- select.php & view.php : Correction d'un bug concernant le trie lors d'un

rafraichissement.
- base.css : netoyage
- LSform.js :
  -> initializeLSform_AddAndRemoveBtns() : Modularisation des ajouts 
     d'évenements
  -> Ajout du concept de modules permettant l'initialisation JS à l'ajout d'un
     field vide d'un type avancé
- Ajout de types de champs de formulaire : 
  -> LSformElement_url : Un liens web (URL)
  -> LSformElement_rss : Un lien RSS
- class.LSformElement.php :
  -> ajout de la méthode getTitle() : Texte descriptif du champ
- LSdefault.js : Correction de la déclaration de la variable LSdebug_active
- modify.php : Modification du titre des pages
This commit is contained in:
Benjamin Renard 2008-07-15 16:24:35 +00:00
parent 8d8ede930c
commit 7c37c65366
17 changed files with 415 additions and 17 deletions

View file

@ -0,0 +1,53 @@
<?php
/*******************************************************************************
* Copyright (C) 2007 Easter-eggs
* http://ldapsaisie.labs.libre-entreprise.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
/**
* Type d'attribut HTML RSS
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSattr_html_rss extends LSattr_html {
/**
* Ajoute l'attribut au formualaire passer en paramètre
*
* @param[in] &$form LSform Le formulaire
* @param[in] $idForm L'identifiant du formulaire
* @param[in] $data Valeur du champs du formulaire
*
* @retval LSformElement L'element du formulaire ajouté
*/
function addToForm (&$form,$idForm,$data=NULL) {
$element=$form -> addElement('rss', $this -> name, $this -> config['label'],$this -> config, $this);
if(!$element) {
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name);
return;
}
if ($data) {
$element -> setValue($data);
}
return $element;
}
}
?>

View file

@ -0,0 +1,53 @@
<?php
/*******************************************************************************
* Copyright (C) 2007 Easter-eggs
* http://ldapsaisie.labs.libre-entreprise.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
/**
* Type d'attribut HTML URL
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSattr_html_url extends LSattr_html {
/**
* Ajoute l'attribut au formualaire passer en paramètre
*
* @param[in] &$form LSform Le formulaire
* @param[in] $idForm L'identifiant du formulaire
* @param[in] $data Valeur du champs du formulaire
*
* @retval LSformElement L'element du formulaire ajouté
*/
function addToForm (&$form,$idForm,$data=NULL) {
$element=$form -> addElement('url', $this -> name, $this -> config['label'],$this -> config, $this);
if(!$element) {
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name);
return;
}
if ($data) {
$element -> setValue($data);
}
return $element;
}
}
?>

View file

@ -259,6 +259,15 @@ class LSformElement {
return ''; return '';
} }
} }
/**
* Retourne le titre du champ
*
* @retval string Titre du champ
**/
function getTitle() {
return $this -> form -> ldapObject -> getDisplayValue().' - '.$this -> getLabel();
}
} }
?> ?>

View file

