Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #11 from ExchangeCalendar/wip-dialogs-event-attendees
Browse files Browse the repository at this point in the history
Event dialog: fix content editor and attendees dialog
  • Loading branch information
advancingu authored Jun 10, 2017
2 parents b4da51e + 2132ce9 commit 76b8803
Show file tree
Hide file tree
Showing 22 changed files with 723 additions and 648 deletions.
4 changes: 4 additions & 0 deletions chrome.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ overlay chrome://calendar/content/calendar-calendars-list.xul chrome://exchangec
overlay chrome://messenger/content/messenger.xul chrome://exchangecalendar/content/progress_panel.xul
overlay chrome://calendar/content/calendar-task-view.xul chrome://exchangecalendar/content/messenger_task_delegation.xul
overlay chrome://lightning/content/lightning-standalone.xul chrome://exchangecalendar/content/progress_panel.xul

overlay chrome://calendar/content/calendar-event-dialog.xul chrome://exchangecalendar/content/calendar-event-dialog.xul
overlay chrome://lightning/content/lightning-item-iframe.xul chrome://exchangecalendar/content/lightning-item-iframe.xul

overlay chrome://calendar/content/calendar-event-dialog-reminder.xul chrome://exchangecalendar/content/calendar-event-dialog-reminder.xul
overlay chrome://calendar/content/calendar-summary-dialog.xul chrome://exchangecalendar/content/calendar-summary-dialog.xul
overlay chrome://calendar/content/calendar-properties-dialog.xul chrome://exchangecalendar/content/calendar-properties-dialog.xul

overlay chrome://messenger/content/messenger.xul chrome://exchangecalendar/content/sharedCalendarParser.xul application={3550f703-e582-4d05-9a08-453d09bdfdc6}
overlay chrome://messenger/content/messenger.xul chrome://exchangecalendar/content/check4lightning.xul
overlay chrome://messenger/content/preferences/preferences.xul chrome://exchangecalendar/content/messenger-overlay-preferences.xul
Expand Down
71 changes: 51 additions & 20 deletions chrome/content/attachments-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function exchAttachments(aDocument, aWindow)
}

