570 lines
17 KiB
HTML
570 lines
17 KiB
HTML
<div style="height:210px;background-color:#f2f2f2;width:550px;">
|
|
<table id="fw_update_list" class="table table-classic table-hover" width="550">
|
|
<thead>
|
|
<tr>
|
|
<th width="220" id="fw_type">Type</th>
|
|
<th width="*" id="fw_filename">File Name</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody></tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<script data-jui="#fw_update_list" data-tpl="row" type="text/template">
|
|
<tr style="text-align:center;cursor:pointer;" style="width:550px;">
|
|
<td><!=Type !></td>
|
|
<td><!=File !></td>
|
|
</tr>
|
|
</script>
|
|
|
|
<script data-jui="#fw_update_list" data-tpl="none" type="text/template">
|
|
<tr>
|
|
<td colspan="2" class="none" style="text-align:center;height:180px;width:550px;"> </td>
|
|
</tr>
|
|
</script>
|
|
<div style="position:relative;left:0px;top:10px;"><i class="icon-help" style="color:gray;font-size: 20px; float:left; vertical-align:middle;" id="icon_fw_update_list"></i></div>
|
|
<div style="width:550px;text-align:right;padding: 10px 0 10px 0;">
|
|
<!-- <a class="btn" id="btn_fw_update">F/W Update</a> -->
|
|
<a class="btn btn-gray" style="float:left; left:10px" id="btn_fw_file_delete">File Delete</a>
|
|
<a class="btn btn-gray" id="btn_fw_file_upload">File Upload</a>
|
|
<a class="btn btn-gray" onclick="fnGetFWUpdateList();" id="fw_refresh">Refresh</a>
|
|
</div>
|
|
|
|
<div style="height:340px;background-color:#f2f2f2;">
|
|
<table id="fw_update_status_list" class="table table-classic table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th width="150" id="fw_list_type">Type</th>
|
|
<th width="*" id="fw_list_total">Total</th>
|
|
<th width="100" id="fw_list_connected">Connected</th>
|
|
<th width="100" id="fw_list_disconnected">Disconnected</th>
|
|
<th width="100" id="fw_list_removed">Removed</th>
|
|
<th width="100" id="fw_list_busy">Busy</th>
|
|
<th width="150" id="fw_list_in_progress">In Progress</th>
|
|
<th width="150" id="fw_list_at_gateway">At Gateway</th>
|
|
<th width="150" id="fw_list_success">Success</th>
|
|
<th width="100" id="fw_list_waiting">Waiting</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody></tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<script data-jui="#fw_update_status_list" data-tpl="row" type="text/template">
|
|
<tr style="text-align:center;">
|
|
<td><!=Type !></td>
|
|
<td><!=Total !></td>
|
|
<td><!=Connected !></td>
|
|
<td><!=Disconnected !></td>
|
|
<td><!=Removed !></td>
|
|
<td><!=Busy !></td>
|
|
<td><!=In_Progress !></td>
|
|
<td><!=At_Gateway !></td>
|
|
<td><!=Success !></td>
|
|
<td><!=Waiting !></td>
|
|
</tr>
|
|
</script>
|
|
|
|
<script data-jui="#fw_update_status_list" data-tpl="none" type="text/template">
|
|
<tr>
|
|
<td colspan="10" class="none" style="text-align:center;height:310px;width:1280px;"> </td>
|
|
</tr>
|
|
</script>
|
|
<div style="position:relative;left:0px;top:10px;"><i class="icon-help" style="color:gray;font-size: 20px; float:left; vertical-align:middle;" id="icon_fw_update_status_list"></i></div>
|
|
<div style="text-align:right;padding-top:10px;">
|
|
<a class="btn btn-gray" onclick="fnGetFWUpdateStatusList();" id="fw_list_refresh">Refresh</a>
|
|
</div>
|
|
|
|
<div id="fw_upload_window" class="window window-white">
|
|
<div class="panel">
|
|
<div class="head" id="fwupdate_upload">F/W File Upload</div>
|
|
<div class="body">
|
|
<form name="frmFWReg" id="frmFWReg">
|
|
<div style="padding-bottom:5px;">
|
|
<label class="label label-small" style="width:80px;" id="fwupdate_upload_type">Type</label>
|
|
<input type="text" name="fw_upload_type" id="fw_upload_type" value="" class="input input-small input-rect" style="width:200px;" readonly="readonly" /><br />
|
|
</div>
|
|
|
|
<div style="padding-bottom:5px;">
|
|
<label class="label label-small" style="width:80px;" id="fwupdate_upload_file">File</label>
|
|
<input type="file" name="fw_file" id="fw_file" class="input-mini input-rect""/><br />
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="foot" align="center">
|
|
<a href="#" class="btn btn-gray" id="btn_fw_upload_save">Save</a>
|
|
<a href="#" class="btn btn-gray" id="btn_fw_upload_close">Close</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
var fw_update_list
|
|
, fw_update_loading
|
|
, fw_update_status_list
|
|
, fw_update_status_loading
|
|
, fw_upload_window
|
|
, fw_upload_window_loading
|
|
, fw_upload_window_left;
|
|
jui.ready(['uix.table'], function(table) {
|
|
fw_update_list = table('#fw_update_list', {
|
|
scroll: true
|
|
, scrollHeight: 182
|
|
, resize: true
|
|
, event: {
|
|
click: function(row, e) {
|
|
this.uncheckAll();
|
|
this.check(row.index);
|
|
}
|
|
}
|
|
});
|
|
fw_update_status_list = table('#fw_update_status_list', {
|
|
scroll: true
|
|
, scrollHeight: 310
|
|
, resize: true
|
|
});
|
|
});
|
|
|
|
jui.ready([ "ui.modal" ], function(modal) {
|
|
fw_update_loading = modal('#loading', {
|
|
target: '#fw_update_list',
|
|
opacity: 0.1,
|
|
autoHide: false
|
|
});
|
|
|
|
fw_update_status_loading = modal('#loading', {
|
|
target: '#fw_update_status_list',
|
|
opacity: 0.1,
|
|
autoHide: false
|
|
});
|
|
|
|
fw_upload_window_loading = modal('#loading', {
|
|
target: '#fw_upload_window > div.panel',
|
|
opacity: 0.1,
|
|
autoHide: false,
|
|
clone: true
|
|
});
|
|
});
|
|
|
|
jui.ready(['uix.window'], function(win) {
|
|
fw_upload_window = win('#fw_upload_window', {
|
|
width: 350
|
|
, height: 160
|
|
, modal: true
|
|
, modalIndex: 99999
|
|
});
|
|
});
|
|
jui.ready([ "ui.tooltip" ], function(tooltip) {
|
|
tooltip_icon_fw_update_list = tooltip("#icon_fw_update_list", {
|
|
position: "top",
|
|
width: 400,
|
|
align: "left",
|
|
title: locale.tooltip_icon_fw_update_list
|
|
});
|
|
tooltip_btn_fw_file_delete = tooltip("#btn_fw_file_delete", {
|
|
position: "top",
|
|
width: 400,
|
|
align: "left",
|
|
title: locale.tooltip_btn_fw_file_delete
|
|
});
|
|
|
|
tooltip_btn_fw_file_upload = tooltip("#btn_fw_file_upload", {
|
|
position: "top",
|
|
width: 400,
|
|
align: "left",
|
|
title: locale.tooltip_btn_fw_file_upload
|
|
});
|
|
tooltip_btn_fw_refresh = tooltip("#fw_refresh", {
|
|
position: "top",
|
|
width: 400,
|
|
align: "left",
|
|
title: locale.tooltip_btn_fw_refresh
|
|
});
|
|
tooltip_fw_list_refresh = tooltip("#fw_list_refresh", {
|
|
position: "top",
|
|
width: 400,
|
|
align: "left",
|
|
title: locale.tooltip_fw_list_refresh
|
|
});
|
|
});
|
|
jui.ready([ "ui.tooltip" ], function(tooltip) {
|
|
tooltip_icon_fw_update_status_list = tooltip("#icon_fw_update_status_list", {
|
|
position: "top",
|
|
width: 400,
|
|
align: "left",
|
|
title: locale.tooltip_icon_fw_update_status_list
|
|
});
|
|
});
|
|
function fnGetFWUpdateList() {
|
|
fw_update_loading.show();
|
|
$.ajax({
|
|
url: '/restapi/system/fwinfo'
|
|
, type: 'POST'
|
|
, data: {
|
|
}, success : function(json) {
|
|
fw_update_loading.hide();
|
|
fw_update_list.uncheckAll();
|
|
|
|
if(json.result.toLowerCase() == "invalid_token") {
|
|
document.location.replace('./index.html');
|
|
}else if(json.result.toLowerCase() == "success") {
|
|
json = json.data;
|
|
|
|
json.sort(function(a, b) {
|
|
return (a.Sort_ID < b.Sort_ID ? -1 : ((a.Sort_ID > b.Sort_ID) ? 1 : 0));
|
|
})
|
|
$.each(json, function (i, v) {
|
|
if (json[i]['Type'] == 'Gateway') {
|
|
json[i]['Type'] = 'Gateway (GWA_1XX~3XX)';
|
|
}else if (json[i]['Type'] == 'Gateway-Advanced') {
|
|
json[i]['Type'] = 'Gateway Advanced (GWB_XXX)';
|
|
}else if (json[i]['Type'] == 'Gateway-Advanced2') {
|
|
json[i]['Type'] = 'Gateway Advanced2 (GWA_4XX)';
|
|
}else if (json[i]['Type'] == 'Gateway2') {
|
|
json[i]['Type'] = 'Gateway2 (GWC_1XX)';
|
|
}
|
|
});
|
|
fw_update_list.update(json);
|
|
}
|
|
}, error:function(request,status,err){
|
|
fw_update_loading.hide();
|
|
if (request.status == 0) {
|
|
alertify.error(locale.server_not_run)
|
|
} else {
|
|
// alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+err);
|
|
alert(locale.service_error + "(" + request.status + ")");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function fnGetFWUpdateStatusList() {
|
|
fw_update_status_loading.show();
|
|
$.ajax({
|
|
url: '/restapi/system/fwstatus'
|
|
, type: 'POST'
|
|
, data: {
|
|
}, success : function(json) {
|
|
fw_update_status_loading.hide();
|
|
|
|
if(json.result.toLowerCase() == "invalid_token") {
|
|
document.location.replace('./index.html');
|
|
}else if(json.result.toLowerCase() == "success") {
|
|
json = json.data;
|
|
|
|
json.sort(function(a, b) {
|
|
return (a.Sort_ID < b.Sort_ID ? -1 : ((a.Sort_ID > b.Sort_ID) ? 1 : 0));
|
|
})
|
|
|
|
$.each(json, function (i, v) {
|
|
if (json[i]['Type'] == 'Total') {
|
|
json[i]['Type'] = locale.total;
|
|
}
|
|
else if (json[i]['Type'] == 'Gateway') {
|
|
json[i]['Type'] = locale.gateway;
|
|
}
|
|
});
|
|
|
|
fw_update_status_list.update(json);
|
|
}
|
|
}, error:function(request,status,err){
|
|
fw_update_status_loading.hide();
|
|
if (request.status == 0) {
|
|
alertify.error(locale.server_not_run);
|
|
} else {
|
|
// alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+err);
|
|
alert(locale.service_error + "(" + request.status + ")");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
$(function() {
|
|
fnGetFWUpdateList();
|
|
fnGetFWUpdateStatusList();
|
|
|
|
$('#btn_fw_upload_close').click(function() {
|
|
fw_upload_window.hide();
|
|
});
|
|
|
|
$('#btn_fw_file_delete').click(function() {
|
|
var obj = fw_update_list.listChecked();
|
|
if(obj.length <= 0) {
|
|
alertify.error(locale.no_selected);
|
|
return;
|
|
}
|
|
|
|
var type = obj[0].data.Type
|
|
, file = ' '
|
|
|
|
if (!type) {
|
|
fw_upload_window.hide();
|
|
alertify.error(locale.no_selected);
|
|
return;
|
|
}
|
|
oData = new FormData();
|
|
if (type == 'Gateway (GWA_1XX~3XX)') {
|
|
type = 'Gateway';
|
|
}else if (type == 'Gateway Advanced (GWB_XXX)') {
|
|
type = 'Gateway-Advanced';
|
|
}else if (type == 'Gateway Advanced2 (GWA_4XX)') {
|
|
type = 'Gateway-Advanced2';
|
|
}else if (type == 'Gateway2 (GWC_1XX)') {
|
|
type = 'Gateway2';
|
|
}
|
|
oData.append('type', type);
|
|
oData.append('file', '');
|
|
|
|
fw_upload_window_loading.show();
|
|
|
|
$.ajax({
|
|
url: '/restapi/system/fwupload',
|
|
type: "POST",
|
|
dataType: "text",
|
|
data: oData,
|
|
processData: false,
|
|
contentType: false,
|
|
success: function(data, textStatus, jqXHR) {
|
|
fw_upload_window_loading.hide();
|
|
var json = JSON.parse(data);
|
|
|
|
if(json.result.toLowerCase() == "invalid_token") {
|
|
document.location.replace('./index.html');
|
|
}else if(json.result.toLowerCase() == "success") {
|
|
fnGetFWUpdateList();
|
|
alertify.success(locale[json.result.toLowerCase()]);
|
|
}else {
|
|
alertify.error(locale[json.result.toLowerCase()]);
|
|
}
|
|
}, error: function(request,status,err) {
|
|
fw_upload_window_loading.hide();
|
|
if (request.status == 0) {
|
|
alertify.error(locale.server_not_run);
|
|
} else {
|
|
// alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+err);
|
|
alert(locale.service_error + "(" + request.status + ")");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
$('#btn_fw_file_upload').click(function() {
|
|
var obj = fw_update_list.listChecked();
|
|
if(obj.length <= 0) {
|
|
alertify.error(locale.no_selected);
|
|
return;
|
|
}
|
|
|
|
document.frmFWReg.fw_upload_type.value = obj[0].data.Type;
|
|
document.frmFWReg.fw_file.value = '';
|
|
|
|
fw_upload_window.show();
|
|
});
|
|
|
|
$('#btn_fw_update').click(function() {
|
|
var obj = fw_update_list.listChecked();
|
|
if(obj.length <= 0) {
|
|
alertify.error(locale.no_selected);
|
|
return;
|
|
}
|
|
|
|
if(!obj[0].data.File) {
|
|
//alert('No registered File.');
|
|
alertify.alert('Error','No registered File.');
|
|
return;
|
|
}
|
|
|
|
$.ajax({
|
|
url: '/restapi/system/fwupdate'
|
|
, type: 'POST'
|
|
, data: {
|
|
'type_b': obj[0].data.Type
|
|
}, success : function(json) {
|
|
|
|
}, error:function(request,status,err){
|
|
if (request.status == 0) {
|
|
alertify.error(locale.server_not_run);
|
|
} else {
|
|
// alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+err);
|
|
alert(locale.service_error + "(" + request.status + ")");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
$('#btn_fw_upload_save').click(function() {
|
|
//var fileObj = document.frmFWReg.fw_file;//document.getElementById("fw_file");
|
|
//alert(path);
|
|
//alert(fileObj.files[0].size);
|
|
/*if(fileObj.files[0].size < 5* 1024)
|
|
{
|
|
alertify.error(locale.invalid_file_size + "(" + fileObj.files[0].size + " Bytes)")
|
|
return;
|
|
}*/
|
|
|
|
var type = document.frmFWReg.fw_upload_type.value
|
|
, file = document.frmFWReg.fw_file.value
|
|
, file_name = file.substring(file.lastIndexOf('\\') + 1)
|
|
, oData
|
|
, cnt = 0;
|
|
|
|
if (!type) {
|
|
fw_upload_window.hide();
|
|
alertify.error(locale.no_selected);
|
|
return;
|
|
}
|
|
|
|
if (!file) {
|
|
fw_upload_window.hide();
|
|
alertify.alert('Error','There is no selected file.').
|
|
set({onshow:null, onclose:function(){
|
|
fw_upload_window.show();
|
|
}});
|
|
return;
|
|
}
|
|
|
|
var sizeinbytes = 0;
|
|
if(window.ActiveXObject){
|
|
var oas = new ActiveXObject("Scripting.FileSystemObject");
|
|
var filepath = document.getElementById('fw_file').value;
|
|
var filesize = oas.getFile(filepath);
|
|
sizeinbytes = filesize.size;
|
|
|
|
} else {
|
|
sizeinbytes = document.getElementById('fw_file').files[0].size;
|
|
|
|
}
|
|
|
|
$.each(fw_update_list.listData(), function(i, v) {
|
|
if(v.File) {
|
|
if (v.File == file_name && v.Type == type) {
|
|
cnt ++;
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
/*if (cnt > 0) {
|
|
fw_upload_window.hide();
|
|
alertify.confirm(locale.confirm,'Same name already exists.\n\n Do you want to overwrite it?', function (e) {
|
|
if (e) {
|
|
|
|
fw_upload_window.show();
|
|
oData = new FormData();
|
|
oData.append('type', type);
|
|
oData.append('file', document.getElementById('fw_file').files[0]);
|
|
|
|
fw_upload_window_loading.show();
|
|
|
|
$.ajax({
|
|
url: '/restapi/system/fwupload',
|
|
type: "POST",
|
|
dataType: "text",
|
|
data: oData,
|
|
processData: false,
|
|
contentType: false,
|
|
success: function(data, textStatus, jqXHR) {
|
|
fw_upload_window_loading.hide();
|
|
|
|
var json = JSON.parse(data);
|
|
//alert(json[0].result);
|
|
if(json[0].result.toLowerCase() != 'success') {
|
|
//alert(json[0].result);
|
|
alertify.error(locale[json[0].result.toLowerCase()]);
|
|
} else {
|
|
document.frmFWReg.fw_upload_type.value = '';
|
|
document.frmFWReg.fw_file.value = '';
|
|
fw_upload_window.hide();
|
|
fnGetFWUpdateList();
|
|
alertify.success(locale[json[0].result.toLowerCase()]);
|
|
}
|
|
}, error: function(request,status,err) {
|
|
fw_upload_window_loading.hide();
|
|
if (request.status == 0) {
|
|
alertify.error(locale.server_not_run);
|
|
} else {
|
|
alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+err);
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
fw_upload_window.show();
|
|
return;
|
|
}
|
|
}, null);
|
|
|
|
}
|
|
else
|
|
{*/
|
|
oData = new FormData();
|
|
if (type == 'Gateway (GWA_1XX~3XX)') {
|
|
type = 'Gateway';
|
|
}else if (type == 'Gateway Advanced (GWB_XXX)') {
|
|
type = 'Gateway-Advanced';
|
|
}else if (type == 'Gateway Advanced2 (GWA_4XX)') {
|
|
type = 'Gateway-Advanced2';
|
|
}else if (type == 'Gateway2 (GWC_1XX)') {
|
|
type = 'Gateway2';
|
|
}
|
|
oData.append('type', type);
|
|
oData.append('size', sizeinbytes);
|
|
oData.append('file', document.getElementById('fw_file').files[0]);
|
|
|
|
fw_upload_window_loading.show();
|
|
|
|
$.ajax({
|
|
url: '/restapi/system/fwupload',
|
|
type: "POST",
|
|
dataType: "text",
|
|
data: oData,
|
|
processData: false,
|
|
contentType: false,
|
|
success: function(data, textStatus, jqXHR) {
|
|
fw_upload_window_loading.hide();
|
|
var json = JSON.parse(data);
|
|
|
|
if(json.result.toLowerCase() == "invalid_token") {
|
|
document.location.replace('./index.html');
|
|
}else if(json.result.toLowerCase() == "success") {
|
|
document.frmFWReg.fw_upload_type.value = '';
|
|
document.frmFWReg.fw_file.value = '';
|
|
fw_upload_window.hide();
|
|
fnGetFWUpdateList();
|
|
alertify.success(locale[json.result.toLowerCase()]);
|
|
}else {
|
|
alertify.error(locale[json.result.toLowerCase()]);
|
|
}
|
|
}, error: function(request,status,err) {
|
|
fw_upload_window_loading.hide();
|
|
if (request.status == 0) {
|
|
alertify.error(locale.server_not_run);
|
|
} else {
|
|
// alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+err);
|
|
alert(locale.service_error + "(" + request.status + ")");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
$('#fw_type').text(locale.sw_type);
|
|
$('#fw_filename').text(locale.file_name);
|
|
$('#btn_fw_file_upload').text(locale.file_upload);
|
|
$('#btn_fw_file_delete').text(locale.delete);
|
|
$('#fw_refresh').text(locale.refresh);
|
|
$('#fw_list_type').text(locale.type);
|
|
$('#fw_list_total').text(locale.total);
|
|
$('#fw_list_connected').text(locale.connected);
|
|
$('#fw_list_disconnected').text(locale.disconnected);
|
|
$('#fw_list_removed').text(locale.removed);
|
|
$('#fw_list_busy').text(locale.busy);
|
|
$('#fw_list_in_progress').text(locale.in_progress);
|
|
$('#fw_list_at_gateway').text(locale.at_gateway);
|
|
$('#fw_list_success').text(locale.success);
|
|
$('#fw_list_waiting').text(locale.waiting);
|
|
$('#fw_list_refresh').text(locale.refresh);
|
|
$('#fwupdate_upload').text(locale.fwupdate_upload);
|
|
$('#fwupdate_upload_type').text(locale.sw_type);
|
|
$('#fwupdate_upload_file').text(locale.sw_file);
|
|
$('#btn_fw_upload_save').text(locale.save);
|
|
$('#btn_fw_upload_close').text(locale.close);
|
|
});
|
|
</script>
|