Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki-CVS

SVN: [59429] branches/wmf-deployment/extensions/LiquidThreads_alpha

 

 

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded


werdna at svn

Nov 25, 2009, 10:05 AM

Post #1 of 1 (81 views)
Permalink
SVN: [59429] branches/wmf-deployment/extensions/LiquidThreads_alpha

http://www.mediawiki.org/wiki/Special:Code/MediaWiki/59429

Revision: 59429
Author: werdna
Date: 2009-11-25 18:05:03 +0000 (Wed, 25 Nov 2009)

Log Message:
-----------
Update LiquidThreads alpha to trunk state

Modified Paths:
--------------
branches/wmf-deployment/extensions/LiquidThreads_alpha/LiquidThreads.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/api/ApiThreadAction.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Dispatch.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Hooks.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Thread.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Threads.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/View.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.css
branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js
branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/IndividualThreadHistoryView.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageHeaderView.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageHistoryView.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageView.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadDiffView.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadHistoricalRevisionView.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadHistoryListingView.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadPermalinkView.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadProtectionFormView.php
branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadWatchView.php

Property Changed:
----------------
branches/wmf-deployment/extensions/LiquidThreads_alpha/
branches/wmf-deployment/extensions/LiquidThreads_alpha/i18n/Lqt.i18n.php


Property changes on: branches/wmf-deployment/extensions/LiquidThreads_alpha
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk/extensions/LiquidThreads:57390,58990-59196,59198-59218,59221-59351,59353,59417,59420,59423
+ /trunk/extensions/LiquidThreads:57390,58990-59196,59198-59218,59221-59351,59353-59427

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/LiquidThreads.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/LiquidThreads.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/LiquidThreads.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -47,6 +47,8 @@
// Hooks
// Main dispatch hook
$wgHooks['MediaWikiPerformAction'][] = 'LqtDispatch::tryPage';
+$wgHooks['SkinTemplateTabs'][] = 'LqtDispatch::onSkinTemplateTabs';
+$wgHooks['SkinTemplateNavigation'][] = 'LqtDispatch::onSkinTemplateNavigation';

// Customisation of recentchanges
//$wgHooks['OldChangesListRecentChangesLine'][] = 'LqtHooks::customizeOldChangesList';

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/api/ApiThreadAction.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/api/ApiThreadAction.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/api/ApiThreadAction.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -30,6 +30,11 @@
'text' => 'The text of the post to create',
'render' => 'If set, on post/reply methods, the top-level thread '.
'after the change will be rendered and returned in the result.',
+ 'bump' => 'If set, overrides default behaviour as to whether or not to ',
+ "increase the thread's sort key. If true, sets it to current ".
+ "timestamp. If false, does not set it. Default depends on ".
+ "the action being taken. Presently only works for newthread ".
+ "and reply actions.",
);
}

@@ -54,6 +59,7 @@
'newparent' => null,
'text' => null,
'render' => null,
+ 'bump' => null,
);
}

@@ -294,6 +300,8 @@
return;
}

+ $bump = isset($params['bump']) ? $params['bump'] : null;
+
$subject = $params['subject'];
$title = null;
$subjectOk = Thread::validateSubject( $subject, $title, null, $talkpage );
@@ -357,7 +365,7 @@
$title->resetArticleID( $articleId );

$thread = LqtView::postEditUpdates( 'new', null, $article, $talkpage,
- $subject, $summary, null, $text );
+ $subject, $summary, null, $text, $bump );

$maxLag = wfGetLB()->getMaxLag();
$maxLag = $maxLag[1];
@@ -414,6 +422,8 @@

$text = $params['text'];

+ $bump = isset($params['bump']) ? $params['bump'] : null;
+
// Generate/pull summary
$summary = wfMsgForContent( 'lqt-reply-summary', $replyTo->subject(),
$replyTo->title()->getPrefixedText() );
@@ -468,7 +478,7 @@
$title->resetArticleID( $articleId );

$thread = LqtView::postEditUpdates( 'reply', $replyTo, $article, $talkpage,
- $subject, $summary, null, $text );
+ $subject, $summary, null, $text, $bump );

