[MediaWiki-commits] [Gerrit] mediawiki...Kartographer[master]: Fix mapframe preview with enabled snapshot

2016-10-25 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Fix mapframe preview with enabled snapshot
..


Fix mapframe preview with enabled snapshot

Bug: T149070
Change-Id: Ib5c43b9f18ad3c94171b0f26962600773bd5f8c9
---
M includes/Tag/MapFrame.php
M includes/Tag/TagHandler.php
2 files changed, 16 insertions(+), 7 deletions(-)

Approvals:
  Yurik: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Tag/MapFrame.php b/includes/Tag/MapFrame.php
index ecab4a9..ced690c 100644
--- a/includes/Tag/MapFrame.php
+++ b/includes/Tag/MapFrame.php
@@ -50,6 +50,11 @@
$framed = $caption !== null || $this->getText( 'frameless', 
null ) === null;
 
$output = $this->parser->getOutput();
+   $options = $this->parser->getOptions();
+
+   $useSnapshot =
+   $wgKartographerStaticMapframe && 
!$options->getIsPreview() &&
+   !$options->getIsSectionPreview();
 
switch ( $wgKartographerFrameMode ) {
/* Not implemented in Kartotherian yet
@@ -88,11 +93,9 @@
*/
 
case 'interactive':
-   if ( $wgKartographerStaticMapframe ) {
-   $output->addModules( 
'ext.kartographer.staticframe' );
-   } else {
-   $output->addModules( 
'ext.kartographer.frame' );
-   }
+   $output->addModules( $useSnapshot
+   ? 'ext.kartographer.staticframe'
+   : 'ext.kartographer.frame' );
 
$fullWidth = false;
 
@@ -167,7 +170,7 @@
$attrs['style'] .= " width: {$width}; height: 
{$height};";
$attrs['class'] .= " {$containerClass} 
{$alignClasses[$this->align]}";
 
-   return Html::rawElement( $wgKartographerStaticMapframe 
? 'a' : 'div', $attrs );
+   return Html::rawElement( $useSnapshot ? 'a' : 'div', 
$attrs );
}
 
$attrs['style'] .= " height: {$height};";
@@ -176,7 +179,7 @@
$captionFrame = Html::rawElement( 'div', [ 'class' => 
'thumbcaption' ],
$this->parser->recursiveTagParse( $caption ) );
 
-   $mapDiv = Html::rawElement( $wgKartographerStaticMapframe ? 'a' 
: 'div', $attrs );
+   $mapDiv = Html::rawElement( $useSnapshot ? 'a' : 'div', $attrs 
);
 
return Html::rawElement( 'div', [ 'class' => $containerClass ],
Html::rawElement( 'div', [
diff --git a/includes/Tag/TagHandler.php b/includes/Tag/TagHandler.php
index 7412e71..6996a41 100644
--- a/includes/Tag/TagHandler.php
+++ b/includes/Tag/TagHandler.php
@@ -279,6 +279,8 @@
 * @param Parser $parser
 */
public static function finalParseStep( Parser $parser ) {
+   global $wgKartographerStaticMapframe;
+
$output = $parser->getOutput();
$state = State::getState( $output );
 
@@ -303,6 +305,10 @@
$options = $parser->getOptions();
if ( $data && ( $options->getIsPreview() || 
$options->getIsSectionPreview() ) ) {
$output->addJsConfigVars( 'wgKartographerLiveData', 
$data );
+   if ( $wgKartographerStaticMapframe ) {
+   // Preview generates HTML that is different 
from normal
+   $output->updateCacheExpiry( 0 );
+   }
} else {
$interact = $state->getInteractiveGroups();
$requested = $state->getRequestedGroups();

-- 
To view, visit https://gerrit.wikimedia.org/r/317753
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib5c43b9f18ad3c94171b0f26962600773bd5f8c9
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: master
Gerrit-Owner: Yurik 
Gerrit-Reviewer: MaxSem 
Gerrit-Reviewer: Yurik 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Kartographer[master]: Fix mapframe preview with enabled snapshot

2016-10-24 Thread Yurik (Code Review)
Yurik has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/317753

Change subject: Fix mapframe preview with enabled snapshot
..

Fix mapframe preview with enabled snapshot

Bug: T149070
Change-Id: Ib5c43b9f18ad3c94171b0f26962600773bd5f8c9
---
M includes/Tag/MapFrame.php
M includes/Tag/TagHandler.php
2 files changed, 12 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Kartographer 
refs/changes/53/317753/1

diff --git a/includes/Tag/MapFrame.php b/includes/Tag/MapFrame.php
index ecab4a9..ced690c 100644
--- a/includes/Tag/MapFrame.php
+++ b/includes/Tag/MapFrame.php
@@ -50,6 +50,11 @@
$framed = $caption !== null || $this->getText( 'frameless', 
null ) === null;
 
$output = $this->parser->getOutput();
+   $options = $this->parser->getOptions();
+
+   $useSnapshot =
+   $wgKartographerStaticMapframe && 
!$options->getIsPreview() &&
+   !$options->getIsSectionPreview();
 
switch ( $wgKartographerFrameMode ) {
/* Not implemented in Kartotherian yet
@@ -88,11 +93,9 @@
*/
 
case 'interactive':
-   if ( $wgKartographerStaticMapframe ) {
-   $output->addModules( 
'ext.kartographer.staticframe' );
-   } else {
-   $output->addModules( 
'ext.kartographer.frame' );
-   }
+   $output->addModules( $useSnapshot
+   ? 'ext.kartographer.staticframe'
+   : 'ext.kartographer.frame' );
 
$fullWidth = false;
 
@@ -167,7 +170,7 @@
$attrs['style'] .= " width: {$width}; height: 
{$height};";
$attrs['class'] .= " {$containerClass} 
{$alignClasses[$this->align]}";
 
-   return Html::rawElement( $wgKartographerStaticMapframe 
? 'a' : 'div', $attrs );
+   return Html::rawElement( $useSnapshot ? 'a' : 'div', 
$attrs );
}
 
$attrs['style'] .= " height: {$height};";
@@ -176,7 +179,7 @@
$captionFrame = Html::rawElement( 'div', [ 'class' => 
'thumbcaption' ],
$this->parser->recursiveTagParse( $caption ) );
 
-   $mapDiv = Html::rawElement( $wgKartographerStaticMapframe ? 'a' 
: 'div', $attrs );
+   $mapDiv = Html::rawElement( $useSnapshot ? 'a' : 'div', $attrs 
);
 
return Html::rawElement( 'div', [ 'class' => $containerClass ],
Html::rawElement( 'div', [
diff --git a/includes/Tag/TagHandler.php b/includes/Tag/TagHandler.php
index 7412e71..2b8b6a0 100644
--- a/includes/Tag/TagHandler.php
+++ b/includes/Tag/TagHandler.php
@@ -303,6 +303,8 @@
$options = $parser->getOptions();
if ( $data && ( $options->getIsPreview() || 
$options->getIsSectionPreview() ) ) {
$output->addJsConfigVars( 'wgKartographerLiveData', 
$data );
+   // Preview generates HTML that is different from normal
+   $output->updateCacheExpiry( 0 );
} else {
$interact = $state->getInteractiveGroups();
$requested = $state->getRequestedGroups();

-- 
To view, visit https://gerrit.wikimedia.org/r/317753
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib5c43b9f18ad3c94171b0f26962600773bd5f8c9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: master
Gerrit-Owner: Yurik 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits