Changeset 17766
- Timestamp:
- Sep 5, 2012, 10:49:12 PM (12 years ago)
- Location:
- branches/2.4/admin
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.4/admin/batch_manager.php
r17290 r17766 115 115 ); 116 116 } 117 118 if (substr_compare($_GET['cat'],'tag-',0,4)==0) 119 { 120 $_SESSION['bulk_manager_filter']=array(); 121 $_SESSION['bulk_manager_filter']['tags'] = array(intval(substr($_GET['cat'],4))); 122 $_SESSION['bulk_manager_filter']['tag_mode'] = 'AND'; 123 } 117 124 } 118 125 -
branches/2.4/admin/batch_manager_unit.php
r16277 r17766 181 181 ); 182 182 $template->assign(array('navbar' => $nav_bar)); 183 184 // tags185 $all_tags = get_all_tags();186 183 187 184 $element_ids = array(); -
branches/2.4/admin/include/functions.php
r17725 r17766 1206 1206 return array('error' => l10n('The name of an album must not be empty')); 1207 1207 } 1208 1208 1209 1209 $insert = array( 1210 1210 'name' => $category_name, … … 1475 1475 } 1476 1476 1477 mass_inserts( 1478 IMAGE_TAG_TABLE, 1479 array_keys($inserts[0]), 1480 $inserts 1481 ); 1477 if (count($inserts)) 1478 { 1479 mass_inserts( 1480 IMAGE_TAG_TABLE, 1481 array_keys($inserts[0]), 1482 $inserts 1483 ); 1484 } 1482 1485 } 1483 1486 } … … 2096 2099 2097 2100 $taglist = array(); 2101 $altlist = array(); 2098 2102 while ($row = pwg_db_fetch_assoc($result)) 2099 2103 { 2100 if (!$only_user_language and preg_match_all('#\[lang=(.*?)\](.*?)\[/lang\]#is', $row['name'], $matches)) 2101 { 2102 foreach ($matches[2] as $tag_name) 2104 $raw_name = $row['name']; 2105 $name = trigger_event('render_tag_name', $raw_name); 2106 2107 $taglist[] = array( 2108 'name' => $name, 2109 'id' => '~~'.$row['id'].'~~', 2110 ); 2111 2112 if (!$only_user_language) 2113 { 2114 $alt_names = trigger_event('get_tag_alt_names', array(), $raw_name); 2115 2116 // TEMP 2.4 2117 if (count($alt_names)==0 and preg_match_all('#\[lang=(.*?)\](.*?)\[/lang\]#is', $row['name'], $matches)) 2103 2118 { 2104 array_push( 2105 $taglist, 2106 array( 2107 'name' => trigger_event('render_tag_name', $tag_name), 2119 foreach ($matches[2] as $alt) 2120 { 2121 $alt_names[] = $alt; 2122 } 2123 } 2124 2125 foreach( array_diff( array_unique($alt_names), array($name) ) as $alt) 2126 { 2127 $altlist[] = array( 2128 'name' => $alt, 2108 2129 'id' => '~~'.$row['id'].'~~', 2109 )2110 2130 ); 2111 2131 } 2112 2113 $row['name'] = preg_replace('#\[lang=(.*?)\](.*?)\[/lang\]#is', null, $row['name']); 2114 } 2115 2116 if (strlen($row['name']) > 0) 2117 { 2118 array_push( 2119 $taglist, 2120 array( 2121 'name' => trigger_event('render_tag_name', $row['name']), 2122 'id' => '~~'.$row['id'].'~~', 2123 ) 2124 ); 2125 } 2126 } 2127 2128 $cmp = create_function('$a,$b', 'return strcasecmp($a["name"], $b["name"]);'); 2129 usort($taglist, $cmp); 2132 } 2133 } 2134 2135 usort($taglist, 'tag_alpha_compare'); 2136 if (count($altlist)) 2137 { 2138 usort($altlist, 'tag_alpha_compare'); 2139 $taglist = array_merge($taglist, $altlist); 2140 } 2130 2141 2131 2142 return $taglist; -
branches/2.4/admin/tags.php
r12922 r17766 46 46 ;'; 47 47 $existing_names = array_from_query($query, 'name'); 48 48 49 49 50 50 $current_name_of = array(); … … 59 59 $current_name_of[ $row['id'] ] = $row['name']; 60 60 } 61 61 62 62 $updates = array(); 63 63 // we must not rename tag with an already existing name … … 118 118 $destination_tag_id = $_POST['destination_tag']; 119 119 $tag_ids = explode(',', $_POST['merge_list']); 120 120 121 121 if (is_array($tag_ids) and count($tag_ids) > 1) 122 122 { … … 134 134 $name_of_tag[ $row['id'] ] = trigger_event('render_tag_name', $row['name']); 135 135 } 136 136 137 137 $tag_ids_to_delete = array_diff( 138 138 $tag_ids, … … 189 189 $tags_deleted[] = $name_of_tag[$tag_id]; 190 190 } 191 191 192 192 array_push( 193 193 $page['infos'], … … 217 217 218 218 delete_tags($_POST['tags']); 219 219 220 220 array_push( 221 221 $page['infos'], 222 222 l10n_dec( 223 'The following tag was deleted', 223 'The following tag was deleted', 224 224 'The %d following tags were deleted', 225 225 count($tag_names)).' : '. … … 235 235 { 236 236 check_pwg_token(); 237 237 238 238 delete_orphan_tags(); 239 239 $_SESSION['page_infos'] = array(l10n('Orphan tags deleted')); … … 269 269 ) 270 270 ); 271 271 272 272 array_push( 273 273 $page['infos'], … … 332 332 // +-----------------------------------------------------------------------+ 333 333 334 335 // tag counters 336 $query = ' 337 SELECT tag_id, COUNT(image_id) AS counter 338 FROM '.IMAGE_TAG_TABLE.' 339 GROUP BY tag_id'; 340 $tag_counters = simple_hash_from_query($query, 'tag_id', 'counter'); 341 342 // all tags 343 $query = ' 344 SELECT * 345 FROM '.TAGS_TABLE.' 346 ;'; 347 $result = pwg_query($query); 348 $all_tags = array(); 349 while ($tag = pwg_db_fetch_assoc($result)) 350 { 351 $raw_name = $tag['name']; 352 $tag['name'] = trigger_event('render_tag_name', $raw_name); 353 $tag['counter'] = intval(@$tag_counters[ $tag['id'] ]); 354 $tag['U_VIEW'] = make_index_url(array('tags'=>array($tag))); 355 $tag['U_EDIT'] = 'admin.php?page=batch_manager&cat=tag-'.$tag['id']; 356 357 $alt_names = trigger_event('get_tag_alt_names', array(), $raw_name); 358 $alt_names = array_diff( array_unique($alt_names), array($tag['name']) ); 359 if (count($alt_names)) 360 { 361 $tag['alt_names'] = implode(', ', $alt_names); 362 } 363 $all_tags[] = $tag; 364 } 365 usort($all_tags, 'tag_alpha_compare'); 366 367 368 334 369 $template->assign( 335 370 array( 336 'TAG_SELECTION' => get_html_tag_selection( 337 get_all_tags(), 338 'tags' 339 ), 371 'all_tags' => $all_tags, 340 372 ) 341 373 ); … … 348 380 $list_name = 'MERGE_TAGS_LIST'; 349 381 } 350 382 351 383 $template->assign( 352 384 array( -
branches/2.4/admin/themes/default/template/tags.tpl
r12032 r17766 41 41 <tr> 42 42 <td>{$tag.NAME}</td> 43 <td><input type="text" name="tag_name-{$tag.ID}" value="{$tag.NAME}" size=" 30"></td>43 <td><input type="text" name="tag_name-{$tag.ID}" value="{$tag.NAME}" size="50"></td> 44 44 </tr> 45 45 {/foreach} … … 72 72 <label> 73 73 {'New tag'|@translate} 74 <input type="text" name="add_tag" size=" 30">74 <input type="text" name="add_tag" size="50"> 75 75 </label> 76 76 … … 80 80 <fieldset> 81 81 <legend>{'Tag selection'|@translate}</legend> 82 83 {$TAG_SELECTION} 82 {html_style} 83 .showInfo{ldelim}position:static; display:inline-block; text-indent:6px} 84 {/html_style} 85 {footer_script}{literal} 86 jQuery('.showInfo').tipTip({ 87 'delay' : 0, 88 'fadeIn' : 200, 89 'fadeOut' : 200, 90 'maxWidth':'300px', 91 'keepAlive':true, 92 'activation':'click' 93 }); 94 {/literal}{/footer_script} 95 <ul class="tagSelection"> 96 {foreach from=$all_tags item=tag} 97 <li>{capture name='showInfo'}<b>{$tag.name}</b><br>{$pwg->l10n_dec('%d photo', '%d photos', $tag.counter)} <a href="{$tag.U_VIEW}">{'View'|@translate}</a> <a href="{$tag.U_EDIT}">{'Edit'|@translate}</a>{if !empty($tag.alt_names)}<br>{$tag.alt_names}{/if}{/capture} 98 <a class="showInfo" title="{$smarty.capture.showInfo|@htmlspecialchars}">i</a> 99 <label> 100 <input type="checkbox" name="tags[]" value="{$tag.id}"> {$tag.name} 101 </label> 102 </li> 103 {/foreach} 104 </ul> 84 105 85 106 <p>
Note: See TracChangeset
for help on using the changeset viewer.