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
maint-2.0.2
Francis Lachapelle 2009-07-07 21:17:43 +00:00
parent 42eb08f909
commit 0249688874
11 changed files with 74 additions and 33 deletions

View File

@ -1,3 +1,14 @@
2009-07-07 Francis Lachapelle <flachapelle@inverse.ca>
* 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 <wsourdeau@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentFolder.m

View File

@ -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;

View File

@ -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;

View File

@ -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"; } )
)

View File

@ -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"; } )
)

View File

@ -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;

View File

@ -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];

View File

@ -99,12 +99,12 @@
<label id="documentLabel" style="display: none;"><var:string label:value="Document:"
/><span class="content"
><a href="#" id="documentHref"><!-- space --></a
><a id="changeUrlButton" class="button" var:href="#"
><a id="changeAttachButton" class="button" var:href="#"
><var:string label:value="Change..."/></a
></span></label>
<!-- hidden -->
<input type="hidden" name="url" id="url" var:value="url"/>
<input type="hidden" name="attach" id="attach" var:value="attach"/>
<input type="hidden" name="privacy" id="privacy"
var:value="privacy"/>
<input type="hidden" name="attendeesNames" id="attendeesNames"

View File

@ -81,9 +81,6 @@ n0SPAN.content
SPAN.content A
{ line-height: 2em; }
A#changeUrlButton
{ margin-left: 1em; }
A#detailsButton
{ position: absolute;
right: 1em;

View File

@ -4,6 +4,9 @@ SELECT#calendarList
#attendeesLabel
{ display: none; }
A#changeAttachButton
{ margin-left: 1em; }
SPAN.datePicker INPUT.textField
{ width: 7em; }

View File

@ -20,28 +20,28 @@ function onSelectPrivacy(event) {
}
}
function onPopupUrlWindow(event) {
function onPopupAttachWindow(event) {
if (event)
preventDefault(event);
var urlInput = document.getElementById("url");
var newUrl = window.prompt(labels["Target:"], urlInput.value);
if (newUrl != null) {
var attachInput = document.getElementById("attach");
var newAttach = window.prompt(labels["Target:"], attachInput.value || "http://");
if (newAttach != null) {
var documentHref = $("documentHref");
var documentLabel = $("documentLabel");
if (documentHref.childNodes.length > 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" });