2806 lines
99 KiB
JavaScript
Executable File
2806 lines
99 KiB
JavaScript
Executable File
var clickedURL = null;
|
|
var actionRequired = 0;
|
|
var timeToPost = 120000; //2 Minutes (1sec=1000)
|
|
var timeForWatcher = 15000; //15 Seconds
|
|
var backupLocationValue = undefined;
|
|
var rootLevelEnabled = false;
|
|
var rootLevelVal = "/";
|
|
|
|
function updateBackupLocationValue() {
|
|
if(backupLocationValue != undefined && backupLocationValue != "undefined") {
|
|
$('#backupLocation').val(backupLocationValue);
|
|
backupLocationValue = undefined;
|
|
}
|
|
}
|
|
jQuery(window).bind('beforeunload', function(eventObject) {
|
|
if(clickedURL == 'preferences.php'){
|
|
if(preferenceChanged>0){
|
|
preferenceSettings();
|
|
return ""; //"Do you really want to close?";
|
|
}
|
|
}
|
|
|
|
if(clickedURL == 'trash.php' && searchStarted == true){
|
|
stopSearchExecution("trash");
|
|
return "";
|
|
}
|
|
if(actionRequired==2){
|
|
if(clickedURL == 'restore.php' && dedup==false) {
|
|
editJob('restore');
|
|
} else {
|
|
editJob('backup');
|
|
}
|
|
return ""; //"Do you really want to close?";
|
|
}
|
|
|
|
var archiveWindow = jQuery("#archiveWindow").val();
|
|
if(archiveWindow == "1")
|
|
{
|
|
if($("#Stop").is(':visible')){
|
|
archiveAjax.abort();
|
|
var url2="action.php?action=stopSearch&type=archive"; // calling stop archive while closing the archive popup.eventObject
|
|
$.post(url2,function(data){});
|
|
} else if($("#delete").is(':visible')){
|
|
var url2="action.php?action=stopSearch&type=removeArchivePid"; // calling stop archive to remove PID
|
|
$.post(url2,function(data){});
|
|
$("#archiveWindow").val("0");
|
|
$.popContainerHide();
|
|
showErrorMessages('.head_search .error_msg','Archive cleanup operation has been cancelled');
|
|
} else if($('#Deleting').is(':visible')){ /* calling stop delete while closing delete popup .*/
|
|
var url2="action.php?action=deleteCancel";
|
|
$.post(url2,function(data){});
|
|
}
|
|
postPeriodicCleanup();
|
|
return "";
|
|
}
|
|
});
|
|
|
|
/* Custom script for AJAX */
|
|
jQuery('.leftnav a, .sliding a, .right_menu a.restore_trash_menu, .menuOp a').live('click', function (event) {
|
|
|
|
if(jQuery(this).html()=='Help'){
|
|
return true;
|
|
}
|
|
var url = jQuery(this).attr('href');
|
|
|
|
if(url =="logout.php")
|
|
return true;
|
|
|
|
abortAjax(trashAjaxCall);
|
|
abortAjax(trashAjaxCall2);
|
|
abortAjax(searchAjaxRequest2);
|
|
loadSearchTimout = '';
|
|
loadTrashTimout = '';
|
|
|
|
event.preventDefault();
|
|
clearInterval(logsTimeoutVar);
|
|
clearTimeout(preferenceTimeoutVar);
|
|
clearTimeout(backupTimeoutVar);
|
|
clearTimeout(restoreTimeoutVar);
|
|
clearTimeout(msgTimeoutVar);
|
|
clearTimeout(scheduleWatcherTimeoutVar);
|
|
clearTimeout(sizeWatcherTimeoutVar);
|
|
clearTimeout(reIndexTimeoutVar);
|
|
|
|
if(url == '#'){
|
|
|
|
var alt = jQuery(this).attr('alt');
|
|
if(alt == "idriveLogout"){
|
|
clickedURL = "account.php";
|
|
jQuery(this).attr('href', "account.php") ;
|
|
return true;
|
|
}
|
|
return false;
|
|
} else if(clickedURL == 'preferences.php') {
|
|
var checkIP = checkIPformat();
|
|
if(checkIP===false){ return false; }
|
|
if(preferenceChanged>0){ preferenceSettings(); }
|
|
}
|
|
|
|
if(clickedURL == 'restore.php'){
|
|
if(dedup==true){
|
|
//if(Object.keys(dynamicRemoteArray[deviceID+"/"]).length == 0){ Modified by Senthil on 18-May-2017 due to JS error
|
|
if(typeof dynamicRemoteArray[selectedRestoreListPath+"/"] =='undefined'){
|
|
jQuery('.menu_refresh_icon').trigger('click');
|
|
}
|
|
} else {
|
|
//if(Object.keys(dynamicRemoteArray["/"]).length == 0){ Modified by Senthil on 18-May-2017 due to JS error
|
|
if(typeof dynamicRemoteArray["/"] =='undefined'){
|
|
jQuery('.menu_refresh_icon').trigger('click');
|
|
}
|
|
}
|
|
}
|
|
//Checking whether Job needs to be to Edit or not
|
|
var editActionRequired=false;
|
|
if(actionRequired==2){
|
|
editActionRequired=true;
|
|
if(clickedURL == 'restore.php')
|
|
editJob('restore');
|
|
else if(clickedURL == 'trash.php')
|
|
editJob('trash');
|
|
else
|
|
editJob('backup');
|
|
}
|
|
else if(actionRequired==10) {
|
|
editActionRequired=true;
|
|
editJob('trash');
|
|
}
|
|
|
|
if(clickedURL == 'trash.php' && searchStarted == true)
|
|
stopSearchExecution("trash");
|
|
|
|
IDrive.UserName = jQuery('#registered_user').html();
|
|
// if(IDrive.UserName !='' || (url == 'preferences.php' && machine!='twotier') || (url == 'account.php' || url == "backup.php") ){
|
|
if(IDrive.UserName !='' || (url == 'preferences.php' && machine!='twotier') || (url == 'account.php') ){
|
|
clickedURL = url;
|
|
jQuery('.head_search .common_msg').hide();
|
|
jQuery('.alert p').html('Loading...Please wait');
|
|
jQuery('.ajax_loader').hide();
|
|
jQuery('.alert,#page_loader').show();
|
|
var clickedMenu = jQuery(this);
|
|
if(clickedURL == 'expressBackup.php'){
|
|
checkMountedDrives(clickedMenu);
|
|
return false;
|
|
}/*else if(IDrive.UserName =='' && clickedURL == 'backup.php'){
|
|
clickedMenu.attr("href", "account.php");
|
|
clickedMenu.attr("class", "topnavbutton");
|
|
clickedMenu.attr("alt", "Login to your IDrive account");
|
|
return false;
|
|
}*/
|
|
//Next Scheduler Event - Hide/Show link "More..."
|
|
var nextMoreTxt = jQuery('.next-schdul-time span');
|
|
if(clickedURL == 'scheduler.php')
|
|
jQuery('.next-more-txt').hide();
|
|
else if(!nextMoreTxt.hasClass('no_event'))
|
|
jQuery('.next-more-txt').show();
|
|
|
|
if(editActionRequired==true){
|
|
setTimeout(function(){
|
|
loadPageDetails(clickedMenu);
|
|
}, 500);
|
|
} else {
|
|
loadPageDetails(clickedMenu);
|
|
}
|
|
} else {
|
|
if(clickedURL=='preferences.php' && url!='preferences.php'){
|
|
jQuery('a.head_user').trigger('click');
|
|
}
|
|
showErrorMessages('.head_search .error_msg','Please enter your account details to continue');
|
|
}
|
|
});
|
|
|
|
/* Load page - Start*/
|
|
function loadPageDetails(clickedMenu){
|
|
/* Add/Remove active left navigation */
|
|
var clicked = clickedMenu.attr('class');
|
|
if(clicked=='leftnavbutton'){
|
|
jQuery('a').removeClass('act');
|
|
clickedMenu.addClass('act');
|
|
} else if(clicked=='topnavbutton'){
|
|
jQuery('a').removeClass('act');
|
|
}
|
|
|
|
//Removing appended drop-down
|
|
if(jQuery('#dropdown').length!==0){
|
|
jQuery('#dropdown').remove();
|
|
}
|
|
clearTimeout(backupTimeoutVar);
|
|
clearTimeout(restoreTimeoutVar);
|
|
|
|
/* Loading the corresponding page content*/
|
|
var url = clickedMenu.attr('href');
|
|
var pageTitle = clickedMenu.attr('alt');
|
|
if(pageTitle == "idriveLogout")
|
|
pageTitle = "Login to your IDrive account";
|
|
var navName = clickedMenu.html();
|
|
|
|
abortAjax(currentAjaxRequest);
|
|
abortAjax(currentLocalAjaxRequest);
|
|
currentLocalAjaxRequest = '';
|
|
jQuery('#dropdown:last').remove(); //Removing right menu
|
|
jQuery('#content').load(url,function(){
|
|
if(jQuery('#content title').text()!=''){
|
|
window.location.href='../index.php';
|
|
}
|
|
jQuery('.page_title h4').html(pageTitle);
|
|
jQuery('.alert,#page_loader').hide();
|
|
|
|
/* Adding CSS attribute */
|
|
if(navName=='Backup' || navName=='Restore'){
|
|
jQuery('#content').css('margin-top','125px');
|
|
//jQuery('.leftnav,.body_wrap').removeAttr("style"); Commented by Senthil for Vault Express
|
|
} else {
|
|
jQuery('#content').css('margin-top','167px');
|
|
//jQuery('.leftnav').css('top','147px'); Commented by Senthil for Vault Express
|
|
//jQuery('.body_wrap').css('margin-top','-20px'); Commented by Senthil for Vault Express
|
|
}
|
|
});
|
|
}
|
|
|
|
/* check Mounted Drives - Start*/
|
|
function checkMountedDrives(clickedMenu){
|
|
//AJAX call to check Mounted Drives
|
|
$.ajax({
|
|
url: "action.php?action=checkMountedDrives",
|
|
type: "POST",
|
|
success: function(validatedData){
|
|
if(validatedData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
if(validatedData!=''){
|
|
validatedRes=$.parseJSON(validatedData);
|
|
if(validatedRes[0]==true){
|
|
loadPageDetails(clickedMenu);
|
|
} else {
|
|
jQuery('.alert,#page_loader').hide();
|
|
showErrorMessages('.head_search .error_msg','External disks are not mounted.');
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/* Calculate Storage Usage - Start*/
|
|
function storageCalculate(binaryCall){
|
|
binaryCall = (typeof binaryCall !== 'undefined') ? binaryCall : '';
|
|
jQuery('.storage_calculate').hide();
|
|
jQuery('#rcalcprg').show();
|
|
/*var url = "accountUsage.php";
|
|
jQuery('.storage_used').load(url,function(){
|
|
if(!jQuery('.storage_used ul li').hasClass('storage_box'))
|
|
{
|
|
window.location.href='../index.php';
|
|
}
|
|
});*/
|
|
|
|
$.ajax({
|
|
url: "accountUsage.php?binaryCall="+binaryCall,
|
|
type: "POST",
|
|
success: function(accountUsageData){
|
|
jQuery('.storage_used').html(accountUsageData);
|
|
if(!jQuery('.storage_used ul li').hasClass('storage_box'))
|
|
{
|
|
window.location.href='../index.php';
|
|
}
|
|
}
|
|
});
|
|
}
|
|
jQuery('.storage_calculate').live('click', function () {
|
|
storageCalculate(); //Calling function
|
|
});
|
|
|
|
function preferenceSettings(){
|
|
if(preferenceChanged>0 && clickedURL=='preferences.php'){
|
|
var actualPassword = jQuery(".proxy_set3 input[name='password']").val();
|
|
if(actualPassword!=''){
|
|
jQuery(".proxy_set3 input[name='password']").val(base64_encode(actualPassword));
|
|
}
|
|
var data = $(".preference_page form").serialize();
|
|
if(actualPassword!=''){
|
|
jQuery(".proxy_set3 input[name='password']").val(actualPassword);
|
|
}
|
|
preferenceChanged=0;
|
|
if(showHiddenClicked == true){
|
|
jQuery("#page_loader").show();
|
|
}
|
|
//AJAX call to update preference
|
|
$.ajax({
|
|
url: "addPreferences.php",
|
|
type: "POST",
|
|
data: data,
|
|
success: function(validatedData){
|
|
if(validatedData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
if(showHiddenClicked == true){
|
|
showErrorMessages('.welcome_message','Settings have been saved');
|
|
jQuery("#page_loader").hide();
|
|
showHiddenClicked = false;
|
|
}
|
|
|
|
if(rootDisplayChanged == true) {
|
|
showErrorMessages('.welcome_message', 'Settings have been saved. Reloading the App. Please wait...');
|
|
jQuery("#page_loader").show();
|
|
window.location.reload();
|
|
}
|
|
},
|
|
error: function() {
|
|
if(rootDisplayChanged == true) {
|
|
showErrorMessages('.error_msg', 'Could not save the settings.');
|
|
$('#displayRootChk').prop('checked', !$('#displayRootChk').prop('checked'));
|
|
rootDisplayChanged = false;
|
|
jQuery("#page_loader").hide();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
//Edit Job while navigating/Changing Job
|
|
function editJob(type){
|
|
/*if(jQuery("#oldJobName").val()=='0'){
|
|
return false;
|
|
} */
|
|
if(type=='backup' || type=='localBackup' ){
|
|
jQuery("form[name*='startBackupForm'] input[type='checkbox']:not(.excludeForBackup)").attr('checked',true);
|
|
var values = jQuery("form#startBackupForm").serialize();
|
|
}
|
|
else if(type=='trash') {
|
|
|
|
var values = {"restoreLocation":jQuery('#restoreLocation').val(),"restoreLocationLength":jQuery('#restoreLocationLength').val()};
|
|
}
|
|
else {
|
|
$(".excludefiles.restore_cnt table.restore_cnt").find('*').prop('disabled',false);
|
|
$(".excludefiles.version_restore_cnt table.version_restore_cnt").find('*').prop('disabled',true);
|
|
var fieldsCount = jQuery("form#startRestoreForm input[type='checkbox']").attr('checked',true).length;
|
|
var values = jQuery("form#startRestoreForm").serialize();
|
|
if(typeof availableLocalDevices != "undefined" && availableLocalDevices.length > 0 && $('.localRestore').length > 0) {
|
|
values += "&dedupBucket=" + $('#localBackupHost').find("option:selected").attr('idr-bkt');
|
|
}
|
|
$(".excludefiles.restore_cnt table.restore_cnt").find('*').prop('disabled',true);
|
|
$(".excludefiles.version_restore_cnt table.version_restore_cnt").find('*').prop('disabled',false);
|
|
}
|
|
|
|
if(dedup == true && dedupDeviceOptionListHTML != '' && typeof currentDedupDeviceId != 'undefined' && currentDedupDeviceId != '') {
|
|
$(dedupDeviceOptionListHTML).each(function(inx, opt) {
|
|
if($(opt).val() == currentDedupDeviceId) {
|
|
var opttxt = $(opt).text();
|
|
var oldopt = $(opt).html();
|
|
var newopt = '';
|
|
var backuploc = $("#backupLocation").val();
|
|
|
|
if(typeof backuploc == "undefined") {
|
|
return;
|
|
}
|
|
|
|
if(opttxt.indexOf("this NAS") != -1) {
|
|
newopt = $(opt).text(backuploc + " (this NAS)");
|
|
} else {
|
|
newopt = $(opt).text(backuploc);
|
|
}
|
|
|
|
dedupDeviceOptionListHTML = dedupDeviceOptionListHTML.replace(oldopt, $(newopt).html());
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
$.ajax({
|
|
url: "editJob.php",
|
|
type: "POST",
|
|
data: values,
|
|
success: function(validatedData){
|
|
if(validatedData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
if(removeBackupAndRestoreList == true){
|
|
ajaxCallForRefresh(type,'/');
|
|
removeBackupAndRestoreList=false;
|
|
}
|
|
|
|
if(validatedData==''){
|
|
return true;
|
|
}
|
|
validatedRes=$.parseJSON(validatedData);
|
|
if(validatedRes['dir']!==null && validatedRes['dir']!=''){
|
|
jobListArray[validatedRes['dir']] = validatedRes['files'];
|
|
jobListTypeArray[validatedRes['dir']] = validatedRes['type'];
|
|
jobListSizeArray[validatedRes['dir']] = validatedRes['size'];
|
|
jobListLMTimeArray[validatedRes['dir']] = validatedRes['modtime'];
|
|
if(validatedRes['dir']!='0'){
|
|
IDrive.Jobs[validatedRes['dir']].selected_files = validatedRes['files'];
|
|
}
|
|
}
|
|
}
|
|
});
|
|
actionRequired=1;
|
|
}
|
|
|
|
//Function to clear Log
|
|
jQuery('.logsDeleteJob').live('click', function() {
|
|
var id = jQuery(this).closest('tr').attr("id");
|
|
jQuery('#clearLogObject').val(id);
|
|
$.popContainer();
|
|
jQuery(secPosCont).append(jQuery('.logs_clear_popup').show());
|
|
});
|
|
jQuery('#clearLogButton').die('click').live('click', function() {
|
|
clearLog();
|
|
});
|
|
function clearLog(){
|
|
var id = jQuery('#clearLogObject').val();
|
|
var url = jQuery('tr[id="'+id+'"]').find('a').attr('href');
|
|
|
|
jQuery('.head_search .alert p').html('Deleting log...Please wait').parent().show();
|
|
jQuery('html,body').scrollTop(0);
|
|
|
|
url = url.replace('viewLog','clearLog');
|
|
clearInterval(IDrive.Scheduler.LogPollID);
|
|
$.popContainerHide(); // Close popup box
|
|
$.ajax({
|
|
url: url,
|
|
type: "GET",
|
|
success: function(validatedData){
|
|
if(validatedData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
IDrive.Scheduler.LoadLogs();
|
|
checkSelectedLogs();
|
|
jQuery('.head_search .alert').hide();
|
|
var clearDataRes=$.parseJSON(validatedData);
|
|
if(clearDataRes[0]==true){
|
|
showErrorMessages('.head_search .welcome_message','Log deleted successfully');
|
|
} else {
|
|
showErrorMessages('.head_search .error_msg','Job is in progress. Please try again later');
|
|
}
|
|
IDrive.Scheduler.LogPollID = setInterval(IDrive.Scheduler.WatchLogs, timeForWatcher);
|
|
}
|
|
});
|
|
}
|
|
|
|
//Delete all logs
|
|
jQuery('.menu_delete_all').live('click', function() {
|
|
$.popContainer();
|
|
jQuery(secPosCont).append(jQuery('.logs_clearall_popup').show());
|
|
});
|
|
jQuery('#clearAllLogButton').die('click').live('click', function() {
|
|
clearAllLog();
|
|
});
|
|
function clearAllLog(){
|
|
jQuery('.logs-icon-row').hide();
|
|
jQuery('.head_search .alert p').html('Deleting log...Please wait').parent().show();
|
|
jQuery('html,body').scrollTop(0);
|
|
logFileList = [];
|
|
|
|
url = 'clearLog.php';
|
|
data = jQuery('form#jobLogsList').serialize();
|
|
$.popContainerHide(); // Close popup box
|
|
$.ajax({
|
|
url: url,
|
|
type: "POST",
|
|
data: data,
|
|
success: function(validatedData){
|
|
if(validatedData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
IDrive.Scheduler.LoadLogs();
|
|
checkSelectedLogs();
|
|
jQuery('.head_search .alert').hide();
|
|
var clearDataRes=$.parseJSON(validatedData);
|
|
if(clearDataRes[0]==true){
|
|
showErrorMessages('.head_search .welcome_message','Logs deleted successfully');
|
|
jQuery('.delete_all_disabled').hide();
|
|
} else {
|
|
if(clearDataRes[1].length>1){
|
|
showErrorMessages('.head_search .error_msg','Jobs are in progress. Please try again later');
|
|
} else {
|
|
showErrorMessages('.head_search .error_msg','Job is in progress. Please try again later');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
jQuery(document).on('click','.logs-section td.file_check', function(){
|
|
checkSelectedLogs();
|
|
})
|
|
//Function to enable/disable checkbox
|
|
function checkSelectedLogs(){
|
|
var countChecked = jQuery('#jobLogsList input[type="checkbox"]:checked').length;
|
|
var countCheckBox = jQuery('#jobLogsList input[type="checkbox"]').length;
|
|
if(countChecked>0){
|
|
jQuery('.logs-icon-row').show();
|
|
jQuery('.delete_all_disabled').hide();
|
|
} else {
|
|
jQuery('.logs-icon-row').hide();
|
|
jQuery('#log_list .header_part').find('label').removeAttr('class');
|
|
if(countCheckBox>0){
|
|
jQuery('.delete_all_disabled').show();
|
|
}
|
|
}
|
|
}
|
|
//Function to check Logs list
|
|
function checkRemainingLogRows(){
|
|
var rowLength = jQuery('#logRows tr').length;
|
|
if(rowLength==0){
|
|
jQuery('#logRows').siblings('.nfiles').show();
|
|
}
|
|
}
|
|
|
|
//Function to check the IP address format
|
|
function checkIPformat(){
|
|
var proxyOption = jQuery('input[name="proxy_option"]:checked').val();
|
|
if(proxyOption =='Manual' || proxyOption=='autodetect'){
|
|
var inputField = jQuery('input[name="ipAddress"]');
|
|
var val = inputField.val();
|
|
|
|
var patternForIP = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
|
|
var patternForDomain = /^(?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63}$/;
|
|
var testIP = val.match(patternForIP);
|
|
var testDomainName = val.match(patternForDomain);
|
|
if(testIP || testDomainName){
|
|
return true;
|
|
} else {
|
|
showErrorMessages('.head_search .error_msg','Invalid IP address/Domain Name format');
|
|
inputField.trigger('focus').focus();
|
|
document.getElementById('ipAddress').focus();
|
|
return false;
|
|
}
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
//Function to POST automatically if no activity
|
|
function startTimeoutForAutoPost(page){
|
|
if(page=='preferences'){
|
|
preferenceChanged=1;
|
|
clearTimeout(preferenceTimeoutVar);
|
|
preferenceTimeoutVar = setTimeout("preferenceSettings()",timeToPost); // 2 Minutes (1sec=1000)
|
|
} else if(page=='backup'){
|
|
clearTimeout(backupTimeoutVar);
|
|
backupTimeoutVar = setTimeout("editJob('backup')",timeToPost); // 2 Minutes
|
|
} else if(page=='restore'){
|
|
clearTimeout(restoreTimeoutVar);
|
|
restoreTimeoutVar = setTimeout("editJob('restore')",timeToPost); // 2 Minutes
|
|
} else if(page=='periodic'){
|
|
clearTimeout(periodicTimeoutVar);
|
|
periodicTimeoutVar = setTimeout("postPeriodicCleanup()",timeToPost); // 2 Minutes
|
|
}
|
|
}
|
|
|
|
//Function to load added Job Files/Folders
|
|
function loadExistingJob(val,type, getDir, versionInfo)
|
|
{
|
|
var reload = 0;
|
|
var chkRemote = 0;
|
|
getDir = getDir || '/';
|
|
var isVersionRestore = false;
|
|
if(getDir =='reload'){
|
|
getDir = '/';
|
|
reload = 1;
|
|
} else {
|
|
jQuery("#backupSetSizeHTML").html('0.00 B');
|
|
jQuery("#backupSetSize").val(0);
|
|
}
|
|
|
|
if(TrashPutbackHappen == 1){
|
|
for(var key in jobListArray){
|
|
if(key.substr(0, 8)=='Restore_'){
|
|
delete jobListArray[key];
|
|
delete jobListTypeArray[key];
|
|
delete jobListSizeArray[key];
|
|
delete jobListLMTimeArray[key];
|
|
}
|
|
}
|
|
//delete jobListArray[jQuery('#select_restore_job').val()];
|
|
TrashPutbackHappen = 0;
|
|
loadRestoreRemoteFiles('/','loadRestorePath','fullPathBreadCrumb','restoreFilePath');
|
|
chkRemote = 1;
|
|
}
|
|
$(".archive_menu").hide();
|
|
if(type=='backup' && val != "0" && val != "" && backupModeSet == 'mirror') {
|
|
$(".archive_menu").show();
|
|
}
|
|
if(!(type=='backup' && jQuery(".ajax_loader").is(':visible'))){
|
|
jQuery('#noBackupsetFiles').siblings('.ajax_loader').show();
|
|
}
|
|
|
|
if(versionInfo && versionInfo.version) {
|
|
isVersionRestore = true;
|
|
$('.restore_cnt').hide();
|
|
$('.version_restore_cnt').show();
|
|
$(".excludefiles.restore_cnt table.restore_cnt").find('*').prop('disabled',true);
|
|
$(".excludefiles.version_restore_cnt table.version_restore_cnt").find('*').prop('disabled',false);
|
|
var displayPath = $('.main_chk_table1.version_restore_cnt');
|
|
displayPath.find('span#folderDetailsName')
|
|
.text(versionInfo['file'].substring(versionInfo['file'].lastIndexOf("/") + 1));
|
|
displayPath.find('span#folderDetailsName')
|
|
.attr('alt', versionInfo['file'].substring(versionInfo['file'].lastIndexOf("/") + 1))
|
|
.attr('title', versionInfo['file'].substring(versionInfo['file'].lastIndexOf("/") + 1));
|
|
displayPath.find('span#folderDetailsPath')
|
|
.text('Home' + (versionInfo['file'].slice(0, versionInfo['file'].lastIndexOf('/'))));
|
|
displayPath.find('span#folderDetailsPath')
|
|
.attr('alt', 'Home' + (versionInfo['file'].slice(0, versionInfo['file'].lastIndexOf('/'))))
|
|
.attr('title', 'Home' + (versionInfo['file'].slice(0, versionInfo['file'].lastIndexOf('/'))));
|
|
|
|
var showVersionSelected = $('.excludefiles.version_restore_cnt table.version_restore_cnt');
|
|
showVersionSelected.find('span#versioncountno').text(versionInfo['version']);
|
|
showVersionSelected.find('span#versionfilesize').text(versionInfo['size']);
|
|
showVersionSelected.find('span#versiondatemodified').text(versionInfo['modifiedon']);
|
|
jQuery('#noBackupsetFiles').siblings('.ajax_loader').hide();
|
|
}
|
|
|
|
backupSetArray = [];
|
|
backupSetTypeArray = []
|
|
restoreSetArray = [];
|
|
localBackupSetArray = [];
|
|
localBackupSetTypeArray = [];
|
|
localRestoreSetArray = [];
|
|
|
|
//Checking whether Job needs to be to Edit or not
|
|
if(actionRequired ==0){
|
|
actionRequired =1;
|
|
} else if(actionRequired ==2){
|
|
editJob(type);
|
|
}
|
|
|
|
var jobName = val==''?0:val;
|
|
jQuery('#oldJobName').val(jobName);
|
|
|
|
var html='';
|
|
|
|
var dirListVal = jobListArray[jobName];
|
|
var dirTypeVal = jobListTypeArray[jobName];
|
|
var dirSizeVal = jobListSizeArray[jobName];
|
|
var dirLMTimeVal = jobListLMTimeArray[jobName];
|
|
var dirInfo = jobListfileInfoArray[jobName];
|
|
|
|
if(refreshFolder==true){
|
|
var current_directory = jQuery('#fullPathBreadCrumb a:last').attr('alt');
|
|
if(type=='backup' || type=='localBackup'){
|
|
loadLocalFiles(current_directory,'loadFullPath','fullPathBreadCrumb','backupFilePath');
|
|
} else if(type=='restore'){
|
|
loadRestoreRemoteFiles(current_directory,'loadRestorePath','fullPathBreadCrumb','restoreFilePath');
|
|
} else {
|
|
//var restoreType = jQuery('select.restoreDropdown-txtbox').val();
|
|
var restoreTypeData = $('input[type=radio][name="restore_type_detail[]"]:checked').val();
|
|
loadLocalRestoreFiles(current_directory,'loadRestorePath','fullPathBreadCrumb','restoreFilePath',restoreTypeData);
|
|
}
|
|
} else if((jQuery('#fullPathBreadCrumb a').length>1 || val=='' || machine != '') && checkingSelectedItems==false){
|
|
if(type=='backup'){
|
|
loadLocalFiles('/','loadFullPath','fullPathBreadCrumb','backupFilePath');
|
|
} else if(type=='localBackup'){
|
|
loadLocalFiles('/','loadFullPath','fullPathBreadCrumb','backupFilePath');
|
|
} else if(type=='restore'){
|
|
loadRestoreRemoteFiles('/','loadRestorePath','fullPathBreadCrumb','restoreFilePath');
|
|
} else {
|
|
clickedDirPath = '/';
|
|
//var restoreType = jQuery('select.restoreDropdown-txtbox').val();
|
|
var restoreTypeData = $('input[type=radio][name="restore_type_detail[]"]:checked').val();
|
|
loadLocalRestoreFiles('/','loadRestorePath','fullPathBreadCrumb','restoreFilePath',restoreTypeData);
|
|
}
|
|
}
|
|
|
|
//if(type=='restore' && ((dedup!=true && val!='0') || (dedup==true && defaultRestoreSetArray.length==0))){ //Commented by Senthil for YR_Synology_2.03.28.09_01
|
|
if(type=='restore' && (dedup==true && defaultRestoreSetArray.length==0 && $('input[type=radio][name="restore_type_detail[]"]:checked').val() =='Online Account' && manualRestoreRunning==false && isDedupRefresh==false)){
|
|
jQuery('#noBackupsetFiles').show().siblings('.ajax_loader').hide();
|
|
displayListHTML(type,html,isVersionRestore);
|
|
return false;
|
|
}
|
|
|
|
if(val=='0' || val=='' || machine=='twotier' || (dedup==true && type=='restore' && refreshFolder!=true)) {
|
|
if(type=='backup'){
|
|
dirListVal = defaultBackupSetArray;
|
|
dirTypeVal = defaultBackupSetTypeArray;
|
|
dirSizeVal = defaultBackupSetSizeArray;
|
|
dirLMTimeVal = defaultBackupSetModTimeInfo;
|
|
dirInfo = defaultBackupSetFileInfo;
|
|
} else if(type=='localBackup') {
|
|
dirListVal = defaultLocalBackupSetArray;
|
|
dirTypeVal = defaultLocalBackupSetTypeArray;
|
|
dirInfo = defaultBackupSetFileInfo;
|
|
} else if(type=='restore') {
|
|
dirListVal = defaultRestoreSetArray;
|
|
dirTypeVal = defaultRestoreSetTypeArray;
|
|
dirInfo = defaultRestoreSetFileInfo;
|
|
} else {
|
|
dirListVal = defaultLocalRestoreSetArray;
|
|
dirTypeVal = defaultLocalRestoreSetTypeArray;
|
|
dirInfo = defaultRestoreSetFileInfo;
|
|
}
|
|
}
|
|
|
|
if(type=='backup'){
|
|
backupSetArray = [];
|
|
backupSetTypeArray = []; //Added for Backup set size calculation
|
|
} else if(type=='localBackup') {
|
|
localBackupSetArray = [];
|
|
localBackupSetTypeArray = [];
|
|
} else if(type=='restore'){
|
|
restoreSetArray = [];
|
|
} else {
|
|
localRestoreSetArray = [];
|
|
}
|
|
|
|
if(dirListVal === "" || typeof dirListVal == "undefined" || dirListVal.length == 0 || (typeof isRefresh != "undefined" && isRefresh == true && type == 'localBackup')) {
|
|
if( jobName==0 && refreshFolder==true){
|
|
jQuery('#noBackupsetFiles').show().siblings('.ajax_loader').hide();
|
|
return false;
|
|
} else if(jobName=='' && jobName!=0){
|
|
jQuery('#noBackupsetFiles').siblings('.ajax_loader').hide();
|
|
displayListHTML(type,html, isVersionRestore);
|
|
return false;
|
|
}
|
|
refreshFolder=false;
|
|
|
|
if(typeof isRefresh != "undefined" && isRefresh == true && type == 'localBackup') {
|
|
defaultLocalBackupSetArray = [];
|
|
defaultLocalBackupSetTypeArray = [];
|
|
}
|
|
|
|
var itemType = new Array();
|
|
var itemSize = new Array();
|
|
var itemLModf = new Array();
|
|
$.ajax({
|
|
url: "displayBackupsetFileContent.php?JOB_NAME="+encodeURIComponent(jobName)+"&jobType="+type+"&getDir="+getDir+"&reload="+reload,
|
|
async: false,
|
|
success: function(dataList){
|
|
if(dataList.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
dataListRes=$.parseJSON(dataList);
|
|
if (dataListRes === null) return;
|
|
if (dataListRes[0] === true) {
|
|
var listArray = dataListRes[1];
|
|
var typeArray = dataListRes[2];
|
|
var fileInfo = dataListRes[3];
|
|
var fileSize = dataListRes[4];
|
|
var fileLMod = dataListRes[5];
|
|
var cnt = -1;
|
|
|
|
//var data = listArray.filter(function(selected) {
|
|
$.each(listArray, function(index, selected) {
|
|
cnt++;
|
|
|
|
toParse = selected.replace('/','');
|
|
var parsedID = toParse.replace(/[\/]/g,'_');
|
|
parsedID = base64_encode(parsedID,1);
|
|
parsedID = parsedID.replace(/[=]/gi, '');
|
|
|
|
itemType = typeArray[cnt];
|
|
itemSize = fileSize[cnt];
|
|
itemLModf = fileLMod[cnt];
|
|
|
|
var cssSpanClassName = '';
|
|
var cssClassName = '';
|
|
var fileMissingEle = '';
|
|
var itemInfo = fileInfo[cnt];
|
|
var itemIndex = 0;
|
|
if(type == 'backup' || type=='localBackup') {
|
|
itemIndex = $.inArray(selected, defaultBackupSetFileInfo);
|
|
}else{
|
|
itemIndex = $.inArray(selected, defaultRestoreSetFileInfo);
|
|
}
|
|
//if (machine=='twotier' && type == 'backup') {
|
|
if ((itemInfo == '0') || ((itemInfo == '2') &&
|
|
(itemIndex > -1))) {
|
|
cssSpanClassName = 'class="file_missing_filename"';
|
|
cssClassName = 'class="file_missing"';
|
|
fileMissingEle = '<span class="file_missing_text">';
|
|
fileMissingEle += (itemType + ' is missing');
|
|
fileMissingEle += '</span>';
|
|
}
|
|
else if ((itemInfo == '1') &&
|
|
(itemIndex > -1)) {
|
|
if(type == 'backup' || type=='localBackup') {
|
|
defaultBackupSetFileInfo.splice(itemIndex, 1);
|
|
}else{
|
|
defaultRestoreSetFileInfo.splice(itemIndex, 1);
|
|
}
|
|
}
|
|
//}
|
|
|
|
var pos=-1;
|
|
if((type=='backup' || type=='localBackup') && sh=="Hide" && (pos=selected.indexOf("/."))>=0){
|
|
var tr_style='style="display: none;"';
|
|
}
|
|
else{
|
|
var tr_style='';
|
|
}
|
|
|
|
var displaySelected = selected;
|
|
if(machine=='twotier' && (type=='backup' || type=='localBackup')){
|
|
displaySelected = selected.substring(sharedFolderPathLength);
|
|
}
|
|
|
|
html += '<tr '+tr_style+' id="'+parsedID+'" ' + cssClassName + '>\
|
|
<td class="file_check"><input type="checkbox" name="chk_group[]" value="'+htmlEntities(selected)+'" ><input type="hidden" value="'+itemType+'" name="itemType[]"><input type="hidden" name="itemSize[]" value="'+itemSize+'" ><input type="hidden" name="itemLModf[]" value="'+itemLModf+'" ><label>files</label></td>\
|
|
<td width="68%" class="cont_heading" title="'+htmlEntities(displaySelected)+'"><img src="include/images/idq_ico_'+itemType+'.png"><span ' + cssSpanClassName + ((fileMissingEle != '')? "style=\"max-width: 560px;\"" : '') + ' >'+htmlEntities(displaySelected).replace(/[\s]/g,' ')+'</span> ' + fileMissingEle + '</td><td width="5%"></td></tr>';
|
|
|
|
var selected_dir = selected+"/";
|
|
if(type=='backup'){
|
|
backupSetArray.push(selected);
|
|
backupSetTypeArray.push(itemType);
|
|
if(jobName==0 || (machine=='twotier')){
|
|
defaultBackupSetArray.push(selected);
|
|
defaultBackupSetTypeArray.push(itemType);
|
|
}
|
|
|
|
if (itemInfo == '0' &&
|
|
(itemIndex == -1)) {
|
|
defaultBackupSetFileInfo.push(selected);
|
|
} else if (fileSize[cnt] >= 0) {
|
|
localFileDirSize[selected] = fileSize[cnt];
|
|
updateCalculatedSize(fileSize[cnt], 'add');
|
|
} else {
|
|
getItemSize(selected,itemType); //Calculate & display size of Backup Set
|
|
}
|
|
} else if(type=='localBackup') {
|
|
//Local Backup page
|
|
localBackupSetArray.push(selected);
|
|
if(jobName==0){
|
|
defaultLocalBackupSetArray.push(selected);
|
|
defaultLocalBackupSetTypeArray.push(itemType);
|
|
}
|
|
|
|
if (itemInfo == '0' && (itemIndex == -1)) {
|
|
defaultBackupSetFileInfo.push(selected);
|
|
} else {
|
|
getItemSize(selected,itemType); //Calculate & display size of Backup Set
|
|
}
|
|
|
|
} else if(type=='restore'){
|
|
//Restore page
|
|
restoreSetArray.push(selected);
|
|
if (itemInfo == '0' && (itemIndex == -1)) {
|
|
defaultRestoreSetFileInfo.push(selected);
|
|
}
|
|
if(jobName==0){
|
|
defaultRestoreSetArray.push(selected);
|
|
defaultRestoreSetTypeArray.push(itemType);
|
|
}
|
|
} else if(type=='localRestore') {
|
|
//Local Restore page
|
|
localRestoreSetArray.push(selected);
|
|
if(jobName==0){
|
|
defaultLocalRestoreSetArray.push(selected);
|
|
defaultLocalRestoreSetTypeArray.push(itemType);
|
|
}
|
|
}
|
|
|
|
if(typeof(IDrive.Jobs[jobName]) != "undefined") {
|
|
if(IDrive.Jobs[jobName].selected_files) {
|
|
IDrive.Jobs[jobName].selected_files.push(selected);
|
|
}else {
|
|
IDrive.Jobs[jobName].selected_files = [];
|
|
IDrive.Jobs[jobName].selected_files.push(selected);
|
|
}
|
|
}
|
|
});
|
|
isDedupRefresh=false;
|
|
}
|
|
else if(type == 'restore' && dataListRes[0] === false && dataListRes[2] == null && typeof jobName != "undefined"){
|
|
jQuery('#noBackupsetFiles').siblings('.ajax_loader').hide();
|
|
isDedupRefresh=false;
|
|
}
|
|
else if(type == 'restore' && dataListRes[0] === false && parseInt(dataListRes[2]) == 1 && typeof jobName != "undefined"){
|
|
setTimeout(function(){ loadExistingJob(jobName,'restore','reload'); }, 3000);
|
|
return;
|
|
}
|
|
|
|
if(dataListRes[0] == true || type=='localBackup' || type=='backup' || dataListRes[2] == 0){
|
|
displayListHTML(type,html, isVersionRestore);
|
|
jobListArray[jobName] = listArray;
|
|
jobListTypeArray[jobName] = typeArray;
|
|
if(type=='backup' || type=='localBackup'){
|
|
jobListfileInfoArray[jobName] = defaultBackupSetFileInfo;
|
|
jobListSizeArray[jobName] = defaultBackupSetSizeArray;
|
|
jobListLMTimeArray[jobName] = defaultBackupSetModTimeInfo;
|
|
}else if(type=='restore'){
|
|
jobListfileInfoArray[jobName] = defaultRestoreSetFileInfo;
|
|
}
|
|
jQuery('#noBackupsetFiles').siblings('.ajax_loader').hide();
|
|
}
|
|
}, //need to add error handling to remove loader atleast.
|
|
error: function (request, status, error) {
|
|
jQuery('#noBackupsetFiles').siblings('.ajax_loader').hide();
|
|
}
|
|
});
|
|
|
|
} else {
|
|
var listArray = dirListVal;
|
|
|
|
if(typeof listArray!='undefined' && listArray.length>0){
|
|
var cnt=0;
|
|
var data = listArray.filter(function(selected){
|
|
|
|
toParse = selected.replace('/','');
|
|
var parsedID = toParse.replace(/[\/]/g,'_');
|
|
parsedID = base64_encode(parsedID,1);
|
|
parsedID = parsedID.replace(/[=]/gi, '');
|
|
|
|
/* Hidden file checking...Start*/
|
|
var pos=-1;
|
|
if((type=='backup' || type=='localBackup') && sh=="Hide" && (pos=selected.indexOf("/."))>=0){
|
|
var tr_style='style="display: none;"';
|
|
}
|
|
else{
|
|
var tr_style='';
|
|
}
|
|
|
|
var cssSpanClassName = '';
|
|
var cssClassName = '';
|
|
var fileMissingEle = '';
|
|
|
|
if (dirInfo.indexOf(selected) != -1) {
|
|
cssSpanClassName = 'class="file_missing_filename"';
|
|
cssClassName = 'class="file_missing"';
|
|
fileMissingEle = '<span class="file_missing_text">';
|
|
fileMissingEle += (dirTypeVal[cnt] + ' is missing');
|
|
fileMissingEle += '</span>';
|
|
}
|
|
|
|
var displaySelected = selected;
|
|
if(machine=='twotier' && (type=='backup' || type=='localBackup')){
|
|
displaySelected = selected.substring(sharedFolderPathLength);
|
|
}
|
|
|
|
/* Hidden file checking...End*/
|
|
|
|
if(type=='backup'){
|
|
html += '<tr '+tr_style+' id="'+parsedID+'" ' + cssClassName + '>\
|
|
<td class="file_check"><input type="checkbox" name="chk_group[]" value="'+htmlEntities(selected)+'" ><input type="hidden" value="'+dirTypeVal[cnt]+'" name="itemType[]"><input type="hidden" name="itemSize[]" value="'+dirSizeVal[cnt]+'" ><input type="hidden" name="itemLModf[]" value="'+dirLMTimeVal[cnt]+'" ><label>files</label></td>\
|
|
<td width="68%" class="cont_heading" title="'+htmlEntities(displaySelected)+'"><img src="include/images/idq_ico_'+dirTypeVal[cnt]+'.png"><span ' + cssSpanClassName + ((fileMissingEle != '')? "style=\"max-width: 560px;\"" : '') + ' >'+htmlEntities(displaySelected).replace(/[\s]/g,' ')+'</span> ' + fileMissingEle + '\
|
|
</td><td width="5%"></td></tr>';
|
|
}else{
|
|
html += '<tr '+tr_style+' id="'+parsedID+'" ' + cssClassName + '>\
|
|
<td class="file_check"><input type="checkbox" name="chk_group[]" value="'+htmlEntities(selected)+'" ><input type="hidden" value="'+dirTypeVal[cnt]+'" name="itemType[]"><input type="hidden" name="itemSize[]" value="undefined" ><input type="hidden" name="itemLModf[]" value="undefined" ><label>files</label></td>\
|
|
<td width="68%" class="cont_heading" title="'+htmlEntities(displaySelected)+'"><img src="include/images/idq_ico_'+dirTypeVal[cnt]+'.png"><span ' + cssSpanClassName + ((fileMissingEle != '')? "style=\"max-width: 560px;\"" : '') + ' >'+htmlEntities(displaySelected).replace(/[\s]/g,' ')+'</span> ' + fileMissingEle + '\
|
|
</td><td width="5%"></td></tr>';
|
|
|
|
}
|
|
|
|
cnt++;
|
|
if(type=='backup'){
|
|
backupSetArray.push(selected);
|
|
backupSetTypeArray.push(dirTypeVal[cnt]);
|
|
if (dirInfo.indexOf(selected) == -1)
|
|
getItemSize(selected,dirTypeVal[cnt]); //Calculate & display size of Backup Set
|
|
} else if(type=='localBackup') {
|
|
localBackupSetArray.push(selected);
|
|
if (dirInfo.indexOf(selected) == -1)
|
|
getItemSize(selected,dirTypeVal[cnt]); //Calculate & display size of Backup Set
|
|
} else if(type=='restore'){
|
|
restoreSetArray.push(selected);
|
|
} else if(type=='localRestore') {
|
|
localRestoreSetArray.push(selected);
|
|
}
|
|
});
|
|
jQuery('#noBackupsetFiles').siblings('.ajax_loader').hide();
|
|
displayListHTML(type,html,isVersionRestore);
|
|
}
|
|
}
|
|
}
|
|
|
|
function showErrorMessages(divId,msg){
|
|
var cleanText = msg.replace(/<\/?[^>]+(>|$)/g, "");
|
|
jQuery(divId).attr('title',cleanText).find('p').html(msg);
|
|
jQuery(divId).slideDown(200,function(){
|
|
msgTimeoutVar=setTimeout(function(){ jQuery(divId).slideUp(200); },5000);
|
|
});
|
|
jQuery('html,body').scrollTop(0);
|
|
}
|
|
|
|
function encodeFilePath(str){
|
|
toParse = str.replace('/','');
|
|
var parsedID = toParse.replace(/[\/]/g,'_');
|
|
parsedID = base64_encode(parsedID,1);
|
|
parsedID = parsedID.replace(/[=]/gi, '');
|
|
return parsedID;
|
|
}
|
|
function clearArrayValues(){
|
|
dynamicRemoteArray = [];
|
|
dynamicRemoteType = [];
|
|
dynamicRemoteSize = [];
|
|
dynamicRemoteDate = [];
|
|
dynamicRemoteRequestInfo = [];
|
|
|
|
dynamicArray = new Array();
|
|
dynamicType = new Array();
|
|
dynamicRequestInfo = new Array();
|
|
backupModeSet = null;
|
|
selectedRestoreListPath = '';
|
|
|
|
//Folders List For Backup/Restore Location
|
|
dynamicLocalDirList = [];
|
|
dynamicRemoteDirList = [];
|
|
|
|
clickedDirPath = '/';
|
|
clickedNewDirPath = [];
|
|
|
|
/* Job List Array Variables */
|
|
jobListArray = [];
|
|
jobListTypeArray = [];
|
|
jobListSizeArray = [];
|
|
jobListLMTimeArray = [];
|
|
jobListfileInfoArray = [];
|
|
currentBackupJob='Backup_Default Backup Set';
|
|
currentRestoreJob='';
|
|
currentBackupLocation='';
|
|
currentRestoreLocation='';
|
|
currentLocalBackupJob='';
|
|
|
|
/* Backup Page Array Variables */
|
|
backupSetArray = [];
|
|
defaultBackupSetArray = [];
|
|
defaultBackupSetTypeArray = [];
|
|
defaultBackupSetFileInfo = [];
|
|
manualBackupRunning=false;
|
|
|
|
newBackupSetArray = [];
|
|
|
|
backupListCount=0;
|
|
backupCheckedCount=0;
|
|
|
|
/* Local backup page Array Variables */
|
|
localBackupSetArray = [];
|
|
defaultLocalBackupSetArray = [];
|
|
defaultLocalBackupSetTypeArray = [];
|
|
manualLocalBackupRunning=false;
|
|
|
|
/* Local Restore Page Array Variables */
|
|
localrestoreSetArray = [];
|
|
defaultLocalRestoreSetArray = [];
|
|
defaultLocalRestoreSetTypeArray = [];
|
|
manualLocalRestoreRunning=false;
|
|
/* Restore Page Array Variables */
|
|
restoreSetArray = [];
|
|
defaultRestoreSetArray = [];
|
|
defaultRestoreSetTypeArray = [];
|
|
manualRestoreRunning=false;
|
|
|
|
newRestoreSetArray = [];
|
|
restoreListCount=0;
|
|
restoreCheckedCount=0;
|
|
|
|
startImmediateRunning=false;
|
|
jobCancelling=false;
|
|
|
|
/* Local restore page Array Variables */
|
|
localRestoreSetArray = [];
|
|
defaultLocalRestoreSetArray = [];
|
|
defaultLocalRestoreSetTypeArray = [];
|
|
|
|
dynamicLocalRestoreRequestInfo = [];
|
|
dynamicLocalRestoreArray = [];
|
|
dynamicLocalRestoreType = [];
|
|
dynamicLocalRestoreSize = [];
|
|
dynamicLocalRestoreDate = [];
|
|
|
|
/* Preferences Page Full Exclude Array Variables */
|
|
excludedFullPathArray = [];
|
|
excludedFullPathTypeArray = [];
|
|
|
|
//Temp Arrays
|
|
tempExcludedFullPathArray = [];
|
|
tempExcludedFullPathTypeArray = [];
|
|
|
|
//Multiple share items Array
|
|
shareItemArray = [];
|
|
sharePathArray = [];
|
|
shareTypeArray = [];
|
|
|
|
//Timeout Variables for Manual Backup/Restore Task status
|
|
backupTimeoutVar = '';
|
|
restoreTimeoutVar = '';
|
|
logsTimeoutVar='';
|
|
preferenceTimeoutVar='';
|
|
preferenceChanged =0;
|
|
msgTimeoutVar='';
|
|
periodicTimeoutVar='';
|
|
scheduleWatcherTimeoutVar='';
|
|
renameAjaxStatus = 0;
|
|
currentAjaxRequest = '';
|
|
|
|
searchAjaxRequest1 = '';
|
|
searchAjaxRequest2 = '';
|
|
searchStarted = false;
|
|
loadSearchTimout='';
|
|
cancelledSearch=false;
|
|
searchKeyword;
|
|
loadPage;
|
|
searchItemArray = [];
|
|
searchItemTempArray = [];
|
|
searchItemTypeArray = [];
|
|
|
|
showHiddenClicked = false;
|
|
sh='';
|
|
checkingSelectedItems=false;
|
|
timeForArchiveWatcher = 200;
|
|
test = 0;
|
|
archiveAjax ='';
|
|
archiveAjaxStatus='';
|
|
archiveTimeoutVar='';
|
|
checkArchiveRunningAjax=false;
|
|
removeScheduler=false;
|
|
removeBackupAndRestoreList=false;
|
|
refreshFolder = false;
|
|
dbUsedSize = [];
|
|
activeJobsTimeoutVar = '';
|
|
|
|
localFileDirSize = [];
|
|
loadFileSize = [];
|
|
|
|
deDupDeviceID = "";
|
|
selectedRestoreListPath = "";
|
|
restore_radioBtn_chk = "Online Account";
|
|
dedupDeviceOptionListHTML = "";
|
|
}
|
|
|
|
|
|
function base64_encode(data,urlSafe) {
|
|
if(urlSafe)
|
|
var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_:';
|
|
else
|
|
var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
|
|
ac = 0,
|
|
enc = '',
|
|
tmp_arr = [];
|
|
|
|
if (!data) {
|
|
return data;
|
|
}
|
|
|
|
do { // pack three octets into four hexets
|
|
o1 = data.charCodeAt(i++);
|
|
o2 = data.charCodeAt(i++);
|
|
o3 = data.charCodeAt(i++);
|
|
|
|
bits = o1 << 16 | o2 << 8 | o3;
|
|
|
|
h1 = bits >> 18 & 0x3f;
|
|
h2 = bits >> 12 & 0x3f;
|
|
h3 = bits >> 6 & 0x3f;
|
|
h4 = bits & 0x3f;
|
|
|
|
// use hexets to index into b64, and append result to encoded string
|
|
tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
|
|
} while (i < data.length);
|
|
|
|
enc = tmp_arr.join('');
|
|
|
|
var r = data.length % 3;
|
|
|
|
return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);
|
|
}
|
|
|
|
function base64_decode(data,urlSafe) {
|
|
|
|
if(urlSafe)
|
|
var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_:';
|
|
else
|
|
var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
|
|
ac = 0,
|
|
dec = '',
|
|
tmp_arr = [];
|
|
|
|
if (!data) {
|
|
return data;
|
|
}
|
|
|
|
data += '';
|
|
|
|
do {
|
|
// unpack four hexets into three octets using index points in b64
|
|
h1 = b64.indexOf(data.charAt(i++));
|
|
h2 = b64.indexOf(data.charAt(i++));
|
|
h3 = b64.indexOf(data.charAt(i++));
|
|
h4 = b64.indexOf(data.charAt(i++));
|
|
|
|
bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;
|
|
|
|
o1 = bits >> 16 & 0xff;
|
|
o2 = bits >> 8 & 0xff;
|
|
o3 = bits & 0xff;
|
|
|
|
if (h3 == 64) {
|
|
tmp_arr[ac++] = String.fromCharCode(o1);
|
|
} else if (h4 == 64) {
|
|
tmp_arr[ac++] = String.fromCharCode(o1, o2);
|
|
} else {
|
|
tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);
|
|
}
|
|
} while (i < data.length);
|
|
|
|
dec = tmp_arr.join('');
|
|
|
|
return decodeURIComponent(escape(dec.replace(/\0+$/, '')));
|
|
}
|
|
|
|
function urlencode(str) {
|
|
str = (str + '').toString();
|
|
return encodeURIComponent(str)
|
|
.replace(/!/g, '%21')
|
|
.replace(/'/g, '%27')
|
|
.replace(/\~/g, '%7E')
|
|
.replace(/\(/g, '%28')
|
|
.replace(/\)/g, '%29')
|
|
.replace(/\*/g, '%2A')
|
|
.replace(/%20/g, '+');
|
|
}
|
|
|
|
function rawurlencode(str) {
|
|
str = (str + '').toString();
|
|
return encodeURIComponent(str)
|
|
.replace(/\~/g, '%7E')
|
|
.replace(/!/g, '%21')
|
|
.replace(/'/g, '%27')
|
|
.replace(/\(/g, '%28')
|
|
.replace(/\)/g, '%29')
|
|
.replace(/\*/g, '%2A');
|
|
}
|
|
|
|
function rawurldecode(str) {
|
|
return decodeURIComponent( (str + '')
|
|
.replace( /\%21/g, '!' )
|
|
.replace( /\%27/g, "'" )
|
|
.replace( /\%28/g, '(' )
|
|
.replace( /\%29/g, ')' )
|
|
.replace( /\%2A/g, '*' )
|
|
.replace( /\%7E/g, '~' ) );
|
|
}
|
|
|
|
function urldecode(str) {
|
|
return decodeURIComponent((str + '')
|
|
.replace(/%(?![\da-f]{2})/gi, function() {
|
|
// PHP tolerates poorly formed escape sequences
|
|
return '%25';
|
|
})
|
|
.replace(/\+/g, '%20'));
|
|
}
|
|
|
|
//Validate Job Name
|
|
jQuery('input#newJobName').die('keypress').live('keypress',function(event){
|
|
|
|
var jobName = jQuery('input#newJobName').val();
|
|
if(jobName.length >=50)
|
|
{
|
|
event.preventDefault();
|
|
showErrorMessages('#popupError1','More than 50 characters are not allowed');
|
|
}
|
|
|
|
var keyCode = event.charCode;
|
|
if (keyCode == undefined)
|
|
keyCode = event.keyCode;
|
|
|
|
if (!((keyCode >= 65 && keyCode <= 90) || (keyCode >= 97 && keyCode <= 122) || (keyCode >= 48 && keyCode <= 57) || (keyCode == 32) || (keyCode == 45) || (keyCode == 46) || (keyCode == 95) || (keyCode == 0)))
|
|
{
|
|
event.preventDefault();
|
|
showErrorMessages('#popupError1','You can use letters, numbers, space and characters(.-_)');
|
|
}
|
|
});
|
|
|
|
//Validate Job Name
|
|
function validateJobname(){
|
|
var jobName = jQuery('input#newJobName').val();
|
|
var validateRegex = /^[a-zA-Z0-9\-\_\.]+$/;
|
|
|
|
if(!validateRegex.test(jobName))
|
|
{
|
|
e.preventDefault();
|
|
showErrorMessages('#popupError1','You can use letters, numbers, space and characters(.-_)');
|
|
}
|
|
}
|
|
|
|
|
|
/* Function for Responsive BreadCrumb - Start */
|
|
function responsiveBreadcrumb(breadCrumbID,breadCrumbAnchClass){
|
|
var lastElementAttr = jQuery(breadCrumbID+' a:last').attr('alt');
|
|
var width = textWidth(lastElementAttr)+10;
|
|
var remainingElement = lastElementAttr;
|
|
var lastElement = jQuery(breadCrumbID+' a:last').html();
|
|
if(typeof lastElementAttr != 'undefined' && lastElementAttr != "/") {
|
|
var elementArray = lastElementAttr.split('/');
|
|
var elementArrayCount = elementArray.length;
|
|
for(var i=0;i<elementArrayCount;i++){
|
|
var lastElementCharCount = elementArray[i].length;
|
|
if(lastElementCharCount>5){
|
|
width += ((lastElementCharCount-5)*5);
|
|
}
|
|
}
|
|
}
|
|
var innerWidth = jQuery(breadCrumbID).innerWidth();
|
|
|
|
var childCount = jQuery(breadCrumbID+' a').length;
|
|
if(innerWidth<=(width+(childCount*10))){
|
|
if(machine=='twotier' && breadCrumbID == '#restoreLocationBreadCrumb'){
|
|
var vaultRestoreRootPath = "/"+vaultRestorePath;
|
|
var newBreadcrumb = '<a class="'+breadCrumbAnchClass+'" title="'+vaultRestoreRootPath+'" alt="/" href="javascript:void(0);">'+vaultRestoreRootPath+'</a>';
|
|
} else {
|
|
var newBreadcrumb = '<a class="'+breadCrumbAnchClass+'" title="/" alt="/" href="javascript:void(0);">/</a> ';
|
|
}
|
|
|
|
var newBreadcrumb1 ='';
|
|
var newBreadcrumb2 ='';
|
|
var newBreadcrumbLast ='';
|
|
var newBreadcrumbDot = '';
|
|
for(var i=1; i<childCount; i++){
|
|
var breadcrumbObj = jQuery(breadCrumbID).children().eq(i);
|
|
var dirName = breadcrumbObj.html();
|
|
var dirPath = breadcrumbObj.attr('alt');
|
|
dirPath = htmlEntities(dirPath);
|
|
|
|
var currTextWidth = textWidth(remainingElement);
|
|
currTextWidth = currTextWidth<50?50:currTextWidth;
|
|
currTextWidth = currTextWidth + (i*50)+(childCount*10);
|
|
|
|
if(childCount*50 < innerWidth){
|
|
if(innerWidth>currTextWidth || i==(childCount-1)){
|
|
newBreadcrumb += '<a class="'+breadCrumbAnchClass+'" title="'+dirPath+'" alt="'+dirPath+'" href="javascript:void(0);">'+dirName+'</a> ';
|
|
remainingElement = remainingElement.substring(dirName.length+1);
|
|
} else {
|
|
newBreadcrumb += '<a class="'+breadCrumbAnchClass+'" title="'+dirPath+'" alt="'+dirPath+'" href="javascript:void(0);">'+dirName.charAt(0)+'</a> ';
|
|
remainingElement = remainingElement.substring(dirName.length+1);
|
|
}
|
|
} else {
|
|
if(i==(childCount-1)){
|
|
newBreadcrumbLast = '<a class="'+breadCrumbAnchClass+'" title="'+dirPath+'" alt="'+dirPath+'" href="javascript:void(0);">'+dirName+'</a> ';
|
|
} else {
|
|
firstNodeCount = (childCount/2)<3?3:4;
|
|
if(i<=firstNodeCount){
|
|
newBreadcrumb1 += '<a class="'+breadCrumbAnchClass+'" title="'+dirPath+'" alt="'+dirPath+'" href="javascript:void(0);">'+dirName.charAt(0)+'</a> ';
|
|
}
|
|
else if(i>=(childCount-3)){
|
|
newBreadcrumb2 += '<a class="'+breadCrumbAnchClass+'" title="'+dirPath+'" alt="'+dirPath+'" href="javascript:void(0);">'+dirName.charAt(0)+'</a> ';
|
|
}
|
|
else {
|
|
newBreadcrumbDot = '<a class="'+breadCrumbAnchClass+'" title="'+dirPath+'" alt="'+dirPath+'" href="javascript:void(0);">..</a> ';
|
|
}
|
|
}
|
|
}
|
|
/* if(newBreadcrumb1!=''){
|
|
newBreadcrumb = newBreadcrumb+newBreadcrumb1+newBreadcrumbDot+newBreadcrumb2+newBreadcrumbLast;
|
|
} */
|
|
}/* else {
|
|
newBreadcrumb = jQuery(breadCrumbID).html();
|
|
} */
|
|
if(newBreadcrumb1!=''){
|
|
newBreadcrumb = newBreadcrumb+newBreadcrumb1+newBreadcrumbDot+newBreadcrumb2+newBreadcrumbLast;
|
|
}
|
|
} else {
|
|
newBreadcrumb = jQuery(breadCrumbID).html();
|
|
}
|
|
jQuery(breadCrumbID).html(newBreadcrumb);
|
|
hideBreadCrumbElement(); //Calling the function to hide element of breadcrumb based on machine
|
|
}
|
|
|
|
function textWidth(text){
|
|
if(typeof text != 'undefined' && text != ''){
|
|
var text = text.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\s\{\}\[\]\\\/]/gi, 'A');
|
|
var org = $(this);
|
|
var textHTML = '<span style="postion:absolute;width:auto;left:-9999px">' + (text || org.html()) + '</span>';
|
|
var html = $(textHTML);
|
|
if (!text) {
|
|
html.css("font-family", org.css("font-family"));
|
|
html.css("font-size", org.css("font-size"));
|
|
}
|
|
|
|
$('body').append(html);
|
|
var width1 = html.width();
|
|
html.remove();
|
|
return width1;
|
|
} else {
|
|
return 0;
|
|
}
|
|
|
|
}
|
|
|
|
/* Function to hide the elements for shared folders list - Start */
|
|
function hideBreadCrumbElement(){
|
|
if(machine!='twotier' && (typeof rootLevelEnabled != "undefined" && rootLevelEnabled == 1)) {
|
|
return false;
|
|
}
|
|
|
|
if(machine=='netgear' || machine=='synology'){
|
|
jQuery('.backup_page #fullPathBreadCrumb a,.localbackup_page #fullPathBreadCrumb a,#restoreLocationBreadCrumb a,.preferences #fullPathBreadCrumb a').eq(1).hide();
|
|
jQuery('.backup_page div#bkpBreadCrumb a,.localbackup_page div#bkpBreadCrumb a').eq(1).hide();
|
|
} else if(machine=='twotier'){
|
|
jQuery('.backup_page #fullPathBreadCrumb a,.localbackup_page #fullPathBreadCrumb a,.preferences #fullPathBreadCrumb a').eq(1).hide();
|
|
jQuery('.backup_page div#bkpBreadCrumb a,.localbackup_page div#bkpBreadCrumb a').eq(1).hide();
|
|
}
|
|
else if(machine==ASUSTOR){
|
|
if(jQuery('.backup_page #fullPathBreadCrumb a,#restoreLocationBreadCrumb a,.preferences #fullPathBreadCrumb a').slice(2,3).html() == 'home'){
|
|
jQuery('.backup_page #fullPathBreadCrumb a,#restoreLocationBreadCrumb a,.preferences #fullPathBreadCrumb a').slice(2,3).hide();
|
|
jQuery('.backup_page #fullPathBreadCrumb a,#restoreLocationBreadCrumb a,.preferences #fullPathBreadCrumb a').slice(3,4).text("Home");
|
|
}
|
|
jQuery('.backup_page #fullPathBreadCrumb a,.localbackup_page #fullPathBreadCrumb a,#restoreLocationBreadCrumb a,.preferences #fullPathBreadCrumb a').eq(1).hide();
|
|
jQuery('.backup_page div#bkpBreadCrumb a').eq(1).hide();
|
|
}
|
|
else {
|
|
jQuery('.backup_page #fullPathBreadCrumb a, .localbackup_page #fullPathBreadCrumb a,#restoreLocationBreadCrumb a,.preferences #fullPathBreadCrumb a').slice(1,3).hide();
|
|
jQuery('.backup_page div#bkpBreadCrumb a, .localbackup_page div#bkpBreadCrumb a').slice(1,3).hide();
|
|
}
|
|
}
|
|
/* Function to hide the elements for shared folders list - End */
|
|
/* Function for Responsive BreadCrumb - End */
|
|
|
|
/* Function to Abort AJAX - Start */
|
|
function abortAjax(xhr) {
|
|
if(xhr && xhr.readystate != 4){
|
|
xhr.abort();
|
|
}
|
|
}
|
|
/* Function to Abort AJAX - End */
|
|
/* Function to close notification */
|
|
$('.notify-close').on('click',function(){$('.display-notify').hide();});
|
|
|
|
function htmlEntities(str)
|
|
{
|
|
var ret = String(str).replace(/&/g, '&').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
|
return ret;
|
|
}
|
|
|
|
function htmlentities_decode(s)
|
|
{
|
|
var decoded = $('<div/>').html(s).text();
|
|
return decoded;
|
|
}
|
|
|
|
function countHiddenFilesAboveSelectedFile(clickedDirPath, currentFile)
|
|
{
|
|
var countHidden = 0;
|
|
|
|
$.each( dynamicArray[clickedDirPath], function( key, value ) {
|
|
|
|
if(currentFile == value)
|
|
{
|
|
return false;
|
|
|
|
}
|
|
else if(value.indexOf("/.") != -1)
|
|
{
|
|
countHidden++;
|
|
}
|
|
});
|
|
return countHidden;
|
|
}
|
|
|
|
//Restrict to add/remove items to/from Backup/Restore set if Manual Backup/Restore is running
|
|
function restrictAddRemoveItems(){
|
|
if( machine=='twotier'){
|
|
if(jQuery('.body_wrap').hasClass('backup_page') && manualBackupRunning==true){
|
|
jQuery('.common_msg').hide();
|
|
showErrorMessages('.head_search .error_msg','Backup is in progress. Please try again later');
|
|
return false;
|
|
} else if(jQuery('.body_wrap').hasClass('localbackup_page') && manualLocalBackupRunning==true){
|
|
jQuery('.common_msg').hide();
|
|
showErrorMessages('.head_search .error_msg','Backup is in progress. Please try again later');
|
|
return false;
|
|
} else if(jQuery('.body_wrap').hasClass('localrestore_page') && manualLocalRestoreRunning==true){
|
|
jQuery('.common_msg').hide();
|
|
showErrorMessages('.head_search .error_msg','Restore is in progress. Please try again later');
|
|
return false;
|
|
} else if(jQuery('.body_wrap').hasClass('restore_page') && !jQuery('.body_wrap').hasClass('localrestore_page') && manualRestoreRunning==true){
|
|
jQuery('.common_msg').hide();
|
|
showErrorMessages('.head_search .error_msg','Restore is in progress. Please try again later');
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
//To Keep selected LOG items
|
|
jQuery(document).on('click', '#log_list_table td.file_check, #log_list .header_part .file_check', function(e) {
|
|
var clickedLabel = e.target.nodeName;
|
|
if(clickedLabel != 'LABEL'){
|
|
return false;
|
|
}
|
|
|
|
if(jQuery(this).find('label').hasClass('label_checked')){
|
|
|
|
if(jQuery(this).find('label').html()=="All"){
|
|
addLogList("All");
|
|
} else {
|
|
addLogList(jQuery(this));
|
|
}
|
|
} else {
|
|
if(jQuery(this).find('label').html()=="All"){
|
|
removeLogList("All");
|
|
} else {
|
|
removeLogList(jQuery(this));
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
function addLogList(args){
|
|
if(args=="All"){
|
|
logFileList = [];
|
|
logFileList.push("All");
|
|
} else {
|
|
if(logFileList.length==1 && logFileList.indexOf("All")>=0){
|
|
logFileList = [];
|
|
}
|
|
selected = args.find('input').val();
|
|
logFileList.push(selected);
|
|
}
|
|
}
|
|
|
|
function removeLogList(args){
|
|
if(args=="All"){
|
|
logFileList = [];
|
|
} else {
|
|
if(logFileList.length==1 && logFileList.indexOf("All")>=0){
|
|
logFileList = [];
|
|
selectedVal = args.find('input').val();
|
|
|
|
jQuery('#logRows input').each(function(){
|
|
selected = jQuery(this).val();
|
|
logFileList.push(selected);
|
|
|
|
});
|
|
var index = logFileList.indexOf(selectedVal);
|
|
if(index>=0){
|
|
logFileList.splice(index, 1);
|
|
}
|
|
} else {
|
|
selected = args.find('input').val();
|
|
var index = logFileList.indexOf(selected);
|
|
if(index>=0){
|
|
logFileList.splice(index, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/* Function to refresh local drive quota - Start */
|
|
jQuery("div.wrapper section#content").off('click','.refresh-btn').on('click', '.refresh-btn', function() {
|
|
var diskName = jQuery('#selectBackupLocation').val();
|
|
delete dbUsedSize[diskName];
|
|
checkSelectedLocalPath(diskName,0,false);
|
|
});
|
|
/* Function to refresh local drive quota - End */
|
|
/* Function to check the reIndex/Backup job status - Start */
|
|
function checkSelectedLocalPath(name,action,onChange){
|
|
var prevLocation = $('#localBackupLocation').val();
|
|
if(manualLocalBackupRunning==true && action!=false){
|
|
jQuery('#selectBackupLocation').val(prevLocation);
|
|
jQuery('.common_msg').hide();
|
|
showErrorMessages('.head_search .error_msg','Backup is in progress. Please try again later');
|
|
return false;
|
|
} else if(manualLocalBackupRunning == false && action != false && reIndexStarted != true){
|
|
restore_radioBtn_chk = name;
|
|
$.ajax({
|
|
url: "action.php?action=checkMountedDrives&driveName="+encodeURIComponent(name),
|
|
type: "POST",
|
|
success: function(validatedData){
|
|
if(validatedData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
cmd = $.parseJSON(validatedData);
|
|
if(cmd[0] != true) {
|
|
var diskName = jQuery('select.localbkp_txtbox option[value="'+name+'"]').html();
|
|
if(diskName != '') {
|
|
showErrorMessages('.head_search .error_msg', '<b>' + diskName + '</b> not mounted');
|
|
} else {
|
|
showErrorMessages('.head_search .error_msg', 'External disks are not mounted.');
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
if(onChange==true && reIndexStarted==true){
|
|
showErrorMessages('.head_search .alert','Verifying the reindex process');
|
|
jQuery.ajax({
|
|
url: "action.php?action=reIndexWatcher",
|
|
success: function(data){
|
|
if(data.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
|
|
dataArray=$.parseJSON(data);
|
|
if(dataArray[0]==='running'){
|
|
jQuery('#selectBackupLocation').val(prevLocation);
|
|
$('#localbkp_path').html(prevLocation).attr('title',prevLocation);
|
|
$('#localBackupLocation').val(prevLocation);
|
|
selectedRestoreListPath = prevLocation;
|
|
jQuery('.common_msg').hide();
|
|
showErrorMessages('.head_search .error_msg','Reindex in progress. Please try again later');
|
|
return false;
|
|
} else {
|
|
setTimeout(function(){ jQuery('.common_msg').hide(); },500);
|
|
selectedLocalPath(name,action,onChange)
|
|
reIndexStarted=false;
|
|
}
|
|
}
|
|
});
|
|
|
|
} else {
|
|
selectedLocalPath(name,action,onChange)
|
|
}
|
|
}
|
|
/* Function to check the reIndex/Backup job status - End */
|
|
/* Function to modify selected Local Path - Start */
|
|
function selectedLocalPath(name,action,onChange){
|
|
if(onChange){
|
|
localRestoreSetArray = [];
|
|
defaultLocalRestoreSetArray = [];
|
|
defaultLocalRestoreSetTypeArray = [];
|
|
$('.space_used_value').html('0 KB');
|
|
var url = "action.php?action=updateLocalMPC&path="+encodeURIComponent(name);
|
|
if(typeof availableLocalDevices != "undefined" && availableLocalDevices.length > 0 && $('.localRestore').length > 0) {
|
|
url += "&dedupBucket=" + $('#localBackupHost').find("option:selected").attr('idr-bkt');
|
|
}
|
|
|
|
//Update local backup location
|
|
$.ajax({
|
|
url: url,
|
|
success: function(dataList){
|
|
if(dataList.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
$('#localbkp_path').html(name).attr('title',name);
|
|
$('#localBackupLocation').val(name);
|
|
selectedRestoreListPath = name;
|
|
|
|
if(action==1){
|
|
actionRequired=2;
|
|
}
|
|
|
|
if(typeof dbUsedSize[name] == 'undefined' || dbUsedSize[name] == ''){
|
|
$('.refresh-btn').hide();
|
|
$('#refreshLoader').show();
|
|
|
|
$.ajax({
|
|
url: "action.php?action=getUsedSize&path=" + encodeURIComponent(name) + "&cb=" + Date.now(),
|
|
success: function(dataList){
|
|
if(dataList.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
|
|
if(dataList.trim() == '') {
|
|
$('.refresh-btn').removeAttr('style');
|
|
$('#refreshLoader').hide();
|
|
return false;
|
|
}
|
|
|
|
dataListRes = $.parseJSON(dataList);
|
|
if(dataListRes[0] == true) {
|
|
$('.space_used_value').html(dataListRes[1]);
|
|
dbUsedSize[name] = dataListRes[1];
|
|
} else {
|
|
$('.space_used_value').html('0 KB');
|
|
dbUsedSize[name] = '0 KB';
|
|
}
|
|
$('.refresh-btn').removeAttr('style');
|
|
$('#refreshLoader').hide();
|
|
}
|
|
});
|
|
} else {
|
|
$('.space_used_value').html(dbUsedSize[name]);
|
|
$('#refreshLoader').hide();
|
|
$('.refresh-btn').removeAttr('style');
|
|
}
|
|
}
|
|
/* Function to modify selected Local Path - End */
|
|
/*
|
|
* Function to hide/show Create new restore set link - Start
|
|
* & display the corresponding restore list
|
|
*/
|
|
var selectedLocalDedupDevice = undefined;
|
|
var resetLocalRestoreList = false;
|
|
function checkAndSelectRestorePath(name, dropdown, noreset, elem){
|
|
noreset = (typeof noreset !== 'undefined') ? noreset : false;
|
|
if(reIndexStarted == true && $('.radio-restore:checked').val() != 'Online Account') {
|
|
$(".reindex_menu").css("display", "block");
|
|
$("#localBackupHost option[idr-bkt='" + previousSelectedDedupBucket + "']").prop('selected', true);
|
|
var reindexMsg = "Reindex is in progress...Please wait";
|
|
jQuery('.head_search .alert').attr('title', reindexMsg).find('p').html(reindexMsg);
|
|
$('.head_search .alert').show();
|
|
reIndexWatcher();
|
|
return false;
|
|
}
|
|
|
|
if(typeof elem != "undefined" && $(elem).attr('id') == "localBackupHost" && $('.localrestore_page').length > 0 && dedup == true) {
|
|
selectedLocalDedupDevice = jQuery('#localBackupHost option:selected').attr('idr-bkt');
|
|
resetLocalRestoreList = true;
|
|
}
|
|
|
|
if(dropdown == true) {
|
|
jQuery('select.restoreDropdown-txtbox').attr("title", $("select.restoreDropdown-txtbox option[value='" + name + "']").text());
|
|
}
|
|
|
|
var restoreValue = $('input[type=radio][name="restore_type_detail[]"]:checked').val();
|
|
if(dedup == true) {
|
|
if(manualRestoreRunning == true) {
|
|
jQuery('select[name="localBackupHost"]').val(selectedRestoreListPath);
|
|
showErrorMessages('.head_search .error_msg', 'Restore operation is in progress...Please wait');
|
|
return false;
|
|
} else if(manualLocalRestoreRunning == true) {
|
|
$("#localBackupHost option[idr-bkt='" + previousSelectedDedupBucket + "']").prop('selected', true);
|
|
showErrorMessages('.head_search .error_msg','Restore operation is in progress...Please wait');
|
|
return false;
|
|
} else if(restoreValue == 'Online Account'){
|
|
selectedRestoreListPath = jQuery('select.restoreDropdown-txtbox').val();
|
|
dedupSelectedDevice = selectedRestoreListPath;
|
|
selectedRestoreListPathDetail = restoreValue;
|
|
jQuery('#sourcePath').val(restoreValue);
|
|
jQuery('.reindex_menu').hide();
|
|
jQuery('.restore-dropdown,.option_menu,.backupset').show();
|
|
jQuery('#loadRestorePath').hide().siblings('.nfiles').show();
|
|
jQuery('#loadRestorePath').find('tbody').html('');
|
|
jQuery('#maincheck,#selectFiles #maincheck').siblings('label').removeAttr('class').css('visibility','hidden');
|
|
// jQuery('select.restoreDropdown-txtbox').val(restoreValue);
|
|
selectedRestorePath(restoreValue);
|
|
if(!noreset) {
|
|
defaultRestoreSetArray = [];
|
|
defaultRestoreSetTypeArray = [];
|
|
defaultRestoreSetFileInfo = [];
|
|
}
|
|
|
|
// reset local restore array as we are switching the tasks
|
|
defaultLocalRestoreSetArray = [];
|
|
defaultLocalRestoreSetTypeArray = [];
|
|
|
|
// Commented to display the selected restore set files after traversing from the tabs.
|
|
var urlCheck = "action.php?action=removeRestoreSetFiles";
|
|
$.get(urlCheck,function(jobdata){});
|
|
loadExistingJob('','restore');
|
|
return false;
|
|
} else {
|
|
defaultRestoreSetArray = [];
|
|
defaultRestoreSetTypeArray = [];
|
|
defaultRestoreSetFileInfo = [];
|
|
jQuery('.reindex_menu,.restore-dropdown').show();
|
|
jQuery('.option_menu,.backupset').hide();
|
|
|
|
if(typeof availableLocalDevices != "undefined" && availableLocalDevices.length > 0 && $('.localRestore').length > 0) {
|
|
previousSelectedDedupBucket = $('#localBackupHost').find("option:selected").attr('idr-bkt');
|
|
}
|
|
}
|
|
} else if(restoreValue=='Online Account'){
|
|
$(".usb-account").parent().hide();
|
|
$(".online-account").parent().show();
|
|
$('.reindex_menu').hide();
|
|
$('.restore-dropdown,.option_menu,.backupset').show();
|
|
$(".usb-account").attr("id", "select_restore_job_usb");
|
|
$(".online-account").attr("id", "select_restore_job");
|
|
selectedRestorePath(restoreValue);
|
|
}
|
|
|
|
if(restoreValue != 'Online Account') {
|
|
jQuery('.restore_page').children('.ajax_loader').eq(0).show();
|
|
$('.restore-dropdown, .reindex_menu').show();
|
|
$('.option_menu,.backupset').hide();
|
|
$(".usb-account").parent().show();
|
|
$(".online-account").parent().hide();
|
|
$(".usb-account").attr("id", "select_restore_job");
|
|
$(".online-account").attr("id", "select_restore_job_online");
|
|
|
|
var expressCkeckURL = "action.php?action=checkMountedDrives&driveName="+encodeURIComponent(name);
|
|
if(dedup == true && typeof availableLocalDevices != "undefined" && availableLocalDevices.length > 0 && $('.localRestore').length > 0) {
|
|
expressCkeckURL += "&dedupBucket=" + $('#localBackupHost').find("option:selected").attr('idr-bkt');
|
|
// Reset all the local restore arrays as we are refreshing the list
|
|
if(typeof resetLocalRestoreList == "undefined" || resetLocalRestoreList == true) {
|
|
defaultLocalRestoreSetArray = [];
|
|
defaultLocalRestoreSetTypeArray = [];
|
|
resetLocalRestoreList = false;
|
|
}
|
|
}
|
|
$.ajax({
|
|
url: expressCkeckURL,
|
|
type: "POST",
|
|
success: function(validatedData){
|
|
if(validatedData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
jQuery('.restore_page').children('.ajax_loader').eq(0).hide();
|
|
cmd = $.parseJSON(validatedData);
|
|
if(cmd[0] == true) {
|
|
selectedRestorePath(restoreValue);
|
|
} else {
|
|
if(dropdown == true){
|
|
var diskName = jQuery('select.restoreDropdown-txtbox option[value="'+name+'"]').html();
|
|
if(diskName != '')
|
|
showErrorMessages('.head_search .error_msg','<b>'+diskName+'</b> not mounted');
|
|
else
|
|
showErrorMessages('.head_search .error_msg','External disks are not mounted.');
|
|
|
|
$('input[name="restore_type_detail[]"][value="Online Account"]').prop("checked",true);
|
|
if(selectedRestoreListPathDetail != 'Online Account'){
|
|
selectedRestorePath('Online Account');
|
|
}
|
|
|
|
jQuery('input[name="restore_type_detail[]"][value="Online Account"]').trigger('click');
|
|
|
|
return false;
|
|
} else {
|
|
selectedRestoreListPathDetail = 'Online Account';
|
|
jQuery('.restoreDropdown-txtbox').val(selectedRestoreListPathDetail);
|
|
selectedRestorePath(selectedRestoreListPathDetail);
|
|
jQuery('input[name="restore_type_detail[]"][value="Online Account"]').trigger('click');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
function selectedRestorePath(name) {
|
|
$('.head_search .alert').hide();
|
|
jQuery('#sourcePath').val(name);
|
|
if(name != 'Online Account') {
|
|
selectedRestoreListPath = name;
|
|
}
|
|
|
|
if(currentRestoreJob == '') {
|
|
currentRestoreJob = 0;
|
|
}
|
|
//Checking whether Job needs to be to Edit or not
|
|
if(actionRequired == 2) {
|
|
editJob('restore');
|
|
}
|
|
|
|
if(manualLocalRestoreRunning == true) {
|
|
watchRestoreStatus();
|
|
clearTimeout(restoreTimeoutVar); //Stop watcher
|
|
restoreTimeoutVar = '';
|
|
} else {
|
|
jQuery("#startRestore").show();
|
|
jQuery("#cancelRestore,#cancellingRestore,.alert,div.loading_icon,.restore_loading_gray,#removeRestoresetFiles span").hide();
|
|
}
|
|
|
|
actionRequired = 1;
|
|
if(currentAjaxRequest) abortAjax(currentAjaxRequest);
|
|
if(currentLocalAjaxRequest)
|
|
{
|
|
abortAjax(currentLocalAjaxRequest);
|
|
currentLocalAjaxRequest = '';
|
|
}
|
|
if(name=='Online Account'){
|
|
clickedDirPath = '/';
|
|
jQuery('.body_wrap').removeClass('localrestore_page');
|
|
jQuery('#select_restore_job').val(currentRestoreJob).removeAttr('disabled');
|
|
jQuery('input[name="jobTypeManualTask"]').val('Restore');
|
|
jQuery('.reindex_menu').hide();
|
|
loadExistingJob(currentRestoreJob,'restore');
|
|
if(machine!='twotier'){
|
|
IDrive.Scheduler.selectSchedule(currentRestoreJob,'Restore');
|
|
jQuery('#dropdown .file_menu_rename,.option_menu').show();
|
|
}
|
|
} else {
|
|
clickedDirPath = name+'/';
|
|
jQuery('.body_wrap').addClass('localrestore_page');
|
|
jQuery('#select_restore_job').val('0').attr('disabled','disabled');
|
|
jQuery('#RestoreSchedule').hide();
|
|
jQuery('input[name="jobTypeManualTask"]').val('LocalRestore');
|
|
jQuery('#dropdown .file_menu_rename,.option_menu').hide();
|
|
jQuery('.reindex_menu').show();
|
|
|
|
if(reIndexStarted == false){
|
|
loadExistingJob(currentLocalRestoreJob,'localRestore');
|
|
} else {
|
|
jQuery('#loadRestorePath').siblings('.ajax_loader').show();
|
|
//$('.head_search .alert p').html("Reindex is in progress........Please wait");
|
|
msg = "Reindex is in progress...Please wait";
|
|
jQuery('.head_search .alert').attr('title',msg).find('p').html(msg);
|
|
$('.head_search .alert').show();
|
|
jQuery('#loadRestorePath').hide().siblings('.nfiles').show();
|
|
jQuery('#loadRestorePath').find('tbody').html('');
|
|
jQuery('#maincheck').siblings('label').css('visibility','hidden');
|
|
loadExistingJob(currentLocalRestoreJob,'localRestore');
|
|
reIndexWatcher();
|
|
}
|
|
}
|
|
}
|
|
/* Function to hide/show Create new restore set link - End */
|
|
|
|
(function($) {
|
|
// Log filtering JS code
|
|
$(document).on('change', '#log_date_selection', function(e) {
|
|
var params = {};
|
|
params.action = "log_list_table";
|
|
params.duration = (($('#log_date_selection').val() != "undefined" && $('#log_date_selection').val() != '')? $('#log_date_selection').val() : '');
|
|
$.ajax({
|
|
url: "action.php",
|
|
type: "GET",
|
|
dataType: "html",
|
|
data: params,
|
|
success: function(html) {
|
|
if(html.indexOf('<html>') > 0) {
|
|
window.location.href='../index.php';
|
|
}
|
|
|
|
$("div.wrapper section#content div#log_list_table").html(html);
|
|
IDrive.Scheduler.UpdateLogs(IDrive.LogList);
|
|
}
|
|
});
|
|
});
|
|
})(jQuery);
|
|
|
|
// Check whether the user is really logged in or not
|
|
function hasUserLoggedIn() {
|
|
if(jQuery('#registered_user').html() == "") {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
// Next Scheduled Event - JS
|
|
function processNextScheduledEvent()
|
|
{
|
|
if(!hasUserLoggedIn()) {
|
|
$("#nse_main_div").hide();
|
|
return true;
|
|
}
|
|
|
|
(function($) {
|
|
if(!$("#nse_main_div").is(":visible")) {
|
|
$("#nse_main_div").show();
|
|
}
|
|
|
|
$.getJSON("action.php?action=getNextScheduledTask", function(data) {
|
|
|
|
if(!jQuery.isEmptyObject(data) && Object.keys(data).length > 0) {
|
|
schedule_html = '';
|
|
$.each(data, function(ind, sch) {
|
|
schedule_html += '<div class="next-schdul-time"><span class="s_blu_txt">' + sch.jobType + ':</span> ' + sch.time + '</div>';
|
|
});
|
|
|
|
$('.next-schdul-time').remove();
|
|
$('.next-schdul-con').prepend(schedule_html);
|
|
$('.next-more-txt').show();
|
|
//if(Object.keys(data).length > 1) {
|
|
//$('.next-more-txt').show();
|
|
//}
|
|
} else {
|
|
$('.next-schdul-time').remove();
|
|
$('.next-schdul-con').prepend('<div class="next-schdul-time"><span class="s_blu_txt no_event">No Event</span></div>');
|
|
$('.next-more-txt').hide();
|
|
}
|
|
if(clickedURL == 'scheduler.php')
|
|
$('.next-more-txt').hide();
|
|
setTimeout(processNextScheduledEvent, 5000); //5 Sec
|
|
}).fail(function() {
|
|
window.location.href='../index.php';
|
|
});
|
|
})(jQuery);
|
|
}
|
|
|
|
(function($) {
|
|
$(document).ready(function() {
|
|
processNextScheduledEvent();
|
|
});
|
|
})(jQuery);
|
|
|
|
(function($) {
|
|
$(document).ready(function() {
|
|
$("#nse_main_div").on("click", function() {
|
|
if($("#nav_scheduler").hasClass("act") || !hasUserLoggedIn() || $(".s_blu_txt").hasClass("no_event")) {
|
|
return false;
|
|
}
|
|
|
|
/*if(!hasUserLoggedIn()) {
|
|
return false;
|
|
}*/
|
|
$("#nav_scheduler").trigger('click');
|
|
});
|
|
watcherForActiveJobs();
|
|
});
|
|
|
|
})(jQuery);
|
|
|
|
function updateRootLevelDisplaySettings(statusVal,val) {
|
|
if(typeof statusVal == "undefined" || statusVal == 0 || statusVal == "") {
|
|
rootLevelEnabled = false;
|
|
rootLevelVal = val.slice(0, -1);
|
|
} else {
|
|
rootLevelEnabled = true;
|
|
rootLevelVal = "/";
|
|
}
|
|
}
|
|
//function for showing backup/restore progress...
|
|
|
|
function watcherForActiveJobs() {
|
|
if(!hasUserLoggedIn()) {
|
|
$(".activity_prog_con,.progress_box,.drag_body_con").css("display","none");
|
|
jQuery('#nse_main_div').removeClass('backup-progress-active restore-progress-active');
|
|
return false;
|
|
}
|
|
var htmlContBackup = PROGR_HTML_CNT_BACKUP;
|
|
var htmlContRestore = PROGR_HTML_CNT_RESTORE;
|
|
var url = "action.php?action=checkActiveJobs";
|
|
watcherTime = PROGRESS_WATCHER_ENABLE_TIME;
|
|
|
|
ajaxRequestJobs = $.ajax({
|
|
url: url,
|
|
type: "GET",
|
|
success: function(obj) {
|
|
if(obj.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
if(obj==''){
|
|
watcherTime = PROGRESS_WATCHER_DISABLE_TIME;
|
|
clearTimeout(activeJobsTimeoutVar);
|
|
activeJobsTimeoutVar = setTimeout(watcherForActiveJobs, watcherTime);
|
|
return false;
|
|
}
|
|
obj = $.parseJSON(obj);
|
|
var jobsRuns = obj.jobArray;
|
|
if(jobsRuns == "")
|
|
$("#ptype").val("");
|
|
|
|
var aggTransfered = 0;
|
|
var aggTotalSize = 0;
|
|
var aggTimeRem = 0;
|
|
var aggTransferedRestore= 0;
|
|
var aggTotalSizeRestore = 0;
|
|
var backupJobCount = 0;
|
|
var restoreJobCount = 0;
|
|
var restore_perc = 0;
|
|
var backup_perc = 0;
|
|
|
|
//% calculation for consolidated progress backup/restore..
|
|
var tempBackArr = new Array();
|
|
var tempRestArr = new Array();
|
|
|
|
$.each(obj.jobArray, function(index, objinfo) {
|
|
|
|
var typeofJob = objinfo.jobType;
|
|
//var jobPath = objinfo.jobPath;
|
|
var jobName = objinfo.jobName;
|
|
var jobType = objinfo.BackupType;
|
|
var scannedFile = objinfo.fileScanning;
|
|
var fileSize = objinfo.getFileSize;
|
|
|
|
if(jobName == "+ManualTask" && typeofJob == "Backup")
|
|
jobName = SELECTED_BACKUP_SET;
|
|
|
|
if(jobName == "+ManualTask" && typeofJob == "Restore")
|
|
jobName = SELECTED_RESTORE_SET;
|
|
if(jobName == "+ManualTask" && typeofJob == "LocalBackup")
|
|
jobName = SELECTED_EXPRESS_BACKUP_SET;
|
|
|
|
if(jobName == "+ManualTask" && typeofJob == "LocalRestore")
|
|
jobName = SELECTED_EXPRESS_RESTORE_SET;
|
|
|
|
jobName = base64_encode(jobName,1);
|
|
jobName = jobName.replace(/[=]/gi, '');
|
|
|
|
if(!activeJobsetArray[typeofJob+'_'+jobName+'_transfered'])
|
|
activeJobsetArray[typeofJob+'_'+jobName+'_transfered'] = -1;
|
|
|
|
if(!activeJobsetArray[typeofJob+'_'+jobName+'_total'])
|
|
activeJobsetArray[typeofJob+'_'+jobName+'_total'] = -1;
|
|
|
|
if(!isNaN(objinfo.transfered) && objinfo.transfered !== null && objinfo.total >= 0)
|
|
{
|
|
activeJobsetArray[typeofJob+'_'+jobName+'_transfered'] = parseFloat(objinfo.transfered);
|
|
activeJobsetArray[typeofJob+'_'+jobName+'_total'] = parseFloat(objinfo.total);
|
|
}
|
|
|
|
if(!previousProgressData[typeofJob+'_'+jobName+'_transfered'])
|
|
previousProgressData[typeofJob+'_'+jobName+'_transfered'] = activeJobsetArray[typeofJob+'_'+jobName+'_transfered'];
|
|
|
|
//checking whether job exist , other wise remove div.
|
|
/* Here we are doing backup/restore progress avg progress for leftside div */
|
|
if(typeofJob == "Backup" || typeofJob == "LocalBackup"){
|
|
tempBackArr.push(jobName);
|
|
backupJobCount += 1;
|
|
|
|
if(previousProgressData[typeofJob+'_'+jobName+'_transfered'] > parseFloat(activeJobsetArray[typeofJob+'_'+jobName+'_transfered']))
|
|
{
|
|
aggTransfered = aggTransfered + parseFloat(previousProgressData[typeofJob+'_'+jobName+'_transfered']);
|
|
aggTotalSize = aggTotalSize + parseFloat(activeJobsetArray[typeofJob+'_'+jobName+'_total']);
|
|
}
|
|
else
|
|
{
|
|
aggTransfered = aggTransfered + parseFloat(activeJobsetArray[typeofJob+'_'+jobName+'_transfered']);
|
|
aggTotalSize = aggTotalSize + parseFloat(activeJobsetArray[typeofJob+'_'+jobName+'_total']);
|
|
}
|
|
|
|
if( aggTransfered >0 && aggTotalSize >0 && progressJobBackupCount > 0)
|
|
{
|
|
backup_perc = aggTransfered / aggTotalSize;
|
|
backup_perc = backup_perc * 100;
|
|
backup_perc = Math.round(backup_perc);
|
|
}
|
|
else if( aggTransfered == 0 && aggTotalSize == 0 && progressJobBackupCount > 0)
|
|
{
|
|
backup_perc = 100;
|
|
}
|
|
else if( aggTransfered == -1 )
|
|
{
|
|
backup_perc = 0;
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
tempRestArr.push(jobName);
|
|
restoreJobCount += 1;
|
|
if(previousProgressData[typeofJob+'_'+jobName+'_transfered'] >= parseFloat(activeJobsetArray[typeofJob+'_'+jobName+'_transfered']))
|
|
{
|
|
aggTransferedRestore = aggTransferedRestore + parseFloat(previousProgressData[typeofJob+'_'+jobName+'_transfered']);
|
|
aggTotalSizeRestore = aggTotalSizeRestore + parseFloat(activeJobsetArray[typeofJob+'_'+jobName+'_total']);
|
|
}
|
|
else
|
|
{
|
|
aggTransferedRestore = aggTransferedRestore + parseFloat(activeJobsetArray[typeofJob+'_'+jobName+'_transfered']);
|
|
aggTotalSizeRestore = aggTotalSizeRestore + parseFloat(activeJobsetArray[typeofJob+'_'+jobName+'_total']);
|
|
}
|
|
if( aggTransferedRestore >0 && aggTotalSizeRestore >0 && progressJobRestoreCount > 0)
|
|
{
|
|
restore_perc = aggTransferedRestore / aggTotalSizeRestore;
|
|
restore_perc = restore_perc * 100;
|
|
restore_perc = Math.round(restore_perc);
|
|
}
|
|
else if( aggTransferedRestore == 0 && aggTotalSizeRestore == 0 && progressJobRestoreCount > 0)
|
|
{
|
|
restore_perc = 100;
|
|
}
|
|
else if( aggTransferedRestore == -1 )
|
|
{
|
|
restore_perc = 0;
|
|
}
|
|
}
|
|
});
|
|
|
|
backup_perc = (backup_perc<=100)?backup_perc:100;
|
|
if((!(parseInt($("#activityProgress_backup_perc").text().replace('%', '')) >= 0 && progressJobBackupCount > 0 && backup_perc == 0) && backup_perc <= 100) || (tempBackArr.length > 0 && backup_perc == 0) || rm_backup_perc == 1)
|
|
{
|
|
$("#activityProgress_backup_perc").html(backup_perc+"%");
|
|
$("#left_status_bar_bg_backup").css("width",backup_perc+"%");
|
|
rm_backup_perc = 0;
|
|
}
|
|
restore_perc = (restore_perc<=100)?restore_perc:100;
|
|
if((!(parseInt($("#activityProgress_restore_perc").text().replace('%', '')) >= 0 && progressJobRestoreCount > 0 && restore_perc == 0) && restore_perc <= 100) || (tempRestArr.length > 0 && restore_perc == 0) || rm_restore_perc == 1)
|
|
{
|
|
$("#activityProgress_restore_perc").html(restore_perc+"%");
|
|
$("#left_status_bar_bg_restore").css("width",restore_perc+"%");
|
|
rm_restore_perc = 0;
|
|
}
|
|
/* Here we are doing backup/restore progress avg progress for leftside div */
|
|
|
|
/* Here we are checking any job finished in backup/restore.
|
|
If yes we are removing particular job */
|
|
var tmparr = new Array();
|
|
var divWithClass = $(".mainDivBackup");
|
|
$.each(divWithClass,function(index,eachrow)
|
|
{
|
|
var currdivid = eachrow.id;
|
|
if(currdivid.indexOf("LocalBackup_prog_") !== -1)
|
|
var chk_bk_job_id = currdivid.substring(12).replace("prog_",'');
|
|
else
|
|
var chk_bk_job_id = currdivid.substring(7).replace("prog_",'');
|
|
tmparr.push(chk_bk_job_id);
|
|
|
|
});
|
|
|
|
var bk_diff = $(tmparr).not(tempBackArr).get();
|
|
for(var m=0; m < bk_diff.length; m++)
|
|
{
|
|
$.each([ 'Backup', 'LocalBackup' ], function( Bkindex, Bkvalue ) {
|
|
var bk_tmp = bk_diff[m];
|
|
var bk_finalId = Bkvalue+"_prog_"+bk_tmp;
|
|
var bk_cnt_finalId = Bkvalue+"_count_" + bk_tmp;
|
|
var bk_cnt_finalVal = parseInt($("#"+bk_cnt_finalId).val());
|
|
if(bk_cnt_finalVal >5)
|
|
{
|
|
if(backupTimeoutVar != '')
|
|
{
|
|
if(Bkvalue == 'Backup')
|
|
watcher_bk_type = 'backup';
|
|
else
|
|
watcher_bk_type = 'localBackup';
|
|
|
|
watchBackupStatus(watcher_bk_type); //Modified by Senthil on 5-Jan-2017 and vijay
|
|
}
|
|
$("div#"+bk_finalId).parent().remove();
|
|
rm_backup_perc = 1;
|
|
$("#"+bk_cnt_finalId).val(1);
|
|
delete activeJobsetArray[Bkvalue+'_'+bk_tmp+'_transfered'];
|
|
delete activeJobsetArray[Bkvalue+'_'+bk_tmp+'_total'];
|
|
delete previousProgressData[Bkvalue+'_'+bk_tmp+'_transfered'];
|
|
if(progressJobBackupCount == "1" && $("#ptype").val() == "1")
|
|
{
|
|
$("#ptype").val("");
|
|
$(".progress_box").css({'display':'none'});
|
|
progressJobBackupCount = 0;
|
|
}
|
|
if(Bkvalue == 'Backup')
|
|
storageCalculate();
|
|
bk_diff.splice(m, 1);
|
|
}
|
|
else
|
|
{
|
|
$("#"+bk_cnt_finalId).val(parseInt($("#"+bk_cnt_finalId).val()) + 1);
|
|
backupJobCount += 1;
|
|
}
|
|
});
|
|
}
|
|
|
|
var tmparr1 = new Array();
|
|
var divWithClassR = $(".mainDivRestore");
|
|
|
|
$.each(divWithClassR,function(index,eachrow)
|
|
{
|
|
var currdivid = eachrow.id;
|
|
if(currdivid.indexOf("LocalRestore_prog_") !== -1)
|
|
var chk_rs_job_id = currdivid.substring(13).replace("prog_",'');
|
|
else
|
|
var chk_rs_job_id = currdivid.substring(8).replace("prog_",'');
|
|
tmparr1.push(chk_rs_job_id);
|
|
|
|
});
|
|
|
|
var rs_diff = $(tmparr1).not(tempRestArr).get();
|
|
for(var n=0; n < rs_diff.length; n++)
|
|
{
|
|
$.each([ 'Restore', 'LocalRestore' ], function( Rsindex, Rsvalue ) {
|
|
var rs_tmp = rs_diff[n];
|
|
var rs_finalId = Rsvalue+"_prog_"+rs_tmp;
|
|
var rs_cnt_finalId = Rsvalue+"_count_" + rs_tmp;
|
|
var rs_cnt_finalVal = parseInt($("#"+rs_cnt_finalId).val());
|
|
if(rs_cnt_finalVal >5)
|
|
{
|
|
if(restoreTimeoutVar != ''){
|
|
watchRestoreStatus();
|
|
} //Modified by Senthil on 5-Jan-2017
|
|
|
|
$("div#"+rs_finalId).parent().remove();
|
|
rm_restore_perc = 1; // modified fr issues fix Snigdha_2.04.04_11_4
|
|
$("#"+rs_cnt_finalId).val(1);
|
|
rs_diff.splice(n, 1);
|
|
|
|
delete activeJobsetArray[Rsvalue+'_'+rs_tmp+'_transfered'];
|
|
delete activeJobsetArray[Rsvalue+'_'+rs_tmp+'_total'];
|
|
delete previousProgressData[Rsvalue+'_'+rs_tmp+'_transfered'];
|
|
|
|
if(progressJobRestoreCount == "1" && $("#ptype").val() == "2")
|
|
{
|
|
$("#ptype").val("");
|
|
$(".progress_box").css({'display':'none'});
|
|
progressJobRestoreCount = 0;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$("#"+rs_cnt_finalId).val(parseInt($("#"+rs_cnt_finalId).val()) + 1);
|
|
restoreJobCount += 1;
|
|
}
|
|
});
|
|
/* else
|
|
{
|
|
$("#ptype").val("");
|
|
$(".progress_box").css({'display':'none'});
|
|
progressJobRestoreCount = 0;
|
|
} */
|
|
}
|
|
/* Here we are checking any job finished in backup/restore.
|
|
If yes we are removing particular job */
|
|
|
|
// If no job is available start the watcher with the time iteration of 10 sec
|
|
if(jobsRuns == "" && rs_diff.length == 0 && bk_diff.length == 0 )
|
|
{
|
|
$("#RestoreProgress").html("");
|
|
$("#BackupProgress").html("");
|
|
$(".activity_prog_con,.progress_box,.drag_body_con").css("display","none");
|
|
jQuery('#nse_main_div').removeClass('backup-progress-active restore-progress-active');
|
|
$("#ptype").val("");
|
|
progressJobBackupCount = 0;
|
|
progressJobRestoreCount = 0;
|
|
activeJobsetArray = [];
|
|
watcherTime = PROGRESS_WATCHER_DISABLE_TIME;
|
|
clearTimeout(activeJobsTimeoutVar);
|
|
activeJobsTimeoutVar = setTimeout(watcherForActiveJobs, watcherTime);
|
|
return false;
|
|
}
|
|
|
|
if(isNaN(backupJobCount) === true || backupJobCount === 0)
|
|
{
|
|
$("#activity_progress_for_backup").hide();
|
|
$("#activity_progress_for_restore").css({'box-shadow':'none'});
|
|
jQuery('#nse_main_div').removeClass('backup-progress-active');
|
|
manualBackupRunning=false;
|
|
}
|
|
|
|
if(isNaN(restoreJobCount) === true || restoreJobCount === 0)
|
|
{
|
|
$("#activity_progress_for_restore").hide();
|
|
$("#activity_progress_for_restore").css({'box-shadow':'none'});
|
|
jQuery('#nse_main_div').removeClass('restore-progress-active');
|
|
}
|
|
|
|
// updating no.of jobs running in backup/restore
|
|
progressJobBackupCount = backupJobCount;
|
|
progressJobRestoreCount = restoreJobCount;
|
|
|
|
if(backupJobCount === 0 && restoreJobCount === 0)
|
|
$(".progress_box").css({'display':'none'});
|
|
|
|
if((progressJobRestoreCount == 0 && $("#ptype").val() == "2") || (progressJobBackupCount == 0 && $("#ptype").val() == "1"))
|
|
{
|
|
$("#ptype").val("");
|
|
$(".progress_box").css({'display':'none'});
|
|
}
|
|
|
|
/* appending or updating rightside box backup/restore job contents */
|
|
if(backupJobCount > 0 || restoreJobCount > 0)
|
|
{
|
|
/* based on the backup/restore click showing div in rightside and hiding overall progress leftside*/
|
|
if(backupJobCount > 0)
|
|
{
|
|
if(($("#ptype").val() == "2" || $("#ptype").val() == "") && jobsRuns != "")
|
|
{
|
|
$(".activity_prog_con").css({'display':'block'});
|
|
$("#activity_progress_for_backup").css({'display':'block'});
|
|
jQuery('#nse_main_div').addClass('backup-progress-active');
|
|
}
|
|
|
|
if($('#activity_progress_for_restore').css('display') == 'block')
|
|
$("#activity_progress_for_restore").css({'box-shadow':'0 -5px 2px -5px #333'});
|
|
}
|
|
if(restoreJobCount > 0)
|
|
{
|
|
if(($("#ptype").val() == "1" || $("#ptype").val() == "") && jobsRuns != "")
|
|
{
|
|
$(".activity_prog_con").css({'display':'block'});
|
|
$("#activity_progress_for_restore").css({'display':'block'});
|
|
$("#activity_progress_for_restore").css({'box-shadow':'none'});
|
|
jQuery('#nse_main_div').addClass('restore-progress-active');
|
|
}
|
|
if($('#activity_progress_for_backup').css('display') == 'block')
|
|
$("#activity_progress_for_restore").css({'box-shadow':'0 -5px 2px -5px #333'});
|
|
|
|
}
|
|
/* End of based on the backup/restore click showing div in rightside and hiding overall progress leftside*/
|
|
|
|
$.each(obj.jobArray, function(index1, objinfo1)
|
|
{
|
|
var typeofJob = objinfo1.jobType;
|
|
//var jobPath = objinfo1.jobPath;
|
|
var jobName = objinfo1.jobName;
|
|
//var splitJobPath = jobPath.split('/').pop();
|
|
var fileSize = objinfo1.getFileSize;
|
|
var Transfered = objinfo1.transferedRate;
|
|
var TotalSize = objinfo1.totalSize;
|
|
var TimeRem = objinfo1.remainingTime;
|
|
var scannedFile = objinfo1.fileScanning;
|
|
if(scannedFile != "" && scannedFile !== null)
|
|
scannedFile = prepareProgressText(scannedFile, 40, .5);
|
|
//scannedFile = scannedFile.substr(0,40);
|
|
|
|
backupTransfered = objinfo1.transfered;
|
|
backupTotalSize = objinfo1.total;
|
|
job_perc_round = 0;
|
|
|
|
if(jobName == "+ManualTask" && typeofJob == "Backup")
|
|
transferedJobName = SELECTED_BACKUP_SET;
|
|
else if(jobName == "+ManualTask" && typeofJob == "Restore")
|
|
transferedJobName = SELECTED_RESTORE_SET;
|
|
else if(jobName == "+ManualTask" && typeofJob == "LocalBackup")
|
|
transferedJobName = SELECTED_EXPRESS_BACKUP_SET;
|
|
else if(jobName == "+ManualTask" && typeofJob == "LocalRestore")
|
|
transferedJobName = SELECTED_EXPRESS_RESTORE_SET;
|
|
else
|
|
transferedJobName = jobName.trim();
|
|
|
|
transferedJobName = base64_encode(transferedJobName,1);
|
|
transferedJobName = transferedJobName.replace(/[=]/gi, '');
|
|
|
|
if(previousProgressData[typeofJob+'_'+transferedJobName+'_transfered'] > backupTransfered)
|
|
backupTransfered = previousProgressData[typeofJob+'_'+transferedJobName+'_transfered'];
|
|
|
|
if( backupTransfered >0 && backupTotalSize >0 && ( backupJobCount > 0 || restoreJobCount > 0))
|
|
{
|
|
job_perc = backupTransfered / backupTotalSize;
|
|
job_perc = job_perc * 100;
|
|
job_perc_round = Math.round(job_perc);
|
|
}
|
|
else if( backupTransfered == 0 && backupTotalSize == 0 && ( backupJobCount > 0 || restoreJobCount > 0))
|
|
{
|
|
job_perc_round = 100;
|
|
}
|
|
|
|
if((typeofJob == "Backup" || typeofJob == "LocalBackup") && backupJobCount > 0)
|
|
{
|
|
if(jobName == "+ManualTask" && typeofJob == "Backup")
|
|
jobName = SELECTED_BACKUP_SET;
|
|
if(jobName == "+ManualTask" && typeofJob == "LocalBackup")
|
|
jobName = SELECTED_EXPRESS_BACKUP_SET;
|
|
if(typeofJob == "Backup")
|
|
var jobType = objinfo1.BackupType;
|
|
else if(typeofJob == "LocalBackup")
|
|
var jobType = objinfo1.LocalBackupType;
|
|
// will check with deepak about this change.
|
|
//$("#act_progress").html(typeofJob);
|
|
var bk_jb_name = jobName.trim();
|
|
//bk_jb_name = bk_jb_name.split(' ').join('_');
|
|
//bk_jb_name = bk_jb_name.replace(/[\/]/g,'_');
|
|
bk_jb_name = base64_encode(bk_jb_name,1);
|
|
bk_jb_name = bk_jb_name.replace(/[=]/gi, '');
|
|
var myDivId = typeofJob+"_prog_" + bk_jb_name;
|
|
var bk_cnt = typeofJob+"_count_" + bk_jb_name;
|
|
var a = jobType.toLowerCase();
|
|
jobType = a.substr(0,1).toUpperCase()+a.substr(1);
|
|
if($("#ptype").val() == "1")
|
|
{
|
|
var height = "130px";
|
|
if(backupJobCount > 1)
|
|
height = "252px";
|
|
$(".drag_body_con").css("height",height);
|
|
}
|
|
|
|
if(backupJobCount == 1)
|
|
$("#BackupProgress .progress_body_con").css({'border-bottom':'0px'});
|
|
else
|
|
$("#BackupProgress .progress_body_con").css({'border-bottom':'1px solid #cfcfcf'});
|
|
if(jobType != '')
|
|
jobType = jobType+":";
|
|
|
|
if(!$("#"+myDivId).length)
|
|
{
|
|
// here we care preparing div structure for very first time based on the output for backup
|
|
|
|
$("#BackupProgress").prepend(htmlContBackup);
|
|
$(".mainDivBackup").first().attr("id",myDivId);
|
|
$("#"+myDivId+" input[type='hidden']").attr('id',bk_cnt);
|
|
|
|
$("span:contains('prog_backup_job_name')").html(jobName);
|
|
|
|
if((scannedFile != "" && scannedFile !== null && scannedFile != "null") && (fileSize != "" && fileSize !== null && fileSize != "null")){
|
|
scannedFilewithSlash = scannedFile;
|
|
if(typeofJob != "LocalBackup")
|
|
scannedFilewithSlash = " /"+scannedFile;
|
|
$("span:contains('prog_backup_job_type')").html("<b>"+jobType+"</b>");
|
|
$("span:contains('prog_backup_file_name')").html(" /"+scannedFilewithSlash).attr("title",objinfo1.fileScanning);
|
|
$("div:contains('prog_backup_file_size'):last").html(fileSize);
|
|
} else if(parseFloat(backupTotalSize) <= 0) {
|
|
$("span:contains('prog_backup_job_type')").html("");
|
|
$("span:contains('prog_backup_file_name')").html(PREPARING_LIST);
|
|
$("div:contains('prog_backup_file_size'):last").html("");
|
|
}
|
|
|
|
if(parseFloat(backupTotalSize) > 0)
|
|
{
|
|
$("span:contains('prog_backup_job_type')").html("<strong>"+jobType+"</strong>");
|
|
|
|
if(scannedFile != "" && scannedFile !== null && scannedFile != "null" && fileSize != "" && fileSize !== null)
|
|
{
|
|
scannedFilewithSlash = scannedFile;
|
|
if(typeofJob != "LocalBackup")
|
|
scannedFilewithSlash = " /"+scannedFile;
|
|
$("span:contains('prog_backup_file_name')").html(" /"+scannedFilewithSlash).attr("title",objinfo1.fileScanning);
|
|
$("div:contains('prog_backup_file_size'):last").html(fileSize);
|
|
}
|
|
/*if(job_perc_round <= 100){*/
|
|
job_perc_round = (job_perc_round<=100)?job_perc_round:"100";
|
|
$("div:contains('prog_backup_per11'):last").html(job_perc_round+"%");
|
|
$("div:contains('prog_backup_bar'):last").css("width",job_perc_round+"%");
|
|
$("div:contains('prog_backup_bar'):last").html("");
|
|
/*}*/
|
|
if(TotalSize > 0)
|
|
{
|
|
$("span:contains('prog_Backing Up11')").html("Backing up: "+Transfered+" of "+TotalSize);
|
|
if(TimeRem!="" && TimeRem!=null)
|
|
$("div:contains('prog_timeRemBackup11'):last").html("About "+TimeRem +" remaining");
|
|
}else{
|
|
$("span:contains('prog_Backing Up11')").html("");
|
|
$("div:contains('prog_timeRemBackup11'):last").html("");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$("span:contains('prog_backup_job_type')").html("");
|
|
$("span:contains('prog_backup_file_name')").html(PREPARING_LIST);
|
|
$("div:contains('prog_backup_file_size'):last").html("");
|
|
$("div:contains('prog_backup_per11'):last").html("");
|
|
$("div:contains('prog_backup_bar'):last").css({'width':'0%'});
|
|
$("div:contains('prog_backup_bar'):last").html("");
|
|
$("span:contains('prog_Backing Up11')").html("");
|
|
$("div:contains('prog_timeRemBackup11'):last").html("");
|
|
$("#"+myDivId).find(".green-txt").html("0%");
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
// here we care updating div contents for existing jobs based on the output for backup
|
|
|
|
$("#"+myDivId).find("#BackupType").html("<strong>"+jobType+"</strong>");
|
|
|
|
if(scannedFile != "" && scannedFile !== null && scannedFile != "null" && fileSize != "" && fileSize !== null)
|
|
{
|
|
scannedFilewithSlash = scannedFile;
|
|
if(typeofJob != "LocalBackup")
|
|
scannedFilewithSlash = " /"+scannedFile;
|
|
|
|
$("#"+myDivId).find("#scannedFile").html(scannedFilewithSlash).attr("title",objinfo1.fileScanning);
|
|
$("#"+myDivId).find("#scannedFileSize").html(fileSize);
|
|
}
|
|
bkProgressVal = parseInt($("#"+myDivId).find(".green-txt").html().replace('%', ''));
|
|
if(job_perc_round != 0 && bkProgressVal <= job_perc_round)
|
|
{
|
|
job_perc_round = (job_perc_round <= 100)?job_perc_round:"100";
|
|
$("#"+myDivId).find(".green-txt").html(job_perc_round+"%");
|
|
$("#"+myDivId).find("#green_bar_backup").css("width",job_perc_round+"%");
|
|
}
|
|
|
|
if(Transfered != "" && Transfered !== null && Transfered != 0 && TotalSize != -1)
|
|
{
|
|
if(previousProgressData[typeofJob+'_'+transferedJobName+'_transfered'] < backupTransfered)
|
|
{
|
|
previousProgressData[typeofJob+'_'+transferedJobName+'_transfered'] = backupTransfered;
|
|
$("#"+myDivId).find("#sizeofBackedUp").html("Backing up: "+Transfered+" of "+TotalSize);
|
|
if(TimeRem!="" && TimeRem!=null)
|
|
$("#"+myDivId).find("#timeLeft").html("About "+TimeRem+" remaining");
|
|
}
|
|
}
|
|
else if($("#"+myDivId).find("#timeLeft").text() == "")
|
|
{
|
|
$("#"+myDivId).find("#timeLeft").html(CALCULATING);
|
|
}
|
|
|
|
if(job_perc_round == 100 && TimeRem == 0 )
|
|
$("#"+myDivId).find("#timeLeft").hide();
|
|
}
|
|
|
|
}
|
|
else if(restoreJobCount > 0)
|
|
{
|
|
// here we care preparing div structure for very first time based on the output for restore
|
|
if(typeofJob == "Restore")
|
|
var jobType = objinfo1.RestoreType;
|
|
else if (typeofJob == "LocalRestore")
|
|
var jobType = objinfo1.LocalRestoreType;
|
|
|
|
var a = jobType.toLowerCase();
|
|
jobType = a.substr(0,1).toUpperCase()+a.substr(1);
|
|
if($("#ptype").val() == "2")
|
|
{
|
|
var height = "130px";
|
|
if(restoreJobCount > 1)
|
|
height = "252px";
|
|
$(".drag_body_con").css("height",height);
|
|
}
|
|
if(restoreJobCount == 1)
|
|
$("#RestoreProgress .progress_body_con").css({'border-bottom':'0px'});
|
|
else
|
|
$("#RestoreProgress .progress_body_con").css({'border-bottom':'1px solid #cfcfcf'});
|
|
|
|
if(jobName == "+ManualTask" && typeofJob == "Restore")
|
|
jobName = SELECTED_RESTORE_SET;
|
|
else if(jobName == "+ManualTask")
|
|
jobName = SELECTED_EXPRESS_RESTORE_SET;
|
|
|
|
var rs_jb_name = jobName.trim();
|
|
//rs_jb_name = rs_jb_name.replace(/[\/]/g,'_');
|
|
rs_jb_name = base64_encode(rs_jb_name,1);
|
|
rs_jb_name = rs_jb_name.replace(/[=]/gi, '');
|
|
|
|
//rs_jb_name = rs_jb_name.split(' ').join('_');
|
|
|
|
var myDivId = typeofJob+"_prog_"+rs_jb_name;
|
|
var rs_cnt = typeofJob+"_count_" + rs_jb_name;
|
|
|
|
if(jobType != '')
|
|
jobType = jobType+":";
|
|
|
|
if(!$("#"+myDivId).length)
|
|
{
|
|
$("#RestoreProgress").prepend(htmlContRestore);
|
|
$(".mainDivRestore").first().attr("id",myDivId);
|
|
$("#"+myDivId+" input[type='hidden']").attr('id',rs_cnt);
|
|
$("span:contains('prog_restore_job_name')").html(jobName);
|
|
|
|
if((scannedFile != "" && scannedFile !== null && scannedFile != "null") && (fileSize != "" && fileSize !== null && fileSize != "null")){
|
|
$("span:contains('prog_restore_job_type')").html("<b>"+jobType+"</b>");
|
|
$("span:contains('prog_restore_file_name')").html(" /"+scannedFile).attr("title",objinfo1.fileScanning);
|
|
$("div:contains('prog_restore_file_size'):last").html(fileSize);
|
|
} else if(parseFloat(backupTotalSize) <= 0) {
|
|
$("span:contains('prog_restore_job_type')").html("");
|
|
$("span:contains('prog_restore_file_name')").html(PREPARING_LIST);
|
|
$("div:contains('prog_restore_file_size'):last").html("");
|
|
}
|
|
|
|
if(parseFloat(backupTotalSize) > 0)
|
|
{
|
|
|
|
/*if(job_perc_round <= 100){*/
|
|
job_perc_round = (job_perc_round<=100)?job_perc_round:"100";
|
|
$("div:contains('prog_restore_per11'):last").html(job_perc_round+"%");
|
|
$("div:contains('prog_restore_bar'):last").css("width",job_perc_round+"%");
|
|
$("div:contains('prog_restore_bar'):last").html("");
|
|
/*}*/
|
|
if(TotalSize > 0) {
|
|
$("span:contains('prog_restoring')").html("Restoring: "+Transfered+" of "+TotalSize);
|
|
$("div:contains('prog_timeRemRestore11'):last").html(TimeRem);
|
|
}else
|
|
{
|
|
$("span:contains('prog_restoring')").html("");
|
|
$("div:contains('prog_timeRemRestore11'):last").html("");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$("div:contains('prog_restore_per11'):last").html("");
|
|
$("div:contains('prog_restore_bar'):last").css({'width':'0%'});
|
|
$("div:contains('prog_restore_bar'):last").html("");
|
|
$("span:contains('prog_restoring')").html("");
|
|
$("div:contains('prog_timeRemRestore11'):last").html("");
|
|
$("#"+myDivId).find(".green-txt").html("0%");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// here we care updating div contents for existing jobs based on the output for restore
|
|
|
|
$("#"+myDivId).find("#RestoreType").html("<strong>"+jobType+"</strong>");
|
|
if(scannedFile != "" && scannedFile !== null && scannedFile != "null" && fileSize != "" && fileSize !== null)
|
|
{
|
|
if(typeofJob != "LocalRestore")
|
|
scannedFile = " /"+scannedFile;
|
|
$("#"+myDivId).find("#scannedFileRestore").html(scannedFile).attr("title",objinfo1.fileScanning);
|
|
$("#"+myDivId).find("#scannedFileSizeRestore").html(fileSize);
|
|
}
|
|
if(job_perc_round != 0)
|
|
{
|
|
job_perc_round = (job_perc_round <= 100)?job_perc_round:"100";
|
|
$("#"+myDivId).find(".green-txt").html(job_perc_round+"%");
|
|
$("#"+myDivId).find("#green_bar_restore").css("width",job_perc_round+"%");
|
|
}
|
|
|
|
if(Transfered != "" && Transfered !== null && Transfered != 0 && TotalSize != -1)
|
|
{
|
|
if(previousProgressData[typeofJob+'_'+transferedJobName+'_transfered'] < backupTransfered)
|
|
{
|
|
previousProgressData[typeofJob+'_'+transferedJobName+'_transfered'] = backupTransfered;
|
|
if(TimeRem!="" && TimeRem!=null)
|
|
$("#"+myDivId).find("#timeLeftRestore").html("About "+TimeRem+" remaining");
|
|
$("#"+myDivId).find("#sizeofRestore").html("Restoring: "+Transfered+" of "+TotalSize);
|
|
}
|
|
}
|
|
else if($("#"+myDivId).find("#timeLeftRestore").text() == "")
|
|
{
|
|
$("#"+myDivId).find("#timeLeftRestore").html(CALCULATING);
|
|
}
|
|
|
|
if(job_perc_round == 100 && TimeRem == ZERO_SECONDS )
|
|
$("#"+myDivId).find("#timeLeftRestore").hide();
|
|
}
|
|
}
|
|
});
|
|
activeJobsTimeoutVar = setTimeout(watcherForActiveJobs, watcherTime);
|
|
}
|
|
else{
|
|
previousProgressData = new Array();
|
|
activeJobsetArray = new Array();
|
|
$(".activity_prog_con").css("display","none");
|
|
jQuery('#nse_main_div').removeClass('backup-progress-active restore-progress-active');
|
|
}
|
|
/* End of appending or updating rightside box backup/restore job contents */
|
|
},
|
|
error: function() {
|
|
window.location.href='../index.php';
|
|
}
|
|
});
|
|
}
|
|
|
|
$(document).on('click', "#min_act_icon_backup",function(){
|
|
var height = "130px";
|
|
$("#ptype").val("1");
|
|
var jobCount = progressJobBackupCount;
|
|
if(jobCount > 1)
|
|
height = "252px";
|
|
$(".drag_body_con").css("height",height);
|
|
$(".drag_body_con").css("display","block");
|
|
|
|
$(".progress_hdr").show();
|
|
$("#progress_hdr_rht_backup").show();
|
|
$("#act_progress").html("Backup Progress");
|
|
$("#BackupProgress").show();
|
|
$("#RestoreProgress").hide();
|
|
//$("#activity_progress_for_restore").css("box-shadow","");
|
|
if(progressJobRestoreCount > 0 )
|
|
{
|
|
$("#activity_progress_for_restore").css({"display":"block"});
|
|
jQuery('#nse_main_div').addClass('restore-progress-active');
|
|
}
|
|
$("#activity_progress_for_restore").css({"box-shadow":"none"});
|
|
$("#activity_progress_for_backup").css({"display":"none"});
|
|
jQuery('#nse_main_div').removeClass('backup-progress-active');
|
|
if($("#activity_progress_for_restore").css("display") == "none")
|
|
{
|
|
$(".activity_prog_con").css("display","none");
|
|
jQuery('#nse_main_div').removeClass('restore-progress-active');
|
|
//jQuery('#nse_main_div').removeClass('backup-progress-active restore-progress-active');
|
|
}
|
|
|
|
$(".progress_box").css("display","block");
|
|
|
|
});
|
|
$(document).on('click', "#min_act_icon_restore",function(){
|
|
$("#ptype").val("2");
|
|
$("#activity_progress_for_restore").css("display","none");
|
|
jQuery('#nse_main_div').removeClass('restore-progress-active');
|
|
$("#act_progress").html("Restore Progress");
|
|
var height = "130px";
|
|
var jobCount = progressJobRestoreCount;
|
|
if(jobCount > 1)
|
|
height = "252px";
|
|
$(".drag_body_con").css("height",height);
|
|
$(".drag_body_con").css("display","block");
|
|
$(".progress_hdr").show();
|
|
$("#RestoreProgress").show();
|
|
$("#BackupProgress").hide();
|
|
|
|
if(progressJobBackupCount > 0 )
|
|
{
|
|
$("#activity_progress_for_backup").css("display","block");
|
|
jQuery('#nse_main_div').addClass('backup-progress-active');
|
|
}
|
|
|
|
|
|
if($("#activity_progress_for_backup").css("display") == "none"){
|
|
$(".activity_prog_con").css("display","none");
|
|
jQuery('#nse_main_div').removeClass('backup-progress-active');
|
|
}
|
|
$(".progress_box").css("display","block");
|
|
});
|
|
$(document).on('click', ".close-icon",function(){
|
|
$(".progress_hdr").show();
|
|
$(".activity_prog_con").css("display","block");
|
|
$("#BackupProgress").hide();
|
|
$(".drag_body_con").hide();
|
|
var checkFlag = $("#ptype").val();
|
|
|
|
if(checkFlag == "1"){
|
|
$("#activity_progress_for_backup").show();
|
|
jQuery('#nse_main_div').removeClass('backup-progress-active');
|
|
} else if(checkFlag == "2"){
|
|
$("#activity_progress_for_restore").show();
|
|
jQuery('#nse_main_div').removeClass('restore-progress-active');
|
|
}
|
|
|
|
if(progressJobBackupCount > 0 )
|
|
$("#activity_progress_for_restore").css({'box-shadow':'0 -5px 2px -5px #333'});
|
|
|
|
$(".progress_box").css("display","none");
|
|
$("#ptype").val("");
|
|
});
|
|
$('.minimize-icon').click(function(){
|
|
$(".drag_body_con").slideToggle("2000,slow");
|
|
});
|
|
|
|
function prepareProgressText(str, maxLength, ellipsisLocationPercentage,placeholder){
|
|
/*
|
|
ARGUMENTS:
|
|
str - the string you want to maninpulate
|
|
maxLength - max number of characters allowed in return string
|
|
ellipsisLocationPercentage (optional) - How far (percentage wise) into the return string you want the ellipses to be placed
|
|
Examples:
|
|
.85 : This is a very long string. This is a very long string. This is a very long string. This is a ver[...]very long string.
|
|
.25 : This is a very long string. [...]g. This is a very long string. This is a very long string. This is a very long string.
|
|
placeholder (optional) - this will be used to replace the removed substring. Suggestions : '...', '[..]', '[ ... ]', etc....
|
|
*/
|
|
if(ellipsisLocationPercentage == null || isNaN(ellipsisLocationPercentage) || ellipsisLocationPercentage >= 1 || ellipsisLocationPercentage <= 0)
|
|
{
|
|
ellipsisLocationPercentage = .85;
|
|
}
|
|
if(placeholder == null || placeholder =="")
|
|
{
|
|
placeholder = " ... ";
|
|
}
|
|
|
|
if (str.length > (maxLength-placeholder.length))
|
|
{
|
|
//get the end of the string
|
|
var beginning = str.substr(0, (maxLength - placeholder.length)*ellipsisLocationPercentage );
|
|
var end = str.substr(str.length-(maxLength - placeholder.length) * (1-ellipsisLocationPercentage));
|
|
return beginning + placeholder + end;
|
|
}
|
|
return str;
|
|
}
|
|
|
|
function ajaxCallForCleareRestoreList(type,dirName){
|
|
dirName = typeof dirName === 'undefined' ? '' : dirName;
|
|
jQuery.ajax({
|
|
url: 'action.php?action=refresh&type='+type+'&dirName='+encodeURIComponent(dirName),
|
|
success: function(outputData){
|
|
if(outputData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
}
|
|
});
|
|
}
|