mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:15 +01:00
Introduce a checkbox method for toolbar widget in order to be able to get/set checkbox actions
- Function pattern: widget.checkbox(action_id,[value]) - Fix encrypt toolbar action set/get according to new method
This commit is contained in:
parent
fbfb2f18d7
commit
394f7394ff
@ -405,8 +405,7 @@ var et2_toolbar = et2_DOMWidget.extend([et2_IInput],
|
||||
|
||||
if (action && action.checkbox)
|
||||
{
|
||||
var action_event = typeof this._actionManager != 'undefined'?this._actionManager.getActionById(action.id):null;
|
||||
if (action_event && action_event.checked) button.addClass('toolbar_toggled');
|
||||
if (this.checkbox(action.id)) button.addClass('toolbar_toggled');
|
||||
}
|
||||
if ( action.iconUrl)
|
||||
{
|
||||
@ -429,6 +428,7 @@ var et2_toolbar = et2_DOMWidget.extend([et2_IInput],
|
||||
{
|
||||
button.button(button_options);
|
||||
}
|
||||
var self = this;
|
||||
// Set up the click action
|
||||
var click = function(e)
|
||||
{
|
||||
@ -437,8 +437,7 @@ var et2_toolbar = et2_DOMWidget.extend([et2_IInput],
|
||||
{
|
||||
if (action.checkbox)
|
||||
{
|
||||
action.set_checked(!action.checked);
|
||||
jQuery(button).toggleClass('toolbar_toggled');
|
||||
self.checkbox(action.id, !action.checked);
|
||||
}
|
||||
this.value = action.id;
|
||||
action.data.event = e;
|
||||
@ -458,7 +457,41 @@ var et2_toolbar = et2_DOMWidget.extend([et2_IInput],
|
||||
{
|
||||
this._build_menu(actions);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Set/Get the checkbox toolbar action
|
||||
*
|
||||
* @param {string} _action action name of the selected toolbar
|
||||
* @param {boolean} _value value that needs to be set for the action true|false
|
||||
* - if no value means checkbox value returns the current value
|
||||
*
|
||||
* @returns {boolean} returns boolean result of get checkbox value
|
||||
* or returns undefined as Set result or failure
|
||||
*/
|
||||
checkbox: function (_action, _value)
|
||||
{
|
||||
if (!_action || typeof this._actionManager == 'undefined') return undefined;
|
||||
var action_event = this._actionManager.getActionById(_action);
|
||||
|
||||
if (action_event && typeof _value !='undefined')
|
||||
{
|
||||
var btn = jQuery('#'+this.id+'-'+_action);
|
||||
if (btn.length > 0)
|
||||
{
|
||||
action_event.set_checked(_value);
|
||||
btn.toggleClass('toolbar_toggled');
|
||||
}
|
||||
}
|
||||
else if (action_event)
|
||||
{
|
||||
return action_event.checked;
|
||||
}
|
||||
else
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
|
||||
getDOMNode: function(asker)
|
||||
{
|
||||
return this.div[0];
|
||||
|
@ -4430,11 +4430,10 @@ app.classes.mail = AppJS.extend(
|
||||
predefinedText: options.predefinedText.slice(end_pgp+this.end_pgp_message.length+1).replace(/^> \s*/m,'')
|
||||
};
|
||||
// set encrypted checkbox, if not already set
|
||||
var pgp_action = this.et2.getWidgetById('composeToolbar')._actionManager.getActionById('pgp');
|
||||
if (pgp_action && !pgp_action.checked)
|
||||
var composeToolbar = this.et2.getWidgetById('composeToolbar');
|
||||
if (composeToolbar.checkbox('pgp'))
|
||||
{
|
||||
pgp_action.set_checked(true);
|
||||
jQuery('button#composeToolbar-pgp').toggleClass('toolbar_toggled');
|
||||
composeToolbar.checkbox('pgp',true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4491,8 +4490,7 @@ app.classes.mail = AppJS.extend(
|
||||
}
|
||||
else
|
||||
{
|
||||
self.et2.getWidgetById('composeToolbar')._actionManager.getActionById('pgp').set_checked(true);
|
||||
jQuery('button#composeToolbar-pgp').toggleClass('toolbar_toggled');
|
||||
self.et2.getWidgetById('composeToolbar').checkbox('pgp',true);
|
||||
}
|
||||
},
|
||||
this.egw.lang('You will loose current message body, unless you save it to your clipboard!'),
|
||||
|
Loading…
Reference in New Issue
Block a user