summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/blank.tifbin0 -> 270 bytes
-rw-r--r--program/js/app.js83
-rw-r--r--program/steps/mail/func.inc7
-rw-r--r--program/steps/mail/show.inc10
4 files changed, 96 insertions, 4 deletions
diff --git a/program/blank.tif b/program/blank.tif
new file mode 100644
index 000000000..2b3f4ec5d
--- /dev/null
+++ b/program/blank.tif
Binary files differ
diff --git a/program/js/app.js b/program/js/app.js
index c4bf5ec31..32ab69f2e 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -307,6 +307,10 @@ function rcube_webmail()
this.http_post(postact, postdata);
}
+ // detect browser capabilities
+ if (!this.is_framed())
+ this.browser_capabilities_check();
+
break;
case 'addressbook':
@@ -1943,13 +1947,16 @@ function rcube_webmail()
if (this.env.search_request)
url += '&_search='+this.env.search_request;
- if (action == 'preview' && String(target.location.href).indexOf(url) >= 0)
+ // add browser capabilities, so we can properly handle attachments
+ url += '&_caps='+urlencode(this.browser_capabilities());
+
+ if (preview && String(target.location.href).indexOf(url) >= 0)
this.show_contentframe(true);
else {
this.location_href(this.env.comm_path+url, target, true);
// mark as read and change mbox unread counter
- if (action == 'preview' && this.message_list && this.message_list.rows[id] && this.message_list.rows[id].unread && this.env.preview_pane_mark_read >= 0) {
+ if (preview && this.message_list && this.message_list.rows[id] && this.message_list.rows[id].unread && this.env.preview_pane_mark_read >= 0) {
this.preview_read_timer = setTimeout(function() {
ref.set_message(id, 'unread', false);
ref.update_thread_root(id, 'read');
@@ -6368,6 +6375,78 @@ function rcube_webmail()
$(elem).click(function() { rcmail.register_protocol_handler(name); return false; });
};
+ // Checks browser capabilities eg. PDF support, TIF support
+ this.browser_capabilities_check = function()
+ {
+ if (!this.env.browser_capabilities)
+ this.env.browser_capabilities = {};
+
+ if (this.env.browser_capabilities.pdf === undefined)
+ this.env.browser_capabilities.pdf = this.pdf_support_check();
+
+ if (this.env.browser_capabilities.tif === undefined)
+ this.tif_support_check();
+ };
+
+ // Returns browser capabilities string
+ this.browser_capabilities = function()
+ {
+ if (!this.env.browser_capabilities)
+ return '';
+
+ var n, ret = [];
+
+ for (n in this.env.browser_capabilities)
+ ret.push(n + '=' + this.env.browser_capabilities[n]);
+
+ return ret.join();
+ };
+
+ this.tif_support_check = function()
+ {
+ var img = new Image();
+
+ img.onload = function() { rcmail.env.browser_capabilities.tif = 1; };
+ img.onerror = function() { rcmail.env.browser_capabilities.tif = 0; };
+ img.src = 'program/blank.tif';
+ };
+
+ this.pdf_support_check = function()
+ {
+ var plugin = navigator.mimeTypes ? navigator.mimeTypes["application/pdf"] : {},
+ plugins = navigator.plugins,
+ len = plugins.length,
+ regex = /Adobe Reader|PDF|Acrobat/i;
+
+ if (plugin && plugin.enabledPlugin)
+ return 1;
+
+ if (window.ActiveXObject) {
+ try {
+ if (axObj = new ActiveXObject("AcroPDF.PDF"))
+ return 1;
+ }
+ catch (e) {}
+ try {
+ if (axObj = new ActiveXObject("PDF.PdfCtrl"))
+ return 1;
+ }
+ catch (e) {}
+ }
+
+ for (i=0; i<len; i++) {
+ plugin = plugins[i];
+ if (typeof plugin === 'String') {
+ if (regex.test(plugin))
+ return 1;
+ }
+ else if (plugin.name && regex.test(plugin.name))
+ return 1;
+ }
+
+ return 0;
+ };
+
} // end object rcube_webmail
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 05d589503..fb438c9ed 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -81,8 +81,8 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') {
$OUTPUT->set_env('search_request', $search_request);
}
- $search_mods = $RCMAIL->config->get('search_mods', $SEARCH_MODS_DEFAULT);
- $OUTPUT->set_env('search_mods', $search_mods);
+ $search_mods = $RCMAIL->config->get('search_mods', $SEARCH_MODS_DEFAULT);
+ $OUTPUT->set_env('search_mods', $search_mods);
}
$threading = (bool) $RCMAIL->storage->get_threading();
@@ -115,6 +115,9 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') {
if ($CONFIG['junk_mbox'])
$OUTPUT->set_env('junk_mailbox', $CONFIG['junk_mbox']);
+ if (!empty($_SESSION['browser_caps']))
+ $OUTPUT->set_env('browser_capabilities', $_SESSION['browser_caps']);
+
if (!$OUTPUT->ajax_call)
$OUTPUT->add_label('checkingmail', 'deletemessage', 'movemessagetotrash',
'movingmessage', 'copyingmessage', 'deletingmessage', 'markingmessage',
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 2d4d8e5a5..a104880ca 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -21,6 +21,16 @@
$PRINT_MODE = $RCMAIL->action=='print' ? TRUE : FALSE;
+// Read browser capabilities and store them in session
+if ($caps = get_input_value('_caps', RCUBE_INPUT_GET)) {
+ $browser_caps = array();
+ foreach (explode(',', $caps) as $cap) {
+ $cap = explode('=', $cap);
+ $browser_caps[$cap[0]] = $cap[1];
+ }
+ $_SESSION['browser_caps'] = $browser_caps;
+}
+
// similar code as in program/steps/mail/get.inc
if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) {
$MESSAGE = new rcube_message($uid);