Changeset 12607 for extensions/Subscribe_to_comments
- Timestamp:
- Nov 11, 2011, 7:11:38 PM (12 years ago)
- Location:
- extensions/Subscribe_to_comments
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Subscribe_to_comments/include/functions.inc.php
r12600 r12607 58 58 59 59 $generic_content = ' 60 <a href="'.$element['url'].'"><img src="'.$element['thumbnail'].'" alt="'.$element['name'].'"></a> 61 <br> 60 62 <b>.'.trigger_event('render_comment_author', $comm['author']).'</b> wrote : 61 63 … … 79 81 80 82 81 /* 83 /** 82 84 * add an email to subscribers list 83 85 * @param int (image|category)_id … … 155 157 } 156 158 157 /* 159 160 /** 158 161 * remove an email from subscribers list 159 162 * @param int (image|category)_id … … 205 208 } 206 209 207 /* 210 211 /** 208 212 * validate a subscription 209 213 * @param int (image|category)_id … … 243 247 } 244 248 249 245 250 /** 246 251 * create absolute url to subscriptions section … … 284 289 } 285 290 291 286 292 /** 287 293 * get name and url of a picture … … 297 303 id, 298 304 name, 299 file 305 file, 306 path, 307 tn_ext 300 308 FROM '.IMAGES_TABLE.' 301 309 WHERE id = '.$image_id.' … … 316 324 $element['url'] = make_picture_url($url_params); 317 325 326 $element['thumbnail'] = get_thumbnail_url($element); 327 318 328 return $element; 319 329 } … … 326 336 function get_category_infos($cat_id) 327 337 { 338 global $conf; 339 328 340 $query = ' 329 341 SELECT 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.' 335 354 ;'; 336 355 $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 337 357 338 358 $url_params['section'] = 'categories'; … … 340 360 $element['url'] = make_index_url($url_params); 341 361 362 $element['thumbnail'] = get_thumbnail_url(array( 363 'id' => $element['image_id'], 364 'path' => $element['path'], 365 'tn_ext' => $element['tn_ext'], 366 )); 367 342 368 return $element; 343 369 } 370 344 371 345 372 /** -
extensions/Subscribe_to_comments/include/subscribe_to_comments.inc.php
r12600 r12607 173 173 function stc_on_picture_prefilter($template, &$smarty) 174 174 { 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; 183 176 184 177 // if registered user we check if already subscribed 178 $subscribed = false; 185 179 if (!is_a_guest()) 186 180 { … … 195 189 if (pwg_db_num_rows(pwg_query($query))) 196 190 { 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].= ' 198 205 {\'You are currently subscribed to comments of this picture.\'|@translate} 199 206 <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 205 209 { 206 210 $replace[1].= ' … … 212 216 $replace[1].= ' 213 217 <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> 215 219 {footer_script require="jquery"}{literal} 216 220 jQuery(document).ready(function() { … … 248 252 $replace[0] = null; 249 253 250 if (! isset($no_form))254 if (!$subscribed) 251 255 { 252 256 $replace[0].= ' … … 335 339 function stc_on_album_prefilter($template, &$smarty) 336 340 { 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; 345 342 346 343 // if registered user we check if already subscribed 344 $subscribed = false; 347 345 if (!is_a_guest()) 348 346 { … … 357 355 if (pwg_db_num_rows(pwg_query($query))) 358 356 { 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']; 363 373 364 $replace[1].= ' 374 $element_url = make_index_url($url_params); 375 376 $replace[1].= ' 365 377 {\'You are currently subscribed to comments of this album.\'|@translate} 366 378 <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 372 381 { 373 382 $replace[1].= ' … … 379 388 $replace[1].= ' 380 389 <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> 382 391 {footer_script require="jquery"}{literal} 383 392 jQuery(document).ready(function() { … … 415 424 $replace[0] = null; 416 425 417 if (! isset($no_form))426 if (!$subscribed) 418 427 { 419 428 $replace[0].= ' … … 442 451 * add link to management page for registered users 443 452 */ 444 function stc_ menubar_apply($menu_ref_arr)453 function stc_profile_link() 445 454 { 446 455 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 460 function stc_profile_link_prefilter($content, &$smarty) 456 461 { 457 462 global $user; 458 463 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); 462 468 } 463 469 ?> -
extensions/Subscribe_to_comments/language/en_UK/plugin.lang.php
r12600 r12607 17 17 $lang['Only unsubscribe notifications for comments from:'] = 'Only unsubscribe notifications for comments from:'; 18 18 $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'; 20 20 $lang['Item'] = 'Item'; 21 21 $lang['Date'] = 'Date'; 22 22 $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'; 23 24 24 25 ?> -
extensions/Subscribe_to_comments/language/fr_FR/plugin.lang.php
r12600 r12607 13 13 $lang['Your subscribtion has been validated, thanks you.'] = 'Votre inscription a été validée, merci.'; 14 14 $lang['Nothing to validate.'] = 'Rien à valider.'; 15 $lang['Subscriptions of'] = ' Subscriptions of';15 $lang['Subscriptions of'] = 'Abonnements de'; 16 16 $lang['Unsubscribe from email notification'] = 'Se désinscrire de la notification par mail'; 17 17 $lang['Only unsubscribe notifications for comments from:'] = 'Uniquement se désinscrire de :'; 18 18 $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'; 20 20 $lang['Item'] = 'Objet'; 21 21 $lang['Date'] = 'Date'; 22 22 $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'; 23 24 24 25 ?> -
extensions/Subscribe_to_comments/main.inc.php
r12600 r12607 34 34 add_event_handler('loc_end_index', 'stc_load_section'); 35 35 36 // menulink37 add_event_handler(' blockmanager_apply', 'stc_menubar_apply');36 // profile link 37 add_event_handler('loc_begin_profile', 'stc_profile_link'); 38 38 39 39 ?> -
extensions/Subscribe_to_comments/template/style.css
r12600 r12607 9 9 10 10 .subscriptions_list TD { 11 padding: 0 5px; 11 padding:5px 5px 2px 5px; 12 vertical-align:center; 12 13 } 13 14 … … 16 17 } 17 18 18 .subscriptions_list TH { 19 padding:7px 5px; 20 } 19 .row2 { background-color:#222; } 20 .row1 { background-color:#333; } 21 21 22 .row2 { background-color: #222; } 23 .throw, .row1 { background-color:#111; } 24 25 p { 22 .stc p { 26 23 text-align:center; 27 24 } 28 25 29 label {26 .stc label { 30 27 display:block; 31 28 } 29 30 img.thumbnail { 31 max-width:120px; 32 max-height:90px; 33 } -
extensions/Subscribe_to_comments/template/subscribtions_page.tpl
r12600 r12607 5 5 {if !empty($PLUGIN_INDEX_CONTENT_BEFORE)}{$PLUGIN_INDEX_CONTENT_BEFORE}{/if} 6 6 7 <div id="content" class="content ">7 <div id="content" class="content stc"> 8 8 <div class="titrePage"> 9 9 <ul class="categoryActions"> … … 58 58 <form action="{$MANAGE_LINK}" method="post"> 59 59 <fieldset> 60 <legend>{'Manage my subscriptions '|@translate}</legend>60 <legend>{'Manage my subscriptions to comments'|@translate}</legend> 61 61 <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>67 62 {foreach from=$subscriptions item=sub name=subs_loop} 68 63 <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> 69 65 <td> 70 66 {if $sub.type == 'image'} … … 74 70 {/if} 75 71 <a href="{$sub.infos.url}">{$sub.infos.name}</a> 72 <br>{$sub.registration_date} 76 73 </td> 77 <td>{$sub.registration_date}</td>78 74 <td><a href="{$MANAGE_LINK}&unsubscribe={$sub.id}">{'Unsubscribe'|@translate}</a></td> 79 75 </tr>
Note: See TracChangeset
for help on using the changeset viewer.