Code

Fixed repository list
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Nov 2007 08:50:23 +0000 (08:50 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Nov 2007 08:50:23 +0000 (08:50 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7932 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_location.inc
plugins/admin/systems/class_divListRepositories.inc [new file with mode: 0644]
plugins/admin/systems/class_servRepository.inc

index acff81c88347ee0852e96e3a76884219f57e2bfc..7f5fccd3f17a6e334312920fd3c697bbe94d87df 100644 (file)
@@ -24,9 +24,9 @@ $class_mapping= array(
                 "opengwAccount" => "plugins/personal/connectivity/class_opengwAccount.inc",
                 "phpscheduleitAccount" => "plugins/personal/connectivity/class_phpscheduleitAccount.inc",
                 "connectivity" => "plugins/personal/connectivity/class_connectivity.inc",
+                "blocklistGeneric" => "plugins/gofax/blocklists/class_blocklistGeneric.inc",
                 "blocklist" => "plugins/gofax/blocklists/class_blocklistManagement.inc",
                 "divListBlocklist" => "plugins/gofax/blocklists/class_divListBlocklists.inc",
-                "blocklistGeneric" => "plugins/gofax/blocklists/class_blocklistGeneric.inc",
                 "faxblocktabs" => "plugins/gofax/blocklists/tabs_blocklist.inc",
                 "gofaxAccount" => "plugins/gofax/faxaccount/class_gofaxAccount.inc",
                 "faxreport" => "plugins/gofax/faxreports/class_faxreport.inc",
@@ -181,6 +181,7 @@ $class_mapping= array(
                 "gospamserver" => "plugins/admin/systems/class_goSpamServer.inc",
                 "printerPPDSelectionDialog" => "plugins/admin/systems/class_printerPPDSelectionDialog.inc",
                 "goShareServer" => "plugins/admin/systems/class_goShareServer.inc",
+                "divListRepository" => "plugins/admin/systems/class_divListRepositories.inc",
                 "mimetype" => "plugins/admin/mimetypes/class_mimetypeGeneric.inc",
                 "mimetypeManagement" => "plugins/admin/mimetypes/class_mimetypeManagement.inc",
                 "divListMimeTypes" => "plugins/admin/mimetypes/class_divListMimeTypes.inc",
diff --git a/plugins/admin/systems/class_divListRepositories.inc b/plugins/admin/systems/class_divListRepositories.inc
new file mode 100644 (file)
index 0000000..6e43dc1
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+
+class divListRepository extends MultiSelectWindow
+{
+  /* CheckBoxes, to change default values modify $this->AddCheckBox */
+  var $parent             ;
+  var $ui                 ;
+
+  var $regex ="*";
+
+  function divListRepository ($config,$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config,"Repository", "server");
+    
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+
+    $this->SetTitle("repositories");
+    $this->SetSummary(_("List of configured repositories."));
+    $this->SetInformation(_("This menu allows you to create, delete and edit repository settings."));
+    $this->EnableCloseButton(FALSE);
+    $this->EnableSaveButton(FALSE);
+    $this->AddHeader(array("string"=>_("Release"),"attach"=>"style='width:80px;'"));
+    $this->AddHeader(array("string"=>_("Sections")));
+    $this->AddHeader(array("string"=>_("Options"),"attach"=>"style='border-right:0px;width:55px;'"));
+    $this->AddRegex("regex",_("Regular expression for matching object names"),"*",TRUE);
+    $this->EnableAplhabet(TRUE);
+  }
+
+  function GenHeader()
+  {
+    if($this->parent->acl_is_createable()){
+      $this->SetListHeader("<input type=\"image\" src=\"images/fai_new_packages.png\" title=\""._("Add repository")."\"                 name=\"AddRepository\">");
+    }
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($list)
+  {
+    $link   = "<a href='?plug=".$_GET['plug']."&amp;act=open_repository&amp;id=%s'>%s</a>";
+    $edit   = "<input type='image' value='%s' name='edit_%s'   src='images/edit.png'>&nbsp;";
+
+    /* Hide delete icon, if delete is not allowed */
+    if($this->parent->acl_is_removeable()){
+      $delete = "<input type='image' value='%s' name='delete_%s' src='images/edittrash.png'>";
+    }else{
+      $delete = "<img src='images/empty.png' alt='&nbsp;'>";
+    }
+
+    foreach($list as $name => $reps){
+
+      $str = " ";
+      if(preg_match("/".str_replace("*",".*",$this->regex)."/",$reps['Release'])){
+        foreach($reps['Sections'] as $sec){
+          $str.=$sec." ";
+        }
+        $this->AddElement(array(
+              array("string"=>sprintf($link,base64_encode($name),$name),"attach"=>"style='width:80px;'"),
+              array("string"=>sprintf($link,base64_encode($name),_("Sections")." :".$str)),
+              array("string"=>preg_replace("/%s/",base64_encode($name),$edit.$delete),"attach"=>"style='border-right:0px;width:55px;text-  align:right;'")
+              ));
+      }
+    }
+
+  }
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow :: save_object();   
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
index de72d986e397a8165a1782e6eecca2c3a509729e..10321c02453a36f5c19e959f7280b778af844182 100644 (file)
@@ -81,21 +81,7 @@ class servrepository extends goService
 
 
     /* Create divlist */
-    $divlist = new MultiSelectWindow($this->config,"repositories","server/servRepository");
-    $divlist->SetTitle("repositories");
-    $divlist->SetSummary(_("List of configured repositories."));
-    $divlist->SetInformation(_("This menu allows you to create, delete and edit repository settings."));
-    $divlist->EnableCloseButton(FALSE);
-    $divlist->EnableSaveButton(FALSE);
-    $divlist->AddHeader(array("string"=>_("Release"),"attach"=>"style='width:80px;'"));
-    $divlist->AddHeader(array("string"=>_("Sections")));
-    $divlist->AddHeader(array("string"=>_("Options"),"attach"=>"style='border-right:0px;width:55px;'"));
-    $divlist->AddRegex("regex",_("Regular expression for matching object names"),"*",TRUE);
-    $divlist->EnableAplhabet(TRUE);
-    if($this->acl_is_createable()){
-      $divlist->SetListHeader("<input type=\"image\" src=\"images/fai_new_packages.png\" title=\""._("Add repository")."\" name=\"AddRepository\">");
-    }
-    $this->divlist = $divlist;
+    $this->divlist = new divListRepository($this->config,$this);
   }
 
   function execute()
@@ -264,25 +250,10 @@ class servrepository extends goService
     }else{
       $delete = "<img src='images/empty.png' alt='&nbsp;'>";
     }
-  
-    $this->divlist->ClearElementsList(); 
-    foreach($this->repositories as $name => $reps){
-
-      $str = " ";
-      if(preg_match("/".str_replace("*",".*",$this->divlist->regex)."/",$reps['Release'])){
-        foreach($reps['Sections'] as $sec){
-          $str.=$sec." ";  
-        }    
-        $this->divlist->AddElement(array(
-              array("string"=>sprintf($link,base64_encode($name),$name),"attach"=>"style='width:80px;'"),
-              array("string"=>sprintf($link,base64_encode($name),_("Sections")." :".$str)),
-              array("string"=>preg_replace("/%s/",base64_encode($name),$edit.$delete),"attach"=>"style='border-right:0px;width:55px;text-align:right;'")
-              ));
-      }
-    }
-    $smarty->assign("Repositories",$this->divlist->Draw());
 
+    $this->divlist->execute(); 
+    $this->divlist->setEntries($this->repositories);
+    $smarty->assign("Repositories",$this->divlist->Draw());
     $display.= $smarty->fetch(get_template_path('servRepository.tpl', TRUE));
     return($display);
   }