[3394] | 1 | {literal} |
---|
| 2 | <script type="text/javascript"> |
---|
| 3 | |
---|
| 4 | function change_color(inputzone, colorsquare) |
---|
| 5 | { |
---|
| 6 | var objinp = document.getElementById(inputzone); |
---|
| 7 | var objcol = document.getElementById(colorsquare); |
---|
| 8 | var colvalue = objinp.value; |
---|
| 9 | |
---|
| 10 | while(colvalue.length<6) { colvalue+='0'; } |
---|
| 11 | |
---|
| 12 | objcol.style.background = '#'+colvalue; |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | function change_width(inputzone, widthbar) |
---|
| 16 | { |
---|
| 17 | var objinp = document.getElementById(inputzone); |
---|
| 18 | var objbar = document.getElementById(widthbar); |
---|
| 19 | objbar.style.width = objinp.value+'px'; |
---|
| 20 | } |
---|
| 21 | |
---|
[3706] | 22 | function isAValidIP(ip, strict) |
---|
| 23 | { |
---|
| 24 | returnedip=ip; |
---|
| 25 | re = /^(\d{1,3}){1}(\.\d{1,3}){0,3}$/i; |
---|
| 26 | if(re.test(ip)) |
---|
| 27 | { |
---|
| 28 | num = ip.split('.'); |
---|
| 29 | for(i=0;i<num.length;i++) |
---|
| 30 | { |
---|
| 31 | if(num[i]>255) return(false); |
---|
| 32 | } |
---|
| 33 | if(!strict) |
---|
| 34 | { |
---|
| 35 | returnedip+="%"; |
---|
| 36 | } |
---|
| 37 | for(j=4-i;j>0;j--) |
---|
| 38 | { |
---|
| 39 | returnedip+=".%"; |
---|
| 40 | } |
---|
| 41 | return(returnedip); |
---|
| 42 | } |
---|
| 43 | else |
---|
| 44 | { |
---|
| 45 | return(false); |
---|
| 46 | } |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | function makeOptionsFromList(list, options) |
---|
| 50 | { |
---|
| 51 | if(list=="") |
---|
| 52 | { |
---|
| 53 | return(false); |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | items=list.split(","); |
---|
| 57 | for(i=0;i<items.length;i++) |
---|
| 58 | { |
---|
| 59 | opt = document.createElement("option"); |
---|
| 60 | opt.value=items[i]; |
---|
| 61 | opt.text=items[i]; |
---|
| 62 | options.appendChild(opt); |
---|
| 63 | } |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | function makeListFromOptions(options) |
---|
| 67 | { |
---|
| 68 | list=""; |
---|
| 69 | for(i=0;i<options.length;i++) |
---|
| 70 | { |
---|
| 71 | (i!=0)?list+=",":""; |
---|
| 72 | list+=options[i].value; |
---|
| 73 | } |
---|
| 74 | return(list); |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | function addIP() |
---|
| 78 | { |
---|
| 79 | ip=isAValidIP($("#iaddblackip").val(), true); |
---|
| 80 | |
---|
| 81 | if(ip==false) return(false); |
---|
| 82 | |
---|
| 83 | list = $("#iblacklistedip").val()+","; |
---|
| 84 | if(list.indexOf(ip+",")==-1) |
---|
| 85 | { |
---|
| 86 | opt = document.createElement("option"); |
---|
| 87 | opt.value=ip; |
---|
| 88 | opt.text=ip; |
---|
| 89 | $("#iblacklistip")[0].appendChild(opt); |
---|
| 90 | $("#iblacklistedip").val(makeListFromOptions($("#iblacklistip")[0].options)); |
---|
| 91 | } |
---|
| 92 | $("#iaddblackip").val(""); |
---|
| 93 | checkButtons(); |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | function delIP() |
---|
| 97 | { |
---|
| 98 | opt = $("#iblacklistip")[0]; |
---|
| 99 | |
---|
| 100 | i=0; |
---|
| 101 | while(i<opt.options.length) |
---|
| 102 | { |
---|
| 103 | if(opt.options[i].selected) |
---|
| 104 | { |
---|
| 105 | opt.removeChild(opt.options[i]); |
---|
| 106 | } |
---|
| 107 | else |
---|
| 108 | { |
---|
| 109 | i++; |
---|
| 110 | } |
---|
| 111 | } |
---|
| 112 | $("#iblacklistedip").val(makeListFromOptions(opt.options)); |
---|
| 113 | checkButtons(); |
---|
| 114 | } |
---|
| 115 | |
---|
| 116 | function checkButtons() |
---|
| 117 | { |
---|
| 118 | $("#idelipbutton").attr('disabled', !($("#iblacklistip")[0].selectedIndex!=-1)); |
---|
| 119 | $("#iaddipbutton").attr('disabled', (isAValidIP($('#iaddblackip').val(),true)==false) ); |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | function init() |
---|
| 123 | { |
---|
| 124 | makeOptionsFromList($("#iblacklistedip").val(), $("#iblacklistip")[0]); |
---|
| 125 | |
---|
| 126 | $("#iaddblackip").bind("keyup focus", getIPList).bind("blur", hideIPList); |
---|
| 127 | p = $("#iaddblackip").offset() |
---|
| 128 | $("#iplist").css({ |
---|
| 129 | left:p.left+1, |
---|
| 130 | top:p.top+$("#iaddblackip").outerHeight()-1 |
---|
| 131 | }); |
---|
| 132 | $("#iblacklistip").bind("change", checkButtons); |
---|
| 133 | checkButtons(); |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | function getIPList() |
---|
| 137 | { |
---|
| 138 | /*if($("#iaddblackip").val()=="") |
---|
| 139 | { |
---|
| 140 | ip="%"; |
---|
| 141 | } |
---|
| 142 | else |
---|
| 143 | { |
---|
| 144 | ip=isAValidIP($("#iaddblackip").val(),false); |
---|
| 145 | } |
---|
| 146 | if(ip==false) return(false);*/ |
---|
| 147 | ip=$("#iaddblackip").val()+"%"; |
---|
| 148 | |
---|
| 149 | checkButtons(); |
---|
| 150 | $("html,input").css({cursor:"progress"}); |
---|
| 151 | $.get("{/literal}{$datas.ajaxurl}{literal}", { |
---|
| 152 | ajaxfct:"astat_listip", |
---|
| 153 | ipfilter:ip, |
---|
| 154 | exclude:$("#iblacklistedip").val() |
---|
| 155 | }, |
---|
| 156 | function (data) |
---|
| 157 | { |
---|
| 158 | $("#iplist").html(data).css({visibility:"visible"}); |
---|
| 159 | $("#iipsellist") |
---|
| 160 | .bind("mouseover", function (event) { |
---|
| 161 | $("#iaddblackip").unbind("blur"); |
---|
| 162 | } ) |
---|
| 163 | .bind("mouseout", function (event) { |
---|
| 164 | $("#iaddblackip").bind("blur", hideIPList); |
---|
| 165 | } ) |
---|
| 166 | .bind("blur", hideIPList) |
---|
| 167 | .bind("change", function (event) { |
---|
| 168 | $("#iaddblackip").val($("#iipsellist").val()); |
---|
| 169 | $("#iipsellist").trigger("blur").attr("selectedIndex", -1); |
---|
| 170 | checkButtons(); |
---|
| 171 | hideIPList(); |
---|
| 172 | } ) ; |
---|
| 173 | $("html,input").css({cursor:"default"}); |
---|
| 174 | $("input:text").css({cursor:"text"}); |
---|
| 175 | } |
---|
| 176 | ); |
---|
| 177 | } |
---|
| 178 | |
---|
| 179 | function hideIPList() |
---|
| 180 | { |
---|
| 181 | $("#iplist").css({visibility:"hidden"}); |
---|
| 182 | } |
---|
| 183 | |
---|
[3394] | 184 | </script> |
---|
| 185 | {/literal} |
---|
| 186 | |
---|
| 187 | <form method="post" action="" class="general"> |
---|
| 188 | <fieldset > |
---|
| 189 | <legend>{'AStat_config_colors_and_graph'|@translate}</legend> |
---|
| 190 | |
---|
| 191 | <table class="formtable" > |
---|
| 192 | <tr> |
---|
| 193 | <td>{'AStat_BarColor_Pages'|@translate}</td> |
---|
| 194 | <td> |
---|
| 195 | <input type="text" name="f_AStat_BarColor_Pages" value="{$datas.f_AStat_BarColor_Pages}" maxlength=6 id="idz1" onkeyup="change_color('idz1', 'ids1');change_color('idz1', 'ids4')" /> |
---|
| 196 | </td> |
---|
| 197 | <td> |
---|
| 198 | <div id="ids1" style="display:block;width:15px;height:15px;border:0px;background-color:#{$datas.f_AStat_BarColor_Pages};"/> |
---|
| 199 | </td> |
---|
| 200 | </tr> |
---|
| 201 | |
---|
| 202 | <tr> |
---|
| 203 | <td>{'AStat_BarColor_Img'|@translate}</td> |
---|
| 204 | <td> |
---|
| 205 | <input type="text" name="f_AStat_BarColor_Img" value="{$datas.f_AStat_BarColor_Img}" maxlength=6 id="idz2" onkeyup="change_color('idz2', 'ids2')"/> |
---|
| 206 | </td> |
---|
| 207 | <td> |
---|
| 208 | <div id="ids2" style="display:block;width:15px;height:15px;border:0px;background-color:#{$datas.f_AStat_BarColor_Img}"/> |
---|
| 209 | </td> |
---|
| 210 | </tr> |
---|
| 211 | |
---|
| 212 | <tr> |
---|
| 213 | <td>{'AStat_BarColor_Cat'|@translate}</td> |
---|
| 214 | <td> |
---|
| 215 | <input type="text" name="f_AStat_BarColor_Cat" value="{$datas.f_AStat_BarColor_Cat}" maxlength=6 id="idz6" onkeyup="change_color('idz6', 'ids6')"/> |
---|
| 216 | </td> |
---|
| 217 | <td> |
---|
| 218 | <div id="ids6" style="display:block;width:15px;height:15px;border:0px;background-color:#{$datas.f_AStat_BarColor_Cat}"/> |
---|
| 219 | </td> |
---|
| 220 | </tr> |
---|
| 221 | |
---|
| 222 | <tr> |
---|
| 223 | <td>{'AStat_BarColor_IP'|@translate}</td> |
---|
| 224 | <td> |
---|
| 225 | <input type="text" name="f_AStat_BarColor_IP" value="{$datas.f_AStat_BarColor_IP}" maxlength=6 id="idz3" onkeyup="change_color('idz3', 'ids3')"/> |
---|
| 226 | </td> |
---|
| 227 | <td> |
---|
| 228 | <div id="ids3" style="display:block;width:15px;height:15px;border:0px;background-color:#{$datas.f_AStat_BarColor_IP}"/> |
---|
| 229 | </td> |
---|
| 230 | </tr> |
---|
| 231 | |
---|
| 232 | <tr> |
---|
| 233 | <td>{'AStat_MouseOverColor'|@translate}</td> |
---|
| 234 | <td> |
---|
| 235 | <input type="text" name="f_AStat_MouseOverColor" value="{$datas.f_AStat_MouseOverColor}" maxlength=6 id="idz5" onkeyup="change_color('idz5', 'ids5')"/> |
---|
| 236 | </td> |
---|
| 237 | <td> |
---|
| 238 | <div id="ids5" style="display:block;width:15px;height:15px;border:0px;background-color:#{$datas.f_AStat_MouseOverColor}"/> |
---|
| 239 | </td> |
---|
| 240 | </tr> |
---|
| 241 | |
---|
| 242 | <tr> |
---|
| 243 | <td>{'AStat_MaxBarWidth'|@translate}</td> |
---|
| 244 | <td> |
---|
| 245 | <input type="text" name="f_AStat_MaxBarWidth" value="{$datas.f_AStat_MaxBarWidth}" maxlength=4 id="idz4" onkeyup="change_width('idz4', 'ids4')"/> |
---|
| 246 | </td> |
---|
| 247 | <td> |
---|
| 248 | <div id="ids4" style="display:block;width:{$datas.f_AStat_MaxBarWidth}px;height:8px;top:3px;border:0px;background-color:#{$datas.f_AStat_BarColor_Pages}"/> |
---|
| 249 | </td> |
---|
| 250 | </tr> |
---|
| 251 | </table> |
---|
| 252 | |
---|
| 253 | </fieldset> |
---|
| 254 | |
---|
| 255 | |
---|
| 256 | <fieldset> |
---|
| 257 | <legend>{'AStat_specific_period_config'|@translate}</legend> |
---|
| 258 | <table class="formtable"> |
---|
| 259 | <tr> |
---|
| 260 | <td>{'AStat_PeriodPerDefault'|@translate}</td> |
---|
| 261 | <td> |
---|
| 262 | <select name="f_AStat_default_period"> |
---|
| 263 | {html_options values=$AStat_periods_list_values output=$AStat_periods_list_labels selected=$datas.AStat_periods_selected} |
---|
| 264 | </select> |
---|
| 265 | </td> |
---|
| 266 | </tr> |
---|
| 267 | </table> |
---|
| 268 | </fieldset> |
---|
| 269 | |
---|
| 270 | |
---|
| 271 | <fieldset> |
---|
| 272 | <legend>{'AStat_specific_ip_config'|@translate}</legend> |
---|
| 273 | <table class="formtable"> |
---|
| 274 | <tr> |
---|
| 275 | <td>{'AStat_NbIPPerPages'|@translate}</td> |
---|
[3706] | 276 | <td colspan="2"><input type="text" name="f_AStat_NpIPPerPages" value="{$datas.f_AStat_NpIPPerPages}" maxlength=4/></td> |
---|
[3394] | 277 | </tr> |
---|
| 278 | |
---|
| 279 | <tr> |
---|
| 280 | <td>{'AStat_DefaultSortIP'|@translate}</td> |
---|
[3706] | 281 | <td colspan="2"> |
---|
[3394] | 282 | <select name="f_AStat_DefaultSortIP"> |
---|
| 283 | {html_options values=$AStat_defaultsortip_list_values output=$AStat_defaultsortip_list_labels selected=$datas.AStat_defaultsortip_selected} |
---|
| 284 | </select> |
---|
| 285 | </td> |
---|
| 286 | </tr> |
---|
[3706] | 287 | |
---|
| 288 | <tr> |
---|
| 289 | <td>{'AStat_BlackListedIP'|@translate}</td> |
---|
| 290 | <td> |
---|
| 291 | <input type="text" size="15" id="iaddblackip" style="width:200px;" autocomplete="off"/> |
---|
| 292 | <input type="hidden" id="iblacklistedip" name="f_AStat_BlackListedIP" value="{$datas.f_AStat_BlackListedIP}"/> |
---|
| 293 | <div id="iplist"></div> |
---|
| 294 | </td> |
---|
| 295 | <td> |
---|
| 296 | <input type="button" value="{'AStat_AddIP'|@translate}" id="iaddipbutton" onclick="addIP();"/> |
---|
| 297 | </td> |
---|
| 298 | </tr> |
---|
| 299 | <tr> |
---|
| 300 | <td> </td> |
---|
| 301 | <td> |
---|
| 302 | <select multiple size="4" id="iblacklistip" style="width:200px;height:150px;"> |
---|
| 303 | </select> |
---|
| 304 | </td> |
---|
| 305 | <td> |
---|
| 306 | <input type="button" value="{'AStat_DelIP'|@translate}" id="idelipbutton" onclick="delIP();"/> |
---|
| 307 | </td> |
---|
| 308 | </tr> |
---|
[3707] | 309 | <tr> |
---|
| 310 | <td> </td> |
---|
| 311 | <td colspan="2"> |
---|
| 312 | <select name="f_AStat_UseBlackList"> |
---|
| 313 | {html_options values=$AStat_enableddisabled_list_values output=$AStat_enableddisabled_list_labels selected=$datas.AStat_UseBlackList_selected} |
---|
| 314 | </select> |
---|
| 315 | </td> |
---|
| 316 | </tr> |
---|
[3706] | 317 | |
---|
| 318 | |
---|
| 319 | |
---|
[3394] | 320 | </table> |
---|
| 321 | </fieldset> |
---|
| 322 | |
---|
| 323 | <fieldset> |
---|
| 324 | <legend>{'AStat_specific_category_config'|@translate}</legend> |
---|
| 325 | <table class="formtable"> |
---|
| 326 | <tr> |
---|
| 327 | <td>{'AStat_NbCatPerPages'|@translate}</td> |
---|
| 328 | <td><input type="text" name="f_AStat_NpCatPerPages" value="{$datas.f_AStat_NpCatPerPages}" maxlength=4/></td> |
---|
| 329 | </tr> |
---|
| 330 | |
---|
| 331 | <tr> |
---|
| 332 | <td>{'AStat_ShowThumbCat'|@translate}</td> |
---|
| 333 | <td> |
---|
| 334 | <select name="f_AStat_ShowThumbCat"> |
---|
| 335 | {html_options values=$AStat_yesno_list_values output=$AStat_yesno_list_labels selected=$datas.AStat_showthumbcat_selected} |
---|
| 336 | </select> |
---|
| 337 | </td> |
---|
| 338 | </tr> |
---|
| 339 | |
---|
| 340 | <tr> |
---|
| 341 | <td>{'AStat_DefaultSortCat'|@translate}</td> |
---|
| 342 | <td> |
---|
| 343 | <select name="f_AStat_DefaultSortCat"> |
---|
| 344 | {html_options values=$AStat_defaultsortcat_list_values output=$AStat_defaultsortcat_list_labels selected=$datas.AStat_defaultsortcat_selected} |
---|
| 345 | </select> |
---|
| 346 | </td> |
---|
| 347 | </tr> |
---|
| 348 | </table> |
---|
| 349 | </fieldset> |
---|
| 350 | |
---|
| 351 | <fieldset> |
---|
| 352 | <legend>{'AStat_specific_image_config'|@translate}</legend> |
---|
| 353 | <table class="formtable"> |
---|
| 354 | <tr> |
---|
| 355 | <td>{'AStat_NbImgPerPages'|@translate}</td> |
---|
| 356 | <td> |
---|
| 357 | <input type="text" name="f_AStat_NbImgPerPages" value="{$datas.f_AStat_NbImgPerPages}" maxlength=4/> |
---|
| 358 | </td> |
---|
| 359 | </tr> |
---|
| 360 | |
---|
| 361 | <tr> |
---|
| 362 | <td>{'AStat_ShowThumbImg'|@translate}</td> |
---|
| 363 | <td> |
---|
| 364 | <select name="f_AStat_ShowThumbImg"> |
---|
| 365 | {html_options values=$AStat_yesno_list_values output=$AStat_yesno_list_labels selected=$datas.AStat_showthumbimg_selected} |
---|
| 366 | </select> |
---|
| 367 | </td> |
---|
| 368 | </tr> |
---|
| 369 | |
---|
| 370 | <tr> |
---|
| 371 | <td>{'AStat_DefaultSortImg'|@translate}</td> |
---|
| 372 | <td> |
---|
| 373 | <select name="f_AStat_DefaultSortImg"> |
---|
| 374 | {html_options values=$AStat_defaultsortimg_list_values output=$AStat_defaultsortimg_list_labels selected=$datas.AStat_defaultsortimg_selected} |
---|
| 375 | </select> |
---|
| 376 | </td> |
---|
| 377 | </tr> |
---|
| 378 | </table> |
---|
| 379 | </fieldset> |
---|
| 380 | |
---|
| 381 | <p> |
---|
| 382 | <input type="submit" value="{'AStat_do_save'|@translate}" name="submit"/> |
---|
| 383 | </p> |
---|
| 384 | |
---|
| 385 | </form> |
---|
| 386 | |
---|
[3706] | 387 | <script type="text/javascript"> |
---|
| 388 | init(); |
---|
| 389 | </script> |
---|
[3394] | 390 | |
---|