summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
Diffstat (limited to 'program/js')
-rw-r--r--program/js/app.js39
-rw-r--r--program/js/common.js61
-rw-r--r--program/js/list.js4
3 files changed, 35 insertions, 69 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 2cc14a79e..4a5200028 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -143,7 +143,7 @@ function rcube_webmail()
this.task = this.env.task;
// check browser
- if (!bw.dom || !bw.xmlhttp_test() || (bw.mz && bw.vendver < 1.9) || (bw.ie && bw.vendver < 7)) {
+ if (this.env.server_error != 409 && (!bw.dom || !bw.xmlhttp_test() || (bw.mz && bw.vendver < 1.9) || (bw.ie && bw.vendver < 7))) {
this.goto_url('error', '_code=0x199');
return;
}
@@ -1074,8 +1074,9 @@ function rcube_webmail()
// Reset the auto-save timer
clearTimeout(this.save_timer);
- if (!this.upload_file(props || this.gui_objects.uploadform, 'upload')) {
- alert(this.get_label('selectimportfile'));
+ if (!(flag = this.upload_file(props || this.gui_objects.uploadform, 'upload'))) {
+ if (flag !== false)
+ alert(this.get_label('selectimportfile'));
aborted = true;
}
break;
@@ -1200,12 +1201,15 @@ function rcube_webmail()
break;
case 'import-messages':
- var form = props || this.gui_objects.importform;
- var importlock = this.set_busy(true, 'importwait');
+ var form = props || this.gui_objects.importform,
+ importlock = this.set_busy(true, 'importwait');
+
$('input[name="_unlock"]', form).val(importlock);
- if (!this.upload_file(form, 'import')) {
+
+ if (!(flag = this.upload_file(form, 'import'))) {
this.set_busy(false, null, importlock);
- alert(this.get_label('selectimportfile'));
+ if (flag !== false)
+ alert(this.get_label('selectimportfile'));
aborted = true;
}
break;
@@ -1936,7 +1940,7 @@ function rcube_webmail()
// add each submitted col
for (n in this.env.listcols) {
c = this.env.listcols[n];
- col = { className: String(c).toLowerCase() };
+ col = {className: String(c).toLowerCase(), events:{}};
if (this.env.coltypes[c] && this.env.coltypes[c].hidden) {
col.className += ' hidden';
@@ -1970,11 +1974,8 @@ function rcube_webmail()
else if (c == 'threads')
html = expando;
else if (c == 'subject') {
- if (bw.ie) {
- col.onmouseover = function() { rcube_webmail.long_subject_title_ex(this, message.depth+1); };
- if (bw.ie8)
- tree = '<span></span>' + tree; // #1487821
- }
+ if (bw.ie)
+ col.events.mouseover = function() { rcube_webmail.long_subject_title_ex(this); };
html = tree + cols[c];
}
else if (c == 'priority') {
@@ -4019,7 +4020,7 @@ function rcube_webmail()
this.upload_file = function(form, action)
{
if (!form)
- return false;
+ return;
// count files and size on capable browser
var size = 0, numfiles = 0;
@@ -4079,8 +4080,6 @@ function rcube_webmail()
this.gui_objects.attachmentform = form;
return true;
}
-
- return false;
};
// add file name to attachment list
@@ -4102,7 +4101,7 @@ function rcube_webmail()
li.attr('id', name)
.addClass(att.classname)
.html(att.html)
- .on('mouseover', function() { rcube_webmail.long_subject_title_ex(this, 0); });
+ .on('mouseover', function() { rcube_webmail.long_subject_title_ex(this); });
// replace indicator's li
if (upload_id && (indicator = document.getElementById(upload_id))) {
@@ -6846,7 +6845,7 @@ function rcube_webmail()
param[k] = query[k];
}
- return base + '&' + $.param(param) + querystring;
+ return base + (base.indexOf('?') > -1 ? '&' : '?') + $.param(param) + querystring;
};
this.redirect = function(url, lock)
@@ -7862,7 +7861,7 @@ rcube_webmail.long_subject_title = function(elem, indent)
}
};
-rcube_webmail.long_subject_title_ex = function(elem, indent)
+rcube_webmail.long_subject_title_ex = function(elem)
{
if (!elem.title) {
var $elem = $(elem),
@@ -7874,7 +7873,7 @@ rcube_webmail.long_subject_title_ex = function(elem, indent)
w = tmp.width();
tmp.remove();
- if (w + indent * 15 > $elem.width())
+ if (w + $('span.branch', $elem).width() * 15 > $elem.width())
elem.title = txt;
}
};
diff --git a/program/js/common.js b/program/js/common.js
index ed9488b2c..28f79d56f 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -255,13 +255,17 @@ remove_listener: function(p)
cancel: function(evt)
{
var e = evt ? evt : window.event;
+
if (e.preventDefault)
e.preventDefault();
+ else
+ e.returnValue = false;
+
if (e.stopPropagation)
e.stopPropagation();
e.cancelBubble = true;
- e.returnValue = false;
+
return false;
},
@@ -326,13 +330,17 @@ removeEventListener: function(evt, func, obj)
triggerEvent: function(evt, e)
{
var ret, h;
+
if (e === undefined)
e = this;
else if (typeof e === 'object')
e.event = evt;
- if (this._events && this._events[evt] && !this._event_exec) {
- this._event_exec = true;
+ if (!this._event_exec)
+ this._event_exec = {};
+
+ if (this._events && this._events[evt] && !this._event_exec[evt]) {
+ this._event_exec[evt] = true;
for (var i=0; i < this._events[evt].length; i++) {
if ((h = this._events[evt][i])) {
if (typeof h.func === 'function')
@@ -355,7 +363,8 @@ triggerEvent: function(evt, e)
}
}
- this._event_exec = false;
+ delete this._event_exec[evt];
+
if (e.event) {
try {
delete e.event;
@@ -529,36 +538,6 @@ function getCookie(name)
roundcube_browser.prototype.set_cookie = setCookie;
roundcube_browser.prototype.get_cookie = getCookie;
-// tiny replacement for Firebox functionality
-function rcube_console()
-{
- this.log = function(msg)
- {
- var box = rcube_find_object('dbgconsole');
-
- if (box) {
- if (msg.charAt(msg.length-1)=='\n')
- msg += '--------------------------------------\n';
- else
- msg += '\n--------------------------------------\n';
-
- // Konqueror doesn't allow to just change the value of hidden element
- if (bw.konq) {
- box.innerText += msg;
- box.value = box.innerText;
- } else
- box.value += msg;
- }
- };
-
- this.reset = function()
- {
- var box = rcube_find_object('dbgconsole');
- if (box)
- box.innerText = box.value = '';
- };
-};
-
var bw = new roundcube_browser();
bw.set_html_class();
@@ -596,20 +575,6 @@ if (!String.prototype.startsWith) {
};
}
-// Make getElementById() case-sensitive on IE
-if (bw.ie) {
- document._getElementById = document.getElementById;
- document.getElementById = function(id) {
- var i = 0, obj = document._getElementById(id);
-
- if (obj && obj.id != id)
- while ((obj = document.all[i]) && obj.id != id)
- i++;
-
- return obj;
- }
-}
-
// jQuery plugin to emulate HTML5 placeholder attributes on input elements
jQuery.fn.placeholder = function(text) {
return this.each(function() {
diff --git a/program/js/list.js b/program/js/list.js
index 9b7779c7b..a39bb5abe 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -301,11 +301,13 @@ insert_row: function(row, before)
if (row.style) $.extend(domrow.style, row.style);
if (row.uid) $(domrow).data('uid', row.uid);
- for (var domcell, col, i=0; row.cols && i < row.cols.length; i++) {
+ for (var e, domcell, col, i=0; row.cols && i < row.cols.length; i++) {
col = row.cols[i];
domcell = document.createElement(this.col_tagname());
if (col.className) domcell.className = col.className;
if (col.innerHTML) domcell.innerHTML = col.innerHTML;
+ for (e in col.events)
+ domcell['on' + e] = col.events[e];
domrow.appendChild(domcell);
}