3137 lines
114 KiB
JavaScript
Executable File
3137 lines
114 KiB
JavaScript
Executable File
var request_sent_share = "", request_sent_details = "";
|
|
var DeleteItem = "";
|
|
var isRefresh = false;
|
|
var isDedupRefresh = false;
|
|
|
|
jQuery(document).ready(function() {
|
|
var popupTabs='.popContent .popup_tabs td',
|
|
manageRowSelected='.jobs_table tr',
|
|
CommonMsg=jQuery(".common_msg"),
|
|
MsgCloseBtn=jQuery('.close_info');
|
|
|
|
// manage all scheduled job related row click event
|
|
jQuery("div.wrapper section#content").off('click',manageRowSelected).on('click', manageRowSelected, function() {
|
|
jQuery(manageRowSelected).removeClass('active');
|
|
jQuery(this).addClass('active');
|
|
});
|
|
|
|
// common message display related event
|
|
setTimeout(function(){CommonMsg.fadeOut(); }, 5000);
|
|
MsgCloseBtn.mousedown(function(){CommonMsg.hide();});
|
|
jQuery(document).off('click', '.close_info').on('click', '.close_info', function() {
|
|
jQuery(".common_msg").hide();
|
|
});
|
|
|
|
// Popup Tabs button changes
|
|
jQuery("div.wrapper section#content").off('click', popupTabs).on('click', popupTabs, function() {
|
|
|
|
jQuery('.popContent .popup_tabs td').removeClass('active');
|
|
jQuery(this).addClass('active');
|
|
if(jQuery('.selected_after').hasClass('active')){
|
|
jQuery('.popContent .ajax_loader').show();
|
|
|
|
var clickedTabId = jQuery(this).parent('tr').attr('id');
|
|
|
|
jQuery('.newBkpSet .breadcrumb,.selectedFiles_tab,#newBackupSet,#newRestoreSet').hide();
|
|
setTimeout(function(){
|
|
jQuery('.popContent .ajax_loader,#selectFiles').hide();
|
|
jQuery('#selectedFiles').show();
|
|
|
|
if(clickedTabId == 'backupTab')
|
|
var selectedItemCount = newBackupSetArray.length;
|
|
else
|
|
var selectedItemCount = newRestoreSetArray.length;
|
|
|
|
if(selectedItemCount>0)
|
|
jQuery('.selected_bdr .nfiles').hide();
|
|
else
|
|
jQuery('.selected_bdr .nfiles').show();
|
|
|
|
}, 300);
|
|
|
|
} else {
|
|
jQuery('.popContent .excludefiles').show();
|
|
jQuery('.popContent .ajax_loader,.popContent .nfiles,#selectedFiles').hide();
|
|
jQuery('.newBkpSet .breadcrumb,.selectedFiles_tab,#selectFiles,#selectFiles #newBackupSet,#newRestoreSet').show();
|
|
}
|
|
});
|
|
|
|
|
|
jQuery("div.wrapper section#content").off('click','.excludeContainer,.logos_exclude').on({
|
|
mouseenter : function() {
|
|
if(!jQuery(this).hasClass('searchSection')){
|
|
jQuery(this).find('.excludefiles').css({'overflow': 'auto'});
|
|
}
|
|
},
|
|
mouseleave: function(){
|
|
if(!jQuery(this).hasClass('searchSection')){
|
|
jQuery(this).find('.excludefiles').css({'overflow': 'hidden'});
|
|
}
|
|
}
|
|
},'.excludeContainer,.logos_exclude');
|
|
|
|
jQuery('.remem_box label').click(function(){
|
|
jQuery(this).toggleClass('label_checked');
|
|
|
|
});
|
|
|
|
/* Dedup popup - start */
|
|
jQuery("div.wrapper section#content").off('click','#createNewLocation').on('click','#createNewLocation', function() {
|
|
createNewLocation();
|
|
});
|
|
|
|
jQuery("div.wrapper section#content").off('click','#linkExistingLocation').on('click','#linkExistingLocation', function(){
|
|
$.popContainerHide();
|
|
jQuery('.popContent .popup_tabs td').removeClass('active');
|
|
$.popContainer();
|
|
jQuery(secPosCont).append(jQuery('.table-popup').show());
|
|
jQuery(popcont).addClass('popLeft');
|
|
jQuery('.select-loc-tbl tr').removeClass('highlight');
|
|
jQuery('.select-loc-tbl tr:first').addClass('highlight');
|
|
});
|
|
|
|
/*jQuery("div.wrapper section#content").off('click','#backToSelectLocation').on('click','#backToSelectLocation', function(){
|
|
$.popContainerHide();
|
|
jQuery('.popContent .popup_tabs td').removeClass('active');
|
|
$.popContainer();
|
|
jQuery(secPosCont).append(jQuery('#locationTablePopup').show());
|
|
jQuery(popcont).addClass('popLeft');
|
|
}); */
|
|
|
|
jQuery("div.wrapper section#content").off('click','#backToSelectLocation').on('click','#backToSelectLocation', function(){
|
|
selectDedupLocation();
|
|
});
|
|
|
|
jQuery("div.wrapper section#content").off('click','#createBucket').on('click', '#createBucket', function() {
|
|
var hostName = jQuery("#locationNamePopup input[name='hostName']").val();
|
|
jQuery('#page_loader').show();
|
|
//AJAX call to create bucket
|
|
$.ajax({
|
|
url: "action.php?action=bucket&operation=create&nickName="+encodeURIComponent(hostName),
|
|
success: function(settingsData){
|
|
if(settingsData.indexOf('<html>')>0){
|
|
window.location.href='logout.php';
|
|
}
|
|
settingsRes=$.parseJSON(settingsData);
|
|
if(settingsRes[0]==true){
|
|
//loadBackupPage();
|
|
window.location.reload();
|
|
} else if(settingsRes[1]){
|
|
jQuery('#page_loader').hide();
|
|
showErrorMessages('.dedupLocationName',settingsRes[1]);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
jQuery("div.wrapper section#content").off('click','#adoptSelectedLocation').on('click', '#adoptSelectedLocation', function() {
|
|
var element = jQuery('.select-loc-tbl tr.highlight');
|
|
if(element.length==0)
|
|
element = jQuery('.select-loc-tbl tr').first();
|
|
var deviceID = element.attr('id');
|
|
//var nickName = jQuery(this). span:first-child).children('span').text();
|
|
var nickName = jQuery(':first-child', element).find('span').text();
|
|
jQuery('#page_loader').show();
|
|
|
|
//AJAX call to create bucket
|
|
$.ajax({
|
|
url: "action.php?action=bucket&operation=link&nickName="+encodeURIComponent(nickName)+"&deviceID="+encodeURIComponent(deviceID),
|
|
success: function(settingsData){
|
|
if(settingsData.indexOf('<html>')>0){
|
|
window.location.href='logout.php';
|
|
}
|
|
settingsRes=$.parseJSON(settingsData);
|
|
|
|
if(settingsRes[0]==true){
|
|
//loadBackupPage();
|
|
var msg = "This computer '"+nickName+"' will now backup as '"+ jQuery('.select-loc-tbl tbody').attr('name') +"'";
|
|
jQuery('#page_loader').hide();
|
|
showErrorMessages('.dedupLocationName1',msg);
|
|
|
|
window.location.reload();
|
|
} else if(settingsRes[1]){
|
|
jQuery('#page_loader').hide();
|
|
showErrorMessages('.dedupLocationName',settingsRes[1]);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
jQuery("div.wrapper section#content").off('keypress','#hostName,#backupLocation').on('keypress', '#hostName,#backupLocation', function(event) {
|
|
if(dedup==true){
|
|
backupLocationChanged = false;
|
|
var keyCode = event.charCode;
|
|
if (keyCode == undefined)
|
|
keyCode = event.keyCode;
|
|
|
|
var strLength = jQuery(this).val().length;
|
|
var bucketRegEx = /^[0-9a-zA-Z-_]{1}$/;
|
|
if(keyCode != 13 && !bucketRegEx.test(String.fromCharCode(keyCode))) {
|
|
event.preventDefault();
|
|
if(jQuery(this).attr('id') == 'hostName') {
|
|
showErrorMessages('.dedupLocationName', 'You can use letters, numbers and characters(-_).');
|
|
} else {
|
|
showErrorMessages('.head_search .error_msg', 'You can use letters, numbers and characters(-_).');
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
if(strLength >= 64) {
|
|
event.preventDefault();
|
|
if(jQuery(this).attr('id') == 'hostName') {
|
|
showErrorMessages('.dedupLocationName', 'Backup location name should not exceed 64 characters.');
|
|
} else {
|
|
showErrorMessages('.head_search .error_msg', 'Backup location name should not exceed 64 characters.');
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
if(jQuery(this).attr('id') != 'hostName')
|
|
actionRequired=2; //To update Nick Name
|
|
|
|
if(keyCode == 13){
|
|
if(jQuery(this).attr('id') == 'hostName'){
|
|
validateNewBackupLocation();
|
|
$( "#createBucket" ).trigger( "click" );
|
|
} else {
|
|
event.preventDefault();
|
|
backupLocationChange();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
//$(".select-loc-tbl tr").click(function() {
|
|
jQuery("div.wrapper section#content").off('click','tr.linkDevice').on('click', 'tr.linkDevice', function() {
|
|
var selected = jQuery(this).hasClass("highlight");
|
|
if(!selected){
|
|
jQuery("tr.linkDevice").removeClass("highlight");
|
|
jQuery(this).addClass("highlight");
|
|
}
|
|
});
|
|
/* Dedup popup - End */
|
|
});
|
|
/* Dedup popup - Start */
|
|
function selectDedupLocation(){
|
|
jQuery('.alert,#page_loader').hide();
|
|
jQuery('.popContent .popup_tabs td').removeClass('active');
|
|
$.popContainer();
|
|
jQuery(secPosCont).append(jQuery('#selectPathPopup').show());
|
|
jQuery(popcont).addClass('popLeft');
|
|
}
|
|
function createNewLocation(){
|
|
jQuery('.alert,#page_loader').hide();
|
|
$.popContainerHide();
|
|
jQuery('.popContent .popup_tabs td').removeClass('active');
|
|
$.popContainer();
|
|
jQuery(secPosCont).append(jQuery('#locationNamePopup').show());
|
|
jQuery(popcont).addClass('popLeft');
|
|
$("#locationNamePopup input").focus();
|
|
}
|
|
/* Dedup popup - End */
|
|
|
|
// Popup related scripts
|
|
var version, popDiv, secPosCont, popCont, masterWrap, popCloseBtn;
|
|
popcont = '.master_wrapper .popup_container';
|
|
secPosCont = '.sec_pos_container';
|
|
masterWrap = '.master_wrapper';
|
|
popCloseBtn = '.popup_close_btn,.popup_cancelBtn';
|
|
popaddcloseBtn='.hide_addpopup';
|
|
popDiv = '<div class="master_wrapper">\
|
|
<div class="shadow_container"></div>\
|
|
<div class="popup_wrapper">\
|
|
<div class="first_pos_container_new view_report_part">\
|
|
<div class="sec_pos_container"></div>\
|
|
</div>\
|
|
</div>\
|
|
</div>';
|
|
|
|
$.popContainer = function() {
|
|
jQuery('#content').append(popDiv).hide().fadeIn(0);
|
|
jQuery('#content').css('overflow', 'hidden');
|
|
jQuery('body').css('overflow', 'hidden');
|
|
};
|
|
|
|
$.popContainerHide = function() {
|
|
jQuery('#content').append(jQuery(popcont).hide());
|
|
jQuery('.popup_container').hide();
|
|
jQuery(masterWrap).remove();
|
|
jQuery('#content').css('overflow', '');
|
|
jQuery('body').css('overflow', 'auto');
|
|
};
|
|
|
|
$.popdivhide = function() {
|
|
jQuery('.add_cancel').hide();
|
|
jQuery('.popup_addwrapper').show();
|
|
};
|
|
|
|
jQuery("div.wrapper section#content").off('click',popCloseBtn).on('click', popCloseBtn, function() {
|
|
var noShell = jQuery(this).parents().eq(2);
|
|
if(noShell.hasClass('noshell_msg') || noShell.hasClass('noaccess_msg')){
|
|
$.popContainerHide();
|
|
jQuery("div#page_loader").show();
|
|
window.location.href='logout.php';
|
|
return false;
|
|
}
|
|
var tablePopup = jQuery(this).parents().eq(1).attr('id');
|
|
if(tablePopup=="locationTablePopup"){
|
|
$.popContainerHide();
|
|
jQuery("div#page_loader").show();
|
|
window.location.href='logout.php';
|
|
return false;
|
|
}
|
|
|
|
$("#deleteButton").show();
|
|
$.popContainerHide();
|
|
toResetForm();
|
|
request_sent_details = 0;
|
|
});
|
|
|
|
jQuery("div.wrapper section#content").off('click',popaddcloseBtn).on('click', popaddcloseBtn, function() {
|
|
$.popContainerHide();
|
|
});
|
|
|
|
/*jQuery(document).on('keydown', function(e) {
|
|
if ((e.keyCode==27) && !$(popcont).hasClass('archive_cleanup_popup') && !$(popcont).hasClass('newBkpSet') && !$(popcont).is('#selectPathPopup') && !$(popcont).is('#locationNamePopup') && !$(popcont).is('#locationTablePopup') ){
|
|
$.popContainerHide();
|
|
}
|
|
});*/
|
|
|
|
// contact Earlier version popup
|
|
jQuery("div.wrapper section#content").off('click', '.backupset').on('click', '.backupset', function() {
|
|
jQuery(".ajax_loader").hide();
|
|
if(jQuery(this).closest('.body_wrap').hasClass('backup_page')){
|
|
if(actionRequired==2){
|
|
editJob('backup');
|
|
}
|
|
newBackupSetArray = [];
|
|
jQuery('#selectedBackupsetFiles').html('');
|
|
loadLocalFiles('/','newBackupSet','bkpBreadCrumb','selectedFiles_tab');
|
|
} else {
|
|
if(actionRequired==2){
|
|
editJob('restore');
|
|
}
|
|
newRestoreSetArray = [];
|
|
jQuery('#selectedRestoreSetFiles').html('');
|
|
loadRestoreRemoteFiles('/','newRestoreSet','bkpBreadCrumb','selectedBackupsetFiles',false);
|
|
}
|
|
$.popContainer();
|
|
jQuery('#popupError1, #selectedFiles .main_chk_table').hide();
|
|
jQuery('#backupTab td').removeClass('active').eq(0).addClass('active');
|
|
jQuery('.popContent .excludefiles').show();
|
|
jQuery('.popContent .ajax_loader,.popContent .nfiles,#selectedFiles').hide();
|
|
jQuery('.newBkpSet .breadcrumb,.selectedFiles_tab,#selectFiles,#selectFiles #newBackupSet,#newRestoreSet').show();
|
|
jQuery(secPosCont).append(jQuery('.newBkpSet').show());
|
|
jQuery(popcont).addClass('popLeft');
|
|
return false;
|
|
});
|
|
|
|
// schedule Backup popup
|
|
jQuery("div.wrapper section#content").off('click','.scheduleChangeBtn span').on('click', '.scheduleChangeBtn span', function() {
|
|
var count = $('#backupsetFiles tr').length;
|
|
if(count <= 0){
|
|
showErrorMessages('.error_msg',"Please select folder(s)/file(s) to backup set");
|
|
return false;
|
|
}
|
|
var type = $(this).closest('td').attr("id"); // Added by Senthil on June02
|
|
var selected_job_val = "#select_job";
|
|
var e = {};
|
|
e.data = {};
|
|
e.data.type = "edit backup";
|
|
|
|
if(type == "RestoreSchedule") {
|
|
selected_job_val = "#select_restore_job";
|
|
if(actionRequired==2){ editJob('restore'); }
|
|
e.data.job = $(selected_job_val).val();
|
|
} else if(type == "BackupSchedule") {
|
|
if(actionRequired==2){ editJob('backup'); }
|
|
e.data.job = $(selected_job_val).val();
|
|
} else {
|
|
if(actionRequired==2){ editJob('backup'); }
|
|
e.data.job = "Backup_LocalBackupSet";
|
|
}
|
|
if($(selected_job_val).val() == "" && selected_job_val == "#select_restore_job") {
|
|
return false;
|
|
}
|
|
|
|
e.data.job = $(selected_job_val).val();
|
|
$.popContainer();
|
|
jQuery(secPosCont).append(jQuery('.qnapschedule_container').show());
|
|
jQuery(popcont).addClass('popLeft');
|
|
|
|
IDrive.Scheduler.SelectJob(e);
|
|
});
|
|
// Backup/Restore File browser
|
|
jQuery("div.wrapper section#content").off('click','#file_browse').on('click', '#file_browse', function() {
|
|
jQuery('.popContent .popup_tabs td').removeClass('active');
|
|
$.popContainer();
|
|
jQuery(secPosCont).append(jQuery('.Backuplocation_popup').show());
|
|
jQuery(popcont).addClass('popLeft');
|
|
markSelectedLocation(jQuery(this));
|
|
});
|
|
|
|
// Add a new requirement Exclude files/Folders from Backup
|
|
jQuery("div.wrapper section#content").off('click','.addnew.requirements').on('click', '.addnew.requirements', function() {
|
|
$.popContainer();
|
|
jQuery(secPosCont).append(jQuery('.downPop').show());
|
|
jQuery(popcont).addClass('popLeft');
|
|
});
|
|
//schedule_backup
|
|
jQuery("div.wrapper section#content").off('click', '#schedule_backup').on('click', '#schedule_backup', function() {
|
|
var jobName = jQuery('#newJobName').val();
|
|
if(jobName==''){
|
|
showErrorMessages('#popupError1',"Please enter the Backup Set Name");
|
|
jQuery('#newJobName').val('').focus();
|
|
return false;
|
|
} else {
|
|
if(jobName[0] == " " || jobName[0] == ".")
|
|
{
|
|
showErrorMessages('#popupError1',"Backup set name should not start with dot(.) and space");
|
|
jQuery('#newJobName').val('').focus();
|
|
return false;
|
|
} else if(jobName.length>50){
|
|
showErrorMessages('#popupError1',"Backup set name should not be more than 50 characters");
|
|
jQuery('#newJobName').focus();
|
|
return false;
|
|
}
|
|
jobName = jobName.trim();
|
|
}
|
|
if(newBackupSetArray.length==0){
|
|
showErrorMessages('#popupError1',"Please select folder(s)/file(s) to backup");
|
|
return false;
|
|
}
|
|
|
|
addNewJob('backup',jobName);
|
|
});
|
|
// Schedule restore popup
|
|
jQuery("div.wrapper section#content").off('click','#schedule_restore').on('click', '#schedule_restore', function() {
|
|
var jobName = jQuery('#newJobName').val();
|
|
if(jobName==''){
|
|
showErrorMessages('#popupError1',"Please enter the Restore Set Name");
|
|
jQuery('#newJobName').val('').focus();
|
|
return false;
|
|
} else {
|
|
|
|
if(jobName[0] == " " || jobName[0] == ".")
|
|
{
|
|
showErrorMessages('#popupError1',"Restore set name should not start with dot(.) and space");
|
|
jQuery('#newJobName').val('').focus();
|
|
return false;
|
|
} else if(jobName.length>50){
|
|
showErrorMessages('#popupError1',"Backup set name should not be more than 50 characters");
|
|
jQuery('#newJobName').focus();
|
|
return false;
|
|
}
|
|
jobName = jobName.trim();
|
|
|
|
}
|
|
if(newRestoreSetArray.length==0){
|
|
showErrorMessages('#popupError1',"Please select folder(s)/file(s) to restore");
|
|
return false;
|
|
}
|
|
addNewJob('restore',jobName);
|
|
});
|
|
|
|
//Function to add New JOB
|
|
function addNewJob(jobType,jobName){
|
|
var result;
|
|
var newJobSet;
|
|
|
|
if(jobType=='backup'){
|
|
var currentForm = jQuery("form#newBackupSetForm");
|
|
var fieldsCount = jQuery("form#newBackupSetForm input[type='checkbox']").attr('checked',true).length;
|
|
var values = jQuery("form#newBackupSetForm").serialize();
|
|
|
|
newJobSet = {"BACKUPSETFILEPATH": "./BackupsetDisplayFile.txt",
|
|
"job_name_dir": jobName,
|
|
"job_type": "Backup"};
|
|
|
|
} else {
|
|
var currentForm = jQuery("form#newRestoreSetForm");
|
|
var fieldsCount = jQuery("form#newRestoreSetForm input[type='checkbox']").attr('checked',true).length;
|
|
var values = jQuery("form#newRestoreSetForm").serialize();
|
|
|
|
newJobSet = {"RESTORESETFILEPATH": "./RestoresetFile.txt",
|
|
"job_name_dir": jobName,
|
|
"job_type": "Restore"};
|
|
|
|
}
|
|
values = "newJobName="+jobName+'&'+values;
|
|
var new_job_name = newJobSet['job_type']+'_'+jobName;
|
|
|
|
$.ajax({
|
|
url: "addNewJob.php",
|
|
type: "POST",
|
|
data: values,
|
|
success: function(validatedData){
|
|
if(validatedData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
validatedRes=$.parseJSON(validatedData);
|
|
if(validatedRes[0]===true){
|
|
//Reset the Popup Box
|
|
jQuery('#newJobName').val('');
|
|
currentForm.find('table').html('').siblings('nfiles').show();
|
|
jQuery('.newBkpSet').find('tr').removeClass('chk').find('label').removeAttr('class');
|
|
//checkRemainingBackupsetFiles('loadFullPath'); //Commented by Senthil on 13-Oct-2017 for HR_Netgear_1.00.13.02_2
|
|
jQuery('select.backupsetInput').append($("<option></option>").attr("value",new_job_name ).text(jobName));
|
|
//Hide the current Job Selection Box & Show the Scheduler Box
|
|
$.popContainerHide();
|
|
$.popContainer();
|
|
jQuery(secPosCont).append(jQuery('.qnapschedule_container').show());
|
|
jQuery(popcont).addClass('popLeft');
|
|
IDrive.Jobs[new_job_name] = newJobSet;
|
|
var e = {};
|
|
e.data = {};
|
|
e.data.type = "add backup";
|
|
e.data.job = new_job_name;
|
|
IDrive.Scheduler.SelectJob(e);
|
|
} else {
|
|
showErrorMessages('#popupError1',validatedRes[1]);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
//Function to check remaining files in Backup Set
|
|
function checkRemainingBackupsetFiles(DivId){
|
|
if(DivId=='loadFullPath'){
|
|
var remaining = jQuery('#backupsetFiles input').length;
|
|
if(remaining==0){
|
|
jQuery('#maincheckBackup').parent().parent().hide();
|
|
jQuery('#noBackupsetFiles').show().siblings('form').find('.excludefiles').hide();
|
|
jQuery('.sizeLoadingIcon').hide();
|
|
jQuery('#backupSetSizeHTML').html('0.00 B');
|
|
jQuery('#backupSetSize').val(0);
|
|
if(jQuery('.body_wrap').hasClass('backup_page')){
|
|
backupSetArray =[];
|
|
defaultBackupSetArray = [];
|
|
defaultBackupSetTypeArray = [];
|
|
defaultBackupSetFileInfo = [];
|
|
defaultBackupSetSizeArray = [];
|
|
defaultBackupSetModTimeInfo = [];
|
|
} else {
|
|
localBackupSetArray = [];
|
|
defaultLocalBackupSetArray = [];
|
|
defaultLocalBackupSetTypeArray = [];
|
|
}
|
|
}
|
|
} else {
|
|
var remaining = jQuery('#selectedBackupsetFiles input').length;
|
|
if(remaining==0){
|
|
jQuery('#selectedFiles .main_chk_table').hide();
|
|
jQuery('#selectedFiles .nfiles').show();
|
|
newBackupSetArray =[];
|
|
}
|
|
}
|
|
}
|
|
|
|
//Function to reset Backup/Restore forms
|
|
function toResetForm(){
|
|
if(!$(".body_wrap").hasClass("trash-wrap"))
|
|
jQuery('.newBkpSet input[type="text"],input.search_input').val('');
|
|
jQuery('#localDirSearchList').html('');
|
|
jQuery('.newBkpSet tr.chk').removeAttr('class').find('label').removeAttr('class');
|
|
jQuery('.newBkpSet tr.header_part').find('label').removeAttr('class');
|
|
newBackupSetArray = [];
|
|
newRestoreSetArray = [];
|
|
excludedFullPathArrayTemp = excludedFullPathArray;
|
|
}
|
|
|
|
//Function to display Files/Folders List
|
|
function displayListHTML(type,html, isVersionRestore){
|
|
isVersionRestore = isVersionRestore || false;
|
|
jQuery('#noBackupsetFiles').siblings('.ajax_loader').hide();
|
|
if(html !=''){
|
|
if(type=='backup' || type=='localBackup'){
|
|
jQuery('#removebBackupsetFiles span').hide();
|
|
jQuery('#removebBackupsetFiles').siblings('.file_check').find('label').removeAttr('class');
|
|
jQuery('#backupsetFiles').html(html).parent().show().closest('form').show().siblings('.main_chk_table').find('tr').show();
|
|
jQuery('#noBackupsetFiles').hide();
|
|
} else if(type=='restore' || type=='localRestore'){
|
|
jQuery('#removeRestoresetFiles span').hide();
|
|
jQuery('#removeRestoresetFiles').siblings('.file_check').find('label').removeAttr('class');
|
|
jQuery('#restoreSetFiles').html(html).parent().show().closest('form').siblings('.nfiles').hide().siblings('.main_chk_table').find('tr').show();
|
|
}
|
|
} else {
|
|
if(type=='backup' || type=='localBackup'){
|
|
jQuery('#removebBackupsetFiles span').hide();
|
|
jQuery('#removebBackupsetFiles').siblings('.file_check').find('label').removeAttr('class');
|
|
jQuery('#backupsetFiles').html('').parent('.excludefiles').hide().closest('form').siblings('.main_chk_table').find('tr').hide();
|
|
jQuery('#noBackupsetFiles').show();
|
|
|
|
if(type=='backup'){
|
|
backupSetArray = [];
|
|
} else {
|
|
localBackupSetArray = [];
|
|
}
|
|
} else if(type=='restore' || type=='localRestore'){
|
|
jQuery('#removeRestoresetFiles span').hide();
|
|
jQuery('#removeRestoresetFiles').siblings('.file_check').find('label').removeAttr('class');
|
|
jQuery('#restoreSetFiles').html('').parent('.excludefiles').hide().closest('form').siblings('.nfiles').show().siblings('.main_chk_table').find('tr').hide();
|
|
if(type=='restore'){
|
|
restoreSetArray = [];
|
|
} else {
|
|
localRestoreSetArray = [];
|
|
}
|
|
}
|
|
}
|
|
var checkLoader = jQuery('.body_wrap').children('.ajax_loader');
|
|
if(type=='backup' || type=='localBackup' || (!checkLoader.is(":visible"))){
|
|
jQuery('#fullPathBreadCrumb a:last').trigger("click");
|
|
}
|
|
isRefresh = false;
|
|
}
|
|
|
|
//Function to "Mark" the selected Items as per Job List
|
|
function markSelectedJobItems(type){
|
|
current_directory = jQuery('#fullPathBreadCrumb a:last').attr('alt');
|
|
//For Backup Page
|
|
if(type=='backup'){
|
|
//Backup Set
|
|
var parentDiv = 'loadFullPath';
|
|
var markArray1 = backupSetArray.slice();
|
|
var jobList = dynamicArray;
|
|
} else if(type=='localBackup') {
|
|
//Local Backup Set
|
|
var parentDiv = 'loadFullPath';
|
|
var markArray1 = localBackupSetArray.slice();
|
|
var jobList = dynamicArray;
|
|
} else if(type=='restore'){
|
|
//Restore Set
|
|
var parentDiv = 'loadRestorePath';
|
|
var markArray1 = restoreSetArray.slice();
|
|
var jobList = dynamicRemoteArray;
|
|
if(dedup==true){
|
|
var sourcePath = jQuery('select[name="localBackupHost"]').val();
|
|
current_directory = sourcePath+current_directory;
|
|
}
|
|
} else if(type=='localRestore'){
|
|
//Restore Set
|
|
var parentDiv = 'loadRestorePath';
|
|
var markArray1 = localRestoreSetArray.slice();
|
|
var jobList = dynamicLocalRestoreArray;
|
|
var restore_type = $('input[type=radio][name="restore_type_detail[]"]:checked').val();
|
|
if(restore_type =='Online Account'){
|
|
var sourcePath = jQuery('select[name="localBackupHost"]').val();
|
|
}else{
|
|
var sourcePath = '';
|
|
}
|
|
var dedupBucket = '';
|
|
if(dedup == true && typeof availableLocalDevices != "undefined" && availableLocalDevices.length > 0 && $('.localRestore').length > 0) {
|
|
dedupBucket=$('#localBackupHost').find("option:selected").attr('idr-bkt');
|
|
}
|
|
current_directory = sourcePath+current_directory+dedupBucket;
|
|
} else if(type=='fullExclude') {
|
|
//Preferences Full Exclude Set
|
|
var parentDiv = 'loadFullPath';
|
|
var markArray1 = excludedFullPathArray.slice();
|
|
var jobList = dynamicArray;
|
|
}
|
|
|
|
var inputElementCount = jQuery('#'+parentDiv+' input[type="checkbox"]').length;
|
|
var backupSetArrayCount = markArray1.length;
|
|
jQuery('#'+parentDiv+' tr').removeAttr('class').find('input').removeAttr('checked').siblings('label').removeAttr('class');
|
|
|
|
//If Array count is less than HTML elements
|
|
if(backupSetArrayCount < inputElementCount){
|
|
for(var i=0; i < backupSetArrayCount; i++){
|
|
var selected_dir = markArray1[i];
|
|
|
|
if(jobList.indexOf(current_directory) != -1)
|
|
{
|
|
var id_of_element = jobList[current_directory].indexOf(selected_dir);
|
|
var selected_dir_id = jQuery("#loadFullPath tr").eq(id_of_element).find('input:checkbox');
|
|
var check_parent = selected_dir_id.attr('id');
|
|
}
|
|
|
|
if(check_parent!=undefined){
|
|
selected_dir_id.attr('checked',true).next().addClass('label_checked').closest('tr').addClass('chk');
|
|
} else {
|
|
var splitDir = selected_dir.split('/');
|
|
if(machine=='QNAP'){
|
|
selected_dir = '/'+splitDir[1]+'/'+splitDir[2]+'/'+splitDir[3];
|
|
} else {
|
|
selected_dir = '/'+splitDir[1]+'/'+splitDir[2];
|
|
}
|
|
|
|
var check_child = array_search(jobList,selected_dir);
|
|
|
|
if(check_child!=''){
|
|
var val = selected_dir.slice(0, -1);
|
|
if(jobList.indexOf(current_directory)!=-1)
|
|
{
|
|
var id_of_element = jobList[current_directory].indexOf(val);
|
|
jQuery("#loadFullPath tr").eq(id_of_element).addClass('chk').find('input:checkbox').next().attr('class','label_semi_checked');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
//If Array count is greater than HTML elements
|
|
jQuery('#'+parentDiv+' input[type="checkbox"]').each(function(){
|
|
var selected_dir = jQuery(this).val();
|
|
var check_parent = markArray1.indexOf(selected_dir);
|
|
|
|
if(check_parent>=0){
|
|
jQuery(this).attr('checked',true).next().addClass('label_checked').closest('tr').addClass('chk');
|
|
} else {
|
|
var check_child = array_search(markArray1,selected_dir);
|
|
if(check_child!=''){ jQuery(this).next().addClass('label_semi_checked'); }
|
|
}
|
|
});
|
|
}
|
|
var selectedCount = jQuery('#'+parentDiv+' input:checked').length;
|
|
if(selectedCount==inputElementCount && inputElementCount!=0){
|
|
jQuery('#'+parentDiv).siblings('table').find('label').removeAttr('class').addClass('label_checked');
|
|
} else if(selectedCount>0){
|
|
jQuery('#'+parentDiv).siblings('table').find('label').removeAttr('class').addClass('label_semi_checked');
|
|
} else {
|
|
jQuery('#'+parentDiv).siblings('table').find('label').removeAttr('class').addClass('mainCheck');
|
|
}
|
|
|
|
}
|
|
|
|
//Function to Mark main checkbox based selected Items
|
|
function markMaincheckAfterRemove(parentDiv){
|
|
var inputElementCount = jQuery('#'+parentDiv+' input[type="checkbox"]').length;
|
|
var selectedCount = jQuery('#'+parentDiv+' input:checked').length;
|
|
|
|
if(parentDiv == 'startBackupForm'){
|
|
jQuery('#removebBackupsetFiles span').show();
|
|
} else if(parentDiv == 'startRestoreForm'){
|
|
jQuery('#removeRestoresetFiles span').show();
|
|
}
|
|
if(selectedCount==inputElementCount && inputElementCount>0){
|
|
//To keep parent only if all child selected - Start
|
|
jQuery('#'+parentDiv).siblings('table').find('label').removeAttr('class').addClass('label_checked');
|
|
if(parentDiv=='loadFullPath'){
|
|
if(jQuery('.body_wrap').hasClass('backup_page') || jQuery('.body_wrap').hasClass('localbackup_page')){
|
|
backupSetFiles("All");
|
|
} else {
|
|
addExcludeFilesList("All");
|
|
}
|
|
} else if(parentDiv=='newBackupSet'){
|
|
newBackupSetFiles("All");
|
|
} else if(parentDiv=='loadRestorePath'){
|
|
restoreSetFiles("All");
|
|
} else if(parentDiv=='newRestoreSet'){
|
|
newRestoreSetFiles("All");
|
|
}
|
|
//To keep parent only if all child selected - End
|
|
} else if(selectedCount>0){
|
|
jQuery('#'+parentDiv).siblings('table').find('label').removeAttr('class').addClass('label_semi_checked');
|
|
} else if(jQuery('#'+parentDiv+' label.label_semi_checked').length>0){
|
|
jQuery('#'+parentDiv).siblings('table').find('label').removeAttr('class').addClass('label_semi_checked');
|
|
} else {
|
|
if(parentDiv == 'startBackupForm'){
|
|
jQuery('#removebBackupsetFiles span').hide();
|
|
} else if(parentDiv == 'startRestoreForm'){
|
|
jQuery('#removeRestoresetFiles span').hide();
|
|
}
|
|
jQuery('#'+parentDiv).siblings('table').find('label').removeAttr('class').addClass('mainCheck');
|
|
}
|
|
}
|
|
|
|
//Function to mark/unmark semi-checked item
|
|
function checkForSemicheckedItem(parentDiv){
|
|
|
|
if(parentDiv=='loadFullPath'){
|
|
if(jQuery('.body_wrap').hasClass('backup_page')){
|
|
//Backup Set
|
|
var checkArray = backupSetArray.slice();
|
|
} else {
|
|
//Local Backup Set
|
|
var checkArray = localBackupSetArray.slice();
|
|
}
|
|
} else {
|
|
var restoreType = $('input[type=radio][name="restore_type_detail[]"]:checked').val();
|
|
if(jQuery('#sourcePath').val()=='Online Account' || restoreType=='Online Account' ){
|
|
//Restore Set
|
|
var checkArray = restoreSetArray.slice();
|
|
} else{
|
|
var checkArray = localRestoreSetArray.slice();
|
|
}
|
|
}
|
|
|
|
var semiCheckedItem = jQuery('#'+parentDiv+' table tr label.label_semi_checked');
|
|
semiCheckedItem.each(function(){
|
|
var currVal = jQuery(this).siblings('input').val();
|
|
var selected_dir = currVal+'/';
|
|
|
|
var check_parent = array_search(checkArray,selected_dir);
|
|
if(check_parent==''){
|
|
jQuery(this).removeAttr('class').siblings('input').removeAttr('checked');
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
/* Preferences Page modified UI JS - Start */
|
|
jQuery("div.wrapper section#content").off('click','.tabs_section ul >li').on('click', '.tabs_section ul >li', function() {
|
|
var tabClassName = $(this).find('.tabs').text().split(/ \s +/);
|
|
tabClassName = $.trim(tabClassName)
|
|
if(IDrive.UserName == '') {
|
|
tabClassName = 'Network';
|
|
}
|
|
//Checking whether valid IP address or not
|
|
if(checkIPformat()===false){
|
|
document.getElementById('ipAddress').focus();
|
|
return false;
|
|
}
|
|
|
|
if(preferenceChanged>0){
|
|
preferenceSettings(); //POST the preferences page
|
|
clearTimeout(preferenceTimeoutVar); //Clear to restrict automated POST
|
|
}
|
|
|
|
$('.tabs_section ul li').removeClass('selected');
|
|
|
|
if(tabClassName === 'General'){
|
|
$('.tab1_wrap').show();
|
|
$('.tab2_wrap,.tab3_wrap').hide();
|
|
$(this).addClass('selected');
|
|
}else if(tabClassName === 'Exclude'){
|
|
$('.tab2_wrap').show();
|
|
$('.tab1_wrap,.tab3_wrap').hide();
|
|
$(this).addClass('selected');
|
|
}else if(tabClassName === 'Network'){
|
|
$('.tab3_wrap').show();
|
|
$('.tab1_wrap,.tab2_wrap').hide();
|
|
$(".tabs_section li.advance_tab").addClass('selected');
|
|
}
|
|
});
|
|
|
|
// Proxy option click event
|
|
jQuery("div.wrapper section#content").off('click','.proxy_option input[type=radio]').on('click', '.proxy_option input[type=radio]', function() { $.ProxySelected(); });
|
|
|
|
var ProxyOption,ProxyDisable=$('.proxy_set_disable');
|
|
$.ProxySelected = function(){
|
|
ProxyOption= $(".proxy_option input[type='radio']:checked").val();
|
|
ProxyOption = $.trim(ProxyOption)
|
|
if(ProxyOption == 'Manual'){
|
|
|
|
$.ProxyCheckPassword();
|
|
$('.proxy_set1 input,.proxy_set2 input').removeAttr('disabled').removeClass('proxy_wrap_gry_input');
|
|
document.getElementById('ipAddress').focus();
|
|
|
|
} else if(ProxyOption == 'autodetect'){
|
|
jQuery('.alert p').html('Detecting your proxy details...Please wait').parent().show();
|
|
jQuery.ajax({
|
|
url: 'action.php?action=getProxySettings',
|
|
success: function(locationData){
|
|
if(locationData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
setTimeout("jQuery('.alert').hide('slow')",750);
|
|
locationDataRes=$.parseJSON(locationData);
|
|
if(locationDataRes[0]==true){
|
|
setTimeout(function(){
|
|
showErrorMessages('.welcome_message',locationDataRes[2]);
|
|
ProxyDisable.css('height','90px');
|
|
jQuery('input[name="ipAddress"]').removeAttr('disabled').val(locationDataRes[1].ipAddress).removeClass('proxy_wrap_gry_input');
|
|
jQuery('input[name="port"]').removeAttr('disabled').val(locationDataRes[1].port).removeClass('proxy_wrap_gry_input');
|
|
jQuery('input[name="proxyServerPassword"]').removeAttr('disabled').removeClass('proxy_wrap_gry_input');
|
|
if(locationDataRes[1].username!=''){
|
|
//ProxyDisable.css('height','0px');
|
|
jQuery('.proxy_set_disable').css('height','175px');
|
|
jQuery('input[name="proxyServerPassword"]').attr('checked','checked');
|
|
jQuery('input[name="userName"]').removeAttr('disabled').val(locationDataRes[1].username).removeClass('proxy_wrap_gry_input');
|
|
var pass = locationDataRes[1].password;
|
|
pass = base64_decode(rawurldecode(pass));
|
|
jQuery('input[name="password"]').removeAttr('disabled').val(pass).removeClass('proxy_wrap_gry_input');
|
|
} else {
|
|
ProxyDisable.css('height','90px');
|
|
jQuery('input[name="proxyServerPassword"]').removeAttr('checked');
|
|
jQuery('input[name="userName"]').attr('disabled','disabled').val('').addClass('proxy_wrap_gry_input');
|
|
jQuery('input[name="password"]').attr('disabled','disabled').val('').addClass('proxy_wrap_gry_input');
|
|
|
|
}
|
|
},1000);
|
|
} else {
|
|
showErrorMessages('.error_msg',locationDataRes[1]);
|
|
jQuery('.proxy_option input').removeAttr('checked').removeClass('proxy_wrap_gry_input');
|
|
jQuery('.proxy_option input[value="No-Proxy"]').attr('checked','checked');
|
|
ProxyDisable.css('height','175px');
|
|
$('.proxy_set input').attr('disabled','disabled').addClass('proxy_wrap_gry_input');
|
|
$('.proxy_set input[type="textbox"],.proxy_set input[type="password"]').val('');
|
|
$('#proxyServerPassword').removeAttr('checked').removeClass('proxy_wrap_gry_input');
|
|
}
|
|
}
|
|
});
|
|
|
|
} else{
|
|
ProxyDisable.css('height','175px');
|
|
$('.proxy_set input').attr('disabled','disabled').addClass('proxy_wrap_gry_input');
|
|
$('.proxy_set input[type="textbox"],.proxy_set input[type="password"]').val('').addClass('proxy_wrap_gry_input');
|
|
$('#proxyServerPassword').removeAttr('checked').removeClass('proxy_wrap_gry_input');
|
|
}
|
|
}
|
|
// proxy password check event
|
|
jQuery("div.wrapper section#content").off('click','.proxy_set2 input').on('click', '.proxy_set2 input', function() {
|
|
if(checkIPformat()===false){
|
|
document.getElementById('ipAddress').focus();
|
|
return false;
|
|
}
|
|
$.ProxyCheckPassword();
|
|
});
|
|
|
|
$.ProxyCheckPassword = function(){
|
|
var ProxyPassword= $('.proxy_set2').find( "input:checked" ).length;
|
|
var ProxyDisable = $('.proxy_set_disable');
|
|
if(ProxyPassword =='1'){
|
|
ProxyDisable.css('height','0px');
|
|
$('.proxy_set3 input').removeAttr('disabled').removeClass('proxy_wrap_gry_input');
|
|
}else{
|
|
ProxyDisable.css('height','95px');
|
|
$('.proxy_set3 input[type="textbox"],.proxy_set3 input[type="password"]').val('');
|
|
$('.proxy_set3 input').attr('disabled','disabled').addClass('proxy_wrap_gry_input');
|
|
}
|
|
}
|
|
/* Preferences Page modified UI JS - End*/
|
|
|
|
function markSelectedLocation(args){
|
|
var id = '';
|
|
$.each(args.siblings('input'), function() {
|
|
var attrId = $(this).attr('id');
|
|
if ((typeof attrId !== typeof undefined) && (attrId !== false)) {
|
|
id = attrId;
|
|
return false;
|
|
}
|
|
});
|
|
var location = jQuery('#'+id).val();
|
|
|
|
if(location.charAt(0)!='/'){
|
|
location = '/'+location;
|
|
}
|
|
var splitLoc = location.split('/');
|
|
|
|
if(splitLoc.length>=2){
|
|
splitLoc.pop();
|
|
if(machine == ASUSTOR && splitLoc.length==2 && id=='restoreLocation')
|
|
splitLoc.pop();
|
|
var urlPath = splitLoc.join('/');
|
|
|
|
if(urlPath==''){
|
|
urlPath = '/';
|
|
}
|
|
if(id=='restoreLocation'){
|
|
urlPath = checkSharedFolderPath(splitLoc,urlPath);
|
|
loadRestoreLocalFiles(urlPath,'loadRestoreLocation','restoreLocationBreadCrumb',location);
|
|
} else {
|
|
loadRemoteFiles(urlPath,'loadBackupLocation','backupLocationBreadCrumb',location);
|
|
}
|
|
} else {
|
|
if(id=='restoreLocation'){
|
|
jQuery('#loadRestoreLocation input').closest('tr').removeClass('selected_row').removeAttr("style");
|
|
jQuery('#loadRestoreLocation input[value= "'+location+'/"]').closest('tr').addClass('selected_row').css("background-color","#CDDAE1");
|
|
} else {
|
|
jQuery('#loadBackupLocation input').closest('tr').removeClass('selected_row').removeAttr("style");
|
|
jQuery('#loadBackupLocation input[value= "'+location+'/"]').closest('tr').addClass('selected_row').css("background-color","#CDDAE1");
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/* Function to Load Remote system Files/Folders - Start */
|
|
function loadRemoteFiles(obj,toPlace,breadcrum,markSelected){
|
|
|
|
jQuery('#loadBackupLocation').siblings('.ajax_loader').show();
|
|
var getDir = obj;
|
|
var url = "backupLocation.php?fullPath="+encodeURIComponent(getDir);
|
|
|
|
/* BreadCrumb */
|
|
var splitDir = getDir.split('/');
|
|
var breadCrumb = '<a href="javascript:void(0);" alt="/" title="/" class="getBackupDirList">/</a>';
|
|
var currDir = '';
|
|
splitDir = splitDir.filter(function(val) {
|
|
if(!(val === "" || typeof val == "undefined" || val === null)){
|
|
currDir += '/'+htmlEntities(val);
|
|
breadCrumb += "<a class=\"getBackupDirList\" href=\"javascript:void(0);\" title='"+currDir+"' alt='"+currDir+"'>"+val+"</a>";
|
|
}
|
|
});
|
|
jQuery('#'+breadcrum).html(breadCrumb);
|
|
responsiveBreadcrumb('#'+breadcrum,'getBackupDirList');
|
|
/* BreadCrumb */
|
|
|
|
/* To highlight the selected backup location */
|
|
if(markSelected==''){
|
|
var markSelected = jQuery('input#backupLocation').val();
|
|
if(markSelected.charAt(0)!='/'){
|
|
markSelected = '/'+markSelected;
|
|
}
|
|
}
|
|
var checkFiles = function() {
|
|
jQuery.ajax({
|
|
url: url
|
|
});
|
|
};
|
|
|
|
var container = '<div class="excludefiles" style="overflow: hidden;">';
|
|
container += '<table id="excludeFilesPath" width="100%" border="0" cellspacing="0" cellpadding="0" class="folderBackupContent backupset_table bc_table">';
|
|
container += '<tbody></tbody>';
|
|
container += '</table></div>';
|
|
jQuery('#loadBackupLocation').html(container);
|
|
|
|
// AJAX Call for new
|
|
var pageid = 0;
|
|
var makeRequest = function(pageid) {
|
|
abortAjax(currentAjaxRequest);
|
|
currentAjaxRequest = jQuery.ajax({
|
|
url: (url + ('&pageid=' + pageid)),
|
|
success: function(locationData){
|
|
if(locationData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
locationDataRes=$.parseJSON(locationData);
|
|
if(locationDataRes[0]==true){
|
|
jQuery('#loadBackupLocation').show().siblings('.nfiles').hide().siblings('.ajax_loader').hide();
|
|
jQuery('#loadBackupLocation').find('tbody').html(locationDataRes[1]);
|
|
|
|
jQuery('#loadBackupLocation input').closest('tr').removeClass('selected_row').removeAttr("style");
|
|
if(getDir.indexOf(markSelected)<0 && getDir!=markSelected){
|
|
jQuery('#loadBackupLocation input:hidden').filter(function(){ return this.value==markSelected+"/"}).closest('tr').addClass('selected_row').css("background-color","#CDDAE1");
|
|
}
|
|
jQuery('#loadBackupLocation .excludefiles').css({'overflow': 'auto'});
|
|
makeRequest(++pageid);
|
|
}
|
|
else if ( typeof locationDataRes['retry'] != 'undefined' ) {
|
|
jQuery('#loadBackupLocation').siblings('.ajax_loader').show();
|
|
if (locationDataRes['retry']) {
|
|
makeRequest(++pageid);
|
|
}
|
|
else {
|
|
jQuery('#loadBackupLocation').siblings('.ajax_loader').hide();
|
|
}
|
|
}
|
|
else {
|
|
jQuery('#loadBackupLocation').hide().siblings('.nfiles').show().siblings('.ajax_loader').hide();
|
|
}
|
|
}
|
|
|
|
});
|
|
}
|
|
checkFiles();
|
|
setTimeout(function(){
|
|
makeRequest(0);
|
|
}, 500);
|
|
}
|
|
/* Function to Load Remote system Files/Folders - End */
|
|
|
|
|
|
|
|
/* Function to Load local system Files/Folders - Start */
|
|
function loadRestoreLocalFiles(obj,toPlace,breadcrum,markSelected){
|
|
var getDir = obj;
|
|
//clickedDirPath = getDir; //For the purpose while unchecking the child
|
|
var url = "restoreLocation.php?fullPath="+encodeURIComponent(getDir);
|
|
var dirListVal = dynamicLocalDirList[getDir];
|
|
/* Restore Location BreadCrumb - Start */
|
|
var splitDir = getDir.split('/');
|
|
splitDir.shift();
|
|
if(machine=='twotier' && breadcrum == 'restoreLocationBreadCrumb'){
|
|
splitDir.shift();
|
|
var vaultRestoreRootPath = "/"+vaultRestorePath;
|
|
var breadCrumb = '<a href="javascript:void(0);" alt="/" title="'+vaultRestoreRootPath+'" class="getRestoreDirList">'+vaultRestoreRootPath+'</a>';
|
|
var currDir = vaultRestoreRootPath;
|
|
} else {
|
|
var breadCrumb = '<a href="javascript:void(0);" alt="/" title="/" class="getRestoreDirList">/</a>';
|
|
var currDir = "";
|
|
}
|
|
|
|
if(splitDir.length>0){
|
|
splitDir = splitDir.filter(function(val) {
|
|
if(!(val === "" || typeof val == "undefined" || val === null)){
|
|
currDir += "/"+val;
|
|
var title = currDir;
|
|
breadCrumb += '<a href="javascript:void(0);" title="'+title+'" alt="'+htmlEntities(currDir)+'" class="getRestoreDirList">'+val+'</a>';
|
|
}
|
|
});
|
|
}
|
|
|
|
jQuery('#'+breadcrum).html(breadCrumb);
|
|
responsiveBreadcrumb('#'+breadcrum,'getRestoreDirList');
|
|
/* Restore Location BreadCrumb - End */
|
|
|
|
/* To highlight the selected restore location */
|
|
if(markSelected==''){
|
|
var markSelected = jQuery('input#restoreLocation').val();
|
|
if(markSelected.charAt(0)!='/'){
|
|
markSelected = '/'+markSelected;
|
|
}
|
|
}
|
|
|
|
// AJAX Call for new
|
|
jQuery('#'+toPlace).siblings('.ajax_loader').show();
|
|
jQuery.ajax({
|
|
url: url,
|
|
success: function(locationData){
|
|
if(locationData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
locationDataRes=$.parseJSON(locationData);
|
|
jQuery('#'+toPlace).siblings('.ajax_loader').hide();
|
|
if(locationDataRes[0]==true){
|
|
jQuery('#'+toPlace).show().siblings('.nfiles').hide();
|
|
jQuery('div#'+toPlace).html(locationDataRes[1]);
|
|
/* To highlight the selected restore location */
|
|
jQuery('#loadRestoreLocation input').closest('tr').removeClass('selected_row').removeAttr("style");
|
|
if(getDir.indexOf(markSelected)<0 && getDir!=markSelected){
|
|
jQuery('#loadRestoreLocation input:hidden').filter(function(){ return this.value==markSelected+"/"}).closest('tr').addClass('selected_row').css("background-color","#CDDAE1");
|
|
}
|
|
} else {
|
|
jQuery('#'+toPlace).hide().siblings('.nfiles').show();
|
|
}
|
|
|
|
jQuery('#loadRestoreLocation .excludefiles').css({'overflow': 'auto'});
|
|
}
|
|
});
|
|
}
|
|
/* Function to Load local system Files/Folders - End */
|
|
|
|
// Row right click event
|
|
var ListRightClickDropDown = '.file_menu_list',
|
|
RightClickDrop = '.drop_list',
|
|
DropDownShow='.dropdown';
|
|
|
|
$(RightClickDrop).live('click',function(){
|
|
$('tr').removeClass('row_selected');
|
|
if($(this).siblings('.file_check').children('label').text()=='folder'){
|
|
if($(".head_search .page_title h4").text() == "Trash"){
|
|
jQuery('.trash_dropdown a.file_menu_details').show();
|
|
jQuery('.trash_dropdown a.file_menu_version').hide();
|
|
jQuery('.trash_dropdown a.file_menu_search').show();
|
|
} else {
|
|
jQuery('#dropdown a.file_menu_details').show();
|
|
jQuery('#dropdown a.file_menu_version').hide();
|
|
jQuery('#dropdown a.file_menu_search').show();
|
|
}
|
|
} else {
|
|
if($(".head_search .page_title h4").text() == "Trash"){
|
|
jQuery('.trash_dropdown a.file_menu_details').hide();
|
|
jQuery('.trash_dropdown a.file_menu_version').hide();
|
|
jQuery('.trash_dropdown a.file_menu_search').hide();
|
|
}else{
|
|
jQuery('#dropdown a.file_menu_details').hide();
|
|
jQuery('#dropdown a.file_menu_version').show();
|
|
jQuery('#dropdown a.file_menu_search').hide();
|
|
}
|
|
}
|
|
DeleteItemType = $(this).siblings('.file_check').children('label').text();
|
|
jQuery('.refresh_list').hide();
|
|
$(this).closest('tr').addClass('row_selected');
|
|
OffSet=$(this).offset();
|
|
var $vH =(window.innerHeight);
|
|
var $CH = OffSet.top + $('#dropdown').height()+20;
|
|
var dropH = $('#dropdown').height();
|
|
|
|
if($("#remoteDirSearchList .folderBackupContent tr.row_selected td.search-chk-box.file_check input").length)
|
|
{
|
|
DeleteItem = $("#remoteDirSearchList .folderBackupContent tr.row_selected td.search-chk-box.file_check input").val();
|
|
}
|
|
|
|
if ($vH < $CH ){
|
|
$('.row_dropdown').css({'left':OffSet.left-70,'top':OffSet.top-dropH,'position':'absolute'}).show();
|
|
$('.trash_dropdown').css({'left':OffSet.left-250,'top':OffSet.top-(dropH+113),'position':'absolute'}).show();
|
|
}else{
|
|
$('.row_dropdown').css({'left':OffSet.left-70,'top':OffSet.top+34,'position':'absolute'}).show();
|
|
$('.trash_dropdown').css({'left':OffSet.left-250,'top':OffSet.top-95,'position':'absolute'}).show();
|
|
}
|
|
$(this).closest('tr').addClass('row_selected');
|
|
});
|
|
//Restore page drop-down
|
|
$(document).on('click',ListRightClickDropDown,function(){
|
|
$('tr').removeClass('row_selected');
|
|
if($(this).siblings('.file_check').children('label').text()=='folder'){
|
|
jQuery('#dropdown a.file_menu_details,.refresh_list').show();
|
|
jQuery('#dropdown a.file_menu_version').hide();
|
|
jQuery('#dropdown a.file_menu_search').show();
|
|
} else {
|
|
jQuery('#dropdown a.file_menu_details,.refresh_list').hide();
|
|
jQuery('#dropdown a.file_menu_version').show();
|
|
jQuery('#dropdown a.file_menu_search').hide();
|
|
}
|
|
$(this).closest('tr').addClass('row_selected');
|
|
OffSet=$(this).offset();
|
|
var $vW =(window.innerWidth);
|
|
if($vW > 1000){
|
|
$('.row_dropdown').css({'position':'absolute'})
|
|
$('.row_dropdown').css({'left':OffSet.left-70,'top':OffSet.top+30}).show();
|
|
}else{
|
|
$('.row_dropdown').css({'position':'absolute'})
|
|
$('.row_dropdown').css({'left':OffSet.left-70,'top':OffSet.top+30}).show();
|
|
}
|
|
$('#dropdown li').focus();
|
|
|
|
if($("#loadRestorePath .excludefiles tr.row_selected td.file_check input").length )
|
|
{
|
|
DeleteItem = $("#loadRestorePath .excludefiles tr.row_selected td.file_check input").val();
|
|
DeleteItemType = $("#loadRestorePath .excludefiles tr.row_selected td.file_check label").text();
|
|
//alert(DeleteItemType);
|
|
}
|
|
else if($("#loadTrashPath .excludefiles tr.row_selected td.file_check input").length )
|
|
{
|
|
DeleteItem = $("#loadTrashPath .excludefiles tr.row_selected td.file_check input").val();
|
|
}
|
|
|
|
});
|
|
|
|
$(document).on('mouseleave',DropDownShow,function(){
|
|
$(this).hide();
|
|
$('table tr').removeClass('row_selected');
|
|
});
|
|
|
|
|
|
Menu = {
|
|
Ready : function() {
|
|
var EnableOption= '.details_container .popup_close_btn' ;
|
|
var CloseDeletePopup = '.popup_delete .popup_close_btn,#cancelPutback,#cancelEmpty';
|
|
var DeleteMenu = '.menu_delete';
|
|
var PutBackMenu = '.putback';
|
|
var SingleDelete = '.file_menu_delete';
|
|
var SinglePutBack = '.file_menu_putback';
|
|
var putbackfile = 0;
|
|
var PutBackItem;
|
|
DeleteCancelBtn = '#cancelDelete'
|
|
//DeleteWrapper = '.delete_msg .msg_wrap',
|
|
DropDownMenu = '.dropdown',
|
|
DeleteYesBtn = '#deleteConfirmation',
|
|
PutbackYesBtn = '#putbackConfirmation',
|
|
SccuessfulMsg = '.msg_display',
|
|
NewFolderCreate = '.newfolder_li',
|
|
ActionTable = '#loadRestorePath .bc_table',
|
|
CreateFolderClsBtn = '.createFolder_selected .msgclose',
|
|
VisibleFolderClass = '.createFolder_selected',
|
|
FileMenuRename = '.file_menu_rename'
|
|
MenuListShowOption = '.delete_li,.share_li,.copy_li,.rename_li,.details_li',
|
|
EditOptionShow = '.edit_shadow',
|
|
RightSideMenuHide = '.right_menu .search_menu,.right_menu .backupset,.option_menu,.restore-dropdown';
|
|
|
|
//$(DeleteWrapper).hide();
|
|
$(document).on('click',DeleteMenu,Menu.DeleteFileAction);
|
|
$(document).on('click',PutBackMenu,Menu.PutBackFileAction);
|
|
$(document).on('click',DeleteCancelBtn,Menu.DeleteConfirmationCancel);
|
|
$(document).on('click',DeleteYesBtn,Menu.DeleteSuccessfully);
|
|
$(document).on('click',PutbackYesBtn,Menu.PutBackSuccessfully);
|
|
$(document).on('click',SingleDelete,Menu.DeleteSingleEntry);
|
|
$(document).on('click',SinglePutBack,Menu.PutBackSingleEntry);
|
|
$(document).on('click',NewFolderCreate,Menu.CreateNewFolder);
|
|
$(document).on('click',CreateFolderClsBtn,Menu.CreateFolderClose);
|
|
$(document).on('click',FileMenuRename,Menu.RenameChangeCurrentFile);
|
|
$(document).on('click','.rename_Selected .msgclose',Menu.RenameCloseBtn);
|
|
$(document).on('click','.option_menu',Menu.OptionMenuClick);
|
|
$(document).on('click','.share_li .menu_share,.file_menu_share,.shr_li .menu_share',Menu.SharePopupClick);
|
|
$(document).on('click','.share_settings_btn',Menu.SharePopupSettingBtn);
|
|
$(document).on('click','.share_settings_cont .share_settings_cancel_btn',Menu.SharePopupSettingBtn);
|
|
$(document).on('click','.message_column .button',Menu.SharePopupSuccessfull);
|
|
$(document).on('click','.share_container .sharePopup_close_btn',Menu.SharePopupClose);
|
|
$(document).on('click','.f_name_view span',Menu.ShareFileSelectCloseBtn);
|
|
$(document).on('click','.file_menu_version',Menu.VersionPopupShow);
|
|
$(document).on('click','.file_menu_details,.menu_details', Menu.DetailPopupShow);
|
|
$(document).on('click','.file_menu_search', Menu.SearchPopupShow);
|
|
$(document).on('click',EnableOption,Menu.DeleteConfirmationCancel);
|
|
$(document).on('click',CloseDeletePopup,Menu.DeleteConfirmationCancel);
|
|
$(document).on('keyup','input.rename_txtbox',Menu.enterKeyPressForRename);
|
|
$(document).on('keyup','input.newfolder_txtbox',Menu.enterKeyPressForNewDir);
|
|
$(document).on('click','.option_msg .close_menu img',Menu.OptionMenuRemoved);
|
|
$(document).on('keydown','input.newfolder_txtbox,input.rename_txtbox',Menu.checkSpecialChar);
|
|
$(document).on('click','#dropdown .exclude_list',Menu.ExcludePopupShow);
|
|
$(document).on('click','#dropdown .refresh_list,.menu_refresh_icon',Menu.RefreshList);
|
|
},
|
|
|
|
DeleteSingleEntry : function(){
|
|
|
|
|
|
/*if($(".head_search .page_title h4").text() == "Trash"){
|
|
|
|
var current_directory = jQuery('#fullPathBreadCrumb a:last').attr('alt');
|
|
if(dynamicTrashStatus[current_directory].status == "false")
|
|
{
|
|
showErrorMessages('.error_msg','Delete items after this pageload gets complete');
|
|
return false;
|
|
}
|
|
|
|
}*/
|
|
var del_cookie = 'restore_del';
|
|
if($(".head_search .page_title h4").text() == "Trash"){
|
|
DeleteItem = jQuery('tr.row_selected td.file_check input').val();
|
|
del_cookie = 'trash_del';
|
|
}
|
|
if($('.edit_work').is(':visible'))
|
|
{
|
|
window.edit_work = 1;
|
|
}
|
|
else
|
|
{
|
|
window.edit_work = 0;
|
|
}
|
|
window.searchPopup = 0;
|
|
|
|
Menu.MenuOptionUnSelect();
|
|
DeleteItemres = DeleteItem;
|
|
var res = DeleteItemres.split("/");
|
|
DeleteItem = new Array(DeleteItem);
|
|
if(getCookie(del_cookie)){
|
|
Menu.DeleteSuccessfully();
|
|
}else{
|
|
$.popContainer();
|
|
$("#delPopupEllipse").text(res[res.length-1]);
|
|
$(secPosCont).append($('.popup_delete').show());
|
|
$(popcont).addClass('popLeft');
|
|
$('body').css({'overflow-y':'hidden'});
|
|
$(DropDownMenu).hide();
|
|
}
|
|
|
|
},
|
|
|
|
PutBackSingleEntry : function(){
|
|
if($(".head_search .page_title h4").text() == "Trash"){
|
|
PutBackItem = jQuery('tr.row_selected td.file_check input').val();
|
|
}
|
|
Menu.MenuOptionUnSelect();
|
|
var res = PutBackItem.split("/");
|
|
PutBackItem = new Array(PutBackItem);
|
|
if(getCookie('trash_putback')){
|
|
Menu.PutBackSuccessfully();
|
|
}else{
|
|
$.popContainer();
|
|
$("#putBackPopupEllipse").text(res[res.length-1]);
|
|
$(secPosCont).append($('.put_back_popup').show());
|
|
$(popcont).addClass('popLeft');
|
|
$('body').css({'overflow-y':'hidden'});
|
|
}
|
|
$(DropDownMenu).hide();
|
|
|
|
},
|
|
|
|
OptionMenuRemoved : function(){
|
|
Menu.MenuOptionUnSelect();
|
|
Menu.MenuListSelected();
|
|
Menu.checkingSelectedItems(); // Mark already selected items
|
|
Menu.CreateFolderClose();
|
|
window.edit_work = 0;
|
|
},
|
|
|
|
VersionPopupShow: function() {
|
|
var itemName = jQuery('tr.row_selected td.file_check input').val();
|
|
$(DropDownMenu).hide();
|
|
Menu.MenuOptionUnSelect();
|
|
Menu.checkingSelectedItems();
|
|
|
|
jQuery('#page_loader').show();
|
|
value = '';
|
|
if($(".head_search .page_title h4").text() == "Trash"){
|
|
value = '&trash=1';
|
|
}
|
|
if(dedup==true){
|
|
if(value!="")
|
|
var deviceID = selectedRestoreListPath;
|
|
else
|
|
var deviceID = jQuery('select.restoreDropdown-txtbox').val();
|
|
value+="&deviceID="+encodeURIComponent(deviceID);
|
|
}
|
|
jQuery.ajax({
|
|
url: 'action.php?action=getVersionDetails&itemName='+encodeURIComponent(itemName)+value,
|
|
success: function(outputData) {
|
|
jQuery('#page_loader').hide();
|
|
var response = $.parseJSON(outputData);
|
|
if (response[0] == true) {
|
|
if (!response[1].err) {
|
|
$.popContainer();
|
|
$(secPosCont).append($('.version_container').show());
|
|
$(popcont).addClass('popLeft');
|
|
$('.bkp_dropdown').fadeOut();
|
|
$('.master_wrapper').addClass('version_master_wrap')
|
|
|
|
var versionCount = response[1].length;
|
|
$('.version_container #folderDetailsPath')
|
|
.text('Home' + (response[2].slice(0, response[2].lastIndexOf('/'))))
|
|
.attr('alt', 'Home' + (response[2].slice(0, response[2].lastIndexOf('/'))))
|
|
.attr('title', 'Home' + (response[2].slice(0, response[2].lastIndexOf('/'))));
|
|
$('.version_container #folderDetailsPath').attr('path', response[2]);
|
|
var fileName = response[2].substring(response[2].lastIndexOf("/") + 1);
|
|
$('.version_container #folderDetailsName').text(fileName).attr('alt', fileName).attr('title', fileName);
|
|
$('.version_container .version_list').empty();
|
|
for (var count = 0; count < versionCount; count += 3) {
|
|
$('.version_container .version_list').append($('<li>')
|
|
.append($('<div>')
|
|
.append($('<span>', {'id': 'versioncountno'}).text(response[1][count + 2])))
|
|
.append($('<div>')
|
|
.append($('<span>', {'id': 'versionfilesize'}).text(response[1][count + 1])))
|
|
.append($('<div>')
|
|
.append($('<span>', {'id': 'versiondatemodified'}).text(response[1][count]))))
|
|
}
|
|
$('.version_list>li').click(function(){
|
|
$('.version_list').find('li').removeClass('active');
|
|
$(this).addClass('active');
|
|
});
|
|
}
|
|
else {
|
|
$.popContainerHide();
|
|
if ($('#rgt').css('right') == '0px' && ($(".head_search .page_title h4").text() != "Trash")) {
|
|
showErrorMessages('#searchError', response[1].err);
|
|
}
|
|
else {
|
|
showErrorMessages('.error_msg', response[1].err);
|
|
}
|
|
}
|
|
|
|
}
|
|
else {
|
|
$.popContainerHide();
|
|
if ($('#rgt').css('right') == '0px' && ($(".head_search .page_title h4").text() != "Trash")) {
|
|
showErrorMessages('#searchError', response[1].err);
|
|
}
|
|
else {
|
|
showErrorMessages('.error_msg', response[1].err);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
},
|
|
|
|
/*DetailPopupShow : function(){
|
|
$(DropDownMenu).hide();
|
|
Menu.MenuOptionUnSelect();
|
|
jQuery('#page_loader').show();
|
|
var itemName = jQuery('tr.row_selected td.file_check input').val();
|
|
var itemType = jQuery('tr.row_selected td.file_check label').text();
|
|
request_sent_details = 0;
|
|
Menu.DetailsPopupAjax(itemName);
|
|
|
|
},*/
|
|
SearchPopupShow: function(event) {
|
|
var itemName = jQuery('tr.row_selected td.file_check input').val();
|
|
$(DropDownMenu).hide();
|
|
Menu.MenuOptionUnSelect();
|
|
if($('.restore_page').length > 0 || $('.localrestore_page').length > 0) {
|
|
Menu.checkingSelectedItems();
|
|
}
|
|
$('.search_menu').trigger('click');
|
|
$('#location_selected').html(itemName.replace(/[\s]/g,' ') + '/').attr('title', (itemName + '/'));
|
|
},
|
|
DetailPopupShow : function() {
|
|
var itemName = jQuery('tr.row_selected td.file_check input').val();
|
|
var itemType = jQuery('tr.row_selected td.file_check label').text();
|
|
var page = jQuery('input[name="jobTypeManualTask"]').val();
|
|
$(DropDownMenu).hide();
|
|
Menu.MenuOptionUnSelect();
|
|
Menu.checkingSelectedItems();
|
|
jQuery('#page_loader').show();
|
|
request_sent_details = 0;
|
|
Menu.DetailsPopupAjax(itemName, page);
|
|
},
|
|
DetailsPopupAjax : function(itemName,page)
|
|
{
|
|
if(request_sent_details == 1)
|
|
return false;
|
|
request_sent_details = 1;
|
|
|
|
var deviceID = '';
|
|
var restoreValue = $('input[type=radio][name="restore_type_detail[]"]:checked').val();
|
|
if(dedup==true){
|
|
deviceID = jQuery('select.restoreDropdown-txtbox').val();
|
|
deviceID = "&deviceID="+encodeURIComponent(deviceID);
|
|
}
|
|
if(restoreValue == 'Online Account'){
|
|
// jQuery('.restore-dropdown, .option_menu, .backupset').show();
|
|
jQuery('.option_menu, .backupset').show();
|
|
jQuery('.reindex_menu').hide();
|
|
} else {
|
|
// jQuery('.restore-dropdown, .option_menu, .backupset').hide();
|
|
jQuery('.option_menu, .backupset').hide();
|
|
jQuery('.reindex_menu').show();
|
|
if(dedup == true && typeof availableLocalDevices != "undefined" && availableLocalDevices.length > 0 && $('.localRestore').length > 0) {
|
|
dedupBucket=$('#localBackupHost').find("option:selected").attr('idr-bkt');
|
|
deviceID = "&dedupBucket="+encodeURIComponent(dedupBucket);
|
|
}
|
|
}
|
|
|
|
jQuery.ajax({
|
|
url: 'action.php?action=getDetail&page='+page+'&itemName='+encodeURIComponent(itemName)+deviceID,
|
|
success: function(outputData){
|
|
if(outputData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
jQuery('#page_loader').hide();
|
|
outputDataRes=$.parseJSON(outputData);
|
|
if(outputDataRes[0]==true){
|
|
jQuery('.details_container #folderDetailsSize').html(outputDataRes[1][0]);
|
|
jQuery('.details_container #folderDetailsCount').html(outputDataRes[1][1]);
|
|
jQuery('.details_container #folderDetailsLmd').html(outputDataRes[1][2]);
|
|
jQuery('.details_container #folderDetailsName').html(outputDataRes[2].replace(/[\s]/g,' '));
|
|
jQuery('.details_container #folderDetailsName').attr('alt',outputDataRes[2]).attr('title',outputDataRes[2]);
|
|
if(outputDataRes[3].length>62){
|
|
var str1 = outputDataRes[3].substr(0, 30);
|
|
var str2 = outputDataRes[3].substr(outputDataRes[3].length - 30);
|
|
var path = str1+" ..... "+str2;
|
|
} else {
|
|
var path = outputDataRes[3];
|
|
}
|
|
|
|
jQuery('.details_container #folderDetailsPath').html(path.replace(/[\s]/g,' ')).attr('title',outputDataRes[3]).attr('alt',outputDataRes[3]);
|
|
$.popContainer();
|
|
$(secPosCont).append($('.details_container').show());
|
|
$(popcont).addClass('popLeft');
|
|
$('body').css({'overflow-y':'hidden'});
|
|
} else {
|
|
showErrorMessages('.error_msg','File/Folder does not exists');
|
|
}
|
|
}
|
|
});
|
|
},
|
|
//Adding backup list values to ExcludeList...
|
|
ExcludePopupShow : function(){
|
|
var itemName = jQuery('tr.row_selected td.file_check input').val();
|
|
var itemType = jQuery('tr.row_selected td.file_check label').text();
|
|
window.backupSearchbox='open';
|
|
$(DropDownMenu).hide();
|
|
Menu.MenuOptionUnSelect();
|
|
jQuery.ajax({
|
|
url: 'action.php?action=addToExcludeList&itemName='+encodeURIComponent(itemName)+'&itemType='+encodeURIComponent(itemType),
|
|
type: 'post',
|
|
success: function(outputData){
|
|
if(outputData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
jQuery('#page_loader').hide();
|
|
outputDataRes=$.parseJSON(outputData);
|
|
if(outputDataRes[0]==true){
|
|
if(jQuery('.serverDts ').css('right')=='0px'){
|
|
$('#searchError,#exlude_resultmsg').hide();
|
|
showErrorMessages('#exlude_resultmsg','Item has been added successfully to exclude list.');
|
|
}
|
|
else {
|
|
jQuery('.head_search .common_msg').hide();
|
|
showErrorMessages('.head_search .welcome_message','Item has been added successfully to exclude list.');
|
|
}
|
|
}
|
|
else{
|
|
if(jQuery('.serverDts ').css('right')=='0px'){
|
|
$('#exlude_resultmsg,#searchError').hide();
|
|
showErrorMessages('#searchError',"Item already exists in exclude list.");
|
|
}
|
|
else{
|
|
jQuery('.head_search .common_msg').hide();
|
|
showErrorMessages('.head_search .error_msg','Item already exists in exclude list.');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
},
|
|
/* Function to refresh the list */
|
|
RefreshList : function(){
|
|
$(DropDownMenu).hide();
|
|
jQuery("#backupSetSize").val(0);
|
|
jQuery('#backupSetSizeHTML').html('0.00 B');
|
|
if(jQuery(this).hasClass('menu_refresh_icon')){
|
|
var getDir = '/';
|
|
} else {
|
|
var getDir = jQuery('.row_selected input').val();
|
|
}
|
|
if(jQuery('.body_wrap').hasClass('backup_page') || jQuery('.body_wrap').hasClass('localbackup_page')){
|
|
var type = 'backup';
|
|
if(jQuery('.body_wrap').hasClass('localbackup_page')){
|
|
type = 'localBackup';
|
|
}
|
|
if(getDir == '/'){
|
|
dynamicArray = [];
|
|
dynamicType = [];
|
|
dynamicRequestInfo = [];
|
|
IDrive.LocalDirList = [];
|
|
|
|
defaultBackupSetArray = [];
|
|
defaultBackupSetTypeArray = [];
|
|
defaultBackupSetFileInfo = [];
|
|
if(jQuery('.body_wrap').hasClass('backup_page')){
|
|
backupSetArray = [];
|
|
backupSetTypeArray = [];
|
|
}
|
|
jobListArray = [];
|
|
jobListTypeArray = [];
|
|
jobListSizeArray = [];
|
|
jobListLMTimeArray = [];
|
|
localFileDirSize = []; // Cleaning the file/folder size array
|
|
loadFileSize = []; // array of items to fetch the file/folder size
|
|
jQuery("#backupSetSizeHTML").html('0.00 B');
|
|
jQuery("#backupSetSize").val(0);
|
|
isRefresh = true;
|
|
Menu.removeBackupAndRestoreList(getDir,type);
|
|
} else if(typeof dynamicArray[getDir] != "undefined"){
|
|
delete dynamicArray[getDir];
|
|
delete dynamicType[getDir];
|
|
delete dynamicRequestInfo[getDir];
|
|
delete IDrive.LocalDirList[getDir];
|
|
delete localFileDirSize[getDir]; // Cleaning the file/folder size array
|
|
for(var key in dynamicArray)
|
|
{
|
|
if(key.indexOf(getDir+'/') == 0){
|
|
delete dynamicArray[key];
|
|
delete dynamicType[key];
|
|
delete dynamicRequestInfo[key];
|
|
delete IDrive.LocalDirList[key];
|
|
delete localFileDirSize[key]; // Cleaning the file/folder size array
|
|
}
|
|
}
|
|
refreshFolder = true;
|
|
Menu.removeBackupAndRestoreList(getDir,type);
|
|
} else {
|
|
refreshFolder = true;
|
|
var jobName = $("#select_job").val();
|
|
delete jobListArray[jobName];
|
|
delete jobListTypeArray[jobName];
|
|
delete jobListSizeArray[jobName];
|
|
delete jobListLMTimeArray[jobName];
|
|
jQuery('#page_loader').hide();
|
|
loadExistingJob(jobName,type,getDir);
|
|
}
|
|
} else if(jQuery('.body_wrap').hasClass('localrestore_page')){
|
|
if(reIndexStarted==true){
|
|
showErrorMessages('.head_search .error_msg','Reindex in progress. Please try again later');
|
|
return false;
|
|
}
|
|
|
|
if(getDir == '/'){
|
|
dynamicLocalRestoreArray = [];
|
|
dynamicLocalRestoreType = [];
|
|
dynamicLocalRestoreSize = [];
|
|
dynamicLocalRestoreDate = [];
|
|
dynamicLocalRestoreRequestInfo = [];
|
|
|
|
jobListArray = [];
|
|
jobListTypeArray = [];
|
|
jobListSizeArray = [];
|
|
jobListLMTimeArray = [];
|
|
Menu.removeBackupAndRestoreList(getDir,'restore');
|
|
} else {
|
|
var restoreType = jQuery('select.restoreDropdown-txtbox').val();
|
|
var dedupBucket = '';
|
|
if(dedup == true && typeof availableLocalDevices != "undefined" && availableLocalDevices.length > 0 && $('.localRestore').length > 0) {
|
|
dedupBucket=$('#localBackupHost').find("option:selected").attr('idr-bkt');
|
|
}
|
|
getDir = restoreType+getDir+'/'+dedupBucket;
|
|
if(typeof dynamicLocalRestoreArray[getDir] != "undefined"){
|
|
delete dynamicLocalRestoreArray[getDir];
|
|
delete dynamicLocalRestoreType[getDir];
|
|
delete dynamicLocalRestoreSize[getDir];
|
|
delete dynamicLocalRestoreDate[getDir];
|
|
delete dynamicLocalRestoreRequestInfo[getDir];
|
|
for(var key in dynamicLocalRestoreArray)
|
|
{
|
|
if(key.indexOf(getDir) == 0){
|
|
delete dynamicLocalRestoreArray[key];
|
|
delete dynamicLocalRestoreType[key];
|
|
delete dynamicLocalRestoreSize[key];
|
|
delete dynamicLocalRestoreDate[key];
|
|
delete dynamicLocalRestoreRequestInfo[key];
|
|
}
|
|
}
|
|
refreshFolder = true;
|
|
Menu.removeBackupAndRestoreList(getDir,'restore');
|
|
}
|
|
}
|
|
} else if(jQuery('.body_wrap').hasClass('restore_page')){
|
|
if(getDir == '/'){
|
|
dynamicRemoteArray = [];
|
|
dynamicRemoteType = [];
|
|
dynamicRemoteSize = [];
|
|
dynamicRemoteDate = [];
|
|
dynamicRemoteRequestInfo = [];
|
|
isDedupRefresh = true;
|
|
|
|
defaultRestoreSetArray = [];
|
|
defaultRestoreSetTypeArray = [];
|
|
defaultRestoreSetFileInfo = [];
|
|
jobListArray = [];
|
|
jobListTypeArray = [];
|
|
jobListfileInfoArray = [];
|
|
jobListSizeArray = [];
|
|
jobListLMTimeArray = [];
|
|
Menu.removeBackupAndRestoreList(getDir,'restore');
|
|
} else {
|
|
getDir = getDir+'/';
|
|
if(dedup == true){
|
|
var restoreType = jQuery('select.restoreDropdown-txtbox').val();
|
|
getDir = restoreType+getDir;
|
|
}
|
|
|
|
if(typeof dynamicRemoteArray[getDir] != "undefined"){
|
|
delete dynamicRemoteArray[getDir];
|
|
delete dynamicRemoteType[getDir];
|
|
delete dynamicRemoteSize[getDir];
|
|
delete dynamicRemoteDate[getDir];
|
|
delete dynamicRemoteRequestInfo[getDir];
|
|
for(var key in dynamicRemoteArray)
|
|
{
|
|
if(key.indexOf(getDir) == 0){
|
|
delete dynamicRemoteArray[key];
|
|
delete dynamicRemoteType[key];
|
|
delete dynamicRemoteSize[key];
|
|
delete dynamicRemoteDate[key];
|
|
delete dynamicRemoteRequestInfo[key];
|
|
}
|
|
}
|
|
refreshFolder = true;
|
|
Menu.removeBackupAndRestoreList(getDir,'restore');
|
|
}
|
|
}
|
|
}
|
|
$(DropDownMenu).hide();
|
|
if(machine!='twotier') {
|
|
Menu.MenuOptionUnSelect();
|
|
Menu.checkingSelectedItems();
|
|
}
|
|
},
|
|
SharePopupClick : function(){
|
|
var sharedFiles = '';
|
|
var selectedRow = jQuery('tr.row_selected td.file_check');
|
|
if(jQuery(this).hasClass('menu_share')){
|
|
if(jQuery('.serverDts ').css('right')=='0px'){
|
|
var sharedItem = searchItemArray.slice();
|
|
} else {
|
|
var sharedItem = shareItemArray.slice();
|
|
}
|
|
|
|
if(sharedItem.length>0 && typeof sharedItem.length!='undefined'){
|
|
var sharedFiles = '';
|
|
for(var i=0;i<sharedItem.length;i++){
|
|
sharedFiles += sharedItem[i]+'\n';
|
|
}
|
|
} else {
|
|
if(jQuery(this).closest('li').hasClass('shr_li')){
|
|
showErrorMessages('#searchError','Select file(s)/folder(s) to share');
|
|
} else {
|
|
showErrorMessages('.edit_work .error_msg1','Select file(s)/folder(s) to share');
|
|
}
|
|
return false;
|
|
}
|
|
} else {
|
|
sharedFiles = selectedRow.find('input').val();
|
|
var sharedPath = jQuery('#fullPathBreadCrumb a:last').attr('alt');
|
|
var shareType = selectedRow.find('label').text();
|
|
sharedFiles += (shareType=='folder')?'/':'';
|
|
}
|
|
Menu.MenuOptionUnSelect();
|
|
jQuery('#page_loader').show();
|
|
request_sent_share = 0;
|
|
Menu.ShareAjax(sharedFiles);
|
|
},
|
|
ShareAjax : function(sharedFiles){
|
|
if(request_sent_share == 1)
|
|
return false;
|
|
|
|
var deviceID = '';
|
|
if(dedup==true){
|
|
deviceID = jQuery('select.restoreDropdown-txtbox').val();
|
|
deviceID = "&deviceID="+encodeURIComponent(deviceID);
|
|
}
|
|
|
|
request_sent_share = 1;
|
|
sharefiles = '';
|
|
$.each(sharedFiles.split("\n"), function( index, value ) {
|
|
itemData = value.split("/");
|
|
itemName = itemData.pop();
|
|
if(itemName == '')
|
|
itemName = itemData.pop();
|
|
if(typeof itemName !== "undefined"){
|
|
sharedPath = itemData.join("/");
|
|
sharefiles = sharefiles+'<li class="f_name_view"><p title="'+itemName+'">'+itemName+'</p><div>Home'+sharedPath+'</div><span></span></li>';
|
|
}
|
|
});
|
|
sharefiles = sharefiles+'<input type="hidden" name="itemPath" id="itemPath" value="'+sharedFiles+'" />';
|
|
|
|
jQuery('#sharefiles_disp').html(sharefiles);
|
|
jQuery('#page_loader').hide();
|
|
Menu.MenuOptionUnSelect();
|
|
$.popContainer();
|
|
$(secPosCont).append($('.share_container').show());
|
|
$(popcont).addClass('popLeft');
|
|
$('body').css({'overflow-y':'hidden'});
|
|
$(DropDownMenu).hide();
|
|
//jQuery('input#shareType').val(shareType);
|
|
Menu.checkingSelectedItems(); //Clearing the array & Mark-check the items
|
|
|
|
/*jQuery.ajax({
|
|
url: 'action.php?action=share&sharedFiles='+encodeURIComponent(sharedFiles)+deviceID,
|
|
success: function(outputData){
|
|
if(outputData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
outputDataRes=$.parseJSON(outputData);
|
|
jQuery('#page_loader').hide();
|
|
var shareFailed = false;
|
|
var sharePath = '';
|
|
if(outputDataRes.length==0){
|
|
shareFailed = true;
|
|
} else {
|
|
sharePath = outputDataRes['sharePath'];
|
|
}
|
|
|
|
if(shareFailed==false){
|
|
//jQuery('input#shareLinkDisp').val(shareLink).attr('data-clipboard-text',shareLink).siblings('a').attr('href',shareLink);
|
|
jQuery('#sharefiles_disp').html(sharePath);
|
|
} else {
|
|
$.popContainerHide();
|
|
showErrorMessages('.error_msg','Share link not created');
|
|
}
|
|
}
|
|
});*/
|
|
|
|
|
|
},
|
|
ShareFileSelectCloseBtn : function(){
|
|
var FilesLenght = $('.share_viewfiles_body li').length;
|
|
if(FilesLenght === 2){
|
|
$('.share_viewfiles_body li:first-child').find('span').remove();
|
|
}
|
|
$(this).closest('li').remove();
|
|
},
|
|
SharePopupSettingBtn : function(){
|
|
($('.share_settings_body').is(':visible')) ? $('.share_settings_body').hide() : $('.share_settings_body').show()
|
|
},
|
|
SharePopupSuccessfull : function(){
|
|
|
|
/* Validating Multiple Email Addresses - Start */
|
|
var emailIds = jQuery('input.share_email').val();
|
|
if(emailIds!=''){
|
|
var regex = /(?:[^\,\;]+|\\)+/g;
|
|
var matched = null;
|
|
while (matched = regex.exec(emailIds)) {
|
|
if(IDrive.Scheduler.validateSchedulerEmailAddress(matched[0])==false){
|
|
showErrorMessages('.share_body .error_msg','Invalid Email Address format');
|
|
return false;
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
showErrorMessages('.share_body .error_msg','Please enter email address to share');
|
|
return false;
|
|
}
|
|
/* Validating Multiple Email Addresses - End */
|
|
|
|
if(emailIds){
|
|
$.popContainerHide();
|
|
request_sent_share = 0;
|
|
jQuery('#page_loader').show();
|
|
var inputData = jQuery('form#shareForm').serialize();
|
|
|
|
var deviceID = '';
|
|
if(dedup==true){
|
|
deviceID = jQuery('select.restoreDropdown-txtbox').val();
|
|
deviceID = "&deviceID="+encodeURIComponent(deviceID);
|
|
}
|
|
|
|
jQuery.ajax({
|
|
url: 'action.php?action=sendShareEmail'+deviceID,
|
|
type: "POST",
|
|
data:inputData,
|
|
success: function(outputData){
|
|
if(outputData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
jQuery('#page_loader').hide();
|
|
jQuery(':input','#shareForm').not(':button, :submit').val(''); //Clearing the data
|
|
outputDataRes=$.parseJSON(outputData);
|
|
if(outputDataRes[0]==true){
|
|
showErrorMessages('.head_search .welcome_message','File(s)/Folder(s) has been shared successfully');
|
|
} else {
|
|
showErrorMessages('.head_search .error_msg','Failed to share');
|
|
}
|
|
renameAjaxStatus=0;
|
|
}
|
|
});
|
|
}
|
|
},
|
|
SharePopupClose : function(){
|
|
request_sent_share = 0;
|
|
$.popContainerHide();
|
|
//$(SccuessfulMsg).hide();
|
|
jQuery(':input','#shareForm').not(':button, :submit').val(''); //Clearing the data
|
|
jQuery('.error_msg,.error_msg1').hide(); // Hide option error messages
|
|
},
|
|
DeleteFileAction : function(){
|
|
if($('.edit_work').is(':visible'))
|
|
window.edit_work = 1;
|
|
else
|
|
window.edit_work = 0;
|
|
|
|
if ($('#rgt.serverDts').css('right') == '0px')
|
|
window.searchPopup = 1;
|
|
else
|
|
window.searchPopup = 0;
|
|
|
|
//var checkedItemsLength = shareItemArray.length;
|
|
var checkedItemsLength = searchItemArray.length;
|
|
DeleteItem = searchItemArray;
|
|
/* if($(".head_search .page_title h4").text() == "Trash") {
|
|
checkedItemsLength = searchItemArray.length;
|
|
DeleteItem = searchItemArray;
|
|
} */
|
|
|
|
if(!checkedItemsLength) {
|
|
if($(".head_search .page_title h4").text() == "Trash"){
|
|
msg_type = '.error_msg';
|
|
msg = 'Select file(s)/folder(s) to Delete';
|
|
time = 1;
|
|
setTimeout(function(){ showErrorMessages(msg_type,msg);} , time);
|
|
}
|
|
if(jQuery(this).closest('menu_share').hasClass('shr_li') || $('#rgt.serverDts ').css('right') == '0px')
|
|
showErrorMessages('#searchError','Select file(s)/folder(s) to Delete');
|
|
else
|
|
showErrorMessages('.edit_work .error_msg1','Select file(s)/folder(s) to Delete');
|
|
return false;
|
|
}
|
|
|
|
if(checkedItemsLength == 1 && $(".head_search .page_title h4").text() != "Trash") {
|
|
//var DeleteItemres = shareItemArray[0];
|
|
var DeleteItemres = searchItemArray[0];
|
|
var res = DeleteItemres.split("/");
|
|
$("#delPopupEllipse").text(res[res.length-2]);
|
|
del_cookie = 'restore_del';
|
|
} else if (checkedItemsLength == 1 && $(".head_search .page_title h4").text() == "Trash") {
|
|
var DeleteItemres = searchItemArray[0];
|
|
var res = DeleteItemres.split("/");
|
|
$("#delPopupEllipse").text(res[res.length-1]);
|
|
del_cookie = 'trash_del';
|
|
} else {
|
|
$("#delPopupEllipse").text(checkedItemsLength+" items");
|
|
}
|
|
|
|
Menu.MenuOptionUnSelect();
|
|
if(getCookie(del_cookie)) {
|
|
$('#deleteConfirmation').trigger( "click" );
|
|
} else {
|
|
$.popContainer();
|
|
$(secPosCont).append($('.popup_delete').show());
|
|
$(popcont).addClass('popLeft');
|
|
$('body').css({'overflow-y':'hidden'});
|
|
$(DropDownMenu).hide();
|
|
}
|
|
},//DeleteFileAction
|
|
PutBackFileAction : function(){
|
|
PutBackArray = [];
|
|
PutBackArray = searchItemArray;
|
|
putbackfile = 1;
|
|
if(PutBackArray.length > 0){
|
|
Menu.MenuOptionUnSelect();
|
|
PutBackItem = PutBackArray;
|
|
if(getCookie('trash_putback')){
|
|
Menu.PutBackSuccessfully();
|
|
}else{
|
|
if (PutBackArray.length == 1){
|
|
var PutBackres = searchItemArray[0];
|
|
var PutBackres = PutBackres.split("/");
|
|
$("#putBackPopupEllipse").text(PutBackres[PutBackres.length-1]);
|
|
del_cookie = 'trash_del';
|
|
}
|
|
else
|
|
$("#putBackPopupEllipse").text(" "+PutBackArray.length+" Items");
|
|
|
|
$.popContainer();
|
|
$(secPosCont).append($('.put_back_popup').show());
|
|
$(popcont).addClass('popLeft');
|
|
$('body').css({'overflow-y':'hidden'});
|
|
}
|
|
$(DropDownMenu).hide();
|
|
}else{
|
|
msg_type = '.error_msg';
|
|
msg = 'Select file(s)/folder(s) to PutBack';
|
|
time = 1;
|
|
setTimeout(function(){ showErrorMessages(msg_type,msg);} , time);
|
|
}
|
|
},//DeleteFileAction
|
|
DeleteConfirmationCancel : function(){ //alert('DeleteConfirmationCancel');
|
|
|
|
if(DeleteItem) DeleteItem = "";
|
|
|
|
//if(shareItemArray.length > 0 && !window.edit_work) shareItemArray=[];
|
|
|
|
if(window.edit_work)
|
|
Menu.MenuOptionSelect();
|
|
|
|
$.popContainerHide();
|
|
$("#deleteButton").show();
|
|
//Menu.MenuOptionSelect();
|
|
//$(SccuessfulMsg).hide();
|
|
//$(MenuListShowOption).show();
|
|
},
|
|
|
|
CloseDetailsSuccessfully : function(){
|
|
$.popContainerHide();
|
|
$(SccuessfulMsg).hide();
|
|
},
|
|
DeleteSuccessfully : function(){
|
|
$.popContainerHide();
|
|
//$(SccuessfulMsg).hide();
|
|
Deletetype = "";
|
|
if($(".head_search .page_title h4").text() != "Trash"){
|
|
del_cookie = 'restore_del';
|
|
del_check = $('#restore_del_chk').prop("checked");
|
|
}
|
|
else{
|
|
del_cookie = 'trash_del';
|
|
del_check = $('#trash_del_chk').prop("checked");
|
|
}
|
|
|
|
if(del_check)
|
|
setCookie(del_cookie,true,2);
|
|
|
|
if((window.edit_work && (null == DeleteItem || "" == DeleteItem)) || window.searchPopup) {
|
|
items = shareItemArray;
|
|
shareItemArray = [];
|
|
} else {
|
|
DeleteItemArray = DeleteItem;
|
|
DeleteItem = "";
|
|
Deletetype = DeleteItemType;
|
|
DeleteItemType = "";
|
|
shareItemArray=[];
|
|
items = DeleteItemArray;
|
|
}
|
|
|
|
if(items.length == 0 && DeleteItem.length > 0) {
|
|
items = DeleteItem;
|
|
DeleteItemArray = DeleteItem;
|
|
DeleteItem = "";
|
|
}
|
|
|
|
jQuery('#page_loader').show();
|
|
jQuery('.head_search .alert p').html('Deleting files(s)/folder(s)...Please wait').parent().show();
|
|
window.deleteStatus = 1;
|
|
var targetUrl = "action.php?action=deleteAction";
|
|
|
|
trashdelete = false;
|
|
if (($('#rgt.serverDts').css('right') == '0px' && $('#rgt.serverDts .putback').length) || $('#content .trash-wrap').length)
|
|
{
|
|
targetUrl += "&deleteFromTrash=1";
|
|
trashdelete = true;
|
|
}
|
|
if(dedup==true){
|
|
if(trashdelete==true)
|
|
var deviceID = selectedRestoreListPath;
|
|
else
|
|
var deviceID = jQuery('select.restoreDropdown-txtbox').val();
|
|
targetUrl += "&deviceID="+encodeURIComponent(deviceID);
|
|
} else
|
|
editJob('restore');
|
|
|
|
|
|
window.deleteAjaxCall = $.ajax({
|
|
url: targetUrl,
|
|
type: "POST",
|
|
data: {"items":items,"type":Deletetype},
|
|
success: function(validatedData){
|
|
output = validatedData;
|
|
window.deleteStatus = 0;
|
|
var msg_type = "";
|
|
var msg = "";
|
|
var time = 1;
|
|
|
|
if(output.STATUS == 2)
|
|
{
|
|
msg_type = '.error_msg';
|
|
msg = 'Backup job is running. Please try after sometime.';
|
|
|
|
}
|
|
else if(output.STATUS == 3)
|
|
{
|
|
msg_type = '.error_msg';
|
|
msg = 'Delete is in progress already. Please try after sometime.';
|
|
|
|
}
|
|
else if(output.STATUS == 4)
|
|
{
|
|
msg_type = '.error_msg';
|
|
msg = 'No items selected for Delete';
|
|
|
|
}
|
|
else if(output.STATUS == 0)
|
|
{
|
|
msg_type = '.error_msg';
|
|
msg = 'Delete Operation has failed. Please check log for details.';
|
|
}
|
|
else if(output.STATUS == 1)
|
|
{
|
|
if($(".head_search .page_title h4").text() != "Trash"){
|
|
if(output.REMOVE_JS_ARRAY)
|
|
{
|
|
ajaxCallForCleareRestoreList('restore');
|
|
dynamicRemoteArray = [];
|
|
dynamicRemoteType = []
|
|
dynamicRemoteSize = [];
|
|
dynamicRemoteDate = [];
|
|
dynamicRemoteRequestInfo = [];
|
|
}
|
|
else
|
|
{
|
|
var RemovePath = items[0];
|
|
var currDir = jQuery('#fullPathBreadCrumb a').last().attr('title');
|
|
if(dedup == true){
|
|
var restoreType = jQuery('select.restoreDropdown-txtbox').val();
|
|
currDir = restoreType+currDir;
|
|
}
|
|
var RemoveItemIndex = dynamicRemoteArray[currDir].indexOf(items[0]);
|
|
var RemoveItemType = dynamicRemoteType[currDir][RemoveItemIndex];
|
|
ajaxCallForCleareRestoreList('restore',currDir);
|
|
if(RemoveItemIndex != -1){
|
|
dynamicRemoteArray[currDir].splice(RemoveItemIndex,1);
|
|
dynamicRemoteType[currDir].splice(RemoveItemIndex,1);
|
|
dynamicRemoteSize[currDir].splice(RemoveItemIndex,1);
|
|
dynamicRemoteDate[currDir].splice(RemoveItemIndex,1);
|
|
}
|
|
|
|
if(RemoveItemType == "folder") {
|
|
for(var key in dynamicRemoteArray) {
|
|
if(RemovePath == key || key.indexOf(RemovePath) == 0) {
|
|
delete dynamicRemoteArray[key];
|
|
delete dynamicRemoteType[key];
|
|
delete dynamicRemoteSize[key];
|
|
delete dynamicRemoteDate[key];
|
|
}
|
|
}
|
|
}
|
|
|
|
$('td.search-file-name[title="' + RemovePath + '"]').closest('tr').remove();
|
|
}
|
|
if($('#startRestoreForm input[name=jobTypeManualTask]').val() == "Restore"){
|
|
var selectedRestoreJob = jQuery('#select_restore_job').val();
|
|
//delete jobListArray[selectedRestoreJob];
|
|
for(var key in jobListArray){
|
|
if(key.substr(0, 8)=='Restore_'){
|
|
delete jobListArray[key];
|
|
delete jobListTypeArray[key];
|
|
delete jobListSizeArray[key];
|
|
delete jobListLMTimeArray[key];
|
|
}
|
|
}
|
|
|
|
// added by anil for displaying the updated restore set values.
|
|
var indexValueForRestoreSet = defaultRestoreSetArray.indexOf(items[0]);
|
|
if(indexValueForRestoreSet != -1){
|
|
defaultRestoreSetArray.splice(indexValueForRestoreSet,1);
|
|
defaultRestoreSetTypeArray.splice(indexValueForRestoreSet,1);
|
|
|
|
if(defaultRestoreSetArray == "")
|
|
{
|
|
jQuery('#removeRestoresetFiles span').hide();
|
|
jQuery('#removeRestoresetFiles').siblings('.file_check').find('label').removeAttr('class');
|
|
jQuery('#restoreSetFiles').html('').parent('.excludefiles').hide().closest('form').siblings('.nfiles').show().siblings('.main_chk_table').find('tr').hide();
|
|
}
|
|
}
|
|
|
|
|
|
if(selectedRestoreJob !='undefined'){
|
|
// commented these two lines by anil for displaying the updated restore set values.
|
|
/*defaultRestoreSetTypeArray = [];
|
|
defaultRestoreSetArray = [];*/
|
|
refreshFolder=true;
|
|
if(!($(".head_search .page_title h4").text() == "Trash"))
|
|
loadExistingJob(selectedRestoreJob,'restore');
|
|
}
|
|
}
|
|
setTimeout(function(){ $( ".storage_calculate" ).trigger( "click" ) }, 120000);
|
|
}
|
|
jQuery('input#mainchek').removeAttr('checked').siblings('label').removeAttr('class');
|
|
jQuery('#page_loader').hide();
|
|
msg_type = '.welcome_message';
|
|
msg = 'Delete operation has been completed successfully.';
|
|
}
|
|
jQuery('.head_search .alert p').parent().hide();
|
|
jQuery('.alert,#page_loader').hide();
|
|
Menu.MenuOptionUnSelect();
|
|
if($(".head_search .page_title h4").text() == "Trash"){
|
|
startRemoteSearch("trash");
|
|
searchItemArray = [];
|
|
}
|
|
else{
|
|
jQuery('#fullPathBreadCrumb a:last').trigger("click");
|
|
//jQuery('.left_menu .menu_ul').hide();
|
|
}
|
|
|
|
$(MenuListShowOption).show();
|
|
setTimeout(function(){ showErrorMessages(msg_type,msg);} , time);
|
|
}
|
|
});
|
|
|
|
},
|
|
PutBackSuccessfully : function(){
|
|
$.popContainerHide();
|
|
var putBackItem1;
|
|
TrashPutbackHappen = 0;
|
|
putBackItem1 = PutBackItem;
|
|
putback_check = $('#trash_putback_chk').prop("checked");
|
|
if(putback_check)
|
|
setCookie('trash_putback',true,2);
|
|
var targetUrl="action.php?action=putbackTrashSetItems"; // calling stop archive while closing the archive popup.
|
|
if(dedup==true){
|
|
var deviceID = selectedRestoreListPath;
|
|
targetUrl += "&deviceID="+encodeURIComponent(deviceID);
|
|
}
|
|
jQuery('.alert,#page_loader').show();
|
|
jQuery('.head_search .alert p').html('PutBack files(s)/folder(s)...Please wait').parent().show();
|
|
$.ajax({
|
|
url: targetUrl,
|
|
type: "POST",
|
|
data: {"items":putBackItem1},
|
|
dataType: 'json',
|
|
success: function(validatedData){
|
|
|
|
output = validatedData;
|
|
window.deleteStatus = 0;
|
|
var msg_type = "";
|
|
var msg = "";
|
|
var time = 1;
|
|
|
|
if(output.STATUS == 1)
|
|
{
|
|
msg_type = '.welcome_message';
|
|
msg = 'Putback operation has been completed successfully';
|
|
dynamicRemoteArray = [];
|
|
dynamicRemoteType = []
|
|
dynamicRemoteSize = [];
|
|
dynamicRemoteDate = [];
|
|
dynamicRemoteRequestInfo = [];
|
|
defaultRestoreSetTypeArray = [];
|
|
defaultRestoreSetArray = [];
|
|
TrashPutbackHappen = 1;
|
|
|
|
var selectedRestoreJob = currentRestoreJob;
|
|
if(selectedRestoreJob == '')
|
|
selectedRestoreJob = 0;
|
|
//delete jobListArray[selectedRestoreJob];
|
|
for(var key in jobListArray){
|
|
if(key.substr(0, 8)=='Restore_'){
|
|
delete jobListArray[key];
|
|
delete jobListTypeArray[key];
|
|
delete jobListSizeArray[key];
|
|
delete jobListLMTimeArray[key];
|
|
}
|
|
}
|
|
ajaxCallForCleareRestoreList('restore');
|
|
setTimeout(function(){ $( ".storage_calculate" ).trigger( "click" ) }, 120000);
|
|
|
|
}
|
|
else if(output['FAILED'] == 2)
|
|
{
|
|
msg_type = '.error_msg';
|
|
msg = 'Something went wrong. Please try after sometime.';
|
|
|
|
}
|
|
else if(output.STATUS == 4)
|
|
{
|
|
msg_type = '.error_msg';
|
|
msg = 'Select file(s)/folder(s) to PutBack';
|
|
|
|
}
|
|
else if(output.STATUS == "partial")
|
|
{
|
|
msg_type = '.error_msg';
|
|
msg = 'Some files are failed to PutBack. Please check log for details.';
|
|
TrashPutbackHappen = 1;
|
|
ajaxCallForCleareRestoreList('restore');
|
|
dynamicRemoteArray = [];
|
|
dynamicRemoteType = []
|
|
dynamicRemoteSize = [];
|
|
dynamicRemoteDate = [];
|
|
dynamicRemoteRequestInfo = [];
|
|
setTimeout(function(){ $( ".storage_calculate" ).trigger( "click" ) }, 120000);
|
|
}
|
|
else if(output.STATUS == 0)
|
|
{
|
|
msg_type = '.error_msg';
|
|
msg = 'PutBack Operation has failed. Please check log for details.';
|
|
}
|
|
else
|
|
{
|
|
msg_type = '.error_msg';
|
|
msg = 'Something went wrong. Please try after sometime.';
|
|
|
|
}
|
|
|
|
jQuery('input#mainchek').removeAttr('checked').siblings('label').removeAttr('class');
|
|
jQuery('.alert,#page_loader').hide();
|
|
startRemoteSearch("trash");
|
|
$("#backButton").on('click',function(){ $(".leftnavbutton.act").trigger("click"); });
|
|
$(MenuListShowOption).show();
|
|
setTimeout(function(){ showErrorMessages(msg_type,msg);} , time);
|
|
searchItemArray = [];
|
|
}
|
|
});
|
|
},
|
|
CreateNewFolder : function(){
|
|
var CreateFolder = '<tr class="createFolder_selected">\
|
|
<td class="file_check"> \
|
|
</td>\
|
|
<td class="cont_heading"><img src="include/images/idq_ico_folder.png" >\
|
|
<span style="display:none">Public</span> \
|
|
<span class="createfolder_span">\
|
|
<input type="text" value="New Folder" class="newfolder_txtbox">\
|
|
<img src="include/images/msgclose.png" height="16" width="16" class="msgclose">\
|
|
</span>\
|
|
</td>\
|
|
<td class="file_size"></td>\
|
|
<td class="file_date"></td>\
|
|
<td></td>\
|
|
</tr>';
|
|
|
|
if(!$(VisibleFolderClass).is(':visible')){ $(ActionTable).prepend(CreateFolder); }
|
|
$('.excludefiles').scrollTop(0);
|
|
$('#loadRestorePath').show().siblings('.nfiles,.ajax_loader').hide();
|
|
$('span.createfolder_span input').select();
|
|
},//CreateNewFolder
|
|
CreateFolderClose : function(){
|
|
$(VisibleFolderClass).remove();
|
|
},
|
|
RenameChangeCurrentFile : function(){
|
|
var RenameFile ='<span class="rename_span"><input type="text" class="rename_txtbox" value=""><input type="hidden" class="renamePath_txtbox" value=""><img src="include/images/msgclose.png" height="16" width="16" class="msgclose"></span>';
|
|
var RenameSelected = '.rename_Selected',
|
|
RenameHeading = '.cont_heading',
|
|
FileMenuRename = '.file_menu_rename',
|
|
RenameCloseBtn = RenameSelected+' .msgclose',
|
|
RenameRowHeading = 'table tr'+RenameSelected+''+RenameHeading,
|
|
RenameRowHeadSpan = 'table tr'+RenameSelected+''+RenameHeading+' .rename_span',
|
|
RightSideMenuHide = '.right_menu .search_menu,.right_menu .backupset,.option_menu,.restore-dropdown',
|
|
AddClassRename = 'rename_Selected',
|
|
RowSelected = '.row_selected',
|
|
RenameTextBox = '.rename_txtbox';
|
|
RenamePathField = '.renamePath_txtbox';
|
|
if(!$(RenameSelected).is(':visible')){
|
|
$(RowSelected).addClass(AddClassRename);
|
|
var RenameValue = $(RenameSelected).find(RenameHeading).find('span').text();
|
|
$(RenameSelected).find(RenameHeading).find('span').hide();
|
|
$(RenameSelected).find(RenameHeading).append(RenameFile);
|
|
RenameValue = RenameValue.replace(/\u00A0/g, ' ');
|
|
if(jQuery('.serverDts ').css('right')=='0px'){
|
|
var splitChar = RenameValue.split('/');
|
|
var RenameValue = splitChar[splitChar.length-1];
|
|
splitChar.pop();
|
|
RenamePath = splitChar.join('/');
|
|
$(RenamePathField).val(RenamePath+"/");
|
|
}
|
|
$(RenameTextBox).val(RenameValue).focus().select();
|
|
$(DropDownMenu).hide();
|
|
}
|
|
return false;
|
|
},
|
|
RenameCloseBtn : function(){
|
|
var RenameRowHeading = 'table tr.rename_Selected .cont_heading',
|
|
RenameRowHeadSpan = 'table tr.rename_Selected .cont_heading .rename_span';
|
|
|
|
$(RenameRowHeading).find('span').show();
|
|
$('.rename_span').remove();
|
|
$(RenameRowHeadSpan).remove();
|
|
$('table.bc_table tr').removeClass('rename_Selected');
|
|
},
|
|
MenuOptionSelect : function(){
|
|
if(!$('.edit_work').is(':visible')){
|
|
$('.body').addClass('edit_work');
|
|
$('.edit_work').before('<div class=edit_shadow></div>')
|
|
$(RightSideMenuHide).hide();
|
|
$('.newfolder_li,.close_menu').show();
|
|
Menu.MenuListSelected();
|
|
$(EditOptionShow).css('height',$(document).innerHeight());
|
|
}
|
|
},
|
|
MenuOptionUnSelect : function(){
|
|
$(EditOptionShow).remove();
|
|
$('.body').removeClass('edit_work');
|
|
var restoreValue = $('input[type=radio][name="restore_type_detail[]"]:checked').val();
|
|
if(restoreValue == 'Online Account')
|
|
$(RightSideMenuHide).show();
|
|
$('.newfolder_li').hide();
|
|
Menu.MenuListUnSelected();
|
|
$('body').css({'overflow-y':'auto'});
|
|
jQuery('.error_msg,.error_msg1').hide(); // Hide option error messages
|
|
},
|
|
MenuListUnSelected : function(){
|
|
$(MenuListShowOption).hide();
|
|
$('.close_menu').hide();
|
|
},
|
|
MenuListSelected :function (){
|
|
if($('.edit_work').is(':visible')) { $(MenuListShowOption).show(); }
|
|
},
|
|
OptionMenuClick: function(){
|
|
|
|
if(actionRequired==2){
|
|
editJob('restore');
|
|
}
|
|
Menu.MenuOptionSelect();
|
|
Menu.uncheckingSelectedItems();
|
|
jQuery('.error_msg,.error_msg1').hide(); // Hide option error messages
|
|
jQuery('.left_menu .menu_ul').show();
|
|
},
|
|
ajaxCallForRename: function(oldName,newName,oldPath,newPath){
|
|
jQuery('#page_loader').show();
|
|
jQuery.ajax({
|
|
url: 'action.php?action=rename&oldPath='+encodeURIComponent(oldPath)+'&newPath='+encodeURIComponent(newPath),
|
|
success: function(outputData){
|
|
if(outputData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
outputDataRes=$.parseJSON(outputData);
|
|
if(outputDataRes[0]==true){
|
|
jQuery('.rename_Selected').addClass('renamedItem'); //Add temp reference class
|
|
Menu.updateBreadcrumb(oldPath,newPath);
|
|
Menu.updateRenamedItems(oldName,newName,oldPath,newPath);
|
|
Menu.RenameCloseBtn();
|
|
jQuery('#page_loader').hide();
|
|
|
|
if(jQuery('.serverDts ').css('right')!='0px'){
|
|
Menu.MenuOptionUnSelect();
|
|
showErrorMessages('.welcome_message','<b>'+oldName+'</b> has been renamed to <b>'+newName.replace(/\s/g, ' ')+'</b> successfully');
|
|
}
|
|
} else {
|
|
Menu.RenameCloseBtn();
|
|
Menu.MenuOptionUnSelect();
|
|
jQuery('#page_loader').hide();
|
|
|
|
if(jQuery('.serverDts ').css('right')=='0px'){
|
|
showErrorMessages('#searchError',errorNewDirExists);
|
|
} else {
|
|
var pos = outputData.indexOf("already exists");
|
|
if(pos >0)
|
|
showErrorMessages('.error_msg',errorNewDirExists);
|
|
else
|
|
showErrorMessages('.error_msg',"Failed to update");
|
|
}
|
|
}
|
|
Menu.checkingSelectedItems();
|
|
renameAjaxStatus=0;
|
|
}
|
|
});
|
|
},
|
|
initiateRename : function(){
|
|
var oldName = jQuery('tr.rename_Selected span').text();
|
|
var oldPath = jQuery('tr.rename_Selected td.file_check input').val();
|
|
var newName = jQuery('input.rename_txtbox').val();
|
|
oldName = oldName.replace(/\u00A0/g, ' ');
|
|
if(jQuery('.serverDts ').css('right')=='0px'){
|
|
var split_old = oldName.split('/');
|
|
oldName = split_old[split_old.length - 1];
|
|
var newPath = jQuery('input.renamePath_txtbox').val();
|
|
newPath = newPath+newName;
|
|
} else {
|
|
var newPath = jQuery('#fullPathBreadCrumb a:last').attr('alt')+newName;
|
|
}
|
|
|
|
if(newName.trim()==''){
|
|
if(jQuery('.serverDts ').css('right')=='0px'){
|
|
showErrorMessages('#searchError',errorNewDirEmpty);
|
|
} else {
|
|
showErrorMessages('.error_msg',errorNewDirEmpty);
|
|
}
|
|
} else if(newName.trim()=='.' || newName.trim()=='..'){
|
|
if(jQuery('.serverDts ').css('right')=='0px'){
|
|
showErrorMessages('#searchError',errorNewDirName);
|
|
} else {
|
|
showErrorMessages('.error_msg',errorNewDirName);
|
|
}
|
|
return false;
|
|
} else if(oldName==newName){
|
|
//checking new length if both lengths are different then display message or nothing
|
|
Menu.RenameCloseBtn();
|
|
Menu.MenuOptionUnSelect();
|
|
} else {
|
|
if(renameAjaxStatus==0){
|
|
renameAjaxStatus=1;
|
|
Menu.ajaxCallForRename(oldName,newName,oldPath,newPath);
|
|
}
|
|
}
|
|
},
|
|
updateRenamedItems : function(oldName,newName,oldPath,newPath){
|
|
actionRequired=2;
|
|
//Ajax call to Update Restore Set files every job
|
|
jQuery.ajax({
|
|
url: 'action.php?action=renameRestoreSetItems&oldPath='+encodeURIComponent(oldPath)+'&newPath='+encodeURIComponent(newPath),
|
|
success: function(outputData){
|
|
if(outputData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
outputDataRes=$.parseJSON(outputData);
|
|
currentBackupLocation = outputDataRes['backupLocation'];
|
|
if(jQuery('.serverDts ').css('right')=='0px'){
|
|
jQuery(".closeWin").trigger("click");
|
|
}
|
|
showErrorMessages('.welcome_message','<b>'+oldName+'</b> has been renamed to <b>'+newName.replace(/\s/g, ' ')+'</b> successfully');
|
|
}
|
|
});
|
|
|
|
if(jQuery('.serverDts ').css('right')!='0px'){
|
|
var renamed = jQuery('.renamedItem td.file_check input');
|
|
renamed.val(newPath);
|
|
var checkFile = renamed.parent('td').siblings('.cont_heading').attr('title',newName);
|
|
if(checkFile.find('a').hasClass('getDirList')){
|
|
checkFile.find('a').attr('alt',newPath+'/');
|
|
checkFile.find('span').html(newName.replace(/\s/g, ' '));
|
|
} else {
|
|
checkFile.find('span').html(newName.replace(/\s/g, ' '));
|
|
}
|
|
}
|
|
|
|
oldPath1 = oldPath.replace(/"/g, '\\"');
|
|
var checkParent = jQuery('#loadRestorePath tr.row_list td input[value="'+oldPath1+'"]').closest('tr');
|
|
var checkRsetoreList = restoreSetArray.indexOf(oldPath); //Added to update restore set while Renaming on option
|
|
if(checkParent.hasClass('chk') || jQuery('.renamedItem').hasClass('chk') || checkRsetoreList>=0){
|
|
var parsedID = encodeFilePath(oldPath);
|
|
var renamededID = encodeFilePath(newPath);
|
|
|
|
var renamedSet = jQuery('#'+parsedID+' td.file_check input');
|
|
renamedSet.eq(0).val(newPath);
|
|
renamedSet.parent('td').siblings('.cont_heading').attr('title',newPath).find('span').html(newPath.replace(/\s/g, ' '));
|
|
jQuery('#'+parsedID).attr('id',renamededID);
|
|
var index = restoreSetArray.indexOf(oldPath);
|
|
restoreSetArray[index]=newPath;
|
|
defaultRestoreSetArray[index]=newPath;
|
|
} else if(checkParent.siblings('label').hasClass('label_semi_checked') || jQuery('.renamedItem').find('label').hasClass('label_semi_checked')){
|
|
var matchedItem = array_search(restoreSetArray,oldPath);
|
|
if(matchedItem.length>0){
|
|
var matches = matchedItem.filter(function(str) {
|
|
var parsedID = encodeFilePath(str.slice(0,-1));
|
|
var newPath1 = str.replace(oldPath+'/',newPath+'/');
|
|
newPath1 = newPath1.slice(0,-1);
|
|
var renamededID = encodeFilePath(newPath1);
|
|
|
|
var renamedSet = jQuery('#'+parsedID+' td.file_check input');
|
|
renamedSet.eq(0).val(newPath1);
|
|
renamedSet.parent('td').siblings('.cont_heading').attr('title',newPath1).find('span').html(newPath1.replace(/\s/g, ' '));
|
|
jQuery('#'+parsedID).attr('id',renamededID);
|
|
|
|
var index = restoreSetArray.indexOf(newPath1);
|
|
restoreSetArray[index]=newPath1;
|
|
});
|
|
}
|
|
}
|
|
|
|
for(var key in IDrive.Jobs) {
|
|
var value = IDrive.Jobs[key];
|
|
if(value.job_type=='Restore' && typeof value.selected_files != "undefined" && value.selected_files.length>0){
|
|
var jobIndex = value.selected_files.indexOf(oldPath);
|
|
if(jobIndex>=0){
|
|
value.selected_files[jobIndex]=newPath;
|
|
}
|
|
var matchedSelectedItems = array_search(value.selected_files,oldPath+'/');
|
|
if(matchedSelectedItems.length>0){
|
|
var matches = matchedSelectedItems.filter(function(str) {
|
|
var jobIndex1 = value.selected_files.indexOf(str);
|
|
if(jobIndex1 >= 0){
|
|
var newPath1 = str.replace(oldPath+'/',newPath+'/');
|
|
value.selected_files[jobIndex1]=newPath1;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
for(var key in jobListArray){
|
|
if(key.substr(0, 8)=='Restore_'){
|
|
var value = jobListArray[key];
|
|
var jobIndex = value.indexOf(oldPath);
|
|
if(jobIndex>=0){
|
|
value[jobIndex]=newPath;
|
|
}
|
|
var matchedSelectedItems = array_search(value,oldPath+'/');
|
|
if(matchedSelectedItems.length>0){
|
|
var matches = matchedSelectedItems.filter(function(str) {
|
|
var jobIndex1 = value.indexOf(str);
|
|
if(jobIndex1 >= 0){
|
|
var newPath1 = str.replace(oldPath+'/',newPath+'/');
|
|
value[jobIndex1]=newPath1;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
//To replace in Remote Dir List array
|
|
if(Object.keys(dynamicRemoteArray).length>0){
|
|
var splitPath = oldPath.split('/');
|
|
splitPath.pop();
|
|
var renamedDir = splitPath.join('/');
|
|
renamedDir = renamedDir==''?'/':renamedDir+'/';
|
|
if(!(dynamicRemoteArray[renamedDir]=='' || typeof dynamicRemoteArray[renamedDir]=='undefined' || dynamicRemoteArray[renamedDir]==null)){
|
|
var index = dynamicRemoteArray[renamedDir].indexOf(oldPath);
|
|
dynamicRemoteArray[renamedDir][index]=newPath;
|
|
}
|
|
|
|
for(var key in dynamicRemoteArray){
|
|
if(oldPath==key){
|
|
|
|
dynamicRemoteArray[newPath] = moveToNewArray(oldPath,newPath,dynamicRemoteArray[oldPath]);
|
|
dynamicRemoteType[newPath] = moveToNewArray(oldPath,newPath,dynamicRemoteType[oldPath]);
|
|
dynamicRemoteSize[newPath] = moveToNewArray(oldPath,newPath,dynamicRemoteSize[oldPath]);
|
|
dynamicRemoteDate[newPath] = moveToNewArray(oldPath,newPath,dynamicRemoteDate[oldPath]);
|
|
dynamicRemoteRequestInfo[newPath] = dynamicRemoteRequestInfo[oldPath];
|
|
delete dynamicRemoteArray[oldPath];
|
|
delete dynamicRemoteType[oldPath];
|
|
delete dynamicRemoteSize[oldPath];
|
|
delete dynamicRemoteDate[oldPath];
|
|
delete dynamicRemoteRequestInfo[oldPath];
|
|
}
|
|
|
|
if(key.indexOf(oldPath+'/')==0){
|
|
newKey = key.replace(oldPath+'/',newPath+'/');
|
|
|
|
dynamicRemoteArray[newKey] = moveToNewArray(oldPath+'/',newPath+'/',dynamicRemoteArray[key]);
|
|
dynamicRemoteType[newKey] = moveToNewArray(oldPath+'/',newPath+'/',dynamicRemoteType[key]);
|
|
dynamicRemoteSize[newKey] = moveToNewArray(oldPath+'/',newPath+'/',dynamicRemoteSize[key]);
|
|
dynamicRemoteDate[newKey] = moveToNewArray(oldPath+'/',newPath+'/',dynamicRemoteDate[key]);
|
|
|
|
dynamicRemoteRequestInfo[newKey] = dynamicRemoteRequestInfo[oldPath];
|
|
delete dynamicRemoteArray[key];
|
|
delete dynamicRemoteType[key];
|
|
delete dynamicRemoteSize[key];
|
|
delete dynamicRemoteDate[key];
|
|
delete dynamicRemoteRequestInfo[oldPath];
|
|
}
|
|
}
|
|
}
|
|
jQuery('.rename_Selected').removeClass('renamedItem'); //Remove temp reference class
|
|
jQuery("#fullPathBreadCrumb a:last").trigger("click");
|
|
},
|
|
updateBreadcrumb : function(oldPath,newPath){
|
|
if(clickedDirPath.indexOf(oldPath)>=0){
|
|
var remaining = clickedDirPath.replace(oldPath,'');
|
|
var newPath = newPath+remaining;
|
|
remoteFileBreadcrumb(newPath,'loadRestorePath','fullPathBreadCrumb','restoreFilePath'); //Call breadCrumb function
|
|
}
|
|
},
|
|
enterKeyPressForRename:function(e){
|
|
if (e.keyCode == 13) {
|
|
Menu.initiateRename();
|
|
return false;
|
|
}
|
|
},
|
|
enterKeyPressForNewDir:function(e){
|
|
if (e.keyCode == 13) {
|
|
Menu.initiateCreateDir();
|
|
return false;
|
|
}
|
|
},
|
|
checkSpecialChar:function(e){
|
|
if (e.keyCode == 191) {
|
|
if(jQuery('.serverDts ').css('right')=='0px'){
|
|
showErrorMessages('#searchError','Name should not contain "/" and "?"');
|
|
} else {
|
|
showErrorMessages('.error_msg','Name should not contain "/" and "?"');
|
|
}
|
|
e.preventDefault();
|
|
}
|
|
},
|
|
uncheckingSelectedItems:function(){
|
|
jQuery('#loadRestorePath table input').removeAttr('checked').siblings('label').removeAttr('class').closest('tr').removeClass('chk');
|
|
jQuery('.restoreFilePath td.file_check input').removeAttr('checked').siblings('label').removeAttr('class');
|
|
},
|
|
checkingSelectedItems:function(){
|
|
var selectedRestoreJob = jQuery('#select_restore_job').val();
|
|
checkingSelectedItems=true;
|
|
//if(selectedRestoreJob != 0 && selectedRestoreJob !='undefined'){
|
|
if(selectedRestoreJob !='undefined'){
|
|
if($('.localrestore_page').length > 0) {
|
|
loadExistingJob(selectedRestoreJob, 'localRestore');
|
|
} else if($('.restore_page').length > 0) {
|
|
loadExistingJob(selectedRestoreJob, 'restore');
|
|
IDrive.Scheduler.selectSchedule(selectedRestoreJob, 'Restore');
|
|
} else if($('.localbackup_page').length > 0) {
|
|
loadExistingJob('0', 'localBackup');
|
|
}
|
|
}
|
|
actionRequired=1;
|
|
shareItemArray=[]; //Clearing the array on close
|
|
checkingSelectedItems=false;
|
|
},
|
|
initiateCreateDir:function(){
|
|
var newDirName = jQuery('input.newfolder_txtbox').val();
|
|
var newDirPath = jQuery('#fullPathBreadCrumb a:last').attr('alt');
|
|
|
|
if(newDirName.trim()==''){
|
|
showErrorMessages('.edit_work .error_msg1',errorNewDirEmpty);
|
|
} else if(newDirName.trim()=='.' || newDirName.trim()=='..'){
|
|
showErrorMessages('.edit_work .error_msg1',errorNewDirName);
|
|
} else {
|
|
var findDuplicateDir = jQuery('#loadRestorePath span a.getDirList[alt="'+htmlEntities(newDirPath)+htmlEntities(newDirName)+'/"]').length;
|
|
var findDuplicateDir1 = jQuery('#loadRestorePath input[value="'+htmlEntities(newDirPath)+htmlEntities(newDirName)+'"]').length;
|
|
|
|
if(findDuplicateDir>0 || findDuplicateDir1>0){
|
|
showErrorMessages('.edit_work .error_msg1',errorNewDirExists);
|
|
return false;
|
|
} else {
|
|
var deviceID = '';
|
|
if(dedup==true){
|
|
deviceID = jQuery('select.restoreDropdown-txtbox').val();
|
|
deviceID = "&deviceID="+encodeURIComponent(deviceID);
|
|
}
|
|
jQuery('#page_loader').show();
|
|
//Ajax call to create new directory
|
|
jQuery.ajax({
|
|
url: 'action.php?action=createDir&newDirPath='+encodeURIComponent(newDirPath)+'&newDirName='+encodeURIComponent(newDirName)+deviceID,
|
|
success: function(outputData){
|
|
if(outputData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
jQuery('#page_loader').hide();
|
|
outputDataRes=$.parseJSON(outputData);
|
|
if(outputDataRes[0]==true){
|
|
Menu.updateCreatedDir(outputDataRes[2],newDirName);
|
|
Menu.CreateFolderClose();
|
|
Menu.OptionMenuRemoved();
|
|
showErrorMessages('.welcome_message',outputDataRes[1]);
|
|
newDirPath = newDirPath==''?"/":newDirPath;
|
|
if(dedup==true){
|
|
device_ID = jQuery('select.restoreDropdown-txtbox').val();
|
|
arrayIndex = device_ID+newDirPath;
|
|
}
|
|
else{
|
|
arrayIndex = newDirPath;
|
|
}
|
|
if(typeof dynamicRemoteArray[arrayIndex]!='undefined'){
|
|
dynamicRemoteArray[arrayIndex].push(newDirPath+newDirName);
|
|
dynamicRemoteType[arrayIndex].push("folder");
|
|
dynamicRemoteSize[arrayIndex].push("--");
|
|
dynamicRemoteDate[arrayIndex].push(outputDataRes[2]);
|
|
}
|
|
$(".restore_page #fullPathBreadCrumb :last-child").trigger('click');
|
|
} else {
|
|
showErrorMessages('.edit_work .error_msg1',outputDataRes[1]);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
},
|
|
updateCreatedDir:function(date,newDirName){
|
|
var currDirPath = jQuery('#fullPathBreadCrumb a:last').attr('alt');
|
|
var newDirPath = currDirPath+newDirName;
|
|
var CreatedFolder = '<tr><td class="file_check">\
|
|
<input type="checkbox" value="'+htmlEntities(newDirPath)+'" name="chk_elements[]" id="chk_elements[]">\
|
|
<label>folder</label> </td>\
|
|
<td title="'+htmlEntities(newDirName)+'" class="cont_heading"><img src="include/images/idq_ico_folder.png">\
|
|
<span><a alt="'+htmlEntities(newDirPath)+'/" href="javascript:void(0);" class="getDirList">'+htmlEntities(newDirName).replace(/[\s]/g,' ')+'</a></span>\
|
|
</td>\
|
|
<td class="file_size">--</td>\
|
|
<td class="file_date">'+date+'</td>\
|
|
<td class="file_menu_list"></td></tr>';
|
|
$(ActionTable).prepend(CreatedFolder);
|
|
if(typeof restoreSetArray[currDirPath]!='undefined'){
|
|
restoreSetArray[currDirPath].push(newDirName);
|
|
}
|
|
},
|
|
removeBackupAndRestoreList:function(dirName,type){
|
|
jQuery('#page_loader').show();
|
|
if(actionRequired ==2){
|
|
removeBackupAndRestoreList = true;
|
|
editJob(type);
|
|
} else {
|
|
ajaxCallForRefresh(type,dirName);
|
|
}
|
|
}
|
|
|
|
};// menu
|
|
$(document).ready(Menu.Ready);
|
|
// End tool tips scripts
|
|
|
|
$(document).off('mouseup').on('mouseup', function (e){
|
|
var OutSideClickRename = $(".rename_span");
|
|
var OutSideClickCreate = $(".createfolder_span");
|
|
var closeButton = $(".close_menu img");
|
|
var editShadow = $(".edit_shadow");
|
|
if(editShadow.is(e.target)){
|
|
jQuery('.error_msg,.error_msg1').hide(); // Hide option error messages
|
|
Menu.MenuOptionUnSelect();
|
|
$('.ajax_loader').hide();
|
|
Menu.CreateFolderClose();
|
|
Menu.RenameCloseBtn();
|
|
Menu.checkingSelectedItems(); // Mark already selected items
|
|
}
|
|
if(!closeButton.is(e.target)){
|
|
if (!OutSideClickRename.is(e.target) && OutSideClickRename.has(e.target).length === 0 && OutSideClickRename.closest('tr').hasClass('rename_Selected')) {
|
|
jQuery('.error_msg,.error_msg1').hide(); // Hide option error messages
|
|
Menu.initiateRename();
|
|
}
|
|
else if (!OutSideClickCreate.is(e.target) && OutSideClickCreate.has(e.target).length === 0 && OutSideClickCreate.closest('tr').hasClass('createFolder_selected')) {
|
|
jQuery('.error_msg,.error_msg1').hide(); // Hide option error messages
|
|
Menu.initiateCreateDir();
|
|
}
|
|
}
|
|
if($('.edit_work').is(':visible')){
|
|
var OutSideClick = $(".menu,.restorset_top,.dropdown,.breadcrum_menu");
|
|
if (!OutSideClick.is(e.target) && OutSideClick.has(e.target).length === 0) {
|
|
jQuery('.error_msg,.error_msg1').hide(); // Hide option error messages
|
|
Menu.MenuOptionUnSelect();
|
|
$('.ajax_loader').hide();
|
|
Menu.checkingSelectedItems(); // Mark already selected items
|
|
}
|
|
}
|
|
if($('#dropdown').is(':visible')){
|
|
var OutSideClick = $(".dropdown");
|
|
if (!OutSideClick.is(e.target) && OutSideClick.has(e.target).length === 0) {
|
|
$(DropDownShow).hide();
|
|
$('table tr').removeClass('row_selected');
|
|
}
|
|
}
|
|
});
|
|
function moveToNewArray(oldPath,newPath,oldArray){
|
|
var tempArray = new Array();
|
|
if(!(oldArray === "" && typeof oldArray == "undefined" && oldArray === null)){
|
|
oldArray.filter(function(str) {
|
|
var replaced = str.replace(oldPath,newPath);
|
|
tempArray.push(replaced);
|
|
});
|
|
}
|
|
return tempArray;
|
|
}
|
|
$(window).scroll(function(){
|
|
jQuery('#dropdown').hide();
|
|
});
|
|
function checkSharedFolderPath(splitLoc,urlPath){
|
|
if((machine=="synology" || machine=="netgear" || machine=="twotier") && splitLoc.length<=2){
|
|
return '/';
|
|
} else if(machine=="QNAP" && splitLoc.length<=3){
|
|
return '/';
|
|
}
|
|
return urlPath;
|
|
}
|
|
//Ajax call to remove sharedFolder/remotedirList directory
|
|
function ajaxCallForRefresh(type,dirName){
|
|
var deviceID ='';
|
|
if(type=='restore'){
|
|
if($('input[type=radio][name="restore_type_detail[]"]:checked').val() =='Online Account'){
|
|
deviceID = jQuery('select.restoreDropdown-txtbox').val();
|
|
deviceID ="&deviceID="+encodeURIComponent(deviceID);
|
|
}
|
|
}
|
|
jQuery.ajax({
|
|
url: 'action.php?action=refresh&type='+type+'&dirName='+encodeURIComponent(dirName)+deviceID,
|
|
success: function(outputData){
|
|
if(outputData.indexOf('<html>')>0){
|
|
window.location.href='../index.php';
|
|
}
|
|
jQuery('#page_loader').hide();
|
|
jQuery('#maincheckBackup').next().attr('class', 'maincheck'); //Uncheck the Main Checkbox
|
|
if(type=='backup' || type=='localBackup') {
|
|
var current_directory = jQuery('#fullPathBreadCrumb a:last').attr('alt');
|
|
localFileBreadcrumb(current_directory,'loadFullPath','fullPathBreadCrumb','backupFilePath'); //Call breadCrumb function
|
|
var jobName = $("#select_job").val();
|
|
delete jobListArray[jobName];
|
|
delete jobListTypeArray[jobName];
|
|
delete jobListSizeArray[jobName];
|
|
delete jobListLMTimeArray[jobName];
|
|
if(type=='localBackup') {
|
|
jQuery('#nav_express').trigger('click');
|
|
} else {
|
|
loadExistingJob(jobName,type);
|
|
}
|
|
} else if(type == 'restore' && dirName == '/') {
|
|
var restoreType = jQuery('#sourcePath').val();
|
|
if(restoreType == 'Online Account') {
|
|
loadExistingJob('', 'restore', null, '');
|
|
} else {
|
|
loadExistingJob('', 'localRestore');
|
|
}
|
|
|
|
}
|
|
}
|
|
});
|
|
}
|
|
jQuery(document).on('click', '.trash-wrap a.getTrashDirList', function(e) {
|
|
|
|
abortAjax(trashAjaxCall);
|
|
abortAjax(trashAjaxCall2);
|
|
clearTimeout(loadTrashTimout);
|
|
startTrashList(jQuery(this));});
|
|
var lazyLoad = "";
|
|
function startTrashList(obj)
|
|
{
|
|
lazyLoad = 0;
|
|
//alert(obj.attr('alt'));
|
|
//return false;
|
|
|
|
var getDir = obj;
|
|
if(getDir!='/'){
|
|
getDir = obj.attr('alt');
|
|
}
|
|
//jQuery(".trash-wrap .ajax_loader").show();
|
|
|
|
var dirListVal = dynamicTrashArray[getDir];
|
|
var dirListType = dynamicTrashType[getDir];
|
|
var dirListSize = dynamicTrashSize[getDir];
|
|
var dirListDate = dynamicTrashDate[getDir];
|
|
|
|
//if((typeof dynamicTrashStatus[getDir] == "undefined" || dynamicTrashStatus[getDir] === ""))
|
|
if(typeof dynamicTrashStatus[getDir] == "undefined" )
|
|
{
|
|
dynamicTrashStatus[getDir] =new Array();
|
|
}
|
|
|
|
trashFileBreadcrumb(getDir,"loadTrashPath","fullPathBreadCrumb",'restoreFilePath');
|
|
if((typeof dirListVal == "undefined" || dirListVal === ""))
|
|
{
|
|
jQuery(".trash-wrap .ajax_loader").show();
|
|
|
|
values = {"action":"startTrashList","fullPath":getDir};
|
|
trashListStarted = true;
|
|
//AJAX call to start Search
|
|
trashAjaxCall = $.ajax({
|
|
url: "action.php",
|
|
type: "GET",
|
|
data: values,
|
|
success: function(responseData){
|
|
if(responseData.Trashlist)
|
|
{
|
|
cancelledTrashList= true;
|
|
//dynamicTrashStatus[getDir].push({"count":"0","status":"false"});
|
|
dynamicTrashStatus[getDir] = {count:0,status:"false"};
|
|
//getTrashResult('0',encodeURIComponent(getDir));
|
|
getTrashResult('0',htmlEntities(getDir));
|
|
}
|
|
}
|
|
});
|
|
if(cancelledTrashList==false){
|
|
//dynamicTrashStatus[getDir].push({"count":"0","status":"false"});
|
|
dynamicTrashStatus[getDir] = {count:0,status:"false"};
|
|
//loadTrashTimout = setTimeout("getTrashResult('0','"+encodeURIComponent(getDir)+"')",3000); //1000 = 1Sec
|
|
loadTrashTimout = setTimeout("getTrashResult('0','"+htmlEntities(getDir)+"')",3000); //1000 = 1Sec
|
|
}
|
|
}
|
|
else if(dirListVal === null || dirListVal == "")
|
|
{
|
|
jQuery('#loadTrashPath').hide().siblings('.empty_box').show();
|
|
jQuery('#loadTrashPath').find('tbody').html('');
|
|
jQuery('#maincheck,#selectFiles #maincheck').siblings('label').css('visibility','hidden');
|
|
}
|
|
else
|
|
{
|
|
jQuery('#loadTrashPath').show().siblings('.nfiles,.ajax_loader').hide();
|
|
//jQuery(".trash-wrap .ajax_loader").hide();
|
|
|
|
var dirHTML = '';
|
|
for(var j=0; j<dirListVal.length; j++){
|
|
var dirFullPath = dirListVal[j];
|
|
var dirType = dirListType[j];
|
|
var dirSize = dirListSize[j];
|
|
var dirDate = dirListDate[j];
|
|
|
|
var splitPath = dirFullPath.split('/');
|
|
|
|
var dirName = splitPath[splitPath.length-1];
|
|
//dirFullPath = htmlEntities(dirFullPath);
|
|
dirFullPath = dirFullPath;
|
|
//dirName = htmlEntities(dirName);
|
|
dirName = dirName;
|
|
if(dirType=='folder'){
|
|
dirHTML += '<tr class="row_list">';
|
|
dirHTML += '<td class="file_check"><input type="checkbox" name="chk_elements['+j+']" value="'+dirFullPath+'" id="chk_elements['+j+']"> <label>folder</label> </td>';
|
|
dirHTML += '<td class="cont_heading" title="'+dirName+'">';
|
|
dirHTML += '<a class="getTrashDirList" href="javascript:void(0);" alt="'+dirFullPath+'/"><img src="include/images/idq_ico_folder.png"></a>';
|
|
dirHTML += '<a class="getTrashDirList" href="javascript:void(0);" alt="'+dirFullPath+'/"><span>';
|
|
dirHTML += dirName.replace(/[\s]/g,' ');
|
|
dirHTML += '</span></a></td>';
|
|
dirHTML += '<td class="file_size">'+dirSize+'</td><td class="file_date">'+dirDate+'</td>';
|
|
dirHTML += '<td class="file_menu_list"></td>';
|
|
dirHTML += '</tr>';
|
|
} else {
|
|
dirHTML += '<tr class="row_list">';
|
|
dirHTML += '<td class="file_check"><input type="checkbox" name="chk_elements['+j+']" value="'+dirFullPath+'" id="chk_elements['+j+']"> <label>file</label> </td>';
|
|
dirHTML += '<td class="cont_heading" title="'+dirName+'"><img src="include/images/idq_ico_file.png"><span>';
|
|
dirHTML += dirName.replace(/[\s]/g,' ');
|
|
dirHTML += '</span></td>';
|
|
dirHTML += '<td class="file_size">'+dirSize+'</td><td class="file_date">'+dirDate+'</td>';
|
|
dirHTML += '<td class="file_menu_list"></td>';
|
|
dirHTML += '</tr>';
|
|
}
|
|
}
|
|
|
|
var tbodyFind = jQuery('#loadTrashPath').find('tbody');
|
|
if(!tbodyFind.length)
|
|
{
|
|
var html = "";
|
|
|
|
html+='<div class="excludefiles">';
|
|
html+='<table width="100%" border="0" cellspacing="0" cellpadding="0" class="folderBackupContent backupset_table bc_table"><tbody>';
|
|
jQuery('#loadTrashPath').html(html);
|
|
}
|
|
jQuery('#loadTrashPath').show().siblings('.empty_box').hide();
|
|
jQuery('#loadTrashPath').find('tbody').html(dirHTML);
|
|
jQuery('#loadTrashPath .excludefiles').css('overflow','auto');
|
|
markSelectedRestoreItems(getDir,'loadTrashPath','fullPathBreadCrumb',''); //Call function to "Mark" the selected Items
|
|
if(dynamicTrashStatus[getDir].status=="false")
|
|
{
|
|
lazyLoad = 1;
|
|
getTrashResult(dynamicTrashStatus[getDir].count,htmlEntities(getDir),1);
|
|
}
|
|
}
|
|
}
|
|
|
|
function getTrashResult(count,trashDir,recurringRequest){
|
|
//console.log("trashDir : "+trashDir);
|
|
var trash_Dir= trashDir;
|
|
var html='';
|
|
var img,itemSize;
|
|
localDirMore =false;
|
|
abortAjax(trashAjaxCall); // Abort the Trash request
|
|
//AJAX call to get Search Result
|
|
//trashDir = decodeURIComponent(trashDir);
|
|
trashDir = htmlentities_decode(trashDir);
|
|
|
|
html="";
|
|
if(!recurringRequest)
|
|
{
|
|
html+='<div class="excludefiles">';
|
|
html+='<table width="100%" border="0" cellspacing="0" cellpadding="0" class="folderBackupContent backupset_table bc_table"><tbody>';
|
|
}
|
|
//currentDir = jQuery('#fullPathBreadCrumb a:last').attr('alt');
|
|
//console.log("aboce create arr" + dynamicTrashArray[trashDir]);
|
|
//if(dynamicTrashArray[trashDir] == undefined && dynamicTrashType[trashDir] == undefined && dynamicTrashSize[trashDir] == undefined && dynamicTrashDate[trashDir] == undefined)
|
|
if(dynamicTrashArray[trashDir] == undefined )
|
|
{
|
|
dynamicTrashArray[trashDir] = new Array();
|
|
dynamicTrashType[trashDir] = new Array();
|
|
dynamicTrashSize[trashDir] = new Array();
|
|
dynamicTrashDate[trashDir] = new Array();
|
|
}
|
|
path = "";
|
|
|
|
if(lazyLoad) path = trashDir;
|
|
trashAjaxCall2 = $.ajax({
|
|
url: "action.php?action=getTrashRes&count="+count+"&path="+path,
|
|
|
|
success: function(locationData){
|
|
|
|
//dynamicTrashStatus[trashDir] = {count:count,status:"true"};
|
|
searchRes = $.parseJSON(locationData);
|
|
if(searchRes[0]==true || searchRes[0]==1){
|
|
|
|
$.each(searchRes[2], function(i,res){
|
|
|
|
type = res.type=='F'?'file':'folder';
|
|
itemSize = res.type=='F'?res.size:'--';
|
|
//fullPathHTML = htmlEntities(currentDir+res.name);
|
|
//console.log("res.name "+res.name);
|
|
fullPathHTML = htmlEntities(trashDir+res.name);
|
|
dirNameHTML = htmlEntities(res.name);
|
|
|
|
dynamicTrashArray[trashDir].push(fullPathHTML);
|
|
dynamicTrashType[trashDir].push(type);
|
|
dynamicTrashSize[trashDir].push(itemSize);
|
|
dynamicTrashDate[trashDir].push(res.date);
|
|
|
|
|
|
if(res.type=='D')
|
|
{
|
|
html+= '<tr class="row_list">';
|
|
html+= '<td class="file_check">';
|
|
html+= '<input type="checkbox" id="chk_elements['+i+']" name="chk_elements['+i+']" value="'+fullPathHTML+'">';
|
|
html+= '<label >folder</label> </td>';
|
|
html+= '<td class="cont_heading" title="'+dirNameHTML+'">';
|
|
html+= '<a class="getTrashDirList" href="javascript:void(0);" alt="'+fullPathHTML+'/"><img src="include/images/idq_ico_folder.png"></a>';
|
|
html+= '<a class="getTrashDirList" href="javascript:void(0);" alt="'+fullPathHTML+'/"><span>'+dirNameHTML+'</span></a></td>';
|
|
html+= '<td class="file_size">'+itemSize+'</td><td class="file_date">'+res.date+'</td>';
|
|
html+= '<td class="file_menu_list"></td></tr>';
|
|
|
|
}
|
|
else
|
|
{
|
|
html+= '<tr class="row_list">';
|
|
html+= '<td class="file_check">';
|
|
html+= '<input type="checkbox" id="chk_elements['+i+']" name="chk_elements['+i+']" value="'+fullPathHTML+'">';
|
|
html+= '<label >file</label> </td>';
|
|
html+= '<td class="cont_heading" title="'+dirNameHTML+'"><img src="include/images/idq_ico_file.png">';
|
|
html+= '<span>'+dirNameHTML+'</span></td>';
|
|
html+= '<td class="file_size">'+itemSize+'</td><td class="file_date">'+res.date+'</td>';
|
|
html+= '<td class="file_menu_list"></td></tr>';
|
|
|
|
}
|
|
|
|
|
|
});
|
|
html += '<tr class="search_loading"><td colspan="4"> </td></tr>';
|
|
jQuery('#loadTrashPath .backupset_table tr.search_loading').remove();
|
|
jQuery('#loadTrashPath').show().siblings('.empty_box').hide();
|
|
|
|
//html+= "</tbody></table></div>";
|
|
//$("#loadTrashPath").removeAttr("style");
|
|
if(recurringRequest)$("#loadTrashPath .excludefiles tbody").append(html);
|
|
else $("#loadTrashPath").html(html);
|
|
jQuery(".trash-wrap .ajax_loader").hide();
|
|
jQuery('#loadTrashPath .backupset_table tr.search_loading').show();
|
|
dynamicTrashStatus[trashDir] = {count:searchRes[1],status:"false"};
|
|
loadTrashTimout = setTimeout("getTrashResult('"+searchRes[1]+"','"+trash_Dir+"',1)",1000); //1000 = 1Sec
|
|
|
|
|
|
|
|
}
|
|
else if((searchRes[0]==0 && searchRes[1]==1)) {
|
|
dynamicTrashStatus[trashDir] = {count:searchRes[3],status:"false"};
|
|
loadTrashTimout = setTimeout("getTrashResult('"+searchRes[3]+"','"+trash_Dir+"',1)",1000); //1000 = 1Sec
|
|
}
|
|
else {
|
|
|
|
dynamicTrashStatus[trashDir] = {count:count,status:"true"};
|
|
|
|
jQuery(".trash-wrap .ajax_loader").hide();
|
|
|
|
jQuery('#loadTrashPath .backupset_table tr.search_loading').remove();
|
|
$("#loadTrashPath").append("</tbody></table></div>");
|
|
if(!recurringRequest)
|
|
{
|
|
dynamicTrashArray[trashDir]= [];
|
|
dynamicTrashType[trashDir] = [];
|
|
dynamicTrashSize[trashDir] = [];
|
|
dynamicTrashDate[trashDir] = [];
|
|
//jQuery('#loadTrashPath').hide().siblings('.nfiles').show();
|
|
$("#loadTrashPath").removeAttr("style");
|
|
jQuery('#loadTrashPath').hide().siblings('.empty_box').show();
|
|
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
function trashFileBreadcrumb(getDir,toPlace,breadcrum,maincheck){
|
|
|
|
var splitDir = getDir.split('/');
|
|
|
|
var breadCrumb = '<a href="javascript:void(0);" alt="/" title="/" class="getTrashDirList home">Home</a>';
|
|
var currDir = "";
|
|
splitDir = splitDir.filter(function(val) {
|
|
if(!(val === "" || typeof val == "undefined" || val === null)){
|
|
currDir += htmlEntities(val)+'/';
|
|
breadCrumb += '<a href="javascript:void(0);" alt="/'+currDir+'" title="/'+currDir+'" class="getTrashDirList">'+val+'</a>';
|
|
}
|
|
});
|
|
|
|
jQuery('#'+breadcrum).html(breadCrumb);
|
|
if(maincheck !=''){
|
|
jQuery('.'+maincheck+' .header_part .file_check label').removeAttr('class');
|
|
}
|
|
responsiveBreadcrumb('#'+breadcrum,'getTrashDirList');
|
|
}
|
|
|
|
|
|
|
|
function setCookie(cname, cvalue, exdays) {
|
|
var d = new Date();
|
|
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
|
var expires = "expires="+ d.toUTCString();
|
|
document.cookie = cname + "=" + cvalue + "; " + expires;
|
|
}
|
|
|
|
function getCookie(cname) {
|
|
var name = cname + "=";
|
|
var ca = document.cookie.split(';');
|
|
for(var i = 0; i <ca.length; i++) {
|
|
var c = ca[i];
|
|
while (c.charAt(0)==' ') {
|
|
c = c.substring(1);
|
|
}
|
|
if (c.indexOf(name) == 0) {
|
|
return c.substring(name.length,c.length);
|
|
}
|
|
}
|
|
return "";
|
|
}
|