Ignore:
Timestamp:
Nov 11, 2011, 7:11:38 PM (12 years ago)
Author:
mistic100
Message:

display thumbnails on mails and subscriptions list
fix misplaced field on comment form
move management link to profile page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Subscribe_to_comments/include/subscribe_to_comments.inc.php

    r12600 r12607  
    173173function stc_on_picture_prefilter($template, &$smarty)
    174174{
    175   global $user, $picture; 
    176  
    177   ## subscribe at any moment ##
    178   $search[1] = '{if isset($comment_add)}';
    179  
    180   $replace[1] = $search[1].'
    181 <form method="post" action="{$comment_add.F_ACTION}" class="filter" id="stc_standalone">
    182   <fieldset>';
     175  global $user, $picture;
    183176 
    184177  // if registered user we check if already subscribed
     178  $subscribed = false;
    185179  if (!is_a_guest())
    186180  {
     
    195189    if (pwg_db_num_rows(pwg_query($query)))
    196190    {
    197       $replace[1].= '
     191      $subscribed = true;
     192    }
     193  }
     194 
     195  ## subscribe at any moment ##
     196  $search[1] = '{if isset($comment_add)}';
     197 
     198  $replace[1] = $search[1].'
     199<form method="post" action="{$comment_add.F_ACTION}" class="filter" id="stc_standalone">
     200  <fieldset>';
     201 
     202  if ($subscribed)
     203  {
     204    $replace[1].= '
    198205    {\'You are currently subscribed to comments of this picture.\'|@translate}
    199206    <a href="'.add_url_params($picture['current']['url'], array('stc_unsubscribe'=>'1')).'">{\'Unsubscribe\'|@translate}';
    200       $no_form = true;
    201     }
    202   }
    203  
    204   if (!isset($no_form))
     207  }
     208  else
    205209  {
    206210    $replace[1].= '
     
    212216      $replace[1].= '
    213217      <label style="display:none;">{\'Email address\'|@translate} <input type="text" name="stc_mail_stdl"></label>
    214       <label style="display:none;"><input type="submit" value="{\'Submit\'|@translate}"></label>
     218      <label style="display:none;"><input type="submit" id="stc_submit" value="{\'Submit\'|@translate}"></label>
    215219    {footer_script require="jquery"}{literal}
    216220    jQuery(document).ready(function() {
     
    248252  $replace[0] = null;
    249253 
    250   if (!isset($no_form))
     254  if (!$subscribed)
    251255  {
    252256    $replace[0].= '
     
    335339function stc_on_album_prefilter($template, &$smarty)
    336340{
    337   global $user, $page; 
    338  
    339   ## subscribe at any moment ##
    340   $search[1] = '{if isset($comment_add)}';
    341  
    342   $replace[1] = $search[1].'
    343 <form method="post" action="{$comment_add.F_ACTION}" class="filter" id="stc_standalone">
    344   <fieldset>';
     341  global $user, $page;
    345342 
    346343  // if registered user we check if already subscribed
     344  $subscribed = false;
    347345  if (!is_a_guest())
    348346  {
     
    357355    if (pwg_db_num_rows(pwg_query($query)))
    358356    {
    359       $url_params['section'] = 'categories';
    360       $url_params['category'] = $page['category'];
    361      
    362       $element_url = make_index_url($url_params);
     357      $subscribed = true;
     358    }
     359  }
     360 
     361  ## subscribe at any moment ##
     362  $search[1] = '{if isset($comment_add)}';
     363 
     364  $replace[1] = $search[1].'
     365<form method="post" action="{$comment_add.F_ACTION}" class="filter" id="stc_standalone">
     366  <fieldset>';
     367 
     368  // if registered user we check if already subscribed
     369  if ($subscribed)
     370  {
     371    $url_params['section'] = 'categories';
     372    $url_params['category'] = $page['category'];
    363373   
    364       $replace[1].= '
     374    $element_url = make_index_url($url_params);
     375 
     376    $replace[1].= '
    365377    {\'You are currently subscribed to comments of this album.\'|@translate}
    366378    <a href="'.add_url_params($element_url, array('stc_unsubscribe'=>'1')).'">{\'Unsubscribe\'|@translate}';
    367       $no_form = true;
    368     }
    369   }
    370  
    371   if (!isset($no_form))
     379  }
     380  else
    372381  {
    373382    $replace[1].= '
     
    379388      $replace[1].= '
    380389      <label style="display:none;">{\'Email address\'|@translate} <input type="text" name="stc_mail_stdl"></label>
    381       <label style="display:none;"><input type="submit" value="{\'Submit\'|@translate}"></label>
     390      <label style="display:none;"><input type="submit" id="stc_submit" value="{\'Submit\'|@translate}"></label>
    382391    {footer_script require="jquery"}{literal}
    383392    jQuery(document).ready(function() {
     
    415424  $replace[0] = null;
    416425 
    417   if (!isset($no_form))
     426  if (!$subscribed)
    418427  {
    419428    $replace[0].= '
     
    442451 * add link to management page for registered users
    443452 */
    444 function stc_menubar_apply($menu_ref_arr)
     453function stc_profile_link()
    445454{
    446455  global $template;
    447   $menu = &$menu_ref_arr[0];
    448  
    449   if ( !is_a_guest() and ($block = $menu->get_block('mbIdentification')) != null )
    450   {
    451     $template->set_prefilter('menubar', 'stc_menubar_apply_prefilter');
    452   }
    453 }
    454 
    455 function stc_menubar_apply_prefilter($content, &$smarty)
     456 
     457  $template->set_prefilter('profile_content', 'stc_profile_link_prefilter');
     458}
     459
     460function stc_profile_link_prefilter($content, &$smarty)
    456461{
    457462  global $user;
    458463 
    459   $search = '{if isset($U_REGISTER)}';
    460   $replace = '<li><a href="'.make_stc_url('manage', $user['email']).'" title="{\'Manage my subscriptions\'|@translate}" rel="nofollow">{\'Manage my subscriptions\'|@translate}</a></li>';
    461   return str_replace($search, $replace.$search, $content);
     464  $search = '<p class="bottomButtons">';
     465  $replace = '<a href="'.make_stc_url('manage', $user['email']).'" title="{\'Manage my subscriptions to comments\'|@translate}" rel="nofollow">{\'Manage my subscriptions to comments\'|@translate}</a><br>';
     466 
     467  return str_replace($search, $search.$replace, $content);
    462468}
    463469?>
Note: See TracChangeset for help on using the changeset viewer.