diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 7af2eec62ba..645f0673ca0 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -62,6 +62,8 @@ UPDATE llx_website_page SET lang = 'pt' WHERE lang like 'pt_%'; ALTER TABLE llx_website ADD COLUMN lang varchar(8); ALTER TABLE llx_website ADD COLUMN otherlang varchar(255); +ALTER TABLE llx_website_page ADD COLUMN author_alias varchar(64); + ALTER TABLE llx_holiday_users DROP INDEX uk_holiday_users; ALTER TABLE llx_holiday_users ADD UNIQUE INDEX uk_holiday_users(fk_user, fk_type); diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql index 840e12e0141..bacbc8e802b 100644 --- a/htdocs/install/mysql/tables/llx_website_page.sql +++ b/htdocs/install/mysql/tables/llx_website_page.sql @@ -36,6 +36,7 @@ CREATE TABLE llx_website_page grabbed_from varchar(255), fk_user_creat integer, fk_user_modif integer, + author_alias varchar(64), date_creation datetime, tms timestamp, import_key varchar(14) -- import key diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index dc21411342c..eac0d7aaf30 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -124,4 +124,5 @@ YouTryToAccessToAFileThatIsNotAWebsitePage=You try to access to a page that is n UseTextBetween5And70Chars=For good SEO practices, use a text between 5 and 70 characters MainLanguage=Main language OtherLanguages=Other languages -UseManifest=Provide a manifest.json file \ No newline at end of file +UseManifest=Provide a manifest.json file +PublicAuthorAlias=Public author alias \ No newline at end of file diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index ece8cff7e3a..3069de349d3 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -98,6 +98,11 @@ class WebsitePage extends CommonObject */ public $date_modification; + /** + * @var string author_alias + */ + public $author_alias; + const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; @@ -128,7 +133,8 @@ class WebsitePage extends CommonObject '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), '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), + 'author_alias' =>array('type'=>'varchar(64)', 'label'=>'AuthorAlias', 'enabled'=>1, 'visible'=>-1, 'index'=>0, 'position'=>511, 'comment'=>'Author alias'), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', '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), ); @@ -199,6 +205,7 @@ class WebsitePage extends CommonObject $sql .= " t.date_creation,"; $sql .= " t.tms as date_modification,"; $sql .= " t.fk_user_creat,"; + $sql .= " t.author_alias,"; $sql .= " t.fk_user_modif"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; //$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level @@ -246,6 +253,7 @@ class WebsitePage extends CommonObject $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); $this->fk_user_creat = $obj->fk_user_creat; + $this->author_alias = $obj->author_alias; $this->fk_user_modif = $obj->fk_user_modif; } $this->db->free($resql); @@ -300,6 +308,7 @@ class WebsitePage extends CommonObject $sql .= " t.date_creation,"; $sql .= " t.tms as date_modification,"; $sql .= " t.fk_user_creat,"; + $sql .= " t.author_alias,"; $sql .= " t.fk_user_modif"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' WHERE t.fk_website = '.$websiteid; @@ -353,6 +362,7 @@ class WebsitePage extends CommonObject $record->date_creation = $this->db->jdate($obj->date_creation); $record->date_modification = $this->db->jdate($obj->date_modification); $record->fk_user_creat = $obj->fk_user_creat; + $record->author_alias = $obj->author_alias; $record->fk_user_modif = $obj->fk_user_modif; //var_dump($record->id); $records[$record->id] = $record; @@ -533,6 +543,7 @@ class WebsitePage extends CommonObject $object->pageurl = $newref; $object->aliasalt = ''; $object->fk_user_creat = $user->id; + $object->author_alias = ''; $object->date_creation = $now; $object->title = ($newtitle == '1' ? $object->title : ($newtitle ? $newtitle : $object->title)); if (!empty($newlang)) $object->lang = $newlang; @@ -689,5 +700,6 @@ class WebsitePage extends CommonObject $this->date_creation = $now - (24 * 30 * 3600); $this->date_modification = $now - (24 * 7 * 3600); $this->fk_user_creat = $user->id; + $this->author_alias = 'mypublicpseudo'; } } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ed8a863d0a7..1fd59e0423f 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -794,6 +794,7 @@ if ($action == 'addcontainer') $objectpage->image = GETPOST('WEBSITE_IMAGE', 'alpha'); $objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alphanohtml'); $objectpage->htmlheader = GETPOST('htmlheader', 'none'); + $objectpage->author_alias = GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml'); $substitutionarray = array(); $substitutionarray['__WEBSITE_CREATE_BY__'] = $user->getFullName($langs); @@ -1437,6 +1438,7 @@ if ($action == 'updatemeta') $objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alphanohtml'); $objectpage->htmlheader = trim(GETPOST('htmlheader', 'none')); $objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0); + $objectpage->author_alias = trim(GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml')); $newdatecreation = dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int')); if ($newdatecreation) $objectpage->date_creation = $newdatecreation; @@ -3066,6 +3068,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') $pagedatemodification = $objectpage->date_modification; $pageauthorid = $objectpage->fk_user_creat; $pageusermodifid = $objectpage->fk_user_modif; + $pageauthoralias = $objectpage->author_alias; } else { @@ -3073,6 +3076,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') $pagedatecreation = dol_now(); $pageauthorid = $user->id; $pageusermodifid = 0; + $pageauthoralias = ''; } if (GETPOST('WEBSITE_TITLE', 'alpha')) $pagetitle = GETPOST('WEBSITE_TITLE', 'alpha'); if (GETPOST('WEBSITE_PAGENAME', 'alpha')) $pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha'); @@ -3232,6 +3236,12 @@ if ($action == 'editmeta' || $action == 'createcontainer') } print ''; + print '