r57395 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57394‎ | r57395 | r57396 >
Date:19:35, 5 October 2009
Author:werdna
Status:deferred
Tags:
Comment:
Merge r57388 and r57389 (LiquidThreads AJAX watching)
Modified paths:
  • /branches/wmf-deployment/extensions/LiquidThreads (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/classes/View.php (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/lqt.css (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/lqt.js (modified) (history)
  • /branches/wmf-deployment/includes (modified) (history)
  • /branches/wmf-deployment/includes/ConfEditor.php (modified) (history)
  • /branches/wmf-deployment/includes/EditPage.php (modified) (history)
  • /branches/wmf-deployment/includes/HTMLForm.php (modified) (history)
  • /branches/wmf-deployment/includes/HistoryPage.php (modified) (history)
  • /branches/wmf-deployment/includes/Linker.php (modified) (history)
  • /branches/wmf-deployment/includes/Skin.php (modified) (history)
  • /branches/wmf-deployment/includes/Title.php (modified) (history)
  • /branches/wmf-deployment/includes/Xml.php (modified) (history)
  • /branches/wmf-deployment/includes/api/ApiMain.php (modified) (history)
  • /branches/wmf-deployment/includes/json/Services_JSON.php (modified) (history)
  • /branches/wmf-deployment/includes/specials (modified) (history)
  • /branches/wmf-deployment/includes/specials/SpecialContributions.php (modified) (history)
  • /branches/wmf-deployment/includes/specials/SpecialUpload.php (modified) (history)
  • /branches/wmf-deployment/includes/specials/SpecialUserrights.php (modified) (history)
  • /branches/wmf-deployment/includes/upload/UploadBase.php (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/extensions/LiquidThreads/lqt.css
@@ -488,3 +488,11 @@
489489 .mw-lqt-newmessages-left {
490490 width: 10em ;
491491 }
 492+
 493+.lqt-command-working {
 494+ padding: 10px !important;
 495+ margin-right: 0.6em;
 496+ background-image: url(../../skins/common/images/spinner.gif);
 497+ background-position: middle middle;
 498+ background-repeat: no-repeat;
 499+}
Index: branches/wmf-deployment/extensions/LiquidThreads/classes/View.php
@@ -643,7 +643,7 @@
644644 wfLoadExtensionMessages( 'LiquidThreads' );
645645
646646 $messages = array( 'lqt-quote-intro', 'lqt-quote', 'lqt-ajax-updated',
647 - 'lqt-ajax-update-link' );
 647+ 'lqt-ajax-update-link', 'watch', 'unwatch' );
648648 $data = array();
649649
650650 foreach( $messages as $msg ) {
@@ -882,8 +882,10 @@
883883 $commands_html = "";
884884 } else {
885885 $lis = $this->listItemsForCommands( $this->topLevelThreadCommands( $thread ) );
 886+ $id = 'lqt-threadlevel-commands-'.$thread->id();
886887 $commands_html = Xml::tags( 'ul',
887 - array( 'class' => 'lqt_threadlevel_commands' ),
 888+ array( 'class' => 'lqt_threadlevel_commands',
 889+ 'id' => $id ),
888890 $lis );
889891 }
890892
@@ -1038,7 +1040,13 @@
10391041 wfTimestamp( TS_MW, $thread->modified() ),
10401042 array( 'id' => 'lqt-thread-modified-'.$thread->id(),
10411043 'class' => 'lqt-thread-modified' ) );
1042 - }
 1044+ }
 1045+
 1046+ // Add the thread's title
 1047+ $html .= Xml::hidden( 'lqt-thread-title-'.$thread->id(),
 1048+ $thread->title()->getPrefixedText(),
 1049+ array( 'id' => 'lqt-thread-title-'.$thread->id(),
 1050+ 'class' => 'lqt-thread-title-metadata' ) );
10431051
10441052 // Flush output to display thread
10451053 $this->output->addHTML( $html );
Index: branches/wmf-deployment/extensions/LiquidThreads/lqt.js
@@ -480,6 +480,44 @@
481481 }, 'json' );
482482
483483 $j(this).remove();
 484+ },
 485+
 486+ 'asyncWatch' : function(e) {
 487+ var button = $j(this);
 488+ var tlcOffset = "lqt-threadlevel-commands-".length;
 489+
 490+ // Find the title of the thread
 491+ var threadLevelCommands = button.closest('.lqt_threadlevel_commands');
 492+ var threadID = threadLevelCommands.attr('id').substring( tlcOffset );
 493+ var title = $j('#lqt-thread-title-'+threadID).val();
 494+
 495+ // Check if we're watching or unwatching.
 496+ var action = '';
 497+ if ( button.hasClass( 'lqt-command-watch' ) ) {
 498+ button.removeClass( 'lqt-command-watch' );
 499+ action = 'watch';
 500+ } else if ( button.hasClass( 'lqt-command-unwatch' ) ) {
 501+ button.removeClass( 'lqt-command-unwatch' );
 502+ action = 'unwatch';
 503+ }
 504+
 505+ // Replace the watch link with a spinner
 506+ button.empty().addClass( 'lqt-command-working' );
 507+
 508+ // Do the AJAX call.
 509+ var apiParams = { 'action' : 'watch', 'title' : title, 'format' : 'json' };
 510+
 511+ if (action == 'unwatch') {
 512+ apiParams.unwatch = 'yes';
 513+ }
 514+
 515+ $j.get( wgScriptPath+'/api'+wgScriptExtension, apiParams,
 516+ function( data ) {
 517+ threadLevelCommands.load( window.location.href+' '+
 518+ '#'+threadLevelCommands.attr('id')+' > *' );
 519+ }, 'json' );
 520+
 521+ e.preventDefault();
484522 }
485523 }
486524
@@ -524,6 +562,10 @@
525563 liquidThreads.setupThread( this );
526564 } );
527565
 566+ // Live bind for unwatch/watch stuff.
 567+ $j('.lqt-command-watch').live( 'click', liquidThreads.asyncWatch );
 568+ $j('.lqt-command-unwatch').live( 'click', liquidThreads.asyncWatch );
 569+
