diff --git a/debian/changelog b/debian/changelog
index ea8ec001..ebc73942 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -64,7 +64,8 @@ ldapsaisie (3.0.0-1) UNRELEASED; urgency=medium
* LSselect: Allow multiple type of objects selection
* LStemplate:
- Now offer some new methods moved from LSsession to handle custom JS & CSS:
- addJSscript(), addLibJSscript(), addJSconfigParam(), addCssFile() and addLibCssFile()
+ addJSscript(), addLibJSscript(), addJSconfigParam(), addHelpInfos() (renamed as
+ addHelpInfo()), addCssFile() and addLibCssFile()
- fatal_error() method now use LStemplate methods to assign variables and display
template instead of directly use Smarty methods.
* Interface is now responsive
diff --git a/doc/upgrade/upgrade.docbook b/doc/upgrade/upgrade.docbook
index 4f1d4b3f..f91ff1d6 100644
--- a/doc/upgrade/upgrade.docbook
+++ b/doc/upgrade/upgrade.docbook
@@ -161,6 +161,8 @@ grep -Er 'url\(.*\.(png|gif|jpg)' /etc/ldapsaisie/local/css
LSsession :: addJSconfigParam() devient
LStemplate :: addJSconfigParam().
+ LSsession :: addHelpInfos() devient
+ LStemplate :: addHelpInfo().
LSsession :: addCssFile() devient
LStemplate :: addCssFile().
Par ailleurs le paramètre $path disparait et la méthode addLibCssFile
@@ -179,7 +181,7 @@ grep -Er 'url\(.*\.(png|gif|jpg)' /etc/ldapsaisie/local/css
Pour identifier les fichiers concernés, vous pouvez utiliser les commandes suivantes :
- grep -Er 'LSsession *:: *(addJSscript|addLibJSscript|addJSconfigParam|addCssFile|addLibCssFile) *\(' /etc/ldapsaisie/local/
+ grep -Er 'LSsession *:: *(addJSscript|addLibJSscript|addJSconfigParam|addHelpInfos|addCssFile|addLibCssFile) *\(' /etc/ldapsaisie/local/
grep -Er '(LSsession|LStemplate) *:: *addJSscript\(.*local' /etc/ldapsaisie/local/
grep -Er '(LSsession|LStemplate) *:: *addJSscript\(.*\.\.\/' /etc/ldapsaisie/local/
grep -Er '(LSsession|LStemplate) *:: *addCssFile\(.*local' /etc/ldapsaisie/local/
diff --git a/src/includes/class/class.LSform.php b/src/includes/class/class.LSform.php
index ba89203c..ffe7275d 100644
--- a/src/includes/class/class.LSform.php
+++ b/src/includes/class/class.LSform.php
@@ -90,7 +90,7 @@ class LSform {
LStemplate :: addJSscript('LSformElement_field.js');
LStemplate :: addJSscript('LSformElement.js');
- LSsession :: addHelpInfos(
+ LStemplate :: addHelpInfo(
'LSform',
array(
'addFieldBtn' => _('Add a field to add another values.'),
diff --git a/src/includes/class/class.LSformElement_boolean.php b/src/includes/class/class.LSformElement_boolean.php
index 2cc84418..41b22e88 100644
--- a/src/includes/class/class.LSformElement_boolean.php
+++ b/src/includes/class/class.LSformElement_boolean.php
@@ -46,7 +46,7 @@ class LSformElement_boolean extends LSformElement {
$return = $this -> getLabelInfos();
if (!$this -> isFreeze()) {
// Help Infos
- LSsession :: addHelpInfos(
+ LStemplate :: addHelpInfo(
'LSformElement_boolean',
array(
'clear' => _('Reset the choice.')
diff --git a/src/includes/class/class.LSformElement_date.php b/src/includes/class/class.LSformElement_date.php
index 15e93a59..729c6419 100644
--- a/src/includes/class/class.LSformElement_date.php
+++ b/src/includes/class/class.LSformElement_date.php
@@ -146,7 +146,7 @@ class LSformElement_date extends LSformElement {
// value
if (!$this -> isFreeze()) {
// Help Infos
- LSsession :: addHelpInfos(
+ LStemplate :: addHelpInfo(
'LSformElement_date',
array(
'now' => _('Now.'),
diff --git a/src/includes/class/class.LSformElement_image.php b/src/includes/class/class.LSformElement_image.php
index 60779bf6..0a8a0397 100644
--- a/src/includes/class/class.LSformElement_image.php
+++ b/src/includes/class/class.LSformElement_image.php
@@ -47,7 +47,7 @@ class LSformElement_image extends LSformElement {
$return = true;
$id=$this -> name.'_'.rand();
if (!$this -> isFreeze()) {
- LSsession :: addHelpInfos(
+ LStemplate :: addHelpInfo(
'LSformElement_date',
array(
'zoom' => _('Click to enlarge.'),
diff --git a/src/includes/class/class.LSformElement_mail.php b/src/includes/class/class.LSformElement_mail.php
index c93424cb..55484a3b 100644
--- a/src/includes/class/class.LSformElement_mail.php
+++ b/src/includes/class/class.LSformElement_mail.php
@@ -50,7 +50,7 @@ class LSformElement_mail extends LSformElement_text {
var $fieldTemplate = 'LSformElement_uri_field.tpl';
public function getDisplay() {
- LSsession :: addHelpInfos (
+ LStemplate :: addHelpInfo(
'LSformElement_mail',
array(
'mail' => _("Send a mail from here.")
diff --git a/src/includes/class/class.LSformElement_maildir.php b/src/includes/class/class.LSformElement_maildir.php
index 2aa9ee26..fae4fd73 100644
--- a/src/includes/class/class.LSformElement_maildir.php
+++ b/src/includes/class/class.LSformElement_maildir.php
@@ -62,7 +62,7 @@ class LSformElement_maildir extends LSformElement_text {
var $fieldTemplate = 'LSformElement_maildir_field.tpl';
public function getDisplay() {
- LSsession :: addHelpInfos (
+ LStemplate :: addHelpInfo(
'LSformElement_maildir',
array(
'do' => _("Maildir creation/modification on user creation/modification is enabled. Click to disable."),
diff --git a/src/includes/class/class.LSformElement_password.php b/src/includes/class/class.LSformElement_password.php
index df954f61..176dd780 100644
--- a/src/includes/class/class.LSformElement_password.php
+++ b/src/includes/class/class.LSformElement_password.php
@@ -131,7 +131,7 @@ class LSformElement_password extends LSformElement {
if (!$this -> isFreeze()) {
// Help Infos
- LSsession :: addHelpInfos(
+ LStemplate :: addHelpInfo(
'LSformElement_password',
array(
'generate' => _('Generate a password.'),
diff --git a/src/includes/class/class.LSformElement_postaladdress.php b/src/includes/class/class.LSformElement_postaladdress.php
index c50645a6..2b2d8d09 100644
--- a/src/includes/class/class.LSformElement_postaladdress.php
+++ b/src/includes/class/class.LSformElement_postaladdress.php
@@ -67,7 +67,7 @@ class LSformElement_postaladdress extends LSformElement_textarea {
'map_url' => $this -> attr_html -> attribute -> ldapObject -> getFData($map_url_format)
)
);
- LSsession :: addHelpInfos(
+ LStemplate :: addHelpInfo(
'LSformElement_postaladdress',
array(
'viewOnMap' => _('View on map')
diff --git a/src/includes/class/class.LSformElement_rss.php b/src/includes/class/class.LSformElement_rss.php
index d317b765..e9e8ca42 100644
--- a/src/includes/class/class.LSformElement_rss.php
+++ b/src/includes/class/class.LSformElement_rss.php
@@ -44,7 +44,7 @@ class LSformElement_rss extends LSformElement_text {
var $fieldTemplate = 'LSformElement_uri_field.tpl';
public function getDisplay() {
- LSsession :: addHelpInfos (
+ LStemplate :: addHelpInfo(
'LSformElement_rss',
array(
'display' => _("Display RSS stack.")
diff --git a/src/includes/class/class.LSformElement_select.php b/src/includes/class/class.LSformElement_select.php
index 410edea0..178e90ec 100644
--- a/src/includes/class/class.LSformElement_select.php
+++ b/src/includes/class/class.LSformElement_select.php
@@ -46,7 +46,7 @@ class LSformElement_select extends LSformElement {
$return = $this -> getLabelInfos();
$params = array();
if (!$this -> isFreeze()) {
- LSsession :: addHelpInfos (
+ LStemplate :: addHelpInfo(
'LSformElement_select',
array(
'clear' => _("Reset selection.")
diff --git a/src/includes/class/class.LSformElement_select_object.php b/src/includes/class/class.LSformElement_select_object.php
index 8bb6740f..646f1232 100644
--- a/src/includes/class/class.LSformElement_select_object.php
+++ b/src/includes/class/class.LSformElement_select_object.php
@@ -77,7 +77,7 @@ class LSformElement_select_object extends LSformElement {
)
);
- LSsession :: addHelpInfos (
+ LStemplate :: addHelpInfo(
'LSformElement_select_object',
array(
'searchAdd' => _("Fast Add"),
diff --git a/src/includes/class/class.LSformElement_ssh_key.php b/src/includes/class/class.LSformElement_ssh_key.php
index 67edba06..f22478c4 100644
--- a/src/includes/class/class.LSformElement_ssh_key.php
+++ b/src/includes/class/class.LSformElement_ssh_key.php
@@ -51,7 +51,7 @@ class LSformElement_ssh_key extends LSformElement {
}
else {
LStemplate :: addJSscript('LSformElement_ssh_key.js');
- LSsession :: addHelpInfos (
+ LStemplate :: addHelpInfo(
'LSformElement_ssh_key',
array(
'display' => _("Display the full key.")
diff --git a/src/includes/class/class.LSformElement_text.php b/src/includes/class/class.LSformElement_text.php
index eae3846a..fe83662d 100644
--- a/src/includes/class/class.LSformElement_text.php
+++ b/src/includes/class/class.LSformElement_text.php
@@ -51,7 +51,7 @@ class LSformElement_text extends LSformElement {
if ($this -> getParam('html_options')) {
LStemplate :: addJSconfigParam($this -> name, $this -> getParam('html_options'));
}
- LSsession :: addHelpInfos(
+ LStemplate :: addHelpInfo(
'LSformElement_text',
array(
'generate' => _('Generate the value')
diff --git a/src/includes/class/class.LSformElement_textarea.php b/src/includes/class/class.LSformElement_textarea.php
index 7168dbb4..a1fd89fd 100644
--- a/src/includes/class/class.LSformElement_textarea.php
+++ b/src/includes/class/class.LSformElement_textarea.php
@@ -45,7 +45,7 @@ class LSformElement_textarea extends LSformElement {
public function getDisplay(){
$return = $this -> getLabelInfos();
if (!$this -> isFreeze()) {
- LSsession :: addHelpInfos(
+ LStemplate :: addHelpInfo(
'LSformElement_textarea',
array(
'clear' => _('Clear')
diff --git a/src/includes/class/class.LSformElement_url.php b/src/includes/class/class.LSformElement_url.php
index decbfe4c..2ac108c6 100644
--- a/src/includes/class/class.LSformElement_url.php
+++ b/src/includes/class/class.LSformElement_url.php
@@ -45,7 +45,7 @@ class LSformElement_url extends LSformElement_text {
var $fieldTemplate = 'LSformElement_uri_field.tpl';
public function getDisplay() {
- LSsession :: addHelpInfos (
+ LStemplate :: addHelpInfo(
'LSformElement_url',
array(
'go' => _("Display this website."),
diff --git a/src/includes/class/class.LSformElement_xmpp.php b/src/includes/class/class.LSformElement_xmpp.php
index d9165269..762877b8 100644
--- a/src/includes/class/class.LSformElement_xmpp.php
+++ b/src/includes/class/class.LSformElement_xmpp.php
@@ -44,7 +44,7 @@ class LSformElement_xmpp extends LSformElement_text {
var $fieldTemplate = 'LSformElement_uri_field.tpl';
public function getDisplay() {
- LSsession :: addHelpInfos (
+ LStemplate :: addHelpInfo(
'LSformElement_xmpp',
array(
'chat' => _("Chat with this person.")
diff --git a/src/includes/class/class.LSsession.php b/src/includes/class/class.LSsession.php
index c3919822..1cb7d59c 100644
--- a/src/includes/class/class.LSsession.php
+++ b/src/includes/class/class.LSsession.php
@@ -75,9 +75,6 @@ class LSsession {
// Libs JS files to load on page
private static $LibsJSscripts = array();
- // Les paramètres JS à communiquer dans la page
- private static $_JSconfigParams = array();
-
// Les fichiers CSS à charger dans la page
private static $CssFiles = array();
@@ -1625,7 +1622,8 @@ class LSsession {
return;
}
- $data['LSjsConfig'] = self :: $_JSconfigParams;
+ if (class_exists('LStemplate'))
+ $data['LSjsConfig'] = LStemplate :: getJSconfigParam();
// Infos
if((!empty($_SESSION['LSsession_infos']))&&(is_array($_SESSION['LSsession_infos']))) {
@@ -2630,23 +2628,23 @@ class LSsession {
}
/**
- * Ajout d'une information d'aide
+ * Add help info
*
- * @param[in] $group string Le nom du groupe d'infos dans lequels ajouter
- * celle-ci
- * @param[in] $infos array Tableau array(name => value) des infos
+ * @param[in] $group string The group name of this information
+ * @param[in] $info array Array of the information to add (name => value)
*
* @retval void
*/
- public static function addHelpInfos($group,$infos) {
- if (is_array($infos)) {
- if (isset(self :: $_JSconfigParams['helpInfos'][$group]) && is_array(self :: $_JSconfigParams['helpInfos'][$group])) {
- self :: $_JSconfigParams['helpInfos'][$group] = array_merge(self :: $_JSconfigParams['helpInfos'][$group],$infos);
- }
- else {
- self :: $_JSconfigParams['helpInfos'][$group] = $infos;
- }
- }
+ public static function addHelpInfos($group, $info) {
+ LStemplate :: addHelpInfo($group, $info);
+ LSerror :: addErrorCode(
+ 'LSsession_27',
+ array(
+ 'old' => 'LStemplate :: addHelpInfo()',
+ 'new' => 'LStemplate :: addHelpInfo()',
+ 'context' => LSlog :: get_debug_backtrace_context(),
+ )
+ );
}
/**
diff --git a/src/includes/class/class.LStemplate.php b/src/includes/class/class.LStemplate.php
index 884130bf..769362a1 100644
--- a/src/includes/class/class.LStemplate.php
+++ b/src/includes/class/class.LStemplate.php
@@ -566,6 +566,34 @@ class LStemplate extends LSlog_staticLoggerClass {
self :: $JSconfigParams[$name]=$val;
}
+ /**
+ * Get Javascript configuration parameters
+ *
+ * @retval array Javascript configuration parameters
+ */
+ public static function getJSconfigParam() {
+ return self :: $JSconfigParams;
+ }
+
+ /**
+ * Add help info
+ *
+ * @param[in] $group string The group name of this information
+ * @param[in] $info array Array of the information to add (name => value)
+ *
+ * @retval void
+ */
+ public static function addHelpInfo($group, $info) {
+ if (is_array($info)) {
+ if (isset(self :: $JSconfigParams['helpInfo'][$group]) && is_array(self :: $JSconfigParams['helpInfo'][$group])) {
+ self :: $JSconfigParams['helpInfo'][$group] = array_merge(self :: $JSconfigParams['helpInfo'][$group],$info);
+ }
+ else {
+ self :: $JSconfigParams['helpInfo'][$group] = $info;
+ }
+ }
+ }
+
/**
* Add a CSS file to load on page
*
diff --git a/src/includes/js/LSdefault.js b/src/includes/js/LSdefault.js
index 9828cb92..494bfb13 100644
--- a/src/includes/js/LSdefault.js
+++ b/src/includes/js/LSdefault.js
@@ -240,12 +240,12 @@ var LSdefault = new Class({
},
addHelpInfo: function(el,group,name) {
- if ($type(this.LSjsConfig['helpInfos'])) {
+ if ($type(this.LSjsConfig['helpInfo'])) {
if ($type(el)=='element') {
- if ($type(this.LSjsConfig['helpInfos'][group])) {
- if ($type(this.LSjsConfig['helpInfos'][group][name])) {
+ if ($type(this.LSjsConfig['helpInfo'][group])) {
+ if ($type(this.LSjsConfig['helpInfo'][group][name])) {
this.addTip(el);
- el.store('tip:title',this.LSjsConfig['helpInfos'][group][name]);
+ el.store('tip:title',this.LSjsConfig['helpInfo'][group][name]);
}
}
}
@@ -253,11 +253,11 @@ var LSdefault = new Class({
},
setHelpInfo: function(el,group,name) {
- if ($type(this.LSjsConfig['helpInfos'])) {
+ if ($type(this.LSjsConfig['helpInfo'])) {
if ($type(el)=='element') {
- if ($type(this.LSjsConfig['helpInfos'][group])) {
- if ($type(this.LSjsConfig['helpInfos'][group][name])) {
- el.store('tip:title',this.LSjsConfig['helpInfos'][group][name]);
+ if ($type(this.LSjsConfig['helpInfo'][group])) {
+ if ($type(this.LSjsConfig['helpInfo'][group][name])) {
+ el.store('tip:title',this.LSjsConfig['helpInfo'][group][name]);
}
}
}