http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97907
Revision: 97907
Author: werdna
Date: 2011-09-23 11:48:41 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
LiquidThreads Talkpage View: Add error handling for embedding, wrap in an
enclosing div, and make sure links point to the right places
Modified Paths:
--------------
trunk/extensions/LiquidThreads/pages/TalkpageView.php
Modified: trunk/extensions/LiquidThreads/pages/TalkpageView.php
===================================================================
--- trunk/extensions/LiquidThreads/pages/TalkpageView.php 2011-09-23
11:42:34 UTC (rev 97906)
+++ trunk/extensions/LiquidThreads/pages/TalkpageView.php 2011-09-23
11:48:41 UTC (rev 97907)
@@ -59,7 +59,7 @@
global $wgUser;
$sk = $wgUser->getSkin();
- $article = new Article( $this->title );
+ $article = $this->talkpage;
// If $article_text == "", the talkpage was probably just
created
// when the first thread was posted to make the links blue.
@@ -69,14 +69,16 @@
$article->view();
$actionLinks = array();
+ if ( $article->getTitle()->userCan('edit') ) {
+ $actionLinks[] = $sk->link(
+ $article->getTitle(),
+ wfMsgExt( 'edit', 'parsemag' ) . "↑",
+ array(),
+ array( 'action' => 'edit' )
+ );
+ }
$actionLinks[] = $sk->link(
$this->title,
- wfMsgExt( 'edit', 'parseinline' ) . "↑",
- array(),
- array( 'action' => 'edit' )
- );
- $actionLinks[] = $sk->link(
- $this->title,
wfMsgExt( 'history_short', 'parseinline' ) .
"↑",
array(),
array( 'action' => 'history' )
@@ -84,7 +86,7 @@
if ( $wgUser->isAllowed( 'delete' ) ) {
$actionLinks[] = $sk->link(
- $this->title,
+ $article->getTitle(),
wfMsgExt( 'delete', 'parseinline' ) .
'↑',
array(),
array( 'action' => 'delete' )
@@ -101,10 +103,10 @@
$html = Xml::tags( 'div', array( 'class' =>
'lqt_header_content' ), $html );
$this->output->addHTML( $html );
- } else {
+ } elseif ( $article->getTitle()->userCan('edit') ) {
$editLink = $sk->link(
- $this->title,
+ $this->talkpage->getTitle(),
wfMsgExt( 'lqt_add_header', 'parseinline' ),
array(),
array( 'action' => 'edit' )
@@ -226,6 +228,12 @@
function show() {
$this->output->addModules( 'ext.liquidThreads' );
+
+ $article = $this->talkpage;
+ if ( ! LqtDispatch::isLqtPage( $article->getTitle() ) {
+ $this->output->addWikiMsg( 'lqt-not-discussion-page' );
+ return false;
+ }
$this->output->setPageTitle( $this->title->getPrefixedText() );
@@ -242,12 +250,14 @@
$sk = $this->user->getSkin();
- $article = new Article( $this->title );
-
if ( $this->request->getBool( 'lqt_inline' ) ) {
$this->doInlineEditForm();
return false;
}
+
+ $this->output->addHTML(
+ Xml::openElement( 'div', array( 'class' =>
'lqt-talkpage' ) )
+ );
// Search!
if ( $this->request->getCheck( 'lqt_search' ) ) {
@@ -286,7 +296,7 @@
$talkpageHeader = '';
- if ( Thread::canUserPost( $this->user, $this->article ) ) {
+ if ( Thread::canUserPost( $this->user, $this->talkpage ) ) {
$newThreadText = wfMsgExt( 'lqt_new_thread',
'parseinline' );
$newThreadLink = $sk->link(
$this->title, $newThreadText,
@@ -321,7 +331,7 @@
if ( $this->methodApplies( 'talkpage_new_thread' ) ) {
$params = array( 'class' => 'lqt-new-thread
lqt-edit-form' );
$this->output->addHTML( Xml::openElement( 'div',
$params ) );
- $this->showNewThreadForm( $this->article );
+ $this->showNewThreadForm( $this->talkpage );
$this->output->addHTML( Xml::closeElement( 'div' ) );
} else {
$this->output->addHTML( Xml::tags( 'div',
@@ -348,7 +358,11 @@
$this->showThread( $t );
}
- $this->output->addHTML( Xml::closeElement( 'div' ) .
$pager->getNavigationBar() );
+ $this->output->addHTML(
+ Xml::closeElement( 'div' ) .
+ $pager->getNavigationBar() .
+ Xml::closeElement( 'div' )
+ );
// Workaround for bug 25077
global $wgOut, $wgUser;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs