Changeset 26650
- Timestamp:
- Jan 12, 2014, 1:16:46 PM (11 years ago)
- Location:
- trunk/admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/tags.php
r26649 r26650 39 39 // +-----------------------------------------------------------------------+ 40 40 41 if (isset($_POST[' submit']))41 if (isset($_POST['edit_submit'])) 42 42 { 43 43 $query = ' … … 195 195 // +-----------------------------------------------------------------------+ 196 196 197 if (isset($_POST[' confirm_merge']))197 if (isset($_POST['merge_submit'])) 198 198 { 199 199 if (!isset($_POST['destination_tag'])) … … 429 429 } 430 430 431 $template->assign( 432 array( 433 $list_name => implode(',', $_POST['tags']), 434 ) 435 ); 431 $template->assign($list_name, implode(',', $_POST['tags'])); 436 432 437 433 $query = ' … … 442 438 $result = pwg_query($query); 443 439 while ($row = pwg_db_fetch_assoc($result)) 444 {445 $name_of[ $row['id'] ] = $row['name'];446 }447 448 foreach ($_POST['tags'] as $tag_id)449 440 { 450 441 $template->append( 451 442 'tags', 452 443 array( 453 'ID' => $ tag_id,454 'NAME' => $ name_of[$tag_id],444 'ID' => $row['id'], 445 'NAME' => $row['name'], 455 446 ) 456 447 ); -
trunk/admin/themes/default/template/tags.tpl
r26646 r26650 1 1 {include file='include/tag_selection.inc.tpl'} 2 2 3 {footer_script}{literal} 4 jQuery(document).ready(function(){ 5 function displayDeletionWarnings() { 6 jQuery(".warningDeletion").show(); 7 jQuery("input[name=destination_tag]:checked").parent("label").children(".warningDeletion").hide(); 3 {html_style} 4 .showInfo { text-indent:5px; } 5 {/html_style} 6 7 {footer_script require='jquery'} 8 jQuery('.showInfo').tipTip({ 9 'delay' : 0, 10 'fadeIn' : 200, 11 'fadeOut' : 200, 12 'maxWidth':'300px', 13 'keepAlive':true, 14 'activation':'click' 15 }); 16 17 function displayDeletionWarnings() { 18 jQuery(".warningDeletion").show(); 19 jQuery("input[name=destination_tag]:checked").parent("label").children(".warningDeletion").hide(); 20 } 21 22 displayDeletionWarnings(); 23 24 jQuery("#mergeTags label").click(function() { 25 displayDeletionWarnings(); 26 }); 27 28 jQuery("input[name=merge]").click(function() { 29 if (jQuery("ul.tagSelection input[type=checkbox]:checked").length < 2) { 30 alert("{'Select at least two tags for merging'|@translate}"); 31 return false; 32 } 33 }); 34 35 $("#searchInput").on("keydown", function(e) { 36 var $this = $(this), 37 timer = $this.data("timer"); 38 39 if (timer) { 40 clearTimeout(timer); 8 41 } 9 42 10 displayDeletionWarnings(); 43 $this.data("timer", setTimeout(function() { 44 var val = $this.val(); 45 if (!val) { 46 $(".tagSelection>li").show(); 47 $("#filterIcon").css("visibility","hidden"); 48 } 49 else { 50 $("#filterIcon").css("visibility","visible"); 51 var regex = new RegExp( val.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), "i" ); 52 $(".tagSelection>li").each(function() { 53 var $li = $(this), 54 text = $.trim( $("label", $li).text() ); 55 $li.toggle(regex.test(text)); 56 }); 57 } 11 58 12 jQuery("#mergeTags label").click(function() { 13 displayDeletionWarnings(); 14 }); 59 }, 300) ); 15 60 16 jQuery("input[name=merge]").click(function() { 17 if (jQuery("ul.tagSelection input[type=checkbox]:checked").length < 2) { 18 alert("{/literal}{'Select at least two tags for merging'|@translate}{literal}"); 19 return false; 20 } 21 }); 61 if (e.keyCode == 13) { // Enter 62 e.preventDefault(); 63 } 22 64 }); 23 {/ literal}{/footer_script}65 {/footer_script} 24 66 25 67 … … 47 89 48 90 <p> 49 <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}"> 50 <input class="submit" type="submit" name="submit" value="{'Submit'|@translate}"> 51 <input class="submit" type="reset" value="{'Reset'|@translate}"> 91 <input type="submit" name="edit_submit" value="{'Submit'|@translate}"> 92 <input type="submit" name="edit_cancel" value="{'Cancel'|@translate}"> 52 93 </p> 53 94 </fieldset> 54 95 {/if} 96 55 97 {if isset($DUPLIC_TAGS_LIST)} 56 98 <fieldset> … … 71 113 72 114 <p> 73 <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}"> 74 <input class="submit" type="submit" name="duplic_submit" value="{'Submit'|@translate}"> 75 <input class="submit" type="reset" value="{'Reset'|@translate}"> 115 <input type="submit" name="duplic_submit" value="{'Submit'|@translate}"> 116 <input type="submit" name="duplic_cancel" value="{'Cancel'|@translate}"> 76 117 </p> 77 118 </fieldset> … … 79 120 80 121 {if isset($MERGE_TAGS_LIST)} 81 <input type="hidden" name="merge_list" value="{$MERGE_TAGS_LIST}">82 83 122 <fieldset id="mergeTags"> 84 123 <legend>{'Merge tags'|@translate}</legend> 85 {'Select the destination tag'|@translate}<br><br> 124 {'Select the destination tag'|@translate} 125 126 <p> 86 127 {foreach from=$tags item=tag name=tagloop} 87 128 <label><input type="radio" name="destination_tag" value="{$tag.ID}"{if $smarty.foreach.tagloop.index == 0} checked="checked"{/if}> {$tag.NAME}<span class="warningDeletion"> {'(this tag will be deleted)'|@translate}</span></label><br> 88 129 {/foreach} 89 <br><input type="submit" name="confirm_merge" value="{'Confirm merge'|@translate}"> 130 </p> 131 132 <p> 133 <input type="hidden" name="merge_list" value="{$MERGE_TAGS_LIST}"> 134 <input type="submit" name="merge_submit" value="{'Confirm merge'|@translate}"> 135 <input type="submit" name="merge_cancel" value="{'Cancel'|@translate}"> 136 </p> 90 137 </fieldset> 91 138 {/if} … … 104 151 <fieldset> 105 152 <legend>{'Tag selection'|@translate}</legend> 106 {html_style}107 .showInfo{ldelim}text-indent:5px}108 {/html_style}109 {footer_script}{literal}110 jQuery('.showInfo').tipTip({111 'delay' : 0,112 'fadeIn' : 200,113 'fadeOut' : 200,114 'maxWidth':'300px',115 'keepAlive':true,116 'activation':'click'117 });118 {/literal}{/footer_script}119 {if count($all_tags)}120 <div><label><span class="icon-filter" style="visibility:hidden" id="filterIcon"></span>{'Search'|@translate}: <input id="searchInput" type="text" size="12"></label></div>121 {footer_script}{literal}122 $("#searchInput").on( "keydown", function(e) {123 var $this = $(this),124 timer = $this.data("timer");125 if (timer)126 clearTimeout(timer);127 153 128 $this.data("timer", setTimeout( function() { 129 var val = $this.val(); 130 if (!val) { 131 $(".tagSelection>li").show(); 132 $("#filterIcon").css("visibility","hidden"); 133 } 134 else { 135 $("#filterIcon").css("visibility","visible"); 136 var regex = new RegExp( val.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), "i" ); 137 $(".tagSelection>li").each( function(i, li) { 138 var $li = $(li), 139 text = $.trim( $("label", $li).text() ); 140 if (regex.test( text )) 141 $li.show(); 142 else 143 $li.hide(); 144 }); 145 } 154 {if count($all_tags)} 155 <div><label><span class="icon-filter" style="visibility:hidden" id="filterIcon"></span>{'Search'|@translate}: <input id="searchInput" type="text" size="12"></label></div> 156 {/if} 146 157 147 }, 300) ); 148 149 if (e.keyCode == 13) { // Enter 150 e.preventDefault(); 151 } 152 }); 153 {/literal}{/footer_script} 154 {/if} 155 <ul class="tagSelection"> 156 {foreach from=$all_tags item=tag} 157 <li>{capture name='showInfo'}<b>{$tag.name}</b> ({$tag.counter|@translate_dec:'%d photo':'%d photos'}) <br> <a href="{$tag.U_VIEW}">{'View in gallery'|@translate}</a> | <a href="{$tag.U_EDIT}">{'Manage photos'|@translate}</a>{if !empty($tag.alt_names)}<br>{$tag.alt_names}{/if}{/capture} 158 <a class="icon-info-circled-1 showInfo" title="{$smarty.capture.showInfo|@htmlspecialchars}"></a> 159 <label> 160 <input type="checkbox" name="tags[]" value="{$tag.id}"> {$tag.name} 161 </label> 162 </li> 163 {/foreach} 164 </ul> 158 <ul class="tagSelection"> 159 {foreach from=$all_tags item=tag} 160 <li> 161 {capture name='showInfo'}{strip} 162 <b>{$tag.name}</b> ({$tag.counter|@translate_dec:'%d photo':'%d photos'})<br> 163 <a href="{$tag.U_VIEW}">{'View in gallery'|@translate}</a> | 164 <a href="{$tag.U_EDIT}">{'Manage photos'|@translate}</a> 165 {if !empty($tag.alt_names)}<br>{$tag.alt_names}{/if} 166 {/strip}{/capture} 167 <a class="icon-info-circled-1 showInfo" title="{$smarty.capture.showInfo|@htmlspecialchars}"></a> 168 <label> 169 <input type="checkbox" name="tags[]" value="{$tag.id}"> {$tag.name} 170 </label> 171 </li> 172 {/foreach} 173 </ul> 165 174 166 167 168 169 170 171 172 175 <p> 176 <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}"> 177 <input type="submit" name="edit" value="{'Edit selected tags'|@translate}"> 178 <input type="submit" name="duplicate" value="{'Duplicate selected tags'|@translate}"> 179 <input type="submit" name="merge" value="{'Merge selected tags'|@translate}"> 180 <input type="submit" name="delete" value="{'Delete selected tags'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');"> 181 </p> 173 182 </fieldset> 174 183
Note: See TracChangeset
for help on using the changeset viewer.