From b184587d97a90f54d8d97925a28094d1d0cc835a Mon Sep 17 00:00:00 2001 From: wolfgang Date: Thu, 25 Oct 2007 18:35:44 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1199 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOPE/sope-patchset-r1546.diff | 281 +++++++++++++++++++------ UI/WebServerResources/UIxMailEditor.js | 105 +++++---- 2 files changed, 281 insertions(+), 105 deletions(-) diff --git a/SOPE/sope-patchset-r1546.diff b/SOPE/sope-patchset-r1546.diff index a9908ac1..6bf1888e 100644 --- a/SOPE/sope-patchset-r1546.diff +++ b/SOPE/sope-patchset-r1546.diff @@ -1,68 +1,3 @@ -Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.h -=================================================================== ---- sope-gdl1/PostgreSQL/PostgreSQL72Channel.h (révision 1546) -+++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.h (copie de travail) -@@ -28,6 +28,7 @@ - #define ___PostgreSQL72_Channel_H___ - - #include -+#include - #include - - @class NSArray, NSString, NSMutableDictionary; -@@ -40,7 +41,7 @@ - int modification; - } PostgreSQL72FieldInfo; - --@interface PostgreSQL72Channel : EOAdaptorChannel -+@interface PostgreSQL72Channel : EOAdaptorChannel - { - // connection is valid after an openChannel call - PGConnection *connection; -Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m -=================================================================== ---- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (révision 1546) -+++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (copie de travail) -@@ -713,6 +713,39 @@ - return ms; - } - -+/* GCSEOAdaptorChannel protocol */ -+static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \ -+ @" c_name VARCHAR (256) NOT NULL,\n" -+ @" c_content VARCHAR (100000) NOT NULL,\n" -+ @" c_creationdate INT4 NOT NULL,\n" -+ @" c_lastmodified INT4 NOT NULL,\n" -+ @" c_version INT4 NOT NULL,\n" -+ @" c_deleted INT4 NULL\n" -+ @")"); -+static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \ -+ @" c_uid VARCHAR (256) NOT NULL,\n" -+ @" c_object VARCHAR (256) NOT NULL,\n" -+ @" c_role VARCHAR (80) NOT NULL\n" -+ @")"); -+ -+- (NSException *) createGCSFolderTableWithName: (NSString *) tableName -+{ -+ NSString *sql; -+ -+ sql = [NSString stringWithFormat: sqlFolderFormat, tableName]; -+ -+ return [self evaluateExpressionX: sql]; -+} -+ -+- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName -+{ -+ NSString *sql; -+ -+ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName]; -+ -+ return [self evaluateExpressionX: sql]; -+} -+ - @end /* PostgreSQL72Channel */ - - @implementation PostgreSQL72Channel(PrimaryKeyGeneration) Index: sope-mime/NGImap4/NGImap4Connection.m =================================================================== --- sope-mime/NGImap4/NGImap4Connection.m (révision 1546) @@ -385,6 +320,71 @@ Index: sope-mime/NGMime/NGMimePartParser.m contentType = ([ctype isKindOfClass:[NGMimeType class]]) ? ctype : [NGMimeType mimeType:[ctype stringValue]]; +Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.h +=================================================================== +--- sope-gdl1/PostgreSQL/PostgreSQL72Channel.h (révision 1546) ++++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.h (copie de travail) +@@ -28,6 +28,7 @@ + #define ___PostgreSQL72_Channel_H___ + + #include ++#include + #include + + @class NSArray, NSString, NSMutableDictionary; +@@ -40,7 +41,7 @@ + int modification; + } PostgreSQL72FieldInfo; + +-@interface PostgreSQL72Channel : EOAdaptorChannel ++@interface PostgreSQL72Channel : EOAdaptorChannel + { + // connection is valid after an openChannel call + PGConnection *connection; +Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m +=================================================================== +--- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (révision 1546) ++++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (copie de travail) +@@ -713,6 +713,39 @@ + return ms; + } + ++/* GCSEOAdaptorChannel protocol */ ++static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \ ++ @" c_name VARCHAR (256) NOT NULL,\n" ++ @" c_content VARCHAR (100000) NOT NULL,\n" ++ @" c_creationdate INT4 NOT NULL,\n" ++ @" c_lastmodified INT4 NOT NULL,\n" ++ @" c_version INT4 NOT NULL,\n" ++ @" c_deleted INT4 NULL\n" ++ @")"); ++static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \ ++ @" c_uid VARCHAR (256) NOT NULL,\n" ++ @" c_object VARCHAR (256) NOT NULL,\n" ++ @" c_role VARCHAR (80) NOT NULL\n" ++ @")"); ++ ++- (NSException *) createGCSFolderTableWithName: (NSString *) tableName ++{ ++ NSString *sql; ++ ++ sql = [NSString stringWithFormat: sqlFolderFormat, tableName]; ++ ++ return [self evaluateExpressionX: sql]; ++} ++ ++- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName ++{ ++ NSString *sql; ++ ++ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName]; ++ ++ return [self evaluateExpressionX: sql]; ++} ++ + @end /* PostgreSQL72Channel */ + + @implementation PostgreSQL72Channel(PrimaryKeyGeneration) Index: sope-appserver/NGObjWeb/GNUmakefile.postamble =================================================================== --- sope-appserver/NGObjWeb/GNUmakefile.postamble (révision 1546) @@ -515,6 +515,157 @@ Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h BOOL sidInUrl; /* 'ivar' associations */ +Index: sope-appserver/NGObjWeb/SoObjects/SoObject.m +=================================================================== +--- sope-appserver/NGObjWeb/SoObjects/SoObject.m (révision 1546) ++++ sope-appserver/NGObjWeb/SoObjects/SoObject.m (copie de travail) +@@ -39,22 +39,34 @@ + static int debugLookup = -1; + static int debugBaseURL = -1; + static int useRelativeURLs = -1; ++static int redirectInitted = -1; ++static NSURL *redirectURL = nil; ++ + static void _initialize(void) { ++ NSString *url; ++ NSUserDefaults *ud; ++ ++ ud = [NSUserDefaults standardUserDefaults]; ++ + if (debugLookup == -1) { +- debugLookup = [[NSUserDefaults standardUserDefaults] +- boolForKey:@"SoDebugKeyLookup"] ? 1 : 0; ++ debugLookup = [ud boolForKey:@"SoDebugKeyLookup"] ? 1 : 0; + NSLog(@"Note(SoObject): SoDebugKeyLookup is enabled!"); + } + if (debugBaseURL == -1) { +- debugBaseURL = [[NSUserDefaults standardUserDefaults] +- boolForKey:@"SoDebugBaseURL"] ? 1 : 0; ++ debugBaseURL = [ud boolForKey:@"SoDebugBaseURL"] ? 1 : 0; + NSLog(@"Note(SoObject): SoDebugBaseURL is enabled!"); + } + if (useRelativeURLs == -1) { +- useRelativeURLs = [[NSUserDefaults standardUserDefaults] +- boolForKey:@"WOUseRelativeURLs"] ?1:0; ++ useRelativeURLs = [ud boolForKey:@"WOUseRelativeURLs"] ?1:0; + NSLog(@"Note(SoObject): relative base URLs are enabled."); + } ++ if (redirectInitted == -1) { ++ url = [ud stringForKey:@"WOApplicationRedirectURL"]; ++ if ([url length]) { ++ redirectURL = [[NSURL alloc] initWithString: url]; ++ } ++ redirectInitted = 1; ++ } + } + + /* classes */ +@@ -318,56 +330,61 @@ + + rq = [_ctx request]; + ms = [[NSMutableString alloc] initWithCapacity:128]; ++ ++ if (redirectURL) { ++ [ms appendString: [redirectURL absoluteString]]; ++ } ++ else { ++ if (!useRelativeURLs) { ++ port = [[rq headerForKey:@"x-webobjects-server-port"] intValue]; + +- if (!useRelativeURLs) { +- port = [[rq headerForKey:@"x-webobjects-server-port"] intValue]; +- +- /* this is actually a bug in Apache */ +- if (port == 0) { +- static BOOL didWarn = NO; +- if (!didWarn) { +- [self warnWithFormat:@"(%s:%i): got an empty port from Apache!", +- __PRETTY_FUNCTION__, __LINE__]; +- didWarn = YES; ++ /* this is actually a bug in Apache */ ++ if (port == 0) { ++ static BOOL didWarn = NO; ++ if (!didWarn) { ++ [self warnWithFormat:@"(%s:%i): got an empty port from Apache!", ++ __PRETTY_FUNCTION__, __LINE__]; ++ didWarn = YES; ++ } ++ port = 80; + } +- port = 80; +- } + +- if ((tmp = [rq headerForKey:@"host"]) != nil) { +- /* check whether we have a host header with port */ +- if ([tmp rangeOfString:@":"].length == 0) +- tmp = nil; +- } +- if (tmp != nil) { /* we have a host header with port */ +- isHTTPS = +- [[rq headerForKey:@"x-webobjects-server-url"] hasPrefix:@"https"]; +- [ms appendString:isHTTPS ? @"https://" : @"http://"]; +- [ms appendString:tmp]; +- } +- else if ((tmp = [rq headerForKey:@"x-webobjects-server-url"]) != nil) { +- /* sometimes the URL is just wrong! (suggests port 80) */ +- if ([tmp hasSuffix:@":0"] && [tmp length] > 2) { // TODO: bad bad bad +- [self warnWithFormat:@"%s: got incorrect URL from Apache: '%@'", +- __PRETTY_FUNCTION__, tmp]; +- tmp = [tmp substringToIndex:([tmp length] - 2)]; ++ if ((tmp = [rq headerForKey:@"host"]) != nil) { ++ /* check whether we have a host header with port */ ++ if ([tmp rangeOfString:@":"].length == 0) ++ tmp = nil; + } +- else if ([tmp hasSuffix:@":443"] && [tmp hasPrefix:@"http://"]) { +- /* see OGo bug #1435, Debian Apache hack */ +- [self warnWithFormat:@"%s: got 'http' protocol but 443 port, " +- @"assuming Debian/Apache bug (OGo #1435): '%@'", +- __PRETTY_FUNCTION__, tmp]; +- tmp = [tmp substringWithRange:NSMakeRange(4, [tmp length] - 4 - 4)]; +- tmp = [@"https" stringByAppendingString:tmp]; ++ if (tmp != nil) { /* we have a host header with port */ ++ isHTTPS = ++ [[rq headerForKey:@"x-webobjects-server-url"] hasPrefix:@"https"]; ++ [ms appendString:isHTTPS ? @"https://" : @"http://"]; ++ [ms appendString:tmp]; + } +- [ms appendString:tmp]; +- } +- else { +- // TODO: isHTTPS always no in this case? +- [ms appendString:isHTTPS ? @"https://" : @"http://"]; ++ else if ((tmp = [rq headerForKey:@"x-webobjects-server-url"]) != nil) { ++ /* sometimes the URL is just wrong! (suggests port 80) */ ++ if ([tmp hasSuffix:@":0"] && [tmp length] > 2) { // TODO: bad bad bad ++ [self warnWithFormat:@"%s: got incorrect URL from Apache: '%@'", ++ __PRETTY_FUNCTION__, tmp]; ++ tmp = [tmp substringToIndex:([tmp length] - 2)]; ++ } ++ else if ([tmp hasSuffix:@":443"] && [tmp hasPrefix:@"http://"]) { ++ /* see OGo bug #1435, Debian Apache hack */ ++ [self warnWithFormat:@"%s: got 'http' protocol but 443 port, " ++ @"assuming Debian/Apache bug (OGo #1435): '%@'", ++ __PRETTY_FUNCTION__, tmp]; ++ tmp = [tmp substringWithRange:NSMakeRange(4, [tmp length] - 4 - 4)]; ++ tmp = [@"https" stringByAppendingString:tmp]; ++ } ++ [ms appendString:tmp]; ++ } ++ else { ++ // TODO: isHTTPS always no in this case? ++ [ms appendString:isHTTPS ? @"https://" : @"http://"]; + +- [ms appendString:[rq headerForKey:@"x-webobjects-server-name"]]; +- if ((isHTTPS ? (port != 443) : (port != 80)) && port != 0) +- [ms appendFormat:@":%i", port]; ++ [ms appendString:[rq headerForKey:@"x-webobjects-server-name"]]; ++ if ((isHTTPS ? (port != 443) : (port != 80)) && port != 0) ++ [ms appendFormat:@":%i", port]; ++ } + } + } + Index: sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m =================================================================== --- sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m (révision 1546) diff --git a/UI/WebServerResources/UIxMailEditor.js b/UI/WebServerResources/UIxMailEditor.js index 5e94ed0b..8720dd56 100644 --- a/UI/WebServerResources/UIxMailEditor.js +++ b/UI/WebServerResources/UIxMailEditor.js @@ -16,7 +16,7 @@ function onContactAdd() { w.focus(); return false; - } +} function addContact(tag, fullContactName, contactId, contactName, contactEmail) { if (!mailIsRecipient(contactEmail)) { @@ -121,59 +121,76 @@ function updateInlineAttachmentList(sender, attachments) { /* mail editor */ function validateEditorInput(sender) { - var errortext = ""; - var field; + var errortext = ""; + var field; - field = document.pageform.subject; - if (field.value == "") - errortext = errortext + labels["error_missingsubject"] + "\n"; + field = document.pageform.subject; + if (field.value == "") + errortext = errortext + labels["error_missingsubject"] + "\n"; - if (!UIxRecipientSelectorHasRecipients()) - errortext = errortext + labels["error_missingrecipients"] + "\n"; + if (!UIxRecipientSelectorHasRecipients()) + errortext = errortext + labels["error_missingrecipients"] + "\n"; - if (errortext.length > 0) { - alert(labels["error_validationfailed"] + ":\n" + errortext); - return false; - } + if (errortext.length > 0) { + alert(labels["error_validationfailed"] + ":\n" + errortext); + return false; + } - return true; + return true; } function clickedEditorSend(sender) { - if (!validateEditorInput(sender)) - return false; + if (!validateEditorInput(sender)) + return false; + + var input = currentAttachmentInput(); + if (input) + input.parentNode.removeChild(input); - window.shouldPreserve = true; - document.pageform.action = "send"; - document.pageform.submit(); + var toolbar = document.getElementById("toolbar"); + if (!document.busyAnim) + document.busyAnim = startAnimation(toolbar); + + window.shouldPreserve = true; + document.pageform.action = "send"; + document.pageform.submit(); - return false; + return false; } -function clickedEditorAttach(sender) { - var area = $("attachmentsArea"); +function currentAttachmentInput() { + var input = null; - if (!area.style.display) { - area.setStyle({ display: "block" }); - onWindowResize(null); - } + var inputs = $("attachmentsArea").getElementsByTagName("input"); + var i = 0; + while (!input && i < inputs.length) + if ($(inputs[i]).hasClassName("currentAttachment")) + input = inputs[i]; + else + i++; - var inputs = area.getElementsByTagName("input"); + return input; +} - // Verify if there's already a visible file input field - for (var i = 0; i < inputs.length; i++) - if ($(inputs[i]).hasClassName("currentAttachment")) - return false; - - // Add new file input field - var attachmentName = "attachment" + inputs.length; - var newAttachment = createElement("input", attachmentName, - "currentAttachment", null, - { type: "file", - name: attachmentName }, - area); - Event.observe(newAttachment, "change", - onAttachmentChange.bindAsEventListener(newAttachment)); +function clickedEditorAttach(sender) { + var input = currentAttachmentInput(); + if (!input) { + var area = $("attachmentsArea"); + + if (!area.style.display) { + area.setStyle({ display: "block" }); + onWindowResize(null); + } + var inputs = area.getElementsByTagName("input"); + var attachmentName = "attachment" + inputs.length; + var newAttachment = createElement("input", attachmentName, + "currentAttachment", null, + { type: "file", + name: attachmentName }, + area); + Event.observe(newAttachment, "change", + onAttachmentChange.bindAsEventListener(newAttachment)); + } return false; } @@ -211,6 +228,14 @@ function createAttachment(node, list) { } function clickedEditorSave(sender) { + var input = currentAttachmentInput(); + if (input) + input.parentNode.removeChild(input); + + var toolbar = document.getElementById("toolbar"); + if (!document.busyAnim) + document.busyAnim = startAnimation(toolbar); + window.shouldPreserve = true; document.pageform.action = "save"; document.pageform.submit(); -- 2.39.5