ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

grids.js
Go to the documentation of this file.
1
6 if( !ultimix )
7 {
8 ultimix = {};
9 }
10
16 if( !ultimix.grids )
17 {
18 ultimix.grids = {};
19 }
20
32 ultimix.grids.record_selected = function( Name , ErrorMessage )
33 {
34 return( ultimix.grids.record_selected_ex( '._' + Name + '_item_checkbox' , ErrorMessage ) );
35 }
36
46 ultimix.grids.set_checkboxes = function( Name , Value )
47 {
48 jQuery( '._' + Name + '_item_checkbox' ).prop( 'checked' , Value );
49 jQuery( '._' + Name + '_header_checkbox' ).prop( 'checked' , Value );
50 }
51
63 ultimix.grids.record_selected_ex = function( Selector , ErrorMessage )
64 {
65 var Items = jQuery( Selector );
66
67 for( i = 0 ; i < Items.length ; i++ )
68 {
69 if( jQuery( Items[ i ] ).prop( 'checked' ) )
70 {
71 return( true );
72 }
73 }
74
75 if( ErrorMessage )
76 {
77 ultimix.std_dialogs.ErrorMessageBox( ErrorMessage );
78 }
79
80 return( false );
81 }
82
92 ultimix.grids.get_identificators = function( Name )
93 {
94 return( ultimix.grids.get_identificators_ex( '._' + Name + '_item_checkbox' ) );
95 }
96
106 ultimix.grids.get_identificators_ex = function( Selector )
107 {
108 var Identificators = new Array();
109
110 var Items = jQuery( Selector );
111
112 for( var i = 0 ; i < Items.length ; i++ )
113 {
114 if( jQuery( Items[ i ] ).prop( 'checked' ) )
115 {
116 Identificators.push( ( new String( jQuery( Items[ i ] ).attr( 'id' ) ) ).replace( '_id_' , '' ) );
117 }
118 }
119
120 return( Identificators );
121 }
122
130 ultimix.grids.ToggleChildrenCheckboxes = function( Checkbox )
131 {
132 var ChildrenSelector = jQuery( Checkbox ).attr( 'children_selector' );
133
134 var Checked = jQuery( Checkbox ).prop( 'checked' );
135
136 jQuery( ChildrenSelector ).each(
137 function()
138 {
139 jQuery( this ).prop( 'checked' , Checked );
140
141 /* if has children */
142 if( jQuery( this ).attr( 'children_selector' ) )
143 {
144 /* ... then toggle children */
145 ultimix.grids.ToggleChildrenCheckboxes( this );
146 }
147 }
148 );
149 }
150
160 ultimix.grids.toggle_parent = function( ParentSelector , Checked )
161 {
162 jQuery( ParentSelector ).each(
163 function()
164 {
165 jQuery( this ).prop( 'checked' , Checked );
166 ultimix.grids.TryToggleParentCheckbox( this );
167 }
168 );
169 }
170
178 ultimix.grids.TryToggleParentCheckbox = function( Checkbox )
179 {
180 var ParentSelector = jQuery( Checkbox ).attr( 'parent_selector' );
181 if( ParentSelector )
182 {
183 /* try to toggle it */
184 var Checked = jQuery( Checkbox ).prop( 'checked' );
185 if( Checked )
186 {
187 var SiblingsSelector = jQuery( Checkbox ).attr( 'siblings_selector' );
188 if( jQuery( SiblingsSelector ).length == jQuery( SiblingsSelector ).filter( ':checked' ).length )
189 {
190 ultimix.grids.toggle_parent( ParentSelector , Checked );
191 }
192 }
193 else
194 {
195 ultimix.grids.toggle_parent( ParentSelector , Checked );
196 }
197 }
198 }
199
207 ultimix.grids.ProcessLinkedCheckboxes = function( Checkbox )
208 {
209 ultimix.grids.ToggleChildrenCheckboxes( Checkbox );
210 ultimix.grids.TryToggleParentCheckbox( Checkbox );
211 }
212
232 ultimix.grids.SubmitForm0Mass = function( FormId , ConfirmString , Action , Name , NotSelectedErrorMessage ,
233 Waiting , Method )
234 {
235 if( ultimix.grids.record_selected( Name ) == false )
236 {
237 ultimix.std_dialogs.ErrorMessageBox( NotSelectedErrorMessage );
238 return;
239 }
240
241 ultimix.forms.submit_form_0( FormId , ConfirmString , Action , Waiting , Method );
242 }
243
267 ultimix.grids.SubmitForm1Mass = function( FormId , Param1, Value1 , ConfirmString , Action , Name ,
268 NotSelectedErrorMessage , Waiting , Method )
269 {
270 if( ultimix.grids.record_selected( Name ) == false )
271 {
272 ultimix.std_dialogs.ErrorMessageBox( NotSelectedErrorMessage );
273 return;
274 }
275
276 ultimix.forms.submit_form_1( FormId , Param1, Value1 , ConfirmString , Action , Waiting , Method );
277 }
278
306 ultimix.grids.SubmitForm2Mass = function( FormId , Param1, Value1 , Param2, Value2 , ConfirmString , Action , Name ,
307 NotSelectedErrorMessage , Waiting , Method )
308 {
309 if( ultimix.grids.record_selected( Name ) == false )
310 {
311 ultimix.std_dialogs.ErrorMessageBox( NotSelectedErrorMessage );
312 return;
313 }
314
315 ultimix.forms.submit_form_2( FormId , Param1, Value1 , Param2, Value2 , ConfirmString , Action , Waiting );
316 }
317
349 ultimix.grids.SubmitForm3Mass = function( FormId , Param1, Value1 , Param2, Value2 , Param3, Value3 , ConfirmString ,
350 Action , Name , NotSelectedErrorMessage , Waiting , Method )
351 {
352 if( ultimix.grids.record_selected( Name ) == false )
353 {
354 ultimix.std_dialogs.ErrorMessageBox( NotSelectedErrorMessage );
355 return;
356 }
357
358 ultimix.forms.submit_form_3(
359 FormId , Param1, Value1 , Param2, Value2 , Param3, Value3 , ConfirmString , Action , Waiting
360 );
361 }