Code

Some pliglist iconmenu updates
[gosa.git] / gosa-core / include / class_sortableListing.inc
index 7d12f4878cbea635510366f2966057b571777804..a30758ebc3c3ccba455edc2e079eeecb61530b65 100644 (file)
@@ -100,8 +100,12 @@ class sortableListing {
 
     // Transfer information
     $this->displayData= array();
+    $this->modes= array();
     foreach ($data as $key => $value) {
       $this->displayData[]= $value['data'];
+      if (isset($value['mode'])) {
+        $this->modes[]= $value['mode'];
+      }
     }
     $this->keys= array_keys($data);
 
@@ -246,7 +250,7 @@ class sortableListing {
           switch ($this->modes[$row]) {
             case LIST_DISABLED:
               $id= " sortableListItemDisabled";
-              $editable= false;
+              $editable= "";
               break;
             case LIST_MARKED:
               $id= " sortableListItemMarked";
@@ -327,6 +331,15 @@ class sortableListing {
         $this->sortData();
       }
     }
+  }
+
+
+  public function save_object()
+  {
+    // Do not do anything if this is not our PID, or there's even no PID available...
+    if(!isset($_REQUEST['PID']) || $_REQUEST['PID'] != $this->id) {
+      return;
+    }
 
     // Do not do anything if we're not posted - or have no permission
     if (strpos($this->acl, 'w') !== false && isset($_POST['reorder_'.$this->id])){
@@ -356,7 +369,17 @@ class sortableListing {
       foreach ($_POST as $key => $value) {
         if (preg_match('/^del_'.$this->id.'_([0-9]+)_x.*$/', $key, $matches)) {
           $this->active_index= $this->mapping[$matches[1]];
+
+          // Ignore request if mode requests it
+          if (isset($this->modes[$this->active_index]) && $this->modes[$this->active_index] == LIST_DISABLED) {
+            $this->active_index= null;
+            continue;
+          }
+
+          // Set action
           $this->action= "delete";
+
+          // Remove value if requested
           if ($this->instantDelete) {
             $this->deleteEntry($this->active_index);
           }
@@ -369,6 +392,13 @@ class sortableListing {
       foreach ($_POST as $key => $value) {
         if (preg_match('/^edit_'.$this->id.'_([0-9]+)_x.*$/', $key, $matches)) {
           $this->active_index= $this->mapping[$matches[1]];
+
+          // Ignore request if mode requests it
+          if (isset($this->modes[$this->active_index]) && $this->modes[$this->active_index] == LIST_DISABLED) {
+            $this->active_index= null;
+            continue;
+          }
+
           $this->action= "edit";
         }
       }