Files

983 lines
44 KiB
PHP
Executable File

<?php
include_once 'path.php';
if(!isset($_SESSION['validUser']) || $_SESSION['validUser'] !== true)
exit(header("Location:../index.php"));
if(file_exists($drlFile))
$restorePathName = file_get_contents($drlFile);
else
{
$drlPath = Scheduler::$user_dir."RESTORE_DATA";
file_put_contents($drlFile,$drlPath);
@chmod($drlFile, $permissionVal);
$restorePathName = $drlPath;
}
$isVersionRestore = 'false';
$jobs = Scheduler::ReadJobs();
/* Checking whether any Manual Restore Task is running or not*/
$startPidfilePath = Scheduler::$restore_dir.Scheduler::$manual_dir."/".START_PID;
$userCancelPath = Scheduler::$restore_dir.Scheduler::$manual_dir."/".CANCEL_PATH;
$localStartPidfilePath = Scheduler::$localrestore_dir.Scheduler::$manual_dir."/".START_PID;
$localUserCancelPath = Scheduler::$localrestore_dir.Scheduler::$manual_dir."/".CANCEL_PATH;
$cancellingRestoreJob=false;
$currentRestoreJob=0;
$versionInfo = array();
if(file_exists($startPidfilePath)){
if(file_exists($userCancelPath)){
$currentRestoreJob = 0;
$cancellingRestoreJob=true;
} else {
$currentRestoreJob = 0;
}
$versionInfoUnSerialized = file_get_contents($startPidfilePath);
$versionInfoUnSerialized = unserialize($versionInfoUnSerialized);
if(is_array($versionInfoUnSerialized) && (count($versionInfoUnSerialized) > 0))
$versionInfo = $versionInfoUnSerialized;
} else
$currentRestoreJob = '';
$_SESSION['currentRestoreJob']=$currentRestoreJob;
$currentLocalRestoreJob = 0;
$cancellingLocalRestoreJob = false;
if(file_exists($localStartPidfilePath)) {
if(file_exists($localUserCancelPath)){
$currentLocalRestoreJob = 0;
$cancellingLocalRestoreJob = true;
} else {
$currentLocalRestoreJob = 0;
}
} else {
$currentLocalRestoreJob = '';
}
$_SESSION['currentLocalRestoreJob'] = $currentLocalRestoreJob;
$reIndexRunning = FALSE;
if(file_exists("{$reIndexDirPath}/{$pidPath}")) {
$reIndexRunning = TRUE;
}
?>
<div id="rgt" class="serverDts " style="height: 591px; right: -800px;">
<span class="closeIcon"> <img class="right closeWin" src="include/images/popup_close_btn.png"></span>
<h4>Search</h4>
<div class="search_box">
<!-- <form onsubmit="return false;" name="search_box_inpt"> -->
<input type="text" placeholder="Search file/folder" title="Search" value="" class="search_box_inpt search_input">
<div style="display: none;" class="head_srch_item"> <span>Contacts</span> </div>
<input type="submit" class="search_box_btn" id="remoteSearch" value="Search">
<span style="display:block;" class="disabled_search_btn">Search</span>
<section class="locationWrapper">
<div class="locationMain"><span>Location</span>:&nbsp;<span id="location_selected">/</span></div
</section>
<!-- </form> -->
</div>
<div class="clear"></div>
<div id="searchError" class="common_msg">
<p>Please enter the keyword</p>
<a class="close_info" href="javascript:void(0)">
<img width="16" height="16" src="include/images/close.png" alt="close" title="Close">
</a>
</div>
<div id="searchSuccess" class="common_msg success_message" >
<p>Successfully shared</p>
<a href="#" class="close_info">
<img width="16" height="16" title="Close" alt="close" src="include/images/close.png">
</a>
</div>
<div class="clear"></div>
<div class="currentLoad">
<!--<div style="display: none;" id="lazyLoadingImg" class="pageLoaderbtm"></div> -->
<!-- <div class="center popLoader"><img src="include/images/loader_small.gif"></div>-->
<section class="menu">
<div class="left_menu">
<ul class="menu_ul" style="float: left;">
<?php if($_SESSION['encType']=='Default'){ ?>
<li class="shr_li"><a data-tooltip="Share" href="javascript:void(0);" class="menu_share">Share</a></li>
<?php } ?>
<!-- commented by anil to hide delete functionality <li class="dlt_li"><a data-tooltip="Delete" href="javascript:void(0);" class="menu_delete">Delete</a></li>-->
<!-- <li class="rename_li" ><a class="menu_rename" href="javascript:void(0);" data-tooltip="Rename" alt="">Rename</a></li> -->
<!-- <li class="dlt_li"><a data-tooltip="Delete" href="javascript:void(0);" class="menu_delete">Delete</a></li>
<li class="dtls_li"><a data-tooltip="Details" href="javascript:void(0);" class="menu_details">Details</a></li> -->
</ul>
</div>
<div id="rightMenu" class="right_menu">
<!-- <div class="search_menu"><img src="include/images/search_icon.png">Search</div> -->
<div id="addToRestoreSet" class="addbckupset"><a href="javascript:void(0);" class="restr_img">Add to restore set</a></div>
<!-- <div>
<input name="Submit" type="submit" class="bckp_btn" value="Add to backup set" tabindex="4">
</div> -->
</div>
</section>
<div class="exclude ">
<!-- <div class="excludeContainer searchSection restoreFilePath"> -->
<div class="excludeContainer searchSection">
<div class="tab_loader"><p>loader...</p></div>
<div style="border:none" class="selected_bdr">
<table id="remoteDirSearchHeader" cellspacing="0" cellpadding="0" border="0" width="100%" class="folderBackupContent restore-popup-wrap">
<tbody>
<tr class="excludeheader header_part ">
<td class="file_check search-chk-box">&nbsp;&nbsp;&nbsp;&nbsp;
<?php if($machine=='twotier' || $machine==SYNOLOGY_LOCAL) { ?>
<!--<input type="checkbox" class="checkcontrol" id="mainchek">
<label class="" >All</label> -->
<?php } ?>
</td>
<td class="search-file-name">File / Folder name</td>
<td class="search-file-size">Size</td>
<td class="search-file-date">Date modified</td>
<td class="search-menu-icon">&nbsp;</td>
</tr>
</tbody>
</table>
<div class="ajax_loader"></div>
<div class="nfiles"> <b>No Results</b> </div>
<div id="remoteDirSearchList" style="overflow: auto;" class="excludefiles">
<table cellspacing="0" cellpadding="0" border="0" width="100%" class="folderBackupContent restr selectedFiles_tab backupset_table bc_table">
<tbody>
<!-- Search Result will be here -->
</tbody>
</table>
</div>
</div>
<!-- selected_bdr -->
</div>
</div>
</div>
</div>
<?php
$lcoalcss = '';
if($currentLocalRestoreJob === 0) {
$lcoalcss = ' localrestore_page';
}
?>
<div class="container body_wrap restore_page<?php echo $lcoalcss;?>">
<div class="ajax_loader"><p>loader...</p></div>
<section class="breadcrum_menu menu_wrap">
<div class="breadcrumb" id="fullPathBreadCrumb"><a href="javascript:void(0);" alt="/" class="getDirList home">Home</a></div>
<div class="menu_refresh_icon" title="Refresh your restore list">Refresh</div>
</section>
<!-- <section class="menu">
<div id="fullPathBreadCrumb" class="breadcrumb"><a href="javascript:void(0);" alt="/" class="getDirList">/</a></div>
<div class="backupset"><img src="include/images/idq_ico_add.png" >Create new Restore set</div>
</section> -->
<section class="menu backup_menu">
<div class="option_heading">
<div class="right_w">
</div>
</div>
<div class="msg_option">
<div class="option_msg">
<div class="heading_option">Options</div>
<div class="close_menu"><img src="include/images/popup_close_btn.png"></div>
</div>
<div class="common_msg error_msg1" style="display:none;">
<p id="errorMsg">Select file(s)/folder(s) to share</p>
<a class="close_info" href="javascript:void(0)"><img width="16" height="16" src="include/images/close.png" alt="close" title="Close"></a>
</div>
</div>
<div class="left_menu <?php if($_SESSION['dedup']) print "dedup_left_menu"; ?>">
<?php
$optionClass = "option_menu";
$optionIcon = "option_menu.png";
if($_SESSION['dedup'] && $_SESSION['encType']=='Private'){
$optionClass = "option_menu_disable";
$optionIcon = "option_menu_grey.png";
}
?>
<div class="<?php print $optionClass; ?>" style="<?php echo (($optionClass == 'option_menu')? 'display: block;' : '');?>"> <img src="include/images/<?php print $optionIcon; ?>">Options</div>
<ul class="menu_ul">
<?php
if(!$_SESSION['dedup']){
print '<li style="display:none" class="newfolder_li"><a alt="New Folder" title="New Folder" data-tooltip="New Folder" href="javascript:void(0);" class="menu_newfolder">New Folder</a></li>';
}
if($_SESSION['encType'] == 'Default') {
print '<li style="display:none" class="share_li"><a alt="Share" title="Share" data-tooltip="Share" href="javascript:void(0);" class="menu_share">Share</a></li>';
}
?>
<!-- <li style="display:none" class="delete_li"><a alt="" data-tooltip="Delete" href="javascript:void(0);" class="menu_delete" title="Delete">Delete</a></li> -->
</ul>
<?php
if($machine == 'twotier' || $machine==SYNOLOGY_LOCAL || $machine == QNAP || $machine == NETGEAR_LOCAL || $machine == ASUSTOR) {
$diplayDropDown = '';
if(!$_SESSION['dedup'])
$diplayDropDown = 'style="display:none;"';
echo '<div class="restore-dropdown" '.$diplayDropDown.'>';
echo '<label>Select files/folders for restore:</label> ';
echo "<select class='restoreDropdown-txtbox' name='localBackupHost' id='localBackupHost' onchange='checkAndSelectRestorePath(this.value,true)' title='".Scheduler::GetHost($userName)." (this NAS)'>";
$LocalBackupPath = getLocalBackupLocationHTML();
echo "</select></div>";
}
else if($_SESSION['dedup']) {
echo '<div class="restore-dropdown">';
echo '<select class="restoreDropdown-txtbox" name="localBackupHost" onchange="checkAndSelectRestorePath(this.value,true)" title="'.Scheduler::GetHost($userName).'(this NAS)">';
$LocalBackupPath = getLocalBackupLocationHTML();
echo '</select></div>';
}
?>
</div>
<?php
$user_bkpst = '';
$user_search = '';
if($_SESSION['dedup']){
$user_bkpst = 'user-bkpst';
$user_search = 'user-search';
}
?>
<div class="right_menu <?php if($_SESSION['dedup']) print "dedup_right_menu"; ?>">
<!--<div class="backupset <?php //print $user_bkpst; ?>" style="<?php //echo (($currentLocalRestoreJob === 0)? 'display:none;' : ''); ?>"><img src="include/images/idq_ico_add.png">Create new Restore set</div>-->
<?php //}?>
<div title="Search" class="search_menu <?php print $user_search;?>"><img src="include/images/search_icon.png">Search</div>
<!-- Commented by anil for now <a href="trash.php" title="Trash" class="restore_trash_menu" alt="Trash"><span>Trash</span>Trash</a> -->
<?php if($machine == 'twotier' || $machine == SYNOLOGY_LOCAL || $machine == QNAP || $machine == NETGEAR_LOCAL || $machine == ASUSTOR) { ?>
<a class="reindex_menu" title="Re-index file(s)/folder(s)" style="<?php echo (($currentLocalRestoreJob === 0 || $currentLocalRestoreJob == '')? 'display:block;' : ''); ?>"><span class="reindex-icon">.</span>Re-index</a>
<?php } ?>
</div>
</section>
<section class="select-dropdown">
<div class="restore-acc">
<input type="radio" class="radio-restore" id="restore-online" name="restore_type_detail[]" value="Online Account" <?php echo (($cancellingLocalRestoreJob !== true && ($currentLocalRestoreJob !== 0 || $currentLocalRestoreJob == '') && !$reIndexRunning)? 'checked' : '');?> />
<label class="rest-txt" for="restore-online"> Restore files from my IDrive account </label>
</div>
<div class="restore-acc">
<input type="radio" class="radio-restore" id="restore-local" name="restore_type_detail[]" value="<?php echo trim($LocalBackupPath); ?>" <?php echo (($cancellingLocalRestoreJob === true || ($currentLocalRestoreJob === 0 || $currentLocalRestoreJob == '') || $reIndexRunning)? 'checked' : '');?> />
<label class="rest-txt" for="restore-local">Restore files from my local device</label>
</div>
<div class="clear"></div>
</section>
<div class="exclude restorset_top restorset_new">
<div class="excludeContainer restoreFilePath">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr class="excludeheader header_part ">
<td class="file_check">
<input type="checkbox" id="maincheck" class="checkcontrol">
<label class="mainCheck">All</label>
</td>
<td class="fname cont_heading">File/Folder name</td>
<td class="file_size">Size</td>
<td class="file_date">Date modified</td>
<td class="file_menu_list_head"></td>
</tr>
</table>
<div class="nfiles"><?php print NO_FILES;?></div>
<div class="ajax_loader"><p>loader...</p></div>
<div id="loadRestorePath">
<div class="excludefiles">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="folderBackupContent backupset_table bc_table">
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="exclude restoreSetSelected clear_margin restore_set">
<div class="excludeContainer">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="main_chk_table1 restore_cnt">
<tr class="excludeheader backupsetTitle ">
<td class="topHeading" width="40%">
<?php
if($machine!='twotier'){
print '<input type="hidden" id="select_restore_job" name="select_restore_job" value="0">';
print "Contents of Restore Set";
} else {
if($machine!='twotier'){
print '<span style="display:none"><input type="hidden" class="usb-account" id="select_restore_job_usb" name="select_restore_job" value="0">';
print "Contents of Restore Set</span>";
}
?>
<span>Restore Set Name:
<select class="backupsetInput online-account" id="select_restore_job" name="select_restore_job">
<option value="0" selected="selected">Select Restore Set</option>
<?php
foreach($jobs as $k=>$job) {
if($job["job_type"] == "Restore") {
$jobName = substr($k,8);
?>
<option value="<?php echo $k;?>"><?php echo $jobName;?></option>
<?php
}
}?>
</select></span>
</td>
<td colspan="" id="RestoreSchedule" class="topHeading scheduleChangeBtn" align="left" width="30%" style="display:none;" ><span class="schedulerSpan"> Restore Schedule:</span> <span class="backuptime"><!--5:30 am Daily &nbsp;<img src="include/images/idq_ico_schedarrow.png" >--></span></td>
<?php
}
?>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="main_chk_table1 version_restore_cnt">
<tr class="excludeheader backupsetTitle ">
<td colspan="2" class="topHeading" width="50%">
<div><span id="folderDetailsName" alt="TEST" title="TEST" style="float:left">TEST </span> <span style="float:left">&nbsp;/&nbsp;</span>
<span class="fldr_path"><span style="float:left">Path:</span><span id="folderDetailsPath" alt="Home" title="Home">Home</span> </span>
</div>
</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="main_chk_table restore_cnt">
<tr class="excludeheader header_part" style="display:none;">
<td class="file_check"> <input type="checkbox" id="maincheckBackup" class="checkcontrol"> <label class="mainCheck">All</label></td>
<td class="fname" width="37%">File/Folder name</td>
<td width="14%">&nbsp;</td>
<td width="25%" class="backupset_chk_delete" id="removeRestoresetFiles" align="right"> <span> Remove </span></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="main_chk_table version_restore_cnt">
<tr class="excludeheader header_part version_restore_cnt">
<td class="ver-no" width="33%">Version</td>
<td width="33%">Size</td>
<td width="33%">Date modified</td>
</tr>
</table>
<div class="nfiles restore_cnt" id="noBackupsetFiles" style="display:block;"><?php print NO_RESTORESET_FILES;?></div>
<div class="ajax_loader"><p>loader...</p></div>
<form id="startRestoreForm" name="startRestoreForm" method="POST">
<input type="hidden" name="jobTypeManualTask" value="Restore" />
<input type="hidden" name="oldJobName" id="oldJobName" value="<?php print $currentRestoreJob!=''?$currentRestoreJob:'0'; ?>" />
<input type="hidden" name="sourcePath" id="sourcePath" value="" />
<div class="excludefiles scheduler_part restore_cnt version_restore_cnt" style="display:none;">
<table id="restoreSetFiles" width="100%" cellspacing="0" cellpadding="0" border="0" class="folderBackupContent restore_cnt">
<!-- backup set Files needs to be added -->
</table>
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="folderBackupContent version_restore_cnt">
<tbody>
<tr>
<td style="display:none;">
<input id="vr_file" type="hidden" name="chk_group[]" value="" style="display:none;">
<input id="vr_file_type" type="hidden" name="itemType[]" value="file">
<input id="vr_file_len" type="hidden" name="chk_length[]" value="0">
<input id="vr_file_ver" type="hidden" name="vrn" value=""/>
<input id="vr_file_size" type="hidden" name="vrs" value=""/>
<input id="vr_file_modifiedon" type="hidden" name="vrm" value=""/>
</td>
<td width="33%"><span id="versioncountno"></span></td>
<td width="32%"><span id="versionfilesize"></span></td>
<td width="39%"><span id="versiondatemodified"></span></td>
</tr>
</tbody>
</table>
</div>
<div class="restorenow_btm">
<div class="restorenow_lft">
<label>Restore location:</label>
<input type="textbox" class="restore_txtbox" readonly="" title="<?php echo htmlentities($restorePathName, ENT_QUOTES); ?>" value="<?php echo htmlentities($restorePathName, ENT_QUOTES); ?>">
<input type="hidden" name="restoreLocation" id="restoreLocation" value="<?php echo htmlentities($restorePathName, ENT_QUOTES); ?>" />
<input type="button" id="file_browse" value="...">
</div>
<div class="restorenow_rgt">
<input type="hidden" id="startManualTaskButton" name="startManualTaskButton" />
<input type="hidden" id="cancelManualTaskButton" name="cancelManualTaskButton" />
<?php
if($cancellingRestoreJob == true) {
$cancellingJob = 'style="display:block;"';
$startJobButton = 'style="display:none;"';
$cancelJobButton = 'style="display:none;"';
} else if($currentRestoreJob === 0 || $currentLocalRestoreJob === 0) {
$cancellingJob = 'style="display:none;"';
$startJobButton = 'style="display:none;"';
$cancelJobButton = 'style="display:block;"';
} else {
$cancellingJob = 'style="display:none;"';
$startJobButton = 'style="display:block;"';
$cancelJobButton = 'style="display:none;"';
}
?>
<!-- <div class="loading_icon" <?php print $cancelLoader; ?>>Loading...</div> -->
<input type="submit" class="scheduleBtn" id="startRestore" name="startRestore" value="Restore Now" onClick="return startManualRestore()" <?php print $startJobButton; ?> />
<div class="stop_restore">
<div class="restore_loading_gray" <?php print $cancellingJob; ?> ></div>
<span class="scheduleBtn" id="cancellingRestore" <?php print $cancellingJob; ?> >Stopping Restore</span>
</div>
<input type="submit" class="scheduleBtn" id="cancelRestore" name="cancelRestore" value="Stop Restore" onClick="return cancelManualRestore()" <?php print $cancelJobButton; ?> />
</div>
</div>
</form>
</div>
<!-- End excludeContainer -->
</div>
<!-- End exclude -->
<script>
<?php if($reIndexRunning) { ?>
restore_radioBtn_chk = "<?php echo trim($LocalBackupPath); ?>";
reIndexStarted = true;
// var reindexMsg = "Reindex is in progress........Please wait";
// jQuery('.head_search .alert').attr('title', reindexMsg).find('p').html(reindexMsg);
// $('.head_search .alert').show();
// $('.reindex_menu').show();
<?php } else { ?>
reIndexStarted = false;
<?php } ?>
<?php printf("var isVersionRestore = %s;\n", $isVersionRestore); ?>
if (isVersionRestore) {
$('.restore_cnt').hide();
$('.version_restore_cnt').show();
$(".excludefiles.restore_cnt table.restore_cnt").find('*').prop('disabled',true);
$(".excludefiles.version_restore_cnt table.version_restore_cnt").find('*').prop('disabled',false);
}
else {
$('.restore_cnt').show();
$('.version_restore_cnt').hide();
$(".excludefiles.restore_cnt table.restore_cnt").find('*').prop('disabled',false);
$(".excludefiles.version_restore_cnt table.version_restore_cnt").find('*').prop('disabled',true);
}
$("input#version_update" ).click(function() {
if (!$('#startRestore').is(':visible')) {
$.popContainerHide();
if ($('#rgt').css('right') == '0px') {
showErrorMessages('#searchError', 'Restore Job is in progress...');
}
else {
showErrorMessages('.error_msg', 'Restore Job is in progress...');
}
return;
}
var versionSelected = $('.version_container .popup_content .details_body li.active');
var filePath = $('.version_container .popup_header #folderDetailsPath').attr('path');
if (versionSelected.length == 1) {
var selectedVersionDetails = [];
selectedVersionDetails['version'] = $.trim(versionSelected.find('#versioncountno').text());
selectedVersionDetails['size'] = $.trim(versionSelected.find('#versionfilesize').text());
selectedVersionDetails['datemodified'] = $.trim(versionSelected.find('#versiondatemodified').text());
$('.restore_cnt').hide();
$('.version_restore_cnt').show();
$(".excludefiles.restore_cnt table.restore_cnt").find('*').prop('disabled',true);
$(".excludefiles.version_restore_cnt table.version_restore_cnt").find('*').prop('disabled',false);
$.popContainerHide();
var showVersionSelected = $('.excludefiles.version_restore_cnt table.version_restore_cnt');
showVersionSelected.find('#vr_file').val(filePath);
showVersionSelected.find('#vr_file_type').val('file');
showVersionSelected.find('#vr_file_ver').val(selectedVersionDetails['version']);
showVersionSelected.find('#vr_file_size').val(selectedVersionDetails['size']);
showVersionSelected.find('#vr_file_modifiedon').val(selectedVersionDetails['datemodified']);
showVersionSelected.find('span#versioncountno').text(selectedVersionDetails['version']);
showVersionSelected.find('span#versionfilesize').text(selectedVersionDetails['size']);
showVersionSelected.find('span#versiondatemodified').text(selectedVersionDetails['datemodified']);
var displayPath = $('.main_chk_table1.version_restore_cnt');
var folderPath = filePath.substring(filePath.lastIndexOf("/") + 1);
folderPath = folderPath.replace(/[\s]/g,'&nbsp;');
displayPath.find('span#folderDetailsName').html(folderPath);
displayPath.find('span#folderDetailsName').attr('alt', filePath.substring(filePath.lastIndexOf("/") + 1))
.attr('title', filePath.substring(filePath.lastIndexOf("/") + 1));
var folderPath = filePath.slice(0, filePath.lastIndexOf('/'));
folderPath = folderPath.replace(/[\s]/g,'&nbsp;');
displayPath.find('span#folderDetailsPath').html('Home' + (folderPath));
displayPath.find('span#folderDetailsPath').attr('alt', 'Home' + (filePath.slice(0, filePath.lastIndexOf('/'))))
.attr('title', 'Home' + (filePath.slice(0, filePath.lastIndexOf('/'))));
$('#startRestoreForm #startRestore').trigger('click');
}
else {
showErrorMessages('.version_error_msg', 'Please select any one version to continue');
}
});
</script>
</div>
<!-- Create new Restore set -->
<div class="popup_container popContent newBkpSet popLeft">
<section class="popup_header">
<h4>Create new Restore set</h4>
<span class="popup_close_btn hide_popup"></span>
</section>
<section class="popup_body">
<div id="popupError1" class="common_msg">
<p>Please select folder/file to restore</p>
<a class="close_info" href="javascript:void(0)">
<img width="16" height="16" src="include/images/close.png" alt="close" title="Close">
</a>
</div>
<div class="setname">Restore Set Name &nbsp; <input type="text" class="backupsetInput" id="newJobName" name="newJobName" maxlength="50" /> </div>
<div class="exclude popup_set_exclude">
<div class="excludeContainer newRestoreSetClass">
<!-- files table -->
<table width="100%" border="0" cellpadding="0" cellspacing="0" height="40">
<tr class="popup_tabs" id="restoreTab">
<td width="30%" class="selected_before active" >Files/Folders for restore </td>
<td width="30%" class="selected_after">Selected files/folders list</td>
<td width="20%" class="selected_empty"></td>
<td width="20%" class="selected_empty"></td>
</tr>
</table>
<div id="selectFiles" class="exclude popup_set_exclude restore_page" style="margin-top:0px">
<div class="excludeContainer">
<div class="selected_bdr">
<div class="breadcrumb" id="bkpBreadCrumb"><a href="javascript:void(0);" alt="/">/</a></div>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="folderBackupContent selectedFiles_tab">
<tr class="excludeheader header_part excludeheader_part">
<td class="file_check"> <input type="checkbox" id="maincheck" class="checkcontrol"> <label class="mainCheck">All</label> </td>
<td class="fname cont_heading">File/Folder name</td>
<td class="file_size">Size</td>
<td class="file_date">Date modified</td>
</tr>
</table>
<div class="ajax_loader"><p>loader...</p></div>
<div class="nfiles"><?php print NO_FILES;?></div>
<div id="newRestoreSet">
<div style="overflow: hidden;" class="excludefiles">
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="folderBackupContent backupset_table" id="excludeFilesPath">
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="selectedFiles" class="exclude popup_set_exclude" style="margin-top:0px; display:none;">
<div class="excludeContainer">
<!-- Selected Folders/Files - Start -->
<div class="selected_bdr" >
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="main_chk_table folderBackupContent" style="display:none;">
<tr class="excludeheader header_part">
<td class="file_check">
<input type="checkbox" id="maincheckSelected" class="checkcontrol">
<label class="mainCheck">All</label>
</td>
<td class="fname" width="37%">File/Folder name</td>
<td width="24%">&nbsp;</td>
<td width="15%" id="removeSelectedFiles1" class="backupset_chk_delete" align="right"> <span style="display: none;">Remove</span></td>
</tr>
</table>
<div class="nfiles"><?php print NO_RESTORESET_FILES;?></div>
<div class="excludefiles selected_items">
<form id="newRestoreSetForm" method="POST"><input type="hidden" name="jobType" value="Restore" />
<table id="selectedRestoreSetFiles" width="100%" cellspacing="0" cellpadding="0" border="0" class="folderBackupContent">
<!-- Folders/Files needs to be added-->
</table>
</form>
</div>
</div>
<!-- Selected Folders/Files -->
</div>
</div>
<!-- End file table -->
</div>
</div>
<div class="clear"></div>
</section>
<section class="popup_footer">
<div class="btncontainer">
<input type="submit" class="addButton" id="schedule_restore" value="Schedule Restore" >
<input type="submit" class="scheduleBtn popup_cancelBtn" value="Cancel" >
</div>
</section>
</div>
<!-- Schedule restore parameters -->
<div id="scheduler_div" class="popup_container qnapschedule_container popLeft" >
<form name="frm_update_schedule" id="frm_update_schedule" method="post" >
<section class="popup_header">
<h4>Schedule restore parameters</h4>
<span class="popup_close_btn hide_popup" title="Close"></span>
</section>
<section class="popup_body">
<div id="popupError" class="common_msg">
<p><?php print INVALID_EMAIL; ?></p>
<a class="close_info" href="javascript:void(0)">
<img width="16" height="16" src="include/images/close.png" alt="close" title="Close">
</a>
</div>
<?php
//Backup Scheduler
$curPage = 'restore';
include('scheduleDiv.php');
?>
</section>
<section class="popup_footer">
<input type="button" id="update_scheduler" name="update_scheduler" class="addButton" value="Update Schedule">
<input type="button" class="scheduleBtn popup_cancelBtn" value="Cancel" >
</section>
</form>
</div>
<!--popup starts Add Folders/Files to your exclude list -->
<div class="popup_container popContent Backuplocation_popup popLeft restore_page">
<section class="popup_header">
<h4>Select your restore location</h4>
<span class="popup_close_btn hide_popup"></span>
</section>
<section class="popup_body">
<div class="common_msg" id="permissionError" style="display: none;">
<p>Error Message Here</p>
<a href="javascript:void(0)" class="close_info">
<img width="16" height="16" title="Close" alt="close" src="include/images/close.png">
</a>
</div>
<!-- files table -->
<div class="exclude popup_set_exclude">
<div class="excludeContainer">
<div id="restoreLocationBreadCrumb" class="breadcrumb"><a href="javascript:void(0);" alt="/" class="getRestoreDirList">/</a></div>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="folderBackupContent">
<tbody>
<tr class="excludeheader header_part ">
<td class="cont_heading" width="100%">File/Folder name</td>
<!-- <td width="15%">Size</td>
<td width="16%">Date modified</td> -->
</tr>
</tbody>
</table>
<div class="ajax_loader"><p>loader...</p></div>
<div class="nfiles"><?php print NO_FILES;?></div>
<div id="loadRestoreLocation">
<?php require_once("restoreLocation.php"); ?>
</div>
</div>
</div>
<!-- End file table -->
<div class="clear"></div>
</section>
<section class="popup_footer">
<div class="btncontainer">
<input type="submit" id="addRestoreLocation" class="scheduleBtn addButton" value=" Ok ">
<input type="submit" class="scheduleBtn popup_cancelBtn" value="Cancel">
</div>
</section>
</div>
<!-- Table row dropdwon -->
<ul id="dropdown" class="dropdown row_dropdown">
<?php if($_SESSION['encType']=='Default'){ print '<li><a class="file_menu_share">Share</a></li>'; } ?>
<!-- Commented by anil for now <li ><a class="file_menu_delete" >Delete</a></li> -->
<?php if(!$_SESSION['dedup']){ print '<li><a class="file_menu_rename">Rename</a></li>'; } ?>
<li><a class="file_menu_version">Version</a></li>
<li><a class="file_menu_refresh refresh_list">Refresh</a></li>
<li><a class="file_menu_details">Details</a></li>
<li><a class="file_menu_search">Search</a></li>
</ul>
<!-- Start Delete Popup -->
<div class="popup_container popup_delete popLeft">
<section class="popup_header">
<h2 class="account_cancel">Delete</h2>
<span class="popup_close_btn hide_popup"></span>
</section>
<section class="popup_content">
<div class="account_cancel_box">
<p id="deleteConfirmationMessage">Do you really want to move <b id="delPopupEllipse"></b> to trash?</p>
</div>
</section>
<section class="popup_footer">
<p class="donot_ask" id="donot_ask_restore_del"><input type="checkbox" id="restore_del_chk" value=""> Do not ask again.</p>
<input type="button" value="Yes" class="scheduleBtn cancelAccount" id="deleteConfirmation">
<input type="button" value="No" class="scheduleBtn cancelAccount" id="cancelDelete">
</section>
</div>
<!-- End Delete Popup -->
<!-- Start Share Popup -->
<div class="share_container popup_container popLeft" >
<!--<form name="myForm_share" method="post">-->
<!-- popup header:-->
<section class="popup_header">
<h2><b>Share</b></h2>
<span class="sharePopup_close_btn" style="visibility: visible;"></span>
<!-- <span class="share_settings_btn" style="visibility: visible;">Settings</span> -->
</section>
<!-- /popup header-->
<!-- popup content: -->
<section class="popup_content share_body">
<div class="common_msg error_msg">
<p id="errorMsg"><?php echo GUEST_USER; ?></p>
<a class="close_info" href="javascript:void(0)"><img width="16" height="16" src="include/images/close.png" alt="close" title="Close"></a>
</div>
<form id="shareForm" name="shareForm" method="POST">
<div class="share_shadow_cont" style="display: block;"></div>
<div class="share_popup_wraper">
<div class="share_popup_divcont">
<!--div class="sharelink_txt">
<input id="shareLinkDisp" name="shareLinkDisp" value="" data-clipboard-text="">
<a href="javascript:void(0)" data-tooltip="Preview Link" class="copylink_btn" title="Preview Link" target="_blank">Copy link</a>
<!-- <input type="hidden" name="sharedFiles" id="sharedFiles" />
<input type="hidden" name="sharedPath" id="sharedPath" />>
<input type="hidden" name="shareType" id="shareType" />
</div-->
</div>
</div>
<div class="share_viewfiles_cont">
<div><span class="share_viewfiles_btn">Files selected to share</span></div>
<ul class="share_viewfiles_body" id="sharefiles_disp">
<!-- Shared files/folders list here -->
</ul>
</div>
<div class="share_column">
<div class="shareviamail_tab">
<div id="share_via_email" class="tab_body">
<div id="alertMessageBox_share" class="red" style="display: none;"></div>
<div class="pop_mainHead"> <span>Share via email</span> </div>
<div class="share_divColumn">
<div>
<div id="sharefields">
<input type="text" name="emailAddress" autocomplete="off" autofocus class="share_email" >
</div>
</div>
<div class="message_column">
<p>Message</p>
<textarea name="mailcontent" cols="" rows=""></textarea>
<input type="button" id="sendShareEmail" value="Send email" class="button submit">
</div>
</div>
</div>
</div>
</div>
</form>
</section>
<!-- /popup content -->
<!-- </form>-->
</div>
<!-- End Share Popup -->
<!-- Start Details Popup -->
<div class="details_container popup_container popLeft">
<section class="popup_header">
<div class="fldr_img"></div>
<h2> <b><span id="folderDetailsName" alt="TEST" title="TEST" class="dirDetailsDirName">TEST</span></b> </h2>
<div class="fldr_path"> Path: <span id="folderDetailsPath" alt="Home" title="Home" class="dirDetailsPathName">Home</span> </div>
<span class="popup_close_btn hide_popup"></span>
</section>
<section class="popup_content">
<ul class="details_body">
<li class="details_head">
<div> <b>Folder size</b> </div>
<div> <b>File count</b> </div>
<div> <b>Modified date</b></div>
</li>
<li>
<div> <span id="folderDetailsSize"></span> </div>
<div> <span id="folderDetailsCount"></span> </div>
<div> <span id="folderDetailsLmd"></span> </div>
</li>
</ul>
</section>
<section class="popup_footer"></section>
</div>
<!-- End Details Popup -->
<!-- Confirmation box for ReIndex - Start -->
<div style="width: 550px;display:none;" class="popup_container popContent reindex_popup popLeft">
<section class="popup_header">
<h4>Re-Index</h4>
<span class="popup_close_btn hide_popup"></span>
</section>
<section class="popup_body">
<p><?php print REINDEX_CONFIRMATION; ?></p>
<div class="clear"></div>
</section>
<section class="popup_footer">
<div class="btncontainer">
<input type="button" value="Ok" class="addButton" id="startReindexButton">
<input type="button" value="Cancel" class="addButton popup_cancelBtn">
</div>
</section>
</div>
<!-- Confirmation box for ReIndex - End -->
<!-- START: Version details Popup -->
<div class="version_container popup_container popLeft" style="display: none;">
<section class="popup_header">
<div class="genr_img"></div>
<h2> <b><span id="folderDetailsName" alt="TEST" title="TEST">TEST</span></b> </h2>
<div class="fldr_path"><span style="float: left;">Path:</span><span id="folderDetailsPath" alt="Home" title="Home">Home</span> </div>
<span class="popup_close_btn hide_popup"></span>
<div style="clear:both;"></div>
<div class="common_msg error_msg version_error_msg" style="display: none;">
<p id="versionErrorMsg">Please select any one version to continue</p>
<a class="close_info" href="javascript:void(0)"><img width="16" height="16" src="include/images/close.png" alt="close" title="Close"></a>
</div>
</section>
<section class="popup_content">
<ul class="details_body">
<li class="details_head">
<div> <b>Version</b> </div>
<div> <b>Size</b> </div>
<div> <b>Date modified</b> </div>
</li>
</ul>
<ul class="details_body version_list">s
</ul>
</section>
<section class="popup_footer">
<div class="btncontainer">
<input type="submit" class="scheduleBtn" id="version_update" value="Restore">
<input type="submit" class="scheduleBtn popup_cancelBtn" value="Cancel">
</div>
</section>
</div>
<!-- End Details Popup -->
<!-- <script src="include/scripts/popupScript.js" type="text/javascript"></script>
<script src="include/js/restore.js" type="text/javascript"> </script> -->
<script type="text/javascript">
/* For Search - Start*/
var divHeight = jQuery("#remoteDirSearchList")[0].scrollHeight;
var localDirMore = true;
onScrollForRemote();
var checkScrolledHeight=0;
/* For Search - End*/
actionRequired=0;
fromSelectedRestorePath = false;
isDedup = false;
/* Checking local backup status for ReIndex - Start */
manualRestoreRunning = manualLocalRestoreRunning = false;
<?php
$restoreDeviceID = "";
if($currentRestoreJob === 0 || $currentLocalRestoreJob === 0) {
//if(($currentRestoreJob == '' || $currentRestoreJob === 0 ) || ($currentLocalRestoreJob === 0 || $currentLocalRestoreJob == '')) {
if($_SESSION['dedup'])
print("isDedup = true;");
else?>
selectedRestoreListPath = sourcePath = 'Online Account';
<?php
if(file_exists($dedupRestoreDeviceID)) {
$restoreDeviceID = file_get_contents($dedupRestoreDeviceID);
$restoreDeviceID = trim($restoreDeviceID);
$_SESSION['selectedRestoreDeviceID'] = $restoreDeviceID;
print("selectedRestoreListPath='$restoreDeviceID';");
}
}
?>
<?php if($_SESSION['dedup']) { ?>
var availableLocalDevices = <?php print_r(json_encode(getAvailableBucketsInDevice())); ?>;
availableLocalDevices.reverse();
<?php } ?>
/* Checking local backup status for ReIndex - End */
jQuery(document).ready(function() {
if($('.radio-restore:checked').length > 0 && $('.radio-restore:checked').val() != 'Online Account') {
$('.option_menu').hide();
}
//Added for right menu issue
var dropdownHTML = jQuery('#dropdown').detach();
dropdownHTML.appendTo("body");
localBackupDropdownList(); // To check radio button & list the dedup device/mounted device list
if(typeof selectedRestoreListPath == 'undefined' || selectedRestoreListPath != '') {
var sourcePath = selectedRestoreListPath;
jQuery('select[name="localBackupHost"]').val(selectedRestoreListPath);
if(selectedRestoreListPath == 'Online Account' || (isDedup && selectedRestoreListPath == <?php echo "'" . $restoreDeviceID . "'"; ?> && <?php echo "'$currentLocalRestoreJob' === ''";?>)) {
jQuery('input[name="jobTypeManualTask"]').val('Restore');
} else {
jQuery('.right_menu').addClass('localRestore');
localBackupDropdownList();
jQuery('input[name="jobTypeManualTask"]').val('LocalRestore');
}
} else {
<?php if($currentLocalRestoreJob === 0) { ?>
selectedRestoreListPath = $('#restore-local').val();
var sourcePath = selectedRestoreListPath;
jQuery('input[name="jobTypeManualTask"]').val('LocalRestore');
<?php } else { ?>
var sourcePath = jQuery('select[name="localBackupHost"]').val();
jQuery('input[name="jobTypeManualTask"]').val('Restore');
<?php } ?>
}
if(typeof sourcePath == 'undefined' || sourcePath == '') {
sourcePath = 'Online Account';
}
jQuery('#sourcePath').val(sourcePath);
<?php if($currentRestoreJob === 0 || $currentLocalRestoreJob === 0) {
?>
<?php if($currentRestoreJob === 0) { ?>
manualRestoreRunning = true;
$('#restore-online').attr('checked', true);
<?php if(!$_SESSION['dedup']) { ?>
selectedRestoreListPath = sourcePath = 'Online Account';
<?php } ?>
<?php } ?>
<?php if($currentLocalRestoreJob === 0) { ?>
manualLocalRestoreRunning = true;
<?php if(!$_SESSION['dedup']) { ?>
selectedRestoreListPath = sourcePath = $('#localBackupHost').find("option:selected").val();
<?php } ?>
$('.reindex_menu, .restore-dropdown').show();
$('#restore-local').attr('checked', true);
jQuery('#sourcePath').val(sourcePath);
jQuery('.right_menu').addClass('localRestore');
localBackupDropdownList();
jQuery('input[name="jobTypeManualTask"]').val('LocalRestore');
<?php } ?>
if(sourcePath == 'Online Account' || (isDedup && selectedRestoreListPath == <?php echo "'" . $restoreDeviceID . "'"; ?> && <?php echo "'$currentLocalRestoreJob' === ''";?>)) {
manualRestoreRunning = true;
loadExistingJob(0,'restore', null, <?php echo json_encode($versionInfo);?>);
} else {
manualLocalRestoreRunning = true;
loadExistingJob(0, 'localRestore');
$('#restore-local').attr('checked', true);
}
watchRestoreStatus();
<?php } else { ?>
//Deleting the element from Local Dir List array after Restore
if(currentRestoreLocation!=''){
var index = dynamicArray[currentRestoreLocation];
if(index!='undefined' || index!=''){
delete dynamicArray[currentRestoreLocation];
delete dynamicType[currentRestoreLocation];
delete IDrive.LocalDirList[currentRestoreLocation];
currentRestoreLocation='';
}
}
if(manualRestoreRunning==true){
manualRestoreRunning=false;
defaultRestoreSetArray = [];
defaultRestoreSetTypeArray = [];
defaultRestoreSetFileInfo = [];
}
if(manualLocalRestoreRunning == true) {
manualLocalRestoreRunning=false;
defaultLocalRestoreSetArray = [];
defaultLocalRestoreSetTypeArray = [];
}
if(sourcePath == 'Online Account' || $('.radio-restore:checked').val() == 'Online Account') {
if(currentRestoreJob!='' && (typeof jobListArray[currentRestoreJob] != 'undefined' || jobListArray[currentRestoreJob]!='')) {
jQuery('#select_restore_job').val(currentRestoreJob);
loadExistingJob(currentRestoreJob,'restore', null, <?php echo json_encode($versionInfo);?>);
IDrive.Scheduler.selectSchedule(currentRestoreJob,'Restore');
actionRequired=1;
} else {
//loadExistingJob('','restore', null, <?php echo json_encode($versionInfo);?>);
// should add netgear and asustor to resolve hickups with restore/local restore options.
if(machine=='twotier' || machine=='synology' || machine == 'QNAP') {
checkAndSelectRestorePath(sourcePath,false);
} else {
loadExistingJob(0,'restore', null, <?php echo json_encode($versionInfo);?>);
}
}
} else {
if(currentLocalRestoreJob!='' && (jobListArray[currentLocalRestoreJob]!='undefined' || jobListArray[currentLocalRestoreJob]!='')) {
jQuery('#select_restore_job').val(currentLocalRestoreJob);
if(dedup == true && typeof availableLocalDevices != "undefined" && availableLocalDevices.length > 0 && $('.localRestore').length > 0) {
previousSelectedDedupBucket=$('#localBackupHost').find("option:selected").attr('idr-bkt');
}
jQuery('.right_menu').addClass('localRestore');
loadExistingJob(currentLocalRestoreJob,'localRestore');
IDrive.Scheduler.selectSchedule(currentLocalRestoreJob,'Restore');
actionRequired=1;
} else {
if(dedup == true && typeof availableLocalDevices != "undefined" && availableLocalDevices.length > 0 && $('.localRestore').length > 0) {
previousSelectedDedupBucket=$('#localBackupHost').find("option:selected").attr('idr-bkt');
}
checkAndSelectRestorePath(sourcePath, false);
}
}
<?php } ?>
});
</script>