Missing field in website module

This commit is contained in:
Laurent Destailleur 2017-12-02 13:24:21 +01:00
parent 7b47ef3ca1
commit dc04ab3164
5 changed files with 44 additions and 19 deletions

View File

@ -64,6 +64,7 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN default_vat_code varchar(10
ALTER TABLE llx_website_page ADD COLUMN fk_user_create integer; ALTER TABLE llx_website_page ADD COLUMN fk_user_create integer;
ALTER TABLE llx_website_page ADD COLUMN fk_user_modif integer; ALTER TABLE llx_website_page ADD COLUMN fk_user_modif integer;
ALTER TABLE llx_website_page ADD COLUMN type_container varchar(16) NOT NULL DEFAULT 'page';
-- For 7.0 -- For 7.0

View File

@ -20,6 +20,7 @@
CREATE TABLE llx_website CREATE TABLE llx_website
( (
rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY, rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
type_container varchar(16) NOT NULL DEFAULT 'page',
entity integer NOT NULL DEFAULT 1, entity integer NOT NULL DEFAULT 1,
ref varchar(128) NOT NULL, ref varchar(128) NOT NULL,
description varchar(255), description varchar(255),

View File

@ -3,6 +3,7 @@ Shortname=Code
WebsiteSetupDesc=Create here as much entry as number of different websites you need. Then go into menu Websites to edit them. WebsiteSetupDesc=Create here as much entry as number of different websites you need. Then go into menu Websites to edit them.
DeleteWebsite=Delete website DeleteWebsite=Delete website
ConfirmDeleteWebsite=Are you sure you want to delete this web site. All its pages and content will also be removed. ConfirmDeleteWebsite=Are you sure you want to delete this web site. All its pages and content will also be removed.
WEBSITE_TYPE_CONTAINER=Type of page/container
WEBSITE_PAGENAME=Page name/alias WEBSITE_PAGENAME=Page name/alias
WEBSITE_HTML_HEADER=HTML Header (common to all pages) WEBSITE_HTML_HEADER=HTML Header (common to all pages)
HtmlHeaderPage=HTML specific header for page HtmlHeaderPage=HTML specific header for page

View File

@ -53,6 +53,7 @@ class WebsitePage extends CommonObject
public $fk_website; public $fk_website;
public $pageurl; public $pageurl;
public $type_container;
public $title; public $title;
public $description; public $description;
public $keywords; public $keywords;
@ -67,25 +68,26 @@ class WebsitePage extends CommonObject
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. * @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( public $fields=array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'pageurl' =>array('type'=>'varchar(16)', 'label'=>'WEBSITE_PAGENAME', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Alias of page'), 'pageurl' =>array('type'=>'varchar(16)', 'label'=>'WEBSITE_PAGENAME', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Alias of page'),
'title' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1), 'type_container' =>array('type'=>'varchar(16)', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>0, 'position'=>11, 'comment'=>'Type of container'),
'description' =>array('type'=>'varchar(255)', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1), 'title' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
'keywords' =>array('type'=>'varchar(255)', 'label'=>'Keywords', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0), 'description' =>array('type'=>'varchar(255)', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
'lang' =>array('type'=>'varchar(6)', 'label'=>'Lang', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0), 'keywords' =>array('type'=>'varchar(255)', 'label'=>'Keywords', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
'lang' =>array('type'=>'varchar(6)', 'label'=>'Lang', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
//'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>true, 'position'=>1000), //'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>true, 'position'=>1000),
'fk_website' =>array('type'=>'integer', 'label'=>'WebsiteId', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>40, 'searchall'=>0, 'foreignkey'=>'websitepage.rowid'), 'fk_website' =>array('type'=>'integer', 'label'=>'WebsiteId', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>40, 'searchall'=>0, 'foreignkey'=>'websitepage.rowid'),
'fk_page' =>array('type'=>'integer', 'label'=>'ParentPageId', 'enabled'=>1, 'visible'=>1, 'notnull'=>-1, 'position'=>45, 'searchall'=>0, 'foreignkey'=>'website.rowid'), 'fk_page' =>array('type'=>'integer', 'label'=>'ParentPageId', 'enabled'=>1, 'visible'=>1, 'notnull'=>-1, 'position'=>45, 'searchall'=>0, 'foreignkey'=>'website.rowid'),
'htmlheader' =>array('type'=>'text', 'label'=>'HtmlHeader', 'enabled'=>1, 'visible'=>0, 'position'=>50, 'searchall'=>0), 'htmlheader' =>array('type'=>'text', 'label'=>'HtmlHeader', 'enabled'=>1, 'visible'=>0, 'position'=>50, 'searchall'=>0),
'content' =>array('type'=>'mediumtext', 'label'=>'Content', 'enabled'=>1, 'visible'=>0, 'position'=>51, 'searchall'=>0), 'content' =>array('type'=>'mediumtext', 'label'=>'Content', 'enabled'=>1, 'visible'=>0, 'position'=>51, 'searchall'=>0),
'grabbed_from' =>array('type'=>'varchar(255)', 'label'=>'GrabbedFrom', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>400, 'comment'=>'URL page content was grabbed from'), 'grabbed_from' =>array('type'=>'varchar(255)', 'label'=>'GrabbedFrom', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>400, 'comment'=>'URL page content was grabbed from'),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501),
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>502), //'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>502),
//'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>510), //'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>510),
//'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>511), //'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>511),
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1),
); );
// END MODULEBUILDER PROPERTIES // END MODULEBUILDER PROPERTIES
@ -128,6 +130,7 @@ class WebsitePage extends CommonObject
$sql = 'SELECT'; $sql = 'SELECT';
$sql .= ' t.rowid,'; $sql .= ' t.rowid,';
$sql .= " t.fk_website,"; $sql .= " t.fk_website,";
$sql .= ' t.type_container,';
$sql .= " t.pageurl,"; $sql .= " t.pageurl,";
$sql .= " t.title,"; $sql .= " t.title,";
$sql .= " t.description,"; $sql .= " t.description,";
@ -165,6 +168,7 @@ class WebsitePage extends CommonObject
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->fk_website = $obj->fk_website; $this->fk_website = $obj->fk_website;
$this->type_container = $obj->type_container;
$this->pageurl = $obj->pageurl; $this->pageurl = $obj->pageurl;
$this->title = $obj->title; $this->title = $obj->title;
$this->description = $obj->description; $this->description = $obj->description;
@ -214,6 +218,7 @@ class WebsitePage extends CommonObject
$sql = 'SELECT'; $sql = 'SELECT';
$sql .= ' t.rowid,'; $sql .= ' t.rowid,';
$sql .= " t.fk_website,"; $sql .= " t.fk_website,";
$sql .= " t.type_container,";
$sql .= " t.pageurl,"; $sql .= " t.pageurl,";
$sql .= " t.title,"; $sql .= " t.title,";
$sql .= " t.description,"; $sql .= " t.description,";
@ -260,6 +265,7 @@ class WebsitePage extends CommonObject
$record->id = $obj->rowid; $record->id = $obj->rowid;
$record->fk_website = $obj->fk_website; $record->fk_website = $obj->fk_website;
$record->type_container = $obj->type_container;
$record->pageurl = $obj->pageurl; $record->pageurl = $obj->pageurl;
$record->title = $obj->title; $record->title = $obj->title;
$record->description = $obj->description; $record->description = $obj->description;
@ -497,7 +503,8 @@ class WebsitePage extends CommonObject
$now=dol_now(); $now=dol_now();
$this->fk_website = ''; $this->fk_website = '';
$this->pageurl = ''; $this->type_container = 'page';
$this->pageurl = 'specimen';
$this->title = 'My Page'; $this->title = 'My Page';
$this->description = 'This is my page'; $this->description = 'This is my page';
$this->keywords = 'keyword1, keyword2'; $this->keywords = 'keyword1, keyword2';

View File

@ -54,6 +54,8 @@ $action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$cancel=GETPOST('cancel','alpha'); $cancel=GETPOST('cancel','alpha');
$type_container=GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha');
$section_dir = GETPOST('section_dir', 'alpha'); $section_dir = GETPOST('section_dir', 'alpha');
$file_manager = GETPOST('file_manager', 'alpha'); $file_manager = GETPOST('file_manager', 'alpha');
@ -144,7 +146,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
if ($action == 'renamefile') $action='file_manager'; // After actions_linkedfiles, if action were renamefile, we set it to 'file_manager' if ($action == 'renamefile') $action='file_manager'; // After actions_linkedfiles, if action were renamefile, we set it to 'file_manager'
// Add directory // Add directory
if ($action == 'add' && $permtouploadfile) /*
if ($action == 'adddir' && $permtouploadfile)
{ {
$ecmdir->ref = 'NOTUSEDYET'; $ecmdir->ref = 'NOTUSEDYET';
$ecmdir->label = GETPOST("label"); $ecmdir->label = GETPOST("label");
@ -164,7 +167,7 @@ if ($action == 'add' && $permtouploadfile)
clearstatcache(); clearstatcache();
} }
*/
// Remove directory // Remove directory
if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes') if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes')
@ -276,6 +279,7 @@ if ($action == 'add')
preg_match('/<head>(.*)<\/head>/is', $tmp['content'], $reg); preg_match('/<head>(.*)<\/head>/is', $tmp['content'], $reg);
$head = $reg[1]; $head = $reg[1];
$objectpage->type_container = 'page';
$objectpage->pageurl = dol_sanitizeFileName(preg_replace('/[\/\.]/','-',$urltograbwithoutdomainandparam)); $objectpage->pageurl = dol_sanitizeFileName(preg_replace('/[\/\.]/','-',$urltograbwithoutdomainandparam));
if (empty($objectpage->pageurl)) if (empty($objectpage->pageurl))
{ {
@ -454,6 +458,7 @@ if ($action == 'add')
} }
else else
{ {
$objectpage->type_container = GETPOST('WEBSITE_TYPE_CONTAINER','alpha');
$objectpage->title = GETPOST('WEBSITE_TITLE','alpha'); $objectpage->title = GETPOST('WEBSITE_TITLE','alpha');
$objectpage->pageurl = GETPOST('WEBSITE_PAGENAME','alpha'); $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME','alpha');
$objectpage->description = GETPOST('WEBSITE_DESCRIPTION','alpha'); $objectpage->description = GETPOST('WEBSITE_DESCRIPTION','alpha');
@ -621,7 +626,7 @@ if ($action == 'delete')
// Update css // Update css
if ($action == 'updatecss') if ($action == 'updatecss')
{ {
if (GETPOST('refreshsite') || GETPOST('refreshpage')) // If we tried to reload another site/page, we stay on editcss mode. if (GETPOST('refreshsite','alpha') || GETPOST('refreshpage','alpha')) // If we tried to reload another site/page, we stay on editcss mode.
{ {
$action='editcss'; $action='editcss';
} }
@ -859,6 +864,7 @@ if ($action == 'updatemeta')
{ {
$objectpage->old_object = clone $objectpage; $objectpage->old_object = clone $objectpage;
$objectpage->type_container = GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha');
$objectpage->pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha'); $objectpage->pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha');
$objectpage->title = GETPOST('WEBSITE_TITLE', 'alpha'); $objectpage->title = GETPOST('WEBSITE_TITLE', 'alpha');
$objectpage->description = GETPOST('WEBSITE_DESCRIPTION', 'alpha'); $objectpage->description = GETPOST('WEBSITE_DESCRIPTION', 'alpha');
@ -1379,6 +1385,7 @@ if (count($object->records) > 0)
$out.='<option value="'.$key.'"'; $out.='<option value="'.$key.'"';
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
$out.='>'; $out.='>';
$out.='['.$valpage->type_container.'] ';
$out.=$valpage->pageurl.' - '.$valpage->title; $out.=$valpage->pageurl.' - '.$valpage->title;
if ($object->fk_default_home && $key == $object->fk_default_home) $out.=' ('.$langs->trans("HomePage").')'; if ($object->fk_default_home && $key == $object->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
$out.='</option>'; $out.='</option>';
@ -1766,7 +1773,7 @@ if ($action == 'editmeta' || $action == 'create')
print ' * '.$langs->trans("CreateByFetchingExternalPage").'<br><hr>'; print ' * '.$langs->trans("CreateByFetchingExternalPage").'<br><hr>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td class="titlefieldcreate">'; print '<tr><td class="titlefield">';
print $langs->trans("URL"); print $langs->trans("URL");
print '</td><td>'; print '</td><td>';
print '<input class="flat minwidth300" type="text" name="externalurl" value="'.dol_escape_htmltag(GETPOST('externalurl','alpha')).'" placeholder="http://externalsite/pagetofetch"> '; print '<input class="flat minwidth300" type="text" name="externalurl" value="'.dol_escape_htmltag(GETPOST('externalurl','alpha')).'" placeholder="http://externalsite/pagetofetch"> ';
@ -1803,6 +1810,7 @@ if ($action == 'editmeta' || $action == 'create')
print '</td></tr>'; print '</td></tr>';
*/ */
$type_container=$objectpage->type_container;
$pageurl=$objectpage->pageurl; $pageurl=$objectpage->pageurl;
$pagetitle=$objectpage->title; $pagetitle=$objectpage->title;
$pagedescription=$objectpage->description; $pagedescription=$objectpage->description;
@ -1817,6 +1825,13 @@ if ($action == 'editmeta' || $action == 'create')
if (GETPOST('WEBSITE_LANG','aZ09')) $pagelang=GETPOST('WEBSITE_LANG','aZ09'); if (GETPOST('WEBSITE_LANG','aZ09')) $pagelang=GETPOST('WEBSITE_LANG','aZ09');
if (GETPOST('htmlheader','none')) $pagehtmlheader=GETPOST('htmlheader','none'); if (GETPOST('htmlheader','none')) $pagehtmlheader=GETPOST('htmlheader','none');
print '<tr><td class="titlefield fieldrequired">';
print $langs->trans('WEBSITE_TYPE_CONTAINER');
print '</td><td>';
$arrayoftype=array('page'=>$langs->trans("Page"), 'banner'=>$langs->trans("Banner"), 'blogpost'=>$langs->trans("BlogPost"));
print $form->selectarray('WEBSITE_TYPE_CONTAINER', $arrayoftype, $type_container);
print '</td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'; print '<tr><td class="titlefieldcreate fieldrequired">';
print $langs->trans('WEBSITE_PAGENAME'); print $langs->trans('WEBSITE_PAGENAME');
print '</td><td>'; print '</td><td>';