--- /dev/null
+/*
+Copyright (c) Igor Barma, Alexandre Desoubeaux, Christian Martel, Eric Brun, Mathieu Amblard, Gwenael Gevet, Pierre Guillot, 2012
+ * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Alexandre Lefevre, Marc Salvat 2014-2016
+ * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Marc Salvat, Marc Suarez, Harifetra Ramamonjy 2017
+For licensing, see README.txt or http://www.pentilanero.com (Cecill-C or AGPL or LGPL)
+*/
+Ext.ns("EntSavoie.Agenda");
+EntSavoie.Agenda.EventViewer = function (config) {
+ Ext.apply(this, config);
+
+ // Ajoute le texte des erreurs
+ Ext.QuickTips.init();
+
+ // turn on validation errors beside the field globally
+ Ext.form.Field.prototype.msgTarget = 'side';
+
+ this.closeBtn = this.closeBtn || new Ext.Button({
+ tooltip: this.i18n.Agenda.EventViewer.closeBtn.tooltip,
+ text: this.i18n.Agenda.EventViewer.closeBtn.text,
+ handler: this.onCloseBtn,
+ scope: this
+ });
+
+ this.templateEvent = this.templateEvent || new Ext.XTemplate('<tpl for=".">',
+ '<tpl if="this.showIt(Title)">',
+ '<b>{Title}</b><br/>',
+ '</tpl>',
+ '<tpl if="this.showIt(Title)==false">',
+ '<b>(Pas de titre)</b><br/>',
+ '</tpl>',
+ 'par <i><a id="{Token}" onclick="showMenuUser({Token}, {AuthorId}, \'{Author}\')">{Author}</a></i>',
+ '<tpl if="this.sameDay(StartDate, EndDate)">',
+ ' le {StartDate:date("d/m/Y")} de {StartDate:date("H:i")} à {EndDate:date("H:i")}<br/><br/>',
+ '</tpl>',
+ '<tpl if="this.sameDay(StartDate, EndDate)==false">',
+ 'du {StartDate:date("d/m/Y")} à {StartDate:date("H:i")} au {EndDate:date("d/m/Y")} à {EndDate:date("H:i")}<br/><br/>',
+ '</tpl>',
+ '<tpl if="this.showIt(Location)">',
+ 'Lieu: {Location}<br/><br/>',
+ '</tpl>',
+ '<tpl if="this.showIt(Notes)">',
+ '{Notes}<br/>',
+ '</tpl>',
+ '<tpl if="this.showIt(Url)">',
+ '<a href="{Url}">Plus d\'informations</a>',
+ '</tpl>',
+ '</tpl>', {
+ showIt: function(value){
+ if (value==null || value=="") {
+ return false;
+
+ }
+ return true;
+ },
+ sameDay: function(startDate, endDate){
+ var sDay = startDate.format('d/m/Y');
+ var eDay = endDate.format('d/m/Y');
+ return sDay == eDay;
+ }
+
+ });
+
+ this.eventViewer = this.eventViewer || new Ext.Panel({
+ frame: true,
+ border: false,
+ tpl: this.templateEvent
+ });
+
+ EntSavoie.Agenda.EventViewer.superclass.constructor.call(this, {
+ cls: "agenda-portlet",
+ title: this.i18n.Agenda.EventViewer.constructor.title,
+ width: 500,
+ modal: true,
+ items: [this.eventViewer],
+ buttons: [this.closeBtn]
+ });
+
+};
+
+Ext.extend(EntSavoie.Agenda.EventViewer, Ext.Window, {
+ initComponent: function () {
+ EntSavoie.Agenda.EventViewer.superclass.initComponent.call(this);
+ },
+
+ updateAndShow: function(eventRec) {
+ this.show();
+ this.setTitle(eventRec.data["Title"]);
+ this.eventViewer.update(eventRec.data);
+ },
+
+
+ onCloseBtn: function(btn) {
+ this.close();
+ }
+
+
+});