Work on website import

This commit is contained in:
Laurent Destailleur 2018-08-16 00:03:19 +02:00
parent ec56ad752c
commit ae9867eead
2 changed files with 40 additions and 2 deletions

View File

@ -85,4 +85,5 @@ SubdirOfPage=Sub-directory dedicated to page
AliasPageAlreadyExists=Alias page <strong>%s</strong> already exists
CorporateHomePage=Corporate Home page
EmptyPage=Empty page
ExternalURLMustStartWithHttp=External URL must start with http:// or https://
ExternalURLMustStartWithHttp=External URL must start with http:// or https://
ZipOfWebsitePackageToImport=Zip file of website package

View File

@ -1301,8 +1301,29 @@ if ($action == 'exportsite')
// Import site
if ($action == 'importsiteconfirm')
{
$object->importWebSite($fileofzip);
$fileofzip = GETPOST('userfile');
if (empty($fileofzip))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors');
$action = 'importsite';
}
else
{
// TODO
$result = $object->importWebSite($fileofzip);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$action = 'importsite';
}
else
{
header("Location: aaaaa");
exit();
}
}
}
@ -2086,8 +2107,24 @@ if ($action == 'createsite')
if ($action == 'importsite')
{
print '<div class="fiche">';
print '<br>';
print_fiche_titre($langs->trans("ImportSite"));
dol_fiche_head(array(), '0', '', -1);
print $langs->trans("ZipOfWebsitePackageToImport").'<br><br>';
print '<input class="flat minwidth400" type="file" name="userfile[]" accept=".zip">';
print '<input type="submit" class="button" name="buttonsubmitimportfile" value="'.dol_escape_htmltag($langs->trans("Upload")).'">';
dol_fiche_end();
print '</div>';
print '<br>';
}
if ($action == 'editmeta' || $action == 'createcontainer')