Changeset 20097 for extensions/UserCollections
- Timestamp:
- Jan 13, 2013, 12:29:56 AM (11 years ago)
- Location:
- extensions/UserCollections
- Files:
-
- 1 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserCollections/include/collections.inc.php
r20093 r20097 250 250 } 251 251 252 253 // add links for colorbox254 add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_in_collection', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);255 256 252 // add remove item links 257 253 $template->set_prefilter('index_thumbnails', 'user_collections_thumbnails_list_prefilter'); 258 254 259 255 // thumbnails 260 define('USER_COLLEC_REMOVE_GTHUMB', true);261 256 include(USER_COLLEC_PATH . '/include/display_thumbnails.inc.php'); 262 257 … … 335 330 function user_collections_thumbnails_in_collection($tpl_thumbnails_var, $pictures) 336 331 { 337 global $template, $page; 338 339 $template->set_filename('index_thumbnails', dirname(__FILE__).'/../template/thumbnails.tpl'); 332 global $template; 340 333 341 334 foreach ($tpl_thumbnails_var as &$thumbnail) … … 354 347 } 355 348 349 $template->set_prefilter('index_thumbnails', 'user_collections_add_colorbox'); 350 356 351 return $tpl_thumbnails_var; 357 352 } 358 353 354 function user_collections_add_colorbox($content) 355 { 356 // add datas 357 $search = '<a href="{$thumbnail.URL}"'; 358 $replace = $search.' class="preview-box" data-src="{$thumbnail.FILE_SRC}" data-id="{$thumbnail.id}"'; 359 360 // colorbox script 361 $content.= file_get_contents(USER_COLLEC_PATH.'template/thumbnails_colorbox.tpl'); 362 363 return str_replace($search, $replace, $content); 364 } 365 359 366 ?> -
extensions/UserCollections/include/display_thumbnails.inc.php
r20093 r20097 75 75 } 76 76 77 78 // display 79 if (defined('USER_COLLEC_REMOVE_GTHUMB')) 80 { 81 global $uc_nb_image_page_save; 82 83 $user['nb_image_page'] = $uc_nb_image_page_save['user']; 84 $page['nb_image_page'] = $uc_nb_image_page_save['page']; 85 remove_event_handler('loc_end_index_thumbnails', 'process_GThumb', 50); 86 remove_event_handler('loc_end_index', 'GThumb_remove_thumb_size'); 87 } 77 // add links for colorbox 78 add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_in_collection', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 88 79 89 80 include(PHPWG_ROOT_PATH . 'include/category_default.inc.php'); -
extensions/UserCollections/include/events.inc.php
r20093 r20097 2 2 defined('USER_COLLEC_PATH') or die('Hacking attempt!'); 3 3 4 # this file contains all functions directly called by the triggers # 5 6 /* compatibility fix with Gthumb+ */ 7 function user_collections_save_pagination() 8 { 9 global $user, $page, $uc_nb_image_page_save; 10 11 $uc_nb_image_page_save['user'] = $user['nb_image_page']; 12 $uc_nb_image_page_save['page'] = $page['nb_image_page']; 13 } 14 15 4 // +-----------------------------------------------------------------------+ 5 // | SECTION INIT 6 // +-----------------------------------------------------------------------+ 16 7 /* define page section from url */ 17 8 function user_collections_section_init() … … 52 43 53 44 54 /* add buttons on thumbnails list */ 45 // +-----------------------------------------------------------------------+ 46 // | CATEGORY PAGE 47 // +-----------------------------------------------------------------------+ 48 /* toggle an image, in case of no javascript or first call (must create the collection) */ 55 49 function user_collections_index_actions() 56 50 { … … 71 65 } 72 66 67 /* add buttons on thumbnails list */ 73 68 function user_collections_thumbnails_list($tpl_thumbnails_var, $pictures) 74 69 { … … 77 72 global $page, $template, $UserCollection; 78 73 79 // the prefilter is different on collection page 80 if (isset($page['section']) and ($page['section'] == 'collections' or $page['section'] == 'download')) return $tpl_thumbnails_var; 74 // the content is different on collection edition page and no button on batch downloader set edition page 75 if ( (@$page['section'] == 'collections' and @$page['sub_section']=='edit') or @$page['section'] == 'download') 76 { 77 return $tpl_thumbnails_var; 78 } 81 79 82 80 // get existing collections … … 96 94 } 97 95 98 // if the collection is createdwe don't use AJAX to force menu refresh96 // if the collection doesn't exists we don't use AJAX to force menu refresh 99 97 if ($col_id === false) 100 98 { … … 102 100 } 103 101 104 105 $ self_url = duplicate_index_url(array(), array('collection_toggle'));102 // template vars 103 $url = duplicate_index_url(array(), array('collection_toggle')); 106 104 107 105 foreach ($tpl_thumbnails_var as &$thumbnail) … … 114 112 unset($thumbnail); 115 113 116 // thumbnails buttons117 114 $template->assign(array( 118 115 'USER_COLLEC_PATH' => USER_COLLEC_PATH, 119 'collection_toggle_url' => add_url_params($ self_url, array('collection_toggle'=>'')),116 'collection_toggle_url' => add_url_params($url, array('collection_toggle'=>'')), 120 117 )); 118 119 // thumbnails buttons 121 120 $template->set_prefilter('index_thumbnails', 'user_collections_thumbnails_list_prefilter'); 122 121 … … 127 126 { 128 127 // add links 129 $search = ' <span class="wrap1">';130 $replace = $search.'128 $search = '#(<span class="wrap1">|<li class="gthumb">)#'; 129 $replace = '$1 131 130 {strip}<a class="addCollection" href="{$collection_toggle_url}{$thumbnail.id}" data-id="{$thumbnail.id}" rel="nofollow"> 132 {if $COL_ID or $thumbnail.COLLECTION_SELECTED} 131 <span class="uc_remove" {if not $COL_ID and not $thumbnail.COLLECTION_SELECTED}style="display:none;"{/if}> 133 132 {\'Remove from collection\'|@translate} <img src="{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/image_delete.png" title="{\'Remove from collection\'|@translate}"> 134 {else} 133 </span> 134 <span class="uc_add" {if $COL_ID or $thumbnail.COLLECTION_SELECTED}style="display:none;"{/if}> 135 135 {\'Add to collection\'|@translate} <img src="{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/image_add.png" title="{\'Add to collection\'|@translate}"> 136 {/if} 136 </span> 137 137 </a>{/strip}'; 138 138 139 139 // custom CSS and AJAX request 140 140 $content.= file_get_contents(USER_COLLEC_PATH.'template/thumbnails_css_js.tpl'); 141 142 return str_replace($search, $replace, $content); 143 } 144 145 141 142 return preg_replace($search, $replace, $content); 143 } 144 145 146 // +-----------------------------------------------------------------------+ 147 // | PICTURE PAGE 148 // +-----------------------------------------------------------------------+ 146 149 /* add button on picture page */ 147 150 function user_collections_picture_page() … … 190 193 191 194 192 /* menu block */ 195 // +-----------------------------------------------------------------------+ 196 // | MENU BLOCK 197 // +-----------------------------------------------------------------------+ 198 /* register block */ 193 199 function user_collections_add_menublock($menu_ref_arr) 194 200 { … … 201 207 } 202 208 209 /* fill block */ 203 210 function user_collections_applymenu($menu_ref_arr) 204 211 { 205 212 $max = 6; 206 213 207 global $template, $ conf, $user, $UserCollection;214 global $template, $page, $conf, $user, $UserCollection; 208 215 $menu = &$menu_ref_arr[0]; 216 217 // the editable counter is for the active collection, except if we are currently editing a collection 218 $col_in_edit = 0; 219 if ( @$page['section'] == 'collections' and @$page['sub_section']=='edit' and !empty($page['col_id']) ) 220 { 221 $col_in_edit = $page['col_id']; 222 } 209 223 210 224 if (($block = $menu->get_block('mbUserCollection')) != null) … … 223 237 for ($i=0; $i<$max && $i<count($collections); $i++) 224 238 { 239 $collections[$i]['count_handler'] = $col_in_edit!=0 ? $collections[$i]['id']==$col_in_edit : $collections[$i]['active']; 225 240 $collections[$i]['U_EDIT'] = USER_COLLEC_PUBLIC.'edit/'.$collections[$i]['id']; 226 241 array_push($data['collections'], $collections[$i]); -
extensions/UserCollections/main.inc.php
r20090 r20097 32 32 { 33 33 // collections page 34 add_event_handler('loc_begin_index', 'user_collections_save_pagination', EVENT_HANDLER_PRIORITY_NEUTRAL-10);35 34 add_event_handler('loc_end_section_init', 'user_collections_section_init'); 36 35 add_event_handler('loc_end_index', 'user_collections_page', EVENT_HANDLER_PRIORITY_NEUTRAL-10); … … 38 37 // thumbnails actions 39 38 add_event_handler('loc_end_index', 'user_collections_index_actions'); 40 add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_list', EVENT_HANDLER_PRIORITY_NEUTRAL , 2);39 add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_list', EVENT_HANDLER_PRIORITY_NEUTRAL-10, 2); 41 40 42 41 // picture action -
extensions/UserCollections/template/menublock_user_collec.tpl
r16698 r20097 3 3 <p> 4 4 {if $block->data.NB_COL == 0} 5 {'You have no collection'|@translate |sprintf:$block->data.NB_COL}5 {'You have no collection'|@translate} 6 6 {else} 7 7 <a href="{$block->data.U_LIST}">{$pwg->l10n_dec('You have %d collection', 'You have %d collections', $block->data.NB_COL)}</a> … … 10 10 <ul>{strip} 11 11 {foreach from=$block->data.collections item=col} 12 <li> {if $col.active}13 <a href="{$col.U_EDIT}" style="font-weight:bold;" rel="nofollow">{$col.name}</a> <i class="menuInfoCat">({'active'|@translate})</i> <span class="menuInfoCat">[<span class="nbImagesCollec">{$col.nb_images}</span>]</span>14 {else}15 < a href="{$col.U_EDIT}" rel="nofollow">{$col.name}</a> <span class="menuInfoCat">[{$col.nb_images}]</span>16 {/if}</li>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} 15 <span class="menuInfoCat">[<span {if $col.count_handler}class="nbImagesCollec"{/if}>{$col.nb_images}</span>]</span> 16 </li> 17 17 {/foreach} 18 18 {if $block->data.MORE}<li class="menuInfoCat">{'%d more...'|@translate|sprintf:$block->data.MORE}</li>{/if} -
extensions/UserCollections/template/thumbnails_css_js.tpl
r20090 r20097 1 1 {html_style} 2 2 .thumbnails .wrap1 {ldelim} position:relative !important; } 3 .wrap1 .addCollection {ldelim} width:100%;height:16px;display:none;position:absolute;top:0;background:rgba(0,0,0,0.8);padding:2px;border-radius:2px;font-size:10px;z-index:100;color:#eee;white-space:nowrap; }4 .wrap1:hover .addCollection {ldelim} display:block; }3 .wrap1 .addCollection, .gthumb .addCollection {ldelim} width:100%;height:16px;display:none;position:absolute;top:0;background:rgba(0,0,0,0.8);padding:2px;border-radius:2px;font-size:10px;z-index:100 !important;color:#eee;white-space:nowrap; } 4 .wrap1:hover .addCollection, .gthumb:hover .addCollection {ldelim} display:block; } 5 5 {/html_style} 6 6 … … 17 17 }).done(function(msg) {ldelim} 18 18 if (msg == "true") {ldelim} 19 $trigger.html('{'Remove from collection'|@translate} <img src="{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/image_delete.png" title="{'Remove from collection'|@translate}">'); 19 $trigger.children(".uc_remove").show(); 20 $trigger.children(".uc_add").hide(); 20 21 jQuery(".nbImagesCollec").html(parseInt(jQuery(".nbImagesCollec").html()) +1); 21 22 } else if (msg == "false") {ldelim} 22 23 {if $COL_ID} 23 $trigger.parent(".wrap1 ").hide("fast", function() {ldelim} $trigger.remove() });24 $trigger.parent(".wrap1, .gthumb").hide("fast", function() {ldelim} $trigger.remove() }); 24 25 if (typeof batchdown_count != 'undefined') batchdown_count-=1; 25 26 {else} 26 $trigger.html('{'Add to collection'|@translate} <img src="{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/image_add.png" title="{'Add to collection'|@translate}">'); 27 $trigger.children(".uc_remove").hide(); 28 $trigger.children(".uc_add").show(); 27 29 {/if} 28 30 jQuery(".nbImagesCollec").html(parseInt(jQuery(".nbImagesCollec").html()) -1); 29 31 } else {ldelim} 30 32 $trigger.html('{'Un unknown error occured'|@translate}');
Note: See TracChangeset
for help on using the changeset viewer.