Code

We are now able to modify the timestamp.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 25 Jan 2008 10:40:05 +0000 (10:40 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 25 Jan 2008 10:40:05 +0000 (10:40 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8605 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/addons/gotomasses/class_goto_task.inc
gosa-core/plugins/addons/gotomasses/goto_task.tpl

index 74663a13d442eb8fec582d3944ab39888ac16ed9..42b29815a5657066beecff824d77063116166f1e 100644 (file)
@@ -33,6 +33,59 @@ class goto_task extends plugin
         $smarty->assign($attr,"");
       }
     }
+
+    $year   = substr($this->data['TIMESTAMP'],0,4);
+    $month  = substr($this->data['TIMESTAMP'],4,2);
+    $day    = substr($this->data['TIMESTAMP'],6,2);
+    
+    $hour   = substr($this->data['TIMESTAMP'],8,2);
+    $minute = substr($this->data['TIMESTAMP'],10,2);
+    $second = substr($this->data['TIMESTAMP'],12,2);
+
+    $years = array();
+    for($i = date("Y",time()); $i <= 2037 ;$i ++){
+      $years[$i] = $i;
+    }
+    $months = array();
+    for($i = 1; $i <= 12; $i ++){
+      $e = str_pad($i,2,"0",STR_PAD_LEFT);
+      $months[$e] = $e;
+    }
+    $days = array();
+    for($i = 1; $i <= cal_days_in_month(CAL_GREGORIAN,$month,$year); $i ++){
+      $e = str_pad($i,2,"0",STR_PAD_LEFT);
+      $days[$e] = $e;
+    }
+    $hours = array();
+    for($i = 0; $i < 24; $i ++){
+      $e = str_pad($i,2,"0",STR_PAD_LEFT);
+      $hours[$e] = $e;
+    }
+    $minutes = array();
+    for($i = 0; $i < 60; $i ++){
+      $e = str_pad($i,2,"0",STR_PAD_LEFT);
+      $minutes[$e] = $e;
+    }
+    $seconds = array();
+    for($i = 0; $i < 60; $i ++){
+      $e = str_pad($i,2,"0",STR_PAD_LEFT);
+      $seconds[$e] = $e;
+    }
+
+    $smarty->assign("years", $years);
+    $smarty->assign("months", $months);
+    $smarty->assign("days", $days);
+    $smarty->assign("hours", $hours);
+    $smarty->assign("minutes", $minutes);
+    $smarty->assign("seconds", $seconds);
+    $smarty->assign("time_year",$year); 
+    $smarty->assign("time_month",$month); 
+    $smarty->assign("time_day",$day); 
+    $smarty->assign("time_hour",$hour); 
+    $smarty->assign("time_minute",$minute); 
+    $smarty->assign("time_second",$second); 
+
     return ($smarty->fetch (get_template_path('goto_task.tpl', TRUE)));
   }
 
@@ -51,12 +104,23 @@ class goto_task extends plugin
         $this->data[strtoupper($attr)] = $_POST[$attr];
       }
     }
