Changeset 635 for trunk/picture.php


Ignore:
Timestamp:
Dec 5, 2004, 10:28:40 PM (19 years ago)
Author:
plg
Message:
  • on picture.php, related categories under the element are displayed in global_rank order
  • when adding a new virtual category, initializes its global_rank
  • bug fixed : in admin/cat_list, false next rank
  • in admin/cat_modify, complete directory is calculated only if category is not virtual
  • admin/picture_modify rewritten : graphically nearer to admin/cat_modify, virtual associations are back
  • update_category partially rewritten : take an array of categories in parameter, becomes optionnaly recursive, use the set_random_representant function, set a random representant for categories with elements and no representant
  • bug fixed : on a search results screen, elements belonging to more than 1 category were shown more than once
  • bug fixed : in admin/cat_modify, changing a value in a textefield and hitting enter was setting a new random representant
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/picture.php

    r613 r635  
    739739// related categories
    740740$query = '
    741 SELECT category_id
     741SELECT category_id,uppercats,commentable,global_rank
    742742  FROM '.IMAGE_CATEGORY_TABLE.'
     743    INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id
    743744  WHERE image_id = '.$_GET['image_id'];
    744745if ($user['forbidden_categories'] != '')
     
    750751;';
    751752$result = pwg_query($query);
    752 $categories = '';
     753$cat_array = array();
     754while ($row = mysql_fetch_array($result))
     755{
     756  array_push($cat_array, $row);
     757}
     758usort($cat_array, 'global_rank_compare');
     759
     760$cat_output = '';
    753761$page['show_comments'] = false;
    754 while ($row = mysql_fetch_array($result))
    755 {
    756   if ($categories != '')
    757   {
    758     $categories.= '<br />';
    759   }
    760   $cat_info = get_cat_info($row['category_id']);
    761   $categories .= get_cat_display_name($cat_info['name'], ' &gt;');
     762foreach ($cat_array as $category)
     763{
     764  if ($cat_output != '')
     765  {
     766    $cat_output.= '<br />';
     767  }
     768 
     769  if (count($cat_array) > 3)
     770  {
     771    $cat_output .= get_cat_display_name_cache($category['uppercats'],
     772                                              ' &rarr; ');
     773  }
     774  else
     775  {
     776    $cat_info = get_cat_info($category['category_id']);
     777    $cat_output .= get_cat_display_name($cat_info['name'], ' &rarr; ');
     778  }
    762779  // the picture is commentable if it belongs at least to one category which
    763780  // is commentable
    764   if ($cat_info['commentable'])
     781  if ($category['commentable'])
    765782  {
    766783    $page['show_comments'] = true;
     
    771788  array(
    772789    'INFO'  => $lang['categories'],
    773     'VALUE' => $categories
     790    'VALUE' => $cat_output
    774791    ));
    775792// metadata
Note: See TracChangeset for help on using the changeset viewer.