From 3bca0ad07d1223540e7aa5caf118ee5fefc92741 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Oct 2017 21:39:19 +0200 Subject: [PATCH] More modern picto for switch on/off Work on website module --- htdocs/admin/translation.php | 10 +- htdocs/admin/{websites.php => website.php} | 14 +- htdocs/core/lib/functions.lib.php | 19 +- htdocs/core/lib/modulebuilder.lib.php | 9 + ...ebsites.class.php => modWebsite.class.php} | 32 +- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/modulebuilder.lang | 1 + htdocs/modulebuilder/index.php | 18 +- .../template/class/myobject.class.php | 4 +- htdocs/societe/website.php | 241 ++++++--- .../class/website.class.php | 10 +- htdocs/website/class/websiteaccount.class.php | 494 ++++++++++++++++++ .../class/websitepage.class.php | 8 +- htdocs/{websites => website}/index.html | 0 htdocs/{websites => website}/index.php | 58 +- 15 files changed, 752 insertions(+), 168 deletions(-) rename htdocs/admin/{websites.php => website.php} (98%) rename htdocs/core/modules/{modWebsites.class.php => modWebsite.class.php} (80%) rename htdocs/{websites => website}/class/website.class.php (98%) create mode 100644 htdocs/website/class/websiteaccount.class.php rename htdocs/{websites => website}/class/websitepage.class.php (98%) rename htdocs/{websites => website}/index.html (100%) rename htdocs/{websites => website}/index.php (96%) diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index f38406c3df5..4965d6cf759 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -215,20 +215,14 @@ if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) { // Button off, click to enable $enabledisablehtml.=''; - //$enabledisablehtml.=img_picto($langs->trans("Disabled"),'switch_off'); - $enabledisablehtml.=''; - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("EnableOverwriteTranslation"); - $enabledisablehtml.=''; + $enabledisablehtml.=img_picto($langs->trans("Disabled"),'switch_off'); $enabledisablehtml.=''; } else { // Button on, click to disable $enabledisablehtml.=''; - //$enabledisablehtml.=img_picto($langs->trans("Activated"),'switch_on'); - $enabledisablehtml.=''; - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("DisableOverwriteTranslation"); - $enabledisablehtml.=''; + $enabledisablehtml.=img_picto($langs->trans("Activated"),'switch_on'); $enabledisablehtml.=''; } diff --git a/htdocs/admin/websites.php b/htdocs/admin/website.php similarity index 98% rename from htdocs/admin/websites.php rename to htdocs/admin/website.php index 4f829db31df..2dc8a9f1423 100644 --- a/htdocs/admin/websites.php +++ b/htdocs/admin/website.php @@ -16,7 +16,7 @@ */ /** - * \file htdocs/admin/websites.php + * \file htdocs/admin/website.php * \ingroup setup * \brief Page to administer web sites */ @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php'; +require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; $langs->load("errors"); $langs->load("admin"); @@ -99,11 +99,11 @@ $tabrowid[1] = ""; // Condition to show dictionary in setup page $tabcond=array(); -$tabcond[1] = (! empty($conf->websites->enabled)); +$tabcond[1] = (! empty($conf->website->enabled)); // List of help for fields $tabhelp=array(); -$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/websiteref')); +$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/websiteref')); // List of check for fields (NOT USED YET) $tabfieldcheck=array(); @@ -205,7 +205,7 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha')) if ($result) // Add is ok { global $dolibarr_main_data_root; - $pathofwebsite=$dolibarr_main_data_root.'/websites/'.$websitekey; + $pathofwebsite=$dolibarr_main_data_root.'/website/'.$websitekey; $filehtmlheader=$pathofwebsite.'/htmlheader.html'; $filecss=$pathofwebsite.'/styles.css.php'; $filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php'; @@ -283,8 +283,8 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha')) $newname = dol_sanitizeFileName(GETPOST('ref','aZ09')); if ($newname != $website->ref) { - $srcfile=DOL_DATA_ROOT.'/websites/'.$website->ref; - $destfile=DOL_DATA_ROOT.'/websites/'.$newname; + $srcfile=DOL_DATA_ROOT.'/website/'.$website->ref; + $destfile=DOL_DATA_ROOT.'/website/'.$newname; if (dol_is_dir($destfile)) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 538c6593ff3..09c39e8060a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2669,7 +2669,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo */ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly=0, $notitle=0) { - global $conf; + global $conf, $langs; // Define fullpathpicto to use into src if ($pictoisfullpath) @@ -2680,6 +2680,23 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ } else { + if ($picto == 'switch_off') + { + $enabledisablehtml=''; + $enabledisablehtml.=''; + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("EnableOverwriteTranslation"); + $enabledisablehtml.=''; + return $enabledisablehtml; + } + if ($picto == 'switch_on') + { + $enabledisablehtml=''; + $enabledisablehtml.=''; + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("DisableOverwriteTranslation"); + $enabledisablehtml.=''; + return $enabledisablehtml; + } + // We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto $url = DOL_URL_ROOT; $theme = $conf->theme; diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 23d6597b227..28cd88e6a7e 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -254,6 +254,15 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='', $texttoinsert.= "\t".$key." ".$val['type']; if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; + else + { + if ($val['default'] != '') + { + if (preg_match('/^null$/i', $val['default'])) $texttoinsert.= " DEFAULT NULL"; + else if (preg_match('/varchar/', $val['type'])) $texttoinsert.= " DEFAULT '".$db->escape($val['default'])."'"; + else $texttoinsert.= (($val['default'] > 0)?' DEFAULT '.$val['default']:''); + } + } $texttoinsert.= (($val['notnull'] > 0)?' NOT NULL':''); if ($i < count($object->fields)) $texttoinsert.=", "; $texttoinsert.= "\n"; diff --git a/htdocs/core/modules/modWebsites.class.php b/htdocs/core/modules/modWebsite.class.php similarity index 80% rename from htdocs/core/modules/modWebsites.class.php rename to htdocs/core/modules/modWebsite.class.php index 2259a91e15a..c0d4286c5bf 100644 --- a/htdocs/core/modules/modWebsites.class.php +++ b/htdocs/core/modules/modWebsite.class.php @@ -16,11 +16,11 @@ */ /** - * \defgroup websites Module websites - * \brief Websites module descriptor. - * \file htdocs/core/modules/modWebsites.class.php + * \defgroup website Module website + * \brief website module descriptor. + * \file htdocs/core/modules/modWebsite.class.php * \ingroup websites - * \brief Description and activation file for module Websites + * \brief Description and activation file for module Website */ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; @@ -28,7 +28,7 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; /** * Class to describe Websites module */ -class modWebsites extends DolibarrModules +class modWebsite extends DolibarrModules { /** @@ -49,7 +49,7 @@ class modWebsites extends DolibarrModules $this->module_position = 50; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); - $this->description = "Enable to build and serve public websites with CMS features"; + $this->description = "Enable to build and serve public web sites with CMS features"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) @@ -60,11 +60,11 @@ class modWebsites extends DolibarrModules $this->picto='globe'; // Data directories to create when module is enabled - $this->dirs = array("/websites/temp"); + $this->dirs = array("/website/temp"); // Config pages //------------- - $this->config_page_url = array('websites.php'); + $this->config_page_url = array('website.php'); // Dependancies //------------- @@ -80,7 +80,7 @@ class modWebsites extends DolibarrModules // New pages on tabs // ----------------- - $this->tabs[] = array('data'=>'thirdparty:+websites:WebSites:website:$user->rights->websites->read:/societe/website.php?mainmenu=home&id=__ID__'); // To add a new tab identified by code tabname1 + $this->tabs[] = array('data'=>'thirdparty:+website:WebSites:website:($conf->societe->enabled && $user->rights->societe->lire):/societe/website.php?mainmenu=home&id=__ID__'); // To add a new tab identified by code tabname1 // Boxes //------ @@ -88,7 +88,7 @@ class modWebsites extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module - $this->rights_class = 'websites'; + $this->rights_class = 'website'; $r=0; $this->rights[$r][0] = 10001; @@ -114,12 +114,12 @@ class modWebsites extends DolibarrModules $this->menu[$r]=array( 'fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'top', // This is a Left menu entry 'titre'=>'Websites', - 'mainmenu'=>'websites', - 'url'=>'/websites/index.php', - 'langs'=>'websites', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'mainmenu'=>'website', + 'url'=>'/website/index.php', + 'langs'=>'website', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>100, - 'enabled'=>'$conf->websites->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->websites->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'enabled'=>'$conf->website->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'$user->rights->website->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++; @@ -130,7 +130,7 @@ class modWebsites extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='MyWebsitePages'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='globe'; - $keyforclass = 'WebsitePage'; $keyforclassfile='/websites/class/websitepage.class.php'; $keyforelement='Website'; + $keyforclass = 'WebsitePage'; $keyforclassfile='/website/class/websitepage.class.php'; $keyforelement='Website'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; //$keyforselect='myobject'; $keyforelement='myobject'; $keyforaliasextra='extra'; //include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7756f5cc3e5..84564cbb854 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1129,7 +1129,7 @@ SendmailOptionMayHurtBuggedMTA=Feature to send mails using method "PHP mail dire TranslationSetup=Setup of translation TranslationKeySearch=Search a translation key or string TranslationOverwriteKey=Overwrite a translation string -TranslationDesc=How to set displayed application language :
* Systemwide: menu Home - Setup - Display
* Per user: User display setup tab of user card (click on username at the top of the screen). +TranslationDesc=How to set displayed application language :
* Systemwide: menu Home - Setup - Display
* Per user: Use the User display setup tab on user card (click on username at the top of the screen). TranslationOverwriteDesc=You can also override strings filling the following table. Choose your language from "%s" dropdown, insert the translation key string into "%s" and your new translation into "%s" TranslationOverwriteDesc2=You can use the other tab to help you know translation key to use TranslationString=Translation string diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 1ec51989ee6..75a0e16c0ba 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -47,6 +47,7 @@ SpecificationFile=File with business rules LanguageFile=File for language ConfirmDeleteProperty=Are you sure you want to delete the property %s ? This will change code in PHP class but also remove column from table definition of object. NotNull=Not NULL +NotNullDesc=1=Set database to NOT NULL. -1=Allow null values and force value to NULL if empty ('' or 0). SearchAll=Used for 'search all' DatabaseIndex=Database index FileAlreadyExists=File %s already exists diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 40a69851a0e..a6f4e8bc0f1 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1529,7 +1529,7 @@ elseif (! empty($module)) { $reflector = new ReflectionClass($tabobj); $properties = $reflector->getProperties(); // Can also use get_object_vars - $propdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars + //$propdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars //$propstat = $reflector->getStaticProperties(); print load_fiche_titre($langs->trans("Properties"), '', ''); @@ -1553,8 +1553,8 @@ elseif (! empty($module)) print ''; print ''.$langs->trans("Type").''; print ''.$form->textwithpicto($langs->trans("ArrayOfKeyValues"), $langs->trans("ArrayOfKeyValuesDesc")).''; - print ''.$langs->trans("NotNull").''; - //print ''.$langs->trans("DefaultValue").''; + print ''.$form->textwithpicto($langs->trans("NotNull"), $langs->trans("NotNullDesc")).''; + print ''.$langs->trans("DefaultValue").''; print ''.$langs->trans("DatabaseIndex").''; print ''.$langs->trans("Position").''; print ''.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).''; @@ -1576,7 +1576,7 @@ elseif (! empty($module)) print ''; print ''; print ''; - //print ''; + print ''; print ''; print ''; print ''; @@ -1610,7 +1610,7 @@ elseif (! empty($module)) $proparrayofkeyval=$propval['arrayofkeyval']; $propnotnull=$propval['notnull']; $propsearchall=$propval['searchall']; - //$propdefault=$propval['default']; + $propdefault=$propval['default']; $propindex=$propval['index']; $propposition=$propval['position']; $propenabled=$propval['enabled']; @@ -1638,11 +1638,11 @@ elseif (! empty($module)) print ''; print $propnotnull; print ''; - /*print ''; + print ''; print $propdefault; - print '';*/ + print ''; print ''; - print $propindex?'X':''; + print $propindex?'1':''; print ''; print ''; print $propposition; @@ -1657,7 +1657,7 @@ elseif (! empty($module)) print $propisameasure?$propisameasure:''; print ''; print ''; - print $propsearchall?'X':''; + print $propsearchall?'1':''; print ''; print ''; print $propcomment; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index e0a827f8c8c..6abb2f1b9a5 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -80,9 +80,9 @@ class MyObject extends CommonObject public $fields=array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'index'=>1, 'position'=>20), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200'), - 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Amount'), + 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Amount'), 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>45), 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>46), 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 7f390973ec2..68fa531bc2a 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -23,13 +23,17 @@ /** * \file htdocs/societe/website.php - * \ingroup societe + * \ingroup website * \brief Page of web sites accounts */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT.'/websites/class/websiteaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + $langs->load("companies"); @@ -87,97 +91,162 @@ if (empty($reshook)) */ $contactstatic = new Contact($db); +$objectwebsiteaccount = new WebsiteAccount($db); $form = new Form($db); -if ($id > 0) +$langs->load("companies"); + +$object = new Societe($db); +$result = $object->fetch($id); + +$title = $langs->trans("WebisteAccounts"); +llxHeader('', $title); + +$head = societe_prepare_head($object); + +dol_fiche_head($head, 'websites', $langs->trans("ThirdParty"), - 1, 'company'); + +$linkback = '' . $langs->trans("BackToList") . ''; + +dol_banner_tab($object, 'socid', $linkback, ($user->societe_id ? 0 : 1), 'rowid', 'nom'); + +print '
'; + +print '
'; + +print ''; + +// Prefix +if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - - $langs->load("companies"); - - - $object = new Societe($db); - $result = $object->fetch($id); - - $title=$langs->trans("WebisteAccounts"); - llxHeader('',$title); - - $head = societe_prepare_head($object); - - dol_fiche_head($head, 'websites', $langs->trans("ThirdParty"), -1, 'company'); - - $linkback = ''.$langs->trans("BackToList").''; - - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); - - print '
'; - - print '
'; - - print '
'; - - // Prefix - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field - { - print ''; - } - - if ($object->client) - { - print ''; - } - - if ($object->fournisseur) - { - print ''; - } - - print '
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; - print $langs->trans('CustomerCode').''; - print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; - print '
'; - print $langs->trans('SupplierCode').''; - print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; - print '
'; - - print '
'; - - dol_fiche_end(); - - - - $morehtmlcenter=''; - if (! empty($conf->website->enabled)) - { - if (! empty($user->rights->societe->lire)) - { - $morehtmlcenter.=''.$langs->trans("AddWebsiteAccount").''; - } - else - { - $morehtmlcenter.=''.$langs->trans("AddAction").''; - } - } - - print '
'; - - $param='&id='.$id; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - - print_barre_liste($langs->trans("WebsiteAccounts"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1); - - - - - - + print '' . $langs->trans('Prefix') . '' . $object->prefix_comm . ''; } +if ($object->client) { + print ''; + print $langs->trans('CustomerCode') . ''; + print $object->code_client; + if ($object->check_codeclient() != 0) + print ' (' . $langs->trans("WrongCustomerCode") . ')'; + print ''; +} + +if ($object->fournisseur) { + print ''; + print $langs->trans('SupplierCode') . ''; + print $object->code_fournisseur; + if ($object->check_codefournisseur() != 0) + print ' (' . $langs->trans("WrongSupplierCode") . ')'; + print ''; +} + +print ''; + +print ''; + +dol_fiche_end(); + +$morehtmlcenter = ''; +if (! empty($conf->website->enabled)) { + if (! empty($user->rights->societe->lire)) { + $morehtmlcenter .= '' . $langs->trans("AddWebsiteAccount") . ''; + } else { + $morehtmlcenter .= '' . $langs->trans("AddAction") . ''; + } +} + +print '
'; + +$param = '&id=' . $id; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) + $param .= '&contextpage=' . $contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) + $param .= '&limit=' . $limit; + +print_barre_liste($langs->trans("WebsiteAccounts"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, - 1, '', '', '', '', 0, 1, 1); + + + + +// Build and execute select +// -------------------------------------------------------------------- +$sql = 'SELECT '; +foreach($objectwebsiteaccount->fields as $key => $val) +{ + $sql.='t.'.$key.', '; +} +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql=preg_replace('/, $/','', $sql); +$sql.= " FROM ".MAIN_DB_PREFIX."websiteaccount as t"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."websiteaccount_extrafields as ef on (t.rowid = ef.fk_object)"; +$sql.= " WHERE t.entity IN (".getEntity('websiteaccount').")"; +foreach($search as $key => $val) +{ + $mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0); + if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); +} +if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); +// Add where from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $typ=$extrafields->attribute_type[$tmpkey]; + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); + } +} +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook +$sql.=$hookmanager->resPrint; + +/* If a group by is required + $sql.= " GROUP BY " + foreach($objectwebsiteaccount->fields as $key => $val) + { + $sql.='t.'.$key.', '; + } + // Add fields from extrafields + foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : ''); + // Add where from hooks + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $objectwebsiteaccount may have been modified by hook + $sql.=$hookmanager->resPrint; + */ + +$sql.=$db->order($sortfield,$sortorder); + +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit+1, $offset); + +dol_syslog($script_file, LOG_DEBUG); +$resql=$db->query($sql); +if (! $resql) +{ + dol_print_error($db); + exit; +} + + + llxFooter(); diff --git a/htdocs/websites/class/website.class.php b/htdocs/website/class/website.class.php similarity index 98% rename from htdocs/websites/class/website.class.php rename to htdocs/website/class/website.class.php index 8083407bdda..eebe072601b 100644 --- a/htdocs/websites/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -20,8 +20,8 @@ */ /** - * \file websites/website.class.php - * \ingroup websites + * \file website/website.class.php + * \ingroup website * \brief File for the CRUD class of website (Create/Read/Update/Delete) */ @@ -509,8 +509,8 @@ class Website extends CommonObject $oldidforhome=$object->fk_default_home; - $pathofwebsiteold=$dolibarr_main_data_root.'/websites/'.$object->ref; - $pathofwebsitenew=$dolibarr_main_data_root.'/websites/'.$newref; + $pathofwebsiteold=$dolibarr_main_data_root.'/website/'.$object->ref; + $pathofwebsitenew=$dolibarr_main_data_root.'/website/'.$newref; dol_delete_dir_recursive($pathofwebsitenew); $fileindex=$pathofwebsitenew.'/index.php'; @@ -652,7 +652,7 @@ class Website extends CommonObject $label.= '
'; $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; - $link = ' + * Copyright (C) 2014-2016 Juanjo Menent + * Copyright (C) 2015 Florian Henry + * Copyright (C) 2015 Raphaƫl Doursenaud + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 class/websiteaccount.class.php + * \ingroup website + * \brief This file is a CRUD class file for WebsiteAccount (Create/Read/Update/Delete) + */ + +// Put here all includes required by your class file +require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + +/** + * Class for WebsiteAccount + */ +class WebsiteAccount extends CommonObject +{ + /** + * @var string ID to identify managed object + */ + public $element = 'websiteaccount'; + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'websiteaccount'; + + /** + * @var array Does this field is linked to a thirdparty ? + */ + protected $isnolinkedbythird = 1; + /** + * @var array Does websiteaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + */ + protected $ismultientitymanaged = 1; + /** + * @var string String with name of icon for websiteaccount + */ + public $picto = 'websiteaccount@website'; + + + /** + * 'type' if the field format. + * 'label' the translation key. + * 'enabled' is a condition when the filed must be managed. + * 'visible' says if field is visible in list (-1 means not shown by default but can be added into list to be viewed). + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'position' is the sort order of field. + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'help' is a string visible as a tooltip on field + * 'comment' is not used. You can store here any text of your choice. + */ + + // BEGIN MODULEBUILDER PROPERTIES + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields=array( + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), + 'login' => array('type'=>'varchar(64)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Login',), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1,), + 'note_public' => array('type'=>'text', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>45, 'notnull'=>-1,), + 'note_private' => array('type'=>'text', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>46, 'notnull'=>-1,), + 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), + 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), + 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,), + 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'visible'=>-1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,), + 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Active')), + 'fk_soc' => array('type'=>'integer', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1,), + ); + public $rowid; + public $login; + public $label; + public $note_public; + public $note_private; + public $date_creation; + public $tms; + public $fk_user_creat; + public $fk_user_modif; + public $import_key; + public $status; + public $fk_soc; + // END MODULEBUILDER PROPERTIES + + + + // If this object has a subtable with lines + + /** + * @var int Name of subtable line + */ + //public $table_element_line = 'websiteaccountdet'; + /** + * @var int Field with ID of parent key if this field has a parent + */ + //public $fk_element = 'fk_websiteaccount'; + /** + * @var int Name of subtable class that manage subtable lines + */ + //public $class_element_line = 'WebsiteAccountline'; + /** + * @var array Array of child tables (child tables to delete before deleting a record) + */ + //protected $childtables=array('websiteaccountdet'); + /** + * @var WebsiteAccountLine[] Array of subtable lines + */ + //public $lines = array(); + + + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct(DoliDB $db) + { + global $conf; + + $this->db = $db; + + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0; + } + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + return $this->createCommon($user, $notrigger); + } + + /** + * Clone and object into another one + * + * @param User $user User that creates + * @param int $fromid Id of object to clone + * @return mixed New object created, <0 if KO + */ + public function createFromClone(User $user, $fromid) + { + global $hookmanager, $langs; + $error = 0; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $object = new self($this->db); + + $this->db->begin(); + + // Load source object + $object->fetchCommon($fromid); + // Reset some properties + unset($object->id); + unset($object->fk_user_creat); + unset($object->import_key); + + // Clear fields + $object->ref = "copy_of_".$object->ref; + $object->title = $langs->trans("CopyOf")." ".$object->title; + // ... + + // Create clone + $object->context['createfromclone'] = 'createfromclone'; + $result = $object->createCommon($user); + if ($result < 0) { + $error++; + $this->error = $object->error; + $this->errors = $object->errors; + } + + // End + if (!$error) { + $this->db->commit(); + return $object; + } else { + $this->db->rollback(); + return -1; + } + } + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id, $ref = null) + { + $result = $this->fetchCommon($id, $ref); + if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines(); + return $result; + } + + /** + * Load object lines in memory from the database + * + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetchLines() + { + $this->lines=array(); + + // Load lines with object WebsiteAccountLine + + return count($this->lines)?1:0; + } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + return $this->updateCommon($user, $notrigger); + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + } + + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) + { + global $db, $conf, $langs; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $result = ''; + $companylink = ''; + + $label = '' . $langs->trans("WebsiteAccount") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $url = dol_buildpath('/website/websiteaccount_card.php',1).'?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowWebsiteAccount"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = '
'; + $linkend=''; + + if ($withpicto) + { + $result.=($linkstart.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend); + if ($withpicto != 2) $result.=' '; + } + $result.= $linkstart . $this->ref . $linkend; + return $result; + } + + /** + * Return link to download file from a direct external access + * + * @param int $withpicto Add download picto into link + * @return string HTML link to file + */ + function getDirectExternalLink($withpicto=0) + { + return 'todo'; + } + + /** + * Retourne le libelle du status d'un user (actif, inactif) + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->status,$mode); + } + + /** + * Return the status + * + * @param int $status Id status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label of status + */ + static function LibStatut($status,$mode=0) + { + global $langs; + + if ($mode == 0) + { + $prefix=''; + if ($status == 1) return $langs->trans('Enabled'); + if ($status == 0) return $langs->trans('Disabled'); + } + if ($mode == 1) + { + if ($status == 1) return $langs->trans('Enabled'); + if ($status == 0) return $langs->trans('Disabled'); + } + if ($mode == 2) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 3) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); + } + if ($mode == 4) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 5) + { + if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + } + if ($mode == 6) + { + if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + } + } + + /** + * Charge les informations d'ordre info dans l'objet commande + * + * @param int $id Id of order + * @return void + */ + function info($id) + { + $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; + $sql.= ' fk_user_creat, fk_user_modif'; + $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + $sql.= ' WHERE t.rowid = '.$id; + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + $this->id = $obj->rowid; + if ($obj->fk_user_author) + { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } + + if ($obj->fk_user_valid) + { + $vuser = new User($this->db); + $vuser->fetch($obj->fk_user_valid); + $this->user_validation = $vuser; + } + + if ($obj->fk_user_cloture) + { + $cluser = new User($this->db); + $cluser->fetch($obj->fk_user_cloture); + $this->user_cloture = $cluser; + } + + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->datem); + $this->date_validation = $this->db->jdate($obj->datev); + } + + $this->db->free($result); + + } + else + { + dol_print_error($this->db); + } + } + + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + public function initAsSpecimen() + { + $this->initAsSpecimenCommon(); + } + + + /** + * Action executed by scheduler + * CAN BE A CRON TASK + * + * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) + */ + public function doScheduledJob() + { + global $conf, $langs; + + $this->output = ''; + $this->error=''; + + dol_syslog(__METHOD__, LOG_DEBUG); + + // ... + + return 0; + } +} + +/** + * Class WebsiteAccountLine. You can also remove this and generate a CRUD class for lines objects. + */ +/* +class WebsiteAccountLine +{ + // @var int ID + public $id; + // @var mixed Sample line property 1 + public $prop1; + // @var mixed Sample line property 2 + public $prop2; +} +*/ \ No newline at end of file diff --git a/htdocs/websites/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php similarity index 98% rename from htdocs/websites/class/websitepage.class.php rename to htdocs/website/class/websitepage.class.php index 76526f29c0d..e2a5a09da99 100644 --- a/htdocs/websites/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -20,8 +20,8 @@ */ /** - * \file websites/websitepage.class.php - * \ingroup websites + * \file website/websitepage.class.php + * \ingroup website * \brief File for the CRUD class of websitepage (Create/Read/Update/Delete) */ @@ -313,7 +313,7 @@ class WebsitePage extends CommonObject if ($result > 0) { global $dolibarr_main_data_root; - $pathofwebsite=$dolibarr_main_data_root.'/websites/'.$websiteobj->ref; + $pathofwebsite=$dolibarr_main_data_root.'/website/'.$websiteobj->ref; $filealias=$pathofwebsite.'/'.$this->pageurl.'.php'; $filetpl=$pathofwebsite.'/page'.$this->id.'.tpl.php'; @@ -408,7 +408,7 @@ class WebsitePage extends CommonObject $label.= '
'; $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; - $link = 'load("admin"); $langs->load("other"); @@ -96,7 +96,7 @@ if (($pageid > 0 || $pageref) && $action != 'add') } global $dolibarr_main_data_root; -$pathofwebsite=$dolibarr_main_data_root.'/websites/'.$website; +$pathofwebsite=$dolibarr_main_data_root.'/website/'.$website; $filehtmlheader=$pathofwebsite.'/htmlheader.html'; $filecss=$pathofwebsite.'/styles.css.php'; $filejs=$pathofwebsite.'/javascript.js.php'; @@ -831,7 +831,7 @@ if ($action == 'updatemeta') $mastercontent = ''."\n"; $result = file_put_contents($filemaster, $mastercontent); @@ -1090,7 +1090,7 @@ $arrayofjs = array( ); $arrayofcss = array(); -llxHeader('', $langs->trans("WebsiteSetup"), $help_url, '', 0, 0, $arrayofjs, $arrayofcss, '', '', ''."\n".'
'); +llxHeader('', $langs->trans("websiteetup"), $help_url, '', 0, 0, $arrayofjs, $arrayofcss, '', '', ''."\n".'
'); print "\n".'
'; print ''; @@ -1143,16 +1143,16 @@ if (count($object->records) > 0) { // ***** Part for web sites - print '
'; + print '
'; print ''; print '
'; - print '
'; + print '
'; print $langs->trans("Website").': '; print '
'; - // List of websites - print '
'; + // List of website + print '
'; $out=''; $out.=''; print '
'; - print '
'; + print '
'; print $langs->trans("Page").': '; print '
'; - print '
'; + print '
'; if ($action != 'add') { @@ -1296,7 +1296,7 @@ if (count($object->records) > 0) if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone') { $disabled=''; - if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"'; + if (empty($user->rights->website->write)) $disabled=' disabled="disabled"'; // Confirmation to clone if ($action == 'createfromclone') { @@ -1351,7 +1351,7 @@ if (count($object->records) > 0) $websitepage = new WebSitePage($db); $websitepage->fetch($pageid); - $realpage=$urlwithroot.'/public/websites/index.php?website='.$website.'&pageref='.$websitepage->pageurl; + $realpage=$urlwithroot.'/public/website/index.php?website='.$website.'&pageref='.$websitepage->pageurl; $pagealias = $websitepage->pageurl; print 'transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">'; @@ -1365,7 +1365,7 @@ if (count($object->records) > 0) print '
'; $urlext=$virtualurl.'/'.$pagealias.'.php'; - $urlint=$urlwithroot.'/public/websites/index.php?website='.$website; + $urlint=$urlwithroot.'/public/website/index.php?website='.$website; print 'transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext)).'">'; print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $virtualurl?$urlext:''.$langs->trans("VirtualHostUrlNotDefined").''), 1, 'preview_ext'); print ''; @@ -1414,7 +1414,7 @@ if (count($object->records) > 0) url: "'.DOL_URL_ROOT.'/core/ajax/saveinplace.php", data: { field: \'editval_virtualhost\', - element: \'websites\', + element: \'website\', table_element: \'website\', fk_element: '.$object->id.', value: newurl, @@ -1433,7 +1433,7 @@ if (count($object->records) > 0) } else { - print '
'; + print '
'; $langs->load("errors"); print $langs->trans("ErrorModuleSetupNotComplete"); print '
'; @@ -1575,7 +1575,7 @@ if ($action == 'createsite') /*$h = 0; $head = array(); - $head[$h][0] = dol_buildpath('/websites/index.php',1).'?id='.$object->id; + $head[$h][0] = dol_buildpath('/website/index.php',1).'?id='.$object->id; $head[$h][1] = $langs->trans("AddSite"); $head[$h][2] = 'card'; $h++; @@ -1605,7 +1605,7 @@ if ($action == 'createsite') print ''; print ''; - print $form->textwithpicto($langs->trans('Virtualhost'), $langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/websiteref'), 1, 'help', '', 0, 2, 'tooltipvirtual'); + print $form->textwithpicto($langs->trans('Virtualhost'), $langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/websiteref'), 1, 'help', '', 0, 2, 'tooltipvirtual'); print ''; print ''; print ''; @@ -1642,7 +1642,7 @@ if ($action == 'editmeta' || $action == 'create') /*$h = 0; $head = array(); - $head[$h][0] = dol_buildpath('/websites/index.php',1).'?id='.$object->id; + $head[$h][0] = dol_buildpath('/website/index.php',1).'?id='.$object->id; $head[$h][1] = $langs->trans("AddPage"); $head[$h][2] = 'card'; $h++; @@ -1686,7 +1686,7 @@ if ($action == 'editmeta' || $action == 'create') print ''; print $langs->trans('WEBSITE_PAGEURL'); print ''; - print '/public/websites/index.php?website='.urlencode($website).'&pageid='.urlencode($pageid); + print '/public/website/index.php?website='.urlencode($website).'&pageid='.urlencode($pageid); print ''; /* @@ -1875,7 +1875,7 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa //include_once $original_file_osencoded; */ - /*print '';*/ } else @@ -1913,7 +1913,7 @@ function dolSavePageAlias($filealias, $object, $objectpage) $aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n"; $aliascontent.= 'global $dolibarr_main_data_root;'."\n"; $aliascontent.= 'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.'.tpl.php\'; '; - $aliascontent.= 'else require $dolibarr_main_data_root.\'/websites/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n"; + $aliascontent.= 'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n"; $aliascontent.= '?>'."\n"; $result = file_put_contents($filealias, $aliascontent); if (! empty($conf->global->MAIN_UMASK)) @@ -1965,7 +1965,7 @@ function dolSavePageContent($filetpl, $object, $objectpage) $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; - $tplcontent.= 'ref.'/htmlheader.html"); ?>'."\n"; + $tplcontent.= 'ref.'/htmlheader.html"); ?>'."\n"; $tplcontent.= ''."\n"; $tplcontent.= $objectpage->htmlheader."\n"; $tplcontent.= ''."\n";