Changeset 12607


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

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

Location:
extensions/Subscribe_to_comments
Files:
7 edited

Legend:

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

    r12600 r12607  
    5858   
    5959  $generic_content = '
     60<a href="'.$element['url'].'"><img src="'.$element['thumbnail'].'" alt="'.$element['name'].'"></a>
     61<br>
    6062<b>.'.trigger_event('render_comment_author', $comm['author']).'</b> wrote :
    6163
     
    7981
    8082
    81 /*
     83/**
    8284 * add an email to subscribers list
    8385 * @param int (image|category)_id
     
    155157}
    156158
    157 /*
     159
     160/**
    158161 * remove an email from subscribers list
    159162 * @param int (image|category)_id
     
    205208}
    206209
    207 /*
     210
     211/**
    208212 * validate a subscription
    209213 * @param int (image|category)_id
     
    243247}
    244248
     249
    245250/**
    246251 * create absolute url to subscriptions section
     
    284289}
    285290
     291
    286292/**
    287293 * get name and url of a picture
     
    297303    id,
    298304    name,
    299     file
     305    file,
     306    path,
     307    tn_ext
    300308  FROM '.IMAGES_TABLE.'
    301309  WHERE id = '.$image_id.'
     
    316324  $element['url'] = make_picture_url($url_params);
    317325 
     326  $element['thumbnail'] = get_thumbnail_url($element);
     327 
    318328  return $element;
    319329}
     
    326336function get_category_infos($cat_id)
    327337{
     338  global $conf;
     339 
    328340  $query = '
    329341SELECT
    330     id,
    331     name,
    332     permalink
    333   FROM '.CATEGORIES_TABLE.'
    334   WHERE id = '.$cat_id.'
     342    cat.id,
     343    cat.name,
     344    cat.permalink,
     345    img.id AS image_id,
     346    img.path,
     347    img.tn_ext
     348  FROM '.CATEGORIES_TABLE.' AS cat
     349    LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc
     350      ON ucc.cat_id = cat.id AND ucc.user_id = '.$conf['guest_id'].'
     351    LEFT JOIN '.IMAGES_TABLE.' AS img
     352      ON img.id = ucc.user_representative_picture_id
     353  WHERE cat.id = '.$cat_id.'
    335354;';
    336355  $element = pwg_db_fetch_assoc(pwg_query($query));
     356  // we use guest_id for user_cache beacause we don't know the status of recipient
    337357 
    338358  $url_params['section'] = 'categories';
     
    340360  $element['url'] = make_index_url($url_params);
    341361 
     362  $element['thumbnail'] = get_thumbnail_url(array(
     363    'id' => $element['image_id'],
     364    'path' => $element['path'],
     365    'tn_ext' => $element['tn_ext'],
     366    ));
     367 
    342368  return $element;
    343369}
     370
    344371
    345372/**
  • 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?>
  • extensions/Subscribe_to_comments/language/en_UK/plugin.lang.php

    r12600 r12607  
    1717$lang['Only unsubscribe notifications for comments from:'] = 'Only unsubscribe notifications for comments from:';
    1818$lang['Unsubscribe from all email notifications'] = 'Unsubscribe from all email notifications';
    19 $lang['Manage my subscriptions'] = 'Manage my subscriptions';
     19$lang['Manage my subscriptions to comments'] = 'Manage my subscriptions to comments';
    2020$lang['Item'] = 'Item';
    2121$lang['Date'] = 'Date';
    2222$lang['You are not subscribed to any comment.'] = 'You are not subscribed to any comment.';
     23$lang['Return to item page'] = 'Return to item page';
    2324
    2425?>
  • extensions/Subscribe_to_comments/language/fr_FR/plugin.lang.php

    r12600 r12607  
    1313$lang['Your subscribtion has been validated, thanks you.'] = 'Votre inscription a été validée, merci.';
    1414$lang['Nothing to validate.'] = 'Rien à valider.';
    15 $lang['Subscriptions of'] = 'Subscriptions of';
     15$lang['Subscriptions of'] = 'Abonnements de';
    1616$lang['Unsubscribe from email notification'] = 'Se désinscrire de la notification par mail';
    1717$lang['Only unsubscribe notifications for comments from:'] = 'Uniquement se désinscrire de :';
    1818$lang['Unsubscribe from all email notifications'] = 'Ne plus recevoir aucune notification';
    19 $lang['Manage my subscriptions'] = 'Gérer mes abonnements';
     19$lang['Manage my subscriptions to comments'] = 'Gérer mes abonnements aux commentaires';
    2020$lang['Item'] = 'Objet';
    2121$lang['Date'] = 'Date';
    2222$lang['You are not subscribed to any comment.'] = 'Vous n\'êtes inscrit à aucun commentaire.';
     23$lang['Return to item page'] = 'Retourner à la page de l\'élément';
    2324
    2425?>
  • extensions/Subscribe_to_comments/main.inc.php

    r12600 r12607  
    3434add_event_handler('loc_end_index', 'stc_load_section');
    3535
    36 // menu link
    37 add_event_handler('blockmanager_apply', 'stc_menubar_apply');
     36// profile link
     37add_event_handler('loc_begin_profile', 'stc_profile_link');
    3838
    3939?>
  • extensions/Subscribe_to_comments/template/style.css

    r12600 r12607  
    99
    1010.subscriptions_list TD {
    11         padding: 0 5px;
     11        padding:5px 5px 2px 5px;
     12  vertical-align:center;
    1213}
    1314
     
    1617}
    1718
    18 .subscriptions_list TH {
    19   padding:7px 5px;
    20 }
     19.row2 { background-color:#222; }
     20.row1 { background-color:#333; }
    2121
    22 .row2 { background-color: #222; }
    23 .throw, .row1 { background-color:#111;  }
    24 
    25 p {
     22.stc p {
    2623  text-align:center;
    2724}
    2825
    29 label {
     26.stc label {
    3027  display:block;
    3128}
     29
     30img.thumbnail {
     31  max-width:120px;
     32  max-height:90px;
     33}
  • extensions/Subscribe_to_comments/template/subscribtions_page.tpl

    r12600 r12607  
    55{if !empty($PLUGIN_INDEX_CONTENT_BEFORE)}{$PLUGIN_INDEX_CONTENT_BEFORE}{/if}
    66
    7 <div id="content" class="content">
     7<div id="content" class="content stc">
    88  <div class="titrePage">
    99    <ul class="categoryActions">
     
    5858  <form action="{$MANAGE_LINK}" method="post">
    5959  <fieldset>
    60     <legend>{'Manage my subscriptions'|@translate}</legend>
     60    <legend>{'Manage my subscriptions to comments'|@translate}</legend>
    6161    <table class="subscriptions_list">
    62       <tr class="throw">
    63         <th>{'Item'|@translate}</th>
    64         <th>{'Date'|@translate}</th>
    65         <th>{'Unsubscribe'|@translate}</th>
    66       </tr>
    6762      {foreach from=$subscriptions item=sub name=subs_loop}
    6863      <tr class="{if $smarty.foreach.subs_loop.index is odd}row1{else}row2{/if}">
     64        <td><img src="{$sub.infos.thumbnail}" alt="{$sub.infos.name}" class="thumbnail"></td>
    6965        <td>
    7066          {if $sub.type == 'image'}
     
    7470          {/if}
    7571          <a href="{$sub.infos.url}">{$sub.infos.name}</a>
     72          <br>{$sub.registration_date}
    7673        </td>
    77         <td>{$sub.registration_date}</td>
    7874        <td><a href="{$MANAGE_LINK}&amp;unsubscribe={$sub.id}">{'Unsubscribe'|@translate}</a></td>
    7975      </tr>
Note: See TracChangeset for help on using the changeset viewer.