Page to import template easier to understand.
This commit is contained in:
parent
dc86f9528d
commit
5772057723
@ -441,11 +441,13 @@ function showWebsiteTemplates(Website $website)
|
|||||||
|
|
||||||
$colspan = 2;
|
$colspan = 2;
|
||||||
|
|
||||||
$thumbsbyrow = 6;
|
print '<!-- For to import website template -->'."\n";
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
print '<tr class="liste_titre"><th class="titlefield"></th>';
|
print '<tr class="liste_titre"><th class="titlefield">';
|
||||||
|
print $form->textwithpicto($langs->trans("Templates"), $langs->trans("ThemeDir").' : '.join(", ", $dirthemes));
|
||||||
|
print '</th>';
|
||||||
print '<th class="right">';
|
print '<th class="right">';
|
||||||
$url = 'https://www.dolistore.com/43-web-site-templates';
|
$url = 'https://www.dolistore.com/43-web-site-templates';
|
||||||
print '<a href="'.$url.'" target="_blank">';
|
print '<a href="'.$url.'" target="_blank">';
|
||||||
@ -453,73 +455,68 @@ function showWebsiteTemplates(Website $website)
|
|||||||
print '</a>';
|
print '</a>';
|
||||||
print '</th></tr>';
|
print '</th></tr>';
|
||||||
|
|
||||||
print '<tr>';
|
|
||||||
print '<td>'.$langs->trans("ThemeDir").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
foreach ($dirthemes as $dirtheme)
|
|
||||||
{
|
|
||||||
echo '"'.$dirtheme.'" ';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '<tr><td colspan="'.$colspan.'">';
|
print '<tr><td colspan="'.$colspan.'">';
|
||||||
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td><div class="center">';
|
print '<table class="nobordernopadding" width="100%"><tr><td><div class="center">';
|
||||||
|
|
||||||
$i = 0;
|
if (count($dirthemes)) {
|
||||||
foreach ($dirthemes as $dir)
|
$i = 0;
|
||||||
{
|
foreach ($dirthemes as $dir)
|
||||||
//print $dirroot.$dir;exit;
|
|
||||||
$dirtheme = DOL_DATA_ROOT.$dir; // This include loop on $conf->file->dol_document_root
|
|
||||||
if (is_dir($dirtheme))
|
|
||||||
{
|
{
|
||||||
$handle = opendir($dirtheme);
|
//print $dirroot.$dir;exit;
|
||||||
if (is_resource($handle))
|
$dirtheme = DOL_DATA_ROOT.$dir; // This include loop on $conf->file->dol_document_root
|
||||||
|
if (is_dir($dirtheme))
|
||||||
{
|
{
|
||||||
while (($subdir = readdir($handle)) !== false)
|
$handle = opendir($dirtheme);
|
||||||
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
if (is_file($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
|
while (($subdir = readdir($handle)) !== false)
|
||||||
&& substr($subdir, 0, 3) <> 'CVS' && preg_match('/\.zip$/i', $subdir))
|
|
||||||
{
|
{
|
||||||
$subdirwithoutzip = preg_replace('/\.zip$/i', '', $subdir);
|
if (is_file($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
|
||||||
|
&& substr($subdir, 0, 3) <> 'CVS' && preg_match('/\.zip$/i', $subdir))
|
||||||
|
{
|
||||||
|
$subdirwithoutzip = preg_replace('/\.zip$/i', '', $subdir);
|
||||||
|
|
||||||
// Disable not stable themes (dir ends with _exp or _dev)
|
// Disable not stable themes (dir ends with _exp or _dev)
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) continue;
|
if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) continue;
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir)) continue;
|
if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir)) continue;
|
||||||
|
|
||||||
print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
|
print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
|
||||||
|
|
||||||
$file = $dirtheme."/".$subdirwithoutzip.".jpg";
|
$file = $dirtheme."/".$subdirwithoutzip.".jpg";
|
||||||
$url = DOL_URL_ROOT.'/viewimage.php?modulepart=doctemplateswebsite&file='.$subdirwithoutzip.".jpg";
|
$url = DOL_URL_ROOT.'/viewimage.php?modulepart=doctemplateswebsite&file='.$subdirwithoutzip.".jpg";
|
||||||
|
|
||||||
if (!file_exists($file)) $url = DOL_URL_ROOT.'/public/theme/common/nophoto.png';
|
if (!file_exists($file)) $url = DOL_URL_ROOT.'/public/theme/common/nophoto.png';
|
||||||
|
|
||||||
$originalfile = basename($file);
|
$originalfile = basename($file);
|
||||||
$entity = $conf->entity;
|
$entity = $conf->entity;
|
||||||
$modulepart = 'doctemplateswebsite';
|
$modulepart = 'doctemplateswebsite';
|
||||||
$cache = '';
|
$cache = '';
|
||||||
$title = $file;
|
$title = $file;
|
||||||
|
|
||||||
$ret = '';
|
$ret = '';
|
||||||
$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 1, '&entity='.$entity);
|
$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 1, '&entity='.$entity);
|
||||||
if (!empty($urladvanced)) $ret .= '<a class="'.$urladvanced['css'].'" target="'.$urladvanced['target'].'" mime="'.$urladvanced['mime'].'" href="'.$urladvanced['url'].'">';
|
if (!empty($urladvanced)) $ret .= '<a class="'.$urladvanced['css'].'" target="'.$urladvanced['target'].'" mime="'.$urladvanced['mime'].'" href="'.$urladvanced['url'].'">';
|
||||||
else $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
|
else $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
|
||||||
print $ret;
|
print $ret;
|
||||||
print '<img class="img-skinthumb shadow" src="'.$url.'" border="0" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">';
|
print '<img class="img-skinthumb shadow" src="'.$url.'" border="0" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">';
|
||||||
print '</a>';
|
print '</a>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print $subdir.' ('.dol_print_size(dol_filesize($dirtheme."/".$subdir), 1, 1).')';
|
print $subdir.' ('.dol_print_size(dol_filesize($dirtheme."/".$subdir), 1, 1).')';
|
||||||
print '<br><a href="'.$_SERVER["PHP_SELF"].'?action=importsiteconfirm&website='.$website->ref.'&templateuserfile='.$subdir.'" class="button">'.$langs->trans("Load").'</a>';
|
print '<br><a href="'.$_SERVER["PHP_SELF"].'?action=importsiteconfirm&website='.$website->ref.'&templateuserfile='.$subdir.'" class="button">'.$langs->trans("Load").'</a>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
|
||||||
|
}
|
||||||
|
|
||||||
print '</div></td></tr></table>';
|
print '</div></td></tr></table>';
|
||||||
|
|
||||||
|
|||||||
@ -3052,7 +3052,6 @@ if ($action == 'importsite')
|
|||||||
|
|
||||||
showWebsiteTemplates($website);
|
showWebsiteTemplates($website);
|
||||||
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user