Files
matrix/cygnus-onprem-app/build/WebContent/js/appjs/uploaddownload.js

124 lines
3.1 KiB
JavaScript

var curindx=0;
var maxrow=0;
var timestamp='';
function StartDownload()
{
if(checkForm())
{
SubmitForm("startupload", "_parent", "uploadsettings");
}
}
function StartExcelDownload()
{
if(checkForm())
{
SubmitForm("startexcelupload", "_parent", "uploadsettings");
}
}
function InitPage()
{
maxrow=$('#tabbody tr').length-1;
$('#tabbody tr').click(function (event) {
rindx=$(this).index();
if(event.target.id != "chkrow"+rindx)
{
if($("#chkrow"+rindx).attr("checked")=="checked")
{
$(this).removeClass('rowhover');
$("#chkrow"+rindx).attr("checked",false);
}
else
{
$(this).addClass('rowhover');
$("#chkrow"+rindx).attr("checked",true);
}
checkList("chkrow","selall");
}
});
}
function manageRowSelection()
{
$("#tabbody tr").each(function(){
rindx=$(this).index();
if($("#chkrow"+rindx).attr("checked")=="checked")
{
$(this).addClass('rowhover');
}
else
{
$(this).removeClass('rowhover');
}
});
}
function StartProcess()
{
var d=new Date();
timestamp=d.getFullYear()+"-";
timestamp=timestamp+(d.getMonth()<=8 ? ("0"+(d.getMonth()+1)) : (d.getMonth()+1)) +"-";
timestamp=timestamp+(d.getDate()<=8 ? ("0"+(d.getDate())) : d.getDate()) +"TmS";
timestamp=timestamp+(d.getHours()<=9 ? ("0"+d.getHours()) : d.getHours()) +":";
timestamp=timestamp+(d.getMinutes()<=9 ? ("0"+d.getMinutes()) : d.getMinutes()) +":";
timestamp=timestamp+(d.getSeconds()<=9 ? ("0"+d.getSeconds()) : d.getSeconds());
UploadReports();
}
function UploadReports()
{
if(curindx<=maxrow)
{
$("#btnupload").hide();
if($("#chkrow"+curindx).length > 0)
{
var chk=$("#chkrow"+curindx);
if($(chk).attr("checked")=="checked")
{
$("#td"+curindx).html("<img src='/matrix/images/loading_small.gif' width='16' height='7' title='please wait, it will take few minutes' />");
var dname=$("#domainname").val();
var url=$("#url").val();
var key=$("#key").val();
var key1=$("#key1").val();
var uuid=$("#uuid"+curindx).val();
var ftu=$("#rep"+curindx).attr("href");
var ocid=$("#ocid"+curindx).val();
var urlkey=$("#urlkey").val();
var qid=$("#queryid").val();
var uid=$("#uid").val();
var meth=$("#method").val();
var tpq=$("#tpquery").val();
var sip=$("#serverip").val();
RunAjax("POST","uploadreports","val0="+dname+"&val1="+url+"&val2="+key+"&val3="+key1+"&val4="+uuid+"&val5="+ftu+"&val6="+ocid+"&val8="+timestamp+"&val9="+urlkey+"&val10="+qid+"&val11="+uid+"&val12="+meth+"&val13="+tpq+"&val14="+sip,2);
}
else
{
curindx=curindx+1;
UploadReports();
}
}
else
{
curindx=curindx+1;
UploadReports();
}
}
else
{
$("#btnupload").show();
curindx=0;
}
}
function AfterResponse(response,oprID)
{
if(oprID==2)
{
if(response.trim().search("success")>=0)
{
$("#td"+curindx).html("<img src='/matrix/images/check.png' title='success' />");
}
else
{
$("#td"+curindx).html("<img src='/matrix/images/exclm_red.png' title='"+response+"' />");
}
curindx=curindx+1;
UploadReports();
}
}