OpengateM Source Repository
Révision | fb687caf6f0d76fe4894b9d36d1797e492bc95f3 (tree) |
---|---|
l'heure | 2015-03-26 13:16:52 |
Auteur | watanaby <watanaby@user...> |
Commiter | watanaby |
modified update page. reduced emails.
@@ -243,6 +243,10 @@ OpengateM History</H3> | ||
243 | 243 | </DT><DD> |
244 | 244 | Added sendreportmail.php cooperating with watch function of v0.9.1(phpsrc). |
245 | 245 | </DD> |
246 | + <DT>Ver.0.9.4 at 2015.3.26 | |
247 | + </DT><DD> | |
248 | + Modified update page(opengatemup). Reduced emails(opengatemmail). | |
249 | + </DD> | |
246 | 250 | </DL> |
247 | 251 | |
248 | 252 | </BODY> |
@@ -11,7 +11,12 @@ var loglist={ | ||
11 | 11 | </script> |
12 | 12 | <script type="text/javascript" src="/opengate/showlog.js"></script> |
13 | 13 | <script type="text/javascript" src="/opengate/editstring.js"></script> |
14 | -</head> | |
14 | +<script> | |
15 | +function toggleDisplay(id){ | |
16 | + if (document.getElementById(id).style.display=="none") document.getElementById(id).style.display="block"; | |
17 | + else document.getElementById(id).style.display="none"; | |
18 | +} | |
19 | +</script></head> | |
15 | 20 | <body align="center"> |
16 | 21 | |
17 | 22 | <p><font size="5">Update of MAC address registration </font></p> |
@@ -38,34 +43,44 @@ action="%%CGINAME%%?lang=en&redirectedurl=%%REDIRECTEDURL%%"> | ||
38 | 43 | </tr> |
39 | 44 | %%MACLIST%% |
40 | 45 | </table> |
41 | -<p><input type="submit" value=" Send "></p> | |
46 | +<p><input type="submit" value=" Send "> | |
47 | +<span style="color:blue;text-decoration:underline;" onclick="toggleDisplay('help1')"> help </span> | |
48 | +</p> | |
42 | 49 | </form> |
50 | + | |
43 | 51 | <p><font color="red"> |
44 | 52 | %%ERRORLIST%% |
45 | 53 | </font></p> |
46 | -<p> | |
47 | -<p><strong>To prevent hijacking, please confirm your usage | |
48 | -log.</strong> | |
49 | -The red border cells in the usage log include two or more records for one device. Please check carefully. | |
50 | -</p> | |
51 | 54 | |
52 | -<p>Select <strong>Renew</strong> to renew the registration (resume | |
55 | +<ul id="help1" style="display:none"> | |
56 | +<li>Select <strong>Renew</strong> to renew the registration (resume | |
53 | 57 | and extend the limit date). |
54 | -</p> | |
55 | -<p> | |
58 | +</li> | |
59 | +<li> | |
56 | 60 | Select <strong>Pause</strong> to pause the |
57 | 61 | usage. If you want to reuse the device, check "Renew". |
58 | -</p> | |
59 | -<p> | |
62 | +</li> | |
63 | +<li> | |
60 | 64 | Select <strong>Delete</strong> to delete the registration. If you |
61 | 65 | may use this terminal in the future, please use "Pause". |
62 | -</p> | |
63 | -<p> | |
66 | +</li> | |
67 | +<li> | |
64 | 68 | The status "I" indicates that the device is set as Inactive by some |
65 | 69 | reason. Please contact to the administrator. |
70 | +</li> | |
71 | +</ul> | |
72 | + | |
73 | +<p><font size="5"> usage log </font><font size="3">(To prevent hijacking, please confirm your log.)</font> | |
74 | +<span style="color:blue;text-decoration:underline;" onclick="toggleDisplay('help2')"> help </span> | |
66 | 75 | </p> |
67 | 76 | |
68 | -<p><font size="5"> usage log </font></p> | |
77 | +<ul id="help2" style="display:none"> | |
78 | +<li>The color-bars in the chart show the time range when you used your devices.</li> | |
79 | +<li>If there is a use without your memory, please inform it to the administrator.</li> | |
80 | +<li>The red frame indicates that one device has plural logs. Please check it carefully.</li> | |
81 | +<li>Even if you do not intend to use the device, the automatic access might be done.</li> | |
82 | +<li>The closing of the network has time delay after finishing the use.</li> | |
83 | +</ul> | |
69 | 84 | |
70 | 85 | <div id="usagelog"></div> |
71 | 86 | <div id="popup"></div> |
@@ -11,6 +11,12 @@ var loglist={ | ||
11 | 11 | </script> |
12 | 12 | <script type="text/javascript" src="/opengate/showlog.js"></script> |
13 | 13 | <script type="text/javascript" src="/opengate/editstring.js"></script> |
14 | +<script> | |
15 | +function toggleDisplay(id){ | |
16 | + if (document.getElementById(id).style.display=="none") document.getElementById(id).style.display="block"; | |
17 | + else document.getElementById(id).style.display="none"; | |
18 | +} | |
19 | +</script> | |
14 | 20 | </head> |
15 | 21 | <body align="center"> |
16 | 22 | <p><font size="5">MACアドレス登録更新</font></p> |
@@ -38,27 +44,30 @@ action="%%CGINAME%%?lang=ja&redirectedurl=%%REDIRECTEDURL%%"> | ||
38 | 44 | %%MACLIST%% |
39 | 45 | </table> |
40 | 46 | |
41 | -<p><input type="submit" value=" 送信 "></p> | |
47 | +<p><input type="submit" value=" 送信 "> | |
48 | +<span style="color:blue;text-decoration:underline;" onclick="toggleDisplay('help1')"> help </span> | |
49 | +</p> | |
42 | 50 | </form> |
43 | 51 | |
44 | 52 | <p><font color="red"> |
45 | 53 | %%ERRORLIST%% |
46 | 54 | </font></p> |
47 | 55 | |
48 | -<p><strong>不正利用を防ぐため、下の利用履歴が妥当か確認して下さい。 | |
49 | -</strong>利用履歴における赤枠セルは1つの機器に対する2つ以上の利用記録を含んでいます。特に注意して下さい。</p> | |
50 | - | |
51 | -<p><strong>「更新」</strong>をチェックすると、機器の登録を更新して利用期限を延長します。</p> | |
56 | +<ul id="help1" style="display:none"> | |
57 | +<li><strong>「更新」</strong>をチェックすると、機器の登録を更新して利用期限を延長します。</li> | |
58 | +<li><strong>「休止」</strong>をチェックすると、利用不可にします。再び利用するときには更新処理をしてください。</li> | |
59 | +<li><strong>「削除」</strong>をチェックすると、機器の登録を削除します。再び利用する可能性があるときは、休止を利用下さい。</li> | |
60 | +<li>状態が"I"となっている機器は無効とされています。理由は管理者に問い合わせ下さい。</li> | |
61 | +</ul> | |
52 | 62 | |
53 | -<p><strong>「休止」</strong>をチェックすると、利用不可にします。再び利用するときには更新処理をしてください。 | |
63 | +<p><font size="5">利用履歴</font><font size="3">(不正利用を防ぐため、妥当か確認して下さい。)</font> | |
64 | +<span style="color:blue;text-decoration:underline;" onclick="toggleDisplay('help2')"> help </span> | |
54 | 65 | </p> |
55 | -<p><strong>「削除」</strong>をチェックすると、機器の登録を削除します。 | |
56 | -再び利用する可能性があるときは、休止を利用下さい。 | |
57 | -</p> | |
58 | -<p>状態が"I"となっている機器は無効とされています。理由は管理者に問い合わせ下さい。</p> | |
59 | - | |
60 | - | |
61 | -<p><font size="5">利用履歴</font></p> | |
66 | +<ul id="help2" style="display:none"> | |
67 | +<li>利用された時間帯を1時間ごとに色付け表示しています。覚えの無い履歴があれば管理者までお知らせください。</li> | |
68 | +<li>赤枠の時間帯は1つの機器に対する2つ以上の履歴を含んでいます。特に注意下さい。</li> | |
69 | +<li>意図して利用しなくても、自動通信による利用がありえます。また使い終わってしばらくしてから閉鎖します。</li> | |
70 | +</ul> | |
62 | 71 | |
63 | 72 | <div id="usagelog"></div> |
64 | 73 | <div id="popup"></div> |
@@ -168,13 +168,13 @@ function setupCellProperties(td, date, time, iDevice){ | ||
168 | 168 | //set background color of the cell |
169 | 169 | //if two or more items are found, display red border |
170 | 170 | if(logItemNo.length > 1){ |
171 | - td.style.background=colorList[iDevice]; | |
171 | + td.style.background=colorList[iDevice%5]; | |
172 | 172 | td.style.border="3px solid Red"; |
173 | 173 | } |
174 | 174 | // one item is found (if the item number == -1, no log is matched) |
175 | 175 | else if(logItemNo.length == 1){ |
176 | 176 | if(logItemNo[0] == -1) td.style.background=colorList["none"]; |
177 | - else td.style.background=colorList[iDevice]; | |
177 | + else td.style.background=colorList[iDevice%5]; | |
178 | 178 | } |
179 | 179 | // no item |
180 | 180 | else td.style.background=colorList["blank"]; |
@@ -239,7 +239,7 @@ function makeDevicesLegend() { | ||
239 | 239 | tr.appendChild(td); |
240 | 240 | var td = document.createElement("td"); |
241 | 241 | td.width=50; |
242 | - td.style.background=colorList[iDevice]; | |
242 | + td.style.background=colorList[iDevice%5]; | |
243 | 243 | tr.appendChild(td); |
244 | 244 | tbody.appendChild(tr); |
245 | 245 | } |
@@ -574,10 +574,11 @@ int getNextMailAddressFromMngDb(char* mailAddress, char* limitDate, char* device | ||
574 | 574 | /* [select mailAddress,limitDate,device from macaddrs |
575 | 575 | where ( date(now())=date(adddate(limitDate, interval -1 day)) |
576 | 576 | OR date(now())=date(adddate(limitDate, interval -7 day)) ) |
577 | - AND (status='A' OR status='P')] */ | |
577 | + AND (status='A' OR status='P') order by mailAddress,limitDate] */ | |
578 | 578 | snprintf(queryStr, BUFFMAXLN, |
579 | 579 | "select mailAddress,limitDate,device from macaddrs " |
580 | - " where (%s) and (status='A' or status='P')", mailTiming); | |
580 | + " where (%s) and (status='A' or status='P') " | |
581 | + " order by mailAddress,limitDate", mailTiming); | |
581 | 582 | /* mailTiming is a condition string defined in conf file */ |
582 | 583 | |
583 | 584 | /* send SQL query */ |
@@ -29,9 +29,12 @@ Email: watanaby@is.saga-u.ac.jp | ||
29 | 29 | /***************************************************/ |
30 | 30 | int main(int argc, char **argv) |
31 | 31 | { |
32 | - char mailAddress[BUFFMAXLN]; /* mail address */ | |
33 | - char limitDate[WORDMAXLN]; /* limit date */ | |
34 | - char device[WORDMAXLN]; /* device name */ | |
32 | + char mailAddress[BUFFMAXLN]=""; /* mail address */ | |
33 | + char limitDate[WORDMAXLN]=""; /* limit date */ | |
34 | + char device[WORDMAXLN]=""; /* device name */ | |
35 | + char deviceList[BUFFMAXLN]=""; /* device name list */ | |
36 | + char mailAddressPrev[BUFFMAXLN]=""; /* mail address of previous record */ | |
37 | + char limitDatePrev[WORDMAXLN]=""; /* limit date of previous record */ | |
35 | 38 | int count=0; /* count for sending mails */ |
36 | 39 | char* progName; /* the name of this program in argv[0] */ |
37 | 40 |
@@ -67,9 +70,51 @@ int main(int argc, char **argv) | ||
67 | 70 | InitConf(); |
68 | 71 | if(!InitMngDb()) return 0; |
69 | 72 | |
70 | - /* get mail address for users near expiration date and send mail */ | |
71 | - while(GetNextMailAddressFromMngDb(mailAddress, limitDate, device)){ | |
72 | - if(SendMail(mailAddress, limitDate, device)) count++; | |
73 | + /* get first mail address near expiration date */ | |
74 | + if(GetNextMailAddressFromMngDb(mailAddress, limitDate, device)){ | |
75 | + | |
76 | + /* if get, save the first record */ | |
77 | + strncpy(mailAddressPrev, mailAddress, BUFFMAXLN); | |
78 | + strncpy(limitDatePrev, limitDate, WORDMAXLN); | |
79 | + strncpy(deviceList, device, WORDMAXLN); | |
80 | + | |
81 | + /* get next mail address near expiration date */ | |
82 | + while(GetNextMailAddressFromMngDb(mailAddress, limitDate, device)){ | |
83 | + | |
84 | + /* if mailAddress or limitDate are not same as previous */ | |
85 | + if( strcmp(mailAddress, mailAddressPrev)!=0 | |
86 | + || strcmp(limitDate, limitDatePrev)!=0 ){ | |
87 | + | |
88 | + /* send mail to the address and clear deviceList */ | |
89 | + if(!isNull(mailAddressPrev)){ | |
90 | + if(SendMail(mailAddressPrev, limitDatePrev, deviceList)) count++; | |
91 | + } | |
92 | + deviceList[0]='\0'; | |
93 | + } | |
94 | + | |
95 | + /* save the mail Address and limit date */ | |
96 | + strncpy(mailAddressPrev, mailAddress, BUFFMAXLN); | |
97 | + strncpy(limitDatePrev, limitDate, WORDMAXLN); | |
98 | + | |
99 | + /* add the device name to the deviceList | |
100 | + if list is too long, it is terminated by ", ......" */ | |
101 | + if(isNull(deviceList)){ | |
102 | + strncpy(deviceList, device, WORDMAXLN); | |
103 | + } | |
104 | + else if(strstr(deviceList, ", ......")!=NULL) ; | |
105 | + else if( strlen(deviceList) > BUFFMAXLN*0.8 ){ | |
106 | + strncat(deviceList, ", ......", BUFFMAXLN); | |
107 | + } | |
108 | + else{ | |
109 | + strncat(deviceList, ", ", BUFFMAXLN); | |
110 | + strncat(deviceList, device, BUFFMAXLN); | |
111 | + } | |
112 | + } | |
113 | + | |
114 | + /* post process at the end of get loop */ | |
115 | + if( !isNull(mailAddressPrev) ){ | |
116 | + if(SendMail(mailAddressPrev, limitDatePrev, deviceList)) count++; | |
117 | + } | |
73 | 118 | } |
74 | 119 | |
75 | 120 | /* finalize */ |