source: extensions/AMetaData/admin/amd_metadata_select.tpl @ 5226

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

Fix some bug, enhance some functionnalities, and make plugin ready to be translated

  • Property svn:executable set to *
File size: 7.8 KB
Line 
1{literal}
2<script type="text/javascript">
3
4  var globalTagId;
5
6  function init()
7  {
8    computedWidth=$("#content").get(0).clientWidth;
9    computedHeight=$("#content").get(0).clientHeight;
10    $("#dialogViewDetail")
11    .dialog(
12      {
13        autoOpen: false,
14        resizable: false,
15        width:computedWidth,
16        height:computedHeight,
17        modal: true,
18        draggable:false,
19        title: '{/literal}{"g003_metadata_detail"|@translate}{literal}',
20        overlay:
21        {
22          backgroundColor: '#000',
23          opacity: 0.5
24        },
25        open: function(event, ui)
26        {
27          bH=$("div.ui-dialog-buttonpane").get(0).clientHeight;
28          $("#dialogViewDetail").css('height', (this.clientHeight-bH)+"px");
29          $("#iListImages").css('height', (this.clientHeight-bH-$("#iListImagesNb").get(0).clientHeight-$("#iHeaderListImages").get(0).clientHeight)+"px");
30        },
31        buttons:
32        {
33          '{/literal}{"g003_ok"|@translate}{literal}':
34            function()
35            {
36              $(this).dialog('close');
37            }
38        }
39      }
40    );
41  }
42
43  function loadTagList()
44  {
45    $("body").css("cursor", "wait");
46    order=$('#iSelectOrderTagList').val();
47    filter=$("#iSelectFilterTagList").val();
48    unusedTag=($("#iExcludeUnusedTagList").get(0).checked)?"y":"n";
49    selectedOnly=($("#iSelectedTagOnly").get(0).checked)?"y":"n";
50
51    displayTagListOrder();
52
53    $("#iListTags").html(
54      $.ajax({
55        type: "POST",
56        url: "{/literal}{$datas.urlRequest}{literal}",
57        async: false,
58        data: { ajaxfct:"showStatsGetListTags", orderType:order, filterType:filter, excludeUnusedTag:unusedTag, selectedTagOnly:selectedOnly }
59       }).responseText
60    );
61    $("#iListTagsNb").html(
62      "{/literal}{'g003_number_of_filtered_metadata'|@translate}{literal} "+$("#iListTags table tr").length
63    );
64
65    //onclick="updateTagSelect('iNumId{$data.numId}', '')"
66    $("input.cbiListTags")
67      .bind('click',
68        function(event)
69        {
70          event.stopPropagation();
71          updateTagSelect($(this).get(0).id, '');
72        }
73      );
74
75    $("a.cbiListTags")
76      .bind('click',
77        function(event)
78        {
79          event.stopPropagation();
80          loadTagDetail($(this).get(0).id.substr(7));
81        }
82      );
83
84
85
86
87    $("body").css("cursor", "default");
88  }
89
90  function loadTagDetail(tag)
91  {
92    $("#dialogViewDetail").dialog('open');
93
94    globalTagId=tag;
95    order=$('#iSelectOrderImageList').val();
96    $("#iListImages").html("<br>{/literal}{'g003_loading'|@translate}{literal}");
97    $("#iHeaderListImagesTagName").html("["+tag+"]");
98
99    $.ajax(
100      {
101        type: "POST",
102        url: "{/literal}{$datas.urlRequest}{literal}",
103        async: true,
104        data: { ajaxfct:"showStatsGetListImages", orderType:order, tagId:tag,  },
105        success:
106          function(msg)
107          {
108            $("#iListImages").html(msg);
109            $("#iListImagesNb").html(
110              "{/literal}{'g003_number_of_distinct_values'|@translate}{literal} "+$("#iListImages table tr").length
111            );
112          }
113      }
114    );
115  }
116
117  function updateTagSelect(numId, mode)
118  {
119    $("body").css("cursor", "wait");
120
121    if(mode=='switch')
122    {
123      $("#"+numId).get(0).checked=!$("#"+numId).get(0).checked;
124    }
125
126    selected=($("#"+numId).get(0).checked)?"y":"n";
127
128    $("#iListImages").html(
129      $.ajax({
130        type: "POST",
131        url: "{/literal}{$datas.urlRequest}{literal}",
132        async: false,
133        data: { ajaxfct:"updateTagSelect", tagSelected:selected, numId:numId.substr(6) }
134       }).responseText
135    );
136    $("body").css("cursor", "default");
137  }
138
139  function sortTagList(by)
140  {
141    $("#iSelectOrderTagList").val(by);
142    displayTagListOrder();
143    loadTagList();
144  }
145
146  function sortTagDetail(by, tag)
147  {
148    $("#iSelectOrderImageList").val(by);
149    displayTagDetailOrder();
150    loadTagDetail(tag);
151  }
152
153  function displayTagListOrder()
154  {
155    if($("#iSelectOrderTagList").val()=="tag")
156    {
157      $("#iHLTOrderTag").html("&#8593;");
158      $("#iHLTOrderLabel").html("");
159      $("#iHLTOrderNum").html("");
160    }
161    else if($("#iSelectOrderTagList").val()=="num")
162    {
163      $("#iHLTOrderTag").html("");
164      $("#iHLTOrderLabel").html("");
165      $("#iHLTOrderNum").html("&#8593;");
166    }
167    else
168    {
169      // by label
170      $("#iHLTOrderTag").html("");
171      $("#iHLTOrderLabel").html("&#8593;");
172      $("#iHLTOrderNum").html("");
173    }
174  }
175
176  function displayTagDetailOrder()
177  {
178    if($("#iSelectOrderImageList").val()=="value")
179    {
180      $("#iHLIOrderValue").html("&#8593;");
181      $("#iHLIOrderNum").html("");
182    }
183    else
184    {
185      $("#iHLIOrderValue").html("");
186      $("#iHLIOrderNum").html("&#8593;");
187    }
188  }
189
190
191</script>
192{/literal}
193
194
195<h3>{'g003_select_metadata'|@translate}</h3>
196
197<form>
198  <input type="hidden" id="iSelectOrderTagList" value="{$datas.config_GetListTags_OrderType}"/>
199
200  <label>{'g003_filter'|@translate}
201    <select id="iSelectFilterTagList" onchange="loadTagList();">
202      <option value="" {if $datas.config_GetListTags_FilterType==""}selected{/if}>{'g003_no_filter'|@translate}</option>
203      <option value="magic" {if $datas.config_GetListTags_FilterType=="magic"}selected{/if}>{'g003_magic_filter'|@translate}</option>
204      <option value="exif" {if $datas.config_GetListTags_FilterType=="exif"}selected{/if}>Exif</option>
205      <option value="exif.Canon" {if $datas.config_GetListTags_FilterType=="exif.Canon"}selected{/if}>Exif [Canon]</option>
206      <option value="exif.Nikon" {if $datas.config_GetListTags_FilterType=="exif.Nikon"}selected{/if}>Exif [Nikon]</option>
207      <option value="exif.Pentax" {if $datas.config_GetListTags_FilterType=="exif.Pentax"}selected{/if}>Exif [Pentax]</option>
208      <option value="xmp" {if $datas.config_GetListTags_FilterType=="xmp"}selected{/if}>Xmp</option>
209      <option value="iptc" {if $datas.config_GetListTags_FilterType=="iptc"}selected{/if}>Iptc</option>
210    </select>
211  </label>
212
213  <label>
214    <input type="checkbox" id="iExcludeUnusedTagList" onchange="loadTagList();"  {if $datas.config_GetListTags_ExcludeUnusedTag=="y"}checked{/if}>&nbsp;{'g003_exclude_unused_tags'|@translate}
215  </label>
216
217  <label>
218    <input type="checkbox" id="iSelectedTagOnly" onchange="loadTagList();" {if $datas.config_GetListTags_SelectedTagOnly=="y"}checked{/if}>&nbsp;{'g003_selected_tags_only'|@translate}
219  </label>
220
221</form>
222
223<table id='iHeaderListTags' class="littlefont">
224  <tr>
225    <th style="width:35%;min-width:340px;"><span id="iHLTOrderTag"></span><a onclick="sortTagList('tag');">{'g003_TagId'|@translate}</a></th>
226    <th><span id="iHLTOrderLabel"></span><a onclick="sortTagList('label');">{'g003_TagLabel'|@translate}</a></th>
227    <th width="80px"><span id="iHLTOrderNum"></span><a onclick="sortTagList('num');">{'g003_NumOfImage'|@translate}</a></th>
228    <th width="40px">{'g003_Pct'|@translate}</th>
229    <th width="110px">&nbsp;</th>
230  </tr>
231</table>
232<div id='iListTags'>
233</div>
234<div id="iListTagsNb"></div>
235
236
237<div id="dialogViewDetail">
238  <form>
239    <input type="hidden" id="iSelectOrderImageList" value="{$datas.config_GetListImages_OrderType}"/>
240  </form>
241
242  <table id='iHeaderListImages' class="littlefont">
243    <tr>
244      <th><span id="iHLIOrderValue"></span><a onclick="sortTagDetail('value', globalTagId);">{'g003_Value'|@translate}</a>&nbsp;<span id="iHeaderListImagesTagName"></span></th>
245      <th width="80px"><span id="iHLIOrderNum"></span><a onclick="sortTagDetail('num', globalTagId);">{'g003_NumOfImage'|@translate}</a></th>
246      <th width="40px">{'g003_Pct'|@translate}</th>
247      <th width="110px">&nbsp;</th>
248    </tr>
249  </table>
250
251  <div id='iListImages'>
252    <div style="width:100%;text-align:center;padding-top:20px;">{'g003_no_items_selected'|@translate}</div>
253  </div>
254  <div id="iListImagesNb"></div>
255</div>
256
257
258<script type="text/javascript">
259  init();
260  loadTagList();
261  displayTagDetailOrder();
262</script>
Note: See TracBrowser for help on using the repository browser.