Ignore:
Timestamp:
Apr 5, 2006, 12:29:35 AM (19 years ago)
Author:
plg
Message:

feature deleted: code for categories link was too complicated for such a
simple fature. Replaced by static association. Links are not persistent
anymore.

modification removed: #image_category.is_storage replaced by
#images.storage_category_id as in branche 1.5..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/picture_modify.php

    r1119 r1121  
    122122    and count($_POST['cat_dissociated']) > 0)
    123123{
    124   $datas = array();
    125 
    126   foreach ($_POST['cat_dissociated'] as $category_id)
    127   {
    128     array_push(
    129       $datas,
    130       array(
    131         'image_id' => $_GET['image_id'],
    132         'category_id' => $category_id
    133         )
    134       );
    135   }
    136 
    137   mass_inserts(
    138     IMAGE_CATEGORY_TABLE,
    139     array('image_id', 'category_id'),
    140     $datas
     124  associate_images_to_categories(
     125    array($_GET['image_id']),
     126    $_POST['cat_dissociated']
    141127    );
    142 
    143   check_links();
    144   update_category($_POST['cat_dissociated']);
    145128}
    146129// dissociate the element from categories (but not from its storage category)
     
    149132    and count($_POST['cat_associated']) > 0)
    150133{
    151   $associated_categories = $_POST['cat_associated'];
    152 
    153   // If the same element is associated to a source and its destinations,
    154   // dissociating the element with the source implies dissociating the
    155   // element fwith the destination.
    156   $destinations_of = get_destinations($_POST['cat_associated']);
    157   foreach ($destinations_of as $source => $destinations)
    158   {
    159     $associated_categories = array_merge(
    160       $associated_categories,
    161       $destinations
    162       );
    163   }
    164 
    165134  $query = '
    166135DELETE FROM '.IMAGE_CATEGORY_TABLE.'
    167136  WHERE image_id = '.$_GET['image_id'].'
    168     AND category_id IN ('.implode(',', $associated_categories).')
    169     AND is_storage = \'false\'
     137    AND category_id IN ('.implode(',', $_POST['cat_associated']).')
    170138';
    171139  pwg_query($query);
    172 
    173   check_links();
     140 
    174141  update_category($_POST['cat_associated']);
    175142}
     
    202169SELECT *
    203170  FROM '.IMAGES_TABLE.'
    204     INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id
    205171  WHERE id = '.$_GET['image_id'].'
    206     AND is_storage = \'true\'
    207172;';
    208173$row = mysql_fetch_array(pwg_query($query));
    209174
    210 $storage_category_id = $row['category_id'];
     175$storage_category_id = $row['storage_category_id'];
    211176$image_file = $row['file'];
    212177
     
    397362    INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = category_id
    398363  WHERE image_id = '.$_GET['image_id'].'
    399     AND is_storage = \'false\'
     364    AND id != '.$storage_category_id.'
    400365;';
    401366display_select_cat_wrapper($query, array(), 'associated_option');
Note: See TracChangeset for help on using the changeset viewer.