Code

Updated repository listings
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 13 Apr 2010 07:53:41 +0000 (07:53 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 13 Apr 2010 07:53:41 +0000 (07:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17599 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/systems/services/repository/class_servRepositorySetup.inc

index 15ef168eeb01737d5acbb9ac9482baadc4504288..a72bd617d6adb8d986dac6172d0a5aaba5f484ea 100644 (file)
@@ -4,7 +4,7 @@ class servRepositorySetup  extends plugin
 {
   /* attribute list for save action */
   var $ignore_account   = TRUE;
-  var $attributes       = array("Release","ParentServer","Url","cn");
+  var $attributes       = array("Release","ParentServer","Url");
   var $objectclasses    = array("whatever");
 
   /* Attributes */
@@ -20,6 +20,11 @@ class servRepositorySetup  extends plugin
   function servRepositorySetup (&$config, $dn= NULL,$data = false)
   {
     plugin::plugin ($config, $dn);
+
+    if(isset($this->attrs['cn'][0])){
+        $this->cn=$this->attrs['cn'][0];
+    }
+
     if($data != false){
       foreach(array("Sections","Release","Url","ParentServer","initialy_was") as $atr){
         if(isset($data[$atr])){
@@ -27,6 +32,18 @@ class servRepositorySetup  extends plugin
         }
       }
     }
+
+    // Prepare lists
+    $this->sectionList = new sortableListing();
+    $this->sectionList->setDeleteable(true);
+    $this->sectionList->setInstantDelete(true);
+    $this->sectionList->setEditable(false);
+    $this->sectionList->setWidth("100%");
+    $this->sectionList->setHeight("100px");
+    $this->sectionList->setHeader(array(_("Name")));
+    $this->sectionList->setColspecs(array('*','20px'));
+    $this->sectionList->setDefaultSortColumn(0);
+
   }
 
   function GetName()
@@ -80,36 +97,18 @@ class servRepositorySetup  extends plugin
         }
       }
 
-      foreach($_POST as $name => $value){
-        if(preg_match("/^delete_/",$name)){
-
-          $val = preg_replace("/^delete_/","",$name);
-          echo $val;
-          $val = postDecode($val);
-
-          if(isset($this->Sections[$val])){
-            unset($this->Sections[$val]);
-          }
-        }
+      $this->sectionList->save_object();
+      $action = $this->sectionList->getAction();
+      if($action['action'] == 'delete'){
+        $this->Sections = $this->sectionList->getMaintainedData();  
       }
     }
 
-    $divlist = new divSelectBox("servRepositorySetup");
-    $divlist->setHeight("220");
-    $dellink = "";
-    if(preg_match("/w/",$this->parent->getacl("Section"))){
-      $dellink = image('images/lists/trash.png','delete_%s');
-    }
+    $this->sectionList->setAcl($this->parent->getacl('Section'));
+    $this->sectionList->setListData($this->Sections) ;
+    $this->sectionList->update();
  
-    foreach($this->Sections as $sec){
-      $divlist->AddEntry(array(
-            array("string"=>$sec),
-            array("string"=>preg_replace("/%s/",postEncode($sec), $dellink),
-              "attach"=>"style='border-right:0px;width:20px;'")
-            ));
-    }
-  
-    $smarty->assign("Sections",$divlist->DrawList());
+    $smarty->assign("Sections",$this->sectionList->render());
 
     /* Get && assign acls */
     $tmp = $this->parent->plInfo();