Work on website import

This commit is contained in:
Laurent Destailleur 2018-08-15 14:24:33 +02:00
parent 7c6f41e04f
commit b88c657a4a
2 changed files with 38 additions and 8 deletions

View File

@ -62,6 +62,7 @@ CreateByFetchingExternalPage=Create page/container by fetching page from externa
OrEnterPageInfoManually=Or create empty page from scratch...
FetchAndCreate=Fetch and Create
ExportSite=Export site
ImportSite=Import site
IDOfPage=Id of page
Banner=Banner
BlogPost=Blog post

View File

@ -68,6 +68,8 @@ if (GETPOST('setashome','alpha')) { $action='setashome'; }
if (GETPOST('editmeta','alpha')) { $action='editmeta'; }
if (GETPOST('editsource','alpha')) { $action='editsource'; }
if (GETPOST('editcontent','alpha')) { $action='editcontent'; }
if (GETPOST('exportsite','alpha')) { $action='exportsite'; }
if (GETPOST('importsite','alpha')) { $action='importsite'; }
if (GETPOST('createfromclone','alpha')) { $action='createfromclone'; }
if (GETPOST('createpagefromclone','alpha')) { $action='createpagefromclone'; }
if (empty($action) && $file_manager) $action='file_manager';
@ -1279,7 +1281,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
}
// Export site
if (GETPOST('exportsite','alpha'))
if ($action == 'exportsite')
{
$fileofzip = $object->exportWebSite();
@ -1296,6 +1298,14 @@ if (GETPOST('exportsite','alpha'))
}
}
// Import site
if ($action == 'importsiteconfirm')
{
$object->importWebSite($fileofzip);
}
/*
@ -1370,6 +1380,10 @@ if ($action == 'edit')
{
print '<input type="hidden" name="action" value="update">';
}
if ($action == 'importsite')
{
print '<input type="hidden" name="action" value="importsiteconfirm">';
}
if ($action == 'file_manager')
{
print '<input type="hidden" name="action" value="file_manager">';
@ -1431,6 +1445,11 @@ if (count($object->records) > 0)
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
}
$array=$objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage=(is_array($array) && count($array) > 0);
if ($websitekey && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone'))
{
$disabled='';
@ -1442,6 +1461,14 @@ if (count($object->records) > 0)
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
print '<input type="submit" class="button nobordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("CloneSite")).'" name="createfromclone">';
print '<input type="submit" class="button nobordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("ExportSite")).'" name="exportsite">';
if (! $atleastonepage)
{
print '<input type="submit" class="button nobordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("ImportSite")).'" name="importsite">';
}
else
{
print '<input type="submit" class="button nobordertransp" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("ImportSite")).'" name="importsite">';
}
print ' &nbsp; ';
@ -1467,7 +1494,8 @@ if (count($object->records) > 0)
print '</div>';
// Button for website
// Toolbar for website
print '<div class="websitetools">';
if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')
@ -1527,16 +1555,12 @@ if (count($object->records) > 0)
print '</div>';
// ***** Part for pages
// Toolbar for pages
if ($websitekey && ! in_array($action, array('editcss','editmenu')))
if ($websitekey && ! in_array($action, array('editcss','editmenu','importsite')))
{
print '</div>'; // Close current websitebar to open a new one
$array=$objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage=(is_array($array) && count($array) > 0);
print '<div class="centpercent websitebar"'.($style?' style="'.$style.'"':'').'">';
print '<div class="websiteselection hideonsmartphoneimp minwidth100 tdoverflowmax100">';
@ -2060,6 +2084,11 @@ if ($action == 'createsite')
print '<br>';
}
if ($action == 'importsite')
{
}
if ($action == 'editmeta' || $action == 'createcontainer')
{