mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-16 15:33:02 +01:00
- LSrelation :
-> Les noms des objets sont maintenant cliquable et nous emmènent sur la fiche de l'objet correspondant - LSformElement_select_object : -> Les noms des objets sont maintenant cliquable et nous emmènent sur la fiche de l'objet correspondant - LSformElement : -> Ajout de deux types d'élements de formulaire : -> LSformElement_mail : Adresse mail -> LSformElement_xmpp : Adresse xmpp - LSattribute : -> uniformisation des données des attributs (tous des array()) -> modifications des méthodes loadData() & reloadData() -> Correction des bugs induits par cette modification : - trunk/includes/class/class.LSattr_html_select_list.php - trunk/includes/class/class.LSldapObject.php - trunk/includes/class/class.LSattr_html_select_object.php - trunk/includes/class/class.LSattr_ldap_date.php - trunk/includes/class/class.LSsession.php - trunk/includes/addons/LSaddons.samba.php -> Correction d'un bug concernant le refresh des formulaires (#1695) -> modification de la méthode refreshForm() - LSsession : Correction d'un bug d'affichage du nom de l'utilisateur connecté
This commit is contained in:
parent
c857c680a4
commit
af0fef7119
23 changed files with 402 additions and 23 deletions
|
@ -256,7 +256,7 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
||||||
'mail' => array (
|
'mail' => array (
|
||||||
'label' => _('Adresse e-mail'),
|
'label' => _('Adresse e-mail'),
|
||||||
'ldap_type' => 'ascii',
|
'ldap_type' => 'ascii',
|
||||||
'html_type' => 'text',
|
'html_type' => 'mail',
|
||||||
'html_options' => array(
|
'html_options' => array(
|
||||||
'generate_value_format' => '%{uid}@ls.com',
|
'generate_value_format' => '%{uid}@ls.com',
|
||||||
'autoGenerateOnModify' => true
|
'autoGenerateOnModify' => true
|
||||||
|
|
|
@ -164,7 +164,8 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$gidNumber = $ldapObject -> attrs[ LS_SAMBA_GIDNUMBER_ATTR ] -> getValue() * 2 + LS_SAMBA_SID_BASE_GROUP;
|
$gidNumber = $ldapObject -> attrs[ LS_SAMBA_GIDNUMBER_ATTR ] -> getValue();
|
||||||
|
$gidNumber = $gidNumber[0] * 2 + LS_SAMBA_SID_BASE_GROUP;
|
||||||
$sambaPrimaryGroupSID = LS_SAMBA_DOMAIN_SID . '-' . $gidNumber;
|
$sambaPrimaryGroupSID = LS_SAMBA_DOMAIN_SID . '-' . $gidNumber;
|
||||||
|
|
||||||
return ($sambaPrimaryGroupSID);
|
return ($sambaPrimaryGroupSID);
|
||||||
|
|
53
trunk/includes/class/class.LSattr_html_mail.php
Normal file
53
trunk/includes/class/class.LSattr_html_mail.php
Normal 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 mail
|
||||||
|
*
|
||||||
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||||
|
*/
|
||||||
|
class LSattr_html_mail 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('mail', $this -> name, $this -> config['label'],$this -> config, $this);
|
||||||
|
if(!$element) {
|
||||||
|
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($data) {
|
||||||
|
$element -> setValue($data);
|
||||||
|
}
|
||||||
|
return $element;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -103,7 +103,8 @@ class LSattr_html_select_list extends LSattr_html{
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for($i=0;$i<count($list);$i++) {
|
for($i=0;$i<count($list);$i++) {
|
||||||
$retInfos[$list[$i] -> attrs[$val['value_attribute']] -> getValue()]=$list[$i] -> getDisplayValue($val['display_attribute']);
|
$key = $list[$i] -> attrs[$val['value_attribute']] -> getValue();
|
||||||
|
$retInfos[$key[0]]=$list[$i] -> getDisplayValue($val['display_attribute']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,9 @@ class LSattr_html_select_object extends LSattr_html{
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for($i=0;$i<count($list);$i++) {
|
for($i=0;$i<count($list);$i++) {
|
||||||
$retInfos[$list[$i] -> attrs[$val['value_attribute']] -> getValue()]=$list[$i] -> getDisplayValue($conf['display_attribute']);
|
$key = $val['value_attribute'] -> getValue();
|
||||||
|
$key = $key[0];
|
||||||
|
$retInfos[$list[$i] -> attrs[$key]]=$list[$i] -> getDisplayValue($conf['display_attribute']);
|
||||||
$DNs[]=$list[$i] -> dn;
|
$DNs[]=$list[$i] -> dn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,7 +158,9 @@ class LSattr_html_select_object extends LSattr_html{
|
||||||
$retInfos[$obj -> dn]=$obj -> getDisplayValue($conf['display_attribute']);
|
$retInfos[$obj -> dn]=$obj -> getDisplayValue($conf['display_attribute']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$retInfos[$obj -> attrs[$val['value_attribute']] -> getValue()]=$obj -> getDisplayValue($conf['display_attribute']);
|
$key = $val['value_attribute'] -> getValue();
|
||||||
|
$key = $key[0];
|
||||||
|
$retInfos[$obj -> attrs[$key]]=$obj -> getDisplayValue($conf['display_attribute']);
|
||||||
}
|
}
|
||||||
$DNs[]=$dn;
|
$DNs[]=$dn;
|
||||||
}
|
}
|
||||||
|
|
53
trunk/includes/class/class.LSattr_html_xmpp.php
Normal file
53
trunk/includes/class/class.LSattr_html_xmpp.php
Normal 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 xmpp
|
||||||
|
*
|
||||||
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||||
|
*/
|
||||||
|
class LSattr_html_xmpp 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('xmpp', $this -> name, $this -> config['label'],$this -> config, $this);
|
||||||
|
if(!$element) {
|
||||||
|
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($data) {
|
||||||
|
$element -> setValue($data);
|
||||||
|
}
|
||||||
|
return $element;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -34,12 +34,17 @@ class LSattr_ldap_date extends LSattr_ldap {
|
||||||
* @retval mixed La valeur d'affichage de l'attribut
|
* @retval mixed La valeur d'affichage de l'attribut
|
||||||
*/
|
*/
|
||||||
function getDisplayValue($data) {
|
function getDisplayValue($data) {
|
||||||
$date = strptime($data,$this -> getFormat());
|
if(!is_array($data)) {
|
||||||
if (is_array($date)) {
|
$data=array($data);
|
||||||
return mktime($date['tm_hour'],$date['tm_min'],$date['tm_sec'],$date['tm_mon']+1,$date['tm_mday'],$date['tm_year']+1900);
|
|
||||||
}
|
}
|
||||||
else
|
$retval=array();
|
||||||
return;
|
foreach($data as $val) {
|
||||||
|
$date = strptime($val,$this -> getFormat());
|
||||||
|
if (is_array($date)) {
|
||||||
|
$retval[] = mktime($date['tm_hour'],$date['tm_min'],$date['tm_sec'],$date['tm_mon']+1,$date['tm_mday'],$date['tm_year']+1900);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -100,6 +100,9 @@ class LSattribute {
|
||||||
* @retval boolean true
|
* @retval boolean true
|
||||||
*/
|
*/
|
||||||
function loadData($attr_data) {
|
function loadData($attr_data) {
|
||||||
|
if ((!is_array($attr_data))&&(!empty($attr_data))) {
|
||||||
|
$attr_data = array($attr_data);
|
||||||
|
}
|
||||||
$this -> data = $attr_data;
|
$this -> data = $attr_data;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -112,6 +115,9 @@ class LSattribute {
|
||||||
* @retval boolean true
|
* @retval boolean true
|
||||||
*/
|
*/
|
||||||
function reloadData($attr_data) {
|
function reloadData($attr_data) {
|
||||||
|
if ((!is_array($attr_data))&&(!empty($attr_data))) {
|
||||||
|
$attr_data = array($attr_data);
|
||||||
|
}
|
||||||
$this -> data = $attr_data;
|
$this -> data = $attr_data;
|
||||||
$this -> updateData=false;
|
$this -> updateData=false;
|
||||||
$this -> is_validate=false;
|
$this -> is_validate=false;
|
||||||
|
@ -315,7 +321,7 @@ class LSattribute {
|
||||||
* @retval boolean true si la valeur a été rafraichie ou que ce n'est pas nécessaire, false sinon
|
* @retval boolean true si la valeur a été rafraichie ou que ce n'est pas nécessaire, false sinon
|
||||||
*/
|
*/
|
||||||
function refreshForm(&$form,$idForm) {
|
function refreshForm(&$form,$idForm) {
|
||||||
if(isset($this -> config['form'][$idForm]) && ($this -> myRights()=='w')) {
|
if(isset($this -> config['form'][$idForm])) {
|
||||||
$form_element = $form -> getElement($this -> name);
|
$form_element = $form -> getElement($this -> name);
|
||||||
$values = $this -> html -> refreshForm($this -> getFormVal());
|
$values = $this -> html -> refreshForm($this -> getFormVal());
|
||||||
return $form_element -> setValue($values);
|
return $form_element -> setValue($values);
|
||||||
|
|
|
@ -149,7 +149,6 @@ class LSformElement_date extends LSformElement {
|
||||||
$GLOBALS['LSsession'] -> addJSscript('calendar-en.js',LS_LIB_DIR.'jscalendar/lang/');
|
$GLOBALS['LSsession'] -> addJSscript('calendar-en.js',LS_LIB_DIR.'jscalendar/lang/');
|
||||||
$codeLang = strtolower($GLOBALS['LSconfig']['lang'][0].$GLOBALS['LSconfig']['lang'][1]);
|
$codeLang = strtolower($GLOBALS['LSconfig']['lang'][0].$GLOBALS['LSconfig']['lang'][1]);
|
||||||
$GLOBALS['LSsession'] -> addJSscript('calendar-'.$codeLang.'.js',LS_LIB_DIR.'jscalendar/lang/');
|
$GLOBALS['LSsession'] -> addJSscript('calendar-'.$codeLang.'.js',LS_LIB_DIR.'jscalendar/lang/');
|
||||||
//$GLOBALS['LSsession'] -> addJSscript('calendar-setup.js',LS_LIB_DIR.'jscalendar/');
|
|
||||||
$GLOBALS['LSsession'] -> addJSscript('LSformElement_date_field.js');
|
$GLOBALS['LSsession'] -> addJSscript('LSformElement_date_field.js');
|
||||||
$GLOBALS['LSsession'] -> addJSscript('LSformElement_date.js');
|
$GLOBALS['LSsession'] -> addJSscript('LSformElement_date.js');
|
||||||
}
|
}
|
||||||
|
|
87
trunk/includes/class/class.LSformElement_mail.php
Normal file
87
trunk/includes/class/class.LSformElement_mail.php
Normal 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 mail 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_mail 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/mail.png' class='LSformElement_mail_btn btn' alt='"._('Envoyer un mail.')."' title='"._('Envoyer un mail.')."'/>".$multiple."</li>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$return['html'] .= "</ul>\n";
|
||||||
|
$GLOBALS['LSsession'] -> addJSscript('LSformElement_mail.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='mailto:".$value."'>".$value."</a><img src='templates/images/mail.png' alt='"._('Envoyer un mail.')."' title='"._('Envoyer un mail.')."' class='LSformElement_mail_btn btn'></li>\n";
|
||||||
|
$GLOBALS['LSsession'] -> addJSscript('LSformElement_mail.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_mail_btn btn' alt='"._('Envoyer un mail.')."' title='"._('Envoyer un mail.')."'/>".$multiple;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -50,7 +50,7 @@ class LSformElement_select_object extends LSformElement {
|
||||||
|
|
||||||
if (!$this -> isFreeze()) {
|
if (!$this -> isFreeze()) {
|
||||||
$addBtn="<li class='LSform LSformElement_select_object_addBtn'>
|
$addBtn="<li class='LSform LSformElement_select_object_addBtn'>
|
||||||
<a href='select.php?LSobject=".$this -> selectableObject."' class='LSformElement_select_object_addBtn' id='a_LSformElement_select_object_".$this -> name."_$id'>"._('Modifier')."</a>\n
|
<a href='select.php?LSobject=".$this -> selectableObject."' class='LSformElement_select_object LSformElement_select_object_addBtn' id='a_LSformElement_select_object_".$this -> name."_$id'>"._('Modifier')."</a>\n
|
||||||
<input type='hidden' name='LSformElement_select_object_objecttype' id='LSformElement_select_object_objecttype_$id' value='".$this -> selectableObject."' />\n
|
<input type='hidden' name='LSformElement_select_object_objecttype' id='LSformElement_select_object_objecttype_$id' value='".$this -> selectableObject."' />\n
|
||||||
</li>\n";
|
</li>\n";
|
||||||
$delete=" <img src='templates/images/delete.png' alt='"._('Supprimer')."' class='LSformElement_select_object_deleteBtn'/>";
|
$delete=" <img src='templates/images/delete.png' alt='"._('Supprimer')."' class='LSformElement_select_object_deleteBtn'/>";
|
||||||
|
@ -65,7 +65,7 @@ class LSformElement_select_object extends LSformElement {
|
||||||
$return['html']="<ul class='LSform ".$class."' id='LSformElement_select_object_".$this -> name."_$id'>\n";
|
$return['html']="<ul class='LSform ".$class."' id='LSformElement_select_object_".$this -> name."_$id'>\n";
|
||||||
$return['html'].=$addBtn;
|
$return['html'].=$addBtn;
|
||||||
foreach ($this -> values as $value => $txt) {
|
foreach ($this -> values as $value => $txt) {
|
||||||
$return['html'].="<li class='LSform ".$class."'>".$txt."<input type='hidden' class='LSformElement_select_object' name='".$this -> name."[]' value='".$value."' />$delete</li>\n";
|
$return['html'].="<li class='LSform ".$class."'><a href='view.php?LSobject=".$this -> selectableObject."&dn=".$value."' title='"._('Voir')." ' class='LSformElement_select_object'>".$txt."</a><input type='hidden' class='LSformElement_select_object' name='".$this -> name."[]' value='".$value."' />$delete</li>\n";
|
||||||
}
|
}
|
||||||
$return['html'].="</ul>\n";
|
$return['html'].="</ul>\n";
|
||||||
if (!$this -> isFreeze()) {
|
if (!$this -> isFreeze()) {
|
||||||
|
|
87
trunk/includes/class/class.LSformElement_xmpp.php
Normal file
87
trunk/includes/class/class.LSformElement_xmpp.php
Normal 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 xmpp 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_xmpp 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/xmpp.png' class='LSformElement_xmpp_btn btn' alt='"._('Dialoguer')."' title='"._('Dialoguer')."'/>".$multiple."</li>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$return['html'] .= "</ul>\n";
|
||||||
|
$GLOBALS['LSsession'] -> addJSscript('LSformElement_xmpp.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='xmpp:".$value."'>".$value."</a><img src='templates/images/xmpp.png' alt='"._('Dialoguer')."' title='"._('Dialoguer')."' class='LSformElement_xmpp_btn btn'></li>\n";
|
||||||
|
$GLOBALS['LSsession'] -> addJSscript('LSformElement_xmpp.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_xmpp_btn btn' alt='"._('Dialoguer')."' title='"._('Dialoguer')."'/>".$multiple;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -356,13 +356,14 @@ class LSldapObject {
|
||||||
function validateAttrsData($idForm) {
|
function validateAttrsData($idForm) {
|
||||||
$LSform=$this -> forms[$idForm][0];
|
$LSform=$this -> forms[$idForm][0];
|
||||||
foreach($this -> attrs as $attr) {
|
foreach($this -> attrs as $attr) {
|
||||||
|
$attr_values = $attr -> getValue();
|
||||||
if (!$attr -> isValidate()) {
|
if (!$attr -> isValidate()) {
|
||||||
if($attr -> isUpdate()) {
|
if($attr -> isUpdate()) {
|
||||||
if (!$this -> validateAttrData($LSform, $attr)) {
|
if (!$this -> validateAttrData($LSform, $attr)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( ($attr -> getValue() == '') && ($attr -> isRequired()) ) {
|
else if( (empty($attr_values)) && ($attr -> isRequired()) ) {
|
||||||
if ( $attr -> canBeGenerated()) {
|
if ( $attr -> canBeGenerated()) {
|
||||||
if ($attr -> generateValue()) {
|
if ($attr -> generateValue()) {
|
||||||
if (!$this -> validateAttrData($LSform, $attr)) {
|
if (!$this -> validateAttrData($LSform, $attr)) {
|
||||||
|
|
|
@ -295,7 +295,9 @@ class LSsession {
|
||||||
$result = $authobject -> listObjects($filter,$this -> topDn);
|
$result = $authobject -> listObjects($filter,$this -> topDn);
|
||||||
$nbresult=count($result);
|
$nbresult=count($result);
|
||||||
if ($nbresult==1) {
|
if ($nbresult==1) {
|
||||||
$_POST['LSsession_user'] = $result[0] -> getValue('rdn');
|
$rdn = $result[0] -> getValue('rdn');
|
||||||
|
$rdn = $rdn[0];
|
||||||
|
$_POST['LSsession_user'] = $rdn;
|
||||||
$find=false;
|
$find=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,6 +321,7 @@ class LSsession {
|
||||||
debug('Récupération active');
|
debug('Récupération active');
|
||||||
$user=$result[0];
|
$user=$result[0];
|
||||||
$emailAddress = $user -> getValue($this -> ldapServer['recoverPassword']['mailAttr']);
|
$emailAddress = $user -> getValue($this -> ldapServer['recoverPassword']['mailAttr']);
|
||||||
|
$emailAddress = $emailAddress[0];
|
||||||
|
|
||||||
// Header des mails
|
// Header des mails
|
||||||
$headers="Content-Type: text/plain; charset=UTF-8; format=flowed";
|
$headers="Content-Type: text/plain; charset=UTF-8; format=flowed";
|
||||||
|
@ -335,7 +338,9 @@ class LSsession {
|
||||||
// 1ère étape : envoie du recoveryHash
|
// 1ère étape : envoie du recoveryHash
|
||||||
if (!isset($_GET['recoveryHash'])) {
|
if (!isset($_GET['recoveryHash'])) {
|
||||||
// Generer un hash
|
// Generer un hash
|
||||||
$recovery_hash = md5($user -> getValue('rdn') . strval(time()) . strval(rand()));
|
$rdn=$user -> getValue('rdn');
|
||||||
|
$rdn = $rdn[0];
|
||||||
|
$recovery_hash = md5($rdn . strval(time()) . strval(rand()));
|
||||||
|
|
||||||
$lostPasswdForm = $user -> getForm('lostPassword');
|
$lostPasswdForm = $user -> getForm('lostPassword');
|
||||||
$lostPasswdForm -> setPostData(
|
$lostPasswdForm -> setPostData(
|
||||||
|
@ -453,7 +458,7 @@ class LSsession {
|
||||||
$this -> rdn = $_POST['LSsession_user'];
|
$this -> rdn = $_POST['LSsession_user'];
|
||||||
$this -> loadLSrights();
|
$this -> loadLSrights();
|
||||||
$this -> loadLSaccess();
|
$this -> loadLSaccess();
|
||||||
$GLOBALS['Smarty'] -> assign('LSsession_username',$this -> LSuserObject -> getValue('rdn'));
|
$GLOBALS['Smarty'] -> assign('LSsession_username',$this -> LSuserObject -> getDisplayValue());
|
||||||
$_SESSION['LSsession']=get_object_vars($this);
|
$_SESSION['LSsession']=get_object_vars($this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
34
trunk/includes/js/LSformElement_mail.js
Normal file
34
trunk/includes/js/LSformElement_mail.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
var LSformElement_mail = new Class({
|
||||||
|
initialize: function(){
|
||||||
|
this.initialiseLSformElement_mail();
|
||||||
|
if (typeof(varLSform) != "undefined") {
|
||||||
|
varLSform.addModule("LSformElement_mail",this);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
initialiseLSformElement_mail: function(el) {
|
||||||
|
if (typeof(el) == 'undefined') {
|
||||||
|
el = document;
|
||||||
|
}
|
||||||
|
el.getElements('img.LSformElement_mail_btn').each(function(btn) {
|
||||||
|
btn.addEvent('click',this.onBtnClick.bind(this,btn));
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
reinitialize: function(el) {
|
||||||
|
this.initialiseLSformElement_mail(el);
|
||||||
|
},
|
||||||
|
|
||||||
|
onBtnClick: function(btn) {
|
||||||
|
var href = btn.getParent().getFirst().href;
|
||||||
|
if (typeof(href)=="undefined") {
|
||||||
|
href = 'mailto:'+btn.getParent().getFirst().value;
|
||||||
|
}
|
||||||
|
if (href!="") {
|
||||||
|
location.href = href;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
window.addEvent(window.ie ? 'load' : 'domready', function() {
|
||||||
|
varLSformElement_mail = new LSformElement_mail();
|
||||||
|
});
|
34
trunk/includes/js/LSformElement_xmpp.js
Normal file
34
trunk/includes/js/LSformElement_xmpp.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
var LSformElement_xmpp = new Class({
|
||||||
|
initialize: function(){
|
||||||
|
this.initialiseLSformElement_xmpp();
|
||||||
|
if (typeof(varLSform) != "undefined") {
|
||||||
|
varLSform.addModule("LSformElement_xmpp",this);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
initialiseLSformElement_xmpp: function(el) {
|
||||||
|
if (typeof(el) == 'undefined') {
|
||||||
|
el = document;
|
||||||
|
}
|
||||||
|
el.getElements('img.LSformElement_xmpp_btn').each(function(btn) {
|
||||||
|
btn.addEvent('click',this.onBtnClick.bind(this,btn));
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
reinitialize: function(el) {
|
||||||
|
this.initialiseLSformElement_xmpp(el);
|
||||||
|
},
|
||||||
|
|
||||||
|
onBtnClick: function(btn) {
|
||||||
|
var href = btn.getParent().getFirst().href;
|
||||||
|
if (typeof(href)=="undefined") {
|
||||||
|
href = 'xmpp:'+btn.getParent().getFirst().value;
|
||||||
|
}
|
||||||
|
if (href!="") {
|
||||||
|
location.href = href;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
window.addEvent(window.ie ? 'load' : 'domready', function() {
|
||||||
|
varLSformElement_xmpp = new LSformElement_xmpp();
|
||||||
|
});
|
|
@ -182,7 +182,7 @@ if (!isset($_ERRORS)) {
|
||||||
$list = $objRel -> $relationConf['list_function']($object);
|
$list = $objRel -> $relationConf['list_function']($object);
|
||||||
if (is_array($list)) {
|
if (is_array($list)) {
|
||||||
foreach($list as $o) {
|
foreach($list as $o) {
|
||||||
$data['html'].= "<li class='LSrelation'><span id='".$o -> getDn()."'>".$o -> getDisplayValue(NULL,true)."</span></li>\n";
|
$data['html'].= "<li class='LSrelation'><a href='view.php?LSobject=".$relationConf['LSobject']."&dn=".$o -> getDn()."' class='LSrelation'><span id='".$o -> getDn()."'>".$o -> getDisplayValue(NULL,true)."</span></li>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
{/if}
|
{/if}
|
||||||
<ul id='LSrelation_ul_{$item.id}' class='LSrelation'>
|
<ul id='LSrelation_ul_{$item.id}' class='LSrelation'>
|
||||||
{foreach from=$item.objectList item=object}
|
{foreach from=$item.objectList item=object}
|
||||||
<li class='LSrelation'><span id='{$object.dn}'>{$object.text}</span></li>
|
<li class='LSrelation'><a href='view.php?LSobject={$item.LSobject}&dn={$object.dn}' class='LSrelation'><span id='{$object.dn}'>{$object.text}</span></a></li>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -73,7 +73,7 @@ img.LSform-add-field-btn, img.LSform-remove-field-btn {
|
||||||
/*
|
/*
|
||||||
* LSformElement_select_object
|
* LSformElement_select_object
|
||||||
*/
|
*/
|
||||||
a.LSformElement_select_object_addBtn {
|
a.LSformElement_select_object {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #000;
|
color: #000;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
|
|
@ -6,3 +6,9 @@
|
||||||
img.LSrelation-btn {
|
img.LSrelation-btn {
|
||||||
margin-left: 0.5em;
|
margin-left: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.LSrelation {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #000;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
BIN
trunk/templates/images/mail.png
Normal file
BIN
trunk/templates/images/mail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 641 B |
BIN
trunk/templates/images/xmpp.png
Normal file
BIN
trunk/templates/images/xmpp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 743 B |
|
@ -83,7 +83,10 @@ if($LSsession -> startLSsession()) {
|
||||||
$LSrelations=array();
|
$LSrelations=array();
|
||||||
foreach($object -> config['relations'] as $relationName => $relationConf) {
|
foreach($object -> config['relations'] as $relationName => $relationConf) {
|
||||||
if ($GLOBALS['LSsession'] -> relationCanAccess($object -> getValue('dn'),$relationName)) {
|
if ($GLOBALS['LSsession'] -> relationCanAccess($object -> getValue('dn'),$relationName)) {
|
||||||
$return=array('label' => $relationConf['label']);
|
$return=array(
|
||||||
|
'label' => $relationConf['label'],
|
||||||
|
'LSobject' => $relationConf['LSobject']
|
||||||
|
);
|
||||||
|
|
||||||
$id=rand();
|
$id=rand();
|
||||||
$return['id']=$id;
|
$return['id']=$id;
|
||||||
|
|
Loading…
Reference in a new issue