@ -0,0 +1,87 @@
<?php
/*******************************************************************************
* Copyright (C) 2007 Easter-eggs
* http://ldapsaisie.labs.libre-entreprise.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
/**
* Element RSS d'un formulaire pour LdapSaisie
*
* Cette classe définis les éléments textes des formulaires.
* Elle étant la classe basic LSformElement.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSformElement_rss extends LSformElement {
/**
* Retourne les infos d'affichage de l'élément
*
* Cette méthode retourne les informations d'affichage de l'élement
*
* @retval array
*/
function getDisplay(){
$return = $this -> getLabelInfos();
// value
if (!$this -> isFreeze()) {
$return['html'] = "<ul class='LSform'>\n";
if (empty($this -> values)) {
$return['html'] .= "<li>".$this -> getEmptyField()."</li>\n";
}
else {
foreach ($this -> values as $value) {
$multiple = $this -> getMultipleData();
$id = "LSform_".$this -> name."_".rand();
$return['html'] .= "<li><input type='text' name='".$this -> name."[]' value=\"".$value."\" id='".$id."'><img src='templates/images/rss.png' class='LSformElement_rss_btn btn' alt='"._('Afficher la file RSS.')."' title='"._('Afficher la file RSS.')."'/>".$multiple."</li>\n";
}
}
$return['html'] .= "</ul>\n";
$GLOBALS['LSsession'] -> addJSscript('LSformElement_rss.js');
}
else {
$return['html'] = "<ul class='LSform'>\n";
if (empty($this -> values)) {
$return['html'] .= "<li>"._('Aucune valeur definie')."</li>\n";
}
else {
foreach ($this -> values as $value) {
$return['html'] .= "<li><a href='".$value."'>".$value."</a><img src='templates/images/rss.png' alt='"._('Afficher la file RSS.')."' title='"._('Afficher la file RSS.')."' class='LSformElement_rss_btn btn'></li>\n";
$GLOBALS['LSsession'] -> addJSscript('LSformElement_rss.js');
}
}
$return['html'] .= "</ul>\n";
}
return $return;
}
/**
* Retourne le code HTML d'un champ vide
*
* @retval string Code HTML d'un champ vide.
*/
function getEmptyField() {
$multiple = $this -> getMultipleData();
return "<input type='text' name='".$this -> name."[]' id='LSform_".$this -> name."_".rand()."'><img src='templates/images/go.png' class='LSformElement_rss_btn btn' alt='"._('Afficher la file RSS.')."' title='"._('Afficher la file RSS.')."'/>".$multiple;
}
}
?>

View file

@ -0,0 +1,88 @@
<?php
/*******************************************************************************
* Copyright (C) 2007 Easter-eggs
* http://ldapsaisie.labs.libre-entreprise.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
/**
* Element texte d'un formulaire pour LdapSaisie
*
* Cette classe définis les éléments textes des formulaires.
* Elle étant la classe basic LSformElement.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSformElement_url extends LSformElement {
/**
* Retourne les infos d'affichage de l'élément
*
* Cette méthode retourne les informations d'affichage de l'élement
*
* @retval array
*/
function getDisplay(){
$return = $this -> getLabelInfos();
// value
if (!$this -> isFreeze()) {
$return['html'] = "<ul class='LSform'>\n";
if (empty($this -> values)) {
$return['html'] .= "<li>".$this -> getEmptyField()."</li>\n";
}
else {
foreach ($this -> values as $value) {
$multiple = $this -> getMultipleData();
$id = "LSform_".$this -> name."_".rand();
$return['html'] .= "<li><input type='text' name='".$this -> name."[]' value=\"".$value."\" id='".$id."' title=\"".$this -> getTitle()."\"><img src='templates/images/url_go.png' class='LSformElement_url_go_btn btn' alt='"._('Suivre le lien.')."' title='"._('Suivre le lien.')."'/> <img src='templates/images/url_add.png' class='LSformElement_url_add_favorite_btn btn' alt='"._('Ajouter aux favoris.')."' title='"._('Ajouter aux favoris.')."'/>".$multiple."</li>\n";
}
}
$return['html'] .= "</ul>\n";
$GLOBALS['LSsession'] -> addJSscript('LSformElement_url.js');
}
else {
$return['html'] = "<ul class='LSform'>\n";
if (empty($this -> values)) {
$return['html'] .= "<li>"._('Aucune valeur definie')."</li>\n";
}
else {
foreach ($this -> values as $value) {
$return['html'] .= "<li><a href='".$value."' title=\"".$this -> getTitle()."\">".$value."</a><img src='templates/images/url_go.png' class='LSformElement_url_go_btn btn' alt='"._('Suivre le lien.')."' title='"._('Suivre le lien.')."'> <img src='templates/images/url_add.png' class='LSformElement_url_add_favorite_btn btn' alt='"._('Ajouter aux favoris.')."' title='"._('Ajouter aux favoris.')."'/></li>\n";
}
$GLOBALS['LSsession'] -> addJSscript('LSformElement_url.js');
}
$return['html'] .= "</ul>\n";
}
return $return;
}
/**
* Retourne le code HTML d'un champ vide
*
* @retval string Code HTML d'un champ vide.
*/
function getEmptyField() {
$multiple = $this -> getMultipleData();
return "<input type='text' name='".$this -> name."[]' id='LSform_".$this -> name."_".rand()."' title=\"".$this -> getTitle()."\"><img src='templates/images/url_go.png' class='LSformElement_url_go_btn btn' alt='"._('Suivre le lien.')."' title='"._('Suivre le lien.')."'/> <img src='templates/images/url_add.png' class='LSformElement_url_add_favorite_btn btn' alt='"._('Ajouter aux favoris.')."' title='"._('Ajouter aux favoris.')."'/>".$multiple;
}
}
?>

