source: branches/2.5/admin/themes/default/template/cat_list.tpl @ 24982

Revision 24982, 5.2 KB checked in by plg, 6 years ago (diff)

bug 2967 fixed: avoid display changes when album list is long to load. Replace
input text for position to input hidden. It was a fallback when javascript is
deactivated, but nowadays Piwigo administration can't work without javascript.

  • Property svn:eol-style set to LF
Line 
1{footer_script require='jquery.ui.sortable'}{literal}
2jQuery(document).ready(function(){
3  jQuery(".drag_button").show();
4  jQuery(".categoryLi").css("cursor","move");
5  jQuery(".categoryUl").sortable({
6    axis: "y",
7    opacity: 0.8,
8    update : function() {
9      jQuery("#manualOrder").show();
10      jQuery("#notManualOrder").hide();
11      jQuery("#formAutoOrder").hide();
12      jQuery("#formCreateAlbum").hide();
13    }
14  });
15
16  jQuery("#categoryOrdering").submit(function(){
17    ar = jQuery('.categoryUl').sortable('toArray');
18    for(i=0;i<ar.length;i++) {
19      cat = ar[i].split('cat_');
20      document.getElementsByName('catOrd[' + cat[1] + ']')[0].value = i;
21    }
22  });
23
24  jQuery("input[name=order_type]").click(function () {
25    jQuery("#automatic_order_params").hide();
26    if (jQuery("input[name=order_type]:checked").val() == "automatic") {
27      jQuery("#automatic_order_params").show();
28    }
29  });
30
31  jQuery("#addAlbumOpen").click(function(){
32    jQuery("#formCreateAlbum").toggle();
33    jQuery("input[name=virtual_name]").focus();
34    jQuery("#formAutoOrder").hide();
35  });
36
37  jQuery("#addAlbumClose").click(function(){
38    jQuery("#formCreateAlbum").hide();
39  });
40
41
42  jQuery("#autoOrderOpen").click(function(){
43    jQuery("#formAutoOrder").toggle();
44    jQuery("#formCreateAlbum").hide();
45  });
46
47  jQuery("#autoOrderClose").click(function(){
48    jQuery("#formAutoOrder").hide();
49  });
50
51  jQuery("#cancelManualOrder").click(function(){
52    jQuery(".categoryUl").sortable("cancel");
53    jQuery("#manualOrder").hide();
54    jQuery("#notManualOrder").show();
55  });
56});
57{/literal}{/footer_script}
58
59<h2><span style="letter-spacing:0">{$CATEGORIES_NAV}</span> &#8250; {'Album list management'|@translate}</h2>
60<p class="showCreateAlbum" id="notManualOrder">
61  <a href="#" id="addAlbumOpen">{'create a new album'|@translate}</a>
62  {if count($categories)}| <a href="#" id="autoOrderOpen">{'apply automatic sort order'|@translate}</a>{/if}
63</p>
64<form id="formCreateAlbum" action="{$F_ACTION}" method="post" style="display:none;">
65  <fieldset>
66      <legend>{'create a new album'|@translate}</legend>
67      <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
68     
69      <p>
70        <strong>{'Album name'|@translate}</strong><br>
71        <input type="text" name="virtual_name" maxlength="255">
72      </p>
73     
74      <p class="actionButtons">
75        <input class="submit" name="submitAdd" type="submit" value="{'Create'|@translate}">
76        <a href="#" id="addAlbumClose">{'Cancel'|@translate}</a>
77      </p>
78  </fieldset>
79</form>
80{if count($categories)}
81<form id="formAutoOrder" action="{$F_ACTION}" method="post" style="display:none;">
82  <fieldset>
83    <legend>{'Automatic sort order'|@translate}</legend>
84    <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
85   
86    <p><strong>{'Sort order'|@translate}</strong>
87      <br><label><input type="radio" value="asc" name="ascdesc" checked="checked">{'ascending'|@translate}</label>
88      <br><label><input type="radio" value="desc" name="ascdesc">{'descending'|@translate}</label>
89    </p>
90 
91    <p>
92      <label><input type="checkbox" name="recursive"> <strong>{'Apply to sub-albums'|@translate}</strong></label>
93    </p>
94 
95    <p class="actionButtons">
96      <input class="submit" name="submitAutoOrder" type="submit" value="{'Save order'|@translate}">
97      <a href="#" id="autoOrderClose">{'Cancel'|@translate}</a>
98    </p>
99  </fieldset>
100</form>
101{/if}
102
103<form id="categoryOrdering" action="{$F_ACTION}" method="post">
104  <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
105  <p id="manualOrder" style="display:none">
106    <input class="submit" name="submitManualOrder" type="submit" value="{'Save manual order'|@translate}">
107    {'... or '|@translate} <a href="#" id="cancelManualOrder">{'cancel manual order'|@translate}</a>
108  </p>
109 
110{if count($categories)}
111  <ul class="categoryUl">
112    {foreach from=$categories item=category}
113    <li class="categoryLi{if $category.IS_VIRTUAL} virtual_cat{/if}" id="cat_{$category.ID}">
114      <!-- category {$category.ID} -->
115      <p class="albumTitle">
116        <img src="{$themeconf.admin_icon_dir}/cat_move.png" class="button drag_button" style="display:none;" alt="{'Drag to re-order'|@translate}" title="{'Drag to re-order'|@translate}">
117        <strong><a href="{$category.U_CHILDREN}" title="{'manage sub-albums'|@translate}">{$category.NAME}</a></strong>
118      </p>
119
120      <input type="hidden" name="catOrd[{$category.ID}]" value="{$category.RANK}">
121
122      <p class="albumActions">
123        <a href="{$category.U_EDIT}">{'Edit'|@translate}</a>
124        {if isset($category.U_MANAGE_ELEMENTS) }
125        | <a href="{$category.U_MANAGE_ELEMENTS}">{'manage album photos'|@translate}</a>
126        {/if}
127        | <a href="{$category.U_CHILDREN}">{'manage sub-albums'|@translate}</a>
128        {if isset($category.U_SYNC) }
129        | <a href="{$category.U_SYNC}">{'Synchronize'|@translate}</a>
130        {/if}
131        {if isset($category.U_DELETE) }
132        | <a href="{$category.U_DELETE}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');">{'delete album'|@translate}</a>
133      {/if}
134      {if cat_admin_access($category.ID)}
135        | <a href="{$category.U_JUMPTO}">{'jump to album'|@translate} →</a>
136      {/if}
137      </p>
138
139    </li>
140    {/foreach}
141  </ul>
142{/if}
143</form>
Note: See TracBrowser for help on using the repository browser.