ultimix
group_view.js
Go to the documentation of this file.
1 
6 if( !ultimix )
7 {
8  ultimix = {};
9 }
10 
16 if( !ultimix.group )
17 {
18  ultimix.group = {};
19 }
20 
36 ultimix.permit.submit_group_button = function( Group , MasterId , MasterType , Checkboxes , Action )
37 {
38  ultimix.data_form.CreateForm();
39 
40  if( Checkboxes != '' )
41  {
42  if( !ultimix.grids.record_selected( Checkboxes , 'at_least_one_record_must_be_selected' ) )
43  {
44  return;
45  }
46 
47  var ids = ultimix.grids.get_identificators( Checkboxes );
48  var Data = { 'group' : Group , 'master_id' : MasterId , 'master_type' : MasterType , 'ids' : ids };
49  }
50  else
51  {
52  var Data = { 'group' : Group , 'master_id' : MasterId , 'master_type' : MasterType };
53  }
54 
55  Data[ Action ] = 1;
56 
57  var Success = ultimix.permit.success_function( Data , true );
58 
59  ultimix.std_dialogs.MessageBox( ultimix.get_string( 'are_you_shure' ) , ultimix.get_string( 'Question' ) ,
60  ultimix.std_dialogs.MB_YESNO | ultimix.std_dialogs.MB_ICONQUESTION | ultimix.std_dialogs.MB_MODAL , Success );
61  return;
62 
63  Success( ultimix.std_dialogs.MB_YES );
64 }
65 
79 ultimix.permit.set_group_button = function( Group , MasterId , MasterType , Checkboxes )
80 {
81  ultimix.permit.submit_group_button( Group , MasterId , MasterType , Checkboxes , 'set_group' );
82 }
83 
97 ultimix.permit.toggle_group_button = function( Group , MasterId , MasterType , Checkboxes )
98 {
99  ultimix.permit.submit_group_button( Group , MasterId , MasterType , Checkboxes , 'toggle_group' );
100 }
101 
115 ultimix.permit.delete_group_button = function( Group , MasterId , MasterType , Checkboxes )
116 {
117  ultimix.permit.submit_group_button( Group , MasterId , MasterType , Checkboxes , 'delete_group' );
118 }
119 
125 ultimix.permit.add_group = function( GroupName )
126 {
127  if( GroupName != '' )
128  {
129  document.getElementById( 'group_list' ).removeChild( document.getElementById( GroupName + '_div_id_rest' ) );
130  document.getElementById( 'all_groups_div_id' ).innerHTML +=
131  "<div class='double_panel_row no_selection_text' id='" + GroupName + "_div_id'></div>";
132  document.getElementById( GroupName + '_div_id' ).innerHTML += "<input type='hidden' id='" + GroupName +
133  "_field_id' name='groups[]' value='" + GroupName +
134  "'><a href=\"javascript:ultimix.permit.delete_group( '" + GroupName +
135  "' );\">" + GroupName + "</a><br>";
136  }
137 }
138 
144 ultimix.permit.delete_group = function( GroupName )
145 {
146  if( GroupName != '' )
147  {
148  document.getElementById( 'all_groups_div_id' ).removeChild( document.getElementById( GroupName + '_div_id' ) );
149  document.getElementById( 'group_list' ).innerHTML += "<div class='double_panel_row no_selection_text' id='" +
150  GroupName + "_div_id_rest'></div>";
151  document.getElementById( GroupName + '_div_id_rest' ).innerHTML += " <a href=\"javascript:AddGroup( '" +
152  GroupName + "' );\">" + GroupName + "</a><br>";
153  }
154 }
155 
165 ultimix.group.set_default_options = function( ViewOptions )
166 {
167  if( !ViewOptions )
168  {
169  ViewOptions = {};
170  }
171 
172  ViewOptions.meta = ViewOptions.meta ? ViewOptions.meta : 'meta_group_list';
173  ViewOptions.package_name = ViewOptions.package_name ? ViewOptions.package_name : 'permit::group_view';
174  ViewOptions.paging_require_form = ViewOptions.paging_require_form ? ViewOptions.paging_require_form : '0';
175  ViewOptions.add_hidden_fields = ViewOptions.add_hidden_fields ? ViewOptions.add_hidden_fields : '0';
176 
177  return( ViewOptions );
178 }
179 
189 ultimix.group.get_list_form = function( Fuctions , ViewOptions )
190 {
191  if( !Fuctions )
192  {
193  Fuctions = {};
194  }
195 
196  ViewOptions = ultimix.group.set_default_options( ViewOptions );
197 
198  ultimix.ajax_gate.direct_view( ViewOptions , Fuctions );
199 }
200 
216 ultimix.group.get_custom_list_form = function( Fuctions , Header , Item , Footer , ViewOptions )
217 {
218  ultimix.auto.get_custom_list_form( Fuctions , Header , Item , Footer , false , ViewOptions , 'ad_banner' );
219 }
220 
230 ultimix.group.delete = function( Id , DataSelector )
231 {
232  ultimix.auto.delete(
233  Id , DataSelector ,
234  {
235  'package_name' : 'permit::group_controller' ,
236  'group_context_action' : 'delete_record' ,
237  'group_action' : 'delete_record' , 'group_record_id' : Id ,
238  'meta' : 'meta_delete_group'
239  }
240  );
241 }
242 
254 ultimix.group.record_view_form = function( Id , DataSelector )
255 {
256  ultimix.auto.record_view_form(
257  Id , DataSelector ,
258  {
259  'package_name' : 'permit::group_view' , 'group_context_action' : 'record_view_form' ,
260  'group_action' : 'record_view_form' , 'group_record_id' : Id ,
261  'meta' : 'meta_record_view_group_form'
262  }
263  );
264 }