From 50cca89800bd42313d85198579bc9813877fe95d Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 26 Apr 2010 09:09:19 +0000 Subject: [PATCH] Prepared ldif viewer in reference tab git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17831 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../generic/references/class_reference.inc | 24 ++++++++++++++++++- .../plugins/generic/references/contents.tpl | 15 ++++++++---- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/gosa-core/plugins/generic/references/class_reference.inc b/gosa-core/plugins/generic/references/class_reference.inc index 2cb779472..3bb9c1ed7 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); @@ -119,6 +131,12 @@ class reference extends plugin { // Mark plugin as viewed plugin::execute(); + + if(isset($_POST['viewLdif'])){ + echo "ding!"; + } + + $smarty = get_smarty(); // Assign permissions @@ -129,6 +147,10 @@ class reference extends plugin $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', date('d.m.Y H:i:s', strtotime($this->modifyTimestamp))); $smarty->assign('objectList', $this->objectList); $smarty->assign("acls",$this->aclResolver->getReadableACL()); diff --git a/gosa-core/plugins/generic/references/contents.tpl b/gosa-core/plugins/generic/references/contents.tpl index 78a2d1b84..a913e00a4 100644 --- a/gosa-core/plugins/generic/references/contents.tpl +++ b/gosa-core/plugins/generic/references/contents.tpl @@ -3,10 +3,17 @@ {if !$someACL|regex_replace:"/[cdmw]/":"" == "r"} {msgPool type='permView'} {else} - Last modified .... -{/if} -{if $completeACL|regex_replace:"/[cdmw]/":"" == "r"} - + + {if $modifyTimestamp==""} + Last modified: {t}Unknown{/t} + {else} + Last modified: {$modifyTimestamp} + {/if} + + {if $completeACL|regex_replace:"/[cdmw]/":"" == "r"} +
+ {t}View current entry ldif{/t}  + {/if} {/if}
-- 2.30.2