Changeset 9051
- Timestamp:
- Feb 2, 2011, 10:35:48 AM (13 years ago)
- Location:
- trunk/admin
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/cat_modify.php
r8728 r9051 45 45 if (isset($_POST['submit'])) 46 46 { 47 $image_order = null;48 if ( !isset($_POST['image_order_default']) )49 {50 for ($i=1; $i<=3; $i++)51 {52 if ( !empty($_POST['order_field_'.$i]) )53 {54 if (! empty($image_order) )55 {56 $image_order .= ',';57 }58 $image_order .= $_POST['order_field_'.$i];59 if ($_POST['order_direction_'.$i]=='DESC')60 {61 $image_order .= ' DESC';62 }63 }64 }65 }66 67 47 $data = 68 48 array( … … 73 53 $conf['allow_html_descriptions'] ? 74 54 @$_POST['comment'] : strip_tags(@$_POST['comment']), 75 'image_order' => $image_order,76 55 ); 77 56 … … 87 66 // retrieve cat infos before continuing (following updates are expensive) 88 67 $cat_info = get_cat_info($_GET['cat_id']); 89 90 if (isset($_POST['image_order_subcats']))91 {92 $query = '93 UPDATE '.CATEGORIES_TABLE.' SET image_order='.(isset($image_order) ? 'NULL':'\''.$image_order.'\'').'94 WHERE uppercats LIKE \''.$cat_info['uppercats'].',%\'';95 pwg_query($query);96 }97 68 98 69 if ($cat_info['visible'] != get_boolean( $_POST['visible'] ) ) … … 245 216 'CAT_COMMENTABLE' => boolean_to_string($category['commentable']), 246 217 247 'IMG_ORDER_DEFAULT' => empty($category['image_order']) ?248 'checked="checked"' : '',249 250 218 'U_JUMPTO' => make_index_url( 251 219 array( … … 278 246 $base_url.'batch_manager&cat='.$category['id'] 279 247 ); 280 $template->assign( 281 'U_MANAGE_RANKS', 282 $base_url.'element_set_ranks&cat_id='.$category['id'] 283 ); 284 } 248 } 249 250 $template->assign( 251 'U_MANAGE_RANKS', 252 $base_url.'element_set_ranks&cat_id='.$category['id'] 253 ); 285 254 286 255 if ($category['is_virtual']) … … 303 272 ); 304 273 } 305 306 // image order management307 308 $sort_fields = array(309 '' => '',310 'date_creation' => l10n('Creation date'),311 'date_available' => l10n('Post date'),312 'average_rate' => l10n('Average rate'),313 'hit' => l10n('Most visited'),314 'file' => l10n('File name'),315 'id' => 'Id',316 'rank' => l10n('Rank'),317 );318 319 $sort_directions = array(320 'ASC' => l10n('ascending'),321 'DESC' => l10n('descending'),322 );323 324 $template->assign( 'image_order_field_options', $sort_fields);325 $template->assign( 'image_order_direction_options', $sort_directions);326 327 $matches = array();328 if ( !empty( $category['image_order'] ) )329 {330 preg_match_all('/([a-z_]+) *(?:(asc|desc)(?:ending)?)? *(?:, *|$)/i',331 $category['image_order'], $matches);332 }333 334 for ($i=0; $i<3; $i++) // 3 fields335 {336 $tpl_image_order_select = array(337 'ID' => $i+1,338 'FIELD' => array(''),339 'DIRECTION' => array('ASC'),340 );341 342 if ( isset($matches[1][$i]) )343 {344 $tpl_image_order_select['FIELD'] = array($matches[1][$i]);345 }346 347 if (isset($matches[2][$i]) and strcasecmp($matches[2][$i],'DESC')==0)348 {349 $tpl_image_order_select['DIRECTION'] = array('DESC');350 }351 $template->append( 'image_orders', $tpl_image_order_select);352 }353 354 274 355 275 // representant management -
trunk/admin/element_set_ranks.php
r8728 r9051 90 90 if (isset($_POST['submit'])) 91 91 { 92 asort($_POST['rank_of_image'], SORT_NUMERIC); 92 if (isset($_POST['rank_of_image'])) 93 { 94 asort($_POST['rank_of_image'], SORT_NUMERIC); 93 95 94 save_images_order( 95 $page['category_id'], 96 array_keys($_POST['rank_of_image']) 97 ); 98 99 array_push( 100 $page['infos'], 101 l10n('Images manual order was saved') 102 ); 96 save_images_order( 97 $page['category_id'], 98 array_keys($_POST['rank_of_image']) 99 ); 100 101 array_push( 102 $page['infos'], 103 l10n('Images manual order was saved') 104 ); 105 } 103 106 104 107 $image_order = null; … … 135 138 WHERE id='.$page['category_id']; 136 139 pwg_query($query); 140 141 if (isset($_POST['image_order_subcats'])) 142 { 143 $cat_info = get_cat_info($page['category_id']); 144 145 $query = ' 146 UPDATE '.CATEGORIES_TABLE.' 147 SET image_order = '.(isset($image_order) ? '\''.$image_order.'\'' : 'NULL').' 148 WHERE uppercats LIKE \''.$cat_info['uppercats'].',%\''; 149 pwg_query($query); 150 } 151 152 array_push($page['infos'], l10n('Your configuration settings are saved')); 137 153 } 138 154 -
trunk/admin/themes/clear/theme.css
r8732 r9051 262 262 .languageName {color:black;} 263 263 .languageDefault {background-color:#dbe8f3;} 264 265 UL.thumbnails li.rank-of-image { 266 background-color: #ddd; 267 } -
trunk/admin/themes/default/template/cat_modify.tpl
r8727 r9051 15 15 {if isset($U_MANAGE_ELEMENTS) } 16 16 <li><a href="{$U_MANAGE_ELEMENTS}" title="{'manage album photos'|@translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/category_elements.png" class="button" alt="{'Photos'|@translate}"></a></li> 17 {/if} 17 18 <li><a href="{$U_MANAGE_RANKS}" title="{'manage photo ranks'|@translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/ranks.png" class="button" alt="{'ranks'|@translate}"></a></li> 18 {/if}19 19 <li><a href="{$U_CHILDREN}" title="{'manage sub-albums'|@translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/category_children.png" class="button" alt="{'sub-albums'|@translate}"></a></li> 20 20 {if isset($U_MANAGE_PERMISSIONS) } … … 89 89 </fieldset> 90 90 91 <fieldset id="image_order">92 <legend>{'Sort order'|@translate}</legend>93 <input type="checkbox" name="image_order_default" id="image_order_default" {$IMG_ORDER_DEFAULT}>94 <label for="image_order_default">{'Use the default photo sort order (defined in the configuration file)'|@translate}</label>95 <br>96 <input type="checkbox" name="image_order_subcats" id="image_order_subcats">97 <label for="image_order_subcats">{'Apply to sub-albums'|@translate}</label>98 <br>99 100 {foreach from=$image_orders item=order}101 <select name="order_field_{$order.ID}">102 {html_options options=$image_order_field_options selected=$order.FIELD }103 </select>104 <select name="order_direction_{$order.ID}">105 {html_options options=$image_order_direction_options selected=$order.DIRECTION }106 </select><br>107 {/foreach}108 109 </fieldset>110 111 91 <p style="text-align:center;"> 112 92 <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit"> -
trunk/admin/themes/default/template/element_set_ranks.tpl
r9039 r9051 37 37 <h3>{$CATEGORIES_NAV}</h3> 38 38 39 <form action="{$F_ACTION}" method="post"> 39 40 {if !empty($thumbnails)} 40 <form action="{$F_ACTION}" method="post">41 41 <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit"></p> 42 42 <fieldset> 43 <legend>{' Edit ranks'|@translate}</legend>43 <legend>{'Manual order'|@translate}</legend> 44 44 {if !empty($thumbnails)} 45 <p>{'Drag to re-order'|@translate}</p> 45 46 <ul class="thumbnails"> 46 47 {foreach from=$thumbnails item=thumbnail} … … 51 52 </div> 52 53 </div> 53 <input type="text" name="rank_of_image[{$thumbnail.ID}]" value="{$thumbnail.RANK}" >54 <input type="text" name="rank_of_image[{$thumbnail.ID}]" value="{$thumbnail.RANK}" style="display:none"> 54 55 </li> 55 56 {/foreach} … … 57 58 {/if} 58 59 </fieldset> 60 {/if} 59 61 60 62 <fieldset> … … 66 68 <p class="field"> 67 69 <input type="radio" name="image_order_choice" id="image_order_rank" value="rank"{if $image_order_choice=='rank'} checked="checked"{/if}> 68 <label for="image_order_rank">{' By rank'|@translate}</label>70 <label for="image_order_rank">{'manual order'|@translate}</label> 69 71 </p> 70 72 <p class="field"> 71 73 <input type="radio" name="image_order_choice" id="image_order_user_define" value="user_define"{if $image_order_choice=='user_define'} checked="checked"{/if}> 72 <label for="image_order_user_define">{' Manualorder'|@translate}</label>74 <label for="image_order_user_define">{'automatic order'|@translate}</label> 73 75 <div id="image_order_user_define_options"> 74 76 {foreach from=$image_orders item=order} … … 84 86 </div> 85 87 </fieldset> 86 <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit"></p> 88 <p> 89 <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit"> 90 91 <label> 92 <input type="checkbox" name="image_order_subcats" id="image_order_subcats"> 93 {'Apply to sub-albums'|@translate} 94 </label> 95 </p> 87 96 </form> 88 89 90 {else}91 <div class="infos"><p>{'No photo in this album'|@translate}</p></div>92 {/if} -
trunk/admin/themes/default/thumbnails.css
r7869 r9051 7 7 UL.thumbnails li.rank-of-image { 8 8 float: left; 9 background-color: #111; 10 border: 1px solid #666; 9 background-color: #333; 11 10 color: #666; 12 -moz-border-radius: 4px;11 -moz-border-radius: 5px; 13 12 display: block; 14 13 width: 104px; 15 height: 1 28px;14 height: 104px; 16 15 cursor: move; 17 16 margin: 10px; … … 19 18 UL.thumbnails li.rank-of-image img { 20 19 margin: 0 20px; 21 padding: 4px 2px;20 padding: 8px 2px; 22 21 float: left; 23 22 } … … 31 30 } 32 31 UL.thumbnails li.rank-of-image input { 33 height: 12px;34 width: 50px;35 position: relative;36 top: 4px;37 32 } 38 33 UL.thumbnails SPAN.wrap1 {
Note: See TracChangeset
for help on using the changeset viewer.