Changeset 16625 for extensions
- Timestamp:
- Jul 11, 2012, 6:44:23 PM (12 years ago)
- Location:
- extensions/UserCollections
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserCollections/include/UserCollection.class.php
r16591 r16625 4 4 class UserCollection 5 5 { 6 // private $conf;7 6 private $data; 8 7 private $images; … … 15 14 function __construct($col_id, $images=array(), $name=null, $active=false, $public=false) 16 15 { 17 global $user, $conf; 18 19 // $this->conf = $conf['user_collections']; 16 global $user; 17 20 18 $this->data = array( 21 19 'col_id' => 0, -
extensions/UserCollections/include/collections.inc.php
r16608 r16625 4 4 # this file is called on basket public page # 5 5 6 global $page, $template, $conf, $user, $tokens ;6 global $page, $template, $conf, $user, $tokens, $pwg_loaded_plugins; 7 7 8 8 switch ($page['sub_section']) … … 132 132 $col['U_DELETE'] = USER_COLLEC_PUBLIC.'&action=delete&col_id='.$col['id']; 133 133 134 if (isset($pwg_loaded_plugins['BatchDownloader'])) 135 { 136 $col['U_DOWNLOAD'] = USER_COLLEC_PUBLIC.'view/'.$col['id'].'&action=advdown_set'; 137 } 138 134 139 if ($col['name'] == 'temp') 135 140 { … … 163 168 'USER_COLLEC_PATH' => USER_COLLEC_PATH, 164 169 'U_VIEW' => $self_url, 170 'collection_toggle_url' => $self_url, 165 171 'U_LIST' => USER_COLLEC_PUBLIC, 166 172 'COL_ID' => $page['col_id'], … … 183 189 184 190 // remove an element 185 if ( isset($_GET[' remove']) and preg_match('#^[0-9]+$#', $_GET['remove']) )186 { 187 $UserCollection->removeImages(array($_GET[' remove']));191 if ( isset($_GET['collection_toggle']) and preg_match('#^[0-9]+$#', $_GET['collection_toggle']) ) 192 { 193 $UserCollection->removeImages(array($_GET['collection_toggle'])); 188 194 } 189 195 190 196 $template->assign('collection', $UserCollection->getCollectionInfo()); 191 197 192 $template->set_prefilter('index_thumbnails', 'user_collections_thumbnails_list_special_prefilter'); 198 // add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_in_collection', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 199 $template->set_prefilter('index_thumbnails', 'user_collections_thumbnails_list_prefilter'); 193 200 194 201 $page['start'] = isset($_GET['start']) ? $_GET['start'] : 0; … … 282 289 283 290 284 function user_collections_thumbnails_list_special_prefilter($content, &$smarty) 285 { 286 // custom style 287 $search[0] = '{/html_style}'; 288 $replace[0] = '.thumbnails .wrap1 {ldelim} position:relative; } 289 .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:0.8em; } 290 .wrap1:hover .addCollection {ldelim} display:block; }' 291 .$search[0]; 292 293 // links 294 $search[1] = '<span class="wrap1">'; 295 $replace[1] = $search[1].' 296 {strip}<a class="addCollection" href="{$U_VIEW}&remove={$thumbnail.id}" data-id="{$thumbnail.id}" rel="nofollow"> 297 {\'Remove from collection\'|@translate} <img src="{$USER_COLLEC_PATH}template/image_delete.png" title="{\'Remove from collection\'|@translate}"> 298 </a>{/strip}'; 299 300 // AJAX request 301 $search[2] = '{/html_style}'; 302 $replace[2] = $search[2].' 303 {footer_script require=\'jquery\'} 304 jQuery(".addCollection").click(function() {ldelim} 305 var toggle_id = jQuery(this).data("id"); 306 var $trigger = jQuery(this); 291 // function user_collections_thumbnails_in_collection($tpl_thumbnails_var, $pictures) 292 // { 293 // global $page; 307 294 308 jQuery.ajax({ldelim}309 type: "POST",310 url: "{$USER_COLLEC_PATH}toggle_image.php",311 data: {ldelim} "col_id": "{$COL_ID}", "toggle_id": toggle_id }312 }).done(function(msg) {ldelim}313 if (msg == "false") {ldelim}314 $trigger.parent(".wrap1").hide("fast", function() {ldelim} $trigger.remove() });315 } else {ldelim}316 $trigger.html(\'{\'Un unknown error occured\'|@translate}\');317 }318 });295 // foreach ($tpl_thumbnails_var as &$thumbnail) 296 // { 297 // $thumbnail['URL'] = duplicate_picture_url( 298 // array( 299 // 'image_id' => $thumbnail['id'], 300 // 'image_file' => $thumbnail['file'], 301 // 'section' => 'collections', 302 // ), 303 // array('start') 304 // ).'/'.$page['col_id']; 305 // } 319 306 320 return false; 321 }); 322 {/footer_script}'; 323 324 return str_replace($search, $replace, $content); 325 } 307 // return $tpl_thumbnails_var; 308 // } 326 309 327 310 ?> -
extensions/UserCollections/include/events.inc.php
r16608 r16625 35 35 } 36 36 } 37 } 38 39 /* collection section */ 37 38 // if ( script_basename() == 'picture' and @$tokens[1] == 'collections' and preg_match('#^[0-9]+$#', @$tokens[2]) ) 39 // { 40 // try 41 // { 42 // $UserCollection = new UserCollection($tokens[2]); 43 // $page['title'].= $conf['level_separator'].l10n('Collection').': <a href="'.USER_COLLEC_PUBLIC . 'view/'.$tokens[2].'">'.$UserCollection->getParam('name').'</a>'; 44 // $page['items'] = $UserCollection->getImages(); 45 // $page['col_id'] = $tokens[2]; 46 // } catch (Exception $e) {} 47 // } 48 } 49 50 /* collections section */ 40 51 function user_collections_page() 41 52 { … … 116 127 function user_collections_thumbnails_list_prefilter($content, &$smarty) 117 128 { 118 // custom style 119 $search[0] = '{/html_style}'; 120 $replace[0] = '.thumbnails .wrap1 {ldelim} position:relative; } 121 .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:0.8em; } 122 .wrap1:hover .addCollection {ldelim} display:block; }' 123 .$search[0]; 124 125 // links 126 $search[1] = '<span class="wrap1">'; 127 $replace[1] = $search[1].' 129 // add links 130 $search = '<span class="wrap1">'; 131 $replace = $search.' 128 132 {strip}<a class="addCollection" href="{$collection_toggle_url}&collection_toggle={$thumbnail.id}" data-id="{$thumbnail.id}" rel="nofollow"> 129 {if $ thumbnail.COLLECTION_SELECTED}133 {if $COL_ID or $thumbnail.COLLECTION_SELECTED} 130 134 {\'Remove from collection\'|@translate} <img src="{$USER_COLLEC_PATH}template/image_delete.png" title="{\'Remove from collection\'|@translate}"> 131 135 {else} … … 134 138 </a>{/strip}'; 135 139 136 // AJAX request 137 $search[2] = '{/html_style}'; 138 $replace[2] = $search[2].' 139 {footer_script require=\'jquery\'} 140 jQuery(".addCollection").click(function() {ldelim} 141 var toggle_id = jQuery(this).data("id"); 142 var $trigger = jQuery(this); 143 144 jQuery.ajax({ldelim} 145 type: "POST", 146 url: "{$USER_COLLEC_PATH}toggle_image.php", 147 data: {ldelim} "toggle_id": toggle_id } 148 }).done(function(msg) {ldelim} 149 if (msg == "true") {ldelim} 150 $trigger.html(\'{\'Remove from collection\'|@translate} <img src="{$USER_COLLEC_PATH}template/image_delete.png" title="{\'Remove from collection\'|@translate}">\'); 151 } else if (msg == "false") {ldelim} 152 $trigger.html(\'{\'Add to collection\'|@translate} <img src="{$USER_COLLEC_PATH}template/image_add.png" title="{\'Add to collection\'|@translate}">\'); 153 } else {ldelim} 154 $trigger.html(\'{\'Un unknown error occured\'|@translate}\'); 155 } 156 }); 157 158 return false; 159 }); 160 {/footer_script}'; 140 // custom CSS and AJAX request 141 $content.= file_get_contents(USER_COLLEC_PATH.'template/thumbnails_css_js.tpl'); 161 142 162 143 return str_replace($search, $replace, $content); -
extensions/UserCollections/template/edit.tpl
r16608 r16625 27 27 {/footer_script} 28 28 29 {$MENUBAR} 29 {if $themeconf.name != "stripped" and $themeconf.parent != "stripped" and $themeconf.name != "simple-grey" and $themeconf.parent != "simple"} 30 {$MENUBAR} 31 {else} 32 {assign var="intern_menu" value="true"} 33 {/if} 34 <div id="content" class="content{if isset($MENUBAR)} contentWithMenu{/if}"> 35 {if $intern_menu}{$MENUBAR}{/if} 30 36 31 <div id="content" class="content{if isset($MENUBAR)} contentWithMenu{/if}">32 37 <div class="titrePage"> 33 38 <ul class="categoryActions"> -
extensions/UserCollections/template/list.tpl
r16608 r16625 13 13 {/footer_script} 14 14 15 {$MENUBAR} 15 {if $themeconf.name != "stripped" and $themeconf.parent != "stripped" and $themeconf.name != "simple-grey" and $themeconf.parent != "simple"} 16 {$MENUBAR} 17 {else} 18 {assign var="intern_menu" value="true"} 19 {/if} 20 <div id="content" class="content{if isset($MENUBAR)} contentWithMenu{/if}"> 21 {if $intern_menu}{$MENUBAR}{/if} 16 22 17 <div id="content" class="content{if isset($MENUBAR)} contentWithMenu{/if}">18 23 <div class="titrePage"> 19 24 <ul class="categoryActions"></ul> … … 39 44 </p> 40 45 <p class="collecActions"> 41 <a href="{$col.U_EDIT}" rel="nofollow">{'Edit'|@translate}</a> | 42 <a href="{$col.U_SAVE}" class="save_col" rel="nofollow">{'save'|@translate}</a> | 43 <a href="{$col.U_DELETE}" onClick="return confirm('{'Are you sure?'|@translate}');" rel="nofollow">{'delete'|@translate}</a> 46 <a href="{$col.U_EDIT}" rel="nofollow">{'Edit'|@translate}</a> 47 | <a href="{$col.U_SAVE}" class="save_col" rel="nofollow">{'save'|@translate}</a> 48 {if $col.U_DOWNLOAD}| <a href="{$col.U_DOWNLOAD}" rel="nofollow">{'download'|@translate}</a>{/if} 49 | <a href="{$col.U_DELETE}" onClick="return confirm('{'Are you sure?'|@translate}');" rel="nofollow">{'delete'|@translate}</a> 44 50 {if not $col.active}| <a href="{$col.U_ACTIVE}" rel="nofollow">{'set active'|@translate}</a>{/if} 45 51 </p> … … 65 71 </p> 66 72 <p class="collecActions"> 67 <a href="{$col.U_EDIT}" rel="nofollow">{'Edit'|@translate}</a> | 68 <a href="{$col.U_DELETE}" onClick="return confirm('{'Are you sure?'|@translate}');" rel="nofollow">{'delete'|@translate}</a> 73 <a href="{$col.U_EDIT}" rel="nofollow">{'Edit'|@translate}</a> 74 {if $col.U_DOWNLOAD}| <a href="{$col.U_DOWNLOAD}" rel="nofollow">{'download'|@translate}</a>{/if} 75 | <a href="{$col.U_DELETE}" onClick="return confirm('{'Are you sure?'|@translate}');" rel="nofollow">{'delete'|@translate}</a> 69 76 {if not $col.active}| <a href="{$col.U_ACTIVE}" rel="nofollow">{'set active'|@translate}</a>{/if} 70 77 </p> -
extensions/UserCollections/template/menublock_user_collec.tpl
r16608 r16625 2 2 <dd> 3 3 {if $block->data.current} 4 {'Current collection:'|@translate} <b>{$block->data.current.NAME}</b>, {'%d photos'|@translate|@sprintf:$block->data.current.NB_IMAGES} 4 {assign var="nb_images" value='<span class="nbImagesCollec">'|@cat:$block->data.current.NB_IMAGES|@cat:'</span>'} 5 <p>{'Current collection:'|@translate} <b>{$block->data.current.NAME}</b>, {'%d photos'|@translate|replace:'%d':'%s'|sprintf:$nb_images}</p> 5 6 <ul>{strip} 6 7 {foreach from=$block->data.links item=link} … … 9 10 {/strip}</ul> 10 11 {/if} 11 < a href="{$block->data.U_LIST}" rel="nofollow">{'See all my collections'|@translate}</a>12 <p><a href="{$block->data.U_LIST}" rel="nofollow">{'See all my collections'|@translate}</a></p> 12 13 </dd> -
extensions/UserCollections/template/view.tpl
r16597 r16625 1 1 {combine_css path=$USER_COLLEC_PATH|@cat:"template/style.css"} 2 2 3 {$MENUBAR} 3 {if $themeconf.name != "stripped" and $themeconf.parent != "stripped" and $themeconf.name != "simple-grey" and $themeconf.parent != "simple"} 4 {$MENUBAR} 5 {else} 6 {assign var="intern_menu" value="true"} 7 {/if} 8 <div id="content" class="content{if isset($MENUBAR)} contentWithMenu{/if}"> 9 {if $intern_menu}{$MENUBAR}{/if} 4 10 5 <div id="content" class="content{if isset($MENUBAR)} contentWithMenu{/if}">6 11 <div class="titrePage"> 7 12 <ul class="categoryActions">
Note: See TracChangeset
for help on using the changeset viewer.