X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Fplugins%2Fgeneric%2Freferences%2Fclass_reference.inc;h=f79dec13c6a13b5fe0105253e4c5ff3effd35322;hb=4857c1fe8507ec694d445ebc3e8fceb233450093;hp=a4bcabd29aace8f22b077bcc7a0ede4d14cdea2e;hpb=dce7c8f72f88a4201087ed4e98f06368c5a4dd0e;p=gosa.git diff --git a/gosa-core/plugins/generic/references/class_reference.inc b/gosa-core/plugins/generic/references/class_reference.inc index a4bcabd29..f79dec13c 100644 --- a/gosa-core/plugins/generic/references/class_reference.inc +++ b/gosa-core/plugins/generic/references/class_reference.inc @@ -22,17 +22,29 @@ class reference extends plugin { - var $attributes= array('uid'); + var $attributes= array('uid','modifyTimestamp'); var $aclResolver = NULL; var $referenceFilters = array(); var $objectList =""; + var $modifyTimestamp = ""; function reference (&$config, $dn= NULL, $parent = NULL) { // Init the plugin plugin::plugin($config,$dn,$parent); + // Try to read the 'modifyTimestamp' - this has to be done separately. + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->cat($this->dn, array('modifyTimestamp')); + if($ldap->count()){ + $attrs = $ldap->fetch(); + if(isset($attrs['modifyTimestamp'][0])){ + $this->modifyTimestamp = $attrs['modifyTimestamp'][0]; + } + } + // Initialize the ACL-resolver $this->aclResolver = new aclResolver($this->config, $this->dn, $this); @@ -72,14 +84,8 @@ class reference extends plugin // Check for user manager $this->referenceFilters[] = array( 'filter' => "(&(objectClass=gosaAccount)(manager=".normalizeLdap($this->dn)."))", - 'attrs' => array('givenName' => _("Given name"),'sn' => _("Surname"),'uid'=>_("Uid")), + 'attrs' => array('givenName' => _("Given name"),'sn' => _("Surname"),'uid'=>_("UID")), 'msg' => _("User manager")); - } - - function execute() - { - // Mark plugin as viewed - plugin::execute(); // Go through filters and detect possible references $ldap = $this->config->get_ldap_link(); @@ -118,15 +124,44 @@ class reference extends plugin $str .= "
"; } } + $this->objectList = $str; + } + + function execute() + { + // Mark plugin as viewed + plugin::execute(); + + // Show ldif viewer + if(isset($_POST['viewLdif'])){ + $this->dialog = new ldifViewer($this->config, $this->dn); + } + if(isset($_POST['cancelLdifViewer'])) $this->dialog = NULL; + if($this->dialog instanceOf ldifViewer){ + return($this->dialog->execute()); + } $smarty = get_smarty(); - $smarty->assign('objectList', $str); + + // Assign permissions + $tmp = $this->plInfo(); + $ui = get_userinfo(); + + $category = preg_replace("/\/.*$/", "", $this->acl_category); + $smarty->assign('aclREAD', preg_match("/r/",$ui->get_category_permissions($this->dn, 'acl'))); + $smarty->assign('completeACL', $ui->has_complete_category_acls($this->dn, $category)); + $smarty->assign('someACL', $ui->get_category_permissions($this->dn, $category)); + + // Convert the modifyTimestamp to a human readable value + $tz = timezone::get_default_timezone(); + $smarty->assign('modifyTimestamp', set_post(date('d.m.Y H:i:s', strtotime($this->modifyTimestamp)))); + + $smarty->assign('objectList', $this->objectList); $smarty->assign("acls",$this->aclResolver->getReadableACL()); + session::set('autocomplete', $this->aclResolver); return ($smarty->fetch (get_template_path('contents.tpl', TRUE, dirname(__FILE__)))); } - - } ?>