$maxLag = wfGetLB()->getMaxLag();
$maxLag = $maxLag[1];

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Dispatch.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Dispatch.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Dispatch.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -3,6 +3,7 @@
class LqtDispatch {
/** static cache of per-page LiquidThreads activation setting */
static $userLqtOverride;
+ static $primaryView = null;

static function talkpageMain( &$output, &$article, &$title, &$user, &$request ) {
// We are given a talkpage article and title. Fire up a TalkpageView
@@ -48,7 +49,9 @@
} else {
$viewname = 'TalkpageView';
}
+
$view = new $viewname( $output, $article, $title, $user, $request );
+ self::$primaryView = $view;
return $view->show();
}

@@ -79,12 +82,14 @@
}

$view = new $viewname( $output, $article, $title, $user, $request );
+ self::$primaryView = $view;
return $view->show();
}

static function threadSummaryMain( &$output, &$article, &$title, &$user, &$request ) {
$viewname = 'SummaryPageView';
$view = new $viewname( $output, $article, $title, $user, $request );
+ self::$primaryView = $view;
return $view->show();
}

@@ -167,4 +172,20 @@
}
return true;
}
+
+ static function onSkinTemplateNavigation( $skinTemplate, &$links ) {
+ if ( !self::$primaryView ) return true;
+
+ self::$primaryView->customizeNavigation( $skinTemplate, $links );
+
+ return true;
+ }
+
+ static function onSkinTemplateTabs( $skinTemplate, &$links ) {
+ if ( !self::$primaryView ) return true;
+
+ self::$primaryView->customizeTabs( $skinTemplate, $links );
+
+ return true;
+ }
}

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Hooks.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Hooks.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Hooks.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -283,6 +283,7 @@
}

static function editCheckboxes( $editPage, &$checkboxes, &$tabIndex ) {
+ global $wgRequest;
$article = $editPage->getArticle();
$title = $article->getTitle();

@@ -290,6 +291,25 @@
unset( $checkboxes['minor'] );
}

+ if ( $title->getNamespace() == NS_LQT_THREAD && self::$editType != 'new' ) {
+ wfLoadExtensionMessages( 'LiquidThreads' );
+ $label = wfMsgExt( 'lqt-edit-bump', 'parseinline' );
+ $tooltip = wfMsgExt( 'lqt-edit-bump-tooltip', 'parsemag' );
+
+ $checked = ! $wgRequest->wasPosted() ||
+ $wgRequest->getBool( 'wpBumpThread' );
+
+ $html =
+ Xml::check( 'wpBumpThread', $checked, array(
+ 'title' => $tooltip, 'id' => 'wpBumpThread'
+ ) );
+
+ $html .= Xml::tags( 'label', array( 'for' => 'wpBumpThread',
+ 'title' => $tooltip ), $label );
+
+ $checkboxes['bump'] = $html;
+ }
+
return true;
}


Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Thread.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Thread.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Thread.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -55,7 +55,8 @@
}

