From: cajus Date: Fri, 14 Aug 2009 10:06:00 +0000 (+0000) Subject: Updated listing to draw normal actions, too X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bdc628978fa375770775b71b6339afb35b01e4e9;p=gosa.git Updated listing to draw normal actions, too git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14064 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_listing.inc b/gosa-core/include/class_listing.inc index 0e0ee1641..8a85b5016 100644 --- a/gosa-core/include/class_listing.inc +++ b/gosa-core/include/class_listing.inc @@ -95,7 +95,7 @@ class listing { function render() { -echo "filter for images, action menu, sorting, department browsing, filter base handling, bottom list info, copy'n paste handler, snapshot handler
"; +echo "sorting, department browsing, filter base handling, bottom list info, copy'n paste handler, snapshot handler
"; // Initialize list $result= ""; @@ -150,7 +150,7 @@ echo "filter for images, action menu, sorting, department browsing, filter base if ($i != $num_cols-1) { $result.= " "; } else { - $result.= " "; + $result.= " "; } } $result.= ""; @@ -345,9 +345,65 @@ echo "filter for images, action menu, sorting, department browsing, filter base } - function filterActions($row, $dn) + function filterActions($dn, $row, $classes) { - return "TBD"; + // Do nothing if there's no menu defined + if (!isset($this->xmlData['actiontriggers']['action'])) { + return " "; + } + + // Go thru all actions + $result= ""; + $actions= $this->xmlData['actiontriggers']['action']; + foreach($actions as $action) { + // Skip the entry completely if there's no permission to execute it + if (!$this->hasActionPermission($action, $dn)) { + continue; + } + + // If there's an objectclass definition and we don't have it + // add an empty picture here. + if (isset($action['objectclass'])){ + $objectclass= $action['objectclass']; + if (preg_match('/^!(.*)$/', $objectclass, $m)){ + $objectclass= $m[1]; + if(in_array($objectclass, $classes)) { + $result.= " "; + continue; + } + } else { + if(!in_array($objectclass, $classes)) { + $result.= " "; + continue; + } + } + } + + // Render normal entries as usual + if ($action['type'] == "entry") { + $label= $this->processElementFilter($action['label'], $this->entries[$row], $row); + $image= $this->processElementFilter($action['image'], $this->entries[$row], $row); + $result.=""; + } + + // Handle special types + if ($action['type'] == "snapshot") { + #TODO + #echo "actiontriggers: snapshot missing
"; + } + if ($action['type'] == "copypaste") { + #TODO + #echo "actiontriggers: copypaste missing
"; + } + if ($action['type'] == "daemon") { + #TODO + #echo "actiontriggers: daemon missing
"; + } + + } + + return $result; } @@ -454,6 +510,11 @@ echo "filter for images, action menu, sorting, department browsing, filter base $result['action']= preg_replace('/^listing_([a-zA-Z_]+)_[0-9]+$/', '$1', $key); $result['targets'][]= $this->entries[$target]['dn']; } + + // Drop targets if empty + if (count($result['targets']) == 0) { + unset($result['targets']); + } return $result; } @@ -491,6 +552,10 @@ echo "filter for images, action menu, sorting, department browsing, filter base $result['action']= validate($_POST['act']); } + // Drop targets if empty + if (count($result['targets']) == 0) { + unset($result['targets']); + } return $result; } @@ -559,15 +624,18 @@ echo "filter for images, action menu, sorting, department browsing, filter base // Check for special types switch ($action['type']) { case 'copypaste': - echo "actionmenu: copypaste missing
"; + #TODO + #echo "actionmenu: copypaste missing
"; break; case 'snapshot': - echo "actionmenu: snapshot missing
"; + #TODO + #echo "actionmenu: snapshot missing
"; break; case 'daemon': - echo "actionmenu: daemon missing
"; + #TODO + #echo "actionmenu: daemon missing
"; break; } @@ -649,6 +717,7 @@ echo "filter for images, action menu, sorting, department browsing, filter base return true; } + } ?>