Ignore:
Timestamp:
Jul 11, 2012, 6:44:23 PM (12 years ago)
Author:
mistic100
Message:

-add download link if BatchDownloader is installed
-merge two prefilters
-better support of Stripped

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserCollections/include/events.inc.php

    r16608 r16625  
    3535    }
    3636  }
    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 */
    4051function user_collections_page()
    4152{
     
    116127function user_collections_thumbnails_list_prefilter($content, &$smarty)
    117128{
    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.'
    128132{strip}<a class="addCollection" href="{$collection_toggle_url}&amp;collection_toggle={$thumbnail.id}" data-id="{$thumbnail.id}" rel="nofollow">
    129 {if $thumbnail.COLLECTION_SELECTED}
     133{if $COL_ID or $thumbnail.COLLECTION_SELECTED}
    130134{\'Remove from collection\'|@translate}&nbsp;<img src="{$USER_COLLEC_PATH}template/image_delete.png" title="{\'Remove from collection\'|@translate}">
    131135{else}
     
    134138</a>{/strip}';
    135139
    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}&nbsp;<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}&nbsp;<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');
    161142
    162143  return str_replace($search, $replace, $content);
Note: See TracChangeset for help on using the changeset viewer.