Yaron Koren has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/328559 )

Change subject: Added "description" option for "calendar" format
......................................................................

Added "description" option for "calendar" format

Based on a patch by Duncan Crane.

Change-Id: I6d576c31100835a9fa08b0650ea19ff813149822
---
M libs/ext.cargo.calendar.js
M specials/CargoExport.php
2 files changed, 19 insertions(+), 1 deletion(-)


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

diff --git a/libs/ext.cargo.calendar.js b/libs/ext.cargo.calendar.js
index bd6b626..aa2820a 100644
--- a/libs/ext.cargo.calendar.js
+++ b/libs/ext.cargo.calendar.js
@@ -17,6 +17,17 @@
                        },
                        defaultView: startView,
                        defaultDate: startDate,
+                       // Add event description to 'title' attribute, for
+                       // mouseover.
+                       eventMouseover: function(event, jsEvent, view) {
+                               if (view.name !== 'agendaDay') {
+                                       // JS lacks an "HTML decode" function,
+                                       // so we use this jQuery hack.
+                                       // Copied from 
http://stackoverflow.com/a/10715834
+                                       var decodedDescription = 
$('<div/>').html(event.description).text();
+                                       $(jsEvent.target).attr('title', 
decodedDescription);
+                               }
+                       }
                });
        });
 
diff --git a/specials/CargoExport.php b/specials/CargoExport.php
index f557324..9296ff1 100644
--- a/specials/CargoExport.php
+++ b/specials/CargoExport.php
@@ -124,6 +124,12 @@
                                } else {
                                        $eventTitle = reset( $queryResult );
                                }
+                               if ( array_key_exists( 'description', 
$queryResult ) ) {
+                                       $eventDescription = 
$queryResult['description'];
+                               } else {
+                                       $eventDescription = null;
+                               }
+
                                $title = Title::newFromText( 
$queryResult['_pageName'] );
                                $startDateField = $dateFieldAliases[0];
                                $startDate = $queryResult[$startDateField];
@@ -135,7 +141,8 @@
                                        'title' => $eventTitle,
                                        'url' => $title->getLocalURL(),
                                        'start' => 
$queryResult[$dateFieldAliases[0]],
-                                       'color' => $colorArray[$i]
+                                       'color' => $colorArray[$i],
+                                       'description' => $eventDescription
                                );
                                if ( $startDatePrecision != 
CargoStore::DATE_AND_TIME ) {
                                        $curEvent['allDay'] = true;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d576c31100835a9fa08b0650ea19ff813149822
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to