mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix manifest file was saved but not enabled.
This commit is contained in:
parent
8138fa9780
commit
3030a9fa2a
|
|
@ -86,7 +86,7 @@ function dolSavePageAlias($filealias, $object, $objectpage)
|
|||
* @param WebsitePage $objectpage Object websitepage
|
||||
* @return boolean True if OK
|
||||
*/
|
||||
function dolSavePageContent($filetpl, $object, $objectpage)
|
||||
function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
|
@ -122,7 +122,19 @@ function dolSavePageContent($filetpl, $object, $objectpage)
|
|||
$tplcontent .= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
|
||||
$tplcontent .= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.' (https://www.dolibarr.org)" />'."\n";
|
||||
$tplcontent .= '<meta name="dolibarr:pageid" content="'.dol_string_nohtmltag($objectpage->id).'" />'."\n";
|
||||
// Add translation reference (main language)
|
||||
$translationof = $objectpage->fk_page;
|
||||
if ($translationof) {
|
||||
$tmppage = new WebsitePage($db);
|
||||
$tmppage->fetch($translationof);
|
||||
if ($tmppage->id > 0) {
|
||||
$tplcontent .= '<link rel="alternate" hreflang="'.$tmppage->lang.'" href="'.($objectpage->pageurl.'.php').'" />'."\n";
|
||||
}
|
||||
}
|
||||
// Add canonical reference
|
||||
$tplcontent .= '<link href="/'.(($objectpage->id == $object->fk_default_home) ? '' : ($objectpage->pageurl.'.php')).'" rel="canonical" />'."\n";
|
||||
// Add manifest.json on homepage
|
||||
$tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n";
|
||||
$tplcontent .= '<!-- Include link to CSS file -->'."\n";
|
||||
$tplcontent .= '<link rel="stylesheet" href="styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'."\n";
|
||||
$tplcontent .= '<!-- Include HTML header from common file -->'."\n";
|
||||
|
|
|
|||
|
|
@ -539,3 +539,5 @@ ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_stock_movement F
|
|||
ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo);
|
||||
|
||||
ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity);
|
||||
|
||||
ALTER TABLE llx_website ADD COLUMN use_manifest integer;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ CREATE TABLE llx_website
|
|||
maincolor varchar(16),
|
||||
maincolorbis varchar(16),
|
||||
status integer DEFAULT 1,
|
||||
fk_default_home integer,
|
||||
fk_default_home integer,
|
||||
use_manifest integer,
|
||||
virtualhost varchar(255),
|
||||
fk_user_creat integer,
|
||||
fk_user_modif integer,
|
||||
|
|
|
|||
|
|
@ -96,6 +96,11 @@ class Website extends CommonObject
|
|||
*/
|
||||
public $virtualhost;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $use_manifest;
|
||||
|
||||
/**
|
||||
* List of containers
|
||||
*
|
||||
|
|
@ -237,6 +242,7 @@ class Website extends CommonObject
|
|||
$sql .= " t.description,";
|
||||
$sql .= " t.status,";
|
||||
$sql .= " t.fk_default_home,";
|
||||
$sql .= " t.use_manifest,";
|
||||
$sql .= " t.virtualhost,";
|
||||
$sql .= " t.fk_user_creat,";
|
||||
$sql .= " t.fk_user_modif,";
|
||||
|
|
@ -264,6 +270,7 @@ class Website extends CommonObject
|
|||
$this->status = $obj->status;
|
||||
$this->fk_default_home = $obj->fk_default_home;
|
||||
$this->virtualhost = $obj->virtualhost;
|
||||
$this->use_manifest = $obj->use_manifest;
|
||||
$this->fk_user_creat = $obj->fk_user_creat;
|
||||
$this->fk_user_modif = $obj->fk_user_modif;
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
|
|
@ -425,6 +432,7 @@ class Website extends CommonObject
|
|||
$sql .= ' description = '.(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").',';
|
||||
$sql .= ' status = '.(isset($this->status) ? $this->status : "null").',';
|
||||
$sql .= ' fk_default_home = '.(($this->fk_default_home > 0) ? $this->fk_default_home : "null").',';
|
||||
$sql .= ' use_manifest = '.((int) $this->use_manifest).',';
|
||||
$sql .= ' virtualhost = '.(($this->virtualhost != '') ? "'".$this->db->escape($this->virtualhost)."'" : "null").',';
|
||||
$sql .= ' fk_user_modif = '.(!isset($this->fk_user_modif) ? $user->id : $this->fk_user_modif).',';
|
||||
$sql .= ' date_creation = '.(!isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').',';
|
||||
|
|
|
|||
|
|
@ -74,6 +74,10 @@ class WebsitePage extends CommonObject
|
|||
* @var string keywords
|
||||
*/
|
||||
public $keywords;
|
||||
/**
|
||||
* @var string language code ('en', 'fr', 'en-gb', ..)
|
||||
*/
|
||||
public $lang;
|
||||
|
||||
public $htmlheader;
|
||||
public $content;
|
||||
|
|
|
|||
|
|
@ -1059,6 +1059,7 @@ if ($action == 'updatecss')
|
|||
if (!$error)
|
||||
{
|
||||
$object->virtualhost = GETPOST('virtualhost', 'alpha');
|
||||
$object->use_manifest = GETPOST('use_manifest', 'alpha');
|
||||
|
||||
$result = $object->update($user);
|
||||
if ($result < 0)
|
||||
|
|
@ -2738,10 +2739,9 @@ if ($action == 'editcss')
|
|||
$htmlhelp .= dol_htmlentitiesbr($manifestjsoncontentdefault);
|
||||
print $form->textwithpicto($langs->trans('WEBSITE_MANIFEST_JSON'), $htmlhelp, 1, 'help', '', 0, 2, 'manifestjsontooltip');
|
||||
print '</td><td>';
|
||||
|
||||
print $langs->trans("UseManifest").': '.$form->selectyesno('use_manifest', $website->use_manifest, 1).'<br>';
|
||||
$doleditor = new DolEditor('WEBSITE_MANIFEST_JSON', $manifestjsoncontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '');
|
||||
print $doleditor->Create(1, '', true, $langs->trans("File").' manifest.json', 'text');
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// README.md
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user