exchAttachments.prototype = {
_initialized: false,

addAttachmentDialog: function _addAttachmentDialog()
{
Expand Down Expand Up @@ -227,45 +228,75 @@ exchAttachments.prototype = {
}
},

/**
* Receives asynchronous messages from the parent context that contains the iframe.
*
* @param {MessageEvent} aEvent Contains the message being received
*/
receiveMessage: function _receiveMessage(aEvent) {
let validOrigin = gTabmail ? "chrome://messenger" : "chrome://calendar";
if (aEvent.origin !== validOrigin) {
return;
}
switch (aEvent.data.command) {
case "exchWebService_addAttachmentDialog": this.addAttachmentDialog(); break;
}
},

onLoad: function _onLoad()
{
if(this._initialized){
return;
}

var self = this;

if (this._document.getElementById("calendar-task-tree")) {
this.globalFunctions.LOG(" -- calendar-task-tree --");
var self = this;
this._document.getElementById("calendar-task-tree").addEventListener("select", function(){ self.onSelectTask();}, true);
return;
}
}

var args = this._window.arguments[0];
var item = args.calendarEvent;

//this.globalFunctions.LOG(" -- onLoad 2 ("+this.globalFunctions.STACKshort()+")");
this.attachmentListboxVisible = false;

// We can't update toolbar from iframe
if ((item.calendar) && (item.calendar.type == "exchangecalendar")) {
this.globalFunctions.LOG(" -- It is an Exchange Calendar event:"+item.title);


try {
// Hide Lightning URL button
this._document.getElementById("button-url").hidden = true;
this._document.getElementById("event-toolbar").setAttribute("currentset", "button-save,button-attendees,button-privacy,button-url,exchWebService-add-attachment-button,button-delete");
this._document.getElementById("exchWebService-add-attachment-button").hidden = false;
if(this._document.getElementById("options-attachments-menuitem")){
this._document.getElementById("options-attachments-menuitem").setAttribute("label", this._document.getElementById("exchWebService-add-attachment-button").getAttribute("label"));
this._document.getElementById("options-attachments-menuitem").setAttribute("command", "exchWebService_addAttachmentDialog");
}
if (this._document.getElementById("event-grid-attachment-row")) {
this._document.getElementById("event-grid-attachment-row").collapsed = true;
}
catch (ex) {this.globalFunctions.LOG(" -- Could not add exchange attachment buttons:"+ex.toString());}

// calendar-event-dialog (hide existing attachment view)
try {
this._document.getElementById("event-grid-attachment-row").setAttribute("collapsed", "true");
}
catch (ex) {}
// Modify context menu for the attachment list inside the "Attachment" panel
let attachmentListbox = this._document.getElementById("attachment-link");

attachmentListbox.context = "exchWebService-attachment-popup" ;
attachmentListbox.onkeypress = function (aEvent) { self.onKeyPress(aEvent); };
attachmentListbox.onclick = function (aEvent) { self.onSelect(aEvent); };
attachmentListbox.ondblclick = function (aEvent) { self.onDblClick(aEvent); };

this.addAttachmentsFromItem(item);
} else {
if (this._document.getElementById("event-grid-attachment-row")) {
this._document.getElementById("event-grid-attachment-row").collapsed = false;
}

// Modify context menu for the attachment list inside the "Attachment" panel
let attachmentListbox = this._document.getElementById("attachment-link");

attachmentListbox.context = "attachment-popup" ;
attachmentListbox.onkeypress="attachmentLinkKeyPress(event)" ;
attachmentListbox.onclick="attachmentClick(event);" ;
attachmentListbox.ondblclick="attachmentDblClick(event)" ;
}

// Add message listener to be able to receive message from parent window or tab
window.addEventListener("message", function(aEvent) { self.receiveMessage(aEvent); }, false);

this._initialized = true;
},

addAttachmentsFromItem: function _addAttachmentsFromItem(aItem)
Expand Down Expand Up @@ -584,6 +615,6 @@ exchAttachments.prototype = {
}

var tmpAttachment = new exchAttachments(document, window);
window.addEventListener("load", function _onLoad() { window.removeEventListener("load",arguments.callee,false); tmpAttachment.onLoad(); }, true);
window.addEventListener("load", function _onLoad() { tmpAttachment.onLoad(); }, false);


32 changes: 7 additions & 25 deletions chrome/content/attachments-view.xul
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,19 @@
<overlay id="exchWebService-attachment-view"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script type="application/javascript" src="chrome://exchangecalendar/content/attachments-view.js"/>
<script type="application/javascript" src="chrome://exchangecalendar/content/attachments-view.js"/>

<!-- Commands -->
<commandset id="itemCommands">
<commandset>
<command id="exchWebService_openAttachment"
oncommand="tmpAttachment.openAttachment();"/>
oncommand="tmpAttachment.openAttachment();"/>
<command id="exchWebService_saveAttachment"
oncommand="tmpAttachment.saveAttachment();"/>
oncommand="tmpAttachment.saveAttachment();"/>
<command id="exchWebService_deleteAttachment"
oncommand="tmpAttachment.deleteAttachment();"/>
<command id="exchWebService_addAttachmentDialog"
oncommand="tmpAttachment.addAttachmentDialog();"/>
oncommand="tmpAttachment.deleteAttachment();"/>
</commandset>

<!-- Update context popup-->
<popupset id="event-dialog-popupset">
<menupopup id="exchWebService-attachment-popup">
<menuitem id="exchWebService-attachment-popup-open"
Expand All @@ -74,26 +73,9 @@
<menuitem id="exchWebService-attachment-popup-delete"
label="&event.menu.item.delete.label;"
accesskey="&event.menu.item.delete.accesskey;"
disable-on-readonly="true"
disable-on-readonly="true"
command="exchWebService_deleteAttachment"/>
</menupopup>
</popupset>

<toolbarpalette id="event-toolbarpalette">
<toolbarbutton id="exchWebService-add-attachment-button"
mode="dialog"
class="cal-event-toolbarbutton toolbarbutton-1"
label="&exchWebServie.add.attachment.button.label;"
disable-on-readonly="true"
removable="true"
command="exchWebService_addAttachmentDialog"
oncommand="tmpAttachment.addAttachmentDialog();"
hidden="true"/>
</toolbarpalette>
<toolbar id="event-toolbar" defaultset="button-save,button-attendees,button-privacy,button-url,exchWebService-add-attachment-button,button-delete">
</toolbar>


</overlay>


Loading

0 comments on commit 76b8803

Please sign in to comment.