Changeset 1032
- Timestamp:
- 03/08/09 00:00:27 (3 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
smf/SSI.php (modified) (4 diffs)
-
smf/ia_comments.php (modified) (1 diff)
-
www/macros/macro_remotebox.php (modified) (2 diffs)
-
www/macros/macro_smfcomments.php (modified) (2 diffs)
-
www/macros/macro_smftopic.php (modified) (1 diff)
-
www/macros/macro_smftopics.php (modified) (1 diff)
-
www/static/js/remotebox.js (modified) (3 diffs)
-
www/views/blog_view.php (modified) (1 diff)
-
www/views/textblock_view.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/smf/SSI.php
r1017 r1032 243 243 244 244 echo '<a href="', $scripturl, '?action=logout;sesc=', $sc, '">', $txt[108], '</a>'; 245 } 246 247 function ssi_displayPaging($count_comm, $begin_comm, $max_comm, $display) 248 { 249 if($count_comm > $max_comm) { 250 echo '<b>Mergi la pagina:</b> '; 251 for ($i = 1; $i <= $count_comm; $i += $max_comm) { 252 if ($i != $begin_comm) { 253 echo '<a href="javascript:stay()" onclick="RemoteBox_Comments('. $i .', '. $max_comm .', true, \''. $display .'\');"> 254 ['. (int)(($i + $max_comm - 1) / $max_comm) . ']</a> '; 255 } else { 256 echo '<b>[' . (int)(($i + $max_comm - 1)/ $max_comm) . ']</b> '; 257 } 258 } 259 } 245 260 } 246 261 … … 326 341 <div class="comments">'; 327 342 343 $remotebox_display = ($display == 'show' ? 'hide' : 'show'); 328 344 echo ' 329 <a href="javascript:stay()" onclick="RemoteBox_ Display = (RemoteBox_Display == \'show\' ? \'hide\' : \'show\'); RemoteBox_Load();"><h3>» ';345 <a href="javascript:stay()" onclick="RemoteBox_Comments('. $begin_comm .', '. $max_comm .', false, \''. $remotebox_display .'\');"><h3>» '; 330 346 331 347 if (0 == $count_comm){ … … 343 359 if($display == 'show') { 344 360 345 // Pagination 346 if($count_comm > $max_comm) { 347 echo '<b>Mergi la pagina:</b> '; 348 for ($i = 1; $i <= $count_comm; $i += $max_comm) { 349 if ($i != $begin_comm) { 350 echo '<a href="javascript:stay()" onclick="RemoteBox_BeginComm=' . $i . ';RemoteBox_Load();">[' . (int)(($i + $max_comm - 1) / $max_comm) . ']</a> '; 351 } else { 352 echo '<b>[' . (int)(($i + $max_comm - 1)/ $max_comm) . ']</b> '; 353 } 354 } 355 } 361 // Front paging display 362 ssi_displayPaging($count_comm, $begin_comm, $max_comm, $display); 356 363 357 364 foreach ($posts as $post) … … 369 376 </div> 370 377 </div>'; 378 379 // Back paging display 380 echo '<br>'; 381 ssi_displayPaging($count_comm, $begin_comm, $max_comm, $display); 371 382 } 372 383 -
trunk/smf/ia_comments.php
r1004 r1032 7 7 $topic_id = getattr($_GET, 'topic_id'); 8 8 $display = getattr($_GET, 'display', 'hide'); 9 $begin_comm = (int)getattr($_GET, 'begin_comm', ' 0');9 $begin_comm = (int)getattr($_GET, 'begin_comm', '1'); 10 10 $max_comm = getattr($_GET, 'max_comm'); 11 11 -
trunk/www/macros/macro_remotebox.php
r1004 r1032 9 9 // NOTE: This macro requires special user permissions since it poses quite 10 10 // a few security concerns. 11 function macro_remotebox($args, $bypass_security = false) { 12 $url = getattr($args, 'url'); 13 11 function macro_remotebox($url, $bypass_security = false) { 14 12 if (!$bypass_security && !identity_can('macro-remotebox')) { 15 13 return macro_permission_error(); … … 23 21 $buffer .= '<div id="remotebox">remote content</div>'; 24 22 $buffer .= '<script type="text/javascript">RemoteBox_Url="'; 25 $buffer .= html_escape($args['url']); 26 if (array_key_exists('display', $args)) { 27 $buffer .= '";RemoteBox_Display="' . html_escape($args['display']); 28 } 29 if (array_key_exists('max_comm', $args)) { 30 $buffer .= '";RemoteBox_MaxComm="' . html_escape((int)$args['max_comm']); 31 } 23 $buffer .= html_escape($url); 32 24 $buffer .= '";</script>'; 33 25 -
trunk/www/macros/macro_smfcomments.php
r1004 r1032 15 15 // SmfComments( topic_id="400" display="hide" max_comm="5") 16 16 function macro_smfcomments($args) { 17 $comments = '<div id="comentarii">'; 18 17 19 $topic_id = getattr($args, 'topic_id'); 18 20 $display = getattr($args, 'display'); … … 31 33 } 32 34 33 $args = array(34 'url' => IA_SMF_URL.'/ia_comments.php?topic_id='.$topic_id,35 'display' => $display36 );37 35 if(!is_null($max_comm)) { 38 if(is_whole_number($max_comm)) { 39 $args['max_comm'] = $max_comm; 40 } else { 36 if(!is_whole_number($max_comm)) { 41 37 return macro_error('Wrong value for argument `max_comm`'); 42 38 } 43 39 } 44 40 45 return macro_remotebox($args, true); 41 $url = IA_SMF_URL . '/ia_comments.php?topic_id=' . $topic_id . '&display=' . $display; 42 if (!is_null($max_comm)) { 43 $url .= '&max_comm=' . $max_comm; 44 } 45 46 $comments .= macro_remotebox($url, true); 47 $comments .= '</div>'; 48 49 return $comments; 46 50 } 47 51 -
trunk/www/macros/macro_smftopic.php
r1003 r1032 23 23 } 24 24 25 $args = array( 26 'url' => IA_SMF_URL.'/ia_recentposts.php?topic_id='.$topic_id.'&count='.$count 27 ); 28 return macro_remotebox($args, true); 25 $url = IA_SMF_URL.'/ia_recentposts.php?topic_id='.$topic_id.'&count='.$count; 26 27 return macro_remotebox($url, true); 29 28 } 30 29 -
trunk/www/macros/macro_smftopics.php
r852 r1032 25 25 } 26 26 27 $args = array( 28 'url' => IA_SMF_URL.'/ia_recenttopics.php?board_id='.$board_id.'&count='.$count 29 ); 30 return macro_remotebox($args, true); 27 $url = IA_SMF_URL.'/ia_recenttopics.php?board_id='.$board_id.'&count='.$count; 28 29 return macro_remotebox($url, true); 31 30 } 32 31 -
trunk/www/static/js/remotebox.js
r1004 r1032 5 5 6 6 var RemoteBox_Url = ''; 7 var RemoteBox_Display = 'hide';8 var RemoteBox_BeginComm = 1;9 var RemoteBox_MaxComm = 10;10 7 11 function RemoteBox_Load( ) {8 function RemoteBox_Load(remotebox_function) { 12 9 var container = $('remotebox'); 13 10 if (!container || !RemoteBox_Url) { … … 19 16 container.innerHTML = '<div class="loading"> <img src="/static/images/indicator.gif" />Se incarca ...</div>'; 20 17 21 var d = doSimpleXMLHttpRequest(RemoteBox_Url + "&display=" + RemoteBox_Display + 22 "&begin_comm=" + RemoteBox_BeginComm + 23 "&max_comm=" + RemoteBox_MaxComm); 18 var d = doSimpleXMLHttpRequest(RemoteBox_Url); 24 19 25 20 var ready = function(data) { … … 34 29 35 30 d.addCallbacks(ready, error); 31 d.addCallbacks(remotebox_function, null); 32 } 33 34 function RemoteBox_Comments(begin_comm, max_comm, focus_on_comments, display) { 35 var RemoteBox_Base_Url = RemoteBox_Url; 36 37 RemoteBox_Url = RemoteBox_Url + "&display=" + display + 38 "&begin_comm=" + begin_comm + 39 "&max_comm=" + max_comm; 40 if (focus_on_comments == true) { 41 var remotebox_function = function() { 42 // set the anchor to the "comentarii" element 43 window.location.hash = "comentarii"; 44 } 45 RemoteBox_Load(remotebox_function); 46 } else { 47 RemoteBox_Load(null); 48 } 49 50 RemoteBox_Url = RemoteBox_Base_Url; 36 51 } 37 52 -
trunk/www/views/blog_view.php
r1004 r1032 35 35 echo '</div>'; 36 36 // blog comments 37 echo '<div id="comentarii">';38 37 if (getattr($view, 'forum_topic')) { 39 38 echo macro_smfcomments(array('topic_id' => $view['forum_topic'], 'display' => 'show')); 40 39 } 41 echo '</div> </div>';40 echo '</div>'; 42 41 echo '</div>'; 43 42 -
trunk/www/views/textblock_view.php
r1004 r1032 20 20 21 21 // page comments 22 echo '<div id="comentarii">';23 22 if (getattr($view, 'forum_topic')) { 24 23 require_once(IA_ROOT_DIR.'www/macros/macro_smfcomments.php'); 25 24 echo macro_smfcomments(array('topic_id' => $view['forum_topic'], 'display' => 'hide')); 26 25 } 27 echo '</div>';28 26 29 27 // site footer
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)