Code

Added seperate list handler for gotomasses.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 Oct 2007 07:49:57 +0000 (07:49 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 Oct 2007 07:49:57 +0000 (07:49 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7624 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_location.inc
plugins/addons/gotomasses/class_divListMasses.inc [new file with mode: 0644]
plugins/addons/gotomasses/class_gotomasses.inc

index 8df2262fc34002aec98e716587d3db4044b72b47..9540071eaa2aec1b16b02a34585b260c635150d9 100644 (file)
@@ -36,6 +36,7 @@ $class_mapping= array(
                 "gotomasses" => "plugins/addons/gotomasses/class_gotomasses.inc",
                 "goto_task" => "plugins/addons/gotomasses/class_goto_task.inc",
                 "target_list" => "plugins/addons/gotomasses/class_target_list.inc",
+                "divListMasses" => "plugins/addons/gotomasses/class_divListMasses.inc",
                 "parseMailQueue" => "plugins/addons/mailqueue/class_parseMailQueue.inc",
                 "mailqueue" => "plugins/addons/mailqueue/class_mailqueue.inc",
                 "msgplug" => "plugins/addons/notifications/class_msgplug.inc",
@@ -154,8 +155,8 @@ $class_mapping= array(
                 "goTerminalServer" => "plugins/admin/systems/class_goTerminalServer.inc",
                 "servkolab" => "plugins/admin/systems/class_servKolab.inc",
                 "phonetabs" => "plugins/admin/systems/tabs_phone.inc",
-                "componentGeneric" => "plugins/admin/systems/class_componentGeneric.inc",
                 "dhcpSubnet" => "plugins/admin/systems/class_dhcpSubnet.inc",
+                "componentGeneric" => "plugins/admin/systems/class_componentGeneric.inc",
                 "glpiAccount" => "plugins/admin/systems/class_glpiAccount.inc",
                 "dhcpPool" => "plugins/admin/systems/class_dhcpPool.inc",
                 "servrepository" => "plugins/admin/systems/class_servRepository.inc",
@@ -164,6 +165,7 @@ $class_mapping= array(
                 "goSyslogServer" => "plugins/admin/systems/class_goSyslogServer.inc",
                 "goFonServer" => "plugins/admin/systems/class_goFonServer.inc",
                 "termtabs" => "plugins/admin/systems/tabs_terminal.inc",
+                "ArpNewDeviceTabs" => "plugins/admin/systems/tabs_arpnewdevice.inc",
                 "goLogDBServer" => "plugins/admin/systems/class_goLogDBServer.inc",
                 "selectUserToPrinterDialog" => "plugins/admin/systems/class_selectUserToPrinterDialog.inc",
                 "glpiDeviceManagement" => "plugins/admin/systems/class_glpiDeviceManagement.inc",
@@ -173,11 +175,10 @@ $class_mapping= array(
                 "glpiAttachmentPool" => "plugins/admin/systems/class_glpiAttachmentPool.inc",
                 "goImapServer" => "plugins/admin/systems/class_goImapServer.inc",
                 "phoneGeneric" => "plugins/admin/systems/class_phoneGeneric.inc",
+                "ArpNewDevice" => "plugins/admin/systems/class_ArpNewDevice.inc",
                 "gospamserver" => "plugins/admin/systems/class_goSpamServer.inc",
                 "printerPPDSelectionDialog" => "plugins/admin/systems/class_printerPPDSelectionDialog.inc",
                 "goShareServer" => "plugins/admin/systems/class_goShareServer.inc",
-                "ArpNewDeviceTabs" => "plugins/admin/systems/tabs_arpnewdevice.inc",
-                "ArpNewDevice" => "plugins/admin/systems/class_ArpNewDevice.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/addons/gotomasses/class_divListMasses.inc b/plugins/addons/gotomasses/class_divListMasses.inc
new file mode 100644 (file)
index 0000000..f6e9422
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+
+class divListMasses extends MultiSelectWindow
+{
+
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+
+  var $parent             ;
+  var $ui                 ;
+
+  function divListMasses (&$config,$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config, "gotoMasses", array("gotomasses"));
+
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+    $this->SetSummary(_("List of system deployment tasks"));
+    $this->SetHeadpageMode();
+    $this->EnableCloseButton(FALSE);
+    $this->EnableSaveButton(FALSE);
+    $this->SetInformation(_("This menu allows you to add, remove and change the properties of system deployment tasks."));
+    $this->GenHeader();
+  }
+
+  function GenHeader()
+  {
+    
+    /* Display add button if allowed */
+    $header = "<div style='padding:5px'>";
+    if($this->parent->acl_is_createable()){
+      $header .= "<input type='image' src='images/gotomasses_new_task.png' name='new_task' class='center'>&nbsp;";
+    }
+
+    /* Display add button if allowed */
+    if($this->parent->acl_is_removeable()){
+      $header .= "<input type='image' src='images/edittrash.png' name='remove_multiple_task' class='center'>&nbsp;";
+    }
+    $header .= "</div>";
+
+    /* Create divlist */
+    $this->SetListHeader($header);
+
+    $plug  = $_GET['plug'];
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+
+    $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=object'>"._("Target")."</a>"));
+    $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=schedule'>"._("Schedule")."</a>",
+                                      "attach"=>"style='width:100px;'"));
+    $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=action'>"._("Type")."</a>",
+                                      "attach"=>"style='width:80px;'"));
+    $this->AddHeader(array("string"=>_("Action"),
+                                      "attach"=>"style='border-right:0px;width:40px;'"));
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+
+  function setEntries($tasks)
+  {
+    /* Create edit link */
+    $plug = $_GET['plug'];
+    $edit_link = "<div style='width:100%;overflow:hidden;'><nobr><a href='?plug=".$_GET['plug']."&act=edit&id=%key%'>%str%</nobr></div>";
+
+    foreach($tasks as $key => $task){
+      $action = "<input type='image' src='images/edit.png' name='edit_task_".$key."' class='center' alt='"._("Edit")."'>";
+      if($this->parent->acl_is_removeable()){
+        $action.= "<input type='image' src='images/edittrash.png' name='remove_task_".$key."' class='center' alt='"._("Reomve")."'>";
+      }
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+          "attach" => "style='width:20px;'");
+
+      $field1 = array("string" => preg_replace(array("/%key%/","/%str%/"),array($key,$this->parent->target_to_string($task)),$edit_link));
+      $field2 = array("string" => $this->parent->time_to_string($task),"attach" => "style='width:100px;'");
+      $field3 = array("string" => $this->parent->action_to_string($task),"attach" => "style='width:80px;'");
+      $field4 = array("string" => $action,"attach" => "style='text-align:right;width:40px;border-right:0px;'");
+      $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
+    }
+  }
+
+
+  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 72e6bab044b2dcf8d841652a3075fe61b2af67a4..4a58ca9c8db74179e8499b15c506f28239f3e579 100644 (file)
@@ -18,7 +18,7 @@ class gotomasses extends plugin
   var $current =false;
   var $dialog = FALSE;
   var $ids_to_remove = array();
-
+  var $divlist = NULL;
 
   function gotomasses(&$config, $dn= NULL)
   {
@@ -31,7 +31,6 @@ class gotomasses extends plugin
     if(!empty($file)){
       $this->data_file = $file;
     }
-  
     $this->load_gotomasses_data();
   }
 
@@ -176,73 +175,9 @@ class gotomasses extends plugin
      * Handle Divlist 
      ************/
 
-    $plug = $_GET['plug'];
-    $divlist = new MultiSelectWindow($this->config,"GotoMasses","gotomassses");
-    $divlist->SetSummary(_("List of system deployment tasks"));
-    $divlist->SetHeadpageMode();
-    $divlist->EnableCloseButton(FALSE);
-    $divlist->EnableSaveButton(FALSE);
-    $divlist->SetInformation(_("This menu allows you to add, remove and change the properties of system deployment tasks."));
-    /* Display add button if allowed */ 
-    $header = "<div style='padding:5px'>";
-    if($this->acl_is_createable()){ 
-      $header .= "<input type='image' src='images/gotomasses_new_task.png' name='new_task' class='center'>&nbsp;";
-    }
-
-    /* Display add button if allowed */ 
-    if($this->acl_is_removeable()){ 
-      $header .= "<input type='image' src='images/edittrash.png' name='remove_multiple_task' class='center'>&nbsp;";
-    }
-    $header .= "</div>";
-
-    /* Get Permissions */ 
-    $ui = get_userinfo();
-    $acls = $this->getacl("");
-    foreach($ui->get_module_departments("gotomasses") as $dep){
-      $acls .= $ui->get_category_permissions($dep,"gotomasses");
-    }
-    /* Create divlist */
-    $divlist->SetListHeader($header);
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $divlist->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-
-    $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=object'>"._("Target")."</a>"));
-    $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=schedule'>"._("Schedule")."</a>",
-                                      "attach"=>"style='width:100px;'"));
-    $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=action'>"._("Type")."</a>",
-                                      "attach"=>"style='width:80px;'"));
-    $divlist->AddHeader(array("string"=>_("Action"),
-                                      "attach"=>"style='border-right:0px;width:40px;'"));
-
-    /* Create edit link */
-    $edit_link = "<div style='width:100%;overflow:hidden;'><nobr><a href='?plug=".$_GET['plug']."&act=edit&id=%key%'>%str%</nobr></div>";
-  
-    if(!empty($acls)){
-      foreach($this->tasks as $key => $task){
-        $action = "<input type='image' src='images/edit.png' name='edit_task_".$key."' class='center' alt='"._("Edit")."'>";
-        if($this->acl_is_removeable()){
-          $action.= "<input type='image' src='images/edittrash.png' name='remove_task_".$key."' class='center' alt='"._("Reomve")."'>";
-        }
-        /* Create each field */
-        $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                        "attach" => "style='width:20px;'");
-
-        $field1 = array("string" => preg_replace(array("/%key%/","/%str%/"),array($key,$this->target_to_string($task)),$edit_link));
-        $field2 = array("string" => $this->time_to_string($task),"attach" => "style='width:100px;'");
-        $field3 = array("string" => $this->action_to_string($task),"attach" => "style='width:80px;'");
-        $field4 = array("string" => $action,"attach" => "style='text-align:right;width:40px;border-right:0px;'");
-        $divlist->AddElement(array($field0,$field1,$field2,$field3,$field4));
-      }
-    }
-    return($divlist->Draw());
+    $list = new divListMasses($this->config,$this);
+    $list->SetEntries($this->tasks); 
+    return($list->Draw());
   }