summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 74696a0)
raw | patch | inline | side by side (parent: 74696a0)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 1 Oct 2009 14:10:46 +0000 (14:10 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 1 Oct 2009 14:10:46 +0000 (14:10 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14447 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/personal/posix/class_posixAccount.inc | patch | blob | history | |
gosa-core/plugins/personal/posix/posix_shadow.tpl | patch | blob | history |
diff --git a/gosa-core/plugins/personal/posix/class_posixAccount.inc b/gosa-core/plugins/personal/posix/class_posixAccount.inc
index 3c9e99fbea905a3a9d522c5d07fd3303f5f6aa22..f933d29fdb0ac6d6cf24588b8a7d917783a2f15f 100644 (file)
var $shadowWarning= "0";
var $shadowLastChange= "0";
var $shadowInactive= "0";
- var $shadowExpire= "0";
+ var $shadowExpire= "";
var $gosaDefaultPrinter= "";
var $accessTo= array();
var $trustModel= "";
}
}
- /* Convert to seconds */
- $this->shadowExpire= $this->convertToSeconds($this->shadowExpire);
+ /* Convert shadowExpire for usage */
+ if ($this->shadowExpire == 0){
+ $this->shadowExpire= "";
+ } else {
+ $this->shadowExpire= date('d.m.Y', $this->shadowExpire * 60 * 60 * 24);
+ }
+
/* Generate shell list from CONFIG_DIR./shells */
if (file_exists(CONFIG_DIR.'/shells')){
/* Templates now! */
$smarty= get_smarty();
+ $smarty->assign("usePrototype", "true");
/* Show ws dialog */
if ($this->show_ws_dialog){
// Set last system login
$smarty->assign("gotoLastSystemLogin",$this->gotoLastSystemLogin);
- /* Fill calendar */
- /* If this $this->shadowExpire is empty
- use current date as base for calculating selectbox values.
- (This attribute is empty if this is a new user )*/
- if(empty($this->shadowExpire)){
- $date= getdate(time());
- }else{
- $date= getdate($this->shadowExpire);
- }
-
- $days= array();
- for($d= 1; $d<32; $d++){
- $days[$d]= $d;
- }
- $years= array();
- for($y= $date['year']-10; $y<$date['year']+10; $y++){
- $years[]= $y;
- }
- $months= msgPool::months();
- $smarty->assign("day", $date["mday"]);
- $smarty->assign("days", $days);
- $smarty->assign("months", $months);
- $smarty->assign("month", $date["mon"]-1);
- $smarty->assign("years", $years);
- $smarty->assign("year", $date["year"]);
-
/* Fill arrays */
$smarty->assign("shells", $this->loginShellList);
$smarty->assign("secondaryGroups", $this->secondaryGroups);
$this->$var = $_POST[$var];
}else{
$this->$activate_var = false;
- $this->$var = 0;
+ if ($var != "shadowExpire") {
+ $this->$var = 0;
+ }
}
}
}
if (!$this->activate_shadowExpire){
$this->shadowExpire= "0";
} else {
- /* Transform seconds to days here */
- $this->shadowExpire= (int)($this->shadowExpire / (60 * 60 * 24)) ;
+ /* Transform date to days since the beginning */
+ list($day, $month, $year)= split('\.', $this->shadowExpire, 3);
+ $this->shadowExpire= (int)(mktime(0, 0, 0, $month, $day, $year)/ (60 * 60 * 24)) ;
}
if (!$this->activate_shadowMax){
$this->shadowMax= "0";
}
}
+ /* Check dates */
+ if ($this->activate_shadowExpire && ($this->shadowExpire == "" || !tests::is_date($this->shadowExpire))){
+ $message[]= msgPool::invalid("shadowExpire", $this->shadowExpire);
+ }
+
/* Check shadow settings, well I like spaghetties... */
if ($this->activate_shadowMin){
if (!tests::is_id($this->shadowMin)){
diff --git a/gosa-core/plugins/personal/posix/posix_shadow.tpl b/gosa-core/plugins/personal/posix/posix_shadow.tpl
index 79c0ebe33444a6545d2270cdc104107b21d6fe33..9c15386f7cbaf588daa78e7c98085bbebc7e23bd 100644 (file)
<!-- activate_shadowExpire -->
{render acl=$shadowExpireACL checkbox=$multiple_support checked=$use_activate_shadowExpire}
- <input type="checkbox" class="center" name="activate_shadowExpire" value="1" {$activate_shadowExpire}>
+ <table border="0" cellpadding="0" cellspacing="0"><tr><td><input type="checkbox" class="center" name="activate_shadowExpire" value="1" {$activate_shadowExpire}>
{/render}
- {t}Password expires on{/t}
-{render acl=$shadowExpireACL}
- <select name=day onChange="createResult(this.form,this.form.shadowExpire);">
- {html_options values=$days output=$days selected=$day}
- </select>
-{/render}
-{render acl=$shadowExpireACL}
- <select name=month onChange="populate(this.form,this.form.shadowExpire);">
- {html_options options=$months selected=$month}
- </select>
-{/render}
-{render acl=$shadowExpireACL}
- <select name=year onChange="populate(this.form,this.form.shadowExpire);">
- {html_options values=$years output=$years selected=$year}
- </select>
- <input type="hidden" name="shadowExpire" value="{$shadowExpire}">
-{/render}
- <br>
+ {t}Password expires on{/t}
+ {render acl=$shadowExpireACL}
+ </td><td style='width:130px'>
+ <input type="text" id="shadowExpire" name="shadowExpire" class="date" style='width:100px' value="{$shadowExpire}">
+ {if $shadowExpireACL|regex_replace:"/[cdmr]/":"" == "w"}
+ <script type="text/javascript">
+ {literal}
+ var datepicker = new DatePicker({ relative : 'shadowExpire', language : '{/literal}{$lang}{literal}',
+ keepFieldEmpty : true, enableCloseEffect : false, enableShowEffect : false});
+ {/literal}
+ </script>
+ {/if}
+ </td></tr></table>
+ {/render}
<!-- shadowInactive -->
{render acl=$shadowInactiveACL checkbox=$multiple_support checked=$use_activate_shadowInactive}
</td>
</tr>
</table>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
- <!--
- // Populate expiery dialog
- populate(document.mainform,document.mainform.shadowExpire);
- -->
-</script>