View file

@ -144,7 +144,7 @@ window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSdefault = new LSdefault(); varLSdefault = new LSdefault();
}); });
LSdebug_active = 0; var LSdebug_active = 0;
function LSdebug() { function LSdebug() {
if (LSdebug_active != 1) return; if (LSdebug_active != 1) return;

View file

@ -1,12 +1,23 @@
var LSform = new Class({ var LSform = new Class({
initialize: function(){ initialize: function(){
$$('img.LSform-add-field-btn').each(function(el) { this._modules=[];
el.addEvent('click',this.onAddFieldBtnClick.bind(this,el)); this.initializeLSform_AddAndRemoveBtns();
}, this); },
$$('img.LSform-remove-field-btn').each(function(el) { initializeLSform_AddAndRemoveBtns: function(el) {
el.addEvent('click',this.onRemoveFieldBtnClick.bind(this,el)); if (typeof(el) == 'undefined') {
el = document;
}
el.getElements('img[class=LSform-add-field-btn]').each(function(btn) {
btn.addEvent('click',this.onAddFieldBtnClick.bind(this,btn));
}, this); }, this);
el.getElements('img[class=LSform-remove-field-btn]').each(function(btn) {
btn.addEvent('click',this.onRemoveFieldBtnClick.bind(this,btn));
}, this);
},
addModule: function(name,obj) {
this._modules[name]=obj;
}, },
onAddFieldBtnClick: function(img){ onAddFieldBtnClick: function(img){
@ -36,12 +47,15 @@ var LSform = new Class({
var img = $(data.img); var img = $(data.img);
li.set('html',data.html); li.set('html',data.html);
li.injectAfter(img.getParent()); li.injectAfter(img.getParent());
li.getElements('img[class=LSform-add-field-btn]').each(function(el) { this.initializeLSform_AddAndRemoveBtns(li);
el.addEvent('click',this.onAddFieldBtnClick.bind(this,el)); if (typeof(this._modules[data.fieldtype]) != "undefined") {
}, this); try {
li.getElements('img[class=LSform-remove-field-btn]').each(function(el) { this._modules[data.fieldtype].reinitialize(li);
el.addEvent('click',this.onRemoveFieldBtnClick.bind(this,el)); }
}, this); catch(e) {
LSdebug('Pas de reinitialise pour ' + data.fieldtype);
}
}
} }
}, },

View file

@ -0,0 +1,34 @@
var LSformElement_rss = new Class({
initialize: function(){
this.initialiseLSformElement_rss();
if (typeof(varLSform) != "undefined") {
varLSform.addModule("LSformElement_rss",this);
}
},
initialiseLSformElement_rss: function(el) {
if (typeof(el) == 'undefined') {
el = document;
}
el.getElements('img.LSformElement_rss_btn').each(function(btn) {
btn.addEvent('click',this.onBtnClick.bind(this,btn));
}, this);
},
reinitialize: function(el) {
this.initialiseLSformElement_rss(el);
},
onBtnClick: function(btn) {
var href = btn.getParent().getFirst().href;
if (typeof(href)=="undefined") {
href = btn.getParent().getFirst().value;
}
if (href!="") {
window.open(href,'_blank');
}
}
});
window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSformElement_rss = new LSformElement_rss();
});

View file

@ -0,0 +1,56 @@
var LSformElement_url = new Class({
initialize: function(){
this.initialiseLSformElement_url();
if (typeof(varLSform) != "undefined") {
varLSform.addModule("LSformElement_url",this);
}
},
initialiseLSformElement_url: function(el) {
if (typeof(el) == 'undefined') {
el = document;
}
el.getElements('img.LSformElement_url_go_btn').each(function(btn) {
btn.addEvent('click',this.onGoBtnClick.bind(this,btn));
}, this);
el.getElements('img.LSformElement_url_add_favorite_btn').each(function(btn) {
btn.addEvent('click',this.onAddFavoriteBtnClick.bind(this,btn));
}, this);
},
reinitialize: function(el) {
this.initialiseLSformElement_url(el);
},
onGoBtnClick: function(btn) {
var href = btn.getParent().getFirst().href;
if (typeof(href)=="undefined") {
href = btn.getParent().getFirst().value;
}
if (href!="") {
window.open(href,'_blank');
}
},
onAddFavoriteBtnClick: function(btn) {
var href = btn.getParent().getFirst().value;
if (typeof(href)=="undefined") {
href = btn.getParent().getFirst().href;
}
var name = btn.getParent().getFirst().title;
if (href!="") {
if (window.sidebar) {
window.sidebar.addPanel(name,href,'');
}
else if(document.all) {
window.external.AddFavorite(href,name);
}
else {
alert('Fonctionnalité pas encore supportée pour votre navigateur.');
}
}
}
});
window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSformElement_url = new LSformElement_url();
});

View file

@ -46,6 +46,7 @@ if (!isset($_ERRORS)) {
$data = array( $data = array(
'html' => $form -> getEmptyField($_REQUEST['attribute']), 'html' => $form -> getEmptyField($_REQUEST['attribute']),
'img' => $_REQUEST['img'], 'img' => $_REQUEST['img'],
'fieldtype' => get_class($form -> getElement($_REQUEST['attribute']))
); );
} }
} }

