Disable link registering mailto: protocol handler if not supported by the browser (#1489569)

pull/174/head
Thomas Bruederli 11 years ago
parent 3f4845948c
commit d221576489

@ -7516,20 +7516,28 @@ function rcube_webmail()
try { try {
window.navigator.registerProtocolHandler('mailto', this.mailto_handler_uri(), name); window.navigator.registerProtocolHandler('mailto', this.mailto_handler_uri(), name);
} }
catch(e) {}; catch(e) {
this.display_message(String(e), 'error');
};
}; };
this.check_protocol_handler = function(name, elem) this.check_protocol_handler = function(name, elem)
{ {
var nav = window.navigator; var nav = window.navigator;
if (!nav if (!nav || (typeof nav.registerProtocolHandler != 'function')) {
|| (typeof nav.registerProtocolHandler != 'function') $(elem).addClass('disabled').click(function(){ return false; });
|| ((typeof nav.isProtocolHandlerRegistered == 'function') }
&& nav.isProtocolHandlerRegistered('mailto', this.mailto_handler_uri()) == 'registered') else {
) var status = null;
$(elem).addClass('disabled'); if (typeof nav.isProtocolHandlerRegistered == 'function') {
else status = nav.isProtocolHandlerRegistered('mailto', this.mailto_handler_uri());
$(elem).click(function() { rcmail.register_protocol_handler(name); return false; }); if (status)
$(elem).parent().find('.mailtoprotohandler-status').html(status);
}
else {
$(elem).click(function() { rcmail.register_protocol_handler(name); return false; });
}
}
}; };
// Checks browser capabilities eg. PDF support, TIF support // Checks browser capabilities eg. PDF support, TIF support

@ -376,13 +376,16 @@ function rcmail_user_prefs($current = null)
if ($current) { if ($current) {
$product_name = $RCMAIL->config->get('product_name', 'Roundcube Webmail'); $product_name = $RCMAIL->config->get('product_name', 'Roundcube Webmail');
$RCMAIL->output->add_script(sprintf("%s.check_protocol_handler('%s', '#mailtoprotohandler');", $RCMAIL->output->add_script(sprintf("%s.check_protocol_handler('%s', '#mailtoprotohandler');",
rcmail_output::JS_OBJECT_NAME, rcube::JQ($product_name)), 'foot'); rcmail_output::JS_OBJECT_NAME, rcube::JQ($product_name)), 'docready');
} }
$blocks['browser']['options']['mailtoprotohandler'] = array( $blocks['browser']['options']['mailtoprotohandler'] = array(
'content' => html::a(array( 'content' => html::a(array(
'href' => '#', 'href' => '#',
'id' => 'mailtoprotohandler'), rcube::Q($RCMAIL->gettext('mailtoprotohandler'))), 'id' => 'mailtoprotohandler'
),
rcube::Q($RCMAIL->gettext('mailtoprotohandler'))) .
html::span('mailtoprotohandler-status', ''),
); );
break; break;

@ -55,6 +55,13 @@ a.tab
text-align: center; text-align: center;
} }
a.disabled
{
color: #999;
text-decoration: none;
cursor: default;
}
hr hr
{ {
height: 1px; height: 1px;

@ -319,3 +319,8 @@ img.skinthumbnail {
#rcmfd_signature_toolbar2 td { #rcmfd_signature_toolbar2 td {
width: auto; width: auto;
} }
.mailtoprotohandler-status {
padding-left: 1em;
font-style: italic;
}

@ -1613,6 +1613,12 @@ body.iframe .footerleft.floating:before,
width: 95%; width: 95%;
} }
.propform a.disabled {
color: #999;
text-decoration: none;
cursor: default;
}
fieldset.floating { fieldset.floating {
float: left; float: left;
margin-right: 10px; margin-right: 10px;

Loading…
Cancel
Save