Code

Updated to (not working) datepicker
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 2 Oct 2009 07:06:57 +0000 (07:06 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 2 Oct 2009 07:06:57 +0000 (07:06 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14456 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/mail/personal/mail/class_mailAccount.inc
gosa-plugins/mail/personal/mail/generic.tpl

index 7f00182e86ed60ef60adc5a616cc3f4f83acb175..02eb27896ab02b1fd911786292cde060beb6ba71 100644 (file)
@@ -379,6 +379,7 @@ class mailAccount extends plugin
       SMARTY- Assign smarty variables 
      ****************/
     $smarty = get_smarty();
+    $smarty->assign("usePrototype", "true");
     $smarty->assign("initially_was_account", $this->initially_was_account);
     $smarty->assign("isModifyableMail"  , $this->mailMethod->isModifyableMail());
     $smarty->assign("isModifyableServer", $this->mailMethod->isModifyableServer());
index e186fd7892ead99c2ed2cb9e71fb9086e8a5499d..dde2bfa001196a16097cc7e67be320f40125749e 100644 (file)
    <input type=checkbox name="use_vacation" value="1" {$use_vacation} 
     id="use_vacation" {if $own_script != ""} disabled {/if}
     title="{t}Select to automatically response with the vacation message defined below{/t}" class="center" 
-    onclick="changeState('day'); changeState('month'); changeState('year'); 
-    changeState('sday'); changeState('smonth'); changeState('syear');"> {t}Activate vacation message{/t}
+    onclick="changeStates()"> {t}Activate vacation message{/t}
 {/render}
 
    <br>
    <table>
     <tr>
      <td>{t}from{/t}</td>
-     <td>
-{render acl=$gosaVacationMessageACL}
-      <select {if $own_script != "" || $use_vacation == ""} disabled {/if} name=day id="day" 
-       onChange="createResult(this.form,this.form.gosaVacationStart);">
-       {html_options values=$days output=$days selected=$start_day}
-      </select>
-{/render}
+     <td style='width:140px'>
 {render acl=$gosaVacationMessageACL}
-      <select  {if $own_script != "" || $use_vacation == ""} disabled {/if} name=month id="month" 
-       onChange="populate(this.form,this.form.gosaVacationStart);">
-       {html_options options=$months selected=$start_month}
-      </select>
-{/render}
-{render acl=$gosaVacationMessageACL}
-      <select  {if $own_script != "" || $use_vacation == ""} disabled {/if} name=year id="year" 
-       onChange="populate(this.form,this.form.gosaVacationStart);">
-       {html_options values=$years output=$years selected=$start_year}
-      </select>
+        <input type="text" id="gosaVacationStart" name="gosaVacationStart" class="date" style='width:100px' value="{$gosaVacationStart}">
+        {if $gosaVacationMessageACL|regex_replace:"/[cdmr]/":"" == "w"}
+        <script type="text/javascript">
+          {literal}
+          var datepicker  = new DatePicker({ relative : 'gosaVacationStart', language : '{/literal}{$lang}{literal}', keepFieldEmpty : true, enableCloseEffect : false, enableShowEffect : false });
+          {/literal}
+        </script>
+        {/if}
 {/render}
-      <input type="hidden" name="gosaVacationStart" value="{$gosaVacationStart}">
      </td>
-    </tr>
-    <tr>
      <td>{t}till{/t}</td>
-      <td>
-{render acl=$gosaVacationMessageACL}
-       <select  {if $own_script != "" || $use_vacation == ""} disabled {/if} name=sday id="sday" 
-        onChange="createResult2(this.form,this.form.gosaVacationStop);">
-        {html_options values=$days output=$days selected=$end_day}
-       </select>
-{/render}
+      <td style='width:140px'>
 {render acl=$gosaVacationMessageACL}
-       <select  {if $own_script != "" || $use_vacation == ""} disabled {/if} name=smonth id="smonth" 
-        onChange="populate2(this.form,this.form.gosaVacationStop);">
-        {html_options options=$months selected=$end_month}
-       </select>
+        <input type="text" id="gosaVacationStop" name="gosaVacationStop" class="date" style='width:100px' value="{$gosaVacationStop}">
+        {if $gosaVacationMessageACL|regex_replace:"/[cdmr]/":"" == "w"}
+        <script type="text/javascript">
+          {literal}
+          var datepicker  = new DatePicker({ relative : 'gosaVacationStop', language : '{/literal}{$lang}{literal}', keepFieldEmpty : true, enableCloseEffect : false, enableShowEffect : false });
+          {/literal}
+        </script>
+        {/if}
 {/render}
-{render acl=$gosaVacationMessageACL}
-       <select {if $own_script != "" || $use_vacation == ""} disabled {/if}  name=syear id="syear" 
-        onChange="populate2(this.form,this.form.gosaVacationStop);">
-        {html_options values=$years output=$years selected=$end_year}
-       </select>
-{/render}
-       <input type="hidden" name="gosaVacationStop" value="{$gosaVacationStop}">
       </td>
      </tr>
     </table>
 <script language="JavaScript" type="text/javascript">
 
        {literal}
+        function validateClick()
+        {
+alert("yes");
+         if(!document.getElementById('use_vacation').checked){
+            return;
+          }
+        }
+
        function changeStates()
        {
-
                if(document.getElementById('use_vacation').checked){
-                       changeState('day');
-                       changeState('month');
-                       changeState('year');
-                       changeState('sday');
-                       changeState('smonth');
-                       changeState('syear');
+                       document.getElementById("datepicker-opener-gosaVacationStop").style.visibility= "visible";
+                       document.getElementById("datepicker-opener-gosaVacationStart").style.visibility= "visible";
                }else{
-                       changeSubselectState('use_vacation','day');
-                       changeSubselectState('use_vacation','month');
-                       changeSubselectState('use_vacation','year');
-                       changeSubselectState('use_vacation','sday');
-                       changeSubselectState('use_vacation','smonth');
-                       changeSubselectState('use_vacation','syear');
+                       document.getElementById("datepicker-opener-gosaVacationStop").style.visibility= "hidden";
+                       document.getElementById("datepicker-opener-gosaVacationStart").style.visibility= "hidden";
+                        //The prototype way
+                        //$('datepicker-opener-gosaVacationStop').hide();
                }
        }
        {/literal}