function ajax_addnote($dn,$note){
global $conf;
global $LDAP_CON;
+ global $FIELDS;
// fetch the existing note
- $result = ldap_search($LDAP_CON,$dn,'(objectClass=inetOrgPerson)',array('description'));
+ $result = ldap_search($LDAP_CON,$dn,'(objectClass=inetOrgPerson)',array($FIELDS['note']));
if(ldap_count_entries($LDAP_CON,$result)){
$result = ldap_get_binentries($LDAP_CON, $result);
}
- $note = $note."\n\n".$result[0]['description'][0];
+ $note = $note."\n\n".$result[0][$FIELDS['note']][0];
$note = preg_replace("!\n\n\n+!","\n\n",$note);
- $entry['description'] = $note;
+ $entry[$FIELDS['note']] = $note;
ldap_modify($LDAP_CON,$dn,$entry);
function ajax_settags($dn,$tags){
global $conf;
global $LDAP_CON;
- if(!$conf['extended']) return;
+ global $FIELDS;
+ if(!$FIELDS['_marker']) return;
$tags = explode(',',$tags);
$tags = array_map('trim',$tags);
$tags = array_unique($tags);
$tags = array_diff($tags, array('')); //strip empty ones
- $entry['marker'] = $tags;
+ $entry[$FIELDS['_marker']] = $tags;
ldap_mod_replace($LDAP_CON,$dn,$entry);
foreach ($tags as $tag){
function ajax_taglookup($tag){
global $conf;
global $LDAP_CON;
- if(!$conf['extended']) return;
+ if(!$FIELDS['_marker']) return;
$search = ldap_filterescape($tag);
- $filter = "(&(objectClass=contactPerson)(marker=$search*))";
- $result = ldap_queryabooks($filter,'marker');
+ $filter = "(&(objectClass=inetOrgPerson)('.$FIELDS['_marker'].'=$search*))";
+ $result = ldap_queryabooks($filter,$FIELDS['_marker']);
if(!count($result)) return;
$tags = array();
foreach ($result as $entry){
- if(count($entry['marker'])){
- foreach($entry['marker'] as $marker){
+ if(count($entry[$FIELDS['_marker']])){
+ foreach($entry[$FIELDS['_marker']] as $marker){
if(preg_match('/^'.preg_quote($tag,'/').'/i',$marker)){
array_push($tags, strtolower($marker));
}
unset($_REQUEST['entry']['markers']);
foreach(array_keys($_REQUEST['entry']) as $field){
- if($FIELDS['*'.$field]){
+ if($FIELDS['_'.$field]){
// entry has to be handled as array -> clean it up (trim, unique, sort)
$_REQUEST['entry'][$field] = array_map('trim',$_REQUEST['entry'][$field]);
$_REQUEST['entry'][$field] = array_unique($_REQUEST['entry'][$field]);
'url' => 'labeledURI',
'note' => 'description',
'manager' => 'manager', // aka. key account
- '*mail' => 'mail',
+ '_mail' => 'mail',
);
/**
*/
$OCLASSES[] = 'contactPerson';
$FIELDS['anniversary'] = 'anniversary';
-$FIELDS['*marker'] = 'marker'; // aka. tags
+$FIELDS['_marker'] = 'marker'; // aka. tags
/**
* If the open exchange schema is used the following fields
$FIELDS['country'] = 'userCountry';
$FIELDS['birthday'] = 'birthDay';
$FIELDS['ipphone'] = 'IPPhone';
-$FIELDS['*marker'] = 'OXUserCategories';
+$FIELDS['_marker'] = 'OXUserCategories';
$FIELDS['instantmessenger'] = 'OXUserInstantMessenger';
$FIELDS['timezone'] = 'OXTimeZone';
$FIELDS['position'] = 'OXUserPosition';
$FIELDS['certificate'] = 'relClientCert';
+$FIELDS['domain'] = 'domain';
+*/
+
+/**
+ * If the Evolution schema is used the following fields
+ * and object classes are added
+ */
+/* comment in if you want to use it
+$OCLASSES[] = 'evolutionPerson';
+$OCLASSES[] = 'officePerson';
+$FIELDS['department'] = 'ou';
+$FIELDS['state'] = 'st';
+$FIELDS['country'] = 'c';
+$FIELDS['direct'] = 'primaryPhone';
+$FIELDS['swithboard'] = 'companyPhone';
+$FIELDS['note'] = 'note';
+$FIELDS['manager'] = 'seeAlso';
+$FIELDS['birthday'] = 'birthDate';
+$FIELDS['spouse'] = 'spouseName';
*/
if($FIELDS[$key]){
// normal mapped field
$out[$FIELDS[$key]][] = $value;
- }elseif($FIELDS["*$key"]){
+ }elseif($FIELDS["_$key"]){
// mapped multi field
if(is_array($value)){
- $out[$FIELDS["*$key"]] = $value;
+ $out[$FIELDS["_$key"]] = $value;
}else{
- $out[$FIELDS["*$key"]][] = $value; //shouldn't happen, but to be sure
+ $out[$FIELDS["_$key"]][] = $value; //shouldn't happen, but to be sure
}
}else{
// no mapping found - assume it to be a LDAP attribute (shouldn't happen)
$marker = explode(',',$marker);
foreach($marker as $m){
$m = trim($m);
- $ldapfilter .= '('.$FIELDS['*marker'].'='.$m.')';
+ $ldapfilter .= '('.$FIELDS['_marker'].'='.$m.')';
}
$ldapfilter .= ')';
}elseif(!empty($search)){
global $FIELDS;
if(!$conf['extended']) return;
- $result = ldap_queryabooks('(objectClass=inetOrgPerson)',$FIELDS['*marker']);
+ $result = ldap_queryabooks('(objectClass=inetOrgPerson)',$FIELDS['_marker']);
$max = 0;
$min = 999999999;
$tags = array();
foreach ($result as $entry){
- if(!empty($entry[$FIELDS['*marker']]) && count($entry[$FIELDS['*marker']])){
- foreach($entry[$FIELDS['*marker']] as $marker){
+ if(!empty($entry[$FIELDS['_marker']]) && count($entry[$FIELDS['_marker']])){
+ foreach($entry[$FIELDS['_marker']] as $marker){
$marker = strtolower($marker);
if (empty($tags[$marker])) { $tags[$marker]=0; }
$tags[$marker] += 1;
foreach($RFIELDS as $key => $name){
if(empty($in[$key])) continue;
- // keep arrays for starred fields
- if($name{0} == '*'){
+ // keep arrays for multi fields
+ if($name{0} == '_'){
$name = substr($name,1);
if(is_array($in[$key])){
$out[$name] = $in[$key];
</table>
</dd></dl>
{/if}
-
+
{if $conf.extended}
{include file="extended_show.tpl"}
{/if}