summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7b85e02)
raw | patch | inline | side by side (parent: 7b85e02)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 30 Sep 2009 12:49:39 +0000 (12:49 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 30 Sep 2009 12:49:39 +0000 (12:49 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14409 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/opsi/admin/opsiLicenses/class_licenseGeneric.inc | patch | blob | history | |
gosa-plugins/opsi/admin/opsiLicenses/licenseGeneric.tpl | patch | blob | history |
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_licenseGeneric.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_licenseGeneric.inc
index 27a10af215fdaf626a6e4abffac156d173f7a27c..297dea7e602f6562f13d1b52dfb3b71fdb09cdee 100644 (file)
class licenseGeneric extends plugin
{
+ // License attributes
var $si = NULL;
var $data = array();
var $cn = "";
var $description = "";
var $partner = "";
+ // Date attributes
var $conclusionDate = "";
var $expirationDate = "";
var $notificationDate = "";
+ // License model related attribues
var $licenseModel = "";
var $licenseKey = array();
var $orig_licenseModel = "";
function init()
{
+ // Extract license information out of the license object ($this->data)
$this->boundToHost = array('0'=>"");
$this->usedByHost = array('0'=>"");
$this->licenseKey = array('0'=>"");
foreach($this->attributes as $attr){
$this->$attr = $this->data[$attr];
}
+
+ // Fix dates
+ foreach(array("notificationDate","expirationDate","conclusionDate") as $date) {
+ if(!empty($this->$date)){
+ $this->$date = date("d.m.Y",strtotime($this->$date));
+ }
+ }
}
$this->orig_cn = $this->cn;
$smarty = get_smarty();
- // Assign ACls
+ // Assign attributes and its ACls
$plInfo = $this->plInfo();
foreach($plInfo['plProvidedAcls'] as $name => $desc){
$smarty->assign("{$name}ACL",$this->getacl($name));
$smarty->assign($attr,$this->$attr);
}
+ // Assign list of available license models
$smarty->assign("licenseModels",array(
"RETAIL" => _("Retail"),
"OEM"=>_("OEM"),
"VOLUME" => _("Volume")));
-
+ $smarty->assign("usePrototype", "true");
$smarty->assign("init_successfull", $this->init_successfull);
$smarty->assign("initially_was_account", $this->initially_was_account);
$smarty->assign("hosts", $this->getHosts());
$ui = get_userinfo();
-
$acl_base = $this->dn;
if($acl_base == "new"){
$acl_base = $this->config->current['BASE'];
}
-
$smarty->assign("licenseACL", $ui->get_permissions($acl_base,"opsi/licensePoolGeneric","licenses"));
$smarty->assign("writeable", preg_match("/w/",$ui->get_permissions($acl_base,"opsi/licensePoolGeneric","licenses")));
-
$smarty->assign("notUsedHosts", array_diff($this->getHosts(), $this->usedByHost));
$smarty->assign("boundToHost", $this->boundToHost[0]);
$smarty->assign("licenseKey", $this->licenseKey[0]);
// Very simple date input checks
if(!empty($this->expirationDate) &&
- !preg_match("/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/",$this->expirationDate)){
+ !preg_match("/^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$/",$this->expirationDate)){
$message[] = msgPool::invalid(_("Expiration date"),$this->expirationDate,"","2009-02-23");
}
if(!empty($this->conclusionDate) &&
- !preg_match("/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/",$this->conclusionDate)){
+ !preg_match("/^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$/",$this->conclusionDate)){
$message[] = msgPool::invalid(_("Expiration date"),$this->conclusionDate,"","2009-02-23");
}
if(!empty($this->notificationDate) &&
- !preg_match("/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/",$this->notificationDate)){
+ !preg_match("/^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$/",$this->notificationDate)){
$message[] = msgPool::invalid(_("Expiration date"),$this->notificationDate,"","2009-02-23");
}
foreach($this->attributes as $target){
$data[$target] = $this->$target;
}
+
+ // Return opsi like dates.
+ foreach(array("notificationDate","expirationDate","conclusionDate") as $date) {
+ if(!empty($this->$date)){
+ $data[$date] = date("Y-m-d",strtotime($this->$date));
+ }
+ }
+
return($data);
}
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/licenseGeneric.tpl b/gosa-plugins/opsi/admin/opsiLicenses/licenseGeneric.tpl
index 428b8ec946206bd56701c36c44c1f5c955339a71..da685ce02b6baf19f3199004a28369604f41d2c8 100644 (file)
<td>
{t}Conclusion date{/t}
</td>
- <td>
+ <td style='width:300px;'>
{render acl=$licenseACL}
- <input type='text' name='conclusionDate' value='{$conclusionDate}'>
+ <input type="text" id="date1" name="conclusionDate" value="{$conclusionDate}" class="date" />
+ {literal}
+ <script type="text/javascript">
+ /*<[CDATA[*/
+ var datepicker = new DatePicker({
+ relative : 'date1',
+ language : 'de'
+ });
+ /*]]>*/
+ </script>
+ {/literal}
{/render}
</td>
</tr>
<td>
{t}Expiration date{/t}
</td>
- <td>
+ <td style='width:300px;'>
{render acl=$licenseACL}
- <input type='text' name='expirationDate' value='{$expirationDate}'>
+ <input type="text" id="date2" name="expirationDate" value="{$expirationDate}" class="date" />
+ {literal}
+ <script type="text/javascript">
+ /*<[CDATA[*/
+ var datepicker = new DatePicker({
+ relative : 'date2',
+ language : 'de'
+ });
+ /*]]>*/
+ </script>
+ {/literal}
{/render}
</td>
</tr>
<td>
{t}Notification date{/t}
</td>
- <td>
+ <td style='width:300px;'>
{render acl=$licenseACL}
- <input type='text' name='notificationDate' value='{$notificationDate}'>
+ <input type="text" id="date3" name="notificationDate" value="{$notificationDate}" class="date" >
+ {literal}
+ <script type="text/javascript">
+ /*<[CDATA[*/
+ var datepicker = new DatePicker({
+ relative : 'date3',
+ language : 'de'
+ });
+ /*]]>*/
+ </script>
+ {/literal}
{/render}
</td>
</tr>
</td>
</tr>
</table>
+{literal}
+<script type="text/javascript">
+ /*<[CDATA[*/
+ var datepicker = new DatePicker({
+ relative : 'date',
+ language : 'de'
+ });
+ /*]]>*/
+</script>
+{/literal}
<input name='opsiLicensesPosted' value='1' type='hidden'>
{/if}