ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

user_view.js
Go to the documentation of this file.
1
6 if( !ultimix )
7 {
8 ultimix = {};
9 }
10
16 if( !ultimix.user )
17 {
18 ultimix.user = {};
19 }
20
28 ultimix.user.add_avatar = function( ServerData )
29 {
30 var ServerDataObject;
31 eval( "ServerDataObject=" + ServerData );
32
33 ItemTemplate = jQuery( '.avatar>.avatar_template' ).html();
34 ItemTemplate = ultimix.string_utilities.print_record( ItemTemplate , ServerDataObject );
35
36 jQuery( '.avatar>.avatar_item' ).html( ItemTemplate );
37 }
38
50 ultimix_user_after_avatar_upload_processor = function( File , ServerData , ReceivedResponse )
51 {
52 try
53 {
54 var Progress = new FileProgress( File , this.customSettings.progressTarget );
55 Progress.setComplete();
56 Progress.setStatus( ultimix.get_string( 'complete' ) );
57 Progress.toggleCancel( false );
58
59 ultimix.user.add_avatar( ServerData );
60 }
61 catch( ex )
62 {
63 this.debug( ex );
64 }
65 }
66
76 ultimix.user.set_default_options = function( ViewOptions )
77 {
78 if( !ViewOptions )
79 {
80 ViewOptions = {};
81 }
82
83 ViewOptions.meta = ViewOptions.meta ? ViewOptions.meta : 'meta_user_list';
84 ViewOptions.package_name = ViewOptions.package_name ? ViewOptions.package_name : 'user::user_view';
85 ViewOptions.paging_require_form = ViewOptions.paging_require_form ? ViewOptions.paging_require_form : '0';
86 ViewOptions.add_hidden_fields = ViewOptions.add_hidden_fields ? ViewOptions.add_hidden_fields : '0';
87
88 return( ViewOptions );
89 }
90
100 ultimix.user.get_list_form = function( Fuctions , ViewOptions )
101 {
102 if( !Fuctions )
103 {
104 Fuctions = {};
105 }
106
107 ViewOptions = ultimix.user.set_default_options( ViewOptions );
108
109 ultimix.ajax_gate.direct_view( ViewOptions , Fuctions );
110 }
111
127 ultimix.user.get_custom_list_form = function( Fuctions , Header , Item , Footer , ViewOptions )
128 {
129 ultimix.auto.get_custom_list_form( Fuctions , Header , Item , Footer , false , ViewOptions , 'ad_banner' );
130 }
131
143 ultimix.user.activate_success = function( ProgressDialogId , Ids , CheckboxGroupName )
144 {
145 return(
146 function()
147 {
148 ultimix.std_dialogs.close_message_box( ProgressDialogId );
149 ultimix.std_dialogs.InfoMessageBox( 'users_were_activated' );
150 for( var i = 0 ; i < Ids.length ; i++ )
151 {
152 jQuery( '#active_' + Ids[ i ] ).html( ultimix.get_string( 'active' ) );
153 }
154 ultimix.grids.set_checkboxes( CheckboxGroupName , false );
155 }
156 );
157 }
158
170 ultimix.user.activate_users_ajax_request = function( Functions , Ids , CheckboxGroupName )
171 {
172 if( !Functions )
173 {
174 Functions = {};
175 }
176
177 var ProgressDialogId = ultimix.std_dialogs.SimpleWaitingMessageBox();
178
179 if( !Functions.success )
180 {
181 Functions.success = ultimix.user.activate_success( ProgressDialogId , Ids , CheckboxGroupName );
182 }
183
184 ControllerOptions = {
185 'ids' : Ids , 'meta' : 'meta_admin_activate_user' , 'package_name' : 'user::user_controller'
186 };
187
188 ultimix.ajax_gate.direct_controller( ControllerOptions , Functions );
189 }
190
198 ultimix.user.activate_users = function( CheckboxGroupName )
199 {
200 if( !ultimix.grids.record_selected( CheckboxGroupName , 'at_least_one_record_must_be_selected' ) )
201 {
202 return;
203 }
204
205 var Ids = ultimix.grids.get_identificators( CheckboxGroupName );
206
207 ultimix.user.activate_users_ajax_request( {} , Ids , CheckboxGroupName );
208 }
209
221 ultimix.user.deactivate_success = function( ProgressDialogId , Ids , CheckboxGroupName )
222 {
223 return(
224 function()
225 {
226 ultimix.std_dialogs.close_message_box( ProgressDialogId );
227 ultimix.std_dialogs.InfoMessageBox( 'users_were_deactivated' );
228 for( var i = 0 ; i < Ids.length ; i++ )
229 {
230 jQuery( '#active_' + Ids[ i ] ).html( ultimix.get_string( 'not_active' ) );
231 }
232 ultimix.grids.set_checkboxes( CheckboxGroupName , false );
233 }
234 );
235 }
236
248 ultimix.user.deactivate_users_ajax_request = function( Functions , Ids , CheckboxGroupName )
249 {
250 if( !Functions )
251 {
252 Functions = {};
253 }
254
255 var ProgressDialogId = ultimix.std_dialogs.SimpleWaitingMessageBox();
256
257 if( !Functions.success )
258 {
259 Functions.success = ultimix.user.deactivate_success( ProgressDialogId , Ids , CheckboxGroupName );
260 }
261
262 ControllerOptions = {
263 'ids' : Ids , 'meta' : 'meta_admin_deactivate_user' , 'package_name' : 'user::user_controller'
264 };
265
266 ultimix.ajax_gate.direct_controller( ControllerOptions , Functions );
267 }
268
276 ultimix.user.deactivate_users = function( CheckboxGroupName )
277 {
278 if( !ultimix.grids.record_selected( CheckboxGroupName , 'at_least_one_record_must_be_selected' ) )
279 {
280 return;
281 }
282
283 var Ids = ultimix.grids.get_identificators( CheckboxGroupName );
284
285 ultimix.user.deactivate_users_ajax_request( {} , Ids , CheckboxGroupName );
286 }
287
297 ultimix.user.delete = function( Id , DataSelector )
298 {
299 ultimix.auto.delete(
300 Id , DataSelector ,
301 {
302 'package_name' : 'user::user_controller' ,
303 'user_context_action' : 'delete_record' ,
304 'user_action' : 'delete_record' , 'user_record_id' : Id ,
305 'meta' : 'meta_delete_user'
306 }
307 );
308 }
309
321 ultimix.user.record_view_form = function( Id , DataSelector )
322 {
323 ultimix.auto.record_view_form(
324 Id , DataSelector ,
325 {
326 'package_name' : 'user::user_view' , 'user_context_action' : 'record_view_form' ,
327 'user_action' : 'record_view_form' , 'user_record_id' : Id ,
328 'meta' : 'meta_record_view_user_form'
329 }
330 );
331 }
332