From: helge Date: Thu, 21 Jul 2005 08:43:55 +0000 (+0000) Subject: moved maillist JS code to separate file X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6ca2e129643d5870c596a40adcb5bdf8af24a46;p=scalable-opengroupware.org moved maillist JS code to separate file fixed a bug with error handling in mailer.js git-svn-id: http://svn.opengroupware.org/SOGo/trunk@862 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/MailerUI/ChangeLog b/SOGo/UI/MailerUI/ChangeLog index f2bc548b..d36d13e1 100644 --- a/SOGo/UI/MailerUI/ChangeLog +++ b/SOGo/UI/MailerUI/ChangeLog @@ -1,5 +1,8 @@ 2005-07-21 Helge Hess + * UIxMailListView.m: load JavaScript from a file (UIxMailListView.js) + instead of embedding it into the page (v0.9.163) + * UIxMailView.m: do not fetch full message info for 304 existance checks but rather call -doesMailExist (v0.9.162) diff --git a/SOGo/UI/MailerUI/UIxMailListView.m b/SOGo/UI/MailerUI/UIxMailListView.m index 15ec1aab..b1008343 100644 --- a/SOGo/UI/MailerUI/UIxMailListView.m +++ b/SOGo/UI/MailerUI/UIxMailListView.m @@ -377,54 +377,6 @@ static int attachmentFlagSize = 8096; [self messageUidString]]; } -- (NSString *)jsCode { - static NSString *script = \ - @"var rowSelectionCount = 0;\n" - @"\n" - @"validateControls();\n" - @"\n" - @"function showElement(e, shouldShow) {\n" - @" e.style.display = shouldShow ? \"\" : \"none\";\n" - @"}\n" - @"\n" - @"function enableElement(e, shouldEnable) {\n" - @" if(!e)\n" - @" return;\n" - @" if(shouldEnable) {\n" - @" if(e.hasAttribute(\"disabled\"))\n" - @" e.removeAttribute(\"disabled\");\n" - @" }\n" - @" else {\n" - @" e.setAttribute(\"disabled\", \"1\");\n" - @" }\n" - @"}\n" - @"\n" - @"function toggleRowSelectionStatus(sender) {\n" - @" rowID = sender.value;\n" - @" tr = document.getElementById(rowID);\n" - @" if(sender.checked) {\n" - @" tr.className = \"tableview_selected\";\n" - @" rowSelectionCount += 1;\n" - @" }\n" - @" else {\n" - @" tr.className = \"tableview\";\n" - @" rowSelectionCount -= 1;\n" - @" }\n" - @" this.validateControls();\n" - @"}\n" - @"\n" - @"function validateControls() {\n" - @" var e = document.getElementById(\"moveto\");\n" - @" this.enableElement(e, rowSelectionCount > 0);\n" - @"}\n" - @"\n" - @"function moveTo(uri) {\n" - @" alert(\"MoveTo: \" + uri);\n" - @"}\n" - @""; - return script; -} - /* error redirects */ - (id)redirectToViewWithError:(id)_error { diff --git a/SOGo/UI/MailerUI/UIxMailView.m b/SOGo/UI/MailerUI/UIxMailView.m index 4befcc04..9e5731ab 100644 --- a/SOGo/UI/MailerUI/UIxMailView.m +++ b/SOGo/UI/MailerUI/UIxMailView.m @@ -164,6 +164,12 @@ static NSString *mailETag = nil; - (id)defaultAction { /* check etag to see whether we really must rerender */ if (mailETag != nil ) { + /* + Note: There is one thing which *can* change for an existing message, + those are the IMAP4 flags (and annotations, which we do not use). + Since we don't render the flags, it should be OK, if this changes + we must embed the flagging into the etag. + */ NSString *s; if ((s = [[[self context] request] headerForKey:@"if-none-match"])) { diff --git a/SOGo/UI/MailerUI/Version b/SOGo/UI/MailerUI/Version index 380f56ff..5db49006 100644 --- a/SOGo/UI/MailerUI/Version +++ b/SOGo/UI/MailerUI/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=162 +SUBMINOR_VERSION:=163 # v0.9.140 requires SoObjects/Mailer v0.9.100 # v0.9.134 requires libSOGo v0.9.41 diff --git a/SOGo/UI/Templates/MailerUI/UIxMailListView.wox b/SOGo/UI/Templates/MailerUI/UIxMailListView.wox index 3dc615c5..5adc8b3b 100644 --- a/SOGo/UI/Templates/MailerUI/UIxMailListView.wox +++ b/SOGo/UI/Templates/MailerUI/UIxMailListView.wox @@ -10,15 +10,16 @@ title="panelTitle" hideFrame="hideFrame" > + +
-
diff --git a/SOGo/UI/Templates/MailerUI/UIxMailView.wox b/SOGo/UI/Templates/MailerUI/UIxMailView.wox index 795369d4..410a4b1e 100644 --- a/SOGo/UI/Templates/MailerUI/UIxMailView.wox +++ b/SOGo/UI/Templates/MailerUI/UIxMailView.wox @@ -157,7 +157,9 @@ diff --git a/SOGo/UI/WebServerResources/ChangeLog b/SOGo/UI/WebServerResources/ChangeLog index 85a91b96..d7bb9c0f 100644 --- a/SOGo/UI/WebServerResources/ChangeLog +++ b/SOGo/UI/WebServerResources/ChangeLog @@ -1,3 +1,7 @@ +2005-07-21 Helge Hess + + * mailer.js: fixed a bug with calling the opener on errors + 2005-07-20 Helge Hess * mailer.js: use POST instead of GET for toggling the mail read flag, diff --git a/SOGo/UI/WebServerResources/UIxMailListView.js b/SOGo/UI/WebServerResources/UIxMailListView.js new file mode 100644 index 00000000..39414f2a --- /dev/null +++ b/SOGo/UI/WebServerResources/UIxMailListView.js @@ -0,0 +1,42 @@ +var rowSelectionCount = 0; + +validateControls(); + +function showElement(e, shouldShow) { + e.style.display = shouldShow ? "" : "none"; +} + +function enableElement(e, shouldEnable) { + if(!e) + return; + if(shouldEnable) { + if(e.hasAttribute("disabled")) + e.removeAttribute("disabled"); + } + else { + e.setAttribute("disabled", "1"); + } +} + +function toggleRowSelectionStatus(sender) { + rowID = sender.value; + tr = document.getElementById(rowID); + if(sender.checked) { + tr.className = "tableview_selected"; + rowSelectionCount += 1; + } + else { + tr.className = "tableview"; + rowSelectionCount -= 1; + } + this.validateControls(); +} + +function validateControls() { + var e = document.getElementById("moveto"); + this.enableElement(e, rowSelectionCount > 0); +} + +function moveTo(uri) { + alert("MoveTo: " + uri); +} diff --git a/SOGo/UI/WebServerResources/mailer.js b/SOGo/UI/WebServerResources/mailer.js index 3c8c6645..b41421eb 100644 --- a/SOGo/UI/WebServerResources/mailer.js +++ b/SOGo/UI/WebServerResources/mailer.js @@ -200,7 +200,7 @@ function clickedNewFilter(sender) { function markMailInWindow(win, msguid, markread) { var msgDiv; - + msgDiv = win.document.getElementById("div_" + msguid); if (msgDiv) { if (markread) { @@ -225,6 +225,7 @@ function markMailInWindow(win, msguid, markread) { return false; } function markMailReadInWindow(win, msguid) { + /* this is called by UIxMailView with window.opener */ return markMailInWindow(win, msguid, true); } @@ -273,14 +274,14 @@ function mailListMarkMessage(sender, action, msguid, markread) { if (http.status != 200) { // TODO: refresh page? alert("Message Mark Failed: " + http.statusText); - window.opener.location.reload(); + window.location.reload(); } else { markMailInWindow(window, msguid, markread); } } else { - window.opener.location.href = url; + window.location.href = url; } }