static function create( $root, $article, $superthread = null,
- $type = Threads::TYPE_NORMAL, $subject = '' ) {
+ $type = Threads::TYPE_NORMAL, $subject = '',
+ $summary = '', $bump = null ) {

$dbw = wfGetDB( DB_MASTER );

@@ -91,7 +92,7 @@
if ( $superthread ) {
$superthread->addReply( $thread );

- $superthread->commitRevision( $change_type, $thread );
+ $superthread->commitRevision( $change_type, $thread, $summary, $bump );
} else {
$hthread = ThreadRevision::create( $thread, $change_type );
}

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Threads.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Threads.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/Threads.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -51,11 +51,6 @@
static $cache_by_id = array();
static $occupied_titles = array();

- static function newThread( $root, $article, $superthread = null,
- $type = self::TYPE_NORMAL, $subject = '' ) {
- return Thread::create( $root, $article, $superthread, $type, $subject );
- }
-
/**
* Create the talkpage if it doesn't exist so that links to it
* will show up blue instead of red. For use upon new thread creation.
@@ -196,7 +191,7 @@
static function newReplyTitle( $thread, $user ) {
$topThread = $thread->topmostThread();

- $base = $topThread->title()->getText() . '/' . $user->getName();
+ $base = $topThread->title()->getText() . '/reply';

return self::incrementedTitle( $base, NS_LQT_THREAD );
}

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/View.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/View.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/classes/View.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -419,13 +419,30 @@
wfMsgExt( $msg, 'parse' ) );
}

+ global $wgRequest;
// Quietly force a preview if no subject has been specified.
if ( ( !$valid_subject && $subject ) || ( $subject_expected && !$subject ) ) {
// Dirty hack to prevent saving from going ahead
- global $wgRequest;
$wgRequest->setVal( 'wpPreview', true );
}

+ // For new posts and replies, remove the summary field and use a boilerplate
+ // default.
+ if ( $edit_type == 'new' ) {
+ $e->mShowSummaryField = false;
+
+ $summary = wfMsgForContent( 'lqt-newpost-summary', $subject );
+ $wgRequest->setVal( 'wpSummary', $summary );
+ } elseif ( $edit_type == 'reply' ) {
+ $e->mShowSummaryField = false;
+
+ $reply_subject = $edit_applies_to->subject();
+ $reply_title = $edit_applies_to->title()->getPrefixedText();
+ $summary = wfMsgForContent( 'lqt-reply-summary',
+ $reply_subject, $reply_title );
+ $wgRequest->setVal( 'wpSummary', $summary );
+ }
+
// Add an offset so it works if it's on the wrong page.
if ( $edit_applies_to ) {
$dbr = wfGetDB( DB_SLAVE );
@@ -493,10 +510,12 @@
// $this->renameThread( $thread, $subject, $e->summary );
}

+ $bump = $this->request->getBool( 'wpBumpThread' );
+
$thread = self::postEditUpdates(
$edit_type, $edit_applies_to, $article,
$this->article, $subject, $e->summary, $thread,
- $e->textbox1
+ $e->textbox1, $bump
);

if ( $submitted_nonce && $nonce_key ) {
@@ -520,22 +539,25 @@
}

static function postEditUpdates( $edit_type, $edit_applies_to, $edit_page, $article,
- $subject, $edit_summary, $thread, $new_text ) {
+ $subject, $edit_summary, $thread, $new_text,
+ $bump = null ) {
// Update metadata - create and update thread and thread revision objects as
// appropriate.

if ( $edit_type == 'reply' ) {
$subject = $edit_applies_to->subject();

- $thread = Threads::newThread( $edit_page, $article, $edit_applies_to,
- Threads::TYPE_NORMAL, $subject );
+ $thread = Thread::create( $edit_page, $article, $edit_applies_to,
+ Threads::TYPE_NORMAL, $subject,
+ $edit_summary, $bump );

global $wgUser;
NewMessages::markThreadAsReadByUser( $edit_applies_to, $wgUser );
} elseif ( $edit_type == 'summarize' ) {
$edit_applies_to->setSummary( $edit_page );
$edit_applies_to->commitRevision( Threads::CHANGE_EDITED_SUMMARY,
- $edit_applies_to, $edit_summary );
+ $edit_applies_to, $edit_summary,
+ $bump);
} elseif ( $edit_type == 'editExisting' ) {
// Use a separate type if the content is blanked.
$type = strlen( trim( $new_text ) )
@@ -543,10 +565,11 @@
: Threads::CHANGE_ROOT_BLANKED;

// Add the history entry.
- $thread->commitRevision( $type, $thread, $edit_summary );
+ $thread->commitRevision( $type, $thread, $edit_summary, $bump );
} else {
- $thread = Threads::newThread( $edit_page, $article, null,
- Threads::TYPE_NORMAL, $subject );
+ $thread = Thread::create( $edit_page, $article, null,
+ Threads::TYPE_NORMAL, $subject,
+ $edit_summary );
}

return $thread;
@@ -1279,7 +1302,7 @@
$repliesClass = 'lqt-thread-replies lqt-thread-replies-' .
$this->threadNestingLevel;
$div = Xml::openElement( 'div', array( 'class' => $repliesClass ) );
- $this->output->addHTML( $div );
+ $sep = Xml::tags( 'div', array( 'class' => 'lqt-post-sep' ), ' ' );

$subthreadCount = count( $thread->subthreads() );
$i = 0;
@@ -1303,7 +1326,7 @@
// We've shown too many threads.
$link = $this->getShowMore( $thread, $st, $i );

- $this->output->addHTML( $link );
+ $this->output->addHTML( $div.$link );
$showThreads = false;
continue;
}
@@ -1312,10 +1335,7 @@
if ( $showCount == 1 ) {
// There's a post sep before each reply group to
// separate from the parent thread.
- $this->output->addHTML(
- Xml::tags( 'div',
- array( 'class' => 'lqt-post-sep' ),
- ' ' ) );
+ $this->output->addHTML( $sep.$div );
}

$this->showThread( $st, $i, $subthreadCount, $cascadeOptions );
@@ -1583,4 +1603,16 @@

return $sig;
}
+
+ function customizeTabs( $skin, &$links ) {
+ // No-op
+ }
+
+ function customizeNavigation( $skin, &$links ) {
+ // No-op
+ }
+
+ function show() {
+ return true; // No-op
+ }
}


Property changes on: branches/wmf-deployment/extensions/LiquidThreads_alpha/i18n/Lqt.i18n.php
___________________________________________________________________
Deleted: svn:mergeinfo
- /trunk/extensions/LiquidThreads/i18n/Lqt.i18n.php:57390,58990-59196,59198-59218,59221-59351,59353,59356-59424

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.css
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.css 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.css 2009-11-25 18:05:03 UTC (rev 59429)
@@ -1,11 +1,3 @@
-
-#wpTextbox1 {
- /* Textareas in lqt use auto-sizing based on these properties */
- height: 7.5em;
- max-height: 30em;
- min-height: 7.5em;
-}
-
.lqt_watchlist_messages_notice {
background-color: #eee;
border: 1px solid #ddd;
@@ -312,7 +304,6 @@
}

