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

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

feature:1777

  • Weight of the metadata database can becomes very heavy
  • Property svn:executable set to *
File size: 8.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:true,
19        dialogClass: 'gcBgTabSheet gcBorder',
20        title: '{/literal}{"g003_metadata_detail"|@translate}{literal}',
21        open: function(event, ui)
22        {
23          bH=$("div.ui-dialog-buttonpane").get(0).clientHeight;
24          $("#dialogViewDetail").css('height', (this.clientHeight-bH)+"px");
25          $("#iListImages").css('height', (this.clientHeight-bH-$("#iListImagesNb").get(0).clientHeight-$("#iHeaderListImages").get(0).clientHeight)+"px");
26        },
27        buttons:
28        {
29          '{/literal}{"g003_ok"|@translate}{literal}':
30            function()
31            {
32              $(this).dialog('close');
33            }
34        }
35      }
36    );
37  }
38
39  function loadTagList()
40  {
41    order=$('#iSelectOrderTagList').val();
42    filter=$("#iSelectFilterTagList").val();
43    unusedTag=($("#iExcludeUnusedTagList").get(0).checked)?"y":"n";
44    selectedOnly=($("#iSelectedTagOnly").get(0).checked)?"y":"n";
45
46    displayTagListOrder();
47
48    $("#iListTags").html("<br>{/literal}{'g003_loading'|@translate}{literal}<br><img src='./plugins/GrumPluginClasses/icons/processing.gif'>");
49
50    $.ajax(
51      {
52        type: "POST",
53        url: "{/literal}{$datas.urlRequest}{literal}",
54        async: true,
55        data: { ajaxfct:"admin.showStats.getListTags", orderType:order, filterType:filter, excludeUnusedTag:unusedTag, selectedTagOnly:selectedOnly },
56        success:
57          function(msg)
58          {
59            $("#iListTags").html(msg);
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  }
88
89  function loadTagDetail(tag)
90  {
91    $("#dialogViewDetail").dialog('open');
92
93    globalTagId=tag;
94    order=$('#iSelectOrderImageList').val();
95    $("#iListImages").html("<br>{/literal}{'g003_loading'|@translate}{literal}<br><img src='./plugins/GrumPluginClasses/icons/processing.gif'>");
96    $("#iHeaderListImagesTagName").html("["+tag+"]");
97
98    $.ajax(
99      {
100        type: "POST",
101        url: "{/literal}{$datas.urlRequest}{literal}",
102        async: true,
103        data: { ajaxfct:"admin.showStats.getListImages", orderType:order, tagId:tag,  },
104        success:
105          function(msg)
106          {
107            $("#iListImages").html(msg);
108            $("#iListImagesNb").html(
109              "{/literal}{'g003_number_of_distinct_values'|@translate}{literal} "+$("#iListImages table tr").length
110            );
111          }
112      }
113    );
114  }
115
116  function updateTagSelect(numId, mode)
117  {
118
119    if(mode=='switch')
120    {
121      $("#"+numId).get(0).checked=!$("#"+numId).get(0).checked;
122    }
123
124    selected=($("#"+numId).get(0).checked)?"y":"n";
125
126    $("#iListImages").html(
127      $.ajax({
128        type: "POST",
129        url: "{/literal}{$datas.urlRequest}{literal}",
130        async: false,
131        data: { ajaxfct:"admin.updateTag.select", tagSelected:selected, numId:numId.substr(6) }
132       }).responseText
133    );
134
135  }
136
137  function sortTagList(by)
138  {
139    $("#iSelectOrderTagList").val(by);
140    displayTagListOrder();
141    loadTagList();
142  }
143
144  function sortTagDetail(by, tag)
145  {
146    $("#iSelectOrderImageList").val(by);
147    displayTagDetailOrder();
148    loadTagDetail(tag);
149  }
150
151  function displayTagListOrder()
152  {
153    if($("#iSelectOrderTagList").val()=="tag")
154    {
155      $("#iHLTOrderTag").html("&#8593;");
156      $("#iHLTOrderLabel").html("");
157      $("#iHLTOrderNum").html("");
158    }
159    else if($("#iSelectOrderTagList").val()=="num")
160    {
161      $("#iHLTOrderTag").html("");
162      $("#iHLTOrderLabel").html("");
163      $("#iHLTOrderNum").html("&#8593;");
164    }
165    else
166    {
167      // by label
168      /* not fully implemented
169      $("#iHLTOrderTag").html("");
170      $("#iHLTOrderLabel").html("&#8593;");
171      $("#iHLTOrderNum").html("");
172      */
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<h2>{'g003_select_metadata'|@translate}</h2>
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      {if !in_array('magic', $amdConfig.amd_FillDataBaseExcludeFilters)}
204      <option value="magic" {if $datas.config_GetListTags_FilterType=="magic"}selected{/if}>{'g003_magic_filter'|@translate}</option>
205      {/if}
206      <option value="userDefined" {if $datas.config_GetListTags_FilterType=="userDefined"}selected{/if}>{'g003_userDefined_filter'|@translate}</option>
207
208      {if !in_array('exif', $amdConfig.amd_FillDataBaseExcludeFilters)}
209      <option value="exif" {if $datas.config_GetListTags_FilterType=="exif"}selected{/if}>Exif</option>
210      {/if}
211      {if !in_array('exif.maker', $amdConfig.amd_FillDataBaseExcludeFilters)}
212      <option value="exif.maker.Canon" {if $datas.config_GetListTags_FilterType=="exif.maker.Canon"}selected{/if}>Exif [Canon]</option>
213      <option value="exif.maker.Nikon" {if $datas.config_GetListTags_FilterType=="exif.maker.Nikon"}selected{/if}>Exif [Nikon]</option>
214      <option value="exif.maker.Pentax" {if $datas.config_GetListTags_FilterType=="exif.maker.Pentax"}selected{/if}>Exif [Pentax]</option>
215      {/if}
216      {if !in_array('xmp', $amdConfig.amd_FillDataBaseExcludeFilters)}
217      <option value="xmp" {if $datas.config_GetListTags_FilterType=="xmp"}selected{/if}>Xmp</option>
218      {/if}
219      {if !in_array('iptc', $amdConfig.amd_FillDataBaseExcludeFilters)}
220      <option value="iptc" {if $datas.config_GetListTags_FilterType=="iptc"}selected{/if}>Iptc</option>
221      {/if}
222    </select>
223  </label>
224
225  <label>
226    <input type="checkbox" id="iExcludeUnusedTagList" onchange="loadTagList();"  {if $datas.config_GetListTags_ExcludeUnusedTag=="y"}checked{/if}>&nbsp;{'g003_exclude_unused_tags'|@translate}
227  </label>
228
229  <label>
230    <input type="checkbox" id="iSelectedTagOnly" onchange="loadTagList();" {if $datas.config_GetListTags_SelectedTagOnly=="y"}checked{/if}>&nbsp;{'g003_selected_tags_only'|@translate}
231  </label>
232
233</form>
234
235<table id='iHeaderListTags' class="littlefont">
236  <tr>
237    <th style="width:35%;min-width:340px;"><span id="iHLTOrderTag"></span><a onclick="sortTagList('tag');">{'g003_TagId'|@translate}</a></th>
238    {* <th><span id="iHLTOrderLabel"></span><a onclick="sortTagList('label');">{'g003_TagLabel'|@translate}</a></th> *}
239    <th>{'g003_TagLabel'|@translate}</th>
240    <th width="80px"><span id="iHLTOrderNum"></span><a onclick="sortTagList('num');">{'g003_NumOfImage'|@translate}</a></th>
241    <th width="40px">{'g003_Pct'|@translate}</th>
242    <th width="110px">&nbsp;</th>
243  </tr>
244</table>
245<div id='iListTags' class="{$themeconf.name}">
246</div>
247<div id="iListTagsNb"></div>
248
249
250<div id="dialogViewDetail">
251  <form>
252    <input type="hidden" id="iSelectOrderImageList" value="{$datas.config_GetListImages_OrderType}"/>
253  </form>
254
255  <table id='iHeaderListImages' class="littlefont">
256    <tr>
257      <th><span id="iHLIOrderValue"></span><a onclick="sortTagDetail('value', globalTagId);">{'g003_Value'|@translate}</a>&nbsp;<span id="iHeaderListImagesTagName"></span></th>
258      <th width="80px"><span id="iHLIOrderNum"></span><a onclick="sortTagDetail('num', globalTagId);">{'g003_NumOfImage'|@translate}</a></th>
259      <th width="40px">{'g003_Pct'|@translate}</th>
260      <th width="110px">&nbsp;</th>
261    </tr>
262  </table>
263
264  <div id='iListImages' class="{$themeconf.name}">
265    <div style="width:100%;text-align:center;padding-top:20px;">{'g003_no_items_selected'|@translate}</div>
266  </div>
267  <div id="iListImagesNb"></div>
268</div>
269
270
271<script type="text/javascript">
272  init();
273  loadTagList();
274  displayTagDetailOrder();
275</script>
Note: See TracBrowser for help on using the repository browser.