Changeset 23551 for extensions/UserCollections
- Timestamp:
- Jun 26, 2013, 12:09:21 AM (11 years ago)
- Location:
- extensions/UserCollections
- Files:
-
- 21 edited
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserCollections/admin.php
r20090 r23551 15 15 if (isset($_GET['col_id'])) 16 16 { 17 $tabsheet->add('export', l10n('Export '), USER_COLLEC_ADMIN . '-export&col_id='.$_GET['col_id']);17 $tabsheet->add('export', l10n('Export image list'), USER_COLLEC_ADMIN . '-export&col_id='.$_GET['col_id']); 18 18 } 19 19 else -
extensions/UserCollections/admin/config.php
r20090 r23551 17 17 18 18 19 $template->set_filename('user_collections', dirname(__FILE__) . '/template/config.tpl');19 $template->set_filename('user_collections', realpath(USER_COLLEC_PATH . 'admin/template/config.tpl')); 20 20 21 21 ?> -
extensions/UserCollections/admin/export.php
r20099 r23551 55 55 $template->assign('inactive_fields', pwg_get_session_var('uc_export_inactive_fields', $default_inactive_fields)); 56 56 57 $template->set_filename('user_collections', dirname(__FILE__) . '/template/export.tpl');57 $template->set_filename('user_collections', realpath(USER_COLLEC_PATH . 'admin/template/export.tpl')); 58 58 59 59 ?> -
extensions/UserCollections/admin/sets.php
r20090 r23551 46 46 { 47 47 $template->append('sets', array( 48 'NAME' => $row['name'],48 'NAME' => trigger_event('render_category_name', $row['name']), 49 49 'NB_IMAGES' => $row['nb_images'], 50 50 'DATE_CREATION' => format_date($row['date_creation'], true), … … 70 70 ); 71 71 72 $template->assign('order_options', $page['order_by_items']);73 $template->assign('order_selected',74 isset($_POST['order_by']) ? $_POST['order_by'] : '');75 76 $template->assign('direction_options', $page['direction_items']);77 $template->assign('direction_selected',78 isset($_POST['direction']) ? $_POST['direction'] : '');79 80 72 81 73 $template->assign(array( 74 'order_options' => $page['order_by_items'], 75 'order_selected' => isset($_POST['order_by']) ? $_POST['order_by'] : '', 76 'direction_options' => $page['direction_items'], 77 'direction_selected' => isset($_POST['direction']) ? $_POST['direction'] : '', 78 82 79 'F_USERNAME' => @htmlentities($_POST['username'], ENT_COMPAT, 'UTF-8'), 83 80 'F_NAME' => @htmlentities($_POST['name'], ENT_COMPAT, 'UTF-8'), … … 86 83 87 84 88 $template->set_filename('user_collections', dirname(__FILE__) . '/template/sets.tpl');85 $template->set_filename('user_collections', realpath(USER_COLLEC_PATH . 'admin/template/sets.tpl')); 89 86 90 87 ?> -
extensions/UserCollections/admin/template/sets.tpl
r20090 r23551 56 56 <td style="padding-left:25px;"> 57 57 <a href="{$set.U_EDIT}" title="{'Edit this collection'|@translate}"><img src="{$themeconf.admin_icon_dir}/edit_s.png"></a> 58 <a href="{$set.U_EXPORT}" title="{'Export image list'|@translate}"><img src="{$themeconf.admin_icon_dir}/plug_install.png">< /a>59 <a href="{$set.U_DELETE}" title="{'Delete this collection'|@translate}" onClick="return confirm('{'Are you rsure?'|@translate}');"><img src="{$themeconf.admin_icon_dir}/delete.png"></a>58 <a href="{$set.U_EXPORT}" title="{'Export image list'|@translate}"><img src="{$themeconf.admin_icon_dir}/plug_install.png"><span class="icon-upload"></span></a> <!-- temp 2.5/2.6 --> 59 <a href="{$set.U_DELETE}" title="{'Delete this collection'|@translate}" onClick="return confirm('{'Are you sure?'|@translate}');"><img src="{$themeconf.admin_icon_dir}/delete.png"></a> 60 60 </td> 61 61 </tr> … … 64 64 {if not $sets} 65 65 <tr class="row2"> 66 <td colspan="8" style="text-align:center;font-style:italic;">{'No result '|@translate}</td>66 <td colspan="8" style="text-align:center;font-style:italic;">{'No results'|@translate}</td> 67 67 </tr> 68 68 {/if} -
extensions/UserCollections/include/UserCollection.class.php
r23361 r23551 9 9 /** 10 10 * __construct 11 * @param: mixed col id (##|'new' |'active')11 * @param: mixed col id (##|'new') 12 12 * @param: array images 13 13 */ 14 function __construct($col_id, $ images=array(), $name=null, $active=false, $public=false, $user_id=null)14 function __construct($col_id, $name=null, $comment=null, $public=false, $user_id=null) 15 15 { 16 16 global $user; … … 25 25 'name' => null, 26 26 'date_creation' => '0000-00-00 00:00:00', 27 'domment' => null, 27 28 'nb_images' => 0, 28 'active' => 0,29 29 'public' => 0, 30 30 'public_id' => null, … … 71 71 ); 72 72 73 // make sur all pictures of the collection exist73 // make sure all pictures of the collection exist 74 74 $query = ' 75 75 DELETE FROM '.COLLECTION_IMAGES_TABLE.' … … 99 99 { 100 100 $this->data['name'] = $name; 101 $this->data[' active'] = (int)$active;101 $this->data['comment'] = $comment; 102 102 $this->data['public'] = (int)$public; 103 103 $this->data['public_id'] = 'uc'.hash('crc32', uniqid(serialize($this->data), true)); … … 108 108 name, 109 109 date_creation, 110 active,110 comment, 111 111 public, 112 112 public_id … … 116 116 "'.$this->data['name'].'", 117 117 NOW(), 118 '.(int)$this->data['active'].',118 "'.$this->data['comment'].'", 119 119 '.(int)$this->data['public'].', 120 120 "'.$this->data['public_id'].'" … … 126 126 $date = pwg_query('SELECT NOW();'); 127 127 list($this->data['date_creation']) = pwg_db_fetch_row($date); 128 129 if (!empty($images))130 {131 $this->addImages($images);132 }133 128 } 134 129 else … … 283 278 'ID' => $this->data['id'], 284 279 'NAME' => $this->data['name'], 280 'COMMENT' => $this->data['comment'], 285 281 'NB_IMAGES' => $this->data['nb_images'], 286 'ACTIVE' => (bool)$this->data['active'],287 282 'PUBLIC' => (bool)$this->data['public'], 288 283 'DATE_CREATION' => $this->data['date_creation'], … … 317 312 if (!verify_ephemeral_key(@$key)) 318 313 { 319 array_push($errors, l10n('Invalid or expired securitykey'));314 array_push($errors, l10n('Invalid key')); 320 315 $comment_action='reject'; 321 316 } -
extensions/UserCollections/include/collections.inc.php
r23361 r23551 19 19 if (is_a_guest()) access_denied(); 20 20 21 $template->set_filename('index', realpath(USER_COLLEC_PATH.'template/ list.tpl'));21 $template->set_filename('index', realpath(USER_COLLEC_PATH.'template/collections_list.tpl')); 22 22 23 23 // actions … … 35 35 else 36 36 { 37 $UserCollection = new UserCollection('new', array(), $_GET['name'], 1);37 $UserCollection = new UserCollection('new', $_GET['name']); 38 38 39 39 if (isset($_GET['redirect'])) … … 64 64 break; 65 65 } 66 67 // set active68 case 'toggle_active':69 {70 $query = '71 UPDATE '.COLLECTIONS_TABLE.'72 SET active = IF(active=1, 0, 1)73 WHERE74 user_id = '.$user['id'].'75 AND id = '.$_GET['col_id'].'76 ;';77 pwg_query($query);78 79 redirect(USER_COLLEC_PUBLIC);80 break;81 }82 66 } 83 67 } … … 102 86 } 103 87 104 $template->set_filename('index', realpath(USER_COLLEC_PATH.'template/ edit.tpl'));88 $template->set_filename('index', realpath(USER_COLLEC_PATH.'template/collection_edit.tpl')); 105 89 106 90 $self_url = USER_COLLEC_PUBLIC . 'edit/'.$page['col_id']; … … 109 93 'user_collections' => $conf['user_collections'], 110 94 'F_ACTION' => $self_url, 111 'collection_toggle_url' => $self_url,112 95 'U_LIST' => USER_COLLEC_PUBLIC, 113 96 'UC_IN_EDIT' => true, … … 133 116 } 134 117 $UserCollection->updateParam('public', $_POST['public']); 118 $UserCollection->updateParam('comment', stripslashes($_POST['comment'])); 135 119 } 136 120 … … 182 166 // add remove item links 183 167 $template->set_prefilter('index_thumbnails', 'user_collections_thumbnails_list_button'); 184 $template->set_prefilter('index', 'user_collections_thumbnails_list_cssjs');185 168 $template->set_prefilter('index_thumbnails', 'user_collections_add_colorbox'); 186 169 … … 211 194 212 195 $template->concat('TITLE', 213 $conf['level_separator']. $UserCollection->getParam('name')196 $conf['level_separator'].trigger_event('render_category_name', $col['NAME']) 214 197 ); 198 199 $template->assign('CONTENT_DESCRIPTION', trigger_event('render_category_description', nl2br($col['COMMENT']))); 215 200 } 216 201 catch (Exception $e) … … 232 217 } 233 218 234 $template->set_filename('index', dirname(__FILE__).'/../template/view.tpl');219 $template->set_filename('index', realpath(USER_COLLEC_PATH.'template/collection_view.tpl')); 235 220 236 221 $self_url = USER_COLLEC_PUBLIC . 'view/'.$page['col_id']; 237 222 238 223 try { 239 $UserCollection = new UserCollection($page['col_id']); 240 $page['col_id'] = $UserCollection->getParam('id'); 224 $UserCollection = new UserCollection($page['col_id']); // public id 225 $page['col_id'] = $UserCollection->getParam('id'); // private id 226 $col = $UserCollection->getCollectionInfo(); 241 227 242 228 $template->set_prefilter('index_thumbnails', 'user_collections_add_colorbox'); … … 248 234 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 249 235 $template->concat('TITLE', 250 $conf['level_separator'] .$UserCollection->getParam('name').251 ' (' .sprintf(l10n('by %s'), get_username($UserCollection->getParam('user_id'))).')'236 $conf['level_separator'] . trigger_event('render_category_name', $col['NAME']) . 237 ' (' . sprintf(l10n('by %s'), get_username($UserCollection->getParam('user_id'))) . ')' 252 238 ); 239 240 $template->assign('CONTENT_DESCRIPTION', trigger_event('render_category_description', nl2br($col['COMMENT']))); 253 241 } 254 242 catch (Exception $e) … … 264 252 function user_collections_categories_list($content, &$samrty) 265 253 { 266 $search [0]= '<div class="thumbnailCategory">';267 $replace [0] = '<div class="thumbnailCategory {*if $cat.active}activeCollection{/if*}">254 $search = '<div class="thumbnailCategory">'; 255 $replace = '<div class="thumbnailCategory"> 268 256 <div class="collectionActions"> 269 257 <a href="{$cat.URL}" rel="nofollow">{"Edit"|@translate}</a> 270 258 | <a href="{$cat.U_DELETE}" onClick="return confirm(\'{"Are you sure?"|@translate}\');" rel="nofollow">{"Delete"|@translate}</a> 271 {if $cat.U_ACTIVE}| <a href="{$cat.U_ACTIVE}" rel="nofollow">{if $cat.active}{"set inactive"|@translate}{else}{"set active"|@translate}{/if}</a>{/if}272 259 </div>'; 273 274 // $search[1] = '<a href="{$cat.URL}">{$cat.NAME}</a>';275 // $replace[1] = '<a href="{$cat.URL}">{$cat.NAME}</a> {if $cat.active}<span class="collectionActive">({"active"|@translate})</span>{/if}';276 260 277 261 return str_replace($search, $replace, $content); … … 281 265 function user_collections_add_colorbox($content) 282 266 { 283 // add datas284 267 $search = '<a href="{$thumbnail.URL}"'; 285 268 $replace = $search.' class="preview-box" data-src="{$thumbnail.FILE_SRC}" data-id="{$thumbnail.id}"'; 286 269 287 // colorbox script288 $content.= file_get_contents(USER_COLLEC_PATH.'template/thumbnails_colorbox.tpl');289 290 270 return str_replace($search, $replace, $content); 291 271 } -
extensions/UserCollections/include/display_collections.inc.php
r23361 r23551 97 97 'URL' => USER_COLLEC_PUBLIC.'edit/'.$category['id'], 98 98 'CAPTION_NB_IMAGES' => empty($counter) ? sprintf(l10n('%d photo'), 0) : $counter, 99 'NAME' => $category['name'], 99 'NAME' => trigger_event('render_category_name', $category['name']), 100 'DESCRIPTION' => trigger_event('render_category_description', $category['comment'], 'subcatify_category_description'), 100 101 'INFO_DATES' => format_date($category['date_creation'], true), 101 102 // 'U_ACTIVE' => add_url_params(USER_COLLEC_PUBLIC, array('action'=>'toggle_active','col_id'=>$category['id'])),103 102 'U_DELETE' => add_url_params(USER_COLLEC_PUBLIC, array('action'=>'delete','col_id'=>$category['id'])), 104 103 )); -
extensions/UserCollections/include/display_thumbnails.inc.php
r23361 r23551 134 134 array('start') 135 135 ); 136 137 $thumbnail['COLLECTION_SELECTED'] = true;138 $thumbnail['COLLECTION_TOGGLE_URL'] = add_url_params($url, array('collection_toggle'=>$thumbnail['id']));139 136 } 140 137 -
extensions/UserCollections/include/events.inc.php
r23361 r23551 47 47 function user_collections_page() 48 48 { 49 global $page ;49 global $page, $template; 50 50 51 51 if (isset($page['section']) and $page['section'] == 'collections') 52 52 { 53 53 include(USER_COLLEC_PATH . '/include/collections.inc.php'); 54 } 55 56 if (!is_a_guest() && count($page['items'])) 57 { 58 $template->set_filename('uc_tumbnails_cssjs', realpath(USER_COLLEC_PATH . 'template/thumbnails_css_js.tpl')); 59 $template->parse('uc_tumbnails_cssjs'); 54 60 } 55 61 } … … 98 104 // get all collections 99 105 $query = ' 100 SELECT id, name, nb_images , active106 SELECT id, name, nb_images 101 107 FROM '.COLLECTIONS_TABLE.' 102 108 WHERE user_id = '.$user['id'].' … … 104 110 ;'; 105 111 $collections = hash_from_query($query, 'id'); 112 113 foreach ($collections as &$col) 114 { 115 $col["name"] = trigger_event("render_category_name", $col["name"]); 116 } 117 unset($col); 106 118 107 119 $template->assign(array( … … 112 124 // thumbnails buttons 113 125 $template->set_prefilter('index_thumbnails', 'user_collections_thumbnails_list_button'); 114 $template->set_prefilter('index', 'user_collections_thumbnails_list_cssjs');115 126 116 127 return $tpl_thumbnails_var; … … 133 144 } 134 145 135 // add css & js and menu136 function user_collections_thumbnails_list_cssjs($content, &$smarty)137 {138 $content.= file_get_contents(USER_COLLEC_PATH.'template/thumbnails_css_js.tpl');139 return $content;140 }141 142 146 143 147 // +-----------------------------------------------------------------------+ … … 167 171 // get all collections 168 172 $query = ' 169 SELECT id, name, nb_images , active173 SELECT id, name, nb_images 170 174 FROM '.COLLECTIONS_TABLE.' 171 175 WHERE user_id = '.$user['id'].' … … 173 177 ;'; 174 178 $collections = hash_from_query($query, 'id'); 179 180 foreach ($collections as &$col) 181 { 182 $col["name"] = trigger_event("render_category_name", $col["name"]); 183 } 184 unset($col); 175 185 176 186 $template->assign(array( … … 214 224 { 215 225 $query = ' 216 SELECT *226 SELECT id, name, nb_images 217 227 FROM '.COLLECTIONS_TABLE.' 218 228 WHERE user_id = '.$user['id'].' 219 ORDER BY 220 active DESC, 221 date_creation DESC 229 ORDER BY date_creation DESC 222 230 ;'; 223 231 $collections = array_values(hash_from_query($query, 'id')); … … 226 234 for ($i=0; $i<$max && $i<count($collections); $i++) 227 235 { 228 $collections[$i]['U_EDIT'] = USER_COLLEC_PUBLIC.'edit/'.$collections[$i]['id']; 236 $collections[$i]['name'] = trigger_event('render_category_name', $collections[$i]['name']); 237 $collections[$i]['u_edit'] = USER_COLLEC_PUBLIC.'edit/'.$collections[$i]['id']; 229 238 $data['collections'][] = $collections[$i]; 230 239 } … … 239 248 $data['U_CREATE'] = add_url_params(USER_COLLEC_PUBLIC, array('action'=>'new','col_id'=>'0','redirect'=>'true')); 240 249 241 $template->set_template_dir(USER_COLLEC_PATH . 'template/');242 250 $block->set_title('<a href="'.USER_COLLEC_PUBLIC.'">'.l10n('Collections').'</a>'); 243 $block->template = 'menublock_user_collec.tpl';251 $block->template = realpath(USER_COLLEC_PATH . 'template/menublock.tpl'); 244 252 $block->data = $data; 245 253 } -
extensions/UserCollections/include/functions.inc.php
r23361 r23551 1 1 <?php 2 2 defined('USER_COLLEC_PATH') or die('Hacking attempt!'); 3 4 function get_current_collection_id($create=true)5 {6 global $user;7 8 // active in db9 $query = '10 SELECT id11 FROM '.COLLECTIONS_TABLE.'12 WHERE13 active = 114 AND user_id = '.$user['id'].'15 ;';16 $result = pwg_query($query);17 18 if (pwg_db_num_rows($result))19 {20 list($col_id) = pwg_db_fetch_row($result);21 return $col_id;22 }23 24 // new one25 if ($create)26 {27 $UserCollection = new UserCollection('new', array(), 'temp', 1);28 return $UserCollection->getParam('id');29 }30 31 return false;32 }33 3 34 4 function uc_check_email_validity($mail_address) -
extensions/UserCollections/include/install.inc.php
r20090 r23551 24 24 `name` varchar(255) NOT NULL, 25 25 `date_creation` datetime NOT NULL, 26 `comment` text NULL, 26 27 `nb_images` mediumint(8) NOT NULL DEFAULT 0, 27 `active` tinyint(1) DEFAULT 0,28 28 `public` tinyint(1) DEFAULT 0, 29 29 `public_id` varchar(10) NULL, … … 48 48 pwg_query('ALTER TABLE `'.$prefixeTable.'collection_images` ADD `add_date` DATETIME NULL;'); 49 49 } 50 51 $result = pwg_query('SHOW COLUMNS FROM `'.$prefixeTable.'collections` LIKE "comment";'); 52 if (!pwg_db_num_rows($result)) 53 { 54 pwg_query('ALTER TABLE `'.$prefixeTable.'collections` ADD `comment` TEXT NULL;'); 55 pwg_query('ALTER TABLE `'.$prefixeTable.'collections` DROP `active`;'); 56 } 50 57 } 51 58 -
extensions/UserCollections/include/ws_functions.inc.php
r23361 r23551 12 12 array( 13 13 'name' => array(), 14 'comment' => array('default' => null), 14 15 'user_id' => array('default' => null, 'info'=>'Admin parameter, default is current user'), 15 'active' => array('default' => 0),16 16 'public' => array('default' => 0), 17 17 ), … … 32 32 'ws_collections_getList', 33 33 array( 34 'col_id' => array('default' => null),35 34 'user_id' => array('default' => null, 'info'=>'Admin parameter, default is current user'), 36 35 'name' => array('default' => null), 37 36 'public' => array('default' => null), 38 'active' => array('default' => null), 39 ), 40 'Retrive a list of collections.' 37 'per_page' => array('default'=>100, 'maxValue'=>ceil($conf['ws_max_images_per_page']/10)), 38 'page' => array('default'=>0), 39 'order' => array('default'=>'username ASC, name ASC'), 40 ), 41 'Returns a list of collections.' 41 42 ); 42 43 … … 81 82 'default'=>array('id','name','url','path'), 82 83 'flags'=>WS_PARAM_FORCE_ARRAY, 83 'info'=>'Available options are: id, file, name, url, path'84 'info'=>'Available options are: id,file,name,url,path,date_creation,collection_add_date,filesize,width,height' 84 85 ), 85 86 ), 86 87 'Returns a serialized version of the collection in CSV.<br>The return type is plain/text whatever you select as response format.' 88 ); 89 90 $service->addMethod( 91 'pwg.collections.getInfo', 92 'ws_collections_getInfo', 93 array( 94 'col_id' => array('info'=>'The current user must be admin or owner of the collection'), 95 ), 96 'Returns basic info about a collection.' 87 97 ); 88 98 } … … 135 145 } 136 146 137 // check active 138 if ($params['active'] != 0 and $params['active'] != 1) 139 { 140 return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid "active" value, 0 or 1.'); 141 } 142 143 $UserCollection = new UserCollection('new', array(), $params['name'], $params['active'], $params['public'], $params['user_id']); 144 145 $infos = array_change_key_case($UserCollection->getCollectionInfo(), CASE_LOWER); 146 147 return $infos; 147 $UserCollection = new UserCollection('new', $params['name'], $params['comment'], $params['public'], $params['user_id']); 148 149 return array_change_key_case($UserCollection->getCollectionInfo(), CASE_LOWER); 148 150 } 149 151 … … 233 235 } 234 236 235 // check collection id236 if ( !empty($params['col_id']) and !preg_match('#^[0-9]+$#', $params['col_id']) )237 {238 return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid collection id');239 }240 241 237 // check public 242 238 if ( !empty($params['public']) and $params['public'] != 0 and $params['public'] != 1 ) … … 245 241 } 246 242 247 // check active248 if ( !empty($params['active']) and $params['active'] != 0 and $params['active'] != 1 )249 {250 return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid "active" value, 0 or 1.');251 }252 253 243 // search 254 244 $where_clauses = array('1=1'); 255 if (!empty($params['col_id']))256 {257 $where_clauses[] = 'c.id = '.$params['col_id'];258 }259 245 if (!empty($params['user_id'])) 260 246 { … … 265 251 $where_clauses[] = 'public = '.$params['public']; 266 252 } 267 if (!empty($params['active']))268 {269 $where_clauses[] = 'active = '.$params['active'];270 }271 253 if (!empty($params['name'])) 272 254 { 273 255 $where_clauses[] = 'name LIKE("%'.pwg_db_real_escape_string($params['name']).'%")'; 274 256 } 257 258 $order_by = !empty($params['order']) ? $params['order'] : 'username ASC, name ASC'; 275 259 276 260 $query = ' … … 283 267 WHERE 284 268 '.implode("\n AND ", $where_clauses).' 285 ORDER BY username ASC, name ASC 269 ORDER BY '.$order_by.' 270 LIMIT '.(int)$params['per_page'].' OFFSET '.(int)($params['per_page']*$params['page']).' 286 271 ;'; 287 272 $sets = hash_from_query($query, 'id'); 288 273 289 $ ret= array();274 $data = array(); 290 275 foreach ($sets as $row) 291 276 { 292 $ ret[] = array(277 $data[] = array( 293 278 'id' => $row['id'], 294 279 'name' => $row['name'], 280 'comment' => $row['comment'], 295 281 'nb_images' => $row['nb_images'], 296 'active' => (bool)$row['active'],297 282 'public' => (bool)$row['public'], 298 283 'date_creation' => $row['date_creation'], … … 303 288 ); 304 289 } 290 291 return array( 292 'paging' => new PwgNamedStruct(array( 293 'page' => $params['page'], 294 'per_page' => $params['per_page'], 295 'count' => count($data) 296 )), 297 'collections' => new PwgNamedArray( 298 $data, 299 'collection' 300 ) 301 ); 305 302 306 303 return $ret; … … 413 410 WHERE 414 411 '. implode("\n AND ", $where_clauses).' 415 GROUP BY i.id 416 '.$order_by.' 417 LIMIT '.(int)$params['per_page'].' OFFSET '.(int)($params['per_page']*$params['page']); 418 419 $result = pwg_query($query); 420 while ($row = pwg_db_fetch_assoc($result)) 421 { 422 $image = array(); 423 foreach (array('id', 'width', 'height', 'hit') as $k) 412 GROUP BY i.id 413 '.$order_by.' 414 LIMIT '.(int)$params['per_page'].' OFFSET '.(int)($params['per_page']*$params['page']).' 415 ;'; 416 417 $result = pwg_query($query); 418 while ($row = pwg_db_fetch_assoc($result)) 424 419 { 425 if (isset($row[$k])) 420 $image = array(); 421 foreach (array('id', 'width', 'height', 'hit') as $k) 426 422 { 427 $image[$k] = (int)$row[$k]; 423 if (isset($row[$k])) 424 { 425 $image[$k] = (int)$row[$k]; 426 } 428 427 } 428 foreach (array('file', 'name', 'comment', 'date_creation', 'date_available') as $k) 429 { 430 $image[$k] = $row[$k]; 431 } 432 $image = array_merge($image, ws_std_get_urls($row)); 433 434 array_push($images, $image); 429 435 } 430 foreach (array('file', 'name', 'comment', 'date_creation', 'date_available') as $k)431 {432 $image[$k] = $row[$k];433 }434 $image = array_merge($image, ws_std_get_urls($row));435 436 array_push($images, $image);437 436 } 438 } 439 440 return array('images' => array( 441 WS_XML_ATTRIBUTES => array( 442 'page' => $params['page'], 443 'per_page' => $params['per_page'], 444 'count' => count($images) 445 ), 446 WS_XML_CONTENT => new PwgNamedArray( 447 $images, 448 'image', 449 ws_std_get_image_xml_attributes() 450 ), 451 )); 437 438 return array( 439 'paging' => new PwgNamedStruct(array( 440 'page' => $params['page'], 441 'per_page' => $params['per_page'], 442 'count' => count($images) 443 )), 444 'images' => new PwgNamedArray( 445 $images, 446 'image', 447 ws_std_get_image_xml_attributes() 448 ) 449 ); 452 450 } 453 451 catch (Exception $e) … … 491 489 } 492 490 } 491 492 /** 493 * get info about a collection 494 */ 495 function ws_collections_getInfo($params, &$service) 496 { 497 global $conf, $user; 498 499 // check status 500 if (is_a_guest()) 501 { 502 return new PwgError(403, 'Forbidden'); 503 } 504 505 // check collection id 506 if (!preg_match('#^[0-9]+$#', $params['col_id'])) 507 { 508 return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid collection id'); 509 } 510 511 try { 512 $UserCollection = new UserCollection($params['col_id']); 513 514 return array_change_key_case($UserCollection->getCollectionInfo(), CASE_LOWER); 515 } 516 catch (Exception $e) 517 { 518 return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid collection id'); 519 } 520 } 521 493 522 ?> -
extensions/UserCollections/language/en_UK/plugin.lang.php
r23361 r23551 8 8 $lang['Collection name:'] = 'Collection name:'; 9 9 $lang['Create a new collection'] = 'Create a new collection'; 10 $lang['Unsaved collections'] = 'Unsaved collections';11 $lang['save'] = 'save';12 $lang['set active'] = 'set active';13 $lang['Saved collections'] = 'Saved collections';14 10 $lang['See all my collections'] = 'See all my collections'; 15 11 $lang['Please give a name'] = 'Please give a name'; … … 24 20 $lang['You have no collection'] = 'You have no collection'; 25 21 $lang['You have %d collections'] = 'You have %d collections'; 26 $lang['active'] = 'active';27 22 $lang['Save'] = 'Save'; 28 23 $lang['%d more...'] = '%d more...'; -
extensions/UserCollections/language/fr_FR/plugin.lang.php
r23361 r23551 8 8 $lang['Collection name:'] = 'Nom de la collection:'; 9 9 $lang['Create a new collection'] = 'Créer une nouvelle collection'; 10 $lang['Unsaved collections'] = 'Collections temporaires';11 $lang['save'] = 'sauvegarder';12 $lang['set active'] = 'choisir comme collection active';13 $lang['Saved collections'] = 'Collections sauvegardées';14 10 $lang['See all my collections'] = 'Voir toutes mes collections'; 15 11 $lang['Please give a name'] = 'Veuillez donner un nom'; … … 24 20 $lang['You have no collection'] = 'Vous n\'avez aucune collection'; 25 21 $lang['You have %d collections'] = 'Vous avez %d collections'; 26 $lang['active'] = 'active';27 22 $lang['Save'] = 'Sauvegarder'; 28 23 $lang['%d more...'] = 'et %d autres...'; -
extensions/UserCollections/main.inc.php
r23361 r23551 19 19 20 20 defined('USER_COLLEC_ID') or define('USER_COLLEC_ID', basename(dirname(__FILE__))); 21 define('USER_COLLEC_PATH', PHPWG_PLUGINS_PATH . USER_COLLEC_ID . '/');22 define('COLLECTIONS_TABLE', $prefixeTable.'collections');23 define('COLLECTION_IMAGES_TABLE', $prefixeTable.'collection_images');24 define('USER_COLLEC_ADMIN', get_root_url() . 'admin.php?page=plugin-' . USER_COLLEC_ID);25 define('USER_COLLEC_PUBLIC', get_absolute_root_url() . make_index_url(array('section' => 'collections')) . '/');21 define('USER_COLLEC_PATH', PHPWG_PLUGINS_PATH . USER_COLLEC_ID . '/'); 22 define('COLLECTIONS_TABLE', $prefixeTable.'collections'); 23 define('COLLECTION_IMAGES_TABLE', $prefixeTable.'collection_images'); 24 define('USER_COLLEC_ADMIN', get_root_url() . 'admin.php?page=plugin-' . USER_COLLEC_ID); 25 define('USER_COLLEC_PUBLIC', get_absolute_root_url() . make_index_url(array('section' => 'collections')) . '/'); 26 26 define('USER_COLLEC_VERSION', 'auto'); 27 27 -
extensions/UserCollections/maintain.inc.php
r20090 r23551 24 24 global $prefixeTable; 25 25 26 pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "user_collections" LIMIT 1;'); 26 27 pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'collections`;'); 27 28 pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'collection_images`;'); -
extensions/UserCollections/template/collection_edit.tpl
r23217 r23551 1 {combine_css path=$USER_COLLEC_PATH|@cat:"template/style.css"} 2 {combine_script id='ZeroClipboard' path=$USER_COLLEC_PATH|@cat:"template/resources/ZeroClipboard.min.js"} 3 4 {combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'} 5 {combine_css path="themes/default/js/plugins/colorbox/style2/colorbox.css"} 1 {combine_css path=$USER_COLLEC_PATH|cat:'template/style_collections.css'} 2 {combine_script id='ZeroClipboard' path=$USER_COLLEC_PATH|cat:'template/resources/ZeroClipboard.min.js'} 3 {include file=$USER_COLLEC_ABS_PATH|cat:'template/thumbnails_colorbox.tpl'} 6 4 7 5 {footer_script require='jquery'} … … 9 7 ZeroClipboard.setDefaults( {ldelim} moviePath: "{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/ZeroClipboard.swf" } ); 10 8 var clip = new ZeroClipboard(); 9 11 10 clip.glue(jQuery("#publicURL .button").get()); 12 11 clip.addEventListener('onMouseOver', function() {ldelim} … … 42 41 jQuery("#mail_form").css('background-color', jQuery("#the_page #content").css('background-color')); 43 42 {/if} 43 44 jQuery("#edit_form_show").click(function() {ldelim} 45 jQuery("#edit_form_show").hide(); 46 jQuery(".additional_info").hide(); 47 jQuery("#edit_form").show(); 48 }); 49 jQuery("#edit_form_hide").click(function() {ldelim} 50 jQuery("#edit_form_show").show(); 51 jQuery(".additional_info").show(); 52 jQuery("#edit_form").hide(); 53 }); 44 54 {/footer_script} 45 55 … … 61 71 62 72 63 {if $collection} 73 {if !empty($CONTENT_DESCRIPTION)} 74 <div class="additional_info"> 75 {$CONTENT_DESCRIPTION} 76 </div> 77 {/if} 78 79 <p style="text-align:center;"><input type="submit" id="edit_form_show" value="{'Edit'|@translate}"></p> 80 64 81 {* <!-- edit collection -->*} 65 <form action="{$F_ACTION}" method="post" >82 <form action="{$F_ACTION}" method="post" id="edit_form" style="display:none;"> 66 83 <fieldset id="colProperties"> 67 84 <legend>{'Properties'|@translate}</legend> … … 69 86 <p class="title"><label for="name">{'Name'|@translate}</label></p> 70 87 <p><input type="text" name="name" id="name" value="{$collection.NAME|escape:html}" size="60"></p> 88 89 <p class="title"><label for="comment">{'Description'|@translate}</label></p> 90 <p><textarea name="comment" id="comment" style="width:400px;height:100px;">{$collection.COMMENT}</textarea></p> 91 71 92 {if $user_collections.allow_public} 72 93 <p class="title">{'Public collection'|@translate}</p> … … 80 101 </p> 81 102 {/if} 103 82 104 <p> 83 105 <input type="submit" name="save_col" value="{'Save'|@translate}"> 84 <a href="{$U_LIST}" rel="nofollow">{'Return to collections list'|@translate}</a>106 <a id="edit_form_hide">{'Cancel'|@translate}</a> 85 107 </p> 86 108 </fieldset> 87 109 </form> 110 88 111 89 112 {* <!-- send collection by mail -->*} … … 148 171 {/if} 149 172 173 150 174 {* <!-- collection content -->*} 151 175 {if $collection.NB_IMAGES > 0} … … 158 182 159 183 {if !empty($navbar)}{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if} 160 {/if}161 184 162 {if $clear}<div style="clear: both;"></div> 185 186 {if isset($clear)}<div style="clear: both;"></div> 163 187 </div>{/if} 164 188 </div>{* <!-- content --> *} -
extensions/UserCollections/template/collection_view.tpl
r23217 r23551 1 {combine_css path=$USER_COLLEC_PATH|@cat:"template/style.css"} 1 {combine_css path=$USER_COLLEC_PATH|cat:'template/style_collections.css'} 2 {include file=$USER_COLLEC_ABS_PATH|cat:'template/thumbnails_colorbox.tpl'} 2 3 3 4 … … 17 18 {/if} 18 19 20 {if !empty($CONTENT_DESCRIPTION)} 21 <div class="additional_info"> 22 {$CONTENT_DESCRIPTION} 23 </div> 24 {/if} 19 25 20 26 {if !empty($THUMBNAILS)} … … 26 32 {if !empty($navbar)}{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if} 27 33 28 {if $clear}<div style="clear: both;"></div>34 {if isset($clear)}<div style="clear: both;"></div> 29 35 </div>{/if} 30 36 </div>{* <!-- content --> *} -
extensions/UserCollections/template/collections_list.tpl
r23361 r23551 1 {combine_css path=$USER_COLLEC_PATH| @cat:"template/style.css"}1 {combine_css path=$USER_COLLEC_PATH|cat:'template/style_collections.css'} 2 2 3 3 {footer_script require='jquery'} … … 39 39 {/if} 40 40 41 {if $clear}<div style="clear: both;"></div>41 {if isset($clear)}<div style="clear: both;"></div> 42 42 </div>{/if} 43 43 </div>{* <!-- content --> *} -
extensions/UserCollections/template/menublock.tpl
r23361 r23551 11 11 {foreach from=$block->data.collections item=col} 12 12 <li> 13 <a href="{$col.U_EDIT}" {*if $col.active}style="font-weight:bold;"{/if*} rel="nofollow">{$col.name}</a> 14 {*if $col.active}<i class="menuInfoCat">({'active'|@translate})</i> {/if*} 13 <a href="{$col.u_edit}" rel="nofollow">{$col.name}</a> 15 14 <span class="menuInfoCat">[<span class="nbImagesCollec-{$col.id}">{$col.nb_images}</span>]</span> 16 15 </li> 17 16 {/foreach} 18 {if $block->data.MORE}<li class="menuInfoCat"><a href="{$block->data.U_LIST}">{'%d more...'|@translate|sprintf:$block->data.MORE}</a></li>{/if}17 {if isset($block->data.MORE)}<li class="menuInfoCat"><a href="{$block->data.U_LIST}">{'%d more...'|@translate|sprintf:$block->data.MORE}</a></li>{/if} 19 18 {/strip}</ul> 20 19 {/if} -
extensions/UserCollections/template/style_collections.css
r23361 r23551 43 43 } 44 44 45 /* .thumbnailCategory.activeCollection {46 border:1px solid #999;47 } */48 45 .thumbnailCategory { 49 46 position:relative; … … 58 55 display:block; 59 56 } 60 /* .thumbnailCategory .collectionActive {61 font-weight:normal;62 font-style:italic;63 } */64 57 65 58 /* SEND BY MAIL */ … … 83 76 padding:3px; 84 77 } 85 86 /* TipTip CSS - Version 1.2 */87 #tiptip_holder {88 display: none;89 position: absolute;90 top: 0;91 left: 0;92 z-index: 99999;93 }94 #tiptip_holder.tip_top {95 padding-bottom: 5px;96 }97 #tiptip_holder.tip_bottom {98 padding-top: 5px;99 }100 #tiptip_holder.tip_right {101 padding-left: 5px;102 }103 #tiptip_holder.tip_left {104 padding-right: 5px;105 }106 #tiptip_content {107 font-size: 11px;108 color: #fff;109 text-shadow: 0 0 2px #000;110 padding: 4px 8px;111 border: 1px solid rgba(255,255,255,0.25);112 background-color: rgb(25,25,25);113 background-color: rgba(25,25,25,0.92);114 background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(#000));115 border-radius: 3px;116 -webkit-border-radius: 3px;117 -moz-border-radius: 3px;118 box-shadow: 0 0 3px #555;119 -webkit-box-shadow: 0 0 3px #555;120 -moz-box-shadow: 0 0 3px #555;121 }122 #tiptip_arrow, #tiptip_arrow_inner {123 position: absolute;124 border-color: transparent;125 border-style: solid;126 border-width: 6px;127 height: 0;128 width: 0;129 }130 #tiptip_holder.tip_top #tiptip_arrow {131 border-top-color: #fff;132 border-top-color: rgba(255,255,255,0.35);133 }134 #tiptip_holder.tip_bottom #tiptip_arrow {135 border-bottom-color: #fff;136 border-bottom-color: rgba(255,255,255,0.35);137 }138 #tiptip_holder.tip_right #tiptip_arrow {139 border-right-color: #fff;140 border-right-color: rgba(255,255,255,0.35);141 }142 #tiptip_holder.tip_left #tiptip_arrow {143 border-left-color: #fff;144 border-left-color: rgba(255,255,255,0.35);145 }146 #tiptip_holder.tip_top #tiptip_arrow_inner {147 margin-top: -7px;148 margin-left: -6px;149 border-top-color: rgb(25,25,25);150 border-top-color: rgba(25,25,25,0.92);151 }152 #tiptip_holder.tip_bottom #tiptip_arrow_inner {153 margin-top: -5px;154 margin-left: -6px;155 border-bottom-color: rgb(25,25,25);156 border-bottom-color: rgba(25,25,25,0.92);157 }158 #tiptip_holder.tip_right #tiptip_arrow_inner {159 margin-top: -6px;160 margin-left: -5px;161 border-right-color: rgb(25,25,25);162 border-right-color: rgba(25,25,25,0.92);163 }164 #tiptip_holder.tip_left #tiptip_arrow_inner {165 margin-top: -6px;166 margin-left: -7px;167 border-left-color: rgb(25,25,25);168 border-left-color: rgba(25,25,25,0.92);169 } -
extensions/UserCollections/template/style_thumbnails.css
r23361 r23551 27 27 left:0; 28 28 box-shadow:2px 2px 10px #000; 29 z-index:1000; 29 30 } 30 31 -
extensions/UserCollections/template/themes/stripped.tpl
r20093 r23551 8 8 <ul class="categoryActions group1"> 9 9 {if isset($U_CADDIE) } 10 <li class="mainAction"><a href="{$U_CADDIE}" title="{' add to caddie'|@translate}">{'caddie'|@translate}</a></li>10 <li class="mainAction"><a href="{$U_CADDIE}" title="{'Add to caddie'|@translate}">{'Caddie'|@translate}</a></li> 11 11 {/if} 12 12 -
extensions/UserCollections/template/thumbnails_colorbox.tpl
r20097 r23551 1 1 {combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'} 2 {combine_css path= "themes/default/js/plugins/colorbox/style2/colorbox.css"}2 {combine_css path='themes/default/js/plugins/colorbox/style2/colorbox.css'} 3 3 4 4 {footer_script} … … 8 8 title: function() {ldelim} 9 9 var title = $(this).children("img.thumbnail").attr("alt"); 10 {if $F_ACTION} title+= ' · <a href="{$collection_toggle_url}&collection_toggle='+ $(this).data('id') +'" class="addCollection" data-id="'+ $(this).data('id') +'">{'Remove from collection'|@translate}</a>';{/if}10 {if $F_ACTION} title+= ' · <a class="addCollection" data-id="'+ $(this).data('id') +'" rel="nofollow">{'Remove from collection'|@translate}</a>';{/if} 11 11 title+= ' · <a href="'+ $(this).attr('href') +'" target="_blank">{'jump to photo'|@translate} →</a>'; 12 12 return title; -
extensions/UserCollections/template/thumbnails_css_js.tpl
r23361 r23551 1 {combine_css path=$USER_COLLEC_PATH| @cat:"template/style_thumbnails.css"}1 {combine_css path=$USER_COLLEC_PATH|cat:'template/style_thumbnails.css'} 2 2 3 3 {* <!-- all pages but collection edit page --> *} … … 29 29 jQuery(this).val("{'Name'|@translate}"); 30 30 31 if (name == "" ) return;31 if (name == "" || name == null) return; 32 32 33 33 jQuery.ajax({ldelim} … … 39 39 method: "pwg.collections.create", 40 40 name: name, 41 active: 1,42 41 }, 43 42 success: function(data) {ldelim} … … 103 102 if (method == "pwg.collections.addImages" && col_ids.indexOf(col_id) == -1) 104 103 col_ids[ col_ids.length ] = col_id; 105 else 104 else if (method == "pwg.collections.removeImages") 106 105 col_ids.splice(col_ids.indexOf(col_id), 1); 107 106 $target.data("col", col_ids); … … 206 205 }); 207 206 208 // not working, the event is fired twice209 207 event.stopPropagation(); 210 208 event.preventDefault();
Note: See TracChangeset
for help on using the changeset viewer.