From 02496888745effebd5bde1e3df1751f1f1aa1f46 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 7 Jul 2009 21:17:43 +0000 Subject: [PATCH] Fix attachments in web interface Monotone-Parent: ab2ff65d5c716a5cd610c720b705af5e768a77c0 Monotone-Revision: aec0948f76228380cdf63ab082da3759f9d9da50 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-07-07T21:17:43 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 11 ++++++++ SOPE/NGCards/iCalEntityObject.h | 2 ++ SOPE/NGCards/iCalEntityObject.m | 28 +++++++++++++++++++ .../Toolbars/SOGoAppointmentObject.toolbar | 2 +- UI/Scheduler/Toolbars/SOGoTaskObject.toolbar | 2 +- UI/Scheduler/UIxComponentEditor.h | 6 ++-- UI/Scheduler/UIxComponentEditor.m | 18 ++++++------ .../SchedulerUI/UIxComponentEditor.wox | 4 +-- .../UIxAppointmentEditor.css | 3 -- UI/WebServerResources/UIxComponentEditor.css | 3 ++ UI/WebServerResources/UIxComponentEditor.js | 28 +++++++++---------- 11 files changed, 74 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f20cbbe5..97cdaf473 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-07-07 Francis Lachapelle + + * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor + -attach:]): new method to return the ATTACH property of the + component. + ([UIxComponentEditor -setAttach:]): associated setter method. + + * iCalEntityObject.m ([iCalEntityObject -attach]): new method to return the + ATTACH property of the component as a URL. + ([iCalEntityObject -setAttach:]): new method to set the ATTACH property. + 2009-07-07 Wolfgang Sourdeau * SoObjects/Appointments/SOGoAppointmentFolder.m diff --git a/SOPE/NGCards/iCalEntityObject.h b/SOPE/NGCards/iCalEntityObject.h index d9d7faf6d..1b8efeaa5 100644 --- a/SOPE/NGCards/iCalEntityObject.h +++ b/SOPE/NGCards/iCalEntityObject.h @@ -94,6 +94,8 @@ typedef enum - (void) increaseSequence; /* url can either be set as NSString or NSURL */ +- (void) setAttach: (id) _value; +- (NSURL *) attach; - (void) setUrl: (id) _value; - (NSURL *) url; diff --git a/SOPE/NGCards/iCalEntityObject.m b/SOPE/NGCards/iCalEntityObject.m index 5f6ff9775..e4475a611 100644 --- a/SOPE/NGCards/iCalEntityObject.m +++ b/SOPE/NGCards/iCalEntityObject.m @@ -337,6 +337,34 @@ return [self childrenWithTag: @"valarm"]; } +- (void) setAttach: (id) _value +{ + NSString *asString; + + if ([_value isKindOfClass: [NSString class]]) + asString = _value; + else if ([_value isKindOfClass: [NSURL class]]) + asString = [_value absoluteString]; + else + asString = @""; + + [[self uniqueChildWithTag: @"attach"] setValue: 0 to: asString]; +} + +- (NSURL *) attach +{ + NSString *stringAttach; + NSURL *url; + + stringAttach = [[self uniqueChildWithTag: @"attach"] value: 0]; + url = [NSURL URLWithString: stringAttach]; + + if (!url && [stringAttach length] > 0) + url = [NSURL URLWithString: [NSString stringWithFormat: @"http://%@", stringAttach]]; + + return url; +} + - (void) setUrl: (id) _value { NSString *asString; diff --git a/UI/Scheduler/Toolbars/SOGoAppointmentObject.toolbar b/UI/Scheduler/Toolbars/SOGoAppointmentObject.toolbar index b4f117045..49beaa3c7 100644 --- a/UI/Scheduler/Toolbars/SOGoAppointmentObject.toolbar +++ b/UI/Scheduler/Toolbars/SOGoAppointmentObject.toolbar @@ -14,6 +14,6 @@ image = "tb-compose-security-flat-24x24.png"; }, { link = "#"; label = "Documents"; - onclick = "return onPopupUrlWindow();"; + onclick = "return onPopupAttachWindow();"; image = "tb-compose-attach-flat-24x24.png"; } ) ) diff --git a/UI/Scheduler/Toolbars/SOGoTaskObject.toolbar b/UI/Scheduler/Toolbars/SOGoTaskObject.toolbar index 2ad120e2d..83d03e4c4 100644 --- a/UI/Scheduler/Toolbars/SOGoTaskObject.toolbar +++ b/UI/Scheduler/Toolbars/SOGoTaskObject.toolbar @@ -10,6 +10,6 @@ image = "tb-compose-security-flat-24x24.png"; }, { link = "#"; label = "Documents"; - onclick = "return onPopupUrlWindow();"; + onclick = "return onPopupAttachWindow();"; image = "tb-compose-attach-flat-24x24.png"; } ) ) diff --git a/UI/Scheduler/UIxComponentEditor.h b/UI/Scheduler/UIxComponentEditor.h index d1cf6b5dd..910d4a466 100644 --- a/UI/Scheduler/UIxComponentEditor.h +++ b/UI/Scheduler/UIxComponentEditor.h @@ -50,7 +50,7 @@ NSString *location; SOGoAppointmentFolder *componentCalendar; NSString *comment; - NSString *url; + NSString *attachUrl; NSString *priority; NSString *privacy; NSString *status; @@ -138,8 +138,8 @@ - (void) setComment: (NSString *) _value; - (NSString *) comment; -- (void) setUrl: (NSString *) _url; -- (NSString *) url; +- (void) setAttach: (NSString *) _attachUrl; +- (NSString *) attach; - (void) setAttendeesNames: (NSString *) newAttendeesNames; - (NSString *) attendeesNames; diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 1cd7c77f2..089a67ebc 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -203,7 +203,7 @@ iRANGE(2); [categories release]; [cycle release]; [cycleEnd release]; - [url release]; + [attachUrl release]; [attendeesNames release]; [attendeesUIDs release]; [attendeesEmails release]; @@ -534,7 +534,7 @@ iRANGE(2); ASSIGN (title, [component summary]); ASSIGN (location, [component location]); ASSIGN (comment, [component comment]); - ASSIGN (url, [[component url] absoluteString]); + ASSIGN (attachUrl, [[component attach] absoluteString]); ASSIGN (privacy, [component accessClass]); ASSIGN (priority, [component priority]); ASSIGN (status, [component status]); @@ -617,14 +617,14 @@ iRANGE(2); return title; } -- (void) setUrl: (NSString *) _url +- (void) setAttach: (NSString *) _attachUrl { - ASSIGN (url, _url); + ASSIGN (attachUrl, _attachUrl); } -- (NSString *) url +- (NSString *) attach { - return url; + return attachUrl; } - (NSString *) organizerName @@ -1407,7 +1407,7 @@ RANGE(2); /* contact editor compatibility */ -- (NSString *) urlButtonClasses +/*- (NSString *) urlButtonClasses { NSString *classes; @@ -1417,7 +1417,7 @@ RANGE(2); classes = @"button _disabled"; return classes; -} + }*/ - (void) _handleAttendeesEdition { @@ -1711,7 +1711,7 @@ RANGE(2); [component setSummary: title]; [component setLocation: location]; [component setComment: comment]; - [component setUrl: url]; + [component setAttach: attachUrl]; [component setAccessClass: privacy]; [component setCategories: [category capitalizedString]]; [self _handleAttendeesEdition]; diff --git a/UI/Templates/SchedulerUI/UIxComponentEditor.wox b/UI/Templates/SchedulerUI/UIxComponentEditor.wox index 3d6fd0b7f..246c59e0e 100644 --- a/UI/Templates/SchedulerUI/UIxComponentEditor.wox +++ b/UI/Templates/SchedulerUI/UIxComponentEditor.wox @@ -99,12 +99,12 @@ - + 0) { - documentHref.childNodes[0].nodeValue = newUrl; - if (newUrl.length > 0) + documentHref.childNodes[0].nodeValue = newAttach; + if (newAttach.length > 0) documentLabel.setStyle({ display: "block" }); else documentLabel.setStyle({ display: "none" }); } else { - documentHref.appendChild(document.createTextNode(newUrl)); - if (newUrl.length > 0) + documentHref.appendChild(document.createTextNode(newAttach)); + if (newAttach.length > 0) documentLabel.setStyle({ display: "block" }); } - urlInput.value = newUrl; + attachInput.value = newAttach; } onWindowResize(event); @@ -49,7 +49,7 @@ function onPopupUrlWindow(event) { } function onPopupDocumentWindow(event) { - var documentUrl = $("url"); + var documentUrl = $("attach"); preventDefault(event); window.open(documentUrl.value, "SOGo_Document"); @@ -90,7 +90,7 @@ function onChangeCalendar(event) { function initializeDocumentHref() { var documentHref = $("documentHref"); var documentLabel = $("documentLabel"); - var documentUrl = $("url"); + var documentUrl = $("attach"); documentHref.observe("click", onPopupDocumentWindow, false); documentHref.setStyle({ textDecoration: "underline", color: "#00f" }); @@ -99,8 +99,8 @@ function initializeDocumentHref() { documentLabel.setStyle({ display: "block" }); } - var changeUrlButton = $("changeUrlButton"); - changeUrlButton.observe("click", onPopupUrlWindow, false); + var changeUrlButton = $("changeAttachButton"); + changeUrlButton.observe("click", onPopupAttachWindow, false); } function initializePrivacyMenu() { @@ -152,7 +152,7 @@ function onWindowResize(event) { height = window.height() - comment.cumulativeOffset().top - offset; if (document.visible()) - height -= $("changeUrlButton").getHeight(); + height -= $("changeAttachButton").getHeight(); area.setStyle({ height: (height - offset*2) + "px" }); comment.setStyle({ height: (height - offset) + "px" });