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

Revision: 88558
Author:   reedy
Date:     2011-05-22 00:52:48 +0000 (Sun, 22 May 2011)
Log Message:
-----------
Make "filter" appear on any variant of user/status

Added new form to do the clear in

Modified Paths:
--------------
    trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php
    trunk/extensions/CodeReview/ui/CodeRevisionListView.php
    trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php

Modified: trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php   2011-05-21 
23:41:41 UTC (rev 88557)
+++ trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php   2011-05-22 
00:52:48 UTC (rev 88558)
@@ -5,7 +5,6 @@
                parent::__construct( $repo );
                $this->mAuthor = $author;
                $this->mUser = $this->mRepo->authorWikiUser( $author );
-               $this->mAppliedFilter = wfMsg( 'code-revfilter-cr_author', 
$author );
        }
 
        function getPager() {

Modified: trunk/extensions/CodeReview/ui/CodeRevisionListView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeRevisionListView.php     2011-05-21 
23:41:41 UTC (rev 88557)
+++ trunk/extensions/CodeReview/ui/CodeRevisionListView.php     2011-05-22 
00:52:48 UTC (rev 88558)
@@ -25,7 +25,21 @@
 
                $this->mAuthor = $wgRequest->getText( 'author' );
                $this->mStatus = $wgRequest->getText( 'status' );
-               $this->mAppliedFilter = null;
+
+               $filters = array();
+               if ( $this->mAuthor ) {
+                       $filters[] = wfMsg( 'code-revfilter-cr_author', 
$this->mAuthor );
+               }
+               if ( $this->mStatus ) {
+                       $filters[] = wfMsg( 'code-revfilter-cr_status', 
$this->mStatus );
+               }
+
+               if ( count( $filters) ) {
+                       global $wgLang;
+                       $this->mAppliedFilter = $wgLang->listToText( $filters );
+               } else {
+                       $this->mAppliedFilter = null;
+               }
        }
 
        /**
@@ -70,7 +84,7 @@
                $revCount = $this->getRevCount( $dbr );
 
                $pager = $this->getPager();
-               $pathForm = $this->showForm( $pager->getHiddenFields( array( 
'path' ) ) );
+               $pathForm = $this->showForm( $pager );
 
                // Build batch change interface as needed
                $this->batchForm = $wgUser->isAllowed( 'codereview-set-status' 
) ||
@@ -182,32 +196,34 @@
        }
 
        /**
-        * @param $hidden string
+        * @param $pager SvnTablePager
         *
         * @return string
         */
-       function showForm( $hidden = '' ) {
+       function showForm( $pager ) {
                global $wgScript;
 
-               $ret = Xml::openElement( 'form', array( 'action' => $wgScript, 
'method' => 'get' ) ) .
-                       "<fieldset><legend>" . wfMsgHtml( 
'code-pathsearch-legend' ) . "</legend>" .
+               $ret = "<fieldset><legend>" . wfMsgHtml( 
'code-pathsearch-legend' ) . "</legend>" .
                                '<table width="100%"><tr><td>' .
+                               Xml::openElement( 'form', array( 'action' => 
$wgScript, 'method' => 'get' ) ) .
                                Xml::inputlabel( wfMsg( "code-pathsearch-path" 
), 'path', 'path', 55, $this->getPathsAsString() ) .
                                '&#160;' . Xml::submitButton( wfMsg( 
'allpagessubmit' ) ) .
+                               $pager->getHiddenFields( array( 'path' ) ) .
+                               Xml::closeElement( 'form' ) .
                                '</td>';
 
                if ( strlen( $this->mAppliedFilter ) ) {
                        $ret .= '<td>' .
+                               Xml::openElement( 'form', array( 'action' => 
$pager->getTitle()->getLocalURL(), 'method' => 'get' ) ) .
                                Xml::label( wfMsg( 'code-pathsearch-filter' ), 
'revFilter' ) . '&#160;<strong>' .
                                Xml::span( $this->mAppliedFilter, '' ) . 
'</strong>&#160;' .
                                Xml::submitButton( wfMsg( 
'code-revfilter-clear' ) ) .
+                               Xml::closeElement( 'form' ) .
                                '</td>';
                }
 
-               $ret .= $hidden;
+               $ret .= "</tr></table></fieldset>" ;
 
-               $ret .= "</tr></table></fieldset></form>" ;
-
                return $ret;
        }
 

Modified: trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php   2011-05-21 
23:41:41 UTC (rev 88557)
+++ trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php   2011-05-22 
00:52:48 UTC (rev 88558)
@@ -4,7 +4,6 @@
        function __construct( $repo, $status ) {
                parent::__construct( $repo );
                $this->mStatus = $status;
-               $this->mAppliedFilter = wfMsg( 'code-revfilter-cr_status', 
$status );
        }
 
        function getPager() {


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

Reply via email to