- LSformElement_select_object

-> Les lignes supprimées sont barré plutôt que supprimées complétement
	-> Correction d'un bug lorsque l'élément est validé avec une liste vide
- LSattribute : Correction de la méthode isUpdate()
This commit is contained in:
Benjamin Renard 2008-10-15 09:12:20 +00:00
parent b8227ca48a
commit abbf310b2d
6 changed files with 26 additions and 22 deletions

View file

@ -5,7 +5,12 @@ a.LSformElement_select_object {
text-decoration: none; text-decoration: none;
color: #33302b; color: #33302b;
font-weight: normal; font-weight: normal;
}
a.LSformElement_select_object_deleted {
font-style: italic;
color: #777;
text-decoration: line-through;
} }
ul.LSformElement_select_object_edit { ul.LSformElement_select_object_edit {

View file

@ -5,7 +5,12 @@ a.LSformElement_select_object {
text-decoration: none; text-decoration: none;
color: #000; color: #000;
font-weight: normal; font-weight: normal;
}
a.LSformElement_select_object_deleted {
font-style: italic;
color: #777;
text-decoration: line-through;
} }
ul.LSformElement_select_object_edit { ul.LSformElement_select_object_edit {
@ -27,3 +32,4 @@ li.LSformElement_select_object_addBtn {
img.LSformElement_select_object_deleteBtn { img.LSformElement_select_object_deleteBtn {
cursor: pointer; cursor: pointer;
} }

View file

@ -90,7 +90,7 @@ class LSattr_html_select_object extends LSattr_html{
return; return;
} }
if ((is_array($values))&&(!empty($values))) { if (is_array($values)) {
$obj=new $conf['object_type'](); $obj=new $conf['object_type']();
foreach($values as $dn => $name) { foreach($values as $dn => $name) {
if ($obj -> loadData($dn)) { if ($obj -> loadData($dn)) {
@ -139,7 +139,7 @@ class LSattr_html_select_object extends LSattr_html{
return; return;
} }
if ((is_array($values))&&(!empty($values))) { if (is_array($values)) {
if(($conf['value_attribute']=='dn')||($conf['value_attribute']=='%{dn}')||$fromDNs) { if(($conf['value_attribute']=='dn')||($conf['value_attribute']=='%{dn}')||$fromDNs) {
$DNs=$values; $DNs=$values;
$obj = new $conf['object_type'](); $obj = new $conf['object_type']();

View file

@ -389,7 +389,7 @@ class LSattribute {
* @retval boolean true si l'attribut a été mis à jour, false sinon * @retval boolean true si l'attribut a été mis à jour, false sinon
*/ */
function isUpdate() { function isUpdate() {
return ($this -> updateData)?true:false; return ($this -> updateData===false)?false:true;
} }
/** /**

View file

@ -54,7 +54,6 @@ class LSformElement_select_object extends LSformElement {
$params['addBtn'] = _('Modifier'); $params['addBtn'] = _('Modifier');
$params['deleteBtns'] = _('Supprimer'); $params['deleteBtns'] = _('Supprimer');
$params['multiple'] = ($this -> params['multiple'])?1:0; $params['multiple'] = ($this -> params['multiple'])?1:0;
$params['noValueLabel'] = _('Aucune valeur definie');
} }
$ul_id="LSformElement_select_object_".$this -> name; $ul_id="LSformElement_select_object_".$this -> name;

View file

@ -115,24 +115,18 @@ var LSformElement_select_object_field = new Class({
}, },
LSformElement_select_object_deleteBtn: function(img) { LSformElement_select_object_deleteBtn: function(img) {
img.getParent().destroy(); var li = img.getParent();
if (!$type(this.ul.getFirst('li.LSformElement_select_object'))) { var a = li.getFirst('a');
this.addNoValueField(); var input = li.getFirst('input');
} if (a.hasClass('LSformElement_select_object_deleted')) {
}, input.name=this.params['attr_name']+'[]';
a.addClass('LSformElement_select_object');
addNoValueField: function() { a.removeClass('LSformElement_select_object_deleted');
var li = new Element('li');
li.set('html',this.params.noValueLabel);
if (!this.params.multiple) {
this.addSingleAddBtn(li);
} }
else { else {
li.addClass('LSformElement_select_object'); input.name=($random(1,10000));
a.addClass('LSformElement_select_object_deleted');
a.removeClass('LSformElement_select_object');
} }
li.injectInside(this.ul);
} }
}); });