source: extensions/AMetaData/admin/amd_metadata_display.tpl @ 5935

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

Update plugin for Piwigo 2.1

  • Property svn:executable set to *
File size: 9.3 KB
Line 
1
2
3{literal}
4<style>
5 .ui-widget-overlay {
6    background:#000000;
7    opacity:0.88;
8    filter:alpha(opacity:88);
9 }
10</style>
11
12<script type="text/javascript">
13
14  function init()
15  {
16    $("#iGroups")
17    .html(
18      $.ajax(
19        {
20          type: "POST",
21          url: "{/literal}{$datas.urlRequest}{literal}",
22          async: false,
23          data: { ajaxfct:"groupGetList" }
24        }
25      ).responseText
26    )
27    .sortable(
28      {
29        connectWith: '.connectedSortable',
30        cursor: 'move',
31        opacity:0.6,
32        items: 'li.groupItems',
33        axis:'y',
34        tolerance:'intersect',
35        start: function (event, ui)
36          {
37            manageGroup(event.originalTarget.id.substr(8), 'n');
38          },
39        update: function (event, ui)
40          {
41            list="";
42            $("#iGroups li").each(
43                function ()
44                {
45                  if(list!="") list+=";";
46                  list+=this.id.substr(8);
47                }
48              );
49            list=list.substr(0, list.lastIndexOf(';'));
50            $.ajax(
51              {
52                type: "POST",
53                url: "{/literal}{$datas.urlRequest}{literal}",
54                async: false,
55                data: { ajaxfct:"groupSetOrder", listGroup:list }
56              }
57            ).responseText;
58          }
59      }
60    );
61
62    if($("#iGroups li").length == 1)
63    {
64      manageGroup('1', 'y');
65    }
66  }
67
68  function initSubList(groupId)
69  {
70    $("#iGroupId"+groupId+"_tags").sortable(
71      {
72        connectWith: '.g'+groupId+'_connectedSortableTags',
73        cursor: 'move',
74        opacity:0.6,
75        items: 'li',
76        axis:'y',
77        tolerance:'pointer',
78        containment: 'parent',
79        update: function (event, ui)
80          {
81            list="";
82            $("#iGroupId"+groupId+"_tags li").each(
83                function ()
84                {
85                  if(list!="") list+=";";
86                  list+=this.id.substr(this.id.indexOf('t')+1);
87                }
88              );
89            list=list.substr(0, list.lastIndexOf(';'));
90            $.ajax(
91              {
92                type: "POST",
93                url: "{/literal}{$datas.urlRequest}{literal}",
94                async: false,
95                data: { ajaxfct:"groupSetOrderedTagList", id:groupId, listTag:list }
96              }
97            ).responseText;
98          }
99
100      }
101    );
102  }
103
104  function loadGroupTags(groupId)
105  {
106    $("#iGroupId"+groupId+"_tags").html(
107      $.ajax(
108        {
109          type: "POST",
110          url: "{/literal}{$datas.urlRequest}{literal}",
111          async: false,
112          data: { ajaxfct:"groupGetOrderedTagList", id:groupId }
113        }
114      ).responseText
115    );
116  }
117
118  function manageGroup(groupId, force)
119  {
120    if(force=='y')
121    {
122      currentVisibility='hidden';
123    }
124    else if(force=='n')
125    {
126      currentVisibility='visible';
127    }
128    else
129    {
130      currentVisibility=$("#iGroupId"+groupId+"_content").css('visibility');
131    }
132
133
134    if(currentVisibility=='visible')
135    {
136      $("div[name=fGroupId"+groupId+"_content]").css(
137       {
138         visibility:"hidden",
139         height:"0px"
140       }
141      );
142    }
143    else
144    {
145      $("div[name=fGroupId"+groupId+"_content]").css(
146       {
147         visibility:"visible",
148         height:"auto"
149       }
150      );
151      loadGroupTags(groupId);
152    }
153  }
154
155  function deleteGroup(groupId)
156  {
157    if(groupId!="")
158    {
159      groupName=$("#iGroupName"+groupId).val();
160      $("#dialog")
161      .html("")
162      .dialog(
163        {
164          resizable: true,
165          width:480,
166          height:120,
167          modal: true,
168          draggable:true,
169          dialogClass: 'gcBgTabSheet gcBorder',
170          title: "{/literal}{'g003_deleting_a_group'|@translate}{literal}",
171          buttons:
172          {
173            '{/literal}{"g003_yes"|@translate}{literal}':
174              function()
175              {
176                $.ajax(
177                  {
178                    type: "POST",
179                    url: "{/literal}{$datas.urlRequest}{literal}",
180                    async: false,
181                    data: { ajaxfct:"groupDelete", id:groupId }
182                  }
183                ).responseText;
184                $("#iGroups").html(
185                  $.ajax(
186                    {
187                      type: "POST",
188                      url: "{/literal}{$datas.urlRequest}{literal}",
189                      async: false,
190                      data: { ajaxfct:"groupGetList" }
191                    }
192                  ).responseText
193                );
194                $(this).dialog('destroy').html("").get(0).removeAttribute('style');
195              },
196            '{/literal}{"g003_no"|@translate}{literal}':
197              function()
198              {
199                $(this).dialog('destroy').html("").get(0).removeAttribute('style');
200              }
201          }
202        }
203      )
204      .html("<div class='dialogForm'>{/literal}{'g003_confirm_group_delete'|@translate}{literal}</div>".replace("%s", "<i>"+groupName+"</i>", "gi"));
205    }
206  }
207
208  function editGroup(groupId)
209  {
210    if(groupId=="")
211    {
212      dialogTitle="{/literal}{'g003_adding_a_group'|@translate}{literal}";
213    }
214    else
215    {
216      dialogTitle="{/literal}{'g003_editing_a_group'|@translate}{literal}";
217    }
218
219    $("#dialog")
220    .html("")
221    .dialog(
222      {
223        resizable: true,
224        width:480,
225        height:120,
226        modal: true,
227        draggable:true,
228        dialogClass: 'gcBgTabSheet gcBorder',
229        title: dialogTitle,
230        buttons:
231        {
232          '{/literal}{"g003_ok"|@translate}{literal}':
233            function()
234            {
235              list="";
236              $("form.dialogForm input[type='hidden']").each(
237                function ()
238                {
239                  if(list!="") list+="\n";
240                  list+=this.id.substr(6)+"="+this.value;
241                }
242              )
243
244              $.ajax(
245                {
246                  type: "POST",
247                  url: "{/literal}{$datas.urlRequest}{literal}",
248                  async: false,
249                  data: { ajaxfct:"groupSetNames", id:groupId, listNames:list }
250                }
251              ).responseText;
252              $("#iGroups").html(
253                $.ajax(
254                  {
255                    type: "POST",
256                    url: "{/literal}{$datas.urlRequest}{literal}",
257                    async: false,
258                    data: { ajaxfct:"groupGetList" }
259                  }
260                ).responseText
261              );
262              $(this).dialog('destroy').html("").get(0).removeAttribute('style');
263            },
264          '{/literal}{"g003_cancel"|@translate}{literal}':
265            function()
266            {
267              $(this).dialog('destroy').html("").get(0).removeAttribute('style');
268            }
269        }
270      }
271    )
272    .html(
273      $.ajax(
274        {
275          type: "POST",
276          url: "{/literal}{$datas.urlRequest}{literal}",
277          async: false,
278          data: { ajaxfct:"groupGetNames", id:groupId }
279        }
280      ).responseText
281    );
282  }
283
284
285  function editGroupList(groupId)
286  {
287    $("#dialog")
288    .html("")
289    .dialog(
290      {
291        resizable: false,
292        width:480,
293        height:320,
294        modal: true,
295        draggable:true,
296        dialogClass: 'gcBgTabSheet gcBorder',
297        title: '{/literal}{"g003_add_delete_tags"|@translate}{literal}',
298        open: function(event, ui)
299        {
300          bH=$("div.ui-dialog-buttonpane").get(0).clientHeight;
301          $("#dialog").css('height', (this.clientHeight-bH)+"px");
302        },
303        buttons:
304        {
305          '{/literal}{"g003_ok"|@translate}{literal}':
306            function()
307            {
308              list="";
309              $("#dialog table input").each(
310                function ()
311                {
312                  if(this.checked)
313                  {
314                    if(list!="") list+=",";
315                    list+=this.id.substr(6);
316                  }
317                }
318              )
319
320              $.ajax(
321                {
322                  type: "POST",
323                  url: "{/literal}{$datas.urlRequest}{literal}",
324                  async: false,
325                  data: { ajaxfct:"groupSetTagList", id:groupId, listTag:list }
326                }
327              ).responseText;
328
329              $(this).dialog('destroy').html("").get(0).removeAttribute('style');
330              loadGroupTags(groupId);
331            },
332          '{/literal}{"g003_cancel"|@translate}{literal}':
333            function()
334            {
335              $(this).dialog('destroy').html("").get(0).removeAttribute('style');
336            }
337        }
338      }
339    )
340    .html("<br>{/literal}{'g003_loading'|@translate}{literal}<br><img src='./plugins/GrumPluginClasses/icons/processing.gif'>");
341
342    $.ajax(
343      {
344        type: "POST",
345        url: "{/literal}{$datas.urlRequest}{literal}",
346        async: true,
347        data: { ajaxfct:"groupGetTagList", id:groupId },
348        success:
349          function(msg)
350          {
351            $("#dialog").html(msg);
352          }
353      }
354    );
355  }
356
357</script>
358{/literal}
359
360
361<h3>{'g003_display_management'|@translate}</h3>
362
363<div class="addGroup">
364  <a onclick="editGroup('');">{'g003_add_a_group'|@translate}</a>
365</div>
366
367
368<div id="dialog"></div>
369
370
371<div id="iGroupContainer">
372  <ul class="connectedSortable" id="iGroups">
373  </ul>
374</div>
375
376
377<script type="text/javascript">
378  init();
379  {foreach from=$datas.groups key=name item=data}
380  initSubList({$data.id});
381  {/foreach}
382</script>
Note: See TracBrowser for help on using the repository browser.