summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c229c99)
raw | patch | inline | side by side (parent: c229c99)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 23 Sep 2009 13:47:27 +0000 (13:47 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 23 Sep 2009 13:47:27 +0000 (13:47 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14334 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 83054a7da0b44e6a81e9627ccfd380c905fab875..60a94f6db9081b9c3d935257a1b0a4d6dcab788a 100644 (file)
var $cn = "";
var $licenseUses = array();
+ var $reservedLicenses = array();
var $init_successfull = FALSE;
+ var $availableLicenses = array();
function __construct(&$config,$dn)
{
}else{
$res = $this->si->getLicenseUsage($this->cn);
- if($this->si->is_error() || !$res){
+ if($this->si->is_error()){
$this->init_successfull = FALSE;
return;
}
$this->licenseUses = $res;
+ $this->reservedLicenses = $res;
+ $this->init_reservedLicenses = $res;
$this->init_successfull = TRUE;
}
+
+ $this->availableLicenses = array("Dummy","Schinken");
}
$list = new divSelectBox("licenseUsage");
$list->setHeight(150);
foreach($this->licenseUses as $license){
- $f1 = array("string" => $license['hostId'][0]);
- $f2 = array("string" => $license['licenseKey'][0]);
- $f3 = array("string" => $license['licensePoolId'][0]);
+ $f3 = array("string" => $license['licenseKey'][0]);
+ $f2 = array("string" => $license['licensePoolId'][0]);
$f4 = array("string" => $license['softwareLicenseId'][0]);
- $list->addEntry(array($f1,$f2,$f3,$f4));
+ $list->addEntry(array($f2,$f3,$f4));
}
// Create reserved list
$list2 = new divSelectBox("reservedLicenses");
$list2->setHeight(150);
- foreach($this->licenseUses as $license){
- $f1 = array("string" => $license['hostId'][0]);
+ foreach($this->reservedLicenses as $key => $license){
+ $action = "<input class='center' type='image' src='images/lists/trash.png'
+ name='removeReservation_{$key}'>";
+ $f1 = array("string" => $license['licensePoolId'][0]);
$f2 = array("string" => $license['licenseKey'][0]);
- $f3 = array("string" => $license['licensePoolId'][0]);
- $f4 = array("string" => $license['softwareLicenseId'][0]);
- $list2->addEntry(array($f1,$f2,$f3,$f4));
+ $f3 = array("string" => $license['softwareLicenseId'][0]);
+ $f4 = array("string" => $action,
+ "attach" => "style='border-right:0px;'");
+ $list2->addEntry(array($f1,$f2,$f3, $f4));
}
$smarty = get_smarty();
$smarty->assign("licenseUses", $list->DrawList());
$smarty->assign("licenseReserved", $list2->DrawList());
$smarty->assign("init_successfull", $this->init_successfull);
+ $smarty->assign("availableLicenses", $this->availableLicenses);
$smarty->assign("initially_was_account", $this->initially_was_account);
return($smarty->fetch(get_template_path('licenseUsageByHost.tpl',TRUE,dirname(__FILE__))));
}
{
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]);
+ }
+ break;
+ }
+ }
+
+ // Check if we've to add reservations
+ if(isset($_POST['availableLicense']) && isset($_POST['addReservation'])){
+ echo get_post('availableLicense');
+ }
}
}
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/licenseUsageByHost.tpl b/gosa-plugins/opsi/admin/opsiLicenses/licenseUsageByHost.tpl
index 8305a8184e29c32ee1812120d86d9e69032f5a3b..fd7c572027e440b0d860e59dd10dcdfb743ee615 100644 (file)
<br>
{else}
-<!-- GENERIC -->
-<h2>{t}Licenses used{/t}</h2>
-{$licenseUses}
-<h2>{t}Licenses reserved for this host{/t}</h2>
-{$licenseReserved}
+<table width="100%">
+ <tr>
+ <td style='vertical-align:top;width: 50%; padding: 5px; border-right: solid 1px #888888; '>
+ <h2>{t}Licenses used{/t}</h2>
+ {$licenseUses}
+ </td>
+ <td style='vertical-align:top;'>
+ <h2>{t}Licenses reserved for this host{/t}</h2>
+ {$licenseReserved}
+ <select name='availableLicense'>
+ {html_options options=$availableLicenses}
+ </select>
+ <input type='submit' name='addReservation' value='{msgPool type=addButton}'>
+ </td>
+ </tr>
+</table>
<input name='opsiLicenseUsagePosted' value='1' type='hidden'>
{/if}