Ignore:
Timestamp:
Mar 19, 2010, 1:50:19 PM (14 years ago)
Author:
plg
Message:

feature 724: FCBKcomplete propagated to element_set_global and
element_set_unit to manage tags.

Note: multiple instances of FCBKcomplete on the same page does not work as
good as a single instance.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/picture_modify.php

    r5067 r5188  
    107107    );
    108108
    109   // In $_POST[tags] we receive something like array('~~6~~', '~~59~~', 'New
    110   // tag', 'Another new tag') The ~~34~~ means that it is an existing
    111   // tag. I've added the surrounding ~~ to permit creation of tags like "10"
    112   // or "1234" (numeric characters only)
     109  // time to deal with tags
    113110  $tag_ids = array();
    114111  if (isset($_POST['tags']))
    115112  {
    116     foreach ($_POST['tags'] as $raw_tag)
    117     {
    118       if (preg_match('/^~~(\d+)~~$/', $raw_tag, $matches))
    119       {
    120         array_push($tag_ids, $matches[1]);
    121       }
    122       else
    123       {
    124         // we have to create a new tag
    125         array_push(
    126           $tag_ids,
    127           tag_id_from_tag_name($raw_tag)
    128           );
    129       }
    130     }
    131   }
    132  
    133   set_tags(
    134     $tag_ids,
    135     $_GET['image_id']
    136     );
     113    $tag_ids = get_fckb_tag_ids($_POST['tags']);
     114  }
     115  set_tags($tag_ids, $_GET['image_id']);
    137116
    138117  array_push($page['infos'], l10n('Picture informations updated'));
     
    195174
    196175// tags
    197 $tags = array();
    198 
    199176$query = '
    200177SELECT
    201178    tag_id,
    202     name
     179    name AS tag_name
    203180  FROM '.IMAGE_TAG_TABLE.' AS it
    204181    JOIN '.TAGS_TABLE.' AS t ON t.id = it.tag_id
    205182  WHERE image_id = '.$_GET['image_id'].'
    206183;';
    207 $result = pwg_query($query);
    208 while ($row = pwg_db_fetch_assoc($result))
    209 {
    210   array_push(
    211     $tags,
    212     array(
    213       'value' => '~~'.$row['tag_id'].'~~',
    214       'caption' => $row['name'],
    215       )
    216     );
    217 }
     184$tags = get_fckb_taglist($query);
    218185
    219186// retrieving direct information about picture
Note: See TracChangeset for help on using the changeset viewer.