summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: de01c78)
raw | patch | inline | side by side (parent: de01c78)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 23 Sep 2009 08:51:45 +0000 (08:51 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 23 Sep 2009 08:51:45 +0000 (08:51 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14327 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_licenceGeneric.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_licenceGeneric.inc
index aaf9ff3ae63f05b60024379df27f77b1236ffada..19c295bd333e61d6ca907b3a3b29afd915780028 100644 (file)
var $cn = "";
var $orig_cn = "";
var $description = "";
-
var $orig_dn = "";
+
var $data = array();
var $orig_data = array();
-
var $productIds = array();
var $softwareIds= array();
- var $licenses= array();
+ var $licenses = array();
var $availableProductIds = array();
-
var $attributes =array("cn","description");
-
var $si = NULL;
function __construct(&$config,$dn)
$smarty->assign("availableProductIds", array_diff( $this->availableProductIds, $this->productIds));
$smarty->assign("productIds", $this->productIds);
$smarty->assign("softwareIds", $this->softwareIds);
- $smarty->assign("licenses", $this->licenses);
+ $smarty->assign("licenses", $this->getLicenseList());
$smarty->assign("initially_was_account", $this->initially_was_account);
return($smarty->fetch(get_template_path('licenseGeneric.tpl',TRUE,dirname(__FILE__))));
}
+
+ function getLicenseList()
+ {
+ $list = new divSelectBox("test");
+ $list->setHeight(100);
+
+
+
+ return($list->DrawList());
+ }
+
/* Save HTML inputs
*/
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_licenceUsage.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_licenceUsage.inc
--- /dev/null
@@ -0,0 +1,155 @@
+<?php
+/*
+* This code is part of GOsa (http://www.gosa-project.org)
+* Copyright (C) 2003-2008 GONICUS GmbH
+*
+* ID: $$Id: class_opsiLicenses.inc 13520 2009-03-09 14:54:13Z hickert $$
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+
+class licenseUsage extends plugin
+{
+
+ var $cn = "";
+
+ var $init_successfull = FALSE;
+
+
+ function __construct(&$config,$dn)
+ {
+ $this->config = $config;
+ $this->dn = $this->orig_dn = $dn;
+ $this->si = new opsiLicenceHandler($this->config);
+
+ $this->is_account=TRUE;
+ if($this->dn == "new"){
+ $this->initially_was_account = FALSE;
+ }else{
+ $this->initially_was_account = TRUE;
+ $this->cn = $this->orig_cn = preg_replace("/^opsi:cn=([^,]*),.*$/","\\1",$dn);
+ }
+
+ // Extract pool name out of the fake dn.
+ $this->init();
+ }
+
+
+ function init()
+ {
+ $this->init_successfull = TRUE;
+ }
+
+
+ function execute()
+ {
+ // Handle initialization failures.
+ if(isset($_POST['retry_init'])) $this->init();
+ if(!$this->init_successfull){
+ $smarty = get_smarty();
+ $smarty->assign("init_successfull", $this->init_successfull);
+ return($smarty->fetch(get_template_path('licenseGeneric.tpl',TRUE,dirname(__FILE__))));
+ }
+
+ $smarty = get_smarty();
+
+ // Assign ACls
+ $plInfo = $this->plInfo();
+ foreach($plInfo['plProvidedAcls'] as $name => $desc){
+ $smarty->assign("{$name}ACL",$this->getacl($name));
+ }
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr,$this->$attr);
+ }
+
+ $smarty->assign("init_successfull", $this->init_successfull);
+ $smarty->assign("initially_was_account", $this->initially_was_account);
+ return($smarty->fetch(get_template_path('licenseUsage.tpl',TRUE,dirname(__FILE__))));
+ }
+
+
+ /* Save HTML inputs
+ */
+ function save_object()
+ {
+ if(isset($_POST['opsiLicenseUsagePosted'])){
+ plugin::save_object();
+ }
+ }
+
+
+ /* Check user input and return a list of 'invalid input' messages.
+ */
+ function check()
+ {
+ $message = plugin::check();
+ return($message);
+ }
+
+
+ /* Saves object modifications
+ */
+ function save()
+ {
+ plugin::save();
+
+ // Send modify/add events
+ $mode = "modify";
+ if($this->orig_dn == "new"){
+ $mode = "add";
+ }
+
+ $this->si->createPool($this->cn, $this->description,$this->productIds,$this->softwareIds);#
+ if($this->si->is_error()){
+ msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
+ }else{
+ $this->handle_post_events($mode);
+ }
+
+ // Log action
+ if($mode == "modify"){
+ new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$this->si->get_error());
+ }else{
+ new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$this->si->get_error());
+ }
+
+ return 0;
+ }
+
+
+ function remove_from_parent(){ return; }
+
+
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Usage"),
+ "plDescription" => _("License usage"),
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 1,
+ "plSection" => array("administration"),
+ "plCategory" => array("opsi"),
+ "plProvidedAcls"=> array(
+ "cn" => _("Name"),
+ "description" => _("Description"))
+ ));
+ }
+}
+
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc
index 6a3ea5bc993daeefb3b423065c7895d8c1a43f47..fa75d84a1be3783b36758b082f6f6c62414676d3 100644 (file)
$data= array();
$data['licensePoolId'] = htmlentities($licensePoolId);
$res = $this->send_data("gosa_opsi_getLicensePool_hash",$this->target,$data,TRUE);
-
if(isset($res['XML'][0]['ANSWER_OPSI_GETLICENSEPOOL_HASH'])){
$item = array();
foreach(array("LICENSEPOOLID" => "cn",
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/licenseGeneric.tpl b/gosa-plugins/opsi/admin/opsiLicenses/licenseGeneric.tpl
index 9b9252eefe44e0dbd46c59442badb5d5f79fcf59..4e3fe3ec43712db1b0a673d8a6e6f26724148e18 100644 (file)
<table width="100%">
<tr>
- <td colspan="3">
+ <td style='vertical-align:top;'>
<!-- GENERIC -->
<h2>{t}Generic{/t}</h2>
<table>
</table>
</td>
- </tr>
- <tr>
- <td colspan="3">
- <p class='separator'> </p>
- </td>
- </tr>
- <tr>
- <td style='width:33%'>
+ <td style='width:50%; border-left: 1px solid #888888;padding: 5px;'>
<!-- LICENSES -->
<h2>{t}Licenses{/t}</h2>
<table style='width:100%;'>
<tr>
<td>
- <select name='licenses[]' multiple size=4 style="width:100%;">
- {html_options options=$licenses}
- </select>
+ {$licenses}
</td>
</tr>
</table>
</td>
- <td style='width:33%'>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <p class='separator'> </p>
+ </td>
+ </tr>
+ <tr>
+ <td style='width:50%'>
<!-- APPLICATIONS -->
<h2>{t}Applications{/t}</h2>
<table style='width:100%;'>
<tr>
<td>
- <select name='productIds[]' multiple size=4 style="width:100%;">
+ <select name='productIds[]' multiple size="6" style="width:100%;">
{html_options options=$productIds}
</select><br>
<select name='availableProduct'>
</table>
</td>
- <td>
+ <td style="border-left: 1px solid #888888; padding: 5px;">
<!-- SOFTWARE -->
<h2>{t}Windows software IDs{/t}</h2>
<table style='width:100%;'>
<tr>
<td>
- <select name='softwareIds[]' multiple size=4 style="width:100%;">
+ <select name='softwareIds[]' multiple size="6" style="width:100%;">
{html_options options=$softwareIds}
</select>
<input type='text' name='newSoftwareId' value='' size=10>
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/licenseUsage.tpl b/gosa-plugins/opsi/admin/opsiLicenses/licenseUsage.tpl
--- /dev/null
@@ -0,0 +1,30 @@
+{if !$init_successfull}
+<br>
+<b>{msgPool type=siError}</b><br>
+{t}Check if the GOsa support daemon (gosa-si) is running.{/t}
+<input type='submit' name='retry_init' value="{t}retry{/t}">
+<br>
+<br>
+{else}
+
+
+<table width="100%">
+ <tr>
+ <td style='vertical-align:top;'>
+
+ <!-- GENERIC -->
+ <h2>{t}Generic{/t}</h2>
+ <table>
+ <tr>
+ <td>{t}Name{/t}</td>
+ <td>
+ TESTER
+ </td>
+ </tr>
+ </table>
+
+ </td>
+ </tr>
+</table>
+<input name='opsiLicenseUsagePosted' value='1' type='hidden'>
+{/if}