div.lqt-post-sep {
- height: 1px;
padding: 0;
margin: 0;
margin-left: 1em;
@@ -321,6 +312,7 @@
background-position: bottom;
background-repeat: repeat-x;
clear: both;
+ line-height: 1em;
}

.lqt-thread-first > .lqt-post-wrapper {

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js 2009-11-25 18:05:03 UTC (rev 59429)
@@ -97,7 +97,7 @@
var cancelButton = $j(container).find('#mw-editform-cancel');
cancelButton.click( liquidThreads.cancelEdit );

- $j(container).find('#wpTextbox1')[0].rows = 10;
+ $j(container).find('#wpTextbox1').attr( 'rows', 12 );

// Add toolbar
mwSetupToolbar();
@@ -466,6 +466,7 @@
var threadId = thread.data('thread-id');
var replies = thread.parent().find('.lqt-thread-replies');
var loader = $j('<div class="mw-ajax-loader"/>');
+ var sep = $j('<div class="lqt-post-sep">&nbsp;</div>');

replies.empty();
replies.hide();
@@ -493,6 +494,8 @@
liquidThreads.setupThread( $j(this) );
} );

+ replies.before(sep);
+
// Show
loader.remove();
replies.fadeIn('slow');
@@ -641,8 +644,15 @@

var text = editform.find('#wpTextbox1').val();
var summary = editform.find('#wpSummary').val();
+
+ // Check if summary is undefined
+ if (summary === undefined) {
+ summary = '';
+ }
+
var subject = editform.find( '#lqt_subject_field' ).val();
var replyThread = editform.find('input[name=lqt_operand]').val();
+ var bump = editform.find('#wpBumpThread').is(':checked') ? 1 : 0;

var spinner = $j('<div class="mw-ajax-loader"/>');
editform.prepend(spinner);
@@ -747,18 +757,19 @@
};

if ( type == 'reply' ) {
- liquidThreads.doReply( replyThread, text, summary, doneCallback);
+ liquidThreads.doReply( replyThread, text, summary,
+ doneCallback, bump );

e.preventDefault();
} else if ( type == 'talkpage_new_thread' ) {
liquidThreads.doNewThread( wgPageName, subject, text, summary,
- doneCallback );
+ doneCallback, bump );

e.preventDefault();
}
},

