1 | {literal} |
---|
2 | <script type="text/javascript"> |
---|
3 | |
---|
4 | function getStatus() |
---|
5 | { |
---|
6 | $.get("{/literal}{$datas.urlRequest}{literal}", { ajaxfct:"makeStatsGetStatus" }, |
---|
7 | function (data) |
---|
8 | { |
---|
9 | list=data.split(";"); |
---|
10 | $("#ianalyzestatus").html("<ul><li>"+list[0]+"</li><li>"+list[1]+"</li><li>"+list[2]+"</li></ul>"); |
---|
11 | } |
---|
12 | ); |
---|
13 | } |
---|
14 | |
---|
15 | function doAnalyze() |
---|
16 | { |
---|
17 | $("body").css("cursor", "wait"); |
---|
18 | |
---|
19 | mode="all"; |
---|
20 | modeLabel="{/literal}{'g003_analyze_all_pictures'|@translate}{literal}"; |
---|
21 | if($("#ianalyze_action0").get(0).checked) |
---|
22 | { |
---|
23 | mode="notAnalyzed"; |
---|
24 | modeLabel="{/literal}{'g003_analyze_not_analyzed_pictures'|@translate}{literal}"; |
---|
25 | } |
---|
26 | |
---|
27 | doAnalyze="<fieldset><legend>{/literal}{'g003_updating_metadata'|@translate}{literal} ("+modeLabel+")</legend>"+ |
---|
28 | "<form class='formtable'>"+ |
---|
29 | "<div id='iprogressbar_contener'>"+ |
---|
30 | "<span id='iprogressbar_bg' style='width:0%;'> </span>"+ |
---|
31 | "<span id='iprogressbar_fg'>0%</span>"+ |
---|
32 | "</div><div id='iprogress'>{/literal}{'g003_analyze_in_progress'|@translate}{literal}</div></form></fieldset>"; |
---|
33 | |
---|
34 | $("#ianalyzearea").html(doAnalyze); |
---|
35 | |
---|
36 | $.get("{/literal}{$datas.urlRequest}{literal}", { ajaxfct:"makeStatsGetList", selectMode:mode }, doStep_getList); |
---|
37 | } |
---|
38 | |
---|
39 | |
---|
40 | function displayTime(eTime) |
---|
41 | { |
---|
42 | seconds=(eTime%60).toFixed(2); |
---|
43 | minutes=((eTime-seconds)/60).toFixed(0); |
---|
44 | returned=seconds+"s"; |
---|
45 | if(minutes>0) returned=minutes+"m"+returned; |
---|
46 | return(returned); |
---|
47 | } |
---|
48 | |
---|
49 | function doStep_getList(data) |
---|
50 | { |
---|
51 | timeStart = new Date(); |
---|
52 | list=data.split(";"); |
---|
53 | for(i=0;i<list.length-1;i++) |
---|
54 | { |
---|
55 | tmp = $.ajax({ |
---|
56 | type: "POST", |
---|
57 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
58 | async: false, |
---|
59 | data: { ajaxfct:"makeStatsDoAnalyze", imagesList:list[i] } |
---|
60 | }).responseText; |
---|
61 | |
---|
62 | pct=100*(i+1)/(list.length+2); |
---|
63 | $("#iprogressbar_bg").css("width", pct+"%"); |
---|
64 | $("#iprogressbar_fg").html(Math.round(pct)+"%"); |
---|
65 | } |
---|
66 | |
---|
67 | for(j=0;j<3;j++) |
---|
68 | { |
---|
69 | tmp = $.ajax({ |
---|
70 | type: "POST", |
---|
71 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
72 | async: false, |
---|
73 | data: { ajaxfct:"makeStatsConsolidate", step:j } |
---|
74 | }).responseText; |
---|
75 | |
---|
76 | pct=100*(i+j+1)/(list.length+2); |
---|
77 | $("#iprogressbar_bg").css("width", pct+"%"); |
---|
78 | $("#iprogressbar_fg").html(Math.round(pct)+"%"); |
---|
79 | } |
---|
80 | |
---|
81 | timeEnd = new Date(); |
---|
82 | timeElapsed=timeEnd.getTime()-timeStart.getTime(); |
---|
83 | $("#iprogress").html("{/literal}{'g003_analyze_is_finished'|@translate}{literal} ("+displayTime(timeElapsed/1000)+")"); |
---|
84 | getStatus(); |
---|
85 | $("body").css("cursor", "default"); |
---|
86 | } |
---|
87 | |
---|
88 | |
---|
89 | </script> |
---|
90 | {/literal} |
---|
91 | |
---|
92 | |
---|
93 | <h3>{'g003_status_of_database'|@translate}</h3> |
---|
94 | |
---|
95 | <div id="ianalyzestatus"> |
---|
96 | <ul> |
---|
97 | <li>{'g003_loading'|@translate}</li> |
---|
98 | <li>{'g003_loading'|@translate}</li> |
---|
99 | <li>{'g003_loading'|@translate}</li> |
---|
100 | </ul> |
---|
101 | </div> |
---|
102 | |
---|
103 | <div id='ianalyzearea'> |
---|
104 | <fieldset> |
---|
105 | <legend>{'g003_update_metadata'|@translate}</legend> |
---|
106 | <form class="formtable"> |
---|
107 | <label> |
---|
108 | <input type="radio" value="notAnalayzed" name="fAMD_analyze_action" id="ianalyze_action0" checked> |
---|
109 | {'g003_analyze_not_analyzed_pictures'|@translate} |
---|
110 | </label><br> |
---|
111 | <label> |
---|
112 | <input type="radio" value="all" name="fAMD_analyze_action" id="ianalyze_action1"> |
---|
113 | {'g003_analyze_all_pictures'|@translate} |
---|
114 | </label><br> |
---|
115 | <div class="warning"> |
---|
116 | <p style="font-weight:bold; font-size:+1;">{'g003_warning_on_analyze_0'|@translate}</p> |
---|
117 | <p>{'g003_warning_on_analyze_1'|@translate}</p> |
---|
118 | <ul> |
---|
119 | <li>{'g003_warning_on_analyze_2'|@translate}</li> |
---|
120 | <li>{'g003_warning_on_analyze_3'|@translate}</li> |
---|
121 | </ul> |
---|
122 | <p style="font-weight:bold;">{'g003_warning_on_analyze_4'|@translate}</p> |
---|
123 | <p>{'g003_warning_on_analyze_5'|@translate}</p> |
---|
124 | </div> |
---|
125 | <input type="button" value="{'g003_analyze'|@translate}" onclick="doAnalyze();"> |
---|
126 | </form> |
---|
127 | </fieldset> |
---|
128 | </div> |
---|
129 | |
---|
130 | <script type="text/javascript"> |
---|
131 | getStatus(); |
---|
132 | </script> |
---|