Changeset 5067 for trunk/admin/picture_modify.php
- Timestamp:
- Mar 6, 2010, 11:10:23 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/picture_modify.php
r5021 r5067 107 107 ); 108 108 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) 113 $tag_ids = array(); 114 if (isset($_POST['tags'])) 115 { 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 109 133 set_tags( 110 isset($_POST['tags']) ? $_POST['tags'] : array(),134 $tag_ids, 111 135 $_GET['image_id'] 112 136 ); … … 170 194 } 171 195 196 // tags 197 $tags = array(); 198 199 $query = ' 200 SELECT 201 tag_id, 202 name 203 FROM '.IMAGE_TAG_TABLE.' AS it 204 JOIN '.TAGS_TABLE.' AS t ON t.id = it.tag_id 205 WHERE image_id = '.$_GET['image_id'].' 206 ;'; 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 } 218 172 219 // retrieving direct information about picture 173 220 $query = ' … … 185 232 186 233 $image_file = $row['file']; 187 188 // tags189 $query = '190 SELECT tag_id191 FROM '.IMAGE_TAG_TABLE.'192 WHERE image_id = '.$_GET['image_id'].'193 ;';194 $selected_tags = array_from_query($query, 'tag_id');195 234 196 235 // +-----------------------------------------------------------------------+ … … 204 243 ); 205 244 206 $all_tags = get_all_tags();207 208 if (count($all_tags) > 0)209 {210 $tag_selection = get_html_tag_selection(211 $all_tags,212 'tags',213 $selected_tags214 );215 }216 else217 {218 $tag_selection =219 '<p>'.220 l10n('No tag defined. Use Administration>Pictures>Tags').221 '</p>';222 }223 224 245 $template->assign( 225 246 array( 247 'tags' => $tags, 226 248 'U_SYNC' => 227 249 get_root_url().'admin.php?page=picture_modify'. … … 245 267 246 268 'AUTHOR' => isset($_POST['author']) ? $_POST['author'] : @$row['author'], 247 248 'TAG_SELECTION' => $tag_selection,249 269 250 270 'DESCRIPTION' =>
Note: See TracChangeset
for help on using the changeset viewer.