mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-09 00:14:57 +02:00
moving emailadmin to api and admin, only emailadmin_hooks and tables still need moving
This commit is contained in:
253
admin/js/app.js
253
admin/js/app.js
@ -98,13 +98,15 @@ app.classes.admin = AppJS.extend(
|
||||
}
|
||||
break;
|
||||
|
||||
case 'admin.categories.index':
|
||||
break;
|
||||
case 'admin.customfield_edit':
|
||||
// Load settings appropriate to currently set type
|
||||
var widget = _et2.widgetContainer.getWidgetById('cf_type');
|
||||
this.cf_type_change(null,widget);
|
||||
break;
|
||||
|
||||
case 'admin.mailaccount':
|
||||
this.account_hide_not_applying();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@ -809,19 +811,20 @@ app.classes.admin = AppJS.extend(
|
||||
jQuery(root.getWidgetById('cf_rows').getDOMNode()).toggle(attributes.cf_rows && true);
|
||||
jQuery(root.getWidgetById('cf_values').getParentDOMNode()).toggle(attributes.cf_values && true);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Activate none standard SMTP mail accounts for selected users
|
||||
*
|
||||
* @param {type} _selected selected users
|
||||
*
|
||||
* @param {egw_action} _action
|
||||
* @param {array} _selected selected users
|
||||
* @todo remove under construction message
|
||||
*/
|
||||
emailadminActiveAccounts: function (_action, _selected){
|
||||
|
||||
var menuaction = 'emailadmin.emailadmin_wizard.ajax_activeAccounts';
|
||||
|
||||
var menuaction = 'admin.admin_mail.ajax_activeAccounts';
|
||||
var accounts = [];
|
||||
var msg1 = egw.lang('%1 accounts being activated',Object.keys(_selected).length);
|
||||
|
||||
|
||||
for (var i=0;i< Object.keys(_selected).length;i++)
|
||||
{
|
||||
accounts[i] = {id:_selected[i]['id'].split('::')[1],qouta:"", domain:"", status:_action.id == 'active'?_action.id:''};
|
||||
@ -841,9 +844,241 @@ app.classes.admin = AppJS.extend(
|
||||
}
|
||||
}, msg1, 'Mail Acounts Activation', menuaction, accounts, 'admin');
|
||||
}
|
||||
}
|
||||
};
|
||||
// confirmation dialog
|
||||
et2_dialog.show_dialog(callbackDialog, egw.lang('Are you sure you want to %1 mail for selected accounts?', egw.lang(_action.id)), egw.lang('Active Mail Accounts'), {},
|
||||
et2_dialog.BUTTON_YES_NO, et2_dialog.WARNING_MESSAGE, undefined, egw);
|
||||
},
|
||||
|
||||
/**
|
||||
* No SSL
|
||||
*/
|
||||
SSL_NONE: 0,
|
||||
/**
|
||||
* STARTTLS on regular tcp connection/port
|
||||
*/
|
||||
SSL_STARTTLS: 1,
|
||||
/**
|
||||
* SSL (inferior to TLS!)
|
||||
*/
|
||||
SSL_SSL: 3,
|
||||
/**
|
||||
* require TLS version 1+, no SSL version 2 or 3
|
||||
*/
|
||||
SSL_TLS: 2,
|
||||
/**
|
||||
* if set, verify certifcate (currently not implemented in Horde_Imap_Client!)
|
||||
*/
|
||||
SSL_VERIFY: 8,
|
||||
|
||||
/**
|
||||
* Resize window methode
|
||||
*
|
||||
* @returns {undefined}
|
||||
*/
|
||||
wizard_popup_resize: function ()
|
||||
{
|
||||
var $main_div = $j('#popupMainDiv');
|
||||
var $et2 = $j('.et2_container');
|
||||
var w = {
|
||||
width: egw_getWindowInnerWidth(),
|
||||
height: egw_getWindowInnerHeight()
|
||||
};
|
||||
// Use et2_container for width since #popupMainDiv is full width, but we still need
|
||||
// to take padding/margin into account
|
||||
var delta_width = w.width - ($et2.outerWidth(true) + ($main_div.outerWidth(true) - $main_div.width()));
|
||||
var delta_height = w.height - ($et2.outerHeight(true) + ($main_div.outerHeight(true) - $main_div.height()));
|
||||
if(delta_width != 0 || delta_height != 0)
|
||||
{
|
||||
window.resizeTo(egw_getWindowOuterWidth() - delta_width,egw_getWindowOuterHeight() - delta_height);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Switch account wizard to manual entry
|
||||
*/
|
||||
wizard_manual: function()
|
||||
{
|
||||
jQuery('.emailadmin_manual').fadeToggle();// not sure how to to this et2-isch
|
||||
this.wizard_popup_resize(); // popup needs to be resized after toggling
|
||||
},
|
||||
|
||||
/**
|
||||
* onclick for continue button to show progress animation
|
||||
*
|
||||
* @param {object} _event event-object or information about event
|
||||
* @param {et2_baseWidget} _widget widget causing the event
|
||||
*/
|
||||
wizard_detect: function(_event, _widget)
|
||||
{
|
||||
// we need to do a manual asynchronious submit to show progress animation
|
||||
// default synchronious submit stops animation!
|
||||
if (this.et2._inst.submit('button[continue]', true)) // true = async submit
|
||||
{
|
||||
var sieve_enabled = this.et2.getWidgetById('acc_sieve_enabled');
|
||||
if (!sieve_enabled || sieve_enabled.get_value())
|
||||
{
|
||||
jQuery('#admin-mailwizard_output').hide();
|
||||
jQuery('td.emailadmin_progress').show();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set default port, if imap ssl-type changes
|
||||
*
|
||||
* @param {object} _event event-object or information about event
|
||||
* @param {et2_baseWidget} _widget widget causing the event
|
||||
*/
|
||||
wizard_imap_ssl_onchange: function(_event, _widget)
|
||||
{
|
||||
var ssl_type = _widget.get_value();
|
||||
this.et2.getWidgetById('acc_imap_port').set_value(
|
||||
ssl_type == this.SSL_SSL || ssl_type == this.SSL_TLS ? 993 : 143);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set default port, if imap ssl-type changes
|
||||
*
|
||||
* @param {object} _event event-object or information about event
|
||||
* @param {et2_baseWidget} _widget widget causing the event
|
||||
*/
|
||||
wizard_smtp_ssl_onchange: function(_event, _widget)
|
||||
{
|
||||
var ssl_type = _widget.get_value();
|
||||
this.et2.getWidgetById('acc_smtp_port').set_value(
|
||||
ssl_type == 'no' ? 25 : (ssl_type == this.SSL_SSL || ssl_type == this.SSL_TLS ? 465 : 587));
|
||||
},
|
||||
|
||||
/**
|
||||
* Set default port, if imap ssl-type changes
|
||||
*
|
||||
* @param {object} _event event-object or information about event
|
||||
* @param {et2_baseWidget} _widget widget causing the event
|
||||
*/
|
||||
wizard_sieve_ssl_onchange: function(_event, _widget)
|
||||
{
|
||||
var ssl_type = _widget.get_value();
|
||||
this.et2.getWidgetById('acc_sieve_port').set_value(
|
||||
ssl_type == this.SSL_SSL || ssl_type == this.SSL_TLS ? 5190 : 4190);
|
||||
this.wizard_sieve_onchange(_event, _widget);
|
||||
},
|
||||
|
||||
/**
|
||||
* Enable sieve, if user changes some setting
|
||||
*
|
||||
* @param {object} _event event-object or information about event
|
||||
* @param {et2_baseWidget} _widget widget causing the event
|
||||
*/
|
||||
wizard_sieve_onchange: function(_event, _widget)
|
||||
{
|
||||
this.et2.getWidgetById('acc_sieve_enabled').set_value(1);
|
||||
},
|
||||
|
||||
/**
|
||||
* Switch to select multiple accounts
|
||||
*
|
||||
* @param {object} _event event-object or information about event
|
||||
* @param {et2_baseWidget} _widget widget causing the event
|
||||
*/
|
||||
edit_multiple: function(_event, _widget)
|
||||
{
|
||||
// hide multiple button
|
||||
_widget.set_disabled(true);
|
||||
|
||||
// switch account-selection to multiple
|
||||
var account_id = this.et2.getWidgetById('account_id');
|
||||
account_id.set_multiple(true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Hide not applying fields, used as:
|
||||
* - onchange handler on account_id
|
||||
* - called from et2_ready for emailadmin.account template
|
||||
*
|
||||
* @param {object} _event event-object or information about event
|
||||
* @param {et2_baseWidget} _widget widget causing the event
|
||||
*/
|
||||
account_hide_not_applying: function(_event, _widget)
|
||||
{
|
||||
var account_id = this.et2.getWidgetById('account_id');
|
||||
var ids = account_id && account_id.get_value ? account_id.get_value() : [];
|
||||
if (typeof ids == 'string') ids = ids.split(',');
|
||||
|
||||
var multiple = ids.length >= 2 || ids[0] === '' || ids[0] < 0;
|
||||
//alert('multiple='+(multiple?'true':'false')+': '+ids.join(','));
|
||||
|
||||
// initial call
|
||||
if (typeof _widget == 'undefined')
|
||||
{
|
||||
if (!multiple)
|
||||
{
|
||||
jQuery('.emailadmin_no_single').hide();
|
||||
}
|
||||
if (!this.egw.user('apps').emailadmin)
|
||||
{
|
||||
jQuery('.emailadmin_no_user,#button\\[multiple\\]').hide();
|
||||
}
|
||||
if (ids.length == 1)
|
||||
{
|
||||
// switch back to single selectbox
|
||||
account_id.set_multiple(false);
|
||||
this.et2.getWidgetById('button[multiple]').set_disabled(false);
|
||||
}
|
||||
}
|
||||
// switched to single user
|
||||
else if (!multiple)
|
||||
{
|
||||
jQuery('.emailadmin_no_single').fadeOut();
|
||||
// switch back to single selectbox
|
||||
account_id.set_multiple(false);
|
||||
this.et2.getWidgetById('button[multiple]').set_disabled(false);
|
||||
}
|
||||
// switched to multiple user
|
||||
else
|
||||
{
|
||||
jQuery('.emailadmin_no_single').fadeIn();
|
||||
}
|
||||
if (_event && _event.stopPropagation) _event.stopPropagation();
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback if user changed account selction
|
||||
*
|
||||
* @param {object} _event event-object or information about event
|
||||
* @param {et2_baseWidget} _widget widget causing the event
|
||||
*/
|
||||
change_account: function(_event, _widget)
|
||||
{
|
||||
// todo check dirty and query user to a) save changes, b) discard changes, c) cancel selection
|
||||
_widget.getInstanceManager().submit();
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback if user changes notification folders: unset use-default checkbox
|
||||
*
|
||||
* @param {object} _event
|
||||
* @param {et2_widget} _widget
|
||||
*/
|
||||
change_folders: function(_event, _widget)
|
||||
{
|
||||
var use_default = this.et2.getWidgetById('notify_use_default');
|
||||
if (use_default) use_default.set_value(false);
|
||||
},
|
||||
|
||||
/**
|
||||
* default onExecute for admin actions
|
||||
*
|
||||
* @param {object} _action
|
||||
* @param {object} _senders
|
||||
*/
|
||||
account_edit_action: function(_action, _senders)
|
||||
{
|
||||
if (_action.data.url)
|
||||
{
|
||||
this.egw.open_link(_action.data.url, _action.data.target || '_blank', _action.data.popup);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user