Rev 12803 | Rev 12977 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
11809 | guerimand | 1 | !! file to manage score restriction for sheet, exam and other |
11814 | guerimand | 2 | !! don't forget to declare variable into var.def (with right number if in use) of the module |
11870 | bpr | 3 | !! line 1 (2 words) |
12801 | obado | 4 | !! -first : html/put/get |
5 | !! html : html form to display |
||
6 | !! put : initialise var with date in third line |
||
7 | !! get : verify data from reply and make char wimsdata in output |
||
8 | !! -second : num of variable default empty (in case of several use in a same html page) |
||
11814 | guerimand | 9 | !! line 2 : value to put (default value in the form) |
11809 | guerimand | 10 | |
11814 | guerimand | 11 | !distribute line $wims_read_parm into _job,_value |
12 | !distribute word $_job into _job,_num |
||
11809 | guerimand | 13 | !bound _job within html,put,get,empty default empty |
12022 | czzmrn | 14 | !set MAXnbvalue=!defof MAX_TECHVARVAL in wimshome/public_html/bases/sys/define.conf |
15 | !bound _num between 0 and $MAXnbvalue default $empty |
||
11809 | guerimand | 16 | |
17 | !if $_job=empty |
||
12801 | obado | 18 | !exit |
11809 | guerimand | 19 | !endif |
11846 | guerimand | 20 | !goto $_job |
11809 | guerimand | 21 | |
11846 | guerimand | 22 | :put |
12927 | guerimand | 23 | !set _value=!words2items $_value |
24 | !set _n=!itemcnt $_value |
||
25 | !reset IPscore$_num,begindscore$_num,enddscore$_num,begintscore$_num,endtscore$_num |
||
26 | !set datecheck$_num=$empty |
||
27 | !for _k=1 to $_n |
||
28 | !set _c=!char 1 of $(_value[$_k]) |
||
29 | !if $_c=> |
||
30 | !set begindscore$_num=!char 2 to 9 of $(_value[$_k]) |
||
31 | !set begintscore$_num=!char 11 to 15 of $(_value[$_k]) |
||
12801 | obado | 32 | !else |
12927 | guerimand | 33 | !if $_c=< |
34 | !set enddscore$_num=!char 2 to 9 of $(_value[$_k]) |
||
35 | !set endtscore$_num=!char 11 to 15 of $(_value[$_k]) |
||
36 | !else |
||
37 | !set IPscore$_num=$(IPscore$_num) $(_value[$_k]) |
||
38 | !endif |
||
12801 | obado | 39 | !endif |
12927 | guerimand | 40 | !next _k |
41 | !let _now=!char 1 to 8 of $wims_now |
||
42 | !if $(begindscore$_num)=$class_creation or $(begindscore$_num)=$empty |
||
43 | !let begindscore$_num=$_now |
||
44 | !if $(enddscore$_num)=$empty |
||
45 | !let datecheck$_num=yes |
||
46 | !endif |
||
12801 | obado | 47 | !endif |
12927 | guerimand | 48 | !default enddscore$_num=$class_expiration |
49 | !default begintscore$_num=00:00 |
||
50 | !default endtscore$_num=23:59 |
||
51 | !exit |
||
11846 | guerimand | 52 | |
11809 | guerimand | 53 | :html |
11870 | bpr | 54 | <ul class="wims_nopuce"> |
12801 | obado | 55 | <li> |
12927 | guerimand | 56 | |
12801 | obado | 57 | <label for="begindscore$_num">$wims_name_from</label> |
12927 | guerimand | 58 | !if $jquery_defined=yes |
59 | !read adm/datepickerform.phtml $(begindscore$_num)\ |
||
11835 | guerimand | 60 | begindscore$_num\ |
61 | "$class_creation","$class_expiration" |
||
12927 | guerimand | 62 | !else |
63 | <input size="8" name="begindscore$_num" id="begindscore$_num" value="$(begindscore$_num)" /> |
||
64 | !endif |
||
12801 | obado | 65 | <label for="begintscore$_num">$wims_name_at</label> |
66 | <input size="5" name="begintscore$_num" id="begintscore$_num" value="$(begintscore$_num)" /> |
||
11809 | guerimand | 67 | |
12801 | obado | 68 | <label for="enddscore$_num">$wims_name_to</label> |
12927 | guerimand | 69 | !if $jquery_defined=yes |
70 | !read adm/datepickerform.phtml $(enddscore$_num)\ |
||
11835 | guerimand | 71 | enddscore$_num\ |
72 | "$class_creation","$class_expiration" |
||
12927 | guerimand | 73 | !else |
74 | <input size="8" name="enddscore$_num" id="enddscore$_num" value="$(enddscore$_num)" /> |
||
75 | !endif |
||
12801 | obado | 76 | <label for="endtscore$_num">$wims_name_at</label> |
77 | <input size="5" name="endtscore$_num" id="endtscore$_num" value="$(endtscore$_num)" /> |
||
12927 | guerimand | 78 | <input type="checkbox" name="datecheck$_num" value="yes" id="datecheck$_num" |
79 | !if $(datecheck$_num)=yes |
||
80 | checked="checked" |
||
81 | !endif |
||
82 | /> |
||
83 | !reset datecheck$_num |
||
84 | <label for="datecheck$_num">$wims_name_Close</label> |
||
12801 | obado | 85 | </li><li> |
86 | <label for="IPscore$_num">$wims_name_IP</label> |
||
87 | <input size="10" name="IPscore$_num" id="IPscore$_num" value="$(IPscore$_num)" placeholder="127.0.0.1" /> |
||
88 | </li> |
||
11870 | bpr | 89 | </ul> |
11809 | guerimand | 90 | !exit |
91 | |||
92 | :get |
||
11836 | guerimand | 93 | !! error are not display to user but default value replace bad value |
11814 | guerimand | 94 | !! date format verification |
12803 | bpr | 95 | !set _e=begin,end |
96 | !set _l=$class_creation,$class_expiration |
||
97 | !for _t=1 to 2 |
||
12801 | obado | 98 | !set $(_e[$_t])dscore$_num=!text select 0123456789 in $($(_e[$_t])dscore$_num) |
99 | !bound $(_e[$_t])dscore$_num between $class_creation and $class_expiration default $(_l[$_t]) |
||
100 | !set _y=!char 1 to 4 of $($(_e[$_t])dscore$_num) |
||
101 | !set _m=!char 5 to 6 of $($(_e[$_t])dscore$_num) |
||
102 | !set _d=!char 7 to 8 of $($(_e[$_t])dscore$_num) |
||
103 | !! ---- day and month check (not realy good test should be an exact test of existence of date) |
||
104 | !if $_m<1 or $_m>12 or $_d<1 or $_d>31 |
||
105 | !set $(_e[$_t])dscore$_num=$(_l[$_t]) |
||
106 | !endif |
||
12803 | bpr | 107 | !next _t |
11814 | guerimand | 108 | !! time format verification |
12803 | bpr | 109 | !set _l=00:00,23:59 |
110 | !for _t=1 to 2 |
||
12801 | obado | 111 | !set $(_e[$_t])tscore$_num=!text select 0123456789: in $($(_e[$_t])tscore$_num) |
112 | !set $(_e[$_t])tscore$_num=!replace internal : by , in $($(_e[$_t])tscore$_num) |
||
113 | !set _nb=!itemcnt $($(_e[$_t])tscore$_num) |
||
114 | !if $_nb=2 |
||
115 | !distribute item $($(_e[$_t])tscore$_num) into _h,_m |
||
116 | !set _h=$[$_h*1] |
||
117 | !set _m=$[$_m*1] |
||
118 | !if $_h<0 or $_h>23 or $_m<0 or $_m>59 or NaN isin $_h$_m |
||
119 | !set $(_e[$_t])tscore$_num=$(_l[$_t]) |
||
120 | !else |
||
121 | !set _h=!char 2 to 3 of $[100+$_h] |
||
122 | !set _m=!char 2 to 3 of $[100+$_m] |
||
123 | !set $(_e[$_t])tscore$_num=$_h:$_m |
||
124 | !endif |
||
125 | !else |
||
126 | !set $(_e[$_t])tscore$_num=$(_l[$_t]) |
||
127 | !endif |
||
12803 | bpr | 128 | !next _t |
11814 | guerimand | 129 | !! IP restriction char |
12803 | bpr | 130 | !set IPscore$_num=!text select char 1234567890. in $(IPscore$_num) |
11815 | guerimand | 131 | !! write output |
12803 | bpr | 132 | !reset _output |
12927 | guerimand | 133 | !if $(begindscore$_num)!=$empty and ($(begindscore$_num)!=$class_creation or $(begintscore$_num)!=00:00) and yes notin $(datecheck$_num) |
12801 | obado | 134 | !set _output=$_output>$(begindscore$_num).$(begintscore$_num) |
12803 | bpr | 135 | !endif |
12927 | guerimand | 136 | !if $(enddscore$_num)!=$empty and ($(enddscore$_num)!=$class_expiration or $(endtscore$_num)!=23:59) and yes notin $(datecheck$_num) |
12801 | obado | 137 | !set _output=$_output <$(enddscore$_num).$(endtscore$_num) |
12803 | bpr | 138 | !endif |
139 | !set _output=$_output $(IPscore$_num) |
||
140 | !exit |