1 /* JavaScript for SOGo Mailer */
6 bool: resizable, scrollbars, toolbar, location, directories, status,
10 function clickedUid(sender, msguid) {
13 cburl = "markMessageRead?uid=" + msguid;
14 urlstr = msguid + "/view?openerurl=" + encodeURIComponent(cburl);
15 window.open(urlstr, "SOGo_msg_" + msguid,
16 "width=640,height=480,resizable=1,scrollbars=1,toolbar=0," +
17 "location=0,directories=0,status=0,menubar=0,copyhistory=0")
20 function doubleClickedUid(sender, msguid) {
21 alert("DOUBLE Clicked " + msguid);
26 function highlightUid(sender, msguid) {
27 // var row = document.getElementById(msguid);
28 // row.className="mailer_readmailsubject_high";
31 function lowlightUid(sender, msguid) {
32 // var row = document.getElementById(msguid);
33 // row.className="mailer_readmailsubject";
37 function clickedCompose(sender) {
41 window.open(urlstr, "SOGo_compose",
42 "width=680,height=480,resizable=1,scrollbars=1,toolbar=0," +
43 "location=0,directories=0,status=0,menubar=0,copyhistory=0");
44 return false; /* stop following the link */
49 function validateEditorInput(sender) {
53 field = document.pageform.subject;
54 if (field.value == "")
55 errortext = errortext + "Missing Subject\n";
57 if (errortext.length > 0) {
58 alert("validation failed:\n" + errortext);
64 function clickedEditorSend(sender) {
65 if (!validateEditorInput(sender))
68 // TODO: validate whether we have a recipient! (#1220)
70 document.pageform.action="send";
71 document.pageform.submit();
72 // if everything is ok, close the window
76 function clickedEditorAttach(sender) {
79 urlstr = "viewAttachments";
80 window.open(urlstr, "SOGo_attach",
81 "width=320,height=320,resizable=1,scrollbars=1,toolbar=0," +
82 "location=0,directories=0,status=0,menubar=0,copyhistory=0");
83 return false; /* stop following the link */
86 function clickedEditorSave(sender) {
87 document.pageform.action="save";
88 document.pageform.submit();
92 function clickedEditorDelete(sender) {
93 document.pageform.action="delete";
94 document.pageform.submit();
99 /* addressbook helpers */
101 function openAnais(sender) {
105 var w = window.open(urlstr, "Anais",
106 "width=350,height=600,left=10,top=10,toolbar=no," +
107 "dependent=yes,menubar=no,location=no,resizable=yes," +
108 "scrollbars=yes,directories=no,status=no");
112 function openAddressbook(sender) {
115 urlstr = "addressbook";
116 var w = window.open(urlstr, "Addressbook",
117 "width=600,height=400,left=10,top=10,toolbar=no," +
118 "dependent=yes,menubar=no,location=no,resizable=yes," +
119 "scrollbars=yes,directories=no,status=no");
125 function clickedFilter(sender, scriptname) {
128 urlstr = scriptname + "/edit";
129 window.open(urlstr, "SOGo_filter_" + scriptname,
130 "width=640,height=480,resizable=1,scrollbars=1,toolbar=0," +
131 "location=0,directories=0,status=0,menubar=0,copyhistory=0")
135 function clickedNewFilter(sender) {
139 window.open(urlstr, "SOGo_filter",
140 "width=680,height=480,resizable=1,scrollbars=1,toolbar=0," +
141 "location=0,directories=0,status=0,menubar=0,copyhistory=0");
142 return false; /* stop following the link */
147 function refreshOpener() {
148 if (window.opener && !window.opener.closed) {
149 window.opener.location.reload();
153 function getQueryParaArray(s) {
154 if (s.charAt(0) == "?") s = s.substr(1, s.length - 1);
157 function getQueryParaValue(s, name) {
160 t = getQueryParaArray(s);
161 for (var i = 0; i < t.length; i++) {
164 if (s.indexOf(name) != 0)
167 s = s.substr(name.length, s.length - name.length);
168 return decodeURIComponent(s);
173 function triggerOpenerCallback() {
174 /* this code has some issue if the folder has no proper trailing slash! */
175 if (window.opener && !window.opener.closed) {
178 t = getQueryParaValue(window.location.search, "openerurl=");
179 cburl = window.opener.window.location.href;
180 if (cburl[cburl.length - 1] != "/") {
181 cburl = cburl.substr(0, cburl.lastIndexOf("/") + 1);
184 window.opener.window.location.href = cburl;