View file

@ -27,9 +27,6 @@ $GLOBALS['LSsession'] = new LSsession();
if($LSsession -> startLSsession()) { if($LSsession -> startLSsession()) {
// Définition du Titre de la page
$GLOBALS['Smarty'] -> assign('pagetitle',_('Modifier'));
if (isset($_POST['LSform_objecttype'])) { if (isset($_POST['LSform_objecttype'])) {
$LSobject = $_POST['LSform_objecttype']; $LSobject = $_POST['LSform_objecttype'];
} }
@ -64,6 +61,8 @@ if($LSsession -> startLSsession()) {
$object = new $LSobject(); $object = new $LSobject();
if ($object -> loadData($dn)) { if ($object -> loadData($dn)) {
// Définition du Titre de la page
$GLOBALS['Smarty'] -> assign('pagetitle',_('Modifier').' : '.$object -> getDisplayValue());
$form = $object -> getForm('modify'); $form = $object -> getForm('modify');
if ($form->validate()) { if ($form->validate()) {
// MàJ des données de l'objet LDAP // MàJ des données de l'objet LDAP

View file

@ -225,6 +225,9 @@ if($LSsession -> startLSsession()) {
if ($GLOBALS['LSsession'] -> cacheSearch()) { if ($GLOBALS['LSsession'] -> cacheSearch()) {
$_SESSION['LSsession']['LSsearch'][$hash]=$searchData; $_SESSION['LSsession']['LSsearch'][$hash]=$searchData;
} }
if ($orderby) {
$sort=true;
}
} }
$GLOBALS['Smarty']->assign('LSobject_list_nbresult',$searchData['LSobject_list_nbresult']); $GLOBALS['Smarty']->assign('LSobject_list_nbresult',$searchData['LSobject_list_nbresult']);

View file

@ -196,7 +196,6 @@ td.LSobject-list-names {
p.LSobject-list-page { p.LSobject-list-page {
text-align: center; text-align: center;
margin: 0.5em; margin: 0.5em;
//width: 100%;
} }
a.LSobject-list-page { a.LSobject-list-page {

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

View file

@ -326,7 +326,9 @@ if($LSsession -> startLSsession()) {
$searchData['objectList']=$objectList; $searchData['objectList']=$objectList;
$searchData['LSview_actions'] = $LSview_actions; $searchData['LSview_actions'] = $LSview_actions;
if ($orderby) {
$sort=true;
}
} }
if ((!isset($searchData['objectList'][0]['actions']))&&(!empty($searchData['objectList']))) { if ((!isset($searchData['objectList'][0]['actions']))&&(!empty($searchData['objectList']))) {