source: extensions/AMetaData/admin/amd_database.tpl @ 4916

Last change on this file since 4916 was 4905, checked in by grum, 14 years ago

Commit a first release of the plugin for piwigo using the JpegMetaData classe

  • Property svn:executable set to *
File size: 6.7 KB
Line 
1{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"}
2{known_script id="jquery.ui.slider" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.slider.packed.js"}
3{known_script id="jquery.ui.dialog" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.dialog.packed.js"}
4
5{literal}
6<style>
7 .ui-slider {
8    width:350px;
9    height:10px;
10    border:1px solid;
11    margin-left:10px;
12  }
13 .ui-slider-handle {
14    width:12px;
15    height:12px;
16    position:relative;
17    top:-2px;
18    border:1px solid;
19    background:#cccccc;
20  }
21</style>
22
23<script type="text/javascript">
24
25  function init()
26  {
27    formatNbItemPerRequest({/literal}{$datas.NumberOfItemsPerRequest}{literal});
28    $("#iamd_nb_item_per_request_slider").slider(
29      {
30        min:5,
31        max:150,
32        steps:29,
33        startValue:{/literal}{$datas.NumberOfItemsPerRequest}{literal},
34        slide: function(event, ui) { formatNbItemPerRequest(ui.value); }
35      }
36    );
37    getStatus();
38  }
39
40  function formatNbItemPerRequest(nbItems)
41  {
42    $("#iamd_NumberOfItemsPerRequest").val(nbItems);
43    $("#iamd_nb_item_per_request_display").html(nbItems);
44  }
45
46  function getStatus()
47  {
48    data=$.ajax(
49      {
50        type: "POST",
51        url: "{/literal}{$datas.urlRequest}{literal}",
52        async: false,
53        data: { ajaxfct:"makeStatsGetStatus" }
54      }
55    ).responseText;
56
57    list=data.split(";");
58    $("#ianalyzestatus").html("<ul><li>"+list[0]+"</li><li>"+list[1]+"</li><li>"+list[2]+"</li></ul>");
59  }
60
61  function doAnalyze()
62  {
63    $("body").css("cursor", "wait");
64
65    mode="all";
66    modeLabel="{/literal}{'g003_analyze_all_pictures'|@translate}{literal}";
67    if($("#ianalyze_action0").get(0).checked)
68    {
69      mode="notAnalyzed";
70      modeLabel="{/literal}{'g003_analyze_not_analyzed_pictures'|@translate}{literal}";
71    }
72
73    doAnalyze="<br><form id='iDialogProgress' class='formtable'>"+
74      "<div id='iprogressbar_contener'>"+
75      "<span id='iprogressbar_bg' style='width:0%;'>&nbsp;</span>"+
76      "<span id='iprogressbar_fg'>0%</span>"+
77      "</div>{/literal}{'g003_analyze_in_progress'|@translate}{literal}</form>";
78
79    $("#dialog")
80    .html("")
81    .dialog(
82      {
83        resizable: false,
84        width:480,
85        height:120,
86        modal: true,
87        draggable:false,
88        title: '{/literal}{"g003_updating_metadata"|@translate}{literal}&nbsp;('+modeLabel+')',
89        overlay:
90        {
91          backgroundColor: '#000',
92          opacity: 0.5,
93        }
94      }
95    ).html(doAnalyze);
96
97    NumberOfItemsPerRequest=$("#iamd_NumberOfItemsPerRequest").val();
98
99    $.ajax(
100      {
101        type: "POST",
102        url: "{/literal}{$datas.urlRequest}{literal}",
103        async: false,
104        data: { ajaxfct:"makeStatsGetList", selectMode:mode, numOfItems:NumberOfItemsPerRequest },
105        success: function(msg)
106          {
107            doStep_getList(msg);
108          },
109        error: function()
110          {
111            alert('error');
112          }
113      }
114    );
115  }
116
117
118  function displayTime(eTime)
119  {
120    seconds=(eTime%60).toFixed(2);
121    minutes=((eTime-seconds)/60).toFixed(0);
122    returned=seconds+"s";
123    if(minutes>0) returned=minutes+"m"+returned;
124    return(returned);
125  }
126
127  function doStep_getList(data)
128  {
129    timeStart = new Date();
130    list=data.split(";");
131    for(i=0;i<list.length-1;i++)
132    {
133      tmp = $.ajax({
134        type: "POST",
135        url: "{/literal}{$datas.urlRequest}{literal}",
136        async: false,
137        data: { ajaxfct:"makeStatsDoAnalyze", imagesList:list[i] }
138       }).responseText;
139
140      pct=100*(i+1)/(list.length+2);
141      $("#iprogressbar_bg").css("width", pct+"%");
142      $("#iprogressbar_fg").html(Math.round(pct)+"%");
143    }
144
145    for(j=0;j<3;j++)
146    {
147      tmp = $.ajax({
148        type: "POST",
149        url: "{/literal}{$datas.urlRequest}{literal}",
150        async: false,
151        data: { ajaxfct:"makeStatsConsolidate", step:j }
152       }).responseText;
153
154      pct=100*(i+j+1)/(list.length+2);
155      $("#iprogressbar_bg").css("width", pct+"%");
156      $("#iprogressbar_fg").html(Math.round(pct)+"%");
157    }
158
159    timeEnd = new Date();
160    timeElapsed=timeEnd.getTime()-timeStart.getTime();
161
162
163    $("#dialog")
164    .dialog("destroy")
165    .html("")
166    .get(0).removeAttribute('style');
167
168    $("#dialog")
169    .dialog(
170      {
171        resizable: false,
172        width:480,
173        height:120,
174        modal: true,
175        draggable:false,
176        title: '{/literal}{"g003_updating_metadata"|@translate}{literal}',
177        overlay:
178        {
179          backgroundColor: '#000',
180          opacity: 0.5
181        },
182        open: function(event, ui)
183        {
184          bH=$("div.ui-dialog-buttonpane").get(0).clientHeight;
185          $("#dialog").css('height', (this.clientHeight-bH)+"px");
186        },
187        buttons:
188        {
189          '{/literal}{"g003_ok"|@translate}{literal}':
190            function()
191            {
192              $(this).dialog('destroy').html("").get(0).removeAttribute('style');
193            }
194        }
195      }
196    ).html("<br>{/literal}{'g003_analyze_is_finished'|@translate}{literal}&nbsp;("+displayTime(timeElapsed/1000)+")");
197
198    getStatus();
199    $("body").css("cursor", "default");
200  }
201
202
203
204</script>
205{/literal}
206
207<h3>{'g003_status_of_database'|@translate}</h3>
208
209<div id="dialog"></div>
210
211<div id="ianalyzestatus">
212  <ul>
213    <li>{'g003_loading'|@translate}</li>
214    <li>{'g003_loading'|@translate}</li>
215    <li>{'g003_loading'|@translate}</li>
216  </ul>
217</div>
218
219<div id='ianalyzearea'>
220  <fieldset>
221    <legend>{'g003_update_metadata'|@translate}</legend>
222      <form class="formtable">
223        <div class="warning">
224          <p style="font-weight:bold; font-size:+1;">{'g003_warning_on_analyze_0'|@translate}</p>
225          <p>{'g003_warning_on_analyze_1'|@translate}</p>
226          <p  style="font-weight:bold;">{'g003_warning_on_analyze_2'|@translate}</p>
227          <p>{'g003_warning_on_analyze_3'|@translate}</p>
228        </div>
229
230        <label>
231          <input type="radio" value="notAnalayzed" name="fAMD_analyze_action" id="ianalyze_action0" checked>&nbsp;
232          {'g003_analyze_not_analyzed_pictures'|@translate}
233        </label><br>
234
235        <label>
236          <input type="radio" value="all" name="fAMD_analyze_action" id="ianalyze_action1">&nbsp;
237          {'g003_analyze_all_pictures'|@translate}
238        </label><br>
239
240        <br>
241        {'g003_setting_nb_items_per_request'|@translate}&nbsp;
242        <input type="hidden" id="iamd_NumberOfItemsPerRequest" value="{$datas.NumberOfItemsPerRequest}">
243        <div id="iamd_nb_item_per_request_slider"></div>
244        <div id="iamd_nb_item_per_request_display"></div>
245        <br><br>
246
247        <input type="button" value="{'g003_analyze'|@translate}" onclick="doAnalyze();">
248
249      </form>
250  </fieldset>
251</div>
252
253
254
255
256<script type="text/javascript">
257  init();
258</script>
Note: See TracBrowser for help on using the repository browser.