https://www.mediawiki.org/wiki/Special:Code/MediaWiki/110553

Revision: 110553
Author:   jeroendedauw
Date:     2012-02-02 08:59:30 +0000 (Thu, 02 Feb 2012)
Log Message:
-----------
fixed edit permission checks and work on messages

Modified Paths:
--------------
    trunk/extensions/EducationProgram/EducationProgram.i18n.php
    trunk/extensions/EducationProgram/actions/EPEditAction.php
    trunk/extensions/EducationProgram/actions/EPHistoryAction.php
    trunk/extensions/EducationProgram/actions/EditCourseAction.php
    trunk/extensions/EducationProgram/actions/EditOrgAction.php

Modified: trunk/extensions/EducationProgram/EducationProgram.i18n.php
===================================================================
--- trunk/extensions/EducationProgram/EducationProgram.i18n.php 2012-02-02 
08:03:59 UTC (rev 110552)
+++ trunk/extensions/EducationProgram/EducationProgram.i18n.php 2012-02-02 
08:59:30 UTC (rev 110553)
@@ -249,7 +249,10 @@
        'ep-addorg' => 'There is no institution with this name yet, but you can 
add it.',
        'ep-editorg' => 'You are editing an existing institution.',
        'ep-editorg-exists-already' => 'This institution already exists. You 
are editing it.',
+       'ep-editorg-edit' => 'Editing institution: $1',
+       'ep-editorg-add' => 'Adding institution: $1',
 
+
        // Course editing
        'editcourse-add-legend' => 'Add course',
        'editcourse-edit-legend' => 'Edit course',
@@ -269,6 +272,8 @@
        'ep-addcourse' => 'There is no course with this name yet, but you can 
add it.',
        'ep-editcourse' => 'You are editing an existing course.',
        'ep-editcourse-exists-already' => 'This course already exists. You are 
editing it.',
+       'ep-editcourse-edit' => 'Editing course: $1',
+       'ep-editcourse-add' => 'Adding course: $1',
 
        'ep-course-invalid-org' => 'This institution does not exist.',
        'ep-course-invalid-token' => 'The token needs to be at least contain $1 
{{PLURAL:$1|character|characters}}.',
@@ -325,9 +330,11 @@
 
        // Institution history
        'ep-org-history' => 'View logs for this institution',
+       'ep-orghistory-title' => 'Revision history of institution "$1"',
 
        // Course history
        'ep-course-history' => 'View logs for this course',
+       'ep-coursehistory-title' => 'Revision history of course "$1"',
 
        // Special:Ambassador
        'ep-ambassador-does-not-exist' => 'There is no ambassador with name 
"$1". See [[Special:Ambassadors|here]] for a list of ambassadors.',

Modified: trunk/extensions/EducationProgram/actions/EPEditAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/EPEditAction.php  2012-02-02 
08:03:59 UTC (rev 110552)
+++ trunk/extensions/EducationProgram/actions/EPEditAction.php  2012-02-02 
08:59:30 UTC (rev 110553)
@@ -39,6 +39,10 @@
         */
        protected abstract function getItemClass();
        
+       /**
+        * (non-PHPdoc)
+        * @see FormlessAction::onView()
+        */
        public function onView() {
                $this->getOutput()->addModules( 'ep.formpage' );
                
@@ -53,16 +57,20 @@
        }
        
        /**
-        * @see SpecialPage::getDescription
+        * Returns the page title.
         *
         * @since 0.1
         *
         * @return string
         */
