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/admin/cat_list.php

    r632 r635  
    6363    // As we don't create a virtual category every day, let's do (far) too
    6464    // much queries
    65     if ($parent_id != 'NULL')
    66     {
    67       $query = '
    68 SELECT uppercats
    69   FROM '.CATEGORIES_TABLE.'
    70   WHERE id = '.$parent_id.'
    71 ;';
    72       $parent_uppercats = array_pop(mysql_fetch_array(pwg_query($query)));
    73     }
    74        
     65   
    7566    // we have then to add the virtual category
    7667    $query = '
     
    8879;';
    8980    $my_id = array_pop(mysql_fetch_array(pwg_query($query)));
    90 
    91     $query = '
    92 UPDATE '.CATEGORIES_TABLE.'
    93   SET uppercats = \'';
     81   
     82    if ($parent_id != 'NULL')
     83    {
     84      $query = '
     85SELECT uppercats, global_rank
     86  FROM '.CATEGORIES_TABLE.'
     87  WHERE id = '.$parent_id.'
     88;';
     89      $result = pwg_query($query);
     90      $row = mysql_fetch_array($result);
     91     
     92      $parent_uppercats = $row['uppercats'];
     93      $parent_global_rank = $row['global_rank'];
     94    }
     95
     96    $query = '
     97UPDATE '.CATEGORIES_TABLE.'
     98';
    9499    if (!empty($parent_uppercats))
    95100    {
    96       $query.= $parent_uppercats.',';
    97     }
    98     $query.= $my_id;
    99     $query.= '\'
     101      $query.= "  SET uppercats = CONCAT('".$parent_uppercats."',',',id)";
     102    }
     103    else
     104    {
     105      $query.= '  SET uppercats = id';
     106    }
     107    if (!empty($parent_global_rank))
     108    {
     109      $query.= "  , global_rank = CONCAT('".$parent_global_rank."','.',rank)";
     110    }
     111    else
     112    {
     113      $query.= '  , uppercats = id';
     114    }
     115    $query.= '
    100116  WHERE id = '.$my_id.'
    101117;';
     
    277293$template->set_filenames(array('categories'=>'admin/cat_list.tpl'));
    278294
     295$form_action = PHPWG_ROOT_PATH.'admin.php?page=cat_list';
     296if (isset($_GET['parent_id']))
     297{
     298  $form_action.= '&parent_id='.$_GET['parent_id'];
     299}
     300
    279301$template->assign_vars(array(
    280302  'CATEGORIES_NAV'=>$navigation,
    281   'NEXT_RANK'=>count($categories)+1,
     303  'NEXT_RANK'=>max(array_keys($categories))+1,
     304  'F_ACTION'=>$form_action,
    282305 
    283306  'L_ADD_VIRTUAL'=>$lang['cat_add'],
Note: See TracChangeset for help on using the changeset viewer.