r65922 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65921‎ | r65922 | r65923 >
Date:23:29, 4 May 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Fixed issues with continue parameter
Modified paths:
  • /trunk/extensions/Storyboard/api/ApiQueryStories.php (modified) (history)
  • /trunk/extensions/Storyboard/jquery/jquery.ajaxscroll.js (modified) (history)
  • /trunk/extensions/Storyboard/tags/Storyboard/storyboard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/jquery/jquery.ajaxscroll.js
@@ -82,8 +82,6 @@
8383 $b = jQuery( opt.batchTemplate )
8484 .attr({
8585 offset: offset,
86 - storymodified: window.storyModified,
87 - storyid: window.storyId,
8886 len: opt.batchSize
8987 })
9088 .addClass( opt.batchClass + " " + opt.emptyBatchClass );
Index: trunk/extensions/Storyboard/tags/Storyboard/storyboard.js
@@ -27,19 +27,16 @@
2828 'stlimit': 2,
2929 'stlanguage': window.storyboardLanguage
3030 };
31 -
32 - if ( $storyboard.attr( 'storymodified' ) ) {
33 - requestArgs.stcontinue = $storyboard.attr( 'storymodified' );
34 -
35 - requestArgs.stcontinue += '-' +
36 - ( $storyboard.attr( 'storyid' ) ? $storyboard.attr( 'storyid' ) : '0' );
 31+
 32+ if ( window.storyContinueParam ) {
 33+ requestArgs.stcontinue = window.storyContinueParam.stories.stcontinue;
3734 }
38 -
 35+
3936 $.getJSON( wgScriptPath + '/api.php',
4037 requestArgs,
4138 function( data ) {
4239 if ( data.query ) {
43 - addStories( $storyboard, data.query );
 40+ addStories( $storyboard, data );
4441 } else {
4542 alert( 'An error occured:\n' + data.error.info ); // TODO: i18n
4643 }
@@ -47,19 +44,19 @@
4845 );
4946 }
5047
51 - function addStories( $storyboard, query ) {
 48+ function addStories( $storyboard, data ) {
5249 // Remove the empty boxes.
5350 $storyboard.html( '' );
5451
55 - for ( var i in query.stories ) {
56 - var story = query.stories[i];
 52+ for ( var i in data.query.stories ) {
 53+ var story = data.query.stories[i];
5754 var $storyBody = $( "<div />" ).addClass( "storyboard-box" );
5855
5956 var $header = $( "<div />" ).addClass( "story-header" ).appendTo( $storyBody );
6057 $( "<div />" ).addClass( "story-title" ).text( story.title ).appendTo( $header );
6158
62 - var deliciousUrl = "http://delicious.com/save?jump=yes&url=" + encodeURIComponent( story.permalink ) + "&title=" + encodeURIComponent( story.title );
63 - var facebookUrl = "http://www.facebook.com/sharer.php?u=" + encodeURIComponent( story.permalink ) + '&t=' + encodeURIComponent( story.title );
 59+ var deliciousUrl = "http://delicious.com/save?jump=yes&amp;url=" + encodeURIComponent( story.permalink ) + "&amp;title=" + encodeURIComponent( story.title );
 60+ var facebookUrl = "http://www.facebook.com/sharer.php?u=" + encodeURIComponent( story.permalink ) + '&amp;t=' + encodeURIComponent( story.title );
6461
6562 $( "<div />" )
6663 .addClass( "story-sharing" )
@@ -124,9 +121,7 @@
125122 $storyboard.append( $storyBody );
126123 }
127124
128 - var story = query.stories[query.stories.length - 1];
129 - window.storyModified = story.modified;
130 - window.storyId = story.id;
 125+ window.storyContinueParam = data["query-continue"] ? data["query-continue"] : false;
131126
132127 window.storyboardBusy = false;
133128 }
Index: trunk/extensions/Storyboard/api/ApiQueryStories.php
@@ -82,7 +82,7 @@
8383 }
8484
8585 $this->addOption( 'LIMIT', $params['limit'] + 1 );
86 - $this->addOption( 'ORDER BY', 'story_modified, story_id DESC' );
 86+ $this->addOption( 'ORDER BY', 'story_modified DESC, story_id DESC' );
8787
8888 if ( !is_null( $params['language'] ) ) {
8989 $this->addWhere( "story_lang_code = '$params[language]'" );
@@ -102,7 +102,7 @@
103103
104104 $this->addWhere(
105105 "story_modified < $storyModified OR " .
106 - "(story_modified = $storyId AND story_id <= $storyModified)"
 106+ "(story_modified = $storyModified AND story_id <= $storyId)"
107107 );
108108 }
109109
@@ -121,10 +121,8 @@
122122 'id' => $story->story_id,
123123 'author' => $story->story_author_name,
124124 'title' => $story->story_title,
125 - //'created' => wfTimestamp( TS_ISO_8601, $story->story_created ),
126 - //'modified' => wfTimestamp( TS_ISO_8601, $story->story_modified ),
127 - 'created' => $story->story_created,
128 - 'modified' => $story->story_modified,
 125+ 'created' => wfTimestamp( TS_ISO_8601, $story->story_created ),
 126+ 'modified' => wfTimestamp( TS_ISO_8601, $story->story_modified ),
129127 'imageurl' => $story->story_author_image,
130128 'permalink' => SpecialPage::getTitleFor( 'story', $story->story_title )->getFullURL()
131129 );

Status & tagging log