-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsummary.js
More file actions
93 lines (84 loc) · 3.07 KB
/
Copy pathsummary.js
File metadata and controls
93 lines (84 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/***************************************************************************
* This file is part of Roundcube "summary" plugin.
*
* Your are not allowed to distribute this file or parts of it.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Copyright (c) 2012 - 2015 Roland 'Rosali' Liebl - all rights reserved
* dev-team [at] myroundcube [dot] com
* http://myroundcube.com
***************************************************************************/
Date.prototype.getTimezoneOffsetNoDST = function() {
var m = 12,
d = new Date(null, m, 1),
tzo = d.getTimezoneOffset();
while (--m) {
d.setUTCMonth(m);
if (tzo != d.getTimezoneOffset()) {
return Math.max(tzo, d.getTimezoneOffset());
}
}
// Probably shouldn't get here.
return d.getTimezoneOffset();
}
function emptyfolder(myfolder){
if(rcmail.env.jsdialogconfirm){
confirm(rcmail.get_label('purgefolderconfirm'), false, "emptyfolder_do('" + myfolder + "')", false);
}
else{
if(confirm(rcmail.get_label('purgefolderconfirm'))){
emptyfolder_do(myfolder);
}
}
}
function emptyfolder_do(myfolder){
if(rcmail.env.framed){
document.location.href="./?_action=plugin.summary_purge&_mbox=" + escape(myfolder) + "&_framed=1";
}
else{
document.location.href="./?_action=plugin.summary_purge&_mbox=" + escape(myfolder);
}
}
function gotofolder(myfolder){
if(rcmail.env.framed){
parent.location.href="./?_task=mail&_mbox=" + escape(myfolder);
}
else{
document.location.href="./?_task=mail&_mbox=" + escape(myfolder);
}
}
function plugin_summary_trigger_refresh(){
rcmail.http_post('plugin.summary_refresh', '');
window.setTimeout('plugin_summary_trigger_refresh();', rcmail.env.refresh_interval * 1000);
}
$(document).ready(function(){
var cltz = new Date();
rcmail.addEventListener('plugin.summary_getClientTimezone', plugin_summary_clienttimezone);
rcmail.addEventListener('plugin.summary_refresh', plugin_summary_refresh);
rcmail.addEventListener('requestrefresh', plugin_summary_trigger_refresh);
var dst = 0;
var realoffset = cltz.getTimezoneOffsetNoDST();
if(realoffset != cltz.getTimezoneOffset()){
dst = 1;
}
rcmail.http_post('plugin.summary_getClientTimezone', '_cltz=' + realoffset + '&_dst=' + dst);
function plugin_summary_clienttimezone(response){
$('#summary_timezone_container').html(response);
}
function plugin_summary_refresh(response){
if(response.motd){
$('#motd').html($(response.motd).first().html());
}
if(response.mailbox){
$('#mailbox').html($(response.mailbox).first().html());
}
if(response.quota){
if($(response.quota).is('fieldset')){
$('#quota').html($(response.quots).first().html());
}
}
}
});