@@ -3,8 +3,14 @@ <h1><tmpl_var name="list_head_txt"></h1>
33</ div >
44< p > < tmpl _var name ="list_desc_txt "> </ p >
55
6-
7- < legend > Misc</ legend >
6+ < div class ="form-group ">
7+ < label for ="file " class ="col-sm-3 control-label "> {tmpl_var name='logo_txt'}</ label >
8+ < div class ="col-sm-3 col-text "> < input name ="file " id ="file " size ="30 " type ="file " class ="fileUpload " /> </ div > < div class ="col-sm-6 "> < button class ="btn btn-default formbutton-success " type ="button " value ="{tmpl_var name='btn_save_txt'} " id ="start_upload "> {tmpl_var name='upload_txt'}</ button > </ div >
9+ </ div >
10+ < div class ="form-group ">
11+ < label for ="dashboard_atom_url_admin " class ="col-sm-3 control-label "> {tmpl_var name='used_logo_txt'}</ label >
12+ < div class ="col-sm-9 " id ="used_logo "> {tmpl_var name='used_logo'}</ div >
13+ </ div >
814 < div class ="form-group ">
915 < label for ="dashboard_atom_url_admin " class ="col-sm-3 control-label "> {tmpl_var name='dashboard_atom_url_admin_txt'}</ label >
1016 < div class ="col-sm-9 "> < input type ="text " name ="dashboard_atom_url_admin " id ="dashboard_atom_url_admin " value ="{tmpl_var name='dashboard_atom_url_admin'} " size ="" maxlength ="" class ="form-control " /> </ div > </ div >
@@ -98,9 +104,83 @@ <h1><tmpl_var name="list_head_txt"></h1>
98104 {tmpl_var name='maintenance_mode'}
99105 </ div >
100106 </ div >
107+
108+ < tmpl _if name ="msg ">
109+ < div id ="OKMsg "> < p > < tmpl _var name ="msg "> </ p > </ div >
110+ </ tmpl _if>
111+ < tmpl _if name ="error ">
112+ < div id ="errorMsg "> < h3 > ERROR</ h3 > < ol > < tmpl _var name ="error "> </ ol > </ div >
113+ </ tmpl _if>
101114
102- < input type ="hidden " name ="id " value ="{tmpl_var name='id'} ">
115+ < input type ="hidden " name ="id " id =" id " value ="{tmpl_var name='id'} ">
103116 < div class ="clear "> < div class ="right ">
104117 < button class ="btn btn-default formbutton-success " type ="button " value ="{tmpl_var name='btn_save_txt'} " data-submit-form ="pageForm " data-form-action ="admin/system_config_edit.php "> {tmpl_var name='btn_save_txt'}</ button >
105118 < button class ="btn btn-default formbutton-default " type ="button " value ="{tmpl_var name='btn_cancel_txt'} " data-load-content ="admin/server_list.php "> {tmpl_var name='btn_cancel_txt'}</ button >
106- </ div > </ div >
119+ </ div > </ div >
120+ < script language ="JavaScript " type ="text/javascript ">
121+ var defaultLogo = '{tmpl_var name=' default_logo '}' ;
122+ $ ( document ) . on ( 'click' , '#del_custom_logo' , function ( ) {
123+ delCustomLogo ( ) ;
124+ } ) ;
125+
126+ function delCustomLogo ( ) {
127+ var id = jQuery ( 'input[name="id"]' ) . val ( ) ;
128+
129+ jQuery . getJSON ( 'admin/ajax_get_json.php' + '?' + Math . round ( new Date ( ) . getTime ( ) ) , { 'id' : id , 'type' : "delcustomlogo" } , function ( data ) {
130+ //console.log(data);
131+ $ ( '#used_logo' ) . html ( defaultLogo ) ;
132+ $ ( '#logo' ) . css ( { "background" : "url(" + data . data + ") no-repeat" , "width" : data . width , "height" : data . height } ) ;
133+ } ) ;
134+ }
135+
136+ // Variable to store your files
137+ var files ;
138+ // Add events
139+ $ ( 'input[type="file"]' ) . on ( 'change' , prepareUpload ) ;
140+ $ ( '#start_upload' ) . on ( 'click' , uploadFiles ) ;
141+
142+ // Grab the files and set them to our variable
143+ function prepareUpload ( event ) {
144+ files = event . target . files ;
145+ }
146+
147+ // Catch the form submit and upload the files
148+ function uploadFiles ( event ) {
149+ event . stopPropagation ( ) ; // Stop stuff happening
150+ event . preventDefault ( ) ; // Totally stop stuff happening
151+
152+ var id = jQuery ( 'input[name="id"]' ) . val ( ) ;
153+
154+ // Create a formdata object and add the files
155+ var data = new FormData ( ) ;
156+ $ . each ( files , function ( key , value ) {
157+ data . append ( key , value ) ;
158+ } ) ;
159+
160+ $ . ajax ( {
161+ url : 'admin/ajax_get_json.php?id=' + id + '&type=uploadfile' ,
162+ type : 'POST' ,
163+ data : data ,
164+ cache : false ,
165+ dataType : 'json' ,
166+ processData : false , // Don't process the files
167+ contentType : false , // Set content type to false as jQuery will tell the server its a query string request
168+ success : function ( data , textStatus , jqXHR ) {
169+ if ( typeof data . error === 'undefined' ) {
170+ // Success so call function to process the form
171+ //console.log(data);
172+ $ ( '#used_logo' ) . html ( '<img src="' + data . data + '" /> <a href="#" class="btn btn-default formbutton-danger formbutton-narrow" style="margin:5px" id="del_custom_logo"><span class="icon icon-delete"></span></a>' ) ;
173+ $ ( '#logo' ) . css ( { "background" : "url(" + data . data + ") no-repeat" , "width" : data . width , "height" : data . height } ) ;
174+ } else {
175+ // Handle errors here
176+ //console.log(data);
177+ }
178+ } ,
179+ error : function ( jqXHR , textStatus , errorThrown ) {
180+ // Handle errors here
181+ //console.log(data);
182+ }
183+ } ) ;
184+ }
185+
186+ </ script >
0 commit comments