Changeset 28533
- Timestamp:
- May 24, 2014, 6:24:52 PM (11 years ago)
- Location:
- trunk/admin
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/batch_manager_global.php
r28532 r28533 475 475 476 476 // tags 477 $filter_tags = array(); 478 477 479 if (!empty($_SESSION['bulk_manager_filter']['tags'])) 478 480 { … … 484 486 WHERE id IN ('.implode(',', $_SESSION['bulk_manager_filter']['tags']).') 485 487 ;'; 486 $template->assign('filter_tags', get_taglist($query)); 487 } 488 489 // Virtualy associate a picture to a category 490 $query = ' 491 SELECT id,name,uppercats,global_rank 492 FROM '.CATEGORIES_TABLE.' 493 ;'; 494 $categories = array_from_query($query); 495 usort($categories, 'global_rank_compare'); 496 display_select_categories($categories, array(), 'category_full_name_options', true); 497 498 $template->assign('category_parent_options', $template->get_template_vars('category_full_name_options')); 499 $template->assign('category_parent_options_selected', array()); 488 489 $filter_tags = get_taglist($query); 490 } 491 492 $template->assign('filter_tags', $filter_tags); 500 493 501 494 // in the filter box, which category to select by default … … 705 698 'nb_thumbs_page' => $nb_thumbs_page, 706 699 'nb_thumbs_set' => count($page['cat_elements_id']), 707 'CACHE_KEYS' => get_admin_client_cache_keys(array('tags' ))700 'CACHE_KEYS' => get_admin_client_cache_keys(array('tags', 'categories')), 708 701 )); 709 702 -
trunk/admin/cat_modify.php
r26461 r28533 289 289 $intro.= '<br>'.l10n('Numeric identifier : %d', $category['id']); 290 290 291 $template->assign('INTRO', $intro); 292 293 $template->assign( 294 'U_MANAGE_RANKS', 295 $base_url.'element_set_ranks&cat_id='.$category['id'] 296 ); 291 $template->assign(array( 292 'INTRO' => $intro, 293 'U_MANAGE_RANKS' => $base_url.'element_set_ranks&cat_id='.$category['id'], 294 'CACHE_KEYS' => get_admin_client_cache_keys(array('categories')), 295 )); 297 296 298 297 if ($category['is_virtual']) … … 367 366 if ($category['is_virtual']) 368 367 { 369 // the category can be moved in any category but in itself, in any 370 // sub-category 371 $unmovables = get_subcat_ids(array($category['id'])); 372 373 $query = ' 374 SELECT id,name,uppercats,global_rank 375 FROM '.CATEGORIES_TABLE.' 376 WHERE id NOT IN ('.implode(',', $unmovables).') 377 ;'; 378 379 display_select_cat_wrapper( 380 $query, 381 empty($category['id_uppercat']) ? array() : array($category['id_uppercat']), 382 'move_cat_options' 383 ); 368 $template->assign('parent_category', empty($category['id_uppercat']) ? array() : array($category['id_uppercat'])); 384 369 } 385 370 -
trunk/admin/include/photos_add_direct_prepare.inc.php
r26461 r28533 218 218 219 219 // existing album 220 $query = ' 221 SELECT id,name,uppercats,global_rank 222 FROM '.CATEGORIES_TABLE.' 223 ;'; 224 225 display_select_cat_wrapper( 226 $query, 227 $selected_category, 228 'category_options' 229 ); 220 $template->assign('selected_category', $selected_category); 230 221 231 222 … … 257 248 } 258 249 259 $template->assign( 260 array( 261 'setup_errors'=> $setup_errors, 262 ) 263 ); 250 $template->assign(array( 251 'setup_errors'=> $setup_errors, 252 'CACHE_KEYS' => get_admin_client_cache_keys(array('categories')), 253 )); 264 254 265 255 // Warnings -
trunk/admin/themes/default/template/batch_manager_global.tpl
r28532 r28533 118 118 }); 119 119 }); 120 121 {* <!-- CATEGORIES --> *} 122 var categoriesCache = new LocalStorageCache({ 123 key: 'categoriesAdminList', 124 serverKey: '{$CACHE_KEYS.categories}', 125 serverId: '{$CACHE_KEYS._hash}', 126 127 loader: function(callback) { 128 jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.categories.getAdminList', function(data) { 129 callback(data.result.categories); 130 }); 131 } 132 }); 133 134 jQuery('[data-selectize=categories]').selectize({ 135 valueField: 'id', 136 labelField: 'fullname', 137 sortField: 'fullname', 138 searchField: ['fullname'], 139 plugins: ['remove_button'] 140 }); 141 142 categoriesCache.get(function(categories) { 143 categories.sort(function(a, b) { 144 return a.fullname.localeCompare(b.fullname); 145 }); 146 147 jQuery('[data-selectize=categories]').each(function() { 148 this.selectize.load(function(callback) { 149 callback(categories); 150 }); 151 152 if (jQuery(this).data('value')) { 153 this.selectize.setValue(jQuery(this).data('value')[0]); 154 } 155 156 // prevent empty value 157 if (this.selectize.getValue() == '') { 158 this.selectize.setValue(categories[0].id); 159 } 160 this.selectize.on('dropdown_close', function() { 161 if (this.getValue() == '') { 162 this.setValue(categories[0].id); 163 } 164 }); 165 }); 166 }); 167 168 jQuery('[data-add-album]').pwgAddAlbum({ cache: categoriesCache }); 120 169 }); 121 170 … … 228 277 $("[id^=action_]").hide(); 229 278 $("#action_"+$(this).prop("value")).show(); 230 231 /* make sure the #albumSelect is on the right select box so that the */232 /* "add new album" popup fills the right select box */233 if ("associate" == $(this).prop("value") || "move" == $(this).prop("value")) {234 jQuery("#albumSelect").removeAttr("id");235 jQuery("#action_"+$(this).prop("value")+" select").attr("id", "albumSelect");236 }237 279 238 280 if ($(this).val() != -1) { … … 622 664 <input type="checkbox" name="filter_category_use" class="useFilterCheckbox" {if isset($filter.category)}checked="checked"{/if}> 623 665 {'Album'|@translate} 624 <select style="width:400px" name="filter_category" size="1"> 625 {html_options options=$category_full_name_options selected=$filter_category_selected} 626 </select> 666 <select data-selectize="categories" data-value="{$filter_category_selected|@json_encode|escape:html}" 667 name="filter_category" style="width:400px"></select> 627 668 <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label> 628 669 </li> … … 632 673 <input type="checkbox" name="filter_tags_use" class="useFilterCheckbox" {if isset($filter.tags)}checked="checked"{/if}> 633 674 {'Tags'|@translate} 634 <select data-selectize="tags" data-value="{ if isset($filter_tags)}{$filter_tags|@json_encode|escape:html}{else}[]{/if}"675 <select data-selectize="tags" data-value="{$filter_tags|@json_encode|escape:html}" 635 676 name="filter_tags[]" multiple style="width:400px;" ></select> 636 677 <label><span><input type="radio" name="tag_mode" value="AND" {if !isset($filter.tag_mode) or $filter.tag_mode eq 'AND'}checked="checked"{/if}> {'All tags'|@translate}</span></label> … … 834 875 <!-- associate --> 835 876 <div id="action_associate" class="bulkAction"> 836 <select style="width:400px" name="associate" size="1"> 837 {html_options options=$category_full_name_options} 838 </select> 839 <br>{'... or '|@translate} <a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> 877 <select data-selectize="categories" name="associate" style="width:400px"></select> 878 <br>{'... or '|@translate} 879 <a href="#" data-add-album="associate" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> 840 880 </div> 841 881 842 882 <!-- move --> 843 883 <div id="action_move" class="bulkAction"> 844 <select style="width:400px" name="move" size="1"> 845 {html_options options=$category_full_name_options} 846 </select> 847 <br>{'... or '|@translate} <a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> 884 <select data-selectize="categories" name="move" style="width:400px"></select> 885 <br>{'... or '|@translate} 886 <a href="#" data-add-album="move" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> 848 887 </div> 849 888 … … 851 890 <!-- dissociate --> 852 891 <div id="action_dissociate" class="bulkAction"> 853 <select style="width:400px" name="dissociate" size="1"> 854 {if !empty($dissociate_options)}{html_options options=$dissociate_options }{/if} 855 </select> 892 <select data-selectize="categories" name="dissociate" style="width:400px"></select> 856 893 </div> 857 894 -
trunk/admin/themes/default/template/cat_modify.tpl
r25748 r28533 1 {combine_script id='LocalStorageCache' load='footer' path='admin/themes/default/js/LocalStorageCache.js'} 2 3 {combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'} 4 {combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.default.css"} 5 6 {footer_script} 7 {* <!-- CATEGORIES --> *} 8 var categoriesCache = new LocalStorageCache({ 9 key: 'categoriesAdminList', 10 serverKey: '{$CACHE_KEYS.categories}', 11 serverId: '{$CACHE_KEYS._hash}', 12 13 loader: function(callback) { 14 jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.categories.getAdminList', function(data) { 15 callback(data.result.categories); 16 }); 17 } 18 }); 19 20 jQuery('[data-selectize=categories]').selectize({ 21 valueField: 'id', 22 labelField: 'fullname', 23 sortField: 'fullname', 24 searchField: ['fullname'], 25 plugins: ['remove_button'] 26 }); 27 28 categoriesCache.get(function(categories) { 29 categories.push({ 30 id: 0, 31 fullname: '------------' 32 }); 33 34 // remove itself and children 35 categories = jQuery.grep(categories, function(cat) { 36 return !(/\b{$CAT_ID}\b/.test(cat.uppercats)); 37 }); 38 39 categories.sort(function(a, b) { 40 return a.fullname.localeCompare(b.fullname); 41 }); 42 43 jQuery('[data-selectize=categories]').each(function() { 44 this.selectize.load(function(callback) { 45 callback(categories); 46 }); 47 48 if (jQuery(this).data('value')) { 49 this.selectize.setValue(jQuery(this).data('value')[0]); 50 } 51 52 // prevent empty value 53 if (this.selectize.getValue() == '') { 54 this.selectize.setValue(categories[0].id); 55 } 56 this.selectize.on('dropdown_close', function() { 57 if (this.getValue() == '') { 58 this.setValue(categories[0].id); 59 } 60 }); 61 }); 62 }); 63 {/footer_script} 64 65 1 66 <div class="titrePage"> 2 67 <h2><span style="letter-spacing:0">{$CATEGORIES_NAV}</span> › {'Edit album'|@translate} {$TABSHEET_TITLE}</h2> … … 72 137 </p> 73 138 74 {if isset($ move_cat_options) }139 {if isset($parent_category) } 75 140 <p> 76 141 <strong>{'Parent album'|@translate}</strong> 77 142 <br> 78 <select class="categoryDropDown" name="parent"> 79 <option value="0">------------</option> 80 {html_options options=$move_cat_options selected=$move_cat_options_selected } 81 </select> 143 <select data-selectize="categories" data-value="{$parent_category|@json_encode|escape:html}" 144 name="parent" style="width:400px"></select> 82 145 </p> 83 146 {/if} -
trunk/admin/themes/default/template/include/add_album.inc.tpl
r25312 r28533 1 {footer_script}{literal} 2 jQuery(document).ready(function(){ 3 jQuery(".addAlbumOpen").colorbox({ 4 inline: true, 5 href: "#addAlbumForm", 6 onComplete: function() { 7 var $albumSelect = jQuery("#albumSelect"); 1 {include file='include/colorbox.inc.tpl'} 8 2 9 jQuery("input[name=category_name]").focus(); 10 11 jQuery("#category_parent").html('<option value="0">------------</option>') 12 .append($albumSelect.html()) 13 .val($albumSelect.val() || 0); 14 } 15 }); 3 {combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'} 4 {combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.default.css"} 16 5 17 jQuery("#addAlbumForm form").submit(function() { 18 jQuery("#categoryNameError").text(""); 19 20 var parent_id = jQuery("select[name=category_parent] option:selected").val(), 21 name = jQuery("input[name=category_name]").val(); 22 23 jQuery.ajax({ 24 url: "ws.php", 25 dataType: 'json', 26 data: { 27 format: 'json', 28 method: 'pwg.categories.add', 29 parent: parent_id, 30 name: name 31 }, 32 beforeSend: function() { 33 jQuery("#albumCreationLoading").show(); 34 }, 35 success: function(data) { 36 jQuery("#albumCreationLoading").hide(); 37 jQuery(".addAlbumOpen").colorbox.close(); 38 39 var newAlbum = data.result.id, 40 newAlbum_name = ''; 41 42 if (parent_id!=0) { 43 newAlbum_name = jQuery("#category_parent").find("option[value="+ parent_id +"]").text() +' / '; 44 } 45 newAlbum_name+= name; 46 47 var new_option = jQuery("<option/>") 48 .attr("value", newAlbum) 49 .attr("selected", "selected") 50 .text(newAlbum_name); 51 52 var $albumSelect = jQuery("#albumSelect"); 53 $albumSelect.find("option").removeAttr('selected'); 54 55 if (parent_id==0) { 56 $albumSelect.prepend(new_option); 57 } 58 else { 59 $albumSelect.find("option[value="+ parent_id +"]").after(new_option); 60 } 61 62 jQuery("#addAlbumForm form input[name=category_name]").val(''); 63 jQuery("#albumSelection").show(); 64 65 return true; 66 }, 67 error: function(XMLHttpRequest, textStatus, errorThrows) { 68 jQuery("#albumCreationLoading").hide(); 69 jQuery("#categoryNameError").text(errorThrows).css("color", "red"); 70 } 71 }); 72 73 return false; 74 }); 75 }); 76 {/literal}{/footer_script} 6 {combine_script id='addAlbum.js' load='footer' require='jquery.colorbox' path='admin/themes/default/js/addAlbum.js'} 77 7 78 8 <div style="display:none"> 79 <div id="addAlbumForm" style="text-align:left;padding:1em;">9 <div id="addAlbumForm"> 80 10 <form> 81 11 {'Parent album'|@translate}<br> 82 <select id="category_parent" name="category_parent"> 83 </select> 12 <select name="category_parent"></select> 84 13 <br><br> 85 14 -
trunk/admin/themes/default/template/include/colorbox.inc.tpl
r11962 r28533 1 1 {combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'} 2 {combine_css path="themes/default/js/plugins/colorbox/style2/colorbox.css"}2 {combine_css id='jquery.colorbox' path="themes/default/js/plugins/colorbox/style2/colorbox.css"} -
trunk/admin/themes/default/template/photos_add_direct.tpl
r25929 r28533 10 10 {include file='include/add_album.inc.tpl'} 11 11 12 {footer_script}{literal} 12 {combine_script id='LocalStorageCache' load='footer' path='admin/themes/default/js/LocalStorageCache.js'} 13 14 {combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'} 15 {combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.default.css"} 16 17 {footer_script} 18 {* <!-- CATEGORIES --> *} 19 var categoriesCache = new LocalStorageCache({ 20 key: 'categoriesAdminList', 21 serverKey: '{$CACHE_KEYS.categories}', 22 serverId: '{$CACHE_KEYS._hash}', 23 24 loader: function(callback) { 25 jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.categories.getAdminList', function(data) { 26 callback(data.result.categories); 27 }); 28 } 29 }); 30 31 jQuery('[data-selectize=categories]').selectize({ 32 valueField: 'id', 33 labelField: 'fullname', 34 sortField: 'fullname', 35 searchField: ['fullname'], 36 plugins: ['remove_button'] 37 }); 38 39 categoriesCache.get(function(categories) { 40 categories.sort(function(a, b) { 41 return a.fullname.localeCompare(b.fullname); 42 }); 43 44 jQuery('[data-selectize=categories]').each(function() { 45 this.selectize.load(function(callback) { 46 callback(categories); 47 }); 48 49 if (jQuery(this).data('value')) { 50 this.selectize.setValue(jQuery(this).data('value')[0]); 51 } 52 53 // prevent empty value 54 if (this.selectize.getValue() == '') { 55 this.selectize.setValue(categories[0].id); 56 } 57 this.selectize.on('dropdown_close', function() { 58 if (this.getValue() == '') { 59 this.setValue(categories[0].id); 60 } 61 }); 62 }); 63 }); 64 65 jQuery('[data-add-album]').pwgAddAlbum({ cache: categoriesCache }); 66 67 68 {literal} 13 69 jQuery(document).ready(function(){ 14 70 function checkUploadStart() { … … 17 73 jQuery("#formErrors li").hide(); 18 74 19 if (jQuery(" #albumSelect option:selected").length == 0) {75 if (jQuery("select[name=category]").val() == '') { 20 76 jQuery("#formErrors #noAlbum").show(); 21 77 nbErrors++; … … 197 253 'postData', 198 254 { 199 'category_id' : jQuery("select[name=category] option:selected").val(),255 'category_id' : jQuery("select[name=category]").val(), 200 256 'level' : jQuery("select[name=level] option:selected").val(), 201 257 'upload_id' : upload_id, … … 281 337 282 338 <span id="albumSelection"{if count($category_options) == 0} style="display:none"{/if}> 283 <select id="albumSelect" name="category"> 284 {html_options options=$category_options selected=$category_options_selected} 285 </select> 286 <br>{'... or '|@translate}</span><a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> 287 339 <select data-selectize="categories" data-value="{$selected_category|@json_encode|escape:html}" 340 name="category" style="width:400px"></select> 341 <br>{'... or '|@translate}</span> 342 <a href="#" data-add-album="category" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> 288 343 </fieldset> 289 344 -
trunk/admin/themes/default/template/picture_modify.tpl
r28532 r28533 26 26 valueField: 'id', 27 27 labelField: 'fullname', 28 sortField: 'fullname', 28 29 searchField: ['fullname'], 29 30 plugins: ['remove_button'] -
trunk/admin/themes/default/theme.css
r26399 r28533 1044 1044 1045 1045 /* Album Manager */ 1046 #addAlbumForm { 1047 text-align:left; 1048 padding:1em; 1049 } 1050 #addAlbumForm .selectize-dropdown-content { 1051 max-height:170px; 1052 } 1046 1053 #addAlbumForm input[name="category_name"], #formCreateAlbum input[name="virtual_name"] { 1047 1054 width:300px;
Note: See TracChangeset
for help on using the changeset viewer.