http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72724

Revision: 72724
Author:   jeroendedauw
Date:     2010-09-10 15:23:36 +0000 (Fri, 10 Sep 2010)

Log Message:
-----------
Follow up to r72722

Modified Paths:
--------------
    trunk/extensions/Validator/includes/Parameter.php
    trunk/extensions/Validator/includes/criteria/CriterionInArray.php

Modified: trunk/extensions/Validator/includes/Parameter.php
===================================================================
--- trunk/extensions/Validator/includes/Parameter.php   2010-09-10 15:01:43 UTC 
(rev 72723)
+++ trunk/extensions/Validator/includes/Parameter.php   2010-09-10 15:23:36 UTC 
(rev 72724)
@@ -452,6 +452,34 @@
        }
        
        /**
+        * Returns the original use-provided name.
+        * 
+        * @since 0.4
+        * 
+        * @return string
+        */
+       public function getOriginalName() {
+               if ( $this->setCount == 0 ) {
+                       throw new Exception( 'No user imput set to the 
parameter yet, so the original name does not exist' );
+               }               
+               return $this->originalName;
+       }
+
+       /**
+        * Returns the original use-provided value.
+        * 
+        * @since 0.4
+        * 
+        * @return string
+        */
+       public function getOriginalValue() {
+               if ( $this->setCount == 0 ) {
+                       throw new Exception( 'No user imput set to the 
parameter yet, so the original value does not exist' );
+               }
+               return $this->originalValue;
+       }       
+       
+       /**
         * Returns all validation errors that occured so far.
         * 
         * @since 0.4

Modified: trunk/extensions/Validator/includes/criteria/CriterionInArray.php
===================================================================
--- trunk/extensions/Validator/includes/criteria/CriterionInArray.php   
2010-09-10 15:01:43 UTC (rev 72723)
+++ trunk/extensions/Validator/includes/criteria/CriterionInArray.php   
2010-09-10 15:23:36 UTC (rev 72724)
@@ -46,7 +46,16 @@
         * @see ItemParameterCriterion::getItemErrorMessage
         */     
        protected function getItemErrorMessage( Parameter $parameter ) {
-               return wfMsgExt( 'validator_error_accepts_only', 'parsemag', 
$parameter->value );
+               global $wgLang;
+               
+               return wfMsgExt(
+                       'validator_error_accepts_only',
+                       'parsemag',
+                       $parameter->getOriginalName(),
+                       $wgLang->listToText( $this->allowedValues ),
+                       count( $this->allowedValues ),
+                       $parameter->value
+               );
        }
        
        /**



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

Reply via email to