home *** CD-ROM | disk | FTP | other *** search
/ ftp.f-secure.com / 2014.06.ftp.f-secure.com.tar / ftp.f-secure.com / support / hotfix / fsav-server / FSAVSRV900_HF07.jar / iuwebui / forms / tree_updates / autoupdates-schedule.php < prev   
PHP Script  |  2010-09-07  |  8KB  |  203 lines

  1. <?php 
  2.     include ("..\common\commonphp.php");
  3.  
  4.     $tab_name = "tabAUASchedule";
  5.  
  6.     $Page_Settings = array(1 => array(oid => '1.3.6.1.4.1.2213.42.1.11.8', type => GLOBAL_TBL));
  7.  
  8.     $Week_Days = array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun');
  9.     
  10.     if(!isset($_POST[SUBMIT_TABLE]))
  11.     {
  12.         /* first load of the page */
  13.         readSettings(&$Page_Settings);
  14.     }
  15.     else 
  16.     {
  17.         if($_POST[RESTORE_TABLE] == 1)
  18.         {
  19.             /* user wants to restore defaults */
  20.             readDefaultSettings(&$Page_Settings);
  21.         }
  22.         else
  23.         {
  24.             /* Read table */
  25.             for($index = 0, $position = 0; $index < $_POST["ENTRIES_TABLE"]; $index++)
  26.             {
  27.                 if(isset($_POST["EMPTY_TABLE"]) && $_POST["EMPTY_TABLE"] == 1 && 
  28.                    isset($_POST["EMPTY_TABLE__{$index}"]) && $_POST["EMPTY_TABLE__{$index}"] == 1)
  29.                     continue;
  30.  
  31.                 $Page_Settings[1][value][$position] = array("", "", "");
  32.  
  33.                 if(isset($_POST["VAR_TABLE__{$index}__0:0"]))
  34.                 {
  35.                     $_POST["VAR_TABLE__{$index}__0"] = '';
  36.                     for($i = 0; $i < count($Week_Days); $i++)
  37.                         if($_POST["VAR_TABLE__{$index}__0:$i"] == 1)
  38.                             $_POST["VAR_TABLE__{$index}__0"] .= ",{$Week_Days[$i]}";
  39.                     if($_POST["VAR_TABLE__{$index}__0"][0] == ',')
  40.                         $_POST["VAR_TABLE__{$index}__0"] = substr($_POST["VAR_TABLE__{$index}__0"], 1);
  41.  
  42.                     $_POST["VAR_TABLE__{$index}__1"] = '';
  43.                     if(isset($_POST["VAR_TABLE__{$index}__1:0"]) && strlen($_POST["VAR_TABLE__{$index}__1:0"]) > 0)
  44.                     {
  45.                         $_POST["VAR_TABLE__{$index}__1"] = $_POST["VAR_TABLE__{$index}__1:0"];
  46.                         if(isset($_POST["VAR_TABLE__{$index}__1:1"]) && strlen($_POST["VAR_TABLE__{$index}__1:1"]) > 0)
  47.                             $_POST["VAR_TABLE__{$index}__1"] .= ':' . $_POST["VAR_TABLE__{$index}__1:1"];
  48.                         else 
  49.                             $_POST["VAR_TABLE__{$index}__1"] .= ':00';
  50.                     }
  51.                     $_POST["VAR_TABLE__{$index}__2"] = '';
  52.                     if(isset($_POST["VAR_TABLE__{$index}__2:0"]) && strlen($_POST["VAR_TABLE__{$index}__2:0"]) > 0)
  53.                     {
  54.                         $_POST["VAR_TABLE__{$index}__2"] = $_POST["VAR_TABLE__{$index}__2:0"];
  55.                         if(isset($_POST["VAR_TABLE__{$index}__2:1"]) && strlen($_POST["VAR_TABLE__{$index}__2:1"]) > 0)
  56.                             $_POST["VAR_TABLE__{$index}__2"] .= ':' . $_POST["VAR_TABLE__{$index}__2:1"];
  57.                         else 
  58.                             $_POST["VAR_TABLE__{$index}__2"] .= ':00';
  59.                     }
  60.  
  61.                     $Page_Settings[1][value][$position][0] = stripslashes($_POST["VAR_TABLE__{$index}__0"]);
  62.                     $Page_Settings[1][value][$position][1] = stripslashes($_POST["VAR_TABLE__{$index}__1"]);
  63.                     $Page_Settings[1][value][$position][2] = stripslashes($_POST["VAR_TABLE__{$index}__2"]);
  64.                 }    
  65.                 $position++;
  66.             }
  67.  
  68.             readPageData(&$Page_Settings);
  69.  
  70.             if($_POST[SUBMIT_TABLE] == 1)    
  71.                 writeSettings($Page_Settings);
  72.         }    
  73.         exit(0);
  74.     }
  75.     if(count($Page_Settings[1][value]) == 0)
  76.     {
  77.         $info_txt = GLOBAL_EMPTYTBL_TEXT;
  78.         $table_as_html = "
  79.             <tr valign=center><td align='center'>
  80.                     <font class='no_borders_input'>$info_txt</font>
  81.             </td><td> </td><td> </td><td align='center'>
  82.                     <img src='/pics/empty.gif' width=1 height=1>
  83.             </td></tr>";
  84.     }
  85.     else
  86.     {
  87.         for($index = 0; $index < count($Page_Settings[1][value]); $index++)
  88.         {
  89.             unset($checked);
  90.             for($i = 0; $i < count($Week_Days); $i++)
  91.                 if(strpos(strtoupper($Page_Settings[1][value][$index][0]), strtoupper($Week_Days[$i])) !== false)
  92.                     $checked[$i] = 'checked';
  93.             $line0_content = '';
  94.             for($i = 0; $i < count($Week_Days); $i++)
  95.                 $line0_content .= "<input type='checkbox' name='VAR_TABLE__{$index}__0:$i' value=1 $checked[$i]><font class='no_borders_input'> {$Week_Days[$i]} </font>";
  96.  
  97.             $colon = strpos($Page_Settings[1][value][$index][1], ':');
  98.             if($colon !== false)
  99.             {
  100.                 $hours = substr($Page_Settings[1][value][$index][1], 0, $colon);
  101.                 $minutes = substr($Page_Settings[1][value][$index][1], $colon + 1);
  102.             }
  103.             else
  104.             {
  105.                 $hours = $Page_Settings[1][value][$index][1];
  106.                 $minutes = '';
  107.             }
  108.             $line1_content = "    <input name='VAR_TABLE__{$index}__1:0' value='$hours' size=1 class='weekdaysfont'>:<input name='VAR_TABLE__{$index}__1:1' value='$minutes' size=1 class='weekdaysfont'>";
  109.             
  110.             $colon = strpos($Page_Settings[1][value][$index][2], ':');
  111.             if($colon !== false)
  112.             {
  113.                 $hours = substr($Page_Settings[1][value][$index][2], 0, $colon);
  114.                 $minutes = substr($Page_Settings[1][value][$index][2], $colon + 1);
  115.             }
  116.             else
  117.             {
  118.                 $hours = $Page_Settings[1][value][$index][2];
  119.                 $minutes = '';
  120.             }
  121.             $line2_content = "    <input name='VAR_TABLE__{$index}__2:0' value='$hours' size=1 class='weekdaysfont'>:<input name='VAR_TABLE__{$index}__2:1' value='$minutes' size=1 class='weekdaysfont'>";
  122.  
  123.             $table_as_html .= "
  124.                 <tr align=center>
  125.                     <td>$line0_content</td>
  126.                     <td>$line1_content</td>
  127.                     <td>$line2_content</td>    
  128.                     <td align='center'><input type='checkbox' name='EMPTY_TABLE__{$index}' value='1'></td>
  129.                 </tr>
  130.             ";
  131.         }
  132.     }
  133.  
  134.     $table_width = $INSIDE_TEXT_WIDTH;
  135.     $col1_width = 330;
  136.     $col4_width = 30;
  137.     $col2_width = $col3_width = ($table_width - $col1_width - $col4_width) / 2;
  138.  
  139.     show_form_management($tab_name);
  140. ?>
  141.  
  142. <script language="javascript">
  143.     tabAUASchedule_add_hit = function()
  144.     {
  145.         document.form_tabAUASchedule.ENTRIES_TABLE.value++;
  146.         document.form_tabAUASchedule.SUBMIT_TABLE.value=1;
  147.         refreshed = true;
  148.     }
  149.     tabAUASchedule_empty_hit = function()
  150.     {
  151.         document.form_tabAUASchedule.EMPTY_TABLE.value=1;
  152.         document.form_tabAUASchedule.SUBMIT_TABLE.value=1;
  153.         refreshed = true;
  154.     }
  155. </script>
  156.  
  157.     <form method="POST" action='<?php echo "{$_SERVER['PHP_SELF']}?{$_SERVER['QUERY_STRING']}";?>' id="form_<?php echo $tab_name;?>" name="form_<?php echo $tab_name;?>" style="padding: 0; margin: 0;">
  158.         <input type="hidden" name="SUBMIT_TABLE" value="0">
  159.         <input type="hidden" name="RESTORE_TABLE" value="0">
  160.         <input type="hidden" name="APPLY_SETTINGS" value="0">
  161.         <input type="hidden" name="EMPTY_TABLE" value="0">
  162.         <input type="hidden" name="ENTRIES_TABLE" value="<?php echo count($Page_Settings[1][value]);?>">
  163.         
  164.         <input type='hidden' name='VAR_PAGE_SETTINGS_0' value='0'>
  165.         <?php 
  166.             for($index = 0; $index < count($Page_Settings[1][value]); $index++)
  167.                 for($i = 0; $i < count($Week_Days); $i++)
  168.                     echo "\n\t\t<input type=\"hidden\" name=\"VAR_TABLE__{$index}__0:$i\" value=\"0\">";
  169.         ?>
  170.             
  171.         <?php show_action_menu('Download Schedule', $tab_name); ?>
  172.         <table border="0" cellspacing="5" cellpadding="0" class="main_page_table">
  173.             <tr>
  174.                 <td valign="top">
  175.                     <table cellspacing="0" cellpadding="0" border="0" width="100%" class="table_settings">
  176.                         <?php show_section_title('Settings');?>
  177.                         <tr align="left" class="tr_setting">
  178.                             <td nowrap class="td_setting">
  179.                 <?=$Page_Settings[0][lock];?>
  180.                 <?=fsloc('Download Schedule table')?>
  181.                                 <table style='table-layout:fixed;' border=1 cellpadding=0 cellspacing=0  bordercolorlight=D4D0C8>
  182.                                     <tr bgcolor="E6E6E6">
  183.                                         <td align="center" width=<?php echo $col1_width?>>Days</td>
  184.                                         <td align="center" width=<?php echo $col2_width?>>From</td>
  185.                                         <td align="center" width=<?php echo $col3_width?>>To</td>
  186.                                         <td valign="center" align="center" width=<?php echo $col4_width?>>
  187.                                             <a href="javascript:markall('form_<?php echo $tab_name;?>');"><img NAME="MyTrash" VALUE="MyTrash" border="0" src="/pics/trashbin.gif" alt="Select/Deselect all">
  188.                                         </td>
  189.                                     </tr>
  190.                                     <?php echo $table_as_html;?>
  191.                                 </table>
  192.                                 <p style="padding-top: 5px; margin: 0;">
  193.                                 <?php show_newtable_buttons($table_width + 10, $tab_name, true); ?>
  194.                         </td></tr>
  195.                     </table>
  196.                 </td>
  197.             </tr>
  198.             <?php show_action_buttons($tab_name, true, true); ?>
  199.         </table>
  200.  
  201.     </form>
  202.  
  203.