[MediaWiki-commits] [Gerrit] mediawiki...Cargo[master]: Added more alias options for "calendar" format

2017-01-03 Thread Yaron Koren (Code Review)
Yaron Koren has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/330234 )

Change subject: Added more alias options for "calendar" format
..


Added more alias options for "calendar" format

Patch by Duncan Crane.

Change-Id: Ic4c8524b38a2dde8055823f1aa05b6be447fba3a
---
M specials/CargoExport.php
1 file changed, 26 insertions(+), 3 deletions(-)

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



diff --git a/specials/CargoExport.php b/specials/CargoExport.php
index 8c83baa..401202c 100644
--- a/specials/CargoExport.php
+++ b/specials/CargoExport.php
@@ -125,6 +125,28 @@
} else {
$eventTitle = reset( $queryResult );
}
+   if ( array_key_exists( 'color', $queryResult ) 
) {
+   $eventColor = $queryResult['color'];
+   } else {
+   $eventColor = $colorArray[$i];
+   }
+   if ( array_key_exists( 'text color', 
$queryResult ) ) {
+   $eventTextColor = $queryResult['text 
color'];
+   } else {
+   $eventTextColor = $textColorArray[$i];
+   }
+   if ( array_key_exists( 'start', $queryResult ) 
) {
+   $eventStart = $queryResult['start'];
+   } else {
+   $eventStart = 
$queryResult[$dateFieldAliases[0]];
+   }
+   if ( array_key_exists( 'end', $queryResult ) ) {
+   $eventEnd = $queryResult['end'];
+   } elseif ( count( $dateFieldAliases ) > 1 && 
array_key_exists( $dateFieldAliases[1], $queryResult ) ) {
+   $eventEnd = 
$queryResult[$dateFieldAliases[1]];
+   } else {
+   $eventEnd = null;
+   }
if ( array_key_exists( 'description', 
$queryResult ) ) {
$eventDescription = 
$queryResult['description'];
} else {
@@ -141,9 +163,10 @@
// necessarily the page name.
'title' => $eventTitle,
'url' => $title->getLocalURL(),
-   'start' => 
$queryResult[$dateFieldAliases[0]],
-   'color' => $colorArray[$i],
-   'textColor' => $textColorArray[$i],
+   'start' => $eventStart,
+   'end' => $eventEnd,
+   'color' => $eventColor,
+   'textColor' => $eventTextColor,
'description' => $eventDescription
);
if ( $startDatePrecision != 
CargoStore::DATE_AND_TIME ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic4c8524b38a2dde8055823f1aa05b6be447fba3a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren 
Gerrit-Reviewer: Yaron Koren 
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...Cargo[master]: Added more alias options for "calendar" format

2017-01-03 Thread Yaron Koren (Code Review)
Yaron Koren has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/330234 )

Change subject: Added more alias options for "calendar" format
..

Added more alias options for "calendar" format

Patch by Duncan Crane.

Change-Id: Ic4c8524b38a2dde8055823f1aa05b6be447fba3a
---
M specials/CargoExport.php
1 file changed, 26 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo 
refs/changes/34/330234/2

diff --git a/specials/CargoExport.php b/specials/CargoExport.php
index 8c83baa..401202c 100644
--- a/specials/CargoExport.php
+++ b/specials/CargoExport.php
@@ -125,6 +125,28 @@
} else {
$eventTitle = reset( $queryResult );
}
+   if ( array_key_exists( 'color', $queryResult ) 
) {
+   $eventColor = $queryResult['color'];
+   } else {
+   $eventColor = $colorArray[$i];
+   }
+   if ( array_key_exists( 'text color', 
$queryResult ) ) {
+   $eventTextColor = $queryResult['text 
color'];
+   } else {
+   $eventTextColor = $textColorArray[$i];
+   }
+   if ( array_key_exists( 'start', $queryResult ) 
) {
+   $eventStart = $queryResult['start'];
+   } else {
+   $eventStart = 
$queryResult[$dateFieldAliases[0]];
+   }
+   if ( array_key_exists( 'end', $queryResult ) ) {
+   $eventEnd = $queryResult['end'];
+   } elseif ( count( $dateFieldAliases ) > 1 && 
array_key_exists( $dateFieldAliases[1], $queryResult ) ) {
+   $eventEnd = 
$queryResult[$dateFieldAliases[1]];
+   } else {
+   $eventEnd = null;
+   }
if ( array_key_exists( 'description', 
$queryResult ) ) {
$eventDescription = 
$queryResult['description'];
} else {
@@ -141,9 +163,10 @@
// necessarily the page name.
'title' => $eventTitle,
'url' => $title->getLocalURL(),
-   'start' => 
$queryResult[$dateFieldAliases[0]],
-   'color' => $colorArray[$i],
-   'textColor' => $textColorArray[$i],
+   'start' => $eventStart,
+   'end' => $eventEnd,
+   'color' => $eventColor,
+   'textColor' => $eventTextColor,
'description' => $eventDescription
);
if ( $startDatePrecision != 
CargoStore::DATE_AND_TIME ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4c8524b38a2dde8055823f1aa05b6be447fba3a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren 
Gerrit-Reviewer: jenkins-bot <>

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