* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/admin/website.php * \ingroup website * \brief Page to setup the module Website */ /** * Show HTML header HTML + BODY + Top menu + left menu + DIV * * @param string $head Optionnal head lines * @param string $title HTML title * @param string $help_url Url links to help page * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage * For other external page: http://server/url * @param string $target Target to use on links * @param int $disablejs More content into html header * @param int $disablehead More content into html header * @param array $arrayofjs Array of complementary js files * @param array $arrayofcss Array of complementary css files * @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) * @return void */ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='') { global $conf; // html header top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // top menu and left menu area if (empty($conf->dol_hide_topmenu)) { top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring, $help_url); } if (empty($conf->dol_hide_leftmenu)) { left_menu('', $help_url, '', '', 1, $title, 1); } // main area //main_area($title); } require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php'; require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php'; $langs->load("admin"); $langs->load("other"); $langs->load("website"); if (! $user->admin) accessforbidden(); $conf->dol_hide_leftmenu = 1; $error=0; $website=GETPOST('website', 'alpha'); $page=GETPOST('page', 'alpha'); $action = GETPOST('action','alpha'); if (GETPOST('preview')) $action='preview'; if (GETPOST('editmeta')) { $action='editmeta'; } if (GETPOST('editmenu')) { $action='editmenu'; } if (GETPOST('editcontent')) { $action='editcontent'; } if (empty($action)) $action='preview'; $object=new Website($db); $objectpage=new WebsitePage($db); /* * Actions */ // Action mise a jour ou ajout d'une constante if ($action == 'update') { $db->begin(); $object->fetch(0, $website); $objectpage->fk_website = $object->id; $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME'); $res = $objectpage->fetch(0, $object->fk_website, $objectpage->pageurl); if ($res > 0) { $objectpage->title = GETPOST('WEBSITE_TITLE'); $objectpage->description = GETPOST('WEBSITE_DESCRIPTION'); $objectpage->keyword = GETPOST('WEBSITE_KEYWORD'); $res = $objectpage->update($user); if (! $res > 0) { $error++; setEventMessages($objectpage->error, $objectpage->errors, 'errors'); } if (! $error) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); $action=''; } else { $db->rollback(); } } else { dol_print_error($db); } } /* * View */ $form = new Form($db); $help_url=''; llxHeader('', $langs->trans("WebsiteSetup"), $help_url); print "\n".'
'; print ''; print ''; print ''; print ''; $style=''; if ($action != 'preview') $style=' margin-bottom: 5px;'; print '
'; $tmp = $object->fetchAll(); if (count($object->records) > 0) { print '
'; print $langs->trans("Website").': '; print '
'; print '
'; // Loop on each sites $i=0; foreach($object->records as $key => $websitearray) { if (empty($website)) $website=$websitearray->ref; if ($i) print ' - '; print ''; if ($websitearray->ref == $website) print ''; print $websitearray->ref; if ($websitearray->ref == $website) print ''; print ''; $i++; } print '
'; print '
'; if ($action == 'preview') { $disabled=''; if (empty($user->rights->websites->create)) $disabled=' disabled="disabled"'; print ''; } //else print ''; if (preg_match('/^edit/',$action)) print ''; print '
'; if ($website) { print '
'; print '
'; print '
'; print $langs->trans("Page").': '; print '
'; print '
'; $array=$objectpage->fetchAll(); print $form->selectarray('page', $array); print '
'; print ''; print '
'; if ($action == 'preview') { $disabled=''; if (empty($user->rights->websites->create)) $disabled=' disabled="disabled"'; if ($page) { print ''; print ''; } } else print ''; if (preg_match('/^addpage/',$action)) print ''; print '
'; } } else { print '
'; $langs->load("errors"); print $langs->trans("ErrorModuleSetupNotComplete"); print '
'; $action=''; } print '
'; $head = array(); /* * Edit mode */ if ($action == 'editmeta' || $action == 'addpage') { print ''; print ''; print ''; print ''; print "\n"; print ''; if ($action != 'addpage') { print ''; } print ''; print ''; print ''; print '
'.$langs->trans("Description").''.$langs->trans("Value").'
'; print $langs->trans('WEBSITE_PAGENAME'); print ''; print ''; print '
'; print $langs->trans('WEBSITE_URL'); print ''; print '/public/websites/'.$website.'/index.php?page='.urlencode($page); print '
'; print $langs->trans('WEBSITE_TITLE'); print ''; print ''; print '
'; print $langs->trans('WEBSITE_DESCRIPTION'); print ''; print ''; print '
'; print $langs->trans('WEBSITE_KEYWORDS'); print ''; print ''; print '
'; print '
'; } if ($action == 'editmenu') { print '
'.$langs->trans("FeatureNotYetAvailable").''; } if ($action == 'editcontent') { /* * Editing global variables not related to a specific theme */ print load_fiche_titre($langs->trans("Other"),'',''); require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('WEBSITE_HEADER',$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60); $doleditor->Create(); require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('WEBSITE_CONTENT',$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60); $doleditor->Create(); require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('WEBSITE_FOOTER',$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60); $doleditor->Create(); } print ''; if ($action == 'preview') { print '

'.$langs->trans("PreviewOfSiteNotYetAvailable", $website).'


'; print '
'; } llxFooter(); $db->close();