ultimix
file_input_view.js
Go to the documentation of this file.
1 
6 if( !ultimix )
7 {
8  ultimix = {};
9 }
10 
16 if( !ultimix.file_input )
17 {
18  ultimix.file_input = {};
19 }
20 
30 ultimix.file_input.set_single_uploaded_file_info = function( ServerData , ControlSettings )
31 {
32  eval( "var ServerDataObject=" + ServerData );
33 
34  jQuery( '#' + ControlSettings.statusAcceptor ).html(
35  ServerDataObject.original_file_name
36  );
37 
38  jQuery( '#' + ControlSettings.dataAcceptor ).html(
39  "<input type=\"hidden\" name=\"" + ControlSettings.name + "\" value=\"" + ServerDataObject.id + "\">" +
40  "<input type=\"hidden\" name=\"visible_" + ControlSettings.name + "\" value=\"" +
41  ServerDataObject.original_file_name+ "\">"
42  );
43 }
44 
56 ultimix_file_input_view_after_image_upload_processor = function( File , ServerData , ReceivedResponse )
57 {
58  try
59  {
60  var Progress = new FileProgress( File , this.customSettings.progressTarget );
61 
62  Progress.setComplete();
63  Progress.setStatus( ultimix.get_string( 'complete' ) );
64  Progress.toggleCancel( false );
65 
66  eval( "var ServerDataObject=" + ServerData );
67 
68  ultimix_file_input_view_after_image_upload_processor.store_file_info(
69  this , ServerDataObject.original_file_name , ServerDataObject.href , ServerDataObject.id
70  );
71  }
72  catch( ex )
73  {
74  this.debug( ex );
75  }
76 }
77 
91 ultimix_file_input_view_after_image_upload_processor.store_file_info = function( Obj , Name , Path , Id )
92 {
93  if( !Name || !Path || !Id )
94  {
95  return;
96  }
97 
98  jQuery( '#' + Obj.customSettings.statusAcceptor ).html(
99  '<img width="320" src="' + Path + '">'
100  );
101 
102  jQuery( '#' + Obj.customSettings.dataAcceptor ).html(
103  "<input type=\"hidden\" name=\"" + Obj.customSettings.name + "\" value=\"" + Id + "\">" +
104  "<input type=\"hidden\" name=\"" + Obj.customSettings.name + "_name\" value=\"" + Name + "\">" +
105  "<input type=\"hidden\" name=\"" + Obj.customSettings.name + "_path\" value=\"" + Path + "\">"
106  );
107 }
108 
118 ultimix.file_input.set_default_options = function( ViewOptions )
119 {
120  if( !ViewOptions )
121  {
122  ViewOptions = {};
123  }
124 
125  ViewOptions.meta = ViewOptions.meta ? ViewOptions.meta : 'meta_file_input_list';
126  ViewOptions.package_name = ViewOptions.package_name ? ViewOptions.package_name : 'file_input::file_input_view';
127  ViewOptions.paging_require_form = ViewOptions.paging_require_form ? ViewOptions.paging_require_form : '0';
128  ViewOptions.add_hidden_fields = ViewOptions.add_hidden_fields ? ViewOptions.add_hidden_fields : '0';
129 
130  return( ViewOptions );
131 }
132 
142 ultimix.file_input.get_list_form = function( Fuctions , ViewOptions )
143 {
144  if( !Fuctions )
145  {
146  Fuctions = {};
147  }
148 
149  ViewOptions = ultimix.file_input.set_default_options( ViewOptions );
150 
151  ultimix.ajax_gate.direct_view( ViewOptions , Fuctions );
152 }
153 
169 ultimix.file_input.get_custom_list_form = function( Fuctions , Header , Item , Footer , ViewOptions )
170 {
171  ultimix.auto.get_custom_list_form( Fuctions , Header , Item , Footer , false , ViewOptions , 'ad_banner' );
172 }
173 
183 ultimix.file_input.delete = function( Id , DataSelector )
184 {
185  ultimix.auto.delete(
186  Id , DataSelector ,
187  {
188  'package_name' : 'file_input::file_input_controller' ,
189  'file_input_context_action' : 'delete_record' ,
190  'file_input_action' : 'delete_record' , 'file_input_record_id' : Id ,
191  'meta' : 'meta_delete_file_input'
192  }
193  );
194 }
195 
207 ultimix.file_input.record_view_form = function( Id , DataSelector )
208 {
209  ultimix.auto.record_view_form(
210  Id , DataSelector ,
211  {
212  'package_name' : 'file_input::file_input_view' , 'file_input_context_action' : 'record_view_form' ,
213  'file_input_action' : 'record_view_form' , 'file_input_record_id' : Id ,
214  'meta' : 'meta_record_view_file_input_form'
215  }
216  );
217 }
218