+    $date = "";
+    foreach(array("time_year","time_month","time_day","time_hour","time_minute","time_second") as $attr){
+      if(isset($_POST[$attr])){
+        $date .= $_POST[$attr];
+      }else{
+        echo $attr;
+      }
+    }
+    if(strlen($date) == 14){
+      $this->data['TIMESTAMP'] = $date;
+    }
   }
 
   function save()
   {
     $tmp = array();   
-    foreach(array("STATUS","MACADDRESS","HEADERTAG") as $attr){
+    foreach(array("STATUS","MACADDRESS","HEADERTAG","TIMESTAMP") as $attr){
       if(isset($this->data[$attr])){
         $tmp[$attr] = $this->data[$attr];
       }
index 317e185c887a5de45092fe930292e1d2c7c66902..61220bd450d1fa120dd927f6688d59e31d3be031 100644 (file)
@@ -1,53 +1,95 @@
 <table style='width:100%'>
        <tr>
                <td colspan="2">
-                       <h2><img alt="" src="images/head.png" class="center" align="middle"> {t}Generic{/t}</h2>
+                       <h2><img alt="" src="images/head.png" class="center" align="middle"> {t}Job details{/t}</h2>
                </td>
        </tr>
        <tr>
-               <td>
+               <td style="width:50%;">
                        <table>
+                <tr><td>{t}Job ID{/t}</td><td>{$ID}</td></tr>
                                <tr>
                                        <td>
-                                               {t}Job ID{/t}
+                                               {t}Header Tag{/t}
+                                       </td>
+                                       <td>
+                                               <select name="HeaderTag" onChange="document.mainform.submit();">
+                                                       {html_options options=$Actions selected=$HEADERTAG} 
+                                               </select>       
+                                               <input type='image' src="images/list_reload.png"
+                                                alt="{t}Reload{/t}" title="{t}Reload{/t}" class="center">
                                        </td>
-                                       <td>    
-                                               {$ID}
-                                       </td>   
                                </tr>
                                <tr>
-                                       <td>
-                                               {t}Status{/t}
+                                       <td>&nbsp;
                                        </td>
-                                       <td>    
-                                               <input type="text" name="status" value="{$STATUS}">
-                                       </td>   
                                </tr>
-                   <tr>
-                    <td>
-                        {t}Mac{/t}
-                    </td>
-                    <td>
-                        <input type="text" name="macaddress" value="{$MACADDRESS}">
-                    </td>
-                </tr>
                                <tr>
-                                       <td>
-                                               {t}Header Tag{/t}
+                                       <td style="vertical-align: top;">       
+                                               {t}Schedule Execution{/t}
                                        </td>
                                        <td>
-                                               <select name="HeaderTag">
-                                                       <option value="unknown">{t}Unknown{/t}</option>
-                                                       {html_options options=$Actions selected=$HEADERTAG} 
-                                               </select>       
+                                               <table cellspacing="0" cellpadding="0">
+                                                       <tr>
+                                                               <td>{t}Jahr{/t}</td>
+                                                               <td>{t}Monat{/t}</td>
+                                                               <td>{t}Tag{/t}</td>
+                                                               <td>{t}Stunde{/t}</td>
+                                                               <td>{t}Minute{/t}</td>
+                                                               <td>{t}Sekunde{/t}</td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>    
+                                                                       <select name="time_year" onChange="document.mainform.submit();">
+                                                                               {html_options values=$years options=$years selected=$time_year}
+                                                                       </select>&nbsp;
+                                                               </td>
+                                                               <td>    
+                                                                       <select name="time_month" onChange="document.mainform.submit();">
+                                                                               {html_options values=$months options=$months selected=$time_month}
+                                                                       </select>&nbsp;
+                                                               </td>
+                                                               <td>    
+                                                                       <select name="time_day">
+                                                                               {html_options values=$days options=$days selected=$time_day}
+                                                                       </select>&nbsp;
+                                                               </td>
+                                                               <td>    
+                                                                       <select name="time_hour">
+                                                                               {html_options values=$hours options=$hours selected=$time_hour}
+                                                                       </select>&nbsp;
+                                                               </td>
+                                                               <td>    
+                                                                       <select name="time_minute">
+                                                                               {html_options values=$minutes options=$minutes selected=$time_minute}
+                                                                       </select>&nbsp;
+                                                               </td>
+                                                               <td>    
+                                                                       <select name="time_second">
+                                                                               {html_options values=$seconds options=$seconds selected=$time_second}
+                                                                       </select>
+                                                               </td>
+                                                       </tr>
+                                               </table>
                                        </td>
                                </tr>
                        </table>
                </td>
+               <td>
+                       <table>
+{if $HEADERTAG == "ping"}
+                               <tr><td>{t}Status{/t}</td><td><input type="text" name="status" value="{$STATUS}"></td></tr>
+                   <tr><td>{t}Mac{/t}</td><td><input type="text" name="macaddress" value="{$MACADDRESS}"></td></tr>
+{elseif $HEADERTAG == "sayHello"}
+                               <tr><td>{t}Status{/t}</td><td><input type="text" name="status" value="{$STATUS}"></td></tr>
+                   <tr><td>{t}Mac{/t}</td><td><input type="text" name="macaddress" value="{$MACADDRESS}"></td></tr>
+{else}
+                               <tr><td>{t}Job type not implented{/t}</td></tr>
+{/if}
+                       </table>
+               </td>
        </tr>
 </table>
-
-<input type="submit" name="test" value="Test submit()">
        
 <p class='seperator'>&nbsp;</p>
 <input type='hidden' name='goto_task_posted' value='1'>