NEW Can use native php and dolibarr object on pages of module website.
This commit is contained in:
parent
68b3de5b37
commit
a97161b044
@ -195,6 +195,7 @@ class DolEditor
|
|||||||
readOnly : '.($this->readonly?'true':'false').',
|
readOnly : '.($this->readonly?'true':'false').',
|
||||||
htmlEncodeOutput :'.$htmlencode_force.',
|
htmlEncodeOutput :'.$htmlencode_force.',
|
||||||
allowedContent :'.($disallowAnyContent?'false':'true').',
|
allowedContent :'.($disallowAnyContent?'false':'true').',
|
||||||
|
extraAllowedContent : \'\',
|
||||||
fullPage : '.($fullpage?'true':'false').',
|
fullPage : '.($fullpage?'true':'false').',
|
||||||
toolbar: \''.$this->toolbarname.'\',
|
toolbar: \''.$this->toolbarname.'\',
|
||||||
toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').',
|
toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').',
|
||||||
|
|||||||
@ -39,17 +39,17 @@ CKEDITOR.editorConfig = function( config )
|
|||||||
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
||||||
['BidiLtr', 'BidiRtl'],
|
['BidiLtr', 'BidiRtl'],
|
||||||
['Link','Unlink','Anchor'],
|
['Link','Unlink','Anchor'],
|
||||||
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],
|
['Image','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],
|
||||||
['Styles','Format','Font','FontSize'],
|
['Styles','Format','Font','FontSize'],
|
||||||
['TextColor','BGColor'],
|
['TextColor','BGColor'],
|
||||||
['Maximize', 'ShowBlocks','-','About']
|
['Maximize', 'ShowBlocks']
|
||||||
];
|
];
|
||||||
|
|
||||||
// Used for mailing fields
|
// Used for mailing fields
|
||||||
config.toolbar_dolibarr_mailings =
|
config.toolbar_dolibarr_mailings =
|
||||||
[
|
[
|
||||||
['Source','Maximize','Preview'],
|
['Source','Maximize','Preview'],
|
||||||
['Cut','Copy','Paste','-','SpellChecker'],
|
['Cut','Copy','Paste','-','SpellChecker', 'Scayt'],
|
||||||
['Undo','Redo','-','Find','Replace'],
|
['Undo','Redo','-','Find','Replace'],
|
||||||
['Format','Font','FontSize'],
|
['Format','Font','FontSize'],
|
||||||
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
|
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
|
||||||
@ -62,7 +62,7 @@ CKEDITOR.editorConfig = function( config )
|
|||||||
config.toolbar_dolibarr_notes =
|
config.toolbar_dolibarr_notes =
|
||||||
[
|
[
|
||||||
['Source','Maximize'],
|
['Source','Maximize'],
|
||||||
['Cut','Copy','Paste','-','SpellChecker'],
|
['Cut','Copy','Paste','-','SpellChecker', 'Scayt'],
|
||||||
['Undo','Redo','-','Find','Replace'],
|
['Undo','Redo','-','Find','Replace'],
|
||||||
['Format','Font','FontSize'],
|
['Format','Font','FontSize'],
|
||||||
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
|
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
|
||||||
@ -75,7 +75,7 @@ CKEDITOR.editorConfig = function( config )
|
|||||||
config.toolbar_dolibarr_details =
|
config.toolbar_dolibarr_details =
|
||||||
[
|
[
|
||||||
['Source','Maximize'],
|
['Source','Maximize'],
|
||||||
['Cut','Copy','Paste','-','SpellChecker'],
|
['Cut','Copy','Paste','-','SpellChecker', 'Scayt'],
|
||||||
['Format','Font','FontSize'],
|
['Format','Font','FontSize'],
|
||||||
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
|
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
|
||||||
['NumberedList','BulletedList','Outdent','Indent'],
|
['NumberedList','BulletedList','Outdent','Indent'],
|
||||||
|
|||||||
@ -39,17 +39,17 @@ CKEDITOR.editorConfig = function( config )
|
|||||||
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
||||||
['BidiLtr', 'BidiRtl'],
|
['BidiLtr', 'BidiRtl'],
|
||||||
['Link','Unlink','Anchor'],
|
['Link','Unlink','Anchor'],
|
||||||
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],
|
['Image','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],
|
||||||
['Styles','Format','Font','FontSize'],
|
['Styles','Format','Font','FontSize'],
|
||||||
['TextColor','BGColor'],
|
['TextColor','BGColor'],
|
||||||
['Maximize', 'ShowBlocks','-','About']
|
['Maximize', 'ShowBlocks']
|
||||||
];
|
];
|
||||||
|
|
||||||
// Used for mailing fields
|
// Used for mailing fields
|
||||||
config.toolbar_dolibarr_mailings =
|
config.toolbar_dolibarr_mailings =
|
||||||
[
|
[
|
||||||
['Source','Maximize','Preview'],
|
['Source','Maximize','Preview'],
|
||||||
['Cut','Copy','Paste','-','SpellChecker'],
|
['Cut','Copy','Paste','-','SpellChecker', 'Scayt'],
|
||||||
['Undo','Redo','-','Find','Replace'],
|
['Undo','Redo','-','Find','Replace'],
|
||||||
['Format','Font','FontSize'],
|
['Format','Font','FontSize'],
|
||||||
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
|
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
|
||||||
@ -62,7 +62,7 @@ CKEDITOR.editorConfig = function( config )
|
|||||||
config.toolbar_dolibarr_notes =
|
config.toolbar_dolibarr_notes =
|
||||||
[
|
[
|
||||||
['Source','Maximize'],
|
['Source','Maximize'],
|
||||||
['Cut','Copy','Paste','-','SpellChecker'],
|
['Cut','Copy','Paste','-','SpellChecker', 'Scayt'],
|
||||||
['Undo','Redo','-','Find','Replace'],
|
['Undo','Redo','-','Find','Replace'],
|
||||||
['Format','Font','FontSize'],
|
['Format','Font','FontSize'],
|
||||||
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
|
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
|
||||||
@ -75,7 +75,7 @@ CKEDITOR.editorConfig = function( config )
|
|||||||
config.toolbar_dolibarr_details =
|
config.toolbar_dolibarr_details =
|
||||||
[
|
[
|
||||||
['Source','Maximize'],
|
['Source','Maximize'],
|
||||||
['Cut','Copy','Paste','-','SpellChecker'],
|
['Cut','Copy','Paste','-','SpellChecker', 'Scayt'],
|
||||||
['Format','Font','FontSize'],
|
['Format','Font','FontSize'],
|
||||||
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
|
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
|
||||||
['NumberedList','BulletedList','Outdent','Indent'],
|
['NumberedList','BulletedList','Outdent','Indent'],
|
||||||
|
|||||||
@ -325,35 +325,52 @@ if ($action == 'updatemeta')
|
|||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
|
$filemaster=$pathofwebsite.'/master.inc.php';
|
||||||
$fileoldalias=$pathofwebsite.'/'.$objectpage->old_object->pageurl.'.php';
|
$fileoldalias=$pathofwebsite.'/'.$objectpage->old_object->pageurl.'.php';
|
||||||
$filealias=$pathofwebsite.'/'.$objectpage->pageurl.'.php';
|
$filealias=$pathofwebsite.'/'.$objectpage->pageurl.'.php';
|
||||||
|
|
||||||
// Generate the alias.php page
|
|
||||||
//-----------------------------
|
|
||||||
dol_syslog("We regenerate alias page new name=".$filealias.", old name=".$fileoldalias);
|
|
||||||
|
|
||||||
dol_mkdir($pathofwebsite);
|
dol_mkdir($pathofwebsite);
|
||||||
|
|
||||||
|
|
||||||
|
// Now generate the alias.php page
|
||||||
|
dol_syslog("We regenerate the master file");
|
||||||
|
dol_delete_file($filemaster);
|
||||||
|
|
||||||
|
$mastercontent = '<?php'."\n";
|
||||||
|
$mastercontent.= '// File generated to link to the master file'."\n";
|
||||||
|
$mastercontent.= "require '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
|
||||||
|
$mastercontent.= '?>'."\n";
|
||||||
|
$result = file_put_contents($filemaster, $mastercontent);
|
||||||
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
|
@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
|
if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors');
|
||||||
|
|
||||||
|
|
||||||
|
// Now generate the alias.php page
|
||||||
|
dol_syslog("We regenerate alias page new name=".$filealias.", old name=".$fileoldalias);
|
||||||
dol_delete_file($fileoldalias);
|
dol_delete_file($fileoldalias);
|
||||||
|
|
||||||
$aliascontent = '<?php'."\n";
|
$aliascontent = '<?php'."\n";
|
||||||
$aliascontent.= '// File generated to wrap the alias page'."\n";
|
$aliascontent.= '// File generated to wrap the alias page'."\n";
|
||||||
$aliascontent.= "include_once './page".$objectpage->id.".tpl.php'\n";
|
$aliascontent.= "include_once './page".$objectpage->id.".tpl.php';\n";
|
||||||
$aliascontent.= '?>'."\n";
|
$aliascontent.= '?>'."\n";
|
||||||
$result = file_put_contents($filealias, $aliascontent);
|
$result = file_put_contents($filealias, $aliascontent);
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
|
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
if ($result) setEventMessages($langs->trans("Saved"), null, 'mesgs');
|
if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
||||||
else setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
|
||||||
|
|
||||||
|
|
||||||
// Now create the .tpl file (duplicate code with actions updatecontent but we need this to save new header)
|
// Now create the .tpl file (duplicate code with actions updatecontent but we need this to save new header)
|
||||||
dol_syslog("We regenerate the tpl page filetpl=".$filetpl);
|
dol_syslog("We regenerate the tpl page filetpl=".$filetpl);
|
||||||
|
|
||||||
dol_mkdir($pathofwebsite);
|
|
||||||
dol_delete_file($filetpl);
|
dol_delete_file($filetpl);
|
||||||
|
|
||||||
$tplcontent = '<html>'."\n";
|
$tplcontent ='';
|
||||||
|
$tplcontent.= '<?php require "./master.inc.php"; ?>'."\n";
|
||||||
|
$tplcontent.= '<html>'."\n";
|
||||||
$tplcontent.= '<header>'."\n";
|
$tplcontent.= '<header>'."\n";
|
||||||
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
|
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
|
||||||
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
|
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
|
||||||
@ -376,7 +393,7 @@ if ($action == 'updatemeta')
|
|||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
//setEventMessages($langs->trans("Saved"), null, 'mesgs');
|
setEventMessages($langs->trans("Saved"), null, 'mesgs');
|
||||||
//header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid);
|
//header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid);
|
||||||
//exit;
|
//exit;
|
||||||
}
|
}
|
||||||
@ -428,7 +445,9 @@ if ($action == 'updatecontent')
|
|||||||
dol_mkdir($pathofwebsite);
|
dol_mkdir($pathofwebsite);
|
||||||
dol_delete_file($filetpl);
|
dol_delete_file($filetpl);
|
||||||
|
|
||||||
$tplcontent = '<html>'."\n";
|
$tplcontent ='';
|
||||||
|
$tplcontent.= '<?php require "./master.inc.php"; ?>'."\n";
|
||||||
|
$tplcontent.= '<html>'."\n";
|
||||||
$tplcontent.= '<header>'."\n";
|
$tplcontent.= '<header>'."\n";
|
||||||
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
|
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
|
||||||
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
|
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user