ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

permits.js
Go to the documentation of this file.
1
6 if( !ultimix )
7 {
8 ultimix = {};
9 }
10
16 if( !ultimix.permit )
17 {
18 ultimix.permit = {};
19 }
20
30 ultimix.permit.SuccessFunction = function( Data , Waiting )
31 {
32 return(
33 function( Result )
34 {
35 if( Result == ultimix.std_dialogs.MB_YES )
36 {
37 ultimix.data_form.AddDataToForm( Data );
38 document.getElementById( 'data_form' ).submit();
39 if( Waiting )
40 {
41 ultimix.std_dialogs.MessageBox(
42 ultimix.get_string( 'wait_please' ) , ultimix.get_string( 'Info' ) ,
43 ultimix.std_dialogs.MB_ICONLOADING | ultimix.std_dialogs.MB_MODAL
44 );
45 }
46 }
47 }
48 );
49 }
50
66 ultimix.permit.SubmitPermitButton = function( Permit , MasterId , MasterType , Checkboxes , Action )
67 {
68 ultimix.data_form.CreateForm();
69
70 if( Checkboxes != '' )
71 {
72 if( !ultimix.grids.record_selected( Checkboxes , 'at_least_one_record_must_be_selected' ) )
73 {
74 return;
75 }
76 var ids = ultimix.grids.get_identificators( Checkboxes );
77 var Data = { 'permit' : Permit , 'master_id' : MasterId , 'master_type' : MasterType , 'ids' : ids };
78 }
79 else
80 {
81 var Data = { 'permit' : Permit , 'master_id' : MasterId , 'master_type' : MasterType };
82 }
83 Data[ Action ] = 1;
84
85 var Success = ultimix.permit.SuccessFunction( Data , true );
86 ultimix.std_dialogs.QuestionMessageBox( ultimix.get_string( 'are_you_shure' ) , Success )
87 }
88
102 ultimix.permit.SetPermitButton = function( Permit , MasterId , MasterType , Checkboxes )
103 {
104 ultimix.permit.SubmitPermitButton( Permit , MasterId , MasterType , Checkboxes , 'set_permit' );
105 }
106
120 ultimix.permit.TogglePermitButton = function( Permit , MasterId , MasterType , Checkboxes )
121 {
122 ultimix.permit.SubmitPermitButton( Permit , MasterId , MasterType , Checkboxes , 'toggle_permit' );
123 }
124
138 ultimix.permit.DeletePermitButton = function( Permit , MasterId , MasterType , Checkboxes )
139 {
140 ultimix.permit.SubmitPermitButton( Permit , MasterId , MasterType , Checkboxes , 'delete_permit' );
141 }
142
148 function AddPermit( PermitName )
149 {
150 if( PermitName != '' )
151 {
152 document.getElementById( 'permit_list' ).removeChild( document.getElementById( PermitName + '_div_id_rest' ) );
153 document.getElementById( 'all_permits_div_id' ).innerHTML +=
154 "<div class='double_panel_row no_selection_text' id='" + PermitName + "_div_id'></div>";
155 document.getElementById( PermitName + '_div_id' ).innerHTML += "<input type='hidden' id='" + PermitName +
156 "_field_id' name='permits[]' value='" + PermitName + "'><a href=\"javascript:DeletePermit( '" +
157 PermitName + "' );\">" + PermitName + "</a><br>";
158 }
159 }
160
166 function DeletePermit( PermitName )
167 {
168 if( PermitName != '' )
169 {
170 document.getElementById( 'all_permits_div_id' ).removeChild(
171 document.getElementById( PermitName + '_div_id' )
172 );
173 document.getElementById( 'permit_list' ).innerHTML += "<div class='double_panel_row no_selection_text' id='" +
174 PermitName + "_div_id_rest'></div>";
175 document.getElementById( PermitName + '_div_id_rest' ).innerHTML += " <a href=\"javascript:AddPermit( '" +
176 PermitName + "' );\">" + PermitName + "</a><br>";
177 }
178 }