Skip to content

Commit 3bdafc1

Browse files
committed
cleanup code for database restore dialog. Remove some javascript warns on IDE
1 parent 87b5ae0 commit 3bdafc1

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

agility/scripts/admin.js.php

+12-9
Original file line numberDiff line numberDiff line change
@@ -250,19 +250,21 @@ function restoreDatabase(fromClient){
250250
var l2='<?php _e("This operation <strong>WILL ERASE <em>EVERY</em> CURRENT DATA</strong>. before trying restore<br/>"); ?>';
251251
var l3='<?php _e("Be aware of making a backup copy before continue<br/><br/>"); ?>';
252252
var l4='<?php _e("To continue enter administrator password and press <em>Accept</em>"); ?>';
253-
var title='<?php _e('DataBase restore'); ?>';
253+
var titl='<?php _e('DataBase restore'); ?>';
254254
if (fromClient) {
255255
// use file selected from user
256-
if ($('#tools-restoreFile').val()=="") {
256+
if ($('#tools-restoreFile').val()==="") {
257257
$.messager.alert("Restore",'<?php _e("You should specify an <em>.sql</em> file with a previous backup"); ?>',"error");
258258
return false;
259259
}
260260
} else {
261-
title='<?php _e('DataBase update'); ?>';
261+
titl='<?php _e('DataBase update'); ?>';
262262
}
263-
$.messager.password(title,l1+l2+l3+l4 , function(pass){
264-
if (pass){
265-
// comprobamos si el password es correcto
263+
$.messager.password(
264+
titl,
265+
l1+l2+l3+l4,
266+
function(pass){
267+
if (!pass) return false;// comprobamos si el password es correcto
266268
checkPassword(ac_authInfo.Login,pass,function(data) {
267269
if (data.errorMsg) {
268270
// error en comprobación de password
@@ -346,9 +348,10 @@ function getProgress(){
346348
});
347349

348350
if (fromClient) {
351+
let tupl=$('#tools-uploader');
349352
// upload local database file
350353
// incicializamos el uploader
351-
$('#tools-uploader').fileUploader( {
354+
tupl.fileUploader( {
352355
selector: '#tools-restoreFile', // ID of "file" input field
353356
button: null, // ID of submit button
354357
progress: setProgressValue, // ID or function to send upload progress info to
@@ -367,7 +370,7 @@ function getProgress(){
367370
});
368371

369372
// arrancamos el proceso de restore
370-
$('#tools-uploader').fileUploader('upload');
373+
tupl.fileUploader('upload');
371374
} else {
372375
// download database from master server
373376
doRestore();
@@ -377,7 +380,7 @@ function getProgress(){
377380
}
378381
});
379382
}
380-
}).window('resize',{width:640});
383+
).window('resize',{width:450});
381384
}
382385

383386
function clearDatabase(){

agility/scripts/common.js.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ function loadConfiguration(callback) {
499499
$('#mylogo_release').html(ac_config.version_date);
500500

501501
// extra configuration data to speedup
502-
ac_config.numdecs=(ac_config.crono_milliseconds=="0")?2:3;
502+
ac_config.numdecs=(parseInt(ac_config.crono_milliseconds)===0)?2:3;
503503
ac_config.dogInRing=false; // to be used in videowall and livestream to show dog info and timings
504504

505505
// auto-backup related variables

agility/scripts/easyui-patches.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ $.extend($.fn.datagrid.methods, {
259259
return win;
260260
};
261261
$.messager.password =function(title,msg,fn){
262-
var content="<div class=\"messager-icon messager-warning\"></div>"+
263-
"<div>"+msg+"</div>"+"<br />"+"<div style=\"clear:both;\"/>"+
264-
"<div><input class=\"messager-input\" type=\"password\"/></div>";
262+
var content='<div class="messager-icon messager-warning"></div>'+
263+
'<div>'+msg+'</div><br /><div style="clear:both;"/>'+
264+
'<div><input class="messager-input" type="password" style="width:50%"/></div>';
265265
var buttons={};
266266
buttons[$.messager.defaults.ok]=function(){
267267
win.window('close');
@@ -273,14 +273,15 @@ $.extend($.fn.datagrid.methods, {
273273
return false;
274274
};
275275
var win=createDialog(title,content,buttons);
276+
// seems that onchange is also fired when focus lost, so comment it
276277
// when enter is pressed in input box, assume "Accept" button
277-
$(".messager-input",win).change(
278-
function(){
279-
win.window('close');
280-
if (fn) { fn($(".messager-input",win).val()); }
281-
return false;
282-
}
283-
);
278+
// $(".messager-input",win).change(
279+
// function(){
280+
// win.window('close');
281+
// if (fn) { fn($(".messager-input",win).val()); }
282+
// return false;
283+
// }
284+
// );
284285
win.find("input.messager-input").focus();
285286
return win;
286287
}

0 commit comments

Comments
 (0)