Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -288,6 +288,7 @@ |
289 | 289 | 'img_middle' => array( 1, 'middle' ), |
290 | 290 | 'img_bottom' => array( 1, 'bottom' ), |
291 | 291 | 'img_text_bottom' => array( 1, 'text-bottom' ), |
| 292 | + 'img_click' => array( 1, 'click=$1' ), |
292 | 293 | 'int' => array( 0, 'INT:' ), |
293 | 294 | 'sitename' => array( 1, 'SITENAME' ), |
294 | 295 | 'ns' => array( 0, 'NS:' ), |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -148,12 +148,15 @@ |
149 | 149 | $wgExternalLinkTarget |
150 | 150 | * api.php now sends "Retry-After" and "X-Database-Lag" HTTP headers if the maxlag |
151 | 151 | check fails, just like index.php does |
152 | | -* Configurable per-namespace and per-page header, |
153 | | - respectively MediaWiki:Pageheader-# where # is the namespace number, and |
| 152 | +* Configurable per-namespace and per-page header, respectively |
| 153 | + MediaWiki:Pageheader-# where # is the namespace number, and |
154 | 154 | MediaWiki:Pagenumber-#-PAGENAME where # is the page's namespace number and |
155 | | - PAGENAME is the page name minus the namespace prefix. Can be disabled with the new magic word __NOHEADER__ |
| 155 | + PAGENAME is the page name minus the namespace prefix. Can be disabled with |
| 156 | + the new magic word __NOHEADER__ |
| 157 | +* Added "click" parameter to image links, to allow images to link to an |
| 158 | + arbitrary title or URL. This should replace inaccessible and incomplete |
| 159 | + solutions such as CSS-based overlays and ImageMap. |
156 | 160 | |
157 | | - |
158 | 161 | === Bug fixes in 1.14 === |
159 | 162 | |
160 | 163 | * (bug 14907) DatabasePostgres::fieldType now defined. |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -4224,7 +4224,7 @@ |
4225 | 4225 | 'vertAlign' => array( 'baseline', 'sub', 'super', 'top', 'text-top', 'middle', |
4226 | 4226 | 'bottom', 'text-bottom' ), |
4227 | 4227 | 'frame' => array( 'thumbnail', 'manualthumb', 'framed', 'frameless', |
4228 | | - 'upright', 'border' ), |
| 4228 | + 'upright', 'border', 'click' ), |
4229 | 4229 | ); |
4230 | 4230 | static $internalParamMap; |
4231 | 4231 | if ( !$internalParamMap ) { |
— | — | @@ -4343,6 +4343,29 @@ |
4344 | 4344 | /// downstream behavior seems odd with missing manual thumbs. |
4345 | 4345 | $validated = true; |
4346 | 4346 | break; |
| 4347 | + case 'click': |
| 4348 | + $chars = self::EXT_LINK_URL_CLASS; |
| 4349 | + $prots = $this->mUrlProtocols; |
| 4350 | + if ( $value === '' ) { |
| 4351 | + $paramName = 'no-link'; |
| 4352 | + $value = true; |
| 4353 | + $validated = true; |
| 4354 | + } elseif ( preg_match( "/^$prots/", $value ) ) { |
| 4355 | + if ( preg_match( "/^($prots)$chars+$/", $value, $m ) ) { |
| 4356 | + $paramName = 'click-url'; |
| 4357 | + $this->mOutput->addExternalLink( $value ); |
| 4358 | + $validated = true; |
| 4359 | + } |
| 4360 | + } else { |
| 4361 | + $clickTitle = Title::newFromText( $value ); |
| 4362 | + if ( $clickTitle ) { |
| 4363 | + $paramName = 'click-title'; |
| 4364 | + $value = $clickTitle; |
| 4365 | + $this->mOutput->addLink( $clickTitle ); |
| 4366 | + $validated = true; |
| 4367 | + } |
| 4368 | + } |
| 4369 | + break; |
4347 | 4370 | default: |
4348 | 4371 | // Most other things appear to be empty or numeric... |
4349 | 4372 | $validated = ( $value === false || is_numeric( trim( $value ) ) ); |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -699,6 +699,9 @@ |
700 | 700 | * bottom, text-bottom) |
701 | 701 | * alt Alternate text for image (i.e. alt attribute). Plain text. |
702 | 702 | * caption HTML for image caption. |
| 703 | + * click-url URL to link to |
| 704 | + * click-title Title object to link to |
| 705 | + * no-link Boolean, suppress description link |
703 | 706 | * |
704 | 707 | * @param array $handlerParams Associative array of media handler parameters, to be passed |
705 | 708 | * to transform(). Typical keys are "width" and "page". |
— | — | @@ -795,12 +798,22 @@ |
796 | 799 | if ( !$thumb ) { |
797 | 800 | $s = $this->makeBrokenImageLinkObj( $title, '', '', '', '', $time==true ); |
798 | 801 | } else { |
799 | | - $s = $thumb->toHtml( array( |
800 | | - 'desc-link' => true, |
801 | | - 'desc-query' => $query, |
| 802 | + $params = array( |
802 | 803 | 'alt' => $fp['alt'], |
803 | 804 | 'valign' => isset( $fp['valign'] ) ? $fp['valign'] : false , |
804 | | - 'img-class' => isset( $fp['border'] ) ? 'thumbborder' : false ) ); |
| 805 | + 'img-class' => isset( $fp['border'] ) ? 'thumbborder' : false ); |
| 806 | + if ( !empty( $fp['click-url'] ) ) { |
| 807 | + $params['custom-url-link'] = $fp['click-url']; |
| 808 | + } elseif ( !empty( $fp['click-title'] ) ) { |
| 809 | + $params['custom-title-link'] = $fp['click-title']; |
| 810 | + } elseif ( !empty( $fp['no-link'] ) ) { |
| 811 | + // No link |
| 812 | + } else { |
| 813 | + $params['desc-link'] = true; |
| 814 | + $params['desc-query'] = $query; |
| 815 | + } |
| 816 | + |
| 817 | + $s = $thumb->toHtml( $params ); |
805 | 818 | } |
806 | 819 | if ( '' != $fp['align'] ) { |
807 | 820 | $s = "<div class=\"float{$fp['align']}\">{$s}</div>"; |
Index: trunk/phase3/includes/MediaTransformOutput.php |
— | — | @@ -50,6 +50,8 @@ |
51 | 51 | * alt Alternate text or caption |
52 | 52 | * desc-link Boolean, show a description link |
53 | 53 | * file-link Boolean, show a file download link |
| 54 | + * custom-url-link Custom URL to link to |
| 55 | + * custom-title-link Custom Title object to link to |
54 | 56 | * valign vertical-align property, if the output is an inline element |
55 | 57 | * img-class Class applied to the <img> tag, if there is such a tag |
56 | 58 | * |
— | — | @@ -133,6 +135,8 @@ |
134 | 136 | * valign vertical-align property, if the output is an inline element |
135 | 137 | * img-class Class applied to the <img> tag, if there is such a tag |
136 | 138 | * desc-query String, description link query params |
| 139 | + * custom-url-link Custom URL to link to |
| 140 | + * custom-title-link Custom Title object to link to |
137 | 141 | * |
138 | 142 | * For images, desc-link and file-link are implemented as a click-through. For |
139 | 143 | * sounds and videos, they may be displayed in other ways. |
— | — | @@ -147,7 +151,12 @@ |
148 | 152 | |
149 | 153 | $alt = empty( $options['alt'] ) ? '' : $options['alt']; |
150 | 154 | $query = empty($options['desc-query']) ? '' : $options['desc-query']; |
151 | | - if ( !empty( $options['desc-link'] ) ) { |
| 155 | + if ( !empty( $options['custom-url-link'] ) ) { |
| 156 | + $linkAttribs = array( 'href' => $options['custom-url-link'] ); |
| 157 | + } elseif ( !empty( $options['custom-title-link'] ) ) { |
| 158 | + $title = $options['custom-title-link']; |
| 159 | + $linkAttribs = array( 'href' => $title->getLinkUrl(), 'title' => $title->getFullText() ); |
| 160 | + } elseif ( !empty( $options['desc-link'] ) ) { |
152 | 161 | $linkAttribs = $this->getDescLinkAttribs( $alt, $query ); |
153 | 162 | } elseif ( !empty( $options['file-link'] ) ) { |
154 | 163 | $linkAttribs = array( 'href' => $this->file->getURL() ); |