Work on module website
This commit is contained in:
parent
1bc2bba953
commit
1e7aa4d9b4
@ -73,7 +73,7 @@ $tablib[1] = "Websites";
|
|||||||
|
|
||||||
// Requests to extract data
|
// Requests to extract data
|
||||||
$tabsql=array();
|
$tabsql=array();
|
||||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
||||||
|
|
||||||
// Criteria to sort dictionaries
|
// Criteria to sort dictionaries
|
||||||
$tabsqlsort=array();
|
$tabsqlsort=array();
|
||||||
@ -81,15 +81,15 @@ $tabsqlsort[1] ="ref ASC";
|
|||||||
|
|
||||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||||
$tabfield=array();
|
$tabfield=array();
|
||||||
$tabfield[1] = "ref,description";
|
$tabfield[1] = "ref,description,virtualhost";
|
||||||
|
|
||||||
// Nom des champs d'edition pour modification d'un enregistrement
|
// Nom des champs d'edition pour modification d'un enregistrement
|
||||||
$tabfieldvalue=array();
|
$tabfieldvalue=array();
|
||||||
$tabfieldvalue[1] = "ref,description";
|
$tabfieldvalue[1] = "ref,description,virtualhost";
|
||||||
|
|
||||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||||
$tabfieldinsert=array();
|
$tabfieldinsert=array();
|
||||||
$tabfieldinsert[1] = "ref,description,entity";
|
$tabfieldinsert[1] = "ref,description,virtualhost,entity";
|
||||||
|
|
||||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||||
// Example: "" if id field is "rowid" and has autoincrement on
|
// Example: "" if id field is "rowid" and has autoincrement on
|
||||||
@ -103,7 +103,7 @@ $tabcond[1] = (! empty($conf->websites->enabled));
|
|||||||
|
|
||||||
// List of help for fields
|
// List of help for fields
|
||||||
$tabhelp=array();
|
$tabhelp=array();
|
||||||
$tabhelp[1] = array();
|
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/<i>websiteref</i>'));
|
||||||
|
|
||||||
// List of check for fields (NOT USED YET)
|
// List of check for fields (NOT USED YET)
|
||||||
$tabfieldcheck=array();
|
$tabfieldcheck=array();
|
||||||
@ -126,12 +126,19 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
|||||||
$ok=1;
|
$ok=1;
|
||||||
foreach ($listfield as $f => $value)
|
foreach ($listfield as $f => $value)
|
||||||
{
|
{
|
||||||
if (! isset($_POST[$value]) || $_POST[$value]=='') // Fields that are not mandatory
|
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||||
|
&& (! in_array($listfield[$f], array('virtualhost')))) // Fields that are not mandatory
|
||||||
{
|
{
|
||||||
$ok=0;
|
$ok=0;
|
||||||
$fieldnamekey=$listfield[$f];
|
$fieldnamekey=$listfield[$f];
|
||||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||||
}
|
}
|
||||||
|
if ($value == 'ref' && (preg_match('/[a-zA-Z0-9]/', $_POST[$value])))
|
||||||
|
{
|
||||||
|
$ok=0;
|
||||||
|
$fieldnamekey=$listfield[$f];
|
||||||
|
setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si verif ok et action add, on ajoute la ligne
|
// Si verif ok et action add, on ajoute la ligne
|
||||||
|
|||||||
@ -52,7 +52,7 @@ class DolEditor
|
|||||||
* @param string $content Content of WYSIWIG field
|
* @param string $content Content of WYSIWIG field
|
||||||
* @param int $width Width in pixel of edit area (auto by default)
|
* @param int $width Width in pixel of edit area (auto by default)
|
||||||
* @param int $height Height in pixel of edit area (200px by default)
|
* @param int $height Height in pixel of edit area (200px by default)
|
||||||
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly')
|
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly', 'ace').
|
||||||
* @param string $toolbarlocation Where bar is stored :
|
* @param string $toolbarlocation Where bar is stored :
|
||||||
* 'In' each window has its own toolbar
|
* 'In' each window has its own toolbar
|
||||||
* 'Out:name' share toolbar into the div called 'name'
|
* 'Out:name' share toolbar into the div called 'name'
|
||||||
@ -145,9 +145,10 @@ class DolEditor
|
|||||||
* @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });". Used by CKEditor only.
|
* @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });". Used by CKEditor only.
|
||||||
* @param boolean $disallowAnyContent Disallow to use any content. true=restrict to a predefined list of allowed elements. Used by CKEditor only.
|
* @param boolean $disallowAnyContent Disallow to use any content. true=restrict to a predefined list of allowed elements. Used by CKEditor only.
|
||||||
* @param string $titlecontent Show title content before editor area. Used by ACE editor only.
|
* @param string $titlecontent Show title content before editor area. Used by ACE editor only.
|
||||||
|
* @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', ...)
|
||||||
* @return void|string
|
* @return void|string
|
||||||
*/
|
*/
|
||||||
function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='')
|
function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='', $option='')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
@ -254,21 +255,21 @@ class DolEditor
|
|||||||
if (preg_match('/^ace/', $this->tool))
|
if (preg_match('/^ace/', $this->tool))
|
||||||
{
|
{
|
||||||
$found=1;
|
$found=1;
|
||||||
$format=(GETPOST('format','aZ09')?GETPOST('format','aZ09'):'php');
|
$format=$option;
|
||||||
|
|
||||||
$out.= '<!-- Output Ace editor -->'."\n";
|
$out.= "\n".'<!-- Output Ace editor -->'."\n";
|
||||||
|
|
||||||
if ($titlecontent)
|
if ($titlecontent)
|
||||||
{
|
{
|
||||||
$out.= '<div class="aceeditorstatusbar" id="statusBar">'.$titlecontent;
|
$out.= '<div class="aceeditorstatusbar" id="statusBar'.$this->htmlname.'">'.$titlecontent;
|
||||||
$out.= ' - <a id="morelines" href="#" class="right morelines">'.dol_escape_htmltag($langs->trans("ShowMoreLines")).'</a> ';
|
$out.= ' - <a id="morelines" href="#" class="right morelines'.$this->htmlname.'">'.dol_escape_htmltag($langs->trans("ShowMoreLines")).'</a> ';
|
||||||
$out.= '</div>';
|
$out.= '</div>';
|
||||||
$out.= '<script type="text/javascript" language="javascript">'."\n";
|
$out.= '<script type="text/javascript" language="javascript">'."\n";
|
||||||
$out.= 'jQuery(document).ready(function() {'."\n";
|
$out.= 'jQuery(document).ready(function() {'."\n";
|
||||||
$out.= ' var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
|
$out.= ' var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
|
||||||
var StatusBar = window.ace.require("ace/ext/statusbar").StatusBar; // Init status bar. Need lib ext-statusbar
|
var StatusBar = window.ace.require("ace/ext/statusbar").StatusBar; // Init status bar. Need lib ext-statusbar
|
||||||
var statusBar = new StatusBar(aceEditor, document.getElementById("statusBar")); // Init status bar. Need lib ext-statusbar
|
var statusBar = new StatusBar(aceEditor, document.getElementById("statusBar'.$this->htmlname.'")); // Init status bar. Need lib ext-statusbar
|
||||||
jQuery("#morelines").click(function() {
|
jQuery(".morelines'.$this->htmlname.'").click(function() {
|
||||||
console.log("We click on more lines");
|
console.log("We click on more lines");
|
||||||
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
|
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
|
||||||
aceEditor.setOptions({ maxLines: 500 });
|
aceEditor.setOptions({ maxLines: 500 });
|
||||||
@ -297,8 +298,8 @@ class DolEditor
|
|||||||
enableLiveAutocompletion: false, // the editor completes the statement while you are typing. Need lib ext-language_tools.js
|
enableLiveAutocompletion: false, // the editor completes the statement while you are typing. Need lib ext-language_tools.js
|
||||||
showPrintMargin: false, // hides the vertical limiting strip
|
showPrintMargin: false, // hides the vertical limiting strip
|
||||||
minLines: 10,
|
minLines: 10,
|
||||||
maxLines: 34,
|
maxLines: '.(empty($this->height)?'34':(round($this->height/10))).',
|
||||||
fontSize: "110%" // ensures that the editor fits in the environment
|
fontSize: "110%" // ensures that the editor fits in the environment
|
||||||
});
|
});
|
||||||
|
|
||||||
// defines the style of the editor
|
// defines the style of the editor
|
||||||
@ -311,10 +312,12 @@ class DolEditor
|
|||||||
|
|
||||||
$out.= 'jQuery(document).ready(function() {
|
$out.= 'jQuery(document).ready(function() {
|
||||||
jQuery("#savefile").click(function() {
|
jQuery("#savefile").click(function() {
|
||||||
console.log("We click on savefile button");
|
console.log("We click on savefile button for component '.$this->htmlname.'");
|
||||||
|
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid")
|
||||||
|
console.log(aceEditor.getSession().getValue());
|
||||||
jQuery("#'.$this->htmlname.'").val(aceEditor.getSession().getValue());
|
jQuery("#'.$this->htmlname.'").val(aceEditor.getSession().getValue());
|
||||||
if (strlen(jQuery("#'.$this->htmlname.'").html()) > 0) return true;
|
/*if (jQuery("#'.$this->htmlname.'").html().length > 0) return true;
|
||||||
else return false;
|
else return false;*/
|
||||||
});
|
});
|
||||||
})';
|
})';
|
||||||
$out.= '</script>'."\n";
|
$out.= '</script>'."\n";
|
||||||
|
|||||||
@ -29,4 +29,5 @@ ViewWebsiteInProduction=View web site using home URLs
|
|||||||
SetHereVirtualHost=If you can create, on your web server (Apache, Nginx, ...), a dedicated Virtual Host with PHP enabled and a Root directory on <strong>%s</strong><br>then enter here the virtual hostname you have created, so the preview can be done also using this direct web server access, and not only using Dolibarr server.
|
SetHereVirtualHost=If you can create, on your web server (Apache, Nginx, ...), a dedicated Virtual Host with PHP enabled and a Root directory on <strong>%s</strong><br>then enter here the virtual hostname you have created, so the preview can be done also using this direct web server access, and not only using Dolibarr server.
|
||||||
PreviewSiteServedByWebServer=Preview %s in a new tab.<br><br>The %s will be served by an external web server (like Apache, Nginx, IIS). You must install and setup this server before to point to directory:<br><strong>%s</strong><br>URL served by external server:<br><strong>%s</strong>
|
PreviewSiteServedByWebServer=Preview %s in a new tab.<br><br>The %s will be served by an external web server (like Apache, Nginx, IIS). You must install and setup this server before to point to directory:<br><strong>%s</strong><br>URL served by external server:<br><strong>%s</strong>
|
||||||
PreviewSiteServedByDolibarr=Preview %s in a new tab.<br><br>The %s will be served by Dolibarr server so it does not need any extra web server (like Apache, Nginx, IIS) to be installed.<br>The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr.<br>URL served by Dolibarr:<br><strong>%s</strong><br><br>To use your own external web server to serve this web site, create a virtual host on your web server that point on directory<br><strong>%s</strong><br>then enter the name of this virtual server and click on the other preview button.
|
PreviewSiteServedByDolibarr=Preview %s in a new tab.<br><br>The %s will be served by Dolibarr server so it does not need any extra web server (like Apache, Nginx, IIS) to be installed.<br>The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr.<br>URL served by Dolibarr:<br><strong>%s</strong><br><br>To use your own external web server to serve this web site, create a virtual host on your web server that point on directory<br><strong>%s</strong><br>then enter the name of this virtual server and click on the other preview button.
|
||||||
|
VirtualHostUrlNotDefined=URL of the virtual host served by external web server not defined
|
||||||
NoPageYet=No pages yet
|
NoPageYet=No pages yet
|
||||||
@ -611,7 +611,7 @@ if (! dol_is_dir($dirins))
|
|||||||
}
|
}
|
||||||
$dirins_ok=(dol_is_dir($dirins));
|
$dirins_ok=(dol_is_dir($dirins));
|
||||||
|
|
||||||
llxHeader('', $langs->trans("ModuleBuilder"), "", '', 0, 0,
|
llxHeader('', $langs->trans("ModuleBuilder"), '', '', 0, 0,
|
||||||
array(
|
array(
|
||||||
'/includes/ace/ace.js',
|
'/includes/ace/ace.js',
|
||||||
'/includes/ace/ext-statusbar.js',
|
'/includes/ace/ext-statusbar.js',
|
||||||
@ -998,7 +998,7 @@ elseif (! empty($module))
|
|||||||
dol_fiche_head($head2, $tab, '', -1, '');
|
dol_fiche_head($head2, $tab, '', -1, '');
|
||||||
|
|
||||||
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', '');
|
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', '');
|
||||||
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file);
|
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html'));
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
@ -1052,7 +1052,7 @@ elseif (! empty($module))
|
|||||||
print '<input type="hidden" name="module" value="'.$module.'">';
|
print '<input type="hidden" name="module" value="'.$module.'">';
|
||||||
|
|
||||||
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
|
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
|
||||||
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file);
|
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html'));
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<center>';
|
print '<center>';
|
||||||
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||||
@ -1314,7 +1314,7 @@ elseif (! empty($module))
|
|||||||
print '<input type="hidden" name="module" value="'.$module.'">';
|
print '<input type="hidden" name="module" value="'.$module.'">';
|
||||||
|
|
||||||
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
|
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
|
||||||
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file);
|
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html'));
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<center>';
|
print '<center>';
|
||||||
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||||
@ -1365,7 +1365,7 @@ elseif (! empty($module))
|
|||||||
print '<input type="hidden" name="module" value="'.$module.'">';
|
print '<input type="hidden" name="module" value="'.$module.'">';
|
||||||
|
|
||||||
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
|
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
|
||||||
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file);
|
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html'));
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<center>';
|
print '<center>';
|
||||||
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||||
@ -1410,7 +1410,7 @@ elseif (! empty($module))
|
|||||||
print '<input type="hidden" name="module" value="'.$module.'">';
|
print '<input type="hidden" name="module" value="'.$module.'">';
|
||||||
|
|
||||||
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
|
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
|
||||||
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file);
|
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html'));
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<center>';
|
print '<center>';
|
||||||
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||||
@ -1454,7 +1454,7 @@ elseif (! empty($module))
|
|||||||
print '<input type="hidden" name="module" value="'.$module.'">';
|
print '<input type="hidden" name="module" value="'.$module.'">';
|
||||||
|
|
||||||
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
|
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
|
||||||
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file);
|
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html'));
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<center>';
|
print '<center>';
|
||||||
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||||
|
|||||||
@ -551,6 +551,9 @@ textarea.centpercent {
|
|||||||
.cursormove {
|
.cursormove {
|
||||||
cursor: move;
|
cursor: move;
|
||||||
}
|
}
|
||||||
|
.cursornotallowed {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
.badge {
|
.badge {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
min-width: 10px;
|
min-width: 10px;
|
||||||
@ -3347,6 +3350,9 @@ a.websitebuttonsitepreview img {
|
|||||||
width: 26px;
|
width: 26px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
a.websitebuttonsitepreviewdisabled img {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
@ -3664,7 +3670,7 @@ a.cke_dialog_ui_button_ok span {
|
|||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
#statusBar {
|
.aceeditorstatusbar {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|||||||
@ -551,6 +551,9 @@ textarea.centpercent {
|
|||||||
.cursormove {
|
.cursormove {
|
||||||
cursor: move;
|
cursor: move;
|
||||||
}
|
}
|
||||||
|
.cursornotallowed {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
.badge {
|
.badge {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
min-width: 10px;
|
min-width: 10px;
|
||||||
@ -3747,7 +3750,7 @@ a.cke_dialog_ui_button_ok span {
|
|||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
#statusBar {
|
.aceeditorstatusbar {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|||||||
@ -85,13 +85,13 @@ class Website extends CommonObject
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $virtualhost;
|
public $virtualhost;
|
||||||
|
|
||||||
|
|
||||||
public $records;
|
public $records;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -117,6 +117,7 @@ class Website extends CommonObject
|
|||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
$now=dol_now();
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (isset($this->entity)) {
|
if (isset($this->entity)) {
|
||||||
@ -131,7 +132,8 @@ class Website extends CommonObject
|
|||||||
if (isset($this->status)) {
|
if (isset($this->status)) {
|
||||||
$this->status = trim($this->status);
|
$this->status = trim($this->status);
|
||||||
}
|
}
|
||||||
if (empty($this->date_creation)) $this->date_creation = dol_now();
|
if (empty($this->date_creation)) $this->date_creation = $now;
|
||||||
|
if (empty($this->date_modification)) $this->date_modification = $now;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
@ -146,6 +148,7 @@ class Website extends CommonObject
|
|||||||
$sql.= 'virtualhost,';
|
$sql.= 'virtualhost,';
|
||||||
$sql.= 'fk_user_create';
|
$sql.= 'fk_user_create';
|
||||||
$sql.= 'date_creation';
|
$sql.= 'date_creation';
|
||||||
|
$sql.= 'tmps';
|
||||||
$sql .= ') VALUES (';
|
$sql .= ') VALUES (';
|
||||||
$sql .= ' '.(! isset($this->entity)?'NULL':$this->entity).',';
|
$sql .= ' '.(! isset($this->entity)?'NULL':$this->entity).',';
|
||||||
$sql .= ' '.(! isset($this->ref)?'NULL':"'".$this->db->escape($this->ref)."'").',';
|
$sql .= ' '.(! isset($this->ref)?'NULL':"'".$this->db->escape($this->ref)."'").',';
|
||||||
@ -155,6 +158,7 @@ class Website extends CommonObject
|
|||||||
$sql .= ' '.(! isset($this->virtualhost)?'NULL':$this->virtualhost).',';
|
$sql .= ' '.(! isset($this->virtualhost)?'NULL':$this->virtualhost).',';
|
||||||
$sql .= ' '.(! isset($this->fk_user_create)?$user->id:$this->fk_user_create).',';
|
$sql .= ' '.(! isset($this->fk_user_create)?$user->id:$this->fk_user_create).',';
|
||||||
$sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'");
|
$sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'");
|
||||||
|
$sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_creation)."'");
|
||||||
$sql .= ')';
|
$sql .= ')';
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -230,7 +234,7 @@ class Website extends CommonObject
|
|||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
|
|
||||||
$this->entity = $obj->entity;
|
$this->entity = $obj->entity;
|
||||||
$this->ref = $obj->ref;
|
$this->ref = $obj->ref;
|
||||||
$this->description = $obj->description;
|
$this->description = $obj->description;
|
||||||
@ -297,7 +301,7 @@ class Website extends CommonObject
|
|||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
|
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($sortfield)) {
|
if (!empty($sortfield)) {
|
||||||
$sql .= $this->db->order($sortfield,$sortorder);
|
$sql .= $this->db->order($sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
@ -314,7 +318,7 @@ class Website extends CommonObject
|
|||||||
$line = new self($this->db);
|
$line = new self($this->db);
|
||||||
|
|
||||||
$line->id = $obj->rowid;
|
$line->id = $obj->rowid;
|
||||||
|
|
||||||
$line->entity = $obj->entity;
|
$line->entity = $obj->entity;
|
||||||
$line->ref = $obj->ref;
|
$line->ref = $obj->ref;
|
||||||
$line->description = $obj->description;
|
$line->description = $obj->description;
|
||||||
@ -354,7 +358,7 @@ class Website extends CommonObject
|
|||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
|
|
||||||
if (isset($this->entity)) {
|
if (isset($this->entity)) {
|
||||||
$this->entity = trim($this->entity);
|
$this->entity = trim($this->entity);
|
||||||
}
|
}
|
||||||
@ -552,7 +556,7 @@ class Website extends CommonObject
|
|||||||
$result.= $link . $this->ref . $linkend;
|
$result.= $link . $this->ref . $linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne le libelle du status d'un user (actif, inactif)
|
* Retourne le libelle du status d'un user (actif, inactif)
|
||||||
*
|
*
|
||||||
@ -607,8 +611,8 @@ class Website extends CommonObject
|
|||||||
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise object with example values
|
* Initialise object with example values
|
||||||
* Id must be 0 if object instance is a specimen
|
* Id must be 0 if object instance is a specimen
|
||||||
@ -618,9 +622,9 @@ class Website extends CommonObject
|
|||||||
public function initAsSpecimen()
|
public function initAsSpecimen()
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$this->id = 0;
|
$this->id = 0;
|
||||||
|
|
||||||
$this->entity = 1;
|
$this->entity = 1;
|
||||||
$this->ref = 'myspecimenwebsite';
|
$this->ref = 'myspecimenwebsite';
|
||||||
$this->description = 'A specimen website';
|
$this->description = 'A specimen website';
|
||||||
@ -632,7 +636,7 @@ class Website extends CommonObject
|
|||||||
$this->date_creation = dol_now();
|
$this->date_creation = dol_now();
|
||||||
$this->tms = dol_now();
|
$this->tms = dol_now();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,10 +109,10 @@ class WebsitePage extends CommonObject
|
|||||||
if (isset($this->status)) {
|
if (isset($this->status)) {
|
||||||
$this->status = trim($this->status);
|
$this->status = trim($this->status);
|
||||||
}
|
}
|
||||||
if (isset($this->date_creation)) {
|
if (empty($this->date_creation)) {
|
||||||
$this->date_creation = $now;
|
$this->date_creation = $now;
|
||||||
}
|
}
|
||||||
if (isset($this->date_modification)) {
|
if (empty($this->date_modification)) {
|
||||||
$this->date_modification = $now;
|
$this->date_modification = $now;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ class WebsitePage extends CommonObject
|
|||||||
$sql .= ' content = '.(isset($this->content)?"'".$this->db->escape($this->content)."'":"null").',';
|
$sql .= ' content = '.(isset($this->content)?"'".$this->db->escape($this->content)."'":"null").',';
|
||||||
$sql .= ' status = '.(isset($this->status)?$this->status:"null").',';
|
$sql .= ' status = '.(isset($this->status)?$this->status:"null").',';
|
||||||
$sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').',';
|
$sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').',';
|
||||||
$sql .= ' tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'");
|
//$sql .= ' tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'");
|
||||||
$sql .= ' WHERE rowid=' . $this->id;
|
$sql .= ' WHERE rowid=' . $this->id;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|||||||
@ -70,6 +70,7 @@ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0,
|
|||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
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/files.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.'/websites/class/website.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php';
|
||||||
|
|
||||||
@ -146,8 +147,7 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('refreshsite')) $pageid=0; // If we change the site, we reset the pageid.
|
if (GETPOST('refreshsite')) $pageid=0; // If we change the site, we reset the pageid.
|
||||||
if (GETPOST('refreshpage')) $action='preview';
|
if (GETPOST('refreshpage') && ! in_array($action, array('updatecss'))) $action='preview';
|
||||||
|
|
||||||
|
|
||||||
// Add page
|
// Add page
|
||||||
if ($action == 'add')
|
if ($action == 'add')
|
||||||
@ -241,56 +241,63 @@ if ($action == 'delete')
|
|||||||
// Update css
|
// Update css
|
||||||
if ($action == 'updatecss')
|
if ($action == 'updatecss')
|
||||||
{
|
{
|
||||||
$res = $object->fetch(0, $website);
|
if (GETPOST('refreshsite') || GETPOST('refreshpage')) // If we tried to reload another site/page, we stay on editcss mode.
|
||||||
|
{
|
||||||
|
$action='editcss';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$res = $object->fetch(0, $website);
|
||||||
|
|
||||||
// Html header file
|
// Html header file
|
||||||
$htmlheadercontent = '<!-- BEGIN DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
|
$htmlheadercontent = '<!-- BEGIN DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
|
||||||
$htmlheadercontent.= '<!-- File generated to save common html header - YOU CAN MODIFY DIRECTLY THIS FILE. Change affects all pages of website. -->'."\n";
|
$htmlheadercontent.= '<!-- File generated to save common html header - YOU CAN MODIFY DIRECTLY THIS FILE. Change affects all pages of website. -->'."\n";
|
||||||
$htmlheadercontent.= '<!-- END -->'."\n";
|
$htmlheadercontent.= '<!-- END -->'."\n";
|
||||||
$htmlheadercontent.= GETPOST('WEBSITE_HTML_HEADER');
|
$htmlheadercontent.= GETPOST('WEBSITE_HTML_HEADER');
|
||||||
|
|
||||||
dol_syslog("Save file css into ".$filehtmlheader);
|
dol_syslog("Save file css into ".$filehtmlheader);
|
||||||
|
|
||||||
dol_mkdir($pathofwebsite);
|
dol_mkdir($pathofwebsite);
|
||||||
$result = file_put_contents($filehtmlheader, $htmlheadercontent);
|
$result = file_put_contents($filehtmlheader, $htmlheadercontent);
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK));
|
@chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors');
|
setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Css file
|
// Css file
|
||||||
$csscontent = '<!-- BEGIN DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
|
$csscontent = '<!-- BEGIN DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
|
||||||
$csscontent.= '<!-- File generated to wrap the css file - YOU CAN MODIFY DIRECTLY THIS FILE. Change affects all pages of website. -->'."\n";
|
$csscontent.= '<!-- File generated to wrap the css file - YOU CAN MODIFY DIRECTLY THIS FILE. Change affects all pages of website. -->'."\n";
|
||||||
$csscontent.= '<?php '."\n";
|
$csscontent.= '<?php '."\n";
|
||||||
$csscontent.= "header('Content-type: text/css');\n";
|
$csscontent.= "header('Content-type: text/css');\n";
|
||||||
$csscontent.= "?>"."\n";
|
$csscontent.= "?>"."\n";
|
||||||
$csscontent.= '<!-- END -->'."\n";
|
$csscontent.= '<!-- END -->'."\n";
|
||||||
$csscontent.= GETPOST('WEBSITE_CSS_INLINE');
|
$csscontent.= GETPOST('WEBSITE_CSS_INLINE');
|
||||||
|
|
||||||
dol_syslog("Save file css into ".$filecss);
|
dol_syslog("Save file css into ".$filecss);
|
||||||
|
|
||||||
dol_mkdir($pathofwebsite);
|
dol_mkdir($pathofwebsite);
|
||||||
$result = file_put_contents($filecss, $csscontent);
|
$result = file_put_contents($filecss, $csscontent);
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
|
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages('Failed to write file '.$filecss, null, 'errors');
|
setEventMessages('Failed to write file '.$filecss, null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("Saved"), null, 'mesgs');
|
setEventMessages($langs->trans("Saved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
|
|
||||||
$action='preview';
|
$action='preview';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update page
|
// Update page
|
||||||
@ -458,7 +465,7 @@ if ($action == 'updatemeta')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update page
|
// Update page
|
||||||
if ($action == 'updatecontent' || GETPOST('refreshsite') || GETPOST('refreshpage') || GETPOST('preview'))
|
if ($action == 'updatecontent' || ($action == 'preview' && (GETPOST('refreshsite') || GETPOST('refreshpage') || GETPOST('preview'))))
|
||||||
{
|
{
|
||||||
$object->fetch(0, $website);
|
$object->fetch(0, $website);
|
||||||
|
|
||||||
@ -638,7 +645,13 @@ $form = new Form($db);
|
|||||||
|
|
||||||
$help_url='';
|
$help_url='';
|
||||||
|
|
||||||
llxHeader('', $langs->trans("WebsiteSetup"), $help_url);
|
llxHeader('', $langs->trans("WebsiteSetup"), $help_url, '', 0, 0,
|
||||||
|
array(
|
||||||
|
'/includes/ace/ace.js',
|
||||||
|
'/includes/ace/ext-statusbar.js',
|
||||||
|
'/includes/ace/ext-language_tools.js',
|
||||||
|
//'/includes/ace/ext-chromevox.js'
|
||||||
|
), array());
|
||||||
|
|
||||||
print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST"><div>';
|
print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST"><div>';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -746,12 +759,9 @@ if (count($object->records) > 0)
|
|||||||
|
|
||||||
$urlext=$virtualurl;
|
$urlext=$virtualurl;
|
||||||
$urlint=$urlwithroot.'/public/websites/index.php?website='.$website;
|
$urlint=$urlwithroot.'/public/websites/index.php?website='.$website;
|
||||||
//if (! empty($object->virtualhost))
|
print '<a class="websitebuttonsitepreview'.($urlext?'':' websitebuttonsitepreviewdisabled cursornotallowed').'" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
||||||
//{
|
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:'<span class="error">'.$langs->trans("VirtualHostUrlNotDefined").'</span>'), 1, 'preview_ext');
|
||||||
print '<a class="websitebuttonsitepreview" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
print '</a>';
|
||||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
|
|
||||||
print '</a>';
|
|
||||||
//}
|
|
||||||
|
|
||||||
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
|
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
|
||||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview');
|
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview');
|
||||||
@ -760,9 +770,9 @@ if (count($object->records) > 0)
|
|||||||
|
|
||||||
if (in_array($action, array('editcss','editmenu','create')))
|
if (in_array($action, array('editcss','editmenu','create')))
|
||||||
{
|
{
|
||||||
|
if (preg_match('/^create/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||||
|
if (preg_match('/^edit/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||||
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
||||||
if (preg_match('/^create/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
|
||||||
if (preg_match('/^edit/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -887,9 +897,9 @@ if (count($object->records) > 0)
|
|||||||
}
|
}
|
||||||
if (! in_array($action, array('editcss','editmenu','create')))
|
if (! in_array($action, array('editcss','editmenu','create')))
|
||||||
{
|
{
|
||||||
|
if (preg_match('/^create/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||||
|
if (preg_match('/^edit/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||||
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
||||||
if (preg_match('/^create/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
|
||||||
if (preg_match('/^edit/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -953,14 +963,17 @@ if ($action == 'editcss')
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
$csscontent = @file_get_contents($filecss);
|
||||||
|
// Clean the php css file to remove php code and get only css part
|
||||||
|
$csscontent = preg_replace('/<!-- BEGIN DOLIBARR.*END -->/s', '', $csscontent);
|
||||||
|
|
||||||
|
if (! trim($csscontent)) $csscontent='/* CSS content (all website) */';
|
||||||
|
|
||||||
$htmlheader = @file_get_contents($filehtmlheader);
|
$htmlheader = @file_get_contents($filehtmlheader);
|
||||||
// Clean the php css file to remove php code and get only html part
|
// Clean the php css file to remove php code and get only html part
|
||||||
$htmlheader = preg_replace('/<!-- BEGIN DOLIBARR.*END -->/s', '', $htmlheader);
|
$htmlheader = preg_replace('/<!-- BEGIN DOLIBARR.*END -->/s', '', $htmlheader);
|
||||||
|
|
||||||
|
if (! trim($htmlheader)) $htmlheader='<html><!-- HTML header content (all website) --></html>';
|
||||||
$csscontent = @file_get_contents($filecss);
|
|
||||||
// Clean the php css file to remove php code and get only css part
|
|
||||||
$csscontent = preg_replace('/<!-- BEGIN DOLIBARR.*END -->/s', '', $csscontent);
|
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
@ -976,17 +989,25 @@ if ($action == 'editcss')
|
|||||||
print '<tr><td class="tdtop">';
|
print '<tr><td class="tdtop">';
|
||||||
print $langs->trans('WEBSITE_CSS_INLINE');
|
print $langs->trans('WEBSITE_CSS_INLINE');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<textarea class="flat centpercent" rows="20" name="WEBSITE_CSS_INLINE">';
|
|
||||||
|
$doleditor=new DolEditor('WEBSITE_CSS_INLINE', $csscontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '');
|
||||||
|
print $doleditor->Create(1, '', true, 'CSS', 'css');
|
||||||
|
|
||||||
|
/*print '<textarea class="flat centpercent" rows="20" name="WEBSITE_CSS_INLINE">';
|
||||||
print $csscontent;
|
print $csscontent;
|
||||||
print '</textarea>';
|
print '</textarea>';*/
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td class="tdtop">';
|
print '<tr><td class="tdtop">';
|
||||||
print $langs->trans('WEBSITE_HTML_HEADER');
|
print $langs->trans('WEBSITE_HTML_HEADER');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<textarea class="flat centpercent" rows="20" name="WEBSITE_HTML_HEADER">';
|
|
||||||
|
$doleditor=new DolEditor('WEBSITE_HTML_HEADER', $htmlheader, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '');
|
||||||
|
print $doleditor->Create(1, '', true, 'HTML Header', 'html');
|
||||||
|
|
||||||
|
/*print '<textarea class="flat centpercent" rows="20" name="WEBSITE_HTML_HEADER">';
|
||||||
print $htmlheader;
|
print $htmlheader;
|
||||||
print '</textarea>';
|
print '</textarea>';*/
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
/*print '<tr><td>';
|
/*print '<tr><td>';
|
||||||
@ -1032,13 +1053,13 @@ if ($action == 'editmeta' || $action == 'create')
|
|||||||
if (GETPOST('WEBSITE_DESCRIPTION')) $pagedescription=GETPOST('WEBSITE_DESCRIPTION');
|
if (GETPOST('WEBSITE_DESCRIPTION')) $pagedescription=GETPOST('WEBSITE_DESCRIPTION');
|
||||||
if (GETPOST('WEBSITE_KEYWORDS')) $pagekeywords=GETPOST('WEBSITE_KEYWORDS');
|
if (GETPOST('WEBSITE_KEYWORDS')) $pagekeywords=GETPOST('WEBSITE_KEYWORDS');
|
||||||
|
|
||||||
print '<tr><td class="titlefieldcreate">';
|
print '<tr><td class="titlefieldcreate fieldrequired">';
|
||||||
print $langs->trans('WEBSITE_PAGENAME');
|
print $langs->trans('WEBSITE_PAGENAME');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input type="text" class="flat" size="96" name="WEBSITE_PAGENAME" value="'.$pageurl.'">';
|
print '<input type="text" class="flat" size="96" name="WEBSITE_PAGENAME" value="'.$pageurl.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>';
|
print '<tr><td class="fieldrequired">';
|
||||||
print $langs->trans('WEBSITE_TITLE');
|
print $langs->trans('WEBSITE_TITLE');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input type="text" class="flat" size="96" name="WEBSITE_TITLE" value="'.$pagetitle.'">';
|
print '<input type="text" class="flat" size="96" name="WEBSITE_TITLE" value="'.$pagetitle.'">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user