- 'doNewThread' : function( talkpage, subject, text, summary, callback ) {
+ 'doNewThread' : function( talkpage, subject, text, summary, callback, bump ) {
liquidThreads.getToken(
function(token) {
var newTopicParams =
@@ -771,7 +782,8 @@
'token' : token,
'format' : 'json',
'render' : '1',
- 'reason' : summary
+ 'reason' : summary,
+ 'bump' : bump
};

$j.post( wgScriptPath+'/api'+wgScriptExtension, newTopicParams,
@@ -783,7 +795,7 @@
} );
},

- 'doReply' : function( thread, text, summary, callback ) {
+ 'doReply' : function( thread, text, summary, callback, bump ) {
liquidThreads.getToken(
function(token) {
var replyParams =
@@ -795,7 +807,8 @@
'token' : token,
'format' : 'json',
'render' : '1',
- 'reason' : summary
+ 'reason' : summary,
+ 'bump' : bump
};

$j.post( wgScriptPath+'/api'+wgScriptExtension, replyParams,

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/IndividualThreadHistoryView.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/IndividualThreadHistoryView.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/IndividualThreadHistoryView.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -5,11 +5,17 @@
class IndividualThreadHistoryView extends ThreadPermalinkView {
protected $oldid;

- function customizeTabs( $skintemplate, $content_actions ) {
+ function customizeTabs( $skintemplate, &$content_actions ) {
$content_actions['history']['class'] = 'selected';
parent::customizeTabs( $skintemplate, $content_actions );
return true;
}
+
+ function customizeNavigation( $skin, &$links ) {
+ $links['views']['history']['class'] = 'selected';
+ parent::customizeNavigation( $skin, $links );
+ return true;
+ }

/* This customizes the subtitle of a history *listing* from the hook,
and of an old revision from getSubtitle() below. */
@@ -40,8 +46,6 @@
return false;
}

- $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
-
$wgHooks['PageHistoryBeforeList'][] = array( $this, 'customizeSubtitle' );

return true;

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageHeaderView.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageHeaderView.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageHeaderView.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -4,7 +4,7 @@
// Pass-through wrapper with an extra note at the top

class TalkpageHeaderView extends LqtView {
- function customizeTabs( $skintemplate, $content_actions ) {
+ function customizeTabs( $skintemplate, &$content_actions ) {
unset( $content_actions['edit'] );
unset( $content_actions['addsection'] );
unset( $content_actions['history'] );
@@ -15,16 +15,28 @@
$content_actions['header'] = array(
'class' => 'selected',
'text' => wfMsg( 'lqt-talkpage-history-tab' ),
- 'href' => ''
+ 'href' => '',
);
-
- return true;
}
+
+ function customizeNavigation( $skin, &$links ) {
+ $remove = array( 'actions/edit', 'actions/addsection', 'views/history',
+ 'actions/watch', 'actions/move' );
+
+ foreach( $remove as $rem ) {
+ list($section, $item) = explode( '/', $rem, 2 );
+ unset( $links[$section][$item] );
+ }
+
+ $links['views']['header'] = array(
+ 'class' => 'selected',
+ 'text' => wfMsg( 'lqt-talkpage-history-tab' ),
+ 'href' => '',
+ );
+ }

function show() {
- global $wgHooks, $wgOut, $wgTitle, $wgRequest;
- // Why is a hook added here?
- $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
+ global $wgOut, $wgTitle, $wgRequest;

if ( $wgRequest->getVal( 'action' ) === 'edit' ) {
wfLoadExtensionMessages( 'LiquidThreads' );

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageHistoryView.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageHistoryView.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageHistoryView.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -4,9 +4,8 @@

class TalkpageHistoryView extends TalkpageView {
function show() {
- global $wgHooks, $wgUser;
- $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
-
+ global $wgUser;
+
self::addJSandCSS();
wfLoadExtensionMessages( 'LiquidThreads' );

@@ -32,6 +31,19 @@

return false;
}
+
+ function customizeTabs( $skin, &$links ) {
+ TalkpageView::customizeTalkpageTabs( $skin, $links, $this );
+
+ $tabid = $this->article->getTitle()->getNamespaceKey();
+ $links['history']['class'] = 'selected';
+ }
+
+ function customizeNavigation( $skin, &$links ) {
+ TalkpageView::customizeTalkpageNavigation( $skin, $links, $this );
+ $links['views']['history']['class'] = 'selected';
+ $links['views']['view']['class'] = '';
+ }
}

class TalkpageHistoryPager extends ThreadHistoryPager {

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageView.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageView.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/TalkpageView.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -4,7 +4,7 @@

class TalkpageView extends LqtView {
/* Added to SkinTemplateTabs hook in TalkpageView::show(). */
- function customizeTabs( $skintemplate, &$content_actions ) {
+ static function customizeTalkpageTabs( $skintemplate, &$content_actions, $view ) {
// The arguments are passed in by reference.
unset( $content_actions['edit'] );
unset( $content_actions['viewsource'] );
@@ -12,13 +12,34 @@

# Protection against non-SkinTemplate skins
if ( isset( $content_actions['history'] ) ) {
- $thisTitle = $this->article->getTitle();
+ $thisTitle = $view->article->getTitle();
$history_url = $thisTitle->getFullURL( 'lqt_method=talkpage_history' );
$content_actions['history']['href'] = $history_url;
}
-
- return true;
}
+
+ static function customizeTalkpageNavigation( $skin, &$links, $view ) {
+ $remove = array( 'views/edit', 'views/viewsource', 'actions/delete' );
+
+ foreach( $remove as $rem ) {
+ list($section, $item) = explode( '/', $rem, 2 );
+ unset( $links[$section][$item] );
+ }
+
+ if ( isset( $links['views']['history'] ) ) {
+ $title = $view->article->getTitle();
+ $history_url = $title->getFullURL( 'lqt_method=talkpage_history' );
+ $links['views']['history']['href'] = $history_url;
+ }
+ }
+
+ function customizeTabs( $skintemplate, &$links ) {
+ self::customizeTalkpageTabs( $skintemplate, $links, $this );
+ }
+
+ function customizeNavigation( $skintemplate, &$links ) {
+ self::customizeTalkpageNavigation( $skintemplate, $links, $this );
+ }

function showHeader() {
/* Show the contents of the actual talkpage article if it exists. */
@@ -178,10 +199,7 @@
}

function show() {
- global $wgHooks;
wfLoadExtensionMessages( 'LiquidThreads' );
- // FIXME Why is a hook added here?
- $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );

$this->output->setPageTitle( $this->title->getPrefixedText() );
self::addJSandCSS();

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadDiffView.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadDiffView.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadDiffView.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -3,20 +3,22 @@
if ( !defined( 'MEDIAWIKI' ) ) die;

class ThreadDiffView {
- function customizeTabs( $skintemplate, $content_actions ) {
+ function customizeTabs( $skintemplate, &$content_actions ) {
unset( $content_actions['edit'] );
unset( $content_actions['viewsource'] );
unset( $content_actions['talk'] );

- $content_actions['talk']['class'] = false;
$content_actions['history']['class'] = 'selected';
-
- return true;
}
+
+ function customizeNavigation( $skin, &$links ) {
+ $remove = array( 'views/edit', 'views/viewsource' );

- function show() {
- global $wgHooks;
- $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
- return true;
+ foreach( $remove as $rem ) {
+ list($section, $item) = explode( '/', $rem, 2 );
+ unset( $links[$section][$item] );
+ }
+
+ $links['views']['history']['class'] = 'selected';
}
}

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadHistoricalRevisionView.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadHistoricalRevisionView.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadHistoricalRevisionView.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -114,9 +114,6 @@

$this->showHistoryInfo();

- global $wgHooks;
- $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
-
if ( !$this->thread ) {
$this->showMissingThreadPage();
return false;

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadHistoryListingView.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadHistoryListingView.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadHistoryListingView.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -4,9 +4,6 @@

class ThreadHistoryListingView extends ThreadPermalinkView {
function show() {
- global $wgHooks;
- $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
-
if ( ! $this->thread ) {
$this->showMissingThreadPage();
return false;
@@ -33,5 +30,16 @@

return false;
}
+
+ function customizeTabs( $skin, &$links ) {
+ parent::customizeTabs( $skin, $links );
+ $links['history']['class'] = 'selected';
+ }
+
+ function customizeNavigation( $skin, &$links ) {
+ parent::customizeNavigation( $skin, $links );
+ $links['views']['history']['class'] = 'selected';
+ $links['views']['view']['class'] = '';
+ }
}


Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadPermalinkView.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadPermalinkView.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadPermalinkView.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -4,62 +4,131 @@

class ThreadPermalinkView extends LqtView {
protected $thread;
+
+ function customizeTabs( $skin, &$links ) {
+ self::customizeThreadTabs( $skin, $links, $this );
+ }
+
+ function customizeNavigation( $skin, &$links ) {
+ self::customizeThreadNavigation( $skin, $links, $this );
+ }

- function customizeTabs( $skintemplate, $content_actions ) {
+ static function customizeThreadTabs( $skintemplate, &$content_actions, $view ) {
wfLoadExtensionMessages( 'LiquidThreads' );
- // Insert fake 'article' and 'discussion' tabs before the thread tab.
- // If you call the key 'talk', the url gets re-set later. TODO:
- // the access key for the talk tab doesn't work.
- if ( $this->thread ) {
- $article_t = $this->thread->article()->getTitle();
- $talk_t = $this->thread->article()->getTitle();
- } else {
+
+ if ( !$view->thread ) {
return true;
}

- $articleTab =
- array(
- 'text' => wfMsg( $article_t->getNamespaceKey() ),
- 'href' => $article_t->getFullURL(),
- 'class' => $article_t->exists() ? '' : 'new'
- );
- efInsertIntoAssoc( 'article', $articleTab, 'nstab-thread', $content_actions );
+ // Insert 'article' and 'discussion' tabs before the thread tab.

- $talkTab =
- array(
- // talkpage certainly exists since this thread is from it.
- 'text' => wfMsg( 'talk' ),
- 'href' => $talk_t->getFullURL()
- );
-
- efInsertIntoAssoc( 'not_talk', $talkTab, 'nstab-thread', $content_actions );
+ $tabs = self::getCustomTabs( $view );
+ $content_actions = $tabs + $content_actions;

unset( $content_actions['edit'] );
unset( $content_actions['viewsource'] );
unset( $content_actions['talk'] );

- $subpage = $this->thread->title()->getPrefixedText();
+ $subpage = $view->thread->title()->getPrefixedText();

- if ( array_key_exists( 'move', $content_actions ) && $this->thread ) {
+ // Repoint move/delete/history tabs
+ if ( array_key_exists( 'move', $content_actions ) && $view->thread ) {
$content_actions['move']['href'] =
- SpecialPage::getTitleFor( 'MoveThread', $subpage )->getFullURL();
+ SpecialPage::getTitleFor( 'MoveThread', $subpage )->getFullURL();
}

- if ( array_key_exists( 'delete', $content_actions ) && $this->thread ) {
+ if ( array_key_exists( 'delete', $content_actions ) && $view->thread ) {
$content_actions['delete']['href'] =
- $this->thread->title()->getFullURL( 'action=delete' );
+ $view->thread->title()->getFullURL( 'action=delete' );
}

if ( array_key_exists( 'history', $content_actions ) ) {
- $content_actions['history']['href'] = self::permalinkUrl( $this->thread, 'thread_history' );
- if ( $this->methodApplies( 'thread_history' ) ) {
+ $content_actions['history']['href'] = self::permalinkUrl( $view->thread, 'thread_history' );
+ if ( $view->methodApplies( 'thread_history' ) ) {
$content_actions['history']['class'] = 'selected';
}
}

return true;
}
+
+ static function customizeThreadNavigation( $skin, &$links, $view ) {
+ if ( !$view->thread ) {
+ return true;
+ }
+
+ // Insert 'article' and 'discussion' namespace-tabs
+ $new_nstabs = self::getCustomTabs( $view );
+
+ $nstabs =& $links['namespaces'];

+ $talkKey = $view->thread->title()->getNamespaceKey('').'_talk';
+ unset( $nstabs[$talkKey] );
+ $nstabs = $new_nstabs + $nstabs;
+
+ // Remove some views.
+ $views =& $links['views'];
+ unset( $views['viewsource'] );
+ unset( $views['edit'] );
+
+ // Re-point move, delete and history actions
+ $subpage = $view->thread->title()->getPrefixedText();
+ $actions =& $links['actions'];
+ if ( isset($actions['move']) ) {
+ $actions['move']['href'] =
+ SpecialPage::getTitleFor( 'MoveThread', $subpage )->getFullURL();
+ }
+
+ if ( isset($actions['delete']) ) {
+ $actions['delete']['href'] =
+ $view->thread->title()->getFullURL( 'action=delete' );
+ }
+
+ if ( isset($views['history']) ) {
+ $views['history']['href'] =
+ self::permalinkUrl( $view->thread, 'thread_history' );
+ if ( $view->methodApplies( 'thread_history' ) ) {
+ $views['history']['class'] = 'selected';
+ }
+ }
+ }
+
+ // Pre-generates the tabs to be included, for customizeTabs and customizeNavigation
+ // to insert in the appropriate place
+ static function getCustomTabs( $view ) {
+ $tabs = array();
+
+ $articleTitle = $view->thread->article()->getTitle()->getSubjectPage();
+ $talkTitle = $view->thread->article()->getTitle()->getTalkPage();
+
+ $articleClasses = array();
+ if ( !$articleTitle->exists() ) $articleClasses[] = 'new';
+ if ( $articleTitle->equals( $view->thread->article()->getTitle() ) )
+ $articleClasses[] = 'selected';
+
+ $talkClasses = array();
+ if ( !$talkTitle->exists() ) $talkClasses[] = 'new';
+ if ( $talkTitle->equals( $view->thread->article()->getTitle() ) )
+ $talkClasses[] = 'selected';
+
+ $tabs['article'] =
+ array(
+ 'text' => wfMsg( $articleTitle->getNamespaceKey() ),
+ 'href' => $articleTitle->getFullURL(),
+ 'class' => implode( ' ', $articleClasses ),
+ );
+
+ $tabs['lqt_talk'] =
+ array(
+ // talkpage certainly exists since this thread is from it.
+ 'text' => wfMsg( 'talk' ),
+ 'href' => $talkTitle->getFullURL(),
+ 'class' => implode( ' ', $talkClasses ),
+ );
+
+ return $tabs;
+ }
+
function showThreadHeading( $thread ) {
parent::showThreadHeading( $thread );
}
@@ -108,26 +177,21 @@
}

function __construct( &$output, &$article, &$title, &$user, &$request ) {
-
parent::__construct( $output, $article, $title, $user, $request );

$t = Threads::withRoot( $this->article );

$this->thread = $t;
if ( !$t ) {
- return; // error reporting is handled in show(). this kinda sucks.
+ return;
}

// $this->article gets saved to thread_article, so we want it to point to the
// subject page associated with the talkpage, always, not the permalink url.
$this->article = $t->article(); # for creating reply threads.
-
}

function show() {
- global $wgHooks;
- $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
-
if ( !$this->thread ) {
$this->showMissingThreadPage();
return false;

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadProtectionFormView.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadProtectionFormView.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadProtectionFormView.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -3,25 +3,38 @@
if ( !defined( 'MEDIAWIKI' ) ) die;

// Pass-through wrapper
-class ThreadProtectionFormView {
- function customizeTabs( $skintemplate, $content_actions ) {
- unset( $content_actions['edit'] );
- unset( $content_actions['addsection'] );
- unset( $content_actions['viewsource'] );
- unset( $content_actions['talk'] );
-
- $content_actions['talk']['class'] = false;
+class ThreadProtectionFormView extends LqtView {
+ function customizeTabs( $skintemplate, &$content_actions ) {
+ ThreadPermalinkView::customizeThreadTabs( $skintemplate, $content_actions, $this );
+
if ( array_key_exists( 'protect', $content_actions ) )
$content_actions['protect']['class'] = 'selected';
else if ( array_key_exists( 'unprotect', $content_actions ) )
$content_actions['unprotect']['class'] = 'selected';
-
- return true;
}
+
+ function customizeNavigation( $skintemplate, &$links ) {
+ ThreadPermalinkView::customizeThreadNavigation( $skintemplate, $links, $this );
+
+ if ( isset( $links['actions']['protect'] ) ) {
+ $links['actions']['protect']['class'] = 'selected';
+ }
+
+ if ( isset( $links['actions']['unprotect'] ) ) {
+ $links['actions']['unprotect']['class'] = 'selected';
+ }
+ }
+
+ function __construct( &$output, &$article, &$title, &$user, &$request ) {
+ parent::__construct( $output, $article, $title, $user, $request );

- function show() {
- global $wgHooks;
- $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
- return true;
+ $t = Threads::withRoot( $this->article );
+
+ $this->thread = $t;
+ if ( !$t ) {
+ return;
+ }
+
+ $this->article = $t->article();
}
}

Modified: branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadWatchView.php
===================================================================
--- branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadWatchView.php 2009-11-25 18:02:03 UTC (rev 59428)
+++ branches/wmf-deployment/extensions/LiquidThreads_alpha/pages/ThreadWatchView.php 2009-11-25 18:05:03 UTC (rev 59429)
@@ -3,9 +3,4 @@
if ( !defined( 'MEDIAWIKI' ) ) die;

class ThreadWatchView extends ThreadPermalinkView {
- function show() {
- global $wgHooks;
- $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
- return true;
- }
}



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS [at] lists
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.