From b88c657a4a697d9f9214031f815ee8bcb5ebd07e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Aug 2018 14:24:33 +0200 Subject: [PATCH] Work on website import --- htdocs/langs/en_US/website.lang | 1 + htdocs/website/index.php | 45 +++++++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 48867fedb6f..0615675f226 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -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 diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 0fd4005c19d..24c0b8b6e63 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -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 ''; } +if ($action == 'importsite') +{ + print ''; +} if ($action == 'file_manager') { print ''; @@ -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 ''; print ''; print ''; + if (! $atleastonepage) + { + print ''; + } + else + { + print ''; + } print '   '; @@ -1467,7 +1494,8 @@ if (count($object->records) > 0) print ''; - // Button for website + + // Toolbar for website print '
'; if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone') @@ -1527,16 +1555,12 @@ if (count($object->records) > 0) print '
'; - // ***** Part for pages + // Toolbar for pages - if ($websitekey && ! in_array($action, array('editcss','editmenu'))) + if ($websitekey && ! in_array($action, array('editcss','editmenu','importsite'))) { print ''; // 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 '
'; print '
'; @@ -2060,6 +2084,11 @@ if ($action == 'createsite') print '
'; } +if ($action == 'importsite') +{ + + +} if ($action == 'editmeta' || $action == 'createcontainer') {