Changeset 20097 for extensions/UserCollections/include/events.inc.php
- Timestamp:
- Jan 13, 2013, 12:29:56 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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]);
Note: See TracChangeset
for help on using the changeset viewer.