Code

Prepared ldif viewer in reference tab
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Apr 2010 09:09:19 +0000 (09:09 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Apr 2010 09:09:19 +0000 (09:09 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17831 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/generic/references/class_reference.inc
gosa-core/plugins/generic/references/contents.tpl

index 2cb779472af019f6fb1d91e6c43be97dc21a5ef0..3bb9c1ed7b5df57bfd3605cd4c3777e566bef33a 100644 (file)
 
 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());
index 78a2d1b84c5d357fa9fc1c40bc8974e78a0f87ae..a913e00a470485a05ae4b13419914a5764b57400 100644 (file)
@@ -3,10 +3,17 @@
 {if !$someACL|regex_replace:"/[cdmw]/":"" == "r"}
     {msgPool type='permView'}
 {else}
-    Last modified ....
-{/if}
-{if $completeACL|regex_replace:"/[cdmw]/":"" == "r"}
-    <button type='submit' name='viewLdif'>{t}View entry{/t}</button>
+
+    {if $modifyTimestamp==""}
+        Last modified: {t}Unknown{/t}
+    {else}
+        Last modified: {$modifyTimestamp}
+    {/if}
+
+    {if $completeACL|regex_replace:"/[cdmw]/":"" == "r"}
+        <br>
+        {t}View current entry ldif{/t}&nbsp;<button type='submit' name='viewLdif'>{t}View{/t}</button>
+    {/if}
 {/if}
 <hr>
 <table summary='{t}Object references{/t}' class='reference-tab'>