-//     public function getDescription() {
-//             $action = $this->isNew() ? 'add' : 'edit';
-//             return wfMsg( 'special-' . strtolower( $this->getName() ) . '-' 
. $action );
-//     }
+       protected function getPageTitle() {
+               $action = $this->isNew() ? 'add' : 'edit';
+               return wfMsgExt(
+                       'ep-' . strtolower( $this->getName() ) . '-' . $action,
+                       'parsemag',
+                       $this->getTitle()->getText()
+               );
+       }
 
        /**
         * Display the form and set the item field, or redirect the user.
@@ -88,6 +96,7 @@
                                $this->showWarning( wfMessage( 'ep-' . 
strtolower( $this->getName() ) . '-exists-already' ) );
                        }
 
+                       $this->getOutput()->setPageTitle( $this->getPageTitle() 
);
                        $this->getOutput()->setSubtitle( 
$this->getDescription() );
 
                        $this->item = $object;

Modified: trunk/extensions/EducationProgram/actions/EPHistoryAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/EPHistoryAction.php       
2012-02-02 08:03:59 UTC (rev 110552)
+++ trunk/extensions/EducationProgram/actions/EPHistoryAction.php       
2012-02-02 08:59:30 UTC (rev 110553)
@@ -23,7 +23,13 @@
         */
        protected abstract function getItemClass();
        
+       /**
+        * (non-PHPdoc)
+        * @see FormlessAction::onView()
+        */
        public function onView() {
+               $this->getOutput()->setPageTitle( $this->getPageTitle() );
+               
                $c = $this->getItemClass(); // Yeah, this is needed in PHP 5.3 
>_>
                
                $object = $c::get( $this->getTitle()->getText() );
@@ -39,16 +45,20 @@
        }
        
        /**
-        * @see SpecialPage::getDescription
+        * Returns the page title.
         *
         * @since 0.1
         *
         * @return string
         */
-//     public function getDescription() {
-//             return wfMsgExt( 'special-' . strtolower( $this->getName() ), 
'parsemag', $this->subPage );
-//     }
-
+       protected function getPageTitle() {
+               return wfMsgExt(
+                       'ep-' . strtolower( $this->getName() ) . '-title',
+                       'parsemag',
+                       $this->getTitle()->getText()
+               );
+       }
+       
        /**
         * Display a list with the passed revisions.
         *

Modified: trunk/extensions/EducationProgram/actions/EditCourseAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/EditCourseAction.php      
2012-02-02 08:03:59 UTC (rev 110552)
+++ trunk/extensions/EducationProgram/actions/EditCourseAction.php      
2012-02-02 08:59:30 UTC (rev 110553)
@@ -14,15 +14,34 @@
  */
 class EditCourseAction extends EPEditAction {
        
-       
+       /**
+        * (non-PHPdoc)
+        * @see Action::getName()
+        */
        public function getName() {
                return 'editcourse';
        }
 
+       /**
+        * (non-PHPdoc)
+        * @see Action::getDescription()
+        */
        protected function getDescription() {
                return wfMsgHtml( $this->isNew() ? 'ep-addcourse' : 
'ep-editcourse' );
        }
 
+       /**
+        * (non-PHPdoc)
+        * @see Action::getRestriction()
+        */
+       public function getRestriction() {
+               return 'ep-course';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see EPEditAction::onView()
+        */
        public function onView() {
                $this->getOutput()->addModules( array( 'ep.datepicker', 
'ep.combobox' ) );
 

Modified: trunk/extensions/EducationProgram/actions/EditOrgAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/EditOrgAction.php 2012-02-02 
08:03:59 UTC (rev 110552)
+++ trunk/extensions/EducationProgram/actions/EditOrgAction.php 2012-02-02 
08:59:30 UTC (rev 110553)
@@ -14,21 +14,40 @@
  */
 class EditOrgAction extends EPEditAction {
        
-       
+       /**
+        * (non-PHPdoc)
+        * @see Action::getName()
+        */
        public function getName() {
                return 'editorg';
        }
 
+       /**
+        * (non-PHPdoc)
+        * @see Action::getDescription()
+        */
        protected function getDescription() {
                return wfMsgHtml( $this->isNew() ? 'ep-addorg' : 'ep-editorg' );
        }
 
+       /**
+        * (non-PHPdoc)
+        * @see EPEditAction::getItemClass()
+        */
        protected function getItemClass() {
                return 'EPOrg';
        }
        
        /**
         * (non-PHPdoc)
+        * @see Action::getRestriction()
+        */
+       public function getRestriction() {
+               return 'ep-org';
+       }
+       
+       /**
+        * (non-PHPdoc)
         * @see EPEditAction::getFormFields()
         * @return array
         */


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

Reply via email to