https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113343
Revision: 113343
Author: jeroendedauw
Date: 2012-03-08 02:03:12 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
fixed issue with article removal
Modified Paths:
--------------
trunk/extensions/EducationProgram/actions/EPRemoveArticleAction.php
trunk/extensions/EducationProgram/includes/EPArticleTable.php
trunk/extensions/EducationProgram/resources/ep.articletable.js
Modified: trunk/extensions/EducationProgram/actions/EPRemoveArticleAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/EPRemoveArticleAction.php
2012-03-08 01:50:44 UTC (rev 113342)
+++ trunk/extensions/EducationProgram/actions/EPRemoveArticleAction.php
2012-03-08 02:03:12 UTC (rev 113343)
@@ -41,7 +41,18 @@
}
}
- $this->getOutput()->redirect( $this->getTitle()->getLocalURL()
);
+ $returnTo = null;
+
+ if ( $req->getCheck( 'returnto' ) ) {
+ $returnTo = Title::newFromText( $req->getText(
'returnto' ) );
+ }
+
+ if ( is_null( $returnTo ) ) {
+ $returnTo = $this->getTitle();
+ }
+
+ $this->getOutput()->redirect( $returnTo->getLocalURL() );
+
return '';
}
Modified: trunk/extensions/EducationProgram/includes/EPArticleTable.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPArticleTable.php
2012-03-08 01:50:44 UTC (rev 113342)
+++ trunk/extensions/EducationProgram/includes/EPArticleTable.php
2012-03-08 02:03:12 UTC (rev 113343)
@@ -304,14 +304,19 @@
if ( array_key_exists( 'course_id', $this->articleConds ) &&
is_integer( $this->articleConds['course_id'] ) ) {
$attr['data-course-name'] = $this->getCourseName();
- }
- if ( $this->getUser()->getId() === $article->getField(
'user_id' ) ) {
- $html .= ' (' . Html::element(
- 'a',
- $attr,
- wfMsg( 'ep-artciles-remarticle' )
- ) . ')';
+ $title = EPCourses::singleton()->getTitleFor(
$this->getCourseName() );
+ $attr['data-remove-target'] = $title->getLocalURL(
array(
+ 'returnto' => $this->getTitle()->getFullText(),
+ ) );
+
+ if ( $this->getUser()->getId() === $article->getField(
'user_id' ) ) {
+ $html .= ' (' . Html::element(
+ 'a',
+ $attr,
+ wfMsg( 'ep-artciles-remarticle' )
+ ) . ')';
+ }
}
return Html::rawElement(
Modified: trunk/extensions/EducationProgram/resources/ep.articletable.js
===================================================================
--- trunk/extensions/EducationProgram/resources/ep.articletable.js
2012-03-08 01:50:44 UTC (rev 113342)
+++ trunk/extensions/EducationProgram/resources/ep.articletable.js
2012-03-08 02:03:12 UTC (rev 113343)
@@ -130,9 +130,9 @@
var $form = $( '<form>' ).attr( {
'method': 'post',
- 'action': window.location
+ 'action': $this.attr( 'data-remove-target' )
} ).msg(
- 'ep-articletable-remarticle-text' + ( courseName ===
undefined ? '' : '-course' ),
+ 'ep-articletable-remarticle-text-course',
$( '<b>' ).text( $this.attr( 'data-article-name' ) ),
$( '<b>' ).text( courseName )
);
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs