Code

Updated licenses
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 22 Sep 2009 12:22:48 +0000 (12:22 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 22 Sep 2009 12:22:48 +0000 (12:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14309 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/opsi/admin/opsiLicenses/class_divListLicenses.inc
gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc
gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc
gosa-plugins/opsi/admin/opsiLicenses/remove.tpl [new file with mode: 0644]

index 67657a641a39e8fe8af454595e65573f812ed9f7..02e70d91fb48dea99587eed6162e1698715d25b3 100644 (file)
@@ -142,13 +142,13 @@ class divListLicense extends MultiSelectWindow
 
     // Assigning licenses
     foreach($list as $key => $val){
-      
+     
       // Get object permissions
       $acl    = $ui->get_permissions($val['dn'],"opsi/licenseGeneric");
       $acl_all= $ui->has_complete_category_acls($val['dn'],"opsi");
 
       // Create edit and remove icon buttons
-      $actions.= "<input class='center' type='image'
+      $actions = "<input class='center' type='image'
         src='images/lists/edit.png' alt='"._("edit")."' 
         name='license_edit_%KEY%' title='"._("Edit this entry")."'>";
       if(preg_match("/d/",$acl)){
@@ -160,6 +160,7 @@ class divListLicense extends MultiSelectWindow
           title='".msgPool::permDelete()."'>";
       }
 
+
       // Append license descriptio, if available
       $title = "title='".preg_replace('/ /', '&nbsp;', LDAP::fix($val['dn']))."'";
       if(!isset($val['description'][0])){
@@ -167,6 +168,7 @@ class divListLicense extends MultiSelectWindow
       }else{
         $desc = " - [ ".$val['description'][0]." ]";
       }
+      $display = $val['cn'][0].$desc;
 
       // Append the entry to the divlist
       $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' 
index f835c0fdabaf3cba91b23e6e3d566398e5225c9a..bad066d425179c631b7bb0aeddc1337243b464be 100644 (file)
@@ -18,11 +18,33 @@ class opsiLicenceHandler extends opsi  {
   {
     $data= array();
     $res = $this->send_data("gosa_opsi_getLicensePools_listOfHashes",$this->target,$data,TRUE);
+    
     $items  = array();
     if(isset($res['XML'][0]['RESULT'][0]['HIT'])){
       $items = $res['XML'][0]['RESULT'][0]['HIT'];
+      $data =array();
+      foreach($items as $item){
+        $entry = array();
+        foreach(
+          array(
+            "DESCRIPTION"       => "description",
+            "LICENSEPOOLID"     => "cn",
+            "PRODUCTIDS"        => "productId",
+            "WINDOWSSOFTWAREIDS"=> "softwareId") as $source => $dest){
+        
+          if(isset($item[$source])){
+            $entry[$dest] = array('count' => 0);
+            foreach($item[$source] as $obj){
+              $entry[$dest][] = $obj['VALUE'];
+            }
+            $entry[$dest]['count'] = (count($entry[$dest]) -1 );
+          } 
+        }
+        $data[] =$entry;
+      }
+      return($data);
     }
-    return($items);
+    return(FALSE);
   }
 
 
index 9112b1e3fbc7c7b7e405ef4a512fb6ea90fecbf9..631b132e10e1c7d564b439e6cdcf7359e97ac6de 100644 (file)
@@ -281,8 +281,17 @@ class opsiLicenses extends plugin
     $base     = $this->DivListLicenses->selectedBase;
     $Regex    = $this->DivListLicenses->Regex;
 
-    // Search and fetch all matching license objects.
+    $si = new opsiLicenceHandler($this->config);
+    $res = $si->listPools();
+
+    // Reset the list of licenses 
     $this->licenses = array();
+    foreach($res as $item){
+
+      // Fake an ldap entry, this enables ACL checks.
+      $item['dn'] = "opsi:cn=".$item['cn'][0].",".$this->config->current['BASE'];
+      $this->licenses[] = $item;
+    }
   }
 
 
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/remove.tpl b/gosa-plugins/opsi/admin/opsiLicenses/remove.tpl
new file mode 100644 (file)
index 0000000..76cf288
--- /dev/null
@@ -0,0 +1,18 @@
+<div style="font-size:18px;">
+  <img alt="" src="images/warning.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+
+<p>
+  {$info}
+  {t}Please double check if you really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+<p>
+  {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+       <input type=submit name="delete_multiple_roles_confirm" value="{msgPool type=delButton}">
+               &nbsp;
+       <input type=submit name="delete_multiple_roles_cancel" value="{msgPool type=cancelButton}">
+</p>
+