Changeset 15108
- Timestamp:
- May 18, 2012, 11:54:46 PM (13 years ago)
- Location:
- extensions/reply_to
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/reply_to/index.php
r11252 r15108 3 3 // | Piwigo - a PHP based photo gallery | 4 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2008-201 1Piwigo Team http://piwigo.org |5 // | Copyright(C) 2008-2012 Piwigo Team http://piwigo.org | 6 6 // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | 7 7 // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | -
extensions/reply_to/language/en_UK/plugin.lang.php
r11252 r15108 1 1 <?php 2 2 3 $lang[' reply to this comment'] = 'reply to this comment';3 $lang['Reply'] = 'Reply'; 4 4 5 5 ?> -
extensions/reply_to/language/fr_FR/plugin.lang.php
r11252 r15108 1 1 <?php 2 2 3 $lang[' reply to this comment'] = 'répondre à ce commentaire';3 $lang['Reply'] = 'Répondre'; 4 4 5 5 ?> -
extensions/reply_to/language/it_IT/plugin.lang.php
r11460 r15108 1 1 <?php 2 2 3 $lang[' reply to this comment'] = 'Rispondere a questo commento';3 $lang['Reply'] = 'Rispondere'; 4 4 5 5 ?> -
extensions/reply_to/language/lv_LV/plugin.lang.php
r11447 r15108 1 1 <?php 2 2 3 $lang[' reply to this comment'] = 'atbildēt uz šo komentāru';3 $lang['Reply'] = 'Atbildēt'; 4 4 5 5 ?> -
extensions/reply_to/main.inc.php
r12389 r15108 20 20 21 21 add_event_handler('render_comment_content', 'replyto_parse', 60, 2); 22 if (script_basename() == 'comments') add_event_handler(' init', 'replyto_add_link'); // for comments page (section_init.inc is not called on this page)23 else add_event_handler('loc_end_section_init', 'replyto_add_link'); // for all other pages (we need section infos)22 if (script_basename() == 'comments') add_event_handler('loc_after_page_header', 'replyto_add_link'); 23 else add_event_handler('loc_end_section_init', 'replyto_add_link'); 24 24 25 25 ?> -
extensions/reply_to/reply_to.inc.php
r12563 r15108 11 11 global $pwg_loaded_plugins, $template, $page, $conf, $lang; 12 12 $template->assign('REPLYTO_PATH', REPLYTO_PATH); 13 $location = null; 13 14 14 15 // comment form has different id … … 25 26 } 26 27 27 / / must check our location28 if (script_basename() == 'comments') /* COMMENTS page */28 /* COMMENTS page */ 29 if (script_basename() == 'comments') 29 30 { 30 31 if ( !is_a_guest() OR $conf['comments_forall'] ) 31 32 { 33 $comments = &$template->get_template_vars('comments'); 34 if (!count($comments)) return; 35 36 // generates urls to picture or albums with necessary url params 37 foreach ($comments as $tpl_var) 38 { 39 $replyto_links[ $tpl_var['ID'] ] = get_absolute_root_url().$tpl_var['U_PICTURE'].'&rt='.$tpl_var['ID'].'&rta='.$tpl_var['AUTHOR'].'#commentform'; 40 } 41 42 $template->assign('replyto_links', $replyto_links); 32 43 $template->set_prefilter('comments', 'replyto_add_link_comments_prefilter'); 33 44 } 34 45 } 35 else if (script_basename() == 'picture') /* PICTURE page */ 36 { 46 /* PICTURE page */ 47 else if (script_basename() == 'picture') 48 { 49 $location = 'picture'; 37 50 add_event_handler('user_comment_insertion', 'replyto_parse_picture_mail'); 38 51 … … 42 55 } 43 56 } 44 else if /* ALBUM page */ 57 /* ALBUM page */ 58 else if 45 59 ( 46 60 script_basename() == 'index' AND isset($page['section']) AND … … 49 63 ) 50 64 { 65 $location = 'album'; 51 66 add_event_handler('user_comment_insertion', 'replyto_parse_album_mail'); 52 67 … … 57 72 } 58 73 74 59 75 /* we come from comments.php page */ 60 if ( !empty($_GET['reply_to']) and !empty($_GET['reply_to_a']) ) 61 { 62 $lang['Comment'].= ' 63 <script type="text/javascript"> 64 $(document).ready(function(){ 65 jQuery("#'.$template->get_template_vars('replyto_form_name').' textarea").insertAtCaret("[reply='.$_GET['reply_to'].']'.$_GET['reply_to_a'].'[/reply] "); 66 }); 67 </script>'; 68 } 69 } 70 71 /** 72 * links to commentform on comments.php page 76 if ( !empty($_GET['rt']) and !empty($_GET['rta']) ) 77 { 78 if ($location == 'picture') 79 { 80 $template->set_prefilter('picture', 'replyto_fillform_prefilter'); 81 } 82 else 83 { 84 $template->set_prefilter('comments_on_albums', 'replyto_fillform_prefilter'); 85 } 86 } 87 } 88 89 /** 90 * add reply tag from values given in url 91 */ 92 function replyto_fillform_prefilter($content, &$smarty) 93 { 94 $search = '<ul class="commentsList">'; 95 $replace = '{footer_script require=\'insertAtCaret\'}replyTo("'.$_GET['rt'].'", "'.$_GET['rta'].'");{/footer_script}'.$search; 96 return str_replace($search, $replace, $content); 97 } 98 99 /** 100 * reply buttons on comments.php page 73 101 */ 74 102 function replyto_add_link_comments_prefilter($content, &$smarty) 75 { 76 global $template; 77 $comments = $template->get_template_vars('comments'); 78 79 if (!count($comments)) return $content; 80 81 foreach ($comments as $tpl_var) 82 { 83 $replyto_links[ $tpl_var['ID'] ] = get_absolute_root_url().$tpl_var['U_PICTURE'].'&reply_to='.$tpl_var['ID'].'&reply_to_a='.$tpl_var['AUTHOR'].'#commentform'; 84 } 85 86 $template->assign('replyto_links', $replyto_links); 87 88 // style 89 $search[0] = '<ul class="thumbnailCategories">'; 103 { 104 // style 105 $search[0] = '<ul class="commentsList">'; 90 106 $replace[0] = ' 91 107 {html_head} … … 93 109 .replyTo {ldelim} 94 110 display:inline-block; 95 width:16px;111 background:url({$REPLYTO_PATH}reply.png) left top no-repeat; 96 112 height:16px; 97 background:url({$REPLYTO_PATH}reply.png) center top no-repeat; 113 margin-left:20px; 114 padding-left:20px; 98 115 } 99 116 .replyTo:hover {ldelim} 100 background-position: center-16px;117 background-position:left -16px; 101 118 } 102 119 </style> … … 105 122 106 123 // button 107 $search[1] = '<span class="author">'; 108 $replace[1] = ' 109 {if not isset($comment.IN_EDIT)} 110 <div class="actions" style="float:right;"> 111 <a href="{$replyto_links[$comment.ID]}" title="{\'reply to this comment\'|@translate}" class="replyTo"> </a> 112 </div> 113 {/if}' 114 .$search[1]; 124 $search[1] = '<span class="commentDate">{$comment.DATE}</span>'; 125 $replace[1] = $search[1].'<a href="{$replyto_links[$comment.ID]}" class="replyTo">{\'Reply\'|@translate}</a>'; 115 126 116 127 return str_replace($search, $replace, $content); … … 118 129 119 130 /** 120 * links to commentform on picture.php (and index.php) page(s)131 * reply buttons on picture.php and index.php pages 121 132 */ 122 133 function replyto_add_link_prefilter($content, &$smarty) 123 134 { 124 135 // script & style 125 $search[0] = '<ul class=" thumbnailCategories">';136 $search[0] = '<ul class="commentsList">'; 126 137 $replace[0] = ' 127 138 {combine_script id=\'insertAtCaret\' require=\'jquery\' path=$REPLYTO_PATH|@cat:\'insertAtCaret.js\'} … … 137 148 .replyTo {ldelim} 138 149 display:inline-block; 139 width:16px;150 background:url({$REPLYTO_PATH}reply.png) left top no-repeat; 140 151 height:16px; 141 background:url({$REPLYTO_PATH}reply.png) center top no-repeat; 152 margin-left:20px; 153 padding-left:20px; 142 154 } 143 155 .replyTo:hover {ldelim} 144 background-position: center-16px;156 background-position:left -16px; 145 157 } 146 158 </style> … … 149 161 150 162 // button 151 $search[1] = '<span class="author">'; 152 $replace[1] = ' 153 {if not isset($comment.IN_EDIT)} 154 <div class="actions" style="float:right;"> 155 <a href="#commentform" title="{\'reply to this comment\'|@translate}" class="replyTo" onclick="replyTo(\'{$comment.ID}\', \'{$comment.AUTHOR}\');"> </a> 156 </div> 157 {/if}' 158 .$search[1]; 159 160 // anchor 161 $search[2] = '<div class="thumbnailCategory'; 162 $replace[2] = ' 163 <a name="comment-{$comment.ID}"></a>' 164 .$search[2]; 165 166 $search[3] = '<legend>{\'Add a comment\'|@translate}</legend>'; 167 $replace[3] = $search[3].' 168 <a name="commentform"></a>'; 163 $search[1] = '<span class="commentDate">{$comment.DATE}</span>'; 164 $replace[1] = $search[1].'<a href="#commentform" class="replyTo" onclick="replyTo(\'{$comment.ID}\', \'{$comment.AUTHOR}\');">{\'Reply\'|@translate}</a>'; 165 166 // anchors 167 $search[2] = '<li class="commentElement'; 168 $replace[2] = '<a name="comment-{$comment.ID}"></a>'.$search[2]; 169 170 $search[3] = '<div id="commentAdd">'; 171 $replace[3] = $search[3].'<a name="commentform"></a>'; 169 172 170 173 return str_replace($search, $replace, $content); … … 185 188 $query = ' 186 189 SELECT 187 img.id,188 img.file,189 cat.category_id190 FROM ' . IMAGES_TABLE . ' AS img191 INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' AS cat192 ON cat.image_id = img.id193 INNER JOIN ' . COMMENTS_TABLE . ' AS com194 ON com.image_id = img.id195 WHERE com.id = ' . $matches[1] . '190 img.id, 191 img.file, 192 cat.category_id 193 FROM ' . IMAGES_TABLE . ' AS img 194 INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' AS cat 195 ON cat.image_id = img.id 196 INNER JOIN ' . COMMENTS_TABLE . ' AS com 197 ON com.image_id = img.id 198 WHERE com.id = ' . $matches[1] . ' 196 199 ;'; 197 200 $result = pwg_query($query); … … 205 208 $query = ' 206 209 SELECT 207 id,208 name,209 permalink,210 uppercats211 FROM ' . CATEGORIES_TABLE . '212 WHERE id = ' . $image['category_id'] . '210 id, 211 name, 212 permalink, 213 uppercats 214 FROM ' . CATEGORIES_TABLE . ' 215 WHERE id = ' . $image['category_id'] . ' 213 216 ;'; 214 217 $image['cat'] = pwg_db_fetch_assoc(pwg_query($query)); … … 234 237 $query = ' 235 238 SELECT 236 cat.id,237 cat.name,238 cat.permalink,239 cat.uppercats240 FROM ' . COA_TABLE . ' AS com241 INNER JOIN ' . CATEGORIES_TABLE . ' AS cat242 ON cat.id = com.category_id243 WHERE com.id = ' . $matches[1] . '239 cat.id, 240 cat.name, 241 cat.permalink, 242 cat.uppercats 243 FROM ' . COA_TABLE . ' AS com 244 INNER JOIN ' . CATEGORIES_TABLE . ' AS cat 245 ON cat.id = com.category_id 246 WHERE com.id = ' . $matches[1] . ' 244 247 ;'; 245 248 $result = pwg_query($query);
Note: See TracChangeset
for help on using the changeset viewer.