Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -59,7 +59,6 @@ |
60 | 60 | $wgAutoloadClasses['EPHooks'] = dirname( __FILE__ ) . '/EducationProgram.hooks.php'; |
61 | 61 | $wgAutoloadClasses['EPSettings'] = dirname( __FILE__ ) . '/EducationProgram.settings.php'; |
62 | 62 | |
63 | | -$wgAutoloadClasses['CourseHistoryAction'] = dirname( __FILE__ ) . '/actions/CourseHistoryAction.php'; |
64 | 63 | $wgAutoloadClasses['EditCourseAction'] = dirname( __FILE__ ) . '/actions/EditCourseAction.php'; |
65 | 64 | $wgAutoloadClasses['EditOrgAction'] = dirname( __FILE__ ) . '/actions/EditOrgAction.php'; |
66 | 65 | $wgAutoloadClasses['EPAddArticleAction'] = dirname( __FILE__ ) . '/actions/EPAddArticleAction.php'; |
— | — | @@ -73,7 +72,6 @@ |
74 | 73 | $wgAutoloadClasses['EPRestoreAction'] = dirname( __FILE__ ) . '/actions/EPRestoreAction.php'; |
75 | 74 | $wgAutoloadClasses['EPUndoAction'] = dirname( __FILE__ ) . '/actions/EPUndoAction.php'; |
76 | 75 | $wgAutoloadClasses['EPViewAction'] = dirname( __FILE__ ) . '/actions/EPViewAction.php'; |
77 | | -$wgAutoloadClasses['OrgHistoryAction'] = dirname( __FILE__ ) . '/actions/OrgHistoryAction.php'; |
78 | 76 | $wgAutoloadClasses['ViewCourseAction'] = dirname( __FILE__ ) . '/actions/ViewCourseAction.php'; |
79 | 77 | $wgAutoloadClasses['ViewOrgAction'] = dirname( __FILE__ ) . '/actions/ViewOrgAction.php'; |
80 | 78 | |
Index: trunk/extensions/EducationProgram/pages/CoursePage.php |
— | — | @@ -16,14 +16,7 @@ |
17 | 17 | |
18 | 18 | protected static $info = array( |
19 | 19 | 'ns' => EP_NS_COURSE, |
20 | | - 'actions' => array( |
21 | | - 'view' => false, |
22 | | - 'edit' => 'ep-course', |
23 | | - 'history' => false, |
24 | | - 'enroll' => 'ep-enroll', |
25 | | - ), |
26 | 20 | 'edit-right' => 'ep-course', |
27 | | - 'identifier' => 'name', |
28 | 21 | 'list' => 'Courses', |
29 | 22 | 'log-type' => 'course', |
30 | 23 | ); |
— | — | @@ -36,7 +29,7 @@ |
37 | 30 | return array( |
38 | 31 | 'view' => 'ViewCourseAction', |
39 | 32 | 'edit' => 'EditCourseAction', |
40 | | - 'history' => 'CourseHistoryAction', |
| 33 | + 'history' => 'EPHistoryAction', |
41 | 34 | 'delete' => 'EPDeleteAction', |
42 | 35 | ); |
43 | 36 | } |
Index: trunk/extensions/EducationProgram/pages/OrgPage.php |
— | — | @@ -16,13 +16,7 @@ |
17 | 17 | |
18 | 18 | protected static $info = array( |
19 | 19 | 'ns' => EP_NS_INSTITUTION, |
20 | | - 'actions' => array( |
21 | | - 'view' => false, |
22 | | - 'edit' => 'ep-org', |
23 | | - 'history' => false, |
24 | | - ), |
25 | 20 | 'edit-right' => 'ep-org', |
26 | | - 'identifier' => 'name', |
27 | 21 | 'list' => 'Institutions', |
28 | 22 | 'log-type' => 'institution', |
29 | 23 | ); |
— | — | @@ -35,7 +29,7 @@ |
36 | 30 | return array( |
37 | 31 | 'view' => 'ViewOrgAction', |
38 | 32 | 'edit' => 'EditOrgAction', |
39 | | - 'history' => 'OrgHistoryAction', |
| 33 | + 'history' => 'EPHistoryAction', |
40 | 34 | 'delete' => 'EPDeleteAction', |
41 | 35 | ); |
42 | 36 | } |
Index: trunk/extensions/EducationProgram/actions/OrgHistoryAction.php |
— | — | @@ -1,42 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Action to view the history of orgs. |
6 | | - * |
7 | | - * @since 0.1 |
8 | | - * |
9 | | - * @file OrgHistoryAction.php |
10 | | - * @ingroup EducationProgram |
11 | | - * @ingroup Action |
12 | | - * |
13 | | - * @licence GNU GPL v3+ |
14 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
15 | | - */ |
16 | | -class OrgHistoryAction extends EPHistoryAction { |
17 | | - |
18 | | - /** |
19 | | - * Constructor. |
20 | | - * |
21 | | - * @since 0.1 |
22 | | - * |
23 | | - * @param Page $page |
24 | | - * @param IContextSource $context |
25 | | - */ |
26 | | - protected function __construct( Page $page, IContextSource $context = null ) { |
27 | | - parent::__construct( $page, $context, EPOrgs::singleton() ); |
28 | | - } |
29 | | - |
30 | | - public function getName() { |
31 | | - return 'orghistory'; |
32 | | - } |
33 | | - |
34 | | - protected function getDescription() { |
35 | | - return Linker::linkKnown( |
36 | | - SpecialPage::getTitleFor( 'Log' ), |
37 | | - $this->msg( 'ep-org-history' )->escaped(), |
38 | | - array(), |
39 | | - array( 'page' => $this->getTitle()->getPrefixedText() ) |
40 | | - ); |
41 | | - } |
42 | | - |
43 | | -} |
\ No newline at end of file |
Index: trunk/extensions/EducationProgram/actions/CourseHistoryAction.php |
— | — | @@ -1,42 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Action to view the history of courses. |
6 | | - * |
7 | | - * @since 0.1 |
8 | | - * |
9 | | - * @file CourseHistoryAction.php |
10 | | - * @ingroup EducationProgram |
11 | | - * @ingroup Action |
12 | | - * |
13 | | - * @licence GNU GPL v3+ |
14 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
15 | | - */ |
16 | | -class CourseHistoryAction extends EPHistoryAction { |
17 | | - |
18 | | - /** |
19 | | - * Constructor. |
20 | | - * |
21 | | - * @since 0.1 |
22 | | - * |
23 | | - * @param Page $page |
24 | | - * @param IContextSource $context |
25 | | - */ |
26 | | - protected function __construct( Page $page, IContextSource $context = null ) { |
27 | | - parent::__construct( $page, $context, EPCourses::singleton() ); |
28 | | - } |
29 | | - |
30 | | - public function getName() { |
31 | | - return 'coursehistory'; |
32 | | - } |
33 | | - |
34 | | - protected function getDescription() { |
35 | | - return Linker::linkKnown( |
36 | | - SpecialPage::getTitleFor( 'Log' ), |
37 | | - $this->msg( 'ep-course-history' )->escaped(), |
38 | | - array(), |
39 | | - array( 'page' => $this->getTitle()->getPrefixedText() ) |
40 | | - ); |
41 | | - } |
42 | | - |
43 | | -} |
\ No newline at end of file |
Index: trunk/extensions/EducationProgram/actions/EPHistoryAction.php |
— | — | @@ -12,26 +12,14 @@ |
13 | 13 | * @licence GNU GPL v3+ |
14 | 14 | * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
15 | 15 | */ |
16 | | -abstract class EPHistoryAction extends FormlessAction { |
| 16 | +class EPHistoryAction extends FormlessAction { |
17 | 17 | |
18 | 18 | /** |
19 | | - * @since 0.1 |
20 | | - * @var EPPageTable |
| 19 | + * (non-PHPdoc) |
| 20 | + * @see Action::getName() |
21 | 21 | */ |
22 | | - protected $table; |
23 | | - |
24 | | - /** |
25 | | - * Constructor. |
26 | | - * |
27 | | - * @since 0.1 |
28 | | - * |
29 | | - * @param Page $page |
30 | | - * @param IContextSource $context |
31 | | - * @param DBTable $table |
32 | | - */ |
33 | | - protected function __construct( Page $page, IContextSource $context = null, EPPageTable $table ) { |
34 | | - $this->table = $table; |
35 | | - parent::__construct( $page, $context ); |
| 22 | + public function getName() { |
| 23 | + return 'history'; |
36 | 24 | } |
37 | 25 | |
38 | 26 | /** |
— | — | @@ -41,7 +29,7 @@ |
42 | 30 | public function onView() { |
43 | 31 | $this->getOutput()->setPageTitle( $this->getPageTitle() ); |
44 | 32 | |
45 | | - $object = $this->table->get( $this->getTitle()->getText() ); |
| 33 | + $object = $this->page->getTable()->get( $this->getTitle()->getText() ); |
46 | 34 | |
47 | 35 | if ( $object === false ) { |
48 | 36 | $this->displayNoRevisions(); |
— | — | @@ -54,11 +42,11 @@ |
55 | 43 | } |
56 | 44 | |
57 | 45 | protected function displayNoRevisions() { |
58 | | - $this->getOutput()->addWikiMsg( 'ep-' . strtolower( $this->getName() ) . '-norevs' ); |
| 46 | + $this->getOutput()->addWikiMsg( $this->prefixMsg( 'norevs' ) ); |
59 | 47 | |
60 | 48 | $this->page->displayDeletionLog( |
61 | 49 | $this->getContext(), |
62 | | - 'ep-' . strtolower( $this->getName() ) . '-deleted' |
| 50 | + $this->prefixMsg( 'deleted' ) |
63 | 51 | ); |
64 | 52 | } |
65 | 53 | |
— | — | @@ -71,7 +59,7 @@ |
72 | 60 | */ |
73 | 61 | protected function getPageTitle() { |
74 | 62 | return wfMsgExt( |
75 | | - 'ep-' . strtolower( $this->getName() ) . '-title', |
| 63 | + $this->prefixMsg( 'title' ), |
76 | 64 | 'parsemag', |
77 | 65 | $this->getTitle()->getText() |
78 | 66 | ); |
— | — | @@ -132,7 +120,7 @@ |
133 | 121 | '</fieldset></form>' |
134 | 122 | ); |
135 | 123 | |
136 | | - $pager = new EPRevisionPager( $this->getContext(), $this->table, $conditions ); |
| 124 | + $pager = new EPRevisionPager( $this->getContext(), $this->page->getTable(), $conditions ); |
137 | 125 | |
138 | 126 | if ( $pager->getNumRows() ) { |
139 | 127 | $out->addHTML( |
— | — | @@ -145,5 +133,31 @@ |
146 | 134 | // TODO |
147 | 135 | } |
148 | 136 | } |
| 137 | + |
| 138 | + /** |
| 139 | + * (non-PHPdoc) |
| 140 | + * @see Action::getDescription() |
| 141 | + */ |
| 142 | + protected function getDescription() { |
| 143 | + return Linker::linkKnown( |
| 144 | + SpecialPage::getTitleFor( 'Log' ), |
| 145 | + $this->msg( $this->prefixMsg( 'description' ) )->escaped(), |
| 146 | + array(), |
| 147 | + array( 'page' => $this->getTitle()->getPrefixedText() ) |
| 148 | + ); |
| 149 | + } |
| 150 | + |
| 151 | + /** |
| 152 | + * Returns a prefixed message name. |
| 153 | + * |
| 154 | + * @since 0.1 |
| 155 | + * |
| 156 | + * @param string $name |
| 157 | + * |
| 158 | + * @return string |
| 159 | + */ |
| 160 | + protected function prefixMsg( $name ) { |
| 161 | + return strtolower( get_class( $this->page ) ) . '-' . $this->getName() . '-' . $name; |
| 162 | + } |
149 | 163 | |
150 | | -} |
\ No newline at end of file |
| 164 | +} |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -457,16 +457,16 @@ |
458 | 458 | 'ep-viewcourse-deleted' => 'This course has been deleted. The deletion log for the course is provided below for reference.', |
459 | 459 | |
460 | 460 | // Institution history |
461 | | - 'ep-org-history' => 'View logs for this institution', |
462 | | - 'ep-orghistory-title' => 'Revision history of institution "$1"', |
463 | | - 'ep-orghistory-norevs' => 'There is no edit history for this institution.', |
464 | | - 'ep-orghistory-deleted' => 'This institution has been deleted. The deletion log for the institution is provided below for reference.', |
| 461 | + 'orgpage-history-description' => 'View logs for this institution', |
| 462 | + 'orgpage-history-title' => 'Revision history of institution "$1"', |
| 463 | + 'orgpage-history-norevs' => 'There is no edit history for this institution.', |
| 464 | + 'orgpage-history-deleted' => 'This institution has been deleted. The deletion log for the institution is provided below for reference.', |
465 | 465 | |
466 | 466 | // Course history |
467 | | - 'ep-course-history' => 'View logs for this course', |
468 | | - 'ep-coursehistory-title' => 'Revision history of course "$1"', |
469 | | - 'ep-coursehistory-norevs' => 'There is no edit history for this course.', |
470 | | - 'ep-coursehistory-deleted' => 'This course has been deleted. The deletion log for the course is provided below for reference.', |
| 467 | + 'coursepage-history-description' => 'View logs for this course', |
| 468 | + 'coursepage-history-title' => 'Revision history of course "$1"', |
| 469 | + 'coursepage-history-norevs' => 'There is no edit history for this course.', |
| 470 | + 'coursepage-history-deleted' => 'This course has been deleted. The deletion log for the course is provided below for reference.', |
471 | 471 | |
472 | 472 | // Course deletion |
473 | 473 | 'coursepage-delete-text' => 'You are about to delete course $1. This will remove all associated students!', |