2013-07-01 19:07:07 +02:00
/ * *
* EGroupware - Admin - Javascript UI
*
* @ link http : //www.egroupware.org
* @ package filemanager
* @ author Ralf Becker < RalfBecker - AT - outdoor - training . de >
2016-05-14 12:40:15 +02:00
* @ copyright ( c ) 2013 - 16 by Ralf Becker < RalfBecker - AT - outdoor - training . de >
2013-07-01 19:07:07 +02:00
* @ license http : //opensource.org/licenses/gpl-license.php GPL - GNU General Public License
2016-05-14 12:40:15 +02:00
* @ version $Id : app . js 56051 2016 - 05 - 06 07 : 58 : 37 Z ralfbecker $
2013-07-01 19:07:07 +02:00
* /
/ * *
* UI for Admin
2013-11-04 21:54:23 +01:00
*
2013-07-01 19:07:07 +02:00
* @ augments AppJS
* /
2013-11-04 21:54:23 +01:00
app . classes . admin = AppJS . extend (
2014-03-27 20:00:52 +01:00
/ * *
* @ lends app . classes . admin
* /
2013-07-01 19:07:07 +02:00
{
appname : 'admin' ,
2013-07-03 18:27:18 +02:00
/ * *
2014-04-02 00:51:26 +02:00
* reference to iframe
2014-03-27 20:00:52 +01:00
*
* { et2 _iframe }
2013-07-03 18:27:18 +02:00
* /
iframe : null ,
2013-07-01 19:07:07 +02:00
2014-04-02 16:32:52 +02:00
/ * *
* reference to nextmatch
*
* { et2 _extension _nextmatch }
* /
nm : null ,
2016-06-29 17:48:54 +02:00
/ * *
* Refarence to div to hold AJAX loadable pages
*
* { et2 _box }
* /
ajax _target : null ,
2014-04-23 18:45:51 +02:00
/ * *
* Reference to ACL edit dialog ( not the list )
* /
acl _dialog : null ,
2013-07-01 19:07:07 +02:00
/ * *
* Constructor
2013-11-04 21:54:23 +01:00
*
2014-03-27 20:00:52 +01:00
* @ memberOf app . classes . admin
2013-07-01 19:07:07 +02:00
* /
2013-11-04 21:54:23 +01:00
init : function ( )
2013-07-01 19:07:07 +02:00
{
// call parent
this . _super . apply ( this , arguments ) ;
} ,
2013-11-04 21:54:23 +01:00
2013-07-01 19:07:07 +02:00
/ * *
* Destructor
* /
destroy : function ( )
{
2014-02-05 23:31:46 +01:00
this . iframe = null ;
2014-04-23 18:45:51 +02:00
this . nm = null ;
this . acl _dialog = null ;
2014-02-17 16:00:06 +01:00
2013-07-01 19:07:07 +02:00
// call parent
this . _super . apply ( this , arguments ) ;
} ,
2013-11-04 21:54:23 +01:00
2013-07-01 19:07:07 +02:00
/ * *
* This function is called when the etemplate2 object is loaded
* and ready . If you must store a reference to the et2 object ,
* make sure to clean it up in destroy ( ) .
*
2014-02-17 16:00:06 +01:00
* @ param { etemplate2 } _et2
* @ param { string } _name name of template loaded
2013-07-01 19:07:07 +02:00
* /
2014-02-17 16:00:06 +01:00
et2 _ready : function ( _et2 , _name )
2013-07-01 19:07:07 +02:00
{
// call parent
this . _super . apply ( this , arguments ) ;
2014-02-17 16:00:06 +01:00
switch ( _name )
2013-08-01 13:44:44 +02:00
{
2014-02-17 16:00:06 +01:00
case 'admin.index' :
var iframe = this . iframe = this . et2 . getWidgetById ( 'iframe' ) ;
2014-04-02 00:51:26 +02:00
this . nm = this . et2 . getWidgetById ( 'nm' ) ;
2016-06-29 17:48:54 +02:00
this . ajax _target = this . et2 . getWidgetById ( 'ajax_target' ) ;
2014-02-17 16:00:06 +01:00
if ( iframe )
{
var self = this ;
jQuery ( iframe . getDOMNode ( ) ) . off ( 'load.admin' )
. bind ( 'load.admin' , function ( ) {
2014-07-08 15:52:48 +02:00
if ( this . contentDocument . location . href . match ( /(\/admin\/|\/admin\/index.php|menuaction=admin.admin_ui.index)/ ) )
{
this . contentDocument . location . href = 'about:blank' ; // stops redirect from admin/index.php
self . load ( ) ; // load own top-level index aka user-list
}
2014-02-17 16:00:06 +01:00
self . _hide _navbar . call ( self ) ;
}
) ;
2013-12-23 18:24:40 +01:00
}
2014-02-17 16:00:06 +01:00
break ;
2015-02-18 19:23:35 +01:00
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 ;
2016-03-28 20:51:38 +02:00
case 'admin.mailaccount' :
this . account _hide _not _applying ( ) ;
break ;
2013-08-01 13:44:44 +02:00
}
2013-07-03 18:27:18 +02:00
} ,
2013-11-04 21:54:23 +01:00
2014-04-02 16:32:52 +02:00
/ * *
* Show given url in ( visible ) iframe or nextmatch with accounts ( ! _url )
*
* @ param { string } [ _url = ] url to show in iframe or nothing for showing
* /
load : function ( _url )
{
2016-05-14 12:40:15 +02:00
if ( this . iframe && this . iframe . getDOMNode ( ) . contentDocument . location . href
. match ( /menuaction=admin.admin_statistics.submit/ ) &&
! _url . match ( /statistics=(postpone|canceled|submitted)/ ) )
2014-07-17 16:02:11 +02:00
{
2014-10-17 15:49:42 +02:00
this . egw . message ( this . egw . lang ( 'Please submit (or postpone) statistic first' ) , 'info' ) ;
2014-07-17 16:02:11 +02:00
return ; // do not allow to leave statistics submit
}
2014-11-28 13:43:10 +01:00
// url outside EGroupware eg. eSyncPro linking to wikipedia
if ( _url && _url . indexOf ( this . egw . webserverUrl ) == - 1 )
{
window . open ( _url , '_blank' ) ;
return ;
}
2016-06-29 17:48:54 +02:00
var ajax = false ;
2014-04-02 16:32:52 +02:00
if ( _url )
{
2016-06-29 17:48:54 +02:00
// Try to load it without the iframe
2016-06-30 11:12:29 +02:00
ajax = _url . match ( /ajax=true/ ) && _url . match ( /menuaction=/ ) ;
2016-06-29 17:48:54 +02:00
if ( ajax )
{
if ( this . ajax _target . node . children . length )
{
// Node has children already? Check for loading over an
// existing etemplate, and remove it first
jQuery ( this . ajax _target . node . children ) . each ( function ( ) {
var old = etemplate2 . getById ( this . id ) ;
if ( old ) old . clear ( ) ;
} ) ;
jQuery ( this . ajax _target . node ) . empty ( ) ;
}
this . egw . json (
framework . activeApp . getMenuaction ( 'ajax_exec' ) ,
// It's important that the context is null, or etemplate2
// won't load the template properly
[ _url ] , this . _ajax _load _callback , null , true , this
) . sendRequest ( ) ;
}
else
{
this . iframe . set _src ( _url ) ;
}
2014-04-02 16:32:52 +02:00
}
2014-04-02 21:04:37 +02:00
else
{
this . egw . app _header ( '' ) ;
2014-07-08 15:52:48 +02:00
// blank iframe, to not keep something running there
this . iframe . getDOMNode ( ) . contentDocument . location . href = 'about:blank' ;
2014-04-02 21:04:37 +02:00
}
2016-06-29 17:48:54 +02:00
this . iframe . set _disabled ( ! _url || ajax ) ;
this . nm . set _disabled ( ! ! _url || ajax ) ;
this . ajax _target . set _disabled ( ! ajax ) ;
2014-04-02 16:32:52 +02:00
} ,
2014-06-25 12:47:26 +02:00
/ * *
* Observer method receives update notifications from all applications
*
* App is responsible for only reacting to "messages" it is interested in !
*
* @ param { string } _msg message ( already translated ) to show , eg . 'Entry deleted'
* @ param { string } _app application name
* @ param { ( string | number ) } _id id of entry to refresh or null
* @ param { string } _type either 'update' , 'edit' , 'delete' , 'add' or null
* - update : request just modified data from given rows . Sorting is not considered ,
* so if the sort field is changed , the row will not be moved .
* - edit : rows changed , but sorting may be affected . Requires full reload .
* - delete : just delete the given rows clientside ( no server interaction neccessary )
* - add : requires full reload for proper sorting
* @ param { string } _msg _type 'error' , 'warning' or 'success' ( default )
* @ param { string } _targetapp which app ' s window should be refreshed , default current
* @ return { false | * } false to stop regular refresh , thought all observers are run
* /
observer : function ( _msg , _app , _id , _type , _msg _type , _targetapp )
{
switch ( _app )
{
case 'admin' :
2014-11-19 17:08:53 +01:00
// if iframe is used --> refresh it
var iframe _node = this . iframe ? this . iframe . getDOMNode ( ) : undefined ;
var iframe _url = iframe _node ? iframe _node . contentDocument . location . href : undefined ;
if ( _id && iframe _url != 'about:blank' )
{
var refresh _done = false ;
// Try for intelligent et2 refresh inside iframe
if ( iframe _node && iframe _node . contentWindow && iframe _node . contentWindow . etemplate2 )
{
var templates = iframe _node . contentWindow . etemplate2 . getByApplication ( 'admin' ) ;
for ( var i = 0 ; i < templates . length ; i ++ )
{
templates [ i ] . refresh ( _msg , _app , _id , _type ) ;
refresh _done = true ;
}
}
if ( ! refresh _done ) // --> reload iframe
{
this . load ( iframe _url ) ;
}
return false ; // --> no regular refresh
}
2014-06-26 10:23:02 +02:00
// invalidate client-side account-cache
this . egw . invalidate _account ( _id , _type ) ;
2014-06-25 12:47:26 +02:00
// group deleted, added or updated
if ( _id < 0 )
{
var tree = this . et2 . getWidgetById ( 'tree' ) ;
2014-07-10 12:30:37 +02:00
var nm = this . et2 . getWidgetById ( 'nm' ) ;
2014-06-25 12:47:26 +02:00
switch ( _type )
{
case 'delete' :
tree . deleteItem ( '/groups/' + _id , false ) ;
2014-07-10 18:00:52 +02:00
if ( nm ) nm . getInstanceManager ( ) . submit ( ) ;
break ;
2014-06-25 12:47:26 +02:00
default : // add, update, edit, null
2014-07-10 18:00:52 +02:00
if ( nm )
{
var activeFilters = nm . activeFilters ;
nm . getInstanceManager ( ) . submit ( ) ;
var nm = this . et2 . getWidgetById ( 'nm' ) ;
nm . applyFilters ( activeFilters ) ;
}
2014-07-17 16:02:11 +02:00
2014-06-25 12:47:26 +02:00
}
2014-07-10 18:00:52 +02:00
var refreshTree = this . et2 . getWidgetById ( 'tree' ) ;
if ( refreshTree ) refreshTree . refreshItem ( '/groups' ) ;
return false ; // --> no regular refresh
2014-06-25 12:47:26 +02:00
}
2014-07-08 15:52:48 +02:00
// not a user or group, eg. categories
else if ( ! _id )
{
this . load ( ) ;
return false ; // --> no regular refresh needed
}
2014-06-25 12:47:26 +02:00
}
2014-06-26 10:23:02 +02:00
} ,
2014-06-25 12:47:26 +02:00
2014-11-19 17:56:51 +01:00
/ * *
* Hide navbar for idots template
*
* Just a hack for old idots , not neccesary for jdots
* /
_hide _navbar : function ( )
{
var document = this . iframe . getDOMNode ( ) . contentDocument ;
if ( ! document ) return ; // nothing we can do ...
// set white background, as transparent one lets account-list show through
document . getElementsByTagName ( 'body' ) [ 0 ] . style . backgroundColor = 'white' ;
// hide navbar elements
var ids2hide = [ 'divLogo' , 'topmenu' , 'divAppIconBar' , 'divStatusBar' , 'tdSidebox' , 'divAppboxHeader' ] ;
for ( var i = 0 ; i < ids2hide . length ; ++ i )
{
var elem = document . getElementById ( ids2hide [ i ] ) ;
if ( elem ) elem . style . display = 'none' ;
}
} ,
/ * *
* Set location of iframe for given _action and _sender ( row )
*
* @ param _action
* @ param _senders
* /
iframe _location : function ( _action , _senders )
{
var id = _senders [ 0 ] . id . split ( '::' ) ;
var url = _action . data . url . replace ( /(%24|\$)id/ , id [ 1 ] ) ;
this . load ( url ) ;
} ,
2016-06-29 17:48:54 +02:00
/ * *
* Callback to load an etemplate
2016-06-30 11:12:29 +02:00
*
2016-06-29 18:22:24 +02:00
* @ param { Object [ ] } _data
2016-06-29 17:48:54 +02:00
* /
_ajax _load _callback : function ( _data )
{
if ( ! _data || _data . type != undefined ) return ;
// Insert the content, etemplate will load into it
2016-07-29 00:30:16 +02:00
jQuery ( this . ajax _target . node ) . append ( typeof _data === 'string' ? _data : _data [ 0 ] ) ;
2016-06-29 17:48:54 +02:00
} ,
2013-10-15 18:53:43 +02:00
/ * *
* Link hander for jDots template to just reload our iframe , instead of reloading whole admin app
2013-11-04 21:54:23 +01:00
*
2013-10-15 18:53:43 +02:00
* @ param _url
* @ return boolean true , if linkHandler took care of link , false otherwise
* /
linkHandler : function ( _url )
{
2014-02-17 16:00:06 +01:00
var matches = _url . match ( /menuaction=admin.admin_ui.index.*&load=([^&]+)/ ) ;
if ( _url != 'about:blank' && ( this . iframe != null && ! _url . match ( 'menuaction=admin.admin_ui.index' ) || matches ) )
2013-10-15 18:53:43 +02:00
{
if ( matches )
{
2016-06-29 17:48:54 +02:00
_url = _url . replace ( /menuaction=admin.admin_ui.index/ , 'menuaction=' + matches [ 1 ] ) . replace ( /&(load=[^&]+)/g , '' ) ;
2013-10-15 18:53:43 +02:00
}
2014-04-02 16:32:52 +02:00
this . load ( _url ) ;
2013-10-15 18:53:43 +02:00
return true ;
}
// can not load our own index page, has to be done by framework
return false ;
} ,
2013-11-04 21:54:23 +01:00
2013-07-01 19:07:07 +02:00
/ * *
* Run an admin module / onclick callback for tree
2013-11-04 21:54:23 +01:00
*
2014-02-17 16:00:06 +01:00
* @ param { string } _id id of clicked node
* @ param { et2 _tree } _widget reference to tree widget
2013-07-01 19:07:07 +02:00
* /
run : function ( _id , _widget )
{
var link = _widget . getUserData ( _id , 'link' ) ;
2013-11-04 21:54:23 +01:00
2013-07-03 18:27:18 +02:00
if ( _id == '/accounts' || _id . substr ( 0 , 8 ) == '/groups/' )
{
2014-04-02 16:32:52 +02:00
this . load ( ) ;
2013-07-03 18:27:18 +02:00
var parts = _id . split ( '/' ) ;
2013-08-01 13:44:44 +02:00
this . et2 . getWidgetById ( 'nm' ) . applyFilters ( { filter : parts [ 2 ] ? parts [ 2 ] : '' , search : '' } ) ;
2013-07-03 18:27:18 +02:00
}
else if ( typeof link == 'undefined' )
2013-07-01 19:07:07 +02:00
{
2013-11-04 21:54:23 +01:00
_widget . openItem ( _id , 'toggle' ) ;
2013-07-01 19:07:07 +02:00
}
else if ( link [ 0 ] == '/' || link . substr ( 0 , 4 ) == 'http' )
{
2016-05-16 15:26:25 +02:00
link += ( link . indexOf ( '?' ) >= 0 ? '&' : '?' ) + 'nonavbar=1' ;
this . load ( link ) ;
2013-07-01 19:07:07 +02:00
}
else if ( link . substr ( 0 , 11 ) == 'javascript:' )
{
eval ( link . substr ( 11 ) ) ;
}
2013-07-31 16:01:12 +02:00
} ,
2013-11-04 21:54:23 +01:00
2013-07-31 16:01:12 +02:00
/ * *
* View , edit or delete a group callback for tree
2013-11-04 21:54:23 +01:00
*
2014-02-17 16:00:06 +01:00
* @ param { object } _action egwAction
* @ param { array } _senders egwActionObject _senders [ 0 ] . id holds id
2013-07-31 16:01:12 +02:00
* /
group : function ( _action , _senders )
{
switch ( _action . id )
{
case 'view' :
this . run ( _senders [ 0 ] . id , this . et2 . getWidgetById ( 'tree' ) ) ;
break ;
2013-11-04 21:54:23 +01:00
2014-03-19 16:24:54 +01:00
case 'delete' :
var account _id = _senders [ 0 ] . id . split ( '/' ) [ 2 ] ;
this . egw . json ( 'admin_account::ajax_delete_group' , [ account _id ] ) . sendRequest ( ) ;
break ;
2014-03-27 20:00:52 +01:00
default :
if ( ! _action . data . url )
{
alert ( 'Missing url in action ' + _action . id + '!' ) ;
break ;
}
var url = _action . data . url . replace ( '$id' , _senders [ 0 ] . id . split ( '/' ) [ 2 ] ) ;
if ( url [ 0 ] != '/' && url . substr ( 0 , 4 ) != 'http' )
{
url = this . egw . link ( '/index.php' , url ) ;
}
if ( _action . data . popup )
{
this . egw . open _link ( url , '_blank' , _action . data . popup ) ;
}
else
{
2014-04-02 16:32:52 +02:00
this . load ( url ) ;
2014-03-27 20:00:52 +01:00
}
break ;
2013-07-31 16:01:12 +02:00
}
} ,
2013-11-04 21:54:23 +01:00
2013-07-31 16:01:12 +02:00
/ * *
2013-08-27 19:58:38 +02:00
* Modify an ACL entry
2013-11-04 21:54:23 +01:00
*
2014-02-17 16:00:06 +01:00
* @ param { object } _action egwAction
* @ param { array } _senders egwActionObject _senders [ 0 ] . id holds the id "admin::app:account:location"
2013-07-31 16:01:12 +02:00
* /
2013-08-27 19:58:38 +02:00
acl : function ( _action , _senders )
2013-07-31 16:01:12 +02:00
{
2013-08-27 19:58:38 +02:00
var ids = [ ] ;
for ( var i = 0 ; i < _senders . length ; ++ i )
{
2014-03-12 13:49:28 +01:00
ids . push ( _senders [ i ] . id . split ( '::' ) . pop ( ) ) ; // remove "admin::" prefix
2013-08-27 19:58:38 +02:00
}
2014-04-23 18:45:51 +02:00
// For edit, set some data from the list since it's already there
var content = _senders [ 0 ] . id ? jQuery . extend ( { } , egw . dataGetUIDdata ( _senders [ 0 ] . id ) . data ) : { } ;
2014-06-25 12:47:26 +02:00
2014-04-23 18:45:51 +02:00
switch ( _action . id )
{
case 'delete' :
var app = egw . app _name ( ) ; // can be either admin or preferences!
if ( app != 'admin' ) app = 'preferences' ;
var className = app + '_acl' ;
var request = egw . json ( className + '::ajax_change_acl' , [ ids ] , this . _acl _callback , this , false , this )
. sendRequest ( ) ;
break ;
case 'add' :
// No content, even if they clicked on a row
// Defaults set by _acl_content() based on nm values
content = { } ;
// Fall through
case 'edit' :
this . _acl _dialog ( content ) ;
break ;
}
} ,
/ * *
* Create the ACL edit dialog , including defaults & fetching what can be found
*
* @ param content List of content for the dialog template
* @ param sel _options optional select options
* /
_acl _dialog : function ( content , sel _options )
{
if ( typeof content == 'undefined' ) content = { } ;
2014-06-25 12:47:26 +02:00
2014-04-23 18:45:51 +02:00
// Determine which application we're running as
2014-03-12 13:49:28 +01:00
var app = egw . app _name ( ) ; // can be either admin or preferences!
2014-03-12 14:50:16 +01:00
if ( app != 'admin' ) app = 'preferences' ;
2015-01-07 17:35:13 +01:00
// Get by ID, since this.et2 isn't always the ACL list
var et2 = etemplate2 . getById ( 'admin-acl' ) . widgetContainer ;
2014-03-12 13:49:28 +01:00
var className = app + '_acl' ;
2014-04-23 18:45:51 +02:00
var acl _rights = { } ;
var readonlys = { acl : { } } ;
2013-08-27 19:58:38 +02:00
2014-04-02 20:32:52 +02:00
// Select options are already here, just pull them and pass along
2015-04-16 12:24:19 +02:00
sel _options = et2 . getArrayMgr ( 'sel_options' ) . data || { } ;
2014-04-02 20:32:52 +02:00
2014-04-23 18:45:51 +02:00
// Some defaults
2015-01-07 17:35:13 +01:00
if ( et2 && et2 . getWidgetById ( 'nm' ) )
2014-04-02 20:32:52 +02:00
{
2014-04-23 18:45:51 +02:00
// This is which checkboxes are available for each app
2015-01-07 17:35:13 +01:00
var acl _rights = et2 . getWidgetById ( 'nm' ) . getArrayMgr ( 'content' ) . getEntry ( 'acl_rights' ) || { } ;
2014-04-23 18:45:51 +02:00
if ( ! content . acl _appname )
{
// Pre-set appname to currently selected
2015-01-07 17:35:13 +01:00
content . acl _appname = et2 . getWidgetById ( 'filter2' ) . getValue ( ) || "" ;
2014-04-23 18:45:51 +02:00
}
2014-04-30 17:20:32 +02:00
if ( ! content . acl _account )
{
2015-01-07 17:35:13 +01:00
content . acl _account = et2 . getWidgetById ( 'nm' ) . getArrayMgr ( 'content' ) . getEntry ( 'account_id' ) ;
2014-04-30 17:20:32 +02:00
}
2014-04-23 18:45:51 +02:00
if ( ! content . acl _location )
{
2015-01-07 17:35:13 +01:00
content . acl _location = et2 . getWidgetById ( 'filter' ) . getValue ( ) == 'run' ? 'run' : null ;
2014-04-28 18:19:39 +02:00
}
2014-09-18 17:01:08 +02:00
// If no admin rights, change UI to not allow adding access to apps
if ( content . acl _location == 'run' && ! egw . user ( 'apps' ) [ 'admin' ] )
{
content . acl _location = null ;
}
2014-04-28 18:19:39 +02:00
if ( content . acl _location == 'run' )
{
// These are the apps the account has access to
2014-04-30 17:20:32 +02:00
// Fetch current values from server
2014-06-25 12:47:26 +02:00
this . egw . json ( className + '::ajax_get_app_list' , [ content . acl _account ] , function ( data ) { content . apps = data ; } , this , false , this )
2014-04-30 17:20:32 +02:00
. sendRequest ( ) ;
2014-04-28 18:19:39 +02:00
}
else
{
// Restrict application selectbox to only apps that support ACL
2015-09-16 01:59:31 +02:00
sel _options . acl _appname = [ ] ;
2014-04-28 18:19:39 +02:00
for ( var app in acl _rights )
{
2015-09-16 01:59:31 +02:00
sel _options . acl _appname . push ( { value : app , label : this . egw . lang ( app ) } ) ;
2014-04-28 18:19:39 +02:00
}
2015-09-16 01:59:31 +02:00
// Sort list
sel _options . acl _appname . sort ( function ( a , b ) {
if ( a . label > b . label ) return 1 ;
if ( a . label < b . label ) return - 1 ;
return 0 ;
} ) ;
2014-04-23 18:45:51 +02:00
}
2014-04-30 17:20:32 +02:00
2014-04-02 20:32:52 +02:00
}
if ( content . acl _appname )
{
2014-04-23 21:09:28 +02:00
// Load checkboxes & their values
2014-04-02 21:28:57 +02:00
content . acl _rights = content . acl _rights ? parseInt ( content . acl _rights ) : null ;
2014-04-02 20:32:52 +02:00
jQuery . extend ( content , { acl : [ ] , right : [ ] , label : [ ] } ) ;
for ( var right in acl _rights [ content . acl _appname ] )
{
2014-04-23 21:09:28 +02:00
// only user himself is allowed to grant private (16) rights
2014-04-23 18:45:51 +02:00
if ( right == '16' && content [ 'acl_account' ] != egw . user ( 'account_id' ) )
{
readonlys . acl [ content . acl . length ] = true ;
}
2014-04-02 20:32:52 +02:00
content . acl . push ( content . acl _rights & right ) ;
content . right . push ( right ) ;
content . label . push ( egw . lang ( acl _rights [ content . acl _appname ] [ right ] ) ) ;
}
2014-04-23 21:09:28 +02:00
}
2014-06-25 12:47:26 +02:00
2015-01-30 12:30:47 +01:00
if ( content . acl _account && ! egw . user ( 'apps' ) [ 'admin' ] )
2014-09-19 18:31:57 +02:00
{
readonlys . acl _account = true ;
}
2014-04-23 21:09:28 +02:00
if ( content . acl _location )
2014-06-25 12:47:26 +02:00
{
2014-04-23 21:09:28 +02:00
sel _options . acl _location = jQuery . extend ( { } , sel _options . acl _location ) ;
2016-05-06 09:58:37 +02:00
this . egw . link _title ( 'api-accounts' , content . acl _location , function ( title ) { sel _options . acl _location [ content . acl _location ] = title ; } ) ;
2014-04-02 20:32:52 +02:00
}
2014-04-02 21:04:37 +02:00
2014-04-23 18:45:51 +02:00
// Create the dialog
this . acl _dialog = et2 _createWidget ( "dialog" , {
callback : jQuery . proxy ( function ( _button _id , _value ) {
this . acl _dialog = null ;
if ( _button _id != et2 _dialog . OK _BUTTON ) return ;
2014-04-30 17:20:32 +02:00
// Restore account if it's readonly in dialog
if ( ! _value . acl _account ) _value . acl _account = content . acl _account ;
2014-06-25 12:47:26 +02:00
2015-01-07 18:59:34 +01:00
// Handle no applications selected
if ( typeof _value . apps == 'undefined' && content . acl _location == 'run' )
2014-04-23 18:45:51 +02:00
{
2015-01-07 18:59:34 +01:00
_value . apps = [ ] ;
}
// Only send the request if they entered everything (or selected no apps)
if ( _value . acl _account && ( _value . acl _appname && _value . acl _location || typeof _value . apps != 'undefined' ) )
{
if ( _value . acl _appname && _value . acl _account && _value . acl _location )
2014-10-08 01:20:33 +02:00
{
2015-01-07 18:59:34 +01:00
var id = _value . acl _appname + ':' + _value . acl _account + ':' + _value . acl _location ;
if ( content && content . id && id != content . id )
{
// Changed the account or location, remove previous or we
// get a new line instead of an edit
this . egw . json ( className + '::ajax_change_acl' , [ content . id , 0 ] , null , this , false , this )
. sendRequest ( ) ;
}
2014-10-08 01:20:33 +02:00
}
2014-04-23 18:45:51 +02:00
var rights = 0 ;
for ( var i in _value . acl )
{
rights += parseInt ( _value . acl [ i ] ) ;
}
2015-01-07 18:59:34 +01:00
if ( typeof _value . apps != 'undefined' && ! _value . acl _appname )
2014-04-28 19:40:25 +02:00
{
id = [ ] ;
rights = 1 ;
var removed = [ ] ;
// Loop through all apps, remove the ones with no permission
2015-09-28 22:06:21 +02:00
for ( var idx in sel _options . filter2 )
2014-04-28 19:40:25 +02:00
{
2015-09-28 22:06:21 +02:00
var app = sel _options . filter2 [ idx ] . value || false ;
2015-04-16 12:24:19 +02:00
if ( ! app ) continue ;
2014-04-28 19:40:25 +02:00
var run _id = app + ":" + _value . acl _account + ":run" ;
2015-01-07 18:59:34 +01:00
if ( _value . apps . indexOf ( app ) < 0 && ( content . apps . indexOf ( app ) >= 0 || content . apps . length == 0 ) )
2014-04-28 19:40:25 +02:00
{
removed . push ( run _id ) ;
}
else if ( _value . apps . indexOf ( app ) >= 0 && content . apps . indexOf ( app ) < 0 )
{
2014-06-25 12:47:26 +02:00
id . push ( run _id ) ;
2014-04-28 19:40:25 +02:00
}
}
// Remove any removed
if ( removed . length > 0 )
{
this . egw . json ( className + '::ajax_change_acl' , [ removed , 0 ] , this . _acl _callback , this , false , this )
. sendRequest ( ) ;
}
}
2014-04-23 18:45:51 +02:00
this . egw . json ( className + '::ajax_change_acl' , [ id , rights ] , this . _acl _callback , this , false , this )
. sendRequest ( ) ;
}
} , this ) ,
title : egw . lang ( 'Access control' ) ,
buttons : et2 _dialog . BUTTONS _OK _CANCEL ,
value : {
content : content ,
sel _options : sel _options ,
readonlys : readonlys
} ,
template : egw . webserverUrl + '/admin/templates/default/acl.edit.xet'
} , et2 _dialog . _create _parent ( app ) ) ;
} ,
/ * *
* Change handler for ACL edit dialog application selectbox .
* Re - creates the dialog with the current values
2014-06-25 12:47:26 +02:00
*
* @ param input
* @ param widget
2014-04-23 18:45:51 +02:00
* /
2014-04-30 17:20:32 +02:00
acl _reopen _dialog : function ( input , widget )
2014-04-23 18:45:51 +02:00
{
var content = { } ;
if ( this . acl _dialog != null )
2013-08-27 19:58:38 +02:00
{
2014-04-23 18:45:51 +02:00
content = this . acl _dialog . get _value ( ) || { } ;
2013-11-04 21:54:23 +01:00
2014-04-23 18:45:51 +02:00
// Destroy the dialog
this . acl _dialog . free ( ) ;
this . acl _dialog = null ;
2013-08-27 19:58:38 +02:00
}
2014-04-23 18:45:51 +02:00
// Re-open the dialog
this . _acl _dialog ( content ) ;
2013-08-27 19:58:38 +02:00
} ,
2013-11-04 21:54:23 +01:00
2013-08-27 19:58:38 +02:00
/ * *
* Callback called on successfull call of serverside ACL handling
2013-11-04 21:54:23 +01:00
*
2014-02-17 16:00:06 +01:00
* @ param { object } _data returned from server
2013-08-27 19:58:38 +02:00
* /
_acl _callback : function ( _data )
{
2014-06-04 17:05:27 +02:00
// Avoid the window / framework / app and just refresh the etemplate
// Framework will try to refresh the opener
2015-01-07 17:35:13 +01:00
// Get by ID, since this.et2 isn't always the ACL list
var et2 = etemplate2 . getById ( 'admin-acl' ) . widgetContainer ;
et2 . getInstanceManager ( ) . refresh ( _data . msg , this . appname , _data . ids , _data . type ) ;
2013-07-31 16:01:12 +02:00
} ,
2014-01-16 17:21:17 +01:00
/ * *
* Check to see if admin has taken away access to a category
*
* @ @ param { widget } button add / apply pressed button
* /
check _owner : function ( button ) {
var select _owner = this . et2 . getWidgetById ( 'owner' ) ;
2014-01-28 11:48:23 +01:00
var diff = [ ] ;
2014-02-17 16:00:06 +01:00
2014-01-16 17:21:17 +01:00
if ( typeof select _owner != 'undefined' )
{
var owner = select _owner . get _value ( ) ;
}
if ( typeof owner != 'object' )
{
owner = [ owner ] ;
}
// No owner probably means selectbox is read-only, so no need to check
if ( owner == null ) return true ;
var all _users = owner . indexOf ( '0' ) >= 0 ;
// If they checked all users, uncheck the others
if ( all _users ) {
select _owner . set _value ( [ '0' ] ) ;
return true ;
}
// Find out what changed
2014-06-30 10:59:19 +02:00
var cat _original _owner = this . et2 . getArrayMgr ( 'content' ) . getEntry ( 'owner' ) ;
if ( cat _original _owner )
2014-01-28 11:48:23 +01:00
{
var selected _groups = select _owner . get _value ( ) . toString ( ) ;
2014-02-17 16:00:06 +01:00
2014-01-28 11:48:23 +01:00
for ( var i = 0 ; i < cat _original _owner . length ; i ++ )
{
2014-01-28 12:13:48 +01:00
if ( selected _groups . search ( cat _original _owner [ i ] ) < 0 )
2014-01-28 11:48:23 +01:00
{
diff . push ( cat _original _owner [ i ] ) ;
}
}
2014-02-17 16:00:06 +01:00
2014-01-28 12:13:48 +01:00
if ( diff . length > 0 )
2014-01-28 11:48:23 +01:00
{
var removed _cat _label = jQuery . map ( select _owner . options . select _options , function ( val , i )
2014-03-27 20:00:52 +01:00
{
for ( var j = 0 ; j <= diff . length ; j ++ )
{
if ( diff [ j ] == val . value )
{
return val . label ;
}
}
} ) ;
2014-01-16 17:21:17 +01:00
2014-01-28 11:48:23 +01:00
// Somebody will lose permission, give warning.
if ( removed _cat _label )
{
var msg = this . egw . lang ( 'Removing access for groups may cause problems for data in this category. Are you sure? Users in these groups may no longer have access:' ) ;
return et2 _dialog . confirm ( button , msg + removed _cat _label . join ( ',' ) ) ;
}
}
2014-01-16 17:21:17 +01:00
}
return true ;
} ,
/ * *
* Show icon based on icon - selectbox , hide placeholder ( broken image ) , if no icon selected
*
* @ param { widget } widget select box widget
* /
change _icon : function ( widget )
{
var img = widget . getRoot ( ) . getWidgetById ( 'icon_url' ) ;
if ( img )
{
img . set _src ( widget . getValue ( ) ) ;
}
2014-03-18 19:31:52 +01:00
} ,
/ * *
* Add / edit an account
*
* @ param { object } _action egwAction
* @ param { array } _senders egwActionObject _senders [ 0 ] . id holds account _id
* /
account : function ( _action , _senders )
{
var params = jQuery . extend ( { } , this . egw . link _get _registry ( 'addressbook' , 'edit' ) ) ;
var popup = this . egw . link _get _registry ( 'addressbook' , 'edit_popup' ) ;
if ( _action . id == 'add' )
{
params . owner = '0' ;
}
else
{
2014-04-03 10:36:15 +02:00
params . account _id = _senders [ 0 ] . id . split ( '::' ) . pop ( ) ; // get last :: separated part
2014-03-18 19:31:52 +01:00
}
this . egw . open _link ( this . egw . link ( '/index.php' , params ) , 'admin' , popup ) ;
2014-07-02 18:47:38 +02:00
} ,
/ * *
* Submit statistic
*
* Webkit browsers ( Chrome , Safari , ... ) do NOT allow to call form . submit ( ) from within onclick of a submit button .
* Therefor we first store our own form action , replace it with egroupware . org submit url and set a timeout calling
* submit _statistic again with just the form , to do the second submit to our own webserver
*
* @ param { DOM } form
* @ param { string } submit _url
* @ return { boolean }
* /
2016-05-14 12:40:15 +02:00
submit _statistic : function ( form , submit _url )
2014-07-02 18:47:38 +02:00
{
2016-05-14 12:40:15 +02:00
var that = this ;
var submit = function ( _button )
{
2014-07-02 18:47:38 +02:00
// submit to egroupware.org
2016-05-14 12:40:15 +02:00
var method = form . method ;
form . method = 'POST' ;
var action = form . action ;
2014-07-02 18:47:38 +02:00
form . action = submit _url ;
2016-05-14 12:40:15 +02:00
var target = form . target ;
2014-07-02 18:47:38 +02:00
form . target = '_blank' ;
form . submit ( ) ;
2016-05-14 12:40:15 +02:00
// submit to own webserver
form . method = method ;
form . action = action ;
form . target = target ;
that . et2 . getInstanceManager ( ) . submit ( 'submit' ) ;
} ;
// Safari does NOT allow to call form.submit() outside of onclick callback
// so we have to use browsers ugly synchron confirm
if ( navigator . userAgent . match ( /Safari/ ) && ! navigator . userAgent . match ( /Chrome/ ) )
{
if ( confirm ( this . egw . lang ( 'Submit displayed information?' ) ) )
{
submit ( ) ;
}
}
else
{
et2 _dialog . show _dialog ( function ( _button )
{
if ( _button == et2 _dialog . YES _BUTTON )
{
submit ( ) ;
}
} , this . egw . lang ( 'Submit displayed information?' ) , '' , { } ,
et2 _dialog . BUTTON _YES _NO , et2 _dialog . QUESTION _MESSAGE , undefined , egw ) ;
}
return false ;
2014-07-14 12:19:32 +02:00
} ,
2014-07-17 16:02:11 +02:00
2014-07-14 12:19:32 +02:00
/ * *
* Delete confirmation dialog
2014-07-17 16:02:11 +02:00
*
2014-07-15 11:52:00 +02:00
* @ param { egw action } _action
2014-07-14 12:19:32 +02:00
* /
2014-07-15 11:52:00 +02:00
delete _category : function ( _action )
2014-07-14 12:19:32 +02:00
{
var _buttons = [
2014-07-17 17:46:03 +02:00
{ "button_id" : "delete[cancel]" , "text" : this . egw . lang ( 'Cancel' ) , id : 'delete[cancel]' , image : 'cancel' , "default" : true } ,
{ "button_id" : "delete[delete]" , "text" : this . egw . lang ( 'Delete' ) , id : 'delete[delete]' , image : 'delete' } ,
2016-11-02 16:30:39 +01:00
{ "button_id" : "delete[subs]" , "text" : this . egw . lang ( 'Delete including sub-entries' ) , id : 'delete[subs]' , image : 'delete' }
2014-07-14 12:19:32 +02:00
] ;
2014-07-15 11:52:00 +02:00
var action = _action ;
2014-07-14 12:19:32 +02:00
var self = this ;
var delDialog _callBack = function ( _buttons )
{
if ( _buttons != "delete[cancel]" )
{
2014-07-15 11:52:00 +02:00
if ( self . et2 . _inst . name == "admin.categories.index" )
{
var nm _widget = self . et2 . getWidgetById ( 'nm' ) ;
if ( nm _widget )
{
if ( _buttons == "delete[delete]" )
{
nm _action ( action ) ;
}
else
{
action . id = 'delete_sub' ;
nm _action ( action ) ;
}
2014-07-17 16:02:11 +02:00
}
2014-07-15 11:52:00 +02:00
}
else
{
self . et2 . getInstanceManager ( ) . submit ( _buttons ) ;
}
2014-07-14 12:19:32 +02:00
}
} ;
2014-07-17 17:46:03 +02:00
et2 _dialog . show _dialog ( delDialog _callBack , this . egw . lang ( "Are you sure you want to delete this category ?" ) , this . egw . lang ( "Delete" ) , { } , _buttons , et2 _dialog . WARNING _MESSAGE , null , 'admin' ) ;
2015-02-18 19:23:35 +01:00
} ,
/ * *
* Change handler for when you change the type of a custom field .
* It toggles options / attributes as appropriate .
2015-04-16 12:24:19 +02:00
* @ param { event object } e
* @ param { widget object } widget
2015-02-18 19:23:35 +01:00
* /
cf _type _change : function ( e , widget ) {
var root = widget . getRoot ( ) ;
var attributes = widget . getArrayMgr ( 'content' ) . getEntry ( 'attributes[' + widget . getValue ( ) + ']' ) || { } ;
2015-04-20 23:49:05 +02:00
root . getWidgetById ( 'cf_values' ) . set _statustext ( widget . egw ( ) . lang ( widget . getArrayMgr ( 'content' ) . getEntry ( 'options[' + widget . getValue ( ) + ']' ) || '' ) ) ;
2015-04-21 00:54:58 +02:00
jQuery ( root . getWidgetById ( 'cf_len' ) . getDOMNode ( ) ) . toggle ( attributes . cf _len && true ) ;
jQuery ( root . getWidgetById ( 'cf_rows' ) . getDOMNode ( ) ) . toggle ( attributes . cf _rows && true ) ;
jQuery ( root . getWidgetById ( 'cf_values' ) . getParentDOMNode ( ) ) . toggle ( attributes . cf _values && true ) ;
2015-12-11 17:11:56 +01:00
} ,
2016-03-28 20:51:38 +02:00
2015-12-11 17:11:56 +01:00
/ * *
* Activate none standard SMTP mail accounts for selected users
2016-03-28 20:51:38 +02:00
*
* @ param { egw _action } _action
* @ param { array } _selected selected users
2015-12-11 17:11:56 +01:00
* @ todo remove under construction message
* /
emailadminActiveAccounts : function ( _action , _selected ) {
2016-03-28 20:51:38 +02:00
var menuaction = 'admin.admin_mail.ajax_activeAccounts' ;
2015-12-11 17:11:56 +01:00
var accounts = [ ] ;
2015-12-15 12:23:01 +01:00
var msg1 = egw . lang ( '%1 accounts being activated' , Object . keys ( _selected ) . length ) ;
2016-03-28 20:51:38 +02:00
2015-12-11 17:11:56 +01:00
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 : '' } ;
}
var callbackDialog = function ( btn ) {
if ( btn === et2 _dialog . YES _BUTTON )
{
// long task dialog for de/activation accounts
et2 _dialog . long _task ( function ( _val , _resp ) {
if ( _val && _resp . type !== 'error' )
{
console . log ( _val , _resp ) ;
}
else
{
}
} , msg1 , 'Mail Acounts Activation' , menuaction , accounts , 'admin' ) ;
}
2016-03-28 20:51:38 +02:00
} ;
2015-12-11 17:11:56 +01:00
// 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 ) ;
2016-03-28 20:51:38 +02:00
} ,
/ * *
* 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 ( )
{
2016-06-02 16:51:15 +02:00
var $main _div = jQuery ( '#popupMainDiv' ) ;
var $et2 = jQuery ( '.et2_container' ) ;
2016-03-28 20:51:38 +02:00
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 ( ) ;
}
2016-04-26 16:12:41 +02:00
if ( ! this . egw . user ( 'apps' ) . admin )
2016-03-28 20:51:38 +02:00
{
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 ) ;
}
2016-07-28 12:02:01 +02:00
} ,
/ * *
* Clear instance cache
*
* If there is an error on server - side , resend request with an parameter allowing
* cache to use different method not requiring eg . so much memory
* /
clear _cache : function ( )
{
this . egw . message ( this . egw . lang ( 'Clear cache and register hooks' ) + "\n" + this . egw . lang ( 'Please wait...' ) , 'info' ) ;
this . egw . json ( 'admin.admin_hooks.ajax_clear_cache' ) . sendRequest ( true , undefined , jQuery . proxy ( function ( _xmlhttp , _err )
{
this . egw . json ( 'admin.admin_hooks.ajax_clear_cache&errored=1' ) . sendRequest ( true ) ;
} , this ) ) ;
2014-02-17 16:00:06 +01:00
}
2013-07-01 19:07:07 +02:00
} ) ;