root/modules/branches/2.10/timeconditions/page.timegroups.php

Revision 11261, 2.0 kB (checked in by p_lindheimer, 2 years ago)

closes #4725 adds a Remove Section button in each section of a timegroup and submits all changes

Line 
1 <?php /* $Id: page.timegroups.php $ */
2 //
3 //This program is free software; you can redistribute it and/or
4 //modify it under the terms of the GNU General Public License
5 //as published by the Free Software Foundation; either version 2
6 //of the License, or (at your option) any later version.
7 //
8 //This program is distributed in the hope that it will be useful,
9 //but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 //GNU General Public License for more details.
12
13 $dispnum = 'timegroups'; //used for switch on config.php
14
15 ?>
16
17
18 <div class="rnav">
19 <?php
20 $groups = timeconditions_timegroups_list_groups();
21 drawListMenu($groups, $skip, $type, $display, $extdisplay, _("Time Group"));
22 ?>
23 </div>
24
25 <div class="rnav" style="margin:15px 10px; padding: 5px; background: #e0e0ff; border: #2E78A7 solid 1px;">
26     <?php echo _("Server time:")?> <span id="idTime">00:00:00</span>
27 </div>
28
29 <script>
30 var hour = <?php $l = localtime(); echo $l[2]?>;
31 var min  = <?php $l = localtime(); echo $l[1]?>;
32 var sec  = <?php $l = localtime(); echo $l[0]?>;
33
34 //time groups stole this from timeconditions
35 //who stole it from http://www.aspfaq.com/show.asp?id=2300
36 function PadDigits(n, totalDigits)
37 {
38     n = n.toString();
39     var pd = '';
40     if (totalDigits > n.length)
41     {
42         for (i=0; i < (totalDigits-n.length); i++)
43         {
44             pd += '0';
45         }
46     }
47     return pd + n.toString();
48 }
49
50 function updateTime()
51 {
52     sec++;
53     if (sec==60)
54     {
55         min++;
56         sec = 0;
57     }   
58        
59     if (min==60)
60     {
61         hour++;
62         min = 0;
63     }
64
65     if (hour==24)
66     {
67         hour = 0;
68     }
69    
70     document.getElementById("idTime").innerHTML = PadDigits(hour,2)+":"+PadDigits(min,2)+":"+PadDigits(sec,2);
71     setTimeout('updateTime()',1000);
72 }
73
74 updateTime();
75 $(document).ready(function(){
76     $(".remove_section").click(function(){
77     if (confirm('<?php echo _("This section will be removed from this time group and all current settings including changes will be updated. OK to proceed?") ?>')) {
78       $(this).parent().parent().prev().remove();
79       $(this).closest('form').submit();
80     }
81   });
82 });
83 </script>
84
85
Note: See TracBrowser for help on using the browser.