Changeset 1500
- Timestamp:
- Jul 26, 2006, 2:51:08 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/cat_modify.php
r1250 r1500 81 81 } 82 82 83 $image_order = ''; 84 if ( !isset($_POST['image_order_default']) ) 85 { 86 for ($i=1; $i<=3; $i++) 87 { 88 if ( !empty($_POST['order_field_'.$i]) ) 89 { 90 if (! empty($image_order) ) 91 { 92 $image_order .= ','; 93 } 94 $image_order .= $_POST['order_field_'.$i]; 95 if ($_POST['order_direction_'.$i]=='DESC') 96 { 97 $image_order .= ' DESC'; 98 } 99 } 100 } 101 } 102 $image_order = empty($image_order) ? 'null' : "'$image_order'"; 103 $query = ' 104 UPDATE '.CATEGORIES_TABLE.' SET image_order='.$image_order.' 105 WHERE '; 106 if (isset($_POST['image_order_subcats'])) 107 { 108 $query .= 'uppercats REGEXP \'(^|,)'.$_GET['cat_id'].'(,|$)\''; 109 } 110 else 111 { 112 $query .= 'id='.$_GET['cat_id'].';'; 113 } 114 pwg_query($query); 115 83 116 array_push($page['infos'], $lang['editcat_confirm']); 84 117 } … … 226 259 $commentable => 'checked="checked"', 227 260 $uploadable => 'checked="checked"', 261 262 'IMG_ORDER_DEFAULT' => empty($category['image_order']) ? 263 'checked="checked"' : '', 228 264 229 265 'L_EDIT_NAME' => $lang['name'], … … 278 314 } 279 315 316 // image order management 317 $matches = array(); 318 if ( !empty( $category['image_order'] ) ) 319 { 320 preg_match_all('/([a-z_]+) *(?:(asc|desc)(?:ending)?)? *(?:, *|$)/i', 321 $category['image_order'], $matches); 322 } 323 324 $sort_fields = array( 325 '' => '', 326 'date_creation' => l10n('Creation date'), 327 'date_available' => l10n('Post date'), 328 'average_rate' => l10n('Average rate'), 329 'hit' => l10n('most_visited_cat'), 330 'file' => l10n('File name'), 331 'id' => 'Id', 332 ); 333 334 for ($i=0; $i<3; $i++) // 3 fields 335 { 336 $template->assign_block_vars('image_order', array('NUMBER'=>$i+1) ); 337 foreach ($sort_fields as $sort_field => $name) 338 { 339 $selected=''; 340 if ( isset($matches[1][$i]) and $matches[1][$i]==$sort_field ) 341 { 342 $selected='selected="selected"'; 343 } 344 elseif ( empty($sort_field) ) 345 { 346 $selected='selected="selected"'; 347 } 348 349 $template->assign_block_vars('image_order.field', 350 array( 351 'SELECTED' => $selected, 352 'VALUE' => $sort_field, 353 'OPTION' => $name 354 ) 355 ); 356 } 357 358 $template->assign_block_vars('image_order.order', 359 array( 360 'SELECTED' => 361 ( empty($matches[2][$i]) or strcasecmp($matches[2][$i],'ASC')==0 ) 362 ? 'selected="selected"' : '', 363 'VALUE' => 'ASC', 364 'OPTION' => 'Ascending' 365 ) 366 ); 367 368 $template->assign_block_vars('image_order.order', 369 array( 370 'SELECTED' => 371 ( isset($matches[2][$i]) and strcasecmp($matches[2][$i],'DESC')==0 ) 372 ? 'selected="selected"' : '', 373 'VALUE' => 'DESC', 374 'OPTION' => 'Descending' 375 ) 376 ); 377 } 378 379 280 380 // representant management 281 381 if ($category['nb_images'] > 0 -
trunk/include/functions_category.inc.php
r1288 r1500 111 111 $infos = array('nb_images','id_uppercat','comment','site_id' 112 112 ,'dir','date_last','uploadable','status','visible' 113 ,'representative_picture_id','uppercats','commentable'); 113 ,'representative_picture_id','uppercats','commentable' 114 ,'image_order'); 114 115 115 116 $query = ' -
trunk/include/section_init.inc.php
r1373 r1500 343 343 if (!isset($page['chronology_field'])) 344 344 { 345 if ( !empty($result['image_order']) and !isset($page['super_order_by']) ) 346 { 347 $conf[ 'order_by' ] = ' ORDER BY '.$result['image_order']; 348 } 349 345 350 $query = ' 346 351 SELECT image_id -
trunk/install/phpwebgallery_structure.sql
r1495 r1500 38 38 `commentable` enum('true','false') NOT NULL default 'true', 39 39 `global_rank` varchar(255) default NULL, 40 `image_order` varchar(128) default NULL, 40 41 PRIMARY KEY (`id`), 41 42 KEY `categories_i2` (`id_uppercat`) -
trunk/language/en_UK.iso-8859-1/admin.lang.php
r1489 r1500 46 46 $lang['Add selected elements to caddie'] = 'Add selected elements to caddie'; 47 47 $lang['Add'] = 'Add'; 48 $lang['Apply to subcategories'] = 'Apply to subcategories'; 48 49 $lang['Are you sure?'] = 'Are you sure?'; 49 50 $lang['Associated'] = 'Associated'; … … 166 167 $lang['The %d following tags were deleted : %s'] = 'The %d following tags were deleted : %s'; 167 168 $lang['Unable to check for upgrade since allow_url_fopen is disabled.'] = 'Unable to check for upgrade since allow_url_fopen is disabled.'; 169 $lang['Use default sort order']='Use the default image sort order (defined in the configuration file)'; 168 170 $lang['User comments validation'] = 'User comments validation'; 169 171 $lang['Users'] = 'Users'; -
trunk/language/fr_FR.iso-8859-1/admin.lang.php
r1489 r1500 46 46 $lang['Add selected elements to caddie'] = 'Ajouter les éléments sélectionnés au panier'; 47 47 $lang['Add'] = 'Ajouter'; 48 $lang['Apply to subcategories'] = 'Appliquer au sous-catégories'; 48 49 $lang['Are you sure?'] = 'Etes-vous sur?'; 49 50 $lang['Associated'] = 'Associée à'; … … 166 167 $lang['The %d following tags were deleted : %s'] = 'Les %d tags suivants ont été supprimés : %s'; 167 168 $lang['Unable to check for upgrade since allow_url_fopen is disabled.'] = 'Impossible de connaître la dernière version cat la fonction allow_url_fopen est désactivée.'; 169 $lang['Use default sort order']='Utiliser l\'ordre de tri des images par défaut (défini dans le fichier de configuration)'; 168 170 $lang['User comments validation'] = 'Validation des commentaires utilisateur'; 169 171 $lang['Users'] = 'Utilisateurs'; -
trunk/template/yoga/admin/cat_modify.tpl
r1454 r1500 63 63 <option class="{move.parent_option.CLASS}" {move.parent_option.SELECTED} value="{move.parent_option.VALUE}">{move.parent_option.OPTION}</option> 64 64 <!-- END parent_option --> 65 </select> 65 </select> 66 66 </fieldset> 67 67 <!-- END move --> … … 101 101 <!-- END upload --> 102 102 </table> 103 </fieldset> 104 105 <fieldset id="image_order"> 106 <legend>{lang:Sort order}</legend> 107 <input type="checkbox" name="image_order_default" id="image_order_default" {IMG_ORDER_DEFAULT} /> 108 <label for="image_order_default">{lang:Use default sort order}</label> 109 <br/> 110 <input type="checkbox" name="image_order_subcats" id="image_order_subcats" /> 111 <label for="image_order_subcats">{lang:Apply to subcategories}</label> 112 <br/> 113 <!-- BEGIN image_order --> 114 <select name="order_field_{image_order.NUMBER}"> 115 <!-- BEGIN field --> 116 <option value="{image_order.field.VALUE}" {image_order.field.SELECTED}>{image_order.field.OPTION}</option> 117 <!-- END field --> 118 </select> 119 <select name="order_direction_{image_order.NUMBER}"> 120 <!-- BEGIN order --> 121 <option value="{image_order.order.VALUE}" {image_order.order.SELECTED}>{image_order.order.OPTION}</option> 122 <!-- END order --> 123 </select><br/> 124 <!-- END image_order --> 103 125 </fieldset> 104 126 … … 123 145 </td> 124 146 <td> 125 <!-- BEGIN set_random --> 147 <!-- BEGIN set_random --> 126 148 <p><input type="submit" name="set_random_representant" value="{L_SET_RANDOM_REPRESENTANT}" {TAG_INPUT_ENABLED}/></p> 127 149 <!-- END set_random --> … … 139 161 140 162 <form action="{F_ACTION}" method="POST" id="links"> 141 163 142 164 <fieldset id="linkAllNew"> 143 165 <legend>{lang:Link all category elements to a new category}</legend> … … 164 186 <input type="submit" value="{lang:Submit}" name="submitAdd" {TAG_INPUT_ENABLED}/> 165 187 <input type="reset" value="{lang:Reset}" name="reset" /> 166 </p> 188 </p> 167 189 168 190 </fieldset> … … 187 209 <input type="submit" value="{lang:Submit}" name="submitDestinations" {TAG_INPUT_ENABLED}/> 188 210 <input type="reset" value="{lang:Reset}" name="reset" /> 189 </p> 211 </p> 190 212 191 213 </fieldset>
Note: See TracChangeset
for help on using the changeset viewer.