528570 // Set up periodic update checking
529571 setInterval( liquidThreads.checkForUpdates, 60000 );
530572 } );
Property changes on: branches/wmf-deployment/extensions/LiquidThreads
___________________________________________________________________
Modified: svn:mergeinfo
531573 Merged /trunk/extensions/LiquidThreads:r57389
Property changes on: branches/wmf-deployment/includes/EditPage.php
___________________________________________________________________
Modified: svn:mergeinfo
532574 Merged /trunk/phase3/includes/EditPage.php:r57388-57389
Property changes on: branches/wmf-deployment/includes/HTMLForm.php
___________________________________________________________________
Modified: svn:mergeinfo
533575 Merged /trunk/phase3/includes/HTMLForm.php:r57388-57389
Property changes on: branches/wmf-deployment/includes/HistoryPage.php
___________________________________________________________________
Modified: svn:mergeinfo
534576 Merged /trunk/phase3/includes/HistoryPage.php:r57388-57389
Property changes on: branches/wmf-deployment/includes/api/ApiMain.php
___________________________________________________________________
Modified: svn:mergeinfo
535577 Merged /trunk/phase3/includes/api/ApiMain.php:r57388-57389
Property changes on: branches/wmf-deployment/includes/Title.php
___________________________________________________________________
Modified: svn:mergeinfo
536578 Merged /trunk/phase3/includes/Title.php:r57388-57389
Property changes on: branches/wmf-deployment/includes/ConfEditor.php
___________________________________________________________________
Modified: svn:mergeinfo
537579 Merged /trunk/phase3/includes/ConfEditor.php:r57388-57389
Property changes on: branches/wmf-deployment/includes/specials/SpecialUserrights.php
___________________________________________________________________
Modified: svn:mergeinfo
538580 Merged /trunk/phase3/includes/specials/SpecialUserrights.php:r57388-57389
Property changes on: branches/wmf-deployment/includes/specials/SpecialContributions.php
___________________________________________________________________
Modified: svn:mergeinfo
539581 Merged /trunk/phase3/includes/specials/SpecialContributions.php:r57388-57389
Property changes on: branches/wmf-deployment/includes/specials/SpecialUpload.php
___________________________________________________________________
Modified: svn:mergeinfo
540582 Merged /trunk/phase3/includes/specials/SpecialUpload.php:r57388-57389
Property changes on: branches/wmf-deployment/includes/specials
___________________________________________________________________
Modified: svn:mergeinfo
541583 Merged /trunk/phase3/includes/specials:r57388-57389
Index: branches/wmf-deployment/includes/Skin.php
@@ -355,7 +355,7 @@
356356 # Weird back-compat stuff.
357357 $skinName = $skinName['skinname'];
358358 }
359 - global $wgScript, $wgTitle, $wgStylePath, $wgUser;
 359+ global $wgScript, $wgTitle, $wgStylePath, $wgUser, $wgScriptExtension;
360360 global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang;
361361 global $wgCanonicalNamespaceNames, $wgOut, $wgArticle;
362362 global $wgBreakFrames, $wgRequest, $wgVariantArticlePath, $wgActionPaths;
@@ -385,6 +385,7 @@
386386 'stylepath' => $wgStylePath,
387387 'wgArticlePath' => $wgArticlePath,
388388 'wgScriptPath' => $wgScriptPath,
 389+ 'wgScriptExtension' => $wgScriptExtension,
389390 'wgScript' => $wgScript,
390391 'wgVariantArticlePath' => $wgVariantArticlePath,
391392 'wgActionPaths' => (object)$wgActionPaths,
Property changes on: branches/wmf-deployment/includes/Skin.php
___________________________________________________________________
Modified: svn:mergeinfo
392393 Merged /trunk/phase3/includes/Skin.php:r57388-57389
Property changes on: branches/wmf-deployment/includes/upload/UploadBase.php
___________________________________________________________________
Modified: svn:mergeinfo
393394 Merged /trunk/phase3/includes/upload/UploadBase.php:r57388-57389
Property changes on: branches/wmf-deployment/includes/Xml.php
___________________________________________________________________
Modified: svn:mergeinfo
394395 Merged /trunk/phase3/includes/Xml.php:r57388-57389
Property changes on: branches/wmf-deployment/includes/json/Services_JSON.php
___________________________________________________________________
Modified: svn:mergeinfo
395396 Merged /trunk/phase3/includes/json/Services_JSON.php:r57388-57389
Property changes on: branches/wmf-deployment/includes/Linker.php
___________________________________________________________________
Modified: svn:mergeinfo
396397 Merged /trunk/phase3/includes/Linker.php:r57388-57389
Property changes on: branches/wmf-deployment/includes
___________________________________________________________________
Modified: svn:mergeinfo
397398 Merged /trunk/phase3/includes:r57388-57389

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r57388Include wgScriptExtension in exported JS varswerdna15:34, 5 October 2009
r57389LiquidThreads: Turn watch / unwatch links AJAX-y. Replaces the link with a sp...werdna15:36, 5 October 2009

Status & tagging log