diff options
Diffstat (limited to 'includes/specials/SpecialPagesWithProp.php')
-rw-r--r-- | includes/specials/SpecialPagesWithProp.php | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/includes/specials/SpecialPagesWithProp.php b/includes/specials/SpecialPagesWithProp.php index 8f8c981e..e22b42a3 100644 --- a/includes/specials/SpecialPagesWithProp.php +++ b/includes/specials/SpecialPagesWithProp.php @@ -23,7 +23,6 @@ * @author Brad Jorsch */ - /** * Special:PagesWithProp to search the page_props table * @ingroup SpecialPage @@ -43,6 +42,7 @@ class SpecialPagesWithProp extends QueryPage { function execute( $par ) { $this->setHeaders(); $this->outputHeader(); + $this->getOutput()->addModuleStyles( 'mediawiki.special.pagesWithProp' ); $request = $this->getRequest(); $propname = $request->getVal( 'propname', $par ); @@ -55,6 +55,7 @@ class SpecialPagesWithProp extends QueryPage { __METHOD__, array( 'DISTINCT', 'ORDER BY' => 'pp_propname' ) ); + $propnames = array(); foreach ( $res as $row ) { $propnames[$row->pp_propname] = $row->pp_propname; } @@ -70,9 +71,8 @@ class SpecialPagesWithProp extends QueryPage { ), ), $this->getContext() ); $form->setMethod( 'get' ); - $form->setAction( $this->getTitle()->getFullUrl() ); $form->setSubmitCallback( array( $this, 'onSubmit' ) ); - $form->setWrapperLegend( $this->msg( 'pageswithprop-legend' ) ); + $form->setWrapperLegendMsg( 'pageswithprop-legend' ); $form->addHeaderText( $this->msg( 'pageswithprop-text' )->parseAsBlock() ); $form->setSubmitTextMsg( 'pageswithprop-submit' ); @@ -120,15 +120,33 @@ class SpecialPagesWithProp extends QueryPage { return array( 'page_id' ); } + /** + * @param Skin $skin + * @param object $result Result row + * @return string + */ function formatResult( $skin, $result ) { $title = Title::newFromRow( $result ); $ret = Linker::link( $title, null, array(), array(), array( 'known' ) ); if ( $result->pp_value !== '' ) { - $value = $this->msg( 'parentheses' ) - ->rawParams( Xml::span( $result->pp_value, 'prop-value' ) ) - ->escaped(); - $ret .= " $value"; + // Do not show very long or binary values on the special page + $valueLength = strlen( $result->pp_value ); + $isBinary = strpos( $result->pp_value, "\0" ) !== false; + $isTooLong = $valueLength > 1024; + + if ( $isBinary || $isTooLong ) { + $message = $this + ->msg( $isBinary ? 'pageswithprop-prophidden-binary' : 'pageswithprop-prophidden-long' ) + ->params( $this->getLanguage()->formatSize( $valueLength ) ); + + $propValue = Html::element( 'span', array( 'class' => 'prop-value-hidden' ), $message->text() ); + } else { + $propValue = Html::element( 'span', array( 'class' => 'prop-value' ), $result->pp_value ); + } + + $ret .= $this->msg( 'colon-separator' )->escaped() . $propValue; } + return $ret; } |