1 /* JavaScript for SOGo Mailer */
4 DOM ids available in mail list view:
14 bool: resizable, scrollbars, toolbar, location, directories, status,
18 function clickedUid(sender, msguid) {
21 urlstr = msguid + "/view";
22 window.open(urlstr, "SOGo_msg_" + msguid,
23 "width=640,height=480,resizable=1,scrollbars=1,toolbar=0," +
24 "location=0,directories=0,status=0,menubar=0,copyhistory=0")
27 function doubleClickedUid(sender, msguid) {
28 alert("DOUBLE Clicked " + msguid);
33 function highlightUid(sender, msguid) {
34 // var row = document.getElementById(msguid);
35 // row.className="mailer_readmailsubject_high";
38 function lowlightUid(sender, msguid) {
39 // var row = document.getElementById(msguid);
40 // row.className="mailer_readmailsubject";
44 function clickedCompose(sender) {
48 window.open(urlstr, "SOGo_compose",
49 "width=680,height=480,resizable=1,scrollbars=1,toolbar=0," +
50 "location=0,directories=0,status=0,menubar=0,copyhistory=0");
51 return false; /* stop following the link */
56 function validateEditorInput(sender) {
60 field = document.pageform.subject;
61 if (field.value == "")
62 errortext = errortext + "Missing Subject\n";
64 if (errortext.length > 0) {
65 alert("validation failed:\n" + errortext);
71 function clickedEditorSend(sender) {
72 if (!validateEditorInput(sender))
75 // TODO: validate whether we have a recipient! (#1220)
77 document.pageform.action="send";
78 document.pageform.submit();
79 // if everything is ok, close the window
83 function clickedEditorAttach(sender) {
86 urlstr = "viewAttachments";
87 window.open(urlstr, "SOGo_attach",
88 "width=320,height=320,resizable=1,scrollbars=1,toolbar=0," +
89 "location=0,directories=0,status=0,menubar=0,copyhistory=0");
90 return false; /* stop following the link */
93 function clickedEditorSave(sender) {
94 document.pageform.action="save";
95 document.pageform.submit();
99 function clickedEditorDelete(sender) {
100 document.pageform.action="delete";
101 document.pageform.submit();
106 /* addressbook helpers */
108 function openAnais(sender) {
112 var w = window.open(urlstr, "Anais",
113 "width=350,height=600,left=10,top=10,toolbar=no," +
114 "dependent=yes,menubar=no,location=no,resizable=yes," +
115 "scrollbars=yes,directories=no,status=no");
119 function openAddressbook(sender) {
122 urlstr = "addressbook";
123 var w = window.open(urlstr, "Addressbook",
124 "width=600,height=400,left=10,top=10,toolbar=no," +
125 "dependent=yes,menubar=no,location=no,resizable=yes," +
126 "scrollbars=yes,directories=no,status=no");
132 function clickedFilter(sender, scriptname) {
135 urlstr = scriptname + "/edit";
136 window.open(urlstr, "SOGo_filter_" + scriptname,
137 "width=640,height=480,resizable=1,scrollbars=1,toolbar=0," +
138 "location=0,directories=0,status=0,menubar=0,copyhistory=0")
142 function clickedNewFilter(sender) {
146 window.open(urlstr, "SOGo_filter",
147 "width=680,height=480,resizable=1,scrollbars=1,toolbar=0," +
148 "location=0,directories=0,status=0,menubar=0,copyhistory=0");
149 return false; /* stop following the link */
154 function refreshOpener() {
155 if (window.opener && !window.opener.closed) {
156 window.opener.location.reload();
160 function getQueryParaArray(s) {
161 if (s.charAt(0) == "?") s = s.substr(1, s.length - 1);
164 function getQueryParaValue(s, name) {
167 t = getQueryParaArray(s);
168 for (var i = 0; i < t.length; i++) {
171 if (s.indexOf(name) != 0)
174 s = s.substr(name.length, s.length - name.length);
175 return decodeURIComponent(s);
180 function triggerOpenerCallback() {
181 /* this code has some issue if the folder has no proper trailing slash! */
182 if (window.opener && !window.opener.closed) {
185 t = getQueryParaValue(window.location.search, "openerurl=");
186 cburl = window.opener.location.href;
187 if (cburl[cburl.length - 1] != "/") {
188 cburl = cburl.substr(0, cburl.lastIndexOf("/") + 1);
191 window.opener.location.href = cburl;
195 /* mail list DOM changes */
197 function markMailReadInWindow(win, msguid) {
200 msgDiv = win.document.getElementById("div_" + msguid);
202 msgDiv.className = "mailer_readmailsubject";
204 msgDiv = win.document.getElementById("unreaddiv_" + msguid);
205 if (msgDiv) msgDiv.style.display = "none";
206 msgDiv = win.document.getElementById("readdiv_" + msguid);
207 if (msgDiv) msgDiv.style.display = "block";