r110296 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110295‎ | r110296 | r110297 >
Date:15:43, 30 January 2012
Author:jeroendedauw
Status:deferred
Tags:educationprogram 
Comment:
fix some issues with course edit action
Modified paths:
  • /trunk/extensions/EducationProgram/actions/EPEditAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/actions/EPViewAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/actions/EditCourseAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/actions/ViewCourseAction.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/actions/ViewCourseAction.php
@@ -59,13 +59,9 @@
6060 protected function getSummaryData( EPDBObject $course ) {
6161 $stats = array();
6262
63 - $org = EPOrg::selectFieldsRow( 'name', array( 'id' => $course->getField( 'org_id' ) ) );
 63+ $orgName = EPOrg::selectFieldsRow( 'name', array( 'id' => $course->getField( 'org_id' ) ) );
 64+ $stats['org'] = EPOrg::getLinkFor( $orgName );
6465
65 - $stats['org'] = Linker::linkKnown(
66 - SpecialPage::getTitleFor( 'Institution', $org ),
67 - htmlspecialchars( $org )
68 - );
69 -
7066 $lang = $this->getLanguage();
7167
7268 $stats['term'] = htmlspecialchars( $course->getField( 'term' ) );
Index: trunk/extensions/EducationProgram/actions/EPViewAction.php
@@ -53,31 +53,7 @@
5454 }
5555 else {
5656 $object = $rev->getObject();
57 -
58 - $lang = $this->getLanguage();
59 -
60 - $current = false; // TODO
61 - $td = $lang->timeanddate( $rev->getField( 'time' ), true );
62 - $tddate = $lang->date( $rev->getField( 'time' ), true );
63 - $tdtime = $lang->time( $rev->getField( 'time' ), true );
64 -
65 - $userToolLinks = Linker::userLink( $rev->getUser()->getId(), $rev->getUser()->getName() )
66 - . Linker::userToolLinks( $rev->getUser()->getId(), $rev->getUser()->getName() );
67 -
68 - $infomsg = $current && !wfMessage( 'revision-info-current' )->isDisabled()
69 - ? 'revision-info-current'
70 - : 'revision-info';
71 -
72 - $out->setSubtitle(
73 - "<div id=\"mw-{$infomsg}\">" .
74 - wfMessage( $infomsg, $td )->rawParams( $userToolLinks )->params(
75 - $rev->getId(),
76 - $tddate,
77 - $tdtime,
78 - $rev->getUser()
79 - )->parse() .
80 - "</div>"
81 - );
 57+ $this->displayRevisionNotice( $rev );
8258 }
8359 }
8460 }
@@ -103,6 +79,33 @@
10480 return '';
10581 }
10682
 83+ protected function displayRevisionNotice( EPRevision $rev ) {
 84+ $lang = $this->getLanguage();
 85+
 86+ $current = false; // TODO
 87+ $td = $lang->timeanddate( $rev->getField( 'time' ), true );
 88+ $tddate = $lang->date( $rev->getField( 'time' ), true );
 89+ $tdtime = $lang->time( $rev->getField( 'time' ), true );
 90+
 91+ $userToolLinks = Linker::userLink( $rev->getUser()->getId(), $rev->getUser()->getName() )
 92+ . Linker::userToolLinks( $rev->getUser()->getId(), $rev->getUser()->getName() );
 93+
 94+ $infomsg = $current && !wfMessage( 'revision-info-current' )->isDisabled()
 95+ ? 'revision-info-current'
 96+ : 'revision-info';
 97+
 98+ $this->getOutput()->setSubtitle(
 99+ "<div id=\"mw-{$infomsg}\">" .
 100+ wfMessage( $infomsg, $td )->rawParams( $userToolLinks )->params(
 101+ $rev->getId(),
 102+ $tddate,
 103+ $tdtime,
 104+ $rev->getUser()
 105+ )->parse() .
 106+ "</div>"
 107+ );
 108+ }
 109+
107110 protected function displayPage( EPDBObject $object ) {
108111 $this->displayNavigation();
109112
Index: trunk/extensions/EducationProgram/actions/EditCourseAction.php
@@ -50,6 +50,9 @@
5151 'term' => $this->getRequest()->getText( 'newterm', '' ),
5252 )
5353 );
 54+
 55+ $this->isNew = true;
 56+ $this->getOutput()->setSubtitle( $this->getDescription() );
5457
5558 return '';
5659 }
Index: trunk/extensions/EducationProgram/actions/EPEditAction.php
@@ -118,7 +118,7 @@
119119 */
120120 protected function isNew() {
121121 if ( is_null( $this->isNew ) ) {
122 - $isNew = $this->isNewPost();
 122+ $this->isNew = $this->isNewPost();
123123 }
124124
125125 return $this->isNew;

Status & tagging log