summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6988180)
raw | patch | inline | side by side (parent: 6988180)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 28 Sep 2009 12:54:53 +0000 (12:54 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 28 Sep 2009 12:54:53 +0000 (12:54 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14372 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsageByHost.inc | patch | blob | history | |
gosa-plugins/opsi/admin/opsiLicenses/licenseUsageByHost.tpl | patch | blob | history |
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsageByHost.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsageByHost.inc
index 4618df364ef36fac0139f2a198c11476d46e45a0..d2b0817ed53b2f35d00c836adbf9c417e3dc8886 100644 (file)
// Get license usage
$res = $this->si->getLicenseUsage($this->cn);
if($this->si->is_error()){
+ msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
$this->init_successfull = FALSE;
return;
}
// Get reservations
$res = $this->si->getReservedLicensesForHost($this->cn);
if($this->si->is_error()){
+ msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
$this->init_successfull = FALSE;
return;
}
// Get list of license pools
$res = $this->si->listPools();
if($this->si->is_error()){
+ msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
$this->init_successfull = FALSE;
return;
}
$list = new divSelectBox("licenseUsage");
$list->setHeight(150);
foreach($this->licenseUses as $license){
- $f3 = array("string" => $license['licenseKey'][0]);
- $f2 = array("string" => $license['licensePoolId'][0]);
- $f4 = array("string" => $license['softwareLicenseId'][0]);
- $list->addEntry(array($f2,$f3,$f4));
+ if(preg_match("/r/i",$this->getacl('hostId'))){
+ $f3 = array("string" => $license['licenseKey'][0]);
+ $f2 = array("string" => $license['licensePoolId'][0]);
+ $f4 = array("string" => $license['softwareLicenseId'][0]);
+ $list->addEntry(array($f2,$f3,$f4));
+ }
}
// Create reserved list
$list2 = new divSelectBox("reservedLicenses");
$list2->setHeight(150);
foreach($this->reservedLicenses as $key => $license){
- $action = "<input class='center' type='image' src='images/lists/trash.png'
- name='removeReservation_{$key}'>";
- $f1 = array("string" => $license);
- $f4 = array("string" => $action,
- "attach" => "style='border-right:0px; width:16px;'");
- $list2->addEntry(array($f1,$f4));
+ if(preg_match("/r/i",$this->getacl('boundToHost'))){
+
+ // Display remove button in case of write permissions
+ $action = "";
+ if(preg_match("/w/i",$this->getacl('boundToHost'))){
+ $action = "<input class='center' type='image' src='images/lists/trash.png'
+ name='removeReservation_{$key}'>";
+ }
+ $f1 = array("string" => $license);
+ $f4 = array("string" => $action,
+ "attach" => "style='border-right:0px; width:16px;'");
+ $list2->addEntry(array($f1,$f4));
+ }
}
$smarty = get_smarty();
if(isset($_POST['opsiLicenseUsagePosted'])){
plugin::save_object();
- // Check if we've to remove reservations
- foreach($_POST as $name => $value){
- if(preg_match("/^removeReservation_/", $name)){
- $id = preg_replace("/^removeReservation_(.*)_.$/", "\\1" ,$name);
- if(isset($this->reservedLicenses[$id])) {
- unset($this->reservedLicenses[$id]);
+ if(preg_match("/w/i",$this->getacl('boundToHost'))){
+
+ // Check if we've to remove reservations
+ foreach($_POST as $name => $value){
+ if(preg_match("/^removeReservation_/", $name)){
+ $id = preg_replace("/^removeReservation_(.*)_.$/", "\\1" ,$name);
+ if(isset($this->reservedLicenses[$id])) {
+ unset($this->reservedLicenses[$id]);
+ }
+ break;
}
- break;
- }
- }
+ }
- // Check if we've to add reservations
- if(isset($_POST['availableLicense']) && isset($_POST['addReservation'])){
- $id = get_post('availableLicense');
- if(isset($this->availableLicenses[$id])){
- $this->reservedLicenses[] = $this->availableLicenses[$id];
+ // Check if we've to add reservations
+ if(isset($_POST['availableLicense']) && isset($_POST['addReservation'])){
+ $id = get_post('availableLicense');
+ if(isset($this->availableLicenses[$id]) && !in_array($this->availableLicenses[$id],$this->reservedLicenses)){
+ $this->reservedLicenses[] = $this->availableLicenses[$id];
+ }
}
}
}
"plSection" => array("administration"),
"plCategory" => array("opsi"),
"plProvidedAcls"=> array(
- "cn" => _("Name"),
- "description" => _("Description"))
+ "hostId" => _("Used by host")." ("._("read only").")",
+ "boundToHost" => _("License revervation"))
));
}
}
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/licenseUsageByHost.tpl b/gosa-plugins/opsi/admin/opsiLicenses/licenseUsageByHost.tpl
index 68eae0a0a7ae0036ae63511e4afb4b16142a4e4b..c9a60fa340f0536d14d990339b5f149c8908af9f 100644 (file)
<tr>
<td style='vertical-align:top;width: 50%; padding: 5px; border-right: solid 1px #AAA; '>
<h2>{t}Licenses used{/t}</h2>
+{render acl=$boundToHostACL}
{$licenseUses}
+{/render}
</td>
<td style='vertical-align:top;'>
<h2>{t}Licenses reserved for this host{/t}</h2>
+{render acl=$boundToHostACL}
{$licenseReserved}
+{/render}
+{render acl=$boundToHostACL}
<select name='availableLicense'>
+{/render}
{html_options options=$availableLicenses}
</select>
+{render acl=$boundToHostACL}
<input type='submit' name='addReservation' value='{msgPool type=addButton}'>
+{/render}
</td>
</tr>
</table>