Code

Allow to escape '$' replacement in filters.
[gosa.git] / gosa-core / include / class_listing.inc
index bac85ecc9c16e230b45fc5f7960223b3f764b46c..3b83e0811adcc73b06f1a2e398003d61833b6611 100644 (file)
@@ -704,41 +704,44 @@ class listing {
         // Row is replaced by the row number
         if ($param == "row") {
           $params[]= $row;
+          continue;
         }
 
         // pid is replaced by the current PID
         if ($param == "pid") {
           $params[]= $this->pid;
+          continue;
         }
 
         // base is replaced by the current base
         if ($param == "base") {
           $params[]= $this->getBase();
+          continue;
         }
 
         // Fixie with "" is passed directly
         if (preg_match('/^".*"$/', $param)){
           $params[]= preg_replace('/"/', '', $param);
+          continue;
+        }
+
+        // Move dn if needed
+        if ($param == "dn") {
+          $params[]= LDAP::fix($config["dn"]);
+          continue;
         }
 
         // LDAP variables get replaced by their objects
         for ($i= 0; $i<$config['count']; $i++) {
-          if ($config[$i] == 'dn') {
-            continue;
-          }
           if ($param == $config[$i]) {
             $values= $config[$config[$i]];
             if (is_array($values)){
               unset($values['count']);
             }
             $params[]= $values;
+            break;
           }
         }
-
-        // Move dn if needed
-        if ($param == "dn") {
-          $params[]= LDAP::fix($config["dn"]);
-        }
       }
 
       // Replace information
@@ -878,7 +881,9 @@ class listing {
         }
 
         if ($action['type'] == "copypaste") {
-          $result.= $this->renderCopyPasteActions($row, $this->entries[$row]['dn'], $category, $class);
+          $copy = !isset($action['copy']) || $action['copy'] == "true";
+          $cut = !isset($action['cut']) || $action['cut'] == "true";
+          $result.= $this->renderCopyPasteActions($row, $this->entries[$row]['dn'], $category, $class,$copy,$cut);
         } else {
           $result.= $this->renderSnapshotActions($row, $this->entries[$row]['dn'], $category, $class);
         }
@@ -1141,7 +1146,9 @@ class listing {
       // Check for special types
       switch ($action['type']) {
         case 'copypaste':
-          $result.= $this->renderCopyPasteMenu($separator);
+          $cut = !isset($action['cut']) || $action['cut'] != "false";
+          $copy = !isset($action['copy']) || $action['copy'] != "false";
+          $result.= $this->renderCopyPasteMenu($separator, $copy , $cut);
           break;
 
         case 'snapshot':
@@ -1500,6 +1507,17 @@ class listing {
   }
 
 
+  function getEntry($dn)
+  {
+    foreach ($this->entries as $entry) {
+      if (isset($entry['dn']) && strcasecmp($dn, $entry['dn']) == 0){
+        return $entry;
+      }
+    }
+    return null;
+  }
+
+
   function getType($dn)
   {
     if (isset($this->objectDnMapping[$dn])) {