diff --git a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php index f5ddf3b4..d5e31207 100644 --- a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php +++ b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php @@ -30,6 +30,7 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'orderby' => 'displayValue', // Valeurs possibles : 'displayValue' ou 'subDn' 'rdn' => 'uid', 'container_dn' => 'ou=people', + 'container_auto_create' => array( 'objectclass' => array( 'top', @@ -39,12 +40,15 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'ou' => 'people' ) ), + 'before_modify' => 'valid', 'after_modify' => 'valid', 'after_create' => 'createMaildirByFTP', 'after_delete' => 'removeMaildirByFTP', 'select_display_attrs' => '%{cn}', 'label' => _('Utilisateurs'), + + // LSrelation 'relations' => array( 'groups' => array( 'label' => _('Appartient aux groupes...'), @@ -61,8 +65,49 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( ) ) ), + + // LSform + 'LSform' => array ( + // Layout + 'layout' => array ( + 'Civilite' => array( + 'label' => 'Civilité', + 'img' => 1, + 'args' => array ( + 'uid', + 'personalTitle', + 'givenName', + 'sn', + 'cn', + 'mail', + 'description', + 'jpegPhoto' + ) + ), + 'Posix' => array ( + 'label' => 'Posix', + 'args' => array ( + 'uidNumber', + 'gidNumber', + 'loginShell', + 'homeDirectory' + ) + ), + 'Samba' => array ( + 'label' => 'Samba', + 'args' => array ( + 'sambaSID', + 'sambaLMPassword', + 'sambaNTPassword' + ) + ) + ) // fin Layout + ), // fin LSform + // Attributes 'attrs' => array ( + + /* ----------- start -----------*/ 'uid' => array ( 'label' => _('Identifiant'), 'ldap_type' => 'ascii', @@ -101,6 +146,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'homeDirectory' ) ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'uidNumber' => array ( 'label' => _('Identifiant (numérique)'), 'ldap_type' => 'numeric', @@ -128,6 +176,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'modify' => 0, ) ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'givenName' => array ( 'label' => _('Prenom'), 'ldap_type' => 'ascii', @@ -151,6 +202,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( ), 'onDisplay' => 'return_data' ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'sn' => array ( 'label' => _('Nom'), 'ldap_type' => 'ascii', @@ -167,6 +221,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'create' => 1 ) ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'cn' => array ( 'label' => _('Nom complet'), 'ldap_type' => 'ascii', @@ -189,6 +246,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'create' => 1 ) ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'gidNumber' => array ( 'label' => _('Groupe principal'), 'ldap_type' => 'numeric', @@ -231,6 +291,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( ) ) ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'loginShell' => array ( 'label' => _('Interpreteur de commande'), 'help_info' => _("Permet ou non a l'utilisateur de se connecter à un système POSIX."), @@ -250,6 +313,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'true_value' => '/bin/bash', 'false_value' => '/bin/false' ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'sambaSID' => array ( 'label' => _('Identifiant Samba'), 'ldap_type' => 'ascii', @@ -260,9 +326,12 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'admin' => 'r' ), 'form' => array ( - //'modify' => 0, + 'modify' => 0 ) ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'homeDirectory' => array ( 'label' => _('Répertoire personnel'), 'ldap_type' => 'ascii', @@ -274,6 +343,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( ), 'view' => 1 ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'mail' => array ( 'label' => _('Adresse e-mail'), 'ldap_type' => 'ascii', @@ -302,6 +374,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'create' => 1 ) ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'personalTitle' => array ( 'label' => _('Titre'), 'ldap_type' => 'ascii', @@ -324,6 +399,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'Mlle' => 'Mlle' ) ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'description' => array ( 'label' => _('Description'), 'ldap_type' => 'ascii', @@ -340,6 +418,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'create' => 1 ) ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'userPassword' => array ( 'label' => _('Mot de passe'), 'ldap_type' => 'password', @@ -390,6 +471,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( ), 'after_modify' => 'valid' ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'lsRecoveryHash' => array ( 'label' => _('Hash de recouvrement du mot de passe'), 'ldap_type' => 'ascii', @@ -403,6 +487,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'admin' => 'w' ) ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'sambaLMPassword' => array ( 'label' => _('Mot de passe Samba (LM)'), 'ldap_type' => 'ascii', @@ -413,6 +500,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'modify' => 0 ) ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'sambaNTPassword' => array ( 'label' => _('Mot de passe Samba (NT)'), 'ldap_type' => 'ascii', @@ -423,6 +513,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'modify' => 0 ) ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ 'jpegPhoto' => array ( 'label' => _('Photo'), 'ldap_type' => 'image', @@ -455,6 +548,8 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'admin' => 'w' ) ) - ) + /* ----------- end -----------*/ + + ) // Fin args ); ?> diff --git a/trunk/css/default/LSform.css b/trunk/css/default/LSform.css index df7d8f9c..467360ae 100644 --- a/trunk/css/default/LSform.css +++ b/trunk/css/default/LSform.css @@ -3,13 +3,69 @@ * LSForm ****************** */ + +/* + * Layout + */ +ul.LSform_layout_active { + list-style-type: none; + padding: 0; + margin: 1em; + margin-bottom: 0; +} + +li.LSform_layout a { + text-decoration: none; + color: #0072B8; +} + +li.LSform_layout_active a { + color: #fff; +} + +li.LSform_layout_active { + text-decoration: none; + color: #fff; + background-color: #52BCE5; + -moz-border-radius: 3px 3px 0px 0px; + padding: 4px; + display: inline; + margin-right: 1px; +} + +li.LSform_layout_current { + color: #fff; + background-color: #0072B8; +} + +h2.LSform_layout_active { + display: none; +} + +div.LSform_layout { + border: 1px solid #0072B8; + margin: 1em; + padding: 0.5em; +} +div.LSform_layout_active { + display: none; + margin-top: 4px; +} + +div.LSform_layout_current { + display: block; +} + /* * Architecture */ +div.LSform { + margin-left: 1em; +} + dl.LSform { margin: 0; - margin-left: 2em; padding: 0; } @@ -17,14 +73,14 @@ dl.LSform { position: relative; left: 0.2em; top: 1.2em; - width: 15em; + width: 16em; font-weight: bold; font-size: 0.9em; color: #0072b8; } dd.LSform { - margin-left: 15em; + margin-left: 16em; padding: 0; } diff --git a/trunk/css/default/base.css b/trunk/css/default/base.css index 7422a547..8e8bd72f 100644 --- a/trunk/css/default/base.css +++ b/trunk/css/default/base.css @@ -20,6 +20,13 @@ h1 { clear: left; } +h2 { + margin: 0.7em; + margin-bottom: 1px; + color: #0072b8; + clear: left; +} + a img { border: none; } diff --git a/trunk/includes/class/class.LSform.php b/trunk/includes/class/class.LSform.php index 24e08763..8b980e15 100644 --- a/trunk/includes/class/class.LSform.php +++ b/trunk/includes/class/class.LSform.php @@ -74,6 +74,7 @@ class LSform { function display(){ if ($this -> idForm == 'view') { $GLOBALS['LSsession'] -> addJSscript('LSview.js'); + $GLOBALS['LSsession'] -> addJSscript('LSform.js'); } else { $GLOBALS['LSsession'] -> addJSscript('LSformElement_field.js'); @@ -93,6 +94,12 @@ class LSform { 'dn' => $this -> ldapObject -> getValue('dn') ); $GLOBALS['Smarty'] -> assign('LSform_object',$LSform_object); + + if (is_array($GLOBALS['LSobjects'][$LSform_object['type']]['LSform']['layout'])) { + $GLOBALS['Smarty'] -> assign('LSform_layout',$GLOBALS['LSobjects'][$LSform_object['type']]['LSform']['layout']); + $GLOBALS['Smarty'] -> assign('LSform_layout_nofield_label',_('Aucun champ.')); + } + $fields = array(); foreach($this -> elements as $element) { $field = array(); @@ -100,7 +107,7 @@ class LSform { if (isset($this -> _elementsErrors[$element -> name])) { $field['errors']= $this -> _elementsErrors[$element -> name]; } - $fields[] = $field; + $fields[$element -> name] = $field; } if ($this -> maxFileSize) { @@ -123,6 +130,7 @@ class LSform { */ function displayView(){ $GLOBALS['LSsession'] -> addCssFile('LSform.css'); + $GLOBALS['LSsession'] -> addJSscript('LSform.js'); $LSform_object = array( 'type' => $this -> ldapObject -> getType(), 'dn' => $this -> ldapObject -> getDn() @@ -131,9 +139,14 @@ class LSform { $fields = array(); foreach($this -> elements as $element) { $field = $element -> getDisplay(); - $fields[] = $field; + $fields[$element -> name] = $field; } $GLOBALS['Smarty'] -> assign('LSform_fields',$fields); + + if (is_array($GLOBALS['LSobjects'][$LSform_object['type']]['LSform']['layout'])) { + $GLOBALS['Smarty'] -> assign('LSform_layout',$GLOBALS['LSobjects'][$LSform_object['type']]['LSform']['layout']); + $GLOBALS['Smarty'] -> assign('LSform_layout_nofield_label',_('Aucun champ.')); + } } /** diff --git a/trunk/includes/js/LSform.js b/trunk/includes/js/LSform.js index f8de8572..a4bfceb7 100644 --- a/trunk/includes/js/LSform.js +++ b/trunk/includes/js/LSform.js @@ -3,21 +3,67 @@ var LSform = new Class({ this._modules=[]; this._elements=[]; - this.objecttype = $('LSform_objecttype').value, - this.objectdn = $('LSform_objectdn').value, - this.idform = $('LSform_idform').value, + if ($type($('LSform_idform'))) { + this.objecttype = $('LSform_objecttype').value; + this.objectdn = $('LSform_objectdn').value; + this.idform = $('LSform_idform').value; + } this.initializeLSform(); + this.initializeLSformLayout(); }, initializeLSform: function(el) { this.LStips = new Tips('.LStips'); - if (typeof(el) == 'undefined') { - el = document; + if (this.idform) { + if (typeof(el) == 'undefined') { + el = document; + } + el.getElements('ul.LSform').each(function(ul) { + this._elements[ul.id] = new LSformElement(this,ul.id,ul); + }, this); } - el.getElements('ul.LSform').each(function(ul) { - this._elements[ul.id] = new LSformElement(this,ul.id,ul); - }, this); + }, + + initializeLSformLayout: function(el) { + $$('.LSform_layout').each(function(el) { + el.addClass('LSform_layout_active'); + },this); + + var LIs = $$('li.LSform_layout'); + LIs.each(function(li) { + li.getFirst('a').addEvent('click',this.onTabBtnClick.bindWithEvent(this,li)); + },this); + + if (LIs.length != 0) { + this._currentTab = 'default_value'; + document.getElement('li.LSform_layout').getFirst('a').fireEvent('click'); + } + }, + + onTabBtnClick: function(event,li) { + if ($type(event)) { + new Event(event).stop(); + } + + if (this._currentTab!='default_value') { + var oldLi = $$('li.LSform_layout[title='+this._currentTab+']'); + if ($type(oldLi)) { + oldLi.removeClass('LSform_layout_current'); + } + var oldDiv = $$('div.LSform_layout[title='+this._currentTab+']'); + if ($type(oldDiv)) { + oldDiv.removeClass('LSform_layout_current'); + } + } + + this._currentTab = li.title; + li.addClass('LSform_layout_current'); + var div = $$('div.LSform_layout[title='+this._currentTab+']'); + if ($type(div)) { + div.addClass('LSform_layout_current'); + } + }, addModule: function(name,obj) { diff --git a/trunk/includes/js/LSformElement_mail.js b/trunk/includes/js/LSformElement_mail.js index f1d29c92..8926dd2d 100644 --- a/trunk/includes/js/LSformElement_mail.js +++ b/trunk/includes/js/LSformElement_mail.js @@ -50,7 +50,7 @@ var LSformElement_mail = new Class({ if ((mail!="")) { this.LSmail_open = 1; this.LSmail.setMails([mail]); - this.LSmail.setObject($('LSform_objecttype').value,$('LSform_objectdn').value); + this.LSmail.setObject(varLSform.objecttype,varLSform.objectdn); this.LSmail.open(btn); } } diff --git a/trunk/includes/js/LSformElement_select_object_field.js b/trunk/includes/js/LSformElement_select_object_field.js index f62a95de..7e39b7cf 100644 --- a/trunk/includes/js/LSformElement_select_object_field.js +++ b/trunk/includes/js/LSformElement_select_object_field.js @@ -97,9 +97,9 @@ var LSformElement_select_object_field = new Class({ template: 'LSform', action: 'refreshField', attribute: this.name, - objecttype: $('LSform_objecttype').value, - objectdn: $('LSform_objectdn').value, - idform: $('LSform_idform').value + objecttype: varLSform.objecttype, + objectdn: varLSform.objectdn, + idform: varLSform.idform }; data.imgload=varLSdefault.loadingImgDisplay(this.addBtn); new Request({url: 'index_ajax.php', data: data, onSuccess: this.onLSsmoothboxValidComplete.bind(this)}).send(); diff --git a/trunk/templates/default/LSform.tpl b/trunk/templates/default/LSform.tpl new file mode 100644 index 00000000..23c908cf --- /dev/null +++ b/trunk/templates/default/LSform.tpl @@ -0,0 +1,80 @@ +
diff --git a/trunk/templates/default/LSform_view.tpl b/trunk/templates/default/LSform_view.tpl new file mode 100644 index 00000000..598ff351 --- /dev/null +++ b/trunk/templates/default/LSform_view.tpl @@ -0,0 +1,58 @@ + + +{if $LSform_layout} + +