diff --git a/htdocs/admin/websites.php b/htdocs/admin/websites.php
index 61fa7bc17f3..ee75a811347 100644
--- a/htdocs/admin/websites.php
+++ b/htdocs/admin/websites.php
@@ -73,7 +73,7 @@ $tablib[1] = "Websites";
// Requests to extract data
$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
$tabsqlsort=array();
@@ -81,15 +81,15 @@ $tabsqlsort[1] ="ref ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
-$tabfield[1] = "ref,description";
+$tabfield[1] = "ref,description,virtualhost";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
-$tabfieldvalue[1] = "ref,description";
+$tabfieldvalue[1] = "ref,description,virtualhost";
// Nom des champs dans la table pour insertion d'un enregistrement
$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
// 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
$tabhelp=array();
-$tabhelp[1] = array();
+$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/websiteref'));
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
@@ -126,12 +126,19 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
$ok=1;
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;
$fieldnamekey=$listfield[$f];
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
diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php
index 3760dc04081..db768b4c630 100644
--- a/htdocs/core/class/doleditor.class.php
+++ b/htdocs/core/class/doleditor.class.php
@@ -52,7 +52,7 @@ class DolEditor
* @param string $content Content of WYSIWIG field
* @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 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 :
* 'In' each window has its own toolbar
* '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 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 $option For ACE editor, set the source language ('html', 'php', 'javascript', ...)
* @return void|string
*/
- function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='')
+ function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='', $option='')
{
global $conf,$langs;
@@ -254,21 +255,21 @@ class DolEditor
if (preg_match('/^ace/', $this->tool))
{
$found=1;
- $format=(GETPOST('format','aZ09')?GETPOST('format','aZ09'):'php');
+ $format=$option;
- $out.= ''."\n";
+ $out.= "\n".''."\n";
if ($titlecontent)
{
- $out.= '
';
$out.= ''."\n";
diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang
index cc2f31143ce..18d9193b3f9 100644
--- a/htdocs/langs/en_US/website.lang
+++ b/htdocs/langs/en_US/website.lang
@@ -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 %s 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.
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: %s URL served by external server: %s
PreviewSiteServedByDolibarr=Preview %s in a new tab.
The %s will be served by Dolibarr server so it does not need any extra web server (like Apache, Nginx, IIS) to be installed. The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr. URL served by Dolibarr: %s
To use your own external web server to serve this web site, create a virtual host on your web server that point on directory %s 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
\ No newline at end of file
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 1fc949c6f02..d789dc77b55 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -611,7 +611,7 @@ if (! dol_is_dir($dirins))
}
$dirins_ok=(dol_is_dir($dirins));
-llxHeader('', $langs->trans("ModuleBuilder"), "", '', 0, 0,
+llxHeader('', $langs->trans("ModuleBuilder"), '', '', 0, 0,
array(
'/includes/ace/ace.js',
'/includes/ace/ext-statusbar.js',
@@ -998,7 +998,7 @@ elseif (! empty($module))
dol_fiche_head($head2, $tab, '', -1, '');
$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();
@@ -1052,7 +1052,7 @@ elseif (! empty($module))
print '';
$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 ' ';
print '