1 | /** |
---|
2 | * ----------------------------------------------------------------------------- |
---|
3 | * file: estatPM.js |
---|
4 | * file version: 1.0.0 |
---|
5 | * date: 2011-12-02 |
---|
6 | * |
---|
7 | * Page Manager |
---|
8 | */ |
---|
9 | |
---|
10 | var themeColor={ |
---|
11 | border:'#666666', |
---|
12 | background:'#222222' |
---|
13 | } |
---|
14 | |
---|
15 | |
---|
16 | /** |
---|
17 | * estatPM class |
---|
18 | * used to manage the admin interface |
---|
19 | * |
---|
20 | * public functions : |
---|
21 | * - changePage(pageName) |
---|
22 | */ |
---|
23 | $.EStatManagePages = function (fct, values) |
---|
24 | { |
---|
25 | var $this = this, |
---|
26 | properties={ |
---|
27 | url:'', |
---|
28 | urlExport:'', |
---|
29 | token:'', |
---|
30 | itemPerPage:50, |
---|
31 | currentPage:'Stats_by_period', |
---|
32 | initPhase:false, |
---|
33 | graph:{ |
---|
34 | axis:{ |
---|
35 | color:'#666666', |
---|
36 | ticksSize:{ |
---|
37 | small:1, |
---|
38 | big:10 |
---|
39 | }, |
---|
40 | minSpaceLast:5, |
---|
41 | frequency:{ |
---|
42 | small:2, |
---|
43 | big:5 |
---|
44 | }, |
---|
45 | value:{ |
---|
46 | rotateH:20, |
---|
47 | rotateV:0, |
---|
48 | fontName:'arial', |
---|
49 | fontSize:8 |
---|
50 | } |
---|
51 | }, |
---|
52 | colors:{ |
---|
53 | normal:[ |
---|
54 | '#ffdd18', // 0: yellow |
---|
55 | '#b73561', // 1: red purple |
---|
56 | '#00a14b', // 2: green |
---|
57 | '#fe4819', // 3: red-orange |
---|
58 | '#21409a', // 4: blue |
---|
59 | '#f99d28', // 5: yellow-orange |
---|
60 | '#7f4098', // 6: purple |
---|
61 | '#8cc63f', // 7: yellow-green |
---|
62 | '#ed1c24', // 8: red |
---|
63 | '#07707d', // 9: blue-green |
---|
64 | '#f26522', // 10: orange |
---|
65 | '#584099' // 11: blue-purple |
---|
66 | ], |
---|
67 | light:[ |
---|
68 | '#ffe466', // 0: yellow |
---|
69 | '#c5667a', // 1: red purple |
---|
70 | '#6ab574', // 2: green |
---|
71 | '#f58256', // 3: red-orange |
---|
72 | '#5a64ac', // 4: blue |
---|
73 | '#fcbe75', // 5: yellow-orange |
---|
74 | '#996caf', // 6: purple |
---|
75 | '#a8d171', // 7: yellow-green |
---|
76 | '#f16045', // 8: red |
---|
77 | '#548490', // 9: blue-green |
---|
78 | '#f78f58', // 10: orange |
---|
79 | '#7968ae' // 11: blue-purple |
---|
80 | ], |
---|
81 | dark:[ |
---|
82 | '#bfa417', // 0: yellow |
---|
83 | '#872146', // 1: red purple |
---|
84 | '#057938', // 2: green |
---|
85 | '#b23016', // 3: red-orange |
---|
86 | '#142a75', // 4: blue |
---|
87 | '#b8761f', // 5: yellow-orange |
---|
88 | '#5f2974', // 6: purple |
---|
89 | '#66952d', // 7: yellow-green |
---|
90 | '#b11016', // 8: red |
---|
91 | '#05535d', // 9: blue-green |
---|
92 | '#b34b14', // 10: orange |
---|
93 | '#422a74' // 11: blue-purple |
---|
94 | ], |
---|
95 | gray:[ |
---|
96 | '#111111', // 0: |
---|
97 | '#222222', // 1: |
---|
98 | '#333333', // 2: |
---|
99 | '#444444', // 3: |
---|
100 | '#555555', // 4: |
---|
101 | '#666666', // 5: |
---|
102 | '#777777', // 6: |
---|
103 | '#888888', // 7: |
---|
104 | '#999999', // 8: |
---|
105 | '#AAAAAA', // 9: |
---|
106 | '#BBBBBB', // 10: |
---|
107 | '#CCCCCC', // 11: |
---|
108 | '#DDDDDD', // 12: |
---|
109 | '#EEEEEE' // 13: |
---|
110 | ] |
---|
111 | } |
---|
112 | }, |
---|
113 | history:{ |
---|
114 | graphAllPeriods:{ |
---|
115 | axis:null, |
---|
116 | serieTotal:null, |
---|
117 | serieComputer:null, |
---|
118 | serieMobile:null, |
---|
119 | serieCrawler:null, |
---|
120 | serieOther:null |
---|
121 | }, |
---|
122 | graphCurrentPeriod:{ |
---|
123 | axis:null, |
---|
124 | serieTotal:null, |
---|
125 | serieComputer:null, |
---|
126 | serieMobile:null, |
---|
127 | serieCrawler:null, |
---|
128 | serieOther:null |
---|
129 | } |
---|
130 | }, |
---|
131 | period:{ |
---|
132 | graph:{ |
---|
133 | axis:null, |
---|
134 | serieViewedAlbums:null, |
---|
135 | serieViewedImages:null, |
---|
136 | serieViewedPages:null, |
---|
137 | serieUniqueIP:null |
---|
138 | } |
---|
139 | }, |
---|
140 | ip:{ |
---|
141 | graphType:{ |
---|
142 | axis:null, |
---|
143 | serie:null |
---|
144 | }, |
---|
145 | graphCountry:{ |
---|
146 | axis:null, |
---|
147 | serie:null |
---|
148 | } |
---|
149 | } |
---|
150 | }, // << properties={...} |
---|
151 | |
---|
152 | /** |
---|
153 | * ------------------------------------------------------------------------- |
---|
154 | * set the properties values |
---|
155 | * ------------------------------------------------------------------------- |
---|
156 | */ |
---|
157 | setProperties = function (values) |
---|
158 | { |
---|
159 | if(values==null) |
---|
160 | values=$(window).data('EStatMPProperties'); |
---|
161 | |
---|
162 | if(values==null) return(false); |
---|
163 | |
---|
164 | if(values.url) |
---|
165 | properties.url=values.url; |
---|
166 | |
---|
167 | if(values.urlExport) |
---|
168 | properties.urlExport=values.urlExport; |
---|
169 | |
---|
170 | if(values.token) |
---|
171 | properties.token=values.token; |
---|
172 | |
---|
173 | if(values.itemPerPage) |
---|
174 | properties.itemPerPage=values.itemPerPage; |
---|
175 | |
---|
176 | if(values.currentPage) |
---|
177 | properties.currentPage=values.currentPage; |
---|
178 | |
---|
179 | if(values.history) |
---|
180 | properties.history=values.history; |
---|
181 | |
---|
182 | if(values.period) |
---|
183 | properties.period=values.period; |
---|
184 | |
---|
185 | if(values.ip) |
---|
186 | properties.ip=values.ip; |
---|
187 | |
---|
188 | $(window).data('EStatMPProperties', properties); |
---|
189 | return(true); |
---|
190 | }, // << setProperties() |
---|
191 | |
---|
192 | |
---|
193 | |
---|
194 | /** |
---|
195 | * ------------------------------------------------------------------------- |
---|
196 | * |
---|
197 | * INITIALIZATION FUNCTIONS |
---|
198 | * |
---|
199 | * |
---|
200 | * ------------------------------------------------------------------------- |
---|
201 | */ |
---|
202 | |
---|
203 | /** |
---|
204 | * ------------------------------------------------------------------------- |
---|
205 | * this function initialize the page (jquery objects) and preload data page |
---|
206 | * ------------------------------------------------------------------------- |
---|
207 | */ |
---|
208 | init=function () |
---|
209 | { |
---|
210 | properties.initPhase=true; |
---|
211 | |
---|
212 | initGlobalObjects(); |
---|
213 | //initPageSynthesis(); |
---|
214 | initPagePeriod(); |
---|
215 | initPageIP(); |
---|
216 | initPageCategory(); |
---|
217 | initPageImage(); |
---|
218 | initPageHistory(); |
---|
219 | //initPageConfig(); |
---|
220 | //initPageTools(); |
---|
221 | |
---|
222 | properties.initPhase=false; |
---|
223 | changePage('Stats_by_period'); |
---|
224 | }, |
---|
225 | |
---|
226 | /** |
---|
227 | * ------------------------------------------------------------------------- |
---|
228 | * initialise objects common to all pages |
---|
229 | * ------------------------------------------------------------------------- |
---|
230 | */ |
---|
231 | initGlobalObjects = function() |
---|
232 | { |
---|
233 | $('#iFilterCatId').categorySelector( |
---|
234 | { |
---|
235 | listMaxWidth:600, |
---|
236 | listMaxHeight:350, |
---|
237 | displayStatus:true, |
---|
238 | displayPath:true, |
---|
239 | multiple:true, |
---|
240 | levelIndent:20, |
---|
241 | userMode:'public', |
---|
242 | galleryRoot:false, |
---|
243 | load: function (event) |
---|
244 | { |
---|
245 | $(this).categorySelector('expand', ':all+0'); |
---|
246 | //$(this).categorySelector('value', ':first'); |
---|
247 | }, |
---|
248 | change: function (event) |
---|
249 | { |
---|
250 | loadPage(); |
---|
251 | } |
---|
252 | } |
---|
253 | ); |
---|
254 | |
---|
255 | $('#iFilterPeriodId').inputTreeList( |
---|
256 | { |
---|
257 | listMaxWidth:600, |
---|
258 | listMaxHeight:350, |
---|
259 | levelIndent:15, |
---|
260 | iconWidthEC:10, |
---|
261 | displayPath:true, |
---|
262 | postUrl:properties.url, |
---|
263 | displayNfo:false, |
---|
264 | multiple:false, |
---|
265 | postData:{ |
---|
266 | ajaxfct:"admin.stat.periodTreeList", |
---|
267 | token:properties.token |
---|
268 | }, |
---|
269 | load: function (event) |
---|
270 | { |
---|
271 | $(this).inputTreeList('collapse', ':all+0'); |
---|
272 | $(this).inputTreeList('value', ':first'); |
---|
273 | }, |
---|
274 | change: function (event) |
---|
275 | { |
---|
276 | loadPage(); |
---|
277 | } |
---|
278 | } |
---|
279 | ); |
---|
280 | }, // << initGlobalObjects() |
---|
281 | |
---|
282 | initPageSynthesis = function() |
---|
283 | { |
---|
284 | |
---|
285 | }, // << initPageSynthesis() |
---|
286 | |
---|
287 | /** |
---|
288 | * ------------------------------------------------------------------------- |
---|
289 | * initialise objects for period page |
---|
290 | * ------------------------------------------------------------------------- |
---|
291 | */ |
---|
292 | initPagePeriod = function() |
---|
293 | { |
---|
294 | // create history dynamic table |
---|
295 | $('#iPeriodTable').dynamicTable( |
---|
296 | { |
---|
297 | columns: |
---|
298 | [ |
---|
299 | { |
---|
300 | id:'period', |
---|
301 | title:translateString.period, |
---|
302 | sortable:'no', |
---|
303 | width:'20%' |
---|
304 | }, |
---|
305 | { |
---|
306 | id:'viewedPages', |
---|
307 | title:translateString.viewedPages, |
---|
308 | sortable:'no', |
---|
309 | width:'20%' |
---|
310 | }, |
---|
311 | |
---|
312 | { |
---|
313 | id:'viewedAlbums', |
---|
314 | title:translateString.viewedAlbums, |
---|
315 | sortable:'no', |
---|
316 | width:'20%' |
---|
317 | }, |
---|
318 | |
---|
319 | { |
---|
320 | id:'viewedImages', |
---|
321 | title:translateString.viewedImages, |
---|
322 | sortable:'no', |
---|
323 | width:'20%' |
---|
324 | }, |
---|
325 | |
---|
326 | { |
---|
327 | id:'uniqueIP', |
---|
328 | title:translateString.uniqueIP, |
---|
329 | sortable:'no' |
---|
330 | } |
---|
331 | ], |
---|
332 | showTotalRow:'visible', |
---|
333 | showSaveButton:false, |
---|
334 | autoLoad:false, |
---|
335 | postUrl:properties.url, |
---|
336 | postData: |
---|
337 | { |
---|
338 | ajaxfct:"admin.stat.period", |
---|
339 | token:properties.token, |
---|
340 | period:'' |
---|
341 | }, |
---|
342 | minHeight:350, |
---|
343 | maxHeight:350, |
---|
344 | nbItemsPage:properties.itemPerPage, |
---|
345 | footerString: |
---|
346 | { |
---|
347 | singular:'', |
---|
348 | plural:'' |
---|
349 | }, |
---|
350 | /* |
---|
351 | pageChanged: function (event, value) |
---|
352 | { |
---|
353 | }, |
---|
354 | */ |
---|
355 | contentLoading: function (event, value) |
---|
356 | { |
---|
357 | $('#iPeriodTable').dynamicTable('click', 'clear'); |
---|
358 | }, |
---|
359 | contentLoaded: function (event, value) |
---|
360 | { |
---|
361 | switch($('#iPeriodPath').inputPath('level')) |
---|
362 | { |
---|
363 | case 1: |
---|
364 | case 2: |
---|
365 | $('#iPeriodTable').dynamicTable('click', clickOnPeriodTable); |
---|
366 | break; |
---|
367 | case 3: |
---|
368 | $('#iPeriodTable').dynamicTable('click', 'clear'); |
---|
369 | break; |
---|
370 | } |
---|
371 | |
---|
372 | }, |
---|
373 | click: clickOnPeriodTable |
---|
374 | } |
---|
375 | ); |
---|
376 | |
---|
377 | |
---|
378 | // create graph - stat for all period |
---|
379 | properties.period.graph.axis=new CDAxis( |
---|
380 | { |
---|
381 | mode:'XY', |
---|
382 | display:{ |
---|
383 | color:properties.graph.axis.color, |
---|
384 | visible: |
---|
385 | { |
---|
386 | XY: |
---|
387 | { |
---|
388 | H:true, |
---|
389 | V:true |
---|
390 | } |
---|
391 | } |
---|
392 | }, |
---|
393 | XY:{ |
---|
394 | ticks:{ |
---|
395 | H:{ |
---|
396 | size:{ |
---|
397 | small:properties.graph.axis.ticksSize.small, |
---|
398 | big:properties.graph.axis.ticksSize.big |
---|
399 | }, |
---|
400 | visible:{ |
---|
401 | small:true, |
---|
402 | big:true |
---|
403 | }, |
---|
404 | minSpaceLast:properties.graph.axis.minSpaceLast, |
---|
405 | frequency:{ |
---|
406 | small:1, //properties.graph.axis.frequency.small, |
---|
407 | big:1 //properties.graph.axis.frequency.big |
---|
408 | }, |
---|
409 | value:{ |
---|
410 | rotate:properties.graph.axis.value.rotateH, |
---|
411 | visible:true, |
---|
412 | fontName:properties.graph.axis.value.fontName, |
---|
413 | fontSize:properties.graph.axis.value.fontSize |
---|
414 | }, |
---|
415 | offset0:true |
---|
416 | }, |
---|
417 | V:{ |
---|
418 | unit:'', |
---|
419 | size:{ |
---|
420 | small:properties.graph.axis.ticksSize.small, |
---|
421 | big:properties.graph.axis.ticksSize.big |
---|
422 | }, |
---|
423 | visible:{ |
---|
424 | small:true, |
---|
425 | big:true |
---|
426 | }, |
---|
427 | minSpaceLast:properties.graph.axis.minSpaceLast, |
---|
428 | steps:10000, |
---|
429 | frequency:{ |
---|
430 | small:250, |
---|
431 | big:1000 |
---|
432 | }, |
---|
433 | value:{ |
---|
434 | rotate:properties.graph.axis.value.rotateV, |
---|
435 | visible:true, |
---|
436 | fontName:properties.graph.axis.value.fontName, |
---|
437 | fontSize:properties.graph.axis.value.fontSize |
---|
438 | } |
---|
439 | } |
---|
440 | } |
---|
441 | }, |
---|
442 | values:{H:[]} |
---|
443 | } |
---|
444 | ); |
---|
445 | |
---|
446 | properties.period.graph.serieViewedPages=new CDSerie( |
---|
447 | { |
---|
448 | name:'viewedPages', |
---|
449 | order:10, |
---|
450 | values:[], |
---|
451 | options:new CDSerieOptionsBar( |
---|
452 | { |
---|
453 | backgroundColor:properties.graph.colors.gray[3], |
---|
454 | borderColor:properties.graph.colors.gray[7], |
---|
455 | borderWidth:0, |
---|
456 | width:1, |
---|
457 | offset:0 |
---|
458 | } |
---|
459 | ) |
---|
460 | } |
---|
461 | ); |
---|
462 | |
---|
463 | properties.period.graph.serieViewedAlbums=new CDSerie( |
---|
464 | { |
---|
465 | name:'viewedAlbums', |
---|
466 | order:2, |
---|
467 | values:[], |
---|
468 | options:new CDSerieOptionsLine( |
---|
469 | { |
---|
470 | color:properties.graph.colors.normal[0], |
---|
471 | width:1, |
---|
472 | offset:0 |
---|
473 | } |
---|
474 | ) |
---|
475 | } |
---|
476 | ); |
---|
477 | |
---|
478 | properties.period.graph.serieViewedImages=new CDSerie( |
---|
479 | { |
---|
480 | name:'viewedImages', |
---|
481 | order:3, |
---|
482 | values:[], |
---|
483 | options:new CDSerieOptionsLine( |
---|
484 | { |
---|
485 | color:properties.graph.colors.normal[1], |
---|
486 | width:1, |
---|
487 | offset:0 |
---|
488 | } |
---|
489 | ) |
---|
490 | } |
---|
491 | ); |
---|
492 | |
---|
493 | properties.period.graph.serieUniqueIP=new CDSerie( |
---|
494 | { |
---|
495 | name:'uniqueIP', |
---|
496 | order:4, |
---|
497 | values:[], |
---|
498 | options:new CDSerieOptionsLine( |
---|
499 | { |
---|
500 | color:properties.graph.colors.normal[2], |
---|
501 | width:1, |
---|
502 | offset:0 |
---|
503 | } |
---|
504 | ) |
---|
505 | } |
---|
506 | ); |
---|
507 | |
---|
508 | properties.period.graph.axis.serieAdd(properties.period.graph.serieViewedAlbums); |
---|
509 | properties.period.graph.axis.serieAdd(properties.period.graph.serieViewedImages); |
---|
510 | properties.period.graph.axis.serieAdd(properties.period.graph.serieViewedPages); |
---|
511 | properties.period.graph.axis.serieAdd(properties.period.graph.serieUniqueIP); |
---|
512 | |
---|
513 | |
---|
514 | $('#iPeriodGraph').drawingGraph( |
---|
515 | { |
---|
516 | display: |
---|
517 | { |
---|
518 | width:450, |
---|
519 | height:150 |
---|
520 | }, |
---|
521 | cursor: |
---|
522 | { |
---|
523 | verticalType:'line' |
---|
524 | }, |
---|
525 | margins:new CDMargins({top:5,bottom:45, left:50, right:1}), |
---|
526 | legend:new CDLegend({ |
---|
527 | width:0, |
---|
528 | visible:false, |
---|
529 | position:'right', // left or right |
---|
530 | backgroundColor:themeColor.background, |
---|
531 | borderColor:themeColor.border, |
---|
532 | borderWidth:0, |
---|
533 | fontName:'arial', |
---|
534 | fontSize:10 |
---|
535 | }), |
---|
536 | axis:{front:properties.period.graph.axis, back:null}, |
---|
537 | events:{ |
---|
538 | mouseEnter:function (event) |
---|
539 | { |
---|
540 | var geometry={ |
---|
541 | x:0, |
---|
542 | y:0, |
---|
543 | w:250, |
---|
544 | h:75 |
---|
545 | }; |
---|
546 | |
---|
547 | geometry.x=$('#iPeriodGraph').offset().left+($('#iPeriodGraph').width()-geometry.w)/2; |
---|
548 | geometry.y=$('#iPeriodGraph').offset().top-geometry.h-10; |
---|
549 | displayPopupInfo(true, geometry, getPeriodPopupContent()); |
---|
550 | }, |
---|
551 | mouseLeave:function (event) |
---|
552 | { |
---|
553 | displayPopupInfo(false); |
---|
554 | }, |
---|
555 | mousePositionChange:function (event, data) |
---|
556 | { |
---|
557 | var list=['viewedAlbums', 'viewedImages', 'uniqueIP', 'viewedPages']; |
---|
558 | for(i=0;i<list.length;i++) |
---|
559 | { |
---|
560 | $('#iPI_'+list[i]).html(data.values[i].value); |
---|
561 | } |
---|
562 | } |
---|
563 | } |
---|
564 | } |
---|
565 | ); |
---|
566 | |
---|
567 | $('#iPeriodPath') |
---|
568 | .inputPath( |
---|
569 | { |
---|
570 | separator:'>', |
---|
571 | autoSetLevel:true, |
---|
572 | click: function (event, value) |
---|
573 | { |
---|
574 | loadPageStatByPeriod(); |
---|
575 | } |
---|
576 | } |
---|
577 | ) |
---|
578 | .inputPath('push', {id:'allYear', label:translateString.allYear}); |
---|
579 | |
---|
580 | }, // << initPagePeriod() |
---|
581 | |
---|
582 | |
---|
583 | |
---|
584 | /** |
---|
585 | * ------------------------------------------------------------------------- |
---|
586 | * initialise objects for IP page |
---|
587 | * ------------------------------------------------------------------------- |
---|
588 | */ |
---|
589 | initPageIP = function() |
---|
590 | { |
---|
591 | // create IP dynamic table |
---|
592 | $('#iIPTable').dynamicTable( |
---|
593 | { |
---|
594 | columns: |
---|
595 | [ |
---|
596 | { |
---|
597 | id:'IPadress', |
---|
598 | title:translateString.ipAdress, |
---|
599 | sortable:'asc', |
---|
600 | filter: |
---|
601 | { |
---|
602 | title:translateString.ipAdress, |
---|
603 | dataType:'string', |
---|
604 | data:{ |
---|
605 | regexp:'\d{1,3}(?:\.\d{1,3}){0,3}' |
---|
606 | }, |
---|
607 | defaultOperator:'like', |
---|
608 | filterOperators:['like', 'not like', 'between', 'not between'] |
---|
609 | }, |
---|
610 | group:true, |
---|
611 | width:'100px' |
---|
612 | }, |
---|
613 | |
---|
614 | { |
---|
615 | id:'country', |
---|
616 | title:translateString.filter.country, |
---|
617 | sortable:'asc', |
---|
618 | group:true, |
---|
619 | filter: |
---|
620 | { |
---|
621 | title:translateString.filter.country, |
---|
622 | dataType:'dataset-url', |
---|
623 | data:{ |
---|
624 | serverUrl:properties.url+'?ajaxfct=admin.fct.validValues&domain=country&token='+properties.token |
---|
625 | }, |
---|
626 | defaultOperator:'in', |
---|
627 | filterOperators:['in'] |
---|
628 | } |
---|
629 | }, |
---|
630 | |
---|
631 | { |
---|
632 | id:'uaType', |
---|
633 | title:translateString.type, |
---|
634 | filter: |
---|
635 | { |
---|
636 | title:translateString.filter.type, |
---|
637 | dataType:'dataset-url', |
---|
638 | data:{ |
---|
639 | serverUrl:properties.url+'?ajaxfct=admin.fct.validValues&domain=uaType&token='+properties.token |
---|
640 | }, |
---|
641 | defaultOperator:'in', |
---|
642 | filterOperators:['in'] |
---|
643 | }, |
---|
644 | group:true, |
---|
645 | sortable:'asc', |
---|
646 | width:'125px' |
---|
647 | }, |
---|
648 | |
---|
649 | { |
---|
650 | id:'nbVisits', |
---|
651 | title:translateString.visits, |
---|
652 | sortable:'asc', |
---|
653 | width:'90px' |
---|
654 | } |
---|
655 | |
---|
656 | ], |
---|
657 | showTotalRow:'visible', |
---|
658 | showSaveButton:true, |
---|
659 | autoLoad:false, |
---|
660 | postUrl:properties.url, |
---|
661 | postData: |
---|
662 | { |
---|
663 | ajaxfct:"admin.stat.ip", |
---|
664 | token:properties.token, |
---|
665 | period:'' |
---|
666 | }, |
---|
667 | minHeight:350, |
---|
668 | maxHeight:350, |
---|
669 | nbItemsPage:properties.itemPerPage, |
---|
670 | sortBoxTitle:translateString.sortBy, |
---|
671 | footerString: |
---|
672 | { |
---|
673 | singular:translateString.item_nb, |
---|
674 | plural:translateString.items_nb, |
---|
675 | waitForDownload:translateString.waitForDownload |
---|
676 | }, |
---|
677 | dialogsButtons:{ |
---|
678 | ok:translateString.ok, |
---|
679 | cancel:translateString.cancel, |
---|
680 | erase:translateString.eraseFilter |
---|
681 | }, |
---|
682 | saveButtonClick: function (event, data) |
---|
683 | { |
---|
684 | $.dialogExport( |
---|
685 | { |
---|
686 | title:translateString.dataExport, |
---|
687 | buttons: |
---|
688 | { |
---|
689 | ok:translateString.ok, |
---|
690 | cancel:translateString.cancel |
---|
691 | }, |
---|
692 | name:'ipAdress', |
---|
693 | format:'csv', |
---|
694 | compression:'gz', |
---|
695 | formatList: |
---|
696 | [ |
---|
697 | {id:'csv', text:translateString.fileFormatCSV, infos:'(.csv)'}, |
---|
698 | {id:'ods', text:translateString.fileFormatODS, infos:'(.ods)'}, |
---|
699 | {id:'sqlite', text:translateString.fileFormatSQLite, infos:'(.db)'} |
---|
700 | ], |
---|
701 | compressionList: |
---|
702 | [ |
---|
703 | {id:'none', text:translateString.fileCompressionNone, infos:''}, |
---|
704 | {id:'zip', text:translateString.fileCompressionZIP, infos:'(.zip)'}, |
---|
705 | {id:'gz', text:translateString.fileCompressionGZ, infos:'(.gz)'}, |
---|
706 | {id:'bz2', text:translateString.fileCompressionBZ2, infos:'(.bz2)'} |
---|
707 | ], |
---|
708 | validExport: function (event, values) |
---|
709 | { |
---|
710 | $('#iIPTable').dynamicTable('waitForDownload', true); |
---|
711 | $.ajax( |
---|
712 | { |
---|
713 | type: "POST", |
---|
714 | url: properties.urlExport, |
---|
715 | data: |
---|
716 | { |
---|
717 | ajaxfct:'admin.export.ip', |
---|
718 | name:values.name, |
---|
719 | format:values.format, |
---|
720 | compression:values.compression, |
---|
721 | token:properties.token, |
---|
722 | period:$('#iFilterPeriodId').inputTreeList('value'), |
---|
723 | additionalFilter:{catId:$('#iFilterCatId').categorySelector('value')}, |
---|
724 | sort:data.sort, |
---|
725 | filter:data.filter, |
---|
726 | group:data.group |
---|
727 | }, |
---|
728 | async: true, |
---|
729 | success: function(msg) |
---|
730 | { |
---|
731 | $('#iIPTable').dynamicTable('waitForDownload', false); |
---|
732 | if(msg.substr(0,3)=='OK:') |
---|
733 | { |
---|
734 | $.download(msg.substr(3)); |
---|
735 | } |
---|
736 | else |
---|
737 | { |
---|
738 | alert(translateString.downloadError); |
---|
739 | } |
---|
740 | }, |
---|
741 | error: function(msg) |
---|
742 | { |
---|
743 | $('#iIPTable').dynamicTable('waitForDownload', false); |
---|
744 | } |
---|
745 | } |
---|
746 | ); |
---|
747 | } |
---|
748 | } |
---|
749 | ); |
---|
750 | }, |
---|
751 | /* |
---|
752 | pageChanged: function (event, value) |
---|
753 | { |
---|
754 | }, |
---|
755 | contentLoading: function (event, value) |
---|
756 | { |
---|
757 | }, |
---|
758 | contentLoaded: function (event, value) |
---|
759 | { |
---|
760 | }, |
---|
761 | click: function (event, value) |
---|
762 | { |
---|
763 | } |
---|
764 | */ |
---|
765 | } |
---|
766 | ); |
---|
767 | |
---|
768 | |
---|
769 | // create graph - stat for type of browser |
---|
770 | properties.ip.graphType.axis=new CDAxis( |
---|
771 | { |
---|
772 | mode:'pie', |
---|
773 | display:{visible:{pie:false}} |
---|
774 | } |
---|
775 | ); |
---|
776 | properties.ip.graphType.serie=new CDSerie( |
---|
777 | { |
---|
778 | name:translateString.type, |
---|
779 | order:1, |
---|
780 | values:[], |
---|
781 | valuesLabels:[], |
---|
782 | options:new CDSerieOptionsPie( |
---|
783 | { |
---|
784 | outerRadius:85, |
---|
785 | innerRadius:20, |
---|
786 | offset:0, |
---|
787 | borderWidth:1, |
---|
788 | backgroundColors:properties.graph.colors.light |
---|
789 | } |
---|
790 | ) |
---|
791 | } |
---|
792 | ); |
---|
793 | properties.ip.graphType.axis.serieAdd(properties.ip.graphType.serie); |
---|
794 | |
---|
795 | $('#iIPGraphType').drawingGraph( |
---|
796 | { |
---|
797 | display: |
---|
798 | { |
---|
799 | width:225, |
---|
800 | height:150 |
---|
801 | }, |
---|
802 | margins:new CDMargins({top:0,bottom:0, left:0, right:0}), |
---|
803 | legend:new CDLegend({ |
---|
804 | width:20, |
---|
805 | visible:true, |
---|
806 | position:'left', // left or right |
---|
807 | backgroundColor:themeColor.background, |
---|
808 | borderColor:themeColor.border, |
---|
809 | borderWidth:0, |
---|
810 | fontName:'arial', |
---|
811 | fontSize:10 |
---|
812 | }), |
---|
813 | axis:{front:properties.ip.graphType.axis, back:null} |
---|
814 | /* |
---|
815 | events:{ |
---|
816 | mouseEnter:function (event) |
---|
817 | { |
---|
818 | }, |
---|
819 | mouseLeave:function (event) |
---|
820 | { |
---|
821 | }, |
---|
822 | mousePositionChange:function (event, data) |
---|
823 | { |
---|
824 | } |
---|
825 | } |
---|
826 | */ |
---|
827 | } |
---|
828 | ); |
---|
829 | |
---|
830 | |
---|
831 | // create graph - stat for countries |
---|
832 | properties.ip.graphCountry.axis=new CDAxis( |
---|
833 | { |
---|
834 | mode:'pie', |
---|
835 | display:{visible:{pie:false}} |
---|
836 | } |
---|
837 | ); |
---|
838 | properties.ip.graphCountry.serie=new CDSerie( |
---|
839 | { |
---|
840 | name:translateString.country, |
---|
841 | order:1, |
---|
842 | values:[], |
---|
843 | valuesLabels:[], |
---|
844 | options:new CDSerieOptionsPie( |
---|
845 | { |
---|
846 | outerRadius:85, |
---|
847 | innerRadius:20, |
---|
848 | offset:0, |
---|
849 | borderWidth:1, |
---|
850 | backgroundColors:properties.graph.colors.light |
---|
851 | } |
---|
852 | ) |
---|
853 | } |
---|
854 | ); |
---|
855 | properties.ip.graphCountry.axis.serieAdd(properties.ip.graphCountry.serie); |
---|
856 | |
---|
857 | $('#iIPGraphCountry').drawingGraph( |
---|
858 | { |
---|
859 | display: |
---|
860 | { |
---|
861 | width:225, |
---|
862 | height:150 |
---|
863 | }, |
---|
864 | margins:new CDMargins({top:0,bottom:0, left:0, right:0}), |
---|
865 | legend:new CDLegend({ |
---|
866 | width:20, |
---|
867 | visible:true, |
---|
868 | position:'left', // left or right |
---|
869 | backgroundColor:themeColor.background, |
---|
870 | borderColor:themeColor.border, |
---|
871 | borderWidth:0, |
---|
872 | fontName:'arial', |
---|
873 | fontSize:10 |
---|
874 | }), |
---|
875 | axis:{front:properties.ip.graphCountry.axis, back:null} |
---|
876 | /* |
---|
877 | events:{ |
---|
878 | mouseEnter:function (event) |
---|
879 | { |
---|
880 | }, |
---|
881 | mouseLeave:function (event) |
---|
882 | { |
---|
883 | }, |
---|
884 | mousePositionChange:function (event, data) |
---|
885 | { |
---|
886 | } |
---|
887 | } |
---|
888 | */ |
---|
889 | } |
---|
890 | ); |
---|
891 | |
---|
892 | }, // << initPageIP() |
---|
893 | |
---|
894 | initPageCategory = function() |
---|
895 | { |
---|
896 | // create albums/categories dynamic table |
---|
897 | $('#iCategoryTable').dynamicTable( |
---|
898 | { |
---|
899 | columns: |
---|
900 | [ |
---|
901 | { |
---|
902 | id:'catId', |
---|
903 | title:translateString.album, |
---|
904 | sortable:'asc' |
---|
905 | }, |
---|
906 | |
---|
907 | { |
---|
908 | id:'uaType', |
---|
909 | title:translateString.type, |
---|
910 | filter: |
---|
911 | { |
---|
912 | title:translateString.filter.type, |
---|
913 | dataType:'dataset-url', |
---|
914 | data:{ |
---|
915 | serverUrl:properties.url+'?ajaxfct=admin.fct.validValues&domain=uaType&token='+properties.token |
---|
916 | }, |
---|
917 | defaultOperator:'in', |
---|
918 | filterOperators:['in'] |
---|
919 | }, |
---|
920 | group:true, |
---|
921 | sortable:'asc', |
---|
922 | width:'125px' |
---|
923 | }, |
---|
924 | |
---|
925 | { |
---|
926 | id:'nbVisits', |
---|
927 | title:translateString.visits, |
---|
928 | sortable:'asc', |
---|
929 | width:'125px' |
---|
930 | } |
---|
931 | ], |
---|
932 | showTotalRow:'visible', |
---|
933 | showSaveButton:true, |
---|
934 | autoLoad:false, |
---|
935 | postUrl:properties.url, |
---|
936 | postData: |
---|
937 | { |
---|
938 | ajaxfct:"admin.stat.category", |
---|
939 | token:properties.token, |
---|
940 | period:'' |
---|
941 | }, |
---|
942 | minHeight:350, |
---|
943 | maxHeight:350, |
---|
944 | nbItemsPage:properties.itemPerPage, |
---|
945 | sortBoxTitle:translateString.sortBy, |
---|
946 | footerString: |
---|
947 | { |
---|
948 | singular:translateString.item_nb, |
---|
949 | plural:translateString.items_nb, |
---|
950 | waitForDownload:translateString.waitForDownload |
---|
951 | }, |
---|
952 | dialogsButtons:{ |
---|
953 | ok:translateString.ok, |
---|
954 | cancel:translateString.cancel, |
---|
955 | erase:translateString.eraseFilter |
---|
956 | }, |
---|
957 | /* |
---|
958 | pageChanged: function (event, value) |
---|
959 | { |
---|
960 | }, |
---|
961 | contentLoaded: function (event, value) |
---|
962 | { |
---|
963 | }, |
---|
964 | click: function (event, value) |
---|
965 | { |
---|
966 | }, |
---|
967 | */ |
---|
968 | saveButtonClick: function (event, data) |
---|
969 | { |
---|
970 | $.dialogExport( |
---|
971 | { |
---|
972 | title:translateString.dataExport, |
---|
973 | buttons: |
---|
974 | { |
---|
975 | ok:translateString.ok, |
---|
976 | cancel:translateString.cancel |
---|
977 | }, |
---|
978 | name:'album', |
---|
979 | format:'csv', |
---|
980 | compression:'gz', |
---|
981 | formatList: |
---|
982 | [ |
---|
983 | {id:'csv', text:translateString.fileFormatCSV, infos:'(.csv)'}, |
---|
984 | {id:'ods', text:translateString.fileFormatODS, infos:'(.ods)'}, |
---|
985 | {id:'sqlite', text:translateString.fileFormatSQLite, infos:'(.db)'} |
---|
986 | ], |
---|
987 | compressionList: |
---|
988 | [ |
---|
989 | {id:'none', text:translateString.fileCompressionNone, infos:''}, |
---|
990 | {id:'zip', text:translateString.fileCompressionZIP, infos:'(.zip)'}, |
---|
991 | {id:'gz', text:translateString.fileCompressionGZ, infos:'(.gz)'}, |
---|
992 | {id:'bz2', text:translateString.fileCompressionBZ2, infos:'(.bz2)'} |
---|
993 | ], |
---|
994 | validExport: function (event, values) |
---|
995 | { |
---|
996 | $('#iCategoryTable').dynamicTable('waitForDownload', true); |
---|
997 | $.ajax( |
---|
998 | { |
---|
999 | type: "POST", |
---|
1000 | url: properties.urlExport, |
---|
1001 | data: |
---|
1002 | { |
---|
1003 | ajaxfct:'admin.export.category', |
---|
1004 | name:values.name, |
---|
1005 | format:values.format, |
---|
1006 | compression:values.compression, |
---|
1007 | token:properties.token, |
---|
1008 | period:$('#iFilterPeriodId').inputTreeList('value'), |
---|
1009 | additionalFilter:{catId:$('#iFilterCatId').categorySelector('value')}, |
---|
1010 | sort:data.sort, |
---|
1011 | filter:data.filter, |
---|
1012 | group:data.group |
---|
1013 | }, |
---|
1014 | async: true, |
---|
1015 | success: function(msg) |
---|
1016 | { |
---|
1017 | $('#iCategoryTable').dynamicTable('waitForDownload', false); |
---|
1018 | if(msg.substr(0,3)=='OK:') |
---|
1019 | { |
---|
1020 | $.download(msg.substr(3)); |
---|
1021 | } |
---|
1022 | else |
---|
1023 | { |
---|
1024 | alert(translateString.downloadError); |
---|
1025 | } |
---|
1026 | }, |
---|
1027 | error: function(msg) |
---|
1028 | { |
---|
1029 | $('#iCategoryTable').dynamicTable('waitForDownload', false); |
---|
1030 | } |
---|
1031 | } |
---|
1032 | ); |
---|
1033 | } |
---|
1034 | } |
---|
1035 | ); |
---|
1036 | }, |
---|
1037 | contentLoading: function (event, value) |
---|
1038 | { |
---|
1039 | $(this).find('tr[oid]').unbind('mouseenter mouseleave'); |
---|
1040 | }, |
---|
1041 | contentDisplayed: function (event, value) |
---|
1042 | { |
---|
1043 | for(var i=0;i<value.rows.length;i++) |
---|
1044 | { |
---|
1045 | if(value.rows[i][3]!='') |
---|
1046 | { |
---|
1047 | $(this).find('tr[oid='+i+']') |
---|
1048 | .bind('mouseenter', {v:value.rows[i][3]}, function (e) |
---|
1049 | { |
---|
1050 | displayPopupThumb(true, {x:e.pageX, y:$(this).offset().top}, e.data.v); |
---|
1051 | } |
---|
1052 | ) |
---|
1053 | .bind('mouseleave', function (e) |
---|
1054 | { |
---|
1055 | displayPopupThumb(false); |
---|
1056 | } |
---|
1057 | ); |
---|
1058 | } |
---|
1059 | } |
---|
1060 | } |
---|
1061 | } |
---|
1062 | ); |
---|
1063 | }, // << initPageCategory() |
---|
1064 | |
---|
1065 | initPageImage = function() |
---|
1066 | { |
---|
1067 | // create albums/categories dynamic table |
---|
1068 | $('#iImageTable').dynamicTable( |
---|
1069 | { |
---|
1070 | columns: |
---|
1071 | [ |
---|
1072 | { |
---|
1073 | id:'imageId', |
---|
1074 | title:translateString.image, |
---|
1075 | sortable:'asc' |
---|
1076 | }, |
---|
1077 | |
---|
1078 | { |
---|
1079 | id:'uaType', |
---|
1080 | title:translateString.type, |
---|
1081 | filter: |
---|
1082 | { |
---|
1083 | title:translateString.filter.type, |
---|
1084 | dataType:'dataset-url', |
---|
1085 | data:{ |
---|
1086 | serverUrl:properties.url+'?ajaxfct=admin.fct.validValues&domain=uaType&token='+properties.token |
---|
1087 | }, |
---|
1088 | defaultOperator:'in', |
---|
1089 | filterOperators:['in'] |
---|
1090 | }, |
---|
1091 | group:true, |
---|
1092 | sortable:'asc', |
---|
1093 | width:'125px' |
---|
1094 | }, |
---|
1095 | |
---|
1096 | { |
---|
1097 | id:'nbVisits', |
---|
1098 | title:translateString.visits, |
---|
1099 | sortable:'asc', |
---|
1100 | width:'125px' |
---|
1101 | } |
---|
1102 | ], |
---|
1103 | showTotalRow:'visible', |
---|
1104 | showSaveButton:true, |
---|
1105 | autoLoad:false, |
---|
1106 | postUrl:properties.url, |
---|
1107 | postData: |
---|
1108 | { |
---|
1109 | ajaxfct:"admin.stat.image", |
---|
1110 | token:properties.token, |
---|
1111 | period:'' |
---|
1112 | }, |
---|
1113 | minHeight:350, |
---|
1114 | maxHeight:350, |
---|
1115 | nbItemsPage:properties.itemPerPage, |
---|
1116 | sortBoxTitle:translateString.sortBy, |
---|
1117 | footerString: |
---|
1118 | { |
---|
1119 | singular:translateString.item_nb, |
---|
1120 | plural:translateString.items_nb, |
---|
1121 | waitForDownload:translateString.waitForDownload |
---|
1122 | }, |
---|
1123 | dialogsButtons:{ |
---|
1124 | ok:translateString.ok, |
---|
1125 | cancel:translateString.cancel, |
---|
1126 | erase:translateString.eraseFilter |
---|
1127 | }, |
---|
1128 | /* |
---|
1129 | pageChanged: function (event, value) |
---|
1130 | { |
---|
1131 | }, |
---|
1132 | contentLoaded: function (event, value) |
---|
1133 | { |
---|
1134 | }, |
---|
1135 | click: function (event, value) |
---|
1136 | { |
---|
1137 | } |
---|
1138 | */ |
---|
1139 | saveButtonClick: function (event, data) |
---|
1140 | { |
---|
1141 | $.dialogExport( |
---|
1142 | { |
---|
1143 | title:translateString.dataExport, |
---|
1144 | buttons: |
---|
1145 | { |
---|
1146 | ok:translateString.ok, |
---|
1147 | cancel:translateString.cancel |
---|
1148 | }, |
---|
1149 | name:'images', |
---|
1150 | format:'csv', |
---|
1151 | compression:'gz', |
---|
1152 | formatList: |
---|
1153 | [ |
---|
1154 | {id:'csv', text:translateString.fileFormatCSV, infos:'(.csv)'}, |
---|
1155 | {id:'ods', text:translateString.fileFormatODS, infos:'(.ods)'}, |
---|
1156 | {id:'sqlite', text:translateString.fileFormatSQLite, infos:'(.db)'} |
---|
1157 | ], |
---|
1158 | compressionList: |
---|
1159 | [ |
---|
1160 | {id:'none', text:translateString.fileCompressionNone, infos:''}, |
---|
1161 | {id:'zip', text:translateString.fileCompressionZIP, infos:'(.zip)'}, |
---|
1162 | {id:'gz', text:translateString.fileCompressionGZ, infos:'(.gz)'}, |
---|
1163 | {id:'bz2', text:translateString.fileCompressionBZ2, infos:'(.bz2)'} |
---|
1164 | ], |
---|
1165 | validExport: function (event, values) |
---|
1166 | { |
---|
1167 | $('#iImageTable').dynamicTable('waitForDownload', true); |
---|
1168 | $.ajax( |
---|
1169 | { |
---|
1170 | type: "POST", |
---|
1171 | url: properties.urlExport, |
---|
1172 | data: |
---|
1173 | { |
---|
1174 | ajaxfct:'admin.export.image', |
---|
1175 | name:values.name, |
---|
1176 | format:values.format, |
---|
1177 | compression:values.compression, |
---|
1178 | token:properties.token, |
---|
1179 | period:$('#iFilterPeriodId').inputTreeList('value'), |
---|
1180 | additionalFilter:{catId:$('#iFilterCatId').categorySelector('value')}, |
---|
1181 | sort:data.sort, |
---|
1182 | filter:data.filter, |
---|
1183 | group:data.group |
---|
1184 | }, |
---|
1185 | async: true, |
---|
1186 | success: function(msg) |
---|
1187 | { |
---|
1188 | $('#iImageTable').dynamicTable('waitForDownload', false); |
---|
1189 | if(msg.substr(0,3)=='OK:') |
---|
1190 | { |
---|
1191 | $.download(msg.substr(3)); |
---|
1192 | } |
---|
1193 | else |
---|
1194 | { |
---|
1195 | alert(translateString.downloadError); |
---|
1196 | } |
---|
1197 | }, |
---|
1198 | error: function(msg) |
---|
1199 | { |
---|
1200 | $('#iImageTable').dynamicTable('waitForDownload', false); |
---|
1201 | } |
---|
1202 | } |
---|
1203 | ); |
---|
1204 | } |
---|
1205 | } |
---|
1206 | ); |
---|
1207 | }, |
---|
1208 | contentLoading: function (event, value) |
---|
1209 | { |
---|
1210 | $(this).find('tr[oid]').unbind('mouseenter mouseleave'); |
---|
1211 | }, |
---|
1212 | contentDisplayed: function (event, value) |
---|
1213 | { |
---|
1214 | for(var i=0;i<value.rows.length;i++) |
---|
1215 | { |
---|
1216 | if(value.rows[i][3]!='') |
---|
1217 | { |
---|
1218 | $(this).find('tr[oid='+i+']') |
---|
1219 | .bind('mouseenter', {v:value.rows[i][3]}, function (e) |
---|
1220 | { |
---|
1221 | displayPopupThumb(true, {x:e.pageX, y:$(this).offset().top}, e.data.v); |
---|
1222 | } |
---|
1223 | ) |
---|
1224 | .bind('mouseleave', function (e) |
---|
1225 | { |
---|
1226 | displayPopupThumb(false); |
---|
1227 | } |
---|
1228 | ); |
---|
1229 | } |
---|
1230 | } |
---|
1231 | } |
---|
1232 | } |
---|
1233 | ); |
---|
1234 | }, // << initPageImage() |
---|
1235 | |
---|
1236 | |
---|
1237 | /** |
---|
1238 | * ------------------------------------------------------------------------- |
---|
1239 | * initialise objects for history page |
---|
1240 | * ------------------------------------------------------------------------- |
---|
1241 | */ |
---|
1242 | initPageHistory = function() |
---|
1243 | { |
---|
1244 | // create history dynamic table |
---|
1245 | $('#iHistoryTable').dynamicTable( |
---|
1246 | { |
---|
1247 | columns: |
---|
1248 | [ |
---|
1249 | { |
---|
1250 | id:'date', |
---|
1251 | title:translateString.dateTime, |
---|
1252 | filter: |
---|
1253 | { |
---|
1254 | title:translateString.filter.dateTime, |
---|
1255 | dataType:'datetime', |
---|
1256 | data:{ |
---|
1257 | timeFormat:'hh:mm' |
---|
1258 | }, |
---|
1259 | defaultOperator:'between', |
---|
1260 | filterOperators:['>', '<', '>=', '<=', '=', '!=', 'between', 'not between'] |
---|
1261 | }, |
---|
1262 | sortable:'asc', |
---|
1263 | width:'125px' |
---|
1264 | }, |
---|
1265 | { |
---|
1266 | id:'IPadress', |
---|
1267 | title:translateString.ip_user, |
---|
1268 | filter: |
---|
1269 | { |
---|
1270 | title:translateString.filter.ipAdress, |
---|
1271 | dataType:'string', |
---|
1272 | data:{ |
---|
1273 | regexp:'\d{1,3}(?:\.\d{1,3}){0,3}' |
---|
1274 | }, |
---|
1275 | defaultOperator:'like', |
---|
1276 | filterOperators:['like', 'not like', 'between', 'not between'] |
---|
1277 | }, |
---|
1278 | sortable:'asc', |
---|
1279 | width:'125px' |
---|
1280 | }, |
---|
1281 | |
---|
1282 | { |
---|
1283 | id:'catId', |
---|
1284 | title:translateString.album, |
---|
1285 | sortable:'no', |
---|
1286 | width:'225px' |
---|
1287 | }, |
---|
1288 | |
---|
1289 | { |
---|
1290 | id:'imageId', |
---|
1291 | title:translateString.image, |
---|
1292 | sortable:'no', |
---|
1293 | width:'200px' |
---|
1294 | }, |
---|
1295 | |
---|
1296 | { |
---|
1297 | id:'tags', |
---|
1298 | title:translateString.tags, |
---|
1299 | sortable:'no' |
---|
1300 | }, |
---|
1301 | |
---|
1302 | { |
---|
1303 | id:'section', |
---|
1304 | title:translateString.section, |
---|
1305 | filter: |
---|
1306 | { |
---|
1307 | title:translateString.filter.section, |
---|
1308 | dataType:'dataset', |
---|
1309 | data:{ |
---|
1310 | serverUrl:'' |
---|
1311 | }, |
---|
1312 | defaultOperator:'in', |
---|
1313 | filterOperators:['in'] |
---|
1314 | }, |
---|
1315 | sortable:'asc', |
---|
1316 | width:'100px' |
---|
1317 | }, |
---|
1318 | |
---|
1319 | { |
---|
1320 | id:'uaBrowser', |
---|
1321 | title:translateString.browser, |
---|
1322 | filter: |
---|
1323 | { |
---|
1324 | title:translateString.filter.browser, |
---|
1325 | dataType:'dataset-url', |
---|
1326 | data:{ |
---|
1327 | serverUrl:properties.url+'?ajaxfct=admin.fct.validValues&domain=uaBrowser&token='+properties.token |
---|
1328 | }, |
---|
1329 | defaultOperator:'in', |
---|
1330 | filterOperators:['in'] |
---|
1331 | }, |
---|
1332 | sortable:'asc', |
---|
1333 | width:'165px' |
---|
1334 | }, |
---|
1335 | |
---|
1336 | { |
---|
1337 | id:'uaEngine', |
---|
1338 | title:translateString.engine, |
---|
1339 | filter: |
---|
1340 | { |
---|
1341 | title:translateString.filter.engine, |
---|
1342 | dataType:'dataset-url', |
---|
1343 | data:{ |
---|
1344 | serverUrl:properties.url+'?ajaxfct=admin.fct.validValues&domain=uaEngine&token='+properties.token |
---|
1345 | }, |
---|
1346 | defaultOperator:'in', |
---|
1347 | filterOperators:['in'] |
---|
1348 | }, |
---|
1349 | sortable:'asc', |
---|
1350 | width:'125px' |
---|
1351 | }, |
---|
1352 | |
---|
1353 | { |
---|
1354 | id:'uaOS', |
---|
1355 | title:translateString.os, |
---|
1356 | filter: |
---|
1357 | { |
---|
1358 | title:translateString.filter.os, |
---|
1359 | dataType:'dataset-url', |
---|
1360 | data:{ |
---|
1361 | serverUrl:properties.url+'?ajaxfct=admin.fct.validValues&domain=uaOS&token='+properties.token |
---|
1362 | }, |
---|
1363 | defaultOperator:'in', |
---|
1364 | filterOperators:['in'] |
---|
1365 | }, |
---|
1366 | sortable:'asc', |
---|
1367 | width:'125px' |
---|
1368 | }, |
---|
1369 | |
---|
1370 | { |
---|
1371 | id:'uaType', |
---|
1372 | title:translateString.type, |
---|
1373 | filter: |
---|
1374 | { |
---|
1375 | title:translateString.filter.type, |
---|
1376 | dataType:'dataset-url', |
---|
1377 | data:{ |
---|
1378 | serverUrl:properties.url+'?ajaxfct=admin.fct.validValues&domain=uaType&token='+properties.token |
---|
1379 | }, |
---|
1380 | defaultOperator:'in', |
---|
1381 | filterOperators:['in'] |
---|
1382 | }, |
---|
1383 | sortable:'asc', |
---|
1384 | width:'125px' |
---|
1385 | } |
---|
1386 | ], |
---|
1387 | showSaveButton:true, |
---|
1388 | autoLoad:false, |
---|
1389 | postUrl:properties.url, |
---|
1390 | postData: |
---|
1391 | { |
---|
1392 | ajaxfct:"admin.stat.history", |
---|
1393 | token:properties.token, |
---|
1394 | period:'' |
---|
1395 | }, |
---|
1396 | minHeight:150, |
---|
1397 | maxHeight:350, |
---|
1398 | nbItemsPage:properties.itemPerPage, |
---|
1399 | sortBoxTitle:translateString.sortBy, |
---|
1400 | footerString: |
---|
1401 | { |
---|
1402 | singular:translateString.item_nb, |
---|
1403 | plural:translateString.items_nb, |
---|
1404 | waitForDownload:translateString.waitForDownload |
---|
1405 | }, |
---|
1406 | dialogsButtons:{ |
---|
1407 | ok:translateString.ok, |
---|
1408 | cancel:translateString.cancel, |
---|
1409 | erase:translateString.eraseFilter |
---|
1410 | }, |
---|
1411 | /* |
---|
1412 | pageChanged: function (event, value) |
---|
1413 | { |
---|
1414 | }, |
---|
1415 | contentLoading: function (event, value) |
---|
1416 | { |
---|
1417 | }, |
---|
1418 | */ |
---|
1419 | saveButtonClick: function (event, data) |
---|
1420 | { |
---|
1421 | $.dialogExport( |
---|
1422 | { |
---|
1423 | title:translateString.dataExport, |
---|
1424 | buttons: |
---|
1425 | { |
---|
1426 | ok:translateString.ok, |
---|
1427 | cancel:translateString.cancel |
---|
1428 | }, |
---|
1429 | name:'history', |
---|
1430 | format:'csv', |
---|
1431 | compression:'gz', |
---|
1432 | formatList: |
---|
1433 | [ |
---|
1434 | {id:'csv', text:translateString.fileFormatCSV, infos:'(.csv)'}, |
---|
1435 | {id:'ods', text:translateString.fileFormatODS, infos:'(.ods)'}, |
---|
1436 | {id:'sqlite', text:translateString.fileFormatSQLite, infos:'(.db)'} |
---|
1437 | ], |
---|
1438 | compressionList: |
---|
1439 | [ |
---|
1440 | {id:'none', text:translateString.fileCompressionNone, infos:''}, |
---|
1441 | {id:'zip', text:translateString.fileCompressionZIP, infos:'(.zip)'}, |
---|
1442 | {id:'gz', text:translateString.fileCompressionGZ, infos:'(.gz)'}, |
---|
1443 | {id:'bz2', text:translateString.fileCompressionBZ2, infos:'(.bz2)'} |
---|
1444 | ], |
---|
1445 | validExport: function (event, values) |
---|
1446 | { |
---|
1447 | $('#iHistoryTable').dynamicTable('waitForDownload', true); |
---|
1448 | $.ajax( |
---|
1449 | { |
---|
1450 | type: "POST", |
---|
1451 | url: properties.urlExport, |
---|
1452 | data: |
---|
1453 | { |
---|
1454 | ajaxfct:'admin.export.history', |
---|
1455 | name:values.name, |
---|
1456 | format:values.format, |
---|
1457 | compression:values.compression, |
---|
1458 | token:properties.token, |
---|
1459 | period:$('#iHistoryFilterPeriod').inputList('value'), |
---|
1460 | additionalFilter:{catId:$('#iFilterCatId').categorySelector('value')}, |
---|
1461 | sort:data.sort, |
---|
1462 | filter:data.filter, |
---|
1463 | group:data.group |
---|
1464 | }, |
---|
1465 | async: true, |
---|
1466 | success: function(msg) |
---|
1467 | { |
---|
1468 | $('#iHistoryTable').dynamicTable('waitForDownload', false); |
---|
1469 | if(msg.substr(0,3)=='OK:') |
---|
1470 | { |
---|
1471 | $.download(msg.substr(3)); |
---|
1472 | } |
---|
1473 | else |
---|
1474 | { |
---|
1475 | alert(translateString.downloadError); |
---|
1476 | } |
---|
1477 | }, |
---|
1478 | error: function(msg) |
---|
1479 | { |
---|
1480 | $('#iHistoryTable').dynamicTable('waitForDownload', false); |
---|
1481 | } |
---|
1482 | } |
---|
1483 | ); |
---|
1484 | } |
---|
1485 | } |
---|
1486 | ); |
---|
1487 | }, |
---|
1488 | contentLoading: function (event, value) |
---|
1489 | { |
---|
1490 | $(this).find('tr[oid]').unbind('mouseenter mouseleave'); |
---|
1491 | }, |
---|
1492 | contentDisplayed: function (event, value) |
---|
1493 | { |
---|
1494 | for(var i=0;i<value.rows.length;i++) |
---|
1495 | { |
---|
1496 | if(value.rows[i][11]!='') |
---|
1497 | { |
---|
1498 | $(this).find('tr[oid='+i+']') |
---|
1499 | .bind('mouseenter', {v:value.rows[i][11]}, function (e) |
---|
1500 | { |
---|
1501 | displayPopupThumb(true, {x:e.pageX, y:$(this).offset().top}, e.data.v); |
---|
1502 | } |
---|
1503 | ) |
---|
1504 | .bind('mouseleave', function (e) |
---|
1505 | { |
---|
1506 | displayPopupThumb(false); |
---|
1507 | } |
---|
1508 | ); |
---|
1509 | } |
---|
1510 | } |
---|
1511 | } |
---|
1512 | /* |
---|
1513 | click: function (event) |
---|
1514 | { |
---|
1515 | var oId=$(this).attr('oId'), |
---|
1516 | data=$('#table1').dynamicTable('loadedData', oId); |
---|
1517 | } |
---|
1518 | */ |
---|
1519 | } |
---|
1520 | ); |
---|
1521 | |
---|
1522 | |
---|
1523 | // create graph - stat for all period |
---|
1524 | properties.history.graphAllPeriods.axis=new CDAxis( |
---|
1525 | { |
---|
1526 | mode:'XY', |
---|
1527 | display:{ |
---|
1528 | color:properties.graph.axis.color, |
---|
1529 | visible: |
---|
1530 | { |
---|
1531 | XY: |
---|
1532 | { |
---|
1533 | H:true, |
---|
1534 | V:true |
---|
1535 | } |
---|
1536 | } |
---|
1537 | }, |
---|
1538 | XY:{ |
---|
1539 | ticks:{ |
---|
1540 | H:{ |
---|
1541 | size:{ |
---|
1542 | small:properties.graph.axis.ticksSize.small, |
---|
1543 | big:properties.graph.axis.ticksSize.big |
---|
1544 | }, |
---|
1545 | visible:{ |
---|
1546 | small:true, |
---|
1547 | big:true |
---|
1548 | }, |
---|
1549 | minSpaceLast:properties.graph.axis.minSpaceLast, |
---|
1550 | frequency:{ |
---|
1551 | small:1, //properties.graph.axis.frequency.small, |
---|
1552 | big:1 //properties.graph.axis.frequency.big |
---|
1553 | }, |
---|
1554 | value:{ |
---|
1555 | rotate:properties.graph.axis.value.rotateH, |
---|
1556 | visible:true, |
---|
1557 | fontName:properties.graph.axis.value.fontName, |
---|
1558 | fontSize:properties.graph.axis.value.fontSize |
---|
1559 | }, |
---|
1560 | offset0:true |
---|
1561 | }, |
---|
1562 | V:{ |
---|
1563 | unit:'', |
---|
1564 | size:{ |
---|
1565 | small:properties.graph.axis.ticksSize.small, |
---|
1566 | big:properties.graph.axis.ticksSize.big |
---|
1567 | }, |
---|
1568 | visible:{ |
---|
1569 | small:true, |
---|
1570 | big:true |
---|
1571 | }, |
---|
1572 | minSpaceLast:properties.graph.axis.minSpaceLast, |
---|
1573 | steps:10000, |
---|
1574 | frequency:{ |
---|
1575 | small:250, |
---|
1576 | big:1000 |
---|
1577 | }, |
---|
1578 | value:{ |
---|
1579 | rotate:properties.graph.axis.value.rotateV, |
---|
1580 | visible:true, |
---|
1581 | fontName:properties.graph.axis.value.fontName, |
---|
1582 | fontSize:properties.graph.axis.value.fontSize |
---|
1583 | } |
---|
1584 | } |
---|
1585 | } |
---|
1586 | }, |
---|
1587 | values:{H:[]} |
---|
1588 | } |
---|
1589 | ); |
---|
1590 | |
---|
1591 | properties.history.graphAllPeriods.serieTotal=new CDSerie( |
---|
1592 | { |
---|
1593 | name:'total', |
---|
1594 | order:10, |
---|
1595 | values:[], |
---|
1596 | options:new CDSerieOptionsBar( |
---|
1597 | { |
---|
1598 | backgroundColor:properties.graph.colors.gray[3], |
---|
1599 | borderColor:properties.graph.colors.gray[7], |
---|
1600 | borderWidth:0, |
---|
1601 | width:1, |
---|
1602 | offset:0 |
---|
1603 | } |
---|
1604 | ) |
---|
1605 | } |
---|
1606 | ); |
---|
1607 | |
---|
1608 | properties.history.graphAllPeriods.serieComputer=new CDSerie( |
---|
1609 | { |
---|
1610 | name:'computer', |
---|
1611 | order:1, |
---|
1612 | values:[], |
---|
1613 | options:new CDSerieOptionsLine( |
---|
1614 | { |
---|
1615 | color:properties.graph.colors.normal[0], |
---|
1616 | width:1, |
---|
1617 | offset:0 |
---|
1618 | } |
---|
1619 | ) |
---|
1620 | } |
---|
1621 | ); |
---|
1622 | |
---|
1623 | properties.history.graphAllPeriods.serieMobile=new CDSerie( |
---|
1624 | { |
---|
1625 | name:'mobile', |
---|
1626 | order:2, |
---|
1627 | values:[], |
---|
1628 | options:new CDSerieOptionsLine( |
---|
1629 | { |
---|
1630 | color:properties.graph.colors.normal[1], |
---|
1631 | width:1, |
---|
1632 | offset:0 |
---|
1633 | } |
---|
1634 | ) |
---|
1635 | } |
---|
1636 | ); |
---|
1637 | |
---|
1638 | properties.history.graphAllPeriods.serieCrawler=new CDSerie( |
---|
1639 | { |
---|
1640 | name:'crawler', |
---|
1641 | order:3, |
---|
1642 | values:[], |
---|
1643 | options:new CDSerieOptionsLine( |
---|
1644 | { |
---|
1645 | color:properties.graph.colors.normal[2], |
---|
1646 | width:1, |
---|
1647 | offset:0 |
---|
1648 | } |
---|
1649 | ) |
---|
1650 | } |
---|
1651 | ); |
---|
1652 | |
---|
1653 | properties.history.graphAllPeriods.serieOther=new CDSerie( |
---|
1654 | { |
---|
1655 | name:'other', |
---|
1656 | order:4, |
---|
1657 | values:[], |
---|
1658 | options:new CDSerieOptionsLine( |
---|
1659 | { |
---|
1660 | color:properties.graph.colors.normal[3], |
---|
1661 | width:1, |
---|
1662 | offset:0 |
---|
1663 | } |
---|
1664 | ) |
---|
1665 | } |
---|
1666 | ); |
---|
1667 | |
---|
1668 | properties.history.graphAllPeriods.axis.serieAdd(properties.history.graphAllPeriods.serieTotal); |
---|
1669 | properties.history.graphAllPeriods.axis.serieAdd(properties.history.graphAllPeriods.serieComputer); |
---|
1670 | properties.history.graphAllPeriods.axis.serieAdd(properties.history.graphAllPeriods.serieMobile); |
---|
1671 | properties.history.graphAllPeriods.axis.serieAdd(properties.history.graphAllPeriods.serieCrawler); |
---|
1672 | properties.history.graphAllPeriods.axis.serieAdd(properties.history.graphAllPeriods.serieOther); |
---|
1673 | |
---|
1674 | |
---|
1675 | $('#iHistoryGraphAll').drawingGraph( |
---|
1676 | { |
---|
1677 | display: |
---|
1678 | { |
---|
1679 | width:450, |
---|
1680 | height:150 |
---|
1681 | }, |
---|
1682 | cursor: |
---|
1683 | { |
---|
1684 | verticalType:'line' |
---|
1685 | }, |
---|
1686 | margins:new CDMargins({top:5,bottom:45, left:50, right:1}), |
---|
1687 | legend:new CDLegend({ |
---|
1688 | width:0, |
---|
1689 | visible:false, |
---|
1690 | position:'right', // left or right |
---|
1691 | backgroundColor:themeColor.background, |
---|
1692 | borderColor:themeColor.border, |
---|
1693 | borderWidth:0, |
---|
1694 | fontName:'arial', |
---|
1695 | fontSize:10 |
---|
1696 | }), |
---|
1697 | axis:{front:properties.history.graphAllPeriods.axis, back:null}, |
---|
1698 | events:{ |
---|
1699 | mouseEnter:function (event) |
---|
1700 | { |
---|
1701 | var geometry={ |
---|
1702 | x:0, |
---|
1703 | y:0, |
---|
1704 | w:250, |
---|
1705 | h:90 |
---|
1706 | }; |
---|
1707 | |
---|
1708 | geometry.x=$('#iHistoryGraphAll').offset().left+($('#iHistoryGraphAll').width()-geometry.w)/2; |
---|
1709 | geometry.y=$('#iHistoryGraphAll').offset().top+$('#iHistoryGraphAll').height(); |
---|
1710 | displayPopupInfo(true, geometry, getHistoryPopupContent()); |
---|
1711 | }, |
---|
1712 | mouseLeave:function (event) |
---|
1713 | { |
---|
1714 | displayPopupInfo(false); |
---|
1715 | }, |
---|
1716 | mousePositionChange:function (event, data) |
---|
1717 | { |
---|
1718 | var list=['computer', 'mobile', 'crawler', 'other', 'total']; |
---|
1719 | for(i=0;i<list.length;i++) |
---|
1720 | { |
---|
1721 | $('#iPI_'+list[i]).html(data.values[i].value); |
---|
1722 | } |
---|
1723 | } |
---|
1724 | } |
---|
1725 | } |
---|
1726 | ); |
---|
1727 | |
---|
1728 | |
---|
1729 | // create graph - stat for the current period |
---|
1730 | properties.history.graphCurrentPeriod.axis=new CDAxis( |
---|
1731 | { |
---|
1732 | mode:'XY', |
---|
1733 | display:{ |
---|
1734 | color:properties.graph.axis.color, |
---|
1735 | visible: |
---|
1736 | { |
---|
1737 | XY: |
---|
1738 | { |
---|
1739 | H:true, |
---|
1740 | V:true |
---|
1741 | } |
---|
1742 | } |
---|
1743 | }, |
---|
1744 | XY:{ |
---|
1745 | ticks:{ |
---|
1746 | H:{ |
---|
1747 | size:{ |
---|
1748 | small:properties.graph.axis.ticksSize.small, |
---|
1749 | big:properties.graph.axis.ticksSize.big |
---|
1750 | }, |
---|
1751 | visible:{ |
---|
1752 | small:true, |
---|
1753 | big:true |
---|
1754 | }, |
---|
1755 | minSpaceLast:properties.graph.axis.minSpaceLast, |
---|
1756 | frequency:{ |
---|
1757 | small:1, //properties.graph.axis.frequency.small, |
---|
1758 | big:1 //properties.graph.axis.frequency.big |
---|
1759 | }, |
---|
1760 | value:{ |
---|
1761 | rotate:60, //properties.graph.axis.value.rotateH, |
---|
1762 | visible:true, |
---|
1763 | fontName:properties.graph.axis.value.fontName, |
---|
1764 | fontSize:properties.graph.axis.value.fontSize |
---|
1765 | }, |
---|
1766 | offset0:true |
---|
1767 | }, |
---|
1768 | V:{ |
---|
1769 | unit:'', |
---|
1770 | size:{ |
---|
1771 | small:properties.graph.axis.ticksSize.small, |
---|
1772 | big:properties.graph.axis.ticksSize.big |
---|
1773 | }, |
---|
1774 | visible:{ |
---|
1775 | small:true, |
---|
1776 | big:true |
---|
1777 | }, |
---|
1778 | minSpaceLast:properties.graph.axis.minSpaceLast, |
---|
1779 | steps:10000, |
---|
1780 | frequency:{ |
---|
1781 | small:250, |
---|
1782 | big:1000 |
---|
1783 | }, |
---|
1784 | value:{ |
---|
1785 | rotate:properties.graph.axis.value.rotateV, |
---|
1786 | visible:true, |
---|
1787 | fontName:properties.graph.axis.value.fontName, |
---|
1788 | fontSize:properties.graph.axis.value.fontSize |
---|
1789 | } |
---|
1790 | } |
---|
1791 | } |
---|
1792 | }, |
---|
1793 | values:{H:[]} |
---|
1794 | } |
---|
1795 | ); |
---|
1796 | |
---|
1797 | properties.history.graphCurrentPeriod.serieTotal=new CDSerie( |
---|
1798 | { |
---|
1799 | name:'total', |
---|
1800 | order:10, |
---|
1801 | values:[], |
---|
1802 | options:new CDSerieOptionsBar( |
---|
1803 | { |
---|
1804 | backgroundColor:properties.graph.colors.gray[3], |
---|
1805 | borderColor:properties.graph.colors.gray[7], |
---|
1806 | borderWidth:0, |
---|
1807 | width:1, |
---|
1808 | offset:0 |
---|
1809 | } |
---|
1810 | ) |
---|
1811 | } |
---|
1812 | ); |
---|
1813 | |
---|
1814 | properties.history.graphCurrentPeriod.serieComputer=new CDSerie( |
---|
1815 | { |
---|
1816 | name:'computer', |
---|
1817 | order:1, |
---|
1818 | values:[], |
---|
1819 | options:new CDSerieOptionsLine( |
---|
1820 | { |
---|
1821 | color:properties.graph.colors.normal[0], |
---|
1822 | width:1, |
---|
1823 | offset:0 |
---|
1824 | } |
---|
1825 | ) |
---|
1826 | } |
---|
1827 | ); |
---|
1828 | |
---|
1829 | properties.history.graphCurrentPeriod.serieMobile=new CDSerie( |
---|
1830 | { |
---|
1831 | name:'mobile', |
---|
1832 | order:2, |
---|
1833 | values:[], |
---|
1834 | options:new CDSerieOptionsLine( |
---|
1835 | { |
---|
1836 | color:properties.graph.colors.normal[1], |
---|
1837 | width:1, |
---|
1838 | offset:0 |
---|
1839 | } |
---|
1840 | ) |
---|
1841 | } |
---|
1842 | ); |
---|
1843 | |
---|
1844 | properties.history.graphCurrentPeriod.serieCrawler=new CDSerie( |
---|
1845 | { |
---|
1846 | name:'crawler', |
---|
1847 | order:3, |
---|
1848 | values:[], |
---|
1849 | options:new CDSerieOptionsLine( |
---|
1850 | { |
---|
1851 | color:properties.graph.colors.normal[2], |
---|
1852 | width:1, |
---|
1853 | offset:0 |
---|
1854 | } |
---|
1855 | ) |
---|
1856 | } |
---|
1857 | ); |
---|
1858 | |
---|
1859 | properties.history.graphCurrentPeriod.serieOther=new CDSerie( |
---|
1860 | { |
---|
1861 | name:'other', |
---|
1862 | order:4, |
---|
1863 | values:[], |
---|
1864 | options:new CDSerieOptionsLine( |
---|
1865 | { |
---|
1866 | color:properties.graph.colors.normal[3], |
---|
1867 | width:1, |
---|
1868 | offset:0 |
---|
1869 | } |
---|
1870 | ) |
---|
1871 | } |
---|
1872 | ); |
---|
1873 | |
---|
1874 | properties.history.graphCurrentPeriod.axis.serieAdd(properties.history.graphCurrentPeriod.serieTotal); |
---|
1875 | properties.history.graphCurrentPeriod.axis.serieAdd(properties.history.graphCurrentPeriod.serieComputer); |
---|
1876 | properties.history.graphCurrentPeriod.axis.serieAdd(properties.history.graphCurrentPeriod.serieMobile); |
---|
1877 | properties.history.graphCurrentPeriod.axis.serieAdd(properties.history.graphCurrentPeriod.serieCrawler); |
---|
1878 | properties.history.graphCurrentPeriod.axis.serieAdd(properties.history.graphCurrentPeriod.serieOther); |
---|
1879 | |
---|
1880 | |
---|
1881 | $('#iHistoryGraphCurrent').drawingGraph( |
---|
1882 | { |
---|
1883 | display: |
---|
1884 | { |
---|
1885 | width:500, |
---|
1886 | height:150 |
---|
1887 | }, |
---|
1888 | cursor: |
---|
1889 | { |
---|
1890 | verticalType:'line' |
---|
1891 | }, |
---|
1892 | margins:new CDMargins({top:5,bottom:45, left:50, right:1}), |
---|
1893 | legend:new CDLegend({ |
---|
1894 | width:0, |
---|
1895 | visible:true, |
---|
1896 | position:'right', // left or right |
---|
1897 | backgroundColor:themeColor.background, |
---|
1898 | borderColor:themeColor.border, |
---|
1899 | borderWidth:0, |
---|
1900 | fontName:'arial', |
---|
1901 | fontSize:10 |
---|
1902 | }), |
---|
1903 | axis:{front:properties.history.graphCurrentPeriod.axis, back:null}, |
---|
1904 | events:{ |
---|
1905 | mouseEnter:function (event) |
---|
1906 | { |
---|
1907 | var geometry={ |
---|
1908 | x:0, |
---|
1909 | y:0, |
---|
1910 | w:250, |
---|
1911 | h:90 |
---|
1912 | }; |
---|
1913 | |
---|
1914 | geometry.x=$('#iHistoryGraphCurrent').offset().left+($('#iHistoryGraphCurrent').width()-geometry.w)/2; |
---|
1915 | geometry.y=$('#iHistoryGraphCurrent').offset().top+$('#iHistoryGraphCurrent').height(); |
---|
1916 | displayPopupInfo(true, geometry, getHistoryPopupContent()); |
---|
1917 | }, |
---|
1918 | mouseLeave:function (event) |
---|
1919 | { |
---|
1920 | displayPopupInfo(false); |
---|
1921 | }, |
---|
1922 | mousePositionChange:function (event, data) |
---|
1923 | { |
---|
1924 | var list=['computer', 'mobile', 'crawler', 'other', 'total']; |
---|
1925 | for(i=0;i<list.length;i++) |
---|
1926 | { |
---|
1927 | $('#iPI_'+list[i]).html(data.values[i].value); |
---|
1928 | } |
---|
1929 | } |
---|
1930 | } |
---|
1931 | } |
---|
1932 | ); |
---|
1933 | |
---|
1934 | |
---|
1935 | // load period list |
---|
1936 | $('#iHistoryFilterPeriod').inputList( |
---|
1937 | { |
---|
1938 | serverUrl:properties.url, |
---|
1939 | postData: |
---|
1940 | { |
---|
1941 | ajaxfct:'admin.stat.history.periodList', |
---|
1942 | token:properties.token |
---|
1943 | }, |
---|
1944 | listMaxWidth:650, |
---|
1945 | listMaxHeight:300, |
---|
1946 | multiple:false, |
---|
1947 | colsWidth:[180], |
---|
1948 | colsCss:['cPFilterDate','cPFilterNB'], |
---|
1949 | colsDisplayed:[0,1], |
---|
1950 | //popup: function (event, value) { }, |
---|
1951 | change: function (event, value) |
---|
1952 | { |
---|
1953 | loadPageHistory(value); |
---|
1954 | }, |
---|
1955 | load: function (event, value) |
---|
1956 | { |
---|
1957 | $('#iHistoryFilterPeriod').inputList('value', ':last'); |
---|
1958 | loadPageHistory(value); |
---|
1959 | } |
---|
1960 | } |
---|
1961 | ); |
---|
1962 | }, // << initPageHistory() |
---|
1963 | |
---|
1964 | |
---|
1965 | initPageConfig = function() |
---|
1966 | { |
---|
1967 | |
---|
1968 | }, // << initPageConfig() |
---|
1969 | |
---|
1970 | initPageTools = function() |
---|
1971 | { |
---|
1972 | |
---|
1973 | }, // << initPageTools() |
---|
1974 | |
---|
1975 | /** |
---|
1976 | * ------------------------------------------------------------------------- |
---|
1977 | * |
---|
1978 | * PAGE MANAGMENT FUNCTIONS |
---|
1979 | * |
---|
1980 | * |
---|
1981 | * ------------------------------------------------------------------------- |
---|
1982 | */ |
---|
1983 | |
---|
1984 | |
---|
1985 | /** |
---|
1986 | * ------------------------------------------------------------------------- |
---|
1987 | * this function is used to change a page : switch the page, call the data... |
---|
1988 | * |
---|
1989 | * @param String pageName : the name of page to display |
---|
1990 | * @return Boolean : true if ok, otherwise false |
---|
1991 | * ------------------------------------------------------------------------- |
---|
1992 | */ |
---|
1993 | changePage = function(pageName) |
---|
1994 | { |
---|
1995 | $('.cTabContent').css('display', 'none'); |
---|
1996 | $('#iTab'+pageName).css('display', 'inline-block'); |
---|
1997 | switch(pageName) |
---|
1998 | { |
---|
1999 | case 'Stats_by_period': |
---|
2000 | $('#iTabFilter').css('display', 'block'); |
---|
2001 | $('#iFilterCategory').css('display', 'block'); |
---|
2002 | $('#iFilterPeriod').css('display', 'none'); |
---|
2003 | break; |
---|
2004 | case 'Stats_by_ip': |
---|
2005 | case 'Stats_by_category': |
---|
2006 | case 'Stats_by_image': |
---|
2007 | // display filter block |
---|
2008 | $('#iTabFilter').css('display', 'block'); |
---|
2009 | $('#iFilterCategory').css('display', 'block'); |
---|
2010 | $('#iFilterPeriod').css('display', 'block'); |
---|
2011 | break; |
---|
2012 | //case 'Synthesis': |
---|
2013 | case 'History': |
---|
2014 | //case 'Config': |
---|
2015 | //case 'Tools': |
---|
2016 | // hide filter block |
---|
2017 | $('#iTabFilter').css('display', 'none'); |
---|
2018 | $('#iFilterCategory').css('display', 'none'); |
---|
2019 | $('#iFilterPeriod').css('display', 'none'); |
---|
2020 | break; |
---|
2021 | default: |
---|
2022 | return(false); |
---|
2023 | } |
---|
2024 | properties.currentPage=pageName; |
---|
2025 | return(loadPage(properties.currentPage)); |
---|
2026 | }, // << changePage |
---|
2027 | |
---|
2028 | |
---|
2029 | /** |
---|
2030 | * ----------------------------------------------------------------------- |
---|
2031 | * this function manage the page content's loading |
---|
2032 | * |
---|
2033 | * @param String pageName : the name of page which content have to be loaded |
---|
2034 | * @return Boolean : true if ok, otherwise false |
---|
2035 | * ----------------------------------------------------------------------- |
---|
2036 | */ |
---|
2037 | loadPage = function(pageName) |
---|
2038 | { |
---|
2039 | setProperties(); |
---|
2040 | displayPopupInfo(false); |
---|
2041 | displayPopupThumb(false); |
---|
2042 | |
---|
2043 | if(pageName==null) |
---|
2044 | { |
---|
2045 | pageName=properties.currentPage; |
---|
2046 | } |
---|
2047 | else |
---|
2048 | { |
---|
2049 | setProperties({currentPage:pageName}); |
---|
2050 | } |
---|
2051 | |
---|
2052 | switch(pageName) |
---|
2053 | { |
---|
2054 | case 'Stats_by_period': |
---|
2055 | loadPageStatByPeriod(); |
---|
2056 | break; |
---|
2057 | case 'Stats_by_ip': |
---|
2058 | loadPageStatByIp(); |
---|
2059 | break; |
---|
2060 | case 'Stats_by_category': |
---|
2061 | loadPageStatByCategory(); |
---|
2062 | break; |
---|
2063 | case 'Stats_by_image': |
---|
2064 | loadPageStatByImage(); |
---|
2065 | break; |
---|
2066 | case 'Synthesis': |
---|
2067 | loadPageSynthesis(); |
---|
2068 | break; |
---|
2069 | case 'History': |
---|
2070 | loadPageHistory(); |
---|
2071 | break; |
---|
2072 | case 'Config': |
---|
2073 | loadPageConfig(); |
---|
2074 | break; |
---|
2075 | case 'Tools': |
---|
2076 | loadPageTools(); |
---|
2077 | break; |
---|
2078 | default: |
---|
2079 | return(false); |
---|
2080 | } |
---|
2081 | return(true); |
---|
2082 | }, // << loadPage() |
---|
2083 | |
---|
2084 | |
---|
2085 | |
---|
2086 | /** |
---|
2087 | * ----------------------------------------------------------------------- |
---|
2088 | * load content for the "Period" page |
---|
2089 | * |
---|
2090 | * - period table |
---|
2091 | * - period graph |
---|
2092 | * ----------------------------------------------------------------------- |
---|
2093 | */ |
---|
2094 | loadPageStatByPeriod = function () |
---|
2095 | { |
---|
2096 | $('#iPeriodTable').dynamicTable('resizeContent'); |
---|
2097 | $('#iPeriodGraph').drawingGraph('options', |
---|
2098 | { |
---|
2099 | display:{ |
---|
2100 | width:$('#iPeriodTable').width(), |
---|
2101 | height:$('#iPeriodTable').height() |
---|
2102 | } |
---|
2103 | } |
---|
2104 | ); |
---|
2105 | |
---|
2106 | refreshGraphPeriod(); |
---|
2107 | refreshPagePeriodContent(); |
---|
2108 | }, // << loadPageStatByPeriod() |
---|
2109 | |
---|
2110 | loadPageStatByIp = function () |
---|
2111 | { |
---|
2112 | var width=$('#iTabStats_by_ip').width()*0.29, |
---|
2113 | height=$('#iIPTable').height(), |
---|
2114 | radius=Math.min(width, height)*0.35; |
---|
2115 | |
---|
2116 | properties.ip.graphType.serie.get().options.set({outerRadius:radius}); |
---|
2117 | properties.ip.graphCountry.serie.get().options.set({outerRadius:radius}); |
---|
2118 | |
---|
2119 | $('#iIPTable').dynamicTable('resizeContent'); |
---|
2120 | $('#iIPGraphType').drawingGraph('options', |
---|
2121 | { |
---|
2122 | display:{ |
---|
2123 | width:width, |
---|
2124 | height:height |
---|
2125 | } |
---|
2126 | } |
---|
2127 | ); |
---|
2128 | $('#iIPGraphCountry').drawingGraph('options', |
---|
2129 | { |
---|
2130 | display:{ |
---|
2131 | width:width, |
---|
2132 | height:height |
---|
2133 | } |
---|
2134 | } |
---|
2135 | ); |
---|
2136 | refreshGraphIP(); |
---|
2137 | refreshPageIPContent(); |
---|
2138 | }, // << loadPageStatByIp() |
---|
2139 | |
---|
2140 | loadPageStatByCategory = function () |
---|
2141 | { |
---|
2142 | $('#iCategoryTable').dynamicTable('resizeContent'); |
---|
2143 | refreshPageCategoryContent(); |
---|
2144 | }, // << loadPageStatByCategory() |
---|
2145 | |
---|
2146 | loadPageStatByImage = function () |
---|
2147 | { |
---|
2148 | $('#iImageTable').dynamicTable('resizeContent'); |
---|
2149 | refreshPageImageContent(); |
---|
2150 | }, // << loadPageStatByImage() |
---|
2151 | |
---|
2152 | loadPageSynthesis = function () |
---|
2153 | { |
---|
2154 | }, // << loadPageSynthesis() |
---|
2155 | |
---|
2156 | |
---|
2157 | /** |
---|
2158 | * ----------------------------------------------------------------------- |
---|
2159 | * load content for the "History" page |
---|
2160 | * |
---|
2161 | * - history table |
---|
2162 | * - history graph |
---|
2163 | * ----------------------------------------------------------------------- |
---|
2164 | */ |
---|
2165 | loadPageHistory = function (period) |
---|
2166 | { |
---|
2167 | $('#iHistoryTable').dynamicTable('resizeContent'); |
---|
2168 | refreshGraphHistoryMonth(period); |
---|
2169 | refreshPageHistoryContent(period, 1); |
---|
2170 | }, // << loadPageHistory() |
---|
2171 | |
---|
2172 | loadPageConfig = function () |
---|
2173 | { |
---|
2174 | }, // << loadPageConfig() |
---|
2175 | |
---|
2176 | loadPageTools = function () |
---|
2177 | { |
---|
2178 | }, // << loadPageTools() |
---|
2179 | |
---|
2180 | |
---|
2181 | |
---|
2182 | /** |
---|
2183 | * ----------------------------------------------------------------------- |
---|
2184 | * load the content of period table |
---|
2185 | * |
---|
2186 | * @param integer period: period the load; if not set, load the current period |
---|
2187 | * ----------------------------------------------------------------------- |
---|
2188 | */ |
---|
2189 | refreshPagePeriodContent = function (period) |
---|
2190 | { |
---|
2191 | if(period==null) |
---|
2192 | period=$('#iPeriodPath').inputPath('itemLevel', $('#iPeriodPath').inputPath('level')).id; |
---|
2193 | |
---|
2194 | // load the table content |
---|
2195 | $('#iPeriodTable') |
---|
2196 | .dynamicTable('postData', |
---|
2197 | { |
---|
2198 | ajaxfct:'admin.stat.period', |
---|
2199 | token:properties.token, |
---|
2200 | period:period, |
---|
2201 | additionalFilter:{catId:$('#iFilterCatId').categorySelector('value')} |
---|
2202 | } |
---|
2203 | ) |
---|
2204 | .dynamicTable('refreshContent', 1); |
---|
2205 | |
---|
2206 | }, // << refreshPagePeriodContent() |
---|
2207 | |
---|
2208 | |
---|
2209 | |
---|
2210 | /** |
---|
2211 | * ----------------------------------------------------------------------- |
---|
2212 | * load graph data for a period |
---|
2213 | * |
---|
2214 | * @param String period: the period (YYYYMM) to load; if not set, load the current period |
---|
2215 | * ----------------------------------------------------------------------- |
---|
2216 | */ |
---|
2217 | refreshGraphPeriod = function (period) |
---|
2218 | { |
---|
2219 | if(period==null) |
---|
2220 | period=$('#iPeriodPath').inputPath('itemLevel', $('#iPeriodPath').inputPath('level')).id; |
---|
2221 | |
---|
2222 | $.ajax( |
---|
2223 | { |
---|
2224 | type: "POST", |
---|
2225 | url: properties.url, |
---|
2226 | data: |
---|
2227 | { |
---|
2228 | ajaxfct:'admin.stat.period.graph', |
---|
2229 | token:properties.token, |
---|
2230 | period:period, |
---|
2231 | additionalFilter:{catId:$('#iFilterCatId').categorySelector('value')} |
---|
2232 | }, |
---|
2233 | async: true, |
---|
2234 | success: function(msg) |
---|
2235 | { |
---|
2236 | msg=$.parseJSON(msg); |
---|
2237 | properties.period.graph.axis.set( |
---|
2238 | { |
---|
2239 | XY:{ticks:{V:{steps:roundValue(msg.maxValue)}}} |
---|
2240 | } |
---|
2241 | ); |
---|
2242 | properties.period.graph.axis.set( |
---|
2243 | { |
---|
2244 | XY:{ticks:{V:{frequency:calculateTicks(properties.period.graph.axis)}}} |
---|
2245 | } |
---|
2246 | ); |
---|
2247 | properties.period.graph.axis.setValues({H:msg.axis}); |
---|
2248 | properties.period.graph.serieViewedAlbums.set( |
---|
2249 | { |
---|
2250 | values:msg.series.viewedAlbums.nbVisits, |
---|
2251 | name:msg.series.viewedAlbums.name |
---|
2252 | } |
---|
2253 | ); |
---|
2254 | properties.period.graph.serieViewedImages.set( |
---|
2255 | { |
---|
2256 | values:msg.series.viewedImages.nbVisits, |
---|
2257 | name:msg.series.viewedImages.name |
---|
2258 | } |
---|
2259 | ); |
---|
2260 | properties.period.graph.serieViewedPages.set( |
---|
2261 | { |
---|
2262 | values:msg.series.viewedPages.nbVisits, |
---|
2263 | name:msg.series.viewedPages.name |
---|
2264 | } |
---|
2265 | ); |
---|
2266 | properties.period.graph.serieUniqueIP.set( |
---|
2267 | { |
---|
2268 | values:msg.series.uniqueIP.nbVisits, |
---|
2269 | name:msg.series.uniqueIP.name |
---|
2270 | } |
---|
2271 | ); |
---|
2272 | $('#iPeriodGraph').drawingGraph('refresh'); |
---|
2273 | }, |
---|
2274 | error: function(msg) |
---|
2275 | { |
---|
2276 | } |
---|
2277 | } |
---|
2278 | ); |
---|
2279 | }, // << refreshGraphPeriod() |
---|
2280 | |
---|
2281 | |
---|
2282 | |
---|
2283 | |
---|
2284 | |
---|
2285 | /** |
---|
2286 | * ----------------------------------------------------------------------- |
---|
2287 | * load the content of history table |
---|
2288 | * |
---|
2289 | * @param integer period: period the load; if not set, load the current period |
---|
2290 | * @param integer pageNumber: page to load |
---|
2291 | * ----------------------------------------------------------------------- |
---|
2292 | */ |
---|
2293 | refreshPageHistoryContent = function (period, pageNumber) |
---|
2294 | { |
---|
2295 | if(period==null) period=$('#iHistoryFilterPeriod').inputList('value'); |
---|
2296 | |
---|
2297 | if(pageNumber==null | pageNumber<=0) pageNumber=1; |
---|
2298 | |
---|
2299 | // load the table content |
---|
2300 | $('#iHistoryTable') |
---|
2301 | .dynamicTable('postData', |
---|
2302 | { |
---|
2303 | ajaxfct:'admin.stat.history', |
---|
2304 | token:properties.token, |
---|
2305 | period:period |
---|
2306 | } |
---|
2307 | ) |
---|
2308 | .dynamicTable('refreshContent', pageNumber); |
---|
2309 | }, // << refreshPageHistoryContent() |
---|
2310 | |
---|
2311 | /** |
---|
2312 | * ----------------------------------------------------------------------- |
---|
2313 | * load graph data for a period |
---|
2314 | * |
---|
2315 | * @param String priod: the period (YYYYMM) to load; if not set, load the current period |
---|
2316 | * ----------------------------------------------------------------------- |
---|
2317 | */ |
---|
2318 | refreshGraphHistoryMonth = function (period) |
---|
2319 | { |
---|
2320 | if(period==null) period=$('#iHistoryFilterPeriod').inputList('value'); |
---|
2321 | |
---|
2322 | $.ajax( |
---|
2323 | { |
---|
2324 | type: "POST", |
---|
2325 | url: properties.url, |
---|
2326 | data: |
---|
2327 | { |
---|
2328 | ajaxfct:'admin.stat.history.graphAllPeriods', |
---|
2329 | token:properties.token, |
---|
2330 | period:period, |
---|
2331 | nbMonth:12 |
---|
2332 | }, |
---|
2333 | async: true, |
---|
2334 | success: function(msg) |
---|
2335 | { |
---|
2336 | msg=$.parseJSON(msg); |
---|
2337 | properties.history.graphAllPeriods.axis.set( |
---|
2338 | { |
---|
2339 | XY:{ticks:{V:{steps:roundValue(msg.maxValue)}}} |
---|
2340 | } |
---|
2341 | ); |
---|
2342 | properties.history.graphAllPeriods.axis.set( |
---|
2343 | { |
---|
2344 | XY:{ticks:{V:{frequency:calculateTicks(properties.history.graphAllPeriods.axis)}}} |
---|
2345 | } |
---|
2346 | ); |
---|
2347 | properties.history.graphAllPeriods.axis.setValues({H:msg.axis}); |
---|
2348 | properties.history.graphAllPeriods.serieTotal.set( |
---|
2349 | { |
---|
2350 | values:msg.series.total.nbVisits, |
---|
2351 | name:msg.series.total.name |
---|
2352 | } |
---|
2353 | ); |
---|
2354 | properties.history.graphAllPeriods.serieComputer.set( |
---|
2355 | { |
---|
2356 | values:msg.series.computer.nbVisits, |
---|
2357 | name:msg.series.computer.name |
---|
2358 | } |
---|
2359 | ); |
---|
2360 | properties.history.graphAllPeriods.serieCrawler.set( |
---|
2361 | { |
---|
2362 | values:msg.series.crawler.nbVisits, |
---|
2363 | name:msg.series.crawler.name |
---|
2364 | } |
---|
2365 | ); |
---|
2366 | properties.history.graphAllPeriods.serieMobile.set( |
---|
2367 | { |
---|
2368 | values:msg.series.mobile.nbVisits, |
---|
2369 | name:msg.series.mobile.name |
---|
2370 | } |
---|
2371 | ); |
---|
2372 | properties.history.graphAllPeriods.serieOther.set( |
---|
2373 | { |
---|
2374 | values:msg.series.other.nbVisits, |
---|
2375 | name:msg.series.other.name |
---|
2376 | } |
---|
2377 | ); |
---|
2378 | $('#iHistoryGraphAll').drawingGraph('refresh'); |
---|
2379 | }, |
---|
2380 | error: function(msg) |
---|
2381 | { |
---|
2382 | } |
---|
2383 | } |
---|
2384 | ); |
---|
2385 | |
---|
2386 | $.ajax( |
---|
2387 | { |
---|
2388 | type: "POST", |
---|
2389 | url: properties.url, |
---|
2390 | data: |
---|
2391 | { |
---|
2392 | ajaxfct:'admin.stat.history.graphCurrentPeriod', |
---|
2393 | token:properties.token, |
---|
2394 | period:period |
---|
2395 | }, |
---|
2396 | async: true, |
---|
2397 | success: function(msg) |
---|
2398 | { |
---|
2399 | msg=$.parseJSON(msg); |
---|
2400 | properties.history.graphCurrentPeriod.axis.set( |
---|
2401 | { |
---|
2402 | XY:{ticks:{V:{steps:roundValue(msg.maxValue)}}} |
---|
2403 | } |
---|
2404 | ); |
---|
2405 | properties.history.graphCurrentPeriod.axis.set( |
---|
2406 | { |
---|
2407 | XY:{ticks:{V:{frequency:calculateTicks(properties.history.graphCurrentPeriod.axis)}}} |
---|
2408 | } |
---|
2409 | ); |
---|
2410 | properties.history.graphCurrentPeriod.axis.setValues({H:msg.axis}); |
---|
2411 | properties.history.graphCurrentPeriod.serieTotal.set( |
---|
2412 | { |
---|
2413 | values:msg.series.total.nbVisits, |
---|
2414 | name:msg.series.total.name |
---|
2415 | } |
---|
2416 | ); |
---|
2417 | properties.history.graphCurrentPeriod.serieComputer.set( |
---|
2418 | { |
---|
2419 | values:msg.series.computer.nbVisits, |
---|
2420 | name:msg.series.computer.name |
---|
2421 | } |
---|
2422 | ); |
---|
2423 | properties.history.graphCurrentPeriod.serieCrawler.set( |
---|
2424 | { |
---|
2425 | values:msg.series.crawler.nbVisits, |
---|
2426 | name:msg.series.crawler.name |
---|
2427 | } |
---|
2428 | ); |
---|
2429 | properties.history.graphCurrentPeriod.serieMobile.set( |
---|
2430 | { |
---|
2431 | values:msg.series.mobile.nbVisits, |
---|
2432 | name:msg.series.mobile.name |
---|
2433 | } |
---|
2434 | ); |
---|
2435 | properties.history.graphCurrentPeriod.serieOther.set( |
---|
2436 | { |
---|
2437 | values:msg.series.other.nbVisits, |
---|
2438 | name:msg.series.other.name |
---|
2439 | } |
---|
2440 | ); |
---|
2441 | $('#iHistoryGraphCurrent').drawingGraph('refresh'); |
---|
2442 | }, |
---|
2443 | error: function(msg) |
---|
2444 | { |
---|
2445 | } |
---|
2446 | } |
---|
2447 | ); |
---|
2448 | }, // << refreshGraphHistoryMonth() |
---|
2449 | |
---|
2450 | |
---|
2451 | |
---|
2452 | |
---|
2453 | /** |
---|
2454 | * ----------------------------------------------------------------------- |
---|
2455 | * load the content of IP table |
---|
2456 | * |
---|
2457 | * @param integer period: period the load; if not set, load the current period |
---|
2458 | * A : all periods |
---|
2459 | * Y-yyyy : year |
---|
2460 | * YM-yyyymm : year/month |
---|
2461 | * ----------------------------------------------------------------------- |
---|
2462 | */ |
---|
2463 | refreshPageIPContent = function (period) |
---|
2464 | { |
---|
2465 | if(period==null) |
---|
2466 | period=$('#iFilterPeriodId').inputTreeList('value'); |
---|
2467 | |
---|
2468 | // load the table content |
---|
2469 | $('#iIPTable') |
---|
2470 | .dynamicTable('postData', |
---|
2471 | { |
---|
2472 | ajaxfct:"admin.stat.ip", |
---|
2473 | token:properties.token, |
---|
2474 | period:period, |
---|
2475 | additionalFilter:{catId:$('#iFilterCatId').categorySelector('value')} |
---|
2476 | } |
---|
2477 | ) |
---|
2478 | .dynamicTable('refreshContent', 1); |
---|
2479 | }, // << refreshPagePeriodContent() |
---|
2480 | |
---|
2481 | |
---|
2482 | |
---|
2483 | /** |
---|
2484 | * ----------------------------------------------------------------------- |
---|
2485 | * load graph data for IP |
---|
2486 | * |
---|
2487 | * @param integer period: period the load; if not set, load the current period |
---|
2488 | * A : all periods |
---|
2489 | * Y-yyyy : year |
---|
2490 | * YM-yyyymm : year/month |
---|
2491 | * ----------------------------------------------------------------------- |
---|
2492 | */ |
---|
2493 | refreshGraphIP = function (period) |
---|
2494 | { |
---|
2495 | if(period==null) |
---|
2496 | period=$('#iFilterPeriodId').inputTreeList('value'); |
---|
2497 | |
---|
2498 | $.ajax( |
---|
2499 | { |
---|
2500 | type: "POST", |
---|
2501 | url: properties.url, |
---|
2502 | data: |
---|
2503 | { |
---|
2504 | ajaxfct:"admin.stat.ip.graphType", |
---|
2505 | token:properties.token, |
---|
2506 | period:period, |
---|
2507 | additionalFilter:{catId:$('#iFilterCatId').categorySelector('value')} |
---|
2508 | }, |
---|
2509 | async: true, |
---|
2510 | success: function(msg) |
---|
2511 | { |
---|
2512 | msg=$.parseJSON(msg); |
---|
2513 | |
---|
2514 | properties.ip.graphType.serie.set( |
---|
2515 | { |
---|
2516 | values:msg.values, |
---|
2517 | valuesLabels:msg.valuesLabels |
---|
2518 | } |
---|
2519 | ); |
---|
2520 | |
---|
2521 | $('#iIPGraphType').drawingGraph('refresh'); |
---|
2522 | }, |
---|
2523 | error: function(msg) |
---|
2524 | { |
---|
2525 | } |
---|
2526 | } |
---|
2527 | ); |
---|
2528 | |
---|
2529 | $.ajax( |
---|
2530 | { |
---|
2531 | type: "POST", |
---|
2532 | url: properties.url, |
---|
2533 | data: |
---|
2534 | { |
---|
2535 | ajaxfct:"admin.stat.ip.graphCountry", |
---|
2536 | token:properties.token, |
---|
2537 | period:period, |
---|
2538 | additionalFilter:{catId:$('#iFilterCatId').categorySelector('value')} |
---|
2539 | }, |
---|
2540 | async: true, |
---|
2541 | success: function(msg) |
---|
2542 | { |
---|
2543 | msg=$.parseJSON(msg); |
---|
2544 | |
---|
2545 | properties.ip.graphCountry.serie.set( |
---|
2546 | { |
---|
2547 | values:msg.values, |
---|
2548 | valuesLabels:msg.valuesLabels |
---|
2549 | } |
---|
2550 | ); |
---|
2551 | |
---|
2552 | $('#iIPGraphCountry').drawingGraph('refresh'); |
---|
2553 | }, |
---|
2554 | error: function(msg) |
---|
2555 | { |
---|
2556 | } |
---|
2557 | } |
---|
2558 | ); |
---|
2559 | |
---|
2560 | }, // << refreshGraphIP() |
---|
2561 | |
---|
2562 | |
---|
2563 | |
---|
2564 | |
---|
2565 | /** |
---|
2566 | * ----------------------------------------------------------------------- |
---|
2567 | * load the content of album/categories table |
---|
2568 | * |
---|
2569 | * @param integer period: period the load; if not set, load the current period |
---|
2570 | * ----------------------------------------------------------------------- |
---|
2571 | */ |
---|
2572 | refreshPageCategoryContent = function (period) |
---|
2573 | { |
---|
2574 | if(period==null) |
---|
2575 | period=$('#iFilterPeriodId').inputTreeList('value'); |
---|
2576 | |
---|
2577 | // load the table content |
---|
2578 | $('#iCategoryTable') |
---|
2579 | .dynamicTable('postData', |
---|
2580 | { |
---|
2581 | ajaxfct:"admin.stat.category", |
---|
2582 | token:properties.token, |
---|
2583 | period:period, |
---|
2584 | additionalFilter:{catId:$('#iFilterCatId').categorySelector('value')} |
---|
2585 | } |
---|
2586 | ) |
---|
2587 | .dynamicTable('refreshContent', 1); |
---|
2588 | }, // << refreshPageCategoryContent() |
---|
2589 | |
---|
2590 | |
---|
2591 | |
---|
2592 | |
---|
2593 | |
---|
2594 | /** |
---|
2595 | * ----------------------------------------------------------------------- |
---|
2596 | * load the content of images table |
---|
2597 | * |
---|
2598 | * @param integer period: period the load; if not set, load the current period |
---|
2599 | * ----------------------------------------------------------------------- |
---|
2600 | */ |
---|
2601 | refreshPageImageContent = function (period) |
---|
2602 | { |
---|
2603 | if(period==null) |
---|
2604 | period=$('#iFilterPeriodId').inputTreeList('value'); |
---|
2605 | |
---|
2606 | // load the table content |
---|
2607 | $('#iImageTable') |
---|
2608 | .dynamicTable('postData', |
---|
2609 | { |
---|
2610 | ajaxfct:"admin.stat.image", |
---|
2611 | token:properties.token, |
---|
2612 | period:period, |
---|
2613 | additionalFilter:{catId:$('#iFilterCatId').categorySelector('value')} |
---|
2614 | } |
---|
2615 | ) |
---|
2616 | .dynamicTable('refreshContent', 1); |
---|
2617 | }, // << refreshPageCategoryContent() |
---|
2618 | |
---|
2619 | |
---|
2620 | |
---|
2621 | |
---|
2622 | /** |
---|
2623 | * ------------------------------------------------------------------------- |
---|
2624 | * |
---|
2625 | * UTILITIES FUNCTIONS |
---|
2626 | * |
---|
2627 | * |
---|
2628 | * ------------------------------------------------------------------------- |
---|
2629 | */ |
---|
2630 | |
---|
2631 | /** |
---|
2632 | * ----------------------------------------------------------------------- |
---|
2633 | * generic function used to round a value to nearest number according to |
---|
2634 | * to 'size' of the value |
---|
2635 | * |
---|
2636 | * example: |
---|
2637 | * 157 => 160 |
---|
2638 | * 241 => 250 |
---|
2639 | * 1247 => 1250 |
---|
2640 | * 12478 => 12500 |
---|
2641 | * |
---|
2642 | * @param Integer value: the value to be rounded |
---|
2643 | * @return Integer: rounded value |
---|
2644 | * ----------------------------------------------------------------------- |
---|
2645 | */ |
---|
2646 | roundValue = function (value) |
---|
2647 | { |
---|
2648 | var divider=1; |
---|
2649 | |
---|
2650 | if(value<=1000) |
---|
2651 | { |
---|
2652 | divider=10; |
---|
2653 | } |
---|
2654 | else if(value<10000) |
---|
2655 | { |
---|
2656 | divider=100; |
---|
2657 | } |
---|
2658 | else |
---|
2659 | { |
---|
2660 | divider=1000; |
---|
2661 | } |
---|
2662 | return(Math.ceil(value/divider)*divider); |
---|
2663 | }, |
---|
2664 | |
---|
2665 | /** |
---|
2666 | * ----------------------------------------------------------------------- |
---|
2667 | * calculate ticks values according to the current axis properties |
---|
2668 | * (height in pixel and max value) |
---|
2669 | * |
---|
2670 | * @param CDAxis axis: axis |
---|
2671 | * @return object: {small:(Integer), big:(Integer)} |
---|
2672 | * ----------------------------------------------------------------------- |
---|
2673 | */ |
---|
2674 | calculateTicks = function (axis) |
---|
2675 | { |
---|
2676 | var divider=1, |
---|
2677 | maxValue=axis.get().properties.XY.ticks.V.steps, |
---|
2678 | returned={ |
---|
2679 | small:0, |
---|
2680 | big:0 |
---|
2681 | }; |
---|
2682 | |
---|
2683 | if(maxValue<=10) |
---|
2684 | { |
---|
2685 | divider=1; |
---|
2686 | } |
---|
2687 | else if(maxValue<=100) |
---|
2688 | { |
---|
2689 | divider=10; |
---|
2690 | } |
---|
2691 | else if(maxValue<=1000) |
---|
2692 | { |
---|
2693 | divider=100; |
---|
2694 | } |
---|
2695 | else if(maxValue<10000) |
---|
2696 | { |
---|
2697 | divider=1000; |
---|
2698 | } |
---|
2699 | else |
---|
2700 | { |
---|
2701 | divider=10000; |
---|
2702 | } |
---|
2703 | returned.small=Math.ceil(maxValue/divider)*divider/20; |
---|
2704 | returned.big=5*returned.small; |
---|
2705 | return(returned); |
---|
2706 | }, |
---|
2707 | |
---|
2708 | /** |
---|
2709 | * ----------------------------------------------------------------------- |
---|
2710 | * display the popup info box |
---|
2711 | * |
---|
2712 | * @param Boolean visible: display or hide the popup |
---|
2713 | * @param object geometry: {x:(Integer), y:(Integer), w:(Integer), h:(Integer)} object to set the position |
---|
2714 | * @param String content: content of the box |
---|
2715 | * ----------------------------------------------------------------------- |
---|
2716 | */ |
---|
2717 | displayPopupInfo = function (visible, geometry, content) |
---|
2718 | { |
---|
2719 | if(content==null) content=''; |
---|
2720 | if(geometry==null) geometry={x:-1, y:-1, w:0, h:0}; |
---|
2721 | if(visible==null) visible=false; |
---|
2722 | |
---|
2723 | $('#iPopupInfo') |
---|
2724 | .html(content) |
---|
2725 | .css( |
---|
2726 | { |
---|
2727 | 'left':geometry.x+'px', |
---|
2728 | 'top':geometry.y+'px', |
---|
2729 | 'width':geometry.w+'px', |
---|
2730 | 'height':geometry.h+'px', |
---|
2731 | 'display':visible?'block':'none' |
---|
2732 | } |
---|
2733 | ); |
---|
2734 | }, |
---|
2735 | |
---|
2736 | /** |
---|
2737 | * ----------------------------------------------------------------------- |
---|
2738 | * display the popup thumbnail image |
---|
2739 | * |
---|
2740 | * @param Boolean visible: display or hide the popup |
---|
2741 | * @param object geometry: {x:(Integer), y:(Integer)} object to set the position |
---|
2742 | * @param String url: url of the thumbnail |
---|
2743 | * ----------------------------------------------------------------------- |
---|
2744 | */ |
---|
2745 | displayPopupThumb = function (visible, geometry, url) |
---|
2746 | { |
---|
2747 | if(geometry==null) geometry={x:-1, y:-1}; |
---|
2748 | if(visible==null) visible=false; |
---|
2749 | if(url==null) |
---|
2750 | { |
---|
2751 | visible=false; |
---|
2752 | url=''; |
---|
2753 | } |
---|
2754 | if(visible) |
---|
2755 | { |
---|
2756 | $('#iPopupThumb') |
---|
2757 | .unbind('load') |
---|
2758 | .bind('load', {geometry:geometry}, function (e) |
---|
2759 | { |
---|
2760 | $(this).css( |
---|
2761 | { |
---|
2762 | 'left':(e.data.geometry.x-e.target.width/2)+'px', |
---|
2763 | 'top':(e.data.geometry.y-e.target.height-15)+'px', |
---|
2764 | 'display':'block' |
---|
2765 | } |
---|
2766 | ); |
---|
2767 | } |
---|
2768 | ) |
---|
2769 | .attr('src', url); |
---|
2770 | } |
---|
2771 | else |
---|
2772 | { |
---|
2773 | $('#iPopupThumb').unbind('load').css('display', 'none'); |
---|
2774 | } |
---|
2775 | }, |
---|
2776 | |
---|
2777 | /** |
---|
2778 | * ----------------------------------------------------------------------- |
---|
2779 | * return the html content for popup box on history graph |
---|
2780 | * ----------------------------------------------------------------------- |
---|
2781 | */ |
---|
2782 | getHistoryPopupContent = function () |
---|
2783 | { |
---|
2784 | return( |
---|
2785 | "<span class='nfoC'>"+translateString.events+"</span><br>"+ |
---|
2786 | "<span style='color:"+properties.graph.colors.normal[0]+"'>"+translateString.ua_Computer+"</span>"+ |
---|
2787 | "<span class='nfoR' id='iPI_computer'>-</span><br>"+ |
---|
2788 | "<span style='color:"+properties.graph.colors.normal[1]+"'>"+translateString.ua_Mobile+"</span>"+ |
---|
2789 | "<span class='nfoR' id='iPI_mobile'>-</span><br>"+ |
---|
2790 | "<span style='color:"+properties.graph.colors.normal[2]+"'>"+translateString.ua_Crawler+"</span>"+ |
---|
2791 | "<span class='nfoR' id='iPI_crawler'>-</span><br>"+ |
---|
2792 | "<span style='color:"+properties.graph.colors.normal[3]+"'>"+translateString.ua_Other+"</span>"+ |
---|
2793 | "<span class='nfoR' id='iPI_other'>-</span><br>"+ |
---|
2794 | "<span style='color:"+properties.graph.colors.gray[3]+"'>"+translateString.total+"</span>"+ |
---|
2795 | "<span class='nfoR' id='iPI_total'>-</span>" |
---|
2796 | ); |
---|
2797 | }, |
---|
2798 | |
---|
2799 | /** |
---|
2800 | * ----------------------------------------------------------------------- |
---|
2801 | * return the html content for popup box on period graph |
---|
2802 | * ----------------------------------------------------------------------- |
---|
2803 | */ |
---|
2804 | getPeriodPopupContent = function () |
---|
2805 | { |
---|
2806 | return( |
---|
2807 | "<span class='nfoC'>"+translateString.visits+"</span><br>"+ |
---|
2808 | "<span style='color:"+properties.graph.colors.gray[3]+"'>"+translateString.viewedPages+"</span>"+ |
---|
2809 | "<span class='nfoR' id='iPI_viewedPages'>-</span><br>"+ |
---|
2810 | "<span style='color:"+properties.graph.colors.normal[0]+"'>"+translateString.viewedAlbums+"</span>"+ |
---|
2811 | "<span class='nfoR' id='iPI_viewedAlbums'>-</span><br>"+ |
---|
2812 | "<span style='color:"+properties.graph.colors.normal[1]+"'>"+translateString.viewedImages+"</span>"+ |
---|
2813 | "<span class='nfoR' id='iPI_viewedImages'>-</span><br>"+ |
---|
2814 | "<span style='color:"+properties.graph.colors.normal[2]+"'>"+translateString.uniqueIP+"</span>"+ |
---|
2815 | "<span class='nfoR' id='iPI_uniqueIP'>-</span><br>" |
---|
2816 | ); |
---|
2817 | } |
---|
2818 | |
---|
2819 | |
---|
2820 | /** |
---|
2821 | * ----------------------------------------------------------------------- |
---|
2822 | * action done when user click on the period table |
---|
2823 | * |
---|
2824 | * this function is set has an event on $('#iPeriodTable') object |
---|
2825 | * ----------------------------------------------------------------------- |
---|
2826 | */ |
---|
2827 | clickOnPeriodTable = function (event) |
---|
2828 | { |
---|
2829 | var oId=$(this).attr('oId'), |
---|
2830 | data=$('#iPeriodTable').dynamicTable('loadedData', oId), |
---|
2831 | period=''; |
---|
2832 | |
---|
2833 | switch($('#iPeriodPath').inputPath('level')) |
---|
2834 | { |
---|
2835 | case 1: |
---|
2836 | // all years => years |
---|
2837 | $('#iPeriodPath').inputPath('push', {id:'y-'+data[5], label:data[0]} ); |
---|
2838 | break; |
---|
2839 | case 2: |
---|
2840 | // year => months |
---|
2841 | period=$('#iPeriodPath').inputPath('itemLevel', $('#iPeriodPath').inputPath('level')).id.substr(2); |
---|
2842 | $('#iPeriodPath').inputPath('push', {id:'ym-'+period+data[5], label:data[0]} ); |
---|
2843 | break; |
---|
2844 | case 3: |
---|
2845 | // month => days |
---|
2846 | break; |
---|
2847 | } |
---|
2848 | refreshGraphPeriod(); |
---|
2849 | refreshPagePeriodContent(); |
---|
2850 | }; |
---|
2851 | |
---|
2852 | /** |
---|
2853 | * ---------------------------------------------------------------------------- |
---|
2854 | * |
---|
2855 | * MAIN OBJECT FUNCTION |
---|
2856 | * |
---|
2857 | * |
---|
2858 | * ---------------------------------------------------------------------------- |
---|
2859 | */ |
---|
2860 | |
---|
2861 | |
---|
2862 | switch(fct) |
---|
2863 | { |
---|
2864 | case 'init': |
---|
2865 | setProperties(values); |
---|
2866 | init(); |
---|
2867 | break; |
---|
2868 | case 'changePage': |
---|
2869 | setProperties(null); |
---|
2870 | changePage(values); |
---|
2871 | break; |
---|
2872 | } |
---|
2873 | } |
---|