Version Description
- Added a new feature of creating a staging site.
- Fixed some bugs in the plugin code.
- Optimized the plugin code.
Download this release
Release Info
Developer | wpvivid |
Plugin | Migration, Backup, Staging – WPvivid |
Version | 0.9.57 |
Comparing to | |
See all releases |
Code changes from version 0.9.56 to 0.9.57
- admin/class-wpvivid-admin.php +40 -3
- admin/partials/wpvivid-admin-display.php +20 -0
- includes/class-wpvivid-interface-mainwp.php +31 -0
- includes/class-wpvivid-setting.php +1 -1
- includes/class-wpvivid-tab-page-container.php +4 -1
- includes/class-wpvivid.php +4 -0
- includes/upload-cleaner/class-wpvivid-uploads-scanner.php +1 -1
- languages/wpvivid-backuprestore-bg_BG.po +13 -13
- languages/wpvivid-backuprestore-it_IT.po +14 -14
- languages/wpvivid-backuprestore.pot +7 -7
- readme.txt +18 -9
- trunk/admin/class-wpvivid-admin.php +1323 -0
- trunk/admin/css/wpvivid-admin-bar.css +3 -0
- trunk/admin/css/wpvivid-admin.css +266 -0
- trunk/admin/css/wpvivid-staging-custom.css +1614 -0
- trunk/admin/index.php +1 -0
- trunk/admin/js/jstree/dist/jstree.js +8605 -0
- trunk/admin/js/jstree/dist/jstree.min.js +6 -0
- trunk/admin/js/jstree/dist/themes/default-dark/32px.png +0 -0
- trunk/admin/js/jstree/dist/themes/default-dark/40px.png +0 -0
- trunk/admin/js/jstree/dist/themes/default-dark/style.css +1146 -0
- trunk/admin/js/jstree/dist/themes/default-dark/style.min.css +1 -0
- trunk/admin/js/jstree/dist/themes/default-dark/throbber.gif +0 -0
- trunk/admin/js/jstree/dist/themes/default/32px.png +0 -0
- trunk/admin/js/jstree/dist/themes/default/40px.png +0 -0
- trunk/admin/js/jstree/dist/themes/default/style.css +1102 -0
- trunk/admin/js/jstree/dist/themes/default/style.min.css +1 -0
- trunk/admin/js/jstree/dist/themes/default/throbber.gif +0 -0
- trunk/admin/js/wpvivid-admin.js +683 -0
- trunk/admin/partials/images/Delete.png +0 -0
- trunk/admin/partials/images/Edit.png +0 -0
- trunk/admin/partials/images/Log.png +0 -0
- trunk/admin/partials/images/Restore.png +0 -0
- trunk/admin/partials/images/add-storages.png +0 -0
- trunk/admin/partials/images/delete-tab.png +0 -0
- trunk/admin/partials/images/download.png +0 -0
- trunk/admin/partials/images/export-import.png +0 -0
- trunk/admin/partials/images/locked.png +0 -0
- trunk/admin/partials/images/staging/Fresh-list.png +0 -0
- trunk/admin/partials/images/staging/Fresh-tab.png +0 -0
- trunk/admin/partials/images/staging/Log.png +0 -0
- trunk/admin/partials/images/staging/backup-migration.png +0 -0
- trunk/admin/partials/images/staging/backups-restore.png +0 -0
- trunk/admin/partials/images/staging/debug.png +0 -0
- trunk/admin/partials/images/staging/delete-tab.png +0 -0
- trunk/admin/partials/images/staging/download.png +0 -0
- trunk/admin/partials/images/staging/living-site.png +0 -0
- trunk/admin/partials/images/staging/logs.png +0 -0
- trunk/admin/partials/images/staging/pro.png +0 -0
- trunk/admin/partials/images/staging/remote-storage.png +0 -0
- trunk/admin/partials/images/staging/role-cap.png +0 -0
- trunk/admin/partials/images/staging/schedule.png +0 -0
- trunk/admin/partials/images/staging/settings.png +0 -0
- trunk/admin/partials/images/staging/staging-site.png +0 -0
- trunk/admin/partials/images/staging/staging.png +0 -0
- trunk/admin/partials/images/staging/storage-pcloud(gray).png +0 -0
- trunk/admin/partials/images/staging/storage-pcloud.png +0 -0
- trunk/admin/partials/images/staging/storage-wasabi(gray).png +0 -0
- trunk/admin/partials/images/staging/storage-wasabi.png +0 -0
- trunk/admin/partials/images/storage-amazon-s3(gray).png +0 -0
- trunk/admin/partials/images/storage-amazon-s3.png +0 -0
- trunk/admin/partials/images/storage-digitalocean(gray).png +0 -0
- trunk/admin/partials/images/storage-digitalocean.png +0 -0
- trunk/admin/partials/images/storage-dropbox(gray).png +0 -0
- trunk/admin/partials/images/storage-dropbox.png +0 -0
- trunk/admin/partials/images/storage-ftp(gray).png +0 -0
- trunk/admin/partials/images/storage-ftp.png +0 -0
- trunk/admin/partials/images/storage-local(gray).png +0 -0
- trunk/admin/partials/images/storage-local.png +0 -0
- trunk/admin/partials/images/storage-microsoft-onedrive(gray).png +0 -0
- trunk/admin/partials/images/storage-microsoft-onedrive.png +0 -0
- trunk/admin/partials/images/storage-sftp(gray).png +0 -0
- trunk/admin/partials/images/storage-sftp.png +0 -0
- trunk/admin/partials/images/stroage-google-drive(gray).png +0 -0
- trunk/admin/partials/images/stroage-google-drive.png +0 -0
- trunk/admin/partials/images/unlocked.png +0 -0
- trunk/admin/partials/wpvivid-admin-display.php +221 -0
- trunk/admin/partials/wpvivid-backup-restore-page-display.php +2551 -0
- trunk/admin/partials/wpvivid-log-read-page-display.php +0 -0
- trunk/admin/partials/wpvivid-logs-page-display.php +0 -0
- trunk/admin/partials/wpvivid-remote-storage-page-display.php +414 -0
- trunk/admin/partials/wpvivid-schedule-page-display.php +203 -0
- trunk/admin/partials/wpvivid-settings-page-display.php +710 -0
- trunk/admin/partials/wpvivid-website-info-page-display.php +35 -0
- trunk/includes/class-wpvivid-additional-db-method.php +255 -0
- trunk/includes/class-wpvivid-backup-database.php +149 -0
- trunk/includes/class-wpvivid-backup-site.php +52 -0
- trunk/includes/class-wpvivid-backup-uploader.php +792 -0
- trunk/includes/class-wpvivid-backup.php +554 -0
admin/class-wpvivid-admin.php
CHANGED
@@ -68,10 +68,19 @@ class WPvivid_Admin {
|
|
68 |
add_action('wpvivid_before_setup_page',array($this,'check_amazons3'));
|
69 |
add_action('wpvivid_before_setup_page',array($this,'init_js_var'));
|
70 |
|
|
|
|
|
71 |
$this->plugin_name = $plugin_name;
|
72 |
$this->version = $version;
|
73 |
}
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
public function get_screen_ids($screen_ids)
|
76 |
{
|
77 |
$screen_ids[]='toplevel_page_'.$this->plugin_name;
|
@@ -629,7 +638,7 @@ class WPvivid_Admin {
|
|
629 |
$page_array['remote_storage'] = array('index' => '4', 'tab_func' => array($this, 'wpvivid_add_tab_remote_storage'), 'page_func' => array($this, 'wpvivid_add_page_remote_storage'));
|
630 |
$page_array['setting'] = array('index' => '5', 'tab_func' => array($this, 'wpvivid_add_tab_setting'), 'page_func' => array($this, 'wpvivid_add_page_setting'));
|
631 |
$page_array['website_info'] = array('index' => '6', 'tab_func' => array($this, 'wpvivid_add_tab_website_info'), 'page_func' => array($this, 'wpvivid_add_page_website_info'));
|
632 |
-
$page_array['log'] = array('index' => '7', 'tab_func' => array($this, '
|
633 |
$page_array['read_log'] = array('index' => '29', 'tab_func' => array($this, 'wpvivid_add_tab_read_log'), 'page_func' => array($this, 'wpvivid_add_page_read_log'));
|
634 |
$page_array['premium'] = array('index' => '10', 'tab_func' => array($this, 'wpvivid_add_tab_premium'), 'page_func' => array($this, 'wpvivid_add_page_premium'));
|
635 |
$hide_mwp_tab_page = get_option('wpvivid_hide_mwp_tab_page_v1', false);
|
@@ -671,7 +680,7 @@ class WPvivid_Admin {
|
|
671 |
|
672 |
public function wpvivid_add_tab_log(){
|
673 |
?>
|
674 |
-
<a href="#" id="wpvivid_tab_log" class="nav-tab
|
675 |
<?php
|
676 |
}
|
677 |
|
@@ -871,6 +880,34 @@ class WPvivid_Admin {
|
|
871 |
<?php
|
872 |
}
|
873 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
874 |
public function wpvivid_add_page_website_info()
|
875 |
{
|
876 |
?>
|
@@ -1032,7 +1069,7 @@ class WPvivid_Admin {
|
|
1032 |
$max_log_diaplay=20;
|
1033 |
$loglist=$wpvivid_plugin->get_log_list_ex();
|
1034 |
?>
|
1035 |
-
<div id="logs-page" class="
|
1036 |
<table class="wp-list-table widefat plugins">
|
1037 |
<thead class="log-head">
|
1038 |
<tr>
|
68 |
add_action('wpvivid_before_setup_page',array($this,'check_amazons3'));
|
69 |
add_action('wpvivid_before_setup_page',array($this,'init_js_var'));
|
70 |
|
71 |
+
add_filter('wpvivid_add_log_tab_page', array($this, 'add_log_tab_page'), 10);
|
72 |
+
|
73 |
$this->plugin_name = $plugin_name;
|
74 |
$this->version = $version;
|
75 |
}
|
76 |
|
77 |
+
public function add_log_tab_page($setting_array)
|
78 |
+
{
|
79 |
+
$setting_array['backup_log_page'] = array('index' => '1', 'tab_func' => array($this, 'wpvivid_add_tab_log'), 'page_func' => array($this, 'wpvivid_add_page_log'));
|
80 |
+
//$setting_array['read_log_page'] = array('index' => '2', 'tab_func' => array($this, 'wpvivid_add_tab_read_log'), 'page_func' => array($this, 'wpvivid_add_page_read_log'));
|
81 |
+
return $setting_array;
|
82 |
+
}
|
83 |
+
|
84 |
public function get_screen_ids($screen_ids)
|
85 |
{
|
86 |
$screen_ids[]='toplevel_page_'.$this->plugin_name;
|
638 |
$page_array['remote_storage'] = array('index' => '4', 'tab_func' => array($this, 'wpvivid_add_tab_remote_storage'), 'page_func' => array($this, 'wpvivid_add_page_remote_storage'));
|
639 |
$page_array['setting'] = array('index' => '5', 'tab_func' => array($this, 'wpvivid_add_tab_setting'), 'page_func' => array($this, 'wpvivid_add_page_setting'));
|
640 |
$page_array['website_info'] = array('index' => '6', 'tab_func' => array($this, 'wpvivid_add_tab_website_info'), 'page_func' => array($this, 'wpvivid_add_page_website_info'));
|
641 |
+
$page_array['log'] = array('index' => '7', 'tab_func' => array($this, 'wpvivid_add_tab_log_ex'), 'page_func' => array($this, 'wpvivid_add_page_log_ex'));
|
642 |
$page_array['read_log'] = array('index' => '29', 'tab_func' => array($this, 'wpvivid_add_tab_read_log'), 'page_func' => array($this, 'wpvivid_add_page_read_log'));
|
643 |
$page_array['premium'] = array('index' => '10', 'tab_func' => array($this, 'wpvivid_add_tab_premium'), 'page_func' => array($this, 'wpvivid_add_page_premium'));
|
644 |
$hide_mwp_tab_page = get_option('wpvivid_hide_mwp_tab_page_v1', false);
|
680 |
|
681 |
public function wpvivid_add_tab_log(){
|
682 |
?>
|
683 |
+
<a href="#" id="wpvivid_tab_log" class="nav-tab log-nav-tab nav-tab-active" onclick="switchlogTabs(event,'logs-page')"><?php _e('Backup Logs', 'wpvivid-backuprestore'); ?></a>
|
684 |
<?php
|
685 |
}
|
686 |
|
880 |
<?php
|
881 |
}
|
882 |
|
883 |
+
public function wpvivid_add_tab_log_ex(){
|
884 |
+
?>
|
885 |
+
<a href="#" id="wpvivid_tab_log_ex" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'logs-page-ex')"><?php _e('Logs', 'wpvivid-backuprestore'); ?></a>
|
886 |
+
<?php
|
887 |
+
}
|
888 |
+
|
889 |
+
public function wpvivid_add_page_log_ex()
|
890 |
+
{
|
891 |
+
?>
|
892 |
+
<div id="logs-page-ex" class="wrap-tab-content wpvivid_tab_log" name="tab-logs" style="display:none;">
|
893 |
+
<div>
|
894 |
+
<h2 class="nav-tab-wrapper" style="padding-bottom:0!important;">
|
895 |
+
<?php
|
896 |
+
$setting_array = array();
|
897 |
+
$setting_array = apply_filters('wpvivid_add_log_tab_page', $setting_array);
|
898 |
+
foreach ($setting_array as $setting_name) {
|
899 |
+
add_action('wpvivid_logpage_add_tab', $setting_name['tab_func'], $setting_name['index']);
|
900 |
+
add_action('wpvivid_logpage_add_page', $setting_name['page_func'], $setting_name['index']);
|
901 |
+
}
|
902 |
+
do_action('wpvivid_logpage_add_tab');
|
903 |
+
?>
|
904 |
+
</h2>
|
905 |
+
<?php do_action('wpvivid_logpage_add_page'); ?>
|
906 |
+
</div>
|
907 |
+
</div>
|
908 |
+
<?php
|
909 |
+
}
|
910 |
+
|
911 |
public function wpvivid_add_page_website_info()
|
912 |
{
|
913 |
?>
|
1069 |
$max_log_diaplay=20;
|
1070 |
$loglist=$wpvivid_plugin->get_log_list_ex();
|
1071 |
?>
|
1072 |
+
<div id="logs-page" class="log-tab-content wpvivid_tab_log" name="tab-logs">
|
1073 |
<table class="wp-list-table widefat plugins">
|
1074 |
<thead class="log-head">
|
1075 |
<tr>
|
admin/partials/wpvivid-admin-display.php
CHANGED
@@ -140,6 +140,26 @@ foreach ($page_array as $page_name){
|
|
140 |
document.getElementById(contentName).style.display = "block";
|
141 |
evt.currentTarget.className += " nav-tab-active";
|
142 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
function switchsettingTabs(evt,contentName) {
|
144 |
// Declare all variables
|
145 |
var i, tabcontent, tablinks;
|
140 |
document.getElementById(contentName).style.display = "block";
|
141 |
evt.currentTarget.className += " nav-tab-active";
|
142 |
}
|
143 |
+
function switchlogTabs(evt,contentName) {
|
144 |
+
// Declare all variables
|
145 |
+
var i, tabcontent, tablinks;
|
146 |
+
|
147 |
+
// Get all elements with class="table-list-content" and hide them
|
148 |
+
tabcontent = document.getElementsByClassName("log-tab-content");
|
149 |
+
for (i = 0; i < tabcontent.length; i++) {
|
150 |
+
tabcontent[i].style.display = "none";
|
151 |
+
}
|
152 |
+
|
153 |
+
// Get all elements with class="table-nav-tab" and remove the class "nav-tab-active"
|
154 |
+
tablinks = document.getElementsByClassName("log-nav-tab");
|
155 |
+
for (i = 0; i < tablinks.length; i++) {
|
156 |
+
tablinks[i].className = tablinks[i].className.replace(" nav-tab-active", "");
|
157 |
+
}
|
158 |
+
|
159 |
+
// Show the current tab, and add an "storage-menu-active" class to the button that opened the tab
|
160 |
+
document.getElementById(contentName).style.display = "block";
|
161 |
+
evt.currentTarget.className += " nav-tab-active";
|
162 |
+
}
|
163 |
function switchsettingTabs(evt,contentName) {
|
164 |
// Declare all variables
|
165 |
var i, tabcontent, tablinks;
|
includes/class-wpvivid-interface-mainwp.php
CHANGED
@@ -20,6 +20,7 @@ class WPvivid_Interface_MainWP
|
|
20 |
add_filter('wpvivid_backup_now_mainwp', array($this, 'wpvivid_backup_now_mainwp'));
|
21 |
add_filter('wpvivid_view_backup_task_log_mainwp', array($this, 'wpvivid_view_backup_task_log_mainwp'));
|
22 |
add_filter('wpvivid_backup_cancel_mainwp', array($this, 'wpvivid_backup_cancel_mainwp'));
|
|
|
23 |
}
|
24 |
|
25 |
public function load_wpvivid_mainwp_side_bar_filter(){
|
@@ -203,6 +204,36 @@ class WPvivid_Interface_MainWP
|
|
203 |
return $ret;
|
204 |
}
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
public function wpvivid_read_last_backup_log_mainwp($data){
|
207 |
$log_file_name = $data['log_file_name'];
|
208 |
global $wpvivid_plugin;
|
20 |
add_filter('wpvivid_backup_now_mainwp', array($this, 'wpvivid_backup_now_mainwp'));
|
21 |
add_filter('wpvivid_view_backup_task_log_mainwp', array($this, 'wpvivid_view_backup_task_log_mainwp'));
|
22 |
add_filter('wpvivid_backup_cancel_mainwp', array($this, 'wpvivid_backup_cancel_mainwp'));
|
23 |
+
add_filter('wpvivid_set_backup_report_addon_mainwp', array($this, 'wpvivid_set_backup_report_addon_mainwp'));
|
24 |
}
|
25 |
|
26 |
public function load_wpvivid_mainwp_side_bar_filter(){
|
204 |
return $ret;
|
205 |
}
|
206 |
|
207 |
+
public function wpvivid_set_backup_report_addon_mainwp($data){
|
208 |
+
$task_id = $data['id'];
|
209 |
+
$option = array();
|
210 |
+
$option[$task_id]['task_id'] = $task_id;
|
211 |
+
$option[$task_id]['backup_time'] = $data['status']['start_time'];
|
212 |
+
if($data['status']['str'] == 'completed'){
|
213 |
+
$option[$task_id]['status'] = 'Succeeded';
|
214 |
+
}
|
215 |
+
elseif($data['status']['str'] == 'error'){
|
216 |
+
$option[$task_id]['status'] = 'Failed, '.$data['status']['error'];
|
217 |
+
}
|
218 |
+
elseif($data['status']['str'] == 'cancel'){
|
219 |
+
$option[$task_id]['status'] = 'Canceled';
|
220 |
+
}
|
221 |
+
else{
|
222 |
+
$option[$task_id]['status'] = 'The last backup message not found.';
|
223 |
+
}
|
224 |
+
|
225 |
+
$backup_reports = get_option('wpvivid_backup_reports', array());
|
226 |
+
if(!empty($backup_reports)){
|
227 |
+
foreach ($option as $key => $value){
|
228 |
+
$backup_reports[$key] = $value;
|
229 |
+
update_option('wpvivid_backup_reports', $backup_reports);
|
230 |
+
}
|
231 |
+
}
|
232 |
+
else{
|
233 |
+
update_option('wpvivid_backup_reports', $option);
|
234 |
+
}
|
235 |
+
}
|
236 |
+
|
237 |
public function wpvivid_read_last_backup_log_mainwp($data){
|
238 |
$log_file_name = $data['log_file_name'];
|
239 |
global $wpvivid_plugin;
|
includes/class-wpvivid-setting.php
CHANGED
@@ -624,6 +624,7 @@ class WPvivid_Setting
|
|
624 |
$data['schedule']=self::get_option('wpvivid_schedule_setting');
|
625 |
$data['remote']['upload']=self::get_option('wpvivid_upload_setting');
|
626 |
$data['remote']['history']=self::get_option('wpvivid_user_history');
|
|
|
627 |
|
628 |
$data['setting_addon'] = $data['setting'];
|
629 |
$data['setting_addon']['wpvivid_staging_options']=array();
|
@@ -631,7 +632,6 @@ class WPvivid_Setting
|
|
631 |
$data['menu_capability']=array();
|
632 |
$data['white_label_setting']=array();
|
633 |
$data['incremental_backup_setting']=array();
|
634 |
-
$data['last_backup_report']=array();
|
635 |
$data['schedule_addon']=array();
|
636 |
$data['time_zone']=false;
|
637 |
$data['is_pro']=false;
|
624 |
$data['schedule']=self::get_option('wpvivid_schedule_setting');
|
625 |
$data['remote']['upload']=self::get_option('wpvivid_upload_setting');
|
626 |
$data['remote']['history']=self::get_option('wpvivid_user_history');
|
627 |
+
$data['last_backup_report'] = get_option('wpvivid_backup_reports');
|
628 |
|
629 |
$data['setting_addon'] = $data['setting'];
|
630 |
$data['setting_addon']['wpvivid_staging_options']=array();
|
632 |
$data['menu_capability']=array();
|
633 |
$data['white_label_setting']=array();
|
634 |
$data['incremental_backup_setting']=array();
|
|
|
635 |
$data['schedule_addon']=array();
|
636 |
$data['time_zone']=false;
|
637 |
$data['is_pro']=false;
|
includes/class-wpvivid-tab-page-container.php
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
3 |
class WPvivid_Tab_Page_Container
|
4 |
{
|
5 |
public $tabs;
|
1 |
<?php
|
2 |
+
if (!defined('WPVIVID_PLUGIN_DIR'))
|
3 |
+
{
|
4 |
+
die;
|
5 |
+
}
|
6 |
class WPvivid_Tab_Page_Container
|
7 |
{
|
8 |
public $tabs;
|
includes/class-wpvivid.php
CHANGED
@@ -59,6 +59,8 @@ class WPvivid {
|
|
59 |
|
60 |
public $interface_mainwp;
|
61 |
|
|
|
|
|
62 |
public function __construct()
|
63 |
{
|
64 |
$this->version = WPVIVID_PLUGIN_VERSION;
|
@@ -198,6 +200,7 @@ class WPvivid {
|
|
198 |
include_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-interface-mainwp.php';
|
199 |
|
200 |
include_once WPVIVID_PLUGIN_DIR . '/includes/upload-cleaner/class-wpvivid-uploads-cleaner.php';
|
|
|
201 |
|
202 |
$this->function_realize=new WPvivid_Function_Realize();
|
203 |
$this->migrate=new WPvivid_Migrate();
|
@@ -206,6 +209,7 @@ class WPvivid {
|
|
206 |
$send_to_site=new WPvivid_Send_to_site();
|
207 |
$export_import = new WPvivid_Export_Import();
|
208 |
$cleaner=new WPvivid_Uploads_Cleaner();
|
|
|
209 |
}
|
210 |
|
211 |
public function init_pclzip_tmp_folder()
|
59 |
|
60 |
public $interface_mainwp;
|
61 |
|
62 |
+
public $staging;
|
63 |
+
|
64 |
public function __construct()
|
65 |
{
|
66 |
$this->version = WPVIVID_PLUGIN_VERSION;
|
200 |
include_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-interface-mainwp.php';
|
201 |
|
202 |
include_once WPVIVID_PLUGIN_DIR . '/includes/upload-cleaner/class-wpvivid-uploads-cleaner.php';
|
203 |
+
include_once WPVIVID_PLUGIN_DIR . '/includes/staging/class-wpvivid-staging.php';
|
204 |
|
205 |
$this->function_realize=new WPvivid_Function_Realize();
|
206 |
$this->migrate=new WPvivid_Migrate();
|
209 |
$send_to_site=new WPvivid_Send_to_site();
|
210 |
$export_import = new WPvivid_Export_Import();
|
211 |
$cleaner=new WPvivid_Uploads_Cleaner();
|
212 |
+
$this->staging=new WPvivid_Staging_Free();
|
213 |
}
|
214 |
|
215 |
public function init_pclzip_tmp_folder()
|
includes/upload-cleaner/class-wpvivid-uploads-scanner.php
CHANGED
@@ -1477,7 +1477,7 @@ class WPvivid_Uploads_Scanner
|
|
1477 |
$ids=implode(",",$selected_list);
|
1478 |
|
1479 |
$table = $wpdb->prefix . "wpvivid_unused_uploads_files";
|
1480 |
-
$sql="SELECT * FROM $table WHERE `id` IN $ids";
|
1481 |
$result=$wpdb->get_results($sql,ARRAY_A);
|
1482 |
if($result)
|
1483 |
{
|
1477 |
$ids=implode(",",$selected_list);
|
1478 |
|
1479 |
$table = $wpdb->prefix . "wpvivid_unused_uploads_files";
|
1480 |
+
$sql="SELECT * FROM $table WHERE `id` IN ($ids)";
|
1481 |
$result=$wpdb->get_results($sql,ARRAY_A);
|
1482 |
if($result)
|
1483 |
{
|
languages/wpvivid-backuprestore-bg_BG.po
CHANGED
@@ -2000,34 +2000,34 @@ msgid "Authentication failed, the format of the client_secrets.json file is inco
|
|
2000 |
msgstr "Неуспешно удостоверяване, форматът на файла client_secrets.json е неправилен. Изтрийте и инсталирайте отново приставката, за да създадете файла."
|
2001 |
|
2002 |
#: includes/customclass/class-wpvivid-google-drive.php:272
|
2003 |
-
msgid "You have authenticated the
|
2004 |
-
msgstr "Вие сте удостоверили профила в
|
2005 |
|
2006 |
#: includes/customclass/class-wpvivid-google-drive.php:292
|
2007 |
-
msgid "
|
2008 |
-
msgstr "
|
2009 |
|
2010 |
#: includes/customclass/class-wpvivid-google-drive.php:304
|
2011 |
-
msgid "Please read <a target=\"_blank\" href=\"https://wpvivid.com/privacy-policy\" style=\"text-decoration: none;\">this privacy policy</a> for use of our
|
2012 |
-
msgstr "Моля, прочетете <a target=\"_blank\" href=\"https://wpvivid.com/privacy-policy\" style=\"text-decoration: none;\">тази декларация</a> за поверителност за използване на приложението ни за упълномощаване
|
2013 |
|
2014 |
#: includes/customclass/class-wpvivid-google-drive.php:307
|
2015 |
#: includes/customclass/class-wpvivid-google-drive.php:435
|
2016 |
-
msgid "Enter Your
|
2017 |
msgstr "Въведете информацията за google Диск"
|
2018 |
|
2019 |
#: includes/customclass/class-wpvivid-google-drive.php:314
|
2020 |
#: includes/customclass/class-wpvivid-google-drive.php:442
|
2021 |
-
msgid "Enter a unique alias: e.g.
|
2022 |
-
msgstr "Въведете уникален псевдоним: например
|
2023 |
|
2024 |
#: includes/customclass/class-wpvivid-google-drive.php:364
|
2025 |
-
msgid "Authenticate with
|
2026 |
-
msgstr "Удостоверяване с
|
2027 |
|
2028 |
#: includes/customclass/class-wpvivid-google-drive.php:369
|
2029 |
-
msgid "Click the button to get
|
2030 |
-
msgstr "Кликнете върху бутона, за да получите удостоверяване от
|
2031 |
|
2032 |
#: includes/customclass/class-wpvivid-one-drive.php:240
|
2033 |
msgid "You have authenticated the Microsoft OneDrive account as your remote storage."
|
2000 |
msgstr "Неуспешно удостоверяване, форматът на файла client_secrets.json е неправилен. Изтрийте и инсталирайте отново приставката, за да създадете файла."
|
2001 |
|
2002 |
#: includes/customclass/class-wpvivid-google-drive.php:272
|
2003 |
+
msgid "You have authenticated the WPvividGoogle Drive account as your remote storage."
|
2004 |
+
msgstr "Вие сте удостоверили профила в WPvividGoogle Диск като вашето отдалечено хранилище."
|
2005 |
|
2006 |
#: includes/customclass/class-wpvivid-google-drive.php:292
|
2007 |
+
msgid "WPvividGoogle Drive"
|
2008 |
+
msgstr "WPvividGoogle Диск"
|
2009 |
|
2010 |
#: includes/customclass/class-wpvivid-google-drive.php:304
|
2011 |
+
msgid "Please read <a target=\"_blank\" href=\"https://wpvivid.com/privacy-policy\" style=\"text-decoration: none;\">this privacy policy</a> for use of our WPvividGoogle Drive authorization app (none of your backup data is sent to us)."
|
2012 |
+
msgstr "Моля, прочетете <a target=\"_blank\" href=\"https://wpvivid.com/privacy-policy\" style=\"text-decoration: none;\">тази декларация</a> за поверителност за използване на приложението ни за упълномощаване WPvividGoogle Диск (нито един от вашите архивни данни не се изпраща до нас)."
|
2013 |
|
2014 |
#: includes/customclass/class-wpvivid-google-drive.php:307
|
2015 |
#: includes/customclass/class-wpvivid-google-drive.php:435
|
2016 |
+
msgid "Enter Your WPvividGoogle Drive Information"
|
2017 |
msgstr "Въведете информацията за google Диск"
|
2018 |
|
2019 |
#: includes/customclass/class-wpvivid-google-drive.php:314
|
2020 |
#: includes/customclass/class-wpvivid-google-drive.php:442
|
2021 |
+
msgid "Enter a unique alias: e.g. WPvividGoogle Drive-001"
|
2022 |
+
msgstr "Въведете уникален псевдоним: например WPvividGoogle Диск-001"
|
2023 |
|
2024 |
#: includes/customclass/class-wpvivid-google-drive.php:364
|
2025 |
+
msgid "Authenticate with WPvividGoogle Drive"
|
2026 |
+
msgstr "Удостоверяване с WPvividGoogle Диск"
|
2027 |
|
2028 |
#: includes/customclass/class-wpvivid-google-drive.php:369
|
2029 |
+
msgid "Click the button to get WPvividGoogle authentication and add it to the storage list below."
|
2030 |
+
msgstr "Кликнете върху бутона, за да получите удостоверяване от WPvividGoogle и да го добавите към списъка за съхранение по-долу."
|
2031 |
|
2032 |
#: includes/customclass/class-wpvivid-one-drive.php:240
|
2033 |
msgid "You have authenticated the Microsoft OneDrive account as your remote storage."
|
languages/wpvivid-backuprestore-it_IT.po
CHANGED
@@ -2000,34 +2000,34 @@ msgid "Authentication failed, the format of the client_secrets.json file is inco
|
|
2000 |
msgstr "Autenticazione non riuscita, il formato del file client_secrets.json non è corretto. Si consiglia di cancellare e re-installare il plugin per ricreare il file."
|
2001 |
|
2002 |
#: includes/customclass/class-wpvivid-google-drive.php:272
|
2003 |
-
msgid "You have authenticated the
|
2004 |
-
msgstr "Hai autenticato l'account
|
2005 |
|
2006 |
#: includes/customclass/class-wpvivid-google-drive.php:292
|
2007 |
-
msgid "
|
2008 |
-
msgstr "
|
2009 |
|
2010 |
#: includes/customclass/class-wpvivid-google-drive.php:304
|
2011 |
-
msgid "Please read <a target=\"_blank\" href=\"https://wpvivid.com/privacy-policy\" style=\"text-decoration: none;\">this privacy policy</a> for use of our
|
2012 |
-
msgstr "Si prega di leggere <a target=\"_blank\" href=\"https://wpvivid.com/privacy-policy\" style=\"text-decoration: none;\">questa informativa sulla privacy</a> per l'utilizzo della nostra applicazione di autorizzazione a
|
2013 |
|
2014 |
#: includes/customclass/class-wpvivid-google-drive.php:307
|
2015 |
#: includes/customclass/class-wpvivid-google-drive.php:435
|
2016 |
-
msgid "Enter Your
|
2017 |
-
msgstr "Inserisci le informazioni del tuo account
|
2018 |
|
2019 |
#: includes/customclass/class-wpvivid-google-drive.php:314
|
2020 |
#: includes/customclass/class-wpvivid-google-drive.php:442
|
2021 |
-
msgid "Enter a unique alias: e.g.
|
2022 |
-
msgstr "Inserisci un alias univoco: ad esempio
|
2023 |
|
2024 |
#: includes/customclass/class-wpvivid-google-drive.php:364
|
2025 |
-
msgid "Authenticate with
|
2026 |
-
msgstr "Autenticati con
|
2027 |
|
2028 |
#: includes/customclass/class-wpvivid-google-drive.php:369
|
2029 |
-
msgid "Click the button to get
|
2030 |
-
msgstr "Clicca il pulsante per ottenere il codice di autenticazione di
|
2031 |
|
2032 |
#: includes/customclass/class-wpvivid-one-drive.php:240
|
2033 |
msgid "You have authenticated the Microsoft OneDrive account as your remote storage."
|
2000 |
msgstr "Autenticazione non riuscita, il formato del file client_secrets.json non è corretto. Si consiglia di cancellare e re-installare il plugin per ricreare il file."
|
2001 |
|
2002 |
#: includes/customclass/class-wpvivid-google-drive.php:272
|
2003 |
+
msgid "You have authenticated the WPvividGoogle Drive account as your remote storage."
|
2004 |
+
msgstr "Hai autenticato l'account WPvividGoogle Drive come tuo storage remoto."
|
2005 |
|
2006 |
#: includes/customclass/class-wpvivid-google-drive.php:292
|
2007 |
+
msgid "WPvividGoogle Drive"
|
2008 |
+
msgstr "WPvividGoogle Drive"
|
2009 |
|
2010 |
#: includes/customclass/class-wpvivid-google-drive.php:304
|
2011 |
+
msgid "Please read <a target=\"_blank\" href=\"https://wpvivid.com/privacy-policy\" style=\"text-decoration: none;\">this privacy policy</a> for use of our WPvividGoogle Drive authorization app (none of your backup data is sent to us)."
|
2012 |
+
msgstr "Si prega di leggere <a target=\"_blank\" href=\"https://wpvivid.com/privacy-policy\" style=\"text-decoration: none;\">questa informativa sulla privacy</a> per l'utilizzo della nostra applicazione di autorizzazione a WPvividGoogle Drive (nessuno dei dati di backup viene inviato a noi)."
|
2013 |
|
2014 |
#: includes/customclass/class-wpvivid-google-drive.php:307
|
2015 |
#: includes/customclass/class-wpvivid-google-drive.php:435
|
2016 |
+
msgid "Enter Your WPvividGoogle Drive Information"
|
2017 |
+
msgstr "Inserisci le informazioni del tuo account WPvividGoogle Drive"
|
2018 |
|
2019 |
#: includes/customclass/class-wpvivid-google-drive.php:314
|
2020 |
#: includes/customclass/class-wpvivid-google-drive.php:442
|
2021 |
+
msgid "Enter a unique alias: e.g. WPvividGoogle Drive-001"
|
2022 |
+
msgstr "Inserisci un alias univoco: ad esempio WPvividGoogle Drive-001"
|
2023 |
|
2024 |
#: includes/customclass/class-wpvivid-google-drive.php:364
|
2025 |
+
msgid "Authenticate with WPvividGoogle Drive"
|
2026 |
+
msgstr "Autenticati con WPvividGoogle Drive"
|
2027 |
|
2028 |
#: includes/customclass/class-wpvivid-google-drive.php:369
|
2029 |
+
msgid "Click the button to get WPvividGoogle authentication and add it to the storage list below."
|
2030 |
+
msgstr "Clicca il pulsante per ottenere il codice di autenticazione di WPvividGoogle e aggiungerlo alla lista degli storage qui di seguito."
|
2031 |
|
2032 |
#: includes/customclass/class-wpvivid-one-drive.php:240
|
2033 |
msgid "You have authenticated the Microsoft OneDrive account as your remote storage."
|
languages/wpvivid-backuprestore.pot
CHANGED
@@ -1994,33 +1994,33 @@ msgid "Authentication failed, the format of the client_secrets.json file is inco
|
|
1994 |
msgstr ""
|
1995 |
|
1996 |
#: includes/customclass/class-wpvivid-google-drive.php:272
|
1997 |
-
msgid "You have authenticated the
|
1998 |
msgstr ""
|
1999 |
|
2000 |
#: includes/customclass/class-wpvivid-google-drive.php:292
|
2001 |
-
msgid "
|
2002 |
msgstr ""
|
2003 |
|
2004 |
#: includes/customclass/class-wpvivid-google-drive.php:304
|
2005 |
-
msgid "Please read <a target=\"_blank\" href=\"https://wpvivid.com/privacy-policy\" style=\"text-decoration: none;\">this privacy policy</a> for use of our
|
2006 |
msgstr ""
|
2007 |
|
2008 |
#: includes/customclass/class-wpvivid-google-drive.php:307
|
2009 |
#: includes/customclass/class-wpvivid-google-drive.php:435
|
2010 |
-
msgid "Enter Your
|
2011 |
msgstr ""
|
2012 |
|
2013 |
#: includes/customclass/class-wpvivid-google-drive.php:314
|
2014 |
#: includes/customclass/class-wpvivid-google-drive.php:442
|
2015 |
-
msgid "Enter a unique alias: e.g.
|
2016 |
msgstr ""
|
2017 |
|
2018 |
#: includes/customclass/class-wpvivid-google-drive.php:364
|
2019 |
-
msgid "Authenticate with
|
2020 |
msgstr ""
|
2021 |
|
2022 |
#: includes/customclass/class-wpvivid-google-drive.php:369
|
2023 |
-
msgid "Click the button to get
|
2024 |
msgstr ""
|
2025 |
|
2026 |
#: includes/customclass/class-wpvivid-one-drive.php:240
|
1994 |
msgstr ""
|
1995 |
|
1996 |
#: includes/customclass/class-wpvivid-google-drive.php:272
|
1997 |
+
msgid "You have authenticated the WPvividGoogle Drive account as your remote storage."
|
1998 |
msgstr ""
|
1999 |
|
2000 |
#: includes/customclass/class-wpvivid-google-drive.php:292
|
2001 |
+
msgid "WPvividGoogle Drive"
|
2002 |
msgstr ""
|
2003 |
|
2004 |
#: includes/customclass/class-wpvivid-google-drive.php:304
|
2005 |
+
msgid "Please read <a target=\"_blank\" href=\"https://wpvivid.com/privacy-policy\" style=\"text-decoration: none;\">this privacy policy</a> for use of our WPvividGoogle Drive authorization app (none of your backup data is sent to us)."
|
2006 |
msgstr ""
|
2007 |
|
2008 |
#: includes/customclass/class-wpvivid-google-drive.php:307
|
2009 |
#: includes/customclass/class-wpvivid-google-drive.php:435
|
2010 |
+
msgid "Enter Your WPvividGoogle Drive Information"
|
2011 |
msgstr ""
|
2012 |
|
2013 |
#: includes/customclass/class-wpvivid-google-drive.php:314
|
2014 |
#: includes/customclass/class-wpvivid-google-drive.php:442
|
2015 |
+
msgid "Enter a unique alias: e.g. WPvividGoogle Drive-001"
|
2016 |
msgstr ""
|
2017 |
|
2018 |
#: includes/customclass/class-wpvivid-google-drive.php:364
|
2019 |
+
msgid "Authenticate with WPvividGoogle Drive"
|
2020 |
msgstr ""
|
2021 |
|
2022 |
#: includes/customclass/class-wpvivid-google-drive.php:369
|
2023 |
+
msgid "Click the button to get WPvividGoogle authentication and add it to the storage list below."
|
2024 |
msgstr ""
|
2025 |
|
2026 |
#: includes/customclass/class-wpvivid-one-drive.php:240
|
readme.txt
CHANGED
@@ -1,17 +1,19 @@
|
|
1 |
-
=== Backup
|
2 |
Contributors: wpvivid
|
3 |
-
Tags: move, clone, migrate,
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.8
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag: 0.9.
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
11 |
-
Auto migrate, move, duplicate, back up WP. All-in-one backup &
|
12 |
|
13 |
== Description ==
|
14 |
-
WPvivid Backup Plugin offers backup and
|
|
|
|
|
15 |
|
16 |
Migrate a copy of WP site to a new host (a new domain), schedule backups, send backups to leading remote storage, clean unused images before backup and migration. All in one backup & migration plugin.
|
17 |
|
@@ -63,13 +65,15 @@ Migrate your WordPress site to a new domain with a single click. WPvivid Backup
|
|
63 |
You can also migrate a site to a subdirectory, from a.com to b.com, from a.com to a.com/directory and from a.com to b.com/directory.
|
64 |
|
65 |
You are free to choose what to migrate: the entire site, files or just database only.
|
66 |
-
= 3.
|
|
|
|
|
67 |
Set a schedule to run backups automatically on your website. You can set the backups to run every 12 hours, daily, weekly, fortnightly, monthly, and choose backup items and destination.
|
68 |
-
=
|
69 |
Send your backups offsite to a remote location. WPvivid Backup Plugin supports the leading cloud storage providers: Dropbox, Google Drive, Amazon S3, Microsoft OneDrive, DigitalOcean Spaces, FTP and SFTP.
|
70 |
-
=
|
71 |
Restore your WordPress site from a backup with a single click.
|
72 |
-
=
|
73 |
Scan your WP media library to find unused images, then you can choose to clean specific or all unused images.
|
74 |
|
75 |
== Cloud Storage Supported ==
|
@@ -79,6 +83,7 @@ The pro version also supports Wasabi, pCloud, Backblaze and more are coming soon
|
|
79 |
|
80 |
== Features Spotlight ==
|
81 |
* One-Click Site Move or Migration
|
|
|
82 |
* Upload Backups to Restore or Migrate
|
83 |
* Unused Images Cleaner (Beta)
|
84 |
* Schedule Automated Backups
|
@@ -187,6 +192,10 @@ Thank you for translating WPvivid Backup Plugin to your languages!
|
|
187 |
* [Nima](https://profiles.wordpress.org/nima78600/) (Persian)
|
188 |
|
189 |
== Changelog ==
|
|
|
|
|
|
|
|
|
190 |
= 0.9.56 =
|
191 |
- Fixed: Some used images would show up in the image cleaner results in some cases.
|
192 |
- Fixed some bugs in the plugin code.
|
1 |
+
=== Migration, Backup, Staging - WPvivid Backup and Migration Plugin ===
|
2 |
Contributors: wpvivid
|
3 |
+
Tags: move, clone, migrate, staging, backup, restore, auto backup, cloud backup
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.8
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 0.9.57
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
11 |
+
Auto migrate, move, duplicate, back up WP. Create staging sites. All-in-one backup, migration & staging plugin. Schedule, offsite backup.
|
12 |
|
13 |
== Description ==
|
14 |
+
WPvivid Backup Plugin offers backup, migration, and staging as basic features, and is integrating more and more elegant features, such as unused images cleaner etc.
|
15 |
+
|
16 |
+
Create a staging site on a subdirectory to safely test WordPress, plugins, themes and website changes.
|
17 |
|
18 |
Migrate a copy of WP site to a new host (a new domain), schedule backups, send backups to leading remote storage, clean unused images before backup and migration. All in one backup & migration plugin.
|
19 |
|
65 |
You can also migrate a site to a subdirectory, from a.com to b.com, from a.com to a.com/directory and from a.com to b.com/directory.
|
66 |
|
67 |
You are free to choose what to migrate: the entire site, files or just database only.
|
68 |
+
= 3. Create A Staging Site =
|
69 |
+
Create a staging site on a subdirectory of your production site to safely test WordPress, plugins, themes and website changes. You can choose what to copy from the the live site to the staging site.
|
70 |
+
= 4. Scheduled Backups =
|
71 |
Set a schedule to run backups automatically on your website. You can set the backups to run every 12 hours, daily, weekly, fortnightly, monthly, and choose backup items and destination.
|
72 |
+
= 5. Offsite Backup to Remote Storage =
|
73 |
Send your backups offsite to a remote location. WPvivid Backup Plugin supports the leading cloud storage providers: Dropbox, Google Drive, Amazon S3, Microsoft OneDrive, DigitalOcean Spaces, FTP and SFTP.
|
74 |
+
= 6. One-Click Restore =
|
75 |
Restore your WordPress site from a backup with a single click.
|
76 |
+
= 7. Unused Images Cleaner (Beta) =
|
77 |
Scan your WP media library to find unused images, then you can choose to clean specific or all unused images.
|
78 |
|
79 |
== Cloud Storage Supported ==
|
83 |
|
84 |
== Features Spotlight ==
|
85 |
* One-Click Site Move or Migration
|
86 |
+
* Create A Staging Site
|
87 |
* Upload Backups to Restore or Migrate
|
88 |
* Unused Images Cleaner (Beta)
|
89 |
* Schedule Automated Backups
|
192 |
* [Nima](https://profiles.wordpress.org/nima78600/) (Persian)
|
193 |
|
194 |
== Changelog ==
|
195 |
+
= 0.9.57 =
|
196 |
+
- Added a new feature of creating a staging site.
|
197 |
+
- Fixed some bugs in the plugin code.
|
198 |
+
- Optimized the plugin code.
|
199 |
= 0.9.56 =
|
200 |
- Fixed: Some used images would show up in the image cleaner results in some cases.
|
201 |
- Fixed some bugs in the plugin code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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The admin-specific functionality of the plugin.
|
5 |
+
*
|
6 |
+
* @link https://wpvivid.com
|
7 |
+
* @since 0.9.1
|
8 |
+
*
|
9 |
+
* @package WPvivid
|
10 |
+
* @subpackage WPvivid/admin
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The admin-specific functionality of the plugin.
|
15 |
+
*
|
16 |
+
* Defines the plugin name, version, and two examples hooks for how to
|
17 |
+
* enqueue the admin-specific stylesheet and JavaScript.
|
18 |
+
*
|
19 |
+
* @package WPvivid
|
20 |
+
* @subpackage WPvivid/admin
|
21 |
+
* @author wpvivid team
|
22 |
+
*/
|
23 |
+
if (!defined('WPVIVID_PLUGIN_DIR')){
|
24 |
+
die;
|
25 |
+
}
|
26 |
+
class WPvivid_Admin {
|
27 |
+
|
28 |
+
/**
|
29 |
+
* The ID of this plugin.
|
30 |
+
*
|
31 |
+
*
|
32 |
+
* @access private
|
33 |
+
* @var string $plugin_name The ID of this plugin.
|
34 |
+
*/
|
35 |
+
private $plugin_name;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* The version of this plugin.
|
39 |
+
*
|
40 |
+
*
|
41 |
+
* @access private
|
42 |
+
* @var string $version The current version of this plugin.
|
43 |
+
*/
|
44 |
+
private $version;
|
45 |
+
|
46 |
+
private $screen_ids;
|
47 |
+
|
48 |
+
private $toolbar_menus;
|
49 |
+
|
50 |
+
private $submenus;
|
51 |
+
/**
|
52 |
+
* Initialize the class and set its properties.
|
53 |
+
*
|
54 |
+
*
|
55 |
+
* @param string $plugin_name The name of this plugin.
|
56 |
+
* @param string $version The version of this plugin.
|
57 |
+
*/
|
58 |
+
public function __construct($plugin_name, $version)
|
59 |
+
{
|
60 |
+
add_filter('wpvivid_get_screen_ids',array($this,'get_screen_ids'),10);
|
61 |
+
add_filter('wpvivid_get_toolbar_menus',array($this,'get_toolbar_menus'),10);
|
62 |
+
add_filter('wpvivid_get_admin_menus',array($this,'get_admin_menus'),10);
|
63 |
+
add_filter('wpvivid_add_side_bar', array($this, 'wpvivid_add_side_bar'), 10, 2);
|
64 |
+
|
65 |
+
add_action('wpvivid_before_setup_page',array($this,'migrate_notice'));
|
66 |
+
add_action('wpvivid_before_setup_page',array($this,'show_add_my_review'));
|
67 |
+
add_action('wpvivid_before_setup_page',array($this,'check_extensions'));
|
68 |
+
add_action('wpvivid_before_setup_page',array($this,'check_amazons3'));
|
69 |
+
add_action('wpvivid_before_setup_page',array($this,'init_js_var'));
|
70 |
+
|
71 |
+
add_filter('wpvivid_add_log_tab_page', array($this, 'add_log_tab_page'), 10);
|
72 |
+
|
73 |
+
$this->plugin_name = $plugin_name;
|
74 |
+
$this->version = $version;
|
75 |
+
}
|
76 |
+
|
77 |
+
public function add_log_tab_page($setting_array)
|
78 |
+
{
|
79 |
+
$setting_array['backup_log_page'] = array('index' => '1', 'tab_func' => array($this, 'wpvivid_add_tab_log'), 'page_func' => array($this, 'wpvivid_add_page_log'));
|
80 |
+
//$setting_array['read_log_page'] = array('index' => '2', 'tab_func' => array($this, 'wpvivid_add_tab_read_log'), 'page_func' => array($this, 'wpvivid_add_page_read_log'));
|
81 |
+
return $setting_array;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function get_screen_ids($screen_ids)
|
85 |
+
{
|
86 |
+
$screen_ids[]='toplevel_page_'.$this->plugin_name;
|
87 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-transfer';
|
88 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-setting';
|
89 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-schedule';
|
90 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-remote';
|
91 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-website';
|
92 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-log';
|
93 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-key';
|
94 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid-mainwp';
|
95 |
+
$screen_ids[]='wpvivid-backup_page_wpvivid_premium';
|
96 |
+
return $screen_ids;
|
97 |
+
}
|
98 |
+
|
99 |
+
public function get_toolbar_menus($toolbar_menus)
|
100 |
+
{
|
101 |
+
$menu['id']='wpvivid_admin_menu';
|
102 |
+
$menu['title']='WPvivid Backup';
|
103 |
+
$toolbar_menus[$menu['id']]=$menu;
|
104 |
+
|
105 |
+
$admin_url = admin_url();
|
106 |
+
|
107 |
+
$menu['id']='wpvivid_admin_menu_backup';
|
108 |
+
$menu['parent']='wpvivid_admin_menu';
|
109 |
+
$menu['title']=__('Backup & Restore', 'wpvivid-backuprestore');
|
110 |
+
$menu['tab']='admin.php?page=WPvivid&tab-backup';
|
111 |
+
$menu['href']=$admin_url . 'admin.php?page=WPvivid&tab-backup';
|
112 |
+
$menu['capability']='administrator';
|
113 |
+
$menu['index']=1;
|
114 |
+
$toolbar_menus[$menu['parent']]['child'][$menu['id']]=$menu;
|
115 |
+
|
116 |
+
return $toolbar_menus;
|
117 |
+
}
|
118 |
+
|
119 |
+
public function get_admin_menus($submenus)
|
120 |
+
{
|
121 |
+
$submenu['parent_slug']=$this->plugin_name;
|
122 |
+
$submenu['page_title']='WPvivid Backup';
|
123 |
+
$submenu['menu_title']=__('Backup & Restore', 'wpvivid-backuprestore');
|
124 |
+
$submenu['capability']='administrator';
|
125 |
+
$submenu['menu_slug']=$this->plugin_name;
|
126 |
+
$submenu['function']=array($this, 'display_plugin_setup_page');
|
127 |
+
$submenu['index']=1;
|
128 |
+
$submenus[$submenu['menu_slug']]=$submenu;
|
129 |
+
|
130 |
+
$submenu['parent_slug']=$this->plugin_name;
|
131 |
+
$submenu['page_title']='WPvivid Backup';
|
132 |
+
$submenu['menu_title']=__('Settings', 'wpvivid-backuprestore');
|
133 |
+
$submenu['capability']='administrator';
|
134 |
+
$submenu['menu_slug']='wpvivid-setting';
|
135 |
+
$submenu['function']=array($this, 'display_plugin_setup_page');
|
136 |
+
$submenu['index']=5;
|
137 |
+
$submenus[$submenu['menu_slug']]=$submenu;
|
138 |
+
|
139 |
+
return $submenus;
|
140 |
+
}
|
141 |
+
|
142 |
+
public function wpvivid_add_side_bar($html, $show_schedule = false){
|
143 |
+
$wpvivid_version = WPVIVID_PLUGIN_VERSION;
|
144 |
+
$wpvivid_version = apply_filters('wpvivid_display_pro_version', $wpvivid_version);
|
145 |
+
|
146 |
+
$html = '<div class="postbox">
|
147 |
+
<h2>
|
148 |
+
<div style="float: left; margin-right: 5px;"><span style="margin: 0; padding: 0">'.__('Current Version:', 'wpvivid-backuprestore').' '.$wpvivid_version.'</span></div>
|
149 |
+
<div style="float: left; margin-right: 5px;"><span style="margin: 0; padding: 0">|</span></div>
|
150 |
+
<div style="float: left; margin-left: 0;">
|
151 |
+
<span style="margin: 0; padding: 0"><a href="https://wordpress.org/plugins/wpvivid-backuprestore/#developers" target="_blank" style="text-decoration: none;">'.__('ChangeLog', 'wpvivid-backuprestore').'</a></span>
|
152 |
+
</div>
|
153 |
+
<div style="clear: both;"></div>
|
154 |
+
</h2>
|
155 |
+
</div>
|
156 |
+
<div id="wpvivid_backup_schedule_part"></div>
|
157 |
+
<div class="postbox">
|
158 |
+
<h2><span>'.__('Troubleshooting', 'wpvivid-backuprestore').'</span></h2>
|
159 |
+
<div class="inside">
|
160 |
+
<table class="widefat" cellpadding="0">
|
161 |
+
<tbody>
|
162 |
+
<tr class="alternate">
|
163 |
+
<td class="row-title">'.__('Read <a href="https://docs.wpvivid.com/troubleshooting-issues-wpvivid-backup-plugin.html" target="_blank">Troubleshooting page</a> for faster solutions.', 'wpvivid-backuprestore').'</td>
|
164 |
+
</tr>
|
165 |
+
<tr>
|
166 |
+
<td class="row-title">'.__('Adjust <a href="https://docs.wpvivid.com/wpvivid-backup-free-advanced-settings.html" target="_blank">Advanced Settings</a> for higher task success rate.', 'wpvivid-backuprestore').'</td>
|
167 |
+
</tr>
|
168 |
+
</tbody>
|
169 |
+
</table>
|
170 |
+
</div>
|
171 |
+
</div>
|
172 |
+
<div class="postbox">
|
173 |
+
<h2><span>'.__('How-to', 'wpvivid-backuprestore').'</span></h2>
|
174 |
+
<div class="inside">
|
175 |
+
<table class="widefat" cellpadding="0">
|
176 |
+
<tbody>
|
177 |
+
<tr class="alternate"><td class="row-title"><a href="https://docs.wpvivid.com/wpvivid-backup-free-general-settings.html" target="_blank">'.__('WPvivid Backup Settings', 'wpvivid-backuprestore').'</a></td></tr>
|
178 |
+
<tr><td class="row-title"><a href="https://docs.wpvivid.com/get-started-create-manual-backup.html" target="_blank">'.__('Create a Manual Backup', 'wpvivid-backuprestore').'</a></td></tr>
|
179 |
+
<tr class="alternate"><td class="row-title"><a href="https://docs.wpvivid.com/get-started-restore-site.html" target="_blank">'.__('Restore Your Site from a Backup', 'wpvivid-backuprestore').'</a></td></tr>
|
180 |
+
<tr><td class="row-title"><a href="https://docs.wpvivid.com/get-started-transfer-site.html" target="_blank">'.__('Migrate WordPress', 'wpvivid-backuprestore').'</a></td></tr>
|
181 |
+
</tbody>
|
182 |
+
</table>
|
183 |
+
</div>
|
184 |
+
</div>';
|
185 |
+
return $html;
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Register the stylesheets for the admin area.
|
190 |
+
*
|
191 |
+
*
|
192 |
+
*/
|
193 |
+
public function enqueue_styles()
|
194 |
+
{
|
195 |
+
$this->screen_ids=apply_filters('wpvivid_get_screen_ids',$this->screen_ids);
|
196 |
+
if(in_array(get_current_screen()->id,$this->screen_ids))
|
197 |
+
{
|
198 |
+
wp_enqueue_style($this->plugin_name, WPVIVID_PLUGIN_DIR_URL . 'css/wpvivid-admin.css', array(), $this->version, 'all');
|
199 |
+
do_action('wpvivid_do_enqueue_styles');
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Register the JavaScript for the admin area.
|
205 |
+
*
|
206 |
+
*
|
207 |
+
*/
|
208 |
+
public function enqueue_scripts()
|
209 |
+
{
|
210 |
+
$this->screen_ids=apply_filters('wpvivid_get_screen_ids',$this->screen_ids);
|
211 |
+
|
212 |
+
if(in_array(get_current_screen()->id,$this->screen_ids))
|
213 |
+
{
|
214 |
+
wp_enqueue_script($this->plugin_name, WPVIVID_PLUGIN_DIR_URL . 'js/wpvivid-admin.js', array('jquery'), $this->version, false);
|
215 |
+
wp_localize_script($this->plugin_name, 'wpvivid_ajax_object', array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce'=>wp_create_nonce('wpvivid_ajax')));
|
216 |
+
|
217 |
+
wp_localize_script($this->plugin_name, 'wpvividlion', array(
|
218 |
+
'warning' => __('Warning:', 'wpvivid-backuprestore'),
|
219 |
+
'error' => __('Error:', 'wpvivid-backuprestore'),
|
220 |
+
'remotealias' => __('Warning: An alias for remote storage is required.', 'wpvivid-backuprestore'),
|
221 |
+
'remoteexist' => __('Warning: The alias already exists in storage list.', 'wpvivid-backuprestore'),
|
222 |
+
'backup_calc_timeout' => __('Calculating the size of files, folder and database timed out. If you continue to receive this error, please go to the plugin settings, uncheck \'Calculate the size of files, folder and database before backing up\', save changes, then try again.', 'wpvivid-backuprestore'),
|
223 |
+
'restore_step1' => __('Step One: In the backup list, click the \'Restore\' button on the backup you want to restore. This will bring up the restore tab', 'wpvivid-backuprestore'),
|
224 |
+
'restore_step2' => __('Step Two: Choose an option to complete restore, if any', 'wpvivid-backuprestore'),
|
225 |
+
'restore_step3' => __('Step Three: Click \'Restore\' button', 'wpvivid-backuprestore'),
|
226 |
+
'get_key_step1' => __('1. Visit Key tab page of WPvivid backup plugin of destination site.', 'wpvivid-backuprestore'),
|
227 |
+
'get_key_step2' => __('2. Generate a key by clicking Generate button and copy it.', 'wpvivid-backuprestore'),
|
228 |
+
'get_key_step3' => __('3. Go back to this page and paste the key in key box below. Lastly, click Save button.', 'wpvivid-backuprestore'),
|
229 |
+
));
|
230 |
+
|
231 |
+
wp_enqueue_script('plupload-all');
|
232 |
+
do_action('wpvivid_do_enqueue_scripts');
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Register the administration menu for this plugin into the WordPress Dashboard menu.
|
238 |
+
*
|
239 |
+
*
|
240 |
+
*/
|
241 |
+
public function add_plugin_admin_menu()
|
242 |
+
{
|
243 |
+
|
244 |
+
/*
|
245 |
+
* Add a settings page for this plugin to the Settings menu.
|
246 |
+
*
|
247 |
+
* NOTE: Alternative menu locations are available via WordPress administration menu functions.
|
248 |
+
*
|
249 |
+
* Administration Menus: http://codex.wordpress.org/Administration_Menus
|
250 |
+
*
|
251 |
+
*/
|
252 |
+
$menu['page_title']= 'WPvivid Backup';
|
253 |
+
$menu['menu_title']= 'WPvivid Backup';
|
254 |
+
$menu['capability']='administrator';
|
255 |
+
$menu['menu_slug']= $this->plugin_name;
|
256 |
+
$menu['function']=array($this, 'display_plugin_setup_page');
|
257 |
+
$menu['icon_url']='dashicons-cloud';
|
258 |
+
$menu['position']=100;
|
259 |
+
$menu = apply_filters('wpvivid_get_main_admin_menus', $menu);
|
260 |
+
add_menu_page( $menu['page_title'],$menu['menu_title'], $menu['capability'], $menu['menu_slug'], $menu['function'], $menu['icon_url'], $menu['position']);
|
261 |
+
$this->submenus = apply_filters('wpvivid_get_admin_menus', $this->submenus);
|
262 |
+
usort($this->submenus, function ($a, $b) {
|
263 |
+
if ($a['index'] == $b['index'])
|
264 |
+
return 0;
|
265 |
+
|
266 |
+
if ($a['index'] > $b['index'])
|
267 |
+
return 1;
|
268 |
+
else
|
269 |
+
return -1;
|
270 |
+
});
|
271 |
+
foreach ($this->submenus as $submenu) {
|
272 |
+
add_submenu_page(
|
273 |
+
$submenu['parent_slug'],
|
274 |
+
$submenu['page_title'],
|
275 |
+
$submenu['menu_title'],
|
276 |
+
$submenu['capability'],
|
277 |
+
$submenu['menu_slug'],
|
278 |
+
$submenu['function']);
|
279 |
+
}
|
280 |
+
}
|
281 |
+
|
282 |
+
function add_toolbar_items($wp_admin_bar)
|
283 |
+
{
|
284 |
+
global $wpvivid_plugin;
|
285 |
+
if(is_admin())
|
286 |
+
{
|
287 |
+
$show_admin_bar = $wpvivid_plugin->get_admin_bar_setting();
|
288 |
+
if ($show_admin_bar === true)
|
289 |
+
{
|
290 |
+
$this->toolbar_menus = apply_filters('wpvivid_get_toolbar_menus', $this->toolbar_menus);
|
291 |
+
foreach ($this->toolbar_menus as $menu)
|
292 |
+
{
|
293 |
+
$wp_admin_bar->add_menu(array(
|
294 |
+
'id' => $menu['id'],
|
295 |
+
'title' => $menu['title']
|
296 |
+
));
|
297 |
+
if (isset($menu['child']))
|
298 |
+
{
|
299 |
+
usort($menu['child'], function ($a, $b)
|
300 |
+
{
|
301 |
+
if($a['index']==$b['index'])
|
302 |
+
return 0;
|
303 |
+
|
304 |
+
if($a['index']>$b['index'])
|
305 |
+
return 1;
|
306 |
+
else
|
307 |
+
return -1;
|
308 |
+
});
|
309 |
+
foreach ($menu['child'] as $child_menu) {
|
310 |
+
if(isset($child_menu['capability']) && current_user_can($child_menu['capability'])) {
|
311 |
+
$wp_admin_bar->add_menu(array(
|
312 |
+
'id' => $child_menu['id'],
|
313 |
+
'parent' => $menu['id'],
|
314 |
+
'title' => $child_menu['title'],
|
315 |
+
'href' => $child_menu['href']
|
316 |
+
));
|
317 |
+
}
|
318 |
+
}
|
319 |
+
}
|
320 |
+
}
|
321 |
+
}
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
public function add_action_links( $links )
|
326 |
+
{
|
327 |
+
$settings_link = array(
|
328 |
+
'<a href="' . admin_url( 'admin.php?page=' . apply_filters('wpvivid_white_label_slug', $this->plugin_name) ) . '">' . __('Settings', $this->plugin_name) . '</a>',
|
329 |
+
);
|
330 |
+
return array_merge( $settings_link, $links );
|
331 |
+
}
|
332 |
+
|
333 |
+
public static function wpvivid_get_siteurl(){
|
334 |
+
$wpvivid_siteurl = array();
|
335 |
+
$wpvivid_siteurl['home_url'] = home_url();
|
336 |
+
$wpvivid_siteurl['plug_url'] = plugins_url();
|
337 |
+
$wpvivid_siteurl['site_url'] = get_option( 'siteurl' );
|
338 |
+
return $wpvivid_siteurl;
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Render the settings page for this plugin.
|
343 |
+
*
|
344 |
+
*
|
345 |
+
*/
|
346 |
+
public function display_plugin_setup_page()
|
347 |
+
{
|
348 |
+
do_action('wpvivid_before_setup_page');
|
349 |
+
|
350 |
+
add_action('wpvivid_display_page',array($this,'display'));
|
351 |
+
|
352 |
+
do_action('wpvivid_display_page');
|
353 |
+
}
|
354 |
+
|
355 |
+
public function migrate_notice()
|
356 |
+
{
|
357 |
+
$migrate_notice=false;
|
358 |
+
$migrate_status=WPvivid_Setting::get_option('wpvivid_migrate_status');
|
359 |
+
if(!empty($migrate_status) && $migrate_status == 'completed')
|
360 |
+
{
|
361 |
+
$migrate_notice=true;
|
362 |
+
echo '<div class="notice notice-warning is-dismissible"><p>'.__('Migration is complete and htaccess file is replaced. In order to successfully complete the migration, you\'d better reinstall 301 redirect plugin, firewall and security plugin, and caching plugin if they exist.').'</p></div>';
|
363 |
+
WPvivid_Setting::delete_option('wpvivid_migrate_status');
|
364 |
+
}
|
365 |
+
$restore = new WPvivid_restore_data();
|
366 |
+
if ($restore->has_restore())
|
367 |
+
{
|
368 |
+
$restore_status = $restore->get_restore_status();
|
369 |
+
if ($restore_status === WPVIVID_RESTORE_COMPLETED)
|
370 |
+
{
|
371 |
+
$restore->clean_restore_data();
|
372 |
+
do_action('wpvivid_rebuild_backup_list');
|
373 |
+
$need_review=WPvivid_Setting::get_option('wpvivid_need_review');
|
374 |
+
if($need_review=='not')
|
375 |
+
{
|
376 |
+
WPvivid_Setting::update_option('wpvivid_need_review','show');
|
377 |
+
$msg = __('Cheers! WPvivid Backup plugin has restored successfully your website. If you found WPvivid Backup plugin helpful, a 5-star rating would be highly appreciated, which motivates us to keep providing new features.', 'wpvivid-backuprestore');
|
378 |
+
WPvivid_Setting::update_option('wpvivid_review_msg',$msg);
|
379 |
+
}
|
380 |
+
else{
|
381 |
+
if(!$migrate_notice)
|
382 |
+
{
|
383 |
+
echo '<div class="notice notice-success is-dismissible"><p>'.__('Restore completed successfully.').'</p></div>';
|
384 |
+
}
|
385 |
+
}
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
|
390 |
+
public function display()
|
391 |
+
{
|
392 |
+
include_once('partials/wpvivid-admin-display.php');
|
393 |
+
}
|
394 |
+
|
395 |
+
public static function wpvivid_get_page_request()
|
396 |
+
{
|
397 |
+
$request_page='wpvivid_tab_general';
|
398 |
+
|
399 |
+
if(isset($_REQUEST['wpvivid-remote-page-mainwp'])){
|
400 |
+
$request_page='wpvivid_tab_remote_storage';
|
401 |
+
}
|
402 |
+
if(isset($_REQUEST['tab-backup']))
|
403 |
+
{
|
404 |
+
$request_page='wpvivid_tab_general';
|
405 |
+
}
|
406 |
+
else if(isset($_REQUEST['tab-schedule']))
|
407 |
+
{
|
408 |
+
$request_page='wpvivid_tab_schedule';
|
409 |
+
}
|
410 |
+
else if(isset($_REQUEST['tab-transfer']))
|
411 |
+
{
|
412 |
+
$request_page='wpvivid_tab_migrate';
|
413 |
+
}
|
414 |
+
else if(isset($_REQUEST['tab-remote-storage']))
|
415 |
+
{
|
416 |
+
$request_page='wpvivid_tab_remote_storage';
|
417 |
+
}
|
418 |
+
else if(isset($_REQUEST['tab-settings']))
|
419 |
+
{
|
420 |
+
$request_page='wpvivid_tab_setting';
|
421 |
+
}
|
422 |
+
else if(isset($_REQUEST['tab-website-info']))
|
423 |
+
{
|
424 |
+
$request_page='wpvivid_tab_debug';
|
425 |
+
}
|
426 |
+
else if(isset($_REQUEST['tab-logs']))
|
427 |
+
{
|
428 |
+
$request_page='wpvivid_tab_log';
|
429 |
+
}
|
430 |
+
else if(isset($_REQUEST['tab-key']))
|
431 |
+
{
|
432 |
+
$request_page='wpvivid_tab_key';
|
433 |
+
}
|
434 |
+
else if(isset($_REQUEST['tab-mainwp']))
|
435 |
+
{
|
436 |
+
$request_page='wpvivid_tab_mainwp';
|
437 |
+
}
|
438 |
+
else if(isset($_REQUEST['page'])&&$_REQUEST['page']=='wpvivid-pro')
|
439 |
+
{
|
440 |
+
$request_page='wpvivid_tab_pro';
|
441 |
+
}
|
442 |
+
else if(isset($_REQUEST['page'])&&$_REQUEST['page']=='wpvivid-setting')
|
443 |
+
{
|
444 |
+
$request_page='wpvivid_tab_setting';
|
445 |
+
}
|
446 |
+
|
447 |
+
$request_page=apply_filters('wpvivid_set_page_request',$request_page);
|
448 |
+
|
449 |
+
return $request_page;
|
450 |
+
}
|
451 |
+
|
452 |
+
public static function show_add_my_review()
|
453 |
+
{
|
454 |
+
$review = WPvivid_Setting::get_option('wpvivid_need_review');
|
455 |
+
$review_msg = WPvivid_Setting::get_option('wpvivid_review_msg');
|
456 |
+
if (empty($review))
|
457 |
+
{
|
458 |
+
WPvivid_Setting::update_option('wpvivid_need_review', 'not');
|
459 |
+
} else {
|
460 |
+
if ($review == 'not')
|
461 |
+
{
|
462 |
+
}
|
463 |
+
else if ($review == 'show')
|
464 |
+
{
|
465 |
+
if(!empty($review_msg))
|
466 |
+
{
|
467 |
+
echo '<div class="notice notice-info is-dismissible" id="wpvivid_notice_rate">
|
468 |
+
<p>' . $review_msg . '</p>
|
469 |
+
<div style="padding-bottom: 10px;">
|
470 |
+
<span><input type="button" class="button-primary" option="review" name="rate-now" value="'.esc_attr('Rate Us', 'wpvivid-backuprestore').'" /></span>
|
471 |
+
<span><input type="button" class="button-secondary" option="review" name="ask-later" value="'.esc_attr('Maybe Later', 'wpvivid-backuprestore').'" /></span>
|
472 |
+
<span><input type="button" class="button-secondary" option="review" name="never-ask" value="'.esc_attr('Never', 'wpvivid-backuprestore').'" /></span>
|
473 |
+
<span><input type="button" class="button-secondary" option="review" name="already-done" value="'.esc_attr('Already Done', 'wpvivid-backuprestore').'" /></span>
|
474 |
+
</div>
|
475 |
+
</div>';
|
476 |
+
}
|
477 |
+
} else if ($review == 'do_not_ask')
|
478 |
+
{
|
479 |
+
} else
|
480 |
+
{
|
481 |
+
if (time() > $review)
|
482 |
+
{
|
483 |
+
if(!empty($review_msg))
|
484 |
+
{
|
485 |
+
echo '<div class="notice notice-info is-dismissible" id="wpvivid_notice_rate">
|
486 |
+
<p>' . $review_msg . '</p>
|
487 |
+
<div style="padding-bottom: 10px;">
|
488 |
+
<span><input type="button" class="button-primary" option="review" name="rate-now" value="'.esc_attr('Rate Us', 'wpvivid-backuprestore').'" /></span>
|
489 |
+
<span><input type="button" class="button-secondary" option="review" name="ask-later" value="'.esc_attr('Maybe Later', 'wpvivid-backuprestore').'" /></span>
|
490 |
+
<span><input type="button" class="button-secondary" option="review" name="never-ask" value="'.esc_attr('Never', 'wpvivid-backuprestore').'" /></span>
|
491 |
+
<span><input type="button" class="button-secondary" option="review" name="already-done" value="'.esc_attr('Already Done', 'wpvivid-backuprestore').'" /></span>
|
492 |
+
</div>
|
493 |
+
</div>';
|
494 |
+
}
|
495 |
+
}
|
496 |
+
}
|
497 |
+
}
|
498 |
+
}
|
499 |
+
|
500 |
+
public function check_amazons3()
|
501 |
+
{
|
502 |
+
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
503 |
+
$need_amazons3_notice = false;
|
504 |
+
if(isset($remoteslist) && !empty($remoteslist))
|
505 |
+
{
|
506 |
+
foreach ($remoteslist as $remote_id => $value)
|
507 |
+
{
|
508 |
+
if($remote_id === 'remote_selected')
|
509 |
+
{
|
510 |
+
continue;
|
511 |
+
}
|
512 |
+
if($value['type'] == 'amazons3' && isset($value['s3Path']))
|
513 |
+
{
|
514 |
+
$need_amazons3_notice = true;
|
515 |
+
}
|
516 |
+
if($value['type'] == 's3compat' && isset($value['s3directory']))
|
517 |
+
{
|
518 |
+
$need_amazons3_notice = true;
|
519 |
+
}
|
520 |
+
}
|
521 |
+
}
|
522 |
+
if($need_amazons3_notice)
|
523 |
+
{
|
524 |
+
$amazons3_notice = WPvivid_Setting::get_option('wpvivid_amazons3_notice', 'not init');
|
525 |
+
if($amazons3_notice === 'not init')
|
526 |
+
{
|
527 |
+
$notice_message = __('As Amazon S3 and DigitalOcean Space have upgraded their connection methods, please delete the previous connections and re-add your Amazon S3/DigitalOcean Space accounts to make sure the connections work.', 'wpvivid-backuprestore');
|
528 |
+
echo '<div class="notice notice-warning" id="wpvivid_amazons3_notice">
|
529 |
+
<p>' . $notice_message . '</p>
|
530 |
+
<div style="padding-bottom: 10px;">
|
531 |
+
<span><input type="button" class="button-secondary" value="I Understand" onclick="wpvivid_click_amazons3_notice();" /></span>
|
532 |
+
</div>
|
533 |
+
</div>';
|
534 |
+
}
|
535 |
+
}
|
536 |
+
}
|
537 |
+
|
538 |
+
public function check_extensions()
|
539 |
+
{
|
540 |
+
$common_setting = WPvivid_Setting::get_setting(false, 'wpvivid_common_setting');
|
541 |
+
$db_connect_method = isset($common_setting['options']['wpvivid_common_setting']['db_connect_method']) ? $common_setting['options']['wpvivid_common_setting']['db_connect_method'] : 'wpdb';
|
542 |
+
$need_php_extensions = array();
|
543 |
+
$need_extensions_count = 0;
|
544 |
+
$extensions=get_loaded_extensions();
|
545 |
+
if(!function_exists("curl_init")){
|
546 |
+
$need_php_extensions[$need_extensions_count] = 'curl';
|
547 |
+
$need_extensions_count++;
|
548 |
+
}
|
549 |
+
if(!class_exists('PDO')){
|
550 |
+
$need_php_extensions[$need_extensions_count] = 'PDO';
|
551 |
+
$need_extensions_count++;
|
552 |
+
}
|
553 |
+
if(!function_exists("gzopen"))
|
554 |
+
{
|
555 |
+
$need_php_extensions[$need_extensions_count] = 'zlib';
|
556 |
+
$need_extensions_count++;
|
557 |
+
}
|
558 |
+
if(!array_search('pdo_mysql',$extensions) && $db_connect_method === 'pdo')
|
559 |
+
{
|
560 |
+
$need_php_extensions[$need_extensions_count] = 'pdo_mysql';
|
561 |
+
$need_extensions_count++;
|
562 |
+
}
|
563 |
+
if(!empty($need_php_extensions)){
|
564 |
+
$msg = '';
|
565 |
+
$figure = 0;
|
566 |
+
foreach ($need_php_extensions as $extension){
|
567 |
+
$figure++;
|
568 |
+
if($figure == 1){
|
569 |
+
$msg .= $extension;
|
570 |
+
}
|
571 |
+
else if($figure < $need_extensions_count) {
|
572 |
+
$msg .= ', '.$extension;
|
573 |
+
}
|
574 |
+
else if($figure == $need_extensions_count){
|
575 |
+
$msg .= ' and '.$extension;
|
576 |
+
}
|
577 |
+
}
|
578 |
+
if($figure == 1){
|
579 |
+
echo '<div class="notice notice-error"><p>'.sprintf(__('The %s extension is not detected. Please install the extension first.', 'wpvivid-backuprestore'), $msg).'</p></div>';
|
580 |
+
}
|
581 |
+
else{
|
582 |
+
echo '<div class="notice notice-error"><p>'.sprintf(__('The %s extensions are not detected. Please install the extensions first.', 'wpvivid-backuprestore'), $msg).'</p></div>';
|
583 |
+
}
|
584 |
+
}
|
585 |
+
|
586 |
+
if (!class_exists('PclZip')) include_once(ABSPATH.'/wp-admin/includes/class-pclzip.php');
|
587 |
+
if (!class_exists('PclZip')) {
|
588 |
+
echo '<div class="notice notice-error"><p>'.__('Class PclZip is not detected. Please update or reinstall your WordPress.', 'wpvivid-backuprestore').'</p></div>';
|
589 |
+
}
|
590 |
+
|
591 |
+
$hide_notice = get_option('wpvivid_hide_wp_cron_notice', false);
|
592 |
+
if(defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON && $hide_notice === false){
|
593 |
+
echo '<div class="notice notice-error notice-wp-cron is-dismissible"><p>'.__('In order to execute the scheduled backups properly, please set the DISABLE_WP_CRON constant to false.', 'wpvivid-backuprestore').'</p></div>';
|
594 |
+
}
|
595 |
+
}
|
596 |
+
|
597 |
+
public function init_js_var()
|
598 |
+
{
|
599 |
+
global $wpvivid_plugin;
|
600 |
+
|
601 |
+
$loglist=$wpvivid_plugin->get_log_list_ex();
|
602 |
+
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
603 |
+
$default_remote_storage='';
|
604 |
+
foreach ($remoteslist['remote_selected'] as $value)
|
605 |
+
{
|
606 |
+
$default_remote_storage=$value;
|
607 |
+
}
|
608 |
+
?>
|
609 |
+
<script>
|
610 |
+
var wpvivid_siteurl = '<?php
|
611 |
+
$wpvivid_siteurl = array();
|
612 |
+
$wpvivid_siteurl=WPvivid_Admin::wpvivid_get_siteurl();
|
613 |
+
echo esc_url($wpvivid_siteurl['site_url']);
|
614 |
+
?>';
|
615 |
+
var wpvivid_plugurl = '<?php
|
616 |
+
echo WPVIVID_PLUGIN_URL;
|
617 |
+
?>';
|
618 |
+
var wpvivid_log_count = '<?php
|
619 |
+
_e(sizeof($loglist['log_list']['file']), 'wpvivid-backuprestore');
|
620 |
+
?>';
|
621 |
+
var wpvivid_log_array = '<?php
|
622 |
+
_e(json_encode($loglist), 'wpvivid-backuprestore');
|
623 |
+
?>';
|
624 |
+
var wpvivid_page_request = '<?php
|
625 |
+
$page_request = WPvivid_Admin::wpvivid_get_page_request();
|
626 |
+
_e($page_request, 'wpvivid-backuprestore');
|
627 |
+
?>';
|
628 |
+
var wpvivid_default_remote_storage = '<?php
|
629 |
+
_e($default_remote_storage, 'wpvivid-backuprestore');
|
630 |
+
?>';
|
631 |
+
</script>
|
632 |
+
<?php
|
633 |
+
}
|
634 |
+
|
635 |
+
public function wpvivid_add_default_tab_page($page_array){
|
636 |
+
$page_array['backup_restore'] = array('index' => '1', 'tab_func' => array($this, 'wpvivid_add_tab_backup_restore'), 'page_func' => array($this, 'wpvivid_add_page_backup'));
|
637 |
+
$page_array['schedule'] = array('index' => '2', 'tab_func' => array($this, 'wpvivid_add_tab_schedule'), 'page_func' => array($this, 'wpvivid_add_page_schedule'));
|
638 |
+
$page_array['remote_storage'] = array('index' => '4', 'tab_func' => array($this, 'wpvivid_add_tab_remote_storage'), 'page_func' => array($this, 'wpvivid_add_page_remote_storage'));
|
639 |
+
$page_array['setting'] = array('index' => '5', 'tab_func' => array($this, 'wpvivid_add_tab_setting'), 'page_func' => array($this, 'wpvivid_add_page_setting'));
|
640 |
+
$page_array['website_info'] = array('index' => '6', 'tab_func' => array($this, 'wpvivid_add_tab_website_info'), 'page_func' => array($this, 'wpvivid_add_page_website_info'));
|
641 |
+
$page_array['log'] = array('index' => '7', 'tab_func' => array($this, 'wpvivid_add_tab_log_ex'), 'page_func' => array($this, 'wpvivid_add_page_log_ex'));
|
642 |
+
$page_array['read_log'] = array('index' => '29', 'tab_func' => array($this, 'wpvivid_add_tab_read_log'), 'page_func' => array($this, 'wpvivid_add_page_read_log'));
|
643 |
+
$page_array['premium'] = array('index' => '10', 'tab_func' => array($this, 'wpvivid_add_tab_premium'), 'page_func' => array($this, 'wpvivid_add_page_premium'));
|
644 |
+
$hide_mwp_tab_page = get_option('wpvivid_hide_mwp_tab_page_v1', false);
|
645 |
+
if($hide_mwp_tab_page === false) {
|
646 |
+
$page_array['mwp'] = array('index' => '30', 'tab_func' => array($this, 'wpvivid_add_tab_mwp'), 'page_func' => array($this, 'wpvivid_add_page_mwp'));
|
647 |
+
}
|
648 |
+
return $page_array;
|
649 |
+
}
|
650 |
+
|
651 |
+
public function wpvivid_add_tab_backup_restore(){
|
652 |
+
?>
|
653 |
+
<a href="#" id="wpvivid_tab_general" class="nav-tab wrap-nav-tab nav-tab-active" onclick="switchTabs(event,'general-page')"><?php _e('Backup & Restore', 'wpvivid-backuprestore'); ?></a>
|
654 |
+
<?php
|
655 |
+
}
|
656 |
+
|
657 |
+
public function wpvivid_add_tab_schedule(){
|
658 |
+
?>
|
659 |
+
<a href="#" id="wpvivid_tab_schedule" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'schedule-page')"><?php _e('Schedule', 'wpvivid-backuprestore'); ?></a>
|
660 |
+
<?php
|
661 |
+
}
|
662 |
+
|
663 |
+
public function wpvivid_add_tab_remote_storage(){
|
664 |
+
?>
|
665 |
+
<a href="#" id="wpvivid_tab_remote_storage" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'storage-page')"><?php _e('Remote Storage', 'wpvivid-backuprestore'); ?></a>
|
666 |
+
<?php
|
667 |
+
}
|
668 |
+
|
669 |
+
public function wpvivid_add_tab_setting(){
|
670 |
+
?>
|
671 |
+
<a href="#" id="wpvivid_tab_setting" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'settings-page')"><?php _e('Settings', 'wpvivid-backuprestore'); ?></a>
|
672 |
+
<?php
|
673 |
+
}
|
674 |
+
|
675 |
+
public function wpvivid_add_tab_website_info(){
|
676 |
+
?>
|
677 |
+
<a href="#" id="wpvivid_tab_debug" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'debug-page')"><?php _e('Debug', 'wpvivid-backuprestore'); ?></a>
|
678 |
+
<?php
|
679 |
+
}
|
680 |
+
|
681 |
+
public function wpvivid_add_tab_log(){
|
682 |
+
?>
|
683 |
+
<a href="#" id="wpvivid_tab_log" class="nav-tab log-nav-tab nav-tab-active" onclick="switchlogTabs(event,'logs-page')"><?php _e('Backup Logs', 'wpvivid-backuprestore'); ?></a>
|
684 |
+
<?php
|
685 |
+
}
|
686 |
+
|
687 |
+
public function wpvivid_add_tab_read_log(){
|
688 |
+
?>
|
689 |
+
<a href="#" id="wpvivid_tab_read_log" class="nav-tab wrap-nav-tab delete" onclick="switchTabs(event,'log-read-page')" style="display: none;">
|
690 |
+
<div style="margin-right: 15px;"><?php _e('Log', 'wpvivid-backuprestore'); ?></div>
|
691 |
+
<div class="nav-tab-delete-img">
|
692 |
+
<img src="<?php echo esc_url( WPVIVID_PLUGIN_URL.'/admin/partials/images/delete-tab.png' ); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_tab(event, 'wpvivid_tab_read_log', 'wrap', 'wpvivid_tab_log');" />
|
693 |
+
</div>
|
694 |
+
</a>
|
695 |
+
<?php
|
696 |
+
}
|
697 |
+
|
698 |
+
public function wpvivid_add_tab_mwp(){
|
699 |
+
?>
|
700 |
+
<a href="#" id="wpvivid_tab_mainwp" class="nav-tab wrap-nav-tab delete" onclick="switchTabs(event, 'mwp-page')">
|
701 |
+
<div style="margin-right: 15px;"><?php _e('MainWP', 'wpvivid-backuprestore'); ?></div>
|
702 |
+
<div class="nav-tab-delete-img">
|
703 |
+
<img src="<?php echo esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/delete-tab.png'); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_tab(event, 'wpvivid_tab_mainwp', 'wrap', 'wpvivid_tab_general');" />
|
704 |
+
</div>
|
705 |
+
</a>
|
706 |
+
<?php
|
707 |
+
}
|
708 |
+
|
709 |
+
public function wpvivid_add_tab_premium(){
|
710 |
+
?>
|
711 |
+
<a href="#" id="wpvivid_tab_premium" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'premium-page')"><?php _e('Premium', 'wpvivid-backuprestore'); ?></a>
|
712 |
+
<?php
|
713 |
+
}
|
714 |
+
|
715 |
+
public function wpvivid_add_page_backup()
|
716 |
+
{
|
717 |
+
?>
|
718 |
+
<div id="general-page" class="wrap-tab-content wpvivid_tab_general" name="tab-backup" style="width:100%;">
|
719 |
+
<div class="meta-box-sortables ui-sortable">
|
720 |
+
<?php
|
721 |
+
do_action('wpvivid_backuppage_add_module');
|
722 |
+
?>
|
723 |
+
<h2 class="nav-tab-wrapper" id="wpvivid_backup_tab" style="padding-bottom:0!important;">
|
724 |
+
<?php
|
725 |
+
$backuplist_array = array();
|
726 |
+
$backuplist_array = apply_filters('wpvivid_backuppage_load_backuplist', $backuplist_array);
|
727 |
+
foreach ($backuplist_array as $list_name) {
|
728 |
+
add_action('wpvivid_backuppage_add_tab', $list_name['tab_func'], $list_name['index']);
|
729 |
+
add_action('wpvivid_backuppage_add_page', $list_name['page_func'], $list_name['index']);
|
730 |
+
}
|
731 |
+
do_action('wpvivid_backuppage_add_tab');
|
732 |
+
?>
|
733 |
+
</h2>
|
734 |
+
<?php do_action('wpvivid_backuppage_add_page'); ?>
|
735 |
+
</div>
|
736 |
+
</div>
|
737 |
+
<script>
|
738 |
+
<?php do_action('wpvivid_backup_do_js'); ?>
|
739 |
+
</script>
|
740 |
+
<?php
|
741 |
+
}
|
742 |
+
|
743 |
+
public function wpvivid_add_page_schedule()
|
744 |
+
{
|
745 |
+
?>
|
746 |
+
<div id="schedule-page" class="wrap-tab-content wpvivid_tab_schedule" name="tab-schedule" style="display: none;">
|
747 |
+
<div>
|
748 |
+
<table class="widefat">
|
749 |
+
<tbody>
|
750 |
+
<?php do_action('wpvivid_schedule_add_cell'); ?>
|
751 |
+
<tfoot>
|
752 |
+
<tr>
|
753 |
+
<th class="row-title"><input class="button-primary storage-account-button" id="wpvivid_schedule_save" type="submit" name="" value="<?php esc_attr_e( 'Save Changes', 'wpvivid-backuprestore' ); ?>" /></th>
|
754 |
+
<th></th>
|
755 |
+
</tr>
|
756 |
+
</tfoot>
|
757 |
+
</tbody>
|
758 |
+
</table>
|
759 |
+
</div>
|
760 |
+
</div>
|
761 |
+
<script>
|
762 |
+
jQuery('#wpvivid_schedule_save').click(function(){
|
763 |
+
wpvivid_set_schedule();
|
764 |
+
wpvivid_settings_changed = false;
|
765 |
+
});
|
766 |
+
|
767 |
+
function wpvivid_set_schedule()
|
768 |
+
{
|
769 |
+
var schedule_data = wpvivid_ajax_data_transfer('schedule');
|
770 |
+
var ajax_data = {
|
771 |
+
'action': 'wpvivid_set_schedule',
|
772 |
+
'schedule': schedule_data
|
773 |
+
};
|
774 |
+
jQuery('#wpvivid_schedule_save').css({'pointer-events': 'none', 'opacity': '0.4'});
|
775 |
+
wpvivid_post_request(ajax_data, function (data) {
|
776 |
+
try {
|
777 |
+
var jsonarray = jQuery.parseJSON(data);
|
778 |
+
|
779 |
+
jQuery('#wpvivid_schedule_save').css({'pointer-events': 'auto', 'opacity': '1'});
|
780 |
+
if (jsonarray.result === 'success') {
|
781 |
+
location.reload();
|
782 |
+
}
|
783 |
+
else {
|
784 |
+
alert(jsonarray.error);
|
785 |
+
}
|
786 |
+
}
|
787 |
+
catch (err) {
|
788 |
+
alert(err);
|
789 |
+
jQuery('#wpvivid_schedule_save').css({'pointer-events': 'auto', 'opacity': '1'});
|
790 |
+
}
|
791 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
792 |
+
jQuery('#wpvivid_schedule_save').css({'pointer-events': 'auto', 'opacity': '1'});
|
793 |
+
var error_message = wpvivid_output_ajaxerror('changing schedule', textStatus, errorThrown);
|
794 |
+
alert(error_message);
|
795 |
+
});
|
796 |
+
}
|
797 |
+
</script>
|
798 |
+
<?php
|
799 |
+
}
|
800 |
+
|
801 |
+
public function wpvivid_add_page_remote_storage()
|
802 |
+
{
|
803 |
+
?>
|
804 |
+
<div id="storage-page" class="wrap-tab-content wpvivid_tab_remote_storage" name="tab-storage" style="display:none;">
|
805 |
+
<div>
|
806 |
+
<div class="storage-content" id="storage-brand-2" style="">
|
807 |
+
<div class="postbox">
|
808 |
+
<?php do_action('wpvivid_add_storage_tab'); ?>
|
809 |
+
</div>
|
810 |
+
<div class="postbox storage-account-block" id="wpvivid_storage_account_block">
|
811 |
+
<?php do_action('wpvivid_add_storage_page'); ?>
|
812 |
+
</div>
|
813 |
+
<h2 class="nav-tab-wrapper" style="padding-bottom:0!important;">
|
814 |
+
<?php do_action('wpvivid_storage_add_tab'); ?>
|
815 |
+
</h2>
|
816 |
+
<?php do_action('wpvivid_storage_add_page'); ?>
|
817 |
+
</div>
|
818 |
+
</div>
|
819 |
+
</div>
|
820 |
+
<?php
|
821 |
+
}
|
822 |
+
|
823 |
+
public function wpvivid_add_page_setting()
|
824 |
+
{
|
825 |
+
?>
|
826 |
+
<div id="settings-page" class="wrap-tab-content wpvivid_tab_setting" name="tab-setting" style="display:none;">
|
827 |
+
<div>
|
828 |
+
<h2 class="nav-tab-wrapper" style="padding-bottom:0!important;">
|
829 |
+
<?php
|
830 |
+
$setting_array = array();
|
831 |
+
$setting_array = apply_filters('wpvivid_add_setting_tab_page', $setting_array);
|
832 |
+
foreach ($setting_array as $setting_name) {
|
833 |
+
add_action('wpvivid_settingpage_add_tab', $setting_name['tab_func'], $setting_name['index']);
|
834 |
+
add_action('wpvivid_settingpage_add_page', $setting_name['page_func'], $setting_name['index']);
|
835 |
+
}
|
836 |
+
do_action('wpvivid_settingpage_add_tab');
|
837 |
+
?>
|
838 |
+
</h2>
|
839 |
+
<?php do_action('wpvivid_settingpage_add_page'); ?>
|
840 |
+
<div><input class="button-primary" id="wpvivid_setting_general_save" type="submit" value="<?php esc_attr_e( 'Save Changes', 'wpvivid-backuprestore' ); ?>" /></div>
|
841 |
+
</div>
|
842 |
+
</div>
|
843 |
+
<script>
|
844 |
+
jQuery('#wpvivid_setting_general_save').click(function(){
|
845 |
+
wpvivid_set_general_settings();
|
846 |
+
wpvivid_settings_changed = false;
|
847 |
+
});
|
848 |
+
|
849 |
+
function wpvivid_set_general_settings()
|
850 |
+
{
|
851 |
+
var setting_data = wpvivid_ajax_data_transfer('setting');
|
852 |
+
var ajax_data = {
|
853 |
+
'action': 'wpvivid_set_general_setting',
|
854 |
+
'setting': setting_data
|
855 |
+
};
|
856 |
+
jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'none', 'opacity': '0.4'});
|
857 |
+
wpvivid_post_request(ajax_data, function (data) {
|
858 |
+
try {
|
859 |
+
var jsonarray = jQuery.parseJSON(data);
|
860 |
+
|
861 |
+
jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'auto', 'opacity': '1'});
|
862 |
+
if (jsonarray.result === 'success') {
|
863 |
+
location.reload();
|
864 |
+
}
|
865 |
+
else {
|
866 |
+
alert(jsonarray.error);
|
867 |
+
}
|
868 |
+
}
|
869 |
+
catch (err) {
|
870 |
+
alert(err);
|
871 |
+
jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'auto', 'opacity': '1'});
|
872 |
+
}
|
873 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
874 |
+
jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'auto', 'opacity': '1'});
|
875 |
+
var error_message = wpvivid_output_ajaxerror('changing base settings', textStatus, errorThrown);
|
876 |
+
alert(error_message);
|
877 |
+
});
|
878 |
+
}
|
879 |
+
</script>
|
880 |
+
<?php
|
881 |
+
}
|
882 |
+
|
883 |
+
public function wpvivid_add_tab_log_ex(){
|
884 |
+
?>
|
885 |
+
<a href="#" id="wpvivid_tab_log_ex" class="nav-tab wrap-nav-tab" onclick="switchTabs(event,'logs-page-ex')"><?php _e('Logs', 'wpvivid-backuprestore'); ?></a>
|
886 |
+
<?php
|
887 |
+
}
|
888 |
+
|
889 |
+
public function wpvivid_add_page_log_ex()
|
890 |
+
{
|
891 |
+
?>
|
892 |
+
<div id="logs-page-ex" class="wrap-tab-content wpvivid_tab_log" name="tab-logs" style="display:none;">
|
893 |
+
<div>
|
894 |
+
<h2 class="nav-tab-wrapper" style="padding-bottom:0!important;">
|
895 |
+
<?php
|
896 |
+
$setting_array = array();
|
897 |
+
$setting_array = apply_filters('wpvivid_add_log_tab_page', $setting_array);
|
898 |
+
foreach ($setting_array as $setting_name) {
|
899 |
+
add_action('wpvivid_logpage_add_tab', $setting_name['tab_func'], $setting_name['index']);
|
900 |
+
add_action('wpvivid_logpage_add_page', $setting_name['page_func'], $setting_name['index']);
|
901 |
+
}
|
902 |
+
do_action('wpvivid_logpage_add_tab');
|
903 |
+
?>
|
904 |
+
</h2>
|
905 |
+
<?php do_action('wpvivid_logpage_add_page'); ?>
|
906 |
+
</div>
|
907 |
+
</div>
|
908 |
+
<?php
|
909 |
+
}
|
910 |
+
|
911 |
+
public function wpvivid_add_page_website_info()
|
912 |
+
{
|
913 |
+
?>
|
914 |
+
<div id="debug-page" class="wrap-tab-content wpvivid_tab_debug" name="tab-debug" style="display:none;">
|
915 |
+
<table class="widefat">
|
916 |
+
<div style="padding: 0 0 20px 10px;"><?php _e('There are two ways available to send us the debug information. The first one is recommended.', 'wpvivid-backuprestore'); ?></div>
|
917 |
+
<div style="padding-left: 10px;">
|
918 |
+
<strong><?php _e('Method 1.'); ?></strong> <?php _e('If you have configured SMTP on your site, enter your email address and click the button below to send us the relevant information (website info and errors logs) when you are encountering errors. This will help us figure out what happened. Once the issue is resolved, we will inform you by your email address.', 'wpvivid-backuprestore'); ?>
|
919 |
+
</div>
|
920 |
+
<div style="padding:10px 10px 0">
|
921 |
+
<span class="wpvivid-element-space-right"><?php echo __('WPvivid support email:', 'wpvivid-backuprestore'); ?></span><input type="text" id="wpvivid_support_mail" value="support@wpvivid.com" readonly />
|
922 |
+
<span class="wpvivid-element-space-right"><?php _e('Your email:', 'wpvivid-backuprestore'); ?></span><input type="text" id="wpvivid_user_mail" />
|
923 |
+
</div>
|
924 |
+
<div style="padding:10px 10px 0">
|
925 |
+
<div style="float: left;">
|
926 |
+
<div class="wpvivid-element-space-bottom wpvivid-text-space-right wpvivid-debug-text-fix" style="float: left;">
|
927 |
+
<?php _e('I am using:', 'wpvivid-backuprestore'); ?>
|
928 |
+
</div>
|
929 |
+
<div class="wpvivid-element-space-bottom wpvivid-text-space-right" style="float: left;">
|
930 |
+
<select id="wpvivid_debug_type">
|
931 |
+
<option selected="selected" value="sharehost">share hosting</option>
|
932 |
+
<option value="vps">VPS hosting</option>
|
933 |
+
</select>
|
934 |
+
</div>
|
935 |
+
<div style="clear: both;"></div>
|
936 |
+
</div>
|
937 |
+
<div id="wpvivid_debug_host" style="float: left;">
|
938 |
+
<div class="wpvivid-element-space-bottom wpvivid-text-space-right wpvivid-debug-text-fix" style="float: left;">
|
939 |
+
<?php _e('My web hosting provider is:', 'wpvivid-backuprestore'); ?>
|
940 |
+
</div>
|
941 |
+
<div class="wpvivid-element-space-bottom wpvivid-text-space-right" style="float: left;">
|
942 |
+
<input type="text" id="wpvivid_host_provider"/></div>
|
943 |
+
<div style="clear: both;"></div>
|
944 |
+
</div>
|
945 |
+
<div style="clear: both;"></div>
|
946 |
+
</div>
|
947 |
+
<div style="padding:0 10px;">
|
948 |
+
<textarea id="wpvivid_debug_comment" class="wp-editor-area" style="width:100%; height: 200px;" autocomplete="off" cols="60" placeholder="<?php esc_attr_e('Please describe your problem here.', 'wpvivid-backuprestore'); ?>" ></textarea>
|
949 |
+
</div>
|
950 |
+
<div class="schedule-tab-block">
|
951 |
+
<input class="button-primary" type="submit" value="<?php esc_attr_e( 'Send Debug Information to Us', 'wpvivid-backuprestore' ); ?>" onclick="wpvivid_click_send_debug_info();" />
|
952 |
+
</div>
|
953 |
+
<div style="clear:both;"></div>
|
954 |
+
<div style="padding-left: 10px;">
|
955 |
+
<strong><?php _e('Method 2.'); ?></strong> <?php _e('If you didn’t configure SMTP on your site, click the button below to download the relevant information (website info and error logs) to your PC when you are encountering some errors. Sending the files to us will help us diagnose what happened.', 'wpvivid-backuprestore'); ?>
|
956 |
+
</div>
|
957 |
+
<div class="schedule-tab-block">
|
958 |
+
<input class="button-primary" id="wpvivid_download_website_info" type="submit" name="download-website-info" value="<?php esc_attr_e( 'Download', 'wpvivid-backuprestore' ); ?>" />
|
959 |
+
</div>
|
960 |
+
<thead class="website-info-head">
|
961 |
+
<tr>
|
962 |
+
<th class="row-title" style="min-width: 260px;"><?php _e( 'Website Info Key', 'wpvivid-backuprestore' ); ?></th>
|
963 |
+
<th><?php _e( 'Website Info Value', 'wpvivid-backuprestore' ); ?></th>
|
964 |
+
</tr>
|
965 |
+
</thead>
|
966 |
+
<tbody class="wpvivid-websiteinfo-list" id="wpvivid_websiteinfo_list">
|
967 |
+
<?php
|
968 |
+
global $wpvivid_plugin;
|
969 |
+
$website_info=$wpvivid_plugin->get_website_info();
|
970 |
+
if(!empty($website_info['data'])){
|
971 |
+
foreach ($website_info['data'] as $key=>$value) { ?>
|
972 |
+
<?php
|
973 |
+
$website_value='';
|
974 |
+
if (is_array($value)) {
|
975 |
+
foreach ($value as $arr_value) {
|
976 |
+
if (empty($website_value)) {
|
977 |
+
$website_value = $website_value . $arr_value;
|
978 |
+
} else {
|
979 |
+
$website_value = $website_value . ', ' . $arr_value;
|
980 |
+
}
|
981 |
+
}
|
982 |
+
}
|
983 |
+
else{
|
984 |
+
if($value === true || $value === false){
|
985 |
+
if($value === true) {
|
986 |
+
$website_value = 'true';
|
987 |
+
}
|
988 |
+
else{
|
989 |
+
$website_value = 'false';
|
990 |
+
}
|
991 |
+
}
|
992 |
+
else {
|
993 |
+
$website_value = $value;
|
994 |
+
}
|
995 |
+
}
|
996 |
+
?>
|
997 |
+
<tr>
|
998 |
+
<td class="row-title tablelistcolumn"><label for="tablecell"><?php _e($key, 'wpvivid-backuprestore'); ?></label></td>
|
999 |
+
<td class="tablelistcolumn"><?php _e($website_value, 'wpvivid-backuprestore'); ?></td>
|
1000 |
+
</tr>
|
1001 |
+
<?php }} ?>
|
1002 |
+
</tbody>
|
1003 |
+
</table>
|
1004 |
+
</div>
|
1005 |
+
<script>
|
1006 |
+
jQuery('#wpvivid_download_website_info').click(function(){
|
1007 |
+
wpvivid_download_website_info();
|
1008 |
+
});
|
1009 |
+
|
1010 |
+
/**
|
1011 |
+
* Download the relevant website info and error logs to your PC for debugging purposes.
|
1012 |
+
*/
|
1013 |
+
function wpvivid_download_website_info(){
|
1014 |
+
wpvivid_location_href=true;
|
1015 |
+
location.href =ajaxurl+'?_wpnonce='+wpvivid_ajax_object.ajax_nonce+'&action=wpvivid_create_debug_package';
|
1016 |
+
}
|
1017 |
+
|
1018 |
+
jQuery("#wpvivid_debug_type").change(function()
|
1019 |
+
{
|
1020 |
+
if(jQuery(this).val()=='sharehost')
|
1021 |
+
{
|
1022 |
+
jQuery("#wpvivid_debug_host").show();
|
1023 |
+
}
|
1024 |
+
else
|
1025 |
+
{
|
1026 |
+
jQuery("#wpvivid_debug_host").hide();
|
1027 |
+
}
|
1028 |
+
});
|
1029 |
+
|
1030 |
+
function wpvivid_click_send_debug_info(){
|
1031 |
+
var wpvivid_user_mail = jQuery('#wpvivid_user_mail').val();
|
1032 |
+
var server_type = jQuery('#wpvivid_debug_type').val();
|
1033 |
+
var host_provider = jQuery('#wpvivid_host_provider').val();
|
1034 |
+
var comment = jQuery('#wpvivid_debug_comment').val();
|
1035 |
+
|
1036 |
+
var ajax_data = {
|
1037 |
+
'action': 'wpvivid_send_debug_info',
|
1038 |
+
'user_mail': wpvivid_user_mail,
|
1039 |
+
'server_type':server_type,
|
1040 |
+
'host_provider':host_provider,
|
1041 |
+
'comment':comment
|
1042 |
+
};
|
1043 |
+
wpvivid_post_request(ajax_data, function (data) {
|
1044 |
+
try {
|
1045 |
+
var jsonarray = jQuery.parseJSON(data);
|
1046 |
+
if (jsonarray.result === "success") {
|
1047 |
+
alert("Send succeeded.");
|
1048 |
+
}
|
1049 |
+
else {
|
1050 |
+
alert(jsonarray.error);
|
1051 |
+
}
|
1052 |
+
}
|
1053 |
+
catch (err) {
|
1054 |
+
alert(err);
|
1055 |
+
}
|
1056 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
1057 |
+
var error_message = wpvivid_output_ajaxerror('sending debug information', textStatus, errorThrown);
|
1058 |
+
alert(error_message);
|
1059 |
+
});
|
1060 |
+
}
|
1061 |
+
</script>
|
1062 |
+
<?php
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
public function wpvivid_add_page_log()
|
1066 |
+
{
|
1067 |
+
global $wpvivid_plugin;
|
1068 |
+
$display_log_count=array(0=>"10",1=>"20",2=>"30",3=>"40",4=>"50");
|
1069 |
+
$max_log_diaplay=20;
|
1070 |
+
$loglist=$wpvivid_plugin->get_log_list_ex();
|
1071 |
+
?>
|
1072 |
+
<div id="logs-page" class="log-tab-content wpvivid_tab_log" name="tab-logs">
|
1073 |
+
<table class="wp-list-table widefat plugins">
|
1074 |
+
<thead class="log-head">
|
1075 |
+
<tr>
|
1076 |
+
<th class="row-title"><?php _e( 'Date', 'wpvivid-backuprestore' ); ?></th>
|
1077 |
+
<th><?php _e( 'Log Type', 'wpvivid-backuprestore' ); ?></th>
|
1078 |
+
<th><?php _e( 'Log File Name', 'wpvivid-backuprestore' ); ?></th>
|
1079 |
+
<th><?php _e( 'Action', 'wpvivid-backuprestore' ); ?></th>
|
1080 |
+
</tr>
|
1081 |
+
</thead>
|
1082 |
+
<tbody class="wpvivid-loglist" id="wpvivid_loglist">
|
1083 |
+
<?php
|
1084 |
+
$html = '';
|
1085 |
+
$html = apply_filters('wpvivid_get_log_list', $html);
|
1086 |
+
echo $html['html'];
|
1087 |
+
?>
|
1088 |
+
</tbody>
|
1089 |
+
</table>
|
1090 |
+
<div style="padding-top: 10px; text-align: center;">
|
1091 |
+
<input class="button-secondary log-page" id="wpvivid_pre_log_page" type="submit" value="<?php esc_attr_e( ' < Pre page ', 'wpvivid-backuprestore' ); ?>" />
|
1092 |
+
<div style="font-size: 12px; display: inline-block; padding-left: 10px;">
|
1093 |
+
<span id="wpvivid_log_page_info" style="line-height: 35px;">
|
1094 |
+
<?php
|
1095 |
+
$current_page=1;
|
1096 |
+
$max_page=ceil(sizeof($loglist['log_list']['file'])/$max_log_diaplay);
|
1097 |
+
if($max_page == 0) $max_page = 1;
|
1098 |
+
echo $current_page.' / '.$max_page;
|
1099 |
+
?>
|
1100 |
+
</span>
|
1101 |
+
</div>
|
1102 |
+
<input class="button-secondary log-page" id="wpvivid_next_log_page" type="submit" value="<?php esc_attr_e( ' Next page > ', 'wpvivid-backuprestore' ); ?>" />
|
1103 |
+
<div style="float: right;">
|
1104 |
+
<select name="" id="wpvivid_display_log_count">
|
1105 |
+
<?php
|
1106 |
+
foreach ($display_log_count as $value){
|
1107 |
+
if($value == $max_log_diaplay){
|
1108 |
+
echo '<option selected="selected" value="' . $value . '">' . $value . '</option>';
|
1109 |
+
}
|
1110 |
+
else {
|
1111 |
+
echo '<option value="' . $value . '">' . $value . '</option>';
|
1112 |
+
}
|
1113 |
+
}
|
1114 |
+
?>
|
1115 |
+
</select>
|
1116 |
+
</div>
|
1117 |
+
</div>
|
1118 |
+
</div>
|
1119 |
+
<script>
|
1120 |
+
jQuery('#wpvivid_display_log_count').on("change", function(){
|
1121 |
+
wpvivid_display_log_page();
|
1122 |
+
});
|
1123 |
+
|
1124 |
+
jQuery('#wpvivid_pre_log_page').click(function(){
|
1125 |
+
wpvivid_pre_log_page();
|
1126 |
+
});
|
1127 |
+
|
1128 |
+
jQuery('#wpvivid_next_log_page').click(function(){
|
1129 |
+
wpvivid_next_log_page();
|
1130 |
+
});
|
1131 |
+
|
1132 |
+
function wpvivid_pre_log_page(){
|
1133 |
+
if(wpvivid_cur_log_page > 1){
|
1134 |
+
wpvivid_cur_log_page--;
|
1135 |
+
}
|
1136 |
+
wpvivid_display_log_page();
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
function wpvivid_next_log_page(){
|
1140 |
+
var display_count = jQuery("#wpvivid_display_log_count option:selected").val();
|
1141 |
+
var max_pages=Math.ceil(wpvivid_log_count/display_count);
|
1142 |
+
if(wpvivid_cur_log_page < max_pages){
|
1143 |
+
wpvivid_cur_log_page++;
|
1144 |
+
}
|
1145 |
+
wpvivid_display_log_page();
|
1146 |
+
}
|
1147 |
+
|
1148 |
+
function wpvivid_display_log_page(){
|
1149 |
+
var display_count = jQuery("#wpvivid_display_log_count option:selected").val();
|
1150 |
+
var max_pages=Math.ceil(wpvivid_log_count/display_count);
|
1151 |
+
if(max_pages == 0) max_pages = 1;
|
1152 |
+
jQuery('#wpvivid_log_page_info').html(wpvivid_cur_log_page+ " / "+max_pages);
|
1153 |
+
|
1154 |
+
var begin = (wpvivid_cur_log_page - 1) * display_count;
|
1155 |
+
var end = parseInt(begin) + parseInt(display_count);
|
1156 |
+
jQuery("#wpvivid_loglist tr").hide();
|
1157 |
+
jQuery('#wpvivid_loglist tr').each(function(i){
|
1158 |
+
if (i >= begin && i < end)
|
1159 |
+
{
|
1160 |
+
jQuery(this).show();
|
1161 |
+
}
|
1162 |
+
});
|
1163 |
+
}
|
1164 |
+
|
1165 |
+
function wpvivid_retrieve_log_list()
|
1166 |
+
{
|
1167 |
+
var ajax_data = {
|
1168 |
+
'action': 'wpvivid_get_log_list'
|
1169 |
+
};
|
1170 |
+
wpvivid_post_request(ajax_data, function(data){
|
1171 |
+
try {
|
1172 |
+
var jsonarray = jQuery.parseJSON(data);
|
1173 |
+
if (jsonarray.result === "success") {
|
1174 |
+
jQuery('#wpvivid_loglist').html("");
|
1175 |
+
jQuery('#wpvivid_loglist').append(jsonarray.html);
|
1176 |
+
wpvivid_log_count = jsonarray.log_count;
|
1177 |
+
wpvivid_display_log_page();
|
1178 |
+
}
|
1179 |
+
}
|
1180 |
+
catch(err){
|
1181 |
+
alert(err);
|
1182 |
+
}
|
1183 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
1184 |
+
setTimeout(function () {
|
1185 |
+
wpvivid_retrieve_log_list();
|
1186 |
+
}, 3000);
|
1187 |
+
});
|
1188 |
+
}
|
1189 |
+
</script>
|
1190 |
+
<?php
|
1191 |
+
}
|
1192 |
+
|
1193 |
+
public function wpvivid_add_page_read_log()
|
1194 |
+
{
|
1195 |
+
?>
|
1196 |
+
<div id="log-read-page" class="wrap-tab-content wpvivid_tab_read_log" style="display:none;">
|
1197 |
+
<div class="postbox restore_log" id="wpvivid_read_log_content">
|
1198 |
+
<div></div>
|
1199 |
+
</div>
|
1200 |
+
</div>
|
1201 |
+
<?php
|
1202 |
+
}
|
1203 |
+
|
1204 |
+
public function wpvivid_add_page_mwp()
|
1205 |
+
{
|
1206 |
+
?>
|
1207 |
+
<div id="mwp-page" class="wrap-tab-content wpvivid_tab_mainwp" name="tab-mwp" style="display:none;">
|
1208 |
+
<div style="padding: 10px; background-color: #fff;">
|
1209 |
+
<div style="margin-bottom: 10px;">
|
1210 |
+
<?php echo __('If you are a MainWP user, you can set up and control WPvivid Backup Free and Pro for every child site directly from your MainWP dashboard, using our WPvivid Backup for MainWP extension.', 'wpvivid-backuprestore'); ?>
|
1211 |
+
</div>
|
1212 |
+
<div style="margin-bottom: 10px;">
|
1213 |
+
<input type="button" class="button-primary" id="wpvivid_download_mainwp_extension" value="<?php esc_attr_e('Download WPvivid Backup for MainWP', 'wpvivid-backuprestore'); ?>" />
|
1214 |
+
</div>
|
1215 |
+
<div style="margin-bottom: 10px;">
|
1216 |
+
<?php _e('1. Create and download backups for a specific child site', 'wpvivid-backuprestore'); ?>
|
1217 |
+
</div>
|
1218 |
+
<div style="margin-bottom: 10px;">
|
1219 |
+
<?php _e('2. Set backup schedules for all child sites', 'wpvivid-backuprestore'); ?>
|
1220 |
+
</div>
|
1221 |
+
<div style="margin-bottom: 10px;">
|
1222 |
+
<?php
|
1223 |
+
echo __('3. Set WPvivid Backup Free and Pro settings for all child sites', 'wpvivid-backuprestore');
|
1224 |
+
?>
|
1225 |
+
</div>
|
1226 |
+
<div style="margin-bottom: 10px;">
|
1227 |
+
<?php
|
1228 |
+
echo __('4. Install, claim and update WPvivid Backup Pro for child sites in bulk', 'wpvivid-backuprestore');
|
1229 |
+
?>
|
1230 |
+
</div>
|
1231 |
+
<div>
|
1232 |
+
<?php
|
1233 |
+
echo __('5. Set up remote storage for child sites in bulk (for WPvivid Backup Pro only)', 'wpvivid-backuprestore');
|
1234 |
+
?>
|
1235 |
+
</div>
|
1236 |
+
</div>
|
1237 |
+
</div>
|
1238 |
+
<script>
|
1239 |
+
jQuery('#wpvivid_download_mainwp_extension').click(function(){
|
1240 |
+
var tempwindow=window.open('_blank');
|
1241 |
+
tempwindow.location='https://wordpress.org/plugins/wpvivid-backup-mainwp';
|
1242 |
+
});
|
1243 |
+
jQuery('#wpvivid_ask_for_discount').click(function(){
|
1244 |
+
var tempwindow=window.open('_blank');
|
1245 |
+
tempwindow.location='https://wpvivid.com/wpvivid-backup-for-mainwp';
|
1246 |
+
});
|
1247 |
+
</script>
|
1248 |
+
<?php
|
1249 |
+
}
|
1250 |
+
|
1251 |
+
public function wpvivid_add_page_premium(){
|
1252 |
+
?>
|
1253 |
+
<div id="premium-page" class="wrap-tab-content wpvivid_tab_premium" name="tab-premium" style="display: none;">
|
1254 |
+
<table class="wp-list-table widefat plugins" style="border-collapse: collapse;">
|
1255 |
+
<thead>
|
1256 |
+
<tr class="backup-list-head" style="border-bottom: 0;">
|
1257 |
+
<th><?php _e('Features', 'wpvivid-backuprestore'); ?></th>
|
1258 |
+
<th style="text-align:center;"><?php _e('Blogger', 'wpvivid-backuprestore'); ?></th>
|
1259 |
+
<th style="text-align:center;"><?php _e('Freelancer', 'wpvivid-backuprestore'); ?></th>
|
1260 |
+
<th style="text-align:center;"><?php _e('Small Business', 'wpvivid-backuprestore'); ?></th>
|
1261 |
+
<th style="text-align:center;"><?php _e('Ultimate', 'wpvivid-backuprestore'); ?></th>
|
1262 |
+
</tr>
|
1263 |
+
</thead>
|
1264 |
+
<tbody class="wpvivid-backuplist">
|
1265 |
+
<tr style="">
|
1266 |
+
<td>
|
1267 |
+
<p><strong><?php _e('Domains', 'wpvivid-backuprestore'); ?></strong></p>
|
1268 |
+
<p><strong><?php _e('Backup & Migration Pro', 'wpvivid-backuprestore'); ?></strong></p>
|
1269 |
+
<p><strong><?php _e('Image Optimization Pro (Unlimited/domain)', 'wpvivid-backuprestore'); ?></strong></p>
|
1270 |
+
<p><strong><?php _e('Mulitsite Support', 'wpvivid-backuprestore'); ?></strong></p>
|
1271 |
+
<p><strong><?php _e('Staging Pro', 'wpvivid-backuprestore'); ?></strong></p>
|
1272 |
+
<p><strong><?php _e('White Label', 'wpvivid-backuprestore'); ?></strong></p>
|
1273 |
+
<p><strong><?php _e('Roles & Capabilities', 'wpvivid-backuprestore'); ?></strong></p>
|
1274 |
+
</td>
|
1275 |
+
<td style="text-align:center;">
|
1276 |
+
<p><span style="color: #81d742;"><?php _e('2 domains', 'wpvivid-backuprestore'); ?></span></p>
|
1277 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1278 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1279 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1280 |
+
<p><span style="height: 12px;width: 12px;background-color: #f1f1f1;border-radius: 50%;display: inline-block;"></span></p>
|
1281 |
+
<p><span style="height: 12px;width: 12px;background-color: #f1f1f1;border-radius: 50%;display: inline-block;"></span></p>
|
1282 |
+
<p><span style="height: 12px;width: 12px;background-color: #f1f1f1;border-radius: 50%;display: inline-block;"></span></p>
|
1283 |
+
</td>
|
1284 |
+
<td style="text-align:center;">
|
1285 |
+
<p><span style="color: #81d742;"><?php _e('Up to 10 domains', 'wpvivid-backuprestore'); ?></span></p>
|
1286 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1287 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1288 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1289 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1290 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1291 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1292 |
+
</td>
|
1293 |
+
<td style="text-align:center;">
|
1294 |
+
<p><span style="color: #81d742;"><?php _e('Up to 50 domains', 'wpvivid-backuprestore'); ?></span></p>
|
1295 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1296 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1297 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1298 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1299 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1300 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1301 |
+
</td>
|
1302 |
+
<td style="text-align:center;">
|
1303 |
+
<p><span style="color: #81d742;"><?php _e('Unlimited', 'wpvivid-backuprestore'); ?></span></p>
|
1304 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1305 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1306 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1307 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1308 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1309 |
+
<p><span style="height: 12px;width: 12px;background-color: #81d742;border-radius: 50%;display: inline-block;"></span></p>
|
1310 |
+
</td>
|
1311 |
+
</tr>
|
1312 |
+
</tbody>
|
1313 |
+
<tfoot>
|
1314 |
+
<tr>
|
1315 |
+
<th><?php _e('*No credit card needed. Trial starts with the Free Trial plan with 2 sites. You can choose a plan at the end of the trial.', 'wpvivid-backuprestore'); ?></th>
|
1316 |
+
<th colspan="4" style="text-align:center;"><p style="margin-top: 6px;"><a href="https://wpvivid.com/pricing" class="page-title-action"><?php _e('START 14-DAY FREE TRIAL', 'wpvivid-backuprestore'); ?></a></p></th>
|
1317 |
+
</tr>
|
1318 |
+
</tfoot>
|
1319 |
+
</table>
|
1320 |
+
</div>
|
1321 |
+
<?php
|
1322 |
+
}
|
1323 |
+
}
|
trunk/admin/css/wpvivid-admin-bar.css
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
#wpadminbar{
|
2 |
+
background-color: #ff8d00 !important;
|
3 |
+
}
|
tr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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* All of the CSS for your admin-specific functionality should be
|
3 |
+
* included in this file.
|
4 |
+
*/
|
5 |
+
|
6 |
+
.list-top-chip{float:left;display:block; vertical-align:middle; }
|
7 |
+
.list-top-chip::after{content:" "}
|
8 |
+
.backup-basic-info{min-width:100px; margin:10px; float:left;}
|
9 |
+
.quickbackup{width:calc(100% - 290px);float:left; box-sizing:border-box;margin-right:10px; padding:10px;}
|
10 |
+
.quickbackup label{display:inline-block;margin-bottom:10px;}
|
11 |
+
.qucikbackup-schedule{width:280px; float:left; box-sizing:border-box; min-width:280px;}
|
12 |
+
.quickstart-archive-block{width:33%;float:left; position:relative; box-sizing:border-box; }
|
13 |
+
.quickstart-storage-block{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box;}
|
14 |
+
.quickstart-btn{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box;}
|
15 |
+
.quickbackup-btn{display:block !important; margin:0 auto !important;width:150px;height:50px !important; line-height:48px !important; font-size:20px !important;}
|
16 |
+
.schedule-block{float:left;width:100%;padding:0 10px 10px 10px;box-sizing:border-box;}
|
17 |
+
.postbox:after{content: ".";display: block;height: 0;clear: both;visibility: hidden;}
|
18 |
+
.quickbackup-block .fieldset label{margin-bottom:5px;}
|
19 |
+
.custom-info{padding:10px;}
|
20 |
+
.quickstart-storage-setting{width:100%;float:left; padding-left:10px; box-sizing:border-box;background-color:#f1f1f1; margin-bottom:10px;}
|
21 |
+
.action-progress-bar{background-color:#f1f1f1 !important;margin:10px;color:#000;}
|
22 |
+
.action-progress-bar-percent{background-color:#0085ba !important;color:#fff;}
|
23 |
+
.storage-providers{float:left;padding:10px;cursor:pointer;}
|
24 |
+
.storage-providers:hover{background-color:#f1f1f1 !important; color:#fff !important;}
|
25 |
+
.storage-providers-active{background-color:#0085ba !important; color:#fff !important;}
|
26 |
+
.storage-account-block{padding:10px;}
|
27 |
+
.storage-account-button{margin:10px 10px 10px 0 !important;display:block !important; float:left;}
|
28 |
+
.schedule-tab-block{padding:10px;}
|
29 |
+
.schedule-tab-block input{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
30 |
+
.setting-tab-block{padding: 10px 10px 10px 0;}
|
31 |
+
.setting-tab-block input{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
32 |
+
.setting-page-content{padding-left:10px;}
|
33 |
+
.backup-log-btn{height:30px;float:left; margin-left:10px; margin-bottom:10px;}
|
34 |
+
@keyframes rotate { 0% { transform: rotate(0); } 100% { transform: rotate(359.9deg); } }
|
35 |
+
.wpvivid-backup-storage-list tr:hover,
|
36 |
+
.wpvivid-websiteinfo-list tr:hover,
|
37 |
+
.wpvivid-backuplist tr:hover,
|
38 |
+
.wpvivid-loglist tr:hover,
|
39 |
+
.wpvivid-remote-storage-list tr:hover {background-color: #f9f9f9;}
|
40 |
+
.restore_log{padding:10px; width:100%; height:500px; overflow:auto; box-sizing:border-box;}
|
41 |
+
.restore-button-position{margin:10px 10px 10px 0px; float:left;}
|
42 |
+
.restore-button-position input{margin-right:10px;}
|
43 |
+
.nav-tab.delete{display: block;overflow: hidden;position:relative;}
|
44 |
+
.nav-tab-delete-img{position: absolute;top: 0px;right: 3px;}
|
45 |
+
.button-secondary.log-page{background: #fff;color: #00a0d2;border: 1px solid #00a0d2;margin: 3px;}
|
46 |
+
.button-secondary.log-page:hover{color: #0b82a7;border: 1px solid #0b82a7;}
|
47 |
+
.button-secondary.log-page:focus{color: #00a0d2;border: 1px solid #00a0d2;}
|
48 |
+
.remote-storage-set-default-block{padding-top:10px;padding-left:10px;padding-right:10px;}
|
49 |
+
.remote-storage-set-default-block input{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
50 |
+
.remote-storage-ftp-passive-block,
|
51 |
+
.remote-storage-amazons3-storage-class,
|
52 |
+
.remote-storage-amazons3-encryption{padding-left:10px;}
|
53 |
+
.remote-storage-ftp-passive-block input,
|
54 |
+
.remote-storage-amazons3-storage-class input,
|
55 |
+
.remote-storage-amazons3-encryption input{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
56 |
+
.backup-list-head{}
|
57 |
+
.storage-account-form {padding-top: 1px; padding-bottom: 1px;}
|
58 |
+
.quicktransfer{width:100%; float:left; box-sizing:border-box;margin-right:10px; padding:10px;}
|
59 |
+
.quicktransfer label{display:inline-block;margin-bottom:10px;}
|
60 |
+
.quicktransfer-btn{display:block !important; margin:0 auto !important;width:220px;height:50px !important; line-height:48px !important; font-size:20px !important;}
|
61 |
+
.wpvivid-feature-pro{font-size:12px;border:1px solid #f1f1f1;padding:3px 5px;margin: 10px 10px 10px 0;border-radius:5px;}
|
62 |
+
@media screen and (max-width:1650px) {
|
63 |
+
.qucikbackup-schedule{
|
64 |
+
float:none;
|
65 |
+
width:100%;
|
66 |
+
}
|
67 |
+
.quickbackup{
|
68 |
+
float:none;
|
69 |
+
width:100%;
|
70 |
+
}
|
71 |
+
.export-import-block{
|
72 |
+
float:none;
|
73 |
+
width:100%;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
@media only screen and (max-width: 1350px){
|
77 |
+
#poststuff #post-body.columns-2 {
|
78 |
+
margin:0;
|
79 |
+
}
|
80 |
+
#wpbody-content #post-body.columns-2 #postbox-container-1 {
|
81 |
+
margin-right: 0;
|
82 |
+
width: 100%;
|
83 |
+
}
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
@media screen and (max-width:1315px) {
|
88 |
+
.quickstart-storage-block{
|
89 |
+
width:50%;
|
90 |
+
}
|
91 |
+
.quickstart-archive-block{
|
92 |
+
width:50%;
|
93 |
+
}
|
94 |
+
.quickstart-btn{
|
95 |
+
clear:both;
|
96 |
+
float:none;
|
97 |
+
width:100%;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
@media screen and (max-width:800px){
|
101 |
+
.tablelistcolumn{
|
102 |
+
display:block;
|
103 |
+
}
|
104 |
+
.backup-list-head{
|
105 |
+
display:none;
|
106 |
+
}
|
107 |
+
.backuptime{
|
108 |
+
font-size:16px;
|
109 |
+
}
|
110 |
+
.backuplist-delete-backup{
|
111 |
+
display:none;
|
112 |
+
}
|
113 |
+
.website-info-head{
|
114 |
+
display:none;
|
115 |
+
}
|
116 |
+
.log-head{
|
117 |
+
display:none;
|
118 |
+
}
|
119 |
+
.lafowef{
|
120 |
+
display:none;
|
121 |
+
}
|
122 |
+
.storage-account-form input{
|
123 |
+
width:360px;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
@media screen and (max-width:600px) {
|
127 |
+
.quickstart-storage-block{
|
128 |
+
float:none;
|
129 |
+
width:100%;
|
130 |
+
}
|
131 |
+
.quickstart-archive-block{
|
132 |
+
float:none;
|
133 |
+
width:100%;
|
134 |
+
}
|
135 |
+
.quickstart-btn{
|
136 |
+
float:none;
|
137 |
+
width:100%;
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
/* Popup container */
|
142 |
+
.wpvivid-popup {
|
143 |
+
position: relative;
|
144 |
+
display: inline-block;
|
145 |
+
cursor: pointer;
|
146 |
+
}
|
147 |
+
|
148 |
+
/* The actual popup (appears on top) */
|
149 |
+
.wpvivid-popup .wpvivid-popuptext {
|
150 |
+
visibility: hidden;
|
151 |
+
width: 220px;
|
152 |
+
background-color: #555;
|
153 |
+
color: #fff;
|
154 |
+
text-align: center;
|
155 |
+
border-radius: 6px;
|
156 |
+
padding: 8px 0;
|
157 |
+
position: absolute;
|
158 |
+
z-index: 1;
|
159 |
+
bottom: 75%;
|
160 |
+
margin-left: -80px;
|
161 |
+
}
|
162 |
+
|
163 |
+
/* Popup arrow */
|
164 |
+
.wpvivid-popup .wpvivid-popuptext::after {
|
165 |
+
content: "";
|
166 |
+
position: absolute;
|
167 |
+
top: 100%;
|
168 |
+
left: 50%;
|
169 |
+
margin-left: -5px;
|
170 |
+
border-width: 5px;
|
171 |
+
border-style: solid;
|
172 |
+
border-color: #555 transparent transparent transparent;
|
173 |
+
}
|
174 |
+
|
175 |
+
/* Toggle this class when clicking on the popup container (hide and show the popup) */
|
176 |
+
.wpvivid-popup .show {
|
177 |
+
visibility: visible;
|
178 |
+
-webkit-animation: fadeIn 1s;
|
179 |
+
animation: fadeIn 1s
|
180 |
+
}
|
181 |
+
|
182 |
+
.wpvivid-popup .hide {
|
183 |
+
visibility: hidden;
|
184 |
+
-webkit-animation: fadeIn 1s;
|
185 |
+
animation: fadeIn 1s
|
186 |
+
}
|
187 |
+
|
188 |
+
/* Add animation (fade in the popup) */
|
189 |
+
@-webkit-keyframes fadeIn {
|
190 |
+
from {opacity: 0;}
|
191 |
+
to {opacity: 1;}
|
192 |
+
}
|
193 |
+
|
194 |
+
@keyframes fadeIn {
|
195 |
+
from {opacity: 0;}
|
196 |
+
to {opacity:1 ;}
|
197 |
+
}
|
198 |
+
|
199 |
+
.wpvivid-storage-form{
|
200 |
+
margin-top:10px;
|
201 |
+
margin-bottom:5px;
|
202 |
+
}
|
203 |
+
|
204 |
+
.wpvivid-storage-select{
|
205 |
+
margin-top:10px;
|
206 |
+
margin-bottom:5px;
|
207 |
+
padding-bottom:8px;
|
208 |
+
padding-left:2px;
|
209 |
+
}
|
210 |
+
|
211 |
+
.wpvivid-storage-form input[type=text],
|
212 |
+
.wpvivid-storage-form input[type=password]{
|
213 |
+
width: 350px;
|
214 |
+
}
|
215 |
+
|
216 |
+
.wpvivid-storage-form-desc{
|
217 |
+
background-color:#f5f5f5;
|
218 |
+
margin-top:10px;
|
219 |
+
padding:4px 5px;
|
220 |
+
}
|
221 |
+
|
222 |
+
.wpvivid-debug-text-fix{
|
223 |
+
height: 28px;
|
224 |
+
line-height: 28px;
|
225 |
+
}
|
226 |
+
|
227 |
+
@media screen and (max-width: 782px) {
|
228 |
+
.wpvivid-debug-text-fix{
|
229 |
+
height: 36px;
|
230 |
+
line-height: 36px;
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
.wpvivid-text-space-bottom{margin-bottom: 5px;}
|
235 |
+
.wpvivid-text-space-right{margin-right: 5px;}
|
236 |
+
.wpvivid-element-space-bottom{margin-bottom: 10px;}
|
237 |
+
.wpvivid-element-space-right{margin-right: 10px;}
|
238 |
+
.wpvivid-export-type-provider{float: left; cursor: pointer; padding: 10px; height: 30px; line-height: 30px; border-right: 1px solid #e5e5e5;}
|
239 |
+
.wpvivid-export-type-provider:hover{background-color:#f1f1f1 !important;}
|
240 |
+
.wpvivid-export-type-provider-active{background-color:#0085ba !important;}
|
241 |
+
.wpvivid-import-log{padding:10px; width:100%; height:500px; overflow:auto; box-sizing:border-box;}
|
242 |
+
.import > tbody > :nth-child(odd) {background-color: #ffffff;}
|
243 |
+
.import > tbody tr:hover {background-color: #f9f9f9;}
|
244 |
+
.import .column-delete {width: 10%;}
|
245 |
+
.wpvivid-export-import-block span{margin: 0;}
|
246 |
+
.export-import-block{width:100%; box-sizing:border-box;margin-right:10px; padding:10px;}
|
247 |
+
.export-import-block label{display:inline-block;}
|
248 |
+
.export-import-block a{text-decoration: none;}
|
249 |
+
|
250 |
+
.quickbackup-addon{width:100%; box-sizing:border-box;margin-right:10px; padding:10px;}
|
251 |
+
.quickbackup-addon label{display:inline-block;}
|
252 |
+
@media screen and (max-width:1650px) {
|
253 |
+
.quickbackup-addon{
|
254 |
+
float:none;
|
255 |
+
width:100%;
|
256 |
+
}
|
257 |
+
}
|
258 |
+
.quickbackup-addon a{
|
259 |
+
text-decoration: none;
|
260 |
+
}
|
261 |
+
|
262 |
+
.wpvivid-backup-tips{
|
263 |
+
float:left;
|
264 |
+
width:100%;
|
265 |
+
background-color:#f1f1f1;
|
266 |
+
}
|
trunk/admin/css/wpvivid-staging-custom.css
ADDED
@@ -0,0 +1,1614 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.quickbackup-addon{width:100%; box-sizing:border-box;margin-right:10px; padding:10px;}
|
2 |
+
.quickbackup-addon label{display:inline-block;}
|
3 |
+
|
4 |
+
.quickstaging{width:100%;float:left; box-sizing:border-box;margin-right:10px; padding:10px;}
|
5 |
+
.quickstaging label{display:inline-block;margin-bottom:10px;}
|
6 |
+
|
7 |
+
.wpvivid-custom-setting-save{margin: 10px 0 10px 0 !important;display: block !important;float: left;}
|
8 |
+
|
9 |
+
.wpvivid-custom-td-border{border-left: 0;}
|
10 |
+
.wpvivid-custom-backup-detail-odd{margin: 5px 20px 15px 40px;}
|
11 |
+
.wpvivid-custom-backup-detail-even{background: #f7fcfe; border-left: 4px solid #f7fcfe;}
|
12 |
+
|
13 |
+
.wpvivid-custom-database-table-list tbody {
|
14 |
+
display:block;
|
15 |
+
max-height:200px;
|
16 |
+
overflow-y:auto;
|
17 |
+
padding: 0;
|
18 |
+
}
|
19 |
+
.wpvivid-custom-database-table-list thead{
|
20 |
+
display:table;
|
21 |
+
width:100%;
|
22 |
+
}
|
23 |
+
|
24 |
+
.wpvivid-custom-database-table-list tbody tr {
|
25 |
+
display:table;
|
26 |
+
width:100%;
|
27 |
+
table-layout:fixed;
|
28 |
+
}
|
29 |
+
|
30 |
+
.wpvivid-schedule-time-select-addon,
|
31 |
+
.wpvivid-schedule-type-select-addon,
|
32 |
+
.wpvivid-schedule-remote-select-addon,
|
33 |
+
.wpvivid-schedule-create-addon{
|
34 |
+
float: left;
|
35 |
+
padding: 0 10px 10px 10px;
|
36 |
+
}
|
37 |
+
|
38 |
+
/* Popup container */
|
39 |
+
.wpvivid-custom-popup {
|
40 |
+
width: 100%;
|
41 |
+
position: relative;
|
42 |
+
display: inline-block;
|
43 |
+
//cursor: pointer;
|
44 |
+
}
|
45 |
+
|
46 |
+
.wpvivid-custom-popup .wpvivid-custom-popuptext {
|
47 |
+
visibility: hidden;
|
48 |
+
//width: 220px;
|
49 |
+
//background-color: #555;
|
50 |
+
//color: #fff;
|
51 |
+
//text-align: center;
|
52 |
+
border-radius: 6px;
|
53 |
+
padding: 8px 0;
|
54 |
+
//position: absolute;
|
55 |
+
z-index: 1;
|
56 |
+
bottom: 75%;
|
57 |
+
//margin-left: -80px;
|
58 |
+
}
|
59 |
+
|
60 |
+
/* Popup arrow */
|
61 |
+
.wpvivid-custom-popup .wpvivid-custom-popuptext::before {
|
62 |
+
/*content: "\25B2";
|
63 |
+
position: absolute;
|
64 |
+
//top: 100%;
|
65 |
+
bottom: 95%;
|
66 |
+
left: 20%;
|
67 |
+
background-color: #555;
|
68 |
+
margin-left: -5px;
|
69 |
+
border-width: 5px;
|
70 |
+
border-style: solid;
|
71 |
+
border-color: #555 transparent transparent transparent;*/
|
72 |
+
}
|
73 |
+
|
74 |
+
/* Toggle this class when clicking on the popup container (hide and show the popup) */
|
75 |
+
.wpvivid-custom-popup .show {
|
76 |
+
visibility: visible;
|
77 |
+
-webkit-animation: fadeIn 1s;
|
78 |
+
animation: fadeIn 1s
|
79 |
+
}
|
80 |
+
|
81 |
+
.wpvivid-custom-popup .hide {
|
82 |
+
visibility: hidden;
|
83 |
+
-webkit-animation: fadeIn 1s;
|
84 |
+
animation: fadeIn 1s
|
85 |
+
}
|
86 |
+
|
87 |
+
.wpvivid-custom-tree-contain{
|
88 |
+
width: 100%;
|
89 |
+
height: 300px;
|
90 |
+
border:1px dotted;
|
91 |
+
overflow: auto;
|
92 |
+
}
|
93 |
+
|
94 |
+
#wpvivid_custom_backup_tree .jstree-container-ul > .jstree-node {
|
95 |
+
background: transparent;
|
96 |
+
}
|
97 |
+
|
98 |
+
@media screen and (max-width:1650px) {
|
99 |
+
.quickbackup-addon{
|
100 |
+
float:none;
|
101 |
+
width:100%;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
@media screen and (min-width:1600px) {
|
106 |
+
.wpvivid-pro-list{
|
107 |
+
width: calc(50% - 8px) !important;
|
108 |
+
}
|
109 |
+
.wpvivid-pro-list:nth-child(even){
|
110 |
+
margin-right: 0 !important;
|
111 |
+
}
|
112 |
+
.wpvivid-pro-list:nth-child(odd){
|
113 |
+
margin-left: 0 !important;
|
114 |
+
}
|
115 |
+
.wpvivid-pro-list:nth-child(3n){
|
116 |
+
|
117 |
+
}
|
118 |
+
.wpvivid-pro-list:nth-child(3n+1){
|
119 |
+
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
.wpvivid-custom-table-tr-expand{
|
124 |
+
background:#f1f1f1;
|
125 |
+
}
|
126 |
+
|
127 |
+
.wpvivid-custom-table-td-expand{
|
128 |
+
font-weight:bold;
|
129 |
+
}
|
130 |
+
|
131 |
+
.wpvivid-custom-table{
|
132 |
+
width: 100%;
|
133 |
+
}
|
134 |
+
|
135 |
+
.wpvivid-custom-database-wp-table-header{
|
136 |
+
height:30px;
|
137 |
+
border-left:4px solid #00a0d2;
|
138 |
+
padding-left:5px;
|
139 |
+
padding-top:5px;
|
140 |
+
background-color:#f5f5f5;
|
141 |
+
}
|
142 |
+
|
143 |
+
.wpvivid-custom-database-other-table-header{
|
144 |
+
height:30px;
|
145 |
+
border-left:4px solid #00a0d2;
|
146 |
+
padding-left:5px;
|
147 |
+
padding-top:5px;
|
148 |
+
background-color:#f5f5f5;
|
149 |
+
margin-top: 5px;
|
150 |
+
}
|
151 |
+
|
152 |
+
.wpvivid-custom-database-table-column{
|
153 |
+
width:32%;
|
154 |
+
float:left;
|
155 |
+
}
|
156 |
+
|
157 |
+
@media screen and (min-width: 1921px) {
|
158 |
+
.wpvivid-custom-database-table-column{
|
159 |
+
width:24%;
|
160 |
+
float:left;
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
@media screen and (max-width: 1920px) {
|
165 |
+
.wpvivid-custom-database-table-column{
|
166 |
+
width:24%;
|
167 |
+
float:left;
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
@media screen and (max-width: 1550px) {
|
172 |
+
.wpvivid-custom-database-table-column{
|
173 |
+
width:32%;
|
174 |
+
float:left;
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
@media screen and (max-width: 1200px) {
|
179 |
+
.wpvivid-custom-database-table-column{
|
180 |
+
width:49%;
|
181 |
+
float:left;
|
182 |
+
}
|
183 |
+
.wpvivid-database-table-addon{
|
184 |
+
padding-top: 5px;
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
@media screen and (max-width: 790px) {
|
189 |
+
.wpvivid-custom-database-table-column{
|
190 |
+
width:99%;
|
191 |
+
float:left;
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
.wpvivid-custom-uploads-left{
|
196 |
+
width:30%;
|
197 |
+
overflow:auto;
|
198 |
+
}
|
199 |
+
|
200 |
+
.wpvivid-custom-uploads-right{
|
201 |
+
width:70%;
|
202 |
+
padding: 5px;
|
203 |
+
}
|
204 |
+
|
205 |
+
.wpvivid-custom-uploads-tree{
|
206 |
+
width: 100%;
|
207 |
+
height: 250px;
|
208 |
+
max-height: 250px;
|
209 |
+
overflow-y: auto;
|
210 |
+
}
|
211 |
+
|
212 |
+
.wpvivid-export-download-list,
|
213 |
+
.wpvivid-custom-uploads-table{
|
214 |
+
width: 100%;
|
215 |
+
height: 250px;
|
216 |
+
overflow: auto;
|
217 |
+
}
|
218 |
+
|
219 |
+
.wpvivid-export-download-list ul:nth-of-type(odd) {background:#f1f1f1;}
|
220 |
+
.wpvivid-export-download-list ul:nth-of-type(even) {}
|
221 |
+
.wpvivid-export-download-list ul,
|
222 |
+
.wpvivid-export-download-list ul li{
|
223 |
+
width: 100%;
|
224 |
+
height: 24px;
|
225 |
+
margin: 0;
|
226 |
+
}
|
227 |
+
|
228 |
+
.wpvivid-custom-uploads-table ul:nth-of-type(odd) {background:#f1f1f1;}
|
229 |
+
.wpvivid-custom-uploads-table ul:nth-of-type(even) {}
|
230 |
+
|
231 |
+
.wpvivid-custom-uploads-table ul,
|
232 |
+
.wpvivid-custom-uploads-table ul li{
|
233 |
+
width: 100%;
|
234 |
+
height: 24px;
|
235 |
+
margin: 0;
|
236 |
+
}
|
237 |
+
|
238 |
+
.wpvivid-custom-uploads-table .wpvivid-custom-table-li-left{
|
239 |
+
width: 98%;
|
240 |
+
margin: 0;
|
241 |
+
float :left;
|
242 |
+
overflow: hidden;
|
243 |
+
text-overflow: ellipsis;
|
244 |
+
white-space: nowrap;
|
245 |
+
}
|
246 |
+
|
247 |
+
.wpvivid-custom-uploads-table .wpvivid-custom-table-li-right{
|
248 |
+
width: 2%;
|
249 |
+
margin: 0;
|
250 |
+
float :left;
|
251 |
+
}
|
252 |
+
|
253 |
+
.wpvivid-custom-uploads-table-body{
|
254 |
+
width:100%;
|
255 |
+
float:left;
|
256 |
+
}
|
257 |
+
|
258 |
+
.wpvivid-custom-li-folder-icon{
|
259 |
+
background: url("../js/jstree/dist/themes/default/32px.png") -260px -4px no-repeat;
|
260 |
+
width: 24px;
|
261 |
+
height: 24px;
|
262 |
+
line-height: 24px;
|
263 |
+
margin: 0 4px 0 4px;
|
264 |
+
float: left;
|
265 |
+
}
|
266 |
+
|
267 |
+
.wpvivid-custom-li-file-icon{
|
268 |
+
background: url("../js/jstree/dist/themes/default/32px.png") -100px -68px no-repeat;
|
269 |
+
width: 24px;
|
270 |
+
height: 24px;
|
271 |
+
line-height: 24px;
|
272 |
+
margin: 0 4px 0 4px;
|
273 |
+
float: left;
|
274 |
+
}
|
275 |
+
|
276 |
+
.wpvivid-custom-li-font{
|
277 |
+
height: 24px;
|
278 |
+
line-height: 24px;
|
279 |
+
margin: 0;
|
280 |
+
float: left;
|
281 |
+
}
|
282 |
+
|
283 |
+
.wpvivid-custom-li-close{
|
284 |
+
height: 24px;
|
285 |
+
line-height: 24px;
|
286 |
+
margin: 0 10px 0 0;
|
287 |
+
float: right;
|
288 |
+
}
|
289 |
+
|
290 |
+
.wpvivid-custom-li-database-extra-left{
|
291 |
+
height: 24px;
|
292 |
+
line-height: 24px;
|
293 |
+
margin: 0 0 0 10px;
|
294 |
+
float: left;
|
295 |
+
}
|
296 |
+
|
297 |
+
.wpvivid-custom-li-database-extra-right{
|
298 |
+
height: 24px;
|
299 |
+
line-height: 24px;
|
300 |
+
margin: 0 10px 0 0;
|
301 |
+
float: right;
|
302 |
+
}
|
303 |
+
|
304 |
+
.wpvivid-custom-uploads-table-body-left{
|
305 |
+
float:left;
|
306 |
+
}
|
307 |
+
|
308 |
+
.wpvivid-custom-uploads-table-body-right{
|
309 |
+
float:right;
|
310 |
+
}
|
311 |
+
|
312 |
+
.wpvivid-backup-to-font{
|
313 |
+
font-weight:bold;
|
314 |
+
}
|
315 |
+
|
316 |
+
.wpvivid-backup-now-space{
|
317 |
+
padding-top:10px;
|
318 |
+
}
|
319 |
+
|
320 |
+
.wpvivid-backup-now-size{
|
321 |
+
width:200px;
|
322 |
+
height:50px;
|
323 |
+
font-size:20px;
|
324 |
+
}
|
325 |
+
|
326 |
+
.wpvivid-backup-tips{
|
327 |
+
float:left;
|
328 |
+
width:100%;
|
329 |
+
background-color:#f1f1f1;
|
330 |
+
}
|
331 |
+
|
332 |
+
.wpvivid-backup-to-remote{
|
333 |
+
padding-left:20px;
|
334 |
+
margin-top:5px;
|
335 |
+
margin-bottom:10px;
|
336 |
+
border-left:4px solid #00a0d2;
|
337 |
+
}
|
338 |
+
|
339 |
+
div.wpvivid-note{
|
340 |
+
|
341 |
+
-moz-border-radius: 6px;
|
342 |
+
-webkit-border-radius: 6px;
|
343 |
+
background-color: #f5f5f5;
|
344 |
+
background-image: url(../Images/icons/Pencil-48.png);
|
345 |
+
background-position: 9px 0px;
|
346 |
+
background-repeat: no-repeat;
|
347 |
+
border: solid 1px #eee;
|
348 |
+
border-radius: 6px;
|
349 |
+
line-height: 18px;
|
350 |
+
overflow: hidden;
|
351 |
+
padding: 15px 60px;
|
352 |
+
margin:10px 15px 10px 15px;
|
353 |
+
}
|
354 |
+
|
355 |
+
.wpvivid_tooltip {
|
356 |
+
position: relative;
|
357 |
+
width:12px;
|
358 |
+
height:12px;
|
359 |
+
border:1px solid #0073aa;
|
360 |
+
background-color:#0073aa;
|
361 |
+
color:#fff;
|
362 |
+
text-align:center;
|
363 |
+
vertical-align:middle;
|
364 |
+
border-radius:12px;
|
365 |
+
}
|
366 |
+
.wpvivid_tooltiptext a{
|
367 |
+
color: #aa0000;
|
368 |
+
}
|
369 |
+
.wpvivid_tooltip .wpvivid_tooltiptext {
|
370 |
+
visibility: hidden;
|
371 |
+
width: 250px;
|
372 |
+
background-color: #0085ba;
|
373 |
+
color: #fff;
|
374 |
+
text-align: center;
|
375 |
+
border-radius: 6px;
|
376 |
+
padding: 5px;
|
377 |
+
|
378 |
+
/* Position the tooltip */
|
379 |
+
position: absolute;
|
380 |
+
z-index: 1;
|
381 |
+
bottom: 20px;
|
382 |
+
left: 50%;
|
383 |
+
margin-left: -125px; /* Use half of the width (120/2 = 60), to center the tooltip */
|
384 |
+
box-sizing: border-box;
|
385 |
+
}
|
386 |
+
|
387 |
+
.wpvivid_tooltip:hover .wpvivid_tooltiptext {
|
388 |
+
visibility: visible;
|
389 |
+
}
|
390 |
+
.wpvivid_tooltip .wpvivid_tooltiptext::after {
|
391 |
+
content: " ";
|
392 |
+
position: absolute;
|
393 |
+
top: 100%; /* At the bottom of the tooltip */
|
394 |
+
left: 50%;
|
395 |
+
margin-left: -5px;
|
396 |
+
border-width: 5px;
|
397 |
+
border-style: solid;
|
398 |
+
border-color:#0085ba transparent transparent transparent;
|
399 |
+
box-sizing: border-box;
|
400 |
+
}
|
401 |
+
.wpvivid_click_popup{
|
402 |
+
background-color:#f7f7f7;
|
403 |
+
float:left;
|
404 |
+
width:100%;
|
405 |
+
border-radius: 6px;
|
406 |
+
padding:10px;
|
407 |
+
box-sizing:border-box;
|
408 |
+
}
|
409 |
+
|
410 |
+
.quickbackup-addon a{
|
411 |
+
text-decoration: none;
|
412 |
+
}
|
413 |
+
|
414 |
+
.wpvivid-intab-addon .nav-tab-active,
|
415 |
+
.wpvivid-intab-addon .nav-tab-active:focus,
|
416 |
+
.wpvivid-intab-addon .nav-tab-active:focus:active,
|
417 |
+
.wpvivid-intab-addon .nav-tab-active:hover{
|
418 |
+
border-bottom: 1px solid #ffffff;
|
419 |
+
}
|
420 |
+
|
421 |
+
.wpvivid-schedule-fix,
|
422 |
+
.wpvivid-debug-text-fix,
|
423 |
+
.wpvivid-setting-text-fix{
|
424 |
+
height: 28px;
|
425 |
+
line-height: 28px;
|
426 |
+
}
|
427 |
+
|
428 |
+
@media screen and (max-width: 782px) {
|
429 |
+
.wpvivid-tooltip-fix{
|
430 |
+
margin-top: 15px !important;
|
431 |
+
}
|
432 |
+
.wpvivid-schedule-fix,
|
433 |
+
.wpvivid-debug-text-fix,
|
434 |
+
.wpvivid-setting-text-fix{
|
435 |
+
height: 36px;
|
436 |
+
line-height: 36px;
|
437 |
+
}
|
438 |
+
}
|
439 |
+
|
440 |
+
.wpvivid-text-space-bottom{margin-bottom: 5px;}
|
441 |
+
.wpvivid-text-space-right{margin-right: 5px;}
|
442 |
+
.wpvivid-element-space-bottom{margin-bottom: 10px;}
|
443 |
+
.wpvivid-element-space-right{margin-right: 10px;}
|
444 |
+
.wpvivid-restore-log-addon{padding: 10px;width: 100%;height: 500px;overflow: auto;box-sizing: border-box; border-top: none; border-color: #ccc;}
|
445 |
+
.wpvivid-custom-tree ul{margin: 0 !important;}
|
446 |
+
.wpvivid-staging-log{padding:10px; width:100%; height:300px; overflow:auto; box-sizing:border-box;}
|
447 |
+
|
448 |
+
.wpvivid-refresh-tree:hover{
|
449 |
+
background: #0085ba;
|
450 |
+
border-color: #0073aa #006799 #006799;
|
451 |
+
box-shadow: 0 1px 0 #006799;
|
452 |
+
color: #fff;
|
453 |
+
text-decoration: none;
|
454 |
+
text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
|
455 |
+
padding: 0 2px;
|
456 |
+
border-radius: 3px;
|
457 |
+
}
|
458 |
+
|
459 |
+
.wpvivid-setting-addon input{
|
460 |
+
margin: 0 4px 0 0;
|
461 |
+
}
|
462 |
+
|
463 |
+
.wpvivid-pro-update{
|
464 |
+
display: inline-block;
|
465 |
+
vertical-align: top;
|
466 |
+
box-sizing: border-box;
|
467 |
+
margin: 3px 0 0 2px;
|
468 |
+
padding: 0 0 0 8px;
|
469 |
+
min-width: 18px;
|
470 |
+
height: 18px;
|
471 |
+
border-radius: 9px;
|
472 |
+
background-color: #ca4a1f;
|
473 |
+
color: #fff;
|
474 |
+
font-size: 11px;
|
475 |
+
line-height: 1.6;
|
476 |
+
text-align: center;
|
477 |
+
z-index: 26;
|
478 |
+
}
|
479 |
+
|
480 |
+
.schedule-active
|
481 |
+
{
|
482 |
+
background-color: #90ee90;
|
483 |
+
}
|
484 |
+
|
485 |
+
.wpvivid-transparency-tab,
|
486 |
+
.wpvivid-transparency-tab:hover,
|
487 |
+
.wpvivid-transparency-tab:focus,
|
488 |
+
.wpvivid-transparency-tab:focus:active{
|
489 |
+
background: #ffffff;
|
490 |
+
}
|
491 |
+
.column-wpvivid_role_name { width:25% }
|
492 |
+
.column-wpvivid_role { width:8% }
|
493 |
+
.column-wpvivid_role_edit { width:8% }
|
494 |
+
|
495 |
+
.wpvivid-local-remote-backup-list span{margin: 0;}
|
496 |
+
.wpvivid-schedule-list span{margin: 0;}
|
497 |
+
.wpvivid-log-list span{margin: 0;}
|
498 |
+
|
499 |
+
.wpvivid-upload-tr{border: 2px solid #006799; box-sizing:border-box; -moz-box-sizing:border-box; -webkit-box-sizing:border-box;}
|
500 |
+
.wpvivid-backup-list{border-collapse: collapse;}
|
501 |
+
.wpvivid-list-td-center{text-align: center!important;}
|
502 |
+
.wpvivid-backup-option-box{width:100%; border:1px solid #f1f1f1; float:left; padding:10px 10px 0 10px; box-sizing: border-box; margin-top: 10px;}
|
503 |
+
|
504 |
+
.wpvivid-tree-dashicons{
|
505 |
+
padding: 0 !important;
|
506 |
+
width: auto !important;
|
507 |
+
height: auto !important;
|
508 |
+
}
|
509 |
+
|
510 |
+
.wpvivid-tree-dashicons:before{
|
511 |
+
padding: 0 !important;
|
512 |
+
background-color: #007cba !important;
|
513 |
+
font-size: 20px !important;
|
514 |
+
color: #fff !important;
|
515 |
+
}
|
516 |
+
|
517 |
+
/**
|
518 |
+
* All of the CSS for your admin-specific functionality should be
|
519 |
+
* included in this file.
|
520 |
+
*/
|
521 |
+
|
522 |
+
.list-top-chip{float:left;display:block; vertical-align:middle; }
|
523 |
+
.list-top-chip::after{content:" "}
|
524 |
+
.backup-basic-info{min-width:100px; margin:10px; float:left;}
|
525 |
+
.quickbackup{width:calc(100% - 290px);float:left; box-sizing:border-box;margin-right:10px; padding:10px;}
|
526 |
+
.quickbackup label{display:inline-block;margin-bottom:10px;}
|
527 |
+
.qucikbackup-schedule{width:280px; float:left; box-sizing:border-box; min-width:280px;}
|
528 |
+
.quickstart-archive-block{width:33%;float:left; position:relative; box-sizing:border-box; }
|
529 |
+
.quickstart-storage-block{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box;}
|
530 |
+
.quickstart-btn{width:33%;padding:10px; float:left; position:relative; box-sizing:border-box;}
|
531 |
+
.quickbackup-btn{display:block !important; margin:0 auto !important;width:150px;height:50px !important; line-height:48px !important; font-size:20px !important;}
|
532 |
+
.schedule-block{float:left;width:100%;padding:0 10px 10px 10px;box-sizing:border-box;}
|
533 |
+
.postbox:after{content: ".";display: block;height: 0;clear: both;visibility: hidden;}
|
534 |
+
.quickbackup-block .fieldset label{margin-bottom:5px;}
|
535 |
+
.custom-info{padding:10px;}
|
536 |
+
.quickstart-storage-setting{width:100%;float:left; padding-left:10px; box-sizing:border-box;background-color:#f1f1f1; margin-bottom:10px;}
|
537 |
+
.action-progress-bar{background-color:#f1f1f1 !important;margin:10px;color:#000;}
|
538 |
+
.action-progress-bar-percent{background-color:#0085ba !important;color:#fff;}
|
539 |
+
.storage-providers{float:left;padding:10px;cursor:pointer;}
|
540 |
+
.storage-providers:hover{background-color:#f1f1f1 !important; color:#fff !important;}
|
541 |
+
.storage-providers-active{background-color:#0085ba !important; color:#fff !important;}
|
542 |
+
.storage-account-block{padding:10px;}
|
543 |
+
.storage-account-button{margin:10px 10px 10px 0 !important;display:block !important; float:left;}
|
544 |
+
.schedule-tab-block{padding:10px;}
|
545 |
+
.schedule-tab-block input{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
546 |
+
.setting-tab-block{padding: 10px 10px 10px 0;}
|
547 |
+
.setting-tab-block input{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
548 |
+
.setting-page-content{padding-left:10px;}
|
549 |
+
.backup-log-btn{height:30px;float:left; margin-left:10px; margin-bottom:10px;}
|
550 |
+
@keyframes rotate { 0% { transform: rotate(0); } 100% { transform: rotate(359.9deg); } }
|
551 |
+
.wpvivid-backup-storage-list tr:hover,
|
552 |
+
.wpvivid-websiteinfo-list tr:hover,
|
553 |
+
.wpvivid-backuplist tr:hover,
|
554 |
+
.wpvivid-loglist tr:hover,
|
555 |
+
.wpvivid-remote-storage-list tr:hover {background-color: #f9f9f9;}
|
556 |
+
.restore_log{padding:10px; width:100%; height:500px; overflow:auto; box-sizing:border-box;}
|
557 |
+
.restore-button-position{margin:10px 10px 10px 0px; float:left;}
|
558 |
+
.restore-button-position input{margin-right:10px;}
|
559 |
+
.nav-tab.delete{display: block;overflow: hidden;position:relative;}
|
560 |
+
.nav-tab-delete-img{position: absolute;top: 0px;right: 3px;}
|
561 |
+
.button-secondary.log-page{background: #fff;color: #00a0d2;border: 1px solid #00a0d2;margin: 3px;}
|
562 |
+
.button-secondary.log-page:hover{color: #0b82a7;border: 1px solid #0b82a7;}
|
563 |
+
.button-secondary.log-page:focus{color: #00a0d2;border: 1px solid #00a0d2;}
|
564 |
+
.remote-storage-set-default-block{padding-top:10px;padding-left:10px;padding-right:10px;}
|
565 |
+
.remote-storage-set-default-block input{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
566 |
+
.remote-storage-ftp-passive-block,
|
567 |
+
.remote-storage-amazons3-storage-class,
|
568 |
+
.remote-storage-amazons3-encryption{padding-left:10px;}
|
569 |
+
.remote-storage-ftp-passive-block input,
|
570 |
+
.remote-storage-amazons3-storage-class input,
|
571 |
+
.remote-storage-amazons3-encryption input{display:line-block; margin-top:10px; margin-bottom:10px;margin-right:10px;}
|
572 |
+
.backup-list-head{}
|
573 |
+
.storage-account-form {padding-top: 1px; padding-bottom: 1px;}
|
574 |
+
.quicktransfer{width:100%; float:left; box-sizing:border-box;margin-right:10px; padding:10px;}
|
575 |
+
.quicktransfer label{display:inline-block;margin-bottom:10px;}
|
576 |
+
.quicktransfer-btn{display:block !important; margin:0 auto !important;width:220px;height:50px !important; line-height:48px !important; font-size:20px !important;}
|
577 |
+
.wpvivid-feature-pro{font-size:12px;border:1px solid #f1f1f1;padding:3px 5px;margin: 10px 10px 10px 0;border-radius:5px;}
|
578 |
+
@media screen and (max-width:1650px) {
|
579 |
+
.qucikbackup-schedule{
|
580 |
+
float:none;
|
581 |
+
width:100%;
|
582 |
+
}
|
583 |
+
.quickbackup{
|
584 |
+
float:none;
|
585 |
+
width:100%;
|
586 |
+
}
|
587 |
+
.export-import-block{
|
588 |
+
float:none;
|
589 |
+
width:100%;
|
590 |
+
}
|
591 |
+
}
|
592 |
+
@media only screen and (max-width: 1350px){
|
593 |
+
#poststuff #post-body.columns-2 {
|
594 |
+
margin:0;
|
595 |
+
}
|
596 |
+
#wpbody-content #post-body.columns-2 #postbox-container-1 {
|
597 |
+
margin-right: 0;
|
598 |
+
width: 100%;
|
599 |
+
}
|
600 |
+
|
601 |
+
}
|
602 |
+
|
603 |
+
@media screen and (max-width:1315px) {
|
604 |
+
.quickstart-storage-block{
|
605 |
+
width:50%;
|
606 |
+
}
|
607 |
+
.quickstart-archive-block{
|
608 |
+
width:50%;
|
609 |
+
}
|
610 |
+
.quickstart-btn{
|
611 |
+
clear:both;
|
612 |
+
float:none;
|
613 |
+
width:100%;
|
614 |
+
}
|
615 |
+
}
|
616 |
+
@media screen and (max-width:800px){
|
617 |
+
.tablelistcolumn{
|
618 |
+
display:block;
|
619 |
+
}
|
620 |
+
.backup-list-head{
|
621 |
+
display:none;
|
622 |
+
}
|
623 |
+
.backuptime{
|
624 |
+
font-size:16px;
|
625 |
+
}
|
626 |
+
.backuplist-delete-backup{
|
627 |
+
display:none;
|
628 |
+
}
|
629 |
+
.website-info-head{
|
630 |
+
display:none;
|
631 |
+
}
|
632 |
+
.log-head{
|
633 |
+
display:none;
|
634 |
+
}
|
635 |
+
.lafowef{
|
636 |
+
display:none;
|
637 |
+
}
|
638 |
+
.storage-account-form input{
|
639 |
+
width:360px;
|
640 |
+
}
|
641 |
+
}
|
642 |
+
@media screen and (max-width:600px) {
|
643 |
+
.quickstart-storage-block{
|
644 |
+
float:none;
|
645 |
+
width:100%;
|
646 |
+
}
|
647 |
+
.quickstart-archive-block{
|
648 |
+
float:none;
|
649 |
+
width:100%;
|
650 |
+
}
|
651 |
+
.quickstart-btn{
|
652 |
+
float:none;
|
653 |
+
width:100%;
|
654 |
+
}
|
655 |
+
}
|
656 |
+
|
657 |
+
/* Popup container */
|
658 |
+
.wpvivid-popup {
|
659 |
+
position: relative;
|
660 |
+
display: inline-block;
|
661 |
+
cursor: pointer;
|
662 |
+
}
|
663 |
+
|
664 |
+
/* The actual popup (appears on top) */
|
665 |
+
.wpvivid-popup .wpvivid-popuptext {
|
666 |
+
visibility: hidden;
|
667 |
+
width: 220px;
|
668 |
+
background-color: #555;
|
669 |
+
color: #fff;
|
670 |
+
text-align: center;
|
671 |
+
border-radius: 6px;
|
672 |
+
padding: 8px 0;
|
673 |
+
position: absolute;
|
674 |
+
z-index: 1;
|
675 |
+
bottom: 75%;
|
676 |
+
margin-left: -80px;
|
677 |
+
}
|
678 |
+
|
679 |
+
/* Popup arrow */
|
680 |
+
.wpvivid-popup .wpvivid-popuptext::after {
|
681 |
+
content: "";
|
682 |
+
position: absolute;
|
683 |
+
top: 100%;
|
684 |
+
left: 50%;
|
685 |
+
margin-left: -5px;
|
686 |
+
border-width: 5px;
|
687 |
+
border-style: solid;
|
688 |
+
border-color: #555 transparent transparent transparent;
|
689 |
+
}
|
690 |
+
|
691 |
+
/* Toggle this class when clicking on the popup container (hide and show the popup) */
|
692 |
+
.wpvivid-popup .show {
|
693 |
+
visibility: visible;
|
694 |
+
-webkit-animation: fadeIn 1s;
|
695 |
+
animation: fadeIn 1s
|
696 |
+
}
|
697 |
+
|
698 |
+
.wpvivid-popup .hide {
|
699 |
+
visibility: hidden;
|
700 |
+
-webkit-animation: fadeIn 1s;
|
701 |
+
animation: fadeIn 1s
|
702 |
+
}
|
703 |
+
|
704 |
+
/* Add animation (fade in the popup) */
|
705 |
+
@-webkit-keyframes fadeIn {
|
706 |
+
from {opacity: 0;}
|
707 |
+
to {opacity: 1;}
|
708 |
+
}
|
709 |
+
|
710 |
+
@keyframes fadeIn {
|
711 |
+
from {opacity: 0;}
|
712 |
+
to {opacity:1 ;}
|
713 |
+
}
|
714 |
+
|
715 |
+
.wpvivid-storage-form{
|
716 |
+
margin-top:10px;
|
717 |
+
margin-bottom:5px;
|
718 |
+
}
|
719 |
+
|
720 |
+
.wpvivid-storage-select{
|
721 |
+
margin-top:10px;
|
722 |
+
margin-bottom:5px;
|
723 |
+
padding-bottom:8px;
|
724 |
+
padding-left:2px;
|
725 |
+
}
|
726 |
+
|
727 |
+
.wpvivid-storage-form input[type=text],
|
728 |
+
.wpvivid-storage-form input[type=password]{
|
729 |
+
width: 350px;
|
730 |
+
}
|
731 |
+
|
732 |
+
.wpvivid-storage-form-desc{
|
733 |
+
background-color:#f5f5f5;
|
734 |
+
margin-top:10px;
|
735 |
+
padding:4px 5px;
|
736 |
+
}
|
737 |
+
|
738 |
+
.wpvivid-debug-text-fix{
|
739 |
+
height: 28px;
|
740 |
+
line-height: 28px;
|
741 |
+
}
|
742 |
+
|
743 |
+
@media screen and (max-width: 782px) {
|
744 |
+
.wpvivid-debug-text-fix{
|
745 |
+
height: 36px;
|
746 |
+
line-height: 36px;
|
747 |
+
}
|
748 |
+
}
|
749 |
+
|
750 |
+
.wpvivid-text-space-bottom{margin-bottom: 5px;}
|
751 |
+
.wpvivid-text-space-right{margin-right: 5px;}
|
752 |
+
.wpvivid-element-space-bottom{margin-bottom: 10px;}
|
753 |
+
.wpvivid-element-space-right{margin-right: 10px;}
|
754 |
+
.wpvivid-export-type-provider{float: left; cursor: pointer; padding: 10px; height: 30px; line-height: 30px; border-right: 1px solid #e5e5e5;}
|
755 |
+
.wpvivid-export-type-provider:hover{background-color:#f1f1f1 !important; color:#fff !important;}
|
756 |
+
.wpvivid-export-type-provider-active{background-color:#0085ba !important; color:#fff !important;}
|
757 |
+
.wpvivid-import-log{padding:10px; width:100%; height:500px; overflow:auto; box-sizing:border-box;}
|
758 |
+
.import > tbody > :nth-child(odd) {background-color: #ffffff;}
|
759 |
+
.import > tbody tr:hover {background-color: #f9f9f9;}
|
760 |
+
.import .column-delete {width: 10%;}
|
761 |
+
.wpvivid-export-import-block span{margin: 0;}
|
762 |
+
.export-import-block{width:100%; box-sizing:border-box;margin-right:10px; padding:10px;}
|
763 |
+
.export-import-block label{display:inline-block;}
|
764 |
+
.export-import-block a{text-decoration: none;}
|
765 |
+
|
766 |
+
|
767 |
+
.wpvivid-canvas {
|
768 |
+
width:100%;
|
769 |
+
box-sizing: border-box;
|
770 |
+
}
|
771 |
+
.wpvivid-dashboard, .wpvivid-backup{
|
772 |
+
position: relative;
|
773 |
+
|
774 |
+
border: 1px solid #ccd0d4;
|
775 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
776 |
+
background: #fff;
|
777 |
+
}
|
778 |
+
.wpvivid-welcome-panel {
|
779 |
+
width:100%;
|
780 |
+
padding: 0px 10px 0;
|
781 |
+
border: 1px solid #ccd0d4;
|
782 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
783 |
+
background: #fff;
|
784 |
+
box-sizing: border-box;
|
785 |
+
}
|
786 |
+
.wpvivid-red {
|
787 |
+
background:red;
|
788 |
+
color:#fff;
|
789 |
+
}
|
790 |
+
.wpvivid-green {
|
791 |
+
background:#8bc34a;
|
792 |
+
color:#fff;
|
793 |
+
}
|
794 |
+
.wpvivid-blue {
|
795 |
+
background:#007cba;
|
796 |
+
color:#fff;
|
797 |
+
}
|
798 |
+
.wpvivid-orange {
|
799 |
+
background:orange;
|
800 |
+
color:#fff;
|
801 |
+
}
|
802 |
+
.wpvivid-grey {
|
803 |
+
background-color:grey;
|
804 |
+
color: #fff;
|
805 |
+
}
|
806 |
+
.wpvivid-grey-light {
|
807 |
+
background-color:#eee;
|
808 |
+
color: grey;
|
809 |
+
}
|
810 |
+
.wpvivid-hover-blue:hover{
|
811 |
+
background:#007cba;
|
812 |
+
color:#fff;
|
813 |
+
cursor:pointer;
|
814 |
+
}
|
815 |
+
.wpvivid-font-hover-blue:hover{
|
816 |
+
color:#007cba;
|
817 |
+
cursor:pointer;
|
818 |
+
}
|
819 |
+
.wpvivid-hover-green:hover{
|
820 |
+
background:#8bc34a;
|
821 |
+
color:#fff;
|
822 |
+
cursor:pointer;
|
823 |
+
}
|
824 |
+
span.dashicons{
|
825 |
+
margin-right:2px;
|
826 |
+
}
|
827 |
+
.wpvivid-welcome-panel .about-description{
|
828 |
+
font-size: 16px;
|
829 |
+
margin: 0;
|
830 |
+
}
|
831 |
+
.wpvivid-page-title {
|
832 |
+
font-weight: 700;
|
833 |
+
font-size:1.2em;
|
834 |
+
}
|
835 |
+
.wpvivid-dashicons-large {
|
836 |
+
font-size:5em;
|
837 |
+
width:1.2em;
|
838 |
+
height:1.2em;
|
839 |
+
float:left;
|
840 |
+
}
|
841 |
+
.wpvivid-dashicons-large:hover{
|
842 |
+
text-shadow: 0px 0px 2px rgba(0,0,0,0.4);
|
843 |
+
}
|
844 |
+
.wpvivid-dashicons-middle {
|
845 |
+
font-size:3em;
|
846 |
+
width:1.2em;
|
847 |
+
height:1.2em;
|
848 |
+
float:left;
|
849 |
+
|
850 |
+
}
|
851 |
+
|
852 |
+
.wpvivid-welcome-bar{
|
853 |
+
width:100%;
|
854 |
+
box-sizing: border-box;
|
855 |
+
|
856 |
+
}
|
857 |
+
.wpvivid-welcome-bar-left, .wpvivid-block-left {
|
858 |
+
width:50%;
|
859 |
+
float:left;
|
860 |
+
padding:1em;
|
861 |
+
box-sizing: border-box;
|
862 |
+
}
|
863 |
+
.wpvivid-welcome-bar-right, .wpvivid-block-right {
|
864 |
+
width:50%;
|
865 |
+
float:left;
|
866 |
+
padding:1em;
|
867 |
+
box-sizing: border-box;
|
868 |
+
}
|
869 |
+
.wpvivid-features-box, .wpvivid-two-cols{
|
870 |
+
width:50%;
|
871 |
+
float:left;
|
872 |
+
font:14px;
|
873 |
+
padding:1em 1em 1em 1em;
|
874 |
+
box-sizing: border-box;
|
875 |
+
}
|
876 |
+
|
877 |
+
.wpvivid-four-cols{
|
878 |
+
width:25%;
|
879 |
+
float:left;
|
880 |
+
font:14px;
|
881 |
+
|
882 |
+
box-sizing: border-box;
|
883 |
+
border:1px solid #f1f1f1;
|
884 |
+
}
|
885 |
+
.wpvivid-one-coloum {
|
886 |
+
width:100%;
|
887 |
+
float:left;
|
888 |
+
font:14px;
|
889 |
+
padding:1em 1em 1em 1em;
|
890 |
+
box-sizing: border-box;
|
891 |
+
}
|
892 |
+
|
893 |
+
.wpvivid-dashboard .wpvivid-two-col li {
|
894 |
+
border-bottom: 1px solid #eee;
|
895 |
+
margin: 0px;
|
896 |
+
padding: 10px;
|
897 |
+
box-sizing: border-box;
|
898 |
+
|
899 |
+
}
|
900 |
+
|
901 |
+
.wpvivid-dashboard .wpvivid-two-col li::after {
|
902 |
+
content: "";
|
903 |
+
clear: both;
|
904 |
+
display: table;
|
905 |
+
}
|
906 |
+
|
907 |
+
|
908 |
+
.wpvivid-dashboard .wpvivid-two-col li img {
|
909 |
+
padding:1em;
|
910 |
+
width: 5em;
|
911 |
+
height: 5em;
|
912 |
+
float: left;
|
913 |
+
margin: 0.5em;
|
914 |
+
}
|
915 |
+
.wpvivid-sidebar-main{
|
916 |
+
width:100%;
|
917 |
+
float:left;
|
918 |
+
font:13px;
|
919 |
+
box-sizing: border-box;
|
920 |
+
|
921 |
+
}
|
922 |
+
.wpvivid-sidebar-main li::after {
|
923 |
+
content: "";
|
924 |
+
clear: both;
|
925 |
+
display: table;
|
926 |
+
}
|
927 |
+
.wpvivid-sidebar-main li {
|
928 |
+
margin: 0px;
|
929 |
+
padding: 10px;
|
930 |
+
box-sizing: border-box;
|
931 |
+
|
932 |
+
}
|
933 |
+
.wpvivid-sidebar-main li img {
|
934 |
+
padding:1em;
|
935 |
+
width: 5em;
|
936 |
+
height: 5em;
|
937 |
+
float: left;
|
938 |
+
margin: 0.5em;
|
939 |
+
}
|
940 |
+
.wpvivid-sidebar{
|
941 |
+
width:100%;
|
942 |
+
float:left;
|
943 |
+
font:13px;
|
944 |
+
box-sizing: border-box;
|
945 |
+
|
946 |
+
}
|
947 |
+
.wpvivid-sidebar li::after {
|
948 |
+
content: "";
|
949 |
+
clear: both;
|
950 |
+
display: table;
|
951 |
+
}
|
952 |
+
.wpvivid-sidebar li {
|
953 |
+
border-bottom: 1px solid #eee;
|
954 |
+
margin: 0px;
|
955 |
+
padding: 10px;
|
956 |
+
box-sizing: border-box;
|
957 |
+
|
958 |
+
}
|
959 |
+
.wpvivid-sidebar li img {
|
960 |
+
padding:1em;
|
961 |
+
width: 5em;
|
962 |
+
height: 5em;
|
963 |
+
float: left;
|
964 |
+
margin: 0.5em;
|
965 |
+
}
|
966 |
+
.wpvivid-features-box-image-progress {
|
967 |
+
width:100%;
|
968 |
+
}
|
969 |
+
.wpvivid-features-box-image-optimiztion-details {
|
970 |
+
width:50%;
|
971 |
+
}
|
972 |
+
.wpvivid-features-box-image-optimiztion-plate {
|
973 |
+
width:50%;
|
974 |
+
}
|
975 |
+
.wpvivid-features-box-image-optimiztion-percentage{
|
976 |
+
margin-top:2.5em;
|
977 |
+
}
|
978 |
+
.wpvivid-features-box-image-optimiztion-number {
|
979 |
+
font-size: 5em;
|
980 |
+
font-family:Sans-serif;
|
981 |
+
font-weight:600;
|
982 |
+
color:orange;
|
983 |
+
float:left;
|
984 |
+
text-shadow:0 0.05em 0.05em rgba(0,0,0,0.4);
|
985 |
+
}
|
986 |
+
.wpvivid-features-box-image-optimiztion-percentage-unit {
|
987 |
+
font-size:1em;
|
988 |
+
color:grey;
|
989 |
+
float:left;
|
990 |
+
font-size:1.2em;
|
991 |
+
padding-bottom:1em;
|
992 |
+
}
|
993 |
+
.wpvivid-rectangle {
|
994 |
+
border-radius:0.4em;
|
995 |
+
padding:0.5em;
|
996 |
+
margin-left: 0.5em;
|
997 |
+
margin-right:0.5em;
|
998 |
+
font-size:0.8em;
|
999 |
+
}
|
1000 |
+
.wpvivid-rectangle-small {
|
1001 |
+
border-radius:0.4em;
|
1002 |
+
padding:0.2em;
|
1003 |
+
margin-left: 0.5em;
|
1004 |
+
margin-right:0.5em;
|
1005 |
+
font-size:0.6em;
|
1006 |
+
}
|
1007 |
+
.wpvivid-icon-16px{
|
1008 |
+
font-size:16px;
|
1009 |
+
margin-top:2px;
|
1010 |
+
color:#aaa;
|
1011 |
+
cursor:pointer;
|
1012 |
+
}
|
1013 |
+
.wpvivid-icon-16px-nopointer{
|
1014 |
+
font-size:16px;
|
1015 |
+
margin-top:2px;
|
1016 |
+
}
|
1017 |
+
.wpvivid-text-line{
|
1018 |
+
padding:1px;
|
1019 |
+
}
|
1020 |
+
.wpvivid-text-selected{
|
1021 |
+
background:#eee;
|
1022 |
+
}
|
1023 |
+
.wpvivid-text-line:hover{
|
1024 |
+
background:#eee;
|
1025 |
+
}
|
1026 |
+
.wpvivid-span-progress {
|
1027 |
+
display:block;
|
1028 |
+
width:100%;
|
1029 |
+
height:1.5em;
|
1030 |
+
background-color:#9d9fa5;
|
1031 |
+
border-radius:0;
|
1032 |
+
color: #fff;
|
1033 |
+
|
1034 |
+
}
|
1035 |
+
.wpvivid-span-processed-progress {
|
1036 |
+
display:block;
|
1037 |
+
height:1.5em;
|
1038 |
+
background-color:#8bc34a;
|
1039 |
+
border-radius:0;
|
1040 |
+
color: #fff;
|
1041 |
+
padding-left:0.5em;
|
1042 |
+
}
|
1043 |
+
.wpvivid-span-processed-percent-progress{
|
1044 |
+
width:53%;
|
1045 |
+
}
|
1046 |
+
.wpvivid-clear-float {
|
1047 |
+
content: "";
|
1048 |
+
clear: both;
|
1049 |
+
display: table;
|
1050 |
+
width:100%;
|
1051 |
+
}
|
1052 |
+
.wpvivid-title {
|
1053 |
+
font-size:1.2em;
|
1054 |
+
color:#000;
|
1055 |
+
}
|
1056 |
+
.wpvivid-nav-bar{
|
1057 |
+
width: 100%;
|
1058 |
+
float: left;
|
1059 |
+
padding: 1em;
|
1060 |
+
background-color: #fff;
|
1061 |
+
margin-bottom: 1em;
|
1062 |
+
border-top:1px solid #ddd;
|
1063 |
+
border-bottom:1px solid #ddd;
|
1064 |
+
box-sizing: border-box;
|
1065 |
+
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
.wpvivid-two-col{
|
1069 |
+
width:50%;
|
1070 |
+
float:left;
|
1071 |
+
box-sizing: border-box;
|
1072 |
+
}
|
1073 |
+
.wpvivid-float-right{
|
1074 |
+
float:right;
|
1075 |
+
}
|
1076 |
+
.wpvivid-float-left{
|
1077 |
+
float:left;
|
1078 |
+
}
|
1079 |
+
.wpvivid-dashicons-white {
|
1080 |
+
color:#ffffff;
|
1081 |
+
}
|
1082 |
+
.wpvivid-dashicons-green {
|
1083 |
+
color:#8bc34a;
|
1084 |
+
}
|
1085 |
+
.wpvivid-dashicons-red {
|
1086 |
+
color:red;
|
1087 |
+
}
|
1088 |
+
.wpvivid-dashicons-orange {
|
1089 |
+
color:orange;
|
1090 |
+
}
|
1091 |
+
.wpvivid-dashicons-blue {
|
1092 |
+
color:#007cba;
|
1093 |
+
}
|
1094 |
+
.wpvivid-dashicons-grey, .wpvivid-dashicons-editor-help{
|
1095 |
+
color:#999;
|
1096 |
+
}
|
1097 |
+
.wpvivid-nav-tab-wrapper {
|
1098 |
+
padding-bottom:0!important;
|
1099 |
+
|
1100 |
+
}
|
1101 |
+
.wpvivid-nav-tab {
|
1102 |
+
background:#ffffff;
|
1103 |
+
}
|
1104 |
+
.wpvivid-nav-tab-active,.wpvivid-nav-tab-active, .wpvivid-nav-tab-active:focus:active, .wpvivid-nav-tab-active:hover {
|
1105 |
+
border-bottom:1px solid #ffffff;
|
1106 |
+
background:#ffffff;
|
1107 |
+
}
|
1108 |
+
.wpvivid-tabcontent {
|
1109 |
+
display: none;
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
|
1113 |
+
.wpvivid-workflow {
|
1114 |
+
padding:1em;
|
1115 |
+
border:1px solid #eee;
|
1116 |
+
border-radius:8px;
|
1117 |
+
}
|
1118 |
+
|
1119 |
+
|
1120 |
+
/* tooltip */
|
1121 |
+
.wpvivid-tooltip {
|
1122 |
+
display:inline-block;
|
1123 |
+
position:relative;
|
1124 |
+
text-align:left;
|
1125 |
+
}
|
1126 |
+
/* tooltip - top */
|
1127 |
+
.wpvivid-top {
|
1128 |
+
min-width:300px;
|
1129 |
+
top:-20px;
|
1130 |
+
left:50%;
|
1131 |
+
transform:translate(-50%, -100%);
|
1132 |
+
padding:10px 20px;
|
1133 |
+
color:#444444;
|
1134 |
+
background-color:#EEEEEE;
|
1135 |
+
font-weight:normal;
|
1136 |
+
font-size:13px;
|
1137 |
+
border-radius:8px;
|
1138 |
+
position:absolute;
|
1139 |
+
z-index:99999999;
|
1140 |
+
box-sizing:border-box;
|
1141 |
+
box-shadow:0 1px 8px rgba(0,0,0,0.5);
|
1142 |
+
visibility:hidden; opacity:0; transition:opacity 0.8s;
|
1143 |
+
}
|
1144 |
+
|
1145 |
+
.wpvivid-tooltip:hover .wpvivid-top {
|
1146 |
+
visibility:visible; opacity:1;
|
1147 |
+
}
|
1148 |
+
|
1149 |
+
.wpvivid-tooltip .wpvivid-top i {
|
1150 |
+
position:absolute;
|
1151 |
+
top:100%;
|
1152 |
+
left:50%;
|
1153 |
+
margin-left:-12px;
|
1154 |
+
width:24px;
|
1155 |
+
height:12px;
|
1156 |
+
overflow:hidden;
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
.wpvivid-tooltip .wpvivid-top i::after {
|
1160 |
+
content:'';
|
1161 |
+
position:absolute;
|
1162 |
+
width:12px;
|
1163 |
+
height:12px;
|
1164 |
+
left:50%;
|
1165 |
+
transform:translate(-50%,-50%) rotate(45deg);
|
1166 |
+
background-color:#EEEEEE;
|
1167 |
+
box-shadow:0 1px 8px rgba(0,0,0,0.5);
|
1168 |
+
}
|
1169 |
+
|
1170 |
+
/* tooltip - bottom */
|
1171 |
+
.wpvivid-bottom {
|
1172 |
+
min-width:300px;
|
1173 |
+
top:40px;
|
1174 |
+
left:50%;
|
1175 |
+
transform:translate(-50%, 0);
|
1176 |
+
padding:10px 20px;
|
1177 |
+
color:#444444;
|
1178 |
+
background-color:#EEEEEE;
|
1179 |
+
font-weight:normal;
|
1180 |
+
font-size:13px;
|
1181 |
+
border-radius:8px;
|
1182 |
+
position:absolute;
|
1183 |
+
z-index:99999999;
|
1184 |
+
box-sizing:border-box;
|
1185 |
+
box-shadow:0 1px 8px rgba(0,0,0,0.5);
|
1186 |
+
visibility:hidden; opacity:0; transition:opacity 0.4s;
|
1187 |
+
}
|
1188 |
+
|
1189 |
+
.wpvivid-dashicons-editor-help:hover .wpvivid-bottom {
|
1190 |
+
visibility:visible; opacity:1;
|
1191 |
+
}
|
1192 |
+
.wpvivid-dashicons-white:hover .wpvivid-bottom{
|
1193 |
+
visibility:visible; opacity:1;
|
1194 |
+
}
|
1195 |
+
.wpvivid-tooltip .wpvivid-bottom i {
|
1196 |
+
position:absolute;
|
1197 |
+
bottom:100%;
|
1198 |
+
left:50%;
|
1199 |
+
margin-left:-12px;
|
1200 |
+
width:24px;
|
1201 |
+
height:12px;
|
1202 |
+
overflow:hidden;
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
.wpvivid-tooltip .wpvivid-bottom i::after {
|
1206 |
+
content:'';
|
1207 |
+
position:absolute;
|
1208 |
+
width:12px;
|
1209 |
+
height:12px;
|
1210 |
+
left:50%;
|
1211 |
+
transform:translate(-50%,50%) rotate(45deg);
|
1212 |
+
background-color:#EEEEEE;
|
1213 |
+
box-shadow:0 1px 8px rgba(0,0,0,0.5);
|
1214 |
+
}
|
1215 |
+
/* tooltip - left */
|
1216 |
+
.wpvivid-left {
|
1217 |
+
min-width:300px;
|
1218 |
+
top:50%;
|
1219 |
+
right:100%;
|
1220 |
+
margin-right:20px;
|
1221 |
+
transform:translate(0, -50%);
|
1222 |
+
padding:10px 20px;
|
1223 |
+
color:#444444;
|
1224 |
+
background-color:#EEEEEE;
|
1225 |
+
font-weight:normal;
|
1226 |
+
font-size:13px;
|
1227 |
+
border-radius:8px;
|
1228 |
+
position:absolute;
|
1229 |
+
z-index:99999999;
|
1230 |
+
box-sizing:border-box;
|
1231 |
+
box-shadow:0 1px 8px rgba(0,0,0,0.5);
|
1232 |
+
visibility:hidden; opacity:0; transition:opacity 0.8s;
|
1233 |
+
}
|
1234 |
+
|
1235 |
+
.wpvivid-tooltip:hover .wpvivid-left {
|
1236 |
+
visibility:visible; opacity:1;
|
1237 |
+
}
|
1238 |
+
|
1239 |
+
.wpvivid-tooltip .wpvivid-left i {
|
1240 |
+
position:absolute;
|
1241 |
+
top:50%;
|
1242 |
+
left:100%;
|
1243 |
+
margin-top:-12px;
|
1244 |
+
width:12px;
|
1245 |
+
height:24px;
|
1246 |
+
overflow:hidden;
|
1247 |
+
}
|
1248 |
+
|
1249 |
+
.wpvivid-tooltip .wpvivid-left i::after {
|
1250 |
+
content:'';
|
1251 |
+
position:absolute;
|
1252 |
+
width:12px;
|
1253 |
+
height:12px;
|
1254 |
+
left:0;
|
1255 |
+
top:50%;
|
1256 |
+
transform:translate(-50%,-50%) rotate(-45deg);
|
1257 |
+
background-color:#EEEEEE;
|
1258 |
+
box-shadow:0 1px 8px rgba(0,0,0,0.5);
|
1259 |
+
}
|
1260 |
+
/* tooltip - right */
|
1261 |
+
.wpvivid-right {
|
1262 |
+
min-width:300px;
|
1263 |
+
top:50%;
|
1264 |
+
left:100%;
|
1265 |
+
margin-left:20px;
|
1266 |
+
transform:translate(0, -50%);
|
1267 |
+
padding:10px 20px;
|
1268 |
+
color:#444444;
|
1269 |
+
background-color:#EEEEEE;
|
1270 |
+
font-weight:normal;
|
1271 |
+
font-size:13px;
|
1272 |
+
border-radius:8px;
|
1273 |
+
position:absolute;
|
1274 |
+
z-index:99999999;
|
1275 |
+
box-sizing:border-box;
|
1276 |
+
box-shadow:0 1px 8px rgba(0,0,0,0.5);
|
1277 |
+
visibility:hidden;
|
1278 |
+
opacity:0;
|
1279 |
+
transition:opacity 0.8s;
|
1280 |
+
}
|
1281 |
+
|
1282 |
+
.wpvivid-tooltip:hover .wpvivid-right {
|
1283 |
+
visibility:visible; opacity:1;
|
1284 |
+
}
|
1285 |
+
.wpvivid-installer-list li{
|
1286 |
+
padding:0.2em 0;
|
1287 |
+
}
|
1288 |
+
.wpvivid-tooltip .wpvivid-right i {
|
1289 |
+
position:absolute;
|
1290 |
+
top:50%;
|
1291 |
+
right:100%;
|
1292 |
+
margin-top:-12px;
|
1293 |
+
width:12px;
|
1294 |
+
height:24px;
|
1295 |
+
overflow:hidden;
|
1296 |
+
}
|
1297 |
+
|
1298 |
+
.wpvivid-tooltip .wpvivid-right i::after {
|
1299 |
+
content:'';
|
1300 |
+
position:absolute;
|
1301 |
+
width:12px;
|
1302 |
+
height:12px;
|
1303 |
+
left:0;
|
1304 |
+
top:50%;
|
1305 |
+
transform:translate(50%,-50%) rotate(-45deg);
|
1306 |
+
background-color:#EEEEEE;
|
1307 |
+
box-shadow:0 1px 8px rgba(0,0,0,0.5);
|
1308 |
+
}
|
1309 |
+
|
1310 |
+
/* radio box style */
|
1311 |
+
|
1312 |
+
.wpvivid-radio {
|
1313 |
+
display: block;
|
1314 |
+
position: relative;
|
1315 |
+
padding-left: 2em;
|
1316 |
+
margin-bottom: 1em;
|
1317 |
+
cursor: pointer;
|
1318 |
+
font-size: 1em;
|
1319 |
+
-webkit-user-select: none;
|
1320 |
+
-moz-user-select: none;
|
1321 |
+
-ms-user-select: none;
|
1322 |
+
user-select: none;
|
1323 |
+
}
|
1324 |
+
/* Hide the browser's default radio button */
|
1325 |
+
.wpvivid-radio input {
|
1326 |
+
position: absolute;
|
1327 |
+
opacity: 0;
|
1328 |
+
cursor: pointer;
|
1329 |
+
}
|
1330 |
+
/* Create a custom radio button */
|
1331 |
+
.wpvivid-radio-checkmark {
|
1332 |
+
position: absolute;
|
1333 |
+
top: 2px;
|
1334 |
+
left: 0;
|
1335 |
+
height: 16px;
|
1336 |
+
width: 16px;
|
1337 |
+
background-color: #eee;
|
1338 |
+
border-radius: 50%;
|
1339 |
+
}
|
1340 |
+
/* On mouse-over, add a grey background color */
|
1341 |
+
.wpvivid-radio:hover input ~ .wpvivid-radio-checkmark {
|
1342 |
+
background-color: #ccc;
|
1343 |
+
}
|
1344 |
+
/* When the radio button is checked, add a blue background */
|
1345 |
+
.wpvivid-radio input:checked ~ .wpvivid-radio-checkmark {
|
1346 |
+
background-color: #8bc34a;
|
1347 |
+
}
|
1348 |
+
/* Create the indicator (the dot/circle - hidden when not checked) */
|
1349 |
+
.wpvivid-radio-checkmark:after {
|
1350 |
+
content: "✔";
|
1351 |
+
position: absolute;
|
1352 |
+
font-size:12px;
|
1353 |
+
top:-1px;
|
1354 |
+
left:3px;
|
1355 |
+
display: none;
|
1356 |
+
color:white;
|
1357 |
+
}
|
1358 |
+
/* Show the indicator (dot/circle) when checked */
|
1359 |
+
.wpvivid-radio input:checked ~ .wpvivid-radio-checkmark:after {
|
1360 |
+
display: block;
|
1361 |
+
}
|
1362 |
+
|
1363 |
+
/* custom checkbox */
|
1364 |
+
|
1365 |
+
/* Customize the label (the container) */
|
1366 |
+
.wpvivid-checkbox {
|
1367 |
+
display: block;
|
1368 |
+
position: relative;
|
1369 |
+
|
1370 |
+
padding-left: 2em;
|
1371 |
+
cursor: pointer;
|
1372 |
+
font-size: 1em;
|
1373 |
+
|
1374 |
+
-webkit-user-select: none;
|
1375 |
+
-moz-user-select: none;
|
1376 |
+
-ms-user-select: none;
|
1377 |
+
user-select: none;
|
1378 |
+
}
|
1379 |
+
/* Hide the browser's default checkbox */
|
1380 |
+
.wpvivid-checkbox input {
|
1381 |
+
position: absolute;
|
1382 |
+
opacity: 0;
|
1383 |
+
cursor: pointer;
|
1384 |
+
height: 0;
|
1385 |
+
width: 0;
|
1386 |
+
}
|
1387 |
+
/* Create a custom checkbox */
|
1388 |
+
.wpvivid-checkbox-checkmark {
|
1389 |
+
position: absolute;
|
1390 |
+
top: 3px;
|
1391 |
+
left: 0;
|
1392 |
+
height: 16px;
|
1393 |
+
width: 16px;
|
1394 |
+
background-color: #eee;
|
1395 |
+
border-radius: 4px;
|
1396 |
+
}
|
1397 |
+
/* On mouse-over, add a grey background color */
|
1398 |
+
.wpvivid-checkbox:hover input ~ .wpvivid-checkbox-checkmark {
|
1399 |
+
background-color: #ccc;
|
1400 |
+
border-radius: 4px;
|
1401 |
+
}
|
1402 |
+
/* When the checkbox is checked, add a blue background */
|
1403 |
+
.wpvivid-checkbox input:checked ~ .wpvivid-checkbox-checkmark {
|
1404 |
+
background-color: #8bc34a;
|
1405 |
+
border-radius: 4px;
|
1406 |
+
}
|
1407 |
+
/* Create the checkmark/indicator (hidden when not checked) */
|
1408 |
+
.wpvivid-checkbox-checkmark:after {
|
1409 |
+
content: "";
|
1410 |
+
position: absolute;
|
1411 |
+
display: none;
|
1412 |
+
}
|
1413 |
+
/* Show the checkmark when checked */
|
1414 |
+
.wpvivid-checkbox input:checked ~ .wpvivid-checkbox-checkmark:after {
|
1415 |
+
display: block;
|
1416 |
+
}
|
1417 |
+
/* Style the checkmark/indicator */
|
1418 |
+
.wpvivid-checkbox .wpvivid-checkbox-checkmark:after {
|
1419 |
+
left: 4px;
|
1420 |
+
top: 0px;
|
1421 |
+
width: 5px;
|
1422 |
+
height: 10px;
|
1423 |
+
border: solid white;
|
1424 |
+
border-width: 0px 3px 3px 0;
|
1425 |
+
-webkit-transform: rotate(45deg);
|
1426 |
+
-ms-transform: rotate(45deg);
|
1427 |
+
transform: rotate(45deg);
|
1428 |
+
}
|
1429 |
+
/* toggle switch */
|
1430 |
+
|
1431 |
+
/* The switch - the box around the slider */
|
1432 |
+
.wpvivid-switch {
|
1433 |
+
position: relative;
|
1434 |
+
display: inline-block;
|
1435 |
+
width: 32px;
|
1436 |
+
height: 16px;
|
1437 |
+
}
|
1438 |
+
|
1439 |
+
/* Hide default HTML checkbox */
|
1440 |
+
.wpvivid-switch input {
|
1441 |
+
opacity: 0;
|
1442 |
+
width: 0;
|
1443 |
+
height: 0;
|
1444 |
+
}
|
1445 |
+
|
1446 |
+
/* The slider */
|
1447 |
+
.wpvivid-slider {
|
1448 |
+
position: absolute;
|
1449 |
+
cursor: pointer;
|
1450 |
+
top: 0;
|
1451 |
+
left: 0;
|
1452 |
+
right: 0;
|
1453 |
+
bottom: 0px;
|
1454 |
+
background-color: #ccc;
|
1455 |
+
-webkit-transition: .4s;
|
1456 |
+
transition: .4s;
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
.wpvivid-slider:before {
|
1460 |
+
position: absolute;
|
1461 |
+
content: "";
|
1462 |
+
height: 12px;
|
1463 |
+
width: 12px;
|
1464 |
+
left: 2px;
|
1465 |
+
bottom: 2px;
|
1466 |
+
background-color: white;
|
1467 |
+
-webkit-transition: .4s;
|
1468 |
+
transition: .4s;
|
1469 |
+
}
|
1470 |
+
|
1471 |
+
input:checked + .wpvivid-slider {
|
1472 |
+
background-color: #8bc34a;
|
1473 |
+
}
|
1474 |
+
|
1475 |
+
input:focus + .wpvivid-slider {
|
1476 |
+
box-shadow: 0 0 1px #8bc34a;
|
1477 |
+
}
|
1478 |
+
|
1479 |
+
|
1480 |
+
input:checked + .wpvivid-slider:before {
|
1481 |
+
-webkit-transform: translateX(16px);
|
1482 |
+
-ms-transform: translateX(16px);
|
1483 |
+
transform: translateX(16px);
|
1484 |
+
}
|
1485 |
+
|
1486 |
+
/* Rounded sliders */
|
1487 |
+
.wpvivid-slider.wpvivid-round {
|
1488 |
+
border-radius: 16px;
|
1489 |
+
}
|
1490 |
+
|
1491 |
+
.wpvivid-slider.wpvivid-round:before {
|
1492 |
+
border-radius: 50%;
|
1493 |
+
}
|
1494 |
+
|
1495 |
+
|
1496 |
+
/*general postion*/
|
1497 |
+
.wpvivid-tooltip-padding-top {
|
1498 |
+
padding-top:0.2em;
|
1499 |
+
}
|
1500 |
+
.wpvivid-tooltip-padding-top-small {
|
1501 |
+
padding-top:0.1em;
|
1502 |
+
}
|
1503 |
+
|
1504 |
+
/* HD computer monitor */
|
1505 |
+
|
1506 |
+
@media only screen and (min-width: 1366px) {
|
1507 |
+
|
1508 |
+
.wpvivid-four-cols{
|
1509 |
+
width:100%;
|
1510 |
+
margin-bottom:1em;
|
1511 |
+
}
|
1512 |
+
}
|
1513 |
+
|
1514 |
+
/* Tablets in landscape mode, older desktop monitors */
|
1515 |
+
|
1516 |
+
@media only screen and (min-width: 1024px) and (max-width: 1365px) {
|
1517 |
+
|
1518 |
+
|
1519 |
+
#poststuff #post-body.columns-2 {
|
1520 |
+
margin-right: 0px;
|
1521 |
+
}
|
1522 |
+
#wpbody-content #post-body.columns-2 #postbox-container-1 {
|
1523 |
+
margin-right: 0;
|
1524 |
+
width: 100%;
|
1525 |
+
}
|
1526 |
+
.wpvivid-four-cols{
|
1527 |
+
width:100%;
|
1528 |
+
margin-bottom:1em;
|
1529 |
+
}
|
1530 |
+
}
|
1531 |
+
|
1532 |
+
|
1533 |
+
|
1534 |
+
/* Tablets in portrait mode, large display smartphones landscape mode */
|
1535 |
+
|
1536 |
+
@media only screen and (min-width: 768px) and (max-width: 1023px) {
|
1537 |
+
.wpvivid-two-col {
|
1538 |
+
width:100%;
|
1539 |
+
}
|
1540 |
+
.wpvivid-float-right{
|
1541 |
+
float:left;
|
1542 |
+
}
|
1543 |
+
.wpvivid-four-cols{
|
1544 |
+
width:100%;
|
1545 |
+
margin-bottom:1em;
|
1546 |
+
}
|
1547 |
+
..wpvivid-welcome-bar-left{
|
1548 |
+
width:100%;
|
1549 |
+
|
1550 |
+
}
|
1551 |
+
.wpvivid-welcome-bar-right{
|
1552 |
+
display:none;
|
1553 |
+
}
|
1554 |
+
.wpvivid-ignore{
|
1555 |
+
display:none;
|
1556 |
+
}
|
1557 |
+
|
1558 |
+
}
|
1559 |
+
|
1560 |
+
/* Smartphones in landscape mode */
|
1561 |
+
|
1562 |
+
@media only screen and (min-width: 421px) and (max-width: 767px) {
|
1563 |
+
.wpvivid-features-box,.wpvivid-two-col {
|
1564 |
+
width:100%;
|
1565 |
+
}
|
1566 |
+
.wpvivid-float-right{
|
1567 |
+
float:left;
|
1568 |
+
}
|
1569 |
+
.wpvivid-welcome-bar-left{
|
1570 |
+
width:100%;
|
1571 |
+
}
|
1572 |
+
.wpvivid-welcome-bar-right{
|
1573 |
+
display:none;
|
1574 |
+
}
|
1575 |
+
.wpvivid-four-cols{
|
1576 |
+
width:100%;
|
1577 |
+
margin-bottom:1em;
|
1578 |
+
}
|
1579 |
+
.wpvivid-ignore{
|
1580 |
+
display:none;
|
1581 |
+
}
|
1582 |
+
}
|
1583 |
+
|
1584 |
+
|
1585 |
+
/* Smartphones in portrait mode */
|
1586 |
+
|
1587 |
+
@media only screen and (max-width: 420px) {
|
1588 |
+
.wpvivid-features-box,.wpvivid-two-col {
|
1589 |
+
width:100%;
|
1590 |
+
}
|
1591 |
+
.wpvivid-float-right{
|
1592 |
+
float:left;
|
1593 |
+
}
|
1594 |
+
.wpvivid-welcome-bar-left{
|
1595 |
+
width:100%;
|
1596 |
+
|
1597 |
+
}
|
1598 |
+
.wpvivid-welcome-bar-right{
|
1599 |
+
display:none;
|
1600 |
+
}
|
1601 |
+
|
1602 |
+
.wpvivid-four-cols{
|
1603 |
+
width:100%;
|
1604 |
+
margin-bottom:1em;
|
1605 |
+
}
|
1606 |
+
.wpvivid-ignore{
|
1607 |
+
display:none;
|
1608 |
+
}
|
1609 |
+
.wpvivid-img-opt-responsive{
|
1610 |
+
margin-top:1em;
|
1611 |
+
padding-top:1em;
|
1612 |
+
border-top:1px solid #f1f1f1;
|
1613 |
+
}
|
1614 |
+
}
|
trunk/admin/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
trunk/admin/js/jstree/dist/jstree.js
ADDED
@@ -0,0 +1,8605 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*globals jQuery, define, module, exports, require, window, document, postMessage */
|
2 |
+
(function (factory) {
|
3 |
+
"use strict";
|
4 |
+
if (typeof define === 'function' && define.amd) {
|
5 |
+
define(['jquery'], factory);
|
6 |
+
}
|
7 |
+
else if(typeof module !== 'undefined' && module.exports) {
|
8 |
+
module.exports = factory(require('jquery'));
|
9 |
+
}
|
10 |
+
else {
|
11 |
+
factory(jQuery);
|
12 |
+
}
|
13 |
+
}(function ($, undefined) {
|
14 |
+
"use strict";
|
15 |
+
/*!
|
16 |
+
* jsTree 3.3.7
|
17 |
+
* http://jstree.com/
|
18 |
+
*
|
19 |
+
* Copyright (c) 2014 Ivan Bozhanov (http://vakata.com)
|
20 |
+
*
|
21 |
+
* Licensed same as jquery - under the terms of the MIT License
|
22 |
+
* http://www.opensource.org/licenses/mit-license.php
|
23 |
+
*/
|
24 |
+
/*!
|
25 |
+
* if using jslint please allow for the jQuery global and use following options:
|
26 |
+
* jslint: loopfunc: true, browser: true, ass: true, bitwise: true, continue: true, nomen: true, plusplus: true, regexp: true, unparam: true, todo: true, white: true
|
27 |
+
*/
|
28 |
+
/*jshint -W083 */
|
29 |
+
|
30 |
+
// prevent another load? maybe there is a better way?
|
31 |
+
if($.jstree) {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* ### jsTree core functionality
|
37 |
+
*/
|
38 |
+
|
39 |
+
// internal variables
|
40 |
+
var instance_counter = 0,
|
41 |
+
ccp_node = false,
|
42 |
+
ccp_mode = false,
|
43 |
+
ccp_inst = false,
|
44 |
+
themes_loaded = [],
|
45 |
+
src = $('script:last').attr('src'),
|
46 |
+
document = window.document; // local variable is always faster to access then a global
|
47 |
+
|
48 |
+
/**
|
49 |
+
* holds all jstree related functions and variables, including the actual class and methods to create, access and manipulate instances.
|
50 |
+
* @name $.jstree
|
51 |
+
*/
|
52 |
+
$.jstree = {
|
53 |
+
/**
|
54 |
+
* specifies the jstree version in use
|
55 |
+
* @name $.jstree.version
|
56 |
+
*/
|
57 |
+
version : '3.3.7',
|
58 |
+
/**
|
59 |
+
* holds all the default options used when creating new instances
|
60 |
+
* @name $.jstree.defaults
|
61 |
+
*/
|
62 |
+
defaults : {
|
63 |
+
/**
|
64 |
+
* configure which plugins will be active on an instance. Should be an array of strings, where each element is a plugin name. The default is `[]`
|
65 |
+
* @name $.jstree.defaults.plugins
|
66 |
+
*/
|
67 |
+
plugins : []
|
68 |
+
},
|
69 |
+
/**
|
70 |
+
* stores all loaded jstree plugins (used internally)
|
71 |
+
* @name $.jstree.plugins
|
72 |
+
*/
|
73 |
+
plugins : {},
|
74 |
+
path : src && src.indexOf('/') !== -1 ? src.replace(/\/[^\/]+$/,'') : '',
|
75 |
+
idregex : /[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,
|
76 |
+
root : '#'
|
77 |
+
};
|
78 |
+
|
79 |
+
/**
|
80 |
+
* creates a jstree instance
|
81 |
+
* @name $.jstree.create(el [, options])
|
82 |
+
* @param {DOMElement|jQuery|String} el the element to create the instance on, can be jQuery extended or a selector
|
83 |
+
* @param {Object} options options for this instance (extends `$.jstree.defaults`)
|
84 |
+
* @return {jsTree} the new instance
|
85 |
+
*/
|
86 |
+
$.jstree.create = function (el, options) {
|
87 |
+
var tmp = new $.jstree.core(++instance_counter),
|
88 |
+
opt = options;
|
89 |
+
options = $.extend(true, {}, $.jstree.defaults, options);
|
90 |
+
if(opt && opt.plugins) {
|
91 |
+
options.plugins = opt.plugins;
|
92 |
+
}
|
93 |
+
$.each(options.plugins, function (i, k) {
|
94 |
+
if(i !== 'core') {
|
95 |
+
tmp = tmp.plugin(k, options[k]);
|
96 |
+
}
|
97 |
+
});
|
98 |
+
$(el).data('jstree', tmp);
|
99 |
+
tmp.init(el, options);
|
100 |
+
return tmp;
|
101 |
+
};
|
102 |
+
/**
|
103 |
+
* remove all traces of jstree from the DOM and destroy all instances
|
104 |
+
* @name $.jstree.destroy()
|
105 |
+
*/
|
106 |
+
$.jstree.destroy = function () {
|
107 |
+
$('.jstree:jstree').jstree('destroy');
|
108 |
+
$(document).off('.jstree');
|
109 |
+
};
|
110 |
+
/**
|
111 |
+
* the jstree class constructor, used only internally
|
112 |
+
* @private
|
113 |
+
* @name $.jstree.core(id)
|
114 |
+
* @param {Number} id this instance's index
|
115 |
+
*/
|
116 |
+
$.jstree.core = function (id) {
|
117 |
+
this._id = id;
|
118 |
+
this._cnt = 0;
|
119 |
+
this._wrk = null;
|
120 |
+
this._data = {
|
121 |
+
core : {
|
122 |
+
themes : {
|
123 |
+
name : false,
|
124 |
+
dots : false,
|
125 |
+
icons : false,
|
126 |
+
ellipsis : false
|
127 |
+
},
|
128 |
+
selected : [],
|
129 |
+
last_error : {},
|
130 |
+
working : false,
|
131 |
+
worker_queue : [],
|
132 |
+
focused : null
|
133 |
+
}
|
134 |
+
};
|
135 |
+
};
|
136 |
+
/**
|
137 |
+
* get a reference to an existing instance
|
138 |
+
*
|
139 |
+
* __Examples__
|
140 |
+
*
|
141 |
+
* // provided a container with an ID of "tree", and a nested node with an ID of "branch"
|
142 |
+
* // all of there will return the same instance
|
143 |
+
* $.jstree.reference('tree');
|
144 |
+
* $.jstree.reference('#tree');
|
145 |
+
* $.jstree.reference($('#tree'));
|
146 |
+
* $.jstree.reference(document.getElementByID('tree'));
|
147 |
+
* $.jstree.reference('branch');
|
148 |
+
* $.jstree.reference('#branch');
|
149 |
+
* $.jstree.reference($('#branch'));
|
150 |
+
* $.jstree.reference(document.getElementByID('branch'));
|
151 |
+
*
|
152 |
+
* @name $.jstree.reference(needle)
|
153 |
+
* @param {DOMElement|jQuery|String} needle
|
154 |
+
* @return {jsTree|null} the instance or `null` if not found
|
155 |
+
*/
|
156 |
+
$.jstree.reference = function (needle) {
|
157 |
+
var tmp = null,
|
158 |
+
obj = null;
|
159 |
+
if(needle && needle.id && (!needle.tagName || !needle.nodeType)) { needle = needle.id; }
|
160 |
+
|
161 |
+
if(!obj || !obj.length) {
|
162 |
+
try { obj = $(needle); } catch (ignore) { }
|
163 |
+
}
|
164 |
+
if(!obj || !obj.length) {
|
165 |
+
try { obj = $('#' + needle.replace($.jstree.idregex,'\\$&')); } catch (ignore) { }
|
166 |
+
}
|
167 |
+
if(obj && obj.length && (obj = obj.closest('.jstree')).length && (obj = obj.data('jstree'))) {
|
168 |
+
tmp = obj;
|
169 |
+
}
|
170 |
+
else {
|
171 |
+
$('.jstree').each(function () {
|
172 |
+
var inst = $(this).data('jstree');
|
173 |
+
if(inst && inst._model.data[needle]) {
|
174 |
+
tmp = inst;
|
175 |
+
return false;
|
176 |
+
}
|
177 |
+
});
|
178 |
+
}
|
179 |
+
return tmp;
|
180 |
+
};
|
181 |
+
/**
|
182 |
+
* Create an instance, get an instance or invoke a command on a instance.
|
183 |
+
*
|
184 |
+
* If there is no instance associated with the current node a new one is created and `arg` is used to extend `$.jstree.defaults` for this new instance. There would be no return value (chaining is not broken).
|
185 |
+
*
|
186 |
+
* If there is an existing instance and `arg` is a string the command specified by `arg` is executed on the instance, with any additional arguments passed to the function. If the function returns a value it will be returned (chaining could break depending on function).
|
187 |
+
*
|
188 |
+
* If there is an existing instance and `arg` is not a string the instance itself is returned (similar to `$.jstree.reference`).
|
189 |
+
*
|
190 |
+
* In any other case - nothing is returned and chaining is not broken.
|
191 |
+
*
|
192 |
+
* __Examples__
|
193 |
+
*
|
194 |
+
* $('#tree1').jstree(); // creates an instance
|
195 |
+
* $('#tree2').jstree({ plugins : [] }); // create an instance with some options
|
196 |
+
* $('#tree1').jstree('open_node', '#branch_1'); // call a method on an existing instance, passing additional arguments
|
197 |
+
* $('#tree2').jstree(); // get an existing instance (or create an instance)
|
198 |
+
* $('#tree2').jstree(true); // get an existing instance (will not create new instance)
|
199 |
+
* $('#branch_1').jstree().select_node('#branch_1'); // get an instance (using a nested element and call a method)
|
200 |
+
*
|
201 |
+
* @name $().jstree([arg])
|
202 |
+
* @param {String|Object} arg
|
203 |
+
* @return {Mixed}
|
204 |
+
*/
|
205 |
+
$.fn.jstree = function (arg) {
|
206 |
+
// check for string argument
|
207 |
+
var is_method = (typeof arg === 'string'),
|
208 |
+
args = Array.prototype.slice.call(arguments, 1),
|
209 |
+
result = null;
|
210 |
+
if(arg === true && !this.length) { return false; }
|
211 |
+
this.each(function () {
|
212 |
+
// get the instance (if there is one) and method (if it exists)
|
213 |
+
var instance = $.jstree.reference(this),
|
214 |
+
method = is_method && instance ? instance[arg] : null;
|
215 |
+
// if calling a method, and method is available - execute on the instance
|
216 |
+
result = is_method && method ?
|
217 |
+
method.apply(instance, args) :
|
218 |
+
null;
|
219 |
+
// if there is no instance and no method is being called - create one
|
220 |
+
if(!instance && !is_method && (arg === undefined || $.isPlainObject(arg))) {
|
221 |
+
$.jstree.create(this, arg);
|
222 |
+
}
|
223 |
+
// if there is an instance and no method is called - return the instance
|
224 |
+
if( (instance && !is_method) || arg === true ) {
|
225 |
+
result = instance || false;
|
226 |
+
}
|
227 |
+
// if there was a method call which returned a result - break and return the value
|
228 |
+
if(result !== null && result !== undefined) {
|
229 |
+
return false;
|
230 |
+
}
|
231 |
+
});
|
232 |
+
// if there was a method call with a valid return value - return that, otherwise continue the chain
|
233 |
+
return result !== null && result !== undefined ?
|
234 |
+
result : this;
|
235 |
+
};
|
236 |
+
/**
|
237 |
+
* used to find elements containing an instance
|
238 |
+
*
|
239 |
+
* __Examples__
|
240 |
+
*
|
241 |
+
* $('div:jstree').each(function () {
|
242 |
+
* $(this).jstree('destroy');
|
243 |
+
* });
|
244 |
+
*
|
245 |
+
* @name $(':jstree')
|
246 |
+
* @return {jQuery}
|
247 |
+
*/
|
248 |
+
$.expr.pseudos.jstree = $.expr.createPseudo(function(search) {
|
249 |
+
return function(a) {
|
250 |
+
return $(a).hasClass('jstree') &&
|
251 |
+
$(a).data('jstree') !== undefined;
|
252 |
+
};
|
253 |
+
});
|
254 |
+
|
255 |
+
/**
|
256 |
+
* stores all defaults for the core
|
257 |
+
* @name $.jstree.defaults.core
|
258 |
+
*/
|
259 |
+
$.jstree.defaults.core = {
|
260 |
+
/**
|
261 |
+
* data configuration
|
262 |
+
*
|
263 |
+
* If left as `false` the HTML inside the jstree container element is used to populate the tree (that should be an unordered list with list items).
|
264 |
+
*
|
265 |
+
* You can also pass in a HTML string or a JSON array here.
|
266 |
+
*
|
267 |
+
* It is possible to pass in a standard jQuery-like AJAX config and jstree will automatically determine if the response is JSON or HTML and use that to populate the tree.
|
268 |
+
* In addition to the standard jQuery ajax options here you can suppy functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node is being loaded, the return value of those functions will be used.
|
269 |
+
*
|
270 |
+
* The last option is to specify a function, that function will receive the node being loaded as argument and a second param which is a function which should be called with the result.
|
271 |
+
*
|
272 |
+
* __Examples__
|
273 |
+
*
|
274 |
+
* // AJAX
|
275 |
+
* $('#tree').jstree({
|
276 |
+
* 'core' : {
|
277 |
+
* 'data' : {
|
278 |
+
* 'url' : '/get/children/',
|
279 |
+
* 'data' : function (node) {
|
280 |
+
* return { 'id' : node.id };
|
281 |
+
* }
|
282 |
+
* }
|
283 |
+
* });
|
284 |
+
*
|
285 |
+
* // direct data
|
286 |
+
* $('#tree').jstree({
|
287 |
+
* 'core' : {
|
288 |
+
* 'data' : [
|
289 |
+
* 'Simple root node',
|
290 |
+
* {
|
291 |
+
* 'id' : 'node_2',
|
292 |
+
* 'text' : 'Root node with options',
|
293 |
+
* 'state' : { 'opened' : true, 'selected' : true },
|
294 |
+
* 'children' : [ { 'text' : 'Child 1' }, 'Child 2']
|
295 |
+
* }
|
296 |
+
* ]
|
297 |
+
* }
|
298 |
+
* });
|
299 |
+
*
|
300 |
+
* // function
|
301 |
+
* $('#tree').jstree({
|
302 |
+
* 'core' : {
|
303 |
+
* 'data' : function (obj, callback) {
|
304 |
+
* callback.call(this, ['Root 1', 'Root 2']);
|
305 |
+
* }
|
306 |
+
* });
|
307 |
+
*
|
308 |
+
* @name $.jstree.defaults.core.data
|
309 |
+
*/
|
310 |
+
data : false,
|
311 |
+
/**
|
312 |
+
* configure the various strings used throughout the tree
|
313 |
+
*
|
314 |
+
* You can use an object where the key is the string you need to replace and the value is your replacement.
|
315 |
+
* Another option is to specify a function which will be called with an argument of the needed string and should return the replacement.
|
316 |
+
* If left as `false` no replacement is made.
|
317 |
+
*
|
318 |
+
* __Examples__
|
319 |
+
*
|
320 |
+
* $('#tree').jstree({
|
321 |
+
* 'core' : {
|
322 |
+
* 'strings' : {
|
323 |
+
* 'Loading ...' : 'Please wait ...'
|
324 |
+
* }
|
325 |
+
* }
|
326 |
+
* });
|
327 |
+
*
|
328 |
+
* @name $.jstree.defaults.core.strings
|
329 |
+
*/
|
330 |
+
strings : false,
|
331 |
+
/**
|
332 |
+
* determines what happens when a user tries to modify the structure of the tree
|
333 |
+
* If left as `false` all operations like create, rename, delete, move or copy are prevented.
|
334 |
+
* You can set this to `true` to allow all interactions or use a function to have better control.
|
335 |
+
*
|
336 |
+
* __Examples__
|
337 |
+
*
|
338 |
+
* $('#tree').jstree({
|
339 |
+
* 'core' : {
|
340 |
+
* 'check_callback' : function (operation, node, node_parent, node_position, more) {
|
341 |
+
* // operation can be 'create_node', 'rename_node', 'delete_node', 'move_node', 'copy_node' or 'edit'
|
342 |
+
* // in case of 'rename_node' node_position is filled with the new node name
|
343 |
+
* return operation === 'rename_node' ? true : false;
|
344 |
+
* }
|
345 |
+
* }
|
346 |
+
* });
|
347 |
+
*
|
348 |
+
* @name $.jstree.defaults.core.check_callback
|
349 |
+
*/
|
350 |
+
check_callback : false,
|
351 |
+
/**
|
352 |
+
* a callback called with a single object parameter in the instance's scope when something goes wrong (operation prevented, ajax failed, etc)
|
353 |
+
* @name $.jstree.defaults.core.error
|
354 |
+
*/
|
355 |
+
error : $.noop,
|
356 |
+
/**
|
357 |
+
* the open / close animation duration in milliseconds - set this to `false` to disable the animation (default is `200`)
|
358 |
+
* @name $.jstree.defaults.core.animation
|
359 |
+
*/
|
360 |
+
animation : 200,
|
361 |
+
/**
|
362 |
+
* a boolean indicating if multiple nodes can be selected
|
363 |
+
* @name $.jstree.defaults.core.multiple
|
364 |
+
*/
|
365 |
+
multiple : true,
|
366 |
+
/**
|
367 |
+
* theme configuration object
|
368 |
+
* @name $.jstree.defaults.core.themes
|
369 |
+
*/
|
370 |
+
themes : {
|
371 |
+
/**
|
372 |
+
* the name of the theme to use (if left as `false` the default theme is used)
|
373 |
+
* @name $.jstree.defaults.core.themes.name
|
374 |
+
*/
|
375 |
+
name : false,
|
376 |
+
/**
|
377 |
+
* the URL of the theme's CSS file, leave this as `false` if you have manually included the theme CSS (recommended). You can set this to `true` too which will try to autoload the theme.
|
378 |
+
* @name $.jstree.defaults.core.themes.url
|
379 |
+
*/
|
380 |
+
url : false,
|
381 |
+
/**
|
382 |
+
* the location of all jstree themes - only used if `url` is set to `true`
|
383 |
+
* @name $.jstree.defaults.core.themes.dir
|
384 |
+
*/
|
385 |
+
dir : false,
|
386 |
+
/**
|
387 |
+
* a boolean indicating if connecting dots are shown
|
388 |
+
* @name $.jstree.defaults.core.themes.dots
|
389 |
+
*/
|
390 |
+
dots : true,
|
391 |
+
/**
|
392 |
+
* a boolean indicating if node icons are shown
|
393 |
+
* @name $.jstree.defaults.core.themes.icons
|
394 |
+
*/
|
395 |
+
icons : true,
|
396 |
+
/**
|
397 |
+
* a boolean indicating if node ellipsis should be shown - this only works with a fixed with on the container
|
398 |
+
* @name $.jstree.defaults.core.themes.ellipsis
|
399 |
+
*/
|
400 |
+
ellipsis : false,
|
401 |
+
/**
|
402 |
+
* a boolean indicating if the tree background is striped
|
403 |
+
* @name $.jstree.defaults.core.themes.stripes
|
404 |
+
*/
|
405 |
+
stripes : false,
|
406 |
+
/**
|
407 |
+
* a string (or boolean `false`) specifying the theme variant to use (if the theme supports variants)
|
408 |
+
* @name $.jstree.defaults.core.themes.variant
|
409 |
+
*/
|
410 |
+
variant : false,
|
411 |
+
/**
|
412 |
+
* a boolean specifying if a reponsive version of the theme should kick in on smaller screens (if the theme supports it). Defaults to `false`.
|
413 |
+
* @name $.jstree.defaults.core.themes.responsive
|
414 |
+
*/
|
415 |
+
responsive : false
|
416 |
+
},
|
417 |
+
/**
|
418 |
+
* if left as `true` all parents of all selected nodes will be opened once the tree loads (so that all selected nodes are visible to the user)
|
419 |
+
* @name $.jstree.defaults.core.expand_selected_onload
|
420 |
+
*/
|
421 |
+
expand_selected_onload : true,
|
422 |
+
/**
|
423 |
+
* if left as `true` web workers will be used to parse incoming JSON data where possible, so that the UI will not be blocked by large requests. Workers are however about 30% slower. Defaults to `true`
|
424 |
+
* @name $.jstree.defaults.core.worker
|
425 |
+
*/
|
426 |
+
worker : true,
|
427 |
+
/**
|
428 |
+
* Force node text to plain text (and escape HTML). Defaults to `false`
|
429 |
+
* @name $.jstree.defaults.core.force_text
|
430 |
+
*/
|
431 |
+
force_text : false,
|
432 |
+
/**
|
433 |
+
* Should the node be toggled if the text is double clicked. Defaults to `true`
|
434 |
+
* @name $.jstree.defaults.core.dblclick_toggle
|
435 |
+
*/
|
436 |
+
dblclick_toggle : true,
|
437 |
+
/**
|
438 |
+
* Should the loaded nodes be part of the state. Defaults to `false`
|
439 |
+
* @name $.jstree.defaults.core.loaded_state
|
440 |
+
*/
|
441 |
+
loaded_state : false,
|
442 |
+
/**
|
443 |
+
* Should the last active node be focused when the tree container is blurred and the focused again. This helps working with screen readers. Defaults to `true`
|
444 |
+
* @name $.jstree.defaults.core.restore_focus
|
445 |
+
*/
|
446 |
+
restore_focus : true,
|
447 |
+
/**
|
448 |
+
* Default keyboard shortcuts (an object where each key is the button name or combo - like 'enter', 'ctrl-space', 'p', etc and the value is the function to execute in the instance's scope)
|
449 |
+
* @name $.jstree.defaults.core.keyboard
|
450 |
+
*/
|
451 |
+
keyboard : {
|
452 |
+
'ctrl-space': function (e) {
|
453 |
+
// aria defines space only with Ctrl
|
454 |
+
e.type = "click";
|
455 |
+
$(e.currentTarget).trigger(e);
|
456 |
+
},
|
457 |
+
'enter': function (e) {
|
458 |
+
// enter
|
459 |
+
e.type = "click";
|
460 |
+
$(e.currentTarget).trigger(e);
|
461 |
+
},
|
462 |
+
'left': function (e) {
|
463 |
+
// left
|
464 |
+
e.preventDefault();
|
465 |
+
if(this.is_open(e.currentTarget)) {
|
466 |
+
this.close_node(e.currentTarget);
|
467 |
+
}
|
468 |
+
else {
|
469 |
+
var o = this.get_parent(e.currentTarget);
|
470 |
+
if(o && o.id !== $.jstree.root) { this.get_node(o, true).children('.jstree-anchor').focus(); }
|
471 |
+
}
|
472 |
+
},
|
473 |
+
'up': function (e) {
|
474 |
+
// up
|
475 |
+
e.preventDefault();
|
476 |
+
var o = this.get_prev_dom(e.currentTarget);
|
477 |
+
if(o && o.length) { o.children('.jstree-anchor').focus(); }
|
478 |
+
},
|
479 |
+
'right': function (e) {
|
480 |
+
// right
|
481 |
+
e.preventDefault();
|
482 |
+
if(this.is_closed(e.currentTarget)) {
|
483 |
+
this.open_node(e.currentTarget, function (o) { this.get_node(o, true).children('.jstree-anchor').focus(); });
|
484 |
+
}
|
485 |
+
else if (this.is_open(e.currentTarget)) {
|
486 |
+
var o = this.get_node(e.currentTarget, true).children('.jstree-children')[0];
|
487 |
+
if(o) { $(this._firstChild(o)).children('.jstree-anchor').focus(); }
|
488 |
+
}
|
489 |
+
},
|
490 |
+
'down': function (e) {
|
491 |
+
// down
|
492 |
+
e.preventDefault();
|
493 |
+
var o = this.get_next_dom(e.currentTarget);
|
494 |
+
if(o && o.length) { o.children('.jstree-anchor').focus(); }
|
495 |
+
},
|
496 |
+
'*': function (e) {
|
497 |
+
// aria defines * on numpad as open_all - not very common
|
498 |
+
this.open_all();
|
499 |
+
},
|
500 |
+
'home': function (e) {
|
501 |
+
// home
|
502 |
+
e.preventDefault();
|
503 |
+
var o = this._firstChild(this.get_container_ul()[0]);
|
504 |
+
if(o) { $(o).children('.jstree-anchor').filter(':visible').focus(); }
|
505 |
+
},
|
506 |
+
'end': function (e) {
|
507 |
+
// end
|
508 |
+
e.preventDefault();
|
509 |
+
this.element.find('.jstree-anchor').filter(':visible').last().focus();
|
510 |
+
},
|
511 |
+
'f2': function (e) {
|
512 |
+
// f2 - safe to include - if check_callback is false it will fail
|
513 |
+
e.preventDefault();
|
514 |
+
this.edit(e.currentTarget);
|
515 |
+
}
|
516 |
+
}
|
517 |
+
};
|
518 |
+
$.jstree.core.prototype = {
|
519 |
+
/**
|
520 |
+
* used to decorate an instance with a plugin. Used internally.
|
521 |
+
* @private
|
522 |
+
* @name plugin(deco [, opts])
|
523 |
+
* @param {String} deco the plugin to decorate with
|
524 |
+
* @param {Object} opts options for the plugin
|
525 |
+
* @return {jsTree}
|
526 |
+
*/
|
527 |
+
plugin : function (deco, opts) {
|
528 |
+
var Child = $.jstree.plugins[deco];
|
529 |
+
if(Child) {
|
530 |
+
this._data[deco] = {};
|
531 |
+
Child.prototype = this;
|
532 |
+
return new Child(opts, this);
|
533 |
+
}
|
534 |
+
return this;
|
535 |
+
},
|
536 |
+
/**
|
537 |
+
* initialize the instance. Used internally.
|
538 |
+
* @private
|
539 |
+
* @name init(el, optons)
|
540 |
+
* @param {DOMElement|jQuery|String} el the element we are transforming
|
541 |
+
* @param {Object} options options for this instance
|
542 |
+
* @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree
|
543 |
+
*/
|
544 |
+
init : function (el, options) {
|
545 |
+
this._model = {
|
546 |
+
data : {},
|
547 |
+
changed : [],
|
548 |
+
force_full_redraw : false,
|
549 |
+
redraw_timeout : false,
|
550 |
+
default_state : {
|
551 |
+
loaded : true,
|
552 |
+
opened : false,
|
553 |
+
selected : false,
|
554 |
+
disabled : false
|
555 |
+
}
|
556 |
+
};
|
557 |
+
this._model.data[$.jstree.root] = {
|
558 |
+
id : $.jstree.root,
|
559 |
+
parent : null,
|
560 |
+
parents : [],
|
561 |
+
children : [],
|
562 |
+
children_d : [],
|
563 |
+
state : { loaded : false }
|
564 |
+
};
|
565 |
+
|
566 |
+
this.element = $(el).addClass('jstree jstree-' + this._id);
|
567 |
+
this.settings = options;
|
568 |
+
|
569 |
+
this._data.core.ready = false;
|
570 |
+
this._data.core.loaded = false;
|
571 |
+
this._data.core.rtl = (this.element.css("direction") === "rtl");
|
572 |
+
this.element[this._data.core.rtl ? 'addClass' : 'removeClass']("jstree-rtl");
|
573 |
+
this.element.attr('role','tree');
|
574 |
+
if(this.settings.core.multiple) {
|
575 |
+
this.element.attr('aria-multiselectable', true);
|
576 |
+
}
|
577 |
+
if(!this.element.attr('tabindex')) {
|
578 |
+
this.element.attr('tabindex','0');
|
579 |
+
}
|
580 |
+
|
581 |
+
this.bind();
|
582 |
+
/**
|
583 |
+
* triggered after all events are bound
|
584 |
+
* @event
|
585 |
+
* @name init.jstree
|
586 |
+
*/
|
587 |
+
this.trigger("init");
|
588 |
+
|
589 |
+
this._data.core.original_container_html = this.element.find(" > ul > li").clone(true);
|
590 |
+
this._data.core.original_container_html
|
591 |
+
.find("li").addBack()
|
592 |
+
.contents().filter(function() {
|
593 |
+
return this.nodeType === 3 && (!this.nodeValue || /^\s+$/.test(this.nodeValue));
|
594 |
+
})
|
595 |
+
.remove();
|
596 |
+
this.element.html("<"+"ul class='jstree-container-ul jstree-children' role='group'><"+"li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><i class='jstree-icon jstree-ocl'></i><"+"a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>" + this.get_string("Loading ...") + "</a></li></ul>");
|
597 |
+
this.element.attr('aria-activedescendant','j' + this._id + '_loading');
|
598 |
+
this._data.core.li_height = this.get_container_ul().children("li").first().outerHeight() || 24;
|
599 |
+
this._data.core.node = this._create_prototype_node();
|
600 |
+
/**
|
601 |
+
* triggered after the loading text is shown and before loading starts
|
602 |
+
* @event
|
603 |
+
* @name loading.jstree
|
604 |
+
*/
|
605 |
+
this.trigger("loading");
|
606 |
+
this.load_node($.jstree.root);
|
607 |
+
},
|
608 |
+
/**
|
609 |
+
* destroy an instance
|
610 |
+
* @name destroy()
|
611 |
+
* @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact
|
612 |
+
*/
|
613 |
+
destroy : function (keep_html) {
|
614 |
+
/**
|
615 |
+
* triggered before the tree is destroyed
|
616 |
+
* @event
|
617 |
+
* @name destroy.jstree
|
618 |
+
*/
|
619 |
+
this.trigger("destroy");
|
620 |
+
if(this._wrk) {
|
621 |
+
try {
|
622 |
+
window.URL.revokeObjectURL(this._wrk);
|
623 |
+
this._wrk = null;
|
624 |
+
}
|
625 |
+
catch (ignore) { }
|
626 |
+
}
|
627 |
+
if(!keep_html) { this.element.empty(); }
|
628 |
+
this.teardown();
|
629 |
+
},
|
630 |
+
/**
|
631 |
+
* Create a prototype node
|
632 |
+
* @name _create_prototype_node()
|
633 |
+
* @return {DOMElement}
|
634 |
+
*/
|
635 |
+
_create_prototype_node : function () {
|
636 |
+
var _node = document.createElement('LI'), _temp1, _temp2;
|
637 |
+
_node.setAttribute('role', 'treeitem');
|
638 |
+
_temp1 = document.createElement('I');
|
639 |
+
_temp1.className = 'jstree-icon jstree-ocl';
|
640 |
+
_temp1.setAttribute('role', 'presentation');
|
641 |
+
_node.appendChild(_temp1);
|
642 |
+
_temp1 = document.createElement('A');
|
643 |
+
_temp1.className = 'jstree-anchor';
|
644 |
+
_temp1.setAttribute('href','#');
|
645 |
+
_temp1.setAttribute('tabindex','-1');
|
646 |
+
_temp2 = document.createElement('I');
|
647 |
+
_temp2.className = 'jstree-icon jstree-themeicon';
|
648 |
+
_temp2.setAttribute('role', 'presentation');
|
649 |
+
_temp1.appendChild(_temp2);
|
650 |
+
_node.appendChild(_temp1);
|
651 |
+
_temp1 = _temp2 = null;
|
652 |
+
|
653 |
+
return _node;
|
654 |
+
},
|
655 |
+
_kbevent_to_func : function (e) {
|
656 |
+
var keys = {
|
657 |
+
8: "Backspace", 9: "Tab", 13: "Return", 19: "Pause", 27: "Esc",
|
658 |
+
32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home",
|
659 |
+
37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "Print", 45: "Insert",
|
660 |
+
46: "Delete", 96: "Numpad0", 97: "Numpad1", 98: "Numpad2", 99 : "Numpad3",
|
661 |
+
100: "Numpad4", 101: "Numpad5", 102: "Numpad6", 103: "Numpad7",
|
662 |
+
104: "Numpad8", 105: "Numpad9", '-13': "NumpadEnter", 112: "F1",
|
663 |
+
113: "F2", 114: "F3", 115: "F4", 116: "F5", 117: "F6", 118: "F7",
|
664 |
+
119: "F8", 120: "F9", 121: "F10", 122: "F11", 123: "F12", 144: "Numlock",
|
665 |
+
145: "Scrolllock", 16: 'Shift', 17: 'Ctrl', 18: 'Alt',
|
666 |
+
48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5',
|
667 |
+
54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a',
|
668 |
+
66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h',
|
669 |
+
73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',
|
670 |
+
80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',
|
671 |
+
87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',
|
672 |
+
186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`',
|
673 |
+
219: '[', 220: '\\',221: ']', 222: "'", 111: '/', 106: '*', 173: '-'
|
674 |
+
};
|
675 |
+
var parts = [];
|
676 |
+
if (e.ctrlKey) { parts.push('ctrl'); }
|
677 |
+
if (e.altKey) { parts.push('alt'); }
|
678 |
+
if (e.shiftKey) { parts.push('shift'); }
|
679 |
+
parts.push(keys[e.which] || e.which);
|
680 |
+
parts = parts.sort().join('-').toLowerCase();
|
681 |
+
|
682 |
+
var kb = this.settings.core.keyboard, i, tmp;
|
683 |
+
for (i in kb) {
|
684 |
+
if (kb.hasOwnProperty(i)) {
|
685 |
+
tmp = i;
|
686 |
+
if (tmp !== '-' && tmp !== '+') {
|
687 |
+
tmp = tmp.replace('--', '-MINUS').replace('+-', '-MINUS').replace('++', '-PLUS').replace('-+', '-PLUS');
|
688 |
+
tmp = tmp.split(/-|\+/).sort().join('-').replace('MINUS', '-').replace('PLUS', '+').toLowerCase();
|
689 |
+
}
|
690 |
+
if (tmp === parts) {
|
691 |
+
return kb[i];
|
692 |
+
}
|
693 |
+
}
|
694 |
+
}
|
695 |
+
return null;
|
696 |
+
},
|
697 |
+
/**
|
698 |
+
* part of the destroying of an instance. Used internally.
|
699 |
+
* @private
|
700 |
+
* @name teardown()
|
701 |
+
*/
|
702 |
+
teardown : function () {
|
703 |
+
this.unbind();
|
704 |
+
this.element
|
705 |
+
.removeClass('jstree')
|
706 |
+
.removeData('jstree')
|
707 |
+
.find("[class^='jstree']")
|
708 |
+
.addBack()
|
709 |
+
.attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });
|
710 |
+
this.element = null;
|
711 |
+
},
|
712 |
+
/**
|
713 |
+
* bind all events. Used internally.
|
714 |
+
* @private
|
715 |
+
* @name bind()
|
716 |
+
*/
|
717 |
+
bind : function () {
|
718 |
+
var word = '',
|
719 |
+
tout = null,
|
720 |
+
was_click = 0;
|
721 |
+
this.element
|
722 |
+
.on("dblclick.jstree", function (e) {
|
723 |
+
if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; }
|
724 |
+
if(document.selection && document.selection.empty) {
|
725 |
+
document.selection.empty();
|
726 |
+
}
|
727 |
+
else {
|
728 |
+
if(window.getSelection) {
|
729 |
+
var sel = window.getSelection();
|
730 |
+
try {
|
731 |
+
sel.removeAllRanges();
|
732 |
+
sel.collapse();
|
733 |
+
} catch (ignore) { }
|
734 |
+
}
|
735 |
+
}
|
736 |
+
})
|
737 |
+
.on("mousedown.jstree", $.proxy(function (e) {
|
738 |
+
if(e.target === this.element[0]) {
|
739 |
+
e.preventDefault(); // prevent losing focus when clicking scroll arrows (FF, Chrome)
|
740 |
+
was_click = +(new Date()); // ie does not allow to prevent losing focus
|
741 |
+
}
|
742 |
+
}, this))
|
743 |
+
.on("mousedown.jstree", ".jstree-ocl", function (e) {
|
744 |
+
e.preventDefault(); // prevent any node inside from losing focus when clicking the open/close icon
|
745 |
+
})
|
746 |
+
.on("click.jstree", ".jstree-ocl", $.proxy(function (e) {
|
747 |
+
this.toggle_node(e.target);
|
748 |
+
}, this))
|
749 |
+
.on("dblclick.jstree", ".jstree-anchor", $.proxy(function (e) {
|
750 |
+
if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; }
|
751 |
+
if(this.settings.core.dblclick_toggle) {
|
752 |
+
this.toggle_node(e.target);
|
753 |
+
}
|
754 |
+
}, this))
|
755 |
+
.on("click.jstree", ".jstree-anchor", $.proxy(function (e) {
|
756 |
+
e.preventDefault();
|
757 |
+
if(e.currentTarget !== document.activeElement) { $(e.currentTarget).focus(); }
|
758 |
+
this.activate_node(e.currentTarget, e);
|
759 |
+
}, this))
|
760 |
+
.on('keydown.jstree', '.jstree-anchor', $.proxy(function (e) {
|
761 |
+
if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; }
|
762 |
+
if(this._data.core.rtl) {
|
763 |
+
if(e.which === 37) { e.which = 39; }
|
764 |
+
else if(e.which === 39) { e.which = 37; }
|
765 |
+
}
|
766 |
+
var f = this._kbevent_to_func(e);
|
767 |
+
if (f) {
|
768 |
+
var r = f.call(this, e);
|
769 |
+
if (r === false || r === true) {
|
770 |
+
return r;
|
771 |
+
}
|
772 |
+
}
|
773 |
+
}, this))
|
774 |
+
.on("load_node.jstree", $.proxy(function (e, data) {
|
775 |
+
if(data.status) {
|
776 |
+
if(data.node.id === $.jstree.root && !this._data.core.loaded) {
|
777 |
+
this._data.core.loaded = true;
|
778 |
+
if(this._firstChild(this.get_container_ul()[0])) {
|
779 |
+
this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id);
|
780 |
+
}
|
781 |
+
/**
|
782 |
+
* triggered after the root node is loaded for the first time
|
783 |
+
* @event
|
784 |
+
* @name loaded.jstree
|
785 |
+
*/
|
786 |
+
this.trigger("loaded");
|
787 |
+
}
|
788 |
+
if(!this._data.core.ready) {
|
789 |
+
setTimeout($.proxy(function() {
|
790 |
+
if(this.element && !this.get_container_ul().find('.jstree-loading').length) {
|
791 |
+
this._data.core.ready = true;
|
792 |
+
if(this._data.core.selected.length) {
|
793 |
+
if(this.settings.core.expand_selected_onload) {
|
794 |
+
var tmp = [], i, j;
|
795 |
+
for(i = 0, j = this._data.core.selected.length; i < j; i++) {
|
796 |
+
tmp = tmp.concat(this._model.data[this._data.core.selected[i]].parents);
|
797 |
+
}
|
798 |
+
tmp = $.vakata.array_unique(tmp);
|
799 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
800 |
+
this.open_node(tmp[i], false, 0);
|
801 |
+
}
|
802 |
+
}
|
803 |
+
this.trigger('changed', { 'action' : 'ready', 'selected' : this._data.core.selected });
|
804 |
+
}
|
805 |
+
/**
|
806 |
+
* triggered after all nodes are finished loading
|
807 |
+
* @event
|
808 |
+
* @name ready.jstree
|
809 |
+
*/
|
810 |
+
this.trigger("ready");
|
811 |
+
}
|
812 |
+
}, this), 0);
|
813 |
+
}
|
814 |
+
}
|
815 |
+
}, this))
|
816 |
+
// quick searching when the tree is focused
|
817 |
+
.on('keypress.jstree', $.proxy(function (e) {
|
818 |
+
if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; }
|
819 |
+
if(tout) { clearTimeout(tout); }
|
820 |
+
tout = setTimeout(function () {
|
821 |
+
word = '';
|
822 |
+
}, 500);
|
823 |
+
|
824 |
+
var chr = String.fromCharCode(e.which).toLowerCase(),
|
825 |
+
col = this.element.find('.jstree-anchor').filter(':visible'),
|
826 |
+
ind = col.index(document.activeElement) || 0,
|
827 |
+
end = false;
|
828 |
+
word += chr;
|
829 |
+
|
830 |
+
// match for whole word from current node down (including the current node)
|
831 |
+
if(word.length > 1) {
|
832 |
+
col.slice(ind).each($.proxy(function (i, v) {
|
833 |
+
if($(v).text().toLowerCase().indexOf(word) === 0) {
|
834 |
+
$(v).focus();
|
835 |
+
end = true;
|
836 |
+
return false;
|
837 |
+
}
|
838 |
+
}, this));
|
839 |
+
if(end) { return; }
|
840 |
+
|
841 |
+
// match for whole word from the beginning of the tree
|
842 |
+
col.slice(0, ind).each($.proxy(function (i, v) {
|
843 |
+
if($(v).text().toLowerCase().indexOf(word) === 0) {
|
844 |
+
$(v).focus();
|
845 |
+
end = true;
|
846 |
+
return false;
|
847 |
+
}
|
848 |
+
}, this));
|
849 |
+
if(end) { return; }
|
850 |
+
}
|
851 |
+
// list nodes that start with that letter (only if word consists of a single char)
|
852 |
+
if(new RegExp('^' + chr.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '+$').test(word)) {
|
853 |
+
// search for the next node starting with that letter
|
854 |
+
col.slice(ind + 1).each($.proxy(function (i, v) {
|
855 |
+
if($(v).text().toLowerCase().charAt(0) === chr) {
|
856 |
+
$(v).focus();
|
857 |
+
end = true;
|
858 |
+
return false;
|
859 |
+
}
|
860 |
+
}, this));
|
861 |
+
if(end) { return; }
|
862 |
+
|
863 |
+
// search from the beginning
|
864 |
+
col.slice(0, ind + 1).each($.proxy(function (i, v) {
|
865 |
+
if($(v).text().toLowerCase().charAt(0) === chr) {
|
866 |
+
$(v).focus();
|
867 |
+
end = true;
|
868 |
+
return false;
|
869 |
+
}
|
870 |
+
}, this));
|
871 |
+
if(end) { return; }
|
872 |
+
}
|
873 |
+
}, this))
|
874 |
+
// THEME RELATED
|
875 |
+
.on("init.jstree", $.proxy(function () {
|
876 |
+
var s = this.settings.core.themes;
|
877 |
+
this._data.core.themes.dots = s.dots;
|
878 |
+
this._data.core.themes.stripes = s.stripes;
|
879 |
+
this._data.core.themes.icons = s.icons;
|
880 |
+
this._data.core.themes.ellipsis = s.ellipsis;
|
881 |
+
this.set_theme(s.name || "default", s.url);
|
882 |
+
this.set_theme_variant(s.variant);
|
883 |
+
}, this))
|
884 |
+
.on("loading.jstree", $.proxy(function () {
|
885 |
+
this[ this._data.core.themes.dots ? "show_dots" : "hide_dots" ]();
|
886 |
+
this[ this._data.core.themes.icons ? "show_icons" : "hide_icons" ]();
|
887 |
+
this[ this._data.core.themes.stripes ? "show_stripes" : "hide_stripes" ]();
|
888 |
+
this[ this._data.core.themes.ellipsis ? "show_ellipsis" : "hide_ellipsis" ]();
|
889 |
+
}, this))
|
890 |
+
.on('blur.jstree', '.jstree-anchor', $.proxy(function (e) {
|
891 |
+
this._data.core.focused = null;
|
892 |
+
$(e.currentTarget).filter('.jstree-hovered').mouseleave();
|
893 |
+
this.element.attr('tabindex', '0');
|
894 |
+
}, this))
|
895 |
+
.on('focus.jstree', '.jstree-anchor', $.proxy(function (e) {
|
896 |
+
var tmp = this.get_node(e.currentTarget);
|
897 |
+
if(tmp && tmp.id) {
|
898 |
+
this._data.core.focused = tmp.id;
|
899 |
+
}
|
900 |
+
this.element.find('.jstree-hovered').not(e.currentTarget).mouseleave();
|
901 |
+
$(e.currentTarget).mouseenter();
|
902 |
+
this.element.attr('tabindex', '-1');
|
903 |
+
}, this))
|
904 |
+
.on('focus.jstree', $.proxy(function () {
|
905 |
+
if(+(new Date()) - was_click > 500 && !this._data.core.focused && this.settings.core.restore_focus) {
|
906 |
+
was_click = 0;
|
907 |
+
var act = this.get_node(this.element.attr('aria-activedescendant'), true);
|
908 |
+
if(act) {
|
909 |
+
act.find('> .jstree-anchor').focus();
|
910 |
+
}
|
911 |
+
}
|
912 |
+
}, this))
|
913 |
+
.on('mouseenter.jstree', '.jstree-anchor', $.proxy(function (e) {
|
914 |
+
this.hover_node(e.currentTarget);
|
915 |
+
}, this))
|
916 |
+
.on('mouseleave.jstree', '.jstree-anchor', $.proxy(function (e) {
|
917 |
+
this.dehover_node(e.currentTarget);
|
918 |
+
}, this));
|
919 |
+
},
|
920 |
+
/**
|
921 |
+
* part of the destroying of an instance. Used internally.
|
922 |
+
* @private
|
923 |
+
* @name unbind()
|
924 |
+
*/
|
925 |
+
unbind : function () {
|
926 |
+
this.element.off('.jstree');
|
927 |
+
$(document).off('.jstree-' + this._id);
|
928 |
+
},
|
929 |
+
/**
|
930 |
+
* trigger an event. Used internally.
|
931 |
+
* @private
|
932 |
+
* @name trigger(ev [, data])
|
933 |
+
* @param {String} ev the name of the event to trigger
|
934 |
+
* @param {Object} data additional data to pass with the event
|
935 |
+
*/
|
936 |
+
trigger : function (ev, data) {
|
937 |
+
if(!data) {
|
938 |
+
data = {};
|
939 |
+
}
|
940 |
+
data.instance = this;
|
941 |
+
this.element.triggerHandler(ev.replace('.jstree','') + '.jstree', data);
|
942 |
+
},
|
943 |
+
/**
|
944 |
+
* returns the jQuery extended instance container
|
945 |
+
* @name get_container()
|
946 |
+
* @return {jQuery}
|
947 |
+
*/
|
948 |
+
get_container : function () {
|
949 |
+
return this.element;
|
950 |
+
},
|
951 |
+
/**
|
952 |
+
* returns the jQuery extended main UL node inside the instance container. Used internally.
|
953 |
+
* @private
|
954 |
+
* @name get_container_ul()
|
955 |
+
* @return {jQuery}
|
956 |
+
*/
|
957 |
+
get_container_ul : function () {
|
958 |
+
return this.element.children(".jstree-children").first();
|
959 |
+
},
|
960 |
+
/**
|
961 |
+
* gets string replacements (localization). Used internally.
|
962 |
+
* @private
|
963 |
+
* @name get_string(key)
|
964 |
+
* @param {String} key
|
965 |
+
* @return {String}
|
966 |
+
*/
|
967 |
+
get_string : function (key) {
|
968 |
+
var a = this.settings.core.strings;
|
969 |
+
if($.isFunction(a)) { return a.call(this, key); }
|
970 |
+
if(a && a[key]) { return a[key]; }
|
971 |
+
return key;
|
972 |
+
},
|
973 |
+
/**
|
974 |
+
* gets the first child of a DOM node. Used internally.
|
975 |
+
* @private
|
976 |
+
* @name _firstChild(dom)
|
977 |
+
* @param {DOMElement} dom
|
978 |
+
* @return {DOMElement}
|
979 |
+
*/
|
980 |
+
_firstChild : function (dom) {
|
981 |
+
dom = dom ? dom.firstChild : null;
|
982 |
+
while(dom !== null && dom.nodeType !== 1) {
|
983 |
+
dom = dom.nextSibling;
|
984 |
+
}
|
985 |
+
return dom;
|
986 |
+
},
|
987 |
+
/**
|
988 |
+
* gets the next sibling of a DOM node. Used internally.
|
989 |
+
* @private
|
990 |
+
* @name _nextSibling(dom)
|
991 |
+
* @param {DOMElement} dom
|
992 |
+
* @return {DOMElement}
|
993 |
+
*/
|
994 |
+
_nextSibling : function (dom) {
|
995 |
+
dom = dom ? dom.nextSibling : null;
|
996 |
+
while(dom !== null && dom.nodeType !== 1) {
|
997 |
+
dom = dom.nextSibling;
|
998 |
+
}
|
999 |
+
return dom;
|
1000 |
+
},
|
1001 |
+
/**
|
1002 |
+
* gets the previous sibling of a DOM node. Used internally.
|
1003 |
+
* @private
|
1004 |
+
* @name _previousSibling(dom)
|
1005 |
+
* @param {DOMElement} dom
|
1006 |
+
* @return {DOMElement}
|
1007 |
+
*/
|
1008 |
+
_previousSibling : function (dom) {
|
1009 |
+
dom = dom ? dom.previousSibling : null;
|
1010 |
+
while(dom !== null && dom.nodeType !== 1) {
|
1011 |
+
dom = dom.previousSibling;
|
1012 |
+
}
|
1013 |
+
return dom;
|
1014 |
+
},
|
1015 |
+
/**
|
1016 |
+
* get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc)
|
1017 |
+
* @name get_node(obj [, as_dom])
|
1018 |
+
* @param {mixed} obj
|
1019 |
+
* @param {Boolean} as_dom
|
1020 |
+
* @return {Object|jQuery}
|
1021 |
+
*/
|
1022 |
+
get_node : function (obj, as_dom) {
|
1023 |
+
if(obj && obj.id) {
|
1024 |
+
obj = obj.id;
|
1025 |
+
}
|
1026 |
+
if (obj instanceof jQuery && obj.length && obj[0].id) {
|
1027 |
+
obj = obj[0].id;
|
1028 |
+
}
|
1029 |
+
var dom;
|
1030 |
+
try {
|
1031 |
+
if(this._model.data[obj]) {
|
1032 |
+
obj = this._model.data[obj];
|
1033 |
+
}
|
1034 |
+
else if(typeof obj === "string" && this._model.data[obj.replace(/^#/, '')]) {
|
1035 |
+
obj = this._model.data[obj.replace(/^#/, '')];
|
1036 |
+
}
|
1037 |
+
else if(typeof obj === "string" && (dom = $('#' + obj.replace($.jstree.idregex,'\\$&'), this.element)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) {
|
1038 |
+
obj = this._model.data[dom.closest('.jstree-node').attr('id')];
|
1039 |
+
}
|
1040 |
+
else if((dom = this.element.find(obj)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) {
|
1041 |
+
obj = this._model.data[dom.closest('.jstree-node').attr('id')];
|
1042 |
+
}
|
1043 |
+
else if((dom = this.element.find(obj)).length && dom.hasClass('jstree')) {
|
1044 |
+
obj = this._model.data[$.jstree.root];
|
1045 |
+
}
|
1046 |
+
else {
|
1047 |
+
return false;
|
1048 |
+
}
|
1049 |
+
|
1050 |
+
if(as_dom) {
|
1051 |
+
obj = obj.id === $.jstree.root ? this.element : $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element);
|
1052 |
+
}
|
1053 |
+
return obj;
|
1054 |
+
} catch (ex) { return false; }
|
1055 |
+
},
|
1056 |
+
/**
|
1057 |
+
* get the path to a node, either consisting of node texts, or of node IDs, optionally glued together (otherwise an array)
|
1058 |
+
* @name get_path(obj [, glue, ids])
|
1059 |
+
* @param {mixed} obj the node
|
1060 |
+
* @param {String} glue if you want the path as a string - pass the glue here (for example '/'), if a falsy value is supplied here, an array is returned
|
1061 |
+
* @param {Boolean} ids if set to true build the path using ID, otherwise node text is used
|
1062 |
+
* @return {mixed}
|
1063 |
+
*/
|
1064 |
+
get_path : function (obj, glue, ids) {
|
1065 |
+
obj = obj.parents ? obj : this.get_node(obj);
|
1066 |
+
if(!obj || obj.id === $.jstree.root || !obj.parents) {
|
1067 |
+
return false;
|
1068 |
+
}
|
1069 |
+
var i, j, p = [];
|
1070 |
+
p.push(ids ? obj.id : obj.text);
|
1071 |
+
for(i = 0, j = obj.parents.length; i < j; i++) {
|
1072 |
+
p.push(ids ? obj.parents[i] : this.get_text(obj.parents[i]));
|
1073 |
+
}
|
1074 |
+
p = p.reverse().slice(1);
|
1075 |
+
return glue ? p.join(glue) : p;
|
1076 |
+
},
|
1077 |
+
/**
|
1078 |
+
* get the next visible node that is below the `obj` node. If `strict` is set to `true` only sibling nodes are returned.
|
1079 |
+
* @name get_next_dom(obj [, strict])
|
1080 |
+
* @param {mixed} obj
|
1081 |
+
* @param {Boolean} strict
|
1082 |
+
* @return {jQuery}
|
1083 |
+
*/
|
1084 |
+
get_next_dom : function (obj, strict) {
|
1085 |
+
var tmp;
|
1086 |
+
obj = this.get_node(obj, true);
|
1087 |
+
if(obj[0] === this.element[0]) {
|
1088 |
+
tmp = this._firstChild(this.get_container_ul()[0]);
|
1089 |
+
while (tmp && tmp.offsetHeight === 0) {
|
1090 |
+
tmp = this._nextSibling(tmp);
|
1091 |
+
}
|
1092 |
+
return tmp ? $(tmp) : false;
|
1093 |
+
}
|
1094 |
+
if(!obj || !obj.length) {
|
1095 |
+
return false;
|
1096 |
+
}
|
1097 |
+
if(strict) {
|
1098 |
+
tmp = obj[0];
|
1099 |
+
do {
|
1100 |
+
tmp = this._nextSibling(tmp);
|
1101 |
+
} while (tmp && tmp.offsetHeight === 0);
|
1102 |
+
return tmp ? $(tmp) : false;
|
1103 |
+
}
|
1104 |
+
if(obj.hasClass("jstree-open")) {
|
1105 |
+
tmp = this._firstChild(obj.children('.jstree-children')[0]);
|
1106 |
+
while (tmp && tmp.offsetHeight === 0) {
|
1107 |
+
tmp = this._nextSibling(tmp);
|
1108 |
+
}
|
1109 |
+
if(tmp !== null) {
|
1110 |
+
return $(tmp);
|
1111 |
+
}
|
1112 |
+
}
|
1113 |
+
tmp = obj[0];
|
1114 |
+
do {
|
1115 |
+
tmp = this._nextSibling(tmp);
|
1116 |
+
} while (tmp && tmp.offsetHeight === 0);
|
1117 |
+
if(tmp !== null) {
|
1118 |
+
return $(tmp);
|
1119 |
+
}
|
1120 |
+
return obj.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first();
|
1121 |
+
},
|
1122 |
+
/**
|
1123 |
+
* get the previous visible node that is above the `obj` node. If `strict` is set to `true` only sibling nodes are returned.
|
1124 |
+
* @name get_prev_dom(obj [, strict])
|
1125 |
+
* @param {mixed} obj
|
1126 |
+
* @param {Boolean} strict
|
1127 |
+
* @return {jQuery}
|
1128 |
+
*/
|
1129 |
+
get_prev_dom : function (obj, strict) {
|
1130 |
+
var tmp;
|
1131 |
+
obj = this.get_node(obj, true);
|
1132 |
+
if(obj[0] === this.element[0]) {
|
1133 |
+
tmp = this.get_container_ul()[0].lastChild;
|
1134 |
+
while (tmp && tmp.offsetHeight === 0) {
|
1135 |
+
tmp = this._previousSibling(tmp);
|
1136 |
+
}
|
1137 |
+
return tmp ? $(tmp) : false;
|
1138 |
+
}
|
1139 |
+
if(!obj || !obj.length) {
|
1140 |
+
return false;
|
1141 |
+
}
|
1142 |
+
if(strict) {
|
1143 |
+
tmp = obj[0];
|
1144 |
+
do {
|
1145 |
+
tmp = this._previousSibling(tmp);
|
1146 |
+
} while (tmp && tmp.offsetHeight === 0);
|
1147 |
+
return tmp ? $(tmp) : false;
|
1148 |
+
}
|
1149 |
+
tmp = obj[0];
|
1150 |
+
do {
|
1151 |
+
tmp = this._previousSibling(tmp);
|
1152 |
+
} while (tmp && tmp.offsetHeight === 0);
|
1153 |
+
if(tmp !== null) {
|
1154 |
+
obj = $(tmp);
|
1155 |
+
while(obj.hasClass("jstree-open")) {
|
1156 |
+
obj = obj.children(".jstree-children").first().children(".jstree-node:visible:last");
|
1157 |
+
}
|
1158 |
+
return obj;
|
1159 |
+
}
|
1160 |
+
tmp = obj[0].parentNode.parentNode;
|
1161 |
+
return tmp && tmp.className && tmp.className.indexOf('jstree-node') !== -1 ? $(tmp) : false;
|
1162 |
+
},
|
1163 |
+
/**
|
1164 |
+
* get the parent ID of a node
|
1165 |
+
* @name get_parent(obj)
|
1166 |
+
* @param {mixed} obj
|
1167 |
+
* @return {String}
|
1168 |
+
*/
|
1169 |
+
get_parent : function (obj) {
|
1170 |
+
obj = this.get_node(obj);
|
1171 |
+
if(!obj || obj.id === $.jstree.root) {
|
1172 |
+
return false;
|
1173 |
+
}
|
1174 |
+
return obj.parent;
|
1175 |
+
},
|
1176 |
+
/**
|
1177 |
+
* get a jQuery collection of all the children of a node (node must be rendered), returns false on error
|
1178 |
+
* @name get_children_dom(obj)
|
1179 |
+
* @param {mixed} obj
|
1180 |
+
* @return {jQuery}
|
1181 |
+
*/
|
1182 |
+
get_children_dom : function (obj) {
|
1183 |
+
obj = this.get_node(obj, true);
|
1184 |
+
if(obj[0] === this.element[0]) {
|
1185 |
+
return this.get_container_ul().children(".jstree-node");
|
1186 |
+
}
|
1187 |
+
if(!obj || !obj.length) {
|
1188 |
+
return false;
|
1189 |
+
}
|
1190 |
+
return obj.children(".jstree-children").children(".jstree-node");
|
1191 |
+
},
|
1192 |
+
/**
|
1193 |
+
* checks if a node has children
|
1194 |
+
* @name is_parent(obj)
|
1195 |
+
* @param {mixed} obj
|
1196 |
+
* @return {Boolean}
|
1197 |
+
*/
|
1198 |
+
is_parent : function (obj) {
|
1199 |
+
obj = this.get_node(obj);
|
1200 |
+
return obj && (obj.state.loaded === false || obj.children.length > 0);
|
1201 |
+
},
|
1202 |
+
/**
|
1203 |
+
* checks if a node is loaded (its children are available)
|
1204 |
+
* @name is_loaded(obj)
|
1205 |
+
* @param {mixed} obj
|
1206 |
+
* @return {Boolean}
|
1207 |
+
*/
|
1208 |
+
is_loaded : function (obj) {
|
1209 |
+
obj = this.get_node(obj);
|
1210 |
+
return obj && obj.state.loaded;
|
1211 |
+
},
|
1212 |
+
/**
|
1213 |
+
* check if a node is currently loading (fetching children)
|
1214 |
+
* @name is_loading(obj)
|
1215 |
+
* @param {mixed} obj
|
1216 |
+
* @return {Boolean}
|
1217 |
+
*/
|
1218 |
+
is_loading : function (obj) {
|
1219 |
+
obj = this.get_node(obj);
|
1220 |
+
return obj && obj.state && obj.state.loading;
|
1221 |
+
},
|
1222 |
+
/**
|
1223 |
+
* check if a node is opened
|
1224 |
+
* @name is_open(obj)
|
1225 |
+
* @param {mixed} obj
|
1226 |
+
* @return {Boolean}
|
1227 |
+
*/
|
1228 |
+
is_open : function (obj) {
|
1229 |
+
obj = this.get_node(obj);
|
1230 |
+
return obj && obj.state.opened;
|
1231 |
+
},
|
1232 |
+
/**
|
1233 |
+
* check if a node is in a closed state
|
1234 |
+
* @name is_closed(obj)
|
1235 |
+
* @param {mixed} obj
|
1236 |
+
* @return {Boolean}
|
1237 |
+
*/
|
1238 |
+
is_closed : function (obj) {
|
1239 |
+
obj = this.get_node(obj);
|
1240 |
+
return obj && this.is_parent(obj) && !obj.state.opened;
|
1241 |
+
},
|
1242 |
+
/**
|
1243 |
+
* check if a node has no children
|
1244 |
+
* @name is_leaf(obj)
|
1245 |
+
* @param {mixed} obj
|
1246 |
+
* @return {Boolean}
|
1247 |
+
*/
|
1248 |
+
is_leaf : function (obj) {
|
1249 |
+
return !this.is_parent(obj);
|
1250 |
+
},
|
1251 |
+
/**
|
1252 |
+
* loads a node (fetches its children using the `core.data` setting). Multiple nodes can be passed to by using an array.
|
1253 |
+
* @name load_node(obj [, callback])
|
1254 |
+
* @param {mixed} obj
|
1255 |
+
* @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives two arguments - the node and a boolean status
|
1256 |
+
* @return {Boolean}
|
1257 |
+
* @trigger load_node.jstree
|
1258 |
+
*/
|
1259 |
+
load_node : function (obj, callback) {
|
1260 |
+
var k, l, i, j, c;
|
1261 |
+
if($.isArray(obj)) {
|
1262 |
+
this._load_nodes(obj.slice(), callback);
|
1263 |
+
return true;
|
1264 |
+
}
|
1265 |
+
obj = this.get_node(obj);
|
1266 |
+
if(!obj) {
|
1267 |
+
if(callback) { callback.call(this, obj, false); }
|
1268 |
+
return false;
|
1269 |
+
}
|
1270 |
+
// if(obj.state.loading) { } // the node is already loading - just wait for it to load and invoke callback? but if called implicitly it should be loaded again?
|
1271 |
+
if(obj.state.loaded) {
|
1272 |
+
obj.state.loaded = false;
|
1273 |
+
for(i = 0, j = obj.parents.length; i < j; i++) {
|
1274 |
+
this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) {
|
1275 |
+
return $.inArray(v, obj.children_d) === -1;
|
1276 |
+
});
|
1277 |
+
}
|
1278 |
+
for(k = 0, l = obj.children_d.length; k < l; k++) {
|
1279 |
+
if(this._model.data[obj.children_d[k]].state.selected) {
|
1280 |
+
c = true;
|
1281 |
+
}
|
1282 |
+
delete this._model.data[obj.children_d[k]];
|
1283 |
+
}
|
1284 |
+
if (c) {
|
1285 |
+
this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) {
|
1286 |
+
return $.inArray(v, obj.children_d) === -1;
|
1287 |
+
});
|
1288 |
+
}
|
1289 |
+
obj.children = [];
|
1290 |
+
obj.children_d = [];
|
1291 |
+
if(c) {
|
1292 |
+
this.trigger('changed', { 'action' : 'load_node', 'node' : obj, 'selected' : this._data.core.selected });
|
1293 |
+
}
|
1294 |
+
}
|
1295 |
+
obj.state.failed = false;
|
1296 |
+
obj.state.loading = true;
|
1297 |
+
this.get_node(obj, true).addClass("jstree-loading").attr('aria-busy',true);
|
1298 |
+
this._load_node(obj, $.proxy(function (status) {
|
1299 |
+
obj = this._model.data[obj.id];
|
1300 |
+
obj.state.loading = false;
|
1301 |
+
obj.state.loaded = status;
|
1302 |
+
obj.state.failed = !obj.state.loaded;
|
1303 |
+
var dom = this.get_node(obj, true), i = 0, j = 0, m = this._model.data, has_children = false;
|
1304 |
+
for(i = 0, j = obj.children.length; i < j; i++) {
|
1305 |
+
if(m[obj.children[i]] && !m[obj.children[i]].state.hidden) {
|
1306 |
+
has_children = true;
|
1307 |
+
break;
|
1308 |
+
}
|
1309 |
+
}
|
1310 |
+
if(obj.state.loaded && dom && dom.length) {
|
1311 |
+
dom.removeClass('jstree-closed jstree-open jstree-leaf');
|
1312 |
+
if (!has_children) {
|
1313 |
+
dom.addClass('jstree-leaf');
|
1314 |
+
}
|
1315 |
+
else {
|
1316 |
+
if (obj.id !== '#') {
|
1317 |
+
dom.addClass(obj.state.opened ? 'jstree-open' : 'jstree-closed');
|
1318 |
+
}
|
1319 |
+
}
|
1320 |
+
}
|
1321 |
+
dom.removeClass("jstree-loading").attr('aria-busy',false);
|
1322 |
+
/**
|
1323 |
+
* triggered after a node is loaded
|
1324 |
+
* @event
|
1325 |
+
* @name load_node.jstree
|
1326 |
+
* @param {Object} node the node that was loading
|
1327 |
+
* @param {Boolean} status was the node loaded successfully
|
1328 |
+
*/
|
1329 |
+
this.trigger('load_node', { "node" : obj, "status" : status });
|
1330 |
+
if(callback) {
|
1331 |
+
callback.call(this, obj, status);
|
1332 |
+
}
|
1333 |
+
}, this));
|
1334 |
+
return true;
|
1335 |
+
},
|
1336 |
+
/**
|
1337 |
+
* load an array of nodes (will also load unavailable nodes as soon as they appear in the structure). Used internally.
|
1338 |
+
* @private
|
1339 |
+
* @name _load_nodes(nodes [, callback])
|
1340 |
+
* @param {array} nodes
|
1341 |
+
* @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes
|
1342 |
+
*/
|
1343 |
+
_load_nodes : function (nodes, callback, is_callback, force_reload) {
|
1344 |
+
var r = true,
|
1345 |
+
c = function () { this._load_nodes(nodes, callback, true); },
|
1346 |
+
m = this._model.data, i, j, tmp = [];
|
1347 |
+
for(i = 0, j = nodes.length; i < j; i++) {
|
1348 |
+
if(m[nodes[i]] && ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || (!is_callback && force_reload) )) {
|
1349 |
+
if(!this.is_loading(nodes[i])) {
|
1350 |
+
this.load_node(nodes[i], c);
|
1351 |
+
}
|
1352 |
+
r = false;
|
1353 |
+
}
|
1354 |
+
}
|
1355 |
+
if(r) {
|
1356 |
+
for(i = 0, j = nodes.length; i < j; i++) {
|
1357 |
+
if(m[nodes[i]] && m[nodes[i]].state.loaded) {
|
1358 |
+
tmp.push(nodes[i]);
|
1359 |
+
}
|
1360 |
+
}
|
1361 |
+
if(callback && !callback.done) {
|
1362 |
+
callback.call(this, tmp);
|
1363 |
+
callback.done = true;
|
1364 |
+
}
|
1365 |
+
}
|
1366 |
+
},
|
1367 |
+
/**
|
1368 |
+
* loads all unloaded nodes
|
1369 |
+
* @name load_all([obj, callback])
|
1370 |
+
* @param {mixed} obj the node to load recursively, omit to load all nodes in the tree
|
1371 |
+
* @param {function} callback a function to be executed once loading all the nodes is complete,
|
1372 |
+
* @trigger load_all.jstree
|
1373 |
+
*/
|
1374 |
+
load_all : function (obj, callback) {
|
1375 |
+
if(!obj) { obj = $.jstree.root; }
|
1376 |
+
obj = this.get_node(obj);
|
1377 |
+
if(!obj) { return false; }
|
1378 |
+
var to_load = [],
|
1379 |
+
m = this._model.data,
|
1380 |
+
c = m[obj.id].children_d,
|
1381 |
+
i, j;
|
1382 |
+
if(obj.state && !obj.state.loaded) {
|
1383 |
+
to_load.push(obj.id);
|
1384 |
+
}
|
1385 |
+
for(i = 0, j = c.length; i < j; i++) {
|
1386 |
+
if(m[c[i]] && m[c[i]].state && !m[c[i]].state.loaded) {
|
1387 |
+
to_load.push(c[i]);
|
1388 |
+
}
|
1389 |
+
}
|
1390 |
+
if(to_load.length) {
|
1391 |
+
this._load_nodes(to_load, function () {
|
1392 |
+
this.load_all(obj, callback);
|
1393 |
+
});
|
1394 |
+
}
|
1395 |
+
else {
|
1396 |
+
/**
|
1397 |
+
* triggered after a load_all call completes
|
1398 |
+
* @event
|
1399 |
+
* @name load_all.jstree
|
1400 |
+
* @param {Object} node the recursively loaded node
|
1401 |
+
*/
|
1402 |
+
if(callback) { callback.call(this, obj); }
|
1403 |
+
this.trigger('load_all', { "node" : obj });
|
1404 |
+
}
|
1405 |
+
},
|
1406 |
+
/**
|
1407 |
+
* handles the actual loading of a node. Used only internally.
|
1408 |
+
* @private
|
1409 |
+
* @name _load_node(obj [, callback])
|
1410 |
+
* @param {mixed} obj
|
1411 |
+
* @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status
|
1412 |
+
* @return {Boolean}
|
1413 |
+
*/
|
1414 |
+
_load_node : function (obj, callback) {
|
1415 |
+
var s = this.settings.core.data, t;
|
1416 |
+
var notTextOrCommentNode = function notTextOrCommentNode () {
|
1417 |
+
return this.nodeType !== 3 && this.nodeType !== 8;
|
1418 |
+
};
|
1419 |
+
// use original HTML
|
1420 |
+
if(!s) {
|
1421 |
+
if(obj.id === $.jstree.root) {
|
1422 |
+
return this._append_html_data(obj, this._data.core.original_container_html.clone(true), function (status) {
|
1423 |
+
callback.call(this, status);
|
1424 |
+
});
|
1425 |
+
}
|
1426 |
+
else {
|
1427 |
+
return callback.call(this, false);
|
1428 |
+
}
|
1429 |
+
// return callback.call(this, obj.id === $.jstree.root ? this._append_html_data(obj, this._data.core.original_container_html.clone(true)) : false);
|
1430 |
+
}
|
1431 |
+
if($.isFunction(s)) {
|
1432 |
+
return s.call(this, obj, $.proxy(function (d) {
|
1433 |
+
if(d === false) {
|
1434 |
+
callback.call(this, false);
|
1435 |
+
}
|
1436 |
+
else {
|
1437 |
+
this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $($.parseHTML(d)).filter(notTextOrCommentNode) : d, function (status) {
|
1438 |
+
callback.call(this, status);
|
1439 |
+
});
|
1440 |
+
}
|
1441 |
+
// return d === false ? callback.call(this, false) : callback.call(this, this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $(d) : d));
|
1442 |
+
}, this));
|
1443 |
+
}
|
1444 |
+
if(typeof s === 'object') {
|
1445 |
+
if(s.url) {
|
1446 |
+
s = $.extend(true, {}, s);
|
1447 |
+
if($.isFunction(s.url)) {
|
1448 |
+
s.url = s.url.call(this, obj);
|
1449 |
+
}
|
1450 |
+
if($.isFunction(s.data)) {
|
1451 |
+
s.data = s.data.call(this, obj);
|
1452 |
+
}
|
1453 |
+
return $.ajax(s)
|
1454 |
+
.done($.proxy(function (d,t,x) {
|
1455 |
+
var type = x.getResponseHeader('Content-Type');
|
1456 |
+
if((type && type.indexOf('json') !== -1) || typeof d === "object") {
|
1457 |
+
return this._append_json_data(obj, d, function (status) { callback.call(this, status); });
|
1458 |
+
//return callback.call(this, this._append_json_data(obj, d));
|
1459 |
+
}
|
1460 |
+
if((type && type.indexOf('html') !== -1) || typeof d === "string") {
|
1461 |
+
return this._append_html_data(obj, $($.parseHTML(d)).filter(notTextOrCommentNode), function (status) { callback.call(this, status); });
|
1462 |
+
// return callback.call(this, this._append_html_data(obj, $(d)));
|
1463 |
+
}
|
1464 |
+
this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : x }) };
|
1465 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
1466 |
+
return callback.call(this, false);
|
1467 |
+
}, this))
|
1468 |
+
.fail($.proxy(function (f) {
|
1469 |
+
this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : f }) };
|
1470 |
+
callback.call(this, false);
|
1471 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
1472 |
+
}, this));
|
1473 |
+
}
|
1474 |
+
if ($.isArray(s)) {
|
1475 |
+
t = $.extend(true, [], s);
|
1476 |
+
} else if ($.isPlainObject(s)) {
|
1477 |
+
t = $.extend(true, {}, s);
|
1478 |
+
} else {
|
1479 |
+
t = s;
|
1480 |
+
}
|
1481 |
+
if(obj.id === $.jstree.root) {
|
1482 |
+
return this._append_json_data(obj, t, function (status) {
|
1483 |
+
callback.call(this, status);
|
1484 |
+
});
|
1485 |
+
}
|
1486 |
+
else {
|
1487 |
+
this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_05', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) };
|
1488 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
1489 |
+
return callback.call(this, false);
|
1490 |
+
}
|
1491 |
+
//return callback.call(this, (obj.id === $.jstree.root ? this._append_json_data(obj, t) : false) );
|
1492 |
+
}
|
1493 |
+
if(typeof s === 'string') {
|
1494 |
+
if(obj.id === $.jstree.root) {
|
1495 |
+
return this._append_html_data(obj, $($.parseHTML(s)).filter(notTextOrCommentNode), function (status) {
|
1496 |
+
callback.call(this, status);
|
1497 |
+
});
|
1498 |
+
}
|
1499 |
+
else {
|
1500 |
+
this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_06', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) };
|
1501 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
1502 |
+
return callback.call(this, false);
|
1503 |
+
}
|
1504 |
+
//return callback.call(this, (obj.id === $.jstree.root ? this._append_html_data(obj, $(s)) : false) );
|
1505 |
+
}
|
1506 |
+
return callback.call(this, false);
|
1507 |
+
},
|
1508 |
+
/**
|
1509 |
+
* adds a node to the list of nodes to redraw. Used only internally.
|
1510 |
+
* @private
|
1511 |
+
* @name _node_changed(obj [, callback])
|
1512 |
+
* @param {mixed} obj
|
1513 |
+
*/
|
1514 |
+
_node_changed : function (obj) {
|
1515 |
+
obj = this.get_node(obj);
|
1516 |
+
if (obj && $.inArray(obj.id, this._model.changed) === -1) {
|
1517 |
+
this._model.changed.push(obj.id);
|
1518 |
+
}
|
1519 |
+
},
|
1520 |
+
/**
|
1521 |
+
* appends HTML content to the tree. Used internally.
|
1522 |
+
* @private
|
1523 |
+
* @name _append_html_data(obj, data)
|
1524 |
+
* @param {mixed} obj the node to append to
|
1525 |
+
* @param {String} data the HTML string to parse and append
|
1526 |
+
* @trigger model.jstree, changed.jstree
|
1527 |
+
*/
|
1528 |
+
_append_html_data : function (dom, data, cb) {
|
1529 |
+
dom = this.get_node(dom);
|
1530 |
+
dom.children = [];
|
1531 |
+
dom.children_d = [];
|
1532 |
+
var dat = data.is('ul') ? data.children() : data,
|
1533 |
+
par = dom.id,
|
1534 |
+
chd = [],
|
1535 |
+
dpc = [],
|
1536 |
+
m = this._model.data,
|
1537 |
+
p = m[par],
|
1538 |
+
s = this._data.core.selected.length,
|
1539 |
+
tmp, i, j;
|
1540 |
+
dat.each($.proxy(function (i, v) {
|
1541 |
+
tmp = this._parse_model_from_html($(v), par, p.parents.concat());
|
1542 |
+
if(tmp) {
|
1543 |
+
chd.push(tmp);
|
1544 |
+
dpc.push(tmp);
|
1545 |
+
if(m[tmp].children_d.length) {
|
1546 |
+
dpc = dpc.concat(m[tmp].children_d);
|
1547 |
+
}
|
1548 |
+
}
|
1549 |
+
}, this));
|
1550 |
+
p.children = chd;
|
1551 |
+
p.children_d = dpc;
|
1552 |
+
for(i = 0, j = p.parents.length; i < j; i++) {
|
1553 |
+
m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc);
|
1554 |
+
}
|
1555 |
+
/**
|
1556 |
+
* triggered when new data is inserted to the tree model
|
1557 |
+
* @event
|
1558 |
+
* @name model.jstree
|
1559 |
+
* @param {Array} nodes an array of node IDs
|
1560 |
+
* @param {String} parent the parent ID of the nodes
|
1561 |
+
*/
|
1562 |
+
this.trigger('model', { "nodes" : dpc, 'parent' : par });
|
1563 |
+
if(par !== $.jstree.root) {
|
1564 |
+
this._node_changed(par);
|
1565 |
+
this.redraw();
|
1566 |
+
}
|
1567 |
+
else {
|
1568 |
+
this.get_container_ul().children('.jstree-initial-node').remove();
|
1569 |
+
this.redraw(true);
|
1570 |
+
}
|
1571 |
+
if(this._data.core.selected.length !== s) {
|
1572 |
+
this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected });
|
1573 |
+
}
|
1574 |
+
cb.call(this, true);
|
1575 |
+
},
|
1576 |
+
/**
|
1577 |
+
* appends JSON content to the tree. Used internally.
|
1578 |
+
* @private
|
1579 |
+
* @name _append_json_data(obj, data)
|
1580 |
+
* @param {mixed} obj the node to append to
|
1581 |
+
* @param {String} data the JSON object to parse and append
|
1582 |
+
* @param {Boolean} force_processing internal param - do not set
|
1583 |
+
* @trigger model.jstree, changed.jstree
|
1584 |
+
*/
|
1585 |
+
_append_json_data : function (dom, data, cb, force_processing) {
|
1586 |
+
if(this.element === null) { return; }
|
1587 |
+
dom = this.get_node(dom);
|
1588 |
+
dom.children = [];
|
1589 |
+
dom.children_d = [];
|
1590 |
+
// *%$@!!!
|
1591 |
+
if(data.d) {
|
1592 |
+
data = data.d;
|
1593 |
+
if(typeof data === "string") {
|
1594 |
+
data = JSON.parse(data);
|
1595 |
+
}
|
1596 |
+
}
|
1597 |
+
if(!$.isArray(data)) { data = [data]; }
|
1598 |
+
var w = null,
|
1599 |
+
args = {
|
1600 |
+
'df' : this._model.default_state,
|
1601 |
+
'dat' : data,
|
1602 |
+
'par' : dom.id,
|
1603 |
+
'm' : this._model.data,
|
1604 |
+
't_id' : this._id,
|
1605 |
+
't_cnt' : this._cnt,
|
1606 |
+
'sel' : this._data.core.selected
|
1607 |
+
},
|
1608 |
+
func = function (data, undefined) {
|
1609 |
+
if(data.data) { data = data.data; }
|
1610 |
+
var dat = data.dat,
|
1611 |
+
par = data.par,
|
1612 |
+
chd = [],
|
1613 |
+
dpc = [],
|
1614 |
+
add = [],
|
1615 |
+
df = data.df,
|
1616 |
+
t_id = data.t_id,
|
1617 |
+
t_cnt = data.t_cnt,
|
1618 |
+
m = data.m,
|
1619 |
+
p = m[par],
|
1620 |
+
sel = data.sel,
|
1621 |
+
tmp, i, j, rslt,
|
1622 |
+
parse_flat = function (d, p, ps) {
|
1623 |
+
if(!ps) { ps = []; }
|
1624 |
+
else { ps = ps.concat(); }
|
1625 |
+
if(p) { ps.unshift(p); }
|
1626 |
+
var tid = d.id.toString(),
|
1627 |
+
i, j, c, e,
|
1628 |
+
tmp = {
|
1629 |
+
id : tid,
|
1630 |
+
text : d.text || '',
|
1631 |
+
icon : d.icon !== undefined ? d.icon : true,
|
1632 |
+
parent : p,
|
1633 |
+
parents : ps,
|
1634 |
+
children : d.children || [],
|
1635 |
+
children_d : d.children_d || [],
|
1636 |
+
data : d.data,
|
1637 |
+
state : { },
|
1638 |
+
li_attr : { id : false },
|
1639 |
+
a_attr : { href : '#' },
|
1640 |
+
original : false
|
1641 |
+
};
|
1642 |
+
for(i in df) {
|
1643 |
+
if(df.hasOwnProperty(i)) {
|
1644 |
+
tmp.state[i] = df[i];
|
1645 |
+
}
|
1646 |
+
}
|
1647 |
+
if(d && d.data && d.data.jstree && d.data.jstree.icon) {
|
1648 |
+
tmp.icon = d.data.jstree.icon;
|
1649 |
+
}
|
1650 |
+
if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") {
|
1651 |
+
tmp.icon = true;
|
1652 |
+
}
|
1653 |
+
if(d && d.data) {
|
1654 |
+
tmp.data = d.data;
|
1655 |
+
if(d.data.jstree) {
|
1656 |
+
for(i in d.data.jstree) {
|
1657 |
+
if(d.data.jstree.hasOwnProperty(i)) {
|
1658 |
+
tmp.state[i] = d.data.jstree[i];
|
1659 |
+
}
|
1660 |
+
}
|
1661 |
+
}
|
1662 |
+
}
|
1663 |
+
if(d && typeof d.state === 'object') {
|
1664 |
+
for (i in d.state) {
|
1665 |
+
if(d.state.hasOwnProperty(i)) {
|
1666 |
+
tmp.state[i] = d.state[i];
|
1667 |
+
}
|
1668 |
+
}
|
1669 |
+
}
|
1670 |
+
if(d && typeof d.li_attr === 'object') {
|
1671 |
+
for (i in d.li_attr) {
|
1672 |
+
if(d.li_attr.hasOwnProperty(i)) {
|
1673 |
+
tmp.li_attr[i] = d.li_attr[i];
|
1674 |
+
}
|
1675 |
+
}
|
1676 |
+
}
|
1677 |
+
if(!tmp.li_attr.id) {
|
1678 |
+
tmp.li_attr.id = tid;
|
1679 |
+
}
|
1680 |
+
if(d && typeof d.a_attr === 'object') {
|
1681 |
+
for (i in d.a_attr) {
|
1682 |
+
if(d.a_attr.hasOwnProperty(i)) {
|
1683 |
+
tmp.a_attr[i] = d.a_attr[i];
|
1684 |
+
}
|
1685 |
+
}
|
1686 |
+
}
|
1687 |
+
if(d && d.children && d.children === true) {
|
1688 |
+
tmp.state.loaded = false;
|
1689 |
+
tmp.children = [];
|
1690 |
+
tmp.children_d = [];
|
1691 |
+
}
|
1692 |
+
m[tmp.id] = tmp;
|
1693 |
+
for(i = 0, j = tmp.children.length; i < j; i++) {
|
1694 |
+
c = parse_flat(m[tmp.children[i]], tmp.id, ps);
|
1695 |
+
e = m[c];
|
1696 |
+
tmp.children_d.push(c);
|
1697 |
+
if(e.children_d.length) {
|
1698 |
+
tmp.children_d = tmp.children_d.concat(e.children_d);
|
1699 |
+
}
|
1700 |
+
}
|
1701 |
+
delete d.data;
|
1702 |
+
delete d.children;
|
1703 |
+
m[tmp.id].original = d;
|
1704 |
+
if(tmp.state.selected) {
|
1705 |
+
add.push(tmp.id);
|
1706 |
+
}
|
1707 |
+
return tmp.id;
|
1708 |
+
},
|
1709 |
+
parse_nest = function (d, p, ps) {
|
1710 |
+
if(!ps) { ps = []; }
|
1711 |
+
else { ps = ps.concat(); }
|
1712 |
+
if(p) { ps.unshift(p); }
|
1713 |
+
var tid = false, i, j, c, e, tmp;
|
1714 |
+
do {
|
1715 |
+
tid = 'j' + t_id + '_' + (++t_cnt);
|
1716 |
+
} while(m[tid]);
|
1717 |
+
|
1718 |
+
tmp = {
|
1719 |
+
id : false,
|
1720 |
+
text : typeof d === 'string' ? d : '',
|
1721 |
+
icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true,
|
1722 |
+
parent : p,
|
1723 |
+
parents : ps,
|
1724 |
+
children : [],
|
1725 |
+
children_d : [],
|
1726 |
+
data : null,
|
1727 |
+
state : { },
|
1728 |
+
li_attr : { id : false },
|
1729 |
+
a_attr : { href : '#' },
|
1730 |
+
original : false
|
1731 |
+
};
|
1732 |
+
for(i in df) {
|
1733 |
+
if(df.hasOwnProperty(i)) {
|
1734 |
+
tmp.state[i] = df[i];
|
1735 |
+
}
|
1736 |
+
}
|
1737 |
+
if(d && d.id) { tmp.id = d.id.toString(); }
|
1738 |
+
if(d && d.text) { tmp.text = d.text; }
|
1739 |
+
if(d && d.data && d.data.jstree && d.data.jstree.icon) {
|
1740 |
+
tmp.icon = d.data.jstree.icon;
|
1741 |
+
}
|
1742 |
+
if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") {
|
1743 |
+
tmp.icon = true;
|
1744 |
+
}
|
1745 |
+
if(d && d.data) {
|
1746 |
+
tmp.data = d.data;
|
1747 |
+
if(d.data.jstree) {
|
1748 |
+
for(i in d.data.jstree) {
|
1749 |
+
if(d.data.jstree.hasOwnProperty(i)) {
|
1750 |
+
tmp.state[i] = d.data.jstree[i];
|
1751 |
+
}
|
1752 |
+
}
|
1753 |
+
}
|
1754 |
+
}
|
1755 |
+
if(d && typeof d.state === 'object') {
|
1756 |
+
for (i in d.state) {
|
1757 |
+
if(d.state.hasOwnProperty(i)) {
|
1758 |
+
tmp.state[i] = d.state[i];
|
1759 |
+
}
|
1760 |
+
}
|
1761 |
+
}
|
1762 |
+
if(d && typeof d.li_attr === 'object') {
|
1763 |
+
for (i in d.li_attr) {
|
1764 |
+
if(d.li_attr.hasOwnProperty(i)) {
|
1765 |
+
tmp.li_attr[i] = d.li_attr[i];
|
1766 |
+
}
|
1767 |
+
}
|
1768 |
+
}
|
1769 |
+
if(tmp.li_attr.id && !tmp.id) {
|
1770 |
+
tmp.id = tmp.li_attr.id.toString();
|
1771 |
+
}
|
1772 |
+
if(!tmp.id) {
|
1773 |
+
tmp.id = tid;
|
1774 |
+
}
|
1775 |
+
if(!tmp.li_attr.id) {
|
1776 |
+
tmp.li_attr.id = tmp.id;
|
1777 |
+
}
|
1778 |
+
if(d && typeof d.a_attr === 'object') {
|
1779 |
+
for (i in d.a_attr) {
|
1780 |
+
if(d.a_attr.hasOwnProperty(i)) {
|
1781 |
+
tmp.a_attr[i] = d.a_attr[i];
|
1782 |
+
}
|
1783 |
+
}
|
1784 |
+
}
|
1785 |
+
if(d && d.children && d.children.length) {
|
1786 |
+
for(i = 0, j = d.children.length; i < j; i++) {
|
1787 |
+
c = parse_nest(d.children[i], tmp.id, ps);
|
1788 |
+
e = m[c];
|
1789 |
+
tmp.children.push(c);
|
1790 |
+
if(e.children_d.length) {
|
1791 |
+
tmp.children_d = tmp.children_d.concat(e.children_d);
|
1792 |
+
}
|
1793 |
+
}
|
1794 |
+
tmp.children_d = tmp.children_d.concat(tmp.children);
|
1795 |
+
}
|
1796 |
+
if(d && d.children && d.children === true) {
|
1797 |
+
tmp.state.loaded = false;
|
1798 |
+
tmp.children = [];
|
1799 |
+
tmp.children_d = [];
|
1800 |
+
}
|
1801 |
+
delete d.data;
|
1802 |
+
delete d.children;
|
1803 |
+
tmp.original = d;
|
1804 |
+
m[tmp.id] = tmp;
|
1805 |
+
if(tmp.state.selected) {
|
1806 |
+
add.push(tmp.id);
|
1807 |
+
}
|
1808 |
+
return tmp.id;
|
1809 |
+
};
|
1810 |
+
|
1811 |
+
if(dat.length && dat[0].id !== undefined && dat[0].parent !== undefined) {
|
1812 |
+
// Flat JSON support (for easy import from DB):
|
1813 |
+
// 1) convert to object (foreach)
|
1814 |
+
for(i = 0, j = dat.length; i < j; i++) {
|
1815 |
+
if(!dat[i].children) {
|
1816 |
+
dat[i].children = [];
|
1817 |
+
}
|
1818 |
+
if(!dat[i].state) {
|
1819 |
+
dat[i].state = {};
|
1820 |
+
}
|
1821 |
+
m[dat[i].id.toString()] = dat[i];
|
1822 |
+
}
|
1823 |
+
// 2) populate children (foreach)
|
1824 |
+
for(i = 0, j = dat.length; i < j; i++) {
|
1825 |
+
if (!m[dat[i].parent.toString()]) {
|
1826 |
+
this._data.core.last_error = { 'error' : 'parse', 'plugin' : 'core', 'id' : 'core_07', 'reason' : 'Node with invalid parent', 'data' : JSON.stringify({ 'id' : dat[i].id.toString(), 'parent' : dat[i].parent.toString() }) };
|
1827 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
1828 |
+
continue;
|
1829 |
+
}
|
1830 |
+
|
1831 |
+
m[dat[i].parent.toString()].children.push(dat[i].id.toString());
|
1832 |
+
// populate parent.children_d
|
1833 |
+
p.children_d.push(dat[i].id.toString());
|
1834 |
+
}
|
1835 |
+
// 3) normalize && populate parents and children_d with recursion
|
1836 |
+
for(i = 0, j = p.children.length; i < j; i++) {
|
1837 |
+
tmp = parse_flat(m[p.children[i]], par, p.parents.concat());
|
1838 |
+
dpc.push(tmp);
|
1839 |
+
if(m[tmp].children_d.length) {
|
1840 |
+
dpc = dpc.concat(m[tmp].children_d);
|
1841 |
+
}
|
1842 |
+
}
|
1843 |
+
for(i = 0, j = p.parents.length; i < j; i++) {
|
1844 |
+
m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc);
|
1845 |
+
}
|
1846 |
+
// ?) three_state selection - p.state.selected && t - (if three_state foreach(dat => ch) -> foreach(parents) if(parent.selected) child.selected = true;
|
1847 |
+
rslt = {
|
1848 |
+
'cnt' : t_cnt,
|
1849 |
+
'mod' : m,
|
1850 |
+
'sel' : sel,
|
1851 |
+
'par' : par,
|
1852 |
+
'dpc' : dpc,
|
1853 |
+
'add' : add
|
1854 |
+
};
|
1855 |
+
}
|
1856 |
+
else {
|
1857 |
+
for(i = 0, j = dat.length; i < j; i++) {
|
1858 |
+
tmp = parse_nest(dat[i], par, p.parents.concat());
|
1859 |
+
if(tmp) {
|
1860 |
+
chd.push(tmp);
|
1861 |
+
dpc.push(tmp);
|
1862 |
+
if(m[tmp].children_d.length) {
|
1863 |
+
dpc = dpc.concat(m[tmp].children_d);
|
1864 |
+
}
|
1865 |
+
}
|
1866 |
+
}
|
1867 |
+
p.children = chd;
|
1868 |
+
p.children_d = dpc;
|
1869 |
+
for(i = 0, j = p.parents.length; i < j; i++) {
|
1870 |
+
m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc);
|
1871 |
+
}
|
1872 |
+
rslt = {
|
1873 |
+
'cnt' : t_cnt,
|
1874 |
+
'mod' : m,
|
1875 |
+
'sel' : sel,
|
1876 |
+
'par' : par,
|
1877 |
+
'dpc' : dpc,
|
1878 |
+
'add' : add
|
1879 |
+
};
|
1880 |
+
}
|
1881 |
+
if(typeof window === 'undefined' || typeof window.document === 'undefined') {
|
1882 |
+
postMessage(rslt);
|
1883 |
+
}
|
1884 |
+
else {
|
1885 |
+
return rslt;
|
1886 |
+
}
|
1887 |
+
},
|
1888 |
+
rslt = function (rslt, worker) {
|
1889 |
+
if(this.element === null) { return; }
|
1890 |
+
this._cnt = rslt.cnt;
|
1891 |
+
var i, m = this._model.data;
|
1892 |
+
for (i in m) {
|
1893 |
+
if (m.hasOwnProperty(i) && m[i].state && m[i].state.loading && rslt.mod[i]) {
|
1894 |
+
rslt.mod[i].state.loading = true;
|
1895 |
+
}
|
1896 |
+
}
|
1897 |
+
this._model.data = rslt.mod; // breaks the reference in load_node - careful
|
1898 |
+
|
1899 |
+
if(worker) {
|
1900 |
+
var j, a = rslt.add, r = rslt.sel, s = this._data.core.selected.slice();
|
1901 |
+
m = this._model.data;
|
1902 |
+
// if selection was changed while calculating in worker
|
1903 |
+
if(r.length !== s.length || $.vakata.array_unique(r.concat(s)).length !== r.length) {
|
1904 |
+
// deselect nodes that are no longer selected
|
1905 |
+
for(i = 0, j = r.length; i < j; i++) {
|
1906 |
+
if($.inArray(r[i], a) === -1 && $.inArray(r[i], s) === -1) {
|
1907 |
+
m[r[i]].state.selected = false;
|
1908 |
+
}
|
1909 |
+
}
|
1910 |
+
// select nodes that were selected in the mean time
|
1911 |
+
for(i = 0, j = s.length; i < j; i++) {
|
1912 |
+
if($.inArray(s[i], r) === -1) {
|
1913 |
+
m[s[i]].state.selected = true;
|
1914 |
+
}
|
1915 |
+
}
|
1916 |
+
}
|
1917 |
+
}
|
1918 |
+
if(rslt.add.length) {
|
1919 |
+
this._data.core.selected = this._data.core.selected.concat(rslt.add);
|
1920 |
+
}
|
1921 |
+
|
1922 |
+
this.trigger('model', { "nodes" : rslt.dpc, 'parent' : rslt.par });
|
1923 |
+
|
1924 |
+
if(rslt.par !== $.jstree.root) {
|
1925 |
+
this._node_changed(rslt.par);
|
1926 |
+
this.redraw();
|
1927 |
+
}
|
1928 |
+
else {
|
1929 |
+
// this.get_container_ul().children('.jstree-initial-node').remove();
|
1930 |
+
this.redraw(true);
|
1931 |
+
}
|
1932 |
+
if(rslt.add.length) {
|
1933 |
+
this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected });
|
1934 |
+
}
|
1935 |
+
cb.call(this, true);
|
1936 |
+
};
|
1937 |
+
if(this.settings.core.worker && window.Blob && window.URL && window.Worker) {
|
1938 |
+
try {
|
1939 |
+
if(this._wrk === null) {
|
1940 |
+
this._wrk = window.URL.createObjectURL(
|
1941 |
+
new window.Blob(
|
1942 |
+
['self.onmessage = ' + func.toString()],
|
1943 |
+
{type:"text/javascript"}
|
1944 |
+
)
|
1945 |
+
);
|
1946 |
+
}
|
1947 |
+
if(!this._data.core.working || force_processing) {
|
1948 |
+
this._data.core.working = true;
|
1949 |
+
w = new window.Worker(this._wrk);
|
1950 |
+
w.onmessage = $.proxy(function (e) {
|
1951 |
+
rslt.call(this, e.data, true);
|
1952 |
+
try { w.terminate(); w = null; } catch(ignore) { }
|
1953 |
+
if(this._data.core.worker_queue.length) {
|
1954 |
+
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
|
1955 |
+
}
|
1956 |
+
else {
|
1957 |
+
this._data.core.working = false;
|
1958 |
+
}
|
1959 |
+
}, this);
|
1960 |
+
if(!args.par) {
|
1961 |
+
if(this._data.core.worker_queue.length) {
|
1962 |
+
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
|
1963 |
+
}
|
1964 |
+
else {
|
1965 |
+
this._data.core.working = false;
|
1966 |
+
}
|
1967 |
+
}
|
1968 |
+
else {
|
1969 |
+
w.postMessage(args);
|
1970 |
+
}
|
1971 |
+
}
|
1972 |
+
else {
|
1973 |
+
this._data.core.worker_queue.push([dom, data, cb, true]);
|
1974 |
+
}
|
1975 |
+
}
|
1976 |
+
catch(e) {
|
1977 |
+
rslt.call(this, func(args), false);
|
1978 |
+
if(this._data.core.worker_queue.length) {
|
1979 |
+
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
|
1980 |
+
}
|
1981 |
+
else {
|
1982 |
+
this._data.core.working = false;
|
1983 |
+
}
|
1984 |
+
}
|
1985 |
+
}
|
1986 |
+
else {
|
1987 |
+
rslt.call(this, func(args), false);
|
1988 |
+
}
|
1989 |
+
},
|
1990 |
+
/**
|
1991 |
+
* parses a node from a jQuery object and appends them to the in memory tree model. Used internally.
|
1992 |
+
* @private
|
1993 |
+
* @name _parse_model_from_html(d [, p, ps])
|
1994 |
+
* @param {jQuery} d the jQuery object to parse
|
1995 |
+
* @param {String} p the parent ID
|
1996 |
+
* @param {Array} ps list of all parents
|
1997 |
+
* @return {String} the ID of the object added to the model
|
1998 |
+
*/
|
1999 |
+
_parse_model_from_html : function (d, p, ps) {
|
2000 |
+
if(!ps) { ps = []; }
|
2001 |
+
else { ps = [].concat(ps); }
|
2002 |
+
if(p) { ps.unshift(p); }
|
2003 |
+
var c, e, m = this._model.data,
|
2004 |
+
data = {
|
2005 |
+
id : false,
|
2006 |
+
text : false,
|
2007 |
+
icon : true,
|
2008 |
+
parent : p,
|
2009 |
+
parents : ps,
|
2010 |
+
children : [],
|
2011 |
+
children_d : [],
|
2012 |
+
data : null,
|
2013 |
+
state : { },
|
2014 |
+
li_attr : { id : false },
|
2015 |
+
a_attr : { href : '#' },
|
2016 |
+
original : false
|
2017 |
+
}, i, tmp, tid;
|
2018 |
+
for(i in this._model.default_state) {
|
2019 |
+
if(this._model.default_state.hasOwnProperty(i)) {
|
2020 |
+
data.state[i] = this._model.default_state[i];
|
2021 |
+
}
|
2022 |
+
}
|
2023 |
+
tmp = $.vakata.attributes(d, true);
|
2024 |
+
$.each(tmp, function (i, v) {
|
2025 |
+
v = $.trim(v);
|
2026 |
+
if(!v.length) { return true; }
|
2027 |
+
data.li_attr[i] = v;
|
2028 |
+
if(i === 'id') {
|
2029 |
+
data.id = v.toString();
|
2030 |
+
}
|
2031 |
+
});
|
2032 |
+
tmp = d.children('a').first();
|
2033 |
+
if(tmp.length) {
|
2034 |
+
tmp = $.vakata.attributes(tmp, true);
|
2035 |
+
$.each(tmp, function (i, v) {
|
2036 |
+
v = $.trim(v);
|
2037 |
+
if(v.length) {
|
2038 |
+
data.a_attr[i] = v;
|
2039 |
+
}
|
2040 |
+
});
|
2041 |
+
}
|
2042 |
+
tmp = d.children("a").first().length ? d.children("a").first().clone() : d.clone();
|
2043 |
+
tmp.children("ins, i, ul").remove();
|
2044 |
+
tmp = tmp.html();
|
2045 |
+
tmp = $('<div />').html(tmp);
|
2046 |
+
data.text = this.settings.core.force_text ? tmp.text() : tmp.html();
|
2047 |
+
tmp = d.data();
|
2048 |
+
data.data = tmp ? $.extend(true, {}, tmp) : null;
|
2049 |
+
data.state.opened = d.hasClass('jstree-open');
|
2050 |
+
data.state.selected = d.children('a').hasClass('jstree-clicked');
|
2051 |
+
data.state.disabled = d.children('a').hasClass('jstree-disabled');
|
2052 |
+
if(data.data && data.data.jstree) {
|
2053 |
+
for(i in data.data.jstree) {
|
2054 |
+
if(data.data.jstree.hasOwnProperty(i)) {
|
2055 |
+
data.state[i] = data.data.jstree[i];
|
2056 |
+
}
|
2057 |
+
}
|
2058 |
+
}
|
2059 |
+
tmp = d.children("a").children(".jstree-themeicon");
|
2060 |
+
if(tmp.length) {
|
2061 |
+
data.icon = tmp.hasClass('jstree-themeicon-hidden') ? false : tmp.attr('rel');
|
2062 |
+
}
|
2063 |
+
if(data.state.icon !== undefined) {
|
2064 |
+
data.icon = data.state.icon;
|
2065 |
+
}
|
2066 |
+
if(data.icon === undefined || data.icon === null || data.icon === "") {
|
2067 |
+
data.icon = true;
|
2068 |
+
}
|
2069 |
+
tmp = d.children("ul").children("li");
|
2070 |
+
do {
|
2071 |
+
tid = 'j' + this._id + '_' + (++this._cnt);
|
2072 |
+
} while(m[tid]);
|
2073 |
+
data.id = data.li_attr.id ? data.li_attr.id.toString() : tid;
|
2074 |
+
if(tmp.length) {
|
2075 |
+
tmp.each($.proxy(function (i, v) {
|
2076 |
+
c = this._parse_model_from_html($(v), data.id, ps);
|
2077 |
+
e = this._model.data[c];
|
2078 |
+
data.children.push(c);
|
2079 |
+
if(e.children_d.length) {
|
2080 |
+
data.children_d = data.children_d.concat(e.children_d);
|
2081 |
+
}
|
2082 |
+
}, this));
|
2083 |
+
data.children_d = data.children_d.concat(data.children);
|
2084 |
+
}
|
2085 |
+
else {
|
2086 |
+
if(d.hasClass('jstree-closed')) {
|
2087 |
+
data.state.loaded = false;
|
2088 |
+
}
|
2089 |
+
}
|
2090 |
+
if(data.li_attr['class']) {
|
2091 |
+
data.li_attr['class'] = data.li_attr['class'].replace('jstree-closed','').replace('jstree-open','');
|
2092 |
+
}
|
2093 |
+
if(data.a_attr['class']) {
|
2094 |
+
data.a_attr['class'] = data.a_attr['class'].replace('jstree-clicked','').replace('jstree-disabled','');
|
2095 |
+
}
|
2096 |
+
m[data.id] = data;
|
2097 |
+
if(data.state.selected) {
|
2098 |
+
this._data.core.selected.push(data.id);
|
2099 |
+
}
|
2100 |
+
return data.id;
|
2101 |
+
},
|
2102 |
+
/**
|
2103 |
+
* parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally.
|
2104 |
+
* @private
|
2105 |
+
* @name _parse_model_from_flat_json(d [, p, ps])
|
2106 |
+
* @param {Object} d the JSON object to parse
|
2107 |
+
* @param {String} p the parent ID
|
2108 |
+
* @param {Array} ps list of all parents
|
2109 |
+
* @return {String} the ID of the object added to the model
|
2110 |
+
*/
|
2111 |
+
_parse_model_from_flat_json : function (d, p, ps) {
|
2112 |
+
if(!ps) { ps = []; }
|
2113 |
+
else { ps = ps.concat(); }
|
2114 |
+
if(p) { ps.unshift(p); }
|
2115 |
+
var tid = d.id.toString(),
|
2116 |
+
m = this._model.data,
|
2117 |
+
df = this._model.default_state,
|
2118 |
+
i, j, c, e,
|
2119 |
+
tmp = {
|
2120 |
+
id : tid,
|
2121 |
+
text : d.text || '',
|
2122 |
+
icon : d.icon !== undefined ? d.icon : true,
|
2123 |
+
parent : p,
|
2124 |
+
parents : ps,
|
2125 |
+
children : d.children || [],
|
2126 |
+
children_d : d.children_d || [],
|
2127 |
+
data : d.data,
|
2128 |
+
state : { },
|
2129 |
+
li_attr : { id : false },
|
2130 |
+
a_attr : { href : '#' },
|
2131 |
+
original : false
|
2132 |
+
};
|
2133 |
+
for(i in df) {
|
2134 |
+
if(df.hasOwnProperty(i)) {
|
2135 |
+
tmp.state[i] = df[i];
|
2136 |
+
}
|
2137 |
+
}
|
2138 |
+
if(d && d.data && d.data.jstree && d.data.jstree.icon) {
|
2139 |
+
tmp.icon = d.data.jstree.icon;
|
2140 |
+
}
|
2141 |
+
if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") {
|
2142 |
+
tmp.icon = true;
|
2143 |
+
}
|
2144 |
+
if(d && d.data) {
|
2145 |
+
tmp.data = d.data;
|
2146 |
+
if(d.data.jstree) {
|
2147 |
+
for(i in d.data.jstree) {
|
2148 |
+
if(d.data.jstree.hasOwnProperty(i)) {
|
2149 |
+
tmp.state[i] = d.data.jstree[i];
|
2150 |
+
}
|
2151 |
+
}
|
2152 |
+
}
|
2153 |
+
}
|
2154 |
+
if(d && typeof d.state === 'object') {
|
2155 |
+
for (i in d.state) {
|
2156 |
+
if(d.state.hasOwnProperty(i)) {
|
2157 |
+
tmp.state[i] = d.state[i];
|
2158 |
+
}
|
2159 |
+
}
|
2160 |
+
}
|
2161 |
+
if(d && typeof d.li_attr === 'object') {
|
2162 |
+
for (i in d.li_attr) {
|
2163 |
+
if(d.li_attr.hasOwnProperty(i)) {
|
2164 |
+
tmp.li_attr[i] = d.li_attr[i];
|
2165 |
+
}
|
2166 |
+
}
|
2167 |
+
}
|
2168 |
+
if(!tmp.li_attr.id) {
|
2169 |
+
tmp.li_attr.id = tid;
|
2170 |
+
}
|
2171 |
+
if(d && typeof d.a_attr === 'object') {
|
2172 |
+
for (i in d.a_attr) {
|
2173 |
+
if(d.a_attr.hasOwnProperty(i)) {
|
2174 |
+
tmp.a_attr[i] = d.a_attr[i];
|
2175 |
+
}
|
2176 |
+
}
|
2177 |
+
}
|
2178 |
+
if(d && d.children && d.children === true) {
|
2179 |
+
tmp.state.loaded = false;
|
2180 |
+
tmp.children = [];
|
2181 |
+
tmp.children_d = [];
|
2182 |
+
}
|
2183 |
+
m[tmp.id] = tmp;
|
2184 |
+
for(i = 0, j = tmp.children.length; i < j; i++) {
|
2185 |
+
c = this._parse_model_from_flat_json(m[tmp.children[i]], tmp.id, ps);
|
2186 |
+
e = m[c];
|
2187 |
+
tmp.children_d.push(c);
|
2188 |
+
if(e.children_d.length) {
|
2189 |
+
tmp.children_d = tmp.children_d.concat(e.children_d);
|
2190 |
+
}
|
2191 |
+
}
|
2192 |
+
delete d.data;
|
2193 |
+
delete d.children;
|
2194 |
+
m[tmp.id].original = d;
|
2195 |
+
if(tmp.state.selected) {
|
2196 |
+
this._data.core.selected.push(tmp.id);
|
2197 |
+
}
|
2198 |
+
return tmp.id;
|
2199 |
+
},
|
2200 |
+
/**
|
2201 |
+
* parses a node from a JSON object and appends it to the in memory tree model. Used internally.
|
2202 |
+
* @private
|
2203 |
+
* @name _parse_model_from_json(d [, p, ps])
|
2204 |
+
* @param {Object} d the JSON object to parse
|
2205 |
+
* @param {String} p the parent ID
|
2206 |
+
* @param {Array} ps list of all parents
|
2207 |
+
* @return {String} the ID of the object added to the model
|
2208 |
+
*/
|
2209 |
+
_parse_model_from_json : function (d, p, ps) {
|
2210 |
+
if(!ps) { ps = []; }
|
2211 |
+
else { ps = ps.concat(); }
|
2212 |
+
if(p) { ps.unshift(p); }
|
2213 |
+
var tid = false, i, j, c, e, m = this._model.data, df = this._model.default_state, tmp;
|
2214 |
+
do {
|
2215 |
+
tid = 'j' + this._id + '_' + (++this._cnt);
|
2216 |
+
} while(m[tid]);
|
2217 |
+
|
2218 |
+
tmp = {
|
2219 |
+
id : false,
|
2220 |
+
text : typeof d === 'string' ? d : '',
|
2221 |
+
icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true,
|
2222 |
+
parent : p,
|
2223 |
+
parents : ps,
|
2224 |
+
children : [],
|
2225 |
+
children_d : [],
|
2226 |
+
data : null,
|
2227 |
+
state : { },
|
2228 |
+
li_attr : { id : false },
|
2229 |
+
a_attr : { href : '#' },
|
2230 |
+
original : false
|
2231 |
+
};
|
2232 |
+
for(i in df) {
|
2233 |
+
if(df.hasOwnProperty(i)) {
|
2234 |
+
tmp.state[i] = df[i];
|
2235 |
+
}
|
2236 |
+
}
|
2237 |
+
if(d && d.id) { tmp.id = d.id.toString(); }
|
2238 |
+
if(d && d.text) { tmp.text = d.text; }
|
2239 |
+
if(d && d.data && d.data.jstree && d.data.jstree.icon) {
|
2240 |
+
tmp.icon = d.data.jstree.icon;
|
2241 |
+
}
|
2242 |
+
if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") {
|
2243 |
+
tmp.icon = true;
|
2244 |
+
}
|
2245 |
+
if(d && d.data) {
|
2246 |
+
tmp.data = d.data;
|
2247 |
+
if(d.data.jstree) {
|
2248 |
+
for(i in d.data.jstree) {
|
2249 |
+
if(d.data.jstree.hasOwnProperty(i)) {
|
2250 |
+
tmp.state[i] = d.data.jstree[i];
|
2251 |
+
}
|
2252 |
+
}
|
2253 |
+
}
|
2254 |
+
}
|
2255 |
+
if(d && typeof d.state === 'object') {
|
2256 |
+
for (i in d.state) {
|
2257 |
+
if(d.state.hasOwnProperty(i)) {
|
2258 |
+
tmp.state[i] = d.state[i];
|
2259 |
+
}
|
2260 |
+
}
|
2261 |
+
}
|
2262 |
+
if(d && typeof d.li_attr === 'object') {
|
2263 |
+
for (i in d.li_attr) {
|
2264 |
+
if(d.li_attr.hasOwnProperty(i)) {
|
2265 |
+
tmp.li_attr[i] = d.li_attr[i];
|
2266 |
+
}
|
2267 |
+
}
|
2268 |
+
}
|
2269 |
+
if(tmp.li_attr.id && !tmp.id) {
|
2270 |
+
tmp.id = tmp.li_attr.id.toString();
|
2271 |
+
}
|
2272 |
+
if(!tmp.id) {
|
2273 |
+
tmp.id = tid;
|
2274 |
+
}
|
2275 |
+
if(!tmp.li_attr.id) {
|
2276 |
+
tmp.li_attr.id = tmp.id;
|
2277 |
+
}
|
2278 |
+
if(d && typeof d.a_attr === 'object') {
|
2279 |
+
for (i in d.a_attr) {
|
2280 |
+
if(d.a_attr.hasOwnProperty(i)) {
|
2281 |
+
tmp.a_attr[i] = d.a_attr[i];
|
2282 |
+
}
|
2283 |
+
}
|
2284 |
+
}
|
2285 |
+
if(d && d.children && d.children.length) {
|
2286 |
+
for(i = 0, j = d.children.length; i < j; i++) {
|
2287 |
+
c = this._parse_model_from_json(d.children[i], tmp.id, ps);
|
2288 |
+
e = m[c];
|
2289 |
+
tmp.children.push(c);
|
2290 |
+
if(e.children_d.length) {
|
2291 |
+
tmp.children_d = tmp.children_d.concat(e.children_d);
|
2292 |
+
}
|
2293 |
+
}
|
2294 |
+
tmp.children_d = tmp.children_d.concat(tmp.children);
|
2295 |
+
}
|
2296 |
+
if(d && d.children && d.children === true) {
|
2297 |
+
tmp.state.loaded = false;
|
2298 |
+
tmp.children = [];
|
2299 |
+
tmp.children_d = [];
|
2300 |
+
}
|
2301 |
+
delete d.data;
|
2302 |
+
delete d.children;
|
2303 |
+
tmp.original = d;
|
2304 |
+
m[tmp.id] = tmp;
|
2305 |
+
if(tmp.state.selected) {
|
2306 |
+
this._data.core.selected.push(tmp.id);
|
2307 |
+
}
|
2308 |
+
return tmp.id;
|
2309 |
+
},
|
2310 |
+
/**
|
2311 |
+
* redraws all nodes that need to be redrawn. Used internally.
|
2312 |
+
* @private
|
2313 |
+
* @name _redraw()
|
2314 |
+
* @trigger redraw.jstree
|
2315 |
+
*/
|
2316 |
+
_redraw : function () {
|
2317 |
+
var nodes = this._model.force_full_redraw ? this._model.data[$.jstree.root].children.concat([]) : this._model.changed.concat([]),
|
2318 |
+
f = document.createElement('UL'), tmp, i, j, fe = this._data.core.focused;
|
2319 |
+
for(i = 0, j = nodes.length; i < j; i++) {
|
2320 |
+
tmp = this.redraw_node(nodes[i], true, this._model.force_full_redraw);
|
2321 |
+
if(tmp && this._model.force_full_redraw) {
|
2322 |
+
f.appendChild(tmp);
|
2323 |
+
}
|
2324 |
+
}
|
2325 |
+
if(this._model.force_full_redraw) {
|
2326 |
+
f.className = this.get_container_ul()[0].className;
|
2327 |
+
f.setAttribute('role','group');
|
2328 |
+
this.element.empty().append(f);
|
2329 |
+
//this.get_container_ul()[0].appendChild(f);
|
2330 |
+
}
|
2331 |
+
if(fe !== null && this.settings.core.restore_focus) {
|
2332 |
+
tmp = this.get_node(fe, true);
|
2333 |
+
if(tmp && tmp.length && tmp.children('.jstree-anchor')[0] !== document.activeElement) {
|
2334 |
+
tmp.children('.jstree-anchor').focus();
|
2335 |
+
}
|
2336 |
+
else {
|
2337 |
+
this._data.core.focused = null;
|
2338 |
+
}
|
2339 |
+
}
|
2340 |
+
this._model.force_full_redraw = false;
|
2341 |
+
this._model.changed = [];
|
2342 |
+
/**
|
2343 |
+
* triggered after nodes are redrawn
|
2344 |
+
* @event
|
2345 |
+
* @name redraw.jstree
|
2346 |
+
* @param {array} nodes the redrawn nodes
|
2347 |
+
*/
|
2348 |
+
this.trigger('redraw', { "nodes" : nodes });
|
2349 |
+
},
|
2350 |
+
/**
|
2351 |
+
* redraws all nodes that need to be redrawn or optionally - the whole tree
|
2352 |
+
* @name redraw([full])
|
2353 |
+
* @param {Boolean} full if set to `true` all nodes are redrawn.
|
2354 |
+
*/
|
2355 |
+
redraw : function (full) {
|
2356 |
+
if(full) {
|
2357 |
+
this._model.force_full_redraw = true;
|
2358 |
+
}
|
2359 |
+
//if(this._model.redraw_timeout) {
|
2360 |
+
// clearTimeout(this._model.redraw_timeout);
|
2361 |
+
//}
|
2362 |
+
//this._model.redraw_timeout = setTimeout($.proxy(this._redraw, this),0);
|
2363 |
+
this._redraw();
|
2364 |
+
},
|
2365 |
+
/**
|
2366 |
+
* redraws a single node's children. Used internally.
|
2367 |
+
* @private
|
2368 |
+
* @name draw_children(node)
|
2369 |
+
* @param {mixed} node the node whose children will be redrawn
|
2370 |
+
*/
|
2371 |
+
draw_children : function (node) {
|
2372 |
+
var obj = this.get_node(node),
|
2373 |
+
i = false,
|
2374 |
+
j = false,
|
2375 |
+
k = false,
|
2376 |
+
d = document;
|
2377 |
+
if(!obj) { return false; }
|
2378 |
+
if(obj.id === $.jstree.root) { return this.redraw(true); }
|
2379 |
+
node = this.get_node(node, true);
|
2380 |
+
if(!node || !node.length) { return false; } // TODO: quick toggle
|
2381 |
+
|
2382 |
+
node.children('.jstree-children').remove();
|
2383 |
+
node = node[0];
|
2384 |
+
if(obj.children.length && obj.state.loaded) {
|
2385 |
+
k = d.createElement('UL');
|
2386 |
+
k.setAttribute('role', 'group');
|
2387 |
+
k.className = 'jstree-children';
|
2388 |
+
for(i = 0, j = obj.children.length; i < j; i++) {
|
2389 |
+
k.appendChild(this.redraw_node(obj.children[i], true, true));
|
2390 |
+
}
|
2391 |
+
node.appendChild(k);
|
2392 |
+
}
|
2393 |
+
},
|
2394 |
+
/**
|
2395 |
+
* redraws a single node. Used internally.
|
2396 |
+
* @private
|
2397 |
+
* @name redraw_node(node, deep, is_callback, force_render)
|
2398 |
+
* @param {mixed} node the node to redraw
|
2399 |
+
* @param {Boolean} deep should child nodes be redrawn too
|
2400 |
+
* @param {Boolean} is_callback is this a recursion call
|
2401 |
+
* @param {Boolean} force_render should children of closed parents be drawn anyway
|
2402 |
+
*/
|
2403 |
+
redraw_node : function (node, deep, is_callback, force_render) {
|
2404 |
+
var obj = this.get_node(node),
|
2405 |
+
par = false,
|
2406 |
+
ind = false,
|
2407 |
+
old = false,
|
2408 |
+
i = false,
|
2409 |
+
j = false,
|
2410 |
+
k = false,
|
2411 |
+
c = '',
|
2412 |
+
d = document,
|
2413 |
+
m = this._model.data,
|
2414 |
+
f = false,
|
2415 |
+
s = false,
|
2416 |
+
tmp = null,
|
2417 |
+
t = 0,
|
2418 |
+
l = 0,
|
2419 |
+
has_children = false,
|
2420 |
+
last_sibling = false;
|
2421 |
+
if(!obj) { return false; }
|
2422 |
+
if(obj.id === $.jstree.root) { return this.redraw(true); }
|
2423 |
+
deep = deep || obj.children.length === 0;
|
2424 |
+
node = !document.querySelector ? document.getElementById(obj.id) : this.element[0].querySelector('#' + ("0123456789".indexOf(obj.id[0]) !== -1 ? '\\3' + obj.id[0] + ' ' + obj.id.substr(1).replace($.jstree.idregex,'\\$&') : obj.id.replace($.jstree.idregex,'\\$&')) ); //, this.element);
|
2425 |
+
if(!node) {
|
2426 |
+
deep = true;
|
2427 |
+
//node = d.createElement('LI');
|
2428 |
+
if(!is_callback) {
|
2429 |
+
par = obj.parent !== $.jstree.root ? $('#' + obj.parent.replace($.jstree.idregex,'\\$&'), this.element)[0] : null;
|
2430 |
+
if(par !== null && (!par || !m[obj.parent].state.opened)) {
|
2431 |
+
return false;
|
2432 |
+
}
|
2433 |
+
ind = $.inArray(obj.id, par === null ? m[$.jstree.root].children : m[obj.parent].children);
|
2434 |
+
}
|
2435 |
+
}
|
2436 |
+
else {
|
2437 |
+
node = $(node);
|
2438 |
+
if(!is_callback) {
|
2439 |
+
par = node.parent().parent()[0];
|
2440 |
+
if(par === this.element[0]) {
|
2441 |
+
par = null;
|
2442 |
+
}
|
2443 |
+
ind = node.index();
|
2444 |
+
}
|
2445 |
+
// m[obj.id].data = node.data(); // use only node's data, no need to touch jquery storage
|
2446 |
+
if(!deep && obj.children.length && !node.children('.jstree-children').length) {
|
2447 |
+
deep = true;
|
2448 |
+
}
|
2449 |
+
if(!deep) {
|
2450 |
+
old = node.children('.jstree-children')[0];
|
2451 |
+
}
|
2452 |
+
f = node.children('.jstree-anchor')[0] === document.activeElement;
|
2453 |
+
node.remove();
|
2454 |
+
//node = d.createElement('LI');
|
2455 |
+
//node = node[0];
|
2456 |
+
}
|
2457 |
+
node = this._data.core.node.cloneNode(true);
|
2458 |
+
// node is DOM, deep is boolean
|
2459 |
+
|
2460 |
+
c = 'jstree-node ';
|
2461 |
+
for(i in obj.li_attr) {
|
2462 |
+
if(obj.li_attr.hasOwnProperty(i)) {
|
2463 |
+
if(i === 'id') { continue; }
|
2464 |
+
if(i !== 'class') {
|
2465 |
+
node.setAttribute(i, obj.li_attr[i]);
|
2466 |
+
}
|
2467 |
+
else {
|
2468 |
+
c += obj.li_attr[i];
|
2469 |
+
}
|
2470 |
+
}
|
2471 |
+
}
|
2472 |
+
if(!obj.a_attr.id) {
|
2473 |
+
obj.a_attr.id = obj.id + '_anchor';
|
2474 |
+
}
|
2475 |
+
node.setAttribute('aria-selected', !!obj.state.selected);
|
2476 |
+
node.setAttribute('aria-level', obj.parents.length);
|
2477 |
+
node.setAttribute('aria-labelledby', obj.a_attr.id);
|
2478 |
+
if(obj.state.disabled) {
|
2479 |
+
node.setAttribute('aria-disabled', true);
|
2480 |
+
}
|
2481 |
+
|
2482 |
+
for(i = 0, j = obj.children.length; i < j; i++) {
|
2483 |
+
if(!m[obj.children[i]].state.hidden) {
|
2484 |
+
has_children = true;
|
2485 |
+
break;
|
2486 |
+
}
|
2487 |
+
}
|
2488 |
+
if(obj.parent !== null && m[obj.parent] && !obj.state.hidden) {
|
2489 |
+
i = $.inArray(obj.id, m[obj.parent].children);
|
2490 |
+
last_sibling = obj.id;
|
2491 |
+
if(i !== -1) {
|
2492 |
+
i++;
|
2493 |
+
for(j = m[obj.parent].children.length; i < j; i++) {
|
2494 |
+
if(!m[m[obj.parent].children[i]].state.hidden) {
|
2495 |
+
last_sibling = m[obj.parent].children[i];
|
2496 |
+
}
|
2497 |
+
if(last_sibling !== obj.id) {
|
2498 |
+
break;
|
2499 |
+
}
|
2500 |
+
}
|
2501 |
+
}
|
2502 |
+
}
|
2503 |
+
|
2504 |
+
if(obj.state.hidden) {
|
2505 |
+
c += ' jstree-hidden';
|
2506 |
+
}
|
2507 |
+
if (obj.state.loading) {
|
2508 |
+
c += ' jstree-loading';
|
2509 |
+
}
|
2510 |
+
if(obj.state.loaded && !has_children) {
|
2511 |
+
c += ' jstree-leaf';
|
2512 |
+
}
|
2513 |
+
else {
|
2514 |
+
c += obj.state.opened && obj.state.loaded ? ' jstree-open' : ' jstree-closed';
|
2515 |
+
node.setAttribute('aria-expanded', (obj.state.opened && obj.state.loaded) );
|
2516 |
+
}
|
2517 |
+
if(last_sibling === obj.id) {
|
2518 |
+
c += ' jstree-last';
|
2519 |
+
}
|
2520 |
+
node.id = obj.id;
|
2521 |
+
node.className = c;
|
2522 |
+
c = ( obj.state.selected ? ' jstree-clicked' : '') + ( obj.state.disabled ? ' jstree-disabled' : '');
|
2523 |
+
for(j in obj.a_attr) {
|
2524 |
+
if(obj.a_attr.hasOwnProperty(j)) {
|
2525 |
+
if(j === 'href' && obj.a_attr[j] === '#') { continue; }
|
2526 |
+
if(j !== 'class') {
|
2527 |
+
node.childNodes[1].setAttribute(j, obj.a_attr[j]);
|
2528 |
+
}
|
2529 |
+
else {
|
2530 |
+
c += ' ' + obj.a_attr[j];
|
2531 |
+
}
|
2532 |
+
}
|
2533 |
+
}
|
2534 |
+
if(c.length) {
|
2535 |
+
node.childNodes[1].className = 'jstree-anchor ' + c;
|
2536 |
+
}
|
2537 |
+
if((obj.icon && obj.icon !== true) || obj.icon === false) {
|
2538 |
+
if(obj.icon === false) {
|
2539 |
+
node.childNodes[1].childNodes[0].className += ' jstree-themeicon-hidden';
|
2540 |
+
}
|
2541 |
+
else if(obj.icon.indexOf('/') === -1 && obj.icon.indexOf('.') === -1) {
|
2542 |
+
node.childNodes[1].childNodes[0].className += ' ' + obj.icon + ' jstree-themeicon-custom';
|
2543 |
+
}
|
2544 |
+
else {
|
2545 |
+
node.childNodes[1].childNodes[0].style.backgroundImage = 'url("'+obj.icon+'")';
|
2546 |
+
node.childNodes[1].childNodes[0].style.backgroundPosition = 'center center';
|
2547 |
+
node.childNodes[1].childNodes[0].style.backgroundSize = 'auto';
|
2548 |
+
node.childNodes[1].childNodes[0].className += ' jstree-themeicon-custom';
|
2549 |
+
}
|
2550 |
+
}
|
2551 |
+
|
2552 |
+
if(this.settings.core.force_text) {
|
2553 |
+
node.childNodes[1].appendChild(d.createTextNode(obj.text));
|
2554 |
+
}
|
2555 |
+
else {
|
2556 |
+
node.childNodes[1].innerHTML += obj.text;
|
2557 |
+
}
|
2558 |
+
|
2559 |
+
|
2560 |
+
if(deep && obj.children.length && (obj.state.opened || force_render) && obj.state.loaded) {
|
2561 |
+
k = d.createElement('UL');
|
2562 |
+
k.setAttribute('role', 'group');
|
2563 |
+
k.className = 'jstree-children';
|
2564 |
+
for(i = 0, j = obj.children.length; i < j; i++) {
|
2565 |
+
k.appendChild(this.redraw_node(obj.children[i], deep, true));
|
2566 |
+
}
|
2567 |
+
node.appendChild(k);
|
2568 |
+
}
|
2569 |
+
if(old) {
|
2570 |
+
node.appendChild(old);
|
2571 |
+
}
|
2572 |
+
if(!is_callback) {
|
2573 |
+
// append back using par / ind
|
2574 |
+
if(!par) {
|
2575 |
+
par = this.element[0];
|
2576 |
+
}
|
2577 |
+
for(i = 0, j = par.childNodes.length; i < j; i++) {
|
2578 |
+
if(par.childNodes[i] && par.childNodes[i].className && par.childNodes[i].className.indexOf('jstree-children') !== -1) {
|
2579 |
+
tmp = par.childNodes[i];
|
2580 |
+
break;
|
2581 |
+
}
|
2582 |
+
}
|
2583 |
+
if(!tmp) {
|
2584 |
+
tmp = d.createElement('UL');
|
2585 |
+
tmp.setAttribute('role', 'group');
|
2586 |
+
tmp.className = 'jstree-children';
|
2587 |
+
par.appendChild(tmp);
|
2588 |
+
}
|
2589 |
+
par = tmp;
|
2590 |
+
|
2591 |
+
if(ind < par.childNodes.length) {
|
2592 |
+
par.insertBefore(node, par.childNodes[ind]);
|
2593 |
+
}
|
2594 |
+
else {
|
2595 |
+
par.appendChild(node);
|
2596 |
+
}
|
2597 |
+
if(f) {
|
2598 |
+
t = this.element[0].scrollTop;
|
2599 |
+
l = this.element[0].scrollLeft;
|
2600 |
+
node.childNodes[1].focus();
|
2601 |
+
this.element[0].scrollTop = t;
|
2602 |
+
this.element[0].scrollLeft = l;
|
2603 |
+
}
|
2604 |
+
}
|
2605 |
+
if(obj.state.opened && !obj.state.loaded) {
|
2606 |
+
obj.state.opened = false;
|
2607 |
+
setTimeout($.proxy(function () {
|
2608 |
+
this.open_node(obj.id, false, 0);
|
2609 |
+
}, this), 0);
|
2610 |
+
}
|
2611 |
+
return node;
|
2612 |
+
},
|
2613 |
+
/**
|
2614 |
+
* opens a node, revealing its children. If the node is not loaded it will be loaded and opened once ready.
|
2615 |
+
* @name open_node(obj [, callback, animation])
|
2616 |
+
* @param {mixed} obj the node to open
|
2617 |
+
* @param {Function} callback a function to execute once the node is opened
|
2618 |
+
* @param {Number} animation the animation duration in milliseconds when opening the node (overrides the `core.animation` setting). Use `false` for no animation.
|
2619 |
+
* @trigger open_node.jstree, after_open.jstree, before_open.jstree
|
2620 |
+
*/
|
2621 |
+
open_node : function (obj, callback, animation) {
|
2622 |
+
var t1, t2, d, t;
|
2623 |
+
if($.isArray(obj)) {
|
2624 |
+
obj = obj.slice();
|
2625 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
2626 |
+
this.open_node(obj[t1], callback, animation);
|
2627 |
+
}
|
2628 |
+
return true;
|
2629 |
+
}
|
2630 |
+
obj = this.get_node(obj);
|
2631 |
+
if(!obj || obj.id === $.jstree.root) {
|
2632 |
+
return false;
|
2633 |
+
}
|
2634 |
+
animation = animation === undefined ? this.settings.core.animation : animation;
|
2635 |
+
if(!this.is_closed(obj)) {
|
2636 |
+
if(callback) {
|
2637 |
+
callback.call(this, obj, false);
|
2638 |
+
}
|
2639 |
+
return false;
|
2640 |
+
}
|
2641 |
+
if(!this.is_loaded(obj)) {
|
2642 |
+
if(this.is_loading(obj)) {
|
2643 |
+
return setTimeout($.proxy(function () {
|
2644 |
+
this.open_node(obj, callback, animation);
|
2645 |
+
}, this), 500);
|
2646 |
+
}
|
2647 |
+
this.load_node(obj, function (o, ok) {
|
2648 |
+
return ok ? this.open_node(o, callback, animation) : (callback ? callback.call(this, o, false) : false);
|
2649 |
+
});
|
2650 |
+
}
|
2651 |
+
else {
|
2652 |
+
d = this.get_node(obj, true);
|
2653 |
+
t = this;
|
2654 |
+
if(d.length) {
|
2655 |
+
if(animation && d.children(".jstree-children").length) {
|
2656 |
+
d.children(".jstree-children").stop(true, true);
|
2657 |
+
}
|
2658 |
+
if(obj.children.length && !this._firstChild(d.children('.jstree-children')[0])) {
|
2659 |
+
this.draw_children(obj);
|
2660 |
+
//d = this.get_node(obj, true);
|
2661 |
+
}
|
2662 |
+
if(!animation) {
|
2663 |
+
this.trigger('before_open', { "node" : obj });
|
2664 |
+
d[0].className = d[0].className.replace('jstree-closed', 'jstree-open');
|
2665 |
+
d[0].setAttribute("aria-expanded", true);
|
2666 |
+
}
|
2667 |
+
else {
|
2668 |
+
this.trigger('before_open', { "node" : obj });
|
2669 |
+
d
|
2670 |
+
.children(".jstree-children").css("display","none").end()
|
2671 |
+
.removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded", true)
|
2672 |
+
.children(".jstree-children").stop(true, true)
|
2673 |
+
.slideDown(animation, function () {
|
2674 |
+
this.style.display = "";
|
2675 |
+
if (t.element) {
|
2676 |
+
t.trigger("after_open", { "node" : obj });
|
2677 |
+
}
|
2678 |
+
});
|
2679 |
+
}
|
2680 |
+
}
|
2681 |
+
obj.state.opened = true;
|
2682 |
+
if(callback) {
|
2683 |
+
callback.call(this, obj, true);
|
2684 |
+
}
|
2685 |
+
if(!d.length) {
|
2686 |
+
/**
|
2687 |
+
* triggered when a node is about to be opened (if the node is supposed to be in the DOM, it will be, but it won't be visible yet)
|
2688 |
+
* @event
|
2689 |
+
* @name before_open.jstree
|
2690 |
+
* @param {Object} node the opened node
|
2691 |
+
*/
|
2692 |
+
this.trigger('before_open', { "node" : obj });
|
2693 |
+
}
|
2694 |
+
/**
|
2695 |
+
* triggered when a node is opened (if there is an animation it will not be completed yet)
|
2696 |
+
* @event
|
2697 |
+
* @name open_node.jstree
|
2698 |
+
* @param {Object} node the opened node
|
2699 |
+
*/
|
2700 |
+
this.trigger('open_node', { "node" : obj });
|
2701 |
+
if(!animation || !d.length) {
|
2702 |
+
/**
|
2703 |
+
* triggered when a node is opened and the animation is complete
|
2704 |
+
* @event
|
2705 |
+
* @name after_open.jstree
|
2706 |
+
* @param {Object} node the opened node
|
2707 |
+
*/
|
2708 |
+
this.trigger("after_open", { "node" : obj });
|
2709 |
+
}
|
2710 |
+
return true;
|
2711 |
+
}
|
2712 |
+
},
|
2713 |
+
/**
|
2714 |
+
* opens every parent of a node (node should be loaded)
|
2715 |
+
* @name _open_to(obj)
|
2716 |
+
* @param {mixed} obj the node to reveal
|
2717 |
+
* @private
|
2718 |
+
*/
|
2719 |
+
_open_to : function (obj) {
|
2720 |
+
obj = this.get_node(obj);
|
2721 |
+
if(!obj || obj.id === $.jstree.root) {
|
2722 |
+
return false;
|
2723 |
+
}
|
2724 |
+
var i, j, p = obj.parents;
|
2725 |
+
for(i = 0, j = p.length; i < j; i+=1) {
|
2726 |
+
if(i !== $.jstree.root) {
|
2727 |
+
this.open_node(p[i], false, 0);
|
2728 |
+
}
|
2729 |
+
}
|
2730 |
+
return $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element);
|
2731 |
+
},
|
2732 |
+
/**
|
2733 |
+
* closes a node, hiding its children
|
2734 |
+
* @name close_node(obj [, animation])
|
2735 |
+
* @param {mixed} obj the node to close
|
2736 |
+
* @param {Number} animation the animation duration in milliseconds when closing the node (overrides the `core.animation` setting). Use `false` for no animation.
|
2737 |
+
* @trigger close_node.jstree, after_close.jstree
|
2738 |
+
*/
|
2739 |
+
close_node : function (obj, animation) {
|
2740 |
+
var t1, t2, t, d;
|
2741 |
+
if($.isArray(obj)) {
|
2742 |
+
obj = obj.slice();
|
2743 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
2744 |
+
this.close_node(obj[t1], animation);
|
2745 |
+
}
|
2746 |
+
return true;
|
2747 |
+
}
|
2748 |
+
obj = this.get_node(obj);
|
2749 |
+
if(!obj || obj.id === $.jstree.root) {
|
2750 |
+
return false;
|
2751 |
+
}
|
2752 |
+
if(this.is_closed(obj)) {
|
2753 |
+
return false;
|
2754 |
+
}
|
2755 |
+
animation = animation === undefined ? this.settings.core.animation : animation;
|
2756 |
+
t = this;
|
2757 |
+
d = this.get_node(obj, true);
|
2758 |
+
|
2759 |
+
obj.state.opened = false;
|
2760 |
+
/**
|
2761 |
+
* triggered when a node is closed (if there is an animation it will not be complete yet)
|
2762 |
+
* @event
|
2763 |
+
* @name close_node.jstree
|
2764 |
+
* @param {Object} node the closed node
|
2765 |
+
*/
|
2766 |
+
this.trigger('close_node',{ "node" : obj });
|
2767 |
+
if(!d.length) {
|
2768 |
+
/**
|
2769 |
+
* triggered when a node is closed and the animation is complete
|
2770 |
+
* @event
|
2771 |
+
* @name after_close.jstree
|
2772 |
+
* @param {Object} node the closed node
|
2773 |
+
*/
|
2774 |
+
this.trigger("after_close", { "node" : obj });
|
2775 |
+
}
|
2776 |
+
else {
|
2777 |
+
if(!animation) {
|
2778 |
+
d[0].className = d[0].className.replace('jstree-open', 'jstree-closed');
|
2779 |
+
d.attr("aria-expanded", false).children('.jstree-children').remove();
|
2780 |
+
this.trigger("after_close", { "node" : obj });
|
2781 |
+
}
|
2782 |
+
else {
|
2783 |
+
d
|
2784 |
+
.children(".jstree-children").attr("style","display:block !important").end()
|
2785 |
+
.removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded", false)
|
2786 |
+
.children(".jstree-children").stop(true, true).slideUp(animation, function () {
|
2787 |
+
this.style.display = "";
|
2788 |
+
d.children('.jstree-children').remove();
|
2789 |
+
if (t.element) {
|
2790 |
+
t.trigger("after_close", { "node" : obj });
|
2791 |
+
}
|
2792 |
+
});
|
2793 |
+
}
|
2794 |
+
}
|
2795 |
+
},
|
2796 |
+
/**
|
2797 |
+
* toggles a node - closing it if it is open, opening it if it is closed
|
2798 |
+
* @name toggle_node(obj)
|
2799 |
+
* @param {mixed} obj the node to toggle
|
2800 |
+
*/
|
2801 |
+
toggle_node : function (obj) {
|
2802 |
+
var t1, t2;
|
2803 |
+
if($.isArray(obj)) {
|
2804 |
+
obj = obj.slice();
|
2805 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
2806 |
+
this.toggle_node(obj[t1]);
|
2807 |
+
}
|
2808 |
+
return true;
|
2809 |
+
}
|
2810 |
+
if(this.is_closed(obj)) {
|
2811 |
+
return this.open_node(obj);
|
2812 |
+
}
|
2813 |
+
if(this.is_open(obj)) {
|
2814 |
+
return this.close_node(obj);
|
2815 |
+
}
|
2816 |
+
},
|
2817 |
+
/**
|
2818 |
+
* opens all nodes within a node (or the tree), revealing their children. If the node is not loaded it will be loaded and opened once ready.
|
2819 |
+
* @name open_all([obj, animation, original_obj])
|
2820 |
+
* @param {mixed} obj the node to open recursively, omit to open all nodes in the tree
|
2821 |
+
* @param {Number} animation the animation duration in milliseconds when opening the nodes, the default is no animation
|
2822 |
+
* @param {jQuery} reference to the node that started the process (internal use)
|
2823 |
+
* @trigger open_all.jstree
|
2824 |
+
*/
|
2825 |
+
open_all : function (obj, animation, original_obj) {
|
2826 |
+
if(!obj) { obj = $.jstree.root; }
|
2827 |
+
obj = this.get_node(obj);
|
2828 |
+
if(!obj) { return false; }
|
2829 |
+
var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), i, j, _this;
|
2830 |
+
if(!dom.length) {
|
2831 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
2832 |
+
if(this.is_closed(this._model.data[obj.children_d[i]])) {
|
2833 |
+
this._model.data[obj.children_d[i]].state.opened = true;
|
2834 |
+
}
|
2835 |
+
}
|
2836 |
+
return this.trigger('open_all', { "node" : obj });
|
2837 |
+
}
|
2838 |
+
original_obj = original_obj || dom;
|
2839 |
+
_this = this;
|
2840 |
+
dom = this.is_closed(obj) ? dom.find('.jstree-closed').addBack() : dom.find('.jstree-closed');
|
2841 |
+
dom.each(function () {
|
2842 |
+
_this.open_node(
|
2843 |
+
this,
|
2844 |
+
function(node, status) { if(status && this.is_parent(node)) { this.open_all(node, animation, original_obj); } },
|
2845 |
+
animation || 0
|
2846 |
+
);
|
2847 |
+
});
|
2848 |
+
if(original_obj.find('.jstree-closed').length === 0) {
|
2849 |
+
/**
|
2850 |
+
* triggered when an `open_all` call completes
|
2851 |
+
* @event
|
2852 |
+
* @name open_all.jstree
|
2853 |
+
* @param {Object} node the opened node
|
2854 |
+
*/
|
2855 |
+
this.trigger('open_all', { "node" : this.get_node(original_obj) });
|
2856 |
+
}
|
2857 |
+
},
|
2858 |
+
/**
|
2859 |
+
* closes all nodes within a node (or the tree), revealing their children
|
2860 |
+
* @name close_all([obj, animation])
|
2861 |
+
* @param {mixed} obj the node to close recursively, omit to close all nodes in the tree
|
2862 |
+
* @param {Number} animation the animation duration in milliseconds when closing the nodes, the default is no animation
|
2863 |
+
* @trigger close_all.jstree
|
2864 |
+
*/
|
2865 |
+
close_all : function (obj, animation) {
|
2866 |
+
if(!obj) { obj = $.jstree.root; }
|
2867 |
+
obj = this.get_node(obj);
|
2868 |
+
if(!obj) { return false; }
|
2869 |
+
var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true),
|
2870 |
+
_this = this, i, j;
|
2871 |
+
if(dom.length) {
|
2872 |
+
dom = this.is_open(obj) ? dom.find('.jstree-open').addBack() : dom.find('.jstree-open');
|
2873 |
+
$(dom.get().reverse()).each(function () { _this.close_node(this, animation || 0); });
|
2874 |
+
}
|
2875 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
2876 |
+
this._model.data[obj.children_d[i]].state.opened = false;
|
2877 |
+
}
|
2878 |
+
/**
|
2879 |
+
* triggered when an `close_all` call completes
|
2880 |
+
* @event
|
2881 |
+
* @name close_all.jstree
|
2882 |
+
* @param {Object} node the closed node
|
2883 |
+
*/
|
2884 |
+
this.trigger('close_all', { "node" : obj });
|
2885 |
+
},
|
2886 |
+
/**
|
2887 |
+
* checks if a node is disabled (not selectable)
|
2888 |
+
* @name is_disabled(obj)
|
2889 |
+
* @param {mixed} obj
|
2890 |
+
* @return {Boolean}
|
2891 |
+
*/
|
2892 |
+
is_disabled : function (obj) {
|
2893 |
+
obj = this.get_node(obj);
|
2894 |
+
return obj && obj.state && obj.state.disabled;
|
2895 |
+
},
|
2896 |
+
/**
|
2897 |
+
* enables a node - so that it can be selected
|
2898 |
+
* @name enable_node(obj)
|
2899 |
+
* @param {mixed} obj the node to enable
|
2900 |
+
* @trigger enable_node.jstree
|
2901 |
+
*/
|
2902 |
+
enable_node : function (obj) {
|
2903 |
+
var t1, t2;
|
2904 |
+
if($.isArray(obj)) {
|
2905 |
+
obj = obj.slice();
|
2906 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
2907 |
+
this.enable_node(obj[t1]);
|
2908 |
+
}
|
2909 |
+
return true;
|
2910 |
+
}
|
2911 |
+
obj = this.get_node(obj);
|
2912 |
+
if(!obj || obj.id === $.jstree.root) {
|
2913 |
+
return false;
|
2914 |
+
}
|
2915 |
+
obj.state.disabled = false;
|
2916 |
+
this.get_node(obj,true).children('.jstree-anchor').removeClass('jstree-disabled').attr('aria-disabled', false);
|
2917 |
+
/**
|
2918 |
+
* triggered when an node is enabled
|
2919 |
+
* @event
|
2920 |
+
* @name enable_node.jstree
|
2921 |
+
* @param {Object} node the enabled node
|
2922 |
+
*/
|
2923 |
+
this.trigger('enable_node', { 'node' : obj });
|
2924 |
+
},
|
2925 |
+
/**
|
2926 |
+
* disables a node - so that it can not be selected
|
2927 |
+
* @name disable_node(obj)
|
2928 |
+
* @param {mixed} obj the node to disable
|
2929 |
+
* @trigger disable_node.jstree
|
2930 |
+
*/
|
2931 |
+
disable_node : function (obj) {
|
2932 |
+
var t1, t2;
|
2933 |
+
if($.isArray(obj)) {
|
2934 |
+
obj = obj.slice();
|
2935 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
2936 |
+
this.disable_node(obj[t1]);
|
2937 |
+
}
|
2938 |
+
return true;
|
2939 |
+
}
|
2940 |
+
obj = this.get_node(obj);
|
2941 |
+
if(!obj || obj.id === $.jstree.root) {
|
2942 |
+
return false;
|
2943 |
+
}
|
2944 |
+
obj.state.disabled = true;
|
2945 |
+
this.get_node(obj,true).children('.jstree-anchor').addClass('jstree-disabled').attr('aria-disabled', true);
|
2946 |
+
/**
|
2947 |
+
* triggered when an node is disabled
|
2948 |
+
* @event
|
2949 |
+
* @name disable_node.jstree
|
2950 |
+
* @param {Object} node the disabled node
|
2951 |
+
*/
|
2952 |
+
this.trigger('disable_node', { 'node' : obj });
|
2953 |
+
},
|
2954 |
+
/**
|
2955 |
+
* determines if a node is hidden
|
2956 |
+
* @name is_hidden(obj)
|
2957 |
+
* @param {mixed} obj the node
|
2958 |
+
*/
|
2959 |
+
is_hidden : function (obj) {
|
2960 |
+
obj = this.get_node(obj);
|
2961 |
+
return obj.state.hidden === true;
|
2962 |
+
},
|
2963 |
+
/**
|
2964 |
+
* hides a node - it is still in the structure but will not be visible
|
2965 |
+
* @name hide_node(obj)
|
2966 |
+
* @param {mixed} obj the node to hide
|
2967 |
+
* @param {Boolean} skip_redraw internal parameter controlling if redraw is called
|
2968 |
+
* @trigger hide_node.jstree
|
2969 |
+
*/
|
2970 |
+
hide_node : function (obj, skip_redraw) {
|
2971 |
+
var t1, t2;
|
2972 |
+
if($.isArray(obj)) {
|
2973 |
+
obj = obj.slice();
|
2974 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
2975 |
+
this.hide_node(obj[t1], true);
|
2976 |
+
}
|
2977 |
+
if (!skip_redraw) {
|
2978 |
+
this.redraw();
|
2979 |
+
}
|
2980 |
+
return true;
|
2981 |
+
}
|
2982 |
+
obj = this.get_node(obj);
|
2983 |
+
if(!obj || obj.id === $.jstree.root) {
|
2984 |
+
return false;
|
2985 |
+
}
|
2986 |
+
if(!obj.state.hidden) {
|
2987 |
+
obj.state.hidden = true;
|
2988 |
+
this._node_changed(obj.parent);
|
2989 |
+
if(!skip_redraw) {
|
2990 |
+
this.redraw();
|
2991 |
+
}
|
2992 |
+
/**
|
2993 |
+
* triggered when an node is hidden
|
2994 |
+
* @event
|
2995 |
+
* @name hide_node.jstree
|
2996 |
+
* @param {Object} node the hidden node
|
2997 |
+
*/
|
2998 |
+
this.trigger('hide_node', { 'node' : obj });
|
2999 |
+
}
|
3000 |
+
},
|
3001 |
+
/**
|
3002 |
+
* shows a node
|
3003 |
+
* @name show_node(obj)
|
3004 |
+
* @param {mixed} obj the node to show
|
3005 |
+
* @param {Boolean} skip_redraw internal parameter controlling if redraw is called
|
3006 |
+
* @trigger show_node.jstree
|
3007 |
+
*/
|
3008 |
+
show_node : function (obj, skip_redraw) {
|
3009 |
+
var t1, t2;
|
3010 |
+
if($.isArray(obj)) {
|
3011 |
+
obj = obj.slice();
|
3012 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
3013 |
+
this.show_node(obj[t1], true);
|
3014 |
+
}
|
3015 |
+
if (!skip_redraw) {
|
3016 |
+
this.redraw();
|
3017 |
+
}
|
3018 |
+
return true;
|
3019 |
+
}
|
3020 |
+
obj = this.get_node(obj);
|
3021 |
+
if(!obj || obj.id === $.jstree.root) {
|
3022 |
+
return false;
|
3023 |
+
}
|
3024 |
+
if(obj.state.hidden) {
|
3025 |
+
obj.state.hidden = false;
|
3026 |
+
this._node_changed(obj.parent);
|
3027 |
+
if(!skip_redraw) {
|
3028 |
+
this.redraw();
|
3029 |
+
}
|
3030 |
+
/**
|
3031 |
+
* triggered when an node is shown
|
3032 |
+
* @event
|
3033 |
+
* @name show_node.jstree
|
3034 |
+
* @param {Object} node the shown node
|
3035 |
+
*/
|
3036 |
+
this.trigger('show_node', { 'node' : obj });
|
3037 |
+
}
|
3038 |
+
},
|
3039 |
+
/**
|
3040 |
+
* hides all nodes
|
3041 |
+
* @name hide_all()
|
3042 |
+
* @trigger hide_all.jstree
|
3043 |
+
*/
|
3044 |
+
hide_all : function (skip_redraw) {
|
3045 |
+
var i, m = this._model.data, ids = [];
|
3046 |
+
for(i in m) {
|
3047 |
+
if(m.hasOwnProperty(i) && i !== $.jstree.root && !m[i].state.hidden) {
|
3048 |
+
m[i].state.hidden = true;
|
3049 |
+
ids.push(i);
|
3050 |
+
}
|
3051 |
+
}
|
3052 |
+
this._model.force_full_redraw = true;
|
3053 |
+
if(!skip_redraw) {
|
3054 |
+
this.redraw();
|
3055 |
+
}
|
3056 |
+
/**
|
3057 |
+
* triggered when all nodes are hidden
|
3058 |
+
* @event
|
3059 |
+
* @name hide_all.jstree
|
3060 |
+
* @param {Array} nodes the IDs of all hidden nodes
|
3061 |
+
*/
|
3062 |
+
this.trigger('hide_all', { 'nodes' : ids });
|
3063 |
+
return ids;
|
3064 |
+
},
|
3065 |
+
/**
|
3066 |
+
* shows all nodes
|
3067 |
+
* @name show_all()
|
3068 |
+
* @trigger show_all.jstree
|
3069 |
+
*/
|
3070 |
+
show_all : function (skip_redraw) {
|
3071 |
+
var i, m = this._model.data, ids = [];
|
3072 |
+
for(i in m) {
|
3073 |
+
if(m.hasOwnProperty(i) && i !== $.jstree.root && m[i].state.hidden) {
|
3074 |
+
m[i].state.hidden = false;
|
3075 |
+
ids.push(i);
|
3076 |
+
}
|
3077 |
+
}
|
3078 |
+
this._model.force_full_redraw = true;
|
3079 |
+
if(!skip_redraw) {
|
3080 |
+
this.redraw();
|
3081 |
+
}
|
3082 |
+
/**
|
3083 |
+
* triggered when all nodes are shown
|
3084 |
+
* @event
|
3085 |
+
* @name show_all.jstree
|
3086 |
+
* @param {Array} nodes the IDs of all shown nodes
|
3087 |
+
*/
|
3088 |
+
this.trigger('show_all', { 'nodes' : ids });
|
3089 |
+
return ids;
|
3090 |
+
},
|
3091 |
+
/**
|
3092 |
+
* called when a node is selected by the user. Used internally.
|
3093 |
+
* @private
|
3094 |
+
* @name activate_node(obj, e)
|
3095 |
+
* @param {mixed} obj the node
|
3096 |
+
* @param {Object} e the related event
|
3097 |
+
* @trigger activate_node.jstree, changed.jstree
|
3098 |
+
*/
|
3099 |
+
activate_node : function (obj, e) {
|
3100 |
+
if(this.is_disabled(obj)) {
|
3101 |
+
return false;
|
3102 |
+
}
|
3103 |
+
if(!e || typeof e !== 'object') {
|
3104 |
+
e = {};
|
3105 |
+
}
|
3106 |
+
|
3107 |
+
// ensure last_clicked is still in the DOM, make it fresh (maybe it was moved?) and make sure it is still selected, if not - make last_clicked the last selected node
|
3108 |
+
this._data.core.last_clicked = this._data.core.last_clicked && this._data.core.last_clicked.id !== undefined ? this.get_node(this._data.core.last_clicked.id) : null;
|
3109 |
+
if(this._data.core.last_clicked && !this._data.core.last_clicked.state.selected) { this._data.core.last_clicked = null; }
|
3110 |
+
if(!this._data.core.last_clicked && this._data.core.selected.length) { this._data.core.last_clicked = this.get_node(this._data.core.selected[this._data.core.selected.length - 1]); }
|
3111 |
+
|
3112 |
+
if(!this.settings.core.multiple || (!e.metaKey && !e.ctrlKey && !e.shiftKey) || (e.shiftKey && (!this._data.core.last_clicked || !this.get_parent(obj) || this.get_parent(obj) !== this._data.core.last_clicked.parent ) )) {
|
3113 |
+
if(!this.settings.core.multiple && (e.metaKey || e.ctrlKey || e.shiftKey) && this.is_selected(obj)) {
|
3114 |
+
this.deselect_node(obj, false, e);
|
3115 |
+
}
|
3116 |
+
else {
|
3117 |
+
this.deselect_all(true);
|
3118 |
+
this.select_node(obj, false, false, e);
|
3119 |
+
this._data.core.last_clicked = this.get_node(obj);
|
3120 |
+
}
|
3121 |
+
}
|
3122 |
+
else {
|
3123 |
+
if(e.shiftKey) {
|
3124 |
+
var o = this.get_node(obj).id,
|
3125 |
+
l = this._data.core.last_clicked.id,
|
3126 |
+
p = this.get_node(this._data.core.last_clicked.parent).children,
|
3127 |
+
c = false,
|
3128 |
+
i, j;
|
3129 |
+
for(i = 0, j = p.length; i < j; i += 1) {
|
3130 |
+
// separate IFs work whem o and l are the same
|
3131 |
+
if(p[i] === o) {
|
3132 |
+
c = !c;
|
3133 |
+
}
|
3134 |
+
if(p[i] === l) {
|
3135 |
+
c = !c;
|
3136 |
+
}
|
3137 |
+
if(!this.is_disabled(p[i]) && (c || p[i] === o || p[i] === l)) {
|
3138 |
+
if (!this.is_hidden(p[i])) {
|
3139 |
+
this.select_node(p[i], true, false, e);
|
3140 |
+
}
|
3141 |
+
}
|
3142 |
+
else {
|
3143 |
+
this.deselect_node(p[i], true, e);
|
3144 |
+
}
|
3145 |
+
}
|
3146 |
+
this.trigger('changed', { 'action' : 'select_node', 'node' : this.get_node(obj), 'selected' : this._data.core.selected, 'event' : e });
|
3147 |
+
}
|
3148 |
+
else {
|
3149 |
+
if(!this.is_selected(obj)) {
|
3150 |
+
this.select_node(obj, false, false, e);
|
3151 |
+
}
|
3152 |
+
else {
|
3153 |
+
this.deselect_node(obj, false, e);
|
3154 |
+
}
|
3155 |
+
}
|
3156 |
+
}
|
3157 |
+
/**
|
3158 |
+
* triggered when an node is clicked or intercated with by the user
|
3159 |
+
* @event
|
3160 |
+
* @name activate_node.jstree
|
3161 |
+
* @param {Object} node
|
3162 |
+
* @param {Object} event the ooriginal event (if any) which triggered the call (may be an empty object)
|
3163 |
+
*/
|
3164 |
+
this.trigger('activate_node', { 'node' : this.get_node(obj), 'event' : e });
|
3165 |
+
},
|
3166 |
+
/**
|
3167 |
+
* applies the hover state on a node, called when a node is hovered by the user. Used internally.
|
3168 |
+
* @private
|
3169 |
+
* @name hover_node(obj)
|
3170 |
+
* @param {mixed} obj
|
3171 |
+
* @trigger hover_node.jstree
|
3172 |
+
*/
|
3173 |
+
hover_node : function (obj) {
|
3174 |
+
obj = this.get_node(obj, true);
|
3175 |
+
if(!obj || !obj.length || obj.children('.jstree-hovered').length) {
|
3176 |
+
return false;
|
3177 |
+
}
|
3178 |
+
var o = this.element.find('.jstree-hovered'), t = this.element;
|
3179 |
+
if(o && o.length) { this.dehover_node(o); }
|
3180 |
+
|
3181 |
+
obj.children('.jstree-anchor').addClass('jstree-hovered');
|
3182 |
+
/**
|
3183 |
+
* triggered when an node is hovered
|
3184 |
+
* @event
|
3185 |
+
* @name hover_node.jstree
|
3186 |
+
* @param {Object} node
|
3187 |
+
*/
|
3188 |
+
this.trigger('hover_node', { 'node' : this.get_node(obj) });
|
3189 |
+
setTimeout(function () { t.attr('aria-activedescendant', obj[0].id); }, 0);
|
3190 |
+
},
|
3191 |
+
/**
|
3192 |
+
* removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally.
|
3193 |
+
* @private
|
3194 |
+
* @name dehover_node(obj)
|
3195 |
+
* @param {mixed} obj
|
3196 |
+
* @trigger dehover_node.jstree
|
3197 |
+
*/
|
3198 |
+
dehover_node : function (obj) {
|
3199 |
+
obj = this.get_node(obj, true);
|
3200 |
+
if(!obj || !obj.length || !obj.children('.jstree-hovered').length) {
|
3201 |
+
return false;
|
3202 |
+
}
|
3203 |
+
obj.children('.jstree-anchor').removeClass('jstree-hovered');
|
3204 |
+
/**
|
3205 |
+
* triggered when an node is no longer hovered
|
3206 |
+
* @event
|
3207 |
+
* @name dehover_node.jstree
|
3208 |
+
* @param {Object} node
|
3209 |
+
*/
|
3210 |
+
this.trigger('dehover_node', { 'node' : this.get_node(obj) });
|
3211 |
+
},
|
3212 |
+
/**
|
3213 |
+
* select a node
|
3214 |
+
* @name select_node(obj [, supress_event, prevent_open])
|
3215 |
+
* @param {mixed} obj an array can be used to select multiple nodes
|
3216 |
+
* @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered
|
3217 |
+
* @param {Boolean} prevent_open if set to `true` parents of the selected node won't be opened
|
3218 |
+
* @trigger select_node.jstree, changed.jstree
|
3219 |
+
*/
|
3220 |
+
select_node : function (obj, supress_event, prevent_open, e) {
|
3221 |
+
var dom, t1, t2, th;
|
3222 |
+
if($.isArray(obj)) {
|
3223 |
+
obj = obj.slice();
|
3224 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
3225 |
+
this.select_node(obj[t1], supress_event, prevent_open, e);
|
3226 |
+
}
|
3227 |
+
return true;
|
3228 |
+
}
|
3229 |
+
obj = this.get_node(obj);
|
3230 |
+
if(!obj || obj.id === $.jstree.root) {
|
3231 |
+
return false;
|
3232 |
+
}
|
3233 |
+
dom = this.get_node(obj, true);
|
3234 |
+
if(!obj.state.selected) {
|
3235 |
+
obj.state.selected = true;
|
3236 |
+
this._data.core.selected.push(obj.id);
|
3237 |
+
if(!prevent_open) {
|
3238 |
+
dom = this._open_to(obj);
|
3239 |
+
}
|
3240 |
+
if(dom && dom.length) {
|
3241 |
+
dom.attr('aria-selected', true).children('.jstree-anchor').addClass('jstree-clicked');
|
3242 |
+
}
|
3243 |
+
/**
|
3244 |
+
* triggered when an node is selected
|
3245 |
+
* @event
|
3246 |
+
* @name select_node.jstree
|
3247 |
+
* @param {Object} node
|
3248 |
+
* @param {Array} selected the current selection
|
3249 |
+
* @param {Object} event the event (if any) that triggered this select_node
|
3250 |
+
*/
|
3251 |
+
this.trigger('select_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e });
|
3252 |
+
if(!supress_event) {
|
3253 |
+
/**
|
3254 |
+
* triggered when selection changes
|
3255 |
+
* @event
|
3256 |
+
* @name changed.jstree
|
3257 |
+
* @param {Object} node
|
3258 |
+
* @param {Object} action the action that caused the selection to change
|
3259 |
+
* @param {Array} selected the current selection
|
3260 |
+
* @param {Object} event the event (if any) that triggered this changed event
|
3261 |
+
*/
|
3262 |
+
this.trigger('changed', { 'action' : 'select_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e });
|
3263 |
+
}
|
3264 |
+
}
|
3265 |
+
},
|
3266 |
+
/**
|
3267 |
+
* deselect a node
|
3268 |
+
* @name deselect_node(obj [, supress_event])
|
3269 |
+
* @param {mixed} obj an array can be used to deselect multiple nodes
|
3270 |
+
* @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered
|
3271 |
+
* @trigger deselect_node.jstree, changed.jstree
|
3272 |
+
*/
|
3273 |
+
deselect_node : function (obj, supress_event, e) {
|
3274 |
+
var t1, t2, dom;
|
3275 |
+
if($.isArray(obj)) {
|
3276 |
+
obj = obj.slice();
|
3277 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
3278 |
+
this.deselect_node(obj[t1], supress_event, e);
|
3279 |
+
}
|
3280 |
+
return true;
|
3281 |
+
}
|
3282 |
+
obj = this.get_node(obj);
|
3283 |
+
if(!obj || obj.id === $.jstree.root) {
|
3284 |
+
return false;
|
3285 |
+
}
|
3286 |
+
dom = this.get_node(obj, true);
|
3287 |
+
if(obj.state.selected) {
|
3288 |
+
obj.state.selected = false;
|
3289 |
+
this._data.core.selected = $.vakata.array_remove_item(this._data.core.selected, obj.id);
|
3290 |
+
if(dom.length) {
|
3291 |
+
dom.attr('aria-selected', false).children('.jstree-anchor').removeClass('jstree-clicked');
|
3292 |
+
}
|
3293 |
+
/**
|
3294 |
+
* triggered when an node is deselected
|
3295 |
+
* @event
|
3296 |
+
* @name deselect_node.jstree
|
3297 |
+
* @param {Object} node
|
3298 |
+
* @param {Array} selected the current selection
|
3299 |
+
* @param {Object} event the event (if any) that triggered this deselect_node
|
3300 |
+
*/
|
3301 |
+
this.trigger('deselect_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e });
|
3302 |
+
if(!supress_event) {
|
3303 |
+
this.trigger('changed', { 'action' : 'deselect_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e });
|
3304 |
+
}
|
3305 |
+
}
|
3306 |
+
},
|
3307 |
+
/**
|
3308 |
+
* select all nodes in the tree
|
3309 |
+
* @name select_all([supress_event])
|
3310 |
+
* @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered
|
3311 |
+
* @trigger select_all.jstree, changed.jstree
|
3312 |
+
*/
|
3313 |
+
select_all : function (supress_event) {
|
3314 |
+
var tmp = this._data.core.selected.concat([]), i, j;
|
3315 |
+
this._data.core.selected = this._model.data[$.jstree.root].children_d.concat();
|
3316 |
+
for(i = 0, j = this._data.core.selected.length; i < j; i++) {
|
3317 |
+
if(this._model.data[this._data.core.selected[i]]) {
|
3318 |
+
this._model.data[this._data.core.selected[i]].state.selected = true;
|
3319 |
+
}
|
3320 |
+
}
|
3321 |
+
this.redraw(true);
|
3322 |
+
/**
|
3323 |
+
* triggered when all nodes are selected
|
3324 |
+
* @event
|
3325 |
+
* @name select_all.jstree
|
3326 |
+
* @param {Array} selected the current selection
|
3327 |
+
*/
|
3328 |
+
this.trigger('select_all', { 'selected' : this._data.core.selected });
|
3329 |
+
if(!supress_event) {
|
3330 |
+
this.trigger('changed', { 'action' : 'select_all', 'selected' : this._data.core.selected, 'old_selection' : tmp });
|
3331 |
+
}
|
3332 |
+
},
|
3333 |
+
/**
|
3334 |
+
* deselect all selected nodes
|
3335 |
+
* @name deselect_all([supress_event])
|
3336 |
+
* @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered
|
3337 |
+
* @trigger deselect_all.jstree, changed.jstree
|
3338 |
+
*/
|
3339 |
+
deselect_all : function (supress_event) {
|
3340 |
+
var tmp = this._data.core.selected.concat([]), i, j;
|
3341 |
+
for(i = 0, j = this._data.core.selected.length; i < j; i++) {
|
3342 |
+
if(this._model.data[this._data.core.selected[i]]) {
|
3343 |
+
this._model.data[this._data.core.selected[i]].state.selected = false;
|
3344 |
+
}
|
3345 |
+
}
|
3346 |
+
this._data.core.selected = [];
|
3347 |
+
this.element.find('.jstree-clicked').removeClass('jstree-clicked').parent().attr('aria-selected', false);
|
3348 |
+
/**
|
3349 |
+
* triggered when all nodes are deselected
|
3350 |
+
* @event
|
3351 |
+
* @name deselect_all.jstree
|
3352 |
+
* @param {Object} node the previous selection
|
3353 |
+
* @param {Array} selected the current selection
|
3354 |
+
*/
|
3355 |
+
this.trigger('deselect_all', { 'selected' : this._data.core.selected, 'node' : tmp });
|
3356 |
+
if(!supress_event) {
|
3357 |
+
this.trigger('changed', { 'action' : 'deselect_all', 'selected' : this._data.core.selected, 'old_selection' : tmp });
|
3358 |
+
}
|
3359 |
+
},
|
3360 |
+
/**
|
3361 |
+
* checks if a node is selected
|
3362 |
+
* @name is_selected(obj)
|
3363 |
+
* @param {mixed} obj
|
3364 |
+
* @return {Boolean}
|
3365 |
+
*/
|
3366 |
+
is_selected : function (obj) {
|
3367 |
+
obj = this.get_node(obj);
|
3368 |
+
if(!obj || obj.id === $.jstree.root) {
|
3369 |
+
return false;
|
3370 |
+
}
|
3371 |
+
return obj.state.selected;
|
3372 |
+
},
|
3373 |
+
/**
|
3374 |
+
* get an array of all selected nodes
|
3375 |
+
* @name get_selected([full])
|
3376 |
+
* @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
3377 |
+
* @return {Array}
|
3378 |
+
*/
|
3379 |
+
get_selected : function (full) {
|
3380 |
+
return full ? $.map(this._data.core.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.core.selected.slice();
|
3381 |
+
},
|
3382 |
+
/**
|
3383 |
+
* get an array of all top level selected nodes (ignoring children of selected nodes)
|
3384 |
+
* @name get_top_selected([full])
|
3385 |
+
* @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
3386 |
+
* @return {Array}
|
3387 |
+
*/
|
3388 |
+
get_top_selected : function (full) {
|
3389 |
+
var tmp = this.get_selected(true),
|
3390 |
+
obj = {}, i, j, k, l;
|
3391 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
3392 |
+
obj[tmp[i].id] = tmp[i];
|
3393 |
+
}
|
3394 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
3395 |
+
for(k = 0, l = tmp[i].children_d.length; k < l; k++) {
|
3396 |
+
if(obj[tmp[i].children_d[k]]) {
|
3397 |
+
delete obj[tmp[i].children_d[k]];
|
3398 |
+
}
|
3399 |
+
}
|
3400 |
+
}
|
3401 |
+
tmp = [];
|
3402 |
+
for(i in obj) {
|
3403 |
+
if(obj.hasOwnProperty(i)) {
|
3404 |
+
tmp.push(i);
|
3405 |
+
}
|
3406 |
+
}
|
3407 |
+
return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp;
|
3408 |
+
},
|
3409 |
+
/**
|
3410 |
+
* get an array of all bottom level selected nodes (ignoring selected parents)
|
3411 |
+
* @name get_bottom_selected([full])
|
3412 |
+
* @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
3413 |
+
* @return {Array}
|
3414 |
+
*/
|
3415 |
+
get_bottom_selected : function (full) {
|
3416 |
+
var tmp = this.get_selected(true),
|
3417 |
+
obj = [], i, j;
|
3418 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
3419 |
+
if(!tmp[i].children.length) {
|
3420 |
+
obj.push(tmp[i].id);
|
3421 |
+
}
|
3422 |
+
}
|
3423 |
+
return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj;
|
3424 |
+
},
|
3425 |
+
/**
|
3426 |
+
* gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally.
|
3427 |
+
* @name get_state()
|
3428 |
+
* @private
|
3429 |
+
* @return {Object}
|
3430 |
+
*/
|
3431 |
+
get_state : function () {
|
3432 |
+
var state = {
|
3433 |
+
'core' : {
|
3434 |
+
'open' : [],
|
3435 |
+
'loaded' : [],
|
3436 |
+
'scroll' : {
|
3437 |
+
'left' : this.element.scrollLeft(),
|
3438 |
+
'top' : this.element.scrollTop()
|
3439 |
+
},
|
3440 |
+
/*!
|
3441 |
+
'themes' : {
|
3442 |
+
'name' : this.get_theme(),
|
3443 |
+
'icons' : this._data.core.themes.icons,
|
3444 |
+
'dots' : this._data.core.themes.dots
|
3445 |
+
},
|
3446 |
+
*/
|
3447 |
+
'selected' : []
|
3448 |
+
}
|
3449 |
+
}, i;
|
3450 |
+
for(i in this._model.data) {
|
3451 |
+
if(this._model.data.hasOwnProperty(i)) {
|
3452 |
+
if(i !== $.jstree.root) {
|
3453 |
+
if(this._model.data[i].state.loaded && this.settings.core.loaded_state) {
|
3454 |
+
state.core.loaded.push(i);
|
3455 |
+
}
|
3456 |
+
if(this._model.data[i].state.opened) {
|
3457 |
+
state.core.open.push(i);
|
3458 |
+
}
|
3459 |
+
if(this._model.data[i].state.selected) {
|
3460 |
+
state.core.selected.push(i);
|
3461 |
+
}
|
3462 |
+
}
|
3463 |
+
}
|
3464 |
+
}
|
3465 |
+
return state;
|
3466 |
+
},
|
3467 |
+
/**
|
3468 |
+
* sets the state of the tree. Used internally.
|
3469 |
+
* @name set_state(state [, callback])
|
3470 |
+
* @private
|
3471 |
+
* @param {Object} state the state to restore. Keep in mind this object is passed by reference and jstree will modify it.
|
3472 |
+
* @param {Function} callback an optional function to execute once the state is restored.
|
3473 |
+
* @trigger set_state.jstree
|
3474 |
+
*/
|
3475 |
+
set_state : function (state, callback) {
|
3476 |
+
if(state) {
|
3477 |
+
if(state.core && state.core.selected && state.core.initial_selection === undefined) {
|
3478 |
+
state.core.initial_selection = this._data.core.selected.concat([]).sort().join(',');
|
3479 |
+
}
|
3480 |
+
if(state.core) {
|
3481 |
+
var res, n, t, _this, i;
|
3482 |
+
if(state.core.loaded) {
|
3483 |
+
if(!this.settings.core.loaded_state || !$.isArray(state.core.loaded) || !state.core.loaded.length) {
|
3484 |
+
delete state.core.loaded;
|
3485 |
+
this.set_state(state, callback);
|
3486 |
+
}
|
3487 |
+
else {
|
3488 |
+
this._load_nodes(state.core.loaded, function (nodes) {
|
3489 |
+
delete state.core.loaded;
|
3490 |
+
this.set_state(state, callback);
|
3491 |
+
});
|
3492 |
+
}
|
3493 |
+
return false;
|
3494 |
+
}
|
3495 |
+
if(state.core.open) {
|
3496 |
+
if(!$.isArray(state.core.open) || !state.core.open.length) {
|
3497 |
+
delete state.core.open;
|
3498 |
+
this.set_state(state, callback);
|
3499 |
+
}
|
3500 |
+
else {
|
3501 |
+
this._load_nodes(state.core.open, function (nodes) {
|
3502 |
+
this.open_node(nodes, false, 0);
|
3503 |
+
delete state.core.open;
|
3504 |
+
this.set_state(state, callback);
|
3505 |
+
});
|
3506 |
+
}
|
3507 |
+
return false;
|
3508 |
+
}
|
3509 |
+
if(state.core.scroll) {
|
3510 |
+
if(state.core.scroll && state.core.scroll.left !== undefined) {
|
3511 |
+
this.element.scrollLeft(state.core.scroll.left);
|
3512 |
+
}
|
3513 |
+
if(state.core.scroll && state.core.scroll.top !== undefined) {
|
3514 |
+
this.element.scrollTop(state.core.scroll.top);
|
3515 |
+
}
|
3516 |
+
delete state.core.scroll;
|
3517 |
+
this.set_state(state, callback);
|
3518 |
+
return false;
|
3519 |
+
}
|
3520 |
+
if(state.core.selected) {
|
3521 |
+
_this = this;
|
3522 |
+
if (state.core.initial_selection === undefined ||
|
3523 |
+
state.core.initial_selection === this._data.core.selected.concat([]).sort().join(',')
|
3524 |
+
) {
|
3525 |
+
this.deselect_all();
|
3526 |
+
$.each(state.core.selected, function (i, v) {
|
3527 |
+
_this.select_node(v, false, true);
|
3528 |
+
});
|
3529 |
+
}
|
3530 |
+
delete state.core.initial_selection;
|
3531 |
+
delete state.core.selected;
|
3532 |
+
this.set_state(state, callback);
|
3533 |
+
return false;
|
3534 |
+
}
|
3535 |
+
for(i in state) {
|
3536 |
+
if(state.hasOwnProperty(i) && i !== "core" && $.inArray(i, this.settings.plugins) === -1) {
|
3537 |
+
delete state[i];
|
3538 |
+
}
|
3539 |
+
}
|
3540 |
+
if($.isEmptyObject(state.core)) {
|
3541 |
+
delete state.core;
|
3542 |
+
this.set_state(state, callback);
|
3543 |
+
return false;
|
3544 |
+
}
|
3545 |
+
}
|
3546 |
+
if($.isEmptyObject(state)) {
|
3547 |
+
state = null;
|
3548 |
+
if(callback) { callback.call(this); }
|
3549 |
+
/**
|
3550 |
+
* triggered when a `set_state` call completes
|
3551 |
+
* @event
|
3552 |
+
* @name set_state.jstree
|
3553 |
+
*/
|
3554 |
+
this.trigger('set_state');
|
3555 |
+
return false;
|
3556 |
+
}
|
3557 |
+
return true;
|
3558 |
+
}
|
3559 |
+
return false;
|
3560 |
+
},
|
3561 |
+
/**
|
3562 |
+
* refreshes the tree - all nodes are reloaded with calls to `load_node`.
|
3563 |
+
* @name refresh()
|
3564 |
+
* @param {Boolean} skip_loading an option to skip showing the loading indicator
|
3565 |
+
* @param {Mixed} forget_state if set to `true` state will not be reapplied, if set to a function (receiving the current state as argument) the result of that function will be used as state
|
3566 |
+
* @trigger refresh.jstree
|
3567 |
+
*/
|
3568 |
+
refresh : function (skip_loading, forget_state) {
|
3569 |
+
this._data.core.state = forget_state === true ? {} : this.get_state();
|
3570 |
+
if(forget_state && $.isFunction(forget_state)) { this._data.core.state = forget_state.call(this, this._data.core.state); }
|
3571 |
+
this._cnt = 0;
|
3572 |
+
this._model.data = {};
|
3573 |
+
this._model.data[$.jstree.root] = {
|
3574 |
+
id : $.jstree.root,
|
3575 |
+
parent : null,
|
3576 |
+
parents : [],
|
3577 |
+
children : [],
|
3578 |
+
children_d : [],
|
3579 |
+
state : { loaded : false }
|
3580 |
+
};
|
3581 |
+
this._data.core.selected = [];
|
3582 |
+
this._data.core.last_clicked = null;
|
3583 |
+
this._data.core.focused = null;
|
3584 |
+
|
3585 |
+
var c = this.get_container_ul()[0].className;
|
3586 |
+
if(!skip_loading) {
|
3587 |
+
this.element.html("<"+"ul class='"+c+"' role='group'><"+"li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j"+this._id+"_loading'><i class='jstree-icon jstree-ocl'></i><"+"a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>" + this.get_string("Loading ...") + "</a></li></ul>");
|
3588 |
+
this.element.attr('aria-activedescendant','j'+this._id+'_loading');
|
3589 |
+
}
|
3590 |
+
this.load_node($.jstree.root, function (o, s) {
|
3591 |
+
if(s) {
|
3592 |
+
this.get_container_ul()[0].className = c;
|
3593 |
+
if(this._firstChild(this.get_container_ul()[0])) {
|
3594 |
+
this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id);
|
3595 |
+
}
|
3596 |
+
this.set_state($.extend(true, {}, this._data.core.state), function () {
|
3597 |
+
/**
|
3598 |
+
* triggered when a `refresh` call completes
|
3599 |
+
* @event
|
3600 |
+
* @name refresh.jstree
|
3601 |
+
*/
|
3602 |
+
this.trigger('refresh');
|
3603 |
+
});
|
3604 |
+
}
|
3605 |
+
this._data.core.state = null;
|
3606 |
+
});
|
3607 |
+
},
|
3608 |
+
/**
|
3609 |
+
* refreshes a node in the tree (reload its children) all opened nodes inside that node are reloaded with calls to `load_node`.
|
3610 |
+
* @name refresh_node(obj)
|
3611 |
+
* @param {mixed} obj the node
|
3612 |
+
* @trigger refresh_node.jstree
|
3613 |
+
*/
|
3614 |
+
refresh_node : function (obj) {
|
3615 |
+
obj = this.get_node(obj);
|
3616 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
3617 |
+
var opened = [], to_load = [], s = this._data.core.selected.concat([]);
|
3618 |
+
to_load.push(obj.id);
|
3619 |
+
if(obj.state.opened === true) { opened.push(obj.id); }
|
3620 |
+
this.get_node(obj, true).find('.jstree-open').each(function() { to_load.push(this.id); opened.push(this.id); });
|
3621 |
+
this._load_nodes(to_load, $.proxy(function (nodes) {
|
3622 |
+
this.open_node(opened, false, 0);
|
3623 |
+
this.select_node(s);
|
3624 |
+
/**
|
3625 |
+
* triggered when a node is refreshed
|
3626 |
+
* @event
|
3627 |
+
* @name refresh_node.jstree
|
3628 |
+
* @param {Object} node - the refreshed node
|
3629 |
+
* @param {Array} nodes - an array of the IDs of the nodes that were reloaded
|
3630 |
+
*/
|
3631 |
+
this.trigger('refresh_node', { 'node' : obj, 'nodes' : nodes });
|
3632 |
+
}, this), false, true);
|
3633 |
+
},
|
3634 |
+
/**
|
3635 |
+
* set (change) the ID of a node
|
3636 |
+
* @name set_id(obj, id)
|
3637 |
+
* @param {mixed} obj the node
|
3638 |
+
* @param {String} id the new ID
|
3639 |
+
* @return {Boolean}
|
3640 |
+
* @trigger set_id.jstree
|
3641 |
+
*/
|
3642 |
+
set_id : function (obj, id) {
|
3643 |
+
obj = this.get_node(obj);
|
3644 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
3645 |
+
var i, j, m = this._model.data, old = obj.id;
|
3646 |
+
id = id.toString();
|
3647 |
+
// update parents (replace current ID with new one in children and children_d)
|
3648 |
+
m[obj.parent].children[$.inArray(obj.id, m[obj.parent].children)] = id;
|
3649 |
+
for(i = 0, j = obj.parents.length; i < j; i++) {
|
3650 |
+
m[obj.parents[i]].children_d[$.inArray(obj.id, m[obj.parents[i]].children_d)] = id;
|
3651 |
+
}
|
3652 |
+
// update children (replace current ID with new one in parent and parents)
|
3653 |
+
for(i = 0, j = obj.children.length; i < j; i++) {
|
3654 |
+
m[obj.children[i]].parent = id;
|
3655 |
+
}
|
3656 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
3657 |
+
m[obj.children_d[i]].parents[$.inArray(obj.id, m[obj.children_d[i]].parents)] = id;
|
3658 |
+
}
|
3659 |
+
i = $.inArray(obj.id, this._data.core.selected);
|
3660 |
+
if(i !== -1) { this._data.core.selected[i] = id; }
|
3661 |
+
// update model and obj itself (obj.id, this._model.data[KEY])
|
3662 |
+
i = this.get_node(obj.id, true);
|
3663 |
+
if(i) {
|
3664 |
+
i.attr('id', id); //.children('.jstree-anchor').attr('id', id + '_anchor').end().attr('aria-labelledby', id + '_anchor');
|
3665 |
+
if(this.element.attr('aria-activedescendant') === obj.id) {
|
3666 |
+
this.element.attr('aria-activedescendant', id);
|
3667 |
+
}
|
3668 |
+
}
|
3669 |
+
delete m[obj.id];
|
3670 |
+
obj.id = id;
|
3671 |
+
obj.li_attr.id = id;
|
3672 |
+
m[id] = obj;
|
3673 |
+
/**
|
3674 |
+
* triggered when a node id value is changed
|
3675 |
+
* @event
|
3676 |
+
* @name set_id.jstree
|
3677 |
+
* @param {Object} node
|
3678 |
+
* @param {String} old the old id
|
3679 |
+
*/
|
3680 |
+
this.trigger('set_id',{ "node" : obj, "new" : obj.id, "old" : old });
|
3681 |
+
return true;
|
3682 |
+
},
|
3683 |
+
/**
|
3684 |
+
* get the text value of a node
|
3685 |
+
* @name get_text(obj)
|
3686 |
+
* @param {mixed} obj the node
|
3687 |
+
* @return {String}
|
3688 |
+
*/
|
3689 |
+
get_text : function (obj) {
|
3690 |
+
obj = this.get_node(obj);
|
3691 |
+
return (!obj || obj.id === $.jstree.root) ? false : obj.text;
|
3692 |
+
},
|
3693 |
+
/**
|
3694 |
+
* set the text value of a node. Used internally, please use `rename_node(obj, val)`.
|
3695 |
+
* @private
|
3696 |
+
* @name set_text(obj, val)
|
3697 |
+
* @param {mixed} obj the node, you can pass an array to set the text on multiple nodes
|
3698 |
+
* @param {String} val the new text value
|
3699 |
+
* @return {Boolean}
|
3700 |
+
* @trigger set_text.jstree
|
3701 |
+
*/
|
3702 |
+
set_text : function (obj, val) {
|
3703 |
+
var t1, t2;
|
3704 |
+
if($.isArray(obj)) {
|
3705 |
+
obj = obj.slice();
|
3706 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
3707 |
+
this.set_text(obj[t1], val);
|
3708 |
+
}
|
3709 |
+
return true;
|
3710 |
+
}
|
3711 |
+
obj = this.get_node(obj);
|
3712 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
3713 |
+
obj.text = val;
|
3714 |
+
if(this.get_node(obj, true).length) {
|
3715 |
+
this.redraw_node(obj.id);
|
3716 |
+
}
|
3717 |
+
/**
|
3718 |
+
* triggered when a node text value is changed
|
3719 |
+
* @event
|
3720 |
+
* @name set_text.jstree
|
3721 |
+
* @param {Object} obj
|
3722 |
+
* @param {String} text the new value
|
3723 |
+
*/
|
3724 |
+
this.trigger('set_text',{ "obj" : obj, "text" : val });
|
3725 |
+
return true;
|
3726 |
+
},
|
3727 |
+
/**
|
3728 |
+
* gets a JSON representation of a node (or the whole tree)
|
3729 |
+
* @name get_json([obj, options])
|
3730 |
+
* @param {mixed} obj
|
3731 |
+
* @param {Object} options
|
3732 |
+
* @param {Boolean} options.no_state do not return state information
|
3733 |
+
* @param {Boolean} options.no_id do not return ID
|
3734 |
+
* @param {Boolean} options.no_children do not include children
|
3735 |
+
* @param {Boolean} options.no_data do not include node data
|
3736 |
+
* @param {Boolean} options.no_li_attr do not include LI attributes
|
3737 |
+
* @param {Boolean} options.no_a_attr do not include A attributes
|
3738 |
+
* @param {Boolean} options.flat return flat JSON instead of nested
|
3739 |
+
* @return {Object}
|
3740 |
+
*/
|
3741 |
+
get_json : function (obj, options, flat) {
|
3742 |
+
obj = this.get_node(obj || $.jstree.root);
|
3743 |
+
if(!obj) { return false; }
|
3744 |
+
if(options && options.flat && !flat) { flat = []; }
|
3745 |
+
var tmp = {
|
3746 |
+
'id' : obj.id,
|
3747 |
+
'text' : obj.text,
|
3748 |
+
'icon' : this.get_icon(obj),
|
3749 |
+
'li_attr' : $.extend(true, {}, obj.li_attr),
|
3750 |
+
'a_attr' : $.extend(true, {}, obj.a_attr),
|
3751 |
+
'state' : {},
|
3752 |
+
'data' : options && options.no_data ? false : $.extend(true, $.isArray(obj.data)?[]:{}, obj.data)
|
3753 |
+
//( this.get_node(obj, true).length ? this.get_node(obj, true).data() : obj.data ),
|
3754 |
+
}, i, j;
|
3755 |
+
if(options && options.flat) {
|
3756 |
+
tmp.parent = obj.parent;
|
3757 |
+
}
|
3758 |
+
else {
|
3759 |
+
tmp.children = [];
|
3760 |
+
}
|
3761 |
+
if(!options || !options.no_state) {
|
3762 |
+
for(i in obj.state) {
|
3763 |
+
if(obj.state.hasOwnProperty(i)) {
|
3764 |
+
tmp.state[i] = obj.state[i];
|
3765 |
+
}
|
3766 |
+
}
|
3767 |
+
} else {
|
3768 |
+
delete tmp.state;
|
3769 |
+
}
|
3770 |
+
if(options && options.no_li_attr) {
|
3771 |
+
delete tmp.li_attr;
|
3772 |
+
}
|
3773 |
+
if(options && options.no_a_attr) {
|
3774 |
+
delete tmp.a_attr;
|
3775 |
+
}
|
3776 |
+
if(options && options.no_id) {
|
3777 |
+
delete tmp.id;
|
3778 |
+
if(tmp.li_attr && tmp.li_attr.id) {
|
3779 |
+
delete tmp.li_attr.id;
|
3780 |
+
}
|
3781 |
+
if(tmp.a_attr && tmp.a_attr.id) {
|
3782 |
+
delete tmp.a_attr.id;
|
3783 |
+
}
|
3784 |
+
}
|
3785 |
+
if(options && options.flat && obj.id !== $.jstree.root) {
|
3786 |
+
flat.push(tmp);
|
3787 |
+
}
|
3788 |
+
if(!options || !options.no_children) {
|
3789 |
+
for(i = 0, j = obj.children.length; i < j; i++) {
|
3790 |
+
if(options && options.flat) {
|
3791 |
+
this.get_json(obj.children[i], options, flat);
|
3792 |
+
}
|
3793 |
+
else {
|
3794 |
+
tmp.children.push(this.get_json(obj.children[i], options));
|
3795 |
+
}
|
3796 |
+
}
|
3797 |
+
}
|
3798 |
+
return options && options.flat ? flat : (obj.id === $.jstree.root ? tmp.children : tmp);
|
3799 |
+
},
|
3800 |
+
/**
|
3801 |
+
* create a new node (do not confuse with load_node)
|
3802 |
+
* @name create_node([par, node, pos, callback, is_loaded])
|
3803 |
+
* @param {mixed} par the parent node (to create a root node use either "#" (string) or `null`)
|
3804 |
+
* @param {mixed} node the data for the new node (a valid JSON object, or a simple string with the name)
|
3805 |
+
* @param {mixed} pos the index at which to insert the node, "first" and "last" are also supported, default is "last"
|
3806 |
+
* @param {Function} callback a function to be called once the node is created
|
3807 |
+
* @param {Boolean} is_loaded internal argument indicating if the parent node was succesfully loaded
|
3808 |
+
* @return {String} the ID of the newly create node
|
3809 |
+
* @trigger model.jstree, create_node.jstree
|
3810 |
+
*/
|
3811 |
+
create_node : function (par, node, pos, callback, is_loaded) {
|
3812 |
+
if(par === null) { par = $.jstree.root; }
|
3813 |
+
par = this.get_node(par);
|
3814 |
+
if(!par) { return false; }
|
3815 |
+
pos = pos === undefined ? "last" : pos;
|
3816 |
+
if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {
|
3817 |
+
return this.load_node(par, function () { this.create_node(par, node, pos, callback, true); });
|
3818 |
+
}
|
3819 |
+
if(!node) { node = { "text" : this.get_string('New node') }; }
|
3820 |
+
if(typeof node === "string") {
|
3821 |
+
node = { "text" : node };
|
3822 |
+
} else {
|
3823 |
+
node = $.extend(true, {}, node);
|
3824 |
+
}
|
3825 |
+
if(node.text === undefined) { node.text = this.get_string('New node'); }
|
3826 |
+
var tmp, dpc, i, j;
|
3827 |
+
|
3828 |
+
if(par.id === $.jstree.root) {
|
3829 |
+
if(pos === "before") { pos = "first"; }
|
3830 |
+
if(pos === "after") { pos = "last"; }
|
3831 |
+
}
|
3832 |
+
switch(pos) {
|
3833 |
+
case "before":
|
3834 |
+
tmp = this.get_node(par.parent);
|
3835 |
+
pos = $.inArray(par.id, tmp.children);
|
3836 |
+
par = tmp;
|
3837 |
+
break;
|
3838 |
+
case "after" :
|
3839 |
+
tmp = this.get_node(par.parent);
|
3840 |
+
pos = $.inArray(par.id, tmp.children) + 1;
|
3841 |
+
par = tmp;
|
3842 |
+
break;
|
3843 |
+
case "inside":
|
3844 |
+
case "first":
|
3845 |
+
pos = 0;
|
3846 |
+
break;
|
3847 |
+
case "last":
|
3848 |
+
pos = par.children.length;
|
3849 |
+
break;
|
3850 |
+
default:
|
3851 |
+
if(!pos) { pos = 0; }
|
3852 |
+
break;
|
3853 |
+
}
|
3854 |
+
if(pos > par.children.length) { pos = par.children.length; }
|
3855 |
+
if(!node.id) { node.id = true; }
|
3856 |
+
if(!this.check("create_node", node, par, pos)) {
|
3857 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
3858 |
+
return false;
|
3859 |
+
}
|
3860 |
+
if(node.id === true) { delete node.id; }
|
3861 |
+
node = this._parse_model_from_json(node, par.id, par.parents.concat());
|
3862 |
+
if(!node) { return false; }
|
3863 |
+
tmp = this.get_node(node);
|
3864 |
+
dpc = [];
|
3865 |
+
dpc.push(node);
|
3866 |
+
dpc = dpc.concat(tmp.children_d);
|
3867 |
+
this.trigger('model', { "nodes" : dpc, "parent" : par.id });
|
3868 |
+
|
3869 |
+
par.children_d = par.children_d.concat(dpc);
|
3870 |
+
for(i = 0, j = par.parents.length; i < j; i++) {
|
3871 |
+
this._model.data[par.parents[i]].children_d = this._model.data[par.parents[i]].children_d.concat(dpc);
|
3872 |
+
}
|
3873 |
+
node = tmp;
|
3874 |
+
tmp = [];
|
3875 |
+
for(i = 0, j = par.children.length; i < j; i++) {
|
3876 |
+
tmp[i >= pos ? i+1 : i] = par.children[i];
|
3877 |
+
}
|
3878 |
+
tmp[pos] = node.id;
|
3879 |
+
par.children = tmp;
|
3880 |
+
|
3881 |
+
this.redraw_node(par, true);
|
3882 |
+
/**
|
3883 |
+
* triggered when a node is created
|
3884 |
+
* @event
|
3885 |
+
* @name create_node.jstree
|
3886 |
+
* @param {Object} node
|
3887 |
+
* @param {String} parent the parent's ID
|
3888 |
+
* @param {Number} position the position of the new node among the parent's children
|
3889 |
+
*/
|
3890 |
+
this.trigger('create_node', { "node" : this.get_node(node), "parent" : par.id, "position" : pos });
|
3891 |
+
if(callback) { callback.call(this, this.get_node(node)); }
|
3892 |
+
return node.id;
|
3893 |
+
},
|
3894 |
+
/**
|
3895 |
+
* set the text value of a node
|
3896 |
+
* @name rename_node(obj, val)
|
3897 |
+
* @param {mixed} obj the node, you can pass an array to rename multiple nodes to the same name
|
3898 |
+
* @param {String} val the new text value
|
3899 |
+
* @return {Boolean}
|
3900 |
+
* @trigger rename_node.jstree
|
3901 |
+
*/
|
3902 |
+
rename_node : function (obj, val) {
|
3903 |
+
var t1, t2, old;
|
3904 |
+
if($.isArray(obj)) {
|
3905 |
+
obj = obj.slice();
|
3906 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
3907 |
+
this.rename_node(obj[t1], val);
|
3908 |
+
}
|
3909 |
+
return true;
|
3910 |
+
}
|
3911 |
+
obj = this.get_node(obj);
|
3912 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
3913 |
+
old = obj.text;
|
3914 |
+
if(!this.check("rename_node", obj, this.get_parent(obj), val)) {
|
3915 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
3916 |
+
return false;
|
3917 |
+
}
|
3918 |
+
this.set_text(obj, val); // .apply(this, Array.prototype.slice.call(arguments))
|
3919 |
+
/**
|
3920 |
+
* triggered when a node is renamed
|
3921 |
+
* @event
|
3922 |
+
* @name rename_node.jstree
|
3923 |
+
* @param {Object} node
|
3924 |
+
* @param {String} text the new value
|
3925 |
+
* @param {String} old the old value
|
3926 |
+
*/
|
3927 |
+
this.trigger('rename_node', { "node" : obj, "text" : val, "old" : old });
|
3928 |
+
return true;
|
3929 |
+
},
|
3930 |
+
/**
|
3931 |
+
* remove a node
|
3932 |
+
* @name delete_node(obj)
|
3933 |
+
* @param {mixed} obj the node, you can pass an array to delete multiple nodes
|
3934 |
+
* @return {Boolean}
|
3935 |
+
* @trigger delete_node.jstree, changed.jstree
|
3936 |
+
*/
|
3937 |
+
delete_node : function (obj) {
|
3938 |
+
var t1, t2, par, pos, tmp, i, j, k, l, c, top, lft;
|
3939 |
+
if($.isArray(obj)) {
|
3940 |
+
obj = obj.slice();
|
3941 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
3942 |
+
this.delete_node(obj[t1]);
|
3943 |
+
}
|
3944 |
+
return true;
|
3945 |
+
}
|
3946 |
+
obj = this.get_node(obj);
|
3947 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
3948 |
+
par = this.get_node(obj.parent);
|
3949 |
+
pos = $.inArray(obj.id, par.children);
|
3950 |
+
c = false;
|
3951 |
+
if(!this.check("delete_node", obj, par, pos)) {
|
3952 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
3953 |
+
return false;
|
3954 |
+
}
|
3955 |
+
if(pos !== -1) {
|
3956 |
+
par.children = $.vakata.array_remove(par.children, pos);
|
3957 |
+
}
|
3958 |
+
tmp = obj.children_d.concat([]);
|
3959 |
+
tmp.push(obj.id);
|
3960 |
+
for(i = 0, j = obj.parents.length; i < j; i++) {
|
3961 |
+
this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) {
|
3962 |
+
return $.inArray(v, tmp) === -1;
|
3963 |
+
});
|
3964 |
+
}
|
3965 |
+
for(k = 0, l = tmp.length; k < l; k++) {
|
3966 |
+
if(this._model.data[tmp[k]].state.selected) {
|
3967 |
+
c = true;
|
3968 |
+
break;
|
3969 |
+
}
|
3970 |
+
}
|
3971 |
+
if (c) {
|
3972 |
+
this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) {
|
3973 |
+
return $.inArray(v, tmp) === -1;
|
3974 |
+
});
|
3975 |
+
}
|
3976 |
+
/**
|
3977 |
+
* triggered when a node is deleted
|
3978 |
+
* @event
|
3979 |
+
* @name delete_node.jstree
|
3980 |
+
* @param {Object} node
|
3981 |
+
* @param {String} parent the parent's ID
|
3982 |
+
*/
|
3983 |
+
this.trigger('delete_node', { "node" : obj, "parent" : par.id });
|
3984 |
+
if(c) {
|
3985 |
+
this.trigger('changed', { 'action' : 'delete_node', 'node' : obj, 'selected' : this._data.core.selected, 'parent' : par.id });
|
3986 |
+
}
|
3987 |
+
for(k = 0, l = tmp.length; k < l; k++) {
|
3988 |
+
delete this._model.data[tmp[k]];
|
3989 |
+
}
|
3990 |
+
if($.inArray(this._data.core.focused, tmp) !== -1) {
|
3991 |
+
this._data.core.focused = null;
|
3992 |
+
top = this.element[0].scrollTop;
|
3993 |
+
lft = this.element[0].scrollLeft;
|
3994 |
+
if(par.id === $.jstree.root) {
|
3995 |
+
if (this._model.data[$.jstree.root].children[0]) {
|
3996 |
+
this.get_node(this._model.data[$.jstree.root].children[0], true).children('.jstree-anchor').focus();
|
3997 |
+
}
|
3998 |
+
}
|
3999 |
+
else {
|
4000 |
+
this.get_node(par, true).children('.jstree-anchor').focus();
|
4001 |
+
}
|
4002 |
+
this.element[0].scrollTop = top;
|
4003 |
+
this.element[0].scrollLeft = lft;
|
4004 |
+
}
|
4005 |
+
this.redraw_node(par, true);
|
4006 |
+
return true;
|
4007 |
+
},
|
4008 |
+
/**
|
4009 |
+
* check if an operation is premitted on the tree. Used internally.
|
4010 |
+
* @private
|
4011 |
+
* @name check(chk, obj, par, pos)
|
4012 |
+
* @param {String} chk the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node"
|
4013 |
+
* @param {mixed} obj the node
|
4014 |
+
* @param {mixed} par the parent
|
4015 |
+
* @param {mixed} pos the position to insert at, or if "rename_node" - the new name
|
4016 |
+
* @param {mixed} more some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node
|
4017 |
+
* @return {Boolean}
|
4018 |
+
*/
|
4019 |
+
check : function (chk, obj, par, pos, more) {
|
4020 |
+
obj = obj && obj.id ? obj : this.get_node(obj);
|
4021 |
+
par = par && par.id ? par : this.get_node(par);
|
4022 |
+
var tmp = chk.match(/^move_node|copy_node|create_node$/i) ? par : obj,
|
4023 |
+
chc = this.settings.core.check_callback;
|
4024 |
+
if(chk === "move_node" || chk === "copy_node") {
|
4025 |
+
if((!more || !more.is_multi) && (obj.id === par.id || (chk === "move_node" && $.inArray(obj.id, par.children) === pos) || $.inArray(par.id, obj.children_d) !== -1)) {
|
4026 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_01', 'reason' : 'Moving parent inside child', 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
4027 |
+
return false;
|
4028 |
+
}
|
4029 |
+
}
|
4030 |
+
if(tmp && tmp.data) { tmp = tmp.data; }
|
4031 |
+
if(tmp && tmp.functions && (tmp.functions[chk] === false || tmp.functions[chk] === true)) {
|
4032 |
+
if(tmp.functions[chk] === false) {
|
4033 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_02', 'reason' : 'Node data prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
4034 |
+
}
|
4035 |
+
return tmp.functions[chk];
|
4036 |
+
}
|
4037 |
+
if(chc === false || ($.isFunction(chc) && chc.call(this, chk, obj, par, pos, more) === false) || (chc && chc[chk] === false)) {
|
4038 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_03', 'reason' : 'User config for core.check_callback prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
4039 |
+
return false;
|
4040 |
+
}
|
4041 |
+
return true;
|
4042 |
+
},
|
4043 |
+
/**
|
4044 |
+
* get the last error
|
4045 |
+
* @name last_error()
|
4046 |
+
* @return {Object}
|
4047 |
+
*/
|
4048 |
+
last_error : function () {
|
4049 |
+
return this._data.core.last_error;
|
4050 |
+
},
|
4051 |
+
/**
|
4052 |
+
* move a node to a new parent
|
4053 |
+
* @name move_node(obj, par [, pos, callback, is_loaded])
|
4054 |
+
* @param {mixed} obj the node to move, pass an array to move multiple nodes
|
4055 |
+
* @param {mixed} par the new parent
|
4056 |
+
* @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0`
|
4057 |
+
* @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position
|
4058 |
+
* @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded
|
4059 |
+
* @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn
|
4060 |
+
* @param {Boolean} instance internal parameter indicating if the node comes from another instance
|
4061 |
+
* @trigger move_node.jstree
|
4062 |
+
*/
|
4063 |
+
move_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) {
|
4064 |
+
var t1, t2, old_par, old_pos, new_par, old_ins, is_multi, dpc, tmp, i, j, k, l, p;
|
4065 |
+
|
4066 |
+
par = this.get_node(par);
|
4067 |
+
pos = pos === undefined ? 0 : pos;
|
4068 |
+
if(!par) { return false; }
|
4069 |
+
if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {
|
4070 |
+
return this.load_node(par, function () { this.move_node(obj, par, pos, callback, true, false, origin); });
|
4071 |
+
}
|
4072 |
+
|
4073 |
+
if($.isArray(obj)) {
|
4074 |
+
if(obj.length === 1) {
|
4075 |
+
obj = obj[0];
|
4076 |
+
}
|
4077 |
+
else {
|
4078 |
+
//obj = obj.slice();
|
4079 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4080 |
+
if((tmp = this.move_node(obj[t1], par, pos, callback, is_loaded, false, origin))) {
|
4081 |
+
par = tmp;
|
4082 |
+
pos = "after";
|
4083 |
+
}
|
4084 |
+
}
|
4085 |
+
this.redraw();
|
4086 |
+
return true;
|
4087 |
+
}
|
4088 |
+
}
|
4089 |
+
obj = obj && obj.id ? obj : this.get_node(obj);
|
4090 |
+
|
4091 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
4092 |
+
|
4093 |
+
old_par = (obj.parent || $.jstree.root).toString();
|
4094 |
+
new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent);
|
4095 |
+
old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id));
|
4096 |
+
is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id);
|
4097 |
+
old_pos = old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1;
|
4098 |
+
if(old_ins && old_ins._id) {
|
4099 |
+
obj = old_ins._model.data[obj.id];
|
4100 |
+
}
|
4101 |
+
|
4102 |
+
if(is_multi) {
|
4103 |
+
if((tmp = this.copy_node(obj, par, pos, callback, is_loaded, false, origin))) {
|
4104 |
+
if(old_ins) { old_ins.delete_node(obj); }
|
4105 |
+
return tmp;
|
4106 |
+
}
|
4107 |
+
return false;
|
4108 |
+
}
|
4109 |
+
//var m = this._model.data;
|
4110 |
+
if(par.id === $.jstree.root) {
|
4111 |
+
if(pos === "before") { pos = "first"; }
|
4112 |
+
if(pos === "after") { pos = "last"; }
|
4113 |
+
}
|
4114 |
+
switch(pos) {
|
4115 |
+
case "before":
|
4116 |
+
pos = $.inArray(par.id, new_par.children);
|
4117 |
+
break;
|
4118 |
+
case "after" :
|
4119 |
+
pos = $.inArray(par.id, new_par.children) + 1;
|
4120 |
+
break;
|
4121 |
+
case "inside":
|
4122 |
+
case "first":
|
4123 |
+
pos = 0;
|
4124 |
+
break;
|
4125 |
+
case "last":
|
4126 |
+
pos = new_par.children.length;
|
4127 |
+
break;
|
4128 |
+
default:
|
4129 |
+
if(!pos) { pos = 0; }
|
4130 |
+
break;
|
4131 |
+
}
|
4132 |
+
if(pos > new_par.children.length) { pos = new_par.children.length; }
|
4133 |
+
if(!this.check("move_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) {
|
4134 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
4135 |
+
return false;
|
4136 |
+
}
|
4137 |
+
if(obj.parent === new_par.id) {
|
4138 |
+
dpc = new_par.children.concat();
|
4139 |
+
tmp = $.inArray(obj.id, dpc);
|
4140 |
+
if(tmp !== -1) {
|
4141 |
+
dpc = $.vakata.array_remove(dpc, tmp);
|
4142 |
+
if(pos > tmp) { pos--; }
|
4143 |
+
}
|
4144 |
+
tmp = [];
|
4145 |
+
for(i = 0, j = dpc.length; i < j; i++) {
|
4146 |
+
tmp[i >= pos ? i+1 : i] = dpc[i];
|
4147 |
+
}
|
4148 |
+
tmp[pos] = obj.id;
|
4149 |
+
new_par.children = tmp;
|
4150 |
+
this._node_changed(new_par.id);
|
4151 |
+
this.redraw(new_par.id === $.jstree.root);
|
4152 |
+
}
|
4153 |
+
else {
|
4154 |
+
// clean old parent and up
|
4155 |
+
tmp = obj.children_d.concat();
|
4156 |
+
tmp.push(obj.id);
|
4157 |
+
for(i = 0, j = obj.parents.length; i < j; i++) {
|
4158 |
+
dpc = [];
|
4159 |
+
p = old_ins._model.data[obj.parents[i]].children_d;
|
4160 |
+
for(k = 0, l = p.length; k < l; k++) {
|
4161 |
+
if($.inArray(p[k], tmp) === -1) {
|
4162 |
+
dpc.push(p[k]);
|
4163 |
+
}
|
4164 |
+
}
|
4165 |
+
old_ins._model.data[obj.parents[i]].children_d = dpc;
|
4166 |
+
}
|
4167 |
+
old_ins._model.data[old_par].children = $.vakata.array_remove_item(old_ins._model.data[old_par].children, obj.id);
|
4168 |
+
|
4169 |
+
// insert into new parent and up
|
4170 |
+
for(i = 0, j = new_par.parents.length; i < j; i++) {
|
4171 |
+
this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(tmp);
|
4172 |
+
}
|
4173 |
+
dpc = [];
|
4174 |
+
for(i = 0, j = new_par.children.length; i < j; i++) {
|
4175 |
+
dpc[i >= pos ? i+1 : i] = new_par.children[i];
|
4176 |
+
}
|
4177 |
+
dpc[pos] = obj.id;
|
4178 |
+
new_par.children = dpc;
|
4179 |
+
new_par.children_d.push(obj.id);
|
4180 |
+
new_par.children_d = new_par.children_d.concat(obj.children_d);
|
4181 |
+
|
4182 |
+
// update object
|
4183 |
+
obj.parent = new_par.id;
|
4184 |
+
tmp = new_par.parents.concat();
|
4185 |
+
tmp.unshift(new_par.id);
|
4186 |
+
p = obj.parents.length;
|
4187 |
+
obj.parents = tmp;
|
4188 |
+
|
4189 |
+
// update object children
|
4190 |
+
tmp = tmp.concat();
|
4191 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
4192 |
+
this._model.data[obj.children_d[i]].parents = this._model.data[obj.children_d[i]].parents.slice(0,p*-1);
|
4193 |
+
Array.prototype.push.apply(this._model.data[obj.children_d[i]].parents, tmp);
|
4194 |
+
}
|
4195 |
+
|
4196 |
+
if(old_par === $.jstree.root || new_par.id === $.jstree.root) {
|
4197 |
+
this._model.force_full_redraw = true;
|
4198 |
+
}
|
4199 |
+
if(!this._model.force_full_redraw) {
|
4200 |
+
this._node_changed(old_par);
|
4201 |
+
this._node_changed(new_par.id);
|
4202 |
+
}
|
4203 |
+
if(!skip_redraw) {
|
4204 |
+
this.redraw();
|
4205 |
+
}
|
4206 |
+
}
|
4207 |
+
if(callback) { callback.call(this, obj, new_par, pos); }
|
4208 |
+
/**
|
4209 |
+
* triggered when a node is moved
|
4210 |
+
* @event
|
4211 |
+
* @name move_node.jstree
|
4212 |
+
* @param {Object} node
|
4213 |
+
* @param {String} parent the parent's ID
|
4214 |
+
* @param {Number} position the position of the node among the parent's children
|
4215 |
+
* @param {String} old_parent the old parent of the node
|
4216 |
+
* @param {Number} old_position the old position of the node
|
4217 |
+
* @param {Boolean} is_multi do the node and new parent belong to different instances
|
4218 |
+
* @param {jsTree} old_instance the instance the node came from
|
4219 |
+
* @param {jsTree} new_instance the instance of the new parent
|
4220 |
+
*/
|
4221 |
+
this.trigger('move_node', { "node" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_pos, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this });
|
4222 |
+
return obj.id;
|
4223 |
+
},
|
4224 |
+
/**
|
4225 |
+
* copy a node to a new parent
|
4226 |
+
* @name copy_node(obj, par [, pos, callback, is_loaded])
|
4227 |
+
* @param {mixed} obj the node to copy, pass an array to copy multiple nodes
|
4228 |
+
* @param {mixed} par the new parent
|
4229 |
+
* @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0`
|
4230 |
+
* @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position
|
4231 |
+
* @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded
|
4232 |
+
* @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn
|
4233 |
+
* @param {Boolean} instance internal parameter indicating if the node comes from another instance
|
4234 |
+
* @trigger model.jstree copy_node.jstree
|
4235 |
+
*/
|
4236 |
+
copy_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) {
|
4237 |
+
var t1, t2, dpc, tmp, i, j, node, old_par, new_par, old_ins, is_multi;
|
4238 |
+
|
4239 |
+
par = this.get_node(par);
|
4240 |
+
pos = pos === undefined ? 0 : pos;
|
4241 |
+
if(!par) { return false; }
|
4242 |
+
if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {
|
4243 |
+
return this.load_node(par, function () { this.copy_node(obj, par, pos, callback, true, false, origin); });
|
4244 |
+
}
|
4245 |
+
|
4246 |
+
if($.isArray(obj)) {
|
4247 |
+
if(obj.length === 1) {
|
4248 |
+
obj = obj[0];
|
4249 |
+
}
|
4250 |
+
else {
|
4251 |
+
//obj = obj.slice();
|
4252 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4253 |
+
if((tmp = this.copy_node(obj[t1], par, pos, callback, is_loaded, true, origin))) {
|
4254 |
+
par = tmp;
|
4255 |
+
pos = "after";
|
4256 |
+
}
|
4257 |
+
}
|
4258 |
+
this.redraw();
|
4259 |
+
return true;
|
4260 |
+
}
|
4261 |
+
}
|
4262 |
+
obj = obj && obj.id ? obj : this.get_node(obj);
|
4263 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
4264 |
+
|
4265 |
+
old_par = (obj.parent || $.jstree.root).toString();
|
4266 |
+
new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent);
|
4267 |
+
old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id));
|
4268 |
+
is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id);
|
4269 |
+
|
4270 |
+
if(old_ins && old_ins._id) {
|
4271 |
+
obj = old_ins._model.data[obj.id];
|
4272 |
+
}
|
4273 |
+
|
4274 |
+
if(par.id === $.jstree.root) {
|
4275 |
+
if(pos === "before") { pos = "first"; }
|
4276 |
+
if(pos === "after") { pos = "last"; }
|
4277 |
+
}
|
4278 |
+
switch(pos) {
|
4279 |
+
case "before":
|
4280 |
+
pos = $.inArray(par.id, new_par.children);
|
4281 |
+
break;
|
4282 |
+
case "after" :
|
4283 |
+
pos = $.inArray(par.id, new_par.children) + 1;
|
4284 |
+
break;
|
4285 |
+
case "inside":
|
4286 |
+
case "first":
|
4287 |
+
pos = 0;
|
4288 |
+
break;
|
4289 |
+
case "last":
|
4290 |
+
pos = new_par.children.length;
|
4291 |
+
break;
|
4292 |
+
default:
|
4293 |
+
if(!pos) { pos = 0; }
|
4294 |
+
break;
|
4295 |
+
}
|
4296 |
+
if(pos > new_par.children.length) { pos = new_par.children.length; }
|
4297 |
+
if(!this.check("copy_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) {
|
4298 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
4299 |
+
return false;
|
4300 |
+
}
|
4301 |
+
node = old_ins ? old_ins.get_json(obj, { no_id : true, no_data : true, no_state : true }) : obj;
|
4302 |
+
if(!node) { return false; }
|
4303 |
+
if(node.id === true) { delete node.id; }
|
4304 |
+
node = this._parse_model_from_json(node, new_par.id, new_par.parents.concat());
|
4305 |
+
if(!node) { return false; }
|
4306 |
+
tmp = this.get_node(node);
|
4307 |
+
if(obj && obj.state && obj.state.loaded === false) { tmp.state.loaded = false; }
|
4308 |
+
dpc = [];
|
4309 |
+
dpc.push(node);
|
4310 |
+
dpc = dpc.concat(tmp.children_d);
|
4311 |
+
this.trigger('model', { "nodes" : dpc, "parent" : new_par.id });
|
4312 |
+
|
4313 |
+
// insert into new parent and up
|
4314 |
+
for(i = 0, j = new_par.parents.length; i < j; i++) {
|
4315 |
+
this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(dpc);
|
4316 |
+
}
|
4317 |
+
dpc = [];
|
4318 |
+
for(i = 0, j = new_par.children.length; i < j; i++) {
|
4319 |
+
dpc[i >= pos ? i+1 : i] = new_par.children[i];
|
4320 |
+
}
|
4321 |
+
dpc[pos] = tmp.id;
|
4322 |
+
new_par.children = dpc;
|
4323 |
+
new_par.children_d.push(tmp.id);
|
4324 |
+
new_par.children_d = new_par.children_d.concat(tmp.children_d);
|
4325 |
+
|
4326 |
+
if(new_par.id === $.jstree.root) {
|
4327 |
+
this._model.force_full_redraw = true;
|
4328 |
+
}
|
4329 |
+
if(!this._model.force_full_redraw) {
|
4330 |
+
this._node_changed(new_par.id);
|
4331 |
+
}
|
4332 |
+
if(!skip_redraw) {
|
4333 |
+
this.redraw(new_par.id === $.jstree.root);
|
4334 |
+
}
|
4335 |
+
if(callback) { callback.call(this, tmp, new_par, pos); }
|
4336 |
+
/**
|
4337 |
+
* triggered when a node is copied
|
4338 |
+
* @event
|
4339 |
+
* @name copy_node.jstree
|
4340 |
+
* @param {Object} node the copied node
|
4341 |
+
* @param {Object} original the original node
|
4342 |
+
* @param {String} parent the parent's ID
|
4343 |
+
* @param {Number} position the position of the node among the parent's children
|
4344 |
+
* @param {String} old_parent the old parent of the node
|
4345 |
+
* @param {Number} old_position the position of the original node
|
4346 |
+
* @param {Boolean} is_multi do the node and new parent belong to different instances
|
4347 |
+
* @param {jsTree} old_instance the instance the node came from
|
4348 |
+
* @param {jsTree} new_instance the instance of the new parent
|
4349 |
+
*/
|
4350 |
+
this.trigger('copy_node', { "node" : tmp, "original" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1,'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this });
|
4351 |
+
return tmp.id;
|
4352 |
+
},
|
4353 |
+
/**
|
4354 |
+
* cut a node (a later call to `paste(obj)` would move the node)
|
4355 |
+
* @name cut(obj)
|
4356 |
+
* @param {mixed} obj multiple objects can be passed using an array
|
4357 |
+
* @trigger cut.jstree
|
4358 |
+
*/
|
4359 |
+
cut : function (obj) {
|
4360 |
+
if(!obj) { obj = this._data.core.selected.concat(); }
|
4361 |
+
if(!$.isArray(obj)) { obj = [obj]; }
|
4362 |
+
if(!obj.length) { return false; }
|
4363 |
+
var tmp = [], o, t1, t2;
|
4364 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4365 |
+
o = this.get_node(obj[t1]);
|
4366 |
+
if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); }
|
4367 |
+
}
|
4368 |
+
if(!tmp.length) { return false; }
|
4369 |
+
ccp_node = tmp;
|
4370 |
+
ccp_inst = this;
|
4371 |
+
ccp_mode = 'move_node';
|
4372 |
+
/**
|
4373 |
+
* triggered when nodes are added to the buffer for moving
|
4374 |
+
* @event
|
4375 |
+
* @name cut.jstree
|
4376 |
+
* @param {Array} node
|
4377 |
+
*/
|
4378 |
+
this.trigger('cut', { "node" : obj });
|
4379 |
+
},
|
4380 |
+
/**
|
4381 |
+
* copy a node (a later call to `paste(obj)` would copy the node)
|
4382 |
+
* @name copy(obj)
|
4383 |
+
* @param {mixed} obj multiple objects can be passed using an array
|
4384 |
+
* @trigger copy.jstree
|
4385 |
+
*/
|
4386 |
+
copy : function (obj) {
|
4387 |
+
if(!obj) { obj = this._data.core.selected.concat(); }
|
4388 |
+
if(!$.isArray(obj)) { obj = [obj]; }
|
4389 |
+
if(!obj.length) { return false; }
|
4390 |
+
var tmp = [], o, t1, t2;
|
4391 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4392 |
+
o = this.get_node(obj[t1]);
|
4393 |
+
if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); }
|
4394 |
+
}
|
4395 |
+
if(!tmp.length) { return false; }
|
4396 |
+
ccp_node = tmp;
|
4397 |
+
ccp_inst = this;
|
4398 |
+
ccp_mode = 'copy_node';
|
4399 |
+
/**
|
4400 |
+
* triggered when nodes are added to the buffer for copying
|
4401 |
+
* @event
|
4402 |
+
* @name copy.jstree
|
4403 |
+
* @param {Array} node
|
4404 |
+
*/
|
4405 |
+
this.trigger('copy', { "node" : obj });
|
4406 |
+
},
|
4407 |
+
/**
|
4408 |
+
* get the current buffer (any nodes that are waiting for a paste operation)
|
4409 |
+
* @name get_buffer()
|
4410 |
+
* @return {Object} an object consisting of `mode` ("copy_node" or "move_node"), `node` (an array of objects) and `inst` (the instance)
|
4411 |
+
*/
|
4412 |
+
get_buffer : function () {
|
4413 |
+
return { 'mode' : ccp_mode, 'node' : ccp_node, 'inst' : ccp_inst };
|
4414 |
+
},
|
4415 |
+
/**
|
4416 |
+
* check if there is something in the buffer to paste
|
4417 |
+
* @name can_paste()
|
4418 |
+
* @return {Boolean}
|
4419 |
+
*/
|
4420 |
+
can_paste : function () {
|
4421 |
+
return ccp_mode !== false && ccp_node !== false; // && ccp_inst._model.data[ccp_node];
|
4422 |
+
},
|
4423 |
+
/**
|
4424 |
+
* copy or move the previously cut or copied nodes to a new parent
|
4425 |
+
* @name paste(obj [, pos])
|
4426 |
+
* @param {mixed} obj the new parent
|
4427 |
+
* @param {mixed} pos the position to insert at (besides integer, "first" and "last" are supported), defaults to integer `0`
|
4428 |
+
* @trigger paste.jstree
|
4429 |
+
*/
|
4430 |
+
paste : function (obj, pos) {
|
4431 |
+
obj = this.get_node(obj);
|
4432 |
+
if(!obj || !ccp_mode || !ccp_mode.match(/^(copy_node|move_node)$/) || !ccp_node) { return false; }
|
4433 |
+
if(this[ccp_mode](ccp_node, obj, pos, false, false, false, ccp_inst)) {
|
4434 |
+
/**
|
4435 |
+
* triggered when paste is invoked
|
4436 |
+
* @event
|
4437 |
+
* @name paste.jstree
|
4438 |
+
* @param {String} parent the ID of the receiving node
|
4439 |
+
* @param {Array} node the nodes in the buffer
|
4440 |
+
* @param {String} mode the performed operation - "copy_node" or "move_node"
|
4441 |
+
*/
|
4442 |
+
this.trigger('paste', { "parent" : obj.id, "node" : ccp_node, "mode" : ccp_mode });
|
4443 |
+
}
|
4444 |
+
ccp_node = false;
|
4445 |
+
ccp_mode = false;
|
4446 |
+
ccp_inst = false;
|
4447 |
+
},
|
4448 |
+
/**
|
4449 |
+
* clear the buffer of previously copied or cut nodes
|
4450 |
+
* @name clear_buffer()
|
4451 |
+
* @trigger clear_buffer.jstree
|
4452 |
+
*/
|
4453 |
+
clear_buffer : function () {
|
4454 |
+
ccp_node = false;
|
4455 |
+
ccp_mode = false;
|
4456 |
+
ccp_inst = false;
|
4457 |
+
/**
|
4458 |
+
* triggered when the copy / cut buffer is cleared
|
4459 |
+
* @event
|
4460 |
+
* @name clear_buffer.jstree
|
4461 |
+
*/
|
4462 |
+
this.trigger('clear_buffer');
|
4463 |
+
},
|
4464 |
+
/**
|
4465 |
+
* put a node in edit mode (input field to rename the node)
|
4466 |
+
* @name edit(obj [, default_text, callback])
|
4467 |
+
* @param {mixed} obj
|
4468 |
+
* @param {String} default_text the text to populate the input with (if omitted or set to a non-string value the node's text value is used)
|
4469 |
+
* @param {Function} callback a function to be called once the text box is blurred, it is called in the instance's scope and receives the node, a status parameter (true if the rename is successful, false otherwise) and a boolean indicating if the user cancelled the edit. You can access the node's title using .text
|
4470 |
+
*/
|
4471 |
+
edit : function (obj, default_text, callback) {
|
4472 |
+
var rtl, w, a, s, t, h1, h2, fn, tmp, cancel = false;
|
4473 |
+
obj = this.get_node(obj);
|
4474 |
+
if(!obj) { return false; }
|
4475 |
+
if(!this.check("edit", obj, this.get_parent(obj))) {
|
4476 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
4477 |
+
return false;
|
4478 |
+
}
|
4479 |
+
tmp = obj;
|
4480 |
+
default_text = typeof default_text === 'string' ? default_text : obj.text;
|
4481 |
+
this.set_text(obj, "");
|
4482 |
+
obj = this._open_to(obj);
|
4483 |
+
tmp.text = default_text;
|
4484 |
+
|
4485 |
+
rtl = this._data.core.rtl;
|
4486 |
+
w = this.element.width();
|
4487 |
+
this._data.core.focused = tmp.id;
|
4488 |
+
a = obj.children('.jstree-anchor').focus();
|
4489 |
+
s = $('<span>');
|
4490 |
+
/*!
|
4491 |
+
oi = obj.children("i:visible"),
|
4492 |
+
ai = a.children("i:visible"),
|
4493 |
+
w1 = oi.width() * oi.length,
|
4494 |
+
w2 = ai.width() * ai.length,
|
4495 |
+
*/
|
4496 |
+
t = default_text;
|
4497 |
+
h1 = $("<"+"div />", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo(document.body);
|
4498 |
+
h2 = $("<"+"input />", {
|
4499 |
+
"value" : t,
|
4500 |
+
"class" : "jstree-rename-input",
|
4501 |
+
// "size" : t.length,
|
4502 |
+
"css" : {
|
4503 |
+
"padding" : "0",
|
4504 |
+
"border" : "1px solid silver",
|
4505 |
+
"box-sizing" : "border-box",
|
4506 |
+
"display" : "inline-block",
|
4507 |
+
"height" : (this._data.core.li_height) + "px",
|
4508 |
+
"lineHeight" : (this._data.core.li_height) + "px",
|
4509 |
+
"width" : "150px" // will be set a bit further down
|
4510 |
+
},
|
4511 |
+
"blur" : $.proxy(function (e) {
|
4512 |
+
e.stopImmediatePropagation();
|
4513 |
+
e.preventDefault();
|
4514 |
+
var i = s.children(".jstree-rename-input"),
|
4515 |
+
v = i.val(),
|
4516 |
+
f = this.settings.core.force_text,
|
4517 |
+
nv;
|
4518 |
+
if(v === "") { v = t; }
|
4519 |
+
h1.remove();
|
4520 |
+
s.replaceWith(a);
|
4521 |
+
s.remove();
|
4522 |
+
t = f ? t : $('<div></div>').append($.parseHTML(t)).html();
|
4523 |
+
obj = this.get_node(obj);
|
4524 |
+
this.set_text(obj, t);
|
4525 |
+
nv = !!this.rename_node(obj, f ? $('<div></div>').text(v).text() : $('<div></div>').append($.parseHTML(v)).html());
|
4526 |
+
if(!nv) {
|
4527 |
+
this.set_text(obj, t); // move this up? and fix #483
|
4528 |
+
}
|
4529 |
+
this._data.core.focused = tmp.id;
|
4530 |
+
setTimeout($.proxy(function () {
|
4531 |
+
var node = this.get_node(tmp.id, true);
|
4532 |
+
if(node.length) {
|
4533 |
+
this._data.core.focused = tmp.id;
|
4534 |
+
node.children('.jstree-anchor').focus();
|
4535 |
+
}
|
4536 |
+
}, this), 0);
|
4537 |
+
if(callback) {
|
4538 |
+
callback.call(this, tmp, nv, cancel);
|
4539 |
+
}
|
4540 |
+
h2 = null;
|
4541 |
+
}, this),
|
4542 |
+
"keydown" : function (e) {
|
4543 |
+
var key = e.which;
|
4544 |
+
if(key === 27) {
|
4545 |
+
cancel = true;
|
4546 |
+
this.value = t;
|
4547 |
+
}
|
4548 |
+
if(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) {
|
4549 |
+
e.stopImmediatePropagation();
|
4550 |
+
}
|
4551 |
+
if(key === 27 || key === 13) {
|
4552 |
+
e.preventDefault();
|
4553 |
+
this.blur();
|
4554 |
+
}
|
4555 |
+
},
|
4556 |
+
"click" : function (e) { e.stopImmediatePropagation(); },
|
4557 |
+
"mousedown" : function (e) { e.stopImmediatePropagation(); },
|
4558 |
+
"keyup" : function (e) {
|
4559 |
+
h2.width(Math.min(h1.text("pW" + this.value).width(),w));
|
4560 |
+
},
|
4561 |
+
"keypress" : function(e) {
|
4562 |
+
if(e.which === 13) { return false; }
|
4563 |
+
}
|
4564 |
+
});
|
4565 |
+
fn = {
|
4566 |
+
fontFamily : a.css('fontFamily') || '',
|
4567 |
+
fontSize : a.css('fontSize') || '',
|
4568 |
+
fontWeight : a.css('fontWeight') || '',
|
4569 |
+
fontStyle : a.css('fontStyle') || '',
|
4570 |
+
fontStretch : a.css('fontStretch') || '',
|
4571 |
+
fontVariant : a.css('fontVariant') || '',
|
4572 |
+
letterSpacing : a.css('letterSpacing') || '',
|
4573 |
+
wordSpacing : a.css('wordSpacing') || ''
|
4574 |
+
};
|
4575 |
+
s.attr('class', a.attr('class')).append(a.contents().clone()).append(h2);
|
4576 |
+
a.replaceWith(s);
|
4577 |
+
h1.css(fn);
|
4578 |
+
h2.css(fn).width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();
|
4579 |
+
$(document).one('mousedown.jstree touchstart.jstree dnd_start.vakata', function (e) {
|
4580 |
+
if (h2 && e.target !== h2) {
|
4581 |
+
$(h2).blur();
|
4582 |
+
}
|
4583 |
+
});
|
4584 |
+
},
|
4585 |
+
|
4586 |
+
|
4587 |
+
/**
|
4588 |
+
* changes the theme
|
4589 |
+
* @name set_theme(theme_name [, theme_url])
|
4590 |
+
* @param {String} theme_name the name of the new theme to apply
|
4591 |
+
* @param {mixed} theme_url the location of the CSS file for this theme. Omit or set to `false` if you manually included the file. Set to `true` to autoload from the `core.themes.dir` directory.
|
4592 |
+
* @trigger set_theme.jstree
|
4593 |
+
*/
|
4594 |
+
set_theme : function (theme_name, theme_url) {
|
4595 |
+
if(!theme_name) { return false; }
|
4596 |
+
if(theme_url === true) {
|
4597 |
+
var dir = this.settings.core.themes.dir;
|
4598 |
+
if(!dir) { dir = $.jstree.path + '/themes'; }
|
4599 |
+
theme_url = dir + '/' + theme_name + '/style.css';
|
4600 |
+
}
|
4601 |
+
if(theme_url && $.inArray(theme_url, themes_loaded) === -1) {
|
4602 |
+
$('head').append('<'+'link rel="stylesheet" href="' + theme_url + '" type="text/css" />');
|
4603 |
+
themes_loaded.push(theme_url);
|
4604 |
+
}
|
4605 |
+
if(this._data.core.themes.name) {
|
4606 |
+
this.element.removeClass('jstree-' + this._data.core.themes.name);
|
4607 |
+
}
|
4608 |
+
this._data.core.themes.name = theme_name;
|
4609 |
+
this.element.addClass('jstree-' + theme_name);
|
4610 |
+
this.element[this.settings.core.themes.responsive ? 'addClass' : 'removeClass' ]('jstree-' + theme_name + '-responsive');
|
4611 |
+
/**
|
4612 |
+
* triggered when a theme is set
|
4613 |
+
* @event
|
4614 |
+
* @name set_theme.jstree
|
4615 |
+
* @param {String} theme the new theme
|
4616 |
+
*/
|
4617 |
+
this.trigger('set_theme', { 'theme' : theme_name });
|
4618 |
+
},
|
4619 |
+
/**
|
4620 |
+
* gets the name of the currently applied theme name
|
4621 |
+
* @name get_theme()
|
4622 |
+
* @return {String}
|
4623 |
+
*/
|
4624 |
+
get_theme : function () { return this._data.core.themes.name; },
|
4625 |
+
/**
|
4626 |
+
* changes the theme variant (if the theme has variants)
|
4627 |
+
* @name set_theme_variant(variant_name)
|
4628 |
+
* @param {String|Boolean} variant_name the variant to apply (if `false` is used the current variant is removed)
|
4629 |
+
*/
|
4630 |
+
set_theme_variant : function (variant_name) {
|
4631 |
+
if(this._data.core.themes.variant) {
|
4632 |
+
this.element.removeClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant);
|
4633 |
+
}
|
4634 |
+
this._data.core.themes.variant = variant_name;
|
4635 |
+
if(variant_name) {
|
4636 |
+
this.element.addClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant);
|
4637 |
+
}
|
4638 |
+
},
|
4639 |
+
/**
|
4640 |
+
* gets the name of the currently applied theme variant
|
4641 |
+
* @name get_theme()
|
4642 |
+
* @return {String}
|
4643 |
+
*/
|
4644 |
+
get_theme_variant : function () { return this._data.core.themes.variant; },
|
4645 |
+
/**
|
4646 |
+
* shows a striped background on the container (if the theme supports it)
|
4647 |
+
* @name show_stripes()
|
4648 |
+
*/
|
4649 |
+
show_stripes : function () {
|
4650 |
+
this._data.core.themes.stripes = true;
|
4651 |
+
this.get_container_ul().addClass("jstree-striped");
|
4652 |
+
/**
|
4653 |
+
* triggered when stripes are shown
|
4654 |
+
* @event
|
4655 |
+
* @name show_stripes.jstree
|
4656 |
+
*/
|
4657 |
+
this.trigger('show_stripes');
|
4658 |
+
},
|
4659 |
+
/**
|
4660 |
+
* hides the striped background on the container
|
4661 |
+
* @name hide_stripes()
|
4662 |
+
*/
|
4663 |
+
hide_stripes : function () {
|
4664 |
+
this._data.core.themes.stripes = false;
|
4665 |
+
this.get_container_ul().removeClass("jstree-striped");
|
4666 |
+
/**
|
4667 |
+
* triggered when stripes are hidden
|
4668 |
+
* @event
|
4669 |
+
* @name hide_stripes.jstree
|
4670 |
+
*/
|
4671 |
+
this.trigger('hide_stripes');
|
4672 |
+
},
|
4673 |
+
/**
|
4674 |
+
* toggles the striped background on the container
|
4675 |
+
* @name toggle_stripes()
|
4676 |
+
*/
|
4677 |
+
toggle_stripes : function () { if(this._data.core.themes.stripes) { this.hide_stripes(); } else { this.show_stripes(); } },
|
4678 |
+
/**
|
4679 |
+
* shows the connecting dots (if the theme supports it)
|
4680 |
+
* @name show_dots()
|
4681 |
+
*/
|
4682 |
+
show_dots : function () {
|
4683 |
+
this._data.core.themes.dots = true;
|
4684 |
+
this.get_container_ul().removeClass("jstree-no-dots");
|
4685 |
+
/**
|
4686 |
+
* triggered when dots are shown
|
4687 |
+
* @event
|
4688 |
+
* @name show_dots.jstree
|
4689 |
+
*/
|
4690 |
+
this.trigger('show_dots');
|
4691 |
+
},
|
4692 |
+
/**
|
4693 |
+
* hides the connecting dots
|
4694 |
+
* @name hide_dots()
|
4695 |
+
*/
|
4696 |
+
hide_dots : function () {
|
4697 |
+
this._data.core.themes.dots = false;
|
4698 |
+
this.get_container_ul().addClass("jstree-no-dots");
|
4699 |
+
/**
|
4700 |
+
* triggered when dots are hidden
|
4701 |
+
* @event
|
4702 |
+
* @name hide_dots.jstree
|
4703 |
+
*/
|
4704 |
+
this.trigger('hide_dots');
|
4705 |
+
},
|
4706 |
+
/**
|
4707 |
+
* toggles the connecting dots
|
4708 |
+
* @name toggle_dots()
|
4709 |
+
*/
|
4710 |
+
toggle_dots : function () { if(this._data.core.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },
|
4711 |
+
/**
|
4712 |
+
* show the node icons
|
4713 |
+
* @name show_icons()
|
4714 |
+
*/
|
4715 |
+
show_icons : function () {
|
4716 |
+
this._data.core.themes.icons = true;
|
4717 |
+
this.get_container_ul().removeClass("jstree-no-icons");
|
4718 |
+
/**
|
4719 |
+
* triggered when icons are shown
|
4720 |
+
* @event
|
4721 |
+
* @name show_icons.jstree
|
4722 |
+
*/
|
4723 |
+
this.trigger('show_icons');
|
4724 |
+
},
|
4725 |
+
/**
|
4726 |
+
* hide the node icons
|
4727 |
+
* @name hide_icons()
|
4728 |
+
*/
|
4729 |
+
hide_icons : function () {
|
4730 |
+
this._data.core.themes.icons = false;
|
4731 |
+
this.get_container_ul().addClass("jstree-no-icons");
|
4732 |
+
/**
|
4733 |
+
* triggered when icons are hidden
|
4734 |
+
* @event
|
4735 |
+
* @name hide_icons.jstree
|
4736 |
+
*/
|
4737 |
+
this.trigger('hide_icons');
|
4738 |
+
},
|
4739 |
+
/**
|
4740 |
+
* toggle the node icons
|
4741 |
+
* @name toggle_icons()
|
4742 |
+
*/
|
4743 |
+
toggle_icons : function () { if(this._data.core.themes.icons) { this.hide_icons(); } else { this.show_icons(); } },
|
4744 |
+
/**
|
4745 |
+
* show the node ellipsis
|
4746 |
+
* @name show_icons()
|
4747 |
+
*/
|
4748 |
+
show_ellipsis : function () {
|
4749 |
+
this._data.core.themes.ellipsis = true;
|
4750 |
+
this.get_container_ul().addClass("jstree-ellipsis");
|
4751 |
+
/**
|
4752 |
+
* triggered when ellisis is shown
|
4753 |
+
* @event
|
4754 |
+
* @name show_ellipsis.jstree
|
4755 |
+
*/
|
4756 |
+
this.trigger('show_ellipsis');
|
4757 |
+
},
|
4758 |
+
/**
|
4759 |
+
* hide the node ellipsis
|
4760 |
+
* @name hide_ellipsis()
|
4761 |
+
*/
|
4762 |
+
hide_ellipsis : function () {
|
4763 |
+
this._data.core.themes.ellipsis = false;
|
4764 |
+
this.get_container_ul().removeClass("jstree-ellipsis");
|
4765 |
+
/**
|
4766 |
+
* triggered when ellisis is hidden
|
4767 |
+
* @event
|
4768 |
+
* @name hide_ellipsis.jstree
|
4769 |
+
*/
|
4770 |
+
this.trigger('hide_ellipsis');
|
4771 |
+
},
|
4772 |
+
/**
|
4773 |
+
* toggle the node ellipsis
|
4774 |
+
* @name toggle_icons()
|
4775 |
+
*/
|
4776 |
+
toggle_ellipsis : function () { if(this._data.core.themes.ellipsis) { this.hide_ellipsis(); } else { this.show_ellipsis(); } },
|
4777 |
+
/**
|
4778 |
+
* set the node icon for a node
|
4779 |
+
* @name set_icon(obj, icon)
|
4780 |
+
* @param {mixed} obj
|
4781 |
+
* @param {String} icon the new icon - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class
|
4782 |
+
*/
|
4783 |
+
set_icon : function (obj, icon) {
|
4784 |
+
var t1, t2, dom, old;
|
4785 |
+
if($.isArray(obj)) {
|
4786 |
+
obj = obj.slice();
|
4787 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4788 |
+
this.set_icon(obj[t1], icon);
|
4789 |
+
}
|
4790 |
+
return true;
|
4791 |
+
}
|
4792 |
+
obj = this.get_node(obj);
|
4793 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
4794 |
+
old = obj.icon;
|
4795 |
+
obj.icon = icon === true || icon === null || icon === undefined || icon === '' ? true : icon;
|
4796 |
+
dom = this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon");
|
4797 |
+
if(icon === false) {
|
4798 |
+
dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel");
|
4799 |
+
this.hide_icon(obj);
|
4800 |
+
}
|
4801 |
+
else if(icon === true || icon === null || icon === undefined || icon === '') {
|
4802 |
+
dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel");
|
4803 |
+
if(old === false) { this.show_icon(obj); }
|
4804 |
+
}
|
4805 |
+
else if(icon.indexOf("/") === -1 && icon.indexOf(".") === -1) {
|
4806 |
+
dom.removeClass(old).css("background","");
|
4807 |
+
dom.addClass(icon + ' jstree-themeicon-custom').attr("rel",icon);
|
4808 |
+
if(old === false) { this.show_icon(obj); }
|
4809 |
+
}
|
4810 |
+
else {
|
4811 |
+
dom.removeClass(old).css("background","");
|
4812 |
+
dom.addClass('jstree-themeicon-custom').css("background", "url('" + icon + "') center center no-repeat").attr("rel",icon);
|
4813 |
+
if(old === false) { this.show_icon(obj); }
|
4814 |
+
}
|
4815 |
+
return true;
|
4816 |
+
},
|
4817 |
+
/**
|
4818 |
+
* get the node icon for a node
|
4819 |
+
* @name get_icon(obj)
|
4820 |
+
* @param {mixed} obj
|
4821 |
+
* @return {String}
|
4822 |
+
*/
|
4823 |
+
get_icon : function (obj) {
|
4824 |
+
obj = this.get_node(obj);
|
4825 |
+
return (!obj || obj.id === $.jstree.root) ? false : obj.icon;
|
4826 |
+
},
|
4827 |
+
/**
|
4828 |
+
* hide the icon on an individual node
|
4829 |
+
* @name hide_icon(obj)
|
4830 |
+
* @param {mixed} obj
|
4831 |
+
*/
|
4832 |
+
hide_icon : function (obj) {
|
4833 |
+
var t1, t2;
|
4834 |
+
if($.isArray(obj)) {
|
4835 |
+
obj = obj.slice();
|
4836 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4837 |
+
this.hide_icon(obj[t1]);
|
4838 |
+
}
|
4839 |
+
return true;
|
4840 |
+
}
|
4841 |
+
obj = this.get_node(obj);
|
4842 |
+
if(!obj || obj === $.jstree.root) { return false; }
|
4843 |
+
obj.icon = false;
|
4844 |
+
this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon").addClass('jstree-themeicon-hidden');
|
4845 |
+
return true;
|
4846 |
+
},
|
4847 |
+
/**
|
4848 |
+
* show the icon on an individual node
|
4849 |
+
* @name show_icon(obj)
|
4850 |
+
* @param {mixed} obj
|
4851 |
+
*/
|
4852 |
+
show_icon : function (obj) {
|
4853 |
+
var t1, t2, dom;
|
4854 |
+
if($.isArray(obj)) {
|
4855 |
+
obj = obj.slice();
|
4856 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4857 |
+
this.show_icon(obj[t1]);
|
4858 |
+
}
|
4859 |
+
return true;
|
4860 |
+
}
|
4861 |
+
obj = this.get_node(obj);
|
4862 |
+
if(!obj || obj === $.jstree.root) { return false; }
|
4863 |
+
dom = this.get_node(obj, true);
|
4864 |
+
obj.icon = dom.length ? dom.children(".jstree-anchor").children(".jstree-themeicon").attr('rel') : true;
|
4865 |
+
if(!obj.icon) { obj.icon = true; }
|
4866 |
+
dom.children(".jstree-anchor").children(".jstree-themeicon").removeClass('jstree-themeicon-hidden');
|
4867 |
+
return true;
|
4868 |
+
}
|
4869 |
+
};
|
4870 |
+
|
4871 |
+
// helpers
|
4872 |
+
$.vakata = {};
|
4873 |
+
// collect attributes
|
4874 |
+
$.vakata.attributes = function(node, with_values) {
|
4875 |
+
node = $(node)[0];
|
4876 |
+
var attr = with_values ? {} : [];
|
4877 |
+
if(node && node.attributes) {
|
4878 |
+
$.each(node.attributes, function (i, v) {
|
4879 |
+
if($.inArray(v.name.toLowerCase(),['style','contenteditable','hasfocus','tabindex']) !== -1) { return; }
|
4880 |
+
if(v.value !== null && $.trim(v.value) !== '') {
|
4881 |
+
if(with_values) { attr[v.name] = v.value; }
|
4882 |
+
else { attr.push(v.name); }
|
4883 |
+
}
|
4884 |
+
});
|
4885 |
+
}
|
4886 |
+
return attr;
|
4887 |
+
};
|
4888 |
+
$.vakata.array_unique = function(array) {
|
4889 |
+
var a = [], i, j, l, o = {};
|
4890 |
+
for(i = 0, l = array.length; i < l; i++) {
|
4891 |
+
if(o[array[i]] === undefined) {
|
4892 |
+
a.push(array[i]);
|
4893 |
+
o[array[i]] = true;
|
4894 |
+
}
|
4895 |
+
}
|
4896 |
+
return a;
|
4897 |
+
};
|
4898 |
+
// remove item from array
|
4899 |
+
$.vakata.array_remove = function(array, from) {
|
4900 |
+
array.splice(from, 1);
|
4901 |
+
return array;
|
4902 |
+
//var rest = array.slice((to || from) + 1 || array.length);
|
4903 |
+
//array.length = from < 0 ? array.length + from : from;
|
4904 |
+
//array.push.apply(array, rest);
|
4905 |
+
//return array;
|
4906 |
+
};
|
4907 |
+
// remove item from array
|
4908 |
+
$.vakata.array_remove_item = function(array, item) {
|
4909 |
+
var tmp = $.inArray(item, array);
|
4910 |
+
return tmp !== -1 ? $.vakata.array_remove(array, tmp) : array;
|
4911 |
+
};
|
4912 |
+
$.vakata.array_filter = function(c,a,b,d,e) {
|
4913 |
+
if (c.filter) {
|
4914 |
+
return c.filter(a, b);
|
4915 |
+
}
|
4916 |
+
d=[];
|
4917 |
+
for (e in c) {
|
4918 |
+
if (~~e+''===e+'' && e>=0 && a.call(b,c[e],+e,c)) {
|
4919 |
+
d.push(c[e]);
|
4920 |
+
}
|
4921 |
+
}
|
4922 |
+
return d;
|
4923 |
+
};
|
4924 |
+
|
4925 |
+
|
4926 |
+
/**
|
4927 |
+
* ### Changed plugin
|
4928 |
+
*
|
4929 |
+
* This plugin adds more information to the `changed.jstree` event. The new data is contained in the `changed` event data property, and contains a lists of `selected` and `deselected` nodes.
|
4930 |
+
*/
|
4931 |
+
|
4932 |
+
$.jstree.plugins.changed = function (options, parent) {
|
4933 |
+
var last = [];
|
4934 |
+
this.trigger = function (ev, data) {
|
4935 |
+
var i, j;
|
4936 |
+
if(!data) {
|
4937 |
+
data = {};
|
4938 |
+
}
|
4939 |
+
if(ev.replace('.jstree','') === 'changed') {
|
4940 |
+
data.changed = { selected : [], deselected : [] };
|
4941 |
+
var tmp = {};
|
4942 |
+
for(i = 0, j = last.length; i < j; i++) {
|
4943 |
+
tmp[last[i]] = 1;
|
4944 |
+
}
|
4945 |
+
for(i = 0, j = data.selected.length; i < j; i++) {
|
4946 |
+
if(!tmp[data.selected[i]]) {
|
4947 |
+
data.changed.selected.push(data.selected[i]);
|
4948 |
+
}
|
4949 |
+
else {
|
4950 |
+
tmp[data.selected[i]] = 2;
|
4951 |
+
}
|
4952 |
+
}
|
4953 |
+
for(i = 0, j = last.length; i < j; i++) {
|
4954 |
+
if(tmp[last[i]] === 1) {
|
4955 |
+
data.changed.deselected.push(last[i]);
|
4956 |
+
}
|
4957 |
+
}
|
4958 |
+
last = data.selected.slice();
|
4959 |
+
}
|
4960 |
+
/**
|
4961 |
+
* triggered when selection changes (the "changed" plugin enhances the original event with more data)
|
4962 |
+
* @event
|
4963 |
+
* @name changed.jstree
|
4964 |
+
* @param {Object} node
|
4965 |
+
* @param {Object} action the action that caused the selection to change
|
4966 |
+
* @param {Array} selected the current selection
|
4967 |
+
* @param {Object} changed an object containing two properties `selected` and `deselected` - both arrays of node IDs, which were selected or deselected since the last changed event
|
4968 |
+
* @param {Object} event the event (if any) that triggered this changed event
|
4969 |
+
* @plugin changed
|
4970 |
+
*/
|
4971 |
+
parent.trigger.call(this, ev, data);
|
4972 |
+
};
|
4973 |
+
this.refresh = function (skip_loading, forget_state) {
|
4974 |
+
last = [];
|
4975 |
+
return parent.refresh.apply(this, arguments);
|
4976 |
+
};
|
4977 |
+
};
|
4978 |
+
|
4979 |
+
/**
|
4980 |
+
* ### Checkbox plugin
|
4981 |
+
*
|
4982 |
+
* This plugin renders checkbox icons in front of each node, making multiple selection much easier.
|
4983 |
+
* It also supports tri-state behavior, meaning that if a node has a few of its children checked it will be rendered as undetermined, and state will be propagated up.
|
4984 |
+
*/
|
4985 |
+
|
4986 |
+
var _i = document.createElement('I');
|
4987 |
+
_i.className = 'jstree-icon jstree-checkbox';
|
4988 |
+
_i.setAttribute('role', 'presentation');
|
4989 |
+
/**
|
4990 |
+
* stores all defaults for the checkbox plugin
|
4991 |
+
* @name $.jstree.defaults.checkbox
|
4992 |
+
* @plugin checkbox
|
4993 |
+
*/
|
4994 |
+
$.jstree.defaults.checkbox = {
|
4995 |
+
/**
|
4996 |
+
* a boolean indicating if checkboxes should be visible (can be changed at a later time using `show_checkboxes()` and `hide_checkboxes`). Defaults to `true`.
|
4997 |
+
* @name $.jstree.defaults.checkbox.visible
|
4998 |
+
* @plugin checkbox
|
4999 |
+
*/
|
5000 |
+
visible : true,
|
5001 |
+
/**
|
5002 |
+
* a boolean indicating if checkboxes should cascade down and have an undetermined state. Defaults to `true`.
|
5003 |
+
* @name $.jstree.defaults.checkbox.three_state
|
5004 |
+
* @plugin checkbox
|
5005 |
+
*/
|
5006 |
+
three_state : true,
|
5007 |
+
/**
|
5008 |
+
* a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`.
|
5009 |
+
* @name $.jstree.defaults.checkbox.whole_node
|
5010 |
+
* @plugin checkbox
|
5011 |
+
*/
|
5012 |
+
whole_node : true,
|
5013 |
+
/**
|
5014 |
+
* a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`.
|
5015 |
+
* @name $.jstree.defaults.checkbox.keep_selected_style
|
5016 |
+
* @plugin checkbox
|
5017 |
+
*/
|
5018 |
+
keep_selected_style : true,
|
5019 |
+
/**
|
5020 |
+
* This setting controls how cascading and undetermined nodes are applied.
|
5021 |
+
* If 'up' is in the string - cascading up is enabled, if 'down' is in the string - cascading down is enabled, if 'undetermined' is in the string - undetermined nodes will be used.
|
5022 |
+
* If `three_state` is set to `true` this setting is automatically set to 'up+down+undetermined'. Defaults to ''.
|
5023 |
+
* @name $.jstree.defaults.checkbox.cascade
|
5024 |
+
* @plugin checkbox
|
5025 |
+
*/
|
5026 |
+
cascade : '',
|
5027 |
+
/**
|
5028 |
+
* This setting controls if checkbox are bound to the general tree selection or to an internal array maintained by the checkbox plugin. Defaults to `true`, only set to `false` if you know exactly what you are doing.
|
5029 |
+
* @name $.jstree.defaults.checkbox.tie_selection
|
5030 |
+
* @plugin checkbox
|
5031 |
+
*/
|
5032 |
+
tie_selection : true,
|
5033 |
+
|
5034 |
+
/**
|
5035 |
+
* This setting controls if cascading down affects disabled checkboxes
|
5036 |
+
* @name $.jstree.defaults.checkbox.cascade_to_disabled
|
5037 |
+
* @plugin checkbox
|
5038 |
+
*/
|
5039 |
+
cascade_to_disabled : true,
|
5040 |
+
|
5041 |
+
/**
|
5042 |
+
* This setting controls if cascading down affects hidden checkboxes
|
5043 |
+
* @name $.jstree.defaults.checkbox.cascade_to_hidden
|
5044 |
+
* @plugin checkbox
|
5045 |
+
*/
|
5046 |
+
cascade_to_hidden : true
|
5047 |
+
};
|
5048 |
+
$.jstree.plugins.checkbox = function (options, parent) {
|
5049 |
+
this.bind = function () {
|
5050 |
+
parent.bind.call(this);
|
5051 |
+
this._data.checkbox.uto = false;
|
5052 |
+
this._data.checkbox.selected = [];
|
5053 |
+
if(this.settings.checkbox.three_state) {
|
5054 |
+
this.settings.checkbox.cascade = 'up+down+undetermined';
|
5055 |
+
}
|
5056 |
+
this.element
|
5057 |
+
.on("init.jstree", $.proxy(function () {
|
5058 |
+
this._data.checkbox.visible = this.settings.checkbox.visible;
|
5059 |
+
if(!this.settings.checkbox.keep_selected_style) {
|
5060 |
+
this.element.addClass('jstree-checkbox-no-clicked');
|
5061 |
+
}
|
5062 |
+
if(this.settings.checkbox.tie_selection) {
|
5063 |
+
this.element.addClass('jstree-checkbox-selection');
|
5064 |
+
}
|
5065 |
+
}, this))
|
5066 |
+
.on("loading.jstree", $.proxy(function () {
|
5067 |
+
this[ this._data.checkbox.visible ? 'show_checkboxes' : 'hide_checkboxes' ]();
|
5068 |
+
}, this));
|
5069 |
+
if(this.settings.checkbox.cascade.indexOf('undetermined') !== -1) {
|
5070 |
+
this.element
|
5071 |
+
.on('changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree', $.proxy(function () {
|
5072 |
+
// only if undetermined is in setting
|
5073 |
+
if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); }
|
5074 |
+
this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50);
|
5075 |
+
}, this));
|
5076 |
+
}
|
5077 |
+
if(!this.settings.checkbox.tie_selection) {
|
5078 |
+
this.element
|
5079 |
+
.on('model.jstree', $.proxy(function (e, data) {
|
5080 |
+
var m = this._model.data,
|
5081 |
+
p = m[data.parent],
|
5082 |
+
dpc = data.nodes,
|
5083 |
+
i, j;
|
5084 |
+
for(i = 0, j = dpc.length; i < j; i++) {
|
5085 |
+
m[dpc[i]].state.checked = m[dpc[i]].state.checked || (m[dpc[i]].original && m[dpc[i]].original.state && m[dpc[i]].original.state.checked);
|
5086 |
+
if(m[dpc[i]].state.checked) {
|
5087 |
+
this._data.checkbox.selected.push(dpc[i]);
|
5088 |
+
}
|
5089 |
+
}
|
5090 |
+
}, this));
|
5091 |
+
}
|
5092 |
+
if(this.settings.checkbox.cascade.indexOf('up') !== -1 || this.settings.checkbox.cascade.indexOf('down') !== -1) {
|
5093 |
+
this.element
|
5094 |
+
.on('model.jstree', $.proxy(function (e, data) {
|
5095 |
+
var m = this._model.data,
|
5096 |
+
p = m[data.parent],
|
5097 |
+
dpc = data.nodes,
|
5098 |
+
chd = [],
|
5099 |
+
c, i, j, k, l, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection;
|
5100 |
+
|
5101 |
+
if(s.indexOf('down') !== -1) {
|
5102 |
+
// apply down
|
5103 |
+
if(p.state[ t ? 'selected' : 'checked' ]) {
|
5104 |
+
for(i = 0, j = dpc.length; i < j; i++) {
|
5105 |
+
m[dpc[i]].state[ t ? 'selected' : 'checked' ] = true;
|
5106 |
+
}
|
5107 |
+
|
5108 |
+
this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(dpc);
|
5109 |
+
}
|
5110 |
+
else {
|
5111 |
+
for(i = 0, j = dpc.length; i < j; i++) {
|
5112 |
+
if(m[dpc[i]].state[ t ? 'selected' : 'checked' ]) {
|
5113 |
+
for(k = 0, l = m[dpc[i]].children_d.length; k < l; k++) {
|
5114 |
+
m[m[dpc[i]].children_d[k]].state[ t ? 'selected' : 'checked' ] = true;
|
5115 |
+
}
|
5116 |
+
this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(m[dpc[i]].children_d);
|
5117 |
+
}
|
5118 |
+
}
|
5119 |
+
}
|
5120 |
+
}
|
5121 |
+
|
5122 |
+
if(s.indexOf('up') !== -1) {
|
5123 |
+
// apply up
|
5124 |
+
for(i = 0, j = p.children_d.length; i < j; i++) {
|
5125 |
+
if(!m[p.children_d[i]].children.length) {
|
5126 |
+
chd.push(m[p.children_d[i]].parent);
|
5127 |
+
}
|
5128 |
+
}
|
5129 |
+
chd = $.vakata.array_unique(chd);
|
5130 |
+
for(k = 0, l = chd.length; k < l; k++) {
|
5131 |
+
p = m[chd[k]];
|
5132 |
+
while(p && p.id !== $.jstree.root) {
|
5133 |
+
c = 0;
|
5134 |
+
for(i = 0, j = p.children.length; i < j; i++) {
|
5135 |
+
c += m[p.children[i]].state[ t ? 'selected' : 'checked' ];
|
5136 |
+
}
|
5137 |
+
if(c === j) {
|
5138 |
+
p.state[ t ? 'selected' : 'checked' ] = true;
|
5139 |
+
this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id);
|
5140 |
+
tmp = this.get_node(p, true);
|
5141 |
+
if(tmp && tmp.length) {
|
5142 |
+
tmp.attr('aria-selected', true).children('.jstree-anchor').addClass( t ? 'jstree-clicked' : 'jstree-checked');
|
5143 |
+
}
|
5144 |
+
}
|
5145 |
+
else {
|
5146 |
+
break;
|
5147 |
+
}
|
5148 |
+
p = this.get_node(p.parent);
|
5149 |
+
}
|
5150 |
+
}
|
5151 |
+
}
|
5152 |
+
|
5153 |
+
this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected);
|
5154 |
+
}, this))
|
5155 |
+
.on(this.settings.checkbox.tie_selection ? 'select_node.jstree' : 'check_node.jstree', $.proxy(function (e, data) {
|
5156 |
+
var self = this,
|
5157 |
+
obj = data.node,
|
5158 |
+
m = this._model.data,
|
5159 |
+
par = this.get_node(obj.parent),
|
5160 |
+
i, j, c, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection,
|
5161 |
+
sel = {}, cur = this._data[ t ? 'core' : 'checkbox' ].selected;
|
5162 |
+
|
5163 |
+
for (i = 0, j = cur.length; i < j; i++) {
|
5164 |
+
sel[cur[i]] = true;
|
5165 |
+
}
|
5166 |
+
|
5167 |
+
// apply down
|
5168 |
+
if(s.indexOf('down') !== -1) {
|
5169 |
+
//this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected.concat(obj.children_d));
|
5170 |
+
var selectedIds = this._cascade_new_checked_state(obj.id, true);
|
5171 |
+
var temp = obj.children_d.concat(obj.id);
|
5172 |
+
for (i = 0, j = temp.length; i < j; i++) {
|
5173 |
+
if (selectedIds.indexOf(temp[i]) > -1) {
|
5174 |
+
sel[temp[i]] = true;
|
5175 |
+
}
|
5176 |
+
else {
|
5177 |
+
delete sel[temp[i]];
|
5178 |
+
}
|
5179 |
+
}
|
5180 |
+
}
|
5181 |
+
|
5182 |
+
// apply up
|
5183 |
+
if(s.indexOf('up') !== -1) {
|
5184 |
+
while(par && par.id !== $.jstree.root) {
|
5185 |
+
c = 0;
|
5186 |
+
for(i = 0, j = par.children.length; i < j; i++) {
|
5187 |
+
c += m[par.children[i]].state[ t ? 'selected' : 'checked' ];
|
5188 |
+
}
|
5189 |
+
if(c === j) {
|
5190 |
+
par.state[ t ? 'selected' : 'checked' ] = true;
|
5191 |
+
sel[par.id] = true;
|
5192 |
+
//this._data[ t ? 'core' : 'checkbox' ].selected.push(par.id);
|
5193 |
+
tmp = this.get_node(par, true);
|
5194 |
+
if(tmp && tmp.length) {
|
5195 |
+
tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5196 |
+
}
|
5197 |
+
}
|
5198 |
+
else {
|
5199 |
+
break;
|
5200 |
+
}
|
5201 |
+
par = this.get_node(par.parent);
|
5202 |
+
}
|
5203 |
+
}
|
5204 |
+
|
5205 |
+
cur = [];
|
5206 |
+
for (i in sel) {
|
5207 |
+
if (sel.hasOwnProperty(i)) {
|
5208 |
+
cur.push(i);
|
5209 |
+
}
|
5210 |
+
}
|
5211 |
+
this._data[ t ? 'core' : 'checkbox' ].selected = cur;
|
5212 |
+
}, this))
|
5213 |
+
.on(this.settings.checkbox.tie_selection ? 'deselect_all.jstree' : 'uncheck_all.jstree', $.proxy(function (e, data) {
|
5214 |
+
var obj = this.get_node($.jstree.root),
|
5215 |
+
m = this._model.data,
|
5216 |
+
i, j, tmp;
|
5217 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
5218 |
+
tmp = m[obj.children_d[i]];
|
5219 |
+
if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) {
|
5220 |
+
tmp.original.state.undetermined = false;
|
5221 |
+
}
|
5222 |
+
}
|
5223 |
+
}, this))
|
5224 |
+
.on(this.settings.checkbox.tie_selection ? 'deselect_node.jstree' : 'uncheck_node.jstree', $.proxy(function (e, data) {
|
5225 |
+
var self = this,
|
5226 |
+
obj = data.node,
|
5227 |
+
dom = this.get_node(obj, true),
|
5228 |
+
i, j, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection,
|
5229 |
+
cur = this._data[ t ? 'core' : 'checkbox' ].selected, sel = {},
|
5230 |
+
stillSelectedIds = [],
|
5231 |
+
allIds = obj.children_d.concat(obj.id);
|
5232 |
+
|
5233 |
+
// apply down
|
5234 |
+
if(s.indexOf('down') !== -1) {
|
5235 |
+
var selectedIds = this._cascade_new_checked_state(obj.id, false);
|
5236 |
+
|
5237 |
+
cur = cur.filter(function(id) {
|
5238 |
+
return allIds.indexOf(id) === -1 || selectedIds.indexOf(id) > -1;
|
5239 |
+
});
|
5240 |
+
}
|
5241 |
+
|
5242 |
+
// only apply up if cascade up is enabled and if this node is not selected
|
5243 |
+
// (if all child nodes are disabled and cascade_to_disabled === false then this node will till be selected).
|
5244 |
+
if(s.indexOf('up') !== -1 && cur.indexOf(obj.id) === -1) {
|
5245 |
+
for(i = 0, j = obj.parents.length; i < j; i++) {
|
5246 |
+
tmp = this._model.data[obj.parents[i]];
|
5247 |
+
tmp.state[ t ? 'selected' : 'checked' ] = false;
|
5248 |
+
if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) {
|
5249 |
+
tmp.original.state.undetermined = false;
|
5250 |
+
}
|
5251 |
+
tmp = this.get_node(obj.parents[i], true);
|
5252 |
+
if(tmp && tmp.length) {
|
5253 |
+
tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5254 |
+
}
|
5255 |
+
}
|
5256 |
+
|
5257 |
+
cur = cur.filter(function(id) {
|
5258 |
+
return obj.parents.indexOf(id) === -1;
|
5259 |
+
});
|
5260 |
+
}
|
5261 |
+
|
5262 |
+
this._data[ t ? 'core' : 'checkbox' ].selected = cur;
|
5263 |
+
}, this));
|
5264 |
+
}
|
5265 |
+
if(this.settings.checkbox.cascade.indexOf('up') !== -1) {
|
5266 |
+
this.element
|
5267 |
+
.on('delete_node.jstree', $.proxy(function (e, data) {
|
5268 |
+
// apply up (whole handler)
|
5269 |
+
var p = this.get_node(data.parent),
|
5270 |
+
m = this._model.data,
|
5271 |
+
i, j, c, tmp, t = this.settings.checkbox.tie_selection;
|
5272 |
+
while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) {
|
5273 |
+
c = 0;
|
5274 |
+
for(i = 0, j = p.children.length; i < j; i++) {
|
5275 |
+
c += m[p.children[i]].state[ t ? 'selected' : 'checked' ];
|
5276 |
+
}
|
5277 |
+
if(j > 0 && c === j) {
|
5278 |
+
p.state[ t ? 'selected' : 'checked' ] = true;
|
5279 |
+
this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id);
|
5280 |
+
tmp = this.get_node(p, true);
|
5281 |
+
if(tmp && tmp.length) {
|
5282 |
+
tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5283 |
+
}
|
5284 |
+
}
|
5285 |
+
else {
|
5286 |
+
break;
|
5287 |
+
}
|
5288 |
+
p = this.get_node(p.parent);
|
5289 |
+
}
|
5290 |
+
}, this))
|
5291 |
+
.on('move_node.jstree', $.proxy(function (e, data) {
|
5292 |
+
// apply up (whole handler)
|
5293 |
+
var is_multi = data.is_multi,
|
5294 |
+
old_par = data.old_parent,
|
5295 |
+
new_par = this.get_node(data.parent),
|
5296 |
+
m = this._model.data,
|
5297 |
+
p, c, i, j, tmp, t = this.settings.checkbox.tie_selection;
|
5298 |
+
if(!is_multi) {
|
5299 |
+
p = this.get_node(old_par);
|
5300 |
+
while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) {
|
5301 |
+
c = 0;
|
5302 |
+
for(i = 0, j = p.children.length; i < j; i++) {
|
5303 |
+
c += m[p.children[i]].state[ t ? 'selected' : 'checked' ];
|
5304 |
+
}
|
5305 |
+
if(j > 0 && c === j) {
|
5306 |
+
p.state[ t ? 'selected' : 'checked' ] = true;
|
5307 |
+
this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id);
|
5308 |
+
tmp = this.get_node(p, true);
|
5309 |
+
if(tmp && tmp.length) {
|
5310 |
+
tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5311 |
+
}
|
5312 |
+
}
|
5313 |
+
else {
|
5314 |
+
break;
|
5315 |
+
}
|
5316 |
+
p = this.get_node(p.parent);
|
5317 |
+
}
|
5318 |
+
}
|
5319 |
+
p = new_par;
|
5320 |
+
while(p && p.id !== $.jstree.root) {
|
5321 |
+
c = 0;
|
5322 |
+
for(i = 0, j = p.children.length; i < j; i++) {
|
5323 |
+
c += m[p.children[i]].state[ t ? 'selected' : 'checked' ];
|
5324 |
+
}
|
5325 |
+
if(c === j) {
|
5326 |
+
if(!p.state[ t ? 'selected' : 'checked' ]) {
|
5327 |
+
p.state[ t ? 'selected' : 'checked' ] = true;
|
5328 |
+
this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id);
|
5329 |
+
tmp = this.get_node(p, true);
|
5330 |
+
if(tmp && tmp.length) {
|
5331 |
+
tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5332 |
+
}
|
5333 |
+
}
|
5334 |
+
}
|
5335 |
+
else {
|
5336 |
+
if(p.state[ t ? 'selected' : 'checked' ]) {
|
5337 |
+
p.state[ t ? 'selected' : 'checked' ] = false;
|
5338 |
+
this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_remove_item(this._data[ t ? 'core' : 'checkbox' ].selected, p.id);
|
5339 |
+
tmp = this.get_node(p, true);
|
5340 |
+
if(tmp && tmp.length) {
|
5341 |
+
tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5342 |
+
}
|
5343 |
+
}
|
5344 |
+
else {
|
5345 |
+
break;
|
5346 |
+
}
|
5347 |
+
}
|
5348 |
+
p = this.get_node(p.parent);
|
5349 |
+
}
|
5350 |
+
}, this));
|
5351 |
+
}
|
5352 |
+
};
|
5353 |
+
/**
|
5354 |
+
* get an array of all nodes whose state is "undetermined"
|
5355 |
+
* @name get_undetermined([full])
|
5356 |
+
* @param {boolean} full: if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
5357 |
+
* @return {Array}
|
5358 |
+
* @plugin checkbox
|
5359 |
+
*/
|
5360 |
+
this.get_undetermined = function (full) {
|
5361 |
+
if (this.settings.checkbox.cascade.indexOf('undetermined') === -1) {
|
5362 |
+
return [];
|
5363 |
+
}
|
5364 |
+
var i, j, k, l, o = {}, m = this._model.data, t = this.settings.checkbox.tie_selection, s = this._data[ t ? 'core' : 'checkbox' ].selected, p = [], tt = this, r = [];
|
5365 |
+
for(i = 0, j = s.length; i < j; i++) {
|
5366 |
+
if(m[s[i]] && m[s[i]].parents) {
|
5367 |
+
for(k = 0, l = m[s[i]].parents.length; k < l; k++) {
|
5368 |
+
if(o[m[s[i]].parents[k]] !== undefined) {
|
5369 |
+
break;
|
5370 |
+
}
|
5371 |
+
if(m[s[i]].parents[k] !== $.jstree.root) {
|
5372 |
+
o[m[s[i]].parents[k]] = true;
|
5373 |
+
p.push(m[s[i]].parents[k]);
|
5374 |
+
}
|
5375 |
+
}
|
5376 |
+
}
|
5377 |
+
}
|
5378 |
+
// attempt for server side undetermined state
|
5379 |
+
this.element.find('.jstree-closed').not(':has(.jstree-children)')
|
5380 |
+
.each(function () {
|
5381 |
+
var tmp = tt.get_node(this), tmp2;
|
5382 |
+
|
5383 |
+
if(!tmp) { return; }
|
5384 |
+
|
5385 |
+
if(!tmp.state.loaded) {
|
5386 |
+
if(tmp.original && tmp.original.state && tmp.original.state.undetermined && tmp.original.state.undetermined === true) {
|
5387 |
+
if(o[tmp.id] === undefined && tmp.id !== $.jstree.root) {
|
5388 |
+
o[tmp.id] = true;
|
5389 |
+
p.push(tmp.id);
|
5390 |
+
}
|
5391 |
+
for(k = 0, l = tmp.parents.length; k < l; k++) {
|
5392 |
+
if(o[tmp.parents[k]] === undefined && tmp.parents[k] !== $.jstree.root) {
|
5393 |
+
o[tmp.parents[k]] = true;
|
5394 |
+
p.push(tmp.parents[k]);
|
5395 |
+
}
|
5396 |
+
}
|
5397 |
+
}
|
5398 |
+
}
|
5399 |
+
else {
|
5400 |
+
for(i = 0, j = tmp.children_d.length; i < j; i++) {
|
5401 |
+
tmp2 = m[tmp.children_d[i]];
|
5402 |
+
if(!tmp2.state.loaded && tmp2.original && tmp2.original.state && tmp2.original.state.undetermined && tmp2.original.state.undetermined === true) {
|
5403 |
+
if(o[tmp2.id] === undefined && tmp2.id !== $.jstree.root) {
|
5404 |
+
o[tmp2.id] = true;
|
5405 |
+
p.push(tmp2.id);
|
5406 |
+
}
|
5407 |
+
for(k = 0, l = tmp2.parents.length; k < l; k++) {
|
5408 |
+
if(o[tmp2.parents[k]] === undefined && tmp2.parents[k] !== $.jstree.root) {
|
5409 |
+
o[tmp2.parents[k]] = true;
|
5410 |
+
p.push(tmp2.parents[k]);
|
5411 |
+
}
|
5412 |
+
}
|
5413 |
+
}
|
5414 |
+
}
|
5415 |
+
}
|
5416 |
+
});
|
5417 |
+
for (i = 0, j = p.length; i < j; i++) {
|
5418 |
+
if(!m[p[i]].state[ t ? 'selected' : 'checked' ]) {
|
5419 |
+
r.push(full ? m[p[i]] : p[i]);
|
5420 |
+
}
|
5421 |
+
}
|
5422 |
+
return r;
|
5423 |
+
};
|
5424 |
+
/**
|
5425 |
+
* set the undetermined state where and if necessary. Used internally.
|
5426 |
+
* @private
|
5427 |
+
* @name _undetermined()
|
5428 |
+
* @plugin checkbox
|
5429 |
+
*/
|
5430 |
+
this._undetermined = function () {
|
5431 |
+
if(this.element === null) { return; }
|
5432 |
+
var p = this.get_undetermined(false), i, j, s;
|
5433 |
+
|
5434 |
+
this.element.find('.jstree-undetermined').removeClass('jstree-undetermined');
|
5435 |
+
for (i = 0, j = p.length; i < j; i++) {
|
5436 |
+
s = this.get_node(p[i], true);
|
5437 |
+
if(s && s.length) {
|
5438 |
+
s.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-undetermined');
|
5439 |
+
}
|
5440 |
+
}
|
5441 |
+
};
|
5442 |
+
this.redraw_node = function(obj, deep, is_callback, force_render) {
|
5443 |
+
obj = parent.redraw_node.apply(this, arguments);
|
5444 |
+
if(obj) {
|
5445 |
+
var i, j, tmp = null, icon = null;
|
5446 |
+
for(i = 0, j = obj.childNodes.length; i < j; i++) {
|
5447 |
+
if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) {
|
5448 |
+
tmp = obj.childNodes[i];
|
5449 |
+
break;
|
5450 |
+
}
|
5451 |
+
}
|
5452 |
+
if(tmp) {
|
5453 |
+
if(!this.settings.checkbox.tie_selection && this._model.data[obj.id].state.checked) { tmp.className += ' jstree-checked'; }
|
5454 |
+
icon = _i.cloneNode(false);
|
5455 |
+
if(this._model.data[obj.id].state.checkbox_disabled) { icon.className += ' jstree-checkbox-disabled'; }
|
5456 |
+
tmp.insertBefore(icon, tmp.childNodes[0]);
|
5457 |
+
}
|
5458 |
+
}
|
5459 |
+
if(!is_callback && this.settings.checkbox.cascade.indexOf('undetermined') !== -1) {
|
5460 |
+
if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); }
|
5461 |
+
this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50);
|
5462 |
+
}
|
5463 |
+
return obj;
|
5464 |
+
};
|
5465 |
+
/**
|
5466 |
+
* show the node checkbox icons
|
5467 |
+
* @name show_checkboxes()
|
5468 |
+
* @plugin checkbox
|
5469 |
+
*/
|
5470 |
+
this.show_checkboxes = function () { this._data.core.themes.checkboxes = true; this.get_container_ul().removeClass("jstree-no-checkboxes"); };
|
5471 |
+
/**
|
5472 |
+
* hide the node checkbox icons
|
5473 |
+
* @name hide_checkboxes()
|
5474 |
+
* @plugin checkbox
|
5475 |
+
*/
|
5476 |
+
this.hide_checkboxes = function () { this._data.core.themes.checkboxes = false; this.get_container_ul().addClass("jstree-no-checkboxes"); };
|
5477 |
+
/**
|
5478 |
+
* toggle the node icons
|
5479 |
+
* @name toggle_checkboxes()
|
5480 |
+
* @plugin checkbox
|
5481 |
+
*/
|
5482 |
+
this.toggle_checkboxes = function () { if(this._data.core.themes.checkboxes) { this.hide_checkboxes(); } else { this.show_checkboxes(); } };
|
5483 |
+
/**
|
5484 |
+
* checks if a node is in an undetermined state
|
5485 |
+
* @name is_undetermined(obj)
|
5486 |
+
* @param {mixed} obj
|
5487 |
+
* @return {Boolean}
|
5488 |
+
*/
|
5489 |
+
this.is_undetermined = function (obj) {
|
5490 |
+
obj = this.get_node(obj);
|
5491 |
+
var s = this.settings.checkbox.cascade, i, j, t = this.settings.checkbox.tie_selection, d = this._data[ t ? 'core' : 'checkbox' ].selected, m = this._model.data;
|
5492 |
+
if(!obj || obj.state[ t ? 'selected' : 'checked' ] === true || s.indexOf('undetermined') === -1 || (s.indexOf('down') === -1 && s.indexOf('up') === -1)) {
|
5493 |
+
return false;
|
5494 |
+
}
|
5495 |
+
if(!obj.state.loaded && obj.original.state.undetermined === true) {
|
5496 |
+
return true;
|
5497 |
+
}
|
5498 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
5499 |
+
if($.inArray(obj.children_d[i], d) !== -1 || (!m[obj.children_d[i]].state.loaded && m[obj.children_d[i]].original.state.undetermined)) {
|
5500 |
+
return true;
|
5501 |
+
}
|
5502 |
+
}
|
5503 |
+
return false;
|
5504 |
+
};
|
5505 |
+
/**
|
5506 |
+
* disable a node's checkbox
|
5507 |
+
* @name disable_checkbox(obj)
|
5508 |
+
* @param {mixed} obj an array can be used too
|
5509 |
+
* @trigger disable_checkbox.jstree
|
5510 |
+
* @plugin checkbox
|
5511 |
+
*/
|
5512 |
+
this.disable_checkbox = function (obj) {
|
5513 |
+
var t1, t2, dom;
|
5514 |
+
if($.isArray(obj)) {
|
5515 |
+
obj = obj.slice();
|
5516 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
5517 |
+
this.disable_checkbox(obj[t1]);
|
5518 |
+
}
|
5519 |
+
return true;
|
5520 |
+
}
|
5521 |
+
obj = this.get_node(obj);
|
5522 |
+
if(!obj || obj.id === $.jstree.root) {
|
5523 |
+
return false;
|
5524 |
+
}
|
5525 |
+
dom = this.get_node(obj, true);
|
5526 |
+
if(!obj.state.checkbox_disabled) {
|
5527 |
+
obj.state.checkbox_disabled = true;
|
5528 |
+
if(dom && dom.length) {
|
5529 |
+
dom.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-checkbox-disabled');
|
5530 |
+
}
|
5531 |
+
/**
|
5532 |
+
* triggered when an node's checkbox is disabled
|
5533 |
+
* @event
|
5534 |
+
* @name disable_checkbox.jstree
|
5535 |
+
* @param {Object} node
|
5536 |
+
* @plugin checkbox
|
5537 |
+
*/
|
5538 |
+
this.trigger('disable_checkbox', { 'node' : obj });
|
5539 |
+
}
|
5540 |
+
};
|
5541 |
+
/**
|
5542 |
+
* enable a node's checkbox
|
5543 |
+
* @name disable_checkbox(obj)
|
5544 |
+
* @param {mixed} obj an array can be used too
|
5545 |
+
* @trigger enable_checkbox.jstree
|
5546 |
+
* @plugin checkbox
|
5547 |
+
*/
|
5548 |
+
this.enable_checkbox = function (obj) {
|
5549 |
+
var t1, t2, dom;
|
5550 |
+
if($.isArray(obj)) {
|
5551 |
+
obj = obj.slice();
|
5552 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
5553 |
+
this.enable_checkbox(obj[t1]);
|
5554 |
+
}
|
5555 |
+
return true;
|
5556 |
+
}
|
5557 |
+
obj = this.get_node(obj);
|
5558 |
+
if(!obj || obj.id === $.jstree.root) {
|
5559 |
+
return false;
|
5560 |
+
}
|
5561 |
+
dom = this.get_node(obj, true);
|
5562 |
+
if(obj.state.checkbox_disabled) {
|
5563 |
+
obj.state.checkbox_disabled = false;
|
5564 |
+
if(dom && dom.length) {
|
5565 |
+
dom.children('.jstree-anchor').children('.jstree-checkbox').removeClass('jstree-checkbox-disabled');
|
5566 |
+
}
|
5567 |
+
/**
|
5568 |
+
* triggered when an node's checkbox is enabled
|
5569 |
+
* @event
|
5570 |
+
* @name enable_checkbox.jstree
|
5571 |
+
* @param {Object} node
|
5572 |
+
* @plugin checkbox
|
5573 |
+
*/
|
5574 |
+
this.trigger('enable_checkbox', { 'node' : obj });
|
5575 |
+
}
|
5576 |
+
};
|
5577 |
+
|
5578 |
+
this.activate_node = function (obj, e) {
|
5579 |
+
if($(e.target).hasClass('jstree-checkbox-disabled')) {
|
5580 |
+
return false;
|
5581 |
+
}
|
5582 |
+
if(this.settings.checkbox.tie_selection && (this.settings.checkbox.whole_node || $(e.target).hasClass('jstree-checkbox'))) {
|
5583 |
+
e.ctrlKey = true;
|
5584 |
+
}
|
5585 |
+
if(this.settings.checkbox.tie_selection || (!this.settings.checkbox.whole_node && !$(e.target).hasClass('jstree-checkbox'))) {
|
5586 |
+
return parent.activate_node.call(this, obj, e);
|
5587 |
+
}
|
5588 |
+
if(this.is_disabled(obj)) {
|
5589 |
+
return false;
|
5590 |
+
}
|
5591 |
+
if(this.is_checked(obj)) {
|
5592 |
+
this.uncheck_node(obj, e);
|
5593 |
+
}
|
5594 |
+
else {
|
5595 |
+
this.check_node(obj, e);
|
5596 |
+
}
|
5597 |
+
this.trigger('activate_node', { 'node' : this.get_node(obj) });
|
5598 |
+
};
|
5599 |
+
|
5600 |
+
/**
|
5601 |
+
* Cascades checked state to a node and all its descendants. This function does NOT affect hidden and disabled nodes (or their descendants).
|
5602 |
+
* However if these unaffected nodes are already selected their ids will be included in the returned array.
|
5603 |
+
* @private
|
5604 |
+
* @param {string} id the node ID
|
5605 |
+
* @param {bool} checkedState should the nodes be checked or not
|
5606 |
+
* @returns {Array} Array of all node id's (in this tree branch) that are checked.
|
5607 |
+
*/
|
5608 |
+
this._cascade_new_checked_state = function (id, checkedState) {
|
5609 |
+
var self = this;
|
5610 |
+
var t = this.settings.checkbox.tie_selection;
|
5611 |
+
var node = this._model.data[id];
|
5612 |
+
var selectedNodeIds = [];
|
5613 |
+
var selectedChildrenIds = [], i, j, selectedChildIds;
|
5614 |
+
|
5615 |
+
if (
|
5616 |
+
(this.settings.checkbox.cascade_to_disabled || !node.state.disabled) &&
|
5617 |
+
(this.settings.checkbox.cascade_to_hidden || !node.state.hidden)
|
5618 |
+
) {
|
5619 |
+
//First try and check/uncheck the children
|
5620 |
+
if (node.children) {
|
5621 |
+
for (i = 0, j = node.children.length; i < j; i++) {
|
5622 |
+
var childId = node.children[i];
|
5623 |
+
selectedChildIds = self._cascade_new_checked_state(childId, checkedState);
|
5624 |
+
selectedNodeIds = selectedNodeIds.concat(selectedChildIds);
|
5625 |
+
if (selectedChildIds.indexOf(childId) > -1) {
|
5626 |
+
selectedChildrenIds.push(childId);
|
5627 |
+
}
|
5628 |
+
}
|
5629 |
+
}
|
5630 |
+
|
5631 |
+
var dom = self.get_node(node, true);
|
5632 |
+
|
5633 |
+
//A node's state is undetermined if some but not all of it's children are checked/selected .
|
5634 |
+
var undetermined = selectedChildrenIds.length > 0 && selectedChildrenIds.length < node.children.length;
|
5635 |
+
|
5636 |
+
if(node.original && node.original.state && node.original.state.undetermined) {
|
5637 |
+
node.original.state.undetermined = undetermined;
|
5638 |
+
}
|
5639 |
+
|
5640 |
+
//If a node is undetermined then remove selected class
|
5641 |
+
if (undetermined) {
|
5642 |
+
node.state[ t ? 'selected' : 'checked' ] = false;
|
5643 |
+
dom.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5644 |
+
}
|
5645 |
+
//Otherwise, if the checkedState === true (i.e. the node is being checked now) and all of the node's children are checked (if it has any children),
|
5646 |
+
//check the node and style it correctly.
|
5647 |
+
else if (checkedState && selectedChildrenIds.length === node.children.length) {
|
5648 |
+
node.state[ t ? 'selected' : 'checked' ] = checkedState;
|
5649 |
+
selectedNodeIds.push(node.id);
|
5650 |
+
|
5651 |
+
dom.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5652 |
+
}
|
5653 |
+
else {
|
5654 |
+
node.state[ t ? 'selected' : 'checked' ] = false;
|
5655 |
+
dom.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5656 |
+
}
|
5657 |
+
}
|
5658 |
+
else {
|
5659 |
+
selectedChildIds = this.get_checked_descendants(id);
|
5660 |
+
|
5661 |
+
if (node.state[ t ? 'selected' : 'checked' ]) {
|
5662 |
+
selectedChildIds.push(node.id);
|
5663 |
+
}
|
5664 |
+
|
5665 |
+
selectedNodeIds = selectedNodeIds.concat(selectedChildIds);
|
5666 |
+
}
|
5667 |
+
|
5668 |
+
return selectedNodeIds;
|
5669 |
+
};
|
5670 |
+
|
5671 |
+
/**
|
5672 |
+
* Gets ids of nodes selected in branch (of tree) specified by id (does not include the node specified by id)
|
5673 |
+
* @name get_checked_descendants(obj)
|
5674 |
+
* @param {string} id the node ID
|
5675 |
+
* @return {Array} array of IDs
|
5676 |
+
* @plugin checkbox
|
5677 |
+
*/
|
5678 |
+
this.get_checked_descendants = function (id) {
|
5679 |
+
var self = this;
|
5680 |
+
var t = self.settings.checkbox.tie_selection;
|
5681 |
+
var node = self._model.data[id];
|
5682 |
+
|
5683 |
+
return node.children_d.filter(function(_id) {
|
5684 |
+
return self._model.data[_id].state[ t ? 'selected' : 'checked' ];
|
5685 |
+
});
|
5686 |
+
};
|
5687 |
+
|
5688 |
+
/**
|
5689 |
+
* check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally)
|
5690 |
+
* @name check_node(obj)
|
5691 |
+
* @param {mixed} obj an array can be used to check multiple nodes
|
5692 |
+
* @trigger check_node.jstree
|
5693 |
+
* @plugin checkbox
|
5694 |
+
*/
|
5695 |
+
this.check_node = function (obj, e) {
|
5696 |
+
if(this.settings.checkbox.tie_selection) { return this.select_node(obj, false, true, e); }
|
5697 |
+
var dom, t1, t2, th;
|
5698 |
+
if($.isArray(obj)) {
|
5699 |
+
obj = obj.slice();
|
5700 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
5701 |
+
this.check_node(obj[t1], e);
|
5702 |
+
}
|
5703 |
+
return true;
|
5704 |
+
}
|
5705 |
+
obj = this.get_node(obj);
|
5706 |
+
if(!obj || obj.id === $.jstree.root) {
|
5707 |
+
return false;
|
5708 |
+
}
|
5709 |
+
dom = this.get_node(obj, true);
|
5710 |
+
if(!obj.state.checked) {
|
5711 |
+
obj.state.checked = true;
|
5712 |
+
this._data.checkbox.selected.push(obj.id);
|
5713 |
+
if(dom && dom.length) {
|
5714 |
+
dom.children('.jstree-anchor').addClass('jstree-checked');
|
5715 |
+
}
|
5716 |
+
/**
|
5717 |
+
* triggered when an node is checked (only if tie_selection in checkbox settings is false)
|
5718 |
+
* @event
|
5719 |
+
* @name check_node.jstree
|
5720 |
+
* @param {Object} node
|
5721 |
+
* @param {Array} selected the current selection
|
5722 |
+
* @param {Object} event the event (if any) that triggered this check_node
|
5723 |
+
* @plugin checkbox
|
5724 |
+
*/
|
5725 |
+
this.trigger('check_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e });
|
5726 |
+
}
|
5727 |
+
};
|
5728 |
+
/**
|
5729 |
+
* uncheck a node (only if tie_selection in checkbox settings is false, otherwise deselect_node will be called internally)
|
5730 |
+
* @name uncheck_node(obj)
|
5731 |
+
* @param {mixed} obj an array can be used to uncheck multiple nodes
|
5732 |
+
* @trigger uncheck_node.jstree
|
5733 |
+
* @plugin checkbox
|
5734 |
+
*/
|
5735 |
+
this.uncheck_node = function (obj, e) {
|
5736 |
+
if(this.settings.checkbox.tie_selection) { return this.deselect_node(obj, false, e); }
|
5737 |
+
var t1, t2, dom;
|
5738 |
+
if($.isArray(obj)) {
|
5739 |
+
obj = obj.slice();
|
5740 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
5741 |
+
this.uncheck_node(obj[t1], e);
|
5742 |
+
}
|
5743 |
+
return true;
|
5744 |
+
}
|
5745 |
+
obj = this.get_node(obj);
|
5746 |
+
if(!obj || obj.id === $.jstree.root) {
|
5747 |
+
return false;
|
5748 |
+
}
|
5749 |
+
dom = this.get_node(obj, true);
|
5750 |
+
if(obj.state.checked) {
|
5751 |
+
obj.state.checked = false;
|
5752 |
+
this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, obj.id);
|
5753 |
+
if(dom.length) {
|
5754 |
+
dom.children('.jstree-anchor').removeClass('jstree-checked');
|
5755 |
+
}
|
5756 |
+
/**
|
5757 |
+
* triggered when an node is unchecked (only if tie_selection in checkbox settings is false)
|
5758 |
+
* @event
|
5759 |
+
* @name uncheck_node.jstree
|
5760 |
+
* @param {Object} node
|
5761 |
+
* @param {Array} selected the current selection
|
5762 |
+
* @param {Object} event the event (if any) that triggered this uncheck_node
|
5763 |
+
* @plugin checkbox
|
5764 |
+
*/
|
5765 |
+
this.trigger('uncheck_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e });
|
5766 |
+
}
|
5767 |
+
};
|
5768 |
+
|
5769 |
+
/**
|
5770 |
+
* checks all nodes in the tree (only if tie_selection in checkbox settings is false, otherwise select_all will be called internally)
|
5771 |
+
* @name check_all()
|
5772 |
+
* @trigger check_all.jstree, changed.jstree
|
5773 |
+
* @plugin checkbox
|
5774 |
+
*/
|
5775 |
+
this.check_all = function () {
|
5776 |
+
if(this.settings.checkbox.tie_selection) { return this.select_all(); }
|
5777 |
+
var tmp = this._data.checkbox.selected.concat([]), i, j;
|
5778 |
+
this._data.checkbox.selected = this._model.data[$.jstree.root].children_d.concat();
|
5779 |
+
for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) {
|
5780 |
+
if(this._model.data[this._data.checkbox.selected[i]]) {
|
5781 |
+
this._model.data[this._data.checkbox.selected[i]].state.checked = true;
|
5782 |
+
}
|
5783 |
+
}
|
5784 |
+
this.redraw(true);
|
5785 |
+
/**
|
5786 |
+
* triggered when all nodes are checked (only if tie_selection in checkbox settings is false)
|
5787 |
+
* @event
|
5788 |
+
* @name check_all.jstree
|
5789 |
+
* @param {Array} selected the current selection
|
5790 |
+
* @plugin checkbox
|
5791 |
+
*/
|
5792 |
+
this.trigger('check_all', { 'selected' : this._data.checkbox.selected });
|
5793 |
+
};
|
5794 |
+
/**
|
5795 |
+
* uncheck all checked nodes (only if tie_selection in checkbox settings is false, otherwise deselect_all will be called internally)
|
5796 |
+
* @name uncheck_all()
|
5797 |
+
* @trigger uncheck_all.jstree
|
5798 |
+
* @plugin checkbox
|
5799 |
+
*/
|
5800 |
+
this.uncheck_all = function () {
|
5801 |
+
if(this.settings.checkbox.tie_selection) { return this.deselect_all(); }
|
5802 |
+
var tmp = this._data.checkbox.selected.concat([]), i, j;
|
5803 |
+
for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) {
|
5804 |
+
if(this._model.data[this._data.checkbox.selected[i]]) {
|
5805 |
+
this._model.data[this._data.checkbox.selected[i]].state.checked = false;
|
5806 |
+
}
|
5807 |
+
}
|
5808 |
+
this._data.checkbox.selected = [];
|
5809 |
+
this.element.find('.jstree-checked').removeClass('jstree-checked');
|
5810 |
+
/**
|
5811 |
+
* triggered when all nodes are unchecked (only if tie_selection in checkbox settings is false)
|
5812 |
+
* @event
|
5813 |
+
* @name uncheck_all.jstree
|
5814 |
+
* @param {Object} node the previous selection
|
5815 |
+
* @param {Array} selected the current selection
|
5816 |
+
* @plugin checkbox
|
5817 |
+
*/
|
5818 |
+
this.trigger('uncheck_all', { 'selected' : this._data.checkbox.selected, 'node' : tmp });
|
5819 |
+
};
|
5820 |
+
/**
|
5821 |
+
* checks if a node is checked (if tie_selection is on in the settings this function will return the same as is_selected)
|
5822 |
+
* @name is_checked(obj)
|
5823 |
+
* @param {mixed} obj
|
5824 |
+
* @return {Boolean}
|
5825 |
+
* @plugin checkbox
|
5826 |
+
*/
|
5827 |
+
this.is_checked = function (obj) {
|
5828 |
+
if(this.settings.checkbox.tie_selection) { return this.is_selected(obj); }
|
5829 |
+
obj = this.get_node(obj);
|
5830 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
5831 |
+
return obj.state.checked;
|
5832 |
+
};
|
5833 |
+
/**
|
5834 |
+
* get an array of all checked nodes (if tie_selection is on in the settings this function will return the same as get_selected)
|
5835 |
+
* @name get_checked([full])
|
5836 |
+
* @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
5837 |
+
* @return {Array}
|
5838 |
+
* @plugin checkbox
|
5839 |
+
*/
|
5840 |
+
this.get_checked = function (full) {
|
5841 |
+
if(this.settings.checkbox.tie_selection) { return this.get_selected(full); }
|
5842 |
+
return full ? $.map(this._data.checkbox.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.checkbox.selected;
|
5843 |
+
};
|
5844 |
+
/**
|
5845 |
+
* get an array of all top level checked nodes (ignoring children of checked nodes) (if tie_selection is on in the settings this function will return the same as get_top_selected)
|
5846 |
+
* @name get_top_checked([full])
|
5847 |
+
* @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
5848 |
+
* @return {Array}
|
5849 |
+
* @plugin checkbox
|
5850 |
+
*/
|
5851 |
+
this.get_top_checked = function (full) {
|
5852 |
+
if(this.settings.checkbox.tie_selection) { return this.get_top_selected(full); }
|
5853 |
+
var tmp = this.get_checked(true),
|
5854 |
+
obj = {}, i, j, k, l;
|
5855 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
5856 |
+
obj[tmp[i].id] = tmp[i];
|
5857 |
+
}
|
5858 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
5859 |
+
for(k = 0, l = tmp[i].children_d.length; k < l; k++) {
|
5860 |
+
if(obj[tmp[i].children_d[k]]) {
|
5861 |
+
delete obj[tmp[i].children_d[k]];
|
5862 |
+
}
|
5863 |
+
}
|
5864 |
+
}
|
5865 |
+
tmp = [];
|
5866 |
+
for(i in obj) {
|
5867 |
+
if(obj.hasOwnProperty(i)) {
|
5868 |
+
tmp.push(i);
|
5869 |
+
}
|
5870 |
+
}
|
5871 |
+
return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp;
|
5872 |
+
};
|
5873 |
+
/**
|
5874 |
+
* get an array of all bottom level checked nodes (ignoring selected parents) (if tie_selection is on in the settings this function will return the same as get_bottom_selected)
|
5875 |
+
* @name get_bottom_checked([full])
|
5876 |
+
* @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
5877 |
+
* @return {Array}
|
5878 |
+
* @plugin checkbox
|
5879 |
+
*/
|
5880 |
+
this.get_bottom_checked = function (full) {
|
5881 |
+
if(this.settings.checkbox.tie_selection) { return this.get_bottom_selected(full); }
|
5882 |
+
var tmp = this.get_checked(true),
|
5883 |
+
obj = [], i, j;
|
5884 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
5885 |
+
if(!tmp[i].children.length) {
|
5886 |
+
obj.push(tmp[i].id);
|
5887 |
+
}
|
5888 |
+
}
|
5889 |
+
return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj;
|
5890 |
+
};
|
5891 |
+
this.load_node = function (obj, callback) {
|
5892 |
+
var k, l, i, j, c, tmp;
|
5893 |
+
if(!$.isArray(obj) && !this.settings.checkbox.tie_selection) {
|
5894 |
+
tmp = this.get_node(obj);
|
5895 |
+
if(tmp && tmp.state.loaded) {
|
5896 |
+
for(k = 0, l = tmp.children_d.length; k < l; k++) {
|
5897 |
+
if(this._model.data[tmp.children_d[k]].state.checked) {
|
5898 |
+
c = true;
|
5899 |
+
this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, tmp.children_d[k]);
|
5900 |
+
}
|
5901 |
+
}
|
5902 |
+
}
|
5903 |
+
}
|
5904 |
+
return parent.load_node.apply(this, arguments);
|
5905 |
+
};
|
5906 |
+
this.get_state = function () {
|
5907 |
+
var state = parent.get_state.apply(this, arguments);
|
5908 |
+
if(this.settings.checkbox.tie_selection) { return state; }
|
5909 |
+
state.checkbox = this._data.checkbox.selected.slice();
|
5910 |
+
return state;
|
5911 |
+
};
|
5912 |
+
this.set_state = function (state, callback) {
|
5913 |
+
var res = parent.set_state.apply(this, arguments);
|
5914 |
+
if(res && state.checkbox) {
|
5915 |
+
if(!this.settings.checkbox.tie_selection) {
|
5916 |
+
this.uncheck_all();
|
5917 |
+
var _this = this;
|
5918 |
+
$.each(state.checkbox, function (i, v) {
|
5919 |
+
_this.check_node(v);
|
5920 |
+
});
|
5921 |
+
}
|
5922 |
+
delete state.checkbox;
|
5923 |
+
this.set_state(state, callback);
|
5924 |
+
return false;
|
5925 |
+
}
|
5926 |
+
return res;
|
5927 |
+
};
|
5928 |
+
this.refresh = function (skip_loading, forget_state) {
|
5929 |
+
if(this.settings.checkbox.tie_selection) {
|
5930 |
+
this._data.checkbox.selected = [];
|
5931 |
+
}
|
5932 |
+
return parent.refresh.apply(this, arguments);
|
5933 |
+
};
|
5934 |
+
};
|
5935 |
+
|
5936 |
+
// include the checkbox plugin by default
|
5937 |
+
// $.jstree.defaults.plugins.push("checkbox");
|
5938 |
+
|
5939 |
+
|
5940 |
+
/**
|
5941 |
+
* ### Conditionalselect plugin
|
5942 |
+
*
|
5943 |
+
* This plugin allows defining a callback to allow or deny node selection by user input (activate node method).
|
5944 |
+
*/
|
5945 |
+
|
5946 |
+
/**
|
5947 |
+
* a callback (function) which is invoked in the instance's scope and receives two arguments - the node and the event that triggered the `activate_node` call. Returning false prevents working with the node, returning true allows invoking activate_node. Defaults to returning `true`.
|
5948 |
+
* @name $.jstree.defaults.checkbox.visible
|
5949 |
+
* @plugin checkbox
|
5950 |
+
*/
|
5951 |
+
$.jstree.defaults.conditionalselect = function () { return true; };
|
5952 |
+
$.jstree.plugins.conditionalselect = function (options, parent) {
|
5953 |
+
// own function
|
5954 |
+
this.activate_node = function (obj, e) {
|
5955 |
+
if(this.settings.conditionalselect.call(this, this.get_node(obj), e)) {
|
5956 |
+
return parent.activate_node.call(this, obj, e);
|
5957 |
+
}
|
5958 |
+
};
|
5959 |
+
};
|
5960 |
+
|
5961 |
+
|
5962 |
+
/**
|
5963 |
+
* ### Contextmenu plugin
|
5964 |
+
*
|
5965 |
+
* Shows a context menu when a node is right-clicked.
|
5966 |
+
*/
|
5967 |
+
|
5968 |
+
/**
|
5969 |
+
* stores all defaults for the contextmenu plugin
|
5970 |
+
* @name $.jstree.defaults.contextmenu
|
5971 |
+
* @plugin contextmenu
|
5972 |
+
*/
|
5973 |
+
$.jstree.defaults.contextmenu = {
|
5974 |
+
/**
|
5975 |
+
* a boolean indicating if the node should be selected when the context menu is invoked on it. Defaults to `true`.
|
5976 |
+
* @name $.jstree.defaults.contextmenu.select_node
|
5977 |
+
* @plugin contextmenu
|
5978 |
+
*/
|
5979 |
+
select_node : true,
|
5980 |
+
/**
|
5981 |
+
* a boolean indicating if the menu should be shown aligned with the node. Defaults to `true`, otherwise the mouse coordinates are used.
|
5982 |
+
* @name $.jstree.defaults.contextmenu.show_at_node
|
5983 |
+
* @plugin contextmenu
|
5984 |
+
*/
|
5985 |
+
show_at_node : true,
|
5986 |
+
/**
|
5987 |
+
* an object of actions, or a function that accepts a node and a callback function and calls the callback function with an object of actions available for that node (you can also return the items too).
|
5988 |
+
*
|
5989 |
+
* Each action consists of a key (a unique name) and a value which is an object with the following properties (only label and action are required). Once a menu item is activated the `action` function will be invoked with an object containing the following keys: item - the contextmenu item definition as seen below, reference - the DOM node that was used (the tree node), element - the contextmenu DOM element, position - an object with x/y properties indicating the position of the menu.
|
5990 |
+
*
|
5991 |
+
* * `separator_before` - a boolean indicating if there should be a separator before this item
|
5992 |
+
* * `separator_after` - a boolean indicating if there should be a separator after this item
|
5993 |
+
* * `_disabled` - a boolean indicating if this action should be disabled
|
5994 |
+
* * `label` - a string - the name of the action (could be a function returning a string)
|
5995 |
+
* * `title` - a string - an optional tooltip for the item
|
5996 |
+
* * `action` - a function to be executed if this item is chosen, the function will receive
|
5997 |
+
* * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class
|
5998 |
+
* * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2)
|
5999 |
+
* * `shortcut_label` - shortcut label (like for example `F2` for rename)
|
6000 |
+
* * `submenu` - an object with the same structure as $.jstree.defaults.contextmenu.items which can be used to create a submenu - each key will be rendered as a separate option in a submenu that will appear once the current item is hovered
|
6001 |
+
*
|
6002 |
+
* @name $.jstree.defaults.contextmenu.items
|
6003 |
+
* @plugin contextmenu
|
6004 |
+
*/
|
6005 |
+
items : function (o, cb) { // Could be an object directly
|
6006 |
+
return {
|
6007 |
+
"create" : {
|
6008 |
+
"separator_before" : false,
|
6009 |
+
"separator_after" : true,
|
6010 |
+
"_disabled" : false, //(this.check("create_node", data.reference, {}, "last")),
|
6011 |
+
"label" : "Create",
|
6012 |
+
"action" : function (data) {
|
6013 |
+
var inst = $.jstree.reference(data.reference),
|
6014 |
+
obj = inst.get_node(data.reference);
|
6015 |
+
inst.create_node(obj, {}, "last", function (new_node) {
|
6016 |
+
try {
|
6017 |
+
inst.edit(new_node);
|
6018 |
+
} catch (ex) {
|
6019 |
+
setTimeout(function () { inst.edit(new_node); },0);
|
6020 |
+
}
|
6021 |
+
});
|
6022 |
+
}
|
6023 |
+
},
|
6024 |
+
"rename" : {
|
6025 |
+
"separator_before" : false,
|
6026 |
+
"separator_after" : false,
|
6027 |
+
"_disabled" : false, //(this.check("rename_node", data.reference, this.get_parent(data.reference), "")),
|
6028 |
+
"label" : "Rename",
|
6029 |
+
/*!
|
6030 |
+
"shortcut" : 113,
|
6031 |
+
"shortcut_label" : 'F2',
|
6032 |
+
"icon" : "glyphicon glyphicon-leaf",
|
6033 |
+
*/
|
6034 |
+
"action" : function (data) {
|
6035 |
+
var inst = $.jstree.reference(data.reference),
|
6036 |
+
obj = inst.get_node(data.reference);
|
6037 |
+
inst.edit(obj);
|
6038 |
+
}
|
6039 |
+
},
|
6040 |
+
"remove" : {
|
6041 |
+
"separator_before" : false,
|
6042 |
+
"icon" : false,
|
6043 |
+
"separator_after" : false,
|
6044 |
+
"_disabled" : false, //(this.check("delete_node", data.reference, this.get_parent(data.reference), "")),
|
6045 |
+
"label" : "Delete",
|
6046 |
+
"action" : function (data) {
|
6047 |
+
var inst = $.jstree.reference(data.reference),
|
6048 |
+
obj = inst.get_node(data.reference);
|
6049 |
+
if(inst.is_selected(obj)) {
|
6050 |
+
inst.delete_node(inst.get_selected());
|
6051 |
+
}
|
6052 |
+
else {
|
6053 |
+
inst.delete_node(obj);
|
6054 |
+
}
|
6055 |
+
}
|
6056 |
+
},
|
6057 |
+
"ccp" : {
|
6058 |
+
"separator_before" : true,
|
6059 |
+
"icon" : false,
|
6060 |
+
"separator_after" : false,
|
6061 |
+
"label" : "Edit",
|
6062 |
+
"action" : false,
|
6063 |
+
"submenu" : {
|
6064 |
+
"cut" : {
|
6065 |
+
"separator_before" : false,
|
6066 |
+
"separator_after" : false,
|
6067 |
+
"label" : "Cut",
|
6068 |
+
"action" : function (data) {
|
6069 |
+
var inst = $.jstree.reference(data.reference),
|
6070 |
+
obj = inst.get_node(data.reference);
|
6071 |
+
if(inst.is_selected(obj)) {
|
6072 |
+
inst.cut(inst.get_top_selected());
|
6073 |
+
}
|
6074 |
+
else {
|
6075 |
+
inst.cut(obj);
|
6076 |
+
}
|
6077 |
+
}
|
6078 |
+
},
|
6079 |
+
"copy" : {
|
6080 |
+
"separator_before" : false,
|
6081 |
+
"icon" : false,
|
6082 |
+
"separator_after" : false,
|
6083 |
+
"label" : "Copy",
|
6084 |
+
"action" : function (data) {
|
6085 |
+
var inst = $.jstree.reference(data.reference),
|
6086 |
+
obj = inst.get_node(data.reference);
|
6087 |
+
if(inst.is_selected(obj)) {
|
6088 |
+
inst.copy(inst.get_top_selected());
|
6089 |
+
}
|
6090 |
+
else {
|
6091 |
+
inst.copy(obj);
|
6092 |
+
}
|
6093 |
+
}
|
6094 |
+
},
|
6095 |
+
"paste" : {
|
6096 |
+
"separator_before" : false,
|
6097 |
+
"icon" : false,
|
6098 |
+
"_disabled" : function (data) {
|
6099 |
+
return !$.jstree.reference(data.reference).can_paste();
|
6100 |
+
},
|
6101 |
+
"separator_after" : false,
|
6102 |
+
"label" : "Paste",
|
6103 |
+
"action" : function (data) {
|
6104 |
+
var inst = $.jstree.reference(data.reference),
|
6105 |
+
obj = inst.get_node(data.reference);
|
6106 |
+
inst.paste(obj);
|
6107 |
+
}
|
6108 |
+
}
|
6109 |
+
}
|
6110 |
+
}
|
6111 |
+
};
|
6112 |
+
}
|
6113 |
+
};
|
6114 |
+
|
6115 |
+
$.jstree.plugins.contextmenu = function (options, parent) {
|
6116 |
+
this.bind = function () {
|
6117 |
+
parent.bind.call(this);
|
6118 |
+
|
6119 |
+
var last_ts = 0, cto = null, ex, ey;
|
6120 |
+
this.element
|
6121 |
+
.on("init.jstree loading.jstree ready.jstree", $.proxy(function () {
|
6122 |
+
this.get_container_ul().addClass('jstree-contextmenu');
|
6123 |
+
}, this))
|
6124 |
+
.on("contextmenu.jstree", ".jstree-anchor", $.proxy(function (e, data) {
|
6125 |
+
if (e.target.tagName.toLowerCase() === 'input') {
|
6126 |
+
return;
|
6127 |
+
}
|
6128 |
+
e.preventDefault();
|
6129 |
+
last_ts = e.ctrlKey ? +new Date() : 0;
|
6130 |
+
if(data || cto) {
|
6131 |
+
last_ts = (+new Date()) + 10000;
|
6132 |
+
}
|
6133 |
+
if(cto) {
|
6134 |
+
clearTimeout(cto);
|
6135 |
+
}
|
6136 |
+
if(!this.is_loading(e.currentTarget)) {
|
6137 |
+
this.show_contextmenu(e.currentTarget, e.pageX, e.pageY, e);
|
6138 |
+
}
|
6139 |
+
}, this))
|
6140 |
+
.on("click.jstree", ".jstree-anchor", $.proxy(function (e) {
|
6141 |
+
if(this._data.contextmenu.visible && (!last_ts || (+new Date()) - last_ts > 250)) { // work around safari & macOS ctrl+click
|
6142 |
+
$.vakata.context.hide();
|
6143 |
+
}
|
6144 |
+
last_ts = 0;
|
6145 |
+
}, this))
|
6146 |
+
.on("touchstart.jstree", ".jstree-anchor", function (e) {
|
6147 |
+
if(!e.originalEvent || !e.originalEvent.changedTouches || !e.originalEvent.changedTouches[0]) {
|
6148 |
+
return;
|
6149 |
+
}
|
6150 |
+
ex = e.originalEvent.changedTouches[0].clientX;
|
6151 |
+
ey = e.originalEvent.changedTouches[0].clientY;
|
6152 |
+
cto = setTimeout(function () {
|
6153 |
+
$(e.currentTarget).trigger('contextmenu', true);
|
6154 |
+
}, 750);
|
6155 |
+
})
|
6156 |
+
.on('touchmove.vakata.jstree', function (e) {
|
6157 |
+
if(cto && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0] && (Math.abs(ex - e.originalEvent.changedTouches[0].clientX) > 10 || Math.abs(ey - e.originalEvent.changedTouches[0].clientY) > 10)) {
|
6158 |
+
clearTimeout(cto);
|
6159 |
+
$.vakata.context.hide();
|
6160 |
+
}
|
6161 |
+
})
|
6162 |
+
.on('touchend.vakata.jstree', function (e) {
|
6163 |
+
if(cto) {
|
6164 |
+
clearTimeout(cto);
|
6165 |
+
}
|
6166 |
+
});
|
6167 |
+
|
6168 |
+
/*!
|
6169 |
+
if(!('oncontextmenu' in document.body) && ('ontouchstart' in document.body)) {
|
6170 |
+
var el = null, tm = null;
|
6171 |
+
this.element
|
6172 |
+
.on("touchstart", ".jstree-anchor", function (e) {
|
6173 |
+
el = e.currentTarget;
|
6174 |
+
tm = +new Date();
|
6175 |
+
$(document).one("touchend", function (e) {
|
6176 |
+
e.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset);
|
6177 |
+
e.currentTarget = e.target;
|
6178 |
+
tm = ((+(new Date())) - tm);
|
6179 |
+
if(e.target === el && tm > 600 && tm < 1000) {
|
6180 |
+
e.preventDefault();
|
6181 |
+
$(el).trigger('contextmenu', e);
|
6182 |
+
}
|
6183 |
+
el = null;
|
6184 |
+
tm = null;
|
6185 |
+
});
|
6186 |
+
});
|
6187 |
+
}
|
6188 |
+
*/
|
6189 |
+
$(document).on("context_hide.vakata.jstree", $.proxy(function (e, data) {
|
6190 |
+
this._data.contextmenu.visible = false;
|
6191 |
+
$(data.reference).removeClass('jstree-context');
|
6192 |
+
}, this));
|
6193 |
+
};
|
6194 |
+
this.teardown = function () {
|
6195 |
+
if(this._data.contextmenu.visible) {
|
6196 |
+
$.vakata.context.hide();
|
6197 |
+
}
|
6198 |
+
parent.teardown.call(this);
|
6199 |
+
};
|
6200 |
+
|
6201 |
+
/**
|
6202 |
+
* prepare and show the context menu for a node
|
6203 |
+
* @name show_contextmenu(obj [, x, y])
|
6204 |
+
* @param {mixed} obj the node
|
6205 |
+
* @param {Number} x the x-coordinate relative to the document to show the menu at
|
6206 |
+
* @param {Number} y the y-coordinate relative to the document to show the menu at
|
6207 |
+
* @param {Object} e the event if available that triggered the contextmenu
|
6208 |
+
* @plugin contextmenu
|
6209 |
+
* @trigger show_contextmenu.jstree
|
6210 |
+
*/
|
6211 |
+
this.show_contextmenu = function (obj, x, y, e) {
|
6212 |
+
obj = this.get_node(obj);
|
6213 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
6214 |
+
var s = this.settings.contextmenu,
|
6215 |
+
d = this.get_node(obj, true),
|
6216 |
+
a = d.children(".jstree-anchor"),
|
6217 |
+
o = false,
|
6218 |
+
i = false;
|
6219 |
+
if(s.show_at_node || x === undefined || y === undefined) {
|
6220 |
+
o = a.offset();
|
6221 |
+
x = o.left;
|
6222 |
+
y = o.top + this._data.core.li_height;
|
6223 |
+
}
|
6224 |
+
if(this.settings.contextmenu.select_node && !this.is_selected(obj)) {
|
6225 |
+
this.activate_node(obj, e);
|
6226 |
+
}
|
6227 |
+
|
6228 |
+
i = s.items;
|
6229 |
+
if($.isFunction(i)) {
|
6230 |
+
i = i.call(this, obj, $.proxy(function (i) {
|
6231 |
+
this._show_contextmenu(obj, x, y, i);
|
6232 |
+
}, this));
|
6233 |
+
}
|
6234 |
+
if($.isPlainObject(i)) {
|
6235 |
+
this._show_contextmenu(obj, x, y, i);
|
6236 |
+
}
|
6237 |
+
};
|
6238 |
+
/**
|
6239 |
+
* show the prepared context menu for a node
|
6240 |
+
* @name _show_contextmenu(obj, x, y, i)
|
6241 |
+
* @param {mixed} obj the node
|
6242 |
+
* @param {Number} x the x-coordinate relative to the document to show the menu at
|
6243 |
+
* @param {Number} y the y-coordinate relative to the document to show the menu at
|
6244 |
+
* @param {Number} i the object of items to show
|
6245 |
+
* @plugin contextmenu
|
6246 |
+
* @trigger show_contextmenu.jstree
|
6247 |
+
* @private
|
6248 |
+
*/
|
6249 |
+
this._show_contextmenu = function (obj, x, y, i) {
|
6250 |
+
var d = this.get_node(obj, true),
|
6251 |
+
a = d.children(".jstree-anchor");
|
6252 |
+
$(document).one("context_show.vakata.jstree", $.proxy(function (e, data) {
|
6253 |
+
var cls = 'jstree-contextmenu jstree-' + this.get_theme() + '-contextmenu';
|
6254 |
+
$(data.element).addClass(cls);
|
6255 |
+
a.addClass('jstree-context');
|
6256 |
+
}, this));
|
6257 |
+
this._data.contextmenu.visible = true;
|
6258 |
+
$.vakata.context.show(a, { 'x' : x, 'y' : y }, i);
|
6259 |
+
/**
|
6260 |
+
* triggered when the contextmenu is shown for a node
|
6261 |
+
* @event
|
6262 |
+
* @name show_contextmenu.jstree
|
6263 |
+
* @param {Object} node the node
|
6264 |
+
* @param {Number} x the x-coordinate of the menu relative to the document
|
6265 |
+
* @param {Number} y the y-coordinate of the menu relative to the document
|
6266 |
+
* @plugin contextmenu
|
6267 |
+
*/
|
6268 |
+
this.trigger('show_contextmenu', { "node" : obj, "x" : x, "y" : y });
|
6269 |
+
};
|
6270 |
+
};
|
6271 |
+
|
6272 |
+
// contextmenu helper
|
6273 |
+
(function ($) {
|
6274 |
+
var right_to_left = false,
|
6275 |
+
vakata_context = {
|
6276 |
+
element : false,
|
6277 |
+
reference : false,
|
6278 |
+
position_x : 0,
|
6279 |
+
position_y : 0,
|
6280 |
+
items : [],
|
6281 |
+
html : "",
|
6282 |
+
is_visible : false
|
6283 |
+
};
|
6284 |
+
|
6285 |
+
$.vakata.context = {
|
6286 |
+
settings : {
|
6287 |
+
hide_onmouseleave : 0,
|
6288 |
+
icons : true
|
6289 |
+
},
|
6290 |
+
_trigger : function (event_name) {
|
6291 |
+
$(document).triggerHandler("context_" + event_name + ".vakata", {
|
6292 |
+
"reference" : vakata_context.reference,
|
6293 |
+
"element" : vakata_context.element,
|
6294 |
+
"position" : {
|
6295 |
+
"x" : vakata_context.position_x,
|
6296 |
+
"y" : vakata_context.position_y
|
6297 |
+
}
|
6298 |
+
});
|
6299 |
+
},
|
6300 |
+
_execute : function (i) {
|
6301 |
+
i = vakata_context.items[i];
|
6302 |
+
return i && (!i._disabled || ($.isFunction(i._disabled) && !i._disabled({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }))) && i.action ? i.action.call(null, {
|
6303 |
+
"item" : i,
|
6304 |
+
"reference" : vakata_context.reference,
|
6305 |
+
"element" : vakata_context.element,
|
6306 |
+
"position" : {
|
6307 |
+
"x" : vakata_context.position_x,
|
6308 |
+
"y" : vakata_context.position_y
|
6309 |
+
}
|
6310 |
+
}) : false;
|
6311 |
+
},
|
6312 |
+
_parse : function (o, is_callback) {
|
6313 |
+
if(!o) { return false; }
|
6314 |
+
if(!is_callback) {
|
6315 |
+
vakata_context.html = "";
|
6316 |
+
vakata_context.items = [];
|
6317 |
+
}
|
6318 |
+
var str = "",
|
6319 |
+
sep = false,
|
6320 |
+
tmp;
|
6321 |
+
|
6322 |
+
if(is_callback) { str += "<"+"ul>"; }
|
6323 |
+
$.each(o, function (i, val) {
|
6324 |
+
if(!val) { return true; }
|
6325 |
+
vakata_context.items.push(val);
|
6326 |
+
if(!sep && val.separator_before) {
|
6327 |
+
str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>";
|
6328 |
+
}
|
6329 |
+
sep = false;
|
6330 |
+
str += "<"+"li class='" + (val._class || "") + (val._disabled === true || ($.isFunction(val._disabled) && val._disabled({ "item" : val, "reference" : vakata_context.reference, "element" : vakata_context.element })) ? " vakata-contextmenu-disabled " : "") + "' "+(val.shortcut?" data-shortcut='"+val.shortcut+"' ":'')+">";
|
6331 |
+
str += "<"+"a href='#' rel='" + (vakata_context.items.length - 1) + "' " + (val.title ? "title='" + val.title + "'" : "") + ">";
|
6332 |
+
if($.vakata.context.settings.icons) {
|
6333 |
+
str += "<"+"i ";
|
6334 |
+
if(val.icon) {
|
6335 |
+
if(val.icon.indexOf("/") !== -1 || val.icon.indexOf(".") !== -1) { str += " style='background:url(\"" + val.icon + "\") center center no-repeat' "; }
|
6336 |
+
else { str += " class='" + val.icon + "' "; }
|
6337 |
+
}
|
6338 |
+
str += "><"+"/i><"+"span class='vakata-contextmenu-sep'> <"+"/span>";
|
6339 |
+
}
|
6340 |
+
str += ($.isFunction(val.label) ? val.label({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }) : val.label) + (val.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+val.shortcut+'">'+ (val.shortcut_label || '') +'</span>':'') + "<"+"/a>";
|
6341 |
+
if(val.submenu) {
|
6342 |
+
tmp = $.vakata.context._parse(val.submenu, true);
|
6343 |
+
if(tmp) { str += tmp; }
|
6344 |
+
}
|
6345 |
+
str += "<"+"/li>";
|
6346 |
+
if(val.separator_after) {
|
6347 |
+
str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>";
|
6348 |
+
sep = true;
|
6349 |
+
}
|
6350 |
+
});
|
6351 |
+
str = str.replace(/<li class\='vakata-context-separator'\><\/li\>$/,"");
|
6352 |
+
if(is_callback) { str += "</ul>"; }
|
6353 |
+
/**
|
6354 |
+
* triggered on the document when the contextmenu is parsed (HTML is built)
|
6355 |
+
* @event
|
6356 |
+
* @plugin contextmenu
|
6357 |
+
* @name context_parse.vakata
|
6358 |
+
* @param {jQuery} reference the element that was right clicked
|
6359 |
+
* @param {jQuery} element the DOM element of the menu itself
|
6360 |
+
* @param {Object} position the x & y coordinates of the menu
|
6361 |
+
*/
|
6362 |
+
if(!is_callback) { vakata_context.html = str; $.vakata.context._trigger("parse"); }
|
6363 |
+
return str.length > 10 ? str : false;
|
6364 |
+
},
|
6365 |
+
_show_submenu : function (o) {
|
6366 |
+
o = $(o);
|
6367 |
+
if(!o.length || !o.children("ul").length) { return; }
|
6368 |
+
var e = o.children("ul"),
|
6369 |
+
xl = o.offset().left,
|
6370 |
+
x = xl + o.outerWidth(),
|
6371 |
+
y = o.offset().top,
|
6372 |
+
w = e.width(),
|
6373 |
+
h = e.height(),
|
6374 |
+
dw = $(window).width() + $(window).scrollLeft(),
|
6375 |
+
dh = $(window).height() + $(window).scrollTop();
|
6376 |
+
// може да се спести е една проверка - дали няма някой от класовете вече нагоре
|
6377 |
+
if(right_to_left) {
|
6378 |
+
o[x - (w + 10 + o.outerWidth()) < 0 ? "addClass" : "removeClass"]("vakata-context-left");
|
6379 |
+
}
|
6380 |
+
else {
|
6381 |
+
o[x + w > dw && xl > dw - x ? "addClass" : "removeClass"]("vakata-context-right");
|
6382 |
+
}
|
6383 |
+
if(y + h + 10 > dh) {
|
6384 |
+
e.css("bottom","-1px");
|
6385 |
+
}
|
6386 |
+
|
6387 |
+
//if does not fit - stick it to the side
|
6388 |
+
if (o.hasClass('vakata-context-right')) {
|
6389 |
+
if (xl < w) {
|
6390 |
+
e.css("margin-right", xl - w);
|
6391 |
+
}
|
6392 |
+
} else {
|
6393 |
+
if (dw - x < w) {
|
6394 |
+
e.css("margin-left", dw - x - w);
|
6395 |
+
}
|
6396 |
+
}
|
6397 |
+
|
6398 |
+
e.show();
|
6399 |
+
},
|
6400 |
+
show : function (reference, position, data) {
|
6401 |
+
var o, e, x, y, w, h, dw, dh, cond = true;
|
6402 |
+
if(vakata_context.element && vakata_context.element.length) {
|
6403 |
+
vakata_context.element.width('');
|
6404 |
+
}
|
6405 |
+
switch(cond) {
|
6406 |
+
case (!position && !reference):
|
6407 |
+
return false;
|
6408 |
+
case (!!position && !!reference):
|
6409 |
+
vakata_context.reference = reference;
|
6410 |
+
vakata_context.position_x = position.x;
|
6411 |
+
vakata_context.position_y = position.y;
|
6412 |
+
break;
|
6413 |
+
case (!position && !!reference):
|
6414 |
+
vakata_context.reference = reference;
|
6415 |
+
o = reference.offset();
|
6416 |
+
vakata_context.position_x = o.left + reference.outerHeight();
|
6417 |
+
vakata_context.position_y = o.top;
|
6418 |
+
break;
|
6419 |
+
case (!!position && !reference):
|
6420 |
+
vakata_context.position_x = position.x;
|
6421 |
+
vakata_context.position_y = position.y;
|
6422 |
+
break;
|
6423 |
+
}
|
6424 |
+
if(!!reference && !data && $(reference).data('vakata_contextmenu')) {
|
6425 |
+
data = $(reference).data('vakata_contextmenu');
|
6426 |
+
}
|
6427 |
+
if($.vakata.context._parse(data)) {
|
6428 |
+
vakata_context.element.html(vakata_context.html);
|
6429 |
+
}
|
6430 |
+
if(vakata_context.items.length) {
|
6431 |
+
vakata_context.element.appendTo(document.body);
|
6432 |
+
e = vakata_context.element;
|
6433 |
+
x = vakata_context.position_x;
|
6434 |
+
y = vakata_context.position_y;
|
6435 |
+
w = e.width();
|
6436 |
+
h = e.height();
|
6437 |
+
dw = $(window).width() + $(window).scrollLeft();
|
6438 |
+
dh = $(window).height() + $(window).scrollTop();
|
6439 |
+
if(right_to_left) {
|
6440 |
+
x -= (e.outerWidth() - $(reference).outerWidth());
|
6441 |
+
if(x < $(window).scrollLeft() + 20) {
|
6442 |
+
x = $(window).scrollLeft() + 20;
|
6443 |
+
}
|
6444 |
+
}
|
6445 |
+
if(x + w + 20 > dw) {
|
6446 |
+
x = dw - (w + 20);
|
6447 |
+
}
|
6448 |
+
if(y + h + 20 > dh) {
|
6449 |
+
y = dh - (h + 20);
|
6450 |
+
}
|
6451 |
+
|
6452 |
+
vakata_context.element
|
6453 |
+
.css({ "left" : x, "top" : y })
|
6454 |
+
.show()
|
6455 |
+
.find('a').first().focus().parent().addClass("vakata-context-hover");
|
6456 |
+
vakata_context.is_visible = true;
|
6457 |
+
/**
|
6458 |
+
* triggered on the document when the contextmenu is shown
|
6459 |
+
* @event
|
6460 |
+
* @plugin contextmenu
|
6461 |
+
* @name context_show.vakata
|
6462 |
+
* @param {jQuery} reference the element that was right clicked
|
6463 |
+
* @param {jQuery} element the DOM element of the menu itself
|
6464 |
+
* @param {Object} position the x & y coordinates of the menu
|
6465 |
+
*/
|
6466 |
+
$.vakata.context._trigger("show");
|
6467 |
+
}
|
6468 |
+
},
|
6469 |
+
hide : function () {
|
6470 |
+
if(vakata_context.is_visible) {
|
6471 |
+
vakata_context.element.hide().find("ul").hide().end().find(':focus').blur().end().detach();
|
6472 |
+
vakata_context.is_visible = false;
|
6473 |
+
/**
|
6474 |
+
* triggered on the document when the contextmenu is hidden
|
6475 |
+
* @event
|
6476 |
+
* @plugin contextmenu
|
6477 |
+
* @name context_hide.vakata
|
6478 |
+
* @param {jQuery} reference the element that was right clicked
|
6479 |
+
* @param {jQuery} element the DOM element of the menu itself
|
6480 |
+
* @param {Object} position the x & y coordinates of the menu
|
6481 |
+
*/
|
6482 |
+
$.vakata.context._trigger("hide");
|
6483 |
+
}
|
6484 |
+
}
|
6485 |
+
};
|
6486 |
+
$(function () {
|
6487 |
+
right_to_left = $(document.body).css("direction") === "rtl";
|
6488 |
+
var to = false;
|
6489 |
+
|
6490 |
+
vakata_context.element = $("<ul class='vakata-context'></ul>");
|
6491 |
+
vakata_context.element
|
6492 |
+
.on("mouseenter", "li", function (e) {
|
6493 |
+
e.stopImmediatePropagation();
|
6494 |
+
|
6495 |
+
if($.contains(this, e.relatedTarget)) {
|
6496 |
+
// премахнато заради delegate mouseleave по-долу
|
6497 |
+
// $(this).find(".vakata-context-hover").removeClass("vakata-context-hover");
|
6498 |
+
return;
|
6499 |
+
}
|
6500 |
+
|
6501 |
+
if(to) { clearTimeout(to); }
|
6502 |
+
vakata_context.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end();
|
6503 |
+
|
6504 |
+
$(this)
|
6505 |
+
.siblings().find("ul").hide().end().end()
|
6506 |
+
.parentsUntil(".vakata-context", "li").addBack().addClass("vakata-context-hover");
|
6507 |
+
$.vakata.context._show_submenu(this);
|
6508 |
+
})
|
6509 |
+
// тестово - дали не натоварва?
|
6510 |
+
.on("mouseleave", "li", function (e) {
|
6511 |
+
if($.contains(this, e.relatedTarget)) { return; }
|
6512 |
+
$(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover");
|
6513 |
+
})
|
6514 |
+
.on("mouseleave", function (e) {
|
6515 |
+
$(this).find(".vakata-context-hover").removeClass("vakata-context-hover");
|
6516 |
+
if($.vakata.context.settings.hide_onmouseleave) {
|
6517 |
+
to = setTimeout(
|
6518 |
+
(function (t) {
|
6519 |
+
return function () { $.vakata.context.hide(); };
|
6520 |
+
}(this)), $.vakata.context.settings.hide_onmouseleave);
|
6521 |
+
}
|
6522 |
+
})
|
6523 |
+
.on("click", "a", function (e) {
|
6524 |
+
e.preventDefault();
|
6525 |
+
//})
|
6526 |
+
//.on("mouseup", "a", function (e) {
|
6527 |
+
if(!$(this).blur().parent().hasClass("vakata-context-disabled") && $.vakata.context._execute($(this).attr("rel")) !== false) {
|
6528 |
+
$.vakata.context.hide();
|
6529 |
+
}
|
6530 |
+
})
|
6531 |
+
.on('keydown', 'a', function (e) {
|
6532 |
+
var o = null;
|
6533 |
+
switch(e.which) {
|
6534 |
+
case 13:
|
6535 |
+
case 32:
|
6536 |
+
e.type = "click";
|
6537 |
+
e.preventDefault();
|
6538 |
+
$(e.currentTarget).trigger(e);
|
6539 |
+
break;
|
6540 |
+
case 37:
|
6541 |
+
if(vakata_context.is_visible) {
|
6542 |
+
vakata_context.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children('a').focus();
|
6543 |
+
e.stopImmediatePropagation();
|
6544 |
+
e.preventDefault();
|
6545 |
+
}
|
6546 |
+
break;
|
6547 |
+
case 38:
|
6548 |
+
if(vakata_context.is_visible) {
|
6549 |
+
o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first();
|
6550 |
+
if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last(); }
|
6551 |
+
o.addClass("vakata-context-hover").children('a').focus();
|
6552 |
+
e.stopImmediatePropagation();
|
6553 |
+
e.preventDefault();
|
6554 |
+
}
|
6555 |
+
break;
|
6556 |
+
case 39:
|
6557 |
+
if(vakata_context.is_visible) {
|
6558 |
+
vakata_context.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children('a').focus();
|
6559 |
+
e.stopImmediatePropagation();
|
6560 |
+
e.preventDefault();
|
6561 |
+
}
|
6562 |
+
break;
|
6563 |
+
case 40:
|
6564 |
+
if(vakata_context.is_visible) {
|
6565 |
+
o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first();
|
6566 |
+
if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first(); }
|
6567 |
+
o.addClass("vakata-context-hover").children('a').focus();
|
6568 |
+
e.stopImmediatePropagation();
|
6569 |
+
e.preventDefault();
|
6570 |
+
}
|
6571 |
+
break;
|
6572 |
+
case 27:
|
6573 |
+
$.vakata.context.hide();
|
6574 |
+
e.preventDefault();
|
6575 |
+
break;
|
6576 |
+
default:
|
6577 |
+
//console.log(e.which);
|
6578 |
+
break;
|
6579 |
+
}
|
6580 |
+
})
|
6581 |
+
.on('keydown', function (e) {
|
6582 |
+
e.preventDefault();
|
6583 |
+
var a = vakata_context.element.find('.vakata-contextmenu-shortcut-' + e.which).parent();
|
6584 |
+
if(a.parent().not('.vakata-context-disabled')) {
|
6585 |
+
a.click();
|
6586 |
+
}
|
6587 |
+
});
|
6588 |
+
|
6589 |
+
$(document)
|
6590 |
+
.on("mousedown.vakata.jstree", function (e) {
|
6591 |
+
if(vakata_context.is_visible && vakata_context.element[0] !== e.target && !$.contains(vakata_context.element[0], e.target)) {
|
6592 |
+
$.vakata.context.hide();
|
6593 |
+
}
|
6594 |
+
})
|
6595 |
+
.on("context_show.vakata.jstree", function (e, data) {
|
6596 |
+
vakata_context.element.find("li:has(ul)").children("a").addClass("vakata-context-parent");
|
6597 |
+
if(right_to_left) {
|
6598 |
+
vakata_context.element.addClass("vakata-context-rtl").css("direction", "rtl");
|
6599 |
+
}
|
6600 |
+
// also apply a RTL class?
|
6601 |
+
vakata_context.element.find("ul").hide().end();
|
6602 |
+
});
|
6603 |
+
});
|
6604 |
+
}($));
|
6605 |
+
// $.jstree.defaults.plugins.push("contextmenu");
|
6606 |
+
|
6607 |
+
|
6608 |
+
/**
|
6609 |
+
* ### Drag'n'drop plugin
|
6610 |
+
*
|
6611 |
+
* Enables dragging and dropping of nodes in the tree, resulting in a move or copy operations.
|
6612 |
+
*/
|
6613 |
+
|
6614 |
+
/**
|
6615 |
+
* stores all defaults for the drag'n'drop plugin
|
6616 |
+
* @name $.jstree.defaults.dnd
|
6617 |
+
* @plugin dnd
|
6618 |
+
*/
|
6619 |
+
$.jstree.defaults.dnd = {
|
6620 |
+
/**
|
6621 |
+
* a boolean indicating if a copy should be possible while dragging (by pressint the meta key or Ctrl). Defaults to `true`.
|
6622 |
+
* @name $.jstree.defaults.dnd.copy
|
6623 |
+
* @plugin dnd
|
6624 |
+
*/
|
6625 |
+
copy : true,
|
6626 |
+
/**
|
6627 |
+
* a number indicating how long a node should remain hovered while dragging to be opened. Defaults to `500`.
|
6628 |
+
* @name $.jstree.defaults.dnd.open_timeout
|
6629 |
+
* @plugin dnd
|
6630 |
+
*/
|
6631 |
+
open_timeout : 500,
|
6632 |
+
/**
|
6633 |
+
* a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the nodes about to be dragged as an argument (array) and the event that started the drag - return `false` to prevent dragging
|
6634 |
+
* @name $.jstree.defaults.dnd.is_draggable
|
6635 |
+
* @plugin dnd
|
6636 |
+
*/
|
6637 |
+
is_draggable : true,
|
6638 |
+
/**
|
6639 |
+
* a boolean indicating if checks should constantly be made while the user is dragging the node (as opposed to checking only on drop), default is `true`
|
6640 |
+
* @name $.jstree.defaults.dnd.check_while_dragging
|
6641 |
+
* @plugin dnd
|
6642 |
+
*/
|
6643 |
+
check_while_dragging : true,
|
6644 |
+
/**
|
6645 |
+
* a boolean indicating if nodes from this tree should only be copied with dnd (as opposed to moved), default is `false`
|
6646 |
+
* @name $.jstree.defaults.dnd.always_copy
|
6647 |
+
* @plugin dnd
|
6648 |
+
*/
|
6649 |
+
always_copy : false,
|
6650 |
+
/**
|
6651 |
+
* when dropping a node "inside", this setting indicates the position the node should go to - it can be an integer or a string: "first" (same as 0) or "last", default is `0`
|
6652 |
+
* @name $.jstree.defaults.dnd.inside_pos
|
6653 |
+
* @plugin dnd
|
6654 |
+
*/
|
6655 |
+
inside_pos : 0,
|
6656 |
+
/**
|
6657 |
+
* when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node
|
6658 |
+
* @name $.jstree.defaults.dnd.drag_selection
|
6659 |
+
* @plugin dnd
|
6660 |
+
*/
|
6661 |
+
drag_selection : true,
|
6662 |
+
/**
|
6663 |
+
* controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string "selected" which means only selected nodes can be dragged on touch devices.
|
6664 |
+
* @name $.jstree.defaults.dnd.touch
|
6665 |
+
* @plugin dnd
|
6666 |
+
*/
|
6667 |
+
touch : true,
|
6668 |
+
/**
|
6669 |
+
* controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target.
|
6670 |
+
* @name $.jstree.defaults.dnd.large_drop_target
|
6671 |
+
* @plugin dnd
|
6672 |
+
*/
|
6673 |
+
large_drop_target : false,
|
6674 |
+
/**
|
6675 |
+
* controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to "selected".
|
6676 |
+
* @name $.jstree.defaults.dnd.large_drag_target
|
6677 |
+
* @plugin dnd
|
6678 |
+
*/
|
6679 |
+
large_drag_target : false,
|
6680 |
+
/**
|
6681 |
+
* controls whether use HTML5 dnd api instead of classical. That will allow better integration of dnd events with other HTML5 controls.
|
6682 |
+
* @reference http://caniuse.com/#feat=dragndrop
|
6683 |
+
* @name $.jstree.defaults.dnd.use_html5
|
6684 |
+
* @plugin dnd
|
6685 |
+
*/
|
6686 |
+
use_html5: false
|
6687 |
+
};
|
6688 |
+
var drg, elm;
|
6689 |
+
// TODO: now check works by checking for each node individually, how about max_children, unique, etc?
|
6690 |
+
$.jstree.plugins.dnd = function (options, parent) {
|
6691 |
+
this.init = function (el, options) {
|
6692 |
+
parent.init.call(this, el, options);
|
6693 |
+
this.settings.dnd.use_html5 = this.settings.dnd.use_html5 && ('draggable' in document.createElement('span'));
|
6694 |
+
};
|
6695 |
+
this.bind = function () {
|
6696 |
+
parent.bind.call(this);
|
6697 |
+
|
6698 |
+
this.element
|
6699 |
+
.on(this.settings.dnd.use_html5 ? 'dragstart.jstree' : 'mousedown.jstree touchstart.jstree', this.settings.dnd.large_drag_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) {
|
6700 |
+
if(this.settings.dnd.large_drag_target && $(e.target).closest('.jstree-node')[0] !== e.currentTarget) {
|
6701 |
+
return true;
|
6702 |
+
}
|
6703 |
+
if(e.type === "touchstart" && (!this.settings.dnd.touch || (this.settings.dnd.touch === 'selected' && !$(e.currentTarget).closest('.jstree-node').children('.jstree-anchor').hasClass('jstree-clicked')))) {
|
6704 |
+
return true;
|
6705 |
+
}
|
6706 |
+
var obj = this.get_node(e.target),
|
6707 |
+
mlt = this.is_selected(obj) && this.settings.dnd.drag_selection ? this.get_top_selected().length : 1,
|
6708 |
+
txt = (mlt > 1 ? mlt + ' ' + this.get_string('nodes') : this.get_text(e.currentTarget));
|
6709 |
+
if(this.settings.core.force_text) {
|
6710 |
+
txt = $.vakata.html.escape(txt);
|
6711 |
+
}
|
6712 |
+
if(obj && obj.id && obj.id !== $.jstree.root && (e.which === 1 || e.type === "touchstart" || e.type === "dragstart") &&
|
6713 |
+
(this.settings.dnd.is_draggable === true || ($.isFunction(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_top_selected(true) : [obj]), e)))
|
6714 |
+
) {
|
6715 |
+
drg = { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_top_selected() : [obj.id] };
|
6716 |
+
elm = e.currentTarget;
|
6717 |
+
if (this.settings.dnd.use_html5) {
|
6718 |
+
$.vakata.dnd._trigger('start', e, { 'helper': $(), 'element': elm, 'data': drg });
|
6719 |
+
} else {
|
6720 |
+
this.element.trigger('mousedown.jstree');
|
6721 |
+
return $.vakata.dnd.start(e, drg, '<div id="jstree-dnd" class="jstree-' + this.get_theme() + ' jstree-' + this.get_theme() + '-' + this.get_theme_variant() + ' ' + ( this.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' ) + '"><i class="jstree-icon jstree-er"></i>' + txt + '<ins class="jstree-copy" style="display:none;">+</ins></div>');
|
6722 |
+
}
|
6723 |
+
}
|
6724 |
+
}, this));
|
6725 |
+
if (this.settings.dnd.use_html5) {
|
6726 |
+
this.element
|
6727 |
+
.on('dragover.jstree', function (e) {
|
6728 |
+
e.preventDefault();
|
6729 |
+
$.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg });
|
6730 |
+
return false;
|
6731 |
+
})
|
6732 |
+
//.on('dragenter.jstree', this.settings.dnd.large_drop_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) {
|
6733 |
+
// e.preventDefault();
|
6734 |
+
// $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg });
|
6735 |
+
// return false;
|
6736 |
+
// }, this))
|
6737 |
+
.on('drop.jstree', $.proxy(function (e) {
|
6738 |
+
e.preventDefault();
|
6739 |
+
$.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg });
|
6740 |
+
return false;
|
6741 |
+
}, this));
|
6742 |
+
}
|
6743 |
+
};
|
6744 |
+
this.redraw_node = function(obj, deep, callback, force_render) {
|
6745 |
+
obj = parent.redraw_node.apply(this, arguments);
|
6746 |
+
if (obj && this.settings.dnd.use_html5) {
|
6747 |
+
if (this.settings.dnd.large_drag_target) {
|
6748 |
+
obj.setAttribute('draggable', true);
|
6749 |
+
} else {
|
6750 |
+
var i, j, tmp = null;
|
6751 |
+
for(i = 0, j = obj.childNodes.length; i < j; i++) {
|
6752 |
+
if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) {
|
6753 |
+
tmp = obj.childNodes[i];
|
6754 |
+
break;
|
6755 |
+
}
|
6756 |
+
}
|
6757 |
+
if(tmp) {
|
6758 |
+
tmp.setAttribute('draggable', true);
|
6759 |
+
}
|
6760 |
+
}
|
6761 |
+
}
|
6762 |
+
return obj;
|
6763 |
+
};
|
6764 |
+
};
|
6765 |
+
|
6766 |
+
$(function() {
|
6767 |
+
// bind only once for all instances
|
6768 |
+
var lastmv = false,
|
6769 |
+
laster = false,
|
6770 |
+
lastev = false,
|
6771 |
+
opento = false,
|
6772 |
+
marker = $('<div id="jstree-marker"> </div>').hide(); //.appendTo('body');
|
6773 |
+
|
6774 |
+
$(document)
|
6775 |
+
.on('dragover.vakata.jstree', function (e) {
|
6776 |
+
if (elm) {
|
6777 |
+
$.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg });
|
6778 |
+
}
|
6779 |
+
})
|
6780 |
+
.on('drop.vakata.jstree', function (e) {
|
6781 |
+
if (elm) {
|
6782 |
+
$.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg });
|
6783 |
+
elm = null;
|
6784 |
+
drg = null;
|
6785 |
+
}
|
6786 |
+
})
|
6787 |
+
.on('dnd_start.vakata.jstree', function (e, data) {
|
6788 |
+
lastmv = false;
|
6789 |
+
lastev = false;
|
6790 |
+
if(!data || !data.data || !data.data.jstree) { return; }
|
6791 |
+
marker.appendTo(document.body); //.show();
|
6792 |
+
})
|
6793 |
+
.on('dnd_move.vakata.jstree', function (e, data) {
|
6794 |
+
var isDifferentNode = data.event.target !== lastev.target;
|
6795 |
+
if(opento) {
|
6796 |
+
if (!data.event || data.event.type !== 'dragover' || isDifferentNode) {
|
6797 |
+
clearTimeout(opento);
|
6798 |
+
}
|
6799 |
+
}
|
6800 |
+
if(!data || !data.data || !data.data.jstree) { return; }
|
6801 |
+
|
6802 |
+
// if we are hovering the marker image do nothing (can happen on "inside" drags)
|
6803 |
+
if(data.event.target.id && data.event.target.id === 'jstree-marker') {
|
6804 |
+
return;
|
6805 |
+
}
|
6806 |
+
lastev = data.event;
|
6807 |
+
|
6808 |
+
var ins = $.jstree.reference(data.event.target),
|
6809 |
+
ref = false,
|
6810 |
+
off = false,
|
6811 |
+
rel = false,
|
6812 |
+
tmp, l, t, h, p, i, o, ok, t1, t2, op, ps, pr, ip, tm, is_copy, pn;
|
6813 |
+
// if we are over an instance
|
6814 |
+
if(ins && ins._data && ins._data.dnd) {
|
6815 |
+
marker.attr('class', 'jstree-' + ins.get_theme() + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' ));
|
6816 |
+
is_copy = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey)));
|
6817 |
+
data.helper
|
6818 |
+
.children().attr('class', 'jstree-' + ins.get_theme() + ' jstree-' + ins.get_theme() + '-' + ins.get_theme_variant() + ' ' + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' ))
|
6819 |
+
.find('.jstree-copy').first()[ is_copy ? 'show' : 'hide' ]();
|
6820 |
+
|
6821 |
+
// if are hovering the container itself add a new root node
|
6822 |
+
//console.log(data.event);
|
6823 |
+
if( (data.event.target === ins.element[0] || data.event.target === ins.get_container_ul()[0]) && ins.get_container_ul().children().length === 0) {
|
6824 |
+
ok = true;
|
6825 |
+
for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) {
|
6826 |
+
ok = ok && ins.check( (data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey)) ) ? "copy_node" : "move_node"), (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), $.jstree.root, 'last', { 'dnd' : true, 'ref' : ins.get_node($.jstree.root), 'pos' : 'i', 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) });
|
6827 |
+
if(!ok) { break; }
|
6828 |
+
}
|
6829 |
+
if(ok) {
|
6830 |
+
lastmv = { 'ins' : ins, 'par' : $.jstree.root, 'pos' : 'last' };
|
6831 |
+
marker.hide();
|
6832 |
+
data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok');
|
6833 |
+
if (data.event.originalEvent && data.event.originalEvent.dataTransfer) {
|
6834 |
+
data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move';
|
6835 |
+
}
|
6836 |
+
return;
|
6837 |
+
}
|
6838 |
+
}
|
6839 |
+
else {
|
6840 |
+
// if we are hovering a tree node
|
6841 |
+
ref = ins.settings.dnd.large_drop_target ? $(data.event.target).closest('.jstree-node').children('.jstree-anchor') : $(data.event.target).closest('.jstree-anchor');
|
6842 |
+
if(ref && ref.length && ref.parent().is('.jstree-closed, .jstree-open, .jstree-leaf')) {
|
6843 |
+
off = ref.offset();
|
6844 |
+
rel = (data.event.pageY !== undefined ? data.event.pageY : data.event.originalEvent.pageY) - off.top;
|
6845 |
+
h = ref.outerHeight();
|
6846 |
+
if(rel < h / 3) {
|
6847 |
+
o = ['b', 'i', 'a'];
|
6848 |
+
}
|
6849 |
+
else if(rel > h - h / 3) {
|
6850 |
+
o = ['a', 'i', 'b'];
|
6851 |
+
}
|
6852 |
+
else {
|
6853 |
+
o = rel > h / 2 ? ['i', 'a', 'b'] : ['i', 'b', 'a'];
|
6854 |
+
}
|
6855 |
+
$.each(o, function (j, v) {
|
6856 |
+
switch(v) {
|
6857 |
+
case 'b':
|
6858 |
+
l = off.left - 6;
|
6859 |
+
t = off.top;
|
6860 |
+
p = ins.get_parent(ref);
|
6861 |
+
i = ref.parent().index();
|
6862 |
+
break;
|
6863 |
+
case 'i':
|
6864 |
+
ip = ins.settings.dnd.inside_pos;
|
6865 |
+
tm = ins.get_node(ref.parent());
|
6866 |
+
l = off.left - 2;
|
6867 |
+
t = off.top + h / 2 + 1;
|
6868 |
+
p = tm.id;
|
6869 |
+
i = ip === 'first' ? 0 : (ip === 'last' ? tm.children.length : Math.min(ip, tm.children.length));
|
6870 |
+
break;
|
6871 |
+
case 'a':
|
6872 |
+
l = off.left - 6;
|
6873 |
+
t = off.top + h;
|
6874 |
+
p = ins.get_parent(ref);
|
6875 |
+
i = ref.parent().index() + 1;
|
6876 |
+
break;
|
6877 |
+
}
|
6878 |
+
ok = true;
|
6879 |
+
for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) {
|
6880 |
+
op = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? "copy_node" : "move_node";
|
6881 |
+
ps = i;
|
6882 |
+
if(op === "move_node" && v === 'a' && (data.data.origin && data.data.origin === ins) && p === ins.get_parent(data.data.nodes[t1])) {
|
6883 |
+
pr = ins.get_node(p);
|
6884 |
+
if(ps > $.inArray(data.data.nodes[t1], pr.children)) {
|
6885 |
+
ps -= 1;
|
6886 |
+
}
|
6887 |
+
}
|
6888 |
+
ok = ok && ( (ins && ins.settings && ins.settings.dnd && ins.settings.dnd.check_while_dragging === false) || ins.check(op, (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), p, ps, { 'dnd' : true, 'ref' : ins.get_node(ref.parent()), 'pos' : v, 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }) );
|
6889 |
+
if(!ok) {
|
6890 |
+
if(ins && ins.last_error) { laster = ins.last_error(); }
|
6891 |
+
break;
|
6892 |
+
}
|
6893 |
+
}
|
6894 |
+
if(v === 'i' && ref.parent().is('.jstree-closed') && ins.settings.dnd.open_timeout) {
|
6895 |
+
if (!data.event || data.event.type !== 'dragover' || isDifferentNode) {
|
6896 |
+
if (opento) { clearTimeout(opento); }
|
6897 |
+
opento = setTimeout((function (x, z) { return function () { x.open_node(z); }; }(ins, ref)), ins.settings.dnd.open_timeout);
|
6898 |
+
}
|
6899 |
+
}
|
6900 |
+
if(ok) {
|
6901 |
+
pn = ins.get_node(p, true);
|
6902 |
+
if (!pn.hasClass('.jstree-dnd-parent')) {
|
6903 |
+
$('.jstree-dnd-parent').removeClass('jstree-dnd-parent');
|
6904 |
+
pn.addClass('jstree-dnd-parent');
|
6905 |
+
}
|
6906 |
+
lastmv = { 'ins' : ins, 'par' : p, 'pos' : v === 'i' && ip === 'last' && i === 0 && !ins.is_loaded(tm) ? 'last' : i };
|
6907 |
+
marker.css({ 'left' : l + 'px', 'top' : t + 'px' }).show();
|
6908 |
+
data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok');
|
6909 |
+
if (data.event.originalEvent && data.event.originalEvent.dataTransfer) {
|
6910 |
+
data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move';
|
6911 |
+
}
|
6912 |
+
laster = {};
|
6913 |
+
o = true;
|
6914 |
+
return false;
|
6915 |
+
}
|
6916 |
+
});
|
6917 |
+
if(o === true) { return; }
|
6918 |
+
}
|
6919 |
+
}
|
6920 |
+
}
|
6921 |
+
$('.jstree-dnd-parent').removeClass('jstree-dnd-parent');
|
6922 |
+
lastmv = false;
|
6923 |
+
data.helper.find('.jstree-icon').removeClass('jstree-ok').addClass('jstree-er');
|
6924 |
+
if (data.event.originalEvent && data.event.originalEvent.dataTransfer) {
|
6925 |
+
//data.event.originalEvent.dataTransfer.dropEffect = 'none';
|
6926 |
+
}
|
6927 |
+
marker.hide();
|
6928 |
+
})
|
6929 |
+
.on('dnd_scroll.vakata.jstree', function (e, data) {
|
6930 |
+
if(!data || !data.data || !data.data.jstree) { return; }
|
6931 |
+
marker.hide();
|
6932 |
+
lastmv = false;
|
6933 |
+
lastev = false;
|
6934 |
+
data.helper.find('.jstree-icon').first().removeClass('jstree-ok').addClass('jstree-er');
|
6935 |
+
})
|
6936 |
+
.on('dnd_stop.vakata.jstree', function (e, data) {
|
6937 |
+
$('.jstree-dnd-parent').removeClass('jstree-dnd-parent');
|
6938 |
+
if(opento) { clearTimeout(opento); }
|
6939 |
+
if(!data || !data.data || !data.data.jstree) { return; }
|
6940 |
+
marker.hide().detach();
|
6941 |
+
var i, j, nodes = [];
|
6942 |
+
if(lastmv) {
|
6943 |
+
for(i = 0, j = data.data.nodes.length; i < j; i++) {
|
6944 |
+
nodes[i] = data.data.origin ? data.data.origin.get_node(data.data.nodes[i]) : data.data.nodes[i];
|
6945 |
+
}
|
6946 |
+
lastmv.ins[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? 'copy_node' : 'move_node' ](nodes, lastmv.par, lastmv.pos, false, false, false, data.data.origin);
|
6947 |
+
}
|
6948 |
+
else {
|
6949 |
+
i = $(data.event.target).closest('.jstree');
|
6950 |
+
if(i.length && laster && laster.error && laster.error === 'check') {
|
6951 |
+
i = i.jstree(true);
|
6952 |
+
if(i) {
|
6953 |
+
i.settings.core.error.call(this, laster);
|
6954 |
+
}
|
6955 |
+
}
|
6956 |
+
}
|
6957 |
+
lastev = false;
|
6958 |
+
lastmv = false;
|
6959 |
+
})
|
6960 |
+
.on('keyup.jstree keydown.jstree', function (e, data) {
|
6961 |
+
data = $.vakata.dnd._get();
|
6962 |
+
if(data && data.data && data.data.jstree) {
|
6963 |
+
if (e.type === "keyup" && e.which === 27) {
|
6964 |
+
if (opento) { clearTimeout(opento); }
|
6965 |
+
lastmv = false;
|
6966 |
+
laster = false;
|
6967 |
+
lastev = false;
|
6968 |
+
opento = false;
|
6969 |
+
marker.hide().detach();
|
6970 |
+
$.vakata.dnd._clean();
|
6971 |
+
} else {
|
6972 |
+
data.helper.find('.jstree-copy').first()[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (e.metaKey || e.ctrlKey))) ? 'show' : 'hide' ]();
|
6973 |
+
if(lastev) {
|
6974 |
+
lastev.metaKey = e.metaKey;
|
6975 |
+
lastev.ctrlKey = e.ctrlKey;
|
6976 |
+
$.vakata.dnd._trigger('move', lastev);
|
6977 |
+
}
|
6978 |
+
}
|
6979 |
+
}
|
6980 |
+
});
|
6981 |
+
});
|
6982 |
+
|
6983 |
+
// helpers
|
6984 |
+
(function ($) {
|
6985 |
+
$.vakata.html = {
|
6986 |
+
div : $('<div />'),
|
6987 |
+
escape : function (str) {
|
6988 |
+
return $.vakata.html.div.text(str).html();
|
6989 |
+
},
|
6990 |
+
strip : function (str) {
|
6991 |
+
return $.vakata.html.div.empty().append($.parseHTML(str)).text();
|
6992 |
+
}
|
6993 |
+
};
|
6994 |
+
// private variable
|
6995 |
+
var vakata_dnd = {
|
6996 |
+
element : false,
|
6997 |
+
target : false,
|
6998 |
+
is_down : false,
|
6999 |
+
is_drag : false,
|
7000 |
+
helper : false,
|
7001 |
+
helper_w: 0,
|
7002 |
+
data : false,
|
7003 |
+
init_x : 0,
|
7004 |
+
init_y : 0,
|
7005 |
+
scroll_l: 0,
|
7006 |
+
scroll_t: 0,
|
7007 |
+
scroll_e: false,
|
7008 |
+
scroll_i: false,
|
7009 |
+
is_touch: false
|
7010 |
+
};
|
7011 |
+
$.vakata.dnd = {
|
7012 |
+
settings : {
|
7013 |
+
scroll_speed : 10,
|
7014 |
+
scroll_proximity : 20,
|
7015 |
+
helper_left : 5,
|
7016 |
+
helper_top : 10,
|
7017 |
+
threshold : 5,
|
7018 |
+
threshold_touch : 10
|
7019 |
+
},
|
7020 |
+
_trigger : function (event_name, e, data) {
|
7021 |
+
if (data === undefined) {
|
7022 |
+
data = $.vakata.dnd._get();
|
7023 |
+
}
|
7024 |
+
data.event = e;
|
7025 |
+
$(document).triggerHandler("dnd_" + event_name + ".vakata", data);
|
7026 |
+
},
|
7027 |
+
_get : function () {
|
7028 |
+
return {
|
7029 |
+
"data" : vakata_dnd.data,
|
7030 |
+
"element" : vakata_dnd.element,
|
7031 |
+
"helper" : vakata_dnd.helper
|
7032 |
+
};
|
7033 |
+
},
|
7034 |
+
_clean : function () {
|
7035 |
+
if(vakata_dnd.helper) { vakata_dnd.helper.remove(); }
|
7036 |
+
if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; }
|
7037 |
+
vakata_dnd = {
|
7038 |
+
element : false,
|
7039 |
+
target : false,
|
7040 |
+
is_down : false,
|
7041 |
+
is_drag : false,
|
7042 |
+
helper : false,
|
7043 |
+
helper_w: 0,
|
7044 |
+
data : false,
|
7045 |
+
init_x : 0,
|
7046 |
+
init_y : 0,
|
7047 |
+
scroll_l: 0,
|
7048 |
+
scroll_t: 0,
|
7049 |
+
scroll_e: false,
|
7050 |
+
scroll_i: false,
|
7051 |
+
is_touch: false
|
7052 |
+
};
|
7053 |
+
$(document).off("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag);
|
7054 |
+
$(document).off("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop);
|
7055 |
+
},
|
7056 |
+
_scroll : function (init_only) {
|
7057 |
+
if(!vakata_dnd.scroll_e || (!vakata_dnd.scroll_l && !vakata_dnd.scroll_t)) {
|
7058 |
+
if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; }
|
7059 |
+
return false;
|
7060 |
+
}
|
7061 |
+
if(!vakata_dnd.scroll_i) {
|
7062 |
+
vakata_dnd.scroll_i = setInterval($.vakata.dnd._scroll, 100);
|
7063 |
+
return false;
|
7064 |
+
}
|
7065 |
+
if(init_only === true) { return false; }
|
7066 |
+
|
7067 |
+
var i = vakata_dnd.scroll_e.scrollTop(),
|
7068 |
+
j = vakata_dnd.scroll_e.scrollLeft();
|
7069 |
+
vakata_dnd.scroll_e.scrollTop(i + vakata_dnd.scroll_t * $.vakata.dnd.settings.scroll_speed);
|
7070 |
+
vakata_dnd.scroll_e.scrollLeft(j + vakata_dnd.scroll_l * $.vakata.dnd.settings.scroll_speed);
|
7071 |
+
if(i !== vakata_dnd.scroll_e.scrollTop() || j !== vakata_dnd.scroll_e.scrollLeft()) {
|
7072 |
+
/**
|
7073 |
+
* triggered on the document when a drag causes an element to scroll
|
7074 |
+
* @event
|
7075 |
+
* @plugin dnd
|
7076 |
+
* @name dnd_scroll.vakata
|
7077 |
+
* @param {Mixed} data any data supplied with the call to $.vakata.dnd.start
|
7078 |
+
* @param {DOM} element the DOM element being dragged
|
7079 |
+
* @param {jQuery} helper the helper shown next to the mouse
|
7080 |
+
* @param {jQuery} event the element that is scrolling
|
7081 |
+
*/
|
7082 |
+
$.vakata.dnd._trigger("scroll", vakata_dnd.scroll_e);
|
7083 |
+
}
|
7084 |
+
},
|
7085 |
+
start : function (e, data, html) {
|
7086 |
+
if(e.type === "touchstart" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) {
|
7087 |
+
e.pageX = e.originalEvent.changedTouches[0].pageX;
|
7088 |
+
e.pageY = e.originalEvent.changedTouches[0].pageY;
|
7089 |
+
e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset);
|
7090 |
+
}
|
7091 |
+
if(vakata_dnd.is_drag) { $.vakata.dnd.stop({}); }
|
7092 |
+
try {
|
7093 |
+
e.currentTarget.unselectable = "on";
|
7094 |
+
e.currentTarget.onselectstart = function() { return false; };
|
7095 |
+
if(e.currentTarget.style) {
|
7096 |
+
e.currentTarget.style.touchAction = "none";
|
7097 |
+
e.currentTarget.style.msTouchAction = "none";
|
7098 |
+
e.currentTarget.style.MozUserSelect = "none";
|
7099 |
+
}
|
7100 |
+
} catch(ignore) { }
|
7101 |
+
vakata_dnd.init_x = e.pageX;
|
7102 |
+
vakata_dnd.init_y = e.pageY;
|
7103 |
+
vakata_dnd.data = data;
|
7104 |
+
vakata_dnd.is_down = true;
|
7105 |
+
vakata_dnd.element = e.currentTarget;
|
7106 |
+
vakata_dnd.target = e.target;
|
7107 |
+
vakata_dnd.is_touch = e.type === "touchstart";
|
7108 |
+
if(html !== false) {
|
7109 |
+
vakata_dnd.helper = $("<div id='vakata-dnd'></div>").html(html).css({
|
7110 |
+
"display" : "block",
|
7111 |
+
"margin" : "0",
|
7112 |
+
"padding" : "0",
|
7113 |
+
"position" : "absolute",
|
7114 |
+
"top" : "-2000px",
|
7115 |
+
"lineHeight" : "16px",
|
7116 |
+
"zIndex" : "10000"
|
7117 |
+
});
|
7118 |
+
}
|
7119 |
+
$(document).on("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag);
|
7120 |
+
$(document).on("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop);
|
7121 |
+
return false;
|
7122 |
+
},
|
7123 |
+
drag : function (e) {
|
7124 |
+
if(e.type === "touchmove" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) {
|
7125 |
+
e.pageX = e.originalEvent.changedTouches[0].pageX;
|
7126 |
+
e.pageY = e.originalEvent.changedTouches[0].pageY;
|
7127 |
+
e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset);
|
7128 |
+
}
|
7129 |
+
if(!vakata_dnd.is_down) { return; }
|
7130 |
+
if(!vakata_dnd.is_drag) {
|
7131 |
+
if(
|
7132 |
+
Math.abs(e.pageX - vakata_dnd.init_x) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) ||
|
7133 |
+
Math.abs(e.pageY - vakata_dnd.init_y) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold)
|
7134 |
+
) {
|
7135 |
+
if(vakata_dnd.helper) {
|
7136 |
+
vakata_dnd.helper.appendTo(document.body);
|
7137 |
+
vakata_dnd.helper_w = vakata_dnd.helper.outerWidth();
|
7138 |
+
}
|
7139 |
+
vakata_dnd.is_drag = true;
|
7140 |
+
$(vakata_dnd.target).one('click.vakata', false);
|
7141 |
+
/**
|
7142 |
+
* triggered on the document when a drag starts
|
7143 |
+
* @event
|
7144 |
+
* @plugin dnd
|
7145 |
+
* @name dnd_start.vakata
|
7146 |
+
* @param {Mixed} data any data supplied with the call to $.vakata.dnd.start
|
7147 |
+
* @param {DOM} element the DOM element being dragged
|
7148 |
+
* @param {jQuery} helper the helper shown next to the mouse
|
7149 |
+
* @param {Object} event the event that caused the start (probably mousemove)
|
7150 |
+
*/
|
7151 |
+
$.vakata.dnd._trigger("start", e);
|
7152 |
+
}
|
7153 |
+
else { return; }
|
7154 |
+
}
|
7155 |
+
|
7156 |
+
var d = false, w = false,
|
7157 |
+
dh = false, wh = false,
|
7158 |
+
dw = false, ww = false,
|
7159 |
+
dt = false, dl = false,
|
7160 |
+
ht = false, hl = false;
|
7161 |
+
|
7162 |
+
vakata_dnd.scroll_t = 0;
|
7163 |
+
vakata_dnd.scroll_l = 0;
|
7164 |
+
vakata_dnd.scroll_e = false;
|
7165 |
+
$($(e.target).parentsUntil("body").addBack().get().reverse())
|
7166 |
+
.filter(function () {
|
7167 |
+
return (/^auto|scroll$/).test($(this).css("overflow")) &&
|
7168 |
+
(this.scrollHeight > this.offsetHeight || this.scrollWidth > this.offsetWidth);
|
7169 |
+
})
|
7170 |
+
.each(function () {
|
7171 |
+
var t = $(this), o = t.offset();
|
7172 |
+
if(this.scrollHeight > this.offsetHeight) {
|
7173 |
+
if(o.top + t.height() - e.pageY < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; }
|
7174 |
+
if(e.pageY - o.top < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; }
|
7175 |
+
}
|
7176 |
+
if(this.scrollWidth > this.offsetWidth) {
|
7177 |
+
if(o.left + t.width() - e.pageX < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; }
|
7178 |
+
if(e.pageX - o.left < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; }
|
7179 |
+
}
|
7180 |
+
if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) {
|
7181 |
+
vakata_dnd.scroll_e = $(this);
|
7182 |
+
return false;
|
7183 |
+
}
|
7184 |
+
});
|
7185 |
+
|
7186 |
+
if(!vakata_dnd.scroll_e) {
|
7187 |
+
d = $(document); w = $(window);
|
7188 |
+
dh = d.height(); wh = w.height();
|
7189 |
+
dw = d.width(); ww = w.width();
|
7190 |
+
dt = d.scrollTop(); dl = d.scrollLeft();
|
7191 |
+
if(dh > wh && e.pageY - dt < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; }
|
7192 |
+
if(dh > wh && wh - (e.pageY - dt) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; }
|
7193 |
+
if(dw > ww && e.pageX - dl < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; }
|
7194 |
+
if(dw > ww && ww - (e.pageX - dl) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; }
|
7195 |
+
if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) {
|
7196 |
+
vakata_dnd.scroll_e = d;
|
7197 |
+
}
|
7198 |
+
}
|
7199 |
+
if(vakata_dnd.scroll_e) { $.vakata.dnd._scroll(true); }
|
7200 |
+
|
7201 |
+
if(vakata_dnd.helper) {
|
7202 |
+
ht = parseInt(e.pageY + $.vakata.dnd.settings.helper_top, 10);
|
7203 |
+
hl = parseInt(e.pageX + $.vakata.dnd.settings.helper_left, 10);
|
7204 |
+
if(dh && ht + 25 > dh) { ht = dh - 50; }
|
7205 |
+
if(dw && hl + vakata_dnd.helper_w > dw) { hl = dw - (vakata_dnd.helper_w + 2); }
|
7206 |
+
vakata_dnd.helper.css({
|
7207 |
+
left : hl + "px",
|
7208 |
+
top : ht + "px"
|
7209 |
+
});
|
7210 |
+
}
|
7211 |
+
/**
|
7212 |
+
* triggered on the document when a drag is in progress
|
7213 |
+
* @event
|
7214 |
+
* @plugin dnd
|
7215 |
+
* @name dnd_move.vakata
|
7216 |
+
* @param {Mixed} data any data supplied with the call to $.vakata.dnd.start
|
7217 |
+
* @param {DOM} element the DOM element being dragged
|
7218 |
+
* @param {jQuery} helper the helper shown next to the mouse
|
7219 |
+
* @param {Object} event the event that caused this to trigger (most likely mousemove)
|
7220 |
+
*/
|
7221 |
+
$.vakata.dnd._trigger("move", e);
|
7222 |
+
return false;
|
7223 |
+
},
|
7224 |
+
stop : function (e) {
|
7225 |
+
if(e.type === "touchend" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) {
|
7226 |
+
e.pageX = e.originalEvent.changedTouches[0].pageX;
|
7227 |
+
e.pageY = e.originalEvent.changedTouches[0].pageY;
|
7228 |
+
e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset);
|
7229 |
+
}
|
7230 |
+
if(vakata_dnd.is_drag) {
|
7231 |
+
/**
|
7232 |
+
* triggered on the document when a drag stops (the dragged element is dropped)
|
7233 |
+
* @event
|
7234 |
+
* @plugin dnd
|
7235 |
+
* @name dnd_stop.vakata
|
7236 |
+
* @param {Mixed} data any data supplied with the call to $.vakata.dnd.start
|
7237 |
+
* @param {DOM} element the DOM element being dragged
|
7238 |
+
* @param {jQuery} helper the helper shown next to the mouse
|
7239 |
+
* @param {Object} event the event that caused the stop
|
7240 |
+
*/
|
7241 |
+
if (e.target !== vakata_dnd.target) {
|
7242 |
+
$(vakata_dnd.target).off('click.vakata');
|
7243 |
+
}
|
7244 |
+
$.vakata.dnd._trigger("stop", e);
|
7245 |
+
}
|
7246 |
+
else {
|
7247 |
+
if(e.type === "touchend" && e.target === vakata_dnd.target) {
|
7248 |
+
var to = setTimeout(function () { $(e.target).click(); }, 100);
|
7249 |
+
$(e.target).one('click', function() { if(to) { clearTimeout(to); } });
|
7250 |
+
}
|
7251 |
+
}
|
7252 |
+
$.vakata.dnd._clean();
|
7253 |
+
return false;
|
7254 |
+
}
|
7255 |
+
};
|
7256 |
+
}($));
|
7257 |
+
|
7258 |
+
// include the dnd plugin by default
|
7259 |
+
// $.jstree.defaults.plugins.push("dnd");
|
7260 |
+
|
7261 |
+
|
7262 |
+
/**
|
7263 |
+
* ### Massload plugin
|
7264 |
+
*
|
7265 |
+
* Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading).
|
7266 |
+
*/
|
7267 |
+
|
7268 |
+
/**
|
7269 |
+
* massload configuration
|
7270 |
+
*
|
7271 |
+
* It is possible to set this to a standard jQuery-like AJAX config.
|
7272 |
+
* In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used.
|
7273 |
+
*
|
7274 |
+
* You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result.
|
7275 |
+
*
|
7276 |
+
* Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array.
|
7277 |
+
*
|
7278 |
+
* {
|
7279 |
+
* "id1" : [{ "text" : "Child of ID1", "id" : "c1" }, { "text" : "Another child of ID1", "id" : "c2" }],
|
7280 |
+
* "id2" : [{ "text" : "Child of ID2", "id" : "c3" }]
|
7281 |
+
* }
|
7282 |
+
*
|
7283 |
+
* @name $.jstree.defaults.massload
|
7284 |
+
* @plugin massload
|
7285 |
+
*/
|
7286 |
+
$.jstree.defaults.massload = null;
|
7287 |
+
$.jstree.plugins.massload = function (options, parent) {
|
7288 |
+
this.init = function (el, options) {
|
7289 |
+
this._data.massload = {};
|
7290 |
+
parent.init.call(this, el, options);
|
7291 |
+
};
|
7292 |
+
this._load_nodes = function (nodes, callback, is_callback, force_reload) {
|
7293 |
+
var s = this.settings.massload,
|
7294 |
+
nodesString = JSON.stringify(nodes),
|
7295 |
+
toLoad = [],
|
7296 |
+
m = this._model.data,
|
7297 |
+
i, j, dom;
|
7298 |
+
if (!is_callback) {
|
7299 |
+
for(i = 0, j = nodes.length; i < j; i++) {
|
7300 |
+
if(!m[nodes[i]] || ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || force_reload) ) {
|
7301 |
+
toLoad.push(nodes[i]);
|
7302 |
+
dom = this.get_node(nodes[i], true);
|
7303 |
+
if (dom && dom.length) {
|
7304 |
+
dom.addClass("jstree-loading").attr('aria-busy',true);
|
7305 |
+
}
|
7306 |
+
}
|
7307 |
+
}
|
7308 |
+
this._data.massload = {};
|
7309 |
+
if (toLoad.length) {
|
7310 |
+
if($.isFunction(s)) {
|
7311 |
+
return s.call(this, toLoad, $.proxy(function (data) {
|
7312 |
+
var i, j;
|
7313 |
+
if(data) {
|
7314 |
+
for(i in data) {
|
7315 |
+
if(data.hasOwnProperty(i)) {
|
7316 |
+
this._data.massload[i] = data[i];
|
7317 |
+
}
|
7318 |
+
}
|
7319 |
+
}
|
7320 |
+
for(i = 0, j = nodes.length; i < j; i++) {
|
7321 |
+
dom = this.get_node(nodes[i], true);
|
7322 |
+
if (dom && dom.length) {
|
7323 |
+
dom.removeClass("jstree-loading").attr('aria-busy',false);
|
7324 |
+
}
|
7325 |
+
}
|
7326 |
+
parent._load_nodes.call(this, nodes, callback, is_callback, force_reload);
|
7327 |
+
}, this));
|
7328 |
+
}
|
7329 |
+
if(typeof s === 'object' && s && s.url) {
|
7330 |
+
s = $.extend(true, {}, s);
|
7331 |
+
if($.isFunction(s.url)) {
|
7332 |
+
s.url = s.url.call(this, toLoad);
|
7333 |
+
}
|
7334 |
+
if($.isFunction(s.data)) {
|
7335 |
+
s.data = s.data.call(this, toLoad);
|
7336 |
+
}
|
7337 |
+
return $.ajax(s)
|
7338 |
+
.done($.proxy(function (data,t,x) {
|
7339 |
+
var i, j;
|
7340 |
+
if(data) {
|
7341 |
+
for(i in data) {
|
7342 |
+
if(data.hasOwnProperty(i)) {
|
7343 |
+
this._data.massload[i] = data[i];
|
7344 |
+
}
|
7345 |
+
}
|
7346 |
+
}
|
7347 |
+
for(i = 0, j = nodes.length; i < j; i++) {
|
7348 |
+
dom = this.get_node(nodes[i], true);
|
7349 |
+
if (dom && dom.length) {
|
7350 |
+
dom.removeClass("jstree-loading").attr('aria-busy',false);
|
7351 |
+
}
|
7352 |
+
}
|
7353 |
+
parent._load_nodes.call(this, nodes, callback, is_callback, force_reload);
|
7354 |
+
}, this))
|
7355 |
+
.fail($.proxy(function (f) {
|
7356 |
+
parent._load_nodes.call(this, nodes, callback, is_callback, force_reload);
|
7357 |
+
}, this));
|
7358 |
+
}
|
7359 |
+
}
|
7360 |
+
}
|
7361 |
+
return parent._load_nodes.call(this, nodes, callback, is_callback, force_reload);
|
7362 |
+
};
|
7363 |
+
this._load_node = function (obj, callback) {
|
7364 |
+
var data = this._data.massload[obj.id],
|
7365 |
+
rslt = null, dom;
|
7366 |
+
if(data) {
|
7367 |
+
rslt = this[typeof data === 'string' ? '_append_html_data' : '_append_json_data'](
|
7368 |
+
obj,
|
7369 |
+
typeof data === 'string' ? $($.parseHTML(data)).filter(function () { return this.nodeType !== 3; }) : data,
|
7370 |
+
function (status) { callback.call(this, status); }
|
7371 |
+
);
|
7372 |
+
dom = this.get_node(obj.id, true);
|
7373 |
+
if (dom && dom.length) {
|
7374 |
+
dom.removeClass("jstree-loading").attr('aria-busy',false);
|
7375 |
+
}
|
7376 |
+
delete this._data.massload[obj.id];
|
7377 |
+
return rslt;
|
7378 |
+
}
|
7379 |
+
return parent._load_node.call(this, obj, callback);
|
7380 |
+
};
|
7381 |
+
};
|
7382 |
+
|
7383 |
+
/**
|
7384 |
+
* ### Search plugin
|
7385 |
+
*
|
7386 |
+
* Adds search functionality to jsTree.
|
7387 |
+
*/
|
7388 |
+
|
7389 |
+
/**
|
7390 |
+
* stores all defaults for the search plugin
|
7391 |
+
* @name $.jstree.defaults.search
|
7392 |
+
* @plugin search
|
7393 |
+
*/
|
7394 |
+
$.jstree.defaults.search = {
|
7395 |
+
/**
|
7396 |
+
* a jQuery-like AJAX config, which jstree uses if a server should be queried for results.
|
7397 |
+
*
|
7398 |
+
* A `str` (which is the search string) parameter will be added with the request, an optional `inside` parameter will be added if the search is limited to a node id. The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed.
|
7399 |
+
* Leave this setting as `false` to not query the server. You can also set this to a function, which will be invoked in the instance's scope and receive 3 parameters - the search string, the callback to call with the array of nodes to load, and the optional node ID to limit the search to
|
7400 |
+
* @name $.jstree.defaults.search.ajax
|
7401 |
+
* @plugin search
|
7402 |
+
*/
|
7403 |
+
ajax : false,
|
7404 |
+
/**
|
7405 |
+
* Indicates if the search should be fuzzy or not (should `chnd3` match `child node 3`). Default is `false`.
|
7406 |
+
* @name $.jstree.defaults.search.fuzzy
|
7407 |
+
* @plugin search
|
7408 |
+
*/
|
7409 |
+
fuzzy : false,
|
7410 |
+
/**
|
7411 |
+
* Indicates if the search should be case sensitive. Default is `false`.
|
7412 |
+
* @name $.jstree.defaults.search.case_sensitive
|
7413 |
+
* @plugin search
|
7414 |
+
*/
|
7415 |
+
case_sensitive : false,
|
7416 |
+
/**
|
7417 |
+
* Indicates if the tree should be filtered (by default) to show only matching nodes (keep in mind this can be a heavy on large trees in old browsers).
|
7418 |
+
* This setting can be changed at runtime when calling the search method. Default is `false`.
|
7419 |
+
* @name $.jstree.defaults.search.show_only_matches
|
7420 |
+
* @plugin search
|
7421 |
+
*/
|
7422 |
+
show_only_matches : false,
|
7423 |
+
/**
|
7424 |
+
* Indicates if the children of matched element are shown (when show_only_matches is true)
|
7425 |
+
* This setting can be changed at runtime when calling the search method. Default is `false`.
|
7426 |
+
* @name $.jstree.defaults.search.show_only_matches_children
|
7427 |
+
* @plugin search
|
7428 |
+
*/
|
7429 |
+
show_only_matches_children : false,
|
7430 |
+
/**
|
7431 |
+
* Indicates if all nodes opened to reveal the search result, should be closed when the search is cleared or a new search is performed. Default is `true`.
|
7432 |
+
* @name $.jstree.defaults.search.close_opened_onclear
|
7433 |
+
* @plugin search
|
7434 |
+
*/
|
7435 |
+
close_opened_onclear : true,
|
7436 |
+
/**
|
7437 |
+
* Indicates if only leaf nodes should be included in search results. Default is `false`.
|
7438 |
+
* @name $.jstree.defaults.search.search_leaves_only
|
7439 |
+
* @plugin search
|
7440 |
+
*/
|
7441 |
+
search_leaves_only : false,
|
7442 |
+
/**
|
7443 |
+
* If set to a function it wil be called in the instance's scope with two arguments - search string and node (where node will be every node in the structure, so use with caution).
|
7444 |
+
* If the function returns a truthy value the node will be considered a match (it might not be displayed if search_only_leaves is set to true and the node is not a leaf). Default is `false`.
|
7445 |
+
* @name $.jstree.defaults.search.search_callback
|
7446 |
+
* @plugin search
|
7447 |
+
*/
|
7448 |
+
search_callback : false
|
7449 |
+
};
|
7450 |
+
|
7451 |
+
$.jstree.plugins.search = function (options, parent) {
|
7452 |
+
this.bind = function () {
|
7453 |
+
parent.bind.call(this);
|
7454 |
+
|
7455 |
+
this._data.search.str = "";
|
7456 |
+
this._data.search.dom = $();
|
7457 |
+
this._data.search.res = [];
|
7458 |
+
this._data.search.opn = [];
|
7459 |
+
this._data.search.som = false;
|
7460 |
+
this._data.search.smc = false;
|
7461 |
+
this._data.search.hdn = [];
|
7462 |
+
|
7463 |
+
this.element
|
7464 |
+
.on("search.jstree", $.proxy(function (e, data) {
|
7465 |
+
if(this._data.search.som && data.res.length) {
|
7466 |
+
var m = this._model.data, i, j, p = [], k, l;
|
7467 |
+
for(i = 0, j = data.res.length; i < j; i++) {
|
7468 |
+
if(m[data.res[i]] && !m[data.res[i]].state.hidden) {
|
7469 |
+
p.push(data.res[i]);
|
7470 |
+
p = p.concat(m[data.res[i]].parents);
|
7471 |
+
if(this._data.search.smc) {
|
7472 |
+
for (k = 0, l = m[data.res[i]].children_d.length; k < l; k++) {
|
7473 |
+
if (m[m[data.res[i]].children_d[k]] && !m[m[data.res[i]].children_d[k]].state.hidden) {
|
7474 |
+
p.push(m[data.res[i]].children_d[k]);
|
7475 |
+
}
|
7476 |
+
}
|
7477 |
+
}
|
7478 |
+
}
|
7479 |
+
}
|
7480 |
+
p = $.vakata.array_remove_item($.vakata.array_unique(p), $.jstree.root);
|
7481 |
+
this._data.search.hdn = this.hide_all(true);
|
7482 |
+
this.show_node(p, true);
|
7483 |
+
this.redraw(true);
|
7484 |
+
}
|
7485 |
+
}, this))
|
7486 |
+
.on("clear_search.jstree", $.proxy(function (e, data) {
|
7487 |
+
if(this._data.search.som && data.res.length) {
|
7488 |
+
this.show_node(this._data.search.hdn, true);
|
7489 |
+
this.redraw(true);
|
7490 |
+
}
|
7491 |
+
}, this));
|
7492 |
+
};
|
7493 |
+
/**
|
7494 |
+
* used to search the tree nodes for a given string
|
7495 |
+
* @name search(str [, skip_async])
|
7496 |
+
* @param {String} str the search string
|
7497 |
+
* @param {Boolean} skip_async if set to true server will not be queried even if configured
|
7498 |
+
* @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers)
|
7499 |
+
* @param {mixed} inside an optional node to whose children to limit the search
|
7500 |
+
* @param {Boolean} append if set to true the results of this search are appended to the previous search
|
7501 |
+
* @plugin search
|
7502 |
+
* @trigger search.jstree
|
7503 |
+
*/
|
7504 |
+
this.search = function (str, skip_async, show_only_matches, inside, append, show_only_matches_children) {
|
7505 |
+
if(str === false || $.trim(str.toString()) === "") {
|
7506 |
+
return this.clear_search();
|
7507 |
+
}
|
7508 |
+
inside = this.get_node(inside);
|
7509 |
+
inside = inside && inside.id ? inside.id : null;
|
7510 |
+
str = str.toString();
|
7511 |
+
var s = this.settings.search,
|
7512 |
+
a = s.ajax ? s.ajax : false,
|
7513 |
+
m = this._model.data,
|
7514 |
+
f = null,
|
7515 |
+
r = [],
|
7516 |
+
p = [], i, j;
|
7517 |
+
if(this._data.search.res.length && !append) {
|
7518 |
+
this.clear_search();
|
7519 |
+
}
|
7520 |
+
if(show_only_matches === undefined) {
|
7521 |
+
show_only_matches = s.show_only_matches;
|
7522 |
+
}
|
7523 |
+
if(show_only_matches_children === undefined) {
|
7524 |
+
show_only_matches_children = s.show_only_matches_children;
|
7525 |
+
}
|
7526 |
+
if(!skip_async && a !== false) {
|
7527 |
+
if($.isFunction(a)) {
|
7528 |
+
return a.call(this, str, $.proxy(function (d) {
|
7529 |
+
if(d && d.d) { d = d.d; }
|
7530 |
+
this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () {
|
7531 |
+
this.search(str, true, show_only_matches, inside, append, show_only_matches_children);
|
7532 |
+
});
|
7533 |
+
}, this), inside);
|
7534 |
+
}
|
7535 |
+
else {
|
7536 |
+
a = $.extend({}, a);
|
7537 |
+
if(!a.data) { a.data = {}; }
|
7538 |
+
a.data.str = str;
|
7539 |
+
if(inside) {
|
7540 |
+
a.data.inside = inside;
|
7541 |
+
}
|
7542 |
+
if (this._data.search.lastRequest) {
|
7543 |
+
this._data.search.lastRequest.abort();
|
7544 |
+
}
|
7545 |
+
this._data.search.lastRequest = $.ajax(a)
|
7546 |
+
.fail($.proxy(function () {
|
7547 |
+
this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'search', 'id' : 'search_01', 'reason' : 'Could not load search parents', 'data' : JSON.stringify(a) };
|
7548 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
7549 |
+
}, this))
|
7550 |
+
.done($.proxy(function (d) {
|
7551 |
+
if(d && d.d) { d = d.d; }
|
7552 |
+
this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () {
|
7553 |
+
this.search(str, true, show_only_matches, inside, append, show_only_matches_children);
|
7554 |
+
});
|
7555 |
+
}, this));
|
7556 |
+
return this._data.search.lastRequest;
|
7557 |
+
}
|
7558 |
+
}
|
7559 |
+
if(!append) {
|
7560 |
+
this._data.search.str = str;
|
7561 |
+
this._data.search.dom = $();
|
7562 |
+
this._data.search.res = [];
|
7563 |
+
this._data.search.opn = [];
|
7564 |
+
this._data.search.som = show_only_matches;
|
7565 |
+
this._data.search.smc = show_only_matches_children;
|
7566 |
+
}
|
7567 |
+
|
7568 |
+
f = new $.vakata.search(str, true, { caseSensitive : s.case_sensitive, fuzzy : s.fuzzy });
|
7569 |
+
$.each(m[inside ? inside : $.jstree.root].children_d, function (ii, i) {
|
7570 |
+
var v = m[i];
|
7571 |
+
if(v.text && !v.state.hidden && (!s.search_leaves_only || (v.state.loaded && v.children.length === 0)) && ( (s.search_callback && s.search_callback.call(this, str, v)) || (!s.search_callback && f.search(v.text).isMatch) ) ) {
|
7572 |
+
r.push(i);
|
7573 |
+
p = p.concat(v.parents);
|
7574 |
+
}
|
7575 |
+
});
|
7576 |
+
if(r.length) {
|
7577 |
+
p = $.vakata.array_unique(p);
|
7578 |
+
for(i = 0, j = p.length; i < j; i++) {
|
7579 |
+
if(p[i] !== $.jstree.root && m[p[i]] && this.open_node(p[i], null, 0) === true) {
|
7580 |
+
this._data.search.opn.push(p[i]);
|
7581 |
+
}
|
7582 |
+
}
|
7583 |
+
if(!append) {
|
7584 |
+
this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #')));
|
7585 |
+
this._data.search.res = r;
|
7586 |
+
}
|
7587 |
+
else {
|
7588 |
+
this._data.search.dom = this._data.search.dom.add($(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #'))));
|
7589 |
+
this._data.search.res = $.vakata.array_unique(this._data.search.res.concat(r));
|
7590 |
+
}
|
7591 |
+
this._data.search.dom.children(".jstree-anchor").addClass('jstree-search');
|
7592 |
+
}
|
7593 |
+
/**
|
7594 |
+
* triggered after search is complete
|
7595 |
+
* @event
|
7596 |
+
* @name search.jstree
|
7597 |
+
* @param {jQuery} nodes a jQuery collection of matching nodes
|
7598 |
+
* @param {String} str the search string
|
7599 |
+
* @param {Array} res a collection of objects represeing the matching nodes
|
7600 |
+
* @plugin search
|
7601 |
+
*/
|
7602 |
+
this.trigger('search', { nodes : this._data.search.dom, str : str, res : this._data.search.res, show_only_matches : show_only_matches });
|
7603 |
+
};
|
7604 |
+
/**
|
7605 |
+
* used to clear the last search (removes classes and shows all nodes if filtering is on)
|
7606 |
+
* @name clear_search()
|
7607 |
+
* @plugin search
|
7608 |
+
* @trigger clear_search.jstree
|
7609 |
+
*/
|
7610 |
+
this.clear_search = function () {
|
7611 |
+
if(this.settings.search.close_opened_onclear) {
|
7612 |
+
this.close_node(this._data.search.opn, 0);
|
7613 |
+
}
|
7614 |
+
/**
|
7615 |
+
* triggered after search is complete
|
7616 |
+
* @event
|
7617 |
+
* @name clear_search.jstree
|
7618 |
+
* @param {jQuery} nodes a jQuery collection of matching nodes (the result from the last search)
|
7619 |
+
* @param {String} str the search string (the last search string)
|
7620 |
+
* @param {Array} res a collection of objects represeing the matching nodes (the result from the last search)
|
7621 |
+
* @plugin search
|
7622 |
+
*/
|
7623 |
+
this.trigger('clear_search', { 'nodes' : this._data.search.dom, str : this._data.search.str, res : this._data.search.res });
|
7624 |
+
if(this._data.search.res.length) {
|
7625 |
+
this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(this._data.search.res, function (v) {
|
7626 |
+
return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&');
|
7627 |
+
}).join(', #')));
|
7628 |
+
this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search");
|
7629 |
+
}
|
7630 |
+
this._data.search.str = "";
|
7631 |
+
this._data.search.res = [];
|
7632 |
+
this._data.search.opn = [];
|
7633 |
+
this._data.search.dom = $();
|
7634 |
+
};
|
7635 |
+
|
7636 |
+
this.redraw_node = function(obj, deep, callback, force_render) {
|
7637 |
+
obj = parent.redraw_node.apply(this, arguments);
|
7638 |
+
if(obj) {
|
7639 |
+
if($.inArray(obj.id, this._data.search.res) !== -1) {
|
7640 |
+
var i, j, tmp = null;
|
7641 |
+
for(i = 0, j = obj.childNodes.length; i < j; i++) {
|
7642 |
+
if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) {
|
7643 |
+
tmp = obj.childNodes[i];
|
7644 |
+
break;
|
7645 |
+
}
|
7646 |
+
}
|
7647 |
+
if(tmp) {
|
7648 |
+
tmp.className += ' jstree-search';
|
7649 |
+
}
|
7650 |
+
}
|
7651 |
+
}
|
7652 |
+
return obj;
|
7653 |
+
};
|
7654 |
+
};
|
7655 |
+
|
7656 |
+
// helpers
|
7657 |
+
(function ($) {
|
7658 |
+
// from http://kiro.me/projects/fuse.html
|
7659 |
+
$.vakata.search = function(pattern, txt, options) {
|
7660 |
+
options = options || {};
|
7661 |
+
options = $.extend({}, $.vakata.search.defaults, options);
|
7662 |
+
if(options.fuzzy !== false) {
|
7663 |
+
options.fuzzy = true;
|
7664 |
+
}
|
7665 |
+
pattern = options.caseSensitive ? pattern : pattern.toLowerCase();
|
7666 |
+
var MATCH_LOCATION = options.location,
|
7667 |
+
MATCH_DISTANCE = options.distance,
|
7668 |
+
MATCH_THRESHOLD = options.threshold,
|
7669 |
+
patternLen = pattern.length,
|
7670 |
+
matchmask, pattern_alphabet, match_bitapScore, search;
|
7671 |
+
if(patternLen > 32) {
|
7672 |
+
options.fuzzy = false;
|
7673 |
+
}
|
7674 |
+
if(options.fuzzy) {
|
7675 |
+
matchmask = 1 << (patternLen - 1);
|
7676 |
+
pattern_alphabet = (function () {
|
7677 |
+
var mask = {},
|
7678 |
+
i = 0;
|
7679 |
+
for (i = 0; i < patternLen; i++) {
|
7680 |
+
mask[pattern.charAt(i)] = 0;
|
7681 |
+
}
|
7682 |
+
for (i = 0; i < patternLen; i++) {
|
7683 |
+
mask[pattern.charAt(i)] |= 1 << (patternLen - i - 1);
|
7684 |
+
}
|
7685 |
+
return mask;
|
7686 |
+
}());
|
7687 |
+
match_bitapScore = function (e, x) {
|
7688 |
+
var accuracy = e / patternLen,
|
7689 |
+
proximity = Math.abs(MATCH_LOCATION - x);
|
7690 |
+
if(!MATCH_DISTANCE) {
|
7691 |
+
return proximity ? 1.0 : accuracy;
|
7692 |
+
}
|
7693 |
+
return accuracy + (proximity / MATCH_DISTANCE);
|
7694 |
+
};
|
7695 |
+
}
|
7696 |
+
search = function (text) {
|
7697 |
+
text = options.caseSensitive ? text : text.toLowerCase();
|
7698 |
+
if(pattern === text || text.indexOf(pattern) !== -1) {
|
7699 |
+
return {
|
7700 |
+
isMatch: true,
|
7701 |
+
score: 0
|
7702 |
+
};
|
7703 |
+
}
|
7704 |
+
if(!options.fuzzy) {
|
7705 |
+
return {
|
7706 |
+
isMatch: false,
|
7707 |
+
score: 1
|
7708 |
+
};
|
7709 |
+
}
|
7710 |
+
var i, j,
|
7711 |
+
textLen = text.length,
|
7712 |
+
scoreThreshold = MATCH_THRESHOLD,
|
7713 |
+
bestLoc = text.indexOf(pattern, MATCH_LOCATION),
|
7714 |
+
binMin, binMid,
|
7715 |
+
binMax = patternLen + textLen,
|
7716 |
+
lastRd, start, finish, rd, charMatch,
|
7717 |
+
score = 1,
|
7718 |
+
locations = [];
|
7719 |
+
if (bestLoc !== -1) {
|
7720 |
+
scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold);
|
7721 |
+
bestLoc = text.lastIndexOf(pattern, MATCH_LOCATION + patternLen);
|
7722 |
+
if (bestLoc !== -1) {
|
7723 |
+
scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold);
|
7724 |
+
}
|
7725 |
+
}
|
7726 |
+
bestLoc = -1;
|
7727 |
+
for (i = 0; i < patternLen; i++) {
|
7728 |
+
binMin = 0;
|
7729 |
+
binMid = binMax;
|
7730 |
+
while (binMin < binMid) {
|
7731 |
+
if (match_bitapScore(i, MATCH_LOCATION + binMid) <= scoreThreshold) {
|
7732 |
+
binMin = binMid;
|
7733 |
+
} else {
|
7734 |
+
binMax = binMid;
|
7735 |
+
}
|
7736 |
+
binMid = Math.floor((binMax - binMin) / 2 + binMin);
|
7737 |
+
}
|
7738 |
+
binMax = binMid;
|
7739 |
+
start = Math.max(1, MATCH_LOCATION - binMid + 1);
|
7740 |
+
finish = Math.min(MATCH_LOCATION + binMid, textLen) + patternLen;
|
7741 |
+
rd = new Array(finish + 2);
|
7742 |
+
rd[finish + 1] = (1 << i) - 1;
|
7743 |
+
for (j = finish; j >= start; j--) {
|
7744 |
+
charMatch = pattern_alphabet[text.charAt(j - 1)];
|
7745 |
+
if (i === 0) {
|
7746 |
+
rd[j] = ((rd[j + 1] << 1) | 1) & charMatch;
|
7747 |
+
} else {
|
7748 |
+
rd[j] = ((rd[j + 1] << 1) | 1) & charMatch | (((lastRd[j + 1] | lastRd[j]) << 1) | 1) | lastRd[j + 1];
|
7749 |
+
}
|
7750 |
+
if (rd[j] & matchmask) {
|
7751 |
+
score = match_bitapScore(i, j - 1);
|
7752 |
+
if (score <= scoreThreshold) {
|
7753 |
+
scoreThreshold = score;
|
7754 |
+
bestLoc = j - 1;
|
7755 |
+
locations.push(bestLoc);
|
7756 |
+
if (bestLoc > MATCH_LOCATION) {
|
7757 |
+
start = Math.max(1, 2 * MATCH_LOCATION - bestLoc);
|
7758 |
+
} else {
|
7759 |
+
break;
|
7760 |
+
}
|
7761 |
+
}
|
7762 |
+
}
|
7763 |
+
}
|
7764 |
+
if (match_bitapScore(i + 1, MATCH_LOCATION) > scoreThreshold) {
|
7765 |
+
break;
|
7766 |
+
}
|
7767 |
+
lastRd = rd;
|
7768 |
+
}
|
7769 |
+
return {
|
7770 |
+
isMatch: bestLoc >= 0,
|
7771 |
+
score: score
|
7772 |
+
};
|
7773 |
+
};
|
7774 |
+
return txt === true ? { 'search' : search } : search(txt);
|
7775 |
+
};
|
7776 |
+
$.vakata.search.defaults = {
|
7777 |
+
location : 0,
|
7778 |
+
distance : 100,
|
7779 |
+
threshold : 0.6,
|
7780 |
+
fuzzy : false,
|
7781 |
+
caseSensitive : false
|
7782 |
+
};
|
7783 |
+
}($));
|
7784 |
+
|
7785 |
+
// include the search plugin by default
|
7786 |
+
// $.jstree.defaults.plugins.push("search");
|
7787 |
+
|
7788 |
+
|
7789 |
+
/**
|
7790 |
+
* ### Sort plugin
|
7791 |
+
*
|
7792 |
+
* Automatically sorts all siblings in the tree according to a sorting function.
|
7793 |
+
*/
|
7794 |
+
|
7795 |
+
/**
|
7796 |
+
* the settings function used to sort the nodes.
|
7797 |
+
* It is executed in the tree's context, accepts two nodes as arguments and should return `1` or `-1`.
|
7798 |
+
* @name $.jstree.defaults.sort
|
7799 |
+
* @plugin sort
|
7800 |
+
*/
|
7801 |
+
$.jstree.defaults.sort = function (a, b) {
|
7802 |
+
//return this.get_type(a) === this.get_type(b) ? (this.get_text(a) > this.get_text(b) ? 1 : -1) : this.get_type(a) >= this.get_type(b);
|
7803 |
+
return this.get_text(a) > this.get_text(b) ? 1 : -1;
|
7804 |
+
};
|
7805 |
+
$.jstree.plugins.sort = function (options, parent) {
|
7806 |
+
this.bind = function () {
|
7807 |
+
parent.bind.call(this);
|
7808 |
+
this.element
|
7809 |
+
.on("model.jstree", $.proxy(function (e, data) {
|
7810 |
+
this.sort(data.parent, true);
|
7811 |
+
}, this))
|
7812 |
+
.on("rename_node.jstree create_node.jstree", $.proxy(function (e, data) {
|
7813 |
+
this.sort(data.parent || data.node.parent, false);
|
7814 |
+
this.redraw_node(data.parent || data.node.parent, true);
|
7815 |
+
}, this))
|
7816 |
+
.on("move_node.jstree copy_node.jstree", $.proxy(function (e, data) {
|
7817 |
+
this.sort(data.parent, false);
|
7818 |
+
this.redraw_node(data.parent, true);
|
7819 |
+
}, this));
|
7820 |
+
};
|
7821 |
+
/**
|
7822 |
+
* used to sort a node's children
|
7823 |
+
* @private
|
7824 |
+
* @name sort(obj [, deep])
|
7825 |
+
* @param {mixed} obj the node
|
7826 |
+
* @param {Boolean} deep if set to `true` nodes are sorted recursively.
|
7827 |
+
* @plugin sort
|
7828 |
+
* @trigger search.jstree
|
7829 |
+
*/
|
7830 |
+
this.sort = function (obj, deep) {
|
7831 |
+
var i, j;
|
7832 |
+
obj = this.get_node(obj);
|
7833 |
+
if(obj && obj.children && obj.children.length) {
|
7834 |
+
obj.children.sort($.proxy(this.settings.sort, this));
|
7835 |
+
if(deep) {
|
7836 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
7837 |
+
this.sort(obj.children_d[i], false);
|
7838 |
+
}
|
7839 |
+
}
|
7840 |
+
}
|
7841 |
+
};
|
7842 |
+
};
|
7843 |
+
|
7844 |
+
// include the sort plugin by default
|
7845 |
+
// $.jstree.defaults.plugins.push("sort");
|
7846 |
+
|
7847 |
+
/**
|
7848 |
+
* ### State plugin
|
7849 |
+
*
|
7850 |
+
* Saves the state of the tree (selected nodes, opened nodes) on the user's computer using available options (localStorage, cookies, etc)
|
7851 |
+
*/
|
7852 |
+
|
7853 |
+
var to = false;
|
7854 |
+
/**
|
7855 |
+
* stores all defaults for the state plugin
|
7856 |
+
* @name $.jstree.defaults.state
|
7857 |
+
* @plugin state
|
7858 |
+
*/
|
7859 |
+
$.jstree.defaults.state = {
|
7860 |
+
/**
|
7861 |
+
* A string for the key to use when saving the current tree (change if using multiple trees in your project). Defaults to `jstree`.
|
7862 |
+
* @name $.jstree.defaults.state.key
|
7863 |
+
* @plugin state
|
7864 |
+
*/
|
7865 |
+
key : 'jstree',
|
7866 |
+
/**
|
7867 |
+
* A space separated list of events that trigger a state save. Defaults to `changed.jstree open_node.jstree close_node.jstree`.
|
7868 |
+
* @name $.jstree.defaults.state.events
|
7869 |
+
* @plugin state
|
7870 |
+
*/
|
7871 |
+
events : 'changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree',
|
7872 |
+
/**
|
7873 |
+
* Time in milliseconds after which the state will expire. Defaults to 'false' meaning - no expire.
|
7874 |
+
* @name $.jstree.defaults.state.ttl
|
7875 |
+
* @plugin state
|
7876 |
+
*/
|
7877 |
+
ttl : false,
|
7878 |
+
/**
|
7879 |
+
* A function that will be executed prior to restoring state with one argument - the state object. Can be used to clear unwanted parts of the state.
|
7880 |
+
* @name $.jstree.defaults.state.filter
|
7881 |
+
* @plugin state
|
7882 |
+
*/
|
7883 |
+
filter : false,
|
7884 |
+
/**
|
7885 |
+
* Should loaded nodes be restored (setting this to true means that it is possible that the whole tree will be loaded for some users - use with caution). Defaults to `false`
|
7886 |
+
* @name $.jstree.defaults.state.preserve_loaded
|
7887 |
+
* @plugin state
|
7888 |
+
*/
|
7889 |
+
preserve_loaded : false
|
7890 |
+
};
|
7891 |
+
$.jstree.plugins.state = function (options, parent) {
|
7892 |
+
this.bind = function () {
|
7893 |
+
parent.bind.call(this);
|
7894 |
+
var bind = $.proxy(function () {
|
7895 |
+
this.element.on(this.settings.state.events, $.proxy(function () {
|
7896 |
+
if(to) { clearTimeout(to); }
|
7897 |
+
to = setTimeout($.proxy(function () { this.save_state(); }, this), 100);
|
7898 |
+
}, this));
|
7899 |
+
/**
|
7900 |
+
* triggered when the state plugin is finished restoring the state (and immediately after ready if there is no state to restore).
|
7901 |
+
* @event
|
7902 |
+
* @name state_ready.jstree
|
7903 |
+
* @plugin state
|
7904 |
+
*/
|
7905 |
+
this.trigger('state_ready');
|
7906 |
+
}, this);
|
7907 |
+
this.element
|
7908 |
+
.on("ready.jstree", $.proxy(function (e, data) {
|
7909 |
+
this.element.one("restore_state.jstree", bind);
|
7910 |
+
if(!this.restore_state()) { bind(); }
|
7911 |
+
}, this));
|
7912 |
+
};
|
7913 |
+
/**
|
7914 |
+
* save the state
|
7915 |
+
* @name save_state()
|
7916 |
+
* @plugin state
|
7917 |
+
*/
|
7918 |
+
this.save_state = function () {
|
7919 |
+
var tm = this.get_state();
|
7920 |
+
if (!this.settings.state.preserve_loaded) {
|
7921 |
+
delete tm.core.loaded;
|
7922 |
+
}
|
7923 |
+
var st = { 'state' : tm, 'ttl' : this.settings.state.ttl, 'sec' : +(new Date()) };
|
7924 |
+
$.vakata.storage.set(this.settings.state.key, JSON.stringify(st));
|
7925 |
+
};
|
7926 |
+
/**
|
7927 |
+
* restore the state from the user's computer
|
7928 |
+
* @name restore_state()
|
7929 |
+
* @plugin state
|
7930 |
+
*/
|
7931 |
+
this.restore_state = function () {
|
7932 |
+
var k = $.vakata.storage.get(this.settings.state.key);
|
7933 |
+
if(!!k) { try { k = JSON.parse(k); } catch(ex) { return false; } }
|
7934 |
+
if(!!k && k.ttl && k.sec && +(new Date()) - k.sec > k.ttl) { return false; }
|
7935 |
+
if(!!k && k.state) { k = k.state; }
|
7936 |
+
if(!!k && $.isFunction(this.settings.state.filter)) { k = this.settings.state.filter.call(this, k); }
|
7937 |
+
if(!!k) {
|
7938 |
+
if (!this.settings.state.preserve_loaded) {
|
7939 |
+
delete k.core.loaded;
|
7940 |
+
}
|
7941 |
+
this.element.one("set_state.jstree", function (e, data) { data.instance.trigger('restore_state', { 'state' : $.extend(true, {}, k) }); });
|
7942 |
+
this.set_state(k);
|
7943 |
+
return true;
|
7944 |
+
}
|
7945 |
+
return false;
|
7946 |
+
};
|
7947 |
+
/**
|
7948 |
+
* clear the state on the user's computer
|
7949 |
+
* @name clear_state()
|
7950 |
+
* @plugin state
|
7951 |
+
*/
|
7952 |
+
this.clear_state = function () {
|
7953 |
+
return $.vakata.storage.del(this.settings.state.key);
|
7954 |
+
};
|
7955 |
+
};
|
7956 |
+
|
7957 |
+
(function ($, undefined) {
|
7958 |
+
$.vakata.storage = {
|
7959 |
+
// simply specifying the functions in FF throws an error
|
7960 |
+
set : function (key, val) { return window.localStorage.setItem(key, val); },
|
7961 |
+
get : function (key) { return window.localStorage.getItem(key); },
|
7962 |
+
del : function (key) { return window.localStorage.removeItem(key); }
|
7963 |
+
};
|
7964 |
+
}($));
|
7965 |
+
|
7966 |
+
// include the state plugin by default
|
7967 |
+
// $.jstree.defaults.plugins.push("state");
|
7968 |
+
|
7969 |
+
/**
|
7970 |
+
* ### Types plugin
|
7971 |
+
*
|
7972 |
+
* Makes it possible to add predefined types for groups of nodes, which make it possible to easily control nesting rules and icon for each group.
|
7973 |
+
*/
|
7974 |
+
|
7975 |
+
/**
|
7976 |
+
* An object storing all types as key value pairs, where the key is the type name and the value is an object that could contain following keys (all optional).
|
7977 |
+
*
|
7978 |
+
* * `max_children` the maximum number of immediate children this node type can have. Do not specify or set to `-1` for unlimited.
|
7979 |
+
* * `max_depth` the maximum number of nesting this node type can have. A value of `1` would mean that the node can have children, but no grandchildren. Do not specify or set to `-1` for unlimited.
|
7980 |
+
* * `valid_children` an array of node type strings, that nodes of this type can have as children. Do not specify or set to `-1` for no limits.
|
7981 |
+
* * `icon` a string - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class. Omit to use the default icon from your theme.
|
7982 |
+
* * `li_attr` an object of values which will be used to add HTML attributes on the resulting LI DOM node (merged with the node's own data)
|
7983 |
+
* * `a_attr` an object of values which will be used to add HTML attributes on the resulting A DOM node (merged with the node's own data)
|
7984 |
+
*
|
7985 |
+
* There are two predefined types:
|
7986 |
+
*
|
7987 |
+
* * `#` represents the root of the tree, for example `max_children` would control the maximum number of root nodes.
|
7988 |
+
* * `default` represents the default node - any settings here will be applied to all nodes that do not have a type specified.
|
7989 |
+
*
|
7990 |
+
* @name $.jstree.defaults.types
|
7991 |
+
* @plugin types
|
7992 |
+
*/
|
7993 |
+
$.jstree.defaults.types = {
|
7994 |
+
'default' : {}
|
7995 |
+
};
|
7996 |
+
$.jstree.defaults.types[$.jstree.root] = {};
|
7997 |
+
|
7998 |
+
$.jstree.plugins.types = function (options, parent) {
|
7999 |
+
this.init = function (el, options) {
|
8000 |
+
var i, j;
|
8001 |
+
if(options && options.types && options.types['default']) {
|
8002 |
+
for(i in options.types) {
|
8003 |
+
if(i !== "default" && i !== $.jstree.root && options.types.hasOwnProperty(i)) {
|
8004 |
+
for(j in options.types['default']) {
|
8005 |
+
if(options.types['default'].hasOwnProperty(j) && options.types[i][j] === undefined) {
|
8006 |
+
options.types[i][j] = options.types['default'][j];
|
8007 |
+
}
|
8008 |
+
}
|
8009 |
+
}
|
8010 |
+
}
|
8011 |
+
}
|
8012 |
+
parent.init.call(this, el, options);
|
8013 |
+
this._model.data[$.jstree.root].type = $.jstree.root;
|
8014 |
+
};
|
8015 |
+
this.refresh = function (skip_loading, forget_state) {
|
8016 |
+
parent.refresh.call(this, skip_loading, forget_state);
|
8017 |
+
this._model.data[$.jstree.root].type = $.jstree.root;
|
8018 |
+
};
|
8019 |
+
this.bind = function () {
|
8020 |
+
this.element
|
8021 |
+
.on('model.jstree', $.proxy(function (e, data) {
|
8022 |
+
var m = this._model.data,
|
8023 |
+
dpc = data.nodes,
|
8024 |
+
t = this.settings.types,
|
8025 |
+
i, j, c = 'default', k;
|
8026 |
+
for(i = 0, j = dpc.length; i < j; i++) {
|
8027 |
+
c = 'default';
|
8028 |
+
if(m[dpc[i]].original && m[dpc[i]].original.type && t[m[dpc[i]].original.type]) {
|
8029 |
+
c = m[dpc[i]].original.type;
|
8030 |
+
}
|
8031 |
+
if(m[dpc[i]].data && m[dpc[i]].data.jstree && m[dpc[i]].data.jstree.type && t[m[dpc[i]].data.jstree.type]) {
|
8032 |
+
c = m[dpc[i]].data.jstree.type;
|
8033 |
+
}
|
8034 |
+
m[dpc[i]].type = c;
|
8035 |
+
if(m[dpc[i]].icon === true && t[c].icon !== undefined) {
|
8036 |
+
m[dpc[i]].icon = t[c].icon;
|
8037 |
+
}
|
8038 |
+
if(t[c].li_attr !== undefined && typeof t[c].li_attr === 'object') {
|
8039 |
+
for (k in t[c].li_attr) {
|
8040 |
+
if (t[c].li_attr.hasOwnProperty(k)) {
|
8041 |
+
if (k === 'id') {
|
8042 |
+
continue;
|
8043 |
+
}
|
8044 |
+
else if (m[dpc[i]].li_attr[k] === undefined) {
|
8045 |
+
m[dpc[i]].li_attr[k] = t[c].li_attr[k];
|
8046 |
+
}
|
8047 |
+
else if (k === 'class') {
|
8048 |
+
m[dpc[i]].li_attr['class'] = t[c].li_attr['class'] + ' ' + m[dpc[i]].li_attr['class'];
|
8049 |
+
}
|
8050 |
+
}
|
8051 |
+
}
|
8052 |
+
}
|
8053 |
+
if(t[c].a_attr !== undefined && typeof t[c].a_attr === 'object') {
|
8054 |
+
for (k in t[c].a_attr) {
|
8055 |
+
if (t[c].a_attr.hasOwnProperty(k)) {
|
8056 |
+
if (k === 'id') {
|
8057 |
+
continue;
|
8058 |
+
}
|
8059 |
+
else if (m[dpc[i]].a_attr[k] === undefined) {
|
8060 |
+
m[dpc[i]].a_attr[k] = t[c].a_attr[k];
|
8061 |
+
}
|
8062 |
+
else if (k === 'href' && m[dpc[i]].a_attr[k] === '#') {
|
8063 |
+
m[dpc[i]].a_attr['href'] = t[c].a_attr['href'];
|
8064 |
+
}
|
8065 |
+
else if (k === 'class') {
|
8066 |
+
m[dpc[i]].a_attr['class'] = t[c].a_attr['class'] + ' ' + m[dpc[i]].a_attr['class'];
|
8067 |
+
}
|
8068 |
+
}
|
8069 |
+
}
|
8070 |
+
}
|
8071 |
+
}
|
8072 |
+
m[$.jstree.root].type = $.jstree.root;
|
8073 |
+
}, this));
|
8074 |
+
parent.bind.call(this);
|
8075 |
+
};
|
8076 |
+
this.get_json = function (obj, options, flat) {
|
8077 |
+
var i, j,
|
8078 |
+
m = this._model.data,
|
8079 |
+
opt = options ? $.extend(true, {}, options, {no_id:false}) : {},
|
8080 |
+
tmp = parent.get_json.call(this, obj, opt, flat);
|
8081 |
+
if(tmp === false) { return false; }
|
8082 |
+
if($.isArray(tmp)) {
|
8083 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
8084 |
+
tmp[i].type = tmp[i].id && m[tmp[i].id] && m[tmp[i].id].type ? m[tmp[i].id].type : "default";
|
8085 |
+
if(options && options.no_id) {
|
8086 |
+
delete tmp[i].id;
|
8087 |
+
if(tmp[i].li_attr && tmp[i].li_attr.id) {
|
8088 |
+
delete tmp[i].li_attr.id;
|
8089 |
+
}
|
8090 |
+
if(tmp[i].a_attr && tmp[i].a_attr.id) {
|
8091 |
+
delete tmp[i].a_attr.id;
|
8092 |
+
}
|
8093 |
+
}
|
8094 |
+
}
|
8095 |
+
}
|
8096 |
+
else {
|
8097 |
+
tmp.type = tmp.id && m[tmp.id] && m[tmp.id].type ? m[tmp.id].type : "default";
|
8098 |
+
if(options && options.no_id) {
|
8099 |
+
tmp = this._delete_ids(tmp);
|
8100 |
+
}
|
8101 |
+
}
|
8102 |
+
return tmp;
|
8103 |
+
};
|
8104 |
+
this._delete_ids = function (tmp) {
|
8105 |
+
if($.isArray(tmp)) {
|
8106 |
+
for(var i = 0, j = tmp.length; i < j; i++) {
|
8107 |
+
tmp[i] = this._delete_ids(tmp[i]);
|
8108 |
+
}
|
8109 |
+
return tmp;
|
8110 |
+
}
|
8111 |
+
delete tmp.id;
|
8112 |
+
if(tmp.li_attr && tmp.li_attr.id) {
|
8113 |
+
delete tmp.li_attr.id;
|
8114 |
+
}
|
8115 |
+
if(tmp.a_attr && tmp.a_attr.id) {
|
8116 |
+
delete tmp.a_attr.id;
|
8117 |
+
}
|
8118 |
+
if(tmp.children && $.isArray(tmp.children)) {
|
8119 |
+
tmp.children = this._delete_ids(tmp.children);
|
8120 |
+
}
|
8121 |
+
return tmp;
|
8122 |
+
};
|
8123 |
+
this.check = function (chk, obj, par, pos, more) {
|
8124 |
+
if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; }
|
8125 |
+
obj = obj && obj.id ? obj : this.get_node(obj);
|
8126 |
+
par = par && par.id ? par : this.get_node(par);
|
8127 |
+
var m = obj && obj.id ? (more && more.origin ? more.origin : $.jstree.reference(obj.id)) : null, tmp, d, i, j;
|
8128 |
+
m = m && m._model && m._model.data ? m._model.data : null;
|
8129 |
+
switch(chk) {
|
8130 |
+
case "create_node":
|
8131 |
+
case "move_node":
|
8132 |
+
case "copy_node":
|
8133 |
+
if(chk !== 'move_node' || $.inArray(obj.id, par.children) === -1) {
|
8134 |
+
tmp = this.get_rules(par);
|
8135 |
+
if(tmp.max_children !== undefined && tmp.max_children !== -1 && tmp.max_children === par.children.length) {
|
8136 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_01', 'reason' : 'max_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8137 |
+
return false;
|
8138 |
+
}
|
8139 |
+
if(tmp.valid_children !== undefined && tmp.valid_children !== -1 && $.inArray((obj.type || 'default'), tmp.valid_children) === -1) {
|
8140 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_02', 'reason' : 'valid_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8141 |
+
return false;
|
8142 |
+
}
|
8143 |
+
if(m && obj.children_d && obj.parents) {
|
8144 |
+
d = 0;
|
8145 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
8146 |
+
d = Math.max(d, m[obj.children_d[i]].parents.length);
|
8147 |
+
}
|
8148 |
+
d = d - obj.parents.length + 1;
|
8149 |
+
}
|
8150 |
+
if(d <= 0 || d === undefined) { d = 1; }
|
8151 |
+
do {
|
8152 |
+
if(tmp.max_depth !== undefined && tmp.max_depth !== -1 && tmp.max_depth < d) {
|
8153 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_03', 'reason' : 'max_depth prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8154 |
+
return false;
|
8155 |
+
}
|
8156 |
+
par = this.get_node(par.parent);
|
8157 |
+
tmp = this.get_rules(par);
|
8158 |
+
d++;
|
8159 |
+
} while(par);
|
8160 |
+
}
|
8161 |
+
break;
|
8162 |
+
}
|
8163 |
+
return true;
|
8164 |
+
};
|
8165 |
+
/**
|
8166 |
+
* used to retrieve the type settings object for a node
|
8167 |
+
* @name get_rules(obj)
|
8168 |
+
* @param {mixed} obj the node to find the rules for
|
8169 |
+
* @return {Object}
|
8170 |
+
* @plugin types
|
8171 |
+
*/
|
8172 |
+
this.get_rules = function (obj) {
|
8173 |
+
obj = this.get_node(obj);
|
8174 |
+
if(!obj) { return false; }
|
8175 |
+
var tmp = this.get_type(obj, true);
|
8176 |
+
if(tmp.max_depth === undefined) { tmp.max_depth = -1; }
|
8177 |
+
if(tmp.max_children === undefined) { tmp.max_children = -1; }
|
8178 |
+
if(tmp.valid_children === undefined) { tmp.valid_children = -1; }
|
8179 |
+
return tmp;
|
8180 |
+
};
|
8181 |
+
/**
|
8182 |
+
* used to retrieve the type string or settings object for a node
|
8183 |
+
* @name get_type(obj [, rules])
|
8184 |
+
* @param {mixed} obj the node to find the rules for
|
8185 |
+
* @param {Boolean} rules if set to `true` instead of a string the settings object will be returned
|
8186 |
+
* @return {String|Object}
|
8187 |
+
* @plugin types
|
8188 |
+
*/
|
8189 |
+
this.get_type = function (obj, rules) {
|
8190 |
+
obj = this.get_node(obj);
|
8191 |
+
return (!obj) ? false : ( rules ? $.extend({ 'type' : obj.type }, this.settings.types[obj.type]) : obj.type);
|
8192 |
+
};
|
8193 |
+
/**
|
8194 |
+
* used to change a node's type
|
8195 |
+
* @name set_type(obj, type)
|
8196 |
+
* @param {mixed} obj the node to change
|
8197 |
+
* @param {String} type the new type
|
8198 |
+
* @plugin types
|
8199 |
+
*/
|
8200 |
+
this.set_type = function (obj, type) {
|
8201 |
+
var m = this._model.data, t, t1, t2, old_type, old_icon, k, d, a;
|
8202 |
+
if($.isArray(obj)) {
|
8203 |
+
obj = obj.slice();
|
8204 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
8205 |
+
this.set_type(obj[t1], type);
|
8206 |
+
}
|
8207 |
+
return true;
|
8208 |
+
}
|
8209 |
+
t = this.settings.types;
|
8210 |
+
obj = this.get_node(obj);
|
8211 |
+
if(!t[type] || !obj) { return false; }
|
8212 |
+
d = this.get_node(obj, true);
|
8213 |
+
if (d && d.length) {
|
8214 |
+
a = d.children('.jstree-anchor');
|
8215 |
+
}
|
8216 |
+
old_type = obj.type;
|
8217 |
+
old_icon = this.get_icon(obj);
|
8218 |
+
obj.type = type;
|
8219 |
+
if(old_icon === true || !t[old_type] || (t[old_type].icon !== undefined && old_icon === t[old_type].icon)) {
|
8220 |
+
this.set_icon(obj, t[type].icon !== undefined ? t[type].icon : true);
|
8221 |
+
}
|
8222 |
+
|
8223 |
+
// remove old type props
|
8224 |
+
if(t[old_type] && t[old_type].li_attr !== undefined && typeof t[old_type].li_attr === 'object') {
|
8225 |
+
for (k in t[old_type].li_attr) {
|
8226 |
+
if (t[old_type].li_attr.hasOwnProperty(k)) {
|
8227 |
+
if (k === 'id') {
|
8228 |
+
continue;
|
8229 |
+
}
|
8230 |
+
else if (k === 'class') {
|
8231 |
+
m[obj.id].li_attr['class'] = (m[obj.id].li_attr['class'] || '').replace(t[old_type].li_attr[k], '');
|
8232 |
+
if (d) { d.removeClass(t[old_type].li_attr[k]); }
|
8233 |
+
}
|
8234 |
+
else if (m[obj.id].li_attr[k] === t[old_type].li_attr[k]) {
|
8235 |
+
m[obj.id].li_attr[k] = null;
|
8236 |
+
if (d) { d.removeAttr(k); }
|
8237 |
+
}
|
8238 |
+
}
|
8239 |
+
}
|
8240 |
+
}
|
8241 |
+
if(t[old_type] && t[old_type].a_attr !== undefined && typeof t[old_type].a_attr === 'object') {
|
8242 |
+
for (k in t[old_type].a_attr) {
|
8243 |
+
if (t[old_type].a_attr.hasOwnProperty(k)) {
|
8244 |
+
if (k === 'id') {
|
8245 |
+
continue;
|
8246 |
+
}
|
8247 |
+
else if (k === 'class') {
|
8248 |
+
m[obj.id].a_attr['class'] = (m[obj.id].a_attr['class'] || '').replace(t[old_type].a_attr[k], '');
|
8249 |
+
if (a) { a.removeClass(t[old_type].a_attr[k]); }
|
8250 |
+
}
|
8251 |
+
else if (m[obj.id].a_attr[k] === t[old_type].a_attr[k]) {
|
8252 |
+
if (k === 'href') {
|
8253 |
+
m[obj.id].a_attr[k] = '#';
|
8254 |
+
if (a) { a.attr('href', '#'); }
|
8255 |
+
}
|
8256 |
+
else {
|
8257 |
+
delete m[obj.id].a_attr[k];
|
8258 |
+
if (a) { a.removeAttr(k); }
|
8259 |
+
}
|
8260 |
+
}
|
8261 |
+
}
|
8262 |
+
}
|
8263 |
+
}
|
8264 |
+
|
8265 |
+
// add new props
|
8266 |
+
if(t[type].li_attr !== undefined && typeof t[type].li_attr === 'object') {
|
8267 |
+
for (k in t[type].li_attr) {
|
8268 |
+
if (t[type].li_attr.hasOwnProperty(k)) {
|
8269 |
+
if (k === 'id') {
|
8270 |
+
continue;
|
8271 |
+
}
|
8272 |
+
else if (m[obj.id].li_attr[k] === undefined) {
|
8273 |
+
m[obj.id].li_attr[k] = t[type].li_attr[k];
|
8274 |
+
if (d) {
|
8275 |
+
if (k === 'class') {
|
8276 |
+
d.addClass(t[type].li_attr[k]);
|
8277 |
+
}
|
8278 |
+
else {
|
8279 |
+
d.attr(k, t[type].li_attr[k]);
|
8280 |
+
}
|
8281 |
+
}
|
8282 |
+
}
|
8283 |
+
else if (k === 'class') {
|
8284 |
+
m[obj.id].li_attr['class'] = t[type].li_attr[k] + ' ' + m[obj.id].li_attr['class'];
|
8285 |
+
if (d) { d.addClass(t[type].li_attr[k]); }
|
8286 |
+
}
|
8287 |
+
}
|
8288 |
+
}
|
8289 |
+
}
|
8290 |
+
if(t[type].a_attr !== undefined && typeof t[type].a_attr === 'object') {
|
8291 |
+
for (k in t[type].a_attr) {
|
8292 |
+
if (t[type].a_attr.hasOwnProperty(k)) {
|
8293 |
+
if (k === 'id') {
|
8294 |
+
continue;
|
8295 |
+
}
|
8296 |
+
else if (m[obj.id].a_attr[k] === undefined) {
|
8297 |
+
m[obj.id].a_attr[k] = t[type].a_attr[k];
|
8298 |
+
if (a) {
|
8299 |
+
if (k === 'class') {
|
8300 |
+
a.addClass(t[type].a_attr[k]);
|
8301 |
+
}
|
8302 |
+
else {
|
8303 |
+
a.attr(k, t[type].a_attr[k]);
|
8304 |
+
}
|
8305 |
+
}
|
8306 |
+
}
|
8307 |
+
else if (k === 'href' && m[obj.id].a_attr[k] === '#') {
|
8308 |
+
m[obj.id].a_attr['href'] = t[type].a_attr['href'];
|
8309 |
+
if (a) { a.attr('href', t[type].a_attr['href']); }
|
8310 |
+
}
|
8311 |
+
else if (k === 'class') {
|
8312 |
+
m[obj.id].a_attr['class'] = t[type].a_attr['class'] + ' ' + m[obj.id].a_attr['class'];
|
8313 |
+
if (a) { a.addClass(t[type].a_attr[k]); }
|
8314 |
+
}
|
8315 |
+
}
|
8316 |
+
}
|
8317 |
+
}
|
8318 |
+
|
8319 |
+
return true;
|
8320 |
+
};
|
8321 |
+
};
|
8322 |
+
// include the types plugin by default
|
8323 |
+
// $.jstree.defaults.plugins.push("types");
|
8324 |
+
|
8325 |
+
|
8326 |
+
/**
|
8327 |
+
* ### Unique plugin
|
8328 |
+
*
|
8329 |
+
* Enforces that no nodes with the same name can coexist as siblings.
|
8330 |
+
*/
|
8331 |
+
|
8332 |
+
/**
|
8333 |
+
* stores all defaults for the unique plugin
|
8334 |
+
* @name $.jstree.defaults.unique
|
8335 |
+
* @plugin unique
|
8336 |
+
*/
|
8337 |
+
$.jstree.defaults.unique = {
|
8338 |
+
/**
|
8339 |
+
* Indicates if the comparison should be case sensitive. Default is `false`.
|
8340 |
+
* @name $.jstree.defaults.unique.case_sensitive
|
8341 |
+
* @plugin unique
|
8342 |
+
*/
|
8343 |
+
case_sensitive : false,
|
8344 |
+
/**
|
8345 |
+
* Indicates if white space should be trimmed before the comparison. Default is `false`.
|
8346 |
+
* @name $.jstree.defaults.unique.trim_whitespace
|
8347 |
+
* @plugin unique
|
8348 |
+
*/
|
8349 |
+
trim_whitespace : false,
|
8350 |
+
/**
|
8351 |
+
* A callback executed in the instance's scope when a new node is created and the name is already taken, the two arguments are the conflicting name and the counter. The default will produce results like `New node (2)`.
|
8352 |
+
* @name $.jstree.defaults.unique.duplicate
|
8353 |
+
* @plugin unique
|
8354 |
+
*/
|
8355 |
+
duplicate : function (name, counter) {
|
8356 |
+
return name + ' (' + counter + ')';
|
8357 |
+
}
|
8358 |
+
};
|
8359 |
+
|
8360 |
+
$.jstree.plugins.unique = function (options, parent) {
|
8361 |
+
this.check = function (chk, obj, par, pos, more) {
|
8362 |
+
if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; }
|
8363 |
+
obj = obj && obj.id ? obj : this.get_node(obj);
|
8364 |
+
par = par && par.id ? par : this.get_node(par);
|
8365 |
+
if(!par || !par.children) { return true; }
|
8366 |
+
var n = chk === "rename_node" ? pos : obj.text,
|
8367 |
+
c = [],
|
8368 |
+
s = this.settings.unique.case_sensitive,
|
8369 |
+
w = this.settings.unique.trim_whitespace,
|
8370 |
+
m = this._model.data, i, j, t;
|
8371 |
+
for(i = 0, j = par.children.length; i < j; i++) {
|
8372 |
+
t = m[par.children[i]].text;
|
8373 |
+
if (!s) {
|
8374 |
+
t = t.toLowerCase();
|
8375 |
+
}
|
8376 |
+
if (w) {
|
8377 |
+
t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
8378 |
+
}
|
8379 |
+
c.push(t);
|
8380 |
+
}
|
8381 |
+
if(!s) { n = n.toLowerCase(); }
|
8382 |
+
if (w) { n = n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); }
|
8383 |
+
switch(chk) {
|
8384 |
+
case "delete_node":
|
8385 |
+
return true;
|
8386 |
+
case "rename_node":
|
8387 |
+
t = obj.text || '';
|
8388 |
+
if (!s) {
|
8389 |
+
t = t.toLowerCase();
|
8390 |
+
}
|
8391 |
+
if (w) {
|
8392 |
+
t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
8393 |
+
}
|
8394 |
+
i = ($.inArray(n, c) === -1 || (obj.text && t === n));
|
8395 |
+
if(!i) {
|
8396 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_01', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8397 |
+
}
|
8398 |
+
return i;
|
8399 |
+
case "create_node":
|
8400 |
+
i = ($.inArray(n, c) === -1);
|
8401 |
+
if(!i) {
|
8402 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_04', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8403 |
+
}
|
8404 |
+
return i;
|
8405 |
+
case "copy_node":
|
8406 |
+
i = ($.inArray(n, c) === -1);
|
8407 |
+
if(!i) {
|
8408 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_02', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8409 |
+
}
|
8410 |
+
return i;
|
8411 |
+
case "move_node":
|
8412 |
+
i = ( (obj.parent === par.id && (!more || !more.is_multi)) || $.inArray(n, c) === -1);
|
8413 |
+
if(!i) {
|
8414 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_03', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8415 |
+
}
|
8416 |
+
return i;
|
8417 |
+
}
|
8418 |
+
return true;
|
8419 |
+
};
|
8420 |
+
this.create_node = function (par, node, pos, callback, is_loaded) {
|
8421 |
+
if(!node || node.text === undefined) {
|
8422 |
+
if(par === null) {
|
8423 |
+
par = $.jstree.root;
|
8424 |
+
}
|
8425 |
+
par = this.get_node(par);
|
8426 |
+
if(!par) {
|
8427 |
+
return parent.create_node.call(this, par, node, pos, callback, is_loaded);
|
8428 |
+
}
|
8429 |
+
pos = pos === undefined ? "last" : pos;
|
8430 |
+
if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {
|
8431 |
+
return parent.create_node.call(this, par, node, pos, callback, is_loaded);
|
8432 |
+
}
|
8433 |
+
if(!node) { node = {}; }
|
8434 |
+
var tmp, n, dpc, i, j, m = this._model.data, s = this.settings.unique.case_sensitive, w = this.settings.unique.trim_whitespace, cb = this.settings.unique.duplicate, t;
|
8435 |
+
n = tmp = this.get_string('New node');
|
8436 |
+
dpc = [];
|
8437 |
+
for(i = 0, j = par.children.length; i < j; i++) {
|
8438 |
+
t = m[par.children[i]].text;
|
8439 |
+
if (!s) {
|
8440 |
+
t = t.toLowerCase();
|
8441 |
+
}
|
8442 |
+
if (w) {
|
8443 |
+
t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
8444 |
+
}
|
8445 |
+
dpc.push(t);
|
8446 |
+
}
|
8447 |
+
i = 1;
|
8448 |
+
t = n;
|
8449 |
+
if (!s) {
|
8450 |
+
t = t.toLowerCase();
|
8451 |
+
}
|
8452 |
+
if (w) {
|
8453 |
+
t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
8454 |
+
}
|
8455 |
+
while($.inArray(t, dpc) !== -1) {
|
8456 |
+
n = cb.call(this, tmp, (++i)).toString();
|
8457 |
+
t = n;
|
8458 |
+
if (!s) {
|
8459 |
+
t = t.toLowerCase();
|
8460 |
+
}
|
8461 |
+
if (w) {
|
8462 |
+
t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
8463 |
+
}
|
8464 |
+
}
|
8465 |
+
node.text = n;
|
8466 |
+
}
|
8467 |
+
return parent.create_node.call(this, par, node, pos, callback, is_loaded);
|
8468 |
+
};
|
8469 |
+
};
|
8470 |
+
|
8471 |
+
// include the unique plugin by default
|
8472 |
+
// $.jstree.defaults.plugins.push("unique");
|
8473 |
+
|
8474 |
+
|
8475 |
+
/**
|
8476 |
+
* ### Wholerow plugin
|
8477 |
+
*
|
8478 |
+
* Makes each node appear block level. Making selection easier. May cause slow down for large trees in old browsers.
|
8479 |
+
*/
|
8480 |
+
|
8481 |
+
var div = document.createElement('DIV');
|
8482 |
+
div.setAttribute('unselectable','on');
|
8483 |
+
div.setAttribute('role','presentation');
|
8484 |
+
div.className = 'jstree-wholerow';
|
8485 |
+
div.innerHTML = ' ';
|
8486 |
+
$.jstree.plugins.wholerow = function (options, parent) {
|
8487 |
+
this.bind = function () {
|
8488 |
+
parent.bind.call(this);
|
8489 |
+
|
8490 |
+
this.element
|
8491 |
+
.on('ready.jstree set_state.jstree', $.proxy(function () {
|
8492 |
+
this.hide_dots();
|
8493 |
+
}, this))
|
8494 |
+
.on("init.jstree loading.jstree ready.jstree", $.proxy(function () {
|
8495 |
+
//div.style.height = this._data.core.li_height + 'px';
|
8496 |
+
this.get_container_ul().addClass('jstree-wholerow-ul');
|
8497 |
+
}, this))
|
8498 |
+
.on("deselect_all.jstree", $.proxy(function (e, data) {
|
8499 |
+
this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked');
|
8500 |
+
}, this))
|
8501 |
+
.on("changed.jstree", $.proxy(function (e, data) {
|
8502 |
+
this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked');
|
8503 |
+
var tmp = false, i, j;
|
8504 |
+
for(i = 0, j = data.selected.length; i < j; i++) {
|
8505 |
+
tmp = this.get_node(data.selected[i], true);
|
8506 |
+
if(tmp && tmp.length) {
|
8507 |
+
tmp.children('.jstree-wholerow').addClass('jstree-wholerow-clicked');
|
8508 |
+
}
|
8509 |
+
}
|
8510 |
+
}, this))
|
8511 |
+
.on("open_node.jstree", $.proxy(function (e, data) {
|
8512 |
+
this.get_node(data.node, true).find('.jstree-clicked').parent().children('.jstree-wholerow').addClass('jstree-wholerow-clicked');
|
8513 |
+
}, this))
|
8514 |
+
.on("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) {
|
8515 |
+
if(e.type === "hover_node" && this.is_disabled(data.node)) { return; }
|
8516 |
+
this.get_node(data.node, true).children('.jstree-wholerow')[e.type === "hover_node"?"addClass":"removeClass"]('jstree-wholerow-hovered');
|
8517 |
+
}, this))
|
8518 |
+
.on("contextmenu.jstree", ".jstree-wholerow", $.proxy(function (e) {
|
8519 |
+
if (this._data.contextmenu) {
|
8520 |
+
e.preventDefault();
|
8521 |
+
var tmp = $.Event('contextmenu', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey, pageX : e.pageX, pageY : e.pageY });
|
8522 |
+
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp);
|
8523 |
+
}
|
8524 |
+
}, this))
|
8525 |
+
/*!
|
8526 |
+
.on("mousedown.jstree touchstart.jstree", ".jstree-wholerow", function (e) {
|
8527 |
+
if(e.target === e.currentTarget) {
|
8528 |
+
var a = $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor");
|
8529 |
+
e.target = a[0];
|
8530 |
+
a.trigger(e);
|
8531 |
+
}
|
8532 |
+
})
|
8533 |
+
*/
|
8534 |
+
.on("click.jstree", ".jstree-wholerow", function (e) {
|
8535 |
+
e.stopImmediatePropagation();
|
8536 |
+
var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });
|
8537 |
+
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus();
|
8538 |
+
})
|
8539 |
+
.on("dblclick.jstree", ".jstree-wholerow", function (e) {
|
8540 |
+
e.stopImmediatePropagation();
|
8541 |
+
var tmp = $.Event('dblclick', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });
|
8542 |
+
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus();
|
8543 |
+
})
|
8544 |
+
.on("click.jstree", ".jstree-leaf > .jstree-ocl", $.proxy(function (e) {
|
8545 |
+
e.stopImmediatePropagation();
|
8546 |
+
var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });
|
8547 |
+
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus();
|
8548 |
+
}, this))
|
8549 |
+
.on("mouseover.jstree", ".jstree-wholerow, .jstree-icon", $.proxy(function (e) {
|
8550 |
+
e.stopImmediatePropagation();
|
8551 |
+
if(!this.is_disabled(e.currentTarget)) {
|
8552 |
+
this.hover_node(e.currentTarget);
|
8553 |
+
}
|
8554 |
+
return false;
|
8555 |
+
}, this))
|
8556 |
+
.on("mouseleave.jstree", ".jstree-node", $.proxy(function (e) {
|
8557 |
+
this.dehover_node(e.currentTarget);
|
8558 |
+
}, this));
|
8559 |
+
};
|
8560 |
+
this.teardown = function () {
|
8561 |
+
if(this.settings.wholerow) {
|
8562 |
+
this.element.find(".jstree-wholerow").remove();
|
8563 |
+
}
|
8564 |
+
parent.teardown.call(this);
|
8565 |
+
};
|
8566 |
+
this.redraw_node = function(obj, deep, callback, force_render) {
|
8567 |
+
obj = parent.redraw_node.apply(this, arguments);
|
8568 |
+
if(obj) {
|
8569 |
+
var tmp = div.cloneNode(true);
|
8570 |
+
//tmp.style.height = this._data.core.li_height + 'px';
|
8571 |
+
if($.inArray(obj.id, this._data.core.selected) !== -1) { tmp.className += ' jstree-wholerow-clicked'; }
|
8572 |
+
if(this._data.core.focused && this._data.core.focused === obj.id) { tmp.className += ' jstree-wholerow-hovered'; }
|
8573 |
+
obj.insertBefore(tmp, obj.childNodes[0]);
|
8574 |
+
}
|
8575 |
+
return obj;
|
8576 |
+
};
|
8577 |
+
};
|
8578 |
+
// include the wholerow plugin by default
|
8579 |
+
// $.jstree.defaults.plugins.push("wholerow");
|
8580 |
+
if(window.customElements && Object && Object.create) {
|
8581 |
+
var proto = Object.create(HTMLElement.prototype);
|
8582 |
+
proto.createdCallback = function () {
|
8583 |
+
var c = { core : {}, plugins : [] }, i;
|
8584 |
+
for(i in $.jstree.plugins) {
|
8585 |
+
if($.jstree.plugins.hasOwnProperty(i) && this.attributes[i]) {
|
8586 |
+
c.plugins.push(i);
|
8587 |
+
if(this.getAttribute(i) && JSON.parse(this.getAttribute(i))) {
|
8588 |
+
c[i] = JSON.parse(this.getAttribute(i));
|
8589 |
+
}
|
8590 |
+
}
|
8591 |
+
}
|
8592 |
+
for(i in $.jstree.defaults.core) {
|
8593 |
+
if($.jstree.defaults.core.hasOwnProperty(i) && this.attributes[i]) {
|
8594 |
+
c.core[i] = JSON.parse(this.getAttribute(i)) || this.getAttribute(i);
|
8595 |
+
}
|
8596 |
+
}
|
8597 |
+
$(this).jstree(c);
|
8598 |
+
};
|
8599 |
+
// proto.attributeChangedCallback = function (name, previous, value) { };
|
8600 |
+
try {
|
8601 |
+
window.customElements.define("vakata-jstree", function() {}, { prototype: proto });
|
8602 |
+
} catch (ignore) { }
|
8603 |
+
}
|
8604 |
+
|
8605 |
+
}));
|
trunk/admin/js/jstree/dist/jstree.min.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*! jsTree - v3.3.7 - 2018-11-06 - (MIT) */
|
2 |
+
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"undefined"!=typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a,b){"use strict";if(!a.jstree){var c=0,d=!1,e=!1,f=!1,g=[],h=a("script:last").attr("src"),i=window.document;a.jstree={version:"3.3.7",defaults:{plugins:[]},plugins:{},path:h&&-1!==h.indexOf("/")?h.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},a.jstree.create=function(b,d){var e=new a.jstree.core(++c),f=d;return d=a.extend(!0,{},a.jstree.defaults,d),f&&f.plugins&&(d.plugins=f.plugins),a.each(d.plugins,function(a,b){"core"!==a&&(e=e.plugin(b,d[b]))}),a(b).data("jstree",e),e.init(b,d),e},a.jstree.destroy=function(){a(".jstree:jstree").jstree("destroy"),a(i).off(".jstree")},a.jstree.core=function(a){this._id=a,this._cnt=0,this._wrk=null,this._data={core:{themes:{name:!1,dots:!1,icons:!1,ellipsis:!1},selected:[],last_error:{},working:!1,worker_queue:[],focused:null}}},a.jstree.reference=function(b){var c=null,d=null;if(!b||!b.id||b.tagName&&b.nodeType||(b=b.id),!d||!d.length)try{d=a(b)}catch(e){}if(!d||!d.length)try{d=a("#"+b.replace(a.jstree.idregex,"\\$&"))}catch(e){}return d&&d.length&&(d=d.closest(".jstree")).length&&(d=d.data("jstree"))?c=d:a(".jstree").each(function(){var d=a(this).data("jstree");return d&&d._model.data[b]?(c=d,!1):void 0}),c},a.fn.jstree=function(c){var d="string"==typeof c,e=Array.prototype.slice.call(arguments,1),f=null;return c!==!0||this.length?(this.each(function(){var g=a.jstree.reference(this),h=d&&g?g[c]:null;return f=d&&h?h.apply(g,e):null,g||d||c!==b&&!a.isPlainObject(c)||a.jstree.create(this,c),(g&&!d||c===!0)&&(f=g||!1),null!==f&&f!==b?!1:void 0}),null!==f&&f!==b?f:this):!1},a.expr.pseudos.jstree=a.expr.createPseudo(function(c){return function(c){return a(c).hasClass("jstree")&&a(c).data("jstree")!==b}}),a.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:a.noop,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,ellipsis:!1,stripes:!1,variant:!1,responsive:!1},expand_selected_onload:!0,worker:!0,force_text:!1,dblclick_toggle:!0,loaded_state:!1,restore_focus:!0,keyboard:{"ctrl-space":function(b){b.type="click",a(b.currentTarget).trigger(b)},enter:function(b){b.type="click",a(b.currentTarget).trigger(b)},left:function(b){if(b.preventDefault(),this.is_open(b.currentTarget))this.close_node(b.currentTarget);else{var c=this.get_parent(b.currentTarget);c&&c.id!==a.jstree.root&&this.get_node(c,!0).children(".jstree-anchor").focus()}},up:function(a){a.preventDefault();var b=this.get_prev_dom(a.currentTarget);b&&b.length&&b.children(".jstree-anchor").focus()},right:function(b){if(b.preventDefault(),this.is_closed(b.currentTarget))this.open_node(b.currentTarget,function(a){this.get_node(a,!0).children(".jstree-anchor").focus()});else if(this.is_open(b.currentTarget)){var c=this.get_node(b.currentTarget,!0).children(".jstree-children")[0];c&&a(this._firstChild(c)).children(".jstree-anchor").focus()}},down:function(a){a.preventDefault();var b=this.get_next_dom(a.currentTarget);b&&b.length&&b.children(".jstree-anchor").focus()},"*":function(a){this.open_all()},home:function(b){b.preventDefault();var c=this._firstChild(this.get_container_ul()[0]);c&&a(c).children(".jstree-anchor").filter(":visible").focus()},end:function(a){a.preventDefault(),this.element.find(".jstree-anchor").filter(":visible").last().focus()},f2:function(a){a.preventDefault(),this.edit(a.currentTarget)}}},a.jstree.core.prototype={plugin:function(b,c){var d=a.jstree.plugins[b];return d?(this._data[b]={},d.prototype=this,new d(c,this)):this},init:function(b,c){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this._model.data[a.jstree.root]={id:a.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this.element=a(b).addClass("jstree jstree-"+this._id),this.settings=c,this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.settings.core.multiple&&this.element.attr("aria-multiselectable",!0),this.element.attr("tabindex")||this.element.attr("tabindex","0"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html("<ul class='jstree-container-ul jstree-children' role='group'><li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading"),this._data.core.li_height=this.get_container_ul().children("li").first().outerHeight()||24,this._data.core.node=this._create_prototype_node(),this.trigger("loading"),this.load_node(a.jstree.root)},destroy:function(a){if(this.trigger("destroy"),this._wrk)try{window.URL.revokeObjectURL(this._wrk),this._wrk=null}catch(b){}a||this.element.empty(),this.teardown()},_create_prototype_node:function(){var a=i.createElement("LI"),b,c;return a.setAttribute("role","treeitem"),b=i.createElement("I"),b.className="jstree-icon jstree-ocl",b.setAttribute("role","presentation"),a.appendChild(b),b=i.createElement("A"),b.className="jstree-anchor",b.setAttribute("href","#"),b.setAttribute("tabindex","-1"),c=i.createElement("I"),c.className="jstree-icon jstree-themeicon",c.setAttribute("role","presentation"),b.appendChild(c),a.appendChild(b),b=c=null,a},_kbevent_to_func:function(a){var b={8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock",16:"Shift",17:"Ctrl",18:"Alt",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*",173:"-"},c=[];a.ctrlKey&&c.push("ctrl"),a.altKey&&c.push("alt"),a.shiftKey&&c.push("shift"),c.push(b[a.which]||a.which),c=c.sort().join("-").toLowerCase();var d=this.settings.core.keyboard,e,f;for(e in d)if(d.hasOwnProperty(e)&&(f=e,"-"!==f&&"+"!==f&&(f=f.replace("--","-MINUS").replace("+-","-MINUS").replace("++","-PLUS").replace("-+","-PLUS"),f=f.split(/-|\+/).sort().join("-").replace("MINUS","-").replace("PLUS","+").toLowerCase()),f===c))return d[e];return null},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){var b="",c=null,d=0;this.element.on("dblclick.jstree",function(a){if(a.target.tagName&&"input"===a.target.tagName.toLowerCase())return!0;if(i.selection&&i.selection.empty)i.selection.empty();else if(window.getSelection){var b=window.getSelection();try{b.removeAllRanges(),b.collapse()}catch(c){}}}).on("mousedown.jstree",a.proxy(function(a){a.target===this.element[0]&&(a.preventDefault(),d=+new Date)},this)).on("mousedown.jstree",".jstree-ocl",function(a){a.preventDefault()}).on("click.jstree",".jstree-ocl",a.proxy(function(a){this.toggle_node(a.target)},this)).on("dblclick.jstree",".jstree-anchor",a.proxy(function(a){return a.target.tagName&&"input"===a.target.tagName.toLowerCase()?!0:void(this.settings.core.dblclick_toggle&&this.toggle_node(a.target))},this)).on("click.jstree",".jstree-anchor",a.proxy(function(b){b.preventDefault(),b.currentTarget!==i.activeElement&&a(b.currentTarget).focus(),this.activate_node(b.currentTarget,b)},this)).on("keydown.jstree",".jstree-anchor",a.proxy(function(a){if(a.target.tagName&&"input"===a.target.tagName.toLowerCase())return!0;this._data.core.rtl&&(37===a.which?a.which=39:39===a.which&&(a.which=37));var b=this._kbevent_to_func(a);if(b){var c=b.call(this,a);if(c===!1||c===!0)return c}},this)).on("load_node.jstree",a.proxy(function(b,c){c.status&&(c.node.id!==a.jstree.root||this._data.core.loaded||(this._data.core.loaded=!0,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.trigger("loaded")),this._data.core.ready||setTimeout(a.proxy(function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var b=[],c,d;for(c=0,d=this._data.core.selected.length;d>c;c++)b=b.concat(this._model.data[this._data.core.selected[c]].parents);for(b=a.vakata.array_unique(b),c=0,d=b.length;d>c;c++)this.open_node(b[c],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}},this),0))},this)).on("keypress.jstree",a.proxy(function(d){if(d.target.tagName&&"input"===d.target.tagName.toLowerCase())return!0;c&&clearTimeout(c),c=setTimeout(function(){b=""},500);var e=String.fromCharCode(d.which).toLowerCase(),f=this.element.find(".jstree-anchor").filter(":visible"),g=f.index(i.activeElement)||0,h=!1;if(b+=e,b.length>1){if(f.slice(g).each(a.proxy(function(c,d){return 0===a(d).text().toLowerCase().indexOf(b)?(a(d).focus(),h=!0,!1):void 0},this)),h)return;if(f.slice(0,g).each(a.proxy(function(c,d){return 0===a(d).text().toLowerCase().indexOf(b)?(a(d).focus(),h=!0,!1):void 0},this)),h)return}if(new RegExp("^"+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(b)){if(f.slice(g+1).each(a.proxy(function(b,c){return a(c).text().toLowerCase().charAt(0)===e?(a(c).focus(),h=!0,!1):void 0},this)),h)return;if(f.slice(0,g+1).each(a.proxy(function(b,c){return a(c).text().toLowerCase().charAt(0)===e?(a(c).focus(),h=!0,!1):void 0},this)),h)return}},this)).on("init.jstree",a.proxy(function(){var a=this.settings.core.themes;this._data.core.themes.dots=a.dots,this._data.core.themes.stripes=a.stripes,this._data.core.themes.icons=a.icons,this._data.core.themes.ellipsis=a.ellipsis,this.set_theme(a.name||"default",a.url),this.set_theme_variant(a.variant)},this)).on("loading.jstree",a.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"](),this[this._data.core.themes.ellipsis?"show_ellipsis":"hide_ellipsis"]()},this)).on("blur.jstree",".jstree-anchor",a.proxy(function(b){this._data.core.focused=null,a(b.currentTarget).filter(".jstree-hovered").mouseleave(),this.element.attr("tabindex","0")},this)).on("focus.jstree",".jstree-anchor",a.proxy(function(b){var c=this.get_node(b.currentTarget);c&&c.id&&(this._data.core.focused=c.id),this.element.find(".jstree-hovered").not(b.currentTarget).mouseleave(),a(b.currentTarget).mouseenter(),this.element.attr("tabindex","-1")},this)).on("focus.jstree",a.proxy(function(){if(+new Date-d>500&&!this._data.core.focused&&this.settings.core.restore_focus){d=0;var a=this.get_node(this.element.attr("aria-activedescendant"),!0);a&&a.find("> .jstree-anchor").focus()}},this)).on("mouseenter.jstree",".jstree-anchor",a.proxy(function(a){this.hover_node(a.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",a.proxy(function(a){this.dehover_node(a.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),a(i).off(".jstree-"+this._id)},trigger:function(a,b){b||(b={}),b.instance=this,this.element.triggerHandler(a.replace(".jstree","")+".jstree",b)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(b){var c=this.settings.core.strings;return a.isFunction(c)?c.call(this,b):c&&c[b]?c[b]:b},_firstChild:function(a){a=a?a.firstChild:null;while(null!==a&&1!==a.nodeType)a=a.nextSibling;return a},_nextSibling:function(a){a=a?a.nextSibling:null;while(null!==a&&1!==a.nodeType)a=a.nextSibling;return a},_previousSibling:function(a){a=a?a.previousSibling:null;while(null!==a&&1!==a.nodeType)a=a.previousSibling;return a},get_node:function(b,c){b&&b.id&&(b=b.id),b instanceof jQuery&&b.length&&b[0].id&&(b=b[0].id);var d;try{if(this._model.data[b])b=this._model.data[b];else if("string"==typeof b&&this._model.data[b.replace(/^#/,"")])b=this._model.data[b.replace(/^#/,"")];else if("string"==typeof b&&(d=a("#"+b.replace(a.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[d.closest(".jstree-node").attr("id")])b=this._model.data[d.closest(".jstree-node").attr("id")];else if((d=this.element.find(b)).length&&this._model.data[d.closest(".jstree-node").attr("id")])b=this._model.data[d.closest(".jstree-node").attr("id")];else{if(!(d=this.element.find(b)).length||!d.hasClass("jstree"))return!1;b=this._model.data[a.jstree.root]}return c&&(b=b.id===a.jstree.root?this.element:a("#"+b.id.replace(a.jstree.idregex,"\\$&"),this.element)),b}catch(e){return!1}},get_path:function(b,c,d){if(b=b.parents?b:this.get_node(b),!b||b.id===a.jstree.root||!b.parents)return!1;var e,f,g=[];for(g.push(d?b.id:b.text),e=0,f=b.parents.length;f>e;e++)g.push(d?b.parents[e]:this.get_text(b.parents[e]));return g=g.reverse().slice(1),c?g.join(c):g},get_next_dom:function(b,c){var d;if(b=this.get_node(b,!0),b[0]===this.element[0]){d=this._firstChild(this.get_container_ul()[0]);while(d&&0===d.offsetHeight)d=this._nextSibling(d);return d?a(d):!1}if(!b||!b.length)return!1;if(c){d=b[0];do d=this._nextSibling(d);while(d&&0===d.offsetHeight);return d?a(d):!1}if(b.hasClass("jstree-open")){d=this._firstChild(b.children(".jstree-children")[0]);while(d&&0===d.offsetHeight)d=this._nextSibling(d);if(null!==d)return a(d)}d=b[0];do d=this._nextSibling(d);while(d&&0===d.offsetHeight);return null!==d?a(d):b.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(b,c){var d;if(b=this.get_node(b,!0),b[0]===this.element[0]){d=this.get_container_ul()[0].lastChild;while(d&&0===d.offsetHeight)d=this._previousSibling(d);return d?a(d):!1}if(!b||!b.length)return!1;if(c){d=b[0];do d=this._previousSibling(d);while(d&&0===d.offsetHeight);return d?a(d):!1}d=b[0];do d=this._previousSibling(d);while(d&&0===d.offsetHeight);if(null!==d){b=a(d);while(b.hasClass("jstree-open"))b=b.children(".jstree-children").first().children(".jstree-node:visible:last");return b}return d=b[0].parentNode.parentNode,d&&d.className&&-1!==d.className.indexOf("jstree-node")?a(d):!1},get_parent:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.parent:!1},get_children_dom:function(a){return a=this.get_node(a,!0),a[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):a&&a.length?a.children(".jstree-children").children(".jstree-node"):!1},is_parent:function(a){return a=this.get_node(a),a&&(a.state.loaded===!1||a.children.length>0)},is_loaded:function(a){return a=this.get_node(a),a&&a.state.loaded},is_loading:function(a){return a=this.get_node(a),a&&a.state&&a.state.loading},is_open:function(a){return a=this.get_node(a),a&&a.state.opened},is_closed:function(a){return a=this.get_node(a),a&&this.is_parent(a)&&!a.state.opened},is_leaf:function(a){return!this.is_parent(a)},load_node:function(b,c){var d,e,f,g,h;if(a.isArray(b))return this._load_nodes(b.slice(),c),!0;if(b=this.get_node(b),!b)return c&&c.call(this,b,!1),!1;if(b.state.loaded){for(b.state.loaded=!1,f=0,g=b.parents.length;g>f;f++)this._model.data[b.parents[f]].children_d=a.vakata.array_filter(this._model.data[b.parents[f]].children_d,function(c){return-1===a.inArray(c,b.children_d)});for(d=0,e=b.children_d.length;e>d;d++)this._model.data[b.children_d[d]].state.selected&&(h=!0),delete this._model.data[b.children_d[d]];h&&(this._data.core.selected=a.vakata.array_filter(this._data.core.selected,function(c){return-1===a.inArray(c,b.children_d)})),b.children=[],b.children_d=[],h&&this.trigger("changed",{action:"load_node",node:b,selected:this._data.core.selected})}return b.state.failed=!1,b.state.loading=!0,this.get_node(b,!0).addClass("jstree-loading").attr("aria-busy",!0),this._load_node(b,a.proxy(function(a){b=this._model.data[b.id],b.state.loading=!1,b.state.loaded=a,b.state.failed=!b.state.loaded;var d=this.get_node(b,!0),e=0,f=0,g=this._model.data,h=!1;for(e=0,f=b.children.length;f>e;e++)if(g[b.children[e]]&&!g[b.children[e]].state.hidden){h=!0;break}b.state.loaded&&d&&d.length&&(d.removeClass("jstree-closed jstree-open jstree-leaf"),h?"#"!==b.id&&d.addClass(b.state.opened?"jstree-open":"jstree-closed"):d.addClass("jstree-leaf")),d.removeClass("jstree-loading").attr("aria-busy",!1),this.trigger("load_node",{node:b,status:a}),c&&c.call(this,b,a)},this)),!0},_load_nodes:function(a,b,c,d){var e=!0,f=function(){this._load_nodes(a,b,!0)},g=this._model.data,h,i,j=[];for(h=0,i=a.length;i>h;h++)g[a[h]]&&(!g[a[h]].state.loaded&&!g[a[h]].state.failed||!c&&d)&&(this.is_loading(a[h])||this.load_node(a[h],f),e=!1);if(e){for(h=0,i=a.length;i>h;h++)g[a[h]]&&g[a[h]].state.loaded&&j.push(a[h]);b&&!b.done&&(b.call(this,j),b.done=!0)}},load_all:function(b,c){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var d=[],e=this._model.data,f=e[b.id].children_d,g,h;for(b.state&&!b.state.loaded&&d.push(b.id),g=0,h=f.length;h>g;g++)e[f[g]]&&e[f[g]].state&&!e[f[g]].state.loaded&&d.push(f[g]);d.length?this._load_nodes(d,function(){this.load_all(b,c)}):(c&&c.call(this,b),this.trigger("load_all",{node:b}))},_load_node:function(b,c){var d=this.settings.core.data,e,f=function g(){return 3!==this.nodeType&&8!==this.nodeType};return d?a.isFunction(d)?d.call(this,b,a.proxy(function(d){d===!1?c.call(this,!1):this["string"==typeof d?"_append_html_data":"_append_json_data"](b,"string"==typeof d?a(a.parseHTML(d)).filter(f):d,function(a){c.call(this,a)})},this)):"object"==typeof d?d.url?(d=a.extend(!0,{},d),a.isFunction(d.url)&&(d.url=d.url.call(this,b)),a.isFunction(d.data)&&(d.data=d.data.call(this,b)),a.ajax(d).done(a.proxy(function(d,e,g){var h=g.getResponseHeader("Content-Type");return h&&-1!==h.indexOf("json")||"object"==typeof d?this._append_json_data(b,d,function(a){c.call(this,a)}):h&&-1!==h.indexOf("html")||"string"==typeof d?this._append_html_data(b,a(a.parseHTML(d)).filter(f),function(a){c.call(this,a)}):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:b.id,xhr:g})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1))},this)).fail(a.proxy(function(a){this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:b.id,xhr:a})},c.call(this,!1),this.settings.core.error.call(this,this._data.core.last_error)},this))):(e=a.isArray(d)?a.extend(!0,[],d):a.isPlainObject(d)?a.extend(!0,{},d):d,b.id===a.jstree.root?this._append_json_data(b,e,function(a){c.call(this,a)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:b.id})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1))):"string"==typeof d?b.id===a.jstree.root?this._append_html_data(b,a(a.parseHTML(d)).filter(f),function(a){c.call(this,a)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:b.id})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1)):c.call(this,!1):b.id===a.jstree.root?this._append_html_data(b,this._data.core.original_container_html.clone(!0),function(a){c.call(this,a)}):c.call(this,!1)},_node_changed:function(b){b=this.get_node(b),b&&-1===a.inArray(b.id,this._model.changed)&&this._model.changed.push(b.id)},_append_html_data:function(b,c,d){b=this.get_node(b),b.children=[],b.children_d=[];var e=c.is("ul")?c.children():c,f=b.id,g=[],h=[],i=this._model.data,j=i[f],k=this._data.core.selected.length,l,m,n;for(e.each(a.proxy(function(b,c){l=this._parse_model_from_html(a(c),f,j.parents.concat()),l&&(g.push(l),h.push(l),i[l].children_d.length&&(h=h.concat(i[l].children_d)))},this)),j.children=g,j.children_d=h,m=0,n=j.parents.length;n>m;m++)i[j.parents[m]].children_d=i[j.parents[m]].children_d.concat(h);this.trigger("model",{nodes:h,parent:f}),f!==a.jstree.root?(this._node_changed(f),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==k&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),d.call(this,!0)},_append_json_data:function(b,c,d,e){if(null!==this.element){b=this.get_node(b),b.children=[],b.children_d=[],c.d&&(c=c.d,"string"==typeof c&&(c=JSON.parse(c))),a.isArray(c)||(c=[c]);var f=null,g={df:this._model.default_state,dat:c,par:b.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},h=function(a,b){a.data&&(a=a.data);var c=a.dat,d=a.par,e=[],f=[],g=[],h=a.df,i=a.t_id,j=a.t_cnt,k=a.m,l=k[d],m=a.sel,n,o,p,q,r=function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=a.id.toString(),f,i,j,l,m={id:e,text:a.text||"",icon:a.icon!==b?a.icon:!0,parent:c,parents:d,children:a.children||[],children_d:a.children_d||[],data:a.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in h)h.hasOwnProperty(f)&&(m.state[f]=h[f]);if(a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(m.icon=a.data.jstree.icon),(m.icon===b||null===m.icon||""===m.icon)&&(m.icon=!0),a&&a.data&&(m.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(m.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(m.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(m.li_attr[f]=a.li_attr[f]);if(m.li_attr.id||(m.li_attr.id=e),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(m.a_attr[f]=a.a_attr[f]);for(a&&a.children&&a.children===!0&&(m.state.loaded=!1,m.children=[],m.children_d=[]),k[m.id]=m,f=0,i=m.children.length;i>f;f++)j=r(k[m.children[f]],m.id,d),l=k[j],m.children_d.push(j),l.children_d.length&&(m.children_d=m.children_d.concat(l.children_d));return delete a.data,delete a.children,k[m.id].original=a,m.state.selected&&g.push(m.id),m.id},s=function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=!1,f,l,m,n,o;do e="j"+i+"_"+ ++j;while(k[e]);o={id:!1,text:"string"==typeof a?a:"",icon:"object"==typeof a&&a.icon!==b?a.icon:!0,parent:c,parents:d,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in h)h.hasOwnProperty(f)&&(o.state[f]=h[f]);if(a&&a.id&&(o.id=a.id.toString()),a&&a.text&&(o.text=a.text),a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(o.icon=a.data.jstree.icon),(o.icon===b||null===o.icon||""===o.icon)&&(o.icon=!0),a&&a.data&&(o.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(o.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(o.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(o.li_attr[f]=a.li_attr[f]);if(o.li_attr.id&&!o.id&&(o.id=o.li_attr.id.toString()),o.id||(o.id=e),o.li_attr.id||(o.li_attr.id=o.id),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(o.a_attr[f]=a.a_attr[f]);if(a&&a.children&&a.children.length){for(f=0,l=a.children.length;l>f;f++)m=s(a.children[f],o.id,d),n=k[m],o.children.push(m),n.children_d.length&&(o.children_d=o.children_d.concat(n.children_d));o.children_d=o.children_d.concat(o.children)}return a&&a.children&&a.children===!0&&(o.state.loaded=!1,o.children=[],o.children_d=[]),delete a.data,delete a.children,o.original=a,k[o.id]=o,o.state.selected&&g.push(o.id),o.id};if(c.length&&c[0].id!==b&&c[0].parent!==b){for(o=0,p=c.length;p>o;o++)c[o].children||(c[o].children=[]),c[o].state||(c[o].state={}),k[c[o].id.toString()]=c[o];for(o=0,p=c.length;p>o;o++)k[c[o].parent.toString()]?(k[c[o].parent.toString()].children.push(c[o].id.toString()),l.children_d.push(c[o].id.toString())):(this._data.core.last_error={error:"parse",plugin:"core",id:"core_07",reason:"Node with invalid parent",data:JSON.stringify({id:c[o].id.toString(),parent:c[o].parent.toString()})},this.settings.core.error.call(this,this._data.core.last_error));for(o=0,p=l.children.length;p>o;o++)n=r(k[l.children[o]],d,l.parents.concat()),f.push(n),k[n].children_d.length&&(f=f.concat(k[n].children_d));for(o=0,p=l.parents.length;p>o;o++)k[l.parents[o]].children_d=k[l.parents[o]].children_d.concat(f);q={cnt:j,mod:k,sel:m,par:d,dpc:f,add:g}}else{for(o=0,p=c.length;p>o;o++)n=s(c[o],d,l.parents.concat()),n&&(e.push(n),f.push(n),k[n].children_d.length&&(f=f.concat(k[n].children_d)));for(l.children=e,l.children_d=f,o=0,p=l.parents.length;p>o;o++)k[l.parents[o]].children_d=k[l.parents[o]].children_d.concat(f);q={cnt:j,mod:k,sel:m,par:d,dpc:f,add:g}}return"undefined"!=typeof window&&"undefined"!=typeof window.document?q:void postMessage(q)},i=function(b,c){if(null!==this.element){this._cnt=b.cnt;var e,f=this._model.data;for(e in f)f.hasOwnProperty(e)&&f[e].state&&f[e].state.loading&&b.mod[e]&&(b.mod[e].state.loading=!0);if(this._model.data=b.mod,c){var g,h=b.add,i=b.sel,j=this._data.core.selected.slice();if(f=this._model.data,i.length!==j.length||a.vakata.array_unique(i.concat(j)).length!==i.length){for(e=0,g=i.length;g>e;e++)-1===a.inArray(i[e],h)&&-1===a.inArray(i[e],j)&&(f[i[e]].state.selected=!1);for(e=0,g=j.length;g>e;e++)-1===a.inArray(j[e],i)&&(f[j[e]].state.selected=!0)}}b.add.length&&(this._data.core.selected=this._data.core.selected.concat(b.add)),this.trigger("model",{nodes:b.dpc,parent:b.par}),b.par!==a.jstree.root?(this._node_changed(b.par),this.redraw()):this.redraw(!0),b.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),d.call(this,!0)}};if(this.settings.core.worker&&window.Blob&&window.URL&&window.Worker)try{null===this._wrk&&(this._wrk=window.URL.createObjectURL(new window.Blob(["self.onmessage = "+h.toString()],{type:"text/javascript"}))),!this._data.core.working||e?(this._data.core.working=!0,f=new window.Worker(this._wrk),f.onmessage=a.proxy(function(a){i.call(this,a.data,!0);try{f.terminate(),f=null}catch(b){}this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1},this),g.par?f.postMessage(g):this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1):this._data.core.worker_queue.push([b,c,d,!0])}catch(j){i.call(this,h(g),!1),this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else i.call(this,h(g),!1)}},_parse_model_from_html:function(c,d,e){e=e?[].concat(e):[],d&&e.unshift(d);var f,g,h=this._model.data,i={id:!1,text:!1,icon:!0,parent:d,parents:e,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},j,k,l;for(j in this._model.default_state)this._model.default_state.hasOwnProperty(j)&&(i.state[j]=this._model.default_state[j]);if(k=a.vakata.attributes(c,!0),a.each(k,function(b,c){return c=a.trim(c),c.length?(i.li_attr[b]=c,void("id"===b&&(i.id=c.toString()))):!0}),k=c.children("a").first(),k.length&&(k=a.vakata.attributes(k,!0),a.each(k,function(b,c){c=a.trim(c),c.length&&(i.a_attr[b]=c)})),k=c.children("a").first().length?c.children("a").first().clone():c.clone(),k.children("ins, i, ul").remove(),k=k.html(),k=a("<div />").html(k),i.text=this.settings.core.force_text?k.text():k.html(),k=c.data(),i.data=k?a.extend(!0,{},k):null,i.state.opened=c.hasClass("jstree-open"),i.state.selected=c.children("a").hasClass("jstree-clicked"),i.state.disabled=c.children("a").hasClass("jstree-disabled"),i.data&&i.data.jstree)for(j in i.data.jstree)i.data.jstree.hasOwnProperty(j)&&(i.state[j]=i.data.jstree[j]);k=c.children("a").children(".jstree-themeicon"),k.length&&(i.icon=k.hasClass("jstree-themeicon-hidden")?!1:k.attr("rel")),i.state.icon!==b&&(i.icon=i.state.icon),(i.icon===b||null===i.icon||""===i.icon)&&(i.icon=!0),k=c.children("ul").children("li");do l="j"+this._id+"_"+ ++this._cnt;while(h[l]);return i.id=i.li_attr.id?i.li_attr.id.toString():l,k.length?(k.each(a.proxy(function(b,c){f=this._parse_model_from_html(a(c),i.id,e),g=this._model.data[f],i.children.push(f),g.children_d.length&&(i.children_d=i.children_d.concat(g.children_d))},this)),i.children_d=i.children_d.concat(i.children)):c.hasClass("jstree-closed")&&(i.state.loaded=!1),i.li_attr["class"]&&(i.li_attr["class"]=i.li_attr["class"].replace("jstree-closed","").replace("jstree-open","")),i.a_attr["class"]&&(i.a_attr["class"]=i.a_attr["class"].replace("jstree-clicked","").replace("jstree-disabled","")),h[i.id]=i,i.state.selected&&this._data.core.selected.push(i.id),i.id},_parse_model_from_flat_json:function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=a.id.toString(),f=this._model.data,g=this._model.default_state,h,i,j,k,l={id:e,text:a.text||"",icon:a.icon!==b?a.icon:!0,parent:c,parents:d,children:a.children||[],children_d:a.children_d||[],data:a.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(h in g)g.hasOwnProperty(h)&&(l.state[h]=g[h]);if(a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(l.icon=a.data.jstree.icon),(l.icon===b||null===l.icon||""===l.icon)&&(l.icon=!0),a&&a.data&&(l.data=a.data,a.data.jstree))for(h in a.data.jstree)a.data.jstree.hasOwnProperty(h)&&(l.state[h]=a.data.jstree[h]);if(a&&"object"==typeof a.state)for(h in a.state)a.state.hasOwnProperty(h)&&(l.state[h]=a.state[h]);if(a&&"object"==typeof a.li_attr)for(h in a.li_attr)a.li_attr.hasOwnProperty(h)&&(l.li_attr[h]=a.li_attr[h]);if(l.li_attr.id||(l.li_attr.id=e),a&&"object"==typeof a.a_attr)for(h in a.a_attr)a.a_attr.hasOwnProperty(h)&&(l.a_attr[h]=a.a_attr[h]);for(a&&a.children&&a.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),f[l.id]=l,h=0,i=l.children.length;i>h;h++)j=this._parse_model_from_flat_json(f[l.children[h]],l.id,d),k=f[j],l.children_d.push(j),k.children_d.length&&(l.children_d=l.children_d.concat(k.children_d));return delete a.data,delete a.children,f[l.id].original=a,l.state.selected&&this._data.core.selected.push(l.id),l.id},_parse_model_from_json:function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=!1,f,g,h,i,j=this._model.data,k=this._model.default_state,l;do e="j"+this._id+"_"+ ++this._cnt;while(j[e]);l={id:!1,text:"string"==typeof a?a:"",icon:"object"==typeof a&&a.icon!==b?a.icon:!0,parent:c,parents:d,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in k)k.hasOwnProperty(f)&&(l.state[f]=k[f]);if(a&&a.id&&(l.id=a.id.toString()),a&&a.text&&(l.text=a.text),a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(l.icon=a.data.jstree.icon),(l.icon===b||null===l.icon||""===l.icon)&&(l.icon=!0),a&&a.data&&(l.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(l.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(l.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(l.li_attr[f]=a.li_attr[f]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),
|
3 |
+
l.id||(l.id=e),l.li_attr.id||(l.li_attr.id=l.id),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(l.a_attr[f]=a.a_attr[f]);if(a&&a.children&&a.children.length){for(f=0,g=a.children.length;g>f;f++)h=this._parse_model_from_json(a.children[f],l.id,d),i=j[h],l.children.push(h),i.children_d.length&&(l.children_d=l.children_d.concat(i.children_d));l.children_d=l.children_d.concat(l.children)}return a&&a.children&&a.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete a.data,delete a.children,l.original=a,j[l.id]=l,l.state.selected&&this._data.core.selected.push(l.id),l.id},_redraw:function(){var b=this._model.force_full_redraw?this._model.data[a.jstree.root].children.concat([]):this._model.changed.concat([]),c=i.createElement("UL"),d,e,f,g=this._data.core.focused;for(e=0,f=b.length;f>e;e++)d=this.redraw_node(b[e],!0,this._model.force_full_redraw),d&&this._model.force_full_redraw&&c.appendChild(d);this._model.force_full_redraw&&(c.className=this.get_container_ul()[0].className,c.setAttribute("role","group"),this.element.empty().append(c)),null!==g&&this.settings.core.restore_focus&&(d=this.get_node(g,!0),d&&d.length&&d.children(".jstree-anchor")[0]!==i.activeElement?d.children(".jstree-anchor").focus():this._data.core.focused=null),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:b})},redraw:function(a){a&&(this._model.force_full_redraw=!0),this._redraw()},draw_children:function(b){var c=this.get_node(b),d=!1,e=!1,f=!1,g=i;if(!c)return!1;if(c.id===a.jstree.root)return this.redraw(!0);if(b=this.get_node(b,!0),!b||!b.length)return!1;if(b.children(".jstree-children").remove(),b=b[0],c.children.length&&c.state.loaded){for(f=g.createElement("UL"),f.setAttribute("role","group"),f.className="jstree-children",d=0,e=c.children.length;e>d;d++)f.appendChild(this.redraw_node(c.children[d],!0,!0));b.appendChild(f)}},redraw_node:function(b,c,d,e){var f=this.get_node(b),g=!1,h=!1,j=!1,k=!1,l=!1,m=!1,n="",o=i,p=this._model.data,q=!1,r=!1,s=null,t=0,u=0,v=!1,w=!1;if(!f)return!1;if(f.id===a.jstree.root)return this.redraw(!0);if(c=c||0===f.children.length,b=i.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(f.id[0])?"\\3"+f.id[0]+" "+f.id.substr(1).replace(a.jstree.idregex,"\\$&"):f.id.replace(a.jstree.idregex,"\\$&"))):i.getElementById(f.id))b=a(b),d||(g=b.parent().parent()[0],g===this.element[0]&&(g=null),h=b.index()),c||!f.children.length||b.children(".jstree-children").length||(c=!0),c||(j=b.children(".jstree-children")[0]),q=b.children(".jstree-anchor")[0]===i.activeElement,b.remove();else if(c=!0,!d){if(g=f.parent!==a.jstree.root?a("#"+f.parent.replace(a.jstree.idregex,"\\$&"),this.element)[0]:null,!(null===g||g&&p[f.parent].state.opened))return!1;h=a.inArray(f.id,null===g?p[a.jstree.root].children:p[f.parent].children)}b=this._data.core.node.cloneNode(!0),n="jstree-node ";for(k in f.li_attr)if(f.li_attr.hasOwnProperty(k)){if("id"===k)continue;"class"!==k?b.setAttribute(k,f.li_attr[k]):n+=f.li_attr[k]}for(f.a_attr.id||(f.a_attr.id=f.id+"_anchor"),b.setAttribute("aria-selected",!!f.state.selected),b.setAttribute("aria-level",f.parents.length),b.setAttribute("aria-labelledby",f.a_attr.id),f.state.disabled&&b.setAttribute("aria-disabled",!0),k=0,l=f.children.length;l>k;k++)if(!p[f.children[k]].state.hidden){v=!0;break}if(null!==f.parent&&p[f.parent]&&!f.state.hidden&&(k=a.inArray(f.id,p[f.parent].children),w=f.id,-1!==k))for(k++,l=p[f.parent].children.length;l>k;k++)if(p[p[f.parent].children[k]].state.hidden||(w=p[f.parent].children[k]),w!==f.id)break;f.state.hidden&&(n+=" jstree-hidden"),f.state.loading&&(n+=" jstree-loading"),f.state.loaded&&!v?n+=" jstree-leaf":(n+=f.state.opened&&f.state.loaded?" jstree-open":" jstree-closed",b.setAttribute("aria-expanded",f.state.opened&&f.state.loaded)),w===f.id&&(n+=" jstree-last"),b.id=f.id,b.className=n,n=(f.state.selected?" jstree-clicked":"")+(f.state.disabled?" jstree-disabled":"");for(l in f.a_attr)if(f.a_attr.hasOwnProperty(l)){if("href"===l&&"#"===f.a_attr[l])continue;"class"!==l?b.childNodes[1].setAttribute(l,f.a_attr[l]):n+=" "+f.a_attr[l]}if(n.length&&(b.childNodes[1].className="jstree-anchor "+n),(f.icon&&f.icon!==!0||f.icon===!1)&&(f.icon===!1?b.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===f.icon.indexOf("/")&&-1===f.icon.indexOf(".")?b.childNodes[1].childNodes[0].className+=" "+f.icon+" jstree-themeicon-custom":(b.childNodes[1].childNodes[0].style.backgroundImage='url("'+f.icon+'")',b.childNodes[1].childNodes[0].style.backgroundPosition="center center",b.childNodes[1].childNodes[0].style.backgroundSize="auto",b.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?b.childNodes[1].appendChild(o.createTextNode(f.text)):b.childNodes[1].innerHTML+=f.text,c&&f.children.length&&(f.state.opened||e)&&f.state.loaded){for(m=o.createElement("UL"),m.setAttribute("role","group"),m.className="jstree-children",k=0,l=f.children.length;l>k;k++)m.appendChild(this.redraw_node(f.children[k],c,!0));b.appendChild(m)}if(j&&b.appendChild(j),!d){for(g||(g=this.element[0]),k=0,l=g.childNodes.length;l>k;k++)if(g.childNodes[k]&&g.childNodes[k].className&&-1!==g.childNodes[k].className.indexOf("jstree-children")){s=g.childNodes[k];break}s||(s=o.createElement("UL"),s.setAttribute("role","group"),s.className="jstree-children",g.appendChild(s)),g=s,h<g.childNodes.length?g.insertBefore(b,g.childNodes[h]):g.appendChild(b),q&&(t=this.element[0].scrollTop,u=this.element[0].scrollLeft,b.childNodes[1].focus(),this.element[0].scrollTop=t,this.element[0].scrollLeft=u)}return f.state.opened&&!f.state.loaded&&(f.state.opened=!1,setTimeout(a.proxy(function(){this.open_node(f.id,!1,0)},this),0)),b},open_node:function(c,d,e){var f,g,h,i;if(a.isArray(c)){for(c=c.slice(),f=0,g=c.length;g>f;f++)this.open_node(c[f],d,e);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?(e=e===b?this.settings.core.animation:e,this.is_closed(c)?this.is_loaded(c)?(h=this.get_node(c,!0),i=this,h.length&&(e&&h.children(".jstree-children").length&&h.children(".jstree-children").stop(!0,!0),c.children.length&&!this._firstChild(h.children(".jstree-children")[0])&&this.draw_children(c),e?(this.trigger("before_open",{node:c}),h.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children(".jstree-children").stop(!0,!0).slideDown(e,function(){this.style.display="",i.element&&i.trigger("after_open",{node:c})})):(this.trigger("before_open",{node:c}),h[0].className=h[0].className.replace("jstree-closed","jstree-open"),h[0].setAttribute("aria-expanded",!0))),c.state.opened=!0,d&&d.call(this,c,!0),h.length||this.trigger("before_open",{node:c}),this.trigger("open_node",{node:c}),e&&h.length||this.trigger("after_open",{node:c}),!0):this.is_loading(c)?setTimeout(a.proxy(function(){this.open_node(c,d,e)},this),500):void this.load_node(c,function(a,b){return b?this.open_node(a,d,e):d?d.call(this,a,!1):!1}):(d&&d.call(this,c,!1),!1)):!1},_open_to:function(b){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var c,d,e=b.parents;for(c=0,d=e.length;d>c;c+=1)c!==a.jstree.root&&this.open_node(e[c],!1,0);return a("#"+b.id.replace(a.jstree.idregex,"\\$&"),this.element)},close_node:function(c,d){var e,f,g,h;if(a.isArray(c)){for(c=c.slice(),e=0,f=c.length;f>e;e++)this.close_node(c[e],d);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?this.is_closed(c)?!1:(d=d===b?this.settings.core.animation:d,g=this,h=this.get_node(c,!0),c.state.opened=!1,this.trigger("close_node",{node:c}),void(h.length?d?h.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children(".jstree-children").stop(!0,!0).slideUp(d,function(){this.style.display="",h.children(".jstree-children").remove(),g.element&&g.trigger("after_close",{node:c})}):(h[0].className=h[0].className.replace("jstree-open","jstree-closed"),h.attr("aria-expanded",!1).children(".jstree-children").remove(),this.trigger("after_close",{node:c})):this.trigger("after_close",{node:c}))):!1},toggle_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.toggle_node(b[c]);return!0}return this.is_closed(b)?this.open_node(b):this.is_open(b)?this.close_node(b):void 0},open_all:function(b,c,d){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var e=b.id===a.jstree.root?this.get_container_ul():this.get_node(b,!0),f,g,h;if(!e.length){for(f=0,g=b.children_d.length;g>f;f++)this.is_closed(this._model.data[b.children_d[f]])&&(this._model.data[b.children_d[f]].state.opened=!0);return this.trigger("open_all",{node:b})}d=d||e,h=this,e=this.is_closed(b)?e.find(".jstree-closed").addBack():e.find(".jstree-closed"),e.each(function(){h.open_node(this,function(a,b){b&&this.is_parent(a)&&this.open_all(a,c,d)},c||0)}),0===d.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(d)})},close_all:function(b,c){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var d=b.id===a.jstree.root?this.get_container_ul():this.get_node(b,!0),e=this,f,g;for(d.length&&(d=this.is_open(b)?d.find(".jstree-open").addBack():d.find(".jstree-open"),a(d.get().reverse()).each(function(){e.close_node(this,c||0)})),f=0,g=b.children_d.length;g>f;f++)this._model.data[b.children_d[f]].state.opened=!1;this.trigger("close_all",{node:b})},is_disabled:function(a){return a=this.get_node(a),a&&a.state&&a.state.disabled},enable_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.enable_node(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.state.disabled=!1,this.get_node(b,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),void this.trigger("enable_node",{node:b})):!1},disable_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.disable_node(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.state.disabled=!0,this.get_node(b,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),void this.trigger("disable_node",{node:b})):!1},is_hidden:function(a){return a=this.get_node(a),a.state.hidden===!0},hide_node:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.hide_node(b[d],!0);return c||this.redraw(),!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?void(b.state.hidden||(b.state.hidden=!0,this._node_changed(b.parent),c||this.redraw(),this.trigger("hide_node",{node:b}))):!1},show_node:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.show_node(b[d],!0);return c||this.redraw(),!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?void(b.state.hidden&&(b.state.hidden=!1,this._node_changed(b.parent),c||this.redraw(),this.trigger("show_node",{node:b}))):!1},hide_all:function(b){var c,d=this._model.data,e=[];for(c in d)d.hasOwnProperty(c)&&c!==a.jstree.root&&!d[c].state.hidden&&(d[c].state.hidden=!0,e.push(c));return this._model.force_full_redraw=!0,b||this.redraw(),this.trigger("hide_all",{nodes:e}),e},show_all:function(b){var c,d=this._model.data,e=[];for(c in d)d.hasOwnProperty(c)&&c!==a.jstree.root&&d[c].state.hidden&&(d[c].state.hidden=!1,e.push(c));return this._model.force_full_redraw=!0,b||this.redraw(),this.trigger("show_all",{nodes:e}),e},activate_node:function(a,c){if(this.is_disabled(a))return!1;if(c&&"object"==typeof c||(c={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==b?this.get_node(this._data.core.last_clicked.id):null,this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&(this._data.core.last_clicked=null),!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1])),this.settings.core.multiple&&(c.metaKey||c.ctrlKey||c.shiftKey)&&(!c.shiftKey||this._data.core.last_clicked&&this.get_parent(a)&&this.get_parent(a)===this._data.core.last_clicked.parent))if(c.shiftKey){var d=this.get_node(a).id,e=this._data.core.last_clicked.id,f=this.get_node(this._data.core.last_clicked.parent).children,g=!1,h,i;for(h=0,i=f.length;i>h;h+=1)f[h]===d&&(g=!g),f[h]===e&&(g=!g),this.is_disabled(f[h])||!g&&f[h]!==d&&f[h]!==e?this.deselect_node(f[h],!0,c):this.is_hidden(f[h])||this.select_node(f[h],!0,!1,c);this.trigger("changed",{action:"select_node",node:this.get_node(a),selected:this._data.core.selected,event:c})}else this.is_selected(a)?this.deselect_node(a,!1,c):this.select_node(a,!1,!1,c);else!this.settings.core.multiple&&(c.metaKey||c.ctrlKey||c.shiftKey)&&this.is_selected(a)?this.deselect_node(a,!1,c):(this.deselect_all(!0),this.select_node(a,!1,!1,c),this._data.core.last_clicked=this.get_node(a));this.trigger("activate_node",{node:this.get_node(a),event:c})},hover_node:function(a){if(a=this.get_node(a,!0),!a||!a.length||a.children(".jstree-hovered").length)return!1;var b=this.element.find(".jstree-hovered"),c=this.element;b&&b.length&&this.dehover_node(b),a.children(".jstree-anchor").addClass("jstree-hovered"),this.trigger("hover_node",{node:this.get_node(a)}),setTimeout(function(){c.attr("aria-activedescendant",a[0].id)},0)},dehover_node:function(a){return a=this.get_node(a,!0),a&&a.length&&a.children(".jstree-hovered").length?(a.children(".jstree-anchor").removeClass("jstree-hovered"),void this.trigger("dehover_node",{node:this.get_node(a)})):!1},select_node:function(b,c,d,e){var f,g,h,i;if(a.isArray(b)){for(b=b.slice(),g=0,h=b.length;h>g;g++)this.select_node(b[g],c,d,e);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=this.get_node(b,!0),void(b.state.selected||(b.state.selected=!0,this._data.core.selected.push(b.id),d||(f=this._open_to(b)),f&&f.length&&f.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:b,selected:this._data.core.selected,event:e}),c||this.trigger("changed",{action:"select_node",node:b,selected:this._data.core.selected,event:e})))):!1},deselect_node:function(b,c,d){var e,f,g;if(a.isArray(b)){for(b=b.slice(),e=0,f=b.length;f>e;e++)this.deselect_node(b[e],c,d);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(g=this.get_node(b,!0),void(b.state.selected&&(b.state.selected=!1,this._data.core.selected=a.vakata.array_remove_item(this._data.core.selected,b.id),g.length&&g.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:b,selected:this._data.core.selected,event:d}),c||this.trigger("changed",{action:"deselect_node",node:b,selected:this._data.core.selected,event:d})))):!1},select_all:function(b){var c=this._data.core.selected.concat([]),d,e;for(this._data.core.selected=this._model.data[a.jstree.root].children_d.concat(),d=0,e=this._data.core.selected.length;e>d;d++)this._model.data[this._data.core.selected[d]]&&(this._model.data[this._data.core.selected[d]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),b||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:c})},deselect_all:function(a){var b=this._data.core.selected.concat([]),c,d;for(c=0,d=this._data.core.selected.length;d>c;c++)this._model.data[this._data.core.selected[c]]&&(this._model.data[this._data.core.selected[c]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked").parent().attr("aria-selected",!1),this.trigger("deselect_all",{selected:this._data.core.selected,node:b}),a||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:b})},is_selected:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.state.selected:!1},get_selected:function(b){return b?a.map(this._data.core.selected,a.proxy(function(a){return this.get_node(a)},this)):this._data.core.selected.slice()},get_top_selected:function(b){var c=this.get_selected(!0),d={},e,f,g,h;for(e=0,f=c.length;f>e;e++)d[c[e].id]=c[e];for(e=0,f=c.length;f>e;e++)for(g=0,h=c[e].children_d.length;h>g;g++)d[c[e].children_d[g]]&&delete d[c[e].children_d[g]];c=[];for(e in d)d.hasOwnProperty(e)&&c.push(e);return b?a.map(c,a.proxy(function(a){return this.get_node(a)},this)):c},get_bottom_selected:function(b){var c=this.get_selected(!0),d=[],e,f;for(e=0,f=c.length;f>e;e++)c[e].children.length||d.push(c[e].id);return b?a.map(d,a.proxy(function(a){return this.get_node(a)},this)):d},get_state:function(){var b={core:{open:[],loaded:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}},c;for(c in this._model.data)this._model.data.hasOwnProperty(c)&&c!==a.jstree.root&&(this._model.data[c].state.loaded&&this.settings.core.loaded_state&&b.core.loaded.push(c),this._model.data[c].state.opened&&b.core.open.push(c),this._model.data[c].state.selected&&b.core.selected.push(c));return b},set_state:function(c,d){if(c){if(c.core&&c.core.selected&&c.core.initial_selection===b&&(c.core.initial_selection=this._data.core.selected.concat([]).sort().join(",")),c.core){var e,f,g,h,i;if(c.core.loaded)return this.settings.core.loaded_state&&a.isArray(c.core.loaded)&&c.core.loaded.length?this._load_nodes(c.core.loaded,function(a){delete c.core.loaded,this.set_state(c,d)}):(delete c.core.loaded,this.set_state(c,d)),!1;if(c.core.open)return a.isArray(c.core.open)&&c.core.open.length?this._load_nodes(c.core.open,function(a){this.open_node(a,!1,0),delete c.core.open,this.set_state(c,d)}):(delete c.core.open,this.set_state(c,d)),!1;if(c.core.scroll)return c.core.scroll&&c.core.scroll.left!==b&&this.element.scrollLeft(c.core.scroll.left),c.core.scroll&&c.core.scroll.top!==b&&this.element.scrollTop(c.core.scroll.top),delete c.core.scroll,this.set_state(c,d),!1;if(c.core.selected)return h=this,(c.core.initial_selection===b||c.core.initial_selection===this._data.core.selected.concat([]).sort().join(","))&&(this.deselect_all(),a.each(c.core.selected,function(a,b){h.select_node(b,!1,!0)})),delete c.core.initial_selection,delete c.core.selected,this.set_state(c,d),!1;for(i in c)c.hasOwnProperty(i)&&"core"!==i&&-1===a.inArray(i,this.settings.plugins)&&delete c[i];if(a.isEmptyObject(c.core))return delete c.core,this.set_state(c,d),!1}return a.isEmptyObject(c)?(c=null,d&&d.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(b,c){this._data.core.state=c===!0?{}:this.get_state(),c&&a.isFunction(c)&&(this._data.core.state=c.call(this,this._data.core.state)),this._cnt=0,this._model.data={},this._model.data[a.jstree.root]={id:a.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this._data.core.selected=[],this._data.core.last_clicked=null,this._data.core.focused=null;var d=this.get_container_ul()[0].className;b||(this.element.html("<ul class='"+d+"' role='group'><li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j"+this._id+"_loading'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading")),this.load_node(a.jstree.root,function(b,c){c&&(this.get_container_ul()[0].className=d,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(a.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")})),this._data.core.state=null})},refresh_node:function(b){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var c=[],d=[],e=this._data.core.selected.concat([]);d.push(b.id),b.state.opened===!0&&c.push(b.id),this.get_node(b,!0).find(".jstree-open").each(function(){d.push(this.id),c.push(this.id)}),this._load_nodes(d,a.proxy(function(a){this.open_node(c,!1,0),this.select_node(e),this.trigger("refresh_node",{node:b,nodes:a})},this),!1,!0)},set_id:function(b,c){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var d,e,f=this._model.data,g=b.id;for(c=c.toString(),f[b.parent].children[a.inArray(b.id,f[b.parent].children)]=c,d=0,e=b.parents.length;e>d;d++)f[b.parents[d]].children_d[a.inArray(b.id,f[b.parents[d]].children_d)]=c;for(d=0,e=b.children.length;e>d;d++)f[b.children[d]].parent=c;for(d=0,e=b.children_d.length;e>d;d++)f[b.children_d[d]].parents[a.inArray(b.id,f[b.children_d[d]].parents)]=c;return d=a.inArray(b.id,this._data.core.selected),-1!==d&&(this._data.core.selected[d]=c),d=this.get_node(b.id,!0),d&&(d.attr("id",c),this.element.attr("aria-activedescendant")===b.id&&this.element.attr("aria-activedescendant",c)),delete f[b.id],b.id=c,b.li_attr.id=c,f[c]=b,this.trigger("set_id",{node:b,"new":b.id,old:g}),!0},get_text:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.text:!1},set_text:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.set_text(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.text=c,this.get_node(b,!0).length&&this.redraw_node(b.id),this.trigger("set_text",{obj:b,text:c}),!0):!1},get_json:function(b,c,d){if(b=this.get_node(b||a.jstree.root),!b)return!1;c&&c.flat&&!d&&(d=[]);var e={id:b.id,text:b.text,icon:this.get_icon(b),li_attr:a.extend(!0,{},b.li_attr),a_attr:a.extend(!0,{},b.a_attr),state:{},data:c&&c.no_data?!1:a.extend(!0,a.isArray(b.data)?[]:{},b.data)},f,g;if(c&&c.flat?e.parent=b.parent:e.children=[],c&&c.no_state)delete e.state;else for(f in b.state)b.state.hasOwnProperty(f)&&(e.state[f]=b.state[f]);if(c&&c.no_li_attr&&delete e.li_attr,c&&c.no_a_attr&&delete e.a_attr,c&&c.no_id&&(delete e.id,e.li_attr&&e.li_attr.id&&delete e.li_attr.id,e.a_attr&&e.a_attr.id&&delete e.a_attr.id),c&&c.flat&&b.id!==a.jstree.root&&d.push(e),!c||!c.no_children)for(f=0,g=b.children.length;g>f;f++)c&&c.flat?this.get_json(b.children[f],c,d):e.children.push(this.get_json(b.children[f],c));return c&&c.flat?d:b.id===a.jstree.root?e.children:e},create_node:function(c,d,e,f,g){if(null===c&&(c=a.jstree.root),c=this.get_node(c),!c)return!1;if(e=e===b?"last":e,!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(c))return this.load_node(c,function(){this.create_node(c,d,e,f,!0)});d||(d={text:this.get_string("New node")}),d="string"==typeof d?{text:d}:a.extend(!0,{},d),d.text===b&&(d.text=this.get_string("New node"));var h,i,j,k;switch(c.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":h=this.get_node(c.parent),e=a.inArray(c.id,h.children),c=h;break;case"after":h=this.get_node(c.parent),e=a.inArray(c.id,h.children)+1,c=h;break;case"inside":case"first":e=0;break;case"last":e=c.children.length;break;default:e||(e=0)}if(e>c.children.length&&(e=c.children.length),d.id||(d.id=!0),!this.check("create_node",d,c,e))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(d.id===!0&&delete d.id,d=this._parse_model_from_json(d,c.id,c.parents.concat()),!d)return!1;for(h=this.get_node(d),i=[],i.push(d),i=i.concat(h.children_d),this.trigger("model",{nodes:i,parent:c.id}),c.children_d=c.children_d.concat(i),j=0,k=c.parents.length;k>j;j++)this._model.data[c.parents[j]].children_d=this._model.data[c.parents[j]].children_d.concat(i);for(d=h,h=[],j=0,k=c.children.length;k>j;j++)h[j>=e?j+1:j]=c.children[j];return h[e]=d.id,c.children=h,this.redraw_node(c,!0),this.trigger("create_node",{node:this.get_node(d),parent:c.id,position:e}),f&&f.call(this,this.get_node(d)),d.id},rename_node:function(b,c){var d,e,f;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.rename_node(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=b.text,this.check("rename_node",b,this.get_parent(b),c)?(this.set_text(b,c),this.trigger("rename_node",{node:b,text:c,old:f}),!0):(this.settings.core.error.call(this,this._data.core.last_error),!1)):!1},delete_node:function(b){var c,d,e,f,g,h,i,j,k,l,m,n;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.delete_node(b[c]);return!0}if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;if(e=this.get_node(b.parent),f=a.inArray(b.id,e.children),l=!1,!this.check("delete_node",b,e,f))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==f&&(e.children=a.vakata.array_remove(e.children,f)),g=b.children_d.concat([]),g.push(b.id),h=0,i=b.parents.length;i>h;h++)this._model.data[b.parents[h]].children_d=a.vakata.array_filter(this._model.data[b.parents[h]].children_d,function(b){return-1===a.inArray(b,g)});for(j=0,k=g.length;k>j;j++)if(this._model.data[g[j]].state.selected){l=!0;break}for(l&&(this._data.core.selected=a.vakata.array_filter(this._data.core.selected,function(b){return-1===a.inArray(b,g)})),this.trigger("delete_node",{node:b,parent:e.id}),l&&this.trigger("changed",{action:"delete_node",node:b,selected:this._data.core.selected,parent:e.id}),j=0,k=g.length;k>j;j++)delete this._model.data[g[j]];return-1!==a.inArray(this._data.core.focused,g)&&(this._data.core.focused=null,m=this.element[0].scrollTop,n=this.element[0].scrollLeft,e.id===a.jstree.root?this._model.data[a.jstree.root].children[0]&&this.get_node(this._model.data[a.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(e,!0).children(".jstree-anchor").focus(),this.element[0].scrollTop=m,this.element[0].scrollLeft=n),this.redraw_node(e,!0),!0},check:function(b,c,d,e,f){c=c&&c.id?c:this.get_node(c),d=d&&d.id?d:this.get_node(d);var g=b.match(/^move_node|copy_node|create_node$/i)?d:c,h=this.settings.core.check_callback;return"move_node"!==b&&"copy_node"!==b||f&&f.is_multi||c.id!==d.id&&("move_node"!==b||a.inArray(c.id,d.children)!==e)&&-1===a.inArray(d.id,c.children_d)?(g&&g.data&&(g=g.data),g&&g.functions&&(g.functions[b]===!1||g.functions[b]===!0)?(g.functions[b]===!1&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+b,data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})}),g.functions[b]):h===!1||a.isFunction(h)&&h.call(this,b,c,d,e,f)===!1||h&&h[b]===!1?(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+b,data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})},!1):!0):(this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})},!1)},last_error:function(){return this._data.core.last_error},move_node:function(c,d,e,f,g,h,i){var j,k,l,m,n,o,p,q,r,s,t,u,v,w;if(d=this.get_node(d),e=e===b?0:e,!d)return!1;if(!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(d))return this.load_node(d,function(){this.move_node(c,d,e,f,!0,!1,i)});if(a.isArray(c)){if(1!==c.length){for(j=0,k=c.length;k>j;j++)(r=this.move_node(c[j],d,e,f,g,!1,i))&&(d=r,e="after");return this.redraw(),!0}c=c[0]}if(c=c&&c.id?c:this.get_node(c),!c||c.id===a.jstree.root)return!1;if(l=(c.parent||a.jstree.root).toString(),n=e.toString().match(/^(before|after)$/)&&d.id!==a.jstree.root?this.get_node(d.parent):d,o=i?i:this._model.data[c.id]?this:a.jstree.reference(c.id),p=!o||!o._id||this._id!==o._id,m=o&&o._id&&l&&o._model.data[l]&&o._model.data[l].children?a.inArray(c.id,o._model.data[l].children):-1,o&&o._id&&(c=o._model.data[c.id]),p)return(r=this.copy_node(c,d,e,f,g,!1,i))?(o&&o.delete_node(c),r):!1;switch(d.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":e=a.inArray(d.id,n.children);break;case"after":e=a.inArray(d.id,n.children)+1;break;case"inside":case"first":e=0;break;case"last":e=n.children.length;break;default:e||(e=0)}if(e>n.children.length&&(e=n.children.length),!this.check("move_node",c,n,e,{core:!0,origin:i,is_multi:o&&o._id&&o._id!==this._id,is_foreign:!o||!o._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(c.parent===n.id){for(q=n.children.concat(),r=a.inArray(c.id,q),-1!==r&&(q=a.vakata.array_remove(q,r),e>r&&e--),r=[],s=0,t=q.length;t>s;s++)r[s>=e?s+1:s]=q[s];r[e]=c.id,n.children=r,this._node_changed(n.id),this.redraw(n.id===a.jstree.root)}else{for(r=c.children_d.concat(),r.push(c.id),s=0,t=c.parents.length;t>s;s++){for(q=[],w=o._model.data[c.parents[s]].children_d,u=0,v=w.length;v>u;u++)-1===a.inArray(w[u],r)&&q.push(w[u]);o._model.data[c.parents[s]].children_d=q}for(o._model.data[l].children=a.vakata.array_remove_item(o._model.data[l].children,c.id),s=0,t=n.parents.length;t>s;s++)this._model.data[n.parents[s]].children_d=this._model.data[n.parents[s]].children_d.concat(r);for(q=[],s=0,t=n.children.length;t>s;s++)q[s>=e?s+1:s]=n.children[s];for(q[e]=c.id,n.children=q,n.children_d.push(c.id),n.children_d=n.children_d.concat(c.children_d),c.parent=n.id,r=n.parents.concat(),r.unshift(n.id),w=c.parents.length,c.parents=r,r=r.concat(),s=0,t=c.children_d.length;t>s;s++)this._model.data[c.children_d[s]].parents=this._model.data[c.children_d[s]].parents.slice(0,-1*w),Array.prototype.push.apply(this._model.data[c.children_d[s]].parents,r);(l===a.jstree.root||n.id===a.jstree.root)&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(l),this._node_changed(n.id)),h||this.redraw()}return f&&f.call(this,c,n,e),this.trigger("move_node",{node:c,parent:n.id,position:e,old_parent:l,old_position:m,is_multi:o&&o._id&&o._id!==this._id,is_foreign:!o||!o._id,old_instance:o,new_instance:this}),c.id},copy_node:function(c,d,e,f,g,h,i){var j,k,l,m,n,o,p,q,r,s,t;if(d=this.get_node(d),e=e===b?0:e,!d)return!1;if(!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(d))return this.load_node(d,function(){this.copy_node(c,d,e,f,!0,!1,i)});if(a.isArray(c)){if(1!==c.length){for(j=0,k=c.length;k>j;j++)(m=this.copy_node(c[j],d,e,f,g,!0,i))&&(d=m,e="after");return this.redraw(),!0}c=c[0]}if(c=c&&c.id?c:this.get_node(c),!c||c.id===a.jstree.root)return!1;switch(q=(c.parent||a.jstree.root).toString(),r=e.toString().match(/^(before|after)$/)&&d.id!==a.jstree.root?this.get_node(d.parent):d,s=i?i:this._model.data[c.id]?this:a.jstree.reference(c.id),t=!s||!s._id||this._id!==s._id,s&&s._id&&(c=s._model.data[c.id]),d.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":e=a.inArray(d.id,r.children);break;case"after":e=a.inArray(d.id,r.children)+1;break;case"inside":case"first":e=0;break;case"last":e=r.children.length;break;default:e||(e=0)}if(e>r.children.length&&(e=r.children.length),!this.check("copy_node",c,r,e,{core:!0,origin:i,is_multi:s&&s._id&&s._id!==this._id,is_foreign:!s||!s._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(p=s?s.get_json(c,{no_id:!0,no_data:!0,no_state:!0}):c,!p)return!1;if(p.id===!0&&delete p.id,p=this._parse_model_from_json(p,r.id,r.parents.concat()),!p)return!1;for(m=this.get_node(p),c&&c.state&&c.state.loaded===!1&&(m.state.loaded=!1),l=[],l.push(p),l=l.concat(m.children_d),this.trigger("model",{nodes:l,parent:r.id}),n=0,o=r.parents.length;o>n;n++)this._model.data[r.parents[n]].children_d=this._model.data[r.parents[n]].children_d.concat(l);for(l=[],n=0,o=r.children.length;o>n;n++)l[n>=e?n+1:n]=r.children[n];return l[e]=m.id,r.children=l,r.children_d.push(m.id),r.children_d=r.children_d.concat(m.children_d),r.id===a.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(r.id),h||this.redraw(r.id===a.jstree.root),f&&f.call(this,m,r,e),this.trigger("copy_node",{node:m,original:c,parent:r.id,position:e,old_parent:q,old_position:s&&s._id&&q&&s._model.data[q]&&s._model.data[q].children?a.inArray(c.id,s._model.data[q].children):-1,is_multi:s&&s._id&&s._id!==this._id,is_foreign:!s||!s._id,old_instance:s,new_instance:this}),m.id},cut:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var c=[],g,h,i;for(h=0,i=b.length;i>h;h++)g=this.get_node(b[h]),g&&g.id&&g.id!==a.jstree.root&&c.push(g);
|
4 |
+
return c.length?(d=c,f=this,e="move_node",void this.trigger("cut",{node:b})):!1},copy:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var c=[],g,h,i;for(h=0,i=b.length;i>h;h++)g=this.get_node(b[h]),g&&g.id&&g.id!==a.jstree.root&&c.push(g);return c.length?(d=c,f=this,e="copy_node",void this.trigger("copy",{node:b})):!1},get_buffer:function(){return{mode:e,node:d,inst:f}},can_paste:function(){return e!==!1&&d!==!1},paste:function(a,b){return a=this.get_node(a),a&&e&&e.match(/^(copy_node|move_node)$/)&&d?(this[e](d,a,b,!1,!1,!1,f)&&this.trigger("paste",{parent:a.id,node:d,mode:e}),d=!1,e=!1,void(f=!1)):!1},clear_buffer:function(){d=!1,e=!1,f=!1,this.trigger("clear_buffer")},edit:function(b,c,d){var e,f,g,h,j,k,l,m,n,o=!1;return(b=this.get_node(b))?this.check("edit",b,this.get_parent(b))?(n=b,c="string"==typeof c?c:b.text,this.set_text(b,""),b=this._open_to(b),n.text=c,e=this._data.core.rtl,f=this.element.width(),this._data.core.focused=n.id,g=b.children(".jstree-anchor").focus(),h=a("<span>"),j=c,k=a("<div />",{css:{position:"absolute",top:"-200px",left:e?"0px":"-1000px",visibility:"hidden"}}).appendTo(i.body),l=a("<input />",{value:j,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:a.proxy(function(c){c.stopImmediatePropagation(),c.preventDefault();var e=h.children(".jstree-rename-input"),f=e.val(),i=this.settings.core.force_text,m;""===f&&(f=j),k.remove(),h.replaceWith(g),h.remove(),j=i?j:a("<div></div>").append(a.parseHTML(j)).html(),b=this.get_node(b),this.set_text(b,j),m=!!this.rename_node(b,i?a("<div></div>").text(f).text():a("<div></div>").append(a.parseHTML(f)).html()),m||this.set_text(b,j),this._data.core.focused=n.id,setTimeout(a.proxy(function(){var a=this.get_node(n.id,!0);a.length&&(this._data.core.focused=n.id,a.children(".jstree-anchor").focus())},this),0),d&&d.call(this,n,m,o),l=null},this),keydown:function(a){var b=a.which;27===b&&(o=!0,this.value=j),(27===b||13===b||37===b||38===b||39===b||40===b||32===b)&&a.stopImmediatePropagation(),(27===b||13===b)&&(a.preventDefault(),this.blur())},click:function(a){a.stopImmediatePropagation()},mousedown:function(a){a.stopImmediatePropagation()},keyup:function(a){l.width(Math.min(k.text("pW"+this.value).width(),f))},keypress:function(a){return 13===a.which?!1:void 0}}),m={fontFamily:g.css("fontFamily")||"",fontSize:g.css("fontSize")||"",fontWeight:g.css("fontWeight")||"",fontStyle:g.css("fontStyle")||"",fontStretch:g.css("fontStretch")||"",fontVariant:g.css("fontVariant")||"",letterSpacing:g.css("letterSpacing")||"",wordSpacing:g.css("wordSpacing")||""},h.attr("class",g.attr("class")).append(g.contents().clone()).append(l),g.replaceWith(h),k.css(m),l.css(m).width(Math.min(k.text("pW"+l[0].value).width(),f))[0].select(),void a(i).one("mousedown.jstree touchstart.jstree dnd_start.vakata",function(b){l&&b.target!==l&&a(l).blur()})):(this.settings.core.error.call(this,this._data.core.last_error),!1):!1},set_theme:function(b,c){if(!b)return!1;if(c===!0){var d=this.settings.core.themes.dir;d||(d=a.jstree.path+"/themes"),c=d+"/"+b+"/style.css"}c&&-1===a.inArray(c,g)&&(a("head").append('<link rel="stylesheet" href="'+c+'" type="text/css" />'),g.push(c)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=b,this.element.addClass("jstree-"+b),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+b+"-responsive"),this.trigger("set_theme",{theme:b})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(a){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=a,a&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped"),this.trigger("show_stripes")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped"),this.trigger("hide_stripes")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots"),this.trigger("show_dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots"),this.trigger("hide_dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons"),this.trigger("show_icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons"),this.trigger("hide_icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},show_ellipsis:function(){this._data.core.themes.ellipsis=!0,this.get_container_ul().addClass("jstree-ellipsis"),this.trigger("show_ellipsis")},hide_ellipsis:function(){this._data.core.themes.ellipsis=!1,this.get_container_ul().removeClass("jstree-ellipsis"),this.trigger("hide_ellipsis")},toggle_ellipsis:function(){this._data.core.themes.ellipsis?this.hide_ellipsis():this.show_ellipsis()},set_icon:function(c,d){var e,f,g,h;if(a.isArray(c)){for(c=c.slice(),e=0,f=c.length;f>e;e++)this.set_icon(c[e],d);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?(h=c.icon,c.icon=d===!0||null===d||d===b||""===d?!0:d,g=this.get_node(c,!0).children(".jstree-anchor").children(".jstree-themeicon"),d===!1?(g.removeClass("jstree-themeicon-custom "+h).css("background","").removeAttr("rel"),this.hide_icon(c)):d===!0||null===d||d===b||""===d?(g.removeClass("jstree-themeicon-custom "+h).css("background","").removeAttr("rel"),h===!1&&this.show_icon(c)):-1===d.indexOf("/")&&-1===d.indexOf(".")?(g.removeClass(h).css("background",""),g.addClass(d+" jstree-themeicon-custom").attr("rel",d),h===!1&&this.show_icon(c)):(g.removeClass(h).css("background",""),g.addClass("jstree-themeicon-custom").css("background","url('"+d+"') center center no-repeat").attr("rel",d),h===!1&&this.show_icon(c)),!0):!1},get_icon:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.icon:!1},hide_icon:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.hide_icon(b[c]);return!0}return b=this.get_node(b),b&&b!==a.jstree.root?(b.icon=!1,this.get_node(b,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0):!1},show_icon:function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.show_icon(b[c]);return!0}return b=this.get_node(b),b&&b!==a.jstree.root?(e=this.get_node(b,!0),b.icon=e.length?e.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"):!0,b.icon||(b.icon=!0),e.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0):!1}},a.vakata={},a.vakata.attributes=function(b,c){b=a(b)[0];var d=c?{}:[];return b&&b.attributes&&a.each(b.attributes,function(b,e){-1===a.inArray(e.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==e.value&&""!==a.trim(e.value)&&(c?d[e.name]=e.value:d.push(e.name))}),d},a.vakata.array_unique=function(a){var c=[],d,e,f,g={};for(d=0,f=a.length;f>d;d++)g[a[d]]===b&&(c.push(a[d]),g[a[d]]=!0);return c},a.vakata.array_remove=function(a,b){return a.splice(b,1),a},a.vakata.array_remove_item=function(b,c){var d=a.inArray(c,b);return-1!==d?a.vakata.array_remove(b,d):b},a.vakata.array_filter=function(a,b,c,d,e){if(a.filter)return a.filter(b,c);d=[];for(e in a)~~e+""==e+""&&e>=0&&b.call(c,a[e],+e,a)&&d.push(a[e]);return d},a.jstree.plugins.changed=function(a,b){var c=[];this.trigger=function(a,d){var e,f;if(d||(d={}),"changed"===a.replace(".jstree","")){d.changed={selected:[],deselected:[]};var g={};for(e=0,f=c.length;f>e;e++)g[c[e]]=1;for(e=0,f=d.selected.length;f>e;e++)g[d.selected[e]]?g[d.selected[e]]=2:d.changed.selected.push(d.selected[e]);for(e=0,f=c.length;f>e;e++)1===g[c[e]]&&d.changed.deselected.push(c[e]);c=d.selected.slice()}b.trigger.call(this,a,d)},this.refresh=function(a,d){return c=[],b.refresh.apply(this,arguments)}};var j=i.createElement("I");j.className="jstree-icon jstree-checkbox",j.setAttribute("role","presentation"),a.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0,cascade:"",tie_selection:!0,cascade_to_disabled:!0,cascade_to_hidden:!0},a.jstree.plugins.checkbox=function(c,d){this.bind=function(){d.bind.call(this),this._data.checkbox.uto=!1,this._data.checkbox.selected=[],this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined"),this.element.on("init.jstree",a.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked"),this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")},this)).on("loading.jstree",a.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this)),-1!==this.settings.checkbox.cascade.indexOf("undetermined")&&this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",a.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(a.proxy(this._undetermined,this),50)},this)),this.settings.checkbox.tie_selection||this.element.on("model.jstree",a.proxy(function(a,b){var c=this._model.data,d=c[b.parent],e=b.nodes,f,g;for(f=0,g=e.length;g>f;f++)c[e[f]].state.checked=c[e[f]].state.checked||c[e[f]].original&&c[e[f]].original.state&&c[e[f]].original.state.checked,c[e[f]].state.checked&&this._data.checkbox.selected.push(e[f])},this)),(-1!==this.settings.checkbox.cascade.indexOf("up")||-1!==this.settings.checkbox.cascade.indexOf("down"))&&this.element.on("model.jstree",a.proxy(function(b,c){var d=this._model.data,e=d[c.parent],f=c.nodes,g=[],h,i,j,k,l,m,n=this.settings.checkbox.cascade,o=this.settings.checkbox.tie_selection;if(-1!==n.indexOf("down"))if(e.state[o?"selected":"checked"]){for(i=0,j=f.length;j>i;i++)d[f[i]].state[o?"selected":"checked"]=!0;this._data[o?"core":"checkbox"].selected=this._data[o?"core":"checkbox"].selected.concat(f)}else for(i=0,j=f.length;j>i;i++)if(d[f[i]].state[o?"selected":"checked"]){for(k=0,l=d[f[i]].children_d.length;l>k;k++)d[d[f[i]].children_d[k]].state[o?"selected":"checked"]=!0;this._data[o?"core":"checkbox"].selected=this._data[o?"core":"checkbox"].selected.concat(d[f[i]].children_d)}if(-1!==n.indexOf("up")){for(i=0,j=e.children_d.length;j>i;i++)d[e.children_d[i]].children.length||g.push(d[e.children_d[i]].parent);for(g=a.vakata.array_unique(g),k=0,l=g.length;l>k;k++){e=d[g[k]];while(e&&e.id!==a.jstree.root){for(h=0,i=0,j=e.children.length;j>i;i++)h+=d[e.children[i]].state[o?"selected":"checked"];if(h!==j)break;e.state[o?"selected":"checked"]=!0,this._data[o?"core":"checkbox"].selected.push(e.id),m=this.get_node(e,!0),m&&m.length&&m.attr("aria-selected",!0).children(".jstree-anchor").addClass(o?"jstree-clicked":"jstree-checked"),e=this.get_node(e.parent)}}}this._data[o?"core":"checkbox"].selected=a.vakata.array_unique(this._data[o?"core":"checkbox"].selected)},this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",a.proxy(function(b,c){var d=this,e=c.node,f=this._model.data,g=this.get_node(e.parent),h,i,j,k,l=this.settings.checkbox.cascade,m=this.settings.checkbox.tie_selection,n={},o=this._data[m?"core":"checkbox"].selected;for(h=0,i=o.length;i>h;h++)n[o[h]]=!0;if(-1!==l.indexOf("down")){var p=this._cascade_new_checked_state(e.id,!0),q=e.children_d.concat(e.id);for(h=0,i=q.length;i>h;h++)p.indexOf(q[h])>-1?n[q[h]]=!0:delete n[q[h]]}if(-1!==l.indexOf("up"))while(g&&g.id!==a.jstree.root){for(j=0,h=0,i=g.children.length;i>h;h++)j+=f[g.children[h]].state[m?"selected":"checked"];if(j!==i)break;g.state[m?"selected":"checked"]=!0,n[g.id]=!0,k=this.get_node(g,!0),k&&k.length&&k.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"),g=this.get_node(g.parent)}o=[];for(h in n)n.hasOwnProperty(h)&&o.push(h);this._data[m?"core":"checkbox"].selected=o},this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",a.proxy(function(b,c){var d=this.get_node(a.jstree.root),e=this._model.data,f,g,h;for(f=0,g=d.children_d.length;g>f;f++)h=e[d.children_d[f]],h&&h.original&&h.original.state&&h.original.state.undetermined&&(h.original.state.undetermined=!1)},this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",a.proxy(function(a,b){var c=this,d=b.node,e=this.get_node(d,!0),f,g,h,i=this.settings.checkbox.cascade,j=this.settings.checkbox.tie_selection,k=this._data[j?"core":"checkbox"].selected,l={},m=[],n=d.children_d.concat(d.id);if(-1!==i.indexOf("down")){var o=this._cascade_new_checked_state(d.id,!1);k=k.filter(function(a){return-1===n.indexOf(a)||o.indexOf(a)>-1})}if(-1!==i.indexOf("up")&&-1===k.indexOf(d.id)){for(f=0,g=d.parents.length;g>f;f++)h=this._model.data[d.parents[f]],h.state[j?"selected":"checked"]=!1,h&&h.original&&h.original.state&&h.original.state.undetermined&&(h.original.state.undetermined=!1),h=this.get_node(d.parents[f],!0),h&&h.length&&h.attr("aria-selected",!1).children(".jstree-anchor").removeClass(j?"jstree-clicked":"jstree-checked");k=k.filter(function(a){return-1===d.parents.indexOf(a)})}this._data[j?"core":"checkbox"].selected=k},this)),-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",a.proxy(function(b,c){var d=this.get_node(c.parent),e=this._model.data,f,g,h,i,j=this.settings.checkbox.tie_selection;while(d&&d.id!==a.jstree.root&&!d.state[j?"selected":"checked"]){for(h=0,f=0,g=d.children.length;g>f;f++)h+=e[d.children[f]].state[j?"selected":"checked"];if(!(g>0&&h===g))break;d.state[j?"selected":"checked"]=!0,this._data[j?"core":"checkbox"].selected.push(d.id),i=this.get_node(d,!0),i&&i.length&&i.attr("aria-selected",!0).children(".jstree-anchor").addClass(j?"jstree-clicked":"jstree-checked"),d=this.get_node(d.parent)}},this)).on("move_node.jstree",a.proxy(function(b,c){var d=c.is_multi,e=c.old_parent,f=this.get_node(c.parent),g=this._model.data,h,i,j,k,l,m=this.settings.checkbox.tie_selection;if(!d){h=this.get_node(e);while(h&&h.id!==a.jstree.root&&!h.state[m?"selected":"checked"]){for(i=0,j=0,k=h.children.length;k>j;j++)i+=g[h.children[j]].state[m?"selected":"checked"];if(!(k>0&&i===k))break;h.state[m?"selected":"checked"]=!0,this._data[m?"core":"checkbox"].selected.push(h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"),h=this.get_node(h.parent)}}h=f;while(h&&h.id!==a.jstree.root){for(i=0,j=0,k=h.children.length;k>j;j++)i+=g[h.children[j]].state[m?"selected":"checked"];if(i===k)h.state[m?"selected":"checked"]||(h.state[m?"selected":"checked"]=!0,this._data[m?"core":"checkbox"].selected.push(h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"));else{if(!h.state[m?"selected":"checked"])break;h.state[m?"selected":"checked"]=!1,this._data[m?"core":"checkbox"].selected=a.vakata.array_remove_item(this._data[m?"core":"checkbox"].selected,h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!1).children(".jstree-anchor").removeClass(m?"jstree-clicked":"jstree-checked")}h=this.get_node(h.parent)}},this))},this.get_undetermined=function(c){if(-1===this.settings.checkbox.cascade.indexOf("undetermined"))return[];var d,e,f,g,h={},i=this._model.data,j=this.settings.checkbox.tie_selection,k=this._data[j?"core":"checkbox"].selected,l=[],m=this,n=[];for(d=0,e=k.length;e>d;d++)if(i[k[d]]&&i[k[d]].parents)for(f=0,g=i[k[d]].parents.length;g>f;f++){if(h[i[k[d]].parents[f]]!==b)break;i[k[d]].parents[f]!==a.jstree.root&&(h[i[k[d]].parents[f]]=!0,l.push(i[k[d]].parents[f]))}for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function(){var c=m.get_node(this),j;if(c)if(c.state.loaded){for(d=0,e=c.children_d.length;e>d;d++)if(j=i[c.children_d[d]],!j.state.loaded&&j.original&&j.original.state&&j.original.state.undetermined&&j.original.state.undetermined===!0)for(h[j.id]===b&&j.id!==a.jstree.root&&(h[j.id]=!0,l.push(j.id)),f=0,g=j.parents.length;g>f;f++)h[j.parents[f]]===b&&j.parents[f]!==a.jstree.root&&(h[j.parents[f]]=!0,l.push(j.parents[f]))}else if(c.original&&c.original.state&&c.original.state.undetermined&&c.original.state.undetermined===!0)for(h[c.id]===b&&c.id!==a.jstree.root&&(h[c.id]=!0,l.push(c.id)),f=0,g=c.parents.length;g>f;f++)h[c.parents[f]]===b&&c.parents[f]!==a.jstree.root&&(h[c.parents[f]]=!0,l.push(c.parents[f]))}),d=0,e=l.length;e>d;d++)i[l[d]].state[j?"selected":"checked"]||n.push(c?i[l[d]]:l[d]);return n},this._undetermined=function(){if(null!==this.element){var a=this.get_undetermined(!1),b,c,d;for(this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),b=0,c=a.length;c>b;b++)d=this.get_node(a[b],!0),d&&d.length&&d.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}},this.redraw_node=function(b,c,e,f){if(b=d.redraw_node.apply(this,arguments)){var g,h,i=null,k=null;for(g=0,h=b.childNodes.length;h>g;g++)if(b.childNodes[g]&&b.childNodes[g].className&&-1!==b.childNodes[g].className.indexOf("jstree-anchor")){i=b.childNodes[g];break}i&&(!this.settings.checkbox.tie_selection&&this._model.data[b.id].state.checked&&(i.className+=" jstree-checked"),k=j.cloneNode(!1),this._model.data[b.id].state.checkbox_disabled&&(k.className+=" jstree-checkbox-disabled"),i.insertBefore(k,i.childNodes[0]))}return e||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(a.proxy(this._undetermined,this),50)),b},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.get_container_ul().removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.get_container_ul().addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()},this.is_undetermined=function(b){b=this.get_node(b);var c=this.settings.checkbox.cascade,d,e,f=this.settings.checkbox.tie_selection,g=this._data[f?"core":"checkbox"].selected,h=this._model.data;if(!b||b.state[f?"selected":"checked"]===!0||-1===c.indexOf("undetermined")||-1===c.indexOf("down")&&-1===c.indexOf("up"))return!1;if(!b.state.loaded&&b.original.state.undetermined===!0)return!0;for(d=0,e=b.children_d.length;e>d;d++)if(-1!==a.inArray(b.children_d[d],g)||!h[b.children_d[d]].state.loaded&&h[b.children_d[d]].original.state.undetermined)return!0;return!1},this.disable_checkbox=function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.disable_checkbox(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(e=this.get_node(b,!0),void(b.state.checkbox_disabled||(b.state.checkbox_disabled=!0,e&&e.length&&e.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:b})))):!1},this.enable_checkbox=function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.enable_checkbox(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(e=this.get_node(b,!0),void(b.state.checkbox_disabled&&(b.state.checkbox_disabled=!1,e&&e.length&&e.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:b})))):!1},this.activate_node=function(b,c){return a(c.target).hasClass("jstree-checkbox-disabled")?!1:(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||a(c.target).hasClass("jstree-checkbox"))&&(c.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!a(c.target).hasClass("jstree-checkbox")?d.activate_node.call(this,b,c):this.is_disabled(b)?!1:(this.is_checked(b)?this.uncheck_node(b,c):this.check_node(b,c),void this.trigger("activate_node",{node:this.get_node(b)})))},this._cascade_new_checked_state=function(a,b){var c=this,d=this.settings.checkbox.tie_selection,e=this._model.data[a],f=[],g=[],h,i,j;if(!this.settings.checkbox.cascade_to_disabled&&e.state.disabled||!this.settings.checkbox.cascade_to_hidden&&e.state.hidden)j=this.get_checked_descendants(a),e.state[d?"selected":"checked"]&&j.push(e.id),f=f.concat(j);else{if(e.children)for(h=0,i=e.children.length;i>h;h++){var k=e.children[h];j=c._cascade_new_checked_state(k,b),f=f.concat(j),j.indexOf(k)>-1&&g.push(k)}var l=c.get_node(e,!0),m=g.length>0&&g.length<e.children.length;e.original&&e.original.state&&e.original.state.undetermined&&(e.original.state.undetermined=m),m?(e.state[d?"selected":"checked"]=!1,l.attr("aria-selected",!1).children(".jstree-anchor").removeClass(d?"jstree-clicked":"jstree-checked")):b&&g.length===e.children.length?(e.state[d?"selected":"checked"]=b,f.push(e.id),l.attr("aria-selected",!0).children(".jstree-anchor").addClass(d?"jstree-clicked":"jstree-checked")):(e.state[d?"selected":"checked"]=!1,l.attr("aria-selected",!1).children(".jstree-anchor").removeClass(d?"jstree-clicked":"jstree-checked"))}return f},this.get_checked_descendants=function(a){var b=this,c=b.settings.checkbox.tie_selection,d=b._model.data[a];return d.children_d.filter(function(a){return b._model.data[a].state[c?"selected":"checked"]})},this.check_node=function(b,c){if(this.settings.checkbox.tie_selection)return this.select_node(b,!1,!0,c);var d,e,f,g;if(a.isArray(b)){for(b=b.slice(),e=0,f=b.length;f>e;e++)this.check_node(b[e],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(d=this.get_node(b,!0),void(b.state.checked||(b.state.checked=!0,this._data.checkbox.selected.push(b.id),d&&d.length&&d.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:b,selected:this._data.checkbox.selected,event:c})))):!1},this.uncheck_node=function(b,c){if(this.settings.checkbox.tie_selection)return this.deselect_node(b,!1,c);var d,e,f;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.uncheck_node(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=this.get_node(b,!0),void(b.state.checked&&(b.state.checked=!1,this._data.checkbox.selected=a.vakata.array_remove_item(this._data.checkbox.selected,b.id),f.length&&f.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:b,selected:this._data.checkbox.selected,event:c})))):!1},this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();var b=this._data.checkbox.selected.concat([]),c,d;for(this._data.checkbox.selected=this._model.data[a.jstree.root].children_d.concat(),c=0,d=this._data.checkbox.selected.length;d>c;c++)this._model.data[this._data.checkbox.selected[c]]&&(this._model.data[this._data.checkbox.selected[c]].state.checked=!0);this.redraw(!0),this.trigger("check_all",{selected:this._data.checkbox.selected})},this.uncheck_all=function(){if(this.settings.checkbox.tie_selection)return this.deselect_all();var a=this._data.checkbox.selected.concat([]),b,c;for(b=0,c=this._data.checkbox.selected.length;c>b;b++)this._model.data[this._data.checkbox.selected[b]]&&(this._model.data[this._data.checkbox.selected[b]].state.checked=!1);this._data.checkbox.selected=[],this.element.find(".jstree-checked").removeClass("jstree-checked"),this.trigger("uncheck_all",{selected:this._data.checkbox.selected,node:a})},this.is_checked=function(b){return this.settings.checkbox.tie_selection?this.is_selected(b):(b=this.get_node(b),b&&b.id!==a.jstree.root?b.state.checked:!1)},this.get_checked=function(b){return this.settings.checkbox.tie_selection?this.get_selected(b):b?a.map(this._data.checkbox.selected,a.proxy(function(a){return this.get_node(a)},this)):this._data.checkbox.selected},this.get_top_checked=function(b){if(this.settings.checkbox.tie_selection)return this.get_top_selected(b);var c=this.get_checked(!0),d={},e,f,g,h;for(e=0,f=c.length;f>e;e++)d[c[e].id]=c[e];for(e=0,f=c.length;f>e;e++)for(g=0,h=c[e].children_d.length;h>g;g++)d[c[e].children_d[g]]&&delete d[c[e].children_d[g]];c=[];for(e in d)d.hasOwnProperty(e)&&c.push(e);return b?a.map(c,a.proxy(function(a){return this.get_node(a)},this)):c},this.get_bottom_checked=function(b){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(b);var c=this.get_checked(!0),d=[],e,f;for(e=0,f=c.length;f>e;e++)c[e].children.length||d.push(c[e].id);return b?a.map(d,a.proxy(function(a){return this.get_node(a)},this)):d},this.load_node=function(b,c){var e,f,g,h,i,j;if(!a.isArray(b)&&!this.settings.checkbox.tie_selection&&(j=this.get_node(b),j&&j.state.loaded))for(e=0,f=j.children_d.length;f>e;e++)this._model.data[j.children_d[e]].state.checked&&(i=!0,this._data.checkbox.selected=a.vakata.array_remove_item(this._data.checkbox.selected,j.children_d[e]));return d.load_node.apply(this,arguments)},this.get_state=function(){var a=d.get_state.apply(this,arguments);return this.settings.checkbox.tie_selection?a:(a.checkbox=this._data.checkbox.selected.slice(),a)},this.set_state=function(b,c){var e=d.set_state.apply(this,arguments);if(e&&b.checkbox){if(!this.settings.checkbox.tie_selection){this.uncheck_all();var f=this;a.each(b.checkbox,function(a,b){f.check_node(b)})}return delete b.checkbox,this.set_state(b,c),!1}return e},this.refresh=function(a,b){return this.settings.checkbox.tie_selection&&(this._data.checkbox.selected=[]),d.refresh.apply(this,arguments)}},a.jstree.defaults.conditionalselect=function(){return!0},a.jstree.plugins.conditionalselect=function(a,b){this.activate_node=function(a,c){return this.settings.conditionalselect.call(this,this.get_node(a),c)?b.activate_node.call(this,a,c):void 0}},a.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(b,c){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.create_node(d,{},"last",function(a){try{c.edit(a)}catch(b){setTimeout(function(){c.edit(a)},0)}})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.edit(d)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.delete_node(c.get_selected()):c.delete_node(d)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.cut(c.get_top_selected()):c.cut(d)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.copy(c.get_top_selected()):c.copy(d)}},paste:{separator_before:!1,icon:!1,_disabled:function(b){return!a.jstree.reference(b.reference).can_paste()},separator_after:!1,label:"Paste",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.paste(d)}}}}}}},a.jstree.plugins.contextmenu=function(c,d){this.bind=function(){d.bind.call(this);var b=0,c=null,e,f;this.element.on("init.jstree loading.jstree ready.jstree",a.proxy(function(){this.get_container_ul().addClass("jstree-contextmenu")},this)).on("contextmenu.jstree",".jstree-anchor",a.proxy(function(a,d){"input"!==a.target.tagName.toLowerCase()&&(a.preventDefault(),b=a.ctrlKey?+new Date:0,(d||c)&&(b=+new Date+1e4),c&&clearTimeout(c),this.is_loading(a.currentTarget)||this.show_contextmenu(a.currentTarget,a.pageX,a.pageY,a))},this)).on("click.jstree",".jstree-anchor",a.proxy(function(c){this._data.contextmenu.visible&&(!b||+new Date-b>250)&&a.vakata.context.hide(),b=0},this)).on("touchstart.jstree",".jstree-anchor",function(b){b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(e=b.originalEvent.changedTouches[0].clientX,f=b.originalEvent.changedTouches[0].clientY,c=setTimeout(function(){a(b.currentTarget).trigger("contextmenu",!0)},750))}).on("touchmove.vakata.jstree",function(b){c&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(Math.abs(e-b.originalEvent.changedTouches[0].clientX)>10||Math.abs(f-b.originalEvent.changedTouches[0].clientY)>10)&&(clearTimeout(c),a.vakata.context.hide())}).on("touchend.vakata.jstree",function(a){c&&clearTimeout(c)}),a(i).on("context_hide.vakata.jstree",a.proxy(function(b,c){this._data.contextmenu.visible=!1,a(c.reference).removeClass("jstree-context")},this))},this.teardown=function(){this._data.contextmenu.visible&&a.vakata.context.hide(),d.teardown.call(this)},this.show_contextmenu=function(c,d,e,f){if(c=this.get_node(c),!c||c.id===a.jstree.root)return!1;var g=this.settings.contextmenu,h=this.get_node(c,!0),i=h.children(".jstree-anchor"),j=!1,k=!1;(g.show_at_node||d===b||e===b)&&(j=i.offset(),d=j.left,e=j.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(c)&&this.activate_node(c,f),k=g.items,a.isFunction(k)&&(k=k.call(this,c,a.proxy(function(a){this._show_contextmenu(c,d,e,a)},this))),a.isPlainObject(k)&&this._show_contextmenu(c,d,e,k)},this._show_contextmenu=function(b,c,d,e){var f=this.get_node(b,!0),g=f.children(".jstree-anchor");a(i).one("context_show.vakata.jstree",a.proxy(function(b,c){var d="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";a(c.element).addClass(d),g.addClass("jstree-context")},this)),this._data.contextmenu.visible=!0,a.vakata.context.show(g,{x:c,y:d},e),this.trigger("show_contextmenu",{node:b,x:c,y:d})}},function(a){var b=!1,c={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};a.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(b){a(i).triggerHandler("context_"+b+".vakata",{reference:c.reference,element:c.element,position:{x:c.position_x,y:c.position_y}})},_execute:function(b){return b=c.items[b],b&&(!b._disabled||a.isFunction(b._disabled)&&!b._disabled({item:b,reference:c.reference,element:c.element}))&&b.action?b.action.call(null,{item:b,reference:c.reference,element:c.element,position:{x:c.position_x,y:c.position_y}}):!1},_parse:function(b,d){if(!b)return!1;d||(c.html="",c.items=[]);var e="",f=!1,g;return d&&(e+="<ul>"),a.each(b,function(b,d){return d?(c.items.push(d),!f&&d.separator_before&&(e+="<li class='vakata-context-separator'><a href='#' "+(a.vakata.context.settings.icons?"":'style="margin-left:0px;"')+"> </a></li>"),f=!1,e+="<li class='"+(d._class||"")+(d._disabled===!0||a.isFunction(d._disabled)&&d._disabled({item:d,reference:c.reference,element:c.element})?" vakata-contextmenu-disabled ":"")+"' "+(d.shortcut?" data-shortcut='"+d.shortcut+"' ":"")+">",e+="<a href='#' rel='"+(c.items.length-1)+"' "+(d.title?"title='"+d.title+"'":"")+">",a.vakata.context.settings.icons&&(e+="<i ",d.icon&&(e+=-1!==d.icon.indexOf("/")||-1!==d.icon.indexOf(".")?" style='background:url(\""+d.icon+"\") center center no-repeat' ":" class='"+d.icon+"' "),e+="></i><span class='vakata-contextmenu-sep'> </span>"),e+=(a.isFunction(d.label)?d.label({item:b,reference:c.reference,element:c.element}):d.label)+(d.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+d.shortcut+'">'+(d.shortcut_label||"")+"</span>":"")+"</a>",
|
5 |
+
d.submenu&&(g=a.vakata.context._parse(d.submenu,!0),g&&(e+=g)),e+="</li>",void(d.separator_after&&(e+="<li class='vakata-context-separator'><a href='#' "+(a.vakata.context.settings.icons?"":'style="margin-left:0px;"')+"> </a></li>",f=!0))):!0}),e=e.replace(/<li class\='vakata-context-separator'\><\/li\>$/,""),d&&(e+="</ul>"),d||(c.html=e,a.vakata.context._trigger("parse")),e.length>10?e:!1},_show_submenu:function(c){if(c=a(c),c.length&&c.children("ul").length){var d=c.children("ul"),e=c.offset().left,f=e+c.outerWidth(),g=c.offset().top,h=d.width(),i=d.height(),j=a(window).width()+a(window).scrollLeft(),k=a(window).height()+a(window).scrollTop();b?c[f-(h+10+c.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):c[f+h>j&&e>j-f?"addClass":"removeClass"]("vakata-context-right"),g+i+10>k&&d.css("bottom","-1px"),c.hasClass("vakata-context-right")?h>e&&d.css("margin-right",e-h):h>j-f&&d.css("margin-left",j-f-h),d.show()}},show:function(d,e,f){var g,h,j,k,l,m,n,o,p=!0;switch(c.element&&c.element.length&&c.element.width(""),p){case!e&&!d:return!1;case!!e&&!!d:c.reference=d,c.position_x=e.x,c.position_y=e.y;break;case!e&&!!d:c.reference=d,g=d.offset(),c.position_x=g.left+d.outerHeight(),c.position_y=g.top;break;case!!e&&!d:c.position_x=e.x,c.position_y=e.y}d&&!f&&a(d).data("vakata_contextmenu")&&(f=a(d).data("vakata_contextmenu")),a.vakata.context._parse(f)&&c.element.html(c.html),c.items.length&&(c.element.appendTo(i.body),h=c.element,j=c.position_x,k=c.position_y,l=h.width(),m=h.height(),n=a(window).width()+a(window).scrollLeft(),o=a(window).height()+a(window).scrollTop(),b&&(j-=h.outerWidth()-a(d).outerWidth(),j<a(window).scrollLeft()+20&&(j=a(window).scrollLeft()+20)),j+l+20>n&&(j=n-(l+20)),k+m+20>o&&(k=o-(m+20)),c.element.css({left:j,top:k}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),c.is_visible=!0,a.vakata.context._trigger("show"))},hide:function(){c.is_visible&&(c.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),c.is_visible=!1,a.vakata.context._trigger("hide"))}},a(function(){b="rtl"===a(i.body).css("direction");var d=!1;c.element=a("<ul class='vakata-context'></ul>"),c.element.on("mouseenter","li",function(b){b.stopImmediatePropagation(),a.contains(this,b.relatedTarget)||(d&&clearTimeout(d),c.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),a(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),a.vakata.context._show_submenu(this))}).on("mouseleave","li",function(b){a.contains(this,b.relatedTarget)||a(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(b){a(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),a.vakata.context.settings.hide_onmouseleave&&(d=setTimeout(function(b){return function(){a.vakata.context.hide()}}(this),a.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(b){b.preventDefault(),a(this).blur().parent().hasClass("vakata-context-disabled")||a.vakata.context._execute(a(this).attr("rel"))===!1||a.vakata.context.hide()}).on("keydown","a",function(b){var d=null;switch(b.which){case 13:case 32:b.type="click",b.preventDefault(),a(b.currentTarget).trigger(b);break;case 37:c.is_visible&&(c.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 38:c.is_visible&&(d=c.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(),d.length||(d=c.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),d.addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 39:c.is_visible&&(c.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 40:c.is_visible&&(d=c.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),d.length||(d=c.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),d.addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 27:a.vakata.context.hide(),b.preventDefault()}}).on("keydown",function(a){a.preventDefault();var b=c.element.find(".vakata-contextmenu-shortcut-"+a.which).parent();b.parent().not(".vakata-context-disabled")&&b.click()}),a(i).on("mousedown.vakata.jstree",function(b){c.is_visible&&c.element[0]!==b.target&&!a.contains(c.element[0],b.target)&&a.vakata.context.hide()}).on("context_show.vakata.jstree",function(a,d){c.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),b&&c.element.addClass("vakata-context-rtl").css("direction","rtl"),c.element.find("ul").hide().end()})})}(a),a.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0,always_copy:!1,inside_pos:0,drag_selection:!0,touch:!0,large_drop_target:!1,large_drag_target:!1,use_html5:!1};var k,l;a.jstree.plugins.dnd=function(b,c){this.init=function(a,b){c.init.call(this,a,b),this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in i.createElement("span")},this.bind=function(){c.bind.call(this),this.element.on(this.settings.dnd.use_html5?"dragstart.jstree":"mousedown.jstree touchstart.jstree",this.settings.dnd.large_drag_target?".jstree-node":".jstree-anchor",a.proxy(function(b){if(this.settings.dnd.large_drag_target&&a(b.target).closest(".jstree-node")[0]!==b.currentTarget)return!0;if("touchstart"===b.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var c=this.get_node(b.target),d=this.is_selected(c)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,e=d>1?d+" "+this.get_string("nodes"):this.get_text(b.currentTarget);if(this.settings.core.force_text&&(e=a.vakata.html.escape(e)),c&&c.id&&c.id!==a.jstree.root&&(1===b.which||"touchstart"===b.type||"dragstart"===b.type)&&(this.settings.dnd.is_draggable===!0||a.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,d>1?this.get_top_selected(!0):[c],b))){if(k={jstree:!0,origin:this,obj:this.get_node(c,!0),nodes:d>1?this.get_top_selected():[c.id]},l=b.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),a.vakata.dnd.start(b,k,'<div id="jstree-dnd" class="jstree-'+this.get_theme()+" jstree-"+this.get_theme()+"-"+this.get_theme_variant()+" "+(this.settings.core.themes.responsive?" jstree-dnd-responsive":"")+'"><i class="jstree-icon jstree-er"></i>'+e+'<ins class="jstree-copy" style="display:none;">+</ins></div>');a.vakata.dnd._trigger("start",b,{helper:a(),element:l,data:k})}},this)),this.settings.dnd.use_html5&&this.element.on("dragover.jstree",function(b){return b.preventDefault(),a.vakata.dnd._trigger("move",b,{helper:a(),element:l,data:k}),!1}).on("drop.jstree",a.proxy(function(b){return b.preventDefault(),a.vakata.dnd._trigger("stop",b,{helper:a(),element:l,data:k}),!1},this))},this.redraw_node=function(a,b,d,e){if(a=c.redraw_node.apply(this,arguments),a&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)a.setAttribute("draggable",!0);else{var f,g,h=null;for(f=0,g=a.childNodes.length;g>f;f++)if(a.childNodes[f]&&a.childNodes[f].className&&-1!==a.childNodes[f].className.indexOf("jstree-anchor")){h=a.childNodes[f];break}h&&h.setAttribute("draggable",!0)}return a}},a(function(){var c=!1,d=!1,e=!1,f=!1,g=a('<div id="jstree-marker"> </div>').hide();a(i).on("dragover.vakata.jstree",function(b){l&&a.vakata.dnd._trigger("move",b,{helper:a(),element:l,data:k})}).on("drop.vakata.jstree",function(b){l&&(a.vakata.dnd._trigger("stop",b,{helper:a(),element:l,data:k}),l=null,k=null)}).on("dnd_start.vakata.jstree",function(a,b){c=!1,e=!1,b&&b.data&&b.data.jstree&&g.appendTo(i.body)}).on("dnd_move.vakata.jstree",function(h,i){var j=i.event.target!==e.target;if(f&&(!i.event||"dragover"!==i.event.type||j)&&clearTimeout(f),i&&i.data&&i.data.jstree&&(!i.event.target.id||"jstree-marker"!==i.event.target.id)){e=i.event;var k=a.jstree.reference(i.event.target),l=!1,m=!1,n=!1,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E;if(k&&k._data&&k._data.dnd)if(g.attr("class","jstree-"+k.get_theme()+(k.settings.core.themes.responsive?" jstree-dnd-responsive":"")),D=i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey)),i.helper.children().attr("class","jstree-"+k.get_theme()+" jstree-"+k.get_theme()+"-"+k.get_theme_variant()+" "+(k.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[D?"show":"hide"](),i.event.target!==k.element[0]&&i.event.target!==k.get_container_ul()[0]||0!==k.get_container_ul().children().length){if(l=k.settings.dnd.large_drop_target?a(i.event.target).closest(".jstree-node").children(".jstree-anchor"):a(i.event.target).closest(".jstree-anchor"),l&&l.length&&l.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(m=l.offset(),n=(i.event.pageY!==b?i.event.pageY:i.event.originalEvent.pageY)-m.top,r=l.outerHeight(),u=r/3>n?["b","i","a"]:n>r-r/3?["a","i","b"]:n>r/2?["i","a","b"]:["i","b","a"],a.each(u,function(b,e){switch(e){case"b":p=m.left-6,q=m.top,s=k.get_parent(l),t=l.parent().index();break;case"i":B=k.settings.dnd.inside_pos,C=k.get_node(l.parent()),p=m.left-2,q=m.top+r/2+1,s=C.id,t="first"===B?0:"last"===B?C.children.length:Math.min(B,C.children.length);break;case"a":p=m.left-6,q=m.top+r,s=k.get_parent(l),t=l.parent().index()+1}for(v=!0,w=0,x=i.data.nodes.length;x>w;w++)if(y=i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey))?"copy_node":"move_node",z=t,"move_node"===y&&"a"===e&&i.data.origin&&i.data.origin===k&&s===k.get_parent(i.data.nodes[w])&&(A=k.get_node(s),z>a.inArray(i.data.nodes[w],A.children)&&(z-=1)),v=v&&(k&&k.settings&&k.settings.dnd&&k.settings.dnd.check_while_dragging===!1||k.check(y,i.data.origin&&i.data.origin!==k?i.data.origin.get_node(i.data.nodes[w]):i.data.nodes[w],s,z,{dnd:!0,ref:k.get_node(l.parent()),pos:e,origin:i.data.origin,is_multi:i.data.origin&&i.data.origin!==k,is_foreign:!i.data.origin})),!v){k&&k.last_error&&(d=k.last_error());break}return"i"===e&&l.parent().is(".jstree-closed")&&k.settings.dnd.open_timeout&&(!i.event||"dragover"!==i.event.type||j)&&(f&&clearTimeout(f),f=setTimeout(function(a,b){return function(){a.open_node(b)}}(k,l),k.settings.dnd.open_timeout)),v?(E=k.get_node(s,!0),E.hasClass(".jstree-dnd-parent")||(a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),E.addClass("jstree-dnd-parent")),c={ins:k,par:s,pos:"i"!==e||"last"!==B||0!==t||k.is_loaded(C)?t:"last"},g.css({left:p+"px",top:q+"px"}).show(),i.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),i.event.originalEvent&&i.event.originalEvent.dataTransfer&&(i.event.originalEvent.dataTransfer.dropEffect=D?"copy":"move"),d={},u=!0,!1):void 0}),u===!0))return}else{for(v=!0,w=0,x=i.data.nodes.length;x>w;w++)if(v=v&&k.check(i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey))?"copy_node":"move_node",i.data.origin&&i.data.origin!==k?i.data.origin.get_node(i.data.nodes[w]):i.data.nodes[w],a.jstree.root,"last",{dnd:!0,ref:k.get_node(a.jstree.root),pos:"i",origin:i.data.origin,is_multi:i.data.origin&&i.data.origin!==k,is_foreign:!i.data.origin}),!v)break;if(v)return c={ins:k,par:a.jstree.root,pos:"last"},g.hide(),i.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(i.event.originalEvent&&i.event.originalEvent.dataTransfer&&(i.event.originalEvent.dataTransfer.dropEffect=D?"copy":"move"))}a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),c=!1,i.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),i.event.originalEvent&&i.event.originalEvent.dataTransfer,g.hide()}}).on("dnd_scroll.vakata.jstree",function(a,b){b&&b.data&&b.data.jstree&&(g.hide(),c=!1,e=!1,b.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))}).on("dnd_stop.vakata.jstree",function(b,h){if(a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),f&&clearTimeout(f),h&&h.data&&h.data.jstree){g.hide().detach();var i,j,k=[];if(c){for(i=0,j=h.data.nodes.length;j>i;i++)k[i]=h.data.origin?h.data.origin.get_node(h.data.nodes[i]):h.data.nodes[i];c.ins[h.data.origin&&(h.data.origin.settings.dnd.always_copy||h.data.origin.settings.dnd.copy&&(h.event.metaKey||h.event.ctrlKey))?"copy_node":"move_node"](k,c.par,c.pos,!1,!1,!1,h.data.origin)}else i=a(h.event.target).closest(".jstree"),i.length&&d&&d.error&&"check"===d.error&&(i=i.jstree(!0),i&&i.settings.core.error.call(this,d));e=!1,c=!1}}).on("keyup.jstree keydown.jstree",function(b,h){h=a.vakata.dnd._get(),h&&h.data&&h.data.jstree&&("keyup"===b.type&&27===b.which?(f&&clearTimeout(f),c=!1,d=!1,e=!1,f=!1,g.hide().detach(),a.vakata.dnd._clean()):(h.helper.find(".jstree-copy").first()[h.data.origin&&(h.data.origin.settings.dnd.always_copy||h.data.origin.settings.dnd.copy&&(b.metaKey||b.ctrlKey))?"show":"hide"](),e&&(e.metaKey=b.metaKey,e.ctrlKey=b.ctrlKey,a.vakata.dnd._trigger("move",e))))})}),function(a){a.vakata.html={div:a("<div />"),escape:function(b){return a.vakata.html.div.text(b).html()},strip:function(b){return a.vakata.html.div.empty().append(a.parseHTML(b)).text()}};var c={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1};a.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:10},_trigger:function(c,d,e){e===b&&(e=a.vakata.dnd._get()),e.event=d,a(i).triggerHandler("dnd_"+c+".vakata",e)},_get:function(){return{data:c.data,element:c.element,helper:c.helper}},_clean:function(){c.helper&&c.helper.remove(),c.scroll_i&&(clearInterval(c.scroll_i),c.scroll_i=!1),c={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1},a(i).off("mousemove.vakata.jstree touchmove.vakata.jstree",a.vakata.dnd.drag),a(i).off("mouseup.vakata.jstree touchend.vakata.jstree",a.vakata.dnd.stop)},_scroll:function(b){if(!c.scroll_e||!c.scroll_l&&!c.scroll_t)return c.scroll_i&&(clearInterval(c.scroll_i),c.scroll_i=!1),!1;if(!c.scroll_i)return c.scroll_i=setInterval(a.vakata.dnd._scroll,100),!1;if(b===!0)return!1;var d=c.scroll_e.scrollTop(),e=c.scroll_e.scrollLeft();c.scroll_e.scrollTop(d+c.scroll_t*a.vakata.dnd.settings.scroll_speed),c.scroll_e.scrollLeft(e+c.scroll_l*a.vakata.dnd.settings.scroll_speed),(d!==c.scroll_e.scrollTop()||e!==c.scroll_e.scrollLeft())&&a.vakata.dnd._trigger("scroll",c.scroll_e)},start:function(b,d,e){"touchstart"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_drag&&a.vakata.dnd.stop({});try{b.currentTarget.unselectable="on",b.currentTarget.onselectstart=function(){return!1},b.currentTarget.style&&(b.currentTarget.style.touchAction="none",b.currentTarget.style.msTouchAction="none",b.currentTarget.style.MozUserSelect="none")}catch(f){}return c.init_x=b.pageX,c.init_y=b.pageY,c.data=d,c.is_down=!0,c.element=b.currentTarget,c.target=b.target,c.is_touch="touchstart"===b.type,e!==!1&&(c.helper=a("<div id='vakata-dnd'></div>").html(e).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),a(i).on("mousemove.vakata.jstree touchmove.vakata.jstree",a.vakata.dnd.drag),a(i).on("mouseup.vakata.jstree touchend.vakata.jstree",a.vakata.dnd.stop),!1},drag:function(b){if("touchmove"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_down){if(!c.is_drag){if(!(Math.abs(b.pageX-c.init_x)>(c.is_touch?a.vakata.dnd.settings.threshold_touch:a.vakata.dnd.settings.threshold)||Math.abs(b.pageY-c.init_y)>(c.is_touch?a.vakata.dnd.settings.threshold_touch:a.vakata.dnd.settings.threshold)))return;c.helper&&(c.helper.appendTo(i.body),c.helper_w=c.helper.outerWidth()),c.is_drag=!0,a(c.target).one("click.vakata",!1),a.vakata.dnd._trigger("start",b)}var d=!1,e=!1,f=!1,g=!1,h=!1,j=!1,k=!1,l=!1,m=!1,n=!1;return c.scroll_t=0,c.scroll_l=0,c.scroll_e=!1,a(a(b.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(a(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var d=a(this),e=d.offset();return this.scrollHeight>this.offsetHeight&&(e.top+d.height()-b.pageY<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_t=1),b.pageY-e.top<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_t=-1)),this.scrollWidth>this.offsetWidth&&(e.left+d.width()-b.pageX<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_l=1),b.pageX-e.left<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_l=-1)),c.scroll_t||c.scroll_l?(c.scroll_e=a(this),!1):void 0}),c.scroll_e||(d=a(i),e=a(window),f=d.height(),g=e.height(),h=d.width(),j=e.width(),k=d.scrollTop(),l=d.scrollLeft(),f>g&&b.pageY-k<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_t=-1),f>g&&g-(b.pageY-k)<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_t=1),h>j&&b.pageX-l<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_l=-1),h>j&&j-(b.pageX-l)<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_l=1),(c.scroll_t||c.scroll_l)&&(c.scroll_e=d)),c.scroll_e&&a.vakata.dnd._scroll(!0),c.helper&&(m=parseInt(b.pageY+a.vakata.dnd.settings.helper_top,10),n=parseInt(b.pageX+a.vakata.dnd.settings.helper_left,10),f&&m+25>f&&(m=f-50),h&&n+c.helper_w>h&&(n=h-(c.helper_w+2)),c.helper.css({left:n+"px",top:m+"px"})),a.vakata.dnd._trigger("move",b),!1}},stop:function(b){if("touchend"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_drag)b.target!==c.target&&a(c.target).off("click.vakata"),a.vakata.dnd._trigger("stop",b);else if("touchend"===b.type&&b.target===c.target){var d=setTimeout(function(){a(b.target).click()},100);a(b.target).one("click",function(){d&&clearTimeout(d)})}return a.vakata.dnd._clean(),!1}}}(a),a.jstree.defaults.massload=null,a.jstree.plugins.massload=function(b,c){this.init=function(a,b){this._data.massload={},c.init.call(this,a,b)},this._load_nodes=function(b,d,e,f){var g=this.settings.massload,h=JSON.stringify(b),i=[],j=this._model.data,k,l,m;if(!e){for(k=0,l=b.length;l>k;k++)(!j[b[k]]||!j[b[k]].state.loaded&&!j[b[k]].state.failed||f)&&(i.push(b[k]),m=this.get_node(b[k],!0),m&&m.length&&m.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},i.length){if(a.isFunction(g))return g.call(this,i,a.proxy(function(a){var g,h;if(a)for(g in a)a.hasOwnProperty(g)&&(this._data.massload[g]=a[g]);for(g=0,h=b.length;h>g;g++)m=this.get_node(b[g],!0),m&&m.length&&m.removeClass("jstree-loading").attr("aria-busy",!1);c._load_nodes.call(this,b,d,e,f)},this));if("object"==typeof g&&g&&g.url)return g=a.extend(!0,{},g),a.isFunction(g.url)&&(g.url=g.url.call(this,i)),a.isFunction(g.data)&&(g.data=g.data.call(this,i)),a.ajax(g).done(a.proxy(function(a,g,h){var i,j;if(a)for(i in a)a.hasOwnProperty(i)&&(this._data.massload[i]=a[i]);for(i=0,j=b.length;j>i;i++)m=this.get_node(b[i],!0),m&&m.length&&m.removeClass("jstree-loading").attr("aria-busy",!1);c._load_nodes.call(this,b,d,e,f)},this)).fail(a.proxy(function(a){c._load_nodes.call(this,b,d,e,f)},this))}}return c._load_nodes.call(this,b,d,e,f)},this._load_node=function(b,d){var e=this._data.massload[b.id],f=null,g;return e?(f=this["string"==typeof e?"_append_html_data":"_append_json_data"](b,"string"==typeof e?a(a.parseHTML(e)).filter(function(){return 3!==this.nodeType}):e,function(a){d.call(this,a)}),g=this.get_node(b.id,!0),g&&g.length&&g.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[b.id],f):c._load_node.call(this,b,d)}},a.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,show_only_matches_children:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},a.jstree.plugins.search=function(c,d){this.bind=function(){d.bind.call(this),this._data.search.str="",this._data.search.dom=a(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=!1,this._data.search.smc=!1,this._data.search.hdn=[],this.element.on("search.jstree",a.proxy(function(b,c){if(this._data.search.som&&c.res.length){var d=this._model.data,e,f,g=[],h,i;for(e=0,f=c.res.length;f>e;e++)if(d[c.res[e]]&&!d[c.res[e]].state.hidden&&(g.push(c.res[e]),g=g.concat(d[c.res[e]].parents),this._data.search.smc))for(h=0,i=d[c.res[e]].children_d.length;i>h;h++)d[d[c.res[e]].children_d[h]]&&!d[d[c.res[e]].children_d[h]].state.hidden&&g.push(d[c.res[e]].children_d[h]);g=a.vakata.array_remove_item(a.vakata.array_unique(g),a.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(g,!0),this.redraw(!0)}},this)).on("clear_search.jstree",a.proxy(function(a,b){this._data.search.som&&b.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))},this))},this.search=function(c,d,e,f,g,h){if(c===!1||""===a.trim(c.toString()))return this.clear_search();f=this.get_node(f),f=f&&f.id?f.id:null,c=c.toString();var i=this.settings.search,j=i.ajax?i.ajax:!1,k=this._model.data,l=null,m=[],n=[],o,p;if(this._data.search.res.length&&!g&&this.clear_search(),e===b&&(e=i.show_only_matches),h===b&&(h=i.show_only_matches_children),!d&&j!==!1)return a.isFunction(j)?j.call(this,c,a.proxy(function(b){b&&b.d&&(b=b.d),this._load_nodes(a.isArray(b)?a.vakata.array_unique(b):[],function(){this.search(c,!0,e,f,g,h)})},this),f):(j=a.extend({},j),j.data||(j.data={}),j.data.str=c,f&&(j.data.inside=f),this._data.search.lastRequest&&this._data.search.lastRequest.abort(),this._data.search.lastRequest=a.ajax(j).fail(a.proxy(function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(j)},this.settings.core.error.call(this,this._data.core.last_error)},this)).done(a.proxy(function(b){b&&b.d&&(b=b.d),this._load_nodes(a.isArray(b)?a.vakata.array_unique(b):[],function(){this.search(c,!0,e,f,g,h)})},this)),this._data.search.lastRequest);if(g||(this._data.search.str=c,this._data.search.dom=a(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=e,this._data.search.smc=h),l=new a.vakata.search(c,!0,{caseSensitive:i.case_sensitive,fuzzy:i.fuzzy}),a.each(k[f?f:a.jstree.root].children_d,function(a,b){var d=k[b];d.text&&!d.state.hidden&&(!i.search_leaves_only||d.state.loaded&&0===d.children.length)&&(i.search_callback&&i.search_callback.call(this,c,d)||!i.search_callback&&l.search(d.text).isMatch)&&(m.push(b),n=n.concat(d.parents))}),m.length){for(n=a.vakata.array_unique(n),o=0,p=n.length;p>o;o++)n[o]!==a.jstree.root&&k[n[o]]&&this.open_node(n[o],null,0)===!0&&this._data.search.opn.push(n[o]);g?(this._data.search.dom=this._data.search.dom.add(a(this.element[0].querySelectorAll("#"+a.map(m,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #")))),this._data.search.res=a.vakata.array_unique(this._data.search.res.concat(m))):(this._data.search.dom=a(this.element[0].querySelectorAll("#"+a.map(m,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.res=m),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:c,res:this._data.search.res,show_only_matches:e})},this.clear_search=function(){this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.res.length&&(this._data.search.dom=a(this.element[0].querySelectorAll("#"+a.map(this._data.search.res,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search")),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=a()},this.redraw_node=function(b,c,e,f){if(b=d.redraw_node.apply(this,arguments),b&&-1!==a.inArray(b.id,this._data.search.res)){var g,h,i=null;for(g=0,h=b.childNodes.length;h>g;g++)if(b.childNodes[g]&&b.childNodes[g].className&&-1!==b.childNodes[g].className.indexOf("jstree-anchor")){i=b.childNodes[g];break}i&&(i.className+=" jstree-search")}return b}},function(a){a.vakata.search=function(b,c,d){d=d||{},d=a.extend({},a.vakata.search.defaults,d),d.fuzzy!==!1&&(d.fuzzy=!0),b=d.caseSensitive?b:b.toLowerCase();var e=d.location,f=d.distance,g=d.threshold,h=b.length,i,j,k,l;return h>32&&(d.fuzzy=!1),d.fuzzy&&(i=1<<h-1,j=function(){var a={},c=0;for(c=0;h>c;c++)a[b.charAt(c)]=0;for(c=0;h>c;c++)a[b.charAt(c)]|=1<<h-c-1;return a}(),k=function(a,b){var c=a/h,d=Math.abs(e-b);return f?c+d/f:d?1:c}),l=function(a){if(a=d.caseSensitive?a:a.toLowerCase(),b===a||-1!==a.indexOf(b))return{isMatch:!0,score:0};if(!d.fuzzy)return{isMatch:!1,score:1};var c,f,l=a.length,m=g,n=a.indexOf(b,e),o,p,q=h+l,r,s,t,u,v,w=1,x=[];for(-1!==n&&(m=Math.min(k(0,n),m),n=a.lastIndexOf(b,e+h),-1!==n&&(m=Math.min(k(0,n),m))),n=-1,c=0;h>c;c++){o=0,p=q;while(p>o)k(c,e+p)<=m?o=p:q=p,p=Math.floor((q-o)/2+o);for(q=p,s=Math.max(1,e-p+1),t=Math.min(e+p,l)+h,u=new Array(t+2),u[t+1]=(1<<c)-1,f=t;f>=s;f--)if(v=j[a.charAt(f-1)],0===c?u[f]=(u[f+1]<<1|1)&v:u[f]=(u[f+1]<<1|1)&v|((r[f+1]|r[f])<<1|1)|r[f+1],u[f]&i&&(w=k(c,f-1),m>=w)){if(m=w,n=f-1,x.push(n),!(n>e))break;s=Math.max(1,2*e-n)}if(k(c+1,e)>m)break;r=u}return{isMatch:n>=0,score:w}},c===!0?{search:l}:l(c)},a.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1}}(a),a.jstree.defaults.sort=function(a,b){return this.get_text(a)>this.get_text(b)?1:-1},a.jstree.plugins.sort=function(b,c){this.bind=function(){c.bind.call(this),this.element.on("model.jstree",a.proxy(function(a,b){this.sort(b.parent,!0)},this)).on("rename_node.jstree create_node.jstree",a.proxy(function(a,b){this.sort(b.parent||b.node.parent,!1),this.redraw_node(b.parent||b.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",a.proxy(function(a,b){this.sort(b.parent,!1),this.redraw_node(b.parent,!0)},this))},this.sort=function(b,c){var d,e;if(b=this.get_node(b),b&&b.children&&b.children.length&&(b.children.sort(a.proxy(this.settings.sort,this)),c))for(d=0,e=b.children_d.length;e>d;d++)this.sort(b.children_d[d],!1)}};var m=!1;a.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1,preserve_loaded:!1},a.jstree.plugins.state=function(b,c){this.bind=function(){c.bind.call(this);var b=a.proxy(function(){this.element.on(this.settings.state.events,a.proxy(function(){m&&clearTimeout(m),m=setTimeout(a.proxy(function(){this.save_state()},this),100)},this)),this.trigger("state_ready")},this);this.element.on("ready.jstree",a.proxy(function(a,c){this.element.one("restore_state.jstree",b),this.restore_state()||b()},this))},this.save_state=function(){var b=this.get_state();this.settings.state.preserve_loaded||delete b.core.loaded;var c={state:b,ttl:this.settings.state.ttl,sec:+new Date};a.vakata.storage.set(this.settings.state.key,JSON.stringify(c))},this.restore_state=function(){var b=a.vakata.storage.get(this.settings.state.key);if(b)try{b=JSON.parse(b)}catch(c){return!1}return b&&b.ttl&&b.sec&&+new Date-b.sec>b.ttl?!1:(b&&b.state&&(b=b.state),b&&a.isFunction(this.settings.state.filter)&&(b=this.settings.state.filter.call(this,b)),b?(this.settings.state.preserve_loaded||delete b.core.loaded,this.element.one("set_state.jstree",function(c,d){d.instance.trigger("restore_state",{state:a.extend(!0,{},b)})}),this.set_state(b),!0):!1)},this.clear_state=function(){return a.vakata.storage.del(this.settings.state.key)}},function(a,b){a.vakata.storage={set:function(a,b){return window.localStorage.setItem(a,b)},get:function(a){return window.localStorage.getItem(a)},del:function(a){return window.localStorage.removeItem(a)}}}(a),a.jstree.defaults.types={"default":{}},a.jstree.defaults.types[a.jstree.root]={},a.jstree.plugins.types=function(c,d){this.init=function(c,e){var f,g;if(e&&e.types&&e.types["default"])for(f in e.types)if("default"!==f&&f!==a.jstree.root&&e.types.hasOwnProperty(f))for(g in e.types["default"])e.types["default"].hasOwnProperty(g)&&e.types[f][g]===b&&(e.types[f][g]=e.types["default"][g]);d.init.call(this,c,e),this._model.data[a.jstree.root].type=a.jstree.root},this.refresh=function(b,c){d.refresh.call(this,b,c),this._model.data[a.jstree.root].type=a.jstree.root},this.bind=function(){this.element.on("model.jstree",a.proxy(function(c,d){var e=this._model.data,f=d.nodes,g=this.settings.types,h,i,j="default",k;for(h=0,i=f.length;i>h;h++){if(j="default",e[f[h]].original&&e[f[h]].original.type&&g[e[f[h]].original.type]&&(j=e[f[h]].original.type),e[f[h]].data&&e[f[h]].data.jstree&&e[f[h]].data.jstree.type&&g[e[f[h]].data.jstree.type]&&(j=e[f[h]].data.jstree.type),e[f[h]].type=j,e[f[h]].icon===!0&&g[j].icon!==b&&(e[f[h]].icon=g[j].icon),g[j].li_attr!==b&&"object"==typeof g[j].li_attr)for(k in g[j].li_attr)if(g[j].li_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].li_attr[k]===b?e[f[h]].li_attr[k]=g[j].li_attr[k]:"class"===k&&(e[f[h]].li_attr["class"]=g[j].li_attr["class"]+" "+e[f[h]].li_attr["class"])}if(g[j].a_attr!==b&&"object"==typeof g[j].a_attr)for(k in g[j].a_attr)if(g[j].a_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].a_attr[k]===b?e[f[h]].a_attr[k]=g[j].a_attr[k]:"href"===k&&"#"===e[f[h]].a_attr[k]?e[f[h]].a_attr.href=g[j].a_attr.href:"class"===k&&(e[f[h]].a_attr["class"]=g[j].a_attr["class"]+" "+e[f[h]].a_attr["class"])}}e[a.jstree.root].type=a.jstree.root},this)),d.bind.call(this)},this.get_json=function(b,c,e){var f,g,h=this._model.data,i=c?a.extend(!0,{},c,{no_id:!1}):{},j=d.get_json.call(this,b,i,e);if(j===!1)return!1;if(a.isArray(j))for(f=0,g=j.length;g>f;f++)j[f].type=j[f].id&&h[j[f].id]&&h[j[f].id].type?h[j[f].id].type:"default",c&&c.no_id&&(delete j[f].id,j[f].li_attr&&j[f].li_attr.id&&delete j[f].li_attr.id,j[f].a_attr&&j[f].a_attr.id&&delete j[f].a_attr.id);else j.type=j.id&&h[j.id]&&h[j.id].type?h[j.id].type:"default",c&&c.no_id&&(j=this._delete_ids(j));return j},this._delete_ids=function(b){if(a.isArray(b)){for(var c=0,d=b.length;d>c;c++)b[c]=this._delete_ids(b[c]);return b}return delete b.id,
|
6 |
+
b.li_attr&&b.li_attr.id&&delete b.li_attr.id,b.a_attr&&b.a_attr.id&&delete b.a_attr.id,b.children&&a.isArray(b.children)&&(b.children=this._delete_ids(b.children)),b},this.check=function(c,e,f,g,h){if(d.check.call(this,c,e,f,g,h)===!1)return!1;e=e&&e.id?e:this.get_node(e),f=f&&f.id?f:this.get_node(f);var i=e&&e.id?h&&h.origin?h.origin:a.jstree.reference(e.id):null,j,k,l,m;switch(i=i&&i._model&&i._model.data?i._model.data:null,c){case"create_node":case"move_node":case"copy_node":if("move_node"!==c||-1===a.inArray(e.id,f.children)){if(j=this.get_rules(f),j.max_children!==b&&-1!==j.max_children&&j.max_children===f.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;if(j.valid_children!==b&&-1!==j.valid_children&&-1===a.inArray(e.type||"default",j.valid_children))return this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;if(i&&e.children_d&&e.parents){for(k=0,l=0,m=e.children_d.length;m>l;l++)k=Math.max(k,i[e.children_d[l]].parents.length);k=k-e.parents.length+1}(0>=k||k===b)&&(k=1);do{if(j.max_depth!==b&&-1!==j.max_depth&&j.max_depth<k)return this._data.core.last_error={error:"check",plugin:"types",id:"types_03",reason:"max_depth prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;f=this.get_node(f.parent),j=this.get_rules(f),k++}while(f)}}return!0},this.get_rules=function(a){if(a=this.get_node(a),!a)return!1;var c=this.get_type(a,!0);return c.max_depth===b&&(c.max_depth=-1),c.max_children===b&&(c.max_children=-1),c.valid_children===b&&(c.valid_children=-1),c},this.get_type=function(b,c){return b=this.get_node(b),b?c?a.extend({type:b.type},this.settings.types[b.type]):b.type:!1},this.set_type=function(c,d){var e=this._model.data,f,g,h,i,j,k,l,m;if(a.isArray(c)){for(c=c.slice(),g=0,h=c.length;h>g;g++)this.set_type(c[g],d);return!0}if(f=this.settings.types,c=this.get_node(c),!f[d]||!c)return!1;if(l=this.get_node(c,!0),l&&l.length&&(m=l.children(".jstree-anchor")),i=c.type,j=this.get_icon(c),c.type=d,(j===!0||!f[i]||f[i].icon!==b&&j===f[i].icon)&&this.set_icon(c,f[d].icon!==b?f[d].icon:!0),f[i]&&f[i].li_attr!==b&&"object"==typeof f[i].li_attr)for(k in f[i].li_attr)if(f[i].li_attr.hasOwnProperty(k)){if("id"===k)continue;"class"===k?(e[c.id].li_attr["class"]=(e[c.id].li_attr["class"]||"").replace(f[i].li_attr[k],""),l&&l.removeClass(f[i].li_attr[k])):e[c.id].li_attr[k]===f[i].li_attr[k]&&(e[c.id].li_attr[k]=null,l&&l.removeAttr(k))}if(f[i]&&f[i].a_attr!==b&&"object"==typeof f[i].a_attr)for(k in f[i].a_attr)if(f[i].a_attr.hasOwnProperty(k)){if("id"===k)continue;"class"===k?(e[c.id].a_attr["class"]=(e[c.id].a_attr["class"]||"").replace(f[i].a_attr[k],""),m&&m.removeClass(f[i].a_attr[k])):e[c.id].a_attr[k]===f[i].a_attr[k]&&("href"===k?(e[c.id].a_attr[k]="#",m&&m.attr("href","#")):(delete e[c.id].a_attr[k],m&&m.removeAttr(k)))}if(f[d].li_attr!==b&&"object"==typeof f[d].li_attr)for(k in f[d].li_attr)if(f[d].li_attr.hasOwnProperty(k)){if("id"===k)continue;e[c.id].li_attr[k]===b?(e[c.id].li_attr[k]=f[d].li_attr[k],l&&("class"===k?l.addClass(f[d].li_attr[k]):l.attr(k,f[d].li_attr[k]))):"class"===k&&(e[c.id].li_attr["class"]=f[d].li_attr[k]+" "+e[c.id].li_attr["class"],l&&l.addClass(f[d].li_attr[k]))}if(f[d].a_attr!==b&&"object"==typeof f[d].a_attr)for(k in f[d].a_attr)if(f[d].a_attr.hasOwnProperty(k)){if("id"===k)continue;e[c.id].a_attr[k]===b?(e[c.id].a_attr[k]=f[d].a_attr[k],m&&("class"===k?m.addClass(f[d].a_attr[k]):m.attr(k,f[d].a_attr[k]))):"href"===k&&"#"===e[c.id].a_attr[k]?(e[c.id].a_attr.href=f[d].a_attr.href,m&&m.attr("href",f[d].a_attr.href)):"class"===k&&(e[c.id].a_attr["class"]=f[d].a_attr["class"]+" "+e[c.id].a_attr["class"],m&&m.addClass(f[d].a_attr[k]))}return!0}},a.jstree.defaults.unique={case_sensitive:!1,trim_whitespace:!1,duplicate:function(a,b){return a+" ("+b+")"}},a.jstree.plugins.unique=function(c,d){this.check=function(b,c,e,f,g){if(d.check.call(this,b,c,e,f,g)===!1)return!1;if(c=c&&c.id?c:this.get_node(c),e=e&&e.id?e:this.get_node(e),!e||!e.children)return!0;var h="rename_node"===b?f:c.text,i=[],j=this.settings.unique.case_sensitive,k=this.settings.unique.trim_whitespace,l=this._model.data,m,n,o;for(m=0,n=e.children.length;n>m;m++)o=l[e.children[m]].text,j||(o=o.toLowerCase()),k&&(o=o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),i.push(o);switch(j||(h=h.toLowerCase()),k&&(h=h.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),b){case"delete_node":return!0;case"rename_node":return o=c.text||"",j||(o=o.toLowerCase()),k&&(o=o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),m=-1===a.inArray(h,i)||c.text&&o===h,m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m;case"create_node":return m=-1===a.inArray(h,i),m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m;case"copy_node":return m=-1===a.inArray(h,i),m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m;case"move_node":return m=c.parent===e.id&&(!g||!g.is_multi)||-1===a.inArray(h,i),m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m}return!0},this.create_node=function(c,e,f,g,h){if(!e||e.text===b){if(null===c&&(c=a.jstree.root),c=this.get_node(c),!c)return d.create_node.call(this,c,e,f,g,h);if(f=f===b?"last":f,!f.toString().match(/^(before|after)$/)&&!h&&!this.is_loaded(c))return d.create_node.call(this,c,e,f,g,h);e||(e={});var i,j,k,l,m,n=this._model.data,o=this.settings.unique.case_sensitive,p=this.settings.unique.trim_whitespace,q=this.settings.unique.duplicate,r;for(j=i=this.get_string("New node"),k=[],l=0,m=c.children.length;m>l;l++)r=n[c.children[l]].text,o||(r=r.toLowerCase()),p&&(r=r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),k.push(r);l=1,r=j,o||(r=r.toLowerCase()),p&&(r=r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));while(-1!==a.inArray(r,k))j=q.call(this,i,++l).toString(),r=j,o||(r=r.toLowerCase()),p&&(r=r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));e.text=j}return d.create_node.call(this,c,e,f,g,h)}};var n=i.createElement("DIV");if(n.setAttribute("unselectable","on"),n.setAttribute("role","presentation"),n.className="jstree-wholerow",n.innerHTML=" ",a.jstree.plugins.wholerow=function(b,c){this.bind=function(){c.bind.call(this),this.element.on("ready.jstree set_state.jstree",a.proxy(function(){this.hide_dots()},this)).on("init.jstree loading.jstree ready.jstree",a.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",a.proxy(function(a,b){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",a.proxy(function(a,b){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var c=!1,d,e;for(d=0,e=b.selected.length;e>d;d++)c=this.get_node(b.selected[d],!0),c&&c.length&&c.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("open_node.jstree",a.proxy(function(a,b){this.get_node(b.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("hover_node.jstree dehover_node.jstree",a.proxy(function(a,b){"hover_node"===a.type&&this.is_disabled(b.node)||this.get_node(b.node,!0).children(".jstree-wholerow")["hover_node"===a.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",a.proxy(function(b){if(this._data.contextmenu){b.preventDefault();var c=a.Event("contextmenu",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey,pageX:b.pageX,pageY:b.pageY});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c)}},this)).on("click.jstree",".jstree-wholerow",function(b){b.stopImmediatePropagation();var c=a.Event("click",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()}).on("dblclick.jstree",".jstree-wholerow",function(b){b.stopImmediatePropagation();var c=a.Event("dblclick",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",a.proxy(function(b){b.stopImmediatePropagation();var c=a.Event("click",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",a.proxy(function(a){return a.stopImmediatePropagation(),this.is_disabled(a.currentTarget)||this.hover_node(a.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",a.proxy(function(a){this.dehover_node(a.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),c.teardown.call(this)},this.redraw_node=function(b,d,e,f){if(b=c.redraw_node.apply(this,arguments)){var g=n.cloneNode(!0);-1!==a.inArray(b.id,this._data.core.selected)&&(g.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===b.id&&(g.className+=" jstree-wholerow-hovered"),b.insertBefore(g,b.childNodes[0])}return b}},window.customElements&&Object&&Object.create){var o=Object.create(HTMLElement.prototype);o.createdCallback=function(){var b={core:{},plugins:[]},c;for(c in a.jstree.plugins)a.jstree.plugins.hasOwnProperty(c)&&this.attributes[c]&&(b.plugins.push(c),this.getAttribute(c)&&JSON.parse(this.getAttribute(c))&&(b[c]=JSON.parse(this.getAttribute(c))));for(c in a.jstree.defaults.core)a.jstree.defaults.core.hasOwnProperty(c)&&this.attributes[c]&&(b.core[c]=JSON.parse(this.getAttribute(c))||this.getAttribute(c));a(this).jstree(b)};try{window.customElements.define("vakata-jstree",function(){},{prototype:o})}catch(p){}}}});
|
trunk/admin/js/jstree/dist/themes/default-dark/32px.png
ADDED
Binary file
|
trunk/admin/js/jstree/dist/themes/default-dark/40px.png
ADDED
Binary file
|
trunk/admin/js/jstree/dist/themes/default-dark/style.css
ADDED
@@ -0,0 +1,1146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* jsTree default dark theme */
|
2 |
+
.jstree-node,
|
3 |
+
.jstree-children,
|
4 |
+
.jstree-container-ul {
|
5 |
+
display: block;
|
6 |
+
margin: 0;
|
7 |
+
padding: 0;
|
8 |
+
list-style-type: none;
|
9 |
+
list-style-image: none;
|
10 |
+
}
|
11 |
+
.jstree-node {
|
12 |
+
white-space: nowrap;
|
13 |
+
}
|
14 |
+
.jstree-anchor {
|
15 |
+
display: inline-block;
|
16 |
+
color: black;
|
17 |
+
white-space: nowrap;
|
18 |
+
padding: 0 4px 0 1px;
|
19 |
+
margin: 0;
|
20 |
+
vertical-align: top;
|
21 |
+
}
|
22 |
+
.jstree-anchor:focus {
|
23 |
+
outline: 0;
|
24 |
+
}
|
25 |
+
.jstree-anchor,
|
26 |
+
.jstree-anchor:link,
|
27 |
+
.jstree-anchor:visited,
|
28 |
+
.jstree-anchor:hover,
|
29 |
+
.jstree-anchor:active {
|
30 |
+
text-decoration: none;
|
31 |
+
color: inherit;
|
32 |
+
}
|
33 |
+
.jstree-icon {
|
34 |
+
display: inline-block;
|
35 |
+
text-decoration: none;
|
36 |
+
margin: 0;
|
37 |
+
padding: 0;
|
38 |
+
vertical-align: top;
|
39 |
+
text-align: center;
|
40 |
+
}
|
41 |
+
.jstree-icon:empty {
|
42 |
+
display: inline-block;
|
43 |
+
text-decoration: none;
|
44 |
+
margin: 0;
|
45 |
+
padding: 0;
|
46 |
+
vertical-align: top;
|
47 |
+
text-align: center;
|
48 |
+
}
|
49 |
+
.jstree-ocl {
|
50 |
+
cursor: pointer;
|
51 |
+
}
|
52 |
+
.jstree-leaf > .jstree-ocl {
|
53 |
+
cursor: default;
|
54 |
+
}
|
55 |
+
.jstree .jstree-open > .jstree-children {
|
56 |
+
display: block;
|
57 |
+
}
|
58 |
+
.jstree .jstree-closed > .jstree-children,
|
59 |
+
.jstree .jstree-leaf > .jstree-children {
|
60 |
+
display: none;
|
61 |
+
}
|
62 |
+
.jstree-anchor > .jstree-themeicon {
|
63 |
+
margin-right: 2px;
|
64 |
+
}
|
65 |
+
.jstree-no-icons .jstree-themeicon,
|
66 |
+
.jstree-anchor > .jstree-themeicon-hidden {
|
67 |
+
display: none;
|
68 |
+
}
|
69 |
+
.jstree-hidden,
|
70 |
+
.jstree-node.jstree-hidden {
|
71 |
+
display: none;
|
72 |
+
}
|
73 |
+
.jstree-rtl .jstree-anchor {
|
74 |
+
padding: 0 1px 0 4px;
|
75 |
+
}
|
76 |
+
.jstree-rtl .jstree-anchor > .jstree-themeicon {
|
77 |
+
margin-left: 2px;
|
78 |
+
margin-right: 0;
|
79 |
+
}
|
80 |
+
.jstree-rtl .jstree-node {
|
81 |
+
margin-left: 0;
|
82 |
+
}
|
83 |
+
.jstree-rtl .jstree-container-ul > .jstree-node {
|
84 |
+
margin-right: 0;
|
85 |
+
}
|
86 |
+
.jstree-wholerow-ul {
|
87 |
+
position: relative;
|
88 |
+
display: inline-block;
|
89 |
+
min-width: 100%;
|
90 |
+
}
|
91 |
+
.jstree-wholerow-ul .jstree-leaf > .jstree-ocl {
|
92 |
+
cursor: pointer;
|
93 |
+
}
|
94 |
+
.jstree-wholerow-ul .jstree-anchor,
|
95 |
+
.jstree-wholerow-ul .jstree-icon {
|
96 |
+
position: relative;
|
97 |
+
}
|
98 |
+
.jstree-wholerow-ul .jstree-wholerow {
|
99 |
+
width: 100%;
|
100 |
+
cursor: pointer;
|
101 |
+
position: absolute;
|
102 |
+
left: 0;
|
103 |
+
-webkit-user-select: none;
|
104 |
+
-moz-user-select: none;
|
105 |
+
-ms-user-select: none;
|
106 |
+
user-select: none;
|
107 |
+
}
|
108 |
+
.jstree-contextmenu .jstree-anchor {
|
109 |
+
-webkit-user-select: none;
|
110 |
+
/* disable selection/Copy of UIWebView */
|
111 |
+
-webkit-touch-callout: none;
|
112 |
+
/* disable the IOS popup when long-press on a link */
|
113 |
+
}
|
114 |
+
.vakata-context {
|
115 |
+
display: none;
|
116 |
+
}
|
117 |
+
.vakata-context,
|
118 |
+
.vakata-context ul {
|
119 |
+
margin: 0;
|
120 |
+
padding: 2px;
|
121 |
+
position: absolute;
|
122 |
+
background: #f5f5f5;
|
123 |
+
border: 1px solid #979797;
|
124 |
+
box-shadow: 2px 2px 2px #999999;
|
125 |
+
}
|
126 |
+
.vakata-context ul {
|
127 |
+
list-style: none;
|
128 |
+
left: 100%;
|
129 |
+
margin-top: -2.7em;
|
130 |
+
margin-left: -4px;
|
131 |
+
}
|
132 |
+
.vakata-context .vakata-context-right ul {
|
133 |
+
left: auto;
|
134 |
+
right: 100%;
|
135 |
+
margin-left: auto;
|
136 |
+
margin-right: -4px;
|
137 |
+
}
|
138 |
+
.vakata-context li {
|
139 |
+
list-style: none;
|
140 |
+
}
|
141 |
+
.vakata-context li > a {
|
142 |
+
display: block;
|
143 |
+
padding: 0 2em 0 2em;
|
144 |
+
text-decoration: none;
|
145 |
+
width: auto;
|
146 |
+
color: black;
|
147 |
+
white-space: nowrap;
|
148 |
+
line-height: 2.4em;
|
149 |
+
text-shadow: 1px 1px 0 white;
|
150 |
+
border-radius: 1px;
|
151 |
+
}
|
152 |
+
.vakata-context li > a:hover {
|
153 |
+
position: relative;
|
154 |
+
background-color: #e8eff7;
|
155 |
+
box-shadow: 0 0 2px #0a6aa1;
|
156 |
+
}
|
157 |
+
.vakata-context li > a.vakata-context-parent {
|
158 |
+
background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==");
|
159 |
+
background-position: right center;
|
160 |
+
background-repeat: no-repeat;
|
161 |
+
}
|
162 |
+
.vakata-context li > a:focus {
|
163 |
+
outline: 0;
|
164 |
+
}
|
165 |
+
.vakata-context .vakata-context-hover > a {
|
166 |
+
position: relative;
|
167 |
+
background-color: #e8eff7;
|
168 |
+
box-shadow: 0 0 2px #0a6aa1;
|
169 |
+
}
|
170 |
+
.vakata-context .vakata-context-separator > a,
|
171 |
+
.vakata-context .vakata-context-separator > a:hover {
|
172 |
+
background: white;
|
173 |
+
border: 0;
|
174 |
+
border-top: 1px solid #e2e3e3;
|
175 |
+
height: 1px;
|
176 |
+
min-height: 1px;
|
177 |
+
max-height: 1px;
|
178 |
+
padding: 0;
|
179 |
+
margin: 0 0 0 2.4em;
|
180 |
+
border-left: 1px solid #e0e0e0;
|
181 |
+
text-shadow: 0 0 0 transparent;
|
182 |
+
box-shadow: 0 0 0 transparent;
|
183 |
+
border-radius: 0;
|
184 |
+
}
|
185 |
+
.vakata-context .vakata-contextmenu-disabled a,
|
186 |
+
.vakata-context .vakata-contextmenu-disabled a:hover {
|
187 |
+
color: silver;
|
188 |
+
background-color: transparent;
|
189 |
+
border: 0;
|
190 |
+
box-shadow: 0 0 0;
|
191 |
+
}
|
192 |
+
.vakata-context .vakata-contextmenu-disabled > a > i {
|
193 |
+
filter: grayscale(100%);
|
194 |
+
}
|
195 |
+
.vakata-context li > a > i {
|
196 |
+
text-decoration: none;
|
197 |
+
display: inline-block;
|
198 |
+
width: 2.4em;
|
199 |
+
height: 2.4em;
|
200 |
+
background: transparent;
|
201 |
+
margin: 0 0 0 -2em;
|
202 |
+
vertical-align: top;
|
203 |
+
text-align: center;
|
204 |
+
line-height: 2.4em;
|
205 |
+
}
|
206 |
+
.vakata-context li > a > i:empty {
|
207 |
+
width: 2.4em;
|
208 |
+
line-height: 2.4em;
|
209 |
+
}
|
210 |
+
.vakata-context li > a .vakata-contextmenu-sep {
|
211 |
+
display: inline-block;
|
212 |
+
width: 1px;
|
213 |
+
height: 2.4em;
|
214 |
+
background: white;
|
215 |
+
margin: 0 0.5em 0 0;
|
216 |
+
border-left: 1px solid #e2e3e3;
|
217 |
+
}
|
218 |
+
.vakata-context .vakata-contextmenu-shortcut {
|
219 |
+
font-size: 0.8em;
|
220 |
+
color: silver;
|
221 |
+
opacity: 0.5;
|
222 |
+
display: none;
|
223 |
+
}
|
224 |
+
.vakata-context-rtl ul {
|
225 |
+
left: auto;
|
226 |
+
right: 100%;
|
227 |
+
margin-left: auto;
|
228 |
+
margin-right: -4px;
|
229 |
+
}
|
230 |
+
.vakata-context-rtl li > a.vakata-context-parent {
|
231 |
+
background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");
|
232 |
+
background-position: left center;
|
233 |
+
background-repeat: no-repeat;
|
234 |
+
}
|
235 |
+
.vakata-context-rtl .vakata-context-separator > a {
|
236 |
+
margin: 0 2.4em 0 0;
|
237 |
+
border-left: 0;
|
238 |
+
border-right: 1px solid #e2e3e3;
|
239 |
+
}
|
240 |
+
.vakata-context-rtl .vakata-context-left ul {
|
241 |
+
right: auto;
|
242 |
+
left: 100%;
|
243 |
+
margin-left: -4px;
|
244 |
+
margin-right: auto;
|
245 |
+
}
|
246 |
+
.vakata-context-rtl li > a > i {
|
247 |
+
margin: 0 -2em 0 0;
|
248 |
+
}
|
249 |
+
.vakata-context-rtl li > a .vakata-contextmenu-sep {
|
250 |
+
margin: 0 0 0 0.5em;
|
251 |
+
border-left-color: white;
|
252 |
+
background: #e2e3e3;
|
253 |
+
}
|
254 |
+
#jstree-marker {
|
255 |
+
position: absolute;
|
256 |
+
top: 0;
|
257 |
+
left: 0;
|
258 |
+
margin: -5px 0 0 0;
|
259 |
+
padding: 0;
|
260 |
+
border-right: 0;
|
261 |
+
border-top: 5px solid transparent;
|
262 |
+
border-bottom: 5px solid transparent;
|
263 |
+
border-left: 5px solid;
|
264 |
+
width: 0;
|
265 |
+
height: 0;
|
266 |
+
font-size: 0;
|
267 |
+
line-height: 0;
|
268 |
+
}
|
269 |
+
#jstree-dnd {
|
270 |
+
line-height: 16px;
|
271 |
+
margin: 0;
|
272 |
+
padding: 4px;
|
273 |
+
}
|
274 |
+
#jstree-dnd .jstree-icon,
|
275 |
+
#jstree-dnd .jstree-copy {
|
276 |
+
display: inline-block;
|
277 |
+
text-decoration: none;
|
278 |
+
margin: 0 2px 0 0;
|
279 |
+
padding: 0;
|
280 |
+
width: 16px;
|
281 |
+
height: 16px;
|
282 |
+
}
|
283 |
+
#jstree-dnd .jstree-ok {
|
284 |
+
background: green;
|
285 |
+
}
|
286 |
+
#jstree-dnd .jstree-er {
|
287 |
+
background: red;
|
288 |
+
}
|
289 |
+
#jstree-dnd .jstree-copy {
|
290 |
+
margin: 0 2px 0 2px;
|
291 |
+
}
|
292 |
+
.jstree-default-dark .jstree-node,
|
293 |
+
.jstree-default-dark .jstree-icon {
|
294 |
+
background-repeat: no-repeat;
|
295 |
+
background-color: transparent;
|
296 |
+
}
|
297 |
+
.jstree-default-dark .jstree-anchor,
|
298 |
+
.jstree-default-dark .jstree-animated,
|
299 |
+
.jstree-default-dark .jstree-wholerow {
|
300 |
+
transition: background-color 0.15s, box-shadow 0.15s;
|
301 |
+
}
|
302 |
+
.jstree-default-dark .jstree-hovered {
|
303 |
+
background: #555;
|
304 |
+
border-radius: 2px;
|
305 |
+
box-shadow: inset 0 0 1px #555;
|
306 |
+
}
|
307 |
+
.jstree-default-dark .jstree-context {
|
308 |
+
background: #555;
|
309 |
+
border-radius: 2px;
|
310 |
+
box-shadow: inset 0 0 1px #555;
|
311 |
+
}
|
312 |
+
.jstree-default-dark .jstree-clicked {
|
313 |
+
background: #5fa2db;
|
314 |
+
border-radius: 2px;
|
315 |
+
box-shadow: inset 0 0 1px #666666;
|
316 |
+
}
|
317 |
+
.jstree-default-dark .jstree-no-icons .jstree-anchor > .jstree-themeicon {
|
318 |
+
display: none;
|
319 |
+
}
|
320 |
+
.jstree-default-dark .jstree-disabled {
|
321 |
+
background: transparent;
|
322 |
+
color: #666666;
|
323 |
+
}
|
324 |
+
.jstree-default-dark .jstree-disabled.jstree-hovered {
|
325 |
+
background: transparent;
|
326 |
+
box-shadow: none;
|
327 |
+
}
|
328 |
+
.jstree-default-dark .jstree-disabled.jstree-clicked {
|
329 |
+
background: #333333;
|
330 |
+
}
|
331 |
+
.jstree-default-dark .jstree-disabled > .jstree-icon {
|
332 |
+
opacity: 0.8;
|
333 |
+
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
|
334 |
+
/* Firefox 10+ */
|
335 |
+
filter: gray;
|
336 |
+
/* IE6-9 */
|
337 |
+
-webkit-filter: grayscale(100%);
|
338 |
+
/* Chrome 19+ & Safari 6+ */
|
339 |
+
}
|
340 |
+
.jstree-default-dark .jstree-search {
|
341 |
+
font-style: italic;
|
342 |
+
color: #ffffff;
|
343 |
+
font-weight: bold;
|
344 |
+
}
|
345 |
+
.jstree-default-dark .jstree-no-checkboxes .jstree-checkbox {
|
346 |
+
display: none !important;
|
347 |
+
}
|
348 |
+
.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked {
|
349 |
+
background: transparent;
|
350 |
+
box-shadow: none;
|
351 |
+
}
|
352 |
+
.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered {
|
353 |
+
background: #555;
|
354 |
+
}
|
355 |
+
.jstree-default-dark.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked {
|
356 |
+
background: transparent;
|
357 |
+
}
|
358 |
+
.jstree-default-dark.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered {
|
359 |
+
background: #555;
|
360 |
+
}
|
361 |
+
.jstree-default-dark > .jstree-striped {
|
362 |
+
min-width: 100%;
|
363 |
+
display: inline-block;
|
364 |
+
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat;
|
365 |
+
}
|
366 |
+
.jstree-default-dark > .jstree-wholerow-ul .jstree-hovered,
|
367 |
+
.jstree-default-dark > .jstree-wholerow-ul .jstree-clicked {
|
368 |
+
background: transparent;
|
369 |
+
box-shadow: none;
|
370 |
+
border-radius: 0;
|
371 |
+
}
|
372 |
+
.jstree-default-dark .jstree-wholerow {
|
373 |
+
-moz-box-sizing: border-box;
|
374 |
+
-webkit-box-sizing: border-box;
|
375 |
+
box-sizing: border-box;
|
376 |
+
}
|
377 |
+
.jstree-default-dark .jstree-wholerow-hovered {
|
378 |
+
background: #555;
|
379 |
+
}
|
380 |
+
.jstree-default-dark .jstree-wholerow-clicked {
|
381 |
+
background: #5fa2db;
|
382 |
+
background: -webkit-linear-gradient(top, #5fa2db 0%, #5fa2db 100%);
|
383 |
+
background: linear-gradient(to bottom, #5fa2db 0%, #5fa2db 100%);
|
384 |
+
}
|
385 |
+
.jstree-default-dark .jstree-node {
|
386 |
+
min-height: 24px;
|
387 |
+
line-height: 24px;
|
388 |
+
margin-left: 24px;
|
389 |
+
min-width: 24px;
|
390 |
+
}
|
391 |
+
.jstree-default-dark .jstree-anchor {
|
392 |
+
line-height: 24px;
|
393 |
+
height: 24px;
|
394 |
+
}
|
395 |
+
.jstree-default-dark .jstree-icon {
|
396 |
+
width: 24px;
|
397 |
+
height: 24px;
|
398 |
+
line-height: 24px;
|
399 |
+
}
|
400 |
+
.jstree-default-dark .jstree-icon:empty {
|
401 |
+
width: 24px;
|
402 |
+
height: 24px;
|
403 |
+
line-height: 24px;
|
404 |
+
}
|
405 |
+
.jstree-default-dark.jstree-rtl .jstree-node {
|
406 |
+
margin-right: 24px;
|
407 |
+
}
|
408 |
+
.jstree-default-dark .jstree-wholerow {
|
409 |
+
height: 24px;
|
410 |
+
}
|
411 |
+
.jstree-default-dark .jstree-node,
|
412 |
+
.jstree-default-dark .jstree-icon {
|
413 |
+
background-image: url("32px.png");
|
414 |
+
}
|
415 |
+
.jstree-default-dark .jstree-node {
|
416 |
+
background-position: -292px -4px;
|
417 |
+
background-repeat: repeat-y;
|
418 |
+
}
|
419 |
+
.jstree-default-dark .jstree-last {
|
420 |
+
background: transparent;
|
421 |
+
}
|
422 |
+
.jstree-default-dark .jstree-open > .jstree-ocl {
|
423 |
+
background-position: -132px -4px;
|
424 |
+
}
|
425 |
+
.jstree-default-dark .jstree-closed > .jstree-ocl {
|
426 |
+
background-position: -100px -4px;
|
427 |
+
}
|
428 |
+
.jstree-default-dark .jstree-leaf > .jstree-ocl {
|
429 |
+
background-position: -68px -4px;
|
430 |
+
}
|
431 |
+
.jstree-default-dark .jstree-themeicon {
|
432 |
+
background-position: -260px -4px;
|
433 |
+
}
|
434 |
+
.jstree-default-dark > .jstree-no-dots .jstree-node,
|
435 |
+
.jstree-default-dark > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
436 |
+
background: transparent;
|
437 |
+
}
|
438 |
+
.jstree-default-dark > .jstree-no-dots .jstree-open > .jstree-ocl {
|
439 |
+
background-position: -36px -4px;
|
440 |
+
}
|
441 |
+
.jstree-default-dark > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
442 |
+
background-position: -4px -4px;
|
443 |
+
}
|
444 |
+
.jstree-default-dark .jstree-disabled {
|
445 |
+
background: transparent;
|
446 |
+
}
|
447 |
+
.jstree-default-dark .jstree-disabled.jstree-hovered {
|
448 |
+
background: transparent;
|
449 |
+
}
|
450 |
+
.jstree-default-dark .jstree-disabled.jstree-clicked {
|
451 |
+
background: #efefef;
|
452 |
+
}
|
453 |
+
.jstree-default-dark .jstree-checkbox {
|
454 |
+
background-position: -164px -4px;
|
455 |
+
}
|
456 |
+
.jstree-default-dark .jstree-checkbox:hover {
|
457 |
+
background-position: -164px -36px;
|
458 |
+
}
|
459 |
+
.jstree-default-dark.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,
|
460 |
+
.jstree-default-dark .jstree-checked > .jstree-checkbox {
|
461 |
+
background-position: -228px -4px;
|
462 |
+
}
|
463 |
+
.jstree-default-dark.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,
|
464 |
+
.jstree-default-dark .jstree-checked > .jstree-checkbox:hover {
|
465 |
+
background-position: -228px -36px;
|
466 |
+
}
|
467 |
+
.jstree-default-dark .jstree-anchor > .jstree-undetermined {
|
468 |
+
background-position: -196px -4px;
|
469 |
+
}
|
470 |
+
.jstree-default-dark .jstree-anchor > .jstree-undetermined:hover {
|
471 |
+
background-position: -196px -36px;
|
472 |
+
}
|
473 |
+
.jstree-default-dark .jstree-checkbox-disabled {
|
474 |
+
opacity: 0.8;
|
475 |
+
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
|
476 |
+
/* Firefox 10+ */
|
477 |
+
filter: gray;
|
478 |
+
/* IE6-9 */
|
479 |
+
-webkit-filter: grayscale(100%);
|
480 |
+
/* Chrome 19+ & Safari 6+ */
|
481 |
+
}
|
482 |
+
.jstree-default-dark > .jstree-striped {
|
483 |
+
background-size: auto 48px;
|
484 |
+
}
|
485 |
+
.jstree-default-dark.jstree-rtl .jstree-node {
|
486 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
487 |
+
background-position: 100% 1px;
|
488 |
+
background-repeat: repeat-y;
|
489 |
+
}
|
490 |
+
.jstree-default-dark.jstree-rtl .jstree-last {
|
491 |
+
background: transparent;
|
492 |
+
}
|
493 |
+
.jstree-default-dark.jstree-rtl .jstree-open > .jstree-ocl {
|
494 |
+
background-position: -132px -36px;
|
495 |
+
}
|
496 |
+
.jstree-default-dark.jstree-rtl .jstree-closed > .jstree-ocl {
|
497 |
+
background-position: -100px -36px;
|
498 |
+
}
|
499 |
+
.jstree-default-dark.jstree-rtl .jstree-leaf > .jstree-ocl {
|
500 |
+
background-position: -68px -36px;
|
501 |
+
}
|
502 |
+
.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-node,
|
503 |
+
.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
504 |
+
background: transparent;
|
505 |
+
}
|
506 |
+
.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
|
507 |
+
background-position: -36px -36px;
|
508 |
+
}
|
509 |
+
.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
510 |
+
background-position: -4px -36px;
|
511 |
+
}
|
512 |
+
.jstree-default-dark .jstree-themeicon-custom {
|
513 |
+
background-color: transparent;
|
514 |
+
background-image: none;
|
515 |
+
background-position: 0 0;
|
516 |
+
}
|
517 |
+
.jstree-default-dark > .jstree-container-ul .jstree-loading > .jstree-ocl {
|
518 |
+
background: url("throbber.gif") center center no-repeat;
|
519 |
+
}
|
520 |
+
.jstree-default-dark .jstree-file {
|
521 |
+
background: url("32px.png") -100px -68px no-repeat;
|
522 |
+
}
|
523 |
+
.jstree-default-dark .jstree-folder {
|
524 |
+
background: url("32px.png") -260px -4px no-repeat;
|
525 |
+
}
|
526 |
+
.jstree-default-dark > .jstree-container-ul > .jstree-node {
|
527 |
+
margin-left: 0;
|
528 |
+
margin-right: 0;
|
529 |
+
}
|
530 |
+
#jstree-dnd.jstree-default-dark {
|
531 |
+
line-height: 24px;
|
532 |
+
padding: 0 4px;
|
533 |
+
}
|
534 |
+
#jstree-dnd.jstree-default-dark .jstree-ok,
|
535 |
+
#jstree-dnd.jstree-default-dark .jstree-er {
|
536 |
+
background-image: url("32px.png");
|
537 |
+
background-repeat: no-repeat;
|
538 |
+
background-color: transparent;
|
539 |
+
}
|
540 |
+
#jstree-dnd.jstree-default-dark i {
|
541 |
+
background: transparent;
|
542 |
+
width: 24px;
|
543 |
+
height: 24px;
|
544 |
+
line-height: 24px;
|
545 |
+
}
|
546 |
+
#jstree-dnd.jstree-default-dark .jstree-ok {
|
547 |
+
background-position: -4px -68px;
|
548 |
+
}
|
549 |
+
#jstree-dnd.jstree-default-dark .jstree-er {
|
550 |
+
background-position: -36px -68px;
|
551 |
+
}
|
552 |
+
.jstree-default-dark .jstree-ellipsis {
|
553 |
+
overflow: hidden;
|
554 |
+
}
|
555 |
+
.jstree-default-dark .jstree-ellipsis .jstree-anchor {
|
556 |
+
width: calc(100% - 29px);
|
557 |
+
text-overflow: ellipsis;
|
558 |
+
overflow: hidden;
|
559 |
+
}
|
560 |
+
.jstree-default-dark.jstree-rtl .jstree-node {
|
561 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
562 |
+
}
|
563 |
+
.jstree-default-dark.jstree-rtl .jstree-last {
|
564 |
+
background: transparent;
|
565 |
+
}
|
566 |
+
.jstree-default-dark-small .jstree-node {
|
567 |
+
min-height: 18px;
|
568 |
+
line-height: 18px;
|
569 |
+
margin-left: 18px;
|
570 |
+
min-width: 18px;
|
571 |
+
}
|
572 |
+
.jstree-default-dark-small .jstree-anchor {
|
573 |
+
line-height: 18px;
|
574 |
+
height: 18px;
|
575 |
+
}
|
576 |
+
.jstree-default-dark-small .jstree-icon {
|
577 |
+
width: 18px;
|
578 |
+
height: 18px;
|
579 |
+
line-height: 18px;
|
580 |
+
}
|
581 |
+
.jstree-default-dark-small .jstree-icon:empty {
|
582 |
+
width: 18px;
|
583 |
+
height: 18px;
|
584 |
+
line-height: 18px;
|
585 |
+
}
|
586 |
+
.jstree-default-dark-small.jstree-rtl .jstree-node {
|
587 |
+
margin-right: 18px;
|
588 |
+
}
|
589 |
+
.jstree-default-dark-small .jstree-wholerow {
|
590 |
+
height: 18px;
|
591 |
+
}
|
592 |
+
.jstree-default-dark-small .jstree-node,
|
593 |
+
.jstree-default-dark-small .jstree-icon {
|
594 |
+
background-image: url("32px.png");
|
595 |
+
}
|
596 |
+
.jstree-default-dark-small .jstree-node {
|
597 |
+
background-position: -295px -7px;
|
598 |
+
background-repeat: repeat-y;
|
599 |
+
}
|
600 |
+
.jstree-default-dark-small .jstree-last {
|
601 |
+
background: transparent;
|
602 |
+
}
|
603 |
+
.jstree-default-dark-small .jstree-open > .jstree-ocl {
|
604 |
+
background-position: -135px -7px;
|
605 |
+
}
|
606 |
+
.jstree-default-dark-small .jstree-closed > .jstree-ocl {
|
607 |
+
background-position: -103px -7px;
|
608 |
+
}
|
609 |
+
.jstree-default-dark-small .jstree-leaf > .jstree-ocl {
|
610 |
+
background-position: -71px -7px;
|
611 |
+
}
|
612 |
+
.jstree-default-dark-small .jstree-themeicon {
|
613 |
+
background-position: -263px -7px;
|
614 |
+
}
|
615 |
+
.jstree-default-dark-small > .jstree-no-dots .jstree-node,
|
616 |
+
.jstree-default-dark-small > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
617 |
+
background: transparent;
|
618 |
+
}
|
619 |
+
.jstree-default-dark-small > .jstree-no-dots .jstree-open > .jstree-ocl {
|
620 |
+
background-position: -39px -7px;
|
621 |
+
}
|
622 |
+
.jstree-default-dark-small > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
623 |
+
background-position: -7px -7px;
|
624 |
+
}
|
625 |
+
.jstree-default-dark-small .jstree-disabled {
|
626 |
+
background: transparent;
|
627 |
+
}
|
628 |
+
.jstree-default-dark-small .jstree-disabled.jstree-hovered {
|
629 |
+
background: transparent;
|
630 |
+
}
|
631 |
+
.jstree-default-dark-small .jstree-disabled.jstree-clicked {
|
632 |
+
background: #efefef;
|
633 |
+
}
|
634 |
+
.jstree-default-dark-small .jstree-checkbox {
|
635 |
+
background-position: -167px -7px;
|
636 |
+
}
|
637 |
+
.jstree-default-dark-small .jstree-checkbox:hover {
|
638 |
+
background-position: -167px -39px;
|
639 |
+
}
|
640 |
+
.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,
|
641 |
+
.jstree-default-dark-small .jstree-checked > .jstree-checkbox {
|
642 |
+
background-position: -231px -7px;
|
643 |
+
}
|
644 |
+
.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,
|
645 |
+
.jstree-default-dark-small .jstree-checked > .jstree-checkbox:hover {
|
646 |
+
background-position: -231px -39px;
|
647 |
+
}
|
648 |
+
.jstree-default-dark-small .jstree-anchor > .jstree-undetermined {
|
649 |
+
background-position: -199px -7px;
|
650 |
+
}
|
651 |
+
.jstree-default-dark-small .jstree-anchor > .jstree-undetermined:hover {
|
652 |
+
background-position: -199px -39px;
|
653 |
+
}
|
654 |
+
.jstree-default-dark-small .jstree-checkbox-disabled {
|
655 |
+
opacity: 0.8;
|
656 |
+
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
|
657 |
+
/* Firefox 10+ */
|
658 |
+
filter: gray;
|
659 |
+
/* IE6-9 */
|
660 |
+
-webkit-filter: grayscale(100%);
|
661 |
+
/* Chrome 19+ & Safari 6+ */
|
662 |
+
}
|
663 |
+
.jstree-default-dark-small > .jstree-striped {
|
664 |
+
background-size: auto 36px;
|
665 |
+
}
|
666 |
+
.jstree-default-dark-small.jstree-rtl .jstree-node {
|
667 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
668 |
+
background-position: 100% 1px;
|
669 |
+
background-repeat: repeat-y;
|
670 |
+
}
|
671 |
+
.jstree-default-dark-small.jstree-rtl .jstree-last {
|
672 |
+
background: transparent;
|
673 |
+
}
|
674 |
+
.jstree-default-dark-small.jstree-rtl .jstree-open > .jstree-ocl {
|
675 |
+
background-position: -135px -39px;
|
676 |
+
}
|
677 |
+
.jstree-default-dark-small.jstree-rtl .jstree-closed > .jstree-ocl {
|
678 |
+
background-position: -103px -39px;
|
679 |
+
}
|
680 |
+
.jstree-default-dark-small.jstree-rtl .jstree-leaf > .jstree-ocl {
|
681 |
+
background-position: -71px -39px;
|
682 |
+
}
|
683 |
+
.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-node,
|
684 |
+
.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
685 |
+
background: transparent;
|
686 |
+
}
|
687 |
+
.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
|
688 |
+
background-position: -39px -39px;
|
689 |
+
}
|
690 |
+
.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
691 |
+
background-position: -7px -39px;
|
692 |
+
}
|
693 |
+
.jstree-default-dark-small .jstree-themeicon-custom {
|
694 |
+
background-color: transparent;
|
695 |
+
background-image: none;
|
696 |
+
background-position: 0 0;
|
697 |
+
}
|
698 |
+
.jstree-default-dark-small > .jstree-container-ul .jstree-loading > .jstree-ocl {
|
699 |
+
background: url("throbber.gif") center center no-repeat;
|
700 |
+
}
|
701 |
+
.jstree-default-dark-small .jstree-file {
|
702 |
+
background: url("32px.png") -103px -71px no-repeat;
|
703 |
+
}
|
704 |
+
.jstree-default-dark-small .jstree-folder {
|
705 |
+
background: url("32px.png") -263px -7px no-repeat;
|
706 |
+
}
|
707 |
+
.jstree-default-dark-small > .jstree-container-ul > .jstree-node {
|
708 |
+
margin-left: 0;
|
709 |
+
margin-right: 0;
|
710 |
+
}
|
711 |
+
#jstree-dnd.jstree-default-dark-small {
|
712 |
+
line-height: 18px;
|
713 |
+
padding: 0 4px;
|
714 |
+
}
|
715 |
+
#jstree-dnd.jstree-default-dark-small .jstree-ok,
|
716 |
+
#jstree-dnd.jstree-default-dark-small .jstree-er {
|
717 |
+
background-image: url("32px.png");
|
718 |
+
background-repeat: no-repeat;
|
719 |
+
background-color: transparent;
|
720 |
+
}
|
721 |
+
#jstree-dnd.jstree-default-dark-small i {
|
722 |
+
background: transparent;
|
723 |
+
width: 18px;
|
724 |
+
height: 18px;
|
725 |
+
line-height: 18px;
|
726 |
+
}
|
727 |
+
#jstree-dnd.jstree-default-dark-small .jstree-ok {
|
728 |
+
background-position: -7px -71px;
|
729 |
+
}
|
730 |
+
#jstree-dnd.jstree-default-dark-small .jstree-er {
|
731 |
+
background-position: -39px -71px;
|
732 |
+
}
|
733 |
+
.jstree-default-dark-small .jstree-ellipsis {
|
734 |
+
overflow: hidden;
|
735 |
+
}
|
736 |
+
.jstree-default-dark-small .jstree-ellipsis .jstree-anchor {
|
737 |
+
width: calc(100% - 23px);
|
738 |
+
text-overflow: ellipsis;
|
739 |
+
overflow: hidden;
|
740 |
+
}
|
741 |
+
.jstree-default-dark-small.jstree-rtl .jstree-node {
|
742 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==");
|
743 |
+
}
|
744 |
+
.jstree-default-dark-small.jstree-rtl .jstree-last {
|
745 |
+
background: transparent;
|
746 |
+
}
|
747 |
+
.jstree-default-dark-large .jstree-node {
|
748 |
+
min-height: 32px;
|
749 |
+
line-height: 32px;
|
750 |
+
margin-left: 32px;
|
751 |
+
min-width: 32px;
|
752 |
+
}
|
753 |
+
.jstree-default-dark-large .jstree-anchor {
|
754 |
+
line-height: 32px;
|
755 |
+
height: 32px;
|
756 |
+
}
|
757 |
+
.jstree-default-dark-large .jstree-icon {
|
758 |
+
width: 32px;
|
759 |
+
height: 32px;
|
760 |
+
line-height: 32px;
|
761 |
+
}
|
762 |
+
.jstree-default-dark-large .jstree-icon:empty {
|
763 |
+
width: 32px;
|
764 |
+
height: 32px;
|
765 |
+
line-height: 32px;
|
766 |
+
}
|
767 |
+
.jstree-default-dark-large.jstree-rtl .jstree-node {
|
768 |
+
margin-right: 32px;
|
769 |
+
}
|
770 |
+
.jstree-default-dark-large .jstree-wholerow {
|
771 |
+
height: 32px;
|
772 |
+
}
|
773 |
+
.jstree-default-dark-large .jstree-node,
|
774 |
+
.jstree-default-dark-large .jstree-icon {
|
775 |
+
background-image: url("32px.png");
|
776 |
+
}
|
777 |
+
.jstree-default-dark-large .jstree-node {
|
778 |
+
background-position: -288px 0px;
|
779 |
+
background-repeat: repeat-y;
|
780 |
+
}
|
781 |
+
.jstree-default-dark-large .jstree-last {
|
782 |
+
background: transparent;
|
783 |
+
}
|
784 |
+
.jstree-default-dark-large .jstree-open > .jstree-ocl {
|
785 |
+
background-position: -128px 0px;
|
786 |
+
}
|
787 |
+
.jstree-default-dark-large .jstree-closed > .jstree-ocl {
|
788 |
+
background-position: -96px 0px;
|
789 |
+
}
|
790 |
+
.jstree-default-dark-large .jstree-leaf > .jstree-ocl {
|
791 |
+
background-position: -64px 0px;
|
792 |
+
}
|
793 |
+
.jstree-default-dark-large .jstree-themeicon {
|
794 |
+
background-position: -256px 0px;
|
795 |
+
}
|
796 |
+
.jstree-default-dark-large > .jstree-no-dots .jstree-node,
|
797 |
+
.jstree-default-dark-large > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
798 |
+
background: transparent;
|
799 |
+
}
|
800 |
+
.jstree-default-dark-large > .jstree-no-dots .jstree-open > .jstree-ocl {
|
801 |
+
background-position: -32px 0px;
|
802 |
+
}
|
803 |
+
.jstree-default-dark-large > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
804 |
+
background-position: 0px 0px;
|
805 |
+
}
|
806 |
+
.jstree-default-dark-large .jstree-disabled {
|
807 |
+
background: transparent;
|
808 |
+
}
|
809 |
+
.jstree-default-dark-large .jstree-disabled.jstree-hovered {
|
810 |
+
background: transparent;
|
811 |
+
}
|
812 |
+
.jstree-default-dark-large .jstree-disabled.jstree-clicked {
|
813 |
+
background: #efefef;
|
814 |
+
}
|
815 |
+
.jstree-default-dark-large .jstree-checkbox {
|
816 |
+
background-position: -160px 0px;
|
817 |
+
}
|
818 |
+
.jstree-default-dark-large .jstree-checkbox:hover {
|
819 |
+
background-position: -160px -32px;
|
820 |
+
}
|
821 |
+
.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,
|
822 |
+
.jstree-default-dark-large .jstree-checked > .jstree-checkbox {
|
823 |
+
background-position: -224px 0px;
|
824 |
+
}
|
825 |
+
.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,
|
826 |
+
.jstree-default-dark-large .jstree-checked > .jstree-checkbox:hover {
|
827 |
+
background-position: -224px -32px;
|
828 |
+
}
|
829 |
+
.jstree-default-dark-large .jstree-anchor > .jstree-undetermined {
|
830 |
+
background-position: -192px 0px;
|
831 |
+
}
|
832 |
+
.jstree-default-dark-large .jstree-anchor > .jstree-undetermined:hover {
|
833 |
+
background-position: -192px -32px;
|
834 |
+
}
|
835 |
+
.jstree-default-dark-large .jstree-checkbox-disabled {
|
836 |
+
opacity: 0.8;
|
837 |
+
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
|
838 |
+
/* Firefox 10+ */
|
839 |
+
filter: gray;
|
840 |
+
/* IE6-9 */
|
841 |
+
-webkit-filter: grayscale(100%);
|
842 |
+
/* Chrome 19+ & Safari 6+ */
|
843 |
+
}
|
844 |
+
.jstree-default-dark-large > .jstree-striped {
|
845 |
+
background-size: auto 64px;
|
846 |
+
}
|
847 |
+
.jstree-default-dark-large.jstree-rtl .jstree-node {
|
848 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
849 |
+
background-position: 100% 1px;
|
850 |
+
background-repeat: repeat-y;
|
851 |
+
}
|
852 |
+
.jstree-default-dark-large.jstree-rtl .jstree-last {
|
853 |
+
background: transparent;
|
854 |
+
}
|
855 |
+
.jstree-default-dark-large.jstree-rtl .jstree-open > .jstree-ocl {
|
856 |
+
background-position: -128px -32px;
|
857 |
+
}
|
858 |
+
.jstree-default-dark-large.jstree-rtl .jstree-closed > .jstree-ocl {
|
859 |
+
background-position: -96px -32px;
|
860 |
+
}
|
861 |
+
.jstree-default-dark-large.jstree-rtl .jstree-leaf > .jstree-ocl {
|
862 |
+
background-position: -64px -32px;
|
863 |
+
}
|
864 |
+
.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-node,
|
865 |
+
.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
866 |
+
background: transparent;
|
867 |
+
}
|
868 |
+
.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
|
869 |
+
background-position: -32px -32px;
|
870 |
+
}
|
871 |
+
.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
872 |
+
background-position: 0px -32px;
|
873 |
+
}
|
874 |
+
.jstree-default-dark-large .jstree-themeicon-custom {
|
875 |
+
background-color: transparent;
|
876 |
+
background-image: none;
|
877 |
+
background-position: 0 0;
|
878 |
+
}
|
879 |
+
.jstree-default-dark-large > .jstree-container-ul .jstree-loading > .jstree-ocl {
|
880 |
+
background: url("throbber.gif") center center no-repeat;
|
881 |
+
}
|
882 |
+
.jstree-default-dark-large .jstree-file {
|
883 |
+
background: url("32px.png") -96px -64px no-repeat;
|
884 |
+
}
|
885 |
+
.jstree-default-dark-large .jstree-folder {
|
886 |
+
background: url("32px.png") -256px 0px no-repeat;
|
887 |
+
}
|
888 |
+
.jstree-default-dark-large > .jstree-container-ul > .jstree-node {
|
889 |
+
margin-left: 0;
|
890 |
+
margin-right: 0;
|
891 |
+
}
|
892 |
+
#jstree-dnd.jstree-default-dark-large {
|
893 |
+
line-height: 32px;
|
894 |
+
padding: 0 4px;
|
895 |
+
}
|
896 |
+
#jstree-dnd.jstree-default-dark-large .jstree-ok,
|
897 |
+
#jstree-dnd.jstree-default-dark-large .jstree-er {
|
898 |
+
background-image: url("32px.png");
|
899 |
+
background-repeat: no-repeat;
|
900 |
+
background-color: transparent;
|
901 |
+
}
|
902 |
+
#jstree-dnd.jstree-default-dark-large i {
|
903 |
+
background: transparent;
|
904 |
+
width: 32px;
|
905 |
+
height: 32px;
|
906 |
+
line-height: 32px;
|
907 |
+
}
|
908 |
+
#jstree-dnd.jstree-default-dark-large .jstree-ok {
|
909 |
+
background-position: 0px -64px;
|
910 |
+
}
|
911 |
+
#jstree-dnd.jstree-default-dark-large .jstree-er {
|
912 |
+
background-position: -32px -64px;
|
913 |
+
}
|
914 |
+
.jstree-default-dark-large .jstree-ellipsis {
|
915 |
+
overflow: hidden;
|
916 |
+
}
|
917 |
+
.jstree-default-dark-large .jstree-ellipsis .jstree-anchor {
|
918 |
+
width: calc(100% - 37px);
|
919 |
+
text-overflow: ellipsis;
|
920 |
+
overflow: hidden;
|
921 |
+
}
|
922 |
+
.jstree-default-dark-large.jstree-rtl .jstree-node {
|
923 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==");
|
924 |
+
}
|
925 |
+
.jstree-default-dark-large.jstree-rtl .jstree-last {
|
926 |
+
background: transparent;
|
927 |
+
}
|
928 |
+
@media (max-width: 768px) {
|
929 |
+
#jstree-dnd.jstree-dnd-responsive {
|
930 |
+
line-height: 40px;
|
931 |
+
font-weight: bold;
|
932 |
+
font-size: 1.1em;
|
933 |
+
text-shadow: 1px 1px white;
|
934 |
+
}
|
935 |
+
#jstree-dnd.jstree-dnd-responsive > i {
|
936 |
+
background: transparent;
|
937 |
+
width: 40px;
|
938 |
+
height: 40px;
|
939 |
+
}
|
940 |
+
#jstree-dnd.jstree-dnd-responsive > .jstree-ok {
|
941 |
+
background-image: url("40px.png");
|
942 |
+
background-position: 0 -200px;
|
943 |
+
background-size: 120px 240px;
|
944 |
+
}
|
945 |
+
#jstree-dnd.jstree-dnd-responsive > .jstree-er {
|
946 |
+
background-image: url("40px.png");
|
947 |
+
background-position: -40px -200px;
|
948 |
+
background-size: 120px 240px;
|
949 |
+
}
|
950 |
+
#jstree-marker.jstree-dnd-responsive {
|
951 |
+
border-left-width: 10px;
|
952 |
+
border-top-width: 10px;
|
953 |
+
border-bottom-width: 10px;
|
954 |
+
margin-top: -10px;
|
955 |
+
}
|
956 |
+
}
|
957 |
+
@media (max-width: 768px) {
|
958 |
+
.jstree-default-dark-responsive {
|
959 |
+
/*
|
960 |
+
.jstree-open > .jstree-ocl,
|
961 |
+
.jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; }
|
962 |
+
*/
|
963 |
+
}
|
964 |
+
.jstree-default-dark-responsive .jstree-icon {
|
965 |
+
background-image: url("40px.png");
|
966 |
+
}
|
967 |
+
.jstree-default-dark-responsive .jstree-node,
|
968 |
+
.jstree-default-dark-responsive .jstree-leaf > .jstree-ocl {
|
969 |
+
background: transparent;
|
970 |
+
}
|
971 |
+
.jstree-default-dark-responsive .jstree-node {
|
972 |
+
min-height: 40px;
|
973 |
+
line-height: 40px;
|
974 |
+
margin-left: 40px;
|
975 |
+
min-width: 40px;
|
976 |
+
white-space: nowrap;
|
977 |
+
}
|
978 |
+
.jstree-default-dark-responsive .jstree-anchor {
|
979 |
+
line-height: 40px;
|
980 |
+
height: 40px;
|
981 |
+
}
|
982 |
+
.jstree-default-dark-responsive .jstree-icon,
|
983 |
+
.jstree-default-dark-responsive .jstree-icon:empty {
|
984 |
+
width: 40px;
|
985 |
+
height: 40px;
|
986 |
+
line-height: 40px;
|
987 |
+
}
|
988 |
+
.jstree-default-dark-responsive > .jstree-container-ul > .jstree-node {
|
989 |
+
margin-left: 0;
|
990 |
+
}
|
991 |
+
.jstree-default-dark-responsive.jstree-rtl .jstree-node {
|
992 |
+
margin-left: 0;
|
993 |
+
margin-right: 40px;
|
994 |
+
background: transparent;
|
995 |
+
}
|
996 |
+
.jstree-default-dark-responsive.jstree-rtl .jstree-container-ul > .jstree-node {
|
997 |
+
margin-right: 0;
|
998 |
+
}
|
999 |
+
.jstree-default-dark-responsive .jstree-ocl,
|
1000 |
+
.jstree-default-dark-responsive .jstree-themeicon,
|
1001 |
+
.jstree-default-dark-responsive .jstree-checkbox {
|
1002 |
+
background-size: 120px 240px;
|
1003 |
+
}
|
1004 |
+
.jstree-default-dark-responsive .jstree-leaf > .jstree-ocl,
|
1005 |
+
.jstree-default-dark-responsive.jstree-rtl .jstree-leaf > .jstree-ocl {
|
1006 |
+
background: transparent;
|
1007 |
+
}
|
1008 |
+
.jstree-default-dark-responsive .jstree-open > .jstree-ocl {
|
1009 |
+
background-position: 0 0 !important;
|
1010 |
+
}
|
1011 |
+
.jstree-default-dark-responsive .jstree-closed > .jstree-ocl {
|
1012 |
+
background-position: 0 -40px !important;
|
1013 |
+
}
|
1014 |
+
.jstree-default-dark-responsive.jstree-rtl .jstree-closed > .jstree-ocl {
|
1015 |
+
background-position: -40px 0 !important;
|
1016 |
+
}
|
1017 |
+
.jstree-default-dark-responsive .jstree-themeicon {
|
1018 |
+
background-position: -40px -40px;
|
1019 |
+
}
|
1020 |
+
.jstree-default-dark-responsive .jstree-checkbox,
|
1021 |
+
.jstree-default-dark-responsive .jstree-checkbox:hover {
|
1022 |
+
background-position: -40px -80px;
|
1023 |
+
}
|
1024 |
+
.jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,
|
1025 |
+
.jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,
|
1026 |
+
.jstree-default-dark-responsive .jstree-checked > .jstree-checkbox,
|
1027 |
+
.jstree-default-dark-responsive .jstree-checked > .jstree-checkbox:hover {
|
1028 |
+
background-position: 0 -80px;
|
1029 |
+
}
|
1030 |
+
.jstree-default-dark-responsive .jstree-anchor > .jstree-undetermined,
|
1031 |
+
.jstree-default-dark-responsive .jstree-anchor > .jstree-undetermined:hover {
|
1032 |
+
background-position: 0 -120px;
|
1033 |
+
}
|
1034 |
+
.jstree-default-dark-responsive .jstree-anchor {
|
1035 |
+
font-weight: bold;
|
1036 |
+
font-size: 1.1em;
|
1037 |
+
text-shadow: 1px 1px white;
|
1038 |
+
}
|
1039 |
+
.jstree-default-dark-responsive > .jstree-striped {
|
1040 |
+
background: transparent;
|
1041 |
+
}
|
1042 |
+
.jstree-default-dark-responsive .jstree-wholerow {
|
1043 |
+
border-top: 1px solid #666;
|
1044 |
+
border-bottom: 1px solid #000;
|
1045 |
+
background: #333333;
|
1046 |
+
height: 40px;
|
1047 |
+
}
|
1048 |
+
.jstree-default-dark-responsive .jstree-wholerow-hovered {
|
1049 |
+
background: #555;
|
1050 |
+
}
|
1051 |
+
.jstree-default-dark-responsive .jstree-wholerow-clicked {
|
1052 |
+
background: #5fa2db;
|
1053 |
+
}
|
1054 |
+
.jstree-default-dark-responsive .jstree-children .jstree-last > .jstree-wholerow {
|
1055 |
+
box-shadow: inset 0 -6px 3px -5px #111111;
|
1056 |
+
}
|
1057 |
+
.jstree-default-dark-responsive .jstree-children .jstree-open > .jstree-wholerow {
|
1058 |
+
box-shadow: inset 0 6px 3px -5px #111111;
|
1059 |
+
border-top: 0;
|
1060 |
+
}
|
1061 |
+
.jstree-default-dark-responsive .jstree-children .jstree-open + .jstree-open {
|
1062 |
+
box-shadow: none;
|
1063 |
+
}
|
1064 |
+
.jstree-default-dark-responsive .jstree-node,
|
1065 |
+
.jstree-default-dark-responsive .jstree-icon,
|
1066 |
+
.jstree-default-dark-responsive .jstree-node > .jstree-ocl,
|
1067 |
+
.jstree-default-dark-responsive .jstree-themeicon,
|
1068 |
+
.jstree-default-dark-responsive .jstree-checkbox {
|
1069 |
+
background-image: url("40px.png");
|
1070 |
+
background-size: 120px 240px;
|
1071 |
+
}
|
1072 |
+
.jstree-default-dark-responsive .jstree-node {
|
1073 |
+
background-position: -80px 0;
|
1074 |
+
background-repeat: repeat-y;
|
1075 |
+
}
|
1076 |
+
.jstree-default-dark-responsive .jstree-last {
|
1077 |
+
background: transparent;
|
1078 |
+
}
|
1079 |
+
.jstree-default-dark-responsive .jstree-leaf > .jstree-ocl {
|
1080 |
+
background-position: -40px -120px;
|
1081 |
+
}
|
1082 |
+
.jstree-default-dark-responsive .jstree-last > .jstree-ocl {
|
1083 |
+
background-position: -40px -160px;
|
1084 |
+
}
|
1085 |
+
.jstree-default-dark-responsive .jstree-themeicon-custom {
|
1086 |
+
background-color: transparent;
|
1087 |
+
background-image: none;
|
1088 |
+
background-position: 0 0;
|
1089 |
+
}
|
1090 |
+
.jstree-default-dark-responsive .jstree-file {
|
1091 |
+
background: url("40px.png") 0 -160px no-repeat;
|
1092 |
+
background-size: 120px 240px;
|
1093 |
+
}
|
1094 |
+
.jstree-default-dark-responsive .jstree-folder {
|
1095 |
+
background: url("40px.png") -40px -40px no-repeat;
|
1096 |
+
background-size: 120px 240px;
|
1097 |
+
}
|
1098 |
+
.jstree-default-dark-responsive > .jstree-container-ul > .jstree-node {
|
1099 |
+
margin-left: 0;
|
1100 |
+
margin-right: 0;
|
1101 |
+
}
|
1102 |
+
}
|
1103 |
+
.jstree-default-dark {
|
1104 |
+
background: #333;
|
1105 |
+
}
|
1106 |
+
.jstree-default-dark .jstree-anchor {
|
1107 |
+
color: #999;
|
1108 |
+
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
|
1109 |
+
}
|
1110 |
+
.jstree-default-dark .jstree-clicked,
|
1111 |
+
.jstree-default-dark .jstree-checked {
|
1112 |
+
color: white;
|
1113 |
+
}
|
1114 |
+
.jstree-default-dark .jstree-hovered {
|
1115 |
+
color: white;
|
1116 |
+
}
|
1117 |
+
#jstree-marker.jstree-default-dark {
|
1118 |
+
border-left-color: #999;
|
1119 |
+
background: transparent;
|
1120 |
+
}
|
1121 |
+
.jstree-default-dark .jstree-anchor > .jstree-icon {
|
1122 |
+
opacity: 0.75;
|
1123 |
+
}
|
1124 |
+
.jstree-default-dark .jstree-clicked > .jstree-icon,
|
1125 |
+
.jstree-default-dark .jstree-hovered > .jstree-icon,
|
1126 |
+
.jstree-default-dark .jstree-checked > .jstree-icon {
|
1127 |
+
opacity: 1;
|
1128 |
+
}
|
1129 |
+
.jstree-default-dark.jstree-rtl .jstree-node {
|
1130 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
1131 |
+
}
|
1132 |
+
.jstree-default-dark.jstree-rtl .jstree-last {
|
1133 |
+
background: transparent;
|
1134 |
+
}
|
1135 |
+
.jstree-default-dark-small.jstree-rtl .jstree-node {
|
1136 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==");
|
1137 |
+
}
|
1138 |
+
.jstree-default-dark-small.jstree-rtl .jstree-last {
|
1139 |
+
background: transparent;
|
1140 |
+
}
|
1141 |
+
.jstree-default-dark-large.jstree-rtl .jstree-node {
|
1142 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==");
|
1143 |
+
}
|
1144 |
+
.jstree-default-dark-large.jstree-rtl .jstree-last {
|
1145 |
+
background: transparent;
|
1146 |
+
}
|
trunk/admin/js/jstree/dist/themes/default-dark/style.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:black;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-icon:empty{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-ocl{cursor:pointer}.jstree-leaf>.jstree-ocl{cursor:default}.jstree .jstree-open>.jstree-children{display:block}.jstree .jstree-closed>.jstree-children,.jstree .jstree-leaf>.jstree-children{display:none}.jstree-anchor>.jstree-themeicon{margin-right:2px}.jstree-no-icons .jstree-themeicon,.jstree-anchor>.jstree-themeicon-hidden{display:none}.jstree-hidden,.jstree-node.jstree-hidden{display:none}.jstree-rtl .jstree-anchor{padding:0 1px 0 4px}.jstree-rtl .jstree-anchor>.jstree-themeicon{margin-left:2px;margin-right:0}.jstree-rtl .jstree-node{margin-left:0}.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-wholerow-ul{position:relative;display:inline-block;min-width:100%}.jstree-wholerow-ul .jstree-leaf>.jstree-ocl{cursor:pointer}.jstree-wholerow-ul .jstree-anchor,.jstree-wholerow-ul .jstree-icon{position:relative}.jstree-wholerow-ul .jstree-wholerow{width:100%;cursor:pointer;position:absolute;left:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.jstree-contextmenu .jstree-anchor{-webkit-user-select:none;-webkit-touch-callout:none}.vakata-context{display:none}.vakata-context,.vakata-context ul{margin:0;padding:2px;position:absolute;background:#f5f5f5;border:1px solid #979797;box-shadow:2px 2px 2px #999999}.vakata-context ul{list-style:none;left:100%;margin-top:-2.7em;margin-left:-4px}.vakata-context .vakata-context-right ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context li{list-style:none}.vakata-context li>a{display:block;padding:0 2em 0 2em;text-decoration:none;width:auto;color:black;white-space:nowrap;line-height:2.4em;text-shadow:1px 1px 0 white;border-radius:1px}.vakata-context li>a:hover{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==");background-position:right center;background-repeat:no-repeat}.vakata-context li>a:focus{outline:0}.vakata-context .vakata-context-hover>a{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context .vakata-context-separator>a,.vakata-context .vakata-context-separator>a:hover{background:white;border:0;border-top:1px solid #e2e3e3;height:1px;min-height:1px;max-height:1px;padding:0;margin:0 0 0 2.4em;border-left:1px solid #e0e0e0;text-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;border-radius:0}.vakata-context .vakata-contextmenu-disabled a,.vakata-context .vakata-contextmenu-disabled a:hover{color:silver;background-color:transparent;border:0;box-shadow:0 0 0}.vakata-context .vakata-contextmenu-disabled>a>i{filter:grayscale(100%)}.vakata-context li>a>i{text-decoration:none;display:inline-block;width:2.4em;height:2.4em;background:transparent;margin:0 0 0 -2em;vertical-align:top;text-align:center;line-height:2.4em}.vakata-context li>a>i:empty{width:2.4em;line-height:2.4em}.vakata-context li>a .vakata-contextmenu-sep{display:inline-block;width:1px;height:2.4em;background:white;margin:0 .5em 0 0;border-left:1px solid #e2e3e3}.vakata-context .vakata-contextmenu-shortcut{font-size:.8em;color:silver;opacity:.5;display:none}.vakata-context-rtl ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context-rtl li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");background-position:left center;background-repeat:no-repeat}.vakata-context-rtl .vakata-context-separator>a{margin:0 2.4em 0 0;border-left:0;border-right:1px solid #e2e3e3}.vakata-context-rtl .vakata-context-left ul{right:auto;left:100%;margin-left:-4px;margin-right:auto}.vakata-context-rtl li>a>i{margin:0 -2em 0 0}.vakata-context-rtl li>a .vakata-contextmenu-sep{margin:0 0 0 .5em;border-left-color:white;background:#e2e3e3}#jstree-marker{position:absolute;top:0;left:0;margin:-5px 0 0 0;padding:0;border-right:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid;width:0;height:0;font-size:0;line-height:0}#jstree-dnd{line-height:16px;margin:0;padding:4px}#jstree-dnd .jstree-icon,#jstree-dnd .jstree-copy{display:inline-block;text-decoration:none;margin:0 2px 0 0;padding:0;width:16px;height:16px}#jstree-dnd .jstree-ok{background:green}#jstree-dnd .jstree-er{background:red}#jstree-dnd .jstree-copy{margin:0 2px 0 2px}.jstree-default-dark .jstree-node,.jstree-default-dark .jstree-icon{background-repeat:no-repeat;background-color:transparent}.jstree-default-dark .jstree-anchor,.jstree-default-dark .jstree-animated,.jstree-default-dark .jstree-wholerow{transition:background-color .15s,box-shadow .15s}.jstree-default-dark .jstree-hovered{background:#555;border-radius:2px;box-shadow:inset 0 0 1px #555}.jstree-default-dark .jstree-context{background:#555;border-radius:2px;box-shadow:inset 0 0 1px #555}.jstree-default-dark .jstree-clicked{background:#5fa2db;border-radius:2px;box-shadow:inset 0 0 1px #666666}.jstree-default-dark .jstree-no-icons .jstree-anchor>.jstree-themeicon{display:none}.jstree-default-dark .jstree-disabled{background:transparent;color:#666666}.jstree-default-dark .jstree-disabled.jstree-hovered{background:transparent;box-shadow:none}.jstree-default-dark .jstree-disabled.jstree-clicked{background:#333333}.jstree-default-dark .jstree-disabled>.jstree-icon{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark .jstree-search{font-style:italic;color:#ffffff;font-weight:bold}.jstree-default-dark .jstree-no-checkboxes .jstree-checkbox{display:none !important}.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked{background:transparent;box-shadow:none}.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered{background:#555}.jstree-default-dark.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked{background:transparent}.jstree-default-dark.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered{background:#555}.jstree-default-dark>.jstree-striped{min-width:100%;display:inline-block;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat}.jstree-default-dark>.jstree-wholerow-ul .jstree-hovered,.jstree-default-dark>.jstree-wholerow-ul .jstree-clicked{background:transparent;box-shadow:none;border-radius:0}.jstree-default-dark .jstree-wholerow{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.jstree-default-dark .jstree-wholerow-hovered{background:#555}.jstree-default-dark .jstree-wholerow-clicked{background:#5fa2db;background:-webkit-linear-gradient(top, #5fa2db 0, #5fa2db 100%);background:linear-gradient(to bottom, #5fa2db 0, #5fa2db 100%)}.jstree-default-dark .jstree-node{min-height:24px;line-height:24px;margin-left:24px;min-width:24px}.jstree-default-dark .jstree-anchor{line-height:24px;height:24px}.jstree-default-dark .jstree-icon{width:24px;height:24px;line-height:24px}.jstree-default-dark .jstree-icon:empty{width:24px;height:24px;line-height:24px}.jstree-default-dark.jstree-rtl .jstree-node{margin-right:24px}.jstree-default-dark .jstree-wholerow{height:24px}.jstree-default-dark .jstree-node,.jstree-default-dark .jstree-icon{background-image:url("32px.png")}.jstree-default-dark .jstree-node{background-position:-292px -4px;background-repeat:repeat-y}.jstree-default-dark .jstree-last{background:transparent}.jstree-default-dark .jstree-open>.jstree-ocl{background-position:-132px -4px}.jstree-default-dark .jstree-closed>.jstree-ocl{background-position:-100px -4px}.jstree-default-dark .jstree-leaf>.jstree-ocl{background-position:-68px -4px}.jstree-default-dark .jstree-themeicon{background-position:-260px -4px}.jstree-default-dark>.jstree-no-dots .jstree-node,.jstree-default-dark>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -4px}.jstree-default-dark>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -4px}.jstree-default-dark .jstree-disabled{background:transparent}.jstree-default-dark .jstree-disabled.jstree-hovered{background:transparent}.jstree-default-dark .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-dark .jstree-checkbox{background-position:-164px -4px}.jstree-default-dark .jstree-checkbox:hover{background-position:-164px -36px}.jstree-default-dark.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark .jstree-checked>.jstree-checkbox{background-position:-228px -4px}.jstree-default-dark.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark .jstree-checked>.jstree-checkbox:hover{background-position:-228px -36px}.jstree-default-dark .jstree-anchor>.jstree-undetermined{background-position:-196px -4px}.jstree-default-dark .jstree-anchor>.jstree-undetermined:hover{background-position:-196px -36px}.jstree-default-dark .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark>.jstree-striped{background-size:auto 48px}.jstree-default-dark.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default-dark.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark.jstree-rtl .jstree-open>.jstree-ocl{background-position:-132px -36px}.jstree-default-dark.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-100px -36px}.jstree-default-dark.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-68px -36px}.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -36px}.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -36px}.jstree-default-dark .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default-dark .jstree-file{background:url("32px.png") -100px -68px no-repeat}.jstree-default-dark .jstree-folder{background:url("32px.png") -260px -4px no-repeat}.jstree-default-dark>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-dark{line-height:24px;padding:0 4px}#jstree-dnd.jstree-default-dark .jstree-ok,#jstree-dnd.jstree-default-dark .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-dark i{background:transparent;width:24px;height:24px;line-height:24px}#jstree-dnd.jstree-default-dark .jstree-ok{background-position:-4px -68px}#jstree-dnd.jstree-default-dark .jstree-er{background-position:-36px -68px}.jstree-default-dark .jstree-ellipsis{overflow:hidden}.jstree-default-dark .jstree-ellipsis .jstree-anchor{width:calc(100% - 29px);text-overflow:ellipsis;overflow:hidden}.jstree-default-dark.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==")}.jstree-default-dark.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-small .jstree-node{min-height:18px;line-height:18px;margin-left:18px;min-width:18px}.jstree-default-dark-small .jstree-anchor{line-height:18px;height:18px}.jstree-default-dark-small .jstree-icon{width:18px;height:18px;line-height:18px}.jstree-default-dark-small .jstree-icon:empty{width:18px;height:18px;line-height:18px}.jstree-default-dark-small.jstree-rtl .jstree-node{margin-right:18px}.jstree-default-dark-small .jstree-wholerow{height:18px}.jstree-default-dark-small .jstree-node,.jstree-default-dark-small .jstree-icon{background-image:url("32px.png")}.jstree-default-dark-small .jstree-node{background-position:-295px -7px;background-repeat:repeat-y}.jstree-default-dark-small .jstree-last{background:transparent}.jstree-default-dark-small .jstree-open>.jstree-ocl{background-position:-135px -7px}.jstree-default-dark-small .jstree-closed>.jstree-ocl{background-position:-103px -7px}.jstree-default-dark-small .jstree-leaf>.jstree-ocl{background-position:-71px -7px}.jstree-default-dark-small .jstree-themeicon{background-position:-263px -7px}.jstree-default-dark-small>.jstree-no-dots .jstree-node,.jstree-default-dark-small>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-small>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -7px}.jstree-default-dark-small>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -7px}.jstree-default-dark-small .jstree-disabled{background:transparent}.jstree-default-dark-small .jstree-disabled.jstree-hovered{background:transparent}.jstree-default-dark-small .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-dark-small .jstree-checkbox{background-position:-167px -7px}.jstree-default-dark-small .jstree-checkbox:hover{background-position:-167px -39px}.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-small .jstree-checked>.jstree-checkbox{background-position:-231px -7px}.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-small .jstree-checked>.jstree-checkbox:hover{background-position:-231px -39px}.jstree-default-dark-small .jstree-anchor>.jstree-undetermined{background-position:-199px -7px}.jstree-default-dark-small .jstree-anchor>.jstree-undetermined:hover{background-position:-199px -39px}.jstree-default-dark-small .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark-small>.jstree-striped{background-size:auto 36px}.jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default-dark-small.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-small.jstree-rtl .jstree-open>.jstree-ocl{background-position:-135px -39px}.jstree-default-dark-small.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-103px -39px}.jstree-default-dark-small.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-71px -39px}.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -39px}.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -39px}.jstree-default-dark-small .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark-small>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default-dark-small .jstree-file{background:url("32px.png") -103px -71px no-repeat}.jstree-default-dark-small .jstree-folder{background:url("32px.png") -263px -7px no-repeat}.jstree-default-dark-small>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-dark-small{line-height:18px;padding:0 4px}#jstree-dnd.jstree-default-dark-small .jstree-ok,#jstree-dnd.jstree-default-dark-small .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-dark-small i{background:transparent;width:18px;height:18px;line-height:18px}#jstree-dnd.jstree-default-dark-small .jstree-ok{background-position:-7px -71px}#jstree-dnd.jstree-default-dark-small .jstree-er{background-position:-39px -71px}.jstree-default-dark-small .jstree-ellipsis{overflow:hidden}.jstree-default-dark-small .jstree-ellipsis .jstree-anchor{width:calc(100% - 23px);text-overflow:ellipsis;overflow:hidden}.jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==")}.jstree-default-dark-small.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-large .jstree-node{min-height:32px;line-height:32px;margin-left:32px;min-width:32px}.jstree-default-dark-large .jstree-anchor{line-height:32px;height:32px}.jstree-default-dark-large .jstree-icon{width:32px;height:32px;line-height:32px}.jstree-default-dark-large .jstree-icon:empty{width:32px;height:32px;line-height:32px}.jstree-default-dark-large.jstree-rtl .jstree-node{margin-right:32px}.jstree-default-dark-large .jstree-wholerow{height:32px}.jstree-default-dark-large .jstree-node,.jstree-default-dark-large .jstree-icon{background-image:url("32px.png")}.jstree-default-dark-large .jstree-node{background-position:-288px 0;background-repeat:repeat-y}.jstree-default-dark-large .jstree-last{background:transparent}.jstree-default-dark-large .jstree-open>.jstree-ocl{background-position:-128px 0}.jstree-default-dark-large .jstree-closed>.jstree-ocl{background-position:-96px 0}.jstree-default-dark-large .jstree-leaf>.jstree-ocl{background-position:-64px 0}.jstree-default-dark-large .jstree-themeicon{background-position:-256px 0}.jstree-default-dark-large>.jstree-no-dots .jstree-node,.jstree-default-dark-large>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-large>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px 0}.jstree-default-dark-large>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 0}.jstree-default-dark-large .jstree-disabled{background:transparent}.jstree-default-dark-large .jstree-disabled.jstree-hovered{background:transparent}.jstree-default-dark-large .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-dark-large .jstree-checkbox{background-position:-160px 0}.jstree-default-dark-large .jstree-checkbox:hover{background-position:-160px -32px}.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-large .jstree-checked>.jstree-checkbox{background-position:-224px 0}.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-large .jstree-checked>.jstree-checkbox:hover{background-position:-224px -32px}.jstree-default-dark-large .jstree-anchor>.jstree-undetermined{background-position:-192px 0}.jstree-default-dark-large .jstree-anchor>.jstree-undetermined:hover{background-position:-192px -32px}.jstree-default-dark-large .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark-large>.jstree-striped{background-size:auto 64px}.jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default-dark-large.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-large.jstree-rtl .jstree-open>.jstree-ocl{background-position:-128px -32px}.jstree-default-dark-large.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-96px -32px}.jstree-default-dark-large.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-64px -32px}.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px -32px}.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 -32px}.jstree-default-dark-large .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark-large>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default-dark-large .jstree-file{background:url("32px.png") -96px -64px no-repeat}.jstree-default-dark-large .jstree-folder{background:url("32px.png") -256px 0 no-repeat}.jstree-default-dark-large>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-dark-large{line-height:32px;padding:0 4px}#jstree-dnd.jstree-default-dark-large .jstree-ok,#jstree-dnd.jstree-default-dark-large .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-dark-large i{background:transparent;width:32px;height:32px;line-height:32px}#jstree-dnd.jstree-default-dark-large .jstree-ok{background-position:0 -64px}#jstree-dnd.jstree-default-dark-large .jstree-er{background-position:-32px -64px}.jstree-default-dark-large .jstree-ellipsis{overflow:hidden}.jstree-default-dark-large .jstree-ellipsis .jstree-anchor{width:calc(100% - 37px);text-overflow:ellipsis;overflow:hidden}.jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==")}.jstree-default-dark-large.jstree-rtl .jstree-last{background:transparent}@media (max-width:768px){#jstree-dnd.jstree-dnd-responsive{line-height:40px;font-weight:bold;font-size:1.1em;text-shadow:1px 1px white}#jstree-dnd.jstree-dnd-responsive>i{background:transparent;width:40px;height:40px}#jstree-dnd.jstree-dnd-responsive>.jstree-ok{background-image:url("40px.png");background-position:0 -200px;background-size:120px 240px}#jstree-dnd.jstree-dnd-responsive>.jstree-er{background-image:url("40px.png");background-position:-40px -200px;background-size:120px 240px}#jstree-marker.jstree-dnd-responsive{border-left-width:10px;border-top-width:10px;border-bottom-width:10px;margin-top:-10px}}@media (max-width:768px){.jstree-default-dark-responsive .jstree-icon{background-image:url("40px.png")}.jstree-default-dark-responsive .jstree-node,.jstree-default-dark-responsive .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-responsive .jstree-node{min-height:40px;line-height:40px;margin-left:40px;min-width:40px;white-space:nowrap}.jstree-default-dark-responsive .jstree-anchor{line-height:40px;height:40px}.jstree-default-dark-responsive .jstree-icon,.jstree-default-dark-responsive .jstree-icon:empty{width:40px;height:40px;line-height:40px}.jstree-default-dark-responsive>.jstree-container-ul>.jstree-node{margin-left:0}.jstree-default-dark-responsive.jstree-rtl .jstree-node{margin-left:0;margin-right:40px;background:transparent}.jstree-default-dark-responsive.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-default-dark-responsive .jstree-ocl,.jstree-default-dark-responsive .jstree-themeicon,.jstree-default-dark-responsive .jstree-checkbox{background-size:120px 240px}.jstree-default-dark-responsive .jstree-leaf>.jstree-ocl,.jstree-default-dark-responsive.jstree-rtl .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-responsive .jstree-open>.jstree-ocl{background-position:0 0 !important}.jstree-default-dark-responsive .jstree-closed>.jstree-ocl{background-position:0 -40px !important}.jstree-default-dark-responsive.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-40px 0 !important}.jstree-default-dark-responsive .jstree-themeicon{background-position:-40px -40px}.jstree-default-dark-responsive .jstree-checkbox,.jstree-default-dark-responsive .jstree-checkbox:hover{background-position:-40px -80px}.jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-responsive .jstree-checked>.jstree-checkbox,.jstree-default-dark-responsive .jstree-checked>.jstree-checkbox:hover{background-position:0 -80px}.jstree-default-dark-responsive .jstree-anchor>.jstree-undetermined,.jstree-default-dark-responsive .jstree-anchor>.jstree-undetermined:hover{background-position:0 -120px}.jstree-default-dark-responsive .jstree-anchor{font-weight:bold;font-size:1.1em;text-shadow:1px 1px white}.jstree-default-dark-responsive>.jstree-striped{background:transparent}.jstree-default-dark-responsive .jstree-wholerow{border-top:1px solid #666;border-bottom:1px solid #000;background:#333333;height:40px}.jstree-default-dark-responsive .jstree-wholerow-hovered{background:#555}.jstree-default-dark-responsive .jstree-wholerow-clicked{background:#5fa2db}.jstree-default-dark-responsive .jstree-children .jstree-last>.jstree-wholerow{box-shadow:inset 0 -6px 3px -5px #111111}.jstree-default-dark-responsive .jstree-children .jstree-open>.jstree-wholerow{box-shadow:inset 0 6px 3px -5px #111111;border-top:0}.jstree-default-dark-responsive .jstree-children .jstree-open+.jstree-open{box-shadow:none}.jstree-default-dark-responsive .jstree-node,.jstree-default-dark-responsive .jstree-icon,.jstree-default-dark-responsive .jstree-node>.jstree-ocl,.jstree-default-dark-responsive .jstree-themeicon,.jstree-default-dark-responsive .jstree-checkbox{background-image:url("40px.png");background-size:120px 240px}.jstree-default-dark-responsive .jstree-node{background-position:-80px 0;background-repeat:repeat-y}.jstree-default-dark-responsive .jstree-last{background:transparent}.jstree-default-dark-responsive .jstree-leaf>.jstree-ocl{background-position:-40px -120px}.jstree-default-dark-responsive .jstree-last>.jstree-ocl{background-position:-40px -160px}.jstree-default-dark-responsive .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark-responsive .jstree-file{background:url("40px.png") 0 -160px no-repeat;background-size:120px 240px}.jstree-default-dark-responsive .jstree-folder{background:url("40px.png") -40px -40px no-repeat;background-size:120px 240px}.jstree-default-dark-responsive>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}}.jstree-default-dark{background:#333}.jstree-default-dark .jstree-anchor{color:#999;text-shadow:1px 1px 0 rgba(0,0,0,0.5)}.jstree-default-dark .jstree-clicked,.jstree-default-dark .jstree-checked{color:white}.jstree-default-dark .jstree-hovered{color:white}#jstree-marker.jstree-default-dark{border-left-color:#999;background:transparent}.jstree-default-dark .jstree-anchor>.jstree-icon{opacity:.75}.jstree-default-dark .jstree-clicked>.jstree-icon,.jstree-default-dark .jstree-hovered>.jstree-icon,.jstree-default-dark .jstree-checked>.jstree-icon{opacity:1}.jstree-default-dark.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==")}.jstree-default-dark.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==")}.jstree-default-dark-small.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==")}.jstree-default-dark-large.jstree-rtl .jstree-last{background:transparent}
|
trunk/admin/js/jstree/dist/themes/default-dark/throbber.gif
ADDED
Binary file
|
trunk/admin/js/jstree/dist/themes/default/32px.png
ADDED
Binary file
|
trunk/admin/js/jstree/dist/themes/default/40px.png
ADDED
Binary file
|
trunk/admin/js/jstree/dist/themes/default/style.css
ADDED
@@ -0,0 +1,1102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 0;
|
7 |
+
padding: 0;
|
8 |
+
list-style-type: none;
|
9 |
+
list-style-image: none;
|
10 |
+
}
|
11 |
+
.jstree-node {
|
12 |
+
white-space: nowrap;
|
13 |
+
}
|
14 |
+
.jstree-anchor {
|
15 |
+
display: inline-block;
|
16 |
+
color: black;
|
17 |
+
white-space: nowrap;
|
18 |
+
padding: 0 4px 0 1px;
|
19 |
+
margin: 0;
|
20 |
+
vertical-align: top;
|
21 |
+
}
|
22 |
+
.jstree-anchor:focus {
|
23 |
+
outline: 0;
|
24 |
+
}
|
25 |
+
.jstree-anchor,
|
26 |
+
.jstree-anchor:link,
|
27 |
+
.jstree-anchor:visited,
|
28 |
+
.jstree-anchor:hover,
|
29 |
+
.jstree-anchor:active {
|
30 |
+
text-decoration: none;
|
31 |
+
color: inherit;
|
32 |
+
}
|
33 |
+
.jstree-icon {
|
34 |
+
display: inline-block;
|
35 |
+
text-decoration: none;
|
36 |
+
margin: 0;
|
37 |
+
padding: 0;
|
38 |
+
vertical-align: top;
|
39 |
+
text-align: center;
|
40 |
+
}
|
41 |
+
.jstree-icon:empty {
|
42 |
+
display: inline-block;
|
43 |
+
text-decoration: none;
|
44 |
+
margin: 0;
|
45 |
+
padding: 0;
|
46 |
+
vertical-align: top;
|
47 |
+
text-align: center;
|
48 |
+
}
|
49 |
+
.jstree-ocl {
|
50 |
+
cursor: pointer;
|
51 |
+
}
|
52 |
+
.jstree-leaf > .jstree-ocl {
|
53 |
+
cursor: default;
|
54 |
+
}
|
55 |
+
.jstree .jstree-open > .jstree-children {
|
56 |
+
display: block;
|
57 |
+
}
|
58 |
+
.jstree .jstree-closed > .jstree-children,
|
59 |
+
.jstree .jstree-leaf > .jstree-children {
|
60 |
+
display: none;
|
61 |
+
}
|
62 |
+
.jstree-anchor > .jstree-themeicon {
|
63 |
+
margin-right: 2px;
|
64 |
+
}
|
65 |
+
.jstree-no-icons .jstree-themeicon,
|
66 |
+
.jstree-anchor > .jstree-themeicon-hidden {
|
67 |
+
display: none;
|
68 |
+
}
|
69 |
+
.jstree-hidden,
|
70 |
+
.jstree-node.jstree-hidden {
|
71 |
+
display: none;
|
72 |
+
}
|
73 |
+
.jstree-rtl .jstree-anchor {
|
74 |
+
padding: 0 1px 0 4px;
|
75 |
+
}
|
76 |
+
.jstree-rtl .jstree-anchor > .jstree-themeicon {
|
77 |
+
margin-left: 2px;
|
78 |
+
margin-right: 0;
|
79 |
+
}
|
80 |
+
.jstree-rtl .jstree-node {
|
81 |
+
margin-left: 0;
|
82 |
+
}
|
83 |
+
.jstree-rtl .jstree-container-ul > .jstree-node {
|
84 |
+
margin-right: 0;
|
85 |
+
}
|
86 |
+
.jstree-wholerow-ul {
|
87 |
+
position: relative;
|
88 |
+
display: inline-block;
|
89 |
+
min-width: 100%;
|
90 |
+
}
|
91 |
+
.jstree-wholerow-ul .jstree-leaf > .jstree-ocl {
|
92 |
+
cursor: pointer;
|
93 |
+
}
|
94 |
+
.jstree-wholerow-ul .jstree-anchor,
|
95 |
+
.jstree-wholerow-ul .jstree-icon {
|
96 |
+
position: relative;
|
97 |
+
}
|
98 |
+
.jstree-wholerow-ul .jstree-wholerow {
|
99 |
+
width: 100%;
|
100 |
+
cursor: pointer;
|
101 |
+
position: absolute;
|
102 |
+
left: 0;
|
103 |
+
-webkit-user-select: none;
|
104 |
+
-moz-user-select: none;
|
105 |
+
-ms-user-select: none;
|
106 |
+
user-select: none;
|
107 |
+
}
|
108 |
+
.jstree-contextmenu .jstree-anchor {
|
109 |
+
-webkit-user-select: none;
|
110 |
+
/* disable selection/Copy of UIWebView */
|
111 |
+
-webkit-touch-callout: none;
|
112 |
+
/* disable the IOS popup when long-press on a link */
|
113 |
+
}
|
114 |
+
.vakata-context {
|
115 |
+
display: none;
|
116 |
+
}
|
117 |
+
.vakata-context,
|
118 |
+
.vakata-context ul {
|
119 |
+
margin: 0;
|
120 |
+
padding: 2px;
|
121 |
+
position: absolute;
|
122 |
+
background: #f5f5f5;
|
123 |
+
border: 1px solid #979797;
|
124 |
+
box-shadow: 2px 2px 2px #999999;
|
125 |
+
}
|
126 |
+
.vakata-context ul {
|
127 |
+
list-style: none;
|
128 |
+
left: 100%;
|
129 |
+
margin-top: -2.7em;
|
130 |
+
margin-left: -4px;
|
131 |
+
}
|
132 |
+
.vakata-context .vakata-context-right ul {
|
133 |
+
left: auto;
|
134 |
+
right: 100%;
|
135 |
+
margin-left: auto;
|
136 |
+
margin-right: -4px;
|
137 |
+
}
|
138 |
+
.vakata-context li {
|
139 |
+
list-style: none;
|
140 |
+
}
|
141 |
+
.vakata-context li > a {
|
142 |
+
display: block;
|
143 |
+
padding: 0 2em 0 2em;
|
144 |
+
text-decoration: none;
|
145 |
+
width: auto;
|
146 |
+
color: black;
|
147 |
+
white-space: nowrap;
|
148 |
+
line-height: 2.4em;
|
149 |
+
text-shadow: 1px 1px 0 white;
|
150 |
+
border-radius: 1px;
|
151 |
+
}
|
152 |
+
.vakata-context li > a:hover {
|
153 |
+
position: relative;
|
154 |
+
background-color: #e8eff7;
|
155 |
+
box-shadow: 0 0 2px #0a6aa1;
|
156 |
+
}
|
157 |
+
.vakata-context li > a.vakata-context-parent {
|
158 |
+
background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==");
|
159 |
+
background-position: right center;
|
160 |
+
background-repeat: no-repeat;
|
161 |
+
}
|
162 |
+
.vakata-context li > a:focus {
|
163 |
+
outline: 0;
|
164 |
+
}
|
165 |
+
.vakata-context .vakata-context-hover > a {
|
166 |
+
position: relative;
|
167 |
+
background-color: #e8eff7;
|
168 |
+
box-shadow: 0 0 2px #0a6aa1;
|
169 |
+
}
|
170 |
+
.vakata-context .vakata-context-separator > a,
|
171 |
+
.vakata-context .vakata-context-separator > a:hover {
|
172 |
+
background: white;
|
173 |
+
border: 0;
|
174 |
+
border-top: 1px solid #e2e3e3;
|
175 |
+
height: 1px;
|
176 |
+
min-height: 1px;
|
177 |
+
max-height: 1px;
|
178 |
+
padding: 0;
|
179 |
+
margin: 0 0 0 2.4em;
|
180 |
+
border-left: 1px solid #e0e0e0;
|
181 |
+
text-shadow: 0 0 0 transparent;
|
182 |
+
box-shadow: 0 0 0 transparent;
|
183 |
+
border-radius: 0;
|
184 |
+
}
|
185 |
+
.vakata-context .vakata-contextmenu-disabled a,
|
186 |
+
.vakata-context .vakata-contextmenu-disabled a:hover {
|
187 |
+
color: silver;
|
188 |
+
background-color: transparent;
|
189 |
+
border: 0;
|
190 |
+
box-shadow: 0 0 0;
|
191 |
+
}
|
192 |
+
.vakata-context .vakata-contextmenu-disabled > a > i {
|
193 |
+
filter: grayscale(100%);
|
194 |
+
}
|
195 |
+
.vakata-context li > a > i {
|
196 |
+
text-decoration: none;
|
197 |
+
display: inline-block;
|
198 |
+
width: 2.4em;
|
199 |
+
height: 2.4em;
|
200 |
+
background: transparent;
|
201 |
+
margin: 0 0 0 -2em;
|
202 |
+
vertical-align: top;
|
203 |
+
text-align: center;
|
204 |
+
line-height: 2.4em;
|
205 |
+
}
|
206 |
+
.vakata-context li > a > i:empty {
|
207 |
+
width: 2.4em;
|
208 |
+
line-height: 2.4em;
|
209 |
+
}
|
210 |
+
.vakata-context li > a .vakata-contextmenu-sep {
|
211 |
+
display: inline-block;
|
212 |
+
width: 1px;
|
213 |
+
height: 2.4em;
|
214 |
+
background: white;
|
215 |
+
margin: 0 0.5em 0 0;
|
216 |
+
border-left: 1px solid #e2e3e3;
|
217 |
+
}
|
218 |
+
.vakata-context .vakata-contextmenu-shortcut {
|
219 |
+
font-size: 0.8em;
|
220 |
+
color: silver;
|
221 |
+
opacity: 0.5;
|
222 |
+
display: none;
|
223 |
+
}
|
224 |
+
.vakata-context-rtl ul {
|
225 |
+
left: auto;
|
226 |
+
right: 100%;
|
227 |
+
margin-left: auto;
|
228 |
+
margin-right: -4px;
|
229 |
+
}
|
230 |
+
.vakata-context-rtl li > a.vakata-context-parent {
|
231 |
+
background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");
|
232 |
+
background-position: left center;
|
233 |
+
background-repeat: no-repeat;
|
234 |
+
}
|
235 |
+
.vakata-context-rtl .vakata-context-separator > a {
|
236 |
+
margin: 0 2.4em 0 0;
|
237 |
+
border-left: 0;
|
238 |
+
border-right: 1px solid #e2e3e3;
|
239 |
+
}
|
240 |
+
.vakata-context-rtl .vakata-context-left ul {
|
241 |
+
right: auto;
|
242 |
+
left: 100%;
|
243 |
+
margin-left: -4px;
|
244 |
+
margin-right: auto;
|
245 |
+
}
|
246 |
+
.vakata-context-rtl li > a > i {
|
247 |
+
margin: 0 -2em 0 0;
|
248 |
+
}
|
249 |
+
.vakata-context-rtl li > a .vakata-contextmenu-sep {
|
250 |
+
margin: 0 0 0 0.5em;
|
251 |
+
border-left-color: white;
|
252 |
+
background: #e2e3e3;
|
253 |
+
}
|
254 |
+
#jstree-marker {
|
255 |
+
position: absolute;
|
256 |
+
top: 0;
|
257 |
+
left: 0;
|
258 |
+
margin: -5px 0 0 0;
|
259 |
+
padding: 0;
|
260 |
+
border-right: 0;
|
261 |
+
border-top: 5px solid transparent;
|
262 |
+
border-bottom: 5px solid transparent;
|
263 |
+
border-left: 5px solid;
|
264 |
+
width: 0;
|
265 |
+
height: 0;
|
266 |
+
font-size: 0;
|
267 |
+
line-height: 0;
|
268 |
+
}
|
269 |
+
#jstree-dnd {
|
270 |
+
line-height: 16px;
|
271 |
+
margin: 0;
|
272 |
+
padding: 4px;
|
273 |
+
}
|
274 |
+
#jstree-dnd .jstree-icon,
|
275 |
+
#jstree-dnd .jstree-copy {
|
276 |
+
display: inline-block;
|
277 |
+
text-decoration: none;
|
278 |
+
margin: 0 2px 0 0;
|
279 |
+
padding: 0;
|
280 |
+
width: 16px;
|
281 |
+
height: 16px;
|
282 |
+
}
|
283 |
+
#jstree-dnd .jstree-ok {
|
284 |
+
background: green;
|
285 |
+
}
|
286 |
+
#jstree-dnd .jstree-er {
|
287 |
+
background: red;
|
288 |
+
}
|
289 |
+
#jstree-dnd .jstree-copy {
|
290 |
+
margin: 0 2px 0 2px;
|
291 |
+
}
|
292 |
+
.jstree-default .jstree-node,
|
293 |
+
.jstree-default .jstree-icon {
|
294 |
+
background-repeat: no-repeat;
|
295 |
+
background-color: transparent;
|
296 |
+
}
|
297 |
+
.jstree-default .jstree-anchor,
|
298 |
+
.jstree-default .jstree-animated,
|
299 |
+
.jstree-default .jstree-wholerow {
|
300 |
+
transition: background-color 0.15s, box-shadow 0.15s;
|
301 |
+
}
|
302 |
+
.jstree-default .jstree-hovered {
|
303 |
+
background: #e7f4f9;
|
304 |
+
border-radius: 2px;
|
305 |
+
box-shadow: inset 0 0 1px #cccccc;
|
306 |
+
}
|
307 |
+
.jstree-default .jstree-context {
|
308 |
+
background: #e7f4f9;
|
309 |
+
border-radius: 2px;
|
310 |
+
box-shadow: inset 0 0 1px #cccccc;
|
311 |
+
}
|
312 |
+
.jstree-default .jstree-clicked {
|
313 |
+
background: #beebff;
|
314 |
+
border-radius: 2px;
|
315 |
+
box-shadow: inset 0 0 1px #999999;
|
316 |
+
}
|
317 |
+
.jstree-default .jstree-no-icons .jstree-anchor > .jstree-themeicon {
|
318 |
+
display: none;
|
319 |
+
}
|
320 |
+
.jstree-default .jstree-disabled {
|
321 |
+
background: transparent;
|
322 |
+
color: #666666;
|
323 |
+
}
|
324 |
+
.jstree-default .jstree-disabled.jstree-hovered {
|
325 |
+
background: transparent;
|
326 |
+
box-shadow: none;
|
327 |
+
}
|
328 |
+
.jstree-default .jstree-disabled.jstree-clicked {
|
329 |
+
background: #efefef;
|
330 |
+
}
|
331 |
+
.jstree-default .jstree-disabled > .jstree-icon {
|
332 |
+
opacity: 0.8;
|
333 |
+
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
|
334 |
+
/* Firefox 10+ */
|
335 |
+
filter: gray;
|
336 |
+
/* IE6-9 */
|
337 |
+
-webkit-filter: grayscale(100%);
|
338 |
+
/* Chrome 19+ & Safari 6+ */
|
339 |
+
}
|
340 |
+
.jstree-default .jstree-search {
|
341 |
+
font-style: italic;
|
342 |
+
color: #8b0000;
|
343 |
+
font-weight: bold;
|
344 |
+
}
|
345 |
+
.jstree-default .jstree-no-checkboxes .jstree-checkbox {
|
346 |
+
display: none !important;
|
347 |
+
}
|
348 |
+
.jstree-default.jstree-checkbox-no-clicked .jstree-clicked {
|
349 |
+
background: transparent;
|
350 |
+
box-shadow: none;
|
351 |
+
}
|
352 |
+
.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered {
|
353 |
+
background: #e7f4f9;
|
354 |
+
}
|
355 |
+
.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked {
|
356 |
+
background: transparent;
|
357 |
+
}
|
358 |
+
.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered {
|
359 |
+
background: #e7f4f9;
|
360 |
+
}
|
361 |
+
.jstree-default > .jstree-striped {
|
362 |
+
min-width: 100%;
|
363 |
+
display: inline-block;
|
364 |
+
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat;
|
365 |
+
}
|
366 |
+
.jstree-default > .jstree-wholerow-ul .jstree-hovered,
|
367 |
+
.jstree-default > .jstree-wholerow-ul .jstree-clicked {
|
368 |
+
background: transparent;
|
369 |
+
box-shadow: none;
|
370 |
+
border-radius: 0;
|
371 |
+
}
|
372 |
+
.jstree-default .jstree-wholerow {
|
373 |
+
-moz-box-sizing: border-box;
|
374 |
+
-webkit-box-sizing: border-box;
|
375 |
+
box-sizing: border-box;
|
376 |
+
}
|
377 |
+
.jstree-default .jstree-wholerow-hovered {
|
378 |
+
background: #e7f4f9;
|
379 |
+
}
|
380 |
+
.jstree-default .jstree-wholerow-clicked {
|
381 |
+
background: #beebff;
|
382 |
+
background: -webkit-linear-gradient(top, #beebff 0%, #a8e4ff 100%);
|
383 |
+
background: linear-gradient(to bottom, #beebff 0%, #a8e4ff 100%);
|
384 |
+
}
|
385 |
+
.jstree-default .jstree-node {
|
386 |
+
min-height: 24px;
|
387 |
+
line-height: 24px;
|
388 |
+
margin-left: 24px;
|
389 |
+
min-width: 24px;
|
390 |
+
}
|
391 |
+
.jstree-default .jstree-anchor {
|
392 |
+
line-height: 24px;
|
393 |
+
height: 24px;
|
394 |
+
}
|
395 |
+
.jstree-default .jstree-icon {
|
396 |
+
width: 24px;
|
397 |
+
height: 24px;
|
398 |
+
line-height: 24px;
|
399 |
+
}
|
400 |
+
.jstree-default .jstree-icon:empty {
|
401 |
+
width: 24px;
|
402 |
+
height: 24px;
|
403 |
+
line-height: 24px;
|
404 |
+
}
|
405 |
+
.jstree-default.jstree-rtl .jstree-node {
|
406 |
+
margin-right: 24px;
|
407 |
+
}
|
408 |
+
.jstree-default .jstree-wholerow {
|
409 |
+
height: 24px;
|
410 |
+
}
|
411 |
+
.jstree-default .jstree-node,
|
412 |
+
.jstree-default .jstree-icon {
|
413 |
+
background-image: url("32px.png");
|
414 |
+
}
|
415 |
+
.jstree-default .jstree-node {
|
416 |
+
background-position: -292px -4px;
|
417 |
+
background-repeat: repeat-y;
|
418 |
+
}
|
419 |
+
.jstree-default .jstree-last {
|
420 |
+
background: transparent;
|
421 |
+
}
|
422 |
+
.jstree-default .jstree-open > .jstree-ocl {
|
423 |
+
background-position: -132px -4px;
|
424 |
+
}
|
425 |
+
.jstree-default .jstree-closed > .jstree-ocl {
|
426 |
+
background-position: -100px -4px;
|
427 |
+
}
|
428 |
+
.jstree-default .jstree-leaf > .jstree-ocl {
|
429 |
+
background-position: -68px -4px;
|
430 |
+
}
|
431 |
+
.jstree-default .jstree-themeicon {
|
432 |
+
background-position: -260px -4px;
|
433 |
+
}
|
434 |
+
.jstree-default > .jstree-no-dots .jstree-node,
|
435 |
+
.jstree-default > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
436 |
+
background: transparent;
|
437 |
+
}
|
438 |
+
.jstree-default > .jstree-no-dots .jstree-open > .jstree-ocl {
|
439 |
+
background-position: -36px -4px;
|
440 |
+
}
|
441 |
+
.jstree-default > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
442 |
+
background-position: -4px -4px;
|
443 |
+
}
|
444 |
+
.jstree-default .jstree-disabled {
|
445 |
+
background: transparent;
|
446 |
+
}
|
447 |
+
.jstree-default .jstree-disabled.jstree-hovered {
|
448 |
+
background: transparent;
|
449 |
+
}
|
450 |
+
.jstree-default .jstree-disabled.jstree-clicked {
|
451 |
+
background: #efefef;
|
452 |
+
}
|
453 |
+
.jstree-default .jstree-checkbox {
|
454 |
+
background-position: -164px -4px;
|
455 |
+
}
|
456 |
+
.jstree-default .jstree-checkbox:hover {
|
457 |
+
background-position: -164px -36px;
|
458 |
+
}
|
459 |
+
.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,
|
460 |
+
.jstree-default .jstree-checked > .jstree-checkbox {
|
461 |
+
background-position: -228px -4px;
|
462 |
+
}
|
463 |
+
.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,
|
464 |
+
.jstree-default .jstree-checked > .jstree-checkbox:hover {
|
465 |
+
background-position: -228px -36px;
|
466 |
+
}
|
467 |
+
.jstree-default .jstree-anchor > .jstree-undetermined {
|
468 |
+
background-position: -196px -4px;
|
469 |
+
}
|
470 |
+
.jstree-default .jstree-anchor > .jstree-undetermined:hover {
|
471 |
+
background-position: -196px -36px;
|
472 |
+
}
|
473 |
+
.jstree-default .jstree-checkbox-disabled {
|
474 |
+
opacity: 0.8;
|
475 |
+
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
|
476 |
+
/* Firefox 10+ */
|
477 |
+
filter: gray;
|
478 |
+
/* IE6-9 */
|
479 |
+
-webkit-filter: grayscale(100%);
|
480 |
+
/* Chrome 19+ & Safari 6+ */
|
481 |
+
}
|
482 |
+
.jstree-default > .jstree-striped {
|
483 |
+
background-size: auto 48px;
|
484 |
+
}
|
485 |
+
.jstree-default.jstree-rtl .jstree-node {
|
486 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
487 |
+
background-position: 100% 1px;
|
488 |
+
background-repeat: repeat-y;
|
489 |
+
}
|
490 |
+
.jstree-default.jstree-rtl .jstree-last {
|
491 |
+
background: transparent;
|
492 |
+
}
|
493 |
+
.jstree-default.jstree-rtl .jstree-open > .jstree-ocl {
|
494 |
+
background-position: -132px -36px;
|
495 |
+
}
|
496 |
+
.jstree-default.jstree-rtl .jstree-closed > .jstree-ocl {
|
497 |
+
background-position: -100px -36px;
|
498 |
+
}
|
499 |
+
.jstree-default.jstree-rtl .jstree-leaf > .jstree-ocl {
|
500 |
+
background-position: -68px -36px;
|
501 |
+
}
|
502 |
+
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-node,
|
503 |
+
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
504 |
+
background: transparent;
|
505 |
+
}
|
506 |
+
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
|
507 |
+
background-position: -36px -36px;
|
508 |
+
}
|
509 |
+
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
510 |
+
background-position: -4px -36px;
|
511 |
+
}
|
512 |
+
.jstree-default .jstree-themeicon-custom {
|
513 |
+
background-color: transparent;
|
514 |
+
background-image: none;
|
515 |
+
background-position: 0 0;
|
516 |
+
}
|
517 |
+
.jstree-default > .jstree-container-ul .jstree-loading > .jstree-ocl {
|
518 |
+
background: url("throbber.gif") center center no-repeat;
|
519 |
+
}
|
520 |
+
.jstree-default .jstree-file {
|
521 |
+
background: url("32px.png") -100px -68px no-repeat;
|
522 |
+
}
|
523 |
+
.jstree-default .jstree-folder {
|
524 |
+
background: url("32px.png") -260px -4px no-repeat;
|
525 |
+
}
|
526 |
+
.jstree-default > .jstree-container-ul > .jstree-node {
|
527 |
+
margin-left: 0;
|
528 |
+
margin-right: 0;
|
529 |
+
}
|
530 |
+
#jstree-dnd.jstree-default {
|
531 |
+
line-height: 24px;
|
532 |
+
padding: 0 4px;
|
533 |
+
}
|
534 |
+
#jstree-dnd.jstree-default .jstree-ok,
|
535 |
+
#jstree-dnd.jstree-default .jstree-er {
|
536 |
+
background-image: url("32px.png");
|
537 |
+
background-repeat: no-repeat;
|
538 |
+
background-color: transparent;
|
539 |
+
}
|
540 |
+
#jstree-dnd.jstree-default i {
|
541 |
+
background: transparent;
|
542 |
+
width: 24px;
|
543 |
+
height: 24px;
|
544 |
+
line-height: 24px;
|
545 |
+
}
|
546 |
+
#jstree-dnd.jstree-default .jstree-ok {
|
547 |
+
background-position: -4px -68px;
|
548 |
+
}
|
549 |
+
#jstree-dnd.jstree-default .jstree-er {
|
550 |
+
background-position: -36px -68px;
|
551 |
+
}
|
552 |
+
.jstree-default .jstree-ellipsis {
|
553 |
+
overflow: hidden;
|
554 |
+
}
|
555 |
+
.jstree-default .jstree-ellipsis .jstree-anchor {
|
556 |
+
width: calc(100% - 29px);
|
557 |
+
text-overflow: ellipsis;
|
558 |
+
overflow: hidden;
|
559 |
+
}
|
560 |
+
.jstree-default.jstree-rtl .jstree-node {
|
561 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
562 |
+
}
|
563 |
+
.jstree-default.jstree-rtl .jstree-last {
|
564 |
+
background: transparent;
|
565 |
+
}
|
566 |
+
.jstree-default-small .jstree-node {
|
567 |
+
min-height: 18px;
|
568 |
+
line-height: 18px;
|
569 |
+
margin-left: 18px;
|
570 |
+
min-width: 18px;
|
571 |
+
}
|
572 |
+
.jstree-default-small .jstree-anchor {
|
573 |
+
line-height: 18px;
|
574 |
+
height: 18px;
|
575 |
+
}
|
576 |
+
.jstree-default-small .jstree-icon {
|
577 |
+
width: 18px;
|
578 |
+
height: 18px;
|
579 |
+
line-height: 18px;
|
580 |
+
}
|
581 |
+
.jstree-default-small .jstree-icon:empty {
|
582 |
+
width: 18px;
|
583 |
+
height: 18px;
|
584 |
+
line-height: 18px;
|
585 |
+
}
|
586 |
+
.jstree-default-small.jstree-rtl .jstree-node {
|
587 |
+
margin-right: 18px;
|
588 |
+
}
|
589 |
+
.jstree-default-small .jstree-wholerow {
|
590 |
+
height: 18px;
|
591 |
+
}
|
592 |
+
.jstree-default-small .jstree-node,
|
593 |
+
.jstree-default-small .jstree-icon {
|
594 |
+
background-image: url("32px.png");
|
595 |
+
}
|
596 |
+
.jstree-default-small .jstree-node {
|
597 |
+
background-position: -295px -7px;
|
598 |
+
background-repeat: repeat-y;
|
599 |
+
}
|
600 |
+
.jstree-default-small .jstree-last {
|
601 |
+
background: transparent;
|
602 |
+
}
|
603 |
+
.jstree-default-small .jstree-open > .jstree-ocl {
|
604 |
+
background-position: -135px -7px;
|
605 |
+
}
|
606 |
+
.jstree-default-small .jstree-closed > .jstree-ocl {
|
607 |
+
background-position: -103px -7px;
|
608 |
+
}
|
609 |
+
.jstree-default-small .jstree-leaf > .jstree-ocl {
|
610 |
+
background-position: -71px -7px;
|
611 |
+
}
|
612 |
+
.jstree-default-small .jstree-themeicon {
|
613 |
+
background-position: -263px -7px;
|
614 |
+
}
|
615 |
+
.jstree-default-small > .jstree-no-dots .jstree-node,
|
616 |
+
.jstree-default-small > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
617 |
+
background: transparent;
|
618 |
+
}
|
619 |
+
.jstree-default-small > .jstree-no-dots .jstree-open > .jstree-ocl {
|
620 |
+
background-position: -39px -7px;
|
621 |
+
}
|
622 |
+
.jstree-default-small > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
623 |
+
background-position: -7px -7px;
|
624 |
+
}
|
625 |
+
.jstree-default-small .jstree-disabled {
|
626 |
+
background: transparent;
|
627 |
+
}
|
628 |
+
.jstree-default-small .jstree-disabled.jstree-hovered {
|
629 |
+
background: transparent;
|
630 |
+
}
|
631 |
+
.jstree-default-small .jstree-disabled.jstree-clicked {
|
632 |
+
background: #efefef;
|
633 |
+
}
|
634 |
+
.jstree-default-small .jstree-checkbox {
|
635 |
+
background-position: -167px -7px;
|
636 |
+
}
|
637 |
+
.jstree-default-small .jstree-checkbox:hover {
|
638 |
+
background-position: -167px -39px;
|
639 |
+
}
|
640 |
+
.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,
|
641 |
+
.jstree-default-small .jstree-checked > .jstree-checkbox {
|
642 |
+
background-position: -231px -7px;
|
643 |
+
}
|
644 |
+
.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,
|
645 |
+
.jstree-default-small .jstree-checked > .jstree-checkbox:hover {
|
646 |
+
background-position: -231px -39px;
|
647 |
+
}
|
648 |
+
.jstree-default-small .jstree-anchor > .jstree-undetermined {
|
649 |
+
background-position: -199px -7px;
|
650 |
+
}
|
651 |
+
.jstree-default-small .jstree-anchor > .jstree-undetermined:hover {
|
652 |
+
background-position: -199px -39px;
|
653 |
+
}
|
654 |
+
.jstree-default-small .jstree-checkbox-disabled {
|
655 |
+
opacity: 0.8;
|
656 |
+
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
|
657 |
+
/* Firefox 10+ */
|
658 |
+
filter: gray;
|
659 |
+
/* IE6-9 */
|
660 |
+
-webkit-filter: grayscale(100%);
|
661 |
+
/* Chrome 19+ & Safari 6+ */
|
662 |
+
}
|
663 |
+
.jstree-default-small > .jstree-striped {
|
664 |
+
background-size: auto 36px;
|
665 |
+
}
|
666 |
+
.jstree-default-small.jstree-rtl .jstree-node {
|
667 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
668 |
+
background-position: 100% 1px;
|
669 |
+
background-repeat: repeat-y;
|
670 |
+
}
|
671 |
+
.jstree-default-small.jstree-rtl .jstree-last {
|
672 |
+
background: transparent;
|
673 |
+
}
|
674 |
+
.jstree-default-small.jstree-rtl .jstree-open > .jstree-ocl {
|
675 |
+
background-position: -135px -39px;
|
676 |
+
}
|
677 |
+
.jstree-default-small.jstree-rtl .jstree-closed > .jstree-ocl {
|
678 |
+
background-position: -103px -39px;
|
679 |
+
}
|
680 |
+
.jstree-default-small.jstree-rtl .jstree-leaf > .jstree-ocl {
|
681 |
+
background-position: -71px -39px;
|
682 |
+
}
|
683 |
+
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-node,
|
684 |
+
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
685 |
+
background: transparent;
|
686 |
+
}
|
687 |
+
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
|
688 |
+
background-position: -39px -39px;
|
689 |
+
}
|
690 |
+
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
691 |
+
background-position: -7px -39px;
|
692 |
+
}
|
693 |
+
.jstree-default-small .jstree-themeicon-custom {
|
694 |
+
background-color: transparent;
|
695 |
+
background-image: none;
|
696 |
+
background-position: 0 0;
|
697 |
+
}
|
698 |
+
.jstree-default-small > .jstree-container-ul .jstree-loading > .jstree-ocl {
|
699 |
+
background: url("throbber.gif") center center no-repeat;
|
700 |
+
}
|
701 |
+
.jstree-default-small .jstree-file {
|
702 |
+
background: url("32px.png") -103px -71px no-repeat;
|
703 |
+
}
|
704 |
+
.jstree-default-small .jstree-folder {
|
705 |
+
background: url("32px.png") -263px -7px no-repeat;
|
706 |
+
}
|
707 |
+
.jstree-default-small > .jstree-container-ul > .jstree-node {
|
708 |
+
margin-left: 0;
|
709 |
+
margin-right: 0;
|
710 |
+
}
|
711 |
+
#jstree-dnd.jstree-default-small {
|
712 |
+
line-height: 18px;
|
713 |
+
padding: 0 4px;
|
714 |
+
}
|
715 |
+
#jstree-dnd.jstree-default-small .jstree-ok,
|
716 |
+
#jstree-dnd.jstree-default-small .jstree-er {
|
717 |
+
background-image: url("32px.png");
|
718 |
+
background-repeat: no-repeat;
|
719 |
+
background-color: transparent;
|
720 |
+
}
|
721 |
+
#jstree-dnd.jstree-default-small i {
|
722 |
+
background: transparent;
|
723 |
+
width: 18px;
|
724 |
+
height: 18px;
|
725 |
+
line-height: 18px;
|
726 |
+
}
|
727 |
+
#jstree-dnd.jstree-default-small .jstree-ok {
|
728 |
+
background-position: -7px -71px;
|
729 |
+
}
|
730 |
+
#jstree-dnd.jstree-default-small .jstree-er {
|
731 |
+
background-position: -39px -71px;
|
732 |
+
}
|
733 |
+
.jstree-default-small .jstree-ellipsis {
|
734 |
+
overflow: hidden;
|
735 |
+
}
|
736 |
+
.jstree-default-small .jstree-ellipsis .jstree-anchor {
|
737 |
+
width: calc(100% - 23px);
|
738 |
+
text-overflow: ellipsis;
|
739 |
+
overflow: hidden;
|
740 |
+
}
|
741 |
+
.jstree-default-small.jstree-rtl .jstree-node {
|
742 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==");
|
743 |
+
}
|
744 |
+
.jstree-default-small.jstree-rtl .jstree-last {
|
745 |
+
background: transparent;
|
746 |
+
}
|
747 |
+
.jstree-default-large .jstree-node {
|
748 |
+
min-height: 32px;
|
749 |
+
line-height: 32px;
|
750 |
+
margin-left: 32px;
|
751 |
+
min-width: 32px;
|
752 |
+
}
|
753 |
+
.jstree-default-large .jstree-anchor {
|
754 |
+
line-height: 32px;
|
755 |
+
height: 32px;
|
756 |
+
}
|
757 |
+
.jstree-default-large .jstree-icon {
|
758 |
+
width: 32px;
|
759 |
+
height: 32px;
|
760 |
+
line-height: 32px;
|
761 |
+
}
|
762 |
+
.jstree-default-large .jstree-icon:empty {
|
763 |
+
width: 32px;
|
764 |
+
height: 32px;
|
765 |
+
line-height: 32px;
|
766 |
+
}
|
767 |
+
.jstree-default-large.jstree-rtl .jstree-node {
|
768 |
+
margin-right: 32px;
|
769 |
+
}
|
770 |
+
.jstree-default-large .jstree-wholerow {
|
771 |
+
height: 32px;
|
772 |
+
}
|
773 |
+
.jstree-default-large .jstree-node,
|
774 |
+
.jstree-default-large .jstree-icon {
|
775 |
+
background-image: url("32px.png");
|
776 |
+
}
|
777 |
+
.jstree-default-large .jstree-node {
|
778 |
+
background-position: -288px 0px;
|
779 |
+
background-repeat: repeat-y;
|
780 |
+
}
|
781 |
+
.jstree-default-large .jstree-last {
|
782 |
+
background: transparent;
|
783 |
+
}
|
784 |
+
.jstree-default-large .jstree-open > .jstree-ocl {
|
785 |
+
background-position: -128px 0px;
|
786 |
+
}
|
787 |
+
.jstree-default-large .jstree-closed > .jstree-ocl {
|
788 |
+
background-position: -96px 0px;
|
789 |
+
}
|
790 |
+
.jstree-default-large .jstree-leaf > .jstree-ocl {
|
791 |
+
background-position: -64px 0px;
|
792 |
+
}
|
793 |
+
.jstree-default-large .jstree-themeicon {
|
794 |
+
background-position: -256px 0px;
|
795 |
+
}
|
796 |
+
.jstree-default-large > .jstree-no-dots .jstree-node,
|
797 |
+
.jstree-default-large > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
798 |
+
background: transparent;
|
799 |
+
}
|
800 |
+
.jstree-default-large > .jstree-no-dots .jstree-open > .jstree-ocl {
|
801 |
+
background-position: -32px 0px;
|
802 |
+
}
|
803 |
+
.jstree-default-large > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
804 |
+
background-position: 0px 0px;
|
805 |
+
}
|
806 |
+
.jstree-default-large .jstree-disabled {
|
807 |
+
background: transparent;
|
808 |
+
}
|
809 |
+
.jstree-default-large .jstree-disabled.jstree-hovered {
|
810 |
+
background: transparent;
|
811 |
+
}
|
812 |
+
.jstree-default-large .jstree-disabled.jstree-clicked {
|
813 |
+
background: #efefef;
|
814 |
+
}
|
815 |
+
.jstree-default-large .jstree-checkbox {
|
816 |
+
background-position: -160px 0px;
|
817 |
+
}
|
818 |
+
.jstree-default-large .jstree-checkbox:hover {
|
819 |
+
background-position: -160px -32px;
|
820 |
+
}
|
821 |
+
.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,
|
822 |
+
.jstree-default-large .jstree-checked > .jstree-checkbox {
|
823 |
+
background-position: -224px 0px;
|
824 |
+
}
|
825 |
+
.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,
|
826 |
+
.jstree-default-large .jstree-checked > .jstree-checkbox:hover {
|
827 |
+
background-position: -224px -32px;
|
828 |
+
}
|
829 |
+
.jstree-default-large .jstree-anchor > .jstree-undetermined {
|
830 |
+
background-position: -192px 0px;
|
831 |
+
}
|
832 |
+
.jstree-default-large .jstree-anchor > .jstree-undetermined:hover {
|
833 |
+
background-position: -192px -32px;
|
834 |
+
}
|
835 |
+
.jstree-default-large .jstree-checkbox-disabled {
|
836 |
+
opacity: 0.8;
|
837 |
+
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
|
838 |
+
/* Firefox 10+ */
|
839 |
+
filter: gray;
|
840 |
+
/* IE6-9 */
|
841 |
+
-webkit-filter: grayscale(100%);
|
842 |
+
/* Chrome 19+ & Safari 6+ */
|
843 |
+
}
|
844 |
+
.jstree-default-large > .jstree-striped {
|
845 |
+
background-size: auto 64px;
|
846 |
+
}
|
847 |
+
.jstree-default-large.jstree-rtl .jstree-node {
|
848 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
849 |
+
background-position: 100% 1px;
|
850 |
+
background-repeat: repeat-y;
|
851 |
+
}
|
852 |
+
.jstree-default-large.jstree-rtl .jstree-last {
|
853 |
+
background: transparent;
|
854 |
+
}
|
855 |
+
.jstree-default-large.jstree-rtl .jstree-open > .jstree-ocl {
|
856 |
+
background-position: -128px -32px;
|
857 |
+
}
|
858 |
+
.jstree-default-large.jstree-rtl .jstree-closed > .jstree-ocl {
|
859 |
+
background-position: -96px -32px;
|
860 |
+
}
|
861 |
+
.jstree-default-large.jstree-rtl .jstree-leaf > .jstree-ocl {
|
862 |
+
background-position: -64px -32px;
|
863 |
+
}
|
864 |
+
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-node,
|
865 |
+
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
866 |
+
background: transparent;
|
867 |
+
}
|
868 |
+
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
|
869 |
+
background-position: -32px -32px;
|
870 |
+
}
|
871 |
+
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
872 |
+
background-position: 0px -32px;
|
873 |
+
}
|
874 |
+
.jstree-default-large .jstree-themeicon-custom {
|
875 |
+
background-color: transparent;
|
876 |
+
background-image: none;
|
877 |
+
background-position: 0 0;
|
878 |
+
}
|
879 |
+
.jstree-default-large > .jstree-container-ul .jstree-loading > .jstree-ocl {
|
880 |
+
background: url("throbber.gif") center center no-repeat;
|
881 |
+
}
|
882 |
+
.jstree-default-large .jstree-file {
|
883 |
+
background: url("32px.png") -96px -64px no-repeat;
|
884 |
+
}
|
885 |
+
.jstree-default-large .jstree-folder {
|
886 |
+
background: url("32px.png") -256px 0px no-repeat;
|
887 |
+
}
|
888 |
+
.jstree-default-large > .jstree-container-ul > .jstree-node {
|
889 |
+
margin-left: 0;
|
890 |
+
margin-right: 0;
|
891 |
+
}
|
892 |
+
#jstree-dnd.jstree-default-large {
|
893 |
+
line-height: 32px;
|
894 |
+
padding: 0 4px;
|
895 |
+
}
|
896 |
+
#jstree-dnd.jstree-default-large .jstree-ok,
|
897 |
+
#jstree-dnd.jstree-default-large .jstree-er {
|
898 |
+
background-image: url("32px.png");
|
899 |
+
background-repeat: no-repeat;
|
900 |
+
background-color: transparent;
|
901 |
+
}
|
902 |
+
#jstree-dnd.jstree-default-large i {
|
903 |
+
background: transparent;
|
904 |
+
width: 32px;
|
905 |
+
height: 32px;
|
906 |
+
line-height: 32px;
|
907 |
+
}
|
908 |
+
#jstree-dnd.jstree-default-large .jstree-ok {
|
909 |
+
background-position: 0px -64px;
|
910 |
+
}
|
911 |
+
#jstree-dnd.jstree-default-large .jstree-er {
|
912 |
+
background-position: -32px -64px;
|
913 |
+
}
|
914 |
+
.jstree-default-large .jstree-ellipsis {
|
915 |
+
overflow: hidden;
|
916 |
+
}
|
917 |
+
.jstree-default-large .jstree-ellipsis .jstree-anchor {
|
918 |
+
width: calc(100% - 37px);
|
919 |
+
text-overflow: ellipsis;
|
920 |
+
overflow: hidden;
|
921 |
+
}
|
922 |
+
.jstree-default-large.jstree-rtl .jstree-node {
|
923 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==");
|
924 |
+
}
|
925 |
+
.jstree-default-large.jstree-rtl .jstree-last {
|
926 |
+
background: transparent;
|
927 |
+
}
|
928 |
+
@media (max-width: 768px) {
|
929 |
+
#jstree-dnd.jstree-dnd-responsive {
|
930 |
+
line-height: 40px;
|
931 |
+
font-weight: bold;
|
932 |
+
font-size: 1.1em;
|
933 |
+
text-shadow: 1px 1px white;
|
934 |
+
}
|
935 |
+
#jstree-dnd.jstree-dnd-responsive > i {
|
936 |
+
background: transparent;
|
937 |
+
width: 40px;
|
938 |
+
height: 40px;
|
939 |
+
}
|
940 |
+
#jstree-dnd.jstree-dnd-responsive > .jstree-ok {
|
941 |
+
background-image: url("40px.png");
|
942 |
+
background-position: 0 -200px;
|
943 |
+
background-size: 120px 240px;
|
944 |
+
}
|
945 |
+
#jstree-dnd.jstree-dnd-responsive > .jstree-er {
|
946 |
+
background-image: url("40px.png");
|
947 |
+
background-position: -40px -200px;
|
948 |
+
background-size: 120px 240px;
|
949 |
+
}
|
950 |
+
#jstree-marker.jstree-dnd-responsive {
|
951 |
+
border-left-width: 10px;
|
952 |
+
border-top-width: 10px;
|
953 |
+
border-bottom-width: 10px;
|
954 |
+
margin-top: -10px;
|
955 |
+
}
|
956 |
+
}
|
957 |
+
@media (max-width: 768px) {
|
958 |
+
.jstree-default-responsive {
|
959 |
+
/*
|
960 |
+
.jstree-open > .jstree-ocl,
|
961 |
+
.jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; }
|
962 |
+
*/
|
963 |
+
}
|
964 |
+
.jstree-default-responsive .jstree-icon {
|
965 |
+
background-image: url("40px.png");
|
966 |
+
}
|
967 |
+
.jstree-default-responsive .jstree-node,
|
968 |
+
.jstree-default-responsive .jstree-leaf > .jstree-ocl {
|
969 |
+
background: transparent;
|
970 |
+
}
|
971 |
+
.jstree-default-responsive .jstree-node {
|
972 |
+
min-height: 40px;
|
973 |
+
line-height: 40px;
|
974 |
+
margin-left: 40px;
|
975 |
+
min-width: 40px;
|
976 |
+
white-space: nowrap;
|
977 |
+
}
|
978 |
+
.jstree-default-responsive .jstree-anchor {
|
979 |
+
line-height: 40px;
|
980 |
+
height: 40px;
|
981 |
+
}
|
982 |
+
.jstree-default-responsive .jstree-icon,
|
983 |
+
.jstree-default-responsive .jstree-icon:empty {
|
984 |
+
width: 40px;
|
985 |
+
height: 40px;
|
986 |
+
line-height: 40px;
|
987 |
+
}
|
988 |
+
.jstree-default-responsive > .jstree-container-ul > .jstree-node {
|
989 |
+
margin-left: 0;
|
990 |
+
}
|
991 |
+
.jstree-default-responsive.jstree-rtl .jstree-node {
|
992 |
+
margin-left: 0;
|
993 |
+
margin-right: 40px;
|
994 |
+
background: transparent;
|
995 |
+
}
|
996 |
+
.jstree-default-responsive.jstree-rtl .jstree-container-ul > .jstree-node {
|
997 |
+
margin-right: 0;
|
998 |
+
}
|
999 |
+
.jstree-default-responsive .jstree-ocl,
|
1000 |
+
.jstree-default-responsive .jstree-themeicon,
|
1001 |
+
.jstree-default-responsive .jstree-checkbox {
|
1002 |
+
background-size: 120px 240px;
|
1003 |
+
}
|
1004 |
+
.jstree-default-responsive .jstree-leaf > .jstree-ocl,
|
1005 |
+
.jstree-default-responsive.jstree-rtl .jstree-leaf > .jstree-ocl {
|
1006 |
+
background: transparent;
|
1007 |
+
}
|
1008 |
+
.jstree-default-responsive .jstree-open > .jstree-ocl {
|
1009 |
+
background-position: 0 0 !important;
|
1010 |
+
}
|
1011 |
+
.jstree-default-responsive .jstree-closed > .jstree-ocl {
|
1012 |
+
background-position: 0 -40px !important;
|
1013 |
+
}
|
1014 |
+
.jstree-default-responsive.jstree-rtl .jstree-closed > .jstree-ocl {
|
1015 |
+
background-position: -40px 0 !important;
|
1016 |
+
}
|
1017 |
+
.jstree-default-responsive .jstree-themeicon {
|
1018 |
+
background-position: -40px -40px;
|
1019 |
+
}
|
1020 |
+
.jstree-default-responsive .jstree-checkbox,
|
1021 |
+
.jstree-default-responsive .jstree-checkbox:hover {
|
1022 |
+
background-position: -40px -80px;
|
1023 |
+
}
|
1024 |
+
.jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,
|
1025 |
+
.jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,
|
1026 |
+
.jstree-default-responsive .jstree-checked > .jstree-checkbox,
|
1027 |
+
.jstree-default-responsive .jstree-checked > .jstree-checkbox:hover {
|
1028 |
+
background-position: 0 -80px;
|
1029 |
+
}
|
1030 |
+
.jstree-default-responsive .jstree-anchor > .jstree-undetermined,
|
1031 |
+
.jstree-default-responsive .jstree-anchor > .jstree-undetermined:hover {
|
1032 |
+
background-position: 0 -120px;
|
1033 |
+
}
|
1034 |
+
.jstree-default-responsive .jstree-anchor {
|
1035 |
+
font-weight: bold;
|
1036 |
+
font-size: 1.1em;
|
1037 |
+
text-shadow: 1px 1px white;
|
1038 |
+
}
|
1039 |
+
.jstree-default-responsive > .jstree-striped {
|
1040 |
+
background: transparent;
|
1041 |
+
}
|
1042 |
+
.jstree-default-responsive .jstree-wholerow {
|
1043 |
+
border-top: 1px solid rgba(255, 255, 255, 0.7);
|
1044 |
+
border-bottom: 1px solid rgba(64, 64, 64, 0.2);
|
1045 |
+
background: #ebebeb;
|
1046 |
+
height: 40px;
|
1047 |
+
}
|
1048 |
+
.jstree-default-responsive .jstree-wholerow-hovered {
|
1049 |
+
background: #e7f4f9;
|
1050 |
+
}
|
1051 |
+
.jstree-default-responsive .jstree-wholerow-clicked {
|
1052 |
+
background: #beebff;
|
1053 |
+
}
|
1054 |
+
.jstree-default-responsive .jstree-children .jstree-last > .jstree-wholerow {
|
1055 |
+
box-shadow: inset 0 -6px 3px -5px #666666;
|
1056 |
+
}
|
1057 |
+
.jstree-default-responsive .jstree-children .jstree-open > .jstree-wholerow {
|
1058 |
+
box-shadow: inset 0 6px 3px -5px #666666;
|
1059 |
+
border-top: 0;
|
1060 |
+
}
|
1061 |
+
.jstree-default-responsive .jstree-children .jstree-open + .jstree-open {
|
1062 |
+
box-shadow: none;
|
1063 |
+
}
|
1064 |
+
.jstree-default-responsive .jstree-node,
|
1065 |
+
.jstree-default-responsive .jstree-icon,
|
1066 |
+
.jstree-default-responsive .jstree-node > .jstree-ocl,
|
1067 |
+
.jstree-default-responsive .jstree-themeicon,
|
1068 |
+
.jstree-default-responsive .jstree-checkbox {
|
1069 |
+
background-image: url("40px.png");
|
1070 |
+
background-size: 120px 240px;
|
1071 |
+
}
|
1072 |
+
.jstree-default-responsive .jstree-node {
|
1073 |
+
background-position: -80px 0;
|
1074 |
+
background-repeat: repeat-y;
|
1075 |
+
}
|
1076 |
+
.jstree-default-responsive .jstree-last {
|
1077 |
+
background: transparent;
|
1078 |
+
}
|
1079 |
+
.jstree-default-responsive .jstree-leaf > .jstree-ocl {
|
1080 |
+
background-position: -40px -120px;
|
1081 |
+
}
|
1082 |
+
.jstree-default-responsive .jstree-last > .jstree-ocl {
|
1083 |
+
background-position: -40px -160px;
|
1084 |
+
}
|
1085 |
+
.jstree-default-responsive .jstree-themeicon-custom {
|
1086 |
+
background-color: transparent;
|
1087 |
+
background-image: none;
|
1088 |
+
background-position: 0 0;
|
1089 |
+
}
|
1090 |
+
.jstree-default-responsive .jstree-file {
|
1091 |
+
background: url("40px.png") 0 -160px no-repeat;
|
1092 |
+
background-size: 120px 240px;
|
1093 |
+
}
|
1094 |
+
.jstree-default-responsive .jstree-folder {
|
1095 |
+
background: url("40px.png") -40px -40px no-repeat;
|
1096 |
+
background-size: 120px 240px;
|
1097 |
+
}
|
1098 |
+
.jstree-default-responsive > .jstree-container-ul > .jstree-node {
|
1099 |
+
margin-left: 0;
|
1100 |
+
margin-right: 0;
|
1101 |
+
}
|
1102 |
+
}
|
trunk/admin/js/jstree/dist/themes/default/style.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:black;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-icon:empty{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-ocl{cursor:pointer}.jstree-leaf>.jstree-ocl{cursor:default}.jstree .jstree-open>.jstree-children{display:block}.jstree .jstree-closed>.jstree-children,.jstree .jstree-leaf>.jstree-children{display:none}.jstree-anchor>.jstree-themeicon{margin-right:2px}.jstree-no-icons .jstree-themeicon,.jstree-anchor>.jstree-themeicon-hidden{display:none}.jstree-hidden,.jstree-node.jstree-hidden{display:none}.jstree-rtl .jstree-anchor{padding:0 1px 0 4px}.jstree-rtl .jstree-anchor>.jstree-themeicon{margin-left:2px;margin-right:0}.jstree-rtl .jstree-node{margin-left:0}.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-wholerow-ul{position:relative;display:inline-block;min-width:100%}.jstree-wholerow-ul .jstree-leaf>.jstree-ocl{cursor:pointer}.jstree-wholerow-ul .jstree-anchor,.jstree-wholerow-ul .jstree-icon{position:relative}.jstree-wholerow-ul .jstree-wholerow{width:100%;cursor:pointer;position:absolute;left:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.jstree-contextmenu .jstree-anchor{-webkit-user-select:none;-webkit-touch-callout:none}.vakata-context{display:none}.vakata-context,.vakata-context ul{margin:0;padding:2px;position:absolute;background:#f5f5f5;border:1px solid #979797;box-shadow:2px 2px 2px #999999}.vakata-context ul{list-style:none;left:100%;margin-top:-2.7em;margin-left:-4px}.vakata-context .vakata-context-right ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context li{list-style:none}.vakata-context li>a{display:block;padding:0 2em 0 2em;text-decoration:none;width:auto;color:black;white-space:nowrap;line-height:2.4em;text-shadow:1px 1px 0 white;border-radius:1px}.vakata-context li>a:hover{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==");background-position:right center;background-repeat:no-repeat}.vakata-context li>a:focus{outline:0}.vakata-context .vakata-context-hover>a{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context .vakata-context-separator>a,.vakata-context .vakata-context-separator>a:hover{background:white;border:0;border-top:1px solid #e2e3e3;height:1px;min-height:1px;max-height:1px;padding:0;margin:0 0 0 2.4em;border-left:1px solid #e0e0e0;text-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;border-radius:0}.vakata-context .vakata-contextmenu-disabled a,.vakata-context .vakata-contextmenu-disabled a:hover{color:silver;background-color:transparent;border:0;box-shadow:0 0 0}.vakata-context .vakata-contextmenu-disabled>a>i{filter:grayscale(100%)}.vakata-context li>a>i{text-decoration:none;display:inline-block;width:2.4em;height:2.4em;background:transparent;margin:0 0 0 -2em;vertical-align:top;text-align:center;line-height:2.4em}.vakata-context li>a>i:empty{width:2.4em;line-height:2.4em}.vakata-context li>a .vakata-contextmenu-sep{display:inline-block;width:1px;height:2.4em;background:white;margin:0 .5em 0 0;border-left:1px solid #e2e3e3}.vakata-context .vakata-contextmenu-shortcut{font-size:.8em;color:silver;opacity:.5;display:none}.vakata-context-rtl ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context-rtl li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");background-position:left center;background-repeat:no-repeat}.vakata-context-rtl .vakata-context-separator>a{margin:0 2.4em 0 0;border-left:0;border-right:1px solid #e2e3e3}.vakata-context-rtl .vakata-context-left ul{right:auto;left:100%;margin-left:-4px;margin-right:auto}.vakata-context-rtl li>a>i{margin:0 -2em 0 0}.vakata-context-rtl li>a .vakata-contextmenu-sep{margin:0 0 0 .5em;border-left-color:white;background:#e2e3e3}#jstree-marker{position:absolute;top:0;left:0;margin:-5px 0 0 0;padding:0;border-right:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid;width:0;height:0;font-size:0;line-height:0}#jstree-dnd{line-height:16px;margin:0;padding:4px}#jstree-dnd .jstree-icon,#jstree-dnd .jstree-copy{display:inline-block;text-decoration:none;margin:0 2px 0 0;padding:0;width:16px;height:16px}#jstree-dnd .jstree-ok{background:green}#jstree-dnd .jstree-er{background:red}#jstree-dnd .jstree-copy{margin:0 2px 0 2px}.jstree-default .jstree-node,.jstree-default .jstree-icon{background-repeat:no-repeat;background-color:transparent}.jstree-default .jstree-anchor,.jstree-default .jstree-animated,.jstree-default .jstree-wholerow{transition:background-color .15s,box-shadow .15s}.jstree-default .jstree-hovered{background:#e7f4f9;border-radius:2px;box-shadow:inset 0 0 1px #cccccc}.jstree-default .jstree-context{background:#e7f4f9;border-radius:2px;box-shadow:inset 0 0 1px #cccccc}.jstree-default .jstree-clicked{background:#beebff;border-radius:2px;box-shadow:inset 0 0 1px #999999}.jstree-default .jstree-no-icons .jstree-anchor>.jstree-themeicon{display:none}.jstree-default .jstree-disabled{background:transparent;color:#666666}.jstree-default .jstree-disabled.jstree-hovered{background:transparent;box-shadow:none}.jstree-default .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default .jstree-disabled>.jstree-icon{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default .jstree-search{font-style:italic;color:#8b0000;font-weight:bold}.jstree-default .jstree-no-checkboxes .jstree-checkbox{display:none !important}.jstree-default.jstree-checkbox-no-clicked .jstree-clicked{background:transparent;box-shadow:none}.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered{background:#e7f4f9}.jstree-default.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked{background:transparent}.jstree-default.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered{background:#e7f4f9}.jstree-default>.jstree-striped{min-width:100%;display:inline-block;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat}.jstree-default>.jstree-wholerow-ul .jstree-hovered,.jstree-default>.jstree-wholerow-ul .jstree-clicked{background:transparent;box-shadow:none;border-radius:0}.jstree-default .jstree-wholerow{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.jstree-default .jstree-wholerow-hovered{background:#e7f4f9}.jstree-default .jstree-wholerow-clicked{background:#beebff;background:-webkit-linear-gradient(top, #beebff 0, #a8e4ff 100%);background:linear-gradient(to bottom, #beebff 0, #a8e4ff 100%)}.jstree-default .jstree-node{min-height:24px;line-height:24px;margin-left:24px;min-width:24px}.jstree-default .jstree-anchor{line-height:24px;height:24px}.jstree-default .jstree-icon{width:24px;height:24px;line-height:24px}.jstree-default .jstree-icon:empty{width:24px;height:24px;line-height:24px}.jstree-default.jstree-rtl .jstree-node{margin-right:24px}.jstree-default .jstree-wholerow{height:24px}.jstree-default .jstree-node,.jstree-default .jstree-icon{background-image:url("32px.png")}.jstree-default .jstree-node{background-position:-292px -4px;background-repeat:repeat-y}.jstree-default .jstree-last{background:transparent}.jstree-default .jstree-open>.jstree-ocl{background-position:-132px -4px}.jstree-default .jstree-closed>.jstree-ocl{background-position:-100px -4px}.jstree-default .jstree-leaf>.jstree-ocl{background-position:-68px -4px}.jstree-default .jstree-themeicon{background-position:-260px -4px}.jstree-default>.jstree-no-dots .jstree-node,.jstree-default>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -4px}.jstree-default>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -4px}.jstree-default .jstree-disabled{background:transparent}.jstree-default .jstree-disabled.jstree-hovered{background:transparent}.jstree-default .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default .jstree-checkbox{background-position:-164px -4px}.jstree-default .jstree-checkbox:hover{background-position:-164px -36px}.jstree-default.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default .jstree-checked>.jstree-checkbox{background-position:-228px -4px}.jstree-default.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default .jstree-checked>.jstree-checkbox:hover{background-position:-228px -36px}.jstree-default .jstree-anchor>.jstree-undetermined{background-position:-196px -4px}.jstree-default .jstree-anchor>.jstree-undetermined:hover{background-position:-196px -36px}.jstree-default .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default>.jstree-striped{background-size:auto 48px}.jstree-default.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default.jstree-rtl .jstree-last{background:transparent}.jstree-default.jstree-rtl .jstree-open>.jstree-ocl{background-position:-132px -36px}.jstree-default.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-100px -36px}.jstree-default.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-68px -36px}.jstree-default.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -36px}.jstree-default.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -36px}.jstree-default .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default .jstree-file{background:url("32px.png") -100px -68px no-repeat}.jstree-default .jstree-folder{background:url("32px.png") -260px -4px no-repeat}.jstree-default>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default{line-height:24px;padding:0 4px}#jstree-dnd.jstree-default .jstree-ok,#jstree-dnd.jstree-default .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default i{background:transparent;width:24px;height:24px;line-height:24px}#jstree-dnd.jstree-default .jstree-ok{background-position:-4px -68px}#jstree-dnd.jstree-default .jstree-er{background-position:-36px -68px}.jstree-default .jstree-ellipsis{overflow:hidden}.jstree-default .jstree-ellipsis .jstree-anchor{width:calc(100% - 29px);text-overflow:ellipsis;overflow:hidden}.jstree-default.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==")}.jstree-default.jstree-rtl .jstree-last{background:transparent}.jstree-default-small .jstree-node{min-height:18px;line-height:18px;margin-left:18px;min-width:18px}.jstree-default-small .jstree-anchor{line-height:18px;height:18px}.jstree-default-small .jstree-icon{width:18px;height:18px;line-height:18px}.jstree-default-small .jstree-icon:empty{width:18px;height:18px;line-height:18px}.jstree-default-small.jstree-rtl .jstree-node{margin-right:18px}.jstree-default-small .jstree-wholerow{height:18px}.jstree-default-small .jstree-node,.jstree-default-small .jstree-icon{background-image:url("32px.png")}.jstree-default-small .jstree-node{background-position:-295px -7px;background-repeat:repeat-y}.jstree-default-small .jstree-last{background:transparent}.jstree-default-small .jstree-open>.jstree-ocl{background-position:-135px -7px}.jstree-default-small .jstree-closed>.jstree-ocl{background-position:-103px -7px}.jstree-default-small .jstree-leaf>.jstree-ocl{background-position:-71px -7px}.jstree-default-small .jstree-themeicon{background-position:-263px -7px}.jstree-default-small>.jstree-no-dots .jstree-node,.jstree-default-small>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-small>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -7px}.jstree-default-small>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -7px}.jstree-default-small .jstree-disabled{background:transparent}.jstree-default-small .jstree-disabled.jstree-hovered{background:transparent}.jstree-default-small .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-small .jstree-checkbox{background-position:-167px -7px}.jstree-default-small .jstree-checkbox:hover{background-position:-167px -39px}.jstree-default-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-small .jstree-checked>.jstree-checkbox{background-position:-231px -7px}.jstree-default-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-small .jstree-checked>.jstree-checkbox:hover{background-position:-231px -39px}.jstree-default-small .jstree-anchor>.jstree-undetermined{background-position:-199px -7px}.jstree-default-small .jstree-anchor>.jstree-undetermined:hover{background-position:-199px -39px}.jstree-default-small .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-small>.jstree-striped{background-size:auto 36px}.jstree-default-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default-small.jstree-rtl .jstree-last{background:transparent}.jstree-default-small.jstree-rtl .jstree-open>.jstree-ocl{background-position:-135px -39px}.jstree-default-small.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-103px -39px}.jstree-default-small.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-71px -39px}.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -39px}.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -39px}.jstree-default-small .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-small>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default-small .jstree-file{background:url("32px.png") -103px -71px no-repeat}.jstree-default-small .jstree-folder{background:url("32px.png") -263px -7px no-repeat}.jstree-default-small>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-small{line-height:18px;padding:0 4px}#jstree-dnd.jstree-default-small .jstree-ok,#jstree-dnd.jstree-default-small .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-small i{background:transparent;width:18px;height:18px;line-height:18px}#jstree-dnd.jstree-default-small .jstree-ok{background-position:-7px -71px}#jstree-dnd.jstree-default-small .jstree-er{background-position:-39px -71px}.jstree-default-small .jstree-ellipsis{overflow:hidden}.jstree-default-small .jstree-ellipsis .jstree-anchor{width:calc(100% - 23px);text-overflow:ellipsis;overflow:hidden}.jstree-default-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==")}.jstree-default-small.jstree-rtl .jstree-last{background:transparent}.jstree-default-large .jstree-node{min-height:32px;line-height:32px;margin-left:32px;min-width:32px}.jstree-default-large .jstree-anchor{line-height:32px;height:32px}.jstree-default-large .jstree-icon{width:32px;height:32px;line-height:32px}.jstree-default-large .jstree-icon:empty{width:32px;height:32px;line-height:32px}.jstree-default-large.jstree-rtl .jstree-node{margin-right:32px}.jstree-default-large .jstree-wholerow{height:32px}.jstree-default-large .jstree-node,.jstree-default-large .jstree-icon{background-image:url("32px.png")}.jstree-default-large .jstree-node{background-position:-288px 0;background-repeat:repeat-y}.jstree-default-large .jstree-last{background:transparent}.jstree-default-large .jstree-open>.jstree-ocl{background-position:-128px 0}.jstree-default-large .jstree-closed>.jstree-ocl{background-position:-96px 0}.jstree-default-large .jstree-leaf>.jstree-ocl{background-position:-64px 0}.jstree-default-large .jstree-themeicon{background-position:-256px 0}.jstree-default-large>.jstree-no-dots .jstree-node,.jstree-default-large>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-large>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px 0}.jstree-default-large>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 0}.jstree-default-large .jstree-disabled{background:transparent}.jstree-default-large .jstree-disabled.jstree-hovered{background:transparent}.jstree-default-large .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-large .jstree-checkbox{background-position:-160px 0}.jstree-default-large .jstree-checkbox:hover{background-position:-160px -32px}.jstree-default-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-large .jstree-checked>.jstree-checkbox{background-position:-224px 0}.jstree-default-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-large .jstree-checked>.jstree-checkbox:hover{background-position:-224px -32px}.jstree-default-large .jstree-anchor>.jstree-undetermined{background-position:-192px 0}.jstree-default-large .jstree-anchor>.jstree-undetermined:hover{background-position:-192px -32px}.jstree-default-large .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-large>.jstree-striped{background-size:auto 64px}.jstree-default-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default-large.jstree-rtl .jstree-last{background:transparent}.jstree-default-large.jstree-rtl .jstree-open>.jstree-ocl{background-position:-128px -32px}.jstree-default-large.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-96px -32px}.jstree-default-large.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-64px -32px}.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px -32px}.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 -32px}.jstree-default-large .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-large>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default-large .jstree-file{background:url("32px.png") -96px -64px no-repeat}.jstree-default-large .jstree-folder{background:url("32px.png") -256px 0 no-repeat}.jstree-default-large>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-large{line-height:32px;padding:0 4px}#jstree-dnd.jstree-default-large .jstree-ok,#jstree-dnd.jstree-default-large .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-large i{background:transparent;width:32px;height:32px;line-height:32px}#jstree-dnd.jstree-default-large .jstree-ok{background-position:0 -64px}#jstree-dnd.jstree-default-large .jstree-er{background-position:-32px -64px}.jstree-default-large .jstree-ellipsis{overflow:hidden}.jstree-default-large .jstree-ellipsis .jstree-anchor{width:calc(100% - 37px);text-overflow:ellipsis;overflow:hidden}.jstree-default-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==")}.jstree-default-large.jstree-rtl .jstree-last{background:transparent}@media (max-width:768px){#jstree-dnd.jstree-dnd-responsive{line-height:40px;font-weight:bold;font-size:1.1em;text-shadow:1px 1px white}#jstree-dnd.jstree-dnd-responsive>i{background:transparent;width:40px;height:40px}#jstree-dnd.jstree-dnd-responsive>.jstree-ok{background-image:url("40px.png");background-position:0 -200px;background-size:120px 240px}#jstree-dnd.jstree-dnd-responsive>.jstree-er{background-image:url("40px.png");background-position:-40px -200px;background-size:120px 240px}#jstree-marker.jstree-dnd-responsive{border-left-width:10px;border-top-width:10px;border-bottom-width:10px;margin-top:-10px}}@media (max-width:768px){.jstree-default-responsive .jstree-icon{background-image:url("40px.png")}.jstree-default-responsive .jstree-node,.jstree-default-responsive .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-responsive .jstree-node{min-height:40px;line-height:40px;margin-left:40px;min-width:40px;white-space:nowrap}.jstree-default-responsive .jstree-anchor{line-height:40px;height:40px}.jstree-default-responsive .jstree-icon,.jstree-default-responsive .jstree-icon:empty{width:40px;height:40px;line-height:40px}.jstree-default-responsive>.jstree-container-ul>.jstree-node{margin-left:0}.jstree-default-responsive.jstree-rtl .jstree-node{margin-left:0;margin-right:40px;background:transparent}.jstree-default-responsive.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-default-responsive .jstree-ocl,.jstree-default-responsive .jstree-themeicon,.jstree-default-responsive .jstree-checkbox{background-size:120px 240px}.jstree-default-responsive .jstree-leaf>.jstree-ocl,.jstree-default-responsive.jstree-rtl .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-responsive .jstree-open>.jstree-ocl{background-position:0 0 !important}.jstree-default-responsive .jstree-closed>.jstree-ocl{background-position:0 -40px !important}.jstree-default-responsive.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-40px 0 !important}.jstree-default-responsive .jstree-themeicon{background-position:-40px -40px}.jstree-default-responsive .jstree-checkbox,.jstree-default-responsive .jstree-checkbox:hover{background-position:-40px -80px}.jstree-default-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-responsive .jstree-checked>.jstree-checkbox,.jstree-default-responsive .jstree-checked>.jstree-checkbox:hover{background-position:0 -80px}.jstree-default-responsive .jstree-anchor>.jstree-undetermined,.jstree-default-responsive .jstree-anchor>.jstree-undetermined:hover{background-position:0 -120px}.jstree-default-responsive .jstree-anchor{font-weight:bold;font-size:1.1em;text-shadow:1px 1px white}.jstree-default-responsive>.jstree-striped{background:transparent}.jstree-default-responsive .jstree-wholerow{border-top:1px solid rgba(255,255,255,0.7);border-bottom:1px solid rgba(64,64,64,0.2);background:#ebebeb;height:40px}.jstree-default-responsive .jstree-wholerow-hovered{background:#e7f4f9}.jstree-default-responsive .jstree-wholerow-clicked{background:#beebff}.jstree-default-responsive .jstree-children .jstree-last>.jstree-wholerow{box-shadow:inset 0 -6px 3px -5px #666666}.jstree-default-responsive .jstree-children .jstree-open>.jstree-wholerow{box-shadow:inset 0 6px 3px -5px #666666;border-top:0}.jstree-default-responsive .jstree-children .jstree-open+.jstree-open{box-shadow:none}.jstree-default-responsive .jstree-node,.jstree-default-responsive .jstree-icon,.jstree-default-responsive .jstree-node>.jstree-ocl,.jstree-default-responsive .jstree-themeicon,.jstree-default-responsive .jstree-checkbox{background-image:url("40px.png");background-size:120px 240px}.jstree-default-responsive .jstree-node{background-position:-80px 0;background-repeat:repeat-y}.jstree-default-responsive .jstree-last{background:transparent}.jstree-default-responsive .jstree-leaf>.jstree-ocl{background-position:-40px -120px}.jstree-default-responsive .jstree-last>.jstree-ocl{background-position:-40px -160px}.jstree-default-responsive .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-responsive .jstree-file{background:url("40px.png") 0 -160px no-repeat;background-size:120px 240px}.jstree-default-responsive .jstree-folder{background:url("40px.png") -40px -40px no-repeat;background-size:120px 240px}.jstree-default-responsive>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}}
|
trunk/admin/js/jstree/dist/themes/default/throbber.gif
ADDED
Binary file
|
trunk/admin/js/wpvivid-admin.js
ADDED
@@ -0,0 +1,683 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var task_retry_times=0;
|
2 |
+
var running_backup_taskid='';
|
3 |
+
var tmp_current_click_backupid = '';
|
4 |
+
var m_need_update=true;
|
5 |
+
var m_restore_backup_id;
|
6 |
+
var m_backup_task_id;
|
7 |
+
var m_downloading_file_name = '';
|
8 |
+
var m_downloading_id = '';
|
9 |
+
var wpvivid_settings_changed = false;
|
10 |
+
var wpvivid_cur_log_page = 1;
|
11 |
+
var wpvivid_completed_backup = 1;
|
12 |
+
var wpvivid_prepare_backup=false;
|
13 |
+
var wpvivid_restoring=false;
|
14 |
+
var wpvivid_location_href=false;
|
15 |
+
var wpvivid_editing_storage_id = '';
|
16 |
+
var wpvivid_editing_storage_type = '';
|
17 |
+
var wpvivid_restore_download_array;
|
18 |
+
var wpvivid_restore_download_index = 0;
|
19 |
+
var wpvivid_get_download_restore_progress_retry = 0;
|
20 |
+
var wpvivid_restore_timeout = false;
|
21 |
+
var wpvivid_restore_need_download = false;
|
22 |
+
var wpvivid_display_restore_backup = false;
|
23 |
+
var wpvivid_restore_backup_type = '';
|
24 |
+
var wpvivid_display_restore_check = false;
|
25 |
+
var wpvivid_restore_sure = false;
|
26 |
+
var wpvivid_resotre_is_migrate=0;
|
27 |
+
(function ($) {
|
28 |
+
'use strict';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* All of the code for your admin-facing JavaScript source
|
32 |
+
* should reside in this file.
|
33 |
+
*
|
34 |
+
* Note: It has been assumed you will write jQuery code here, so the
|
35 |
+
* $ function reference has been prepared for usage within the scope
|
36 |
+
* of this function.
|
37 |
+
*
|
38 |
+
* This enables you to define handlers, for when the DOM is ready:
|
39 |
+
*
|
40 |
+
* $(function() {
|
41 |
+
*
|
42 |
+
* });
|
43 |
+
*
|
44 |
+
* When the window is loaded:
|
45 |
+
*
|
46 |
+
* $( window ).load(function() {
|
47 |
+
*
|
48 |
+
* });
|
49 |
+
*
|
50 |
+
* ...and/or other possibilities.
|
51 |
+
*
|
52 |
+
* Ideally, it is not considered best practise to attach more than a
|
53 |
+
* single DOM-ready or window-load handler for a particular page.
|
54 |
+
* Although scripts in the WordPress core, Plugins and Themes may be
|
55 |
+
* practising this, we should strive to set a better example in our own work.
|
56 |
+
*/
|
57 |
+
$(document).ready(function () {
|
58 |
+
//wpvivid_getrequest();
|
59 |
+
|
60 |
+
wpvivid_interface_flow_control();
|
61 |
+
|
62 |
+
$('input[option=review]').click(function(){
|
63 |
+
var name = jQuery(this).prop('name');
|
64 |
+
wpvivid_add_review_info(name);
|
65 |
+
});
|
66 |
+
|
67 |
+
$(document).on('click', '.notice-wp-cron .notice-dismiss', function(){
|
68 |
+
var ajax_data = {
|
69 |
+
'action': 'wpvivid_hide_wp_cron_notice'
|
70 |
+
};
|
71 |
+
wpvivid_post_request(ajax_data, function(res){
|
72 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
73 |
+
});
|
74 |
+
});
|
75 |
+
});
|
76 |
+
|
77 |
+
})(jQuery);
|
78 |
+
|
79 |
+
function wpvivid_popup_tour(style) {
|
80 |
+
var popup = document.getElementById("wpvivid_popup_tour");
|
81 |
+
if (popup != null) {
|
82 |
+
popup.classList.add(style);
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
window.onbeforeunload = function(e) {
|
87 |
+
if (wpvivid_settings_changed) {
|
88 |
+
if (wpvivid_location_href){
|
89 |
+
wpvivid_location_href = false;
|
90 |
+
}
|
91 |
+
else {
|
92 |
+
return 'You are leaving the page without saving your changes, any unsaved changes on the page will be lost, are you sure you want to continue?';
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Refresh the scheduled task list as regularly as a preset interval(3-minute), to retrieve and activate the scheduled cron jobs.
|
99 |
+
*/
|
100 |
+
function wpvivid_activate_cron(){
|
101 |
+
var next_get_time = 3 * 60 * 1000;
|
102 |
+
wpvivid_cron_task();
|
103 |
+
setTimeout("wpvivid_activate_cron()", next_get_time);
|
104 |
+
setTimeout(function(){
|
105 |
+
m_need_update=true;
|
106 |
+
}, 10000);
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Send an Ajax request
|
111 |
+
*
|
112 |
+
* @param ajax_data - Data in Ajax request
|
113 |
+
* @param callback - A callback function when the request is succeeded
|
114 |
+
* @param error_callback - A callback function when the request is failed
|
115 |
+
* @param time_out - The timeout for Ajax request
|
116 |
+
*/
|
117 |
+
function wpvivid_post_request(ajax_data, callback, error_callback, time_out){
|
118 |
+
if(typeof time_out === 'undefined') time_out = 30000;
|
119 |
+
ajax_data.nonce=wpvivid_ajax_object.ajax_nonce;
|
120 |
+
jQuery.ajax({
|
121 |
+
type: "post",
|
122 |
+
url: wpvivid_ajax_object.ajax_url,
|
123 |
+
data: ajax_data,
|
124 |
+
success: function (data) {
|
125 |
+
callback(data);
|
126 |
+
},
|
127 |
+
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
128 |
+
error_callback(XMLHttpRequest, textStatus, errorThrown);
|
129 |
+
},
|
130 |
+
timeout: time_out
|
131 |
+
});
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Check if there are running tasks (backup and download)
|
136 |
+
*/
|
137 |
+
function wpvivid_check_runningtask(){
|
138 |
+
var ajax_data = {
|
139 |
+
'action': 'wpvivid_list_tasks',
|
140 |
+
'backup_id': tmp_current_click_backupid
|
141 |
+
};
|
142 |
+
if(wpvivid_restoring === false) {
|
143 |
+
wpvivid_post_request(ajax_data, function (data) {
|
144 |
+
setTimeout(function () {
|
145 |
+
wpvivid_manage_task();
|
146 |
+
}, 3000);
|
147 |
+
try {
|
148 |
+
var jsonarray = jQuery.parseJSON(data);
|
149 |
+
if (jsonarray.success_notice_html != false) {
|
150 |
+
jQuery('#wpvivid_backup_notice').show();
|
151 |
+
jQuery('#wpvivid_backup_notice').append(jsonarray.success_notice_html);
|
152 |
+
}
|
153 |
+
if(jsonarray.error_notice_html != false){
|
154 |
+
jQuery('#wpvivid_backup_notice').show();
|
155 |
+
jQuery.each(jsonarray.error_notice_html, function (index, value) {
|
156 |
+
jQuery('#wpvivid_backup_notice').append(value.error_msg);
|
157 |
+
});
|
158 |
+
}
|
159 |
+
if(jsonarray.backuplist_html != false) {
|
160 |
+
jQuery('#wpvivid_backup_list').html('');
|
161 |
+
jQuery('#wpvivid_backup_list').append(jsonarray.backuplist_html);
|
162 |
+
}
|
163 |
+
var b_has_data = false;
|
164 |
+
if (jsonarray.backup.data.length !== 0) {
|
165 |
+
b_has_data = true;
|
166 |
+
task_retry_times = 0;
|
167 |
+
if (jsonarray.backup.result === 'success') {
|
168 |
+
wpvivid_prepare_backup = false;
|
169 |
+
jQuery.each(jsonarray.backup.data, function (index, value) {
|
170 |
+
if (value.status.str === 'ready') {
|
171 |
+
jQuery('#wpvivid_postbox_backup_percent').html(value.progress_html);
|
172 |
+
m_need_update = true;
|
173 |
+
}
|
174 |
+
else if (value.status.str === 'running') {
|
175 |
+
running_backup_taskid = index;
|
176 |
+
wpvivid_control_backup_lock();
|
177 |
+
jQuery('#wpvivid_postbox_backup_percent').show();
|
178 |
+
jQuery('#wpvivid_postbox_backup_percent').html(value.progress_html);
|
179 |
+
m_need_update = true;
|
180 |
+
}
|
181 |
+
else if (value.status.str === 'wait_resume') {
|
182 |
+
running_backup_taskid = index;
|
183 |
+
wpvivid_control_backup_lock();
|
184 |
+
jQuery('#wpvivid_postbox_backup_percent').show();
|
185 |
+
jQuery('#wpvivid_postbox_backup_percent').html(value.progress_html);
|
186 |
+
if (value.data.next_resume_time !== 'get next resume time failed.') {
|
187 |
+
wpvivid_resume_backup(index, value.data.next_resume_time);
|
188 |
+
}
|
189 |
+
else {
|
190 |
+
wpvivid_delete_backup_task(index);
|
191 |
+
}
|
192 |
+
}
|
193 |
+
else if (value.status.str === 'no_responds') {
|
194 |
+
running_backup_taskid = index;
|
195 |
+
wpvivid_control_backup_lock();
|
196 |
+
jQuery('#wpvivid_postbox_backup_percent').show();
|
197 |
+
jQuery('#wpvivid_postbox_backup_percent').html(value.progress_html);
|
198 |
+
m_need_update = true;
|
199 |
+
}
|
200 |
+
else if (value.status.str === 'completed') {
|
201 |
+
jQuery('#wpvivid_postbox_backup_percent').html(value.progress_html);
|
202 |
+
wpvivid_control_backup_unlock();
|
203 |
+
jQuery('#wpvivid_postbox_backup_percent').hide();
|
204 |
+
jQuery('#wpvivid_last_backup_msg').html(jsonarray.last_msg_html);
|
205 |
+
jQuery('#wpvivid_loglist').html("");
|
206 |
+
jQuery('#wpvivid_loglist').append(jsonarray.log_html);
|
207 |
+
wpvivid_log_count = jsonarray.log_count;
|
208 |
+
wpvivid_display_log_page();
|
209 |
+
running_backup_taskid = '';
|
210 |
+
m_backup_task_id = '';
|
211 |
+
m_need_update = true;
|
212 |
+
}
|
213 |
+
else if (value.status.str === 'error') {
|
214 |
+
jQuery('#wpvivid_postbox_backup_percent').html(value.progress_html);
|
215 |
+
wpvivid_control_backup_unlock();
|
216 |
+
jQuery('#wpvivid_postbox_backup_percent').hide();
|
217 |
+
jQuery('#wpvivid_last_backup_msg').html(jsonarray.last_msg_html);
|
218 |
+
jQuery('#wpvivid_loglist').html("");
|
219 |
+
jQuery('#wpvivid_loglist').append(jsonarray.log_html);
|
220 |
+
running_backup_taskid = '';
|
221 |
+
m_backup_task_id = '';
|
222 |
+
m_need_update = true;
|
223 |
+
}
|
224 |
+
});
|
225 |
+
}
|
226 |
+
}
|
227 |
+
else
|
228 |
+
{
|
229 |
+
if(running_backup_taskid !== '')
|
230 |
+
{
|
231 |
+
jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
232 |
+
jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
233 |
+
wpvivid_control_backup_unlock();
|
234 |
+
jQuery('#wpvivid_postbox_backup_percent').hide();
|
235 |
+
wpvivid_retrieve_backup_list();
|
236 |
+
wpvivid_retrieve_last_backup_message();
|
237 |
+
wpvivid_retrieve_log_list();
|
238 |
+
running_backup_taskid='';
|
239 |
+
}
|
240 |
+
}
|
241 |
+
/*if (jsonarray.download.length !== 0) {
|
242 |
+
if(jsonarray.download.result === 'success') {
|
243 |
+
b_has_data = true;
|
244 |
+
task_retry_times = 0;
|
245 |
+
var i = 0;
|
246 |
+
var file_name = '';
|
247 |
+
jQuery('#wpvivid_file_part_' + tmp_current_click_backupid).html("");
|
248 |
+
var b_download_finish = false;
|
249 |
+
jQuery.each(jsonarray.download.files, function (index, value) {
|
250 |
+
i++;
|
251 |
+
file_name = index;
|
252 |
+
var progress = '0%';
|
253 |
+
if (value.status === 'need_download') {
|
254 |
+
if (m_downloading_file_name === file_name) {
|
255 |
+
m_need_update = true;
|
256 |
+
}
|
257 |
+
jQuery('#wpvivid_file_part_' + tmp_current_click_backupid).append(value.html);
|
258 |
+
//b_download_finish=true;
|
259 |
+
}
|
260 |
+
else if (value.status === 'running') {
|
261 |
+
if (m_downloading_file_name === file_name) {
|
262 |
+
wpvivid_lock_download(tmp_current_click_backupid);
|
263 |
+
}
|
264 |
+
m_need_update = true;
|
265 |
+
jQuery('#wpvivid_file_part_' + tmp_current_click_backupid).append(value.html);
|
266 |
+
b_download_finish = false;
|
267 |
+
}
|
268 |
+
else if (value.status === 'completed') {
|
269 |
+
if (m_downloading_file_name === file_name) {
|
270 |
+
wpvivid_unlock_download(tmp_current_click_backupid);
|
271 |
+
m_downloading_id = '';
|
272 |
+
m_downloading_file_name = '';
|
273 |
+
}
|
274 |
+
jQuery('#wpvivid_file_part_' + tmp_current_click_backupid).append(value.html);
|
275 |
+
b_download_finish = true;
|
276 |
+
}
|
277 |
+
else if (value.status === 'error') {
|
278 |
+
if (m_downloading_file_name === file_name) {
|
279 |
+
wpvivid_unlock_download(tmp_current_click_backupid);
|
280 |
+
m_downloading_id = '';
|
281 |
+
m_downloading_file_name = '';
|
282 |
+
}
|
283 |
+
alert(value.error);
|
284 |
+
jQuery('#wpvivid_file_part_' + tmp_current_click_backupid).append(value.html);
|
285 |
+
b_download_finish = true;
|
286 |
+
}
|
287 |
+
else if (value.status === 'timeout') {
|
288 |
+
if (m_downloading_file_name === file_name) {
|
289 |
+
wpvivid_unlock_download(tmp_current_click_backupid);
|
290 |
+
m_downloading_id = '';
|
291 |
+
m_downloading_file_name = '';
|
292 |
+
}
|
293 |
+
alert('Download timeout, please retry.');
|
294 |
+
jQuery('#wpvivid_file_part_' + tmp_current_click_backupid).append(value.html);
|
295 |
+
b_download_finish = true;
|
296 |
+
}
|
297 |
+
});
|
298 |
+
jQuery('#wpvivid_file_part_' + tmp_current_click_backupid).append(jsonarray.download.place_html);
|
299 |
+
if (b_download_finish == true) {
|
300 |
+
tmp_current_click_backupid = '';
|
301 |
+
}
|
302 |
+
}
|
303 |
+
else{
|
304 |
+
b_has_data = true;
|
305 |
+
alert(jsonarray.download.error);
|
306 |
+
}
|
307 |
+
}*/
|
308 |
+
if (!b_has_data) {
|
309 |
+
task_retry_times++;
|
310 |
+
if (task_retry_times < 5) {
|
311 |
+
m_need_update = true;
|
312 |
+
}
|
313 |
+
}
|
314 |
+
}
|
315 |
+
catch(err){
|
316 |
+
alert(err);
|
317 |
+
}
|
318 |
+
}, function (XMLHttpRequest, textStatus, errorThrown)
|
319 |
+
{
|
320 |
+
task_retry_times++;
|
321 |
+
if (task_retry_times < 5)
|
322 |
+
{
|
323 |
+
setTimeout(function () {
|
324 |
+
m_need_update = true;
|
325 |
+
wpvivid_manage_task();
|
326 |
+
}, 3000);
|
327 |
+
}
|
328 |
+
});
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* This function will show the log on a text box.
|
334 |
+
*
|
335 |
+
* @param data - The log message returned by server
|
336 |
+
*/
|
337 |
+
function wpvivid_show_log(data, content_id){
|
338 |
+
jQuery('#'+content_id).html("");
|
339 |
+
try {
|
340 |
+
var jsonarray = jQuery.parseJSON(data);
|
341 |
+
if (jsonarray.result === "success") {
|
342 |
+
var log_data = jsonarray.data;
|
343 |
+
while (log_data.indexOf('\n') >= 0) {
|
344 |
+
var iLength = log_data.indexOf('\n');
|
345 |
+
var log = log_data.substring(0, iLength);
|
346 |
+
log_data = log_data.substring(iLength + 1);
|
347 |
+
var insert_log = "<div style=\"clear:both;\">" + log + "</div>";
|
348 |
+
jQuery('#'+content_id).append(insert_log);
|
349 |
+
}
|
350 |
+
}
|
351 |
+
else if (jsonarray.result === "failed") {
|
352 |
+
jQuery('#'+content_id).html(jsonarray.error);
|
353 |
+
}
|
354 |
+
}
|
355 |
+
catch(err){
|
356 |
+
alert(err);
|
357 |
+
var div = "Reading the log failed. Please try again.";
|
358 |
+
jQuery('#'+content_id).html(div);
|
359 |
+
}
|
360 |
+
}
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Resume the backup task automatically in 1 minute in a timeout situation
|
364 |
+
*
|
365 |
+
* @param backup_id - A unique ID for a backup
|
366 |
+
* @param next_resume_time - A time interval for resuming next timeout backup task
|
367 |
+
*/
|
368 |
+
function wpvivid_resume_backup(backup_id, next_resume_time){
|
369 |
+
if(next_resume_time < 0){
|
370 |
+
next_resume_time = 0;
|
371 |
+
}
|
372 |
+
next_resume_time = next_resume_time * 1000;
|
373 |
+
setTimeout("wpvivid_cron_task()", next_resume_time);
|
374 |
+
setTimeout(function(){
|
375 |
+
task_retry_times = 0;
|
376 |
+
m_need_update=true;
|
377 |
+
}, next_resume_time);
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* This function will retrieve the last backup message
|
382 |
+
*/
|
383 |
+
function wpvivid_retrieve_last_backup_message(){
|
384 |
+
var ajax_data={
|
385 |
+
'action': 'wpvivid_get_last_backup'
|
386 |
+
};
|
387 |
+
wpvivid_post_request(ajax_data, function(data){
|
388 |
+
try {
|
389 |
+
var jsonarray = jQuery.parseJSON(data);
|
390 |
+
jQuery('#wpvivid_last_backup_msg').html(jsonarray.data);
|
391 |
+
}
|
392 |
+
catch(err){
|
393 |
+
alert(err);
|
394 |
+
}
|
395 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
396 |
+
var error_message = wpvivid_output_ajaxerror('retrieving the last backup log', textStatus, errorThrown);
|
397 |
+
jQuery('#wpvivid_last_backup_msg').html(error_message);
|
398 |
+
});
|
399 |
+
}
|
400 |
+
|
401 |
+
/**
|
402 |
+
* This function will control interface flow.
|
403 |
+
*/
|
404 |
+
function wpvivid_interface_flow_control(){
|
405 |
+
jQuery('#wpvivid_general_email_enable').click(function(){
|
406 |
+
if(jQuery('#wpvivid_general_email_enable').prop('checked') === true){
|
407 |
+
jQuery('#wpvivid_general_email_setting').show();
|
408 |
+
|
409 |
+
}
|
410 |
+
else{
|
411 |
+
jQuery('#wpvivid_general_email_setting').hide();
|
412 |
+
}
|
413 |
+
});
|
414 |
+
|
415 |
+
jQuery("input[name='schedule-backup-files']").bind("click",function(){
|
416 |
+
if(jQuery(this).val() === "custom"){
|
417 |
+
jQuery('#wpvivid_choosed_folders').show();
|
418 |
+
if(jQuery("input[name='wpvivid-schedule-custom-folders'][value='other']").prop('checked')){
|
419 |
+
jQuery('#wpvivid_file_tree_browser').show();
|
420 |
+
}
|
421 |
+
else{
|
422 |
+
jQuery('#wpvivid_file_tree_browser').hide();
|
423 |
+
}
|
424 |
+
}
|
425 |
+
else{
|
426 |
+
jQuery('#wpvivid_choosed_folders').hide();
|
427 |
+
jQuery('#wpvivid_file_tree_browser').hide();
|
428 |
+
}
|
429 |
+
});
|
430 |
+
|
431 |
+
jQuery("input[name='wpvivid-schedule-custom-folders']").bind("click",function(){
|
432 |
+
if(jQuery("input[name='wpvivid-schedule-custom-folders'][value='other']").prop('checked')){
|
433 |
+
jQuery('#wpvivid_file_tree_browser').show();
|
434 |
+
}
|
435 |
+
else{
|
436 |
+
jQuery('#wpvivid_file_tree_browser').hide();
|
437 |
+
}
|
438 |
+
});
|
439 |
+
|
440 |
+
jQuery('#settings-page input[type=checkbox]:not([option=junk-files])').on("change", function(){
|
441 |
+
wpvivid_settings_changed = true;
|
442 |
+
});
|
443 |
+
|
444 |
+
jQuery('#settings-page input[type=radio]').on("change", function(){
|
445 |
+
wpvivid_settings_changed = true;
|
446 |
+
});
|
447 |
+
|
448 |
+
jQuery('#settings-page input[type=text]').on("keyup", function(){
|
449 |
+
wpvivid_settings_changed = true;
|
450 |
+
});
|
451 |
+
|
452 |
+
/*jQuery("#wpvivid_storage_account_block input:not([type=checkbox])").on("keyup", function(){
|
453 |
+
wpvivid_settings_changed = true;
|
454 |
+
});*/
|
455 |
+
|
456 |
+
/*jQuery('#wpvivid_storage_account_block input[type=checkbox]').on("change", function(){
|
457 |
+
wpvivid_settings_changed = true;
|
458 |
+
});*/
|
459 |
+
|
460 |
+
jQuery('input:radio[option=restore]').click(function() {
|
461 |
+
jQuery('input:radio[option=restore]').each(function () {
|
462 |
+
if (jQuery(this).prop('checked')) {
|
463 |
+
jQuery('#wpvivid_restore_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
464 |
+
}
|
465 |
+
});
|
466 |
+
});
|
467 |
+
}
|
468 |
+
|
469 |
+
/**
|
470 |
+
* Manage backup and download tasks. Retrieve the data every 3 seconds for checking if the backup or download tasks exist or not.
|
471 |
+
*/
|
472 |
+
function wpvivid_manage_task() {
|
473 |
+
if(m_need_update === true){
|
474 |
+
m_need_update = false;
|
475 |
+
wpvivid_check_runningtask();
|
476 |
+
}
|
477 |
+
else{
|
478 |
+
setTimeout(function(){
|
479 |
+
wpvivid_manage_task();
|
480 |
+
}, 3000);
|
481 |
+
}
|
482 |
+
}
|
483 |
+
|
484 |
+
function wpvivid_add_notice(notice_action, notice_type, notice_msg){
|
485 |
+
var notice_id="";
|
486 |
+
var tmp_notice_msg = "";
|
487 |
+
if(notice_type === "Warning"){
|
488 |
+
tmp_notice_msg = "Warning: " + notice_msg;
|
489 |
+
}
|
490 |
+
else if(notice_type === "Error"){
|
491 |
+
tmp_notice_msg = "Error: " + notice_msg;
|
492 |
+
}
|
493 |
+
else if(notice_type === "Success"){
|
494 |
+
tmp_notice_msg = "Success: " + notice_msg;
|
495 |
+
}
|
496 |
+
else if(notice_type === "Info"){
|
497 |
+
tmp_notice_msg = notice_msg;
|
498 |
+
}
|
499 |
+
switch(notice_action){
|
500 |
+
case "Backup":
|
501 |
+
notice_id="wpvivid_backup_notice";
|
502 |
+
break;
|
503 |
+
}
|
504 |
+
var bfind = false;
|
505 |
+
$div = jQuery('#'+notice_id).children('div').children('p');
|
506 |
+
$div.each(function (index, value) {
|
507 |
+
if(notice_action === "Backup" && notice_type === "Success"){
|
508 |
+
bfind = false;
|
509 |
+
return false;
|
510 |
+
}
|
511 |
+
if (value.innerHTML === tmp_notice_msg) {
|
512 |
+
bfind = true;
|
513 |
+
return false;
|
514 |
+
}
|
515 |
+
});
|
516 |
+
if (bfind === false) {
|
517 |
+
jQuery('#'+notice_id).show();
|
518 |
+
var div = '';
|
519 |
+
if(notice_type === "Warning"){
|
520 |
+
div = "<div class='notice notice-warning is-dismissible inline'><p>" + wpvividlion.warning + notice_msg + "</p>" +
|
521 |
+
"<button type='button' class='notice-dismiss' onclick='click_dismiss_notice(this);'>" +
|
522 |
+
"<span class='screen-reader-text'>Dismiss this notice.</span>" +
|
523 |
+
"</button>" +
|
524 |
+
"</div>";
|
525 |
+
}
|
526 |
+
else if(notice_type === "Error"){
|
527 |
+
div = "<div class=\"notice notice-error inline\"><p>" + wpvividlion.error + notice_msg + "</p></div>";
|
528 |
+
}
|
529 |
+
else if(notice_type === "Success"){
|
530 |
+
wpvivid_clear_notice('wpvivid_backup_notice');
|
531 |
+
jQuery('#wpvivid_backup_notice').show();
|
532 |
+
var success_msg = wpvivid_completed_backup + " backup tasks have been completed. Please switch to <a href=\"#\" onclick=\"wpvivid_click_switch_page('wrap', 'wpvivid_tab_log', true);\">Log</a> page to check the details.\n";
|
533 |
+
div = "<div class='notice notice-success is-dismissible inline'><p>" + success_msg + "</p>" +
|
534 |
+
"<button type='button' class='notice-dismiss' onclick='click_dismiss_notice(this);'>" +
|
535 |
+
"<span class='screen-reader-text'>Dismiss this notice.</span>" +
|
536 |
+
"</button>" +
|
537 |
+
"</div>";
|
538 |
+
wpvivid_completed_backup++;
|
539 |
+
}
|
540 |
+
else if(notice_type === "Info"){
|
541 |
+
div = "<div class='notice notice-info is-dismissible inline'><p>" + notice_msg + "</p>" +
|
542 |
+
"<button type='button' class='notice-dismiss' onclick='click_dismiss_notice(this);'>" +
|
543 |
+
"<span class='screen-reader-text'>Dismiss this notice.</span>" +
|
544 |
+
"</button>" +
|
545 |
+
"</div>";
|
546 |
+
}
|
547 |
+
jQuery('#'+notice_id).append(div);
|
548 |
+
}
|
549 |
+
}
|
550 |
+
|
551 |
+
function click_dismiss_notice(obj){
|
552 |
+
wpvivid_completed_backup = 1;
|
553 |
+
jQuery(obj).parent().remove();
|
554 |
+
}
|
555 |
+
|
556 |
+
function wpvivid_cron_task(){
|
557 |
+
jQuery.get(wpvivid_siteurl+'/wp-cron.php');
|
558 |
+
}
|
559 |
+
|
560 |
+
function wpvivid_clear_notice(notice_id){
|
561 |
+
var t = document.getElementById(notice_id);
|
562 |
+
var oDiv = t.getElementsByTagName("div");
|
563 |
+
var count = oDiv.length;
|
564 |
+
for (count; count > 0; count--) {
|
565 |
+
var i = count - 1;
|
566 |
+
oDiv[i].parentNode.removeChild(oDiv[i]);
|
567 |
+
}
|
568 |
+
jQuery('#'+notice_id).hide();
|
569 |
+
}
|
570 |
+
|
571 |
+
function wpvivid_click_switch_page(tab, type, scroll)
|
572 |
+
{
|
573 |
+
jQuery('.'+tab+'-tab-content:not(.' + type + ')').hide();
|
574 |
+
jQuery('.'+tab+'-tab-content.' + type).show();
|
575 |
+
jQuery('.'+tab+'-nav-tab:not(#' + type + ')').removeClass('nav-tab-active');
|
576 |
+
jQuery('.'+tab+'-nav-tab#' + type).addClass('nav-tab-active');
|
577 |
+
if(scroll == true){
|
578 |
+
var top = jQuery('#'+type).offset().top-jQuery('#'+type).height();
|
579 |
+
jQuery('html, body').animate({scrollTop:top}, 'slow');
|
580 |
+
}
|
581 |
+
}
|
582 |
+
|
583 |
+
function wpvivid_close_tab(event, hide_tab, type, show_tab){
|
584 |
+
event.stopPropagation();
|
585 |
+
jQuery('#'+hide_tab).hide();
|
586 |
+
if(hide_tab === 'wpvivid_tab_mainwp'){
|
587 |
+
wpvivid_hide_mainwp_tab_page();
|
588 |
+
}
|
589 |
+
wpvivid_click_switch_page(type, show_tab, true);
|
590 |
+
}
|
591 |
+
|
592 |
+
function wpvivid_hide_mainwp_tab_page(){
|
593 |
+
var ajax_data = {
|
594 |
+
'action': 'wpvivid_hide_mainwp_tab_page'
|
595 |
+
};
|
596 |
+
wpvivid_post_request(ajax_data, function(res){
|
597 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
598 |
+
});
|
599 |
+
}
|
600 |
+
|
601 |
+
/**
|
602 |
+
* Output ajax error in a standard format.
|
603 |
+
*
|
604 |
+
* @param action - The specific operation
|
605 |
+
* @param textStatus - The textual status message returned by the server
|
606 |
+
* @param errorThrown - The error message thrown by server
|
607 |
+
*
|
608 |
+
* @returns {string}
|
609 |
+
*/
|
610 |
+
function wpvivid_output_ajaxerror(action, textStatus, errorThrown){
|
611 |
+
action = 'trying to establish communication with your server';
|
612 |
+
var error_msg = "wpvivid_request: "+ textStatus + "(" + errorThrown + "): an error occurred when " + action + ". " +
|
613 |
+
"This error may be request not reaching or server not responding. Please try again later.";
|
614 |
+
//"This error could be caused by an unstable internet connection. Please try again later.";
|
615 |
+
return error_msg;
|
616 |
+
}
|
617 |
+
|
618 |
+
function wpvivid_add_review_info(review){
|
619 |
+
var ajax_data={
|
620 |
+
'action': 'wpvivid_need_review',
|
621 |
+
'review': review
|
622 |
+
};
|
623 |
+
jQuery('#wpvivid_notice_rate').hide();
|
624 |
+
wpvivid_post_request(ajax_data, function(res){
|
625 |
+
if(typeof res != 'undefined' && res != ''){
|
626 |
+
var tempwindow=window.open('_blank');
|
627 |
+
tempwindow.location=res;
|
628 |
+
}
|
629 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
630 |
+
});
|
631 |
+
}
|
632 |
+
|
633 |
+
function wpvivid_click_amazons3_notice(){
|
634 |
+
var ajax_data={
|
635 |
+
'action': 'wpvivid_amazons3_notice'
|
636 |
+
};
|
637 |
+
jQuery('#wpvivid_amazons3_notice').hide();
|
638 |
+
wpvivid_post_request(ajax_data, function(res){
|
639 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
640 |
+
});
|
641 |
+
}
|
642 |
+
|
643 |
+
function wpvivid_ajax_data_transfer(data_type){
|
644 |
+
var json = {};
|
645 |
+
jQuery('input:checkbox[option='+data_type+']').each(function() {
|
646 |
+
var value = '0';
|
647 |
+
var key = jQuery(this).prop('name');
|
648 |
+
if(jQuery(this).prop('checked')) {
|
649 |
+
value = '1';
|
650 |
+
}
|
651 |
+
else {
|
652 |
+
value = '0';
|
653 |
+
}
|
654 |
+
json[key]=value;
|
655 |
+
});
|
656 |
+
jQuery('input:radio[option='+data_type+']').each(function() {
|
657 |
+
if(jQuery(this).prop('checked'))
|
658 |
+
{
|
659 |
+
var key = jQuery(this).prop('name');
|
660 |
+
var value = jQuery(this).prop('value');
|
661 |
+
json[key]=value;
|
662 |
+
}
|
663 |
+
});
|
664 |
+
jQuery('input:text[option='+data_type+']').each(function(){
|
665 |
+
var obj = {};
|
666 |
+
var key = jQuery(this).prop('name');
|
667 |
+
var value = jQuery(this).val();
|
668 |
+
json[key]=value;
|
669 |
+
});
|
670 |
+
jQuery('input:password[option='+data_type+']').each(function(){
|
671 |
+
var obj = {};
|
672 |
+
var key = jQuery(this).prop('name');
|
673 |
+
var value = jQuery(this).val();
|
674 |
+
json[key]=value;
|
675 |
+
});
|
676 |
+
jQuery('select[option='+data_type+']').each(function(){
|
677 |
+
var obj = {};
|
678 |
+
var key = jQuery(this).prop('name');
|
679 |
+
var value = jQuery(this).val();
|
680 |
+
json[key]=value;
|
681 |
+
});
|
682 |
+
return JSON.stringify(json);
|
683 |
+
}
|
trunk/admin/partials/images/Delete.png
ADDED
Binary file
|
trunk/admin/partials/images/Edit.png
ADDED
Binary file
|
trunk/admin/partials/images/Log.png
ADDED
Binary file
|
trunk/admin/partials/images/Restore.png
ADDED
Binary file
|
trunk/admin/partials/images/add-storages.png
ADDED
Binary file
|
trunk/admin/partials/images/delete-tab.png
ADDED
Binary file
|
trunk/admin/partials/images/download.png
ADDED
Binary file
|
trunk/admin/partials/images/export-import.png
ADDED
Binary file
|
trunk/admin/partials/images/locked.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/Fresh-list.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/Fresh-tab.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/Log.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/backup-migration.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/backups-restore.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/debug.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/delete-tab.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/download.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/living-site.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/logs.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/pro.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/remote-storage.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/role-cap.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/schedule.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/settings.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/staging-site.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/staging.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/storage-pcloud(gray).png
ADDED
Binary file
|
trunk/admin/partials/images/staging/storage-pcloud.png
ADDED
Binary file
|
trunk/admin/partials/images/staging/storage-wasabi(gray).png
ADDED
Binary file
|
trunk/admin/partials/images/staging/storage-wasabi.png
ADDED
Binary file
|
trunk/admin/partials/images/storage-amazon-s3(gray).png
ADDED
Binary file
|
trunk/admin/partials/images/storage-amazon-s3.png
ADDED
Binary file
|
trunk/admin/partials/images/storage-digitalocean(gray).png
ADDED
Binary file
|
trunk/admin/partials/images/storage-digitalocean.png
ADDED
Binary file
|
trunk/admin/partials/images/storage-dropbox(gray).png
ADDED
Binary file
|
trunk/admin/partials/images/storage-dropbox.png
ADDED
Binary file
|
trunk/admin/partials/images/storage-ftp(gray).png
ADDED
Binary file
|
trunk/admin/partials/images/storage-ftp.png
ADDED
Binary file
|
trunk/admin/partials/images/storage-local(gray).png
ADDED
Binary file
|
trunk/admin/partials/images/storage-local.png
ADDED
Binary file
|
trunk/admin/partials/images/storage-microsoft-onedrive(gray).png
ADDED
Binary file
|
trunk/admin/partials/images/storage-microsoft-onedrive.png
ADDED
Binary file
|
trunk/admin/partials/images/storage-sftp(gray).png
ADDED
Binary file
|
trunk/admin/partials/images/storage-sftp.png
ADDED
Binary file
|
trunk/admin/partials/images/stroage-google-drive(gray).png
ADDED
Binary file
|
trunk/admin/partials/images/stroage-google-drive.png
ADDED
Binary file
|
trunk/admin/partials/images/unlocked.png
ADDED
Binary file
|
trunk/admin/partials/wpvivid-admin-display.php
ADDED
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Provide a admin area view for the plugin
|
4 |
+
*
|
5 |
+
* This file is used to markup the admin-facing aspects of the plugin.
|
6 |
+
*
|
7 |
+
* @link https://wpvivid.com
|
8 |
+
* @since 0.9.1
|
9 |
+
*
|
10 |
+
* @package WPvivid
|
11 |
+
* @subpackage WPvivid/admin/partials
|
12 |
+
*/
|
13 |
+
|
14 |
+
include_once WPVIVID_PLUGIN_DIR .'/admin/partials/wpvivid-backup-restore-page-display.php';
|
15 |
+
include_once WPVIVID_PLUGIN_DIR .'/admin/partials/wpvivid-remote-storage-page-display.php';
|
16 |
+
include_once WPVIVID_PLUGIN_DIR .'/admin/partials/wpvivid-settings-page-display.php';
|
17 |
+
include_once WPVIVID_PLUGIN_DIR .'/admin/partials/wpvivid-schedule-page-display.php';
|
18 |
+
include_once WPVIVID_PLUGIN_DIR .'/admin/partials/wpvivid-website-info-page-display.php';
|
19 |
+
include_once WPVIVID_PLUGIN_DIR .'/admin/partials/wpvivid-logs-page-display.php';
|
20 |
+
include_once WPVIVID_PLUGIN_DIR .'/admin/partials/wpvivid-log-read-page-display.php';
|
21 |
+
|
22 |
+
if (!defined('WPVIVID_PLUGIN_DIR'))
|
23 |
+
{
|
24 |
+
die;
|
25 |
+
}
|
26 |
+
|
27 |
+
global $wpvivid_plugin;
|
28 |
+
$schedule=WPvivid_Schedule::get_schedule();
|
29 |
+
|
30 |
+
do_action('show_notice');
|
31 |
+
|
32 |
+
?>
|
33 |
+
|
34 |
+
<?php
|
35 |
+
|
36 |
+
$page_array = array();
|
37 |
+
$page_array = apply_filters('wpvivid_add_tab_page', $page_array);
|
38 |
+
foreach ($page_array as $page_name){
|
39 |
+
add_action('wpvivid_backuprestore_add_tab', $page_name['tab_func'], $page_name['index']);
|
40 |
+
add_action('wpvivid_backuprestore_add_page', $page_name['page_func'], $page_name['index']);
|
41 |
+
}
|
42 |
+
|
43 |
+
?>
|
44 |
+
|
45 |
+
<div class="wrap">
|
46 |
+
<h1><?php
|
47 |
+
$plugin_display_name = 'WPvivid Backup Plugin';
|
48 |
+
$plugin_display_name = apply_filters('wpvivid_display_pro_name', $plugin_display_name);
|
49 |
+
echo __('WPvivid Backup Plugin', 'wpvivid-backuprestore');
|
50 |
+
?></h1>
|
51 |
+
<div id="wpvivid_backup_notice">
|
52 |
+
<?php
|
53 |
+
if($schedule['enable'] == true) {
|
54 |
+
if($schedule['backup']['remote'] === 1)
|
55 |
+
{
|
56 |
+
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
57 |
+
$default_remote_storage='';
|
58 |
+
foreach ($remoteslist['remote_selected'] as $value)
|
59 |
+
{
|
60 |
+
$default_remote_storage=$value;
|
61 |
+
}
|
62 |
+
if($default_remote_storage == ''){
|
63 |
+
echo '<div class="notice notice-warning is-dismissible"><p>'.__('Warning: There is no default remote storage available for the scheduled backups, please set up it first.', 'wpvivid-backuprestore').'</p></div>';
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
?>
|
68 |
+
</div>
|
69 |
+
<?php do_action('wpvivid_add_schedule_notice'); ?>
|
70 |
+
<div id="wpvivid_remote_notice"></div>
|
71 |
+
</div>
|
72 |
+
<h2 class="nav-tab-wrapper">
|
73 |
+
<?php
|
74 |
+
do_action('wpvivid_backuprestore_add_tab');
|
75 |
+
?>
|
76 |
+
</h2>
|
77 |
+
<div class="wrap" style="max-width:1720px;">
|
78 |
+
<div id="poststuff" style="padding-top: 0;">
|
79 |
+
<div id="post-body" class="metabox-holder columns-2">
|
80 |
+
<div id="post-body-content">
|
81 |
+
<div class="inside" style="margin-top:0;">
|
82 |
+
<?php
|
83 |
+
do_action('wpvivid_backuprestore_add_page');
|
84 |
+
?>
|
85 |
+
</div>
|
86 |
+
</div>
|
87 |
+
|
88 |
+
<div id="postbox-container-1" class="postbox-container">
|
89 |
+
<div class="meta-box-sortables">
|
90 |
+
<?php
|
91 |
+
$html = '';
|
92 |
+
echo apply_filters('wpvivid_add_side_bar' ,$html, true);
|
93 |
+
?>
|
94 |
+
</div>
|
95 |
+
</div>
|
96 |
+
</div>
|
97 |
+
<br class="clear">
|
98 |
+
</div>
|
99 |
+
</div>
|
100 |
+
|
101 |
+
<script>
|
102 |
+
function switchTabs(evt,contentName) {
|
103 |
+
// Declare all variables
|
104 |
+
var i, tabcontent, tablinks;
|
105 |
+
|
106 |
+
// Get all elements with class="tabcontent" and hide them
|
107 |
+
tabcontent = document.getElementsByClassName("wrap-tab-content");
|
108 |
+
for (i = 0; i < tabcontent.length; i++) {
|
109 |
+
tabcontent[i].style.display = "none";
|
110 |
+
}
|
111 |
+
|
112 |
+
// Get all elements with class="wrap-nav-tab" and remove the class "active"
|
113 |
+
tablinks = document.getElementsByClassName("wrap-nav-tab");
|
114 |
+
for (i = 0; i < tablinks.length; i++) {
|
115 |
+
tablinks[i].className = tablinks[i].className.replace(" nav-tab-active", "");
|
116 |
+
}
|
117 |
+
|
118 |
+
// Show the current tab, and add an "nav-tab-active" class to the button that opened the tab
|
119 |
+
document.getElementById(contentName).style.display = "block";
|
120 |
+
evt.currentTarget.className += " nav-tab-active";
|
121 |
+
jQuery( document ).trigger( 'wpvivid-switch-tabs', contentName );
|
122 |
+
}
|
123 |
+
function switchrestoreTabs(evt,contentName) {
|
124 |
+
// Declare all variables
|
125 |
+
var i, tabcontent, tablinks;
|
126 |
+
|
127 |
+
// Get all elements with class="table-list-content" and hide them
|
128 |
+
tabcontent = document.getElementsByClassName("backup-tab-content");
|
129 |
+
for (i = 0; i < tabcontent.length; i++) {
|
130 |
+
tabcontent[i].style.display = "none";
|
131 |
+
}
|
132 |
+
|
133 |
+
// Get all elements with class="table-nav-tab" and remove the class "nav-tab-active"
|
134 |
+
tablinks = document.getElementsByClassName("backup-nav-tab");
|
135 |
+
for (i = 0; i < tablinks.length; i++) {
|
136 |
+
tablinks[i].className = tablinks[i].className.replace(" nav-tab-active", "");
|
137 |
+
}
|
138 |
+
|
139 |
+
// Show the current tab, and add an "storage-menu-active" class to the button that opened the tab
|
140 |
+
document.getElementById(contentName).style.display = "block";
|
141 |
+
evt.currentTarget.className += " nav-tab-active";
|
142 |
+
}
|
143 |
+
function switchlogTabs(evt,contentName) {
|
144 |
+
// Declare all variables
|
145 |
+
var i, tabcontent, tablinks;
|
146 |
+
|
147 |
+
// Get all elements with class="table-list-content" and hide them
|
148 |
+
tabcontent = document.getElementsByClassName("log-tab-content");
|
149 |
+
for (i = 0; i < tabcontent.length; i++) {
|
150 |
+
tabcontent[i].style.display = "none";
|
151 |
+
}
|
152 |
+
|
153 |
+
// Get all elements with class="table-nav-tab" and remove the class "nav-tab-active"
|
154 |
+
tablinks = document.getElementsByClassName("log-nav-tab");
|
155 |
+
for (i = 0; i < tablinks.length; i++) {
|
156 |
+
tablinks[i].className = tablinks[i].className.replace(" nav-tab-active", "");
|
157 |
+
}
|
158 |
+
|
159 |
+
// Show the current tab, and add an "storage-menu-active" class to the button that opened the tab
|
160 |
+
document.getElementById(contentName).style.display = "block";
|
161 |
+
evt.currentTarget.className += " nav-tab-active";
|
162 |
+
}
|
163 |
+
function switchsettingTabs(evt,contentName) {
|
164 |
+
// Declare all variables
|
165 |
+
var i, tabcontent, tablinks;
|
166 |
+
|
167 |
+
// Get all elements with class="table-list-content" and hide them
|
168 |
+
tabcontent = document.getElementsByClassName("setting-tab-content");
|
169 |
+
for (i = 0; i < tabcontent.length; i++) {
|
170 |
+
tabcontent[i].style.display = "none";
|
171 |
+
}
|
172 |
+
|
173 |
+
// Get all elements with class="table-nav-tab" and remove the class "nav-tab-active"
|
174 |
+
tablinks = document.getElementsByClassName("setting-nav-tab");
|
175 |
+
for (i = 0; i < tablinks.length; i++) {
|
176 |
+
tablinks[i].className = tablinks[i].className.replace(" nav-tab-active", "");
|
177 |
+
}
|
178 |
+
|
179 |
+
// Show the current tab, and add an "storage-menu-active" class to the button that opened the tab
|
180 |
+
document.getElementById(contentName).style.display = "block";
|
181 |
+
evt.currentTarget.className += " nav-tab-active";
|
182 |
+
}
|
183 |
+
function wpvivid_getrequest()
|
184 |
+
{
|
185 |
+
wpvivid_click_switch_page('wrap', wpvivid_page_request, false);
|
186 |
+
}
|
187 |
+
|
188 |
+
function wpvivid_task_monitor()
|
189 |
+
{
|
190 |
+
setTimeout(function () {
|
191 |
+
wpvivid_task_monitor();
|
192 |
+
}, 120000);
|
193 |
+
|
194 |
+
var ajax_data = {
|
195 |
+
'action': 'wpvivid_task_monitor'
|
196 |
+
};
|
197 |
+
|
198 |
+
wpvivid_post_request(ajax_data, function (data)
|
199 |
+
{
|
200 |
+
},function (XMLHttpRequest, textStatus, errorThrown)
|
201 |
+
{
|
202 |
+
});
|
203 |
+
}
|
204 |
+
|
205 |
+
jQuery(document).ready(function ()
|
206 |
+
{
|
207 |
+
wpvivid_getrequest();
|
208 |
+
wpvivid_task_monitor();
|
209 |
+
<?php
|
210 |
+
$default_task_type = array();
|
211 |
+
$default_task_type = apply_filters('wpvivid_get_task_type', $default_task_type);
|
212 |
+
if(empty($default_task_type)){
|
213 |
+
?>
|
214 |
+
wpvivid_activate_cron();
|
215 |
+
wpvivid_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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists( 'WP_List_Table' ) )
|
4 |
+
{
|
5 |
+
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
6 |
+
}
|
7 |
+
|
8 |
+
class WPvivid_Files_List extends WP_List_Table
|
9 |
+
{
|
10 |
+
public $page_num;
|
11 |
+
public $file_list;
|
12 |
+
public $backup_id;
|
13 |
+
|
14 |
+
public function __construct( $args = array() )
|
15 |
+
{
|
16 |
+
parent::__construct(
|
17 |
+
array(
|
18 |
+
'plural' => 'files',
|
19 |
+
'screen' => 'files'
|
20 |
+
)
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
protected function get_table_classes()
|
25 |
+
{
|
26 |
+
return array( 'widefat striped' );
|
27 |
+
}
|
28 |
+
|
29 |
+
public function print_column_headers( $with_id = true )
|
30 |
+
{
|
31 |
+
list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
|
32 |
+
|
33 |
+
if (!empty($columns['cb'])) {
|
34 |
+
static $cb_counter = 1;
|
35 |
+
$columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __('Select All') . '</label>'
|
36 |
+
. '<input id="cb-select-all-' . $cb_counter . '" type="checkbox"/>';
|
37 |
+
$cb_counter++;
|
38 |
+
}
|
39 |
+
|
40 |
+
foreach ( $columns as $column_key => $column_display_name )
|
41 |
+
{
|
42 |
+
$class = array( 'manage-column', "column-$column_key" );
|
43 |
+
|
44 |
+
if ( in_array( $column_key, $hidden ) )
|
45 |
+
{
|
46 |
+
$class[] = 'hidden';
|
47 |
+
}
|
48 |
+
|
49 |
+
if ( $column_key === $primary )
|
50 |
+
{
|
51 |
+
$class[] = 'column-primary';
|
52 |
+
}
|
53 |
+
|
54 |
+
if ( $column_key === 'cb' )
|
55 |
+
{
|
56 |
+
$class[] = 'check-column';
|
57 |
+
}
|
58 |
+
|
59 |
+
$tag = ( 'cb' === $column_key ) ? 'td' : 'th';
|
60 |
+
$scope = ( 'th' === $tag ) ? 'scope="col"' : '';
|
61 |
+
$id = $with_id ? "id='$column_key'" : '';
|
62 |
+
|
63 |
+
if ( ! empty( $class ) )
|
64 |
+
{
|
65 |
+
$class = "class='" . join( ' ', $class ) . "'";
|
66 |
+
}
|
67 |
+
|
68 |
+
echo "<$tag $scope $id $class>$column_display_name</$tag>";
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
public function get_columns()
|
73 |
+
{
|
74 |
+
$columns = array();
|
75 |
+
$columns['wpvivid_file'] = __( 'File', 'wpvivid' );
|
76 |
+
return $columns;
|
77 |
+
}
|
78 |
+
|
79 |
+
public function _column_wpvivid_file( $file )
|
80 |
+
{
|
81 |
+
$html='<td class="tablelistcolumn">
|
82 |
+
<div style="padding:0 0 10px 0;">
|
83 |
+
<span>'. $file['key'].'</span>
|
84 |
+
</div>
|
85 |
+
<div class="wpvivid-download-status" style="padding:0;">';
|
86 |
+
if($file['status']=='completed')
|
87 |
+
{
|
88 |
+
$html.='<span>'.__('File Size: ', 'wpvivid').'</span><span class="wpvivid-element-space-right wpvivid-download-file-size">'.$file['size'].'</span><span class="wpvivid-element-space-right">|</span><span class=" wpvivid-element-space-right wpvivid-ready-download"><a style="cursor: pointer;">Download</a></span>';
|
89 |
+
}
|
90 |
+
else if($file['status']=='file_not_found')
|
91 |
+
{
|
92 |
+
$html.='<span>' . __('File not found', 'wpvivid') . '</span>';
|
93 |
+
}
|
94 |
+
else if($file['status']=='need_download')
|
95 |
+
{
|
96 |
+
$html.='<span>'.__('File Size: ', 'wpvivid').'</span><span class="wpvivid-element-space-right wpvivid-download-file-size">'.$file['size'].'</span><span class="wpvivid-element-space-right">|</span><span class="wpvivid-element-space-right"><a class="wpvivid-download" style="cursor: pointer;">Prepare to Download</a></span>';
|
97 |
+
}
|
98 |
+
else if($file['status']=='running')
|
99 |
+
{
|
100 |
+
$html.='<div class="wpvivid-element-space-bottom">
|
101 |
+
<span class="wpvivid-element-space-right">Retriving (remote storage to web server)</span><span class="wpvivid-element-space-right">|</span><span>File Size: </span><span class="wpvivid-element-space-right wpvivid-download-file-size">'.$file['size'].'</span><span class="wpvivid-element-space-right">|</span><span>Downloaded Size: </span><span>'.$file['downloaded_size'].'</span>
|
102 |
+
</div>
|
103 |
+
<div style="width:100%;height:10px; background-color:#dcdcdc;">
|
104 |
+
<div style="background-color:#0085ba; float:left;width:'.$file['progress_text'].'%;height:10px;"></div>
|
105 |
+
</div>';
|
106 |
+
}
|
107 |
+
else if($file['status']=='timeout')
|
108 |
+
{
|
109 |
+
$html.='<div class="wpvivid-element-space-bottom">
|
110 |
+
<span>Download timeout, please retry.</span>
|
111 |
+
</div>
|
112 |
+
<div>
|
113 |
+
<span>'.__('File Size: ', 'wpvivid').'</span><span class="wpvivid-element-space-right wpvivid-download-file-size">'.$file['size'].'</span><span class="wpvivid-element-space-right">|</span><span class="wpvivid-element-space-right"><a class="wpvivid-download" style="cursor: pointer;">Prepare to Download</a></span>
|
114 |
+
</div>';
|
115 |
+
}
|
116 |
+
else if($file['status']=='error')
|
117 |
+
{
|
118 |
+
$html.='<div class="wpvivid-element-space-bottom">
|
119 |
+
<span>'.$file['error'].'</span>
|
120 |
+
</div>
|
121 |
+
<div>
|
122 |
+
<span>'.__('File Size: ', 'wpvivid').'</span><span class="wpvivid-element-space-right wpvivid-download-file-size">'.$file['size'].'</span><span class="wpvivid-element-space-right">|</span><span class="wpvivid-element-space-right"><a class="wpvivid-download" style="cursor: pointer;">Prepare to Download</a></span>
|
123 |
+
</div>';
|
124 |
+
}
|
125 |
+
|
126 |
+
$html.='</div></td>';
|
127 |
+
echo $html;
|
128 |
+
//size
|
129 |
+
}
|
130 |
+
|
131 |
+
public function set_files_list($file_list,$backup_id,$page_num=1)
|
132 |
+
{
|
133 |
+
$this->file_list=$file_list;
|
134 |
+
$this->backup_id=$backup_id;
|
135 |
+
$this->page_num=$page_num;
|
136 |
+
}
|
137 |
+
|
138 |
+
public function get_pagenum()
|
139 |
+
{
|
140 |
+
if($this->page_num=='first')
|
141 |
+
{
|
142 |
+
$this->page_num=1;
|
143 |
+
}
|
144 |
+
else if($this->page_num=='last')
|
145 |
+
{
|
146 |
+
$this->page_num=$this->_pagination_args['total_pages'];
|
147 |
+
}
|
148 |
+
$pagenum = $this->page_num ? $this->page_num : 0;
|
149 |
+
|
150 |
+
if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] )
|
151 |
+
{
|
152 |
+
$pagenum = $this->_pagination_args['total_pages'];
|
153 |
+
}
|
154 |
+
|
155 |
+
return max( 1, $pagenum );
|
156 |
+
}
|
157 |
+
|
158 |
+
public function prepare_items()
|
159 |
+
{
|
160 |
+
$columns = $this->get_columns();
|
161 |
+
$hidden = array();
|
162 |
+
$sortable = array();
|
163 |
+
$this->_column_headers = array($columns, $hidden, $sortable);
|
164 |
+
|
165 |
+
$total_items =sizeof($this->file_list);
|
166 |
+
|
167 |
+
$this->set_pagination_args(
|
168 |
+
array(
|
169 |
+
'total_items' => $total_items,
|
170 |
+
'per_page' => 10,
|
171 |
+
)
|
172 |
+
);
|
173 |
+
}
|
174 |
+
|
175 |
+
public function has_items()
|
176 |
+
{
|
177 |
+
return !empty($this->file_list);
|
178 |
+
}
|
179 |
+
|
180 |
+
public function display_rows()
|
181 |
+
{
|
182 |
+
$this->_display_rows($this->file_list);
|
183 |
+
}
|
184 |
+
|
185 |
+
private function _display_rows($file_list)
|
186 |
+
{
|
187 |
+
$page=$this->get_pagenum();
|
188 |
+
|
189 |
+
$page_file_list=array();
|
190 |
+
$count=0;
|
191 |
+
while ( $count<$page )
|
192 |
+
{
|
193 |
+
$page_file_list = array_splice( $file_list, 0, 10);
|
194 |
+
$count++;
|
195 |
+
}
|
196 |
+
foreach ( $page_file_list as $key=>$file)
|
197 |
+
{
|
198 |
+
$file['key']=$key;
|
199 |
+
$this->single_row($file);
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
public function single_row($file)
|
204 |
+
{
|
205 |
+
?>
|
206 |
+
<tr slug="<?php echo $file['key']?>">
|
207 |
+
<?php $this->single_row_columns( $file ); ?>
|
208 |
+
</tr>
|
209 |
+
<?php
|
210 |
+
}
|
211 |
+
|
212 |
+
protected function pagination( $which )
|
213 |
+
{
|
214 |
+
if ( empty( $this->_pagination_args ) )
|
215 |
+
{
|
216 |
+
return;
|
217 |
+
}
|
218 |
+
|
219 |
+
$total_items = $this->_pagination_args['total_items'];
|
220 |
+
$total_pages = $this->_pagination_args['total_pages'];
|
221 |
+
$infinite_scroll = false;
|
222 |
+
if ( isset( $this->_pagination_args['infinite_scroll'] ) )
|
223 |
+
{
|
224 |
+
$infinite_scroll = $this->_pagination_args['infinite_scroll'];
|
225 |
+
}
|
226 |
+
|
227 |
+
if ( 'top' === $which && $total_pages > 1 )
|
228 |
+
{
|
229 |
+
$this->screen->render_screen_reader_content( 'heading_pagination' );
|
230 |
+
}
|
231 |
+
|
232 |
+
$output = '<span class="displaying-num">' . sprintf( _n( '%s item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
|
233 |
+
|
234 |
+
$current = $this->get_pagenum();
|
235 |
+
|
236 |
+
$page_links = array();
|
237 |
+
|
238 |
+
$total_pages_before = '<span class="paging-input">';
|
239 |
+
$total_pages_after = '</span></span>';
|
240 |
+
|
241 |
+
$disable_first = $disable_last = $disable_prev = $disable_next = false;
|
242 |
+
|
243 |
+
if ( $current == 1 ) {
|
244 |
+
$disable_first = true;
|
245 |
+
$disable_prev = true;
|
246 |
+
}
|
247 |
+
if ( $current == 2 ) {
|
248 |
+
$disable_first = true;
|
249 |
+
}
|
250 |
+
if ( $current == $total_pages ) {
|
251 |
+
$disable_last = true;
|
252 |
+
$disable_next = true;
|
253 |
+
}
|
254 |
+
if ( $current == $total_pages - 1 ) {
|
255 |
+
$disable_last = true;
|
256 |
+
}
|
257 |
+
|
258 |
+
if ( $disable_first ) {
|
259 |
+
$page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">«</span>';
|
260 |
+
} else {
|
261 |
+
$page_links[] = sprintf(
|
262 |
+
"<div class='first-page button'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></div>",
|
263 |
+
__( 'First page' ),
|
264 |
+
'«'
|
265 |
+
);
|
266 |
+
}
|
267 |
+
|
268 |
+
if ( $disable_prev ) {
|
269 |
+
$page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">‹</span>';
|
270 |
+
} else {
|
271 |
+
$page_links[] = sprintf(
|
272 |
+
"<div class='prev-page button' value='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></div>",
|
273 |
+
$current,
|
274 |
+
__( 'Previous page' ),
|
275 |
+
'‹'
|
276 |
+
);
|
277 |
+
}
|
278 |
+
|
279 |
+
if ( 'bottom' === $which ) {
|
280 |
+
$html_current_page = $current;
|
281 |
+
$total_pages_before = '<span class="screen-reader-text">' . __( 'Current Page' ) . '</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">';
|
282 |
+
} else {
|
283 |
+
$html_current_page = sprintf(
|
284 |
+
"%s<input class='current-page' id='current-page-selector-filelist' type='text' name='paged' value='%s' size='%d' aria-describedby='table-paging' /><span class='tablenav-paging-text'>",
|
285 |
+
'<label for="current-page-selector-filelist" class="screen-reader-text">' . __( 'Current Page' ) . '</label>',
|
286 |
+
$current,
|
287 |
+
strlen( $total_pages )
|
288 |
+
);
|
289 |
+
}
|
290 |
+
$html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
|
291 |
+
$page_links[] = $total_pages_before . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . $total_pages_after;
|
292 |
+
|
293 |
+
if ( $disable_next ) {
|
294 |
+
$page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">›</span>';
|
295 |
+
} else {
|
296 |
+
$page_links[] = sprintf(
|
297 |
+
"<div class='next-page button' value='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></div>",
|
298 |
+
$current,
|
299 |
+
__( 'Next page' ),
|
300 |
+
'›'
|
301 |
+
);
|
302 |
+
}
|
303 |
+
|
304 |
+
if ( $disable_last ) {
|
305 |
+
$page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">»</span>';
|
306 |
+
} else {
|
307 |
+
$page_links[] = sprintf(
|
308 |
+
"<div class='last-page button'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></div>",
|
309 |
+
__( 'Last page' ),
|
310 |
+
'»'
|
311 |
+
);
|
312 |
+
}
|
313 |
+
|
314 |
+
$pagination_links_class = 'pagination-links';
|
315 |
+
if ( ! empty( $infinite_scroll ) ) {
|
316 |
+
$pagination_links_class .= ' hide-if-js';
|
317 |
+
}
|
318 |
+
$output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
|
319 |
+
|
320 |
+
if ( $total_pages ) {
|
321 |
+
$page_class = $total_pages < 2 ? ' one-page' : '';
|
322 |
+
} else {
|
323 |
+
$page_class = ' no-pages';
|
324 |
+
}
|
325 |
+
$this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
|
326 |
+
|
327 |
+
echo $this->_pagination;
|
328 |
+
}
|
329 |
+
|
330 |
+
protected function display_tablenav( $which ) {
|
331 |
+
$css_type = '';
|
332 |
+
if ( 'top' === $which ) {
|
333 |
+
wp_nonce_field( 'bulk-' . $this->_args['plural'] );
|
334 |
+
$css_type = 'margin: 0 0 10px 0';
|
335 |
+
}
|
336 |
+
else if( 'bottom' === $which ) {
|
337 |
+
$css_type = 'margin: 10px 0 0 0';
|
338 |
+
}
|
339 |
+
|
340 |
+
$total_pages = $this->_pagination_args['total_pages'];
|
341 |
+
if ( $total_pages >1)
|
342 |
+
{
|
343 |
+
?>
|
344 |
+
<div class="tablenav <?php echo esc_attr( $which ); ?>" style="<?php esc_attr_e($css_type); ?>">
|
345 |
+
<?php
|
346 |
+
$this->extra_tablenav( $which );
|
347 |
+
$this->pagination( $which );
|
348 |
+
?>
|
349 |
+
|
350 |
+
<br class="clear" />
|
351 |
+
</div>
|
352 |
+
<?php
|
353 |
+
}
|
354 |
+
}
|
355 |
+
|
356 |
+
public function display()
|
357 |
+
{
|
358 |
+
$singular = $this->_args['singular'];
|
359 |
+
|
360 |
+
$this->display_tablenav( 'top' );
|
361 |
+
|
362 |
+
$this->screen->render_screen_reader_content( 'heading_list' );
|
363 |
+
?>
|
364 |
+
<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
|
365 |
+
<thead>
|
366 |
+
<tr>
|
367 |
+
<?php $this->print_column_headers(); ?>
|
368 |
+
</tr>
|
369 |
+
</thead>
|
370 |
+
|
371 |
+
<tbody id="the-list"
|
372 |
+
<?php
|
373 |
+
if ( $singular ) {
|
374 |
+
echo " data-wp-lists='list:$singular'";
|
375 |
+
}
|
376 |
+
?>
|
377 |
+
>
|
378 |
+
<?php $this->display_rows_or_placeholder(); ?>
|
379 |
+
</tbody>
|
380 |
+
|
381 |
+
</table>
|
382 |
+
<?php
|
383 |
+
$this->display_tablenav( 'bottom' );
|
384 |
+
}
|
385 |
+
}
|
386 |
+
|
387 |
+
|
388 |
+
function wpvivid_add_backup_type($html, $type_name)
|
389 |
+
{
|
390 |
+
$html .= '<label>
|
391 |
+
<input type="radio" option="backup" name="'.$type_name.'" value="files+db" checked />
|
392 |
+
<span>'.__( 'Database + Files (WordPress Files)', 'wpvivid-backuprestore' ).'</span>
|
393 |
+
</label><br>
|
394 |
+
<label>
|
395 |
+
<input type="radio" option="backup" name="'.$type_name.'" value="files" />
|
396 |
+
<span>'.__( 'WordPress Files (Exclude Database)', 'wpvivid-backuprestore' ).'</span>
|
397 |
+
</label><br>
|
398 |
+
<label>
|
399 |
+
<input type="radio" option="backup" name="'.$type_name.'" value="db" />
|
400 |
+
<span>'.__( 'Only Database', 'wpvivid-backuprestore' ).'</span>
|
401 |
+
</label><br>
|
402 |
+
<label>
|
403 |
+
<div style="float: left;">
|
404 |
+
<input type="radio" disabled />
|
405 |
+
<span class="wpvivid-element-space-right" style="color: #ddd;">'.__('Create a staging site', 'wpvivid-backuprestore').'</span>
|
406 |
+
</div>
|
407 |
+
<span class="wpvivid-feature-pro">
|
408 |
+
<a href="https://docs.wpvivid.com/wpvivid-backup-pro-create-staging-site.html" style="text-decoration: none;">'.__('Pro feature: learn more', 'wpvivid-backuprestore').'</a>
|
409 |
+
</span>
|
410 |
+
</label><br>
|
411 |
+
<label>
|
412 |
+
<div style="float: left;">
|
413 |
+
<input type="radio" disabled />
|
414 |
+
<span class="wpvivid-element-space-right" style="color: #ddd;">'.__('Custom', 'wpvivid-backuprestore').'</span>
|
415 |
+
</div>
|
416 |
+
<span class="wpvivid-feature-pro">
|
417 |
+
<a href="https://docs.wpvivid.com/wpvivid-backup-pro-overview.html" style="text-decoration: none;">'.__('Pro feature: learn more', 'wpvivid-backuprestore').'</a>
|
418 |
+
</span>
|
419 |
+
</label><br>';
|
420 |
+
return $html;
|
421 |
+
}
|
422 |
+
|
423 |
+
function wpvivid_backup_do_js(){
|
424 |
+
global $wpvivid_plugin;
|
425 |
+
$backup_task = array();
|
426 |
+
$backup_task=$wpvivid_plugin->_list_tasks($backup_task, false);
|
427 |
+
$general_setting=WPvivid_Setting::get_setting(true, "");
|
428 |
+
if($general_setting['options']['wpvivid_common_setting']['estimate_backup'] == 0){
|
429 |
+
?>
|
430 |
+
jQuery('#wpvivid_estimate_backup_info').hide();
|
431 |
+
<?php
|
432 |
+
}
|
433 |
+
if(empty($backup_task['backup']['data'])){
|
434 |
+
?>
|
435 |
+
jQuery('#wpvivid_postbox_backup_percent').hide();
|
436 |
+
jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
437 |
+
jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
438 |
+
<?php
|
439 |
+
}
|
440 |
+
else{
|
441 |
+
foreach($backup_task['backup']['data'] as $key=>$value){
|
442 |
+
if($value['status']['str'] === 'running'){
|
443 |
+
$percent=$value['data']['progress'];
|
444 |
+
?>
|
445 |
+
jQuery('#wpvivid_postbox_backup_percent').show();
|
446 |
+
jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
447 |
+
jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
448 |
+
jQuery('#wpvivid_action_progress_bar_percent').css('width', <?php echo $percent; ?>+'%');
|
449 |
+
jQuery('#wpvivid_backup_database_size').html('<?php echo $value['size']['db_size']; ?>');
|
450 |
+
jQuery('#wpvivid_backup_file_size').html('<?php echo $value['size']['files_size']['sum']; ?>');
|
451 |
+
<?php
|
452 |
+
if($value['is_canceled'] == false){
|
453 |
+
$descript=$value['data']['descript'];
|
454 |
+
if($value['data']['type']){
|
455 |
+
$find_str = 'Total size: ';
|
456 |
+
if(stripos($descript, $find_str) != false) {
|
457 |
+
$pos = stripos($descript, $find_str);
|
458 |
+
$descript = substr($descript, 0, $pos);
|
459 |
+
}
|
460 |
+
}
|
461 |
+
$backup_running_time=$value['data']['running_stamp'];
|
462 |
+
$output = '';
|
463 |
+
foreach (array(86400 => 'day', 3600 => 'hour', 60 => 'min', 1 => 'second') as $key => $value) {
|
464 |
+
if ($backup_running_time >= $key) $output .= floor($backup_running_time/$key) . $value;
|
465 |
+
$backup_running_time %= $key;
|
466 |
+
}
|
467 |
+
if($output==''){
|
468 |
+
$output=0;
|
469 |
+
}
|
470 |
+
?>
|
471 |
+
jQuery('#wpvivid_current_doing').html('<?php echo $descript; ?> Progress: <?php echo $percent; ?>%, running time: <?php echo $output; ?>');
|
472 |
+
<?php
|
473 |
+
}
|
474 |
+
else{
|
475 |
+
?>
|
476 |
+
jQuery('#wpvivid_current_doing').html('The backup will be canceled after backing up the current chunk ends.');
|
477 |
+
<?php
|
478 |
+
}
|
479 |
+
}
|
480 |
+
}
|
481 |
+
}
|
482 |
+
}
|
483 |
+
|
484 |
+
function wpvivid_download_backup_descript($html){
|
485 |
+
$html = '<p><strong>'.__('About backup download', 'wpvivid-backuprestore').'</strong></p>';
|
486 |
+
$html .= '<ul>';
|
487 |
+
$html .= '<li>'.__('->If backups are stored in remote storage, our plugin will retrieve the backup to your web server first. This may take a little time depending on the size of backup files. Please be patient. Then you can download them to your PC.', 'wpvivid-backuprestore').'</li>';
|
488 |
+
$html .= '<li>'.__('->If backups are stored in web server, the plugin will list all relevant files immediately.', 'wpvivid-backuprestore').'</li>';
|
489 |
+
$html .= '</ul>';
|
490 |
+
return $html;
|
491 |
+
}
|
492 |
+
|
493 |
+
function wpvivid_restore_website_descript($html){
|
494 |
+
$html = '<p><a href="#" id="wpvivid_how_to_restore_backup_describe" onclick="wpvivid_click_how_to_restore_backup();" style="text-decoration: none;">'.__('How to restore your website from a backup(scheduled, manual, uploaded and received backup)', 'wpvivid-backuprestore').'</a></p>';
|
495 |
+
$html .= '<div id="wpvivid_how_to_restore_backup"></div>';
|
496 |
+
return $html;
|
497 |
+
}
|
498 |
+
|
499 |
+
function wpvivid_backuppage_load_backuplist($backuplist_array){
|
500 |
+
$backuplist_array['list_backup'] = array('index' => '1', 'tab_func' => 'wpvivid_backuppage_add_tab_backup', 'page_func' => 'wpvivid_backuppage_add_page_backup');
|
501 |
+
$backuplist_array['list_log'] = array('index' => '3', 'tab_func' => 'wpvivid_backuppage_add_tab_log', 'page_func' => 'wpvivid_backuppage_add_page_log');
|
502 |
+
$backuplist_array['list_restore'] = array('index' => '4', 'tab_func' => 'wpvivid_backuppage_add_tab_restore', 'page_func' => 'wpvivid_backuppage_add_page_restore');
|
503 |
+
$backuplist_array['list_download'] = array('index' => '5', 'tab_func' => 'wpvivid_backuppage_add_tab_downlaod', 'page_func' => 'wpvivid_backuppage_add_page_downlaod');
|
504 |
+
return $backuplist_array;
|
505 |
+
}
|
506 |
+
|
507 |
+
function wpvivid_backuppage_add_tab_backup(){
|
508 |
+
?>
|
509 |
+
<a href="#" id="wpvivid_tab_backup" class="nav-tab backup-nav-tab nav-tab-active" onclick="switchrestoreTabs(event,'page-backups')"><?php _e('Backups', 'wpvivid-backuprestore'); ?></a>
|
510 |
+
<?php
|
511 |
+
}
|
512 |
+
|
513 |
+
function wpvivid_backuppage_add_tab_log(){
|
514 |
+
?>
|
515 |
+
<a href="#" id="wpvivid_tab_backup_log" class="nav-tab backup-nav-tab delete" onclick="switchrestoreTabs(event,'page-log')" style="display: none;">
|
516 |
+
<div style="margin-right: 15px;"><?php _e('Log', 'wpvivid-backuprestore'); ?></div>
|
517 |
+
<div class="nav-tab-delete-img">
|
518 |
+
<img src="<?php echo esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_tab(event, 'wpvivid_tab_backup_log', 'backup', 'wpvivid_tab_backup');" />
|
519 |
+
</div>
|
520 |
+
</a>
|
521 |
+
<?php
|
522 |
+
}
|
523 |
+
|
524 |
+
function wpvivid_backuppage_add_tab_restore(){
|
525 |
+
?>
|
526 |
+
<a href="#" id="wpvivid_tab_restore" class="nav-tab backup-nav-tab delete" onclick="switchrestoreTabs(event,'page-restore')" style="display: none;">
|
527 |
+
<div style="margin-right: 15px;"><?php _e('Restore', 'wpvivid-backuprestore'); ?></div>
|
528 |
+
<div class="nav-tab-delete-img">
|
529 |
+
<img src="<?php echo esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_tab(event, 'wpvivid_tab_restore', 'backup', 'wpvivid_tab_backup');" />
|
530 |
+
</div>
|
531 |
+
</a>
|
532 |
+
<?php
|
533 |
+
}
|
534 |
+
|
535 |
+
function wpvivid_backuppage_add_tab_downlaod(){
|
536 |
+
?>
|
537 |
+
<a href="#" id="wpvivid_tab_download" class="nav-tab backup-nav-tab delete" onclick="switchrestoreTabs(event,'page-download')" style="display: none;">
|
538 |
+
<div style="margin-right: 15px;"><?php _e('Download', 'wpvivid-backuprestore'); ?></div>
|
539 |
+
<div class="nav-tab-delete-img">
|
540 |
+
<img src="<?php echo esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_tab(event, 'wpvivid_tab_download', 'backup', 'wpvivid_tab_backup');" />
|
541 |
+
</div>
|
542 |
+
</a>
|
543 |
+
<?php
|
544 |
+
}
|
545 |
+
|
546 |
+
function wpvivid_backuppage_add_page_backup(){
|
547 |
+
$backuplist=WPvivid_Backuplist::get_backuplist();
|
548 |
+
$display_backup_count = WPvivid_Setting::get_max_backup_count();
|
549 |
+
?>
|
550 |
+
<div class="backup-tab-content wpvivid_tab_backup" id="page-backups">
|
551 |
+
<div style="margin-top:10px; margin-bottom:10px;">
|
552 |
+
<?php
|
553 |
+
$descript='';
|
554 |
+
$descript= apply_filters('wpvivid_download_backup_descript',$descript);
|
555 |
+
echo $descript;
|
556 |
+
?>
|
557 |
+
</div>
|
558 |
+
<div style="margin-bottom:10px;">
|
559 |
+
<?php
|
560 |
+
$descript='';
|
561 |
+
$descript= apply_filters('wpvivid_restore_website_descript',$descript);
|
562 |
+
echo $descript;
|
563 |
+
?>
|
564 |
+
</div>
|
565 |
+
<div style="clear:both;"></div>
|
566 |
+
<?php
|
567 |
+
do_action('wpvivid_rescan_backup_list');
|
568 |
+
?>
|
569 |
+
<table class="wp-list-table widefat plugins" id="wpvivid_backuplist_table" style="border-collapse: collapse;">
|
570 |
+
<thead>
|
571 |
+
<tr class="backup-list-head" style="border-bottom: 0;">
|
572 |
+
<td></td>
|
573 |
+
<th><?php _e( 'Backup','wpvivid-backuprestore'); ?></th>
|
574 |
+
<th><?php _e( 'Storage','wpvivid-backuprestore'); ?></th>
|
575 |
+
<th><?php _e( 'Download','wpvivid-backuprestore'); ?></th>
|
576 |
+
<th><?php _e( 'Restore', 'wpvivid-backuprestore'); ?></th>
|
577 |
+
<th><?php _e( 'Delete','wpvivid-backuprestore'); ?></th>
|
578 |
+
</tr>
|
579 |
+
</thead>
|
580 |
+
<tbody class="wpvivid-backuplist" id="wpvivid_backup_list">
|
581 |
+
<?php
|
582 |
+
$html = '';
|
583 |
+
$html = apply_filters('wpvivid_add_backup_list', $html);
|
584 |
+
echo $html;
|
585 |
+
?>
|
586 |
+
</tbody>
|
587 |
+
<tfoot>
|
588 |
+
<tr>
|
589 |
+
<th><input name="" type="checkbox" id="backup_list_all_check" value="1" /></th>
|
590 |
+
<th class="row-title" colspan="5"><a onclick="wpvivid_delete_backups_inbatches();" style="cursor: pointer;"><?php _e('Delete the selected backups', 'wpvivid-backuprestore'); ?></a></th>
|
591 |
+
</tr>
|
592 |
+
</tfoot>
|
593 |
+
</table>
|
594 |
+
</div>
|
595 |
+
<script>
|
596 |
+
function wpvivid_retrieve_backup_list(){
|
597 |
+
var ajax_data = {
|
598 |
+
'action': 'wpvivid_get_backup_list'
|
599 |
+
};
|
600 |
+
wpvivid_post_request(ajax_data, function(data){
|
601 |
+
try {
|
602 |
+
var jsonarray = jQuery.parseJSON(data);
|
603 |
+
if (jsonarray.result === 'success') {
|
604 |
+
jQuery('#wpvivid_backup_list').html('');
|
605 |
+
jQuery('#wpvivid_backup_list').append(jsonarray.html);
|
606 |
+
}
|
607 |
+
}
|
608 |
+
catch(err){
|
609 |
+
alert(err);
|
610 |
+
}
|
611 |
+
},function(XMLHttpRequest, textStatus, errorThrown) {
|
612 |
+
setTimeout(function () {
|
613 |
+
wpvivid_retrieve_backup_list();
|
614 |
+
}, 3000);
|
615 |
+
});
|
616 |
+
}
|
617 |
+
|
618 |
+
function wpvivid_handle_backup_data(data){
|
619 |
+
try {
|
620 |
+
var jsonarray = jQuery.parseJSON(data);
|
621 |
+
if (jsonarray.result === 'success') {
|
622 |
+
jQuery('#wpvivid_backup_list').html('');
|
623 |
+
jQuery('#wpvivid_backup_list').append(jsonarray.html);
|
624 |
+
}
|
625 |
+
else if(jsonarray.result === 'failed'){
|
626 |
+
alert(jsonarray.error);
|
627 |
+
}
|
628 |
+
}
|
629 |
+
catch(err){
|
630 |
+
alert(err);
|
631 |
+
}
|
632 |
+
}
|
633 |
+
|
634 |
+
function wpvivid_click_check_backup(backup_id, list_name){
|
635 |
+
var name = "";
|
636 |
+
var all_check = true;
|
637 |
+
jQuery('#'+list_name+' tr').each(function (i) {
|
638 |
+
jQuery(this).children('th').each(function (j) {
|
639 |
+
if(j === 0) {
|
640 |
+
var id = jQuery(this).find("input[type=checkbox]").attr("id");
|
641 |
+
if (id === backup_id) {
|
642 |
+
name = jQuery(this).parent().children('td').eq(0).find("img").attr("name");
|
643 |
+
if (name === "unlock") {
|
644 |
+
if (jQuery(this).find("input[type=checkbox]").prop('checked') === false) {
|
645 |
+
all_check = false;
|
646 |
+
}
|
647 |
+
}
|
648 |
+
else {
|
649 |
+
jQuery(this).find("input[type=checkbox]").prop('checked', false);
|
650 |
+
all_check = false;
|
651 |
+
}
|
652 |
+
}
|
653 |
+
else {
|
654 |
+
if (jQuery(this).find("input[type=checkbox]").prop('checked') === false) {
|
655 |
+
all_check = false;
|
656 |
+
}
|
657 |
+
}
|
658 |
+
}
|
659 |
+
});
|
660 |
+
});
|
661 |
+
if(all_check === true){
|
662 |
+
jQuery('#backup_list_all_check').prop('checked', true);
|
663 |
+
}
|
664 |
+
else{
|
665 |
+
jQuery('#backup_list_all_check').prop('checked', false);
|
666 |
+
}
|
667 |
+
}
|
668 |
+
|
669 |
+
function wpvivid_set_backup_lock(backup_id, lock_status){
|
670 |
+
var max_count_limit = '<?php echo $display_backup_count; ?>';
|
671 |
+
var check_status = true;
|
672 |
+
if(lock_status === "lock"){
|
673 |
+
var lock=0;
|
674 |
+
}
|
675 |
+
else{
|
676 |
+
var lock=1;
|
677 |
+
var check_can_lock=false;
|
678 |
+
var baackup_list_count = jQuery('#wpvivid_backup_list').find('tr').length;
|
679 |
+
if(baackup_list_count >= max_count_limit) {
|
680 |
+
jQuery('#wpvivid_backup_list').find('tr').find('td:eq(0)').find('span:eq(0)').each(function () {
|
681 |
+
var span_id = jQuery(this).attr('id');
|
682 |
+
span_id = span_id.replace('wpvivid_lock_', '');
|
683 |
+
if (span_id !== backup_id) {
|
684 |
+
var name = jQuery(this).find('img:eq(0)').attr('name');
|
685 |
+
if (name === 'unlock') {
|
686 |
+
check_can_lock = true;
|
687 |
+
return false;
|
688 |
+
}
|
689 |
+
}
|
690 |
+
});
|
691 |
+
if (!check_can_lock) {
|
692 |
+
check_status = false;
|
693 |
+
alert('The locked backups will reach the maximum limits of retained backups, which causes being unable to create a new backup. So, please unlock one of them and continue.');
|
694 |
+
}
|
695 |
+
}
|
696 |
+
}
|
697 |
+
if(check_status) {
|
698 |
+
var ajax_data = {
|
699 |
+
'action': 'wpvivid_set_security_lock',
|
700 |
+
'backup_id': backup_id,
|
701 |
+
'lock': lock
|
702 |
+
};
|
703 |
+
wpvivid_post_request(ajax_data, function (data) {
|
704 |
+
try {
|
705 |
+
var jsonarray = jQuery.parseJSON(data);
|
706 |
+
if (jsonarray.result === 'success') {
|
707 |
+
jQuery('#wpvivid_lock_' + backup_id).html(jsonarray.html);
|
708 |
+
}
|
709 |
+
}
|
710 |
+
catch (err) {
|
711 |
+
alert(err);
|
712 |
+
}
|
713 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
714 |
+
var error_message = wpvivid_output_ajaxerror('setting up a lock for the backup', textStatus, errorThrown);
|
715 |
+
alert(error_message);
|
716 |
+
});
|
717 |
+
}
|
718 |
+
}
|
719 |
+
|
720 |
+
function wpvivid_read_log(action, param){
|
721 |
+
var tab_id = '';
|
722 |
+
var content_id = '';
|
723 |
+
var ajax_data = '';
|
724 |
+
var show_page = '';
|
725 |
+
if(typeof param === 'undefined') param = '';
|
726 |
+
switch(action){
|
727 |
+
case 'wpvivid_view_backup_task_log':
|
728 |
+
ajax_data = {
|
729 |
+
'action':action,
|
730 |
+
'id':running_backup_taskid
|
731 |
+
};
|
732 |
+
tab_id = 'wpvivid_tab_backup_log';
|
733 |
+
content_id = 'wpvivid_display_log_content';
|
734 |
+
show_page = 'backup_page';
|
735 |
+
break;
|
736 |
+
case 'wpvivid_read_last_backup_log':
|
737 |
+
var ajax_data = {
|
738 |
+
'action': action,
|
739 |
+
'log_file_name': param
|
740 |
+
};
|
741 |
+
tab_id = 'wpvivid_tab_backup_log';
|
742 |
+
content_id = 'wpvivid_display_log_content';
|
743 |
+
show_page = 'backup_page';
|
744 |
+
break;
|
745 |
+
case 'wpvivid_view_backup_log':
|
746 |
+
var ajax_data={
|
747 |
+
'action':action,
|
748 |
+
'id':param
|
749 |
+
};
|
750 |
+
tab_id = 'wpvivid_tab_backup_log';
|
751 |
+
content_id = 'wpvivid_display_log_content';
|
752 |
+
show_page = 'backup_page';
|
753 |
+
break;
|
754 |
+
case 'wpvivid_view_log':
|
755 |
+
var ajax_data={
|
756 |
+
'action':action,
|
757 |
+
'path':param
|
758 |
+
};
|
759 |
+
tab_id = 'wpvivid_tab_read_log';
|
760 |
+
content_id = 'wpvivid_read_log_content';
|
761 |
+
show_page = 'log_page';
|
762 |
+
break;
|
763 |
+
default:
|
764 |
+
break;
|
765 |
+
}
|
766 |
+
jQuery('#'+tab_id).show();
|
767 |
+
jQuery('#'+content_id).html("");
|
768 |
+
if(show_page === 'backup_page'){
|
769 |
+
//wpvivid_click_switch_backup_page(tab_id);
|
770 |
+
wpvivid_click_switch_page('backup', tab_id, true);
|
771 |
+
}
|
772 |
+
else if(show_page === 'log_page') {
|
773 |
+
wpvivid_click_switch_page('wrap', tab_id, true);
|
774 |
+
}
|
775 |
+
wpvivid_post_request(ajax_data, function(data){
|
776 |
+
wpvivid_show_log(data, content_id);
|
777 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
778 |
+
var div = 'Reading the log failed. Please try again.';
|
779 |
+
jQuery('#wpvivid_display_log_content').html(div);
|
780 |
+
});
|
781 |
+
}
|
782 |
+
|
783 |
+
/*function wpvivid_initialize_download(backup_id, list_name){
|
784 |
+
wpvivid_reset_backup_list(list_name);
|
785 |
+
jQuery('#wpvivid_download_loading_'+backup_id).addClass('is-active');
|
786 |
+
tmp_current_click_backupid = backup_id;
|
787 |
+
var ajax_data = {
|
788 |
+
'action':'wpvivid_init_download_page',
|
789 |
+
'backup_id':backup_id
|
790 |
+
};
|
791 |
+
wpvivid_post_request(ajax_data, function(data){
|
792 |
+
try {
|
793 |
+
var jsonarray = jQuery.parseJSON(data);
|
794 |
+
jQuery('#wpvivid_download_loading_'+backup_id).removeClass('is-active');
|
795 |
+
if (jsonarray.result === 'success') {
|
796 |
+
jQuery('#wpvivid_file_part_' + backup_id).html("");
|
797 |
+
var i = 0;
|
798 |
+
var file_not_found = false;
|
799 |
+
var file_name = '';
|
800 |
+
jQuery.each(jsonarray.files, function (index, value) {
|
801 |
+
i++;
|
802 |
+
file_name = index;
|
803 |
+
if (value.status === 'need_download') {
|
804 |
+
jQuery('#wpvivid_file_part_' + backup_id).append(value.html);
|
805 |
+
//tmp_current_click_backupid = '';
|
806 |
+
}
|
807 |
+
else if (value.status === 'running') {
|
808 |
+
if (m_downloading_file_name === file_name) {
|
809 |
+
wpvivid_lock_download(tmp_current_click_backupid);
|
810 |
+
}
|
811 |
+
jQuery('#wpvivid_file_part_' + backup_id).append(value.html);
|
812 |
+
}
|
813 |
+
else if (value.status === 'completed') {
|
814 |
+
if (m_downloading_file_name === file_name) {
|
815 |
+
wpvivid_unlock_download(tmp_current_click_backupid);
|
816 |
+
m_downloading_id = '';
|
817 |
+
m_downloading_file_name = '';
|
818 |
+
}
|
819 |
+
jQuery('#wpvivid_file_part_' + backup_id).append(value.html);
|
820 |
+
//tmp_current_click_backupid = '';
|
821 |
+
}
|
822 |
+
else if (value.status === 'timeout') {
|
823 |
+
if (m_downloading_file_name === file_name) {
|
824 |
+
wpvivid_unlock_download(tmp_current_click_backupid);
|
825 |
+
m_downloading_id = '';
|
826 |
+
m_downloading_file_name = '';
|
827 |
+
}
|
828 |
+
jQuery('#wpvivid_file_part_' + backup_id).append(value.html);
|
829 |
+
//tmp_current_click_backupid = '';
|
830 |
+
}
|
831 |
+
else if (value.status === 'file_not_found') {
|
832 |
+
wpvivid_unlock_download(tmp_current_click_backupid);
|
833 |
+
wpvivid_reset_backup_list(list_name);
|
834 |
+
file_not_found = true;
|
835 |
+
alert("Download failed, file not found. The file might has been moved, renamed or deleted. Please verify the file exists and try again.");
|
836 |
+
//tmp_current_click_backupid = '';
|
837 |
+
return false;
|
838 |
+
}
|
839 |
+
});
|
840 |
+
if (file_not_found === false) {
|
841 |
+
jQuery('#wpvivid_file_part_' + backup_id).append(jsonarray.place_html);
|
842 |
+
}
|
843 |
+
}
|
844 |
+
}
|
845 |
+
catch(err){
|
846 |
+
alert(err);
|
847 |
+
jQuery('#wpvivid_download_loading_'+backup_id).removeClass('is-active');
|
848 |
+
}
|
849 |
+
},function(XMLHttpRequest, textStatus, errorThrown){
|
850 |
+
jQuery('#wpvivid_download_loading_'+backup_id).removeClass('is-active');
|
851 |
+
var error_message = wpvivid_output_ajaxerror('initializing download information', textStatus, errorThrown);
|
852 |
+
alert(error_message);
|
853 |
+
});
|
854 |
+
}*/
|
855 |
+
|
856 |
+
function wpvivid_reset_backup_list(list_name){
|
857 |
+
jQuery('#'+list_name+' tr').each(function(i){
|
858 |
+
jQuery(this).children('td').each(function (j) {
|
859 |
+
if (j == 2) {
|
860 |
+
var backup_id = jQuery(this).parent().children('th').find("input[type=checkbox]").attr("id");
|
861 |
+
var download_btn = '<div id="wpvivid_file_part_' + backup_id + '" style="float:left;padding:10px 10px 10px 0px;">' +
|
862 |
+
'<div style="cursor:pointer;" onclick="wpvivid_initialize_download(\'' + backup_id + '\', \''+list_name+'\');" title="Prepare to download the backup">' +
|
863 |
+
'<img id="wpvivid_download_btn_' + backup_id + '" src="' + wpvivid_plugurl + '/admin/partials/images/download.png" style="vertical-align:middle;" />Download' +
|
864 |
+
'<div class="spinner" id="wpvivid_download_loading_' + backup_id + '" style="float:right;width:auto;height:auto;padding:10px 180px 10px 0;background-position:0 0;"></div>' +
|
865 |
+
'</div>' +
|
866 |
+
'</div>';
|
867 |
+
jQuery(this).html(download_btn);
|
868 |
+
}
|
869 |
+
});
|
870 |
+
});
|
871 |
+
}
|
872 |
+
|
873 |
+
function wpvivid_lock_download(backup_id){
|
874 |
+
jQuery('#wpvivid_backup_list tr').each(function(i){
|
875 |
+
jQuery(this).children('td').each(function (j) {
|
876 |
+
if (j == 2) {
|
877 |
+
jQuery(this).css({'pointer-events': 'none', 'opacity': '0.4'});
|
878 |
+
}
|
879 |
+
});
|
880 |
+
});
|
881 |
+
}
|
882 |
+
|
883 |
+
function wpvivid_unlock_download(backup_id){
|
884 |
+
jQuery('#wpvivid_backup_list tr').each(function(i){
|
885 |
+
jQuery(this).children('td').each(function (j) {
|
886 |
+
if (j == 2) {
|
887 |
+
jQuery(this).css({'pointer-events': 'auto', 'opacity': '1'});
|
888 |
+
}
|
889 |
+
});
|
890 |
+
});
|
891 |
+
}
|
892 |
+
|
893 |
+
/**
|
894 |
+
* Start downloading backup
|
895 |
+
*
|
896 |
+
* @param part_num - The part number for the download object
|
897 |
+
* @param backup_id - The unique ID for the backup
|
898 |
+
* @param file_name - File name
|
899 |
+
*/
|
900 |
+
function wpvivid_prepare_download(part_num, backup_id, file_name){
|
901 |
+
var ajax_data = {
|
902 |
+
'action': 'wpvivid_prepare_download_backup',
|
903 |
+
'backup_id':backup_id,
|
904 |
+
'file_name':file_name
|
905 |
+
};
|
906 |
+
var progress = '0%';
|
907 |
+
jQuery("#"+backup_id+"-text-part-"+part_num).html("<a>Retriving(remote storage to web server)</a>");
|
908 |
+
jQuery("#"+backup_id+"-progress-part-"+part_num).css('width', progress);
|
909 |
+
task_retry_times = 0;
|
910 |
+
m_need_update = true;
|
911 |
+
wpvivid_lock_download(backup_id);
|
912 |
+
m_downloading_id = backup_id;
|
913 |
+
tmp_current_click_backupid = backup_id;
|
914 |
+
m_downloading_file_name = file_name;
|
915 |
+
wpvivid_post_request(ajax_data, function(data)
|
916 |
+
{
|
917 |
+
}, function(XMLHttpRequest, textStatus, errorThrown)
|
918 |
+
{
|
919 |
+
}, 0);
|
920 |
+
}
|
921 |
+
|
922 |
+
/**
|
923 |
+
* Download backups to user's computer.
|
924 |
+
*
|
925 |
+
* @param backup_id - The unique ID for the backup
|
926 |
+
* @param backup_type - The types of the backup
|
927 |
+
* @param file_name - File name
|
928 |
+
*/
|
929 |
+
function wpvivid_download(backup_id, backup_type, file_name){
|
930 |
+
wpvivid_location_href=true;
|
931 |
+
location.href =ajaxurl+'?_wpnonce='+wpvivid_ajax_object.ajax_nonce+'&action=wpvivid_download_backup&backup_id='+backup_id+'&download_type='+backup_type+'&file_name='+file_name;
|
932 |
+
}
|
933 |
+
|
934 |
+
function wpvivid_initialize_restore(backup_id, backup_time, backup_type, restore_type='backup'){
|
935 |
+
var time_type = 'backup';
|
936 |
+
var log_type = '';
|
937 |
+
var tab_type = '';
|
938 |
+
var page_type = 'backup';
|
939 |
+
if(restore_type == 'backup'){
|
940 |
+
time_type = 'backup';
|
941 |
+
log_type = '';
|
942 |
+
tab_type = '';
|
943 |
+
page_type = 'backup';
|
944 |
+
}
|
945 |
+
else if(restore_type == 'transfer'){
|
946 |
+
time_type = 'transfer';
|
947 |
+
log_type = 'transfer_';
|
948 |
+
tab_type = 'add_';
|
949 |
+
page_type = 'migrate';
|
950 |
+
}
|
951 |
+
wpvivid_restore_backup_type = backup_type;
|
952 |
+
jQuery('#wpvivid_restore_'+time_type+'_time').html(backup_time);
|
953 |
+
m_restore_backup_id = backup_id;
|
954 |
+
jQuery('#wpvivid_restore_'+log_type+'log').html("");
|
955 |
+
jQuery('#wpvivid_'+tab_type+'tab_restore').show();
|
956 |
+
wpvivid_click_switch_page(page_type, 'wpvivid_'+tab_type+'tab_restore', true);
|
957 |
+
wpvivid_init_restore_data(restore_type);
|
958 |
+
}
|
959 |
+
|
960 |
+
function click_dismiss_restore_check_notice(obj){
|
961 |
+
wpvivid_display_restore_check = false;
|
962 |
+
jQuery(obj).parent().remove();
|
963 |
+
}
|
964 |
+
|
965 |
+
/**
|
966 |
+
* This function will initialize restore information
|
967 |
+
*
|
968 |
+
* @param backup_id - The unique ID for the backup
|
969 |
+
*/
|
970 |
+
function wpvivid_init_restore_data(restore_type)
|
971 |
+
{
|
972 |
+
wpvivid_resotre_is_migrate=0;
|
973 |
+
var restore_method = '';
|
974 |
+
if(restore_type == 'backup'){
|
975 |
+
restore_method = '';
|
976 |
+
}
|
977 |
+
else if(restore_type == 'transfer'){
|
978 |
+
restore_method = 'transfer_';
|
979 |
+
}
|
980 |
+
jQuery('#wpvivid_replace_domain').prop('checked', false);
|
981 |
+
jQuery('#wpvivid_keep_domain').prop('checked', false);
|
982 |
+
jQuery('#wpvivid_restore_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
983 |
+
jQuery('#wpvivid_clean_'+restore_method+'restore').css({'pointer-events': 'none', 'opacity': '0.4'});
|
984 |
+
jQuery('#wpvivid_rollback_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
985 |
+
jQuery('#wpvivid_download_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
986 |
+
jQuery('#wpvivid_restore_'+restore_method+'part').show();
|
987 |
+
jQuery('#wpvivid_clean_'+restore_method+'part').hide();
|
988 |
+
jQuery('#wpvivid_rollback_'+restore_method+'part').hide();
|
989 |
+
jQuery('#wpvivid_download_'+restore_method+'part').hide();
|
990 |
+
|
991 |
+
jQuery('#wpvivid_init_restore_data').addClass('is-active');
|
992 |
+
var ajax_data = {
|
993 |
+
'action':'wpvivid_init_restore_page',
|
994 |
+
'backup_id':m_restore_backup_id
|
995 |
+
};
|
996 |
+
wpvivid_post_request(ajax_data, function(data){
|
997 |
+
try {
|
998 |
+
var jsonarray = jQuery.parseJSON(data);
|
999 |
+
var init_status = false;
|
1000 |
+
if(jsonarray.result === 'success') {
|
1001 |
+
jQuery('#wpvivid_restore_'+restore_method+'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1002 |
+
jQuery('#wpvivid_download_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1003 |
+
jQuery('#wpvivid_restore_'+restore_method+'part').show();
|
1004 |
+
jQuery('#wpvivid_download_'+restore_method+'part').hide();
|
1005 |
+
wpvivid_restore_need_download = false;
|
1006 |
+
init_status = true;
|
1007 |
+
}
|
1008 |
+
else if (jsonarray.result === "need_download"){
|
1009 |
+
init_status = true;
|
1010 |
+
wpvivid_restore_download_array = new Array();
|
1011 |
+
var download_num = 0;
|
1012 |
+
jQuery.each(jsonarray.files, function (index, value)
|
1013 |
+
{
|
1014 |
+
if (value.status === "need_download")
|
1015 |
+
{
|
1016 |
+
wpvivid_restore_download_array[download_num] = new Array('file_name', 'size', 'md5');
|
1017 |
+
wpvivid_restore_download_array[download_num]['file_name'] = index;
|
1018 |
+
wpvivid_restore_download_array[download_num]['size'] = value.size;
|
1019 |
+
wpvivid_restore_download_array[download_num]['md5'] = value.md5;
|
1020 |
+
download_num++;
|
1021 |
+
}
|
1022 |
+
});
|
1023 |
+
wpvivid_restore_download_index=0;
|
1024 |
+
wpvivid_restore_need_download = true;
|
1025 |
+
jQuery('#wpvivid_restore_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1026 |
+
jQuery('#wpvivid_download_'+restore_method+'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1027 |
+
jQuery('#wpvivid_restore_'+restore_method+'part').hide();
|
1028 |
+
jQuery('#wpvivid_download_'+restore_method+'part').show();
|
1029 |
+
}
|
1030 |
+
else if (jsonarray.result === "failed") {
|
1031 |
+
jQuery('#wpvivid_init_restore_data').removeClass('is-active');
|
1032 |
+
wpvivid_display_restore_msg(jsonarray.error, restore_type);
|
1033 |
+
}
|
1034 |
+
|
1035 |
+
if(init_status){
|
1036 |
+
if(jsonarray.max_allow_packet_warning != false || jsonarray.memory_limit_warning != false) {
|
1037 |
+
if(!wpvivid_display_restore_check) {
|
1038 |
+
wpvivid_display_restore_check = true;
|
1039 |
+
var output = '';
|
1040 |
+
if(jsonarray.max_allow_packet_warning != false){
|
1041 |
+
output += "<p>" + jsonarray.max_allow_packet_warning + "</p>";
|
1042 |
+
}
|
1043 |
+
if(jsonarray.memory_limit_warning != false){
|
1044 |
+
output += "<p>" + jsonarray.memory_limit_warning + "</p>";
|
1045 |
+
}
|
1046 |
+
var div = "<div class='notice notice-warning is-dismissible inline'>" +
|
1047 |
+
output +
|
1048 |
+
"<button type='button' class='notice-dismiss' onclick='click_dismiss_restore_check_notice(this);'>" +
|
1049 |
+
"<span class='screen-reader-text'>Dismiss this notice.</span>" +
|
1050 |
+
"</button>" +
|
1051 |
+
"</div>";
|
1052 |
+
jQuery('#wpvivid_restore_check').append(div);
|
1053 |
+
}
|
1054 |
+
}
|
1055 |
+
jQuery('#wpvivid_init_restore_data').removeClass('is-active');
|
1056 |
+
if (jsonarray.has_exist_restore === 0) {
|
1057 |
+
if(wpvivid_restore_need_download == false) {
|
1058 |
+
jQuery('#wpvivid_restore_' + restore_method + 'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1059 |
+
jQuery('#wpvivid_clean_' + restore_method + 'restore').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1060 |
+
jQuery('#wpvivid_rollback_' + restore_method + 'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1061 |
+
jQuery('#wpvivid_restore_' + restore_method + 'part').show();
|
1062 |
+
jQuery('#wpvivid_clean_' + restore_method + 'part').hide();
|
1063 |
+
jQuery('#wpvivid_rollback_' + restore_method + 'part').hide();
|
1064 |
+
jQuery('#wpvivid_restore_is_migrate').css({'pointer-events': 'auto', 'opacity': '1'});
|
1065 |
+
|
1066 |
+
jQuery('#wpvivid_restore_is_migrate').hide();
|
1067 |
+
jQuery('#wpvivid_restore_' + restore_method + 'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1068 |
+
|
1069 |
+
wpvivid_resotre_is_migrate = jsonarray.is_migrate;
|
1070 |
+
|
1071 |
+
if (jsonarray.is_migrate_ui === 1) {
|
1072 |
+
jQuery('#wpvivid_restore_is_migrate').show()
|
1073 |
+
jQuery('#wpvivid_replace_domain').prop('checked', false);
|
1074 |
+
jQuery('#wpvivid_keep_domain').prop('checked', false);
|
1075 |
+
}
|
1076 |
+
else {
|
1077 |
+
jQuery('#wpvivid_restore_is_migrate').hide();
|
1078 |
+
jQuery('#wpvivid_restore_' + restore_method + 'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
wpvivid_interface_flow_control();
|
1082 |
+
}
|
1083 |
+
}
|
1084 |
+
else if (jsonarray.has_exist_restore === 1) {
|
1085 |
+
jQuery('#wpvivid_restore_' + restore_method + 'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1086 |
+
jQuery('#wpvivid_clean_' + restore_method + 'restore').css({'pointer-events': 'auto', 'opacity': '1'});
|
1087 |
+
jQuery('#wpvivid_rollback_' + restore_method + 'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1088 |
+
jQuery('#wpvivid_restore_'+restore_method+'part').hide();
|
1089 |
+
jQuery('#wpvivid_clean_'+restore_method+'part').show();
|
1090 |
+
jQuery('#wpvivid_rollback_'+restore_method+'part').hide();
|
1091 |
+
jQuery('#wpvivid_restore_is_migrate').hide();
|
1092 |
+
wpvivid_display_restore_msg("An uncompleted restore task exists, please terminate it first.", restore_type);
|
1093 |
+
}
|
1094 |
+
}
|
1095 |
+
}
|
1096 |
+
catch(err){
|
1097 |
+
alert(err);
|
1098 |
+
}
|
1099 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
1100 |
+
jQuery('#wpvivid_init_restore_data').removeClass('is-active');
|
1101 |
+
var error_message = wpvivid_output_ajaxerror('initializing restore information', textStatus, errorThrown);
|
1102 |
+
wpvivid_display_restore_msg(error_message, restore_type);
|
1103 |
+
});
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
function wpvivid_delete_selected_backup(backup_id, list_name){
|
1107 |
+
var name = '';
|
1108 |
+
jQuery('#wpvivid_backup_list tr').each(function(i){
|
1109 |
+
jQuery(this).children('td').each(function (j) {
|
1110 |
+
if (j == 0) {
|
1111 |
+
var id = jQuery(this).parent().children('th').find("input[type=checkbox]").attr("id");
|
1112 |
+
if(id === backup_id){
|
1113 |
+
name = jQuery(this).parent().children('td').eq(0).find('img').attr('name');
|
1114 |
+
}
|
1115 |
+
}
|
1116 |
+
});
|
1117 |
+
});
|
1118 |
+
var descript = '';
|
1119 |
+
var force_del = 0;
|
1120 |
+
var bdownloading = false;
|
1121 |
+
if(name === 'lock') {
|
1122 |
+
descript = '<?php _e('This backup is locked, are you sure to remove it? This backup will be deleted permanently from your hosting (localhost) and remote storages.', 'wpvivid-backuprestore'); ?>';
|
1123 |
+
force_del = 1;
|
1124 |
+
}
|
1125 |
+
else{
|
1126 |
+
descript = '<?php _e('Are you sure to remove this backup? This backup will be deleted permanently from your hosting (localhost) and remote storages.', 'wpvivid-backuprestore'); ?>';
|
1127 |
+
force_del = 0;
|
1128 |
+
}
|
1129 |
+
if(m_downloading_id === backup_id){
|
1130 |
+
bdownloading = true;
|
1131 |
+
descript = '<?php _e('This request will delete the backup being downloaded, are you sure you want to continue?', 'wpvivid-backuprestore'); ?>';
|
1132 |
+
force_del = 1;
|
1133 |
+
}
|
1134 |
+
var ret = confirm(descript);
|
1135 |
+
if(ret === true){
|
1136 |
+
var ajax_data={
|
1137 |
+
'action': 'wpvivid_delete_backup',
|
1138 |
+
'backup_id': backup_id,
|
1139 |
+
'force': force_del
|
1140 |
+
};
|
1141 |
+
wpvivid_post_request(ajax_data, function(data){
|
1142 |
+
wpvivid_handle_backup_data(data);
|
1143 |
+
if(bdownloading){
|
1144 |
+
m_downloading_id = '';
|
1145 |
+
}
|
1146 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
1147 |
+
var error_message = wpvivid_output_ajaxerror('deleting the backup', textStatus, errorThrown);
|
1148 |
+
alert(error_message);
|
1149 |
+
});
|
1150 |
+
}
|
1151 |
+
}
|
1152 |
+
function wpvivid_delete_backups_inbatches(){
|
1153 |
+
var delete_backup_array = new Array();
|
1154 |
+
var count = 0;
|
1155 |
+
var bdownloading = false;
|
1156 |
+
jQuery('#wpvivid_backup_list tr').each(function (i) {
|
1157 |
+
jQuery(this).children('th').each(function (j) {
|
1158 |
+
if (j == 0) {
|
1159 |
+
if(jQuery(this).find('input[type=checkbox]').prop('checked')){
|
1160 |
+
delete_backup_array[count] = jQuery(this).find('input[type=checkbox]').attr('id');
|
1161 |
+
if(m_downloading_id === jQuery(this).find('input[type=checkbox]').attr('id')){
|
1162 |
+
bdownloading = true;
|
1163 |
+
}
|
1164 |
+
count++;
|
1165 |
+
}
|
1166 |
+
}
|
1167 |
+
});
|
1168 |
+
});
|
1169 |
+
if( count === 0 ){
|
1170 |
+
alert('<?php _e('Please select at least one item.','wpvivid-backuprestore'); ?>');
|
1171 |
+
}
|
1172 |
+
else {
|
1173 |
+
var descript = '';
|
1174 |
+
if(bdownloading) {
|
1175 |
+
descript = '<?php _e('This request might delete the backup being downloaded, are you sure you want to continue?', 'wpvivid-backuprestore'); ?>';
|
1176 |
+
}
|
1177 |
+
else{
|
1178 |
+
descript = '<?php _e('Are you sure to remove the selected backups? These backups will be deleted permanently from your hosting (localhost).', 'wpvivid-backuprestore'); ?>';
|
1179 |
+
}
|
1180 |
+
var ret = confirm(descript);
|
1181 |
+
if (ret === true) {
|
1182 |
+
var ajax_data = {
|
1183 |
+
'action': 'wpvivid_delete_backup_array',
|
1184 |
+
'backup_id': delete_backup_array
|
1185 |
+
};
|
1186 |
+
wpvivid_post_request(ajax_data, function (data) {
|
1187 |
+
wpvivid_handle_backup_data(data);
|
1188 |
+
jQuery('#backup_list_all_check').prop('checked', false);
|
1189 |
+
if(bdownloading){
|
1190 |
+
m_downloading_id = '';
|
1191 |
+
}
|
1192 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
1193 |
+
var error_message = wpvivid_output_ajaxerror('deleting the backup', textStatus, errorThrown);
|
1194 |
+
alert(error_message);
|
1195 |
+
});
|
1196 |
+
}
|
1197 |
+
}
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
jQuery('#backup_list_all_check').click(function(){
|
1201 |
+
var name = '';
|
1202 |
+
if(jQuery('#backup_list_all_check').prop('checked')) {
|
1203 |
+
jQuery('#wpvivid_backup_list tr').each(function (i) {
|
1204 |
+
jQuery(this).children('th').each(function (j) {
|
1205 |
+
if (j == 0) {
|
1206 |
+
name = jQuery(this).parent().children('td').eq(0).find("img").attr("name");
|
1207 |
+
if(name === 'unlock') {
|
1208 |
+
jQuery(this).find("input[type=checkbox]").prop('checked', true);
|
1209 |
+
}
|
1210 |
+
else{
|
1211 |
+
jQuery(this).find("input[type=checkbox]").prop('checked', false);
|
1212 |
+
}
|
1213 |
+
}
|
1214 |
+
});
|
1215 |
+
});
|
1216 |
+
}
|
1217 |
+
else{
|
1218 |
+
jQuery('#wpvivid_backup_list tr').each(function (i) {
|
1219 |
+
jQuery(this).children('th').each(function (j) {
|
1220 |
+
if (j == 0) {
|
1221 |
+
jQuery(this).find("input[type=checkbox]").prop('checked', false);
|
1222 |
+
}
|
1223 |
+
});
|
1224 |
+
});
|
1225 |
+
}
|
1226 |
+
});
|
1227 |
+
|
1228 |
+
function click_dismiss_restore_notice(obj){
|
1229 |
+
wpvivid_display_restore_backup = false;
|
1230 |
+
jQuery(obj).parent().remove();
|
1231 |
+
}
|
1232 |
+
|
1233 |
+
function wpvivid_click_how_to_restore_backup(){
|
1234 |
+
if(!wpvivid_display_restore_backup){
|
1235 |
+
wpvivid_display_restore_backup = true;
|
1236 |
+
var top = jQuery('#wpvivid_how_to_restore_backup_describe').offset().top-jQuery('#wpvivid_how_to_restore_backup_describe').height();
|
1237 |
+
jQuery('html, body').animate({scrollTop:top}, 'slow');
|
1238 |
+
var div = "<div class='notice notice-info is-dismissible inline'>" +
|
1239 |
+
"<p>" + wpvividlion.restore_step1 + "</p>" +
|
1240 |
+
"<p>" + wpvividlion.restore_step2 + "</p>" +
|
1241 |
+
"<p>" + wpvividlion.restore_step3 + "</p>" +
|
1242 |
+
"<button type='button' class='notice-dismiss' onclick='click_dismiss_restore_notice(this);'>" +
|
1243 |
+
"<span class='screen-reader-text'>Dismiss this notice.</span>" +
|
1244 |
+
"</button>" +
|
1245 |
+
"</div>";
|
1246 |
+
jQuery('#wpvivid_how_to_restore_backup').append(div);
|
1247 |
+
}
|
1248 |
+
}
|
1249 |
+
</script>
|
1250 |
+
<?php
|
1251 |
+
}
|
1252 |
+
|
1253 |
+
function wpvivid_backuppage_add_page_log(){
|
1254 |
+
?>
|
1255 |
+
<div class="backup-tab-content wpvivid_tab_backup_log" id="page-log" style="display:none;">
|
1256 |
+
<div class="postbox restore_log" id="wpvivid_display_log_content">
|
1257 |
+
<div></div>
|
1258 |
+
</div>
|
1259 |
+
</div>
|
1260 |
+
<?php
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
function wpvivid_backuppage_add_page_restore(){
|
1264 |
+
$general_setting=WPvivid_Setting::get_setting(true, "");
|
1265 |
+
if(isset($general_setting['options']['wpvivid_common_setting']['restore_max_execution_time'])){
|
1266 |
+
$restore_max_execution_time = intval($general_setting['options']['wpvivid_common_setting']['restore_max_execution_time']);
|
1267 |
+
}
|
1268 |
+
else{
|
1269 |
+
$restore_max_execution_time = WPVIVID_RESTORE_MAX_EXECUTION_TIME;
|
1270 |
+
}
|
1271 |
+
?>
|
1272 |
+
<div class="backup-tab-content wpvivid_tab_restore" id="page-restore" style="display:none;">
|
1273 |
+
<div>
|
1274 |
+
<h3><?php _e('Restore backup from:', 'wpvivid-backuprestore'); ?><span id="wpvivid_restore_backup_time"></span></h3>
|
1275 |
+
<p><strong><?php _e('Please do not close the page or switch to other pages when a restore task is running, as it could trigger some unexpected errors.', 'wpvivid-backuprestore'); ?></strong></p>
|
1276 |
+
<p><?php _e('Restore function will replace the current site\'s themes, plugins, uploads, database and/or other content directories with the existing equivalents in the selected backup.', 'wpvivid-backuprestore'); ?></p>
|
1277 |
+
<div id="wpvivid_restore_is_migrate" style="padding-bottom: 10px; display: none;">
|
1278 |
+
<label >
|
1279 |
+
<input type="radio" id="wpvivid_replace_domain" option="restore" name="restore_domain" value="1" /><?php echo sprintf(__('Restore and replace the original domain (URL) with %s (migration)', 'wpvivid-backuprestore'), home_url()); ?>
|
1280 |
+
</label><br>
|
1281 |
+
<label >
|
1282 |
+
<input type="radio" id="wpvivid_keep_domain" option="restore" name="restore_domain" value="0" /><?php _e('Restore and keep the original domain (URL) unchanged', 'wpvivid-backuprestore'); ?>
|
1283 |
+
</label><br>
|
1284 |
+
</div>
|
1285 |
+
<div>
|
1286 |
+
<p><strong><?php _e('Tips:', 'wpvivid-backuprestore'); ?></strong> <?php _e('If you are migrating a website, the source domain will be replaced with the target domain automatically. For example, if you are migrating a.com to b.com, then a.com will be replaced with b.com during the restore.', 'wpvivid-backuprestore'); ?></p>
|
1287 |
+
</div>
|
1288 |
+
<div id="wpvivid_restore_check"></div>
|
1289 |
+
<div class="restore-button-position" id="wpvivid_restore_part"><input class="button-primary" id="wpvivid_restore_btn" type="submit" name="restore" value="<?php esc_attr_e( 'Restore', 'wpvivid-backuprestore' ); ?>" onclick="wpvivid_start_restore();" /></div>
|
1290 |
+
<div class="restore-button-position" id="wpvivid_clean_part"><input class="button-primary" id="wpvivid_clean_restore" type="submit" name="clear_restore" value="<?php esc_attr_e( 'Terminate', 'wpvivid-backuprestore' ); ?>" /></div>
|
1291 |
+
<div class="restore-button-position" id="wpvivid_rollback_part"><input class="button-primary" id="wpvivid_rollback_btn" type="submit" name="rollback" value="<?php esc_attr_e( 'Rollback', 'wpvivid-backuprestore' ); ?>" /></div>
|
1292 |
+
<div class="restore-button-position" id="wpvivid_download_part">
|
1293 |
+
<input class="button-primary" id="wpvivid_download_btn" type="submit" name="download" value="<?php esc_attr_e( 'Retrieve the backup to localhost', 'wpvivid-backuprestore' ); ?>" />
|
1294 |
+
<span><?php _e('The backup is stored on the remote storage, click on the button to download it to localhost.', 'wpvivid-backuprestore'); ?></span>
|
1295 |
+
</div>
|
1296 |
+
<div class="spinner" id="wpvivid_init_restore_data" style="float:left;width:auto;height:auto;padding:10px 20px 20px 0;background-position:0 10px;"></div>
|
1297 |
+
</div>
|
1298 |
+
<div class="postbox restore_log" id="wpvivid_restore_log"></div>
|
1299 |
+
</div>
|
1300 |
+
<script>
|
1301 |
+
var restore_max_exection_time = '<?php echo $restore_max_execution_time; ?>';
|
1302 |
+
restore_max_exection_time = restore_max_exection_time * 1000;
|
1303 |
+
jQuery('#wpvivid_clean_restore').click(function(){
|
1304 |
+
wpvivid_delete_incompleted_restore();
|
1305 |
+
});
|
1306 |
+
|
1307 |
+
jQuery('#wpvivid_download_btn').click(function(){
|
1308 |
+
wpvivid_download_restore_file('backup');
|
1309 |
+
});
|
1310 |
+
|
1311 |
+
function wpvivid_delete_incompleted_restore(restore_type = 'backup'){
|
1312 |
+
var restore_method = '';
|
1313 |
+
if(restore_type == 'backup'){
|
1314 |
+
restore_method = '';
|
1315 |
+
}
|
1316 |
+
else if(restore_type == 'transfer'){
|
1317 |
+
restore_method = 'transfer_';
|
1318 |
+
}
|
1319 |
+
|
1320 |
+
var ajax_data={
|
1321 |
+
'action': 'wpvivid_delete_last_restore_data'
|
1322 |
+
};
|
1323 |
+
jQuery('#wpvivid_restore_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1324 |
+
jQuery('#wpvivid_clean_'+restore_method+'restore').css({'pointer-events': 'auto', 'opacity': '1'});
|
1325 |
+
jQuery('#wpvivid_rollback_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1326 |
+
jQuery('#wpvivid_restore_'+restore_method+'part').hide();
|
1327 |
+
jQuery('#wpvivid_clean_'+restore_method+'part').show();
|
1328 |
+
jQuery('#wpvivid_rollback_'+restore_method+'part').hide();
|
1329 |
+
wpvivid_post_request(ajax_data, function(data) {
|
1330 |
+
try {
|
1331 |
+
var jsonarray = jQuery.parseJSON(data);
|
1332 |
+
if (jsonarray.result === "success") {
|
1333 |
+
wpvivid_display_restore_msg("The restore task is terminated.", restore_type);
|
1334 |
+
wpvivid_init_restore_data(restore_type);
|
1335 |
+
}
|
1336 |
+
}
|
1337 |
+
catch(err){
|
1338 |
+
alert(err);
|
1339 |
+
}
|
1340 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
1341 |
+
var error_message = wpvivid_output_ajaxerror('deleting the last incomplete restore task', textStatus, errorThrown);
|
1342 |
+
wpvivid_display_restore_msg(error_message, restore_type);
|
1343 |
+
});
|
1344 |
+
}
|
1345 |
+
|
1346 |
+
function wpvivid_restore_is_migrate(restore_type){
|
1347 |
+
var ajax_data = {
|
1348 |
+
'action': 'wpvivid_get_restore_file_is_migrate',
|
1349 |
+
'backup_id': m_restore_backup_id
|
1350 |
+
};
|
1351 |
+
var restore_method = '';
|
1352 |
+
wpvivid_post_request(ajax_data, function(data)
|
1353 |
+
{
|
1354 |
+
try
|
1355 |
+
{
|
1356 |
+
var jsonarray = jQuery.parseJSON(data);
|
1357 |
+
if(jsonarray.result === "success")
|
1358 |
+
{
|
1359 |
+
if (jsonarray.is_migrate_ui === 1)
|
1360 |
+
{
|
1361 |
+
jQuery('#wpvivid_restore_is_migrate').show();
|
1362 |
+
jQuery('#wpvivid_replace_domain').prop('checked', false);
|
1363 |
+
jQuery('#wpvivid_keep_domain').prop('checked', false);
|
1364 |
+
}
|
1365 |
+
else {
|
1366 |
+
jQuery('#wpvivid_restore_is_migrate').hide();
|
1367 |
+
jQuery('#wpvivid_restore_' + restore_method + 'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1368 |
+
}
|
1369 |
+
}
|
1370 |
+
else if (jsonarray.result === "failed") {
|
1371 |
+
jQuery('#wpvivid_init_restore_data').removeClass('is-active');
|
1372 |
+
wpvivid_display_restore_msg(jsonarray.error, restore_type);
|
1373 |
+
}
|
1374 |
+
}
|
1375 |
+
catch(err){
|
1376 |
+
alert(err);
|
1377 |
+
}
|
1378 |
+
}, function(XMLHttpRequest, textStatus, errorThrown)
|
1379 |
+
{
|
1380 |
+
setTimeout(function()
|
1381 |
+
{
|
1382 |
+
wpvivid_restore_is_migrate(restore_type);
|
1383 |
+
}, 3000);
|
1384 |
+
});
|
1385 |
+
}
|
1386 |
+
|
1387 |
+
/**
|
1388 |
+
* This function will start the process of restoring a backup
|
1389 |
+
*/
|
1390 |
+
function wpvivid_start_restore(restore_type = 'backup'){
|
1391 |
+
if(!wpvivid_restore_sure){
|
1392 |
+
var descript = 'Are you sure to continue?';
|
1393 |
+
var ret = confirm(descript);
|
1394 |
+
}
|
1395 |
+
else{
|
1396 |
+
ret = true;
|
1397 |
+
}
|
1398 |
+
if (ret === true) {
|
1399 |
+
wpvivid_restore_sure = true;
|
1400 |
+
var restore_method = '';
|
1401 |
+
if (restore_type == 'backup') {
|
1402 |
+
restore_method = '';
|
1403 |
+
}
|
1404 |
+
else if (restore_type == 'transfer') {
|
1405 |
+
restore_method = 'transfer_';
|
1406 |
+
}
|
1407 |
+
jQuery('#wpvivid_restore_' + restore_method + 'log').html("");
|
1408 |
+
jQuery('#wpvivid_restore_' + restore_method + 'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1409 |
+
jQuery('#wpvivid_clean_' + restore_method + 'restore').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1410 |
+
jQuery('#wpvivid_rollback_' + restore_method + 'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1411 |
+
jQuery('#wpvivid_restore_' + restore_method + 'part').show();
|
1412 |
+
jQuery('#wpvivid_clean_' + restore_method + 'part').hide();
|
1413 |
+
jQuery('#wpvivid_rollback_' + restore_method + 'part').hide();
|
1414 |
+
wpvivid_restore_lock();
|
1415 |
+
wpvivid_restoring = true;
|
1416 |
+
if (wpvivid_restore_need_download) {
|
1417 |
+
wpvivid_download_restore_file(restore_type);
|
1418 |
+
}
|
1419 |
+
else {
|
1420 |
+
wpvivid_monitor_restore_task(restore_type);
|
1421 |
+
if(wpvivid_resotre_is_migrate==0)
|
1422 |
+
{
|
1423 |
+
jQuery('input:radio[option=restore]').each(function()
|
1424 |
+
{
|
1425 |
+
if(jQuery(this).prop('checked'))
|
1426 |
+
{
|
1427 |
+
var value = jQuery(this).prop('value');
|
1428 |
+
if(value == '1')
|
1429 |
+
{
|
1430 |
+
wpvivid_resotre_is_migrate = '1';
|
1431 |
+
}
|
1432 |
+
}
|
1433 |
+
});
|
1434 |
+
}
|
1435 |
+
|
1436 |
+
wpvivid_restore(restore_type);
|
1437 |
+
}
|
1438 |
+
}
|
1439 |
+
}
|
1440 |
+
|
1441 |
+
function wpvivid_download_restore_file(restore_type)
|
1442 |
+
{
|
1443 |
+
var restore_method = '';
|
1444 |
+
if(restore_type == 'backup'){
|
1445 |
+
restore_method = '';
|
1446 |
+
}
|
1447 |
+
else if(restore_type == 'transfer'){
|
1448 |
+
restore_method = 'transfer_';
|
1449 |
+
}
|
1450 |
+
|
1451 |
+
jQuery('#wpvivid_download_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1452 |
+
wpvivid_restore_lock();
|
1453 |
+
if(wpvivid_restore_download_array.length===0)
|
1454 |
+
{
|
1455 |
+
wpvivid_display_restore_msg("Downloading backup file failed. Backup file might be deleted or network doesn't work properly. Please verify the file and confirm the network connection and try again later.", restore_type);
|
1456 |
+
wpvivid_restore_unlock();
|
1457 |
+
return false;
|
1458 |
+
}
|
1459 |
+
|
1460 |
+
if(wpvivid_restore_download_index+1>wpvivid_restore_download_array.length)
|
1461 |
+
{
|
1462 |
+
wpvivid_display_restore_msg("Download succeeded.", restore_type);
|
1463 |
+
wpvivid_restore_is_migrate(restore_type);
|
1464 |
+
wpvivid_restore_need_download = false;
|
1465 |
+
jQuery('#wpvivid_restore_' + restore_method + 'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1466 |
+
jQuery('#wpvivid_clean_' + restore_method + 'restore').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1467 |
+
jQuery('#wpvivid_rollback_' + restore_method + 'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1468 |
+
jQuery('#wpvivid_download_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1469 |
+
jQuery('#wpvivid_restore_' + restore_method + 'part').show();
|
1470 |
+
jQuery('#wpvivid_clean_' + restore_method + 'part').hide();
|
1471 |
+
jQuery('#wpvivid_rollback_' + restore_method + 'part').hide();
|
1472 |
+
jQuery('#wpvivid_download_'+restore_method+'part').hide();
|
1473 |
+
//wpvivid_start_restore(restore_type);
|
1474 |
+
}
|
1475 |
+
else
|
1476 |
+
{
|
1477 |
+
wpvivid_display_restore_msg("Downloading backup file " + wpvivid_restore_download_array[wpvivid_restore_download_index]['file_name'], restore_type);
|
1478 |
+
wpvivid_display_restore_msg('', restore_type, wpvivid_restore_download_index);
|
1479 |
+
var ajax_data = {
|
1480 |
+
'action': 'wpvivid_download_restore',
|
1481 |
+
'backup_id': m_restore_backup_id,
|
1482 |
+
'file_name': wpvivid_restore_download_array[wpvivid_restore_download_index]['file_name'],
|
1483 |
+
'size': wpvivid_restore_download_array[wpvivid_restore_download_index]['size'],
|
1484 |
+
'md5': wpvivid_restore_download_array[wpvivid_restore_download_index]['md5']
|
1485 |
+
}
|
1486 |
+
wpvivid_get_download_restore_progress_retry=0;
|
1487 |
+
wpvivid_monitor_download_restore_task(restore_type);
|
1488 |
+
wpvivid_post_request(ajax_data, function (data) {
|
1489 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
1490 |
+
}, 0);
|
1491 |
+
}
|
1492 |
+
}
|
1493 |
+
|
1494 |
+
function wpvivid_monitor_download_restore_task(restore_type)
|
1495 |
+
{
|
1496 |
+
var restore_method = '';
|
1497 |
+
if(restore_type == 'backup'){
|
1498 |
+
restore_method = '';
|
1499 |
+
}
|
1500 |
+
else if(restore_type == 'transfer'){
|
1501 |
+
restore_method = 'transfer_';
|
1502 |
+
}
|
1503 |
+
|
1504 |
+
var ajax_data={
|
1505 |
+
'action':'wpvivid_get_download_restore_progress',
|
1506 |
+
'file_name': wpvivid_restore_download_array[wpvivid_restore_download_index]['file_name'],
|
1507 |
+
'size': wpvivid_restore_download_array[wpvivid_restore_download_index]['size'],
|
1508 |
+
'md5': wpvivid_restore_download_array[wpvivid_restore_download_index]['md5']
|
1509 |
+
};
|
1510 |
+
|
1511 |
+
wpvivid_post_request(ajax_data, function(data)
|
1512 |
+
{
|
1513 |
+
try
|
1514 |
+
{
|
1515 |
+
var jsonarray = jQuery.parseJSON(data);
|
1516 |
+
if(typeof jsonarray ==='object')
|
1517 |
+
{
|
1518 |
+
if(jsonarray.result === "success")
|
1519 |
+
{
|
1520 |
+
if(jsonarray.status==='completed')
|
1521 |
+
{
|
1522 |
+
wpvivid_display_restore_msg(wpvivid_restore_download_array[wpvivid_restore_download_index]['file_name'] + ' download succeeded.', restore_type, wpvivid_restore_download_index, false);
|
1523 |
+
wpvivid_restore_download_index++;
|
1524 |
+
wpvivid_download_restore_file(restore_type);
|
1525 |
+
wpvivid_restore_unlock();
|
1526 |
+
}
|
1527 |
+
else if(jsonarray.status==='error')
|
1528 |
+
{
|
1529 |
+
jQuery('#wpvivid_restore_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1530 |
+
jQuery('#wpvivid_clean_'+restore_method+'restore').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1531 |
+
jQuery('#wpvivid_rollback_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1532 |
+
jQuery('#wpvivid_download_'+restore_method+'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1533 |
+
jQuery('#wpvivid_restore_'+restore_method+'part').hide();
|
1534 |
+
jQuery('#wpvivid_clean_'+restore_method+'part').hide();
|
1535 |
+
jQuery('#wpvivid_rollback_'+restore_method+'part').hide();
|
1536 |
+
jQuery('#wpvivid_download_'+restore_method+'part').show();
|
1537 |
+
var error_message = jsonarray.error;
|
1538 |
+
wpvivid_display_restore_msg(error_message,restore_type,wpvivid_restore_download_array[wpvivid_restore_download_index]['file_name'],false);
|
1539 |
+
wpvivid_restore_unlock();
|
1540 |
+
}
|
1541 |
+
else if(jsonarray.status==='running')
|
1542 |
+
{
|
1543 |
+
jQuery('#wpvivid_download_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1544 |
+
wpvivid_display_restore_msg(jsonarray.log, restore_type, wpvivid_restore_download_index, false);
|
1545 |
+
setTimeout(function()
|
1546 |
+
{
|
1547 |
+
wpvivid_monitor_download_restore_task(restore_type);
|
1548 |
+
}, 3000);
|
1549 |
+
wpvivid_restore_lock();
|
1550 |
+
}
|
1551 |
+
else if(jsonarray.status==='timeout')
|
1552 |
+
{
|
1553 |
+
wpvivid_get_download_restore_progress_retry++;
|
1554 |
+
if(wpvivid_get_download_restore_progress_retry>10)
|
1555 |
+
{
|
1556 |
+
jQuery('#wpvivid_restore_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1557 |
+
jQuery('#wpvivid_clean_'+restore_method+'restore').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1558 |
+
jQuery('#wpvivid_rollback_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1559 |
+
jQuery('#wpvivid_download_'+restore_method+'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1560 |
+
jQuery('#wpvivid_restore_'+restore_method+'part').hide();
|
1561 |
+
jQuery('#wpvivid_clean_'+restore_method+'part').hide();
|
1562 |
+
jQuery('#wpvivid_rollback_'+restore_method+'part').hide();
|
1563 |
+
jQuery('#wpvivid_download_'+restore_method+'part').show();
|
1564 |
+
var error_message = jsonarray.error;
|
1565 |
+
wpvivid_display_restore_msg(error_message, restore_type);
|
1566 |
+
wpvivid_restore_unlock();
|
1567 |
+
}
|
1568 |
+
else
|
1569 |
+
{
|
1570 |
+
setTimeout(function()
|
1571 |
+
{
|
1572 |
+
wpvivid_monitor_download_restore_task(restore_type);
|
1573 |
+
}, 3000);
|
1574 |
+
}
|
1575 |
+
}
|
1576 |
+
else
|
1577 |
+
{
|
1578 |
+
setTimeout(function()
|
1579 |
+
{
|
1580 |
+
wpvivid_monitor_download_restore_task(restore_type);
|
1581 |
+
}, 3000);
|
1582 |
+
}
|
1583 |
+
}
|
1584 |
+
else
|
1585 |
+
{
|
1586 |
+
wpvivid_get_download_restore_progress_retry++;
|
1587 |
+
if(wpvivid_get_download_restore_progress_retry>10)
|
1588 |
+
{
|
1589 |
+
jQuery('#wpvivid_restore_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1590 |
+
jQuery('#wpvivid_clean_'+restore_method+'restore').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1591 |
+
jQuery('#wpvivid_rollback_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1592 |
+
jQuery('#wpvivid_download_'+restore_method+'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1593 |
+
jQuery('#wpvivid_restore_'+restore_method+'part').hide();
|
1594 |
+
jQuery('#wpvivid_clean_'+restore_method+'part').hide();
|
1595 |
+
jQuery('#wpvivid_rollback_'+restore_method+'part').hide();
|
1596 |
+
jQuery('#wpvivid_download_'+restore_method+'part').show();
|
1597 |
+
var error_message = jsonarray.error;
|
1598 |
+
wpvivid_display_restore_msg(error_message, restore_type);
|
1599 |
+
wpvivid_restore_unlock();
|
1600 |
+
}
|
1601 |
+
else
|
1602 |
+
{
|
1603 |
+
setTimeout(function()
|
1604 |
+
{
|
1605 |
+
wpvivid_monitor_download_restore_task(restore_type);
|
1606 |
+
}, 3000);
|
1607 |
+
}
|
1608 |
+
}
|
1609 |
+
}
|
1610 |
+
else
|
1611 |
+
{
|
1612 |
+
setTimeout(function()
|
1613 |
+
{
|
1614 |
+
wpvivid_monitor_download_restore_task(restore_type);
|
1615 |
+
}, 3000);
|
1616 |
+
}
|
1617 |
+
}
|
1618 |
+
catch(err){
|
1619 |
+
setTimeout(function()
|
1620 |
+
{
|
1621 |
+
wpvivid_monitor_download_restore_task(restore_type);
|
1622 |
+
}, 3000);
|
1623 |
+
}
|
1624 |
+
}, function(XMLHttpRequest, textStatus, errorThrown)
|
1625 |
+
{
|
1626 |
+
setTimeout(function()
|
1627 |
+
{
|
1628 |
+
wpvivid_monitor_download_restore_task(restore_type);
|
1629 |
+
}, 1000);
|
1630 |
+
});
|
1631 |
+
}
|
1632 |
+
|
1633 |
+
/**
|
1634 |
+
* Monitor restore task.
|
1635 |
+
*/
|
1636 |
+
function wpvivid_monitor_restore_task(restore_type){
|
1637 |
+
var restore_method = '';
|
1638 |
+
if(restore_type == 'backup'){
|
1639 |
+
restore_method = '';
|
1640 |
+
}
|
1641 |
+
else if(restore_type == 'transfer'){
|
1642 |
+
restore_method = 'transfer_';
|
1643 |
+
}
|
1644 |
+
|
1645 |
+
var ajax_data={
|
1646 |
+
'action':'wpvivid_get_restore_progress',
|
1647 |
+
'wpvivid_restore' : '1',
|
1648 |
+
};
|
1649 |
+
|
1650 |
+
if(wpvivid_restore_timeout){
|
1651 |
+
jQuery('#wpvivid_restore_'+restore_method+'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1652 |
+
jQuery('#wpvivid_clean_'+restore_method+'restore').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1653 |
+
jQuery('#wpvivid_rollback_'+restore_method+'btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
1654 |
+
jQuery('#wpvivid_restore_'+restore_method+'part').show();
|
1655 |
+
jQuery('#wpvivid_clean_'+restore_method+'part').hide();
|
1656 |
+
jQuery('#wpvivid_rollback_'+restore_method+'part').hide();
|
1657 |
+
wpvivid_restore_unlock();
|
1658 |
+
wpvivid_restoring = false;
|
1659 |
+
wpvivid_display_restore_msg("Website restore times out.", restore_type);
|
1660 |
+
}
|
1661 |
+
else {
|
1662 |
+
wpvivid_post_request(ajax_data, function (data) {
|
1663 |
+
try {
|
1664 |
+
var jsonarray = jQuery.parseJSON(data);
|
1665 |
+
if (typeof jsonarray === 'object') {
|
1666 |
+
if (jsonarray.result === "success") {
|
1667 |
+
jQuery('#wpvivid_restore_' + restore_method + 'log').html("");
|
1668 |
+
while (jsonarray.log.indexOf('\n') >= 0) {
|
1669 |
+
var iLength = jsonarray.log.indexOf('\n');
|
1670 |
+
var log = jsonarray.log.substring(0, iLength);
|
1671 |
+
jsonarray.log = jsonarray.log.substring(iLength + 1);
|
1672 |
+
var insert_log = "<div style=\"clear:both;\">" + log + "</div>";
|
1673 |
+
jQuery('#wpvivid_restore_' + restore_method + 'log').append(insert_log);
|
1674 |
+
var div = jQuery('#wpvivid_restore_' + restore_method + 'log');
|
1675 |
+
div[0].scrollTop = div[0].scrollHeight;
|
1676 |
+
}
|
1677 |
+
|
1678 |
+
if (jsonarray.status === 'wait') {
|
1679 |
+
wpvivid_restoring = true;
|
1680 |
+
jQuery('#wpvivid_restore_' + restore_method + 'btn').css({
|
1681 |
+
'pointer-events': 'none',
|
1682 |
+
'opacity': '0.4'
|
1683 |
+
});
|
1684 |
+
jQuery('#wpvivid_clean_' + restore_method + 'restore').css({
|
1685 |
+
'pointer-events': 'none',
|
1686 |
+
'opacity': '0.4'
|
1687 |
+
});
|
1688 |
+
jQuery('#wpvivid_rollback_' + restore_method + 'btn').css({
|
1689 |
+
'pointer-events': 'none',
|
1690 |
+
'opacity': '0.4'
|
1691 |
+
});
|
1692 |
+
jQuery('#wpvivid_restore_' + restore_method + 'part').show();
|
1693 |
+
jQuery('#wpvivid_clean_' + restore_method + 'part').hide();
|
1694 |
+
jQuery('#wpvivid_rollback_' + restore_method + 'part').hide();
|
1695 |
+
wpvivid_restore(restore_type);
|
1696 |
+
setTimeout(function () {
|
1697 |
+
wpvivid_monitor_restore_task(restore_type);
|
1698 |
+
}, 1000);
|
1699 |
+
}
|
1700 |
+
else if (jsonarray.status === 'completed') {
|
1701 |
+
wpvivid_restoring = false;
|
1702 |
+
wpvivid_restore(restore_type);
|
1703 |
+
wpvivid_restore_unlock();
|
1704 |
+
alert("Restore completed successfully.");
|
1705 |
+
location.reload();
|
1706 |
+
}
|
1707 |
+
else if (jsonarray.status === 'error') {
|
1708 |
+
wpvivid_restore_unlock();
|
1709 |
+
wpvivid_restoring = false;
|
1710 |
+
jQuery('#wpvivid_restore_' + restore_method + 'btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1711 |
+
alert("Restore failed.");
|
1712 |
+
}
|
1713 |
+
else {
|
1714 |
+
setTimeout(function () {
|
1715 |
+
wpvivid_monitor_restore_task(restore_type);
|
1716 |
+
}, 1000);
|
1717 |
+
}
|
1718 |
+
}
|
1719 |
+
else {
|
1720 |
+
setTimeout(function () {
|
1721 |
+
wpvivid_monitor_restore_task(restore_type);
|
1722 |
+
}, 1000);
|
1723 |
+
}
|
1724 |
+
}
|
1725 |
+
else {
|
1726 |
+
setTimeout(function () {
|
1727 |
+
wpvivid_monitor_restore_task(restore_type);
|
1728 |
+
}, 1000);
|
1729 |
+
}
|
1730 |
+
}
|
1731 |
+
catch (err) {
|
1732 |
+
setTimeout(function () {
|
1733 |
+
wpvivid_monitor_restore_task(restore_type);
|
1734 |
+
}, 1000);
|
1735 |
+
}
|
1736 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
1737 |
+
setTimeout(function () {
|
1738 |
+
wpvivid_monitor_restore_task(restore_type);
|
1739 |
+
}, 1000);
|
1740 |
+
});
|
1741 |
+
}
|
1742 |
+
}
|
1743 |
+
|
1744 |
+
function wpvivid_restore(restore_type){
|
1745 |
+
var restore_method = '';
|
1746 |
+
if(restore_type == 'backup'){
|
1747 |
+
restore_method = '';
|
1748 |
+
}
|
1749 |
+
else if(restore_type == 'transfer'){
|
1750 |
+
restore_method = 'transfer_';
|
1751 |
+
}
|
1752 |
+
|
1753 |
+
var skip_old_site = '1';
|
1754 |
+
var extend_option = {
|
1755 |
+
'skip_backup_old_site':skip_old_site,
|
1756 |
+
'skip_backup_old_database':skip_old_site
|
1757 |
+
};
|
1758 |
+
|
1759 |
+
var migrate_option = {
|
1760 |
+
'is_migrate':wpvivid_resotre_is_migrate,
|
1761 |
+
};
|
1762 |
+
jQuery.extend(extend_option, migrate_option);
|
1763 |
+
|
1764 |
+
var restore_options = {
|
1765 |
+
0:'backup_db',
|
1766 |
+
1:'backup_themes',
|
1767 |
+
2:'backup_plugin',
|
1768 |
+
3:'backup_uploads',
|
1769 |
+
4:'backup_content',
|
1770 |
+
5:'backup_core'
|
1771 |
+
};
|
1772 |
+
jQuery.extend(restore_options, extend_option);
|
1773 |
+
var json = JSON.stringify(restore_options);
|
1774 |
+
var ajax_data={
|
1775 |
+
'action':'wpvivid_restore',
|
1776 |
+
'wpvivid_restore':'1',
|
1777 |
+
'backup_id':m_restore_backup_id,
|
1778 |
+
'restore_options':json
|
1779 |
+
};
|
1780 |
+
setTimeout(function () {
|
1781 |
+
wpvivid_restore_timeout = true;
|
1782 |
+
}, restore_max_exection_time);
|
1783 |
+
wpvivid_post_request(ajax_data, function(data) {
|
1784 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
1785 |
+
});
|
1786 |
+
}
|
1787 |
+
|
1788 |
+
function wpvivid_display_restore_msg(msg, restore_type, div_id, append = true){
|
1789 |
+
var restore_method = '';
|
1790 |
+
if(restore_type == 'backup'){
|
1791 |
+
restore_method = '';
|
1792 |
+
}
|
1793 |
+
else if(restore_type == 'transfer'){
|
1794 |
+
restore_method = 'transfer_';
|
1795 |
+
}
|
1796 |
+
|
1797 |
+
if(typeof div_id == 'undefined') {
|
1798 |
+
var restore_msg = "<div style=\"clear:both;\">" + msg + "</div>";
|
1799 |
+
}
|
1800 |
+
else{
|
1801 |
+
var restore_msg = "<div id=\"restore_file_"+div_id+"\" style=\"clear:both;\">" + msg + "</div>";
|
1802 |
+
}
|
1803 |
+
if(append == true) {
|
1804 |
+
jQuery('#wpvivid_restore_'+restore_method+'log').append(restore_msg);
|
1805 |
+
}
|
1806 |
+
else{
|
1807 |
+
if(jQuery('#restore_file_'+div_id).length )
|
1808 |
+
{
|
1809 |
+
jQuery('#restore_file_'+div_id).html(msg);
|
1810 |
+
}
|
1811 |
+
else
|
1812 |
+
{
|
1813 |
+
jQuery('#wpvivid_restore_'+restore_method+'log').append(restore_msg);
|
1814 |
+
}
|
1815 |
+
}
|
1816 |
+
var div = jQuery('#wpvivid_restore_' + restore_method + 'log');
|
1817 |
+
div[0].scrollTop = div[0].scrollHeight;
|
1818 |
+
}
|
1819 |
+
|
1820 |
+
/**
|
1821 |
+
* Lock certain operations while a restore task is running.
|
1822 |
+
*/
|
1823 |
+
function wpvivid_restore_lock(){
|
1824 |
+
jQuery('#wpvivid_postbox_backup_percent').css({'pointer-events': 'none', 'opacity': '1'});
|
1825 |
+
jQuery('#wpvivid_postbox_backup').css({'pointer-events': 'none', 'opacity': '1'});
|
1826 |
+
jQuery('#wpvivid_postbox_backup_schedule').css({'pointer-events': 'none', 'opacity': '1'});
|
1827 |
+
jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'none', 'opacity': '1'});
|
1828 |
+
jQuery('#wpvivid_tab_backup').css({'pointer-events': 'none', 'opacity': '1'});
|
1829 |
+
jQuery('#wpvivid_tab_upload').css({'pointer-events': 'none', 'opacity': '1'});
|
1830 |
+
jQuery('#wpvivid_tab_backup_log').css({'pointer-events': 'none', 'opacity': '1'});
|
1831 |
+
jQuery('#wpvivid_tab_restore').css({'pointer-events': 'none', 'opacity': '1'});
|
1832 |
+
jQuery('#page-backups').css({'pointer-events': 'none', 'opacity': '1'});
|
1833 |
+
jQuery('#storage-page').css({'pointer-events': 'none', 'opacity': '1'});
|
1834 |
+
jQuery('#settings-page').css({'pointer-events': 'none', 'opacity': '1'});
|
1835 |
+
jQuery('#debug-page').css({'pointer-events': 'none', 'opacity': '1'});
|
1836 |
+
jQuery('#logs-page').css({'pointer-events': 'none', 'opacity': '1'});
|
1837 |
+
jQuery('#wpvivid_tab_migrate').css({'pointer-events': 'none', 'opacity': '1'});
|
1838 |
+
jQuery('#wpvivid_add_tab_migrate').css({'pointer-events': 'none', 'opacity': '1'});
|
1839 |
+
jQuery('#wpvivid_add_tab_import').css({'pointer-events': 'none', 'opacity': '1'});
|
1840 |
+
jQuery('#wpvivid_add_tab_key').css({'pointer-events': 'none', 'opacity': '1'});
|
1841 |
+
jQuery('#wpvivid_add_tab_log').css({'pointer-events': 'none', 'opacity': '1'});
|
1842 |
+
jQuery('#wpvivid_add_tab_restore').css({'pointer-events': 'none', 'opacity': '1'});
|
1843 |
+
jQuery('#wpvivid_restore_is_migrate').css({'pointer-events': 'none', 'opacity': '1'});
|
1844 |
+
jQuery('#wpvivid_replace_domain').css({'pointer-events': 'none', 'opacity': '1'});
|
1845 |
+
jQuery('#wpvivid_keep_domain').css({'pointer-events': 'none', 'opacity': '1'});
|
1846 |
+
}
|
1847 |
+
|
1848 |
+
/**
|
1849 |
+
* Unlock the operations once restore task completed.
|
1850 |
+
*/
|
1851 |
+
function wpvivid_restore_unlock(){
|
1852 |
+
jQuery('#wpvivid_postbox_backup_percent').css({'pointer-events': 'auto', 'opacity': '1'});
|
1853 |
+
jQuery('#wpvivid_postbox_backup').css({'pointer-events': 'auto', 'opacity': '1'});
|
1854 |
+
jQuery('#wpvivid_postbox_backup_schedule').css({'pointer-events': 'auto', 'opacity': '1'});
|
1855 |
+
jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
1856 |
+
jQuery('#wpvivid_tab_backup').css({'pointer-events': 'auto', 'opacity': '1'});
|
1857 |
+
jQuery('#wpvivid_tab_upload').css({'pointer-events': 'auto', 'opacity': '1'});
|
1858 |
+
jQuery('#wpvivid_tab_backup_log').css({'pointer-events': 'auto', 'opacity': '1'});
|
1859 |
+
jQuery('#wpvivid_tab_restore').css({'pointer-events': 'auto', 'opacity': '1'});
|
1860 |
+
jQuery('#page-backups').css({'pointer-events': 'auto', 'opacity': '1'});
|
1861 |
+
jQuery('#storage-page').css({'pointer-events': 'auto', 'opacity': '1'});
|
1862 |
+
jQuery('#settings-page').css({'pointer-events': 'auto', 'opacity': '1'});
|
1863 |
+
jQuery('#debug-page').css({'pointer-events': 'auto', 'opacity': '1'});
|
1864 |
+
jQuery('#logs-page').css({'pointer-events': 'auto', 'opacity': '1'});
|
1865 |
+
jQuery('#wpvivid_tab_migrate').css({'pointer-events': 'auto', 'opacity': '1'});
|
1866 |
+
jQuery('#wpvivid_add_tab_migrate').css({'pointer-events': 'auto', 'opacity': '1'});
|
1867 |
+
jQuery('#wpvivid_add_tab_import').css({'pointer-events': 'auto', 'opacity': '1'});
|
1868 |
+
jQuery('#wpvivid_add_tab_key').css({'pointer-events': 'auto', 'opacity': '1'});
|
1869 |
+
jQuery('#wpvivid_add_tab_log').css({'pointer-events': 'auto', 'opacity': '1'});
|
1870 |
+
jQuery('#wpvivid_add_tab_restore').css({'pointer-events': 'auto', 'opacity': '1'});
|
1871 |
+
jQuery('#wpvivid_restore_is_migrate').css({'pointer-events': 'auto', 'opacity': '1'});
|
1872 |
+
jQuery('#wpvivid_replace_domain').css({'pointer-events': 'auto', 'opacity': '1'});
|
1873 |
+
jQuery('#wpvivid_keep_domain').css({'pointer-events': 'auto', 'opacity': '1'});
|
1874 |
+
}
|
1875 |
+
</script>
|
1876 |
+
<?php
|
1877 |
+
}
|
1878 |
+
|
1879 |
+
function wpvivid_backuppage_add_page_downlaod(){
|
1880 |
+
?>
|
1881 |
+
<div class="backup-tab-content wpvivid_tab_download" id="page-download" style="padding-top: 1em; display:none;">
|
1882 |
+
<div id="wpvivid_init_download_info">
|
1883 |
+
<div style="float: left; height: 20px; line-height: 20px; margin-top: 4px;">Initializing the download info</div>
|
1884 |
+
<div class="spinner" style="float: left;"></div>
|
1885 |
+
<div style="clear: both;"></div>
|
1886 |
+
</div>
|
1887 |
+
<div class="wpvivid-element-space-bottom" id="wpvivid_files_list">
|
1888 |
+
</div>
|
1889 |
+
</div>
|
1890 |
+
|
1891 |
+
<script>
|
1892 |
+
var wpvivid_download_files_list = wpvivid_download_files_list || {};
|
1893 |
+
wpvivid_download_files_list.backup_id='';
|
1894 |
+
wpvivid_download_files_list.wpvivid_download_file_array = Array();
|
1895 |
+
wpvivid_download_files_list.wpvivid_download_lock_array = Array();
|
1896 |
+
wpvivid_download_files_list.init=function(backup_id) {
|
1897 |
+
wpvivid_download_files_list.backup_id=backup_id;
|
1898 |
+
wpvivid_download_files_list.wpvivid_download_file_array.splice(0, wpvivid_download_files_list.wpvivid_download_file_array.length);
|
1899 |
+
};
|
1900 |
+
|
1901 |
+
wpvivid_download_files_list.add_download_queue=function(filename) {
|
1902 |
+
var download_file_size = jQuery("[slug='"+filename+"']").find('.wpvivid-download-status').find('.wpvivid-download-file-size').html();
|
1903 |
+
var tmp_html = '<div class="wpvivid-element-space-bottom">' +
|
1904 |
+
'<span class="wpvivid-element-space-right">Retriving (remote storage to web server)</span><span class="wpvivid-element-space-right">|</span><span>File Size: </span><span class="wpvivid-element-space-right">'+download_file_size+'</span><span class="wpvivid-element-space-right">|</span><span>Downloaded Size: </span><span>0</span>' +
|
1905 |
+
'</div>' +
|
1906 |
+
'<div style="width:100%;height:10px; background-color:#dcdcdc;">' +
|
1907 |
+
'<div style="background-color:#0085ba; float:left;width:0%;height:10px;"></div>' +
|
1908 |
+
'</div>';
|
1909 |
+
jQuery("[slug='"+filename+"']").find('.wpvivid-download-status').html(tmp_html);
|
1910 |
+
if(jQuery.inArray(filename, wpvivid_download_files_list.wpvivid_download_file_array) === -1) {
|
1911 |
+
wpvivid_download_files_list.wpvivid_download_file_array.push(filename);
|
1912 |
+
}
|
1913 |
+
var ajax_data = {
|
1914 |
+
'action': 'wpvivid_prepare_download_backup',
|
1915 |
+
'backup_id':wpvivid_download_files_list.backup_id,
|
1916 |
+
'file_name':filename
|
1917 |
+
};
|
1918 |
+
wpvivid_post_request(ajax_data, function(data)
|
1919 |
+
{
|
1920 |
+
}, function(XMLHttpRequest, textStatus, errorThrown)
|
1921 |
+
{
|
1922 |
+
}, 0);
|
1923 |
+
|
1924 |
+
wpvivid_download_files_list.check_queue();
|
1925 |
+
};
|
1926 |
+
|
1927 |
+
wpvivid_download_files_list.check_queue=function() {
|
1928 |
+
if(jQuery.inArray(wpvivid_download_files_list.backup_id, wpvivid_download_files_list.wpvivid_download_lock_array) !== -1){
|
1929 |
+
return;
|
1930 |
+
}
|
1931 |
+
var ajax_data = {
|
1932 |
+
'action': 'wpvivid_get_download_progress',
|
1933 |
+
'backup_id':wpvivid_download_files_list.backup_id,
|
1934 |
+
};
|
1935 |
+
wpvivid_download_files_list.wpvivid_download_lock_array.push(wpvivid_download_files_list.backup_id);
|
1936 |
+
wpvivid_post_request(ajax_data, function(data)
|
1937 |
+
{
|
1938 |
+
wpvivid_download_files_list.wpvivid_download_lock_array.splice(jQuery.inArray(wpvivid_download_files_list.backup_id, wpvivid_download_files_list.wpvivid_download_file_array),1);
|
1939 |
+
var jsonarray = jQuery.parseJSON(data);
|
1940 |
+
if (jsonarray.result === 'success')
|
1941 |
+
{
|
1942 |
+
jQuery.each(jsonarray.files,function (index, value)
|
1943 |
+
{
|
1944 |
+
if(jQuery.inArray(index, wpvivid_download_files_list.wpvivid_download_file_array) !== -1) {
|
1945 |
+
if(value.status === 'timeout' || value.status === 'completed' || value.status === 'error'){
|
1946 |
+
wpvivid_download_files_list.wpvivid_download_file_array.splice(jQuery.inArray(index, wpvivid_download_files_list.wpvivid_download_file_array),1);
|
1947 |
+
}
|
1948 |
+
wpvivid_download_files_list.update_item(index, value);
|
1949 |
+
}
|
1950 |
+
});
|
1951 |
+
|
1952 |
+
//if(jsonarray.need_update)
|
1953 |
+
if(wpvivid_download_files_list.wpvivid_download_file_array.length > 0)
|
1954 |
+
{
|
1955 |
+
setTimeout(function()
|
1956 |
+
{
|
1957 |
+
wpvivid_download_files_list.check_queue();
|
1958 |
+
}, 3000);
|
1959 |
+
}
|
1960 |
+
}
|
1961 |
+
}, function(XMLHttpRequest, textStatus, errorThrown)
|
1962 |
+
{
|
1963 |
+
wpvivid_download_files_list.wpvivid_download_lock_array.splice(jQuery.inArray(wpvivid_download_files_list.backup_id, wpvivid_download_files_list.wpvivid_download_file_array),1);
|
1964 |
+
setTimeout(function()
|
1965 |
+
{
|
1966 |
+
wpvivid_download_files_list.check_queue();
|
1967 |
+
}, 3000);
|
1968 |
+
}, 0);
|
1969 |
+
};
|
1970 |
+
|
1971 |
+
wpvivid_download_files_list.update_item=function(index,file) {
|
1972 |
+
jQuery("[slug='"+index+"']").find('.wpvivid-download-status').html(file.html);
|
1973 |
+
};
|
1974 |
+
|
1975 |
+
wpvivid_download_files_list.download_now=function(filename) {
|
1976 |
+
wpvivid_location_href=true;
|
1977 |
+
location.href =ajaxurl+'?_wpnonce='+wpvivid_ajax_object.ajax_nonce+'&action=wpvivid_download_backup&backup_id='+wpvivid_download_files_list.backup_id+'&file_name='+filename;
|
1978 |
+
};
|
1979 |
+
|
1980 |
+
function wpvivid_initialize_download(backup_id, list_name){
|
1981 |
+
jQuery('#wpvivid_tab_download').show();
|
1982 |
+
wpvivid_click_switch_page('backup', 'wpvivid_tab_download', true);
|
1983 |
+
wpvivid_init_download_page(backup_id);
|
1984 |
+
|
1985 |
+
|
1986 |
+
/*wpvivid_reset_backup_list(list_name);
|
1987 |
+
jQuery('#wpvivid_download_loading_'+backup_id).addClass('is-active');
|
1988 |
+
tmp_current_click_backupid = backup_id;
|
1989 |
+
var ajax_data = {
|
1990 |
+
'action':'wpvivid_init_download_page',
|
1991 |
+
'backup_id':backup_id
|
1992 |
+
};
|
1993 |
+
wpvivid_post_request(ajax_data, function(data){
|
1994 |
+
try {
|
1995 |
+
var jsonarray = jQuery.parseJSON(data);
|
1996 |
+
jQuery('#wpvivid_download_loading_'+backup_id).removeClass('is-active');
|
1997 |
+
if (jsonarray.result === 'success') {
|
1998 |
+
jQuery('#wpvivid_file_part_' + backup_id).html("");
|
1999 |
+
var i = 0;
|
2000 |
+
var file_not_found = false;
|
2001 |
+
var file_name = '';
|
2002 |
+
jQuery.each(jsonarray.files, function (index, value) {
|
2003 |
+
i++;
|
2004 |
+
file_name = index;
|
2005 |
+
if (value.status === 'need_download') {
|
2006 |
+
jQuery('#wpvivid_file_part_' + backup_id).append(value.html);
|
2007 |
+
//tmp_current_click_backupid = '';
|
2008 |
+
}
|
2009 |
+
else if (value.status === 'running') {
|
2010 |
+
if (m_downloading_file_name === file_name) {
|
2011 |
+
wpvivid_lock_download(tmp_current_click_backupid);
|
2012 |
+
}
|
2013 |
+
jQuery('#wpvivid_file_part_' + backup_id).append(value.html);
|
2014 |
+
}
|
2015 |
+
else if (value.status === 'completed') {
|
2016 |
+
if (m_downloading_file_name === file_name) {
|
2017 |
+
wpvivid_unlock_download(tmp_current_click_backupid);
|
2018 |
+
m_downloading_id = '';
|
2019 |
+
m_downloading_file_name = '';
|
2020 |
+
}
|
2021 |
+
jQuery('#wpvivid_file_part_' + backup_id).append(value.html);
|
2022 |
+
//tmp_current_click_backupid = '';
|
2023 |
+
}
|
2024 |
+
else if (value.status === 'timeout') {
|
2025 |
+
if (m_downloading_file_name === file_name) {
|
2026 |
+
wpvivid_unlock_download(tmp_current_click_backupid);
|
2027 |
+
m_downloading_id = '';
|
2028 |
+
m_downloading_file_name = '';
|
2029 |
+
}
|
2030 |
+
jQuery('#wpvivid_file_part_' + backup_id).append(value.html);
|
2031 |
+
//tmp_current_click_backupid = '';
|
2032 |
+
}
|
2033 |
+
else if (value.status === 'file_not_found') {
|
2034 |
+
wpvivid_unlock_download(tmp_current_click_backupid);
|
2035 |
+
wpvivid_reset_backup_list(list_name);
|
2036 |
+
file_not_found = true;
|
2037 |
+
alert("Download failed, file not found. The file might has been moved, renamed or deleted. Please verify the file exists and try again.");
|
2038 |
+
//tmp_current_click_backupid = '';
|
2039 |
+
return false;
|
2040 |
+
}
|
2041 |
+
});
|
2042 |
+
if (file_not_found === false) {
|
2043 |
+
jQuery('#wpvivid_file_part_' + backup_id).append(jsonarray.place_html);
|
2044 |
+
}
|
2045 |
+
}
|
2046 |
+
}
|
2047 |
+
catch(err){
|
2048 |
+
alert(err);
|
2049 |
+
jQuery('#wpvivid_download_loading_'+backup_id).removeClass('is-active');
|
2050 |
+
}
|
2051 |
+
},function(XMLHttpRequest, textStatus, errorThrown){
|
2052 |
+
jQuery('#wpvivid_download_loading_'+backup_id).removeClass('is-active');
|
2053 |
+
var error_message = wpvivid_output_ajaxerror('initializing download information', textStatus, errorThrown);
|
2054 |
+
alert(error_message);
|
2055 |
+
});*/
|
2056 |
+
}
|
2057 |
+
|
2058 |
+
function wpvivid_init_download_page(backup_id){
|
2059 |
+
jQuery('#wpvivid_files_list').html('');
|
2060 |
+
jQuery('#wpvivid_init_download_info').show();
|
2061 |
+
jQuery('#wpvivid_init_download_info').find('.spinner').addClass('is-active');
|
2062 |
+
var ajax_data = {
|
2063 |
+
'action':'wpvivid_init_download_page',
|
2064 |
+
'backup_id':backup_id
|
2065 |
+
};
|
2066 |
+
var retry = '<input type="button" class="button button-primary" value="Retry the initialization" onclick="wpvivid_init_download_page(\''+backup_id+'\');" />';
|
2067 |
+
|
2068 |
+
wpvivid_post_request(ajax_data, function(data)
|
2069 |
+
{
|
2070 |
+
jQuery('#wpvivid_init_download_info').hide();
|
2071 |
+
jQuery('#wpvivid_init_download_info').find('.spinner').removeClass('is-active');
|
2072 |
+
try
|
2073 |
+
{
|
2074 |
+
var jsonarray = jQuery.parseJSON(data);
|
2075 |
+
if (jsonarray.result === 'success')
|
2076 |
+
{
|
2077 |
+
wpvivid_download_files_list.init(backup_id);
|
2078 |
+
var need_check_queue = false;
|
2079 |
+
jQuery.each(jsonarray.files,function (index, value)
|
2080 |
+
{
|
2081 |
+
if(value.status === 'running'){
|
2082 |
+
if(jQuery.inArray(index, wpvivid_download_files_list.wpvivid_download_file_array) === -1) {
|
2083 |
+
wpvivid_download_files_list.wpvivid_download_file_array.push(index);
|
2084 |
+
need_check_queue = true;
|
2085 |
+
}
|
2086 |
+
}
|
2087 |
+
});
|
2088 |
+
if(need_check_queue) {
|
2089 |
+
wpvivid_download_files_list.check_queue();
|
2090 |
+
}
|
2091 |
+
jQuery('#wpvivid_files_list').html(jsonarray.html);
|
2092 |
+
}
|
2093 |
+
else{
|
2094 |
+
alert(jsonarray.error);
|
2095 |
+
jQuery('#wpvivid_files_list').html(retry);
|
2096 |
+
}
|
2097 |
+
}
|
2098 |
+
catch(err)
|
2099 |
+
{
|
2100 |
+
alert(err);
|
2101 |
+
jQuery('#wpvivid_files_list').html(retry);
|
2102 |
+
}
|
2103 |
+
},function(XMLHttpRequest, textStatus, errorThrown)
|
2104 |
+
{
|
2105 |
+
jQuery('#wpvivid_init_download_info').hide();
|
2106 |
+
jQuery('#wpvivid_init_download_info').find('.spinner').removeClass('is-active');
|
2107 |
+
var error_message = wpvivid_output_ajaxerror('initializing download information', textStatus, errorThrown);
|
2108 |
+
alert(error_message);
|
2109 |
+
jQuery('#wpvivid_files_list').html(retry);
|
2110 |
+
});
|
2111 |
+
}
|
2112 |
+
|
2113 |
+
function wpvivid_download_change_page(page)
|
2114 |
+
{
|
2115 |
+
var backup_id=wpvivid_download_files_list.backup_id;
|
2116 |
+
|
2117 |
+
var ajax_data = {
|
2118 |
+
'action':'wpvivid_get_download_page_ex',
|
2119 |
+
'backup_id':backup_id,
|
2120 |
+
'page':page
|
2121 |
+
};
|
2122 |
+
|
2123 |
+
jQuery('#wpvivid_files_list').html('');
|
2124 |
+
jQuery('#wpvivid_init_download_info').show();
|
2125 |
+
jQuery('#wpvivid_init_download_info').find('.spinner').addClass('is-active');
|
2126 |
+
|
2127 |
+
wpvivid_post_request(ajax_data, function(data)
|
2128 |
+
{
|
2129 |
+
jQuery('#wpvivid_init_download_info').hide();
|
2130 |
+
jQuery('#wpvivid_init_download_info').find('.spinner').removeClass('is-active');
|
2131 |
+
try
|
2132 |
+
{
|
2133 |
+
var jsonarray = jQuery.parseJSON(data);
|
2134 |
+
if (jsonarray.result === 'success')
|
2135 |
+
{
|
2136 |
+
jQuery('#wpvivid_files_list').html(jsonarray.html);
|
2137 |
+
}
|
2138 |
+
else{
|
2139 |
+
alert(jsonarray.error);
|
2140 |
+
}
|
2141 |
+
}
|
2142 |
+
catch(err)
|
2143 |
+
{
|
2144 |
+
alert(err);
|
2145 |
+
}
|
2146 |
+
},function(XMLHttpRequest, textStatus, errorThrown)
|
2147 |
+
{
|
2148 |
+
jQuery('#wpvivid_init_download_info').hide();
|
2149 |
+
jQuery('#wpvivid_init_download_info').find('.spinner').removeClass('is-active');
|
2150 |
+
var error_message = wpvivid_output_ajaxerror('initializing download information', textStatus, errorThrown);
|
2151 |
+
alert(error_message);
|
2152 |
+
});
|
2153 |
+
}
|
2154 |
+
|
2155 |
+
jQuery('#wpvivid_files_list').on("click",'.wpvivid-download',function()
|
2156 |
+
{
|
2157 |
+
var Obj=jQuery(this);
|
2158 |
+
var file_name=Obj.closest('tr').attr('slug');
|
2159 |
+
wpvivid_download_files_list.add_download_queue(file_name);
|
2160 |
+
});
|
2161 |
+
jQuery('#wpvivid_files_list').on("click",'.wpvivid-ready-download',function()
|
2162 |
+
{
|
2163 |
+
var Obj=jQuery(this);
|
2164 |
+
var file_name=Obj.closest('tr').attr('slug');
|
2165 |
+
wpvivid_download_files_list.download_now(file_name);
|
2166 |
+
});
|
2167 |
+
|
2168 |
+
jQuery('#wpvivid_files_list').on("click",'.first-page',function() {
|
2169 |
+
wpvivid_download_change_page('first');
|
2170 |
+
});
|
2171 |
+
|
2172 |
+
jQuery('#wpvivid_files_list').on("click",'.prev-page',function() {
|
2173 |
+
var page=parseInt(jQuery(this).attr('value'));
|
2174 |
+
wpvivid_download_change_page(page-1);
|
2175 |
+
});
|
2176 |
+
|
2177 |
+
jQuery('#wpvivid_files_list').on("click",'.next-page',function() {
|
2178 |
+
var page=parseInt(jQuery(this).attr('value'));
|
2179 |
+
wpvivid_download_change_page(page+1);
|
2180 |
+
});
|
2181 |
+
|
2182 |
+
jQuery('#wpvivid_files_list').on("click",'.last-page',function() {
|
2183 |
+
wpvivid_download_change_page('last');
|
2184 |
+
});
|
2185 |
+
|
2186 |
+
jQuery('#wpvivid_files_list').on("keypress", '.current-page', function(){
|
2187 |
+
if(event.keyCode === 13){
|
2188 |
+
var page = jQuery(this).val();
|
2189 |
+
wpvivid_download_change_page(page);
|
2190 |
+
}
|
2191 |
+
});
|
2192 |
+
</script>
|
2193 |
+
<?php
|
2194 |
+
}
|
2195 |
+
|
2196 |
+
function wpvivid_backuppage_add_progress_module(){
|
2197 |
+
?>
|
2198 |
+
<div class="postbox" id="wpvivid_postbox_backup_percent" style="display: none;">
|
2199 |
+
<div class="action-progress-bar" id="wpvivid_action_progress_bar">
|
2200 |
+
<div class="action-progress-bar-percent" id="wpvivid_action_progress_bar_percent" style="height:24px;width:0;"></div>
|
2201 |
+
</div>
|
2202 |
+
<div id="wpvivid_estimate_backup_info" style="float: left;">
|
2203 |
+
<div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('Database Size:', 'wpvivid-backuprestore'); ?></span><span id="wpvivid_backup_database_size">N/A</span></div>
|
2204 |
+
<div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('File Size:', 'wpvivid-backuprestore'); ?></span><span id="wpvivid_backup_file_size">N/A</span></div>
|
2205 |
+
</div>
|
2206 |
+
<div id="wpvivid_estimate_upload_info" style="float: left;">
|
2207 |
+
<div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('Total Size:', 'wpvivid-backuprestore'); ?></span><span>N/A</span></div>
|
2208 |
+
<div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('Uploaded:', 'wpvivid-backuprestore'); ?></span><span>N/A</span></div>
|
2209 |
+
<div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('Speed:', 'wpvivid-backuprestore'); ?></span><span>N/A</span></div>
|
2210 |
+
</div>
|
2211 |
+
<div style="float: left;">
|
2212 |
+
<div class="backup-basic-info"><span class="wpvivid-element-space-right"><?php _e('Network Connection:', 'wpvivid-backuprestore'); ?></span><span>N/A</span></div>
|
2213 |
+
</div>
|
2214 |
+
<div style="clear:both;"></div>
|
2215 |
+
<div style="margin-left:10px; float: left; width:100%;"><p id="wpvivid_current_doing"></p></div>
|
2216 |
+
<div style="clear: both;"></div>
|
2217 |
+
<div>
|
2218 |
+
<div id="wpvivid_backup_cancel" class="backup-log-btn"><input class="button-primary" id="wpvivid_backup_cancel_btn" type="submit" value="<?php esc_attr_e( 'Cancel', 'wpvivid-backuprestore' ); ?>" /></div>
|
2219 |
+
<div id="wpvivid_backup_log" class="backup-log-btn"><input class="button-primary" id="wpvivid_backup_log_btn" type="submit" value="<?php esc_attr_e( 'Log', 'wpvivid-backuprestore' ); ?>" /></div>
|
2220 |
+
</div>
|
2221 |
+
<div style="clear: both;"></div>
|
2222 |
+
</div>
|
2223 |
+
<script>
|
2224 |
+
jQuery('#wpvivid_postbox_backup_percent').on("click", "input", function(){
|
2225 |
+
if(jQuery(this).attr('id') === 'wpvivid_backup_cancel_btn'){
|
2226 |
+
wpvivid_cancel_backup();
|
2227 |
+
}
|
2228 |
+
if(jQuery(this).attr('id') === 'wpvivid_backup_log_btn'){
|
2229 |
+
wpvivid_read_log('wpvivid_view_backup_task_log');
|
2230 |
+
}
|
2231 |
+
});
|
2232 |
+
|
2233 |
+
function wpvivid_cancel_backup(){
|
2234 |
+
var ajax_data= {
|
2235 |
+
'action': 'wpvivid_backup_cancel'
|
2236 |
+
//'task_id': running_backup_taskid
|
2237 |
+
};
|
2238 |
+
jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
2239 |
+
wpvivid_post_request(ajax_data, function(data){
|
2240 |
+
try {
|
2241 |
+
var jsonarray = jQuery.parseJSON(data);
|
2242 |
+
jQuery('#wpvivid_current_doing').html(jsonarray.msg);
|
2243 |
+
}
|
2244 |
+
catch(err){
|
2245 |
+
alert(err);
|
2246 |
+
}
|
2247 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
2248 |
+
jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
2249 |
+
var error_message = wpvivid_output_ajaxerror('cancelling the backup', textStatus, errorThrown);
|
2250 |
+
wpvivid_add_notice('Backup', 'Error', error_message);
|
2251 |
+
});
|
2252 |
+
}
|
2253 |
+
</script>
|
2254 |
+
<?php
|
2255 |
+
}
|
2256 |
+
|
2257 |
+
function wpvivid_backuppage_add_backup_module(){
|
2258 |
+
?>
|
2259 |
+
<div class="postbox quickbackup" id="wpvivid_postbox_backup">
|
2260 |
+
<?php
|
2261 |
+
do_action('wpvivid_backup_module_add_sub');
|
2262 |
+
?>
|
2263 |
+
</div>
|
2264 |
+
<?php
|
2265 |
+
}
|
2266 |
+
|
2267 |
+
function wpvivid_backup_module_add_descript(){
|
2268 |
+
$backupdir=WPvivid_Setting::get_backupdir();
|
2269 |
+
?>
|
2270 |
+
<div style="font-size: 14px; padding: 8px 12px; margin: 0; line-height: 1.4; font-weight: 600;">
|
2271 |
+
<span style="margin-right: 5px;"><?php _e( 'Back Up Manually','wpvivid-backuprestore'); ?></span>
|
2272 |
+
<span style="margin-right: 5px;">|</span>
|
2273 |
+
<span style="margin-right: 0;"><a href="<?php echo esc_url('https://wordpress.org/plugins/wpvivid-imgoptim/'); ?>" style="text-decoration: none;"><?php _e('Compress images with our image optimization plugin, it\'s free', 'wpvivid-backuprestore'); ?></a></span>
|
2274 |
+
</div>
|
2275 |
+
<div class="quickstart-storage-setting">
|
2276 |
+
<span class="list-top-chip backup" name="ismerge" value="1" style="margin: 10px 10px 10px 0;"><?php _e('Local Storage Directory:', 'wpvivid-backuprestore'); ?></span>
|
2277 |
+
<span class="list-top-chip" id="wpvivid_local_storage_path" style="margin: 10px 10px 10px 0;"><?php _e(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backupdir); ?></span>
|
2278 |
+
<span class="list-top-chip" style="margin: 10px 10px 10px 0;"><a href="#" onclick="wpvivid_click_switch_page('wrap', 'wpvivid_tab_setting', true);" style="text-decoration: none;"><?php _e('rename directory', 'wpvivid-backuprestore'); ?></a></span>
|
2279 |
+
</div>
|
2280 |
+
<?php
|
2281 |
+
}
|
2282 |
+
|
2283 |
+
function wpvivid_backup_module_add_backup_type(){
|
2284 |
+
$backup_type = '';
|
2285 |
+
$type_name = 'backup_files';
|
2286 |
+
?>
|
2287 |
+
<div class="quickstart-archive-block">
|
2288 |
+
<fieldset>
|
2289 |
+
<legend class="screen-reader-text"><span>input type="radio"</span></legend>
|
2290 |
+
<?php echo apply_filters('wpvivid_add_backup_type', $backup_type, $type_name); ?>
|
2291 |
+
<label style="display: none;">
|
2292 |
+
<input type="checkbox" option="backup" name="ismerge" value="1" checked />
|
2293 |
+
</label><br>
|
2294 |
+
</fieldset>
|
2295 |
+
</div>
|
2296 |
+
<?php
|
2297 |
+
}
|
2298 |
+
|
2299 |
+
function wpvivid_backup_module_add_send_remote(){
|
2300 |
+
$pic='';
|
2301 |
+
?>
|
2302 |
+
<div class="quickstart-storage-block">
|
2303 |
+
<fieldset>
|
2304 |
+
<legend class="screen-reader-text"><span>input type="checkbox"</span></legend>
|
2305 |
+
<label>
|
2306 |
+
<input type="radio" id="wpvivid_backup_local" option="backup_ex" name="local_remote" value="local" checked />
|
2307 |
+
<span><?php _e( 'Save Backups to Local', 'wpvivid-backuprestore' ); ?></span>
|
2308 |
+
</label><br>
|
2309 |
+
<label>
|
2310 |
+
<input type="radio" id="wpvivid_backup_remote" option="backup_ex" name="local_remote" value="remote" />
|
2311 |
+
<span><?php _e( 'Send Backup to Remote Storage:', 'wpvivid-backuprestore' ); ?></span>
|
2312 |
+
</label><br>
|
2313 |
+
<div id="upload_storage" style="cursor:pointer;" title="Highlighted icon illuminates that you have choosed a remote storage to store backups">
|
2314 |
+
<?php echo apply_filters('wpvivid_schedule_add_remote_pic',$pic); ?>
|
2315 |
+
</div>
|
2316 |
+
</fieldset>
|
2317 |
+
</div>
|
2318 |
+
<?php
|
2319 |
+
}
|
2320 |
+
|
2321 |
+
function wpvivid_backup_module_add_exec(){
|
2322 |
+
?>
|
2323 |
+
<div class="quickstart-btn" style="padding-top:20px;">
|
2324 |
+
<input class="button-primary quickbackup-btn" id="wpvivid_quickbackup_btn" type="submit" value="<?php esc_attr_e( 'Backup Now', 'wpvivid-backuprestore'); ?>" />
|
2325 |
+
<div class="schedule-tab-block" style="text-align:center;">
|
2326 |
+
<fieldset>
|
2327 |
+
<label>
|
2328 |
+
<input type="checkbox" id="wpvivid_backup_lock" option="backup" name="lock" />
|
2329 |
+
<span><?php _e( 'This backup can only be deleted manually', 'wpvivid-backuprestore' ); ?></span>
|
2330 |
+
</label>
|
2331 |
+
</fieldset>
|
2332 |
+
</div>
|
2333 |
+
</div>
|
2334 |
+
<script>
|
2335 |
+
jQuery('#wpvivid_quickbackup_btn').click(function(){
|
2336 |
+
wpvivid_clear_notice('wpvivid_backup_notice');
|
2337 |
+
wpvivid_start_backup();
|
2338 |
+
});
|
2339 |
+
|
2340 |
+
function wpvivid_start_backup(){
|
2341 |
+
var bcheck=true;
|
2342 |
+
var bdownloading=false;
|
2343 |
+
if(m_downloading_id !== '') {
|
2344 |
+
var descript = 'This request might delete the backup being downloaded, are you sure you want to continue?';
|
2345 |
+
var ret = confirm(descript);
|
2346 |
+
if (ret === true) {
|
2347 |
+
bcheck=true;
|
2348 |
+
bdownloading=true;
|
2349 |
+
}
|
2350 |
+
else{
|
2351 |
+
bcheck=false;
|
2352 |
+
}
|
2353 |
+
}
|
2354 |
+
if(bcheck) {
|
2355 |
+
var backup_data = wpvivid_ajax_data_transfer('backup');
|
2356 |
+
backup_data = JSON.parse(backup_data);
|
2357 |
+
jQuery('input:radio[option=backup_ex]').each(function() {
|
2358 |
+
if(jQuery(this).prop('checked'))
|
2359 |
+
{
|
2360 |
+
var key = jQuery(this).prop('name');
|
2361 |
+
var value = jQuery(this).prop('value');
|
2362 |
+
var json = new Array();
|
2363 |
+
if(value == 'local'){
|
2364 |
+
json['local']='1';
|
2365 |
+
json['remote']='0';
|
2366 |
+
}
|
2367 |
+
else if(value == 'remote'){
|
2368 |
+
json['local']='0';
|
2369 |
+
json['remote']='1';
|
2370 |
+
}
|
2371 |
+
}
|
2372 |
+
jQuery.extend(backup_data, json);
|
2373 |
+
});
|
2374 |
+
backup_data = JSON.stringify(backup_data);
|
2375 |
+
var ajax_data = {
|
2376 |
+
'action': 'wpvivid_prepare_backup',
|
2377 |
+
'backup': backup_data
|
2378 |
+
};
|
2379 |
+
wpvivid_control_backup_lock();
|
2380 |
+
jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
2381 |
+
jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
2382 |
+
jQuery('#wpvivid_postbox_backup_percent').show();
|
2383 |
+
jQuery('#wpvivid_current_doing').html('Ready to backup. Progress: 0%, running time: 0second.');
|
2384 |
+
var percent = '0%';
|
2385 |
+
jQuery('#wpvivid_action_progress_bar_percent').css('width', percent);
|
2386 |
+
jQuery('#wpvivid_backup_database_size').html('N/A');
|
2387 |
+
jQuery('#wpvivid_backup_file_size').html('N/A');
|
2388 |
+
jQuery('#wpvivid_current_doing').html('');
|
2389 |
+
wpvivid_completed_backup = 1;
|
2390 |
+
wpvivid_prepare_backup = true;
|
2391 |
+
wpvivid_post_request(ajax_data, function (data) {
|
2392 |
+
try {
|
2393 |
+
var jsonarray = jQuery.parseJSON(data);
|
2394 |
+
if (jsonarray.result === 'failed') {
|
2395 |
+
wpvivid_delete_ready_task(jsonarray.error);
|
2396 |
+
}
|
2397 |
+
else if (jsonarray.result === 'success') {
|
2398 |
+
if(bdownloading) {
|
2399 |
+
m_downloading_id = '';
|
2400 |
+
}
|
2401 |
+
m_backup_task_id = jsonarray.task_id;
|
2402 |
+
var descript = '';
|
2403 |
+
if (jsonarray.check.alert_db === true || jsonarray.check.alter_files === true) {
|
2404 |
+
descript = 'The database (the dumping SQL file) might be too large, backing up the database may run out of server memory and result in a backup failure.\n' +
|
2405 |
+
'One or more files might be too large, backing up the file(s) may run out of server memory and result in a backup failure.\n' +
|
2406 |
+
'Click OK button and continue to back up.';
|
2407 |
+
var ret = confirm(descript);
|
2408 |
+
if (ret === true) {
|
2409 |
+
jQuery('#wpvivid_backup_list').html('');
|
2410 |
+
jQuery('#wpvivid_backup_list').append(jsonarray.html);
|
2411 |
+
wpvivid_backup_now(m_backup_task_id);
|
2412 |
+
}
|
2413 |
+
else {
|
2414 |
+
jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
2415 |
+
jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
2416 |
+
wpvivid_control_backup_unlock();
|
2417 |
+
jQuery('#wpvivid_postbox_backup_percent').hide();
|
2418 |
+
}
|
2419 |
+
}
|
2420 |
+
else{
|
2421 |
+
jQuery('#wpvivid_backup_list').html('');
|
2422 |
+
jQuery('#wpvivid_backup_list').append(jsonarray.html);
|
2423 |
+
wpvivid_backup_now(jsonarray.task_id);
|
2424 |
+
}
|
2425 |
+
}
|
2426 |
+
}
|
2427 |
+
catch (err) {
|
2428 |
+
wpvivid_delete_ready_task(err);
|
2429 |
+
}
|
2430 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
2431 |
+
//var error_message = wpvivid_output_ajaxerror('preparing the backup', textStatus, errorThrown);
|
2432 |
+
var error_message=wpvividlion.backup_calc_timeout;//'Calculating the size of files, folder and database timed out. If you continue to receive this error, please go to the plugin settings, uncheck \'Calculate the size of files, folder and database before backing up\', save changes, then try again.';
|
2433 |
+
wpvivid_delete_ready_task(error_message);
|
2434 |
+
});
|
2435 |
+
}
|
2436 |
+
}
|
2437 |
+
|
2438 |
+
function wpvivid_backup_now(task_id){
|
2439 |
+
var ajax_data = {
|
2440 |
+
'action': 'wpvivid_backup_now',
|
2441 |
+
'task_id': task_id
|
2442 |
+
};
|
2443 |
+
task_retry_times = 0;
|
2444 |
+
m_need_update=true;
|
2445 |
+
wpvivid_post_request(ajax_data, function(data){
|
2446 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
2447 |
+
});
|
2448 |
+
}
|
2449 |
+
|
2450 |
+
function wpvivid_delete_backup_task(task_id){
|
2451 |
+
var ajax_data = {
|
2452 |
+
'action': 'wpvivid_delete_task',
|
2453 |
+
'task_id': task_id
|
2454 |
+
};
|
2455 |
+
wpvivid_post_request(ajax_data, function(data){}, function(XMLHttpRequest, textStatus, errorThrown) {
|
2456 |
+
});
|
2457 |
+
}
|
2458 |
+
|
2459 |
+
function wpvivid_control_backup_lock(){
|
2460 |
+
jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
2461 |
+
jQuery('#wpvivid_transfer_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
2462 |
+
}
|
2463 |
+
|
2464 |
+
function wpvivid_control_backup_unlock(){
|
2465 |
+
jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
2466 |
+
jQuery('#wpvivid_transfer_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
2467 |
+
}
|
2468 |
+
|
2469 |
+
function wpvivid_delete_ready_task(error){
|
2470 |
+
var ajax_data={
|
2471 |
+
'action': 'wpvivid_delete_ready_task'
|
2472 |
+
};
|
2473 |
+
wpvivid_post_request(ajax_data, function (data) {
|
2474 |
+
try {
|
2475 |
+
var jsonarray = jQuery.parseJSON(data);
|
2476 |
+
if (jsonarray.result === 'success') {
|
2477 |
+
wpvivid_add_notice('Backup', 'Error', error);
|
2478 |
+
wpvivid_control_backup_unlock();
|
2479 |
+
jQuery('#wpvivid_postbox_backup_percent').hide();
|
2480 |
+
}
|
2481 |
+
}
|
2482 |
+
catch(err){
|
2483 |
+
wpvivid_add_notice('Backup', 'Error', err);
|
2484 |
+
wpvivid_control_backup_unlock();
|
2485 |
+
jQuery('#wpvivid_postbox_backup_percent').hide();
|
2486 |
+
}
|
2487 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
2488 |
+
setTimeout(function () {
|
2489 |
+
wpvivid_delete_ready_task(error);
|
2490 |
+
}, 3000);
|
2491 |
+
});
|
2492 |
+
}
|
2493 |
+
</script>
|
2494 |
+
<?php
|
2495 |
+
}
|
2496 |
+
|
2497 |
+
function wpvivid_backup_module_add_tips(){
|
2498 |
+
?>
|
2499 |
+
<div class="custom-info" style="float:left; width:100%;">
|
2500 |
+
<strong><?php _e('Tip:', 'wpvivid-backuprestore'); ?></strong> <?php _e('The settings are only for manual backup, which won\'t affect schedule settings.', 'wpvivid-backuprestore'); ?>
|
2501 |
+
</div>
|
2502 |
+
<?php
|
2503 |
+
}
|
2504 |
+
|
2505 |
+
function wpvivid_backuppage_add_schedule_module(){
|
2506 |
+
$schedule=WPvivid_Schedule::get_schedule();
|
2507 |
+
if($schedule['enable']){
|
2508 |
+
$schedule_status='Enabled';
|
2509 |
+
$next_backup_time=date("l, F d, Y H:i", $schedule['next_start']);
|
2510 |
+
}
|
2511 |
+
else{
|
2512 |
+
$schedule_status='Disabled';
|
2513 |
+
$next_backup_time='N/A';
|
2514 |
+
}
|
2515 |
+
$last_message = '';
|
2516 |
+
$last_message = apply_filters('wpvivid_get_last_backup_message', $last_message);
|
2517 |
+
?>
|
2518 |
+
<div class="postbox qucikbackup-schedule" id="wpvivid_postbox_backup_schedule">
|
2519 |
+
<h2><span><?php _e( 'Backup Schedule','wpvivid-backuprestore'); ?></span></h2>
|
2520 |
+
<div class="schedule-block">
|
2521 |
+
<p id="wpvivid_schedule_status"><strong><?php _e('Schedule Status: ', 'wpvivid-backuprestore'); ?></strong><?php _e($schedule_status); ?></p>
|
2522 |
+
<div id="wpvivid_schedule_info">
|
2523 |
+
<p><strong><?php _e('Server Time: ', 'wpvivid-backuprestore'); ?></strong><?php _e(date("l, F d, Y H:i",time())); ?></p>
|
2524 |
+
<p><span id="wpvivid_last_backup_msg"><?php _e($last_message); ?></span></p>
|
2525 |
+
<p id="wpvivid_next_backup"><strong><?php _e('Next Backup: ', 'wpvivid-backuprestore'); ?></strong><?php _e($next_backup_time); ?></p>
|
2526 |
+
</div>
|
2527 |
+
</div>
|
2528 |
+
</div>
|
2529 |
+
<div style="clear:both;"></div>
|
2530 |
+
<?php
|
2531 |
+
}
|
2532 |
+
|
2533 |
+
|
2534 |
+
add_filter('wpvivid_add_backup_type', 'wpvivid_add_backup_type', 11, 2);
|
2535 |
+
add_action('wpvivid_backup_do_js', 'wpvivid_backup_do_js', 10);
|
2536 |
+
add_filter('wpvivid_download_backup_descript', 'wpvivid_download_backup_descript', 10);
|
2537 |
+
add_filter('wpvivid_restore_website_descript', 'wpvivid_restore_website_descript', 10);
|
2538 |
+
|
2539 |
+
add_filter('wpvivid_backuppage_load_backuplist', 'wpvivid_backuppage_load_backuplist', 10);
|
2540 |
+
|
2541 |
+
add_action('wpvivid_backuppage_add_module', 'wpvivid_backuppage_add_progress_module', 10);
|
2542 |
+
add_action('wpvivid_backuppage_add_module', 'wpvivid_backuppage_add_backup_module', 11);
|
2543 |
+
add_action('wpvivid_backuppage_add_module', 'wpvivid_backuppage_add_schedule_module', 12);
|
2544 |
+
|
2545 |
+
add_action('wpvivid_backup_module_add_sub', 'wpvivid_backup_module_add_descript');
|
2546 |
+
add_action('wpvivid_backup_module_add_sub', 'wpvivid_backup_module_add_backup_type');
|
2547 |
+
add_action('wpvivid_backup_module_add_sub', 'wpvivid_backup_module_add_send_remote');
|
2548 |
+
add_action('wpvivid_backup_module_add_sub', 'wpvivid_backup_module_add_exec');
|
2549 |
+
add_action('wpvivid_backup_module_add_sub', 'wpvivid_backup_module_add_tips');
|
2550 |
+
|
2551 |
+
?>
|
trunk/admin/partials/wpvivid-log-read-page-display.php
ADDED
File without changes
|
trunk/admin/partials/wpvivid-logs-page-display.php
ADDED
File without changes
|
trunk/admin/partials/wpvivid-remote-storage-page-display.php
ADDED
@@ -0,0 +1,414 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wpvivid_add_tab_storage_list()
|
4 |
+
{
|
5 |
+
?>
|
6 |
+
<a href="#" id="wpvivid_tab_storage_list" class="nav-tab storage-nav-tab nav-tab-active" onclick="switchstorageTabs(event,'page-storage-list','page-storage-list')"><?php _e('Storages', 'wpvivid-backuprestore'); ?></a>
|
7 |
+
<?php
|
8 |
+
}
|
9 |
+
|
10 |
+
function wpvivid_add_tab_storage_edit()
|
11 |
+
{
|
12 |
+
?>
|
13 |
+
<a href="#" id="wpvivid_tab_storage_edit" class="nav-tab storage-nav-tab delete" onclick="switchstorageTabs(event,'page-storage_edit','page-storage_edit')" style="display: none;">
|
14 |
+
<div id="wpvivid_tab_storage_edit_text" style="margin-right: 15px;"><?php _e('Storage Edit', 'wpvivid-backuprestore'); ?></div>
|
15 |
+
<div class="nav-tab-delete-img">
|
16 |
+
<img src="<?php echo esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_tab(event, 'wpvivid_tab_storage_edit', 'storage', 'wpvivid_tab_storage_list');" />
|
17 |
+
</div>
|
18 |
+
</a>
|
19 |
+
<?php
|
20 |
+
}
|
21 |
+
|
22 |
+
function wpvivid_add_page_storage_list()
|
23 |
+
{
|
24 |
+
?>
|
25 |
+
<div class="storage-tab-content wpvivid_tab_storage_list" id="page-storage-list">
|
26 |
+
<div style="margin-top:10px;"><p><strong><?php _e('Please choose one storage to save your backups (remote storage)', 'wpvivid-backuprestore'); ?></strong></p></div>
|
27 |
+
<div class="schedule-tab-block"></div>
|
28 |
+
<div class="">
|
29 |
+
<table class="widefat">
|
30 |
+
<thead>
|
31 |
+
<tr>
|
32 |
+
<th></th>
|
33 |
+
<th></th>
|
34 |
+
<th><?php _e( 'Storage Provider', 'wpvivid-backuprestore' ); ?></th>
|
35 |
+
<th class="row-title"><?php _e( 'Remote Storage Alias', 'wpvivid-backuprestore' ); ?></th>
|
36 |
+
<th><?php _e( 'Actions', 'wpvivid-backuprestore' ); ?></th>
|
37 |
+
</tr>
|
38 |
+
</thead>
|
39 |
+
<tbody class="wpvivid-remote-storage-list" id="wpvivid_remote_storage_list">
|
40 |
+
<?php
|
41 |
+
$html = '';
|
42 |
+
$html = apply_filters('wpvivid_add_remote_storage_list', $html);
|
43 |
+
echo $html;
|
44 |
+
?>
|
45 |
+
</tbody>
|
46 |
+
<tfoot>
|
47 |
+
<tr>
|
48 |
+
<th colspan="5" class="row-title"><input class="button-primary" id="wpvivid_set_default_remote_storage" type="submit" name="choose-remote-storage" value="<?php esc_attr_e( 'Save Changes', 'wpvivid-backuprestore' ); ?>" /></th>
|
49 |
+
</tr>
|
50 |
+
</tfoot>
|
51 |
+
</table>
|
52 |
+
</div>
|
53 |
+
</div>
|
54 |
+
<script>
|
55 |
+
jQuery('input[option=add-remote]').click(function(){
|
56 |
+
var storage_type = jQuery(".storage-providers-active").attr("remote_type");
|
57 |
+
wpvivid_add_remote_storage(storage_type);
|
58 |
+
wpvivid_settings_changed = false;
|
59 |
+
});
|
60 |
+
|
61 |
+
jQuery('#wpvivid_set_default_remote_storage').click(function(){
|
62 |
+
wpvivid_set_default_remote_storage();
|
63 |
+
wpvivid_settings_changed = false;
|
64 |
+
});
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Add remote storages to the list
|
68 |
+
*
|
69 |
+
* @param action - The action to add or test a remote storage
|
70 |
+
* @param storage_type - Remote storage types (Amazon S3, SFTP and FTP server)
|
71 |
+
*/
|
72 |
+
function wpvivid_add_remote_storage(storage_type)
|
73 |
+
{
|
74 |
+
var remote_from = wpvivid_ajax_data_transfer(storage_type);
|
75 |
+
var ajax_data;
|
76 |
+
ajax_data = {
|
77 |
+
'action': 'wpvivid_add_remote',
|
78 |
+
'remote': remote_from,
|
79 |
+
'type': storage_type
|
80 |
+
};
|
81 |
+
jQuery('input[option=add-remote]').css({'pointer-events': 'none', 'opacity': '0.4'});
|
82 |
+
jQuery('#wpvivid_remote_notice').html('');
|
83 |
+
wpvivid_post_request(ajax_data, function (data)
|
84 |
+
{
|
85 |
+
try
|
86 |
+
{
|
87 |
+
var jsonarray = jQuery.parseJSON(data);
|
88 |
+
if (jsonarray.result === 'success')
|
89 |
+
{
|
90 |
+
jQuery('input[option=add-remote]').css({'pointer-events': 'auto', 'opacity': '1'});
|
91 |
+
jQuery('input:text[option='+storage_type+']').each(function(){
|
92 |
+
jQuery(this).val('');
|
93 |
+
});
|
94 |
+
jQuery('input:password[option='+storage_type+']').each(function(){
|
95 |
+
jQuery(this).val('');
|
96 |
+
});
|
97 |
+
wpvivid_handle_remote_storage_data(data);
|
98 |
+
}
|
99 |
+
else if (jsonarray.result === 'failed')
|
100 |
+
{
|
101 |
+
jQuery('#wpvivid_remote_notice').html(jsonarray.notice);
|
102 |
+
jQuery('input[option=add-remote]').css({'pointer-events': 'auto', 'opacity': '1'});
|
103 |
+
}
|
104 |
+
}
|
105 |
+
catch (err)
|
106 |
+
{
|
107 |
+
alert(err);
|
108 |
+
jQuery('input[option=add-remote]').css({'pointer-events': 'auto', 'opacity': '1'});
|
109 |
+
}
|
110 |
+
|
111 |
+
}, function (XMLHttpRequest, textStatus, errorThrown)
|
112 |
+
{
|
113 |
+
var error_message = wpvivid_output_ajaxerror('adding the remote storage', textStatus, errorThrown);
|
114 |
+
alert(error_message);
|
115 |
+
jQuery('input[option=add-remote]').css({'pointer-events': 'auto', 'opacity': '1'});
|
116 |
+
});
|
117 |
+
}
|
118 |
+
|
119 |
+
function wpvivid_edit_remote_storage() {
|
120 |
+
var data_tran = 'edit-'+wpvivid_editing_storage_type;
|
121 |
+
var remote_data = wpvivid_ajax_data_transfer(data_tran);
|
122 |
+
var ajax_data;
|
123 |
+
ajax_data = {
|
124 |
+
'action': 'wpvivid_edit_remote',
|
125 |
+
'remote': remote_data,
|
126 |
+
'id': wpvivid_editing_storage_id,
|
127 |
+
'type': wpvivid_editing_storage_type
|
128 |
+
};
|
129 |
+
jQuery('#wpvivid_remote_notice').html('');
|
130 |
+
wpvivid_post_request(ajax_data, function(data){
|
131 |
+
try {
|
132 |
+
var jsonarray = jQuery.parseJSON(data);
|
133 |
+
if (jsonarray.result === 'success') {
|
134 |
+
jQuery('#wpvivid_tab_storage_edit').hide();
|
135 |
+
wpvivid_click_switch_page('storage', 'wpvivid_tab_storage_list', true);
|
136 |
+
wpvivid_handle_remote_storage_data(data);
|
137 |
+
}
|
138 |
+
else if (jsonarray.result === 'failed') {
|
139 |
+
jQuery('#wpvivid_remote_notice').html(jsonarray.notice);
|
140 |
+
}
|
141 |
+
}
|
142 |
+
catch(err){
|
143 |
+
alert(err);
|
144 |
+
}
|
145 |
+
},function(XMLHttpRequest, textStatus, errorThrown) {
|
146 |
+
var error_message = wpvivid_output_ajaxerror('editing the remote storage', textStatus, errorThrown);
|
147 |
+
alert(error_message);
|
148 |
+
});
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Set a default remote storage for backups.
|
153 |
+
*/
|
154 |
+
function wpvivid_set_default_remote_storage(){
|
155 |
+
var remote_storage = new Array();
|
156 |
+
//remote_storage[0] = jQuery("input[name='remote_storage']:checked").val();
|
157 |
+
jQuery.each(jQuery("input[name='remote_storage']:checked"), function()
|
158 |
+
{
|
159 |
+
remote_storage.push(jQuery(this).val());
|
160 |
+
});
|
161 |
+
|
162 |
+
var ajax_data = {
|
163 |
+
'action': 'wpvivid_set_default_remote_storage',
|
164 |
+
'remote_storage': remote_storage
|
165 |
+
};
|
166 |
+
jQuery('#wpvivid_remote_notice').html('');
|
167 |
+
wpvivid_post_request(ajax_data, function(data){
|
168 |
+
wpvivid_handle_remote_storage_data(data);
|
169 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
170 |
+
var error_message = wpvivid_output_ajaxerror('setting up the default remote storage', textStatus, errorThrown);
|
171 |
+
alert(error_message);
|
172 |
+
});
|
173 |
+
}
|
174 |
+
|
175 |
+
jQuery('#wpvivid_remote_storage_list').on("click", "input", function(){
|
176 |
+
var check_status = true;
|
177 |
+
if(jQuery(this).prop('checked') === true){
|
178 |
+
check_status = true;
|
179 |
+
}
|
180 |
+
else {
|
181 |
+
check_status = false;
|
182 |
+
}
|
183 |
+
jQuery('input[name="remote_storage"]').prop('checked', false);
|
184 |
+
if(check_status === true){
|
185 |
+
jQuery(this).prop('checked', true);
|
186 |
+
}
|
187 |
+
else {
|
188 |
+
jQuery(this).prop('checked', false);
|
189 |
+
}
|
190 |
+
});
|
191 |
+
|
192 |
+
function wpvivid_delete_remote_storage(storage_id){
|
193 |
+
var descript = 'Deleting a remote storage will make it unavailable until it is added again. Are you sure to continue?';
|
194 |
+
var ret = confirm(descript);
|
195 |
+
if(ret === true){
|
196 |
+
var ajax_data = {
|
197 |
+
'action': 'wpvivid_delete_remote',
|
198 |
+
'remote_id': storage_id
|
199 |
+
};
|
200 |
+
wpvivid_post_request(ajax_data, function(data){
|
201 |
+
wpvivid_handle_remote_storage_data(data);
|
202 |
+
},function(XMLHttpRequest, textStatus, errorThrown) {
|
203 |
+
var error_message = wpvivid_output_ajaxerror('deleting the remote storage', textStatus, errorThrown);
|
204 |
+
alert(error_message);
|
205 |
+
});
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
function wpvivid_handle_remote_storage_data(data){
|
210 |
+
var i = 0;
|
211 |
+
try {
|
212 |
+
var jsonarray = jQuery.parseJSON(data);
|
213 |
+
if (jsonarray.result === 'success') {
|
214 |
+
jQuery('#wpvivid_remote_storage_list').html('');
|
215 |
+
jQuery('#wpvivid_remote_storage_list').append(jsonarray.html);
|
216 |
+
jQuery('#upload_storage').html(jsonarray.pic);
|
217 |
+
jQuery('#schedule_upload_storage').html(jsonarray.pic);
|
218 |
+
jQuery('#wpvivid_out_of_date_remote_path').html(jsonarray.dir);
|
219 |
+
jQuery('#wpvivid_schedule_backup_local_remote').html(jsonarray.local_remote);
|
220 |
+
wpvivid_control_remote_storage(jsonarray.remote_storage);
|
221 |
+
jQuery('#wpvivid_remote_notice').html(jsonarray.notice);
|
222 |
+
}
|
223 |
+
else if(jsonarray.result === 'failed'){
|
224 |
+
alert(jsonarray.error);
|
225 |
+
}
|
226 |
+
}
|
227 |
+
catch(err){
|
228 |
+
alert(err);
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
function wpvivid_control_remote_storage(has_remote){
|
233 |
+
if(!has_remote){
|
234 |
+
if(jQuery("input:radio[name='save_local_remote'][value='remote']").prop('checked')) {
|
235 |
+
alert("There is no default remote storage configured. Please set it up first.");
|
236 |
+
jQuery("input:radio[name='save_local_remote'][value='local']").prop('checked', true);
|
237 |
+
}
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
function click_retrieve_remote_storage(id,type,name)
|
242 |
+
{
|
243 |
+
wpvivid_editing_storage_id = id;
|
244 |
+
jQuery('.remote-storage-edit').hide();
|
245 |
+
jQuery('#wpvivid_tab_storage_edit').show();
|
246 |
+
jQuery('#wpvivid_tab_storage_edit_text').html(name);
|
247 |
+
wpvivid_editing_storage_type=type;
|
248 |
+
jQuery('#remote_storage_edit_'+wpvivid_editing_storage_type).fadeIn();
|
249 |
+
wpvivid_click_switch_page('storage', 'wpvivid_tab_storage_edit', true);
|
250 |
+
|
251 |
+
var ajax_data = {
|
252 |
+
'action': 'wpvivid_retrieve_remote',
|
253 |
+
'remote_id': id
|
254 |
+
};
|
255 |
+
wpvivid_post_request(ajax_data, function(data)
|
256 |
+
{
|
257 |
+
try
|
258 |
+
{
|
259 |
+
var jsonarray = jQuery.parseJSON(data);
|
260 |
+
if (jsonarray.result === 'success')
|
261 |
+
{
|
262 |
+
jQuery('input:text[option=edit-'+jsonarray.type+']').each(function(){
|
263 |
+
var key = jQuery(this).prop('name');
|
264 |
+
jQuery(this).val(jsonarray[key]);
|
265 |
+
});
|
266 |
+
jQuery('input:password[option=edit-'+jsonarray.type+']').each(function(){
|
267 |
+
var key = jQuery(this).prop('name');
|
268 |
+
jQuery(this).val(jsonarray[key]);
|
269 |
+
});
|
270 |
+
jQuery('input:checkbox[option=edit-'+jsonarray.type+']').each(function() {
|
271 |
+
var key = jQuery(this).prop('name');
|
272 |
+
var value;
|
273 |
+
if(jsonarray[key] == '0'){
|
274 |
+
value = false;
|
275 |
+
}
|
276 |
+
else{
|
277 |
+
value = true;
|
278 |
+
}
|
279 |
+
jQuery(this).prop('checked', value);
|
280 |
+
});
|
281 |
+
}
|
282 |
+
else
|
283 |
+
{
|
284 |
+
alert(jsonarray.error);
|
285 |
+
}
|
286 |
+
}
|
287 |
+
catch(err)
|
288 |
+
{
|
289 |
+
alert(err);
|
290 |
+
}
|
291 |
+
},function(XMLHttpRequest, textStatus, errorThrown)
|
292 |
+
{
|
293 |
+
var error_message = wpvivid_output_ajaxerror('retrieving the remote storage', textStatus, errorThrown);
|
294 |
+
alert(error_message);
|
295 |
+
});
|
296 |
+
}
|
297 |
+
</script>
|
298 |
+
<?php
|
299 |
+
}
|
300 |
+
|
301 |
+
function wpvivid_add_page_storage_edit()
|
302 |
+
{
|
303 |
+
?>
|
304 |
+
<div class="storage-tab-content wpvivid_tab_storage_edit" id="page-storage_edit" style="display:none;">
|
305 |
+
<div><?php do_action('wpvivid_edit_remote_page'); ?></div>
|
306 |
+
</div>
|
307 |
+
<script>
|
308 |
+
jQuery('input[option=edit-remote]').click(function(){
|
309 |
+
wpvivid_edit_remote_storage();
|
310 |
+
});
|
311 |
+
</script>
|
312 |
+
<?php
|
313 |
+
}
|
314 |
+
|
315 |
+
function wpvivid_storage_list($html)
|
316 |
+
{
|
317 |
+
$html='<h2 class="nav-tab-wrapper" style="padding-bottom:0!important;">';
|
318 |
+
$html.='<a href="#" id="wpvivid_tab_storage_list" class="nav-tab storage-nav-tab nav-tab-active" onclick="switchstorageTabs(event,\'page-storage-list\',\'page-storage-list\')">'. __('Storages', 'wpvivid-backuprestore').'</a>';
|
319 |
+
$html.='<a href="#" id="wpvivid_tab_storage_edit" class="nav-tab storage-nav-tab delete" onclick="switchstorageTabs(event,\'page-storage_edit\',\'page-storage_edit\')" style="display: none;">
|
320 |
+
<div id="wpvivid_tab_storage_edit_text" style="margin-right: 15px;">'.__('Storage Edit', 'wpvivid-backuprestore').'</div>
|
321 |
+
<div class="nav-tab-delete-img">
|
322 |
+
<img src="'.esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )).'" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_tab(event, \'wpvivid_tab_storage_edit\', \'storage\', \'wpvivid_tab_storage_list\');" />
|
323 |
+
</div>
|
324 |
+
</a>';
|
325 |
+
$html.='</h2>';
|
326 |
+
$html.='<div class="storage-tab-content wpvivid_tab_storage_list" id="page-storage-list">
|
327 |
+
<div style="margin-top:10px;"><p><strong>'.__('Please choose one storage to save your backups (remote storage)', 'wpvivid-backuprestore').'</strong></p></div>
|
328 |
+
<div class="schedule-tab-block"></div>
|
329 |
+
<div class="">
|
330 |
+
<table class="widefat">
|
331 |
+
<thead>
|
332 |
+
<tr>
|
333 |
+
<th></th>
|
334 |
+
<th></th>
|
335 |
+
<th>'. __( 'Storage Provider', 'wpvivid-backuprestore' ).'</th>
|
336 |
+
<th class="row-title">'. __( 'Remote Storage Alias', 'wpvivid-backuprestore' ).'</th>
|
337 |
+
<th>'. __( 'Actions', 'wpvivid-backuprestore' ).'</th>
|
338 |
+
</tr>
|
339 |
+
</thead>
|
340 |
+
<tbody class="wpvivid-remote-storage-list" id="wpvivid_remote_storage_list">
|
341 |
+
';
|
342 |
+
$html_list='';
|
343 |
+
$html.= apply_filters('wpvivid_add_remote_storage_list', $html_list);
|
344 |
+
$html.='</tbody><tfoot><tr>
|
345 |
+
<th colspan="5" class="row-title"><input class="button-primary" id="wpvivid_set_default_remote_storage" type="submit" name="choose-remote-storage" value="'.esc_attr__( 'Save Changes', 'wpvivid-backuprestore' ).'" /></th>
|
346 |
+
</tr></tfoot></table></div></div>';
|
347 |
+
|
348 |
+
$html .= '<script>
|
349 |
+
jQuery(\'#wpvivid_remote_storage_list\').on("click", "input", function(){
|
350 |
+
var check_status = true;
|
351 |
+
if(jQuery(this).prop(\'checked\') === true){
|
352 |
+
check_status = true;
|
353 |
+
}
|
354 |
+
else {
|
355 |
+
check_status = false;
|
356 |
+
}
|
357 |
+
jQuery(\'input[name = "remote_storage"]\').prop(\'checked\', false);
|
358 |
+
if(check_status === true){
|
359 |
+
jQuery(this).prop(\'checked\', true);
|
360 |
+
}
|
361 |
+
else {
|
362 |
+
jQuery(this).prop(\'checked\', false);
|
363 |
+
}
|
364 |
+
});
|
365 |
+
</script>';
|
366 |
+
return $html;
|
367 |
+
}
|
368 |
+
|
369 |
+
add_action('wpvivid_storage_add_tab', 'wpvivid_add_tab_storage_list', 10);
|
370 |
+
add_action('wpvivid_storage_add_tab', 'wpvivid_add_tab_storage_edit', 11);
|
371 |
+
add_action('wpvivid_storage_add_page', 'wpvivid_add_page_storage_list', 10);
|
372 |
+
add_action('wpvivid_storage_add_page', 'wpvivid_add_page_storage_edit', 11);
|
373 |
+
//add_filter('wpvivid_storage_list','wpvivid_storage_list',10);
|
374 |
+
?>
|
375 |
+
|
376 |
+
|
377 |
+
|
378 |
+
<script>
|
379 |
+
function select_remote_storage(evt, storage_page_id)
|
380 |
+
{
|
381 |
+
var i, tablecontent, tablinks;
|
382 |
+
tablinks = document.getElementsByClassName("storage-providers");
|
383 |
+
for (i = 0; i < tablinks.length; i++) {
|
384 |
+
tablinks[i].className = tablinks[i].className.replace("storage-providers-active", "");
|
385 |
+
}
|
386 |
+
evt.currentTarget.className += " storage-providers-active";
|
387 |
+
|
388 |
+
jQuery(".storage-account-page").hide();
|
389 |
+
jQuery("#"+storage_page_id).show();
|
390 |
+
}
|
391 |
+
function switchstorageTabs(evt,contentName,storage_page_id) {
|
392 |
+
// Declare all variables
|
393 |
+
var i, tabcontent, tablinks;
|
394 |
+
|
395 |
+
// Get all elements with class="table-list-content" and hide them
|
396 |
+
tabcontent = document.getElementsByClassName("storage-tab-content");
|
397 |
+
for (i = 0; i < tabcontent.length; i++) {
|
398 |
+
tabcontent[i].style.display = "none";
|
399 |
+
}
|
400 |
+
|
401 |
+
// Get all elements with class="table-nav-tab" and remove the class "nav-tab-active"
|
402 |
+
tablinks = document.getElementsByClassName("storage-nav-tab");
|
403 |
+
for (i = 0; i < tablinks.length; i++) {
|
404 |
+
tablinks[i].className = tablinks[i].className.replace(" nav-tab-active", "");
|
405 |
+
}
|
406 |
+
|
407 |
+
// Show the current tab, and add an "storage-menu-active" class to the button that opened the tab
|
408 |
+
document.getElementById(contentName).style.display = "block";
|
409 |
+
evt.currentTarget.className += " nav-tab-active";
|
410 |
+
|
411 |
+
var top = jQuery('#'+storage_page_id).offset().top-jQuery('#'+storage_page_id).height();
|
412 |
+
jQuery('html, body').animate({scrollTop:top}, 'slow');
|
413 |
+
}
|
414 |
+
</script>
|
trunk/admin/partials/wpvivid-schedule-page-display.php
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wpvivid_schedule_settings()
|
4 |
+
{
|
5 |
+
?>
|
6 |
+
<tr>
|
7 |
+
<td class="row-title wpvivid-backup-settings-table tablelistcolumn"><label for="tablecell"><?php _e('Schedule Settings', 'wpvivid-backuprestore'); ?></label></td>
|
8 |
+
<td class="tablelistcolumn">
|
9 |
+
<div id="storage-brand-3">
|
10 |
+
<div>
|
11 |
+
<div>
|
12 |
+
<div class="postbox schedule-tab-block">
|
13 |
+
<label for="wpvivid_schedule_enable">
|
14 |
+
<input option="schedule" name="enable" type="checkbox" id="wpvivid_schedule_enable" />
|
15 |
+
<span><?php _e( 'Enable backup schedule', 'wpvivid-backuprestore' ); ?></span>
|
16 |
+
</label><br>
|
17 |
+
<label>
|
18 |
+
<div style="float: left;">
|
19 |
+
<input type="checkbox" disabled />
|
20 |
+
<span class="wpvivid-element-space-right" style="color: #ddd;"><?php _e('Enable Incremental Backup', 'wpvivid-backuprestore'); ?></span>
|
21 |
+
</div>
|
22 |
+
<div style="float: left; height: 32px; line-height: 32px;">
|
23 |
+
<span class="wpvivid-feature-pro">
|
24 |
+
<a href="https://docs.wpvivid.com/wpvivid-backup-pro-incremental-backups.html"><?php _e('Pro feature: learn more', 'wpvivid-backuprestore'); ?></a>
|
25 |
+
</span>
|
26 |
+
</div>
|
27 |
+
<div style="clear: both;"></div>
|
28 |
+
</label>
|
29 |
+
<label>
|
30 |
+
<div style="float: left;">
|
31 |
+
<input type="checkbox" disabled />
|
32 |
+
<span class="wpvivid-element-space-right" style="color: #ddd;"><?php _e('Advanced Schedule', 'wpvivid-backuprestore'); ?></span>
|
33 |
+
</div>
|
34 |
+
<div style="float: left; height: 32px; line-height: 32px;">
|
35 |
+
<span class="wpvivid-feature-pro">
|
36 |
+
<a href="https://docs.wpvivid.com/wpvivid-backup-pro-schedule-overview.html"><?php _e('Pro feature: learn more', 'wpvivid-backuprestore'); ?></a>
|
37 |
+
</span>
|
38 |
+
</div>
|
39 |
+
<div style="clear: both;"></div>
|
40 |
+
</label>
|
41 |
+
<div style="clear: both;"></div>
|
42 |
+
<div>
|
43 |
+
<?php
|
44 |
+
$notice='';
|
45 |
+
$notice= apply_filters('wpvivid_schedule_notice',$notice);
|
46 |
+
echo $notice;
|
47 |
+
?>
|
48 |
+
</div>
|
49 |
+
</div>
|
50 |
+
<div class="postbox schedule-tab-block">
|
51 |
+
<fieldset>
|
52 |
+
<legend class="screen-reader-text"><span>input type="radio"</span></legend>
|
53 |
+
<?php
|
54 |
+
$time='';
|
55 |
+
$time= apply_filters('wpvivid_schedule_time',$time);
|
56 |
+
echo $time;
|
57 |
+
?>
|
58 |
+
</fieldset>
|
59 |
+
</div>
|
60 |
+
</div>
|
61 |
+
</div>
|
62 |
+
<div class="postbox schedule-tab-block" id="wpvivid_schedule_backup_type">
|
63 |
+
<div>
|
64 |
+
<div>
|
65 |
+
<fieldset>
|
66 |
+
<legend class="screen-reader-text"><span>input type="radio"</span></legend>
|
67 |
+
<?php
|
68 |
+
$backup_type='';
|
69 |
+
$backup_type= apply_filters('wpvivid_schedule_backup_type',$backup_type);
|
70 |
+
echo $backup_type;
|
71 |
+
?>
|
72 |
+
</fieldset>
|
73 |
+
</div>
|
74 |
+
<div style="clear:both;"></div>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
<div class="postbox schedule-tab-block" id="wpvivid_schedule_remote_storage">
|
78 |
+
<div id="wpvivid_schedule_backup_local_remote">
|
79 |
+
<?php
|
80 |
+
$html='';
|
81 |
+
$html= apply_filters('wpvivid_schedule_local_remote',$html);
|
82 |
+
echo $html;
|
83 |
+
?>
|
84 |
+
</div>
|
85 |
+
<div id="schedule_upload_storage" style="cursor:pointer;" title="<?php _e('Highlighted icon illuminates that you have choosed a remote storage to store backups', 'wpvivid-backuprestore'); ?>">
|
86 |
+
<?php
|
87 |
+
$pic='';
|
88 |
+
$pic= apply_filters('wpvivid_schedule_add_remote_pic',$pic);
|
89 |
+
echo $pic;
|
90 |
+
?>
|
91 |
+
</div>
|
92 |
+
</div>
|
93 |
+
<div class="postbox schedule-tab-block">
|
94 |
+
<div style="float:left; color: #ddd; margin-right: 10px;">
|
95 |
+
<?php _e('+ Add another schedule', 'wpvivid-backuprestore'); ?>
|
96 |
+
</div>
|
97 |
+
<span class="wpvivid-feature-pro">
|
98 |
+
<a href="https://docs.wpvivid.com/wpvivid-backup-pro-creating-schedules.html"><?php _e('Pro feature: learn more', 'wpvivid-backuprestore'); ?></a>
|
99 |
+
</span>
|
100 |
+
</div>
|
101 |
+
</div>
|
102 |
+
</td>
|
103 |
+
</tr>
|
104 |
+
<script>
|
105 |
+
<?php
|
106 |
+
do_action('wpvivid_schedule_do_js');
|
107 |
+
?>
|
108 |
+
</script>
|
109 |
+
<?php
|
110 |
+
}
|
111 |
+
|
112 |
+
function wpvivid_schedule_notice($html)
|
113 |
+
{
|
114 |
+
$offset=get_option('gmt_offset');
|
115 |
+
$time = '00:00:00';
|
116 |
+
$utime = strtotime($time) + $offset * 60 * 60;
|
117 |
+
$html='<p>1) '.__('Scheduled job will start at <strong>UTC</strong> time:', 'wpvivid-backuprestore').' '.date('H:i:s', $utime).'</p>';
|
118 |
+
$html.='<p>2) '.__('Being subjected to mechanisms of PHP, a scheduled backup task for your site will be triggered only when the site receives at least a visit at any page.', 'wpvivid-backuprestore').'</p>';
|
119 |
+
return $html;
|
120 |
+
}
|
121 |
+
|
122 |
+
function wpvivid_schedule_backup_type($html)
|
123 |
+
{
|
124 |
+
$html='<label>';
|
125 |
+
$html.='<input type="radio" option="schedule" name="backup_type" value="files+db"/>';
|
126 |
+
$html.='<span>'.__('Database + Files (WordPress Files)', 'wpvivid-backuprestore').'</span>';
|
127 |
+
$html.='</label><br>';
|
128 |
+
|
129 |
+
$html.='<label>';
|
130 |
+
$html.='<input type="radio" option="schedule" name="backup_type" value="files"/>';
|
131 |
+
$html.='<span>'.__('WordPress Files (Exclude Database)', 'wpvivid-backuprestore').'</span>';
|
132 |
+
$html.='</label><br>';
|
133 |
+
|
134 |
+
$html.='<label>';
|
135 |
+
$html.='<input type="radio" option="schedule" name="backup_type" value="db"/>';
|
136 |
+
$html.='<span>'.__('Only Database', 'wpvivid-backuprestore').'</span>';
|
137 |
+
$html.='</label><br>';
|
138 |
+
|
139 |
+
$html.='<label>';
|
140 |
+
$html.='<div style="float: left;">';
|
141 |
+
$html.='<input type="radio" disabled />';
|
142 |
+
$html.='<span class="wpvivid-element-space-right" style="color: #ddd;">'.__('Custom', 'wpvivid-backuprestore').'</span>';
|
143 |
+
$html.='</div>';
|
144 |
+
$html.='<div style="float: left; height: 32px; line-height: 32px;">';
|
145 |
+
$html.='<span class="wpvivid-feature-pro">';
|
146 |
+
$html.='<a href="https://docs.wpvivid.com/wpvivid-backup-pro-customize-what-to-backup-for-schedule.html" style="text-decoration: none;">'.__('Pro feature: learn more', 'wpvivid-backuprestore').'</a>';
|
147 |
+
$html.='</span>';
|
148 |
+
$html.='</div>';
|
149 |
+
$html.='</label><br>';
|
150 |
+
return $html;
|
151 |
+
}
|
152 |
+
|
153 |
+
function wpvivid_schedule_do_js()
|
154 |
+
{
|
155 |
+
$schedule=WPvivid_Schedule::get_schedule();
|
156 |
+
if($schedule['enable'] == true)
|
157 |
+
{
|
158 |
+
?>
|
159 |
+
jQuery("#wpvivid_schedule_enable").prop('checked', true);
|
160 |
+
<?php
|
161 |
+
if($schedule['backup']['remote'] === 1)
|
162 |
+
{
|
163 |
+
$schedule_remote='remote';
|
164 |
+
}
|
165 |
+
else{
|
166 |
+
$schedule_remote='local';
|
167 |
+
}
|
168 |
+
}
|
169 |
+
else{
|
170 |
+
$schedule['recurrence']='wpvivid_daily';
|
171 |
+
$schedule['backup']['backup_files']='files+db';
|
172 |
+
$schedule_remote='local';
|
173 |
+
}
|
174 |
+
?>
|
175 |
+
jQuery("input:radio[value='<?php echo $schedule['recurrence']?>']").prop('checked', true);
|
176 |
+
jQuery("input:radio[value='<?php echo $schedule['backup']['backup_files']?>']").prop('checked', true);
|
177 |
+
jQuery("input:radio[name='save_local_remote'][value='remote']").click(function()
|
178 |
+
{
|
179 |
+
<?php
|
180 |
+
$remote_id_array = WPvivid_Setting::get_user_history('remote_selected');
|
181 |
+
$remote_id = '';
|
182 |
+
foreach ($remote_id_array as $value)
|
183 |
+
{
|
184 |
+
$remote_id = $value;
|
185 |
+
}
|
186 |
+
if(empty($remote_id))
|
187 |
+
{
|
188 |
+
?>
|
189 |
+
alert("There is no default remote storage configured. Please set it up first.");
|
190 |
+
jQuery("input:radio[name='save_local_remote'][value='local']").prop('checked', true);
|
191 |
+
<?php
|
192 |
+
}
|
193 |
+
?>
|
194 |
+
});
|
195 |
+
<?php
|
196 |
+
}
|
197 |
+
|
198 |
+
add_action('wpvivid_schedule_add_cell','wpvivid_schedule_settings',11);
|
199 |
+
add_action('wpvivid_schedule_do_js','wpvivid_schedule_do_js',10);
|
200 |
+
add_filter('wpvivid_schedule_backup_type','wpvivid_schedule_backup_type');
|
201 |
+
add_filter('wpvivid_schedule_notice','wpvivid_schedule_notice',10);
|
202 |
+
?>
|
203 |
+
|
trunk/admin/partials/wpvivid-settings-page-display.php
ADDED
@@ -0,0 +1,710 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wpvivid_general_settings()
|
4 |
+
{
|
5 |
+
$general_setting=WPvivid_Setting::get_setting(true, "");
|
6 |
+
$display_backup_count = $general_setting['options']['wpvivid_common_setting']['max_backup_count'];
|
7 |
+
$display_backup_count=intval($display_backup_count);
|
8 |
+
if($display_backup_count > 7){
|
9 |
+
$display_backup_count = 7;
|
10 |
+
}
|
11 |
+
if($general_setting['options']['wpvivid_common_setting']['estimate_backup']){
|
12 |
+
$wpvivid_setting_estimate_backup='checked';
|
13 |
+
}
|
14 |
+
else{
|
15 |
+
$wpvivid_setting_estimate_backup='';
|
16 |
+
}
|
17 |
+
/*if(!isset($general_setting['options']['wpvivid_common_setting']['show_tab_menu'])){
|
18 |
+
$wpvivid_show_tab_menu='checked';
|
19 |
+
}
|
20 |
+
else {
|
21 |
+
if ($general_setting['options']['wpvivid_common_setting']['show_tab_menu']) {
|
22 |
+
$wpvivid_show_tab_menu = 'checked';
|
23 |
+
} else {
|
24 |
+
$wpvivid_show_tab_menu = '';
|
25 |
+
}
|
26 |
+
}*/
|
27 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['show_admin_bar'])){
|
28 |
+
$show_admin_bar = 'checked';
|
29 |
+
}
|
30 |
+
else{
|
31 |
+
if($general_setting['options']['wpvivid_common_setting']['show_admin_bar']){
|
32 |
+
$show_admin_bar = 'checked';
|
33 |
+
}
|
34 |
+
else{
|
35 |
+
$show_admin_bar = '';
|
36 |
+
}
|
37 |
+
}
|
38 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['domain_include'])){
|
39 |
+
$wpvivid_domain_include = 'checked';
|
40 |
+
}
|
41 |
+
else{
|
42 |
+
if($general_setting['options']['wpvivid_common_setting']['domain_include']){
|
43 |
+
$wpvivid_domain_include = 'checked';
|
44 |
+
}
|
45 |
+
else{
|
46 |
+
$wpvivid_domain_include = '';
|
47 |
+
}
|
48 |
+
}
|
49 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['ismerge'])){
|
50 |
+
$wpvivid_ismerge = 'checked';
|
51 |
+
}
|
52 |
+
else{
|
53 |
+
if($general_setting['options']['wpvivid_common_setting']['ismerge'] == '1'){
|
54 |
+
$wpvivid_ismerge = 'checked';
|
55 |
+
}
|
56 |
+
else{
|
57 |
+
$wpvivid_ismerge = '';
|
58 |
+
}
|
59 |
+
}
|
60 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['retain_local'])){
|
61 |
+
$wpvivid_retain_local = '';
|
62 |
+
}
|
63 |
+
else{
|
64 |
+
if($general_setting['options']['wpvivid_common_setting']['retain_local'] == '1'){
|
65 |
+
$wpvivid_retain_local = 'checked';
|
66 |
+
}
|
67 |
+
else{
|
68 |
+
$wpvivid_retain_local = '';
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['uninstall_clear_folder'])){
|
73 |
+
$uninstall_clear_folder = '';
|
74 |
+
}
|
75 |
+
else{
|
76 |
+
if($general_setting['options']['wpvivid_common_setting']['uninstall_clear_folder'] == '1'){
|
77 |
+
$uninstall_clear_folder = 'checked';
|
78 |
+
}
|
79 |
+
else{
|
80 |
+
$uninstall_clear_folder = '';
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
global $wpvivid_plugin;
|
85 |
+
$out_of_date=$wpvivid_plugin->_get_out_of_date_info();
|
86 |
+
?>
|
87 |
+
<div class="postbox schedule-tab-block">
|
88 |
+
<div>
|
89 |
+
<select option="setting" name="max_backup_count" id="wpvivid_max_backup_count">
|
90 |
+
<?php
|
91 |
+
for($i=1; $i<8;$i++){
|
92 |
+
if($i === $display_backup_count){
|
93 |
+
echo '<option selected="selected" value="' . $i . '">' . $i . '</option>';
|
94 |
+
}
|
95 |
+
else {
|
96 |
+
echo '<option value="' . $i . '">' . $i . '</option>';
|
97 |
+
}
|
98 |
+
}
|
99 |
+
?>
|
100 |
+
</select><strong style="margin-right: 10px;"><?php _e('backups retained', 'wpvivid-backuprestore'); ?></strong><a href="https://docs.wpvivid.com/wpvivid-backup-pro-backup-retention.html" style="text-decoration: none;"><?php _e('Pro feature: Retain more backups', 'wpvivid-backuprestore'); ?></a>
|
101 |
+
</div>
|
102 |
+
<div>
|
103 |
+
<label for="wpvivid_estimate_backup">
|
104 |
+
<input type="checkbox" option="setting" name="estimate_backup" id="wpvivid_estimate_backup" value="1" <?php esc_attr_e($wpvivid_setting_estimate_backup); ?> />
|
105 |
+
<span><?php _e('Calculate the size of files, folder and database before backing up', 'wpvivid-backuprestore' ); ?></span>
|
106 |
+
</label>
|
107 |
+
</div>
|
108 |
+
<div>
|
109 |
+
<label>
|
110 |
+
<input type="checkbox" option="setting" name="show_admin_bar" <?php esc_attr_e($show_admin_bar); ?> />
|
111 |
+
<span><?php _e('Show WPvivid backup plugin on top admin bar', 'wpvivid-backuprestore'); ?></span>
|
112 |
+
</label>
|
113 |
+
</div>
|
114 |
+
<div>
|
115 |
+
<label>
|
116 |
+
<input type="checkbox" option="setting" name="ismerge" <?php esc_attr_e($wpvivid_ismerge); ?> />
|
117 |
+
<span><?php _e('Merge all the backup files into single package when a backup completes. This will save great disk spaces, though takes longer time. We recommended you check the option especially on sites with insufficient server resources.', 'wpvivid-backuprestore'); ?></span>
|
118 |
+
</label>
|
119 |
+
</div>
|
120 |
+
<div>
|
121 |
+
<label>
|
122 |
+
<input type="checkbox" option="setting" name="retain_local" <?php esc_attr_e($wpvivid_retain_local); ?> />
|
123 |
+
<span><?php _e('Keep storing the backups in localhost after uploading to remote storage', 'wpvivid-backuprestore'); ?></span>
|
124 |
+
</label>
|
125 |
+
</div>
|
126 |
+
<div>
|
127 |
+
<label>
|
128 |
+
<input type="checkbox" option="setting" name="uninstall_clear_folder" <?php esc_attr_e($uninstall_clear_folder); ?> />
|
129 |
+
<span><?php _e(sprintf('Delete the /%s folder and all backups in it when deleting WPvivid Backup plugin.', $general_setting['options']['wpvivid_local_setting']['path']), 'wpvivid-backuprestore'); ?></span>
|
130 |
+
</label>
|
131 |
+
</div>
|
132 |
+
</div>
|
133 |
+
<div class="postbox schedule-tab-block">
|
134 |
+
<div><strong><?php _e('Backup Folder', 'wpvivid-backuprestore'); ?></strong></div>
|
135 |
+
<div class="setting-tab-block">
|
136 |
+
<div><p><?php _e('Name your folder, this folder must be writable for creating backup files.', 'wpvivid-backuprestore' ); ?><p> </div>
|
137 |
+
<input type="text" placeholder="wpvividbackups" option="setting" name="path" id="wpvivid_option_backup_dir" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_local_setting']['path'], 'wpvivid-backuprestore'); ?>" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'')" onpaste="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'')" />
|
138 |
+
<p><span class="wpvivid-element-space-right"><?php _e('Local storage directory:', 'wpvivid-backuprestore'); ?></span><span><?php echo WP_CONTENT_DIR.'/'; ?><span id="wpvivid_setting_local_storage_path"><?php _e($general_setting['options']['wpvivid_local_setting']['path'], 'wpvivid-backuprestore'); ?></span></span></p>
|
139 |
+
</div>
|
140 |
+
<div>
|
141 |
+
<label>
|
142 |
+
<input type="checkbox" option="setting" name="domain_include" <?php esc_attr_e($wpvivid_domain_include); ?> />
|
143 |
+
<span><?php _e('Display domain(url) of current site in backup name. (e.g. domain_wpvivid-5ceb938b6dca9_2019-05-27-07-36_backup_all.zip)', 'wpvivid-backuprestore'); ?></span>
|
144 |
+
</label>
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
<div class="postbox schedule-tab-block">
|
148 |
+
<div><strong><?php _e('Remove out-of-date backups', 'wpvivid-backuprestore'); ?></strong></div>
|
149 |
+
<div class="setting-tab-block" style="padding-bottom: 0;">
|
150 |
+
<fieldset>
|
151 |
+
<label for="users_can_register">
|
152 |
+
<p><span class="wpvivid-element-space-right"><?php _e('Web Server Directory:', 'wpvivid-backuprestore'); ?></span><span id="wpvivid_out_of_date_local_path"><?php _e($out_of_date['web_server'], 'wpvivid-backuprestore'); ?></span></p>
|
153 |
+
<p><span style="margin-right: 2px;"><?php _e('Remote Storage Directory:', 'wpvivid-backuprestore'); ?></span><span id="wpvivid_out_of_date_remote_path">
|
154 |
+
<?php
|
155 |
+
$wpvivid_get_remote_directory = '';
|
156 |
+
$wpvivid_get_remote_directory = apply_filters('wpvivid_get_remote_directory', $wpvivid_get_remote_directory);
|
157 |
+
echo $wpvivid_get_remote_directory;
|
158 |
+
?>
|
159 |
+
</span>
|
160 |
+
</p>
|
161 |
+
</label>
|
162 |
+
</fieldset>
|
163 |
+
</div>
|
164 |
+
<div class="setting-tab-block" style="padding: 10px 10px 0 0;">
|
165 |
+
<input class="button-primary" id="wpvivid_delete_out_of_backup" style="margin-right:10px;" type="submit" name="delete-out-of-backup" value="<?php esc_attr_e( 'Remove', 'wpvivid-backuprestore' ); ?>" />
|
166 |
+
<p><?php _e('The action is irreversible! It will remove all backups are out-of-date (including local web server and remote storage) if they exist.', 'wpvivid-backuprestore'); ?> </p>
|
167 |
+
</div>
|
168 |
+
</div>
|
169 |
+
<script>
|
170 |
+
jQuery('#wpvivid_delete_out_of_backup').click(function(){
|
171 |
+
wpvivid_delete_out_of_date_backups();
|
172 |
+
});
|
173 |
+
|
174 |
+
/**
|
175 |
+
* This function will delete out of date backups.
|
176 |
+
*/
|
177 |
+
function wpvivid_delete_out_of_date_backups(){
|
178 |
+
var ajax_data={
|
179 |
+
'action': 'wpvivid_clean_out_of_date_backup'
|
180 |
+
};
|
181 |
+
jQuery('#wpvivid_delete_out_of_backup').css({'pointer-events': 'none', 'opacity': '0.4'});
|
182 |
+
wpvivid_post_request(ajax_data, function(data){
|
183 |
+
jQuery('#wpvivid_delete_out_of_backup').css({'pointer-events': 'auto', 'opacity': '1'});
|
184 |
+
try {
|
185 |
+
var jsonarray = jQuery.parseJSON(data);
|
186 |
+
if (jsonarray.result === "success") {
|
187 |
+
alert("Out of date backups have been removed.");
|
188 |
+
wpvivid_handle_backup_data(data);
|
189 |
+
}
|
190 |
+
}
|
191 |
+
catch(err){
|
192 |
+
alert(err);
|
193 |
+
jQuery('#wpvivid_delete_out_of_backup').css({'pointer-events': 'auto', 'opacity': '1'});
|
194 |
+
}
|
195 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
196 |
+
var error_message = wpvivid_output_ajaxerror('deleting out of date backups', textStatus, errorThrown);
|
197 |
+
alert(error_message);
|
198 |
+
jQuery('#wpvivid_delete_out_of_backup').css({'pointer-events': 'auto', 'opacity': '1'});
|
199 |
+
});
|
200 |
+
}
|
201 |
+
</script>
|
202 |
+
<?php
|
203 |
+
}
|
204 |
+
|
205 |
+
function wpvivid_email_report()
|
206 |
+
{
|
207 |
+
$general_setting=WPvivid_Setting::get_setting(true, "");
|
208 |
+
$setting_email_enable='';
|
209 |
+
$setting_email_display = 'display: none;';
|
210 |
+
if(isset($general_setting['options']['wpvivid_email_setting']['email_enable'])){
|
211 |
+
if($general_setting['options']['wpvivid_email_setting']['email_enable']){
|
212 |
+
$setting_email_enable='checked';
|
213 |
+
$setting_email_display = '';
|
214 |
+
}
|
215 |
+
}
|
216 |
+
$wpvivid_setting_email_always='';
|
217 |
+
$wpvivid_setting_email_failed='';
|
218 |
+
if(isset($general_setting['options']['wpvivid_email_setting']['always'])&&$general_setting['options']['wpvivid_email_setting']['always']) {
|
219 |
+
$wpvivid_setting_email_always='checked';
|
220 |
+
}
|
221 |
+
else{
|
222 |
+
$wpvivid_setting_email_failed='checked';
|
223 |
+
}
|
224 |
+
?>
|
225 |
+
<div class="postbox schedule-tab-block" id="wpvivid_email_report">
|
226 |
+
<div><p><?php _e('In order to use this function, please install a <strong><a target="_blank" href="https://wpvivid.com/8-best-smtp-plugins-for-wordpress.html" style="text-decoration: none;">WordPress SMTP plugin</a></strong> of your preference and configure your SMTP server first. This is because WordPress uses the PHP Mail function to send its emails by default, which is not supported by many hosts and can cause issues if it is not set properly.', 'wpvivid-backuprestore'); ?></p>
|
227 |
+
</div>
|
228 |
+
<div>
|
229 |
+
<label for="wpvivid_general_email_enable">
|
230 |
+
<input type="checkbox" option="setting" name="email_enable" id="wpvivid_general_email_enable" value="1" <?php esc_attr_e($setting_email_enable, 'wpvivid-backuprestore'); ?> />
|
231 |
+
<span><strong><?php _e( 'Enable email report', 'wpvivid-backuprestore' ); ?></strong></span>
|
232 |
+
</label>
|
233 |
+
</div>
|
234 |
+
<div id="wpvivid_general_email_setting" style="<?php esc_attr_e($setting_email_display, 'wpvivid-backuprestore'); ?>" >
|
235 |
+
<input type="text" placeholder="example@yourdomain.com" option="setting" name="send_to" class="regular-text" id="wpvivid_mail" value="<?php
|
236 |
+
if(!empty($general_setting['options']['wpvivid_email_setting']['send_to'])) {
|
237 |
+
foreach ($general_setting['options']['wpvivid_email_setting']['send_to'] as $mail) {
|
238 |
+
if(!empty($mail) && !is_array($mail)) {
|
239 |
+
_e($mail, 'wpvivid-backuprestore');
|
240 |
+
break;
|
241 |
+
}
|
242 |
+
}
|
243 |
+
}
|
244 |
+
?>" />
|
245 |
+
<input class="button-secondary" id="wpvivid_send_email_test" style="margin-top:10px;" type="submit" name="" value="<?php esc_attr_e( 'Test Email', 'wpvivid-backuprestore' ); ?>" title="Send an email for testing mail function"/>
|
246 |
+
<div id="wpvivid_send_email_res"></div>
|
247 |
+
<fieldset class="setting-tab-block">
|
248 |
+
<label >
|
249 |
+
<input type="radio" option="setting" name="always" value="1" <?php esc_attr_e($wpvivid_setting_email_always, 'wpvivid-backuprestore'); ?> />
|
250 |
+
<span><?php _e( 'Always send an email notification when a backup is complete', 'wpvivid-backuprestore' ); ?></span>
|
251 |
+
</label><br>
|
252 |
+
<label >
|
253 |
+
<input type="radio" option="setting" name="always" value="0" <?php esc_attr_e($wpvivid_setting_email_failed, 'wpvivid-backuprestore'); ?> />
|
254 |
+
<span><?php _e( 'Only send an email notification when a backup fails', 'wpvivid-backuprestore' ); ?></span>
|
255 |
+
</label><br>
|
256 |
+
</fieldset>
|
257 |
+
<div style="margin-bottom: 10px;">
|
258 |
+
<a href="https://wpvivid.com/wpvivid-backup-pro-email-report?utm_source=client_email_report&utm_medium=inner_link&utm_campaign=access" style="text-decoration: none;"><?php _e('Pro feature: Add another email address to get report', 'wpvivid-backuprestore'); ?></a>
|
259 |
+
</div>
|
260 |
+
</div>
|
261 |
+
</div>
|
262 |
+
<script>
|
263 |
+
jQuery('#wpvivid_send_email_test').click(function(){
|
264 |
+
wpvivid_email_test();
|
265 |
+
});
|
266 |
+
|
267 |
+
/**
|
268 |
+
* After enabling email report feature, and test if an email address works or not
|
269 |
+
*/
|
270 |
+
function wpvivid_email_test(){
|
271 |
+
var mail = jQuery('#wpvivid_mail').val();
|
272 |
+
var ajax_data = {
|
273 |
+
'action': 'wpvivid_test_send_mail',
|
274 |
+
'send_to': mail
|
275 |
+
};
|
276 |
+
wpvivid_post_request(ajax_data, function(data){
|
277 |
+
try {
|
278 |
+
var jsonarray = jQuery.parseJSON(data);
|
279 |
+
if (jsonarray.result === 'success') {
|
280 |
+
jQuery('#wpvivid_send_email_res').html('Test succeeded.');
|
281 |
+
}
|
282 |
+
else {
|
283 |
+
jQuery('#wpvivid_send_email_res').html('Test failed, ' + jsonarray.error);
|
284 |
+
}
|
285 |
+
}
|
286 |
+
catch(err){
|
287 |
+
alert(err);
|
288 |
+
}
|
289 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
290 |
+
var error_message = wpvivid_output_ajaxerror('sending test mail', textStatus, errorThrown);
|
291 |
+
alert(error_message);
|
292 |
+
});
|
293 |
+
}
|
294 |
+
</script>
|
295 |
+
<?php
|
296 |
+
}
|
297 |
+
|
298 |
+
function wpvivid_clean_junk()
|
299 |
+
{
|
300 |
+
global $wpvivid_plugin;
|
301 |
+
$junk_file=$wpvivid_plugin->_junk_files_info();
|
302 |
+
?>
|
303 |
+
<div class="postbox schedule-tab-block" id="wpvivid_clean_junk">
|
304 |
+
<div>
|
305 |
+
<strong><?php _e('Web-server disk space in use by WPvivid', 'wpvivid-backuprestore'); ?></strong>
|
306 |
+
</div>
|
307 |
+
<div class="setting-tab-block">
|
308 |
+
<div class="setting-tab-block">
|
309 |
+
<span class="wpvivid-element-space-right"><?php _e('Total Size:', 'wpvivid-backuprestore'); ?></span>
|
310 |
+
<span id="wpvivid_junk_sum_size"><?php _e($junk_file['sum_size'], 'wpvivid-backuprestore'); ?></span>
|
311 |
+
<input class="button-secondary" id="wpvivid_calculate_size" style="margin-left:10px;" type="submit" name="Calculate-Sizes" value="<?php esc_attr_e( 'Calculate Sizes', 'wpvivid-backuprestore' ); ?>" />
|
312 |
+
</div>
|
313 |
+
<fieldset>
|
314 |
+
<label for="wpvivid_junk_log">
|
315 |
+
<input type="checkbox" id="wpvivid_junk_log" option="junk-files" name="log" value="junk-log" />
|
316 |
+
<span class="wpvivid-element-space-right"><?php _e( 'logs', 'wpvivid-backuprestore' ); ?></span>
|
317 |
+
<span style="margin-right: 2px;"><?php _e('Path:', 'wpvivid-backuprestore' ); ?></span><span id="wpvivid_junk_log_path"><?php _e($junk_file['log_path'], 'wpvivid-backuprestore'); ?></span>
|
318 |
+
</label>
|
319 |
+
</fieldset>
|
320 |
+
<fieldset>
|
321 |
+
<label for="wpvivid_junk_backup_cache">
|
322 |
+
<input type="checkbox" id="wpvivid_junk_backup_cache" option="junk-files" name="backup_cache" value="junk-backup-cache" />
|
323 |
+
<span class="wpvivid-element-space-right"><?php _e( 'Backup Cache', 'wpvivid-backuprestore' ); ?></span>
|
324 |
+
</label>
|
325 |
+
<label for="wpvivid_junk_file">
|
326 |
+
<input type="checkbox" id="wpvivid_junk_file" option="junk-files" name="junk_files" value="junk-files" />
|
327 |
+
<span class="wpvivid-element-space-right"><?php _e( 'Junk', 'wpvivid-backuprestore' ); ?></span>
|
328 |
+
<span style="margin-right: 2px;"><?php _e('Path:', 'wpvivid-backuprestore' ); ?></span><span id="wpvivid_junk_file_path"><?php _e($junk_file['junk_path'], 'wpvivid-backuprestore'); ?></span>
|
329 |
+
</label>
|
330 |
+
</fieldset>
|
331 |
+
<fieldset>
|
332 |
+
<label for="wpvivid_junk_temporary_file">
|
333 |
+
<input type="checkbox" id="wpvivid_junk_temporary_file" option="junk-files" name="old_files" value="junk-temporary-files" />
|
334 |
+
<span class="wpvivid-element-space-right"><?php _e( 'Temporary Files', 'wpvivid-backuprestore' ); ?></span>
|
335 |
+
<span style="margin-right: 2px;"><?php _e('Path:', 'wpvivid-backuprestore'); ?></span><span id="wpvivid_restore_temp_file_path"><?php _e($junk_file['old_files_path'], 'wpvivid-backuprestore'); ?></span>
|
336 |
+
<p><?php echo __('Temporary Files are created by wpvivid when restoring a website.', 'wpvivid-backuprestore'); ?></p>
|
337 |
+
</label>
|
338 |
+
</fieldset>
|
339 |
+
</div>
|
340 |
+
<div><input class="button-primary" id="wpvivid_clean_junk_file" type="submit" name="Empty-all-files" value="<?php esc_attr_e( 'Empty', 'wpvivid-backuprestore' ); ?>" /></div>
|
341 |
+
<div style="clear:both;"></div>
|
342 |
+
</div>
|
343 |
+
<script>
|
344 |
+
jQuery('#wpvivid_calculate_size').click(function(){
|
345 |
+
wpvivid_calculate_diskspaceused();
|
346 |
+
});
|
347 |
+
|
348 |
+
jQuery('#wpvivid_clean_junk_file').click(function(){
|
349 |
+
wpvivid_clean_junk_files();
|
350 |
+
});
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Calculate the server disk space in use by WPvivid.
|
354 |
+
*/
|
355 |
+
function wpvivid_calculate_diskspaceused(){
|
356 |
+
var ajax_data={
|
357 |
+
'action': 'wpvivid_junk_files_info'
|
358 |
+
};
|
359 |
+
var current_size = jQuery('#wpvivid_junk_sum_size').html();
|
360 |
+
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'none', 'opacity': '0.4'});
|
361 |
+
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'none', 'opacity': '0.4'});
|
362 |
+
jQuery('#wpvivid_junk_sum_size').html("calculating...");
|
363 |
+
wpvivid_post_request(ajax_data, function(data){
|
364 |
+
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'auto', 'opacity': '1'});
|
365 |
+
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'auto', 'opacity': '1'});
|
366 |
+
try {
|
367 |
+
var jsonarray = jQuery.parseJSON(data);
|
368 |
+
if (jsonarray.result === "success") {
|
369 |
+
jQuery('#wpvivid_junk_sum_size').html(jsonarray.data.sum_size);
|
370 |
+
jQuery('#wpvivid_junk_log_path').html(jsonarray.data.log_path);
|
371 |
+
jQuery('#wpvivid_junk_file_path').html(jsonarray.data.junk_path);
|
372 |
+
jQuery('#wpvivid_restore_temp_file_path').html(jsonarray.data.old_files_path);
|
373 |
+
}
|
374 |
+
}
|
375 |
+
catch(err){
|
376 |
+
alert(err);
|
377 |
+
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'auto', 'opacity': '1'});
|
378 |
+
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'auto', 'opacity': '1'});
|
379 |
+
jQuery('#wpvivid_junk_sum_size').html(current_size);
|
380 |
+
}
|
381 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
382 |
+
var error_message = wpvivid_output_ajaxerror('calculating server disk space in use by WPvivid', textStatus, errorThrown);
|
383 |
+
alert(error_message);
|
384 |
+
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'auto', 'opacity': '1'});
|
385 |
+
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'auto', 'opacity': '1'});
|
386 |
+
jQuery('#wpvivid_junk_sum_size').html(current_size);
|
387 |
+
});
|
388 |
+
}
|
389 |
+
|
390 |
+
/**
|
391 |
+
* Clean junk files created during backups and restorations off your web server disk.
|
392 |
+
*/
|
393 |
+
function wpvivid_clean_junk_files(){
|
394 |
+
var descript = 'The selected item(s) will be permanently deleted. Are you sure you want to continue?';
|
395 |
+
var ret = confirm(descript);
|
396 |
+
if(ret === true){
|
397 |
+
var option_data = wpvivid_ajax_data_transfer('junk-files');
|
398 |
+
var ajax_data = {
|
399 |
+
'action': 'wpvivid_clean_local_storage',
|
400 |
+
'options': option_data
|
401 |
+
};
|
402 |
+
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'none', 'opacity': '0.4'});
|
403 |
+
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'none', 'opacity': '0.4'});
|
404 |
+
wpvivid_post_request(ajax_data, function (data) {
|
405 |
+
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'auto', 'opacity': '1'});
|
406 |
+
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'auto', 'opacity': '1'});
|
407 |
+
jQuery('input[option="junk-files"]').prop('checked', false);
|
408 |
+
try {
|
409 |
+
var jsonarray = jQuery.parseJSON(data);
|
410 |
+
alert(jsonarray.msg);
|
411 |
+
if (jsonarray.result === "success") {
|
412 |
+
jQuery('#wpvivid_junk_sum_size').html(jsonarray.data.sum_size);
|
413 |
+
jQuery('#wpvivid_junk_log_path').html(jsonarray.data.log_path);
|
414 |
+
jQuery('#wpvivid_junk_file_path').html(jsonarray.data.junk_path);
|
415 |
+
jQuery('#wpvivid_restore_temp_file_path').html(jsonarray.data.old_files_path);
|
416 |
+
jQuery('#wpvivid_loglist').html("");
|
417 |
+
jQuery('#wpvivid_loglist').append(jsonarray.html);
|
418 |
+
wpvivid_log_count = jsonarray.log_count;
|
419 |
+
wpvivid_display_log_page();
|
420 |
+
}
|
421 |
+
}
|
422 |
+
catch(err){
|
423 |
+
alert(err);
|
424 |
+
}
|
425 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
426 |
+
var error_message = wpvivid_output_ajaxerror('cleaning out junk files', textStatus, errorThrown);
|
427 |
+
alert(error_message);
|
428 |
+
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'auto', 'opacity': '1'});
|
429 |
+
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'auto', 'opacity': '1'});
|
430 |
+
});
|
431 |
+
}
|
432 |
+
}
|
433 |
+
</script>
|
434 |
+
<?php
|
435 |
+
}
|
436 |
+
|
437 |
+
function wpvivid_export_import_settings()
|
438 |
+
{
|
439 |
+
?>
|
440 |
+
<div class="postbox schedule-tab-block" id="wpvivid_export_import">
|
441 |
+
<div class="setting-tab-block" style="padding-bottom: 0;">
|
442 |
+
<input class="button-primary" id="wpvivid_setting_export" type="button" name="" value="<?php esc_attr_e( 'Export', 'wpvivid-backuprestore' ); ?>" />
|
443 |
+
<p><?php echo __('Click \'Export\' button to save WPvivid settings on your local computer.', 'wpvivid-backuprestore'); ?> </p>
|
444 |
+
</div>
|
445 |
+
<div class="setting-tab-block" style="padding: 0 10px 0 0;">
|
446 |
+
<input type="file" name="fileTrans" id="wpvivid_select_import_file"></br>
|
447 |
+
<input class="button-primary" id="wpvivid_setting_import" type="button" name="" value="<?php esc_attr_e( 'Import', 'wpvivid-backuprestore' ); ?>" />
|
448 |
+
<p><?php echo __('Importing the json file can help you set WPvivid\'s configuration on another wordpress site quickly.', 'wpvivid-backuprestore'); ?></p>
|
449 |
+
</div>
|
450 |
+
<div style="clear:both;"></div>
|
451 |
+
</div>
|
452 |
+
<script>
|
453 |
+
jQuery('#wpvivid_setting_export').click(function(){
|
454 |
+
wpvivid_export_settings();
|
455 |
+
});
|
456 |
+
|
457 |
+
jQuery('#wpvivid_setting_import').click(function(){
|
458 |
+
wpvivid_import_settings();
|
459 |
+
});
|
460 |
+
|
461 |
+
function wpvivid_export_settings() {
|
462 |
+
wpvivid_location_href=true;
|
463 |
+
location.href =ajaxurl+'?_wpnonce='+wpvivid_ajax_object.ajax_nonce+'&action=wpvivid_export_setting&setting=1&history=1&review=0';
|
464 |
+
}
|
465 |
+
|
466 |
+
function wpvivid_import_settings(){
|
467 |
+
var files = jQuery('input[name="fileTrans"]').prop('files');
|
468 |
+
|
469 |
+
if(files.length == 0){
|
470 |
+
alert('Choose a settings file and import it by clicking Import button.');
|
471 |
+
return;
|
472 |
+
}
|
473 |
+
else{
|
474 |
+
var reader = new FileReader();
|
475 |
+
reader.readAsText(files[0], "UTF-8");
|
476 |
+
reader.onload = function(evt){
|
477 |
+
var fileString = evt.target.result;
|
478 |
+
var ajax_data = {
|
479 |
+
'action': 'wpvivid_import_setting',
|
480 |
+
'data': fileString
|
481 |
+
};
|
482 |
+
wpvivid_post_request(ajax_data, function(data){
|
483 |
+
try {
|
484 |
+
var jsonarray = jQuery.parseJSON(data);
|
485 |
+
if (jsonarray.result === 'success') {
|
486 |
+
alert('The plugin settings is imported successfully.');
|
487 |
+
location.reload();
|
488 |
+
}
|
489 |
+
else {
|
490 |
+
alert('Error: ' + jsonarray.error);
|
491 |
+
}
|
492 |
+
}
|
493 |
+
catch(err){
|
494 |
+
alert(err);
|
495 |
+
}
|
496 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
497 |
+
var error_message = wpvivid_output_ajaxerror('importing the previously-exported settings', textStatus, errorThrown);
|
498 |
+
jQuery('#wpvivid_display_log_content').html(error_message);
|
499 |
+
});
|
500 |
+
}
|
501 |
+
}
|
502 |
+
}
|
503 |
+
</script>
|
504 |
+
<?php
|
505 |
+
}
|
506 |
+
|
507 |
+
function wpvivid_advanced_settings()
|
508 |
+
{
|
509 |
+
$general_setting=WPvivid_Setting::get_setting(true, "");
|
510 |
+
$wpvivid_setting_no_compress='';
|
511 |
+
$wpvivid_setting_compress='';
|
512 |
+
if($general_setting['options']['wpvivid_compress_setting']['no_compress']){
|
513 |
+
$wpvivid_setting_no_compress='checked';
|
514 |
+
}
|
515 |
+
else{
|
516 |
+
$wpvivid_setting_compress='checked';
|
517 |
+
}
|
518 |
+
|
519 |
+
if(!isset($general_setting['options']['wpvivid_compress_setting']['subpackage_plugin_upload'])){
|
520 |
+
$subpackage_plugin_upload = '';
|
521 |
+
}
|
522 |
+
else{
|
523 |
+
if($general_setting['options']['wpvivid_compress_setting']['subpackage_plugin_upload']){
|
524 |
+
$subpackage_plugin_upload = 'checked';
|
525 |
+
}
|
526 |
+
else{
|
527 |
+
$subpackage_plugin_upload = '';
|
528 |
+
}
|
529 |
+
}
|
530 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['max_resume_count'])){
|
531 |
+
$wpvivid_max_resume_count = WPVIVID_RESUME_RETRY_TIMES;
|
532 |
+
}
|
533 |
+
else{
|
534 |
+
$wpvivid_max_resume_count = intval($general_setting['options']['wpvivid_common_setting']['max_resume_count']);
|
535 |
+
}
|
536 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['memory_limit'])){
|
537 |
+
$general_setting['options']['wpvivid_common_setting']['memory_limit']=WPVIVID_MEMORY_LIMIT;
|
538 |
+
}
|
539 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['restore_memory_limit'])){
|
540 |
+
$general_setting['options']['wpvivid_common_setting']['restore_memory_limit']=WPVIVID_RESTORE_MEMORY_LIMIT;
|
541 |
+
}
|
542 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['migrate_size'])){
|
543 |
+
$general_setting['options']['wpvivid_common_setting']['migrate_size']=WPVIVID_MIGRATE_SIZE;
|
544 |
+
}
|
545 |
+
if(isset($general_setting['options']['wpvivid_common_setting']['db_connect_method'])){
|
546 |
+
if($general_setting['options']['wpvivid_common_setting']['db_connect_method'] === 'wpdb'){
|
547 |
+
$db_method_wpdb = 'checked';
|
548 |
+
$db_method_pdo = '';
|
549 |
+
}
|
550 |
+
else{
|
551 |
+
$db_method_wpdb = '';
|
552 |
+
$db_method_pdo = 'checked';
|
553 |
+
}
|
554 |
+
}
|
555 |
+
else{
|
556 |
+
$db_method_wpdb = 'checked';
|
557 |
+
$db_method_pdo = '';
|
558 |
+
}
|
559 |
+
if(isset($general_setting['options']['wpvivid_common_setting']['restore_max_execution_time'])){
|
560 |
+
$restore_max_execution_time = intval($general_setting['options']['wpvivid_common_setting']['restore_max_execution_time']);
|
561 |
+
}
|
562 |
+
else{
|
563 |
+
$restore_max_execution_time = WPVIVID_RESTORE_MAX_EXECUTION_TIME;
|
564 |
+
}
|
565 |
+
?>
|
566 |
+
<div class="postbox schedule-tab-block setting-page-content">
|
567 |
+
<div>
|
568 |
+
<p><strong><?php _e('Enable the option when backup failed.', 'wpvivid-backuprestore'); ?></strong> <?php _e('Special optimization for web hosting/shared hosting', 'wpvivid-backuprestore'); ?></p>
|
569 |
+
<div>
|
570 |
+
<label>
|
571 |
+
<input type="checkbox" option="setting" name="subpackage_plugin_upload" <?php esc_attr_e($subpackage_plugin_upload); ?> />
|
572 |
+
<span><strong><?php _e('Enable optimization mode for web hosting/shared hosting', 'wpvivid-backuprestore'); ?></strong></span>
|
573 |
+
</label>
|
574 |
+
<div>
|
575 |
+
<p><?php _e('Enabling this option can improve the backup success rate, but it will take more time for backup.', 'wpvivid-backuprestore'); ?></p>
|
576 |
+
</div>
|
577 |
+
</div>
|
578 |
+
</div>
|
579 |
+
</div>
|
580 |
+
<div class="postbox schedule-tab-block wpvivid-setting-addon" style="margin-bottom: 10px; padding-bottom: 0;">
|
581 |
+
<div class="wpvivid-element-space-bottom">
|
582 |
+
<strong><?php _e('Database access method.', 'wpvivid-backuprestore'); ?></strong>
|
583 |
+
</div>
|
584 |
+
<div class="wpvivid-element-space-bottom">
|
585 |
+
<label>
|
586 |
+
<input type="radio" option="setting" name="db_connect_method" value="wpdb" <?php esc_attr_e($db_method_wpdb); ?> />
|
587 |
+
<span class="wpvivid-element-space-right"><strong>WPDB</strong></span><span><?php _e('WPDB option has a better compatibility, but the speed of backup and restore is slower.', 'wpvivid-backuprestore'); ?></span>
|
588 |
+
</label>
|
589 |
+
</div>
|
590 |
+
<div class="wpvivid-element-space-bottom">
|
591 |
+
<label>
|
592 |
+
<input type="radio" option="setting" name="db_connect_method" value="pdo" <?php esc_attr_e($db_method_pdo); ?> />
|
593 |
+
<span class="wpvivid-element-space-right"><strong>PDO</strong></span><span><?php _e('It is recommended to choose PDO option if pdo_mysql extension is installed on your server, which lets you backup and restore your site faster.', 'wpvivid-backuprestore'); ?></span>
|
594 |
+
</label>
|
595 |
+
</div>
|
596 |
+
</div>
|
597 |
+
<div class="postbox schedule-tab-block setting-page-content">
|
598 |
+
<fieldset>
|
599 |
+
<label>
|
600 |
+
<input type="radio" option="setting" name="no_compress" value="1" <?php esc_attr_e($wpvivid_setting_no_compress, 'wpvivid-backuprestore'); ?> />
|
601 |
+
<span class="wpvivid-element-space-right" title="<?php _e( 'It will cause a lower CPU Usage and is recommended in a web hosting/ shared hosting environment.', 'wpvivid-backuprestore' ); ?>"><?php _e( 'Only Archive without compressing', 'wpvivid-backuprestore' ); ?></span>
|
602 |
+
</label>
|
603 |
+
<label>
|
604 |
+
<input type="radio" option="setting" name="no_compress" value="0" <?php esc_attr_e($wpvivid_setting_compress, 'wpvivid-backuprestore'); ?> />
|
605 |
+
<span class="wpvivid-element-space-right" title="<?php _e( 'It will cause a higher CPU Usage and is recommended in a VPS/ dedicated hosting environment.', 'wpvivid-backuprestore' ); ?>"><?php _e( 'Compress and Archive', 'wpvivid-backuprestore' ); ?></span>
|
606 |
+
</label>
|
607 |
+
<label style="display: none;">
|
608 |
+
<input type="radio" option="setting" name="compress_type" value="zip" checked />
|
609 |
+
<input type="radio" option="setting" name="use_temp_file" value="1" checked />
|
610 |
+
<input type="radio" option="setting" name="use_temp_size" value="16" checked />
|
611 |
+
</label>
|
612 |
+
</fieldset>
|
613 |
+
<div style="padding-top: 10px;">
|
614 |
+
<div><strong><?php _e('Compress Files Every', 'wpvivid-backuprestore'); ?></strong></div>
|
615 |
+
<div class="setting-tab-block">
|
616 |
+
<input type="text" placeholder="400" option="setting" name="max_file_size" id="wpvivid_max_zip" class="all-options" value="<?php esc_attr_e(str_replace('M', '', $general_setting['options']['wpvivid_compress_setting']['max_file_size']), 'wpvivid-backuprestore'); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
|
617 |
+
<div><p><?php _e( 'Some web hosting providers limit large zip files (e.g. 200MB), and therefore splitting your backup into many parts is an ideal way to avoid hitting the limitation if you are running a big website. Please try to adjust the value if you are encountering backup errors. If you use a value of 0 MB, any backup files won\'t be split.', 'wpvivid-backuprestore' ); ?></div></p>
|
618 |
+
</div>
|
619 |
+
<div><strong><?php _e('Exclude the files which are larger than', 'wpvivid-backuprestore'); ?></strong></div>
|
620 |
+
<div class="setting-tab-block">
|
621 |
+
<input type="text" placeholder="400" option="setting" name="exclude_file_size" id="wpvivid_ignore_large" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_compress_setting']['exclude_file_size'], 'wpvivid-backuprestore'); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
|
622 |
+
<div><p><?php _e( 'Using the option will ignore the file larger than the certain size in MB when backing up, \'0\' (zero) means unlimited.', 'wpvivid-backuprestore' ); ?></p></div>
|
623 |
+
</div>
|
624 |
+
<div><strong><?php _e('PHP script execution timeout for backup', 'wpvivid-backuprestore'); ?></strong></div>
|
625 |
+
<div class="setting-tab-block">
|
626 |
+
<input type="text" placeholder="600" option="setting" name="max_execution_time" id="wpvivid_option_timeout" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_common_setting']['max_execution_time'], 'wpvivid-backuprestore'); ?>" onkeyup="value=value.replace(/\D/g,'')" />Seconds
|
627 |
+
<div><p><?php _e( 'The time-out is not your server PHP time-out. With the execution time exhausted, our plugin will shut the process of backup down. If the progress of backup encounters a time-out, that means you have a medium or large sized website, please try to scale the value bigger.', 'wpvivid-backuprestore' ); ?></p></div>
|
628 |
+
</div>
|
629 |
+
<div><strong><?php _e('PHP script execution timeout for restore', 'wpvivid-backuprestore'); ?></strong></div>
|
630 |
+
<div class="setting-tab-block">
|
631 |
+
<input type="text" placeholder="1800" option="setting" name="restore_max_execution_time" class="all-options" value="<?php esc_attr_e($restore_max_execution_time); ?>" onkeyup="value=value.replace(/\D/g,'')" />Seconds
|
632 |
+
<div><p><?php _e( 'The time-out is not your server PHP time-out. With the execution time exhausted, our plugin will shut the process of restore down. If the progress of restore encounters a time-out, that means you have a medium or large sized website, please try to scale the value bigger.', 'wpvivid-backuprestore' ); ?></p></div>
|
633 |
+
</div>
|
634 |
+
<div><strong><?php _e('PHP Memory Limit for backup', 'wpvivid-backuprestore'); ?></strong></div>
|
635 |
+
<div class="setting-tab-block">
|
636 |
+
<input type="text" placeholder="256" option="setting" name="memory_limit" class="all-options" value="<?php esc_attr_e(str_replace('M', '', $general_setting['options']['wpvivid_common_setting']['memory_limit']), 'wpvivid-backuprestore'); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
|
637 |
+
<div><p><?php _e('Adjust this value to apply for a temporary PHP memory limit for WPvivid backup plugin to run a backup. We set this value to 256M by default. Increase the value if you encounter a memory exhausted error. Note: some web hosting providers may not support this.', 'wpvivid-backuprestore'); ?></p></div>
|
638 |
+
</div>
|
639 |
+
<div><strong><?php _e('PHP Memory Limit for restoration', 'wpvivid-backuprestore'); ?></strong></div>
|
640 |
+
<div class="setting-tab-block">
|
641 |
+
<input type="text" placeholder="256" option="setting" name="restore_memory_limit" class="all-options" value="<?php esc_attr_e(str_replace('M', '', $general_setting['options']['wpvivid_common_setting']['restore_memory_limit']), 'wpvivid-backuprestore'); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
|
642 |
+
<div><p><?php _e('Adjust this value to apply for a temporary PHP memory limit for WPvivid backup plugin in restore process. We set this value to 256M by default. Increase the value if you encounter a memory exhausted error. Note: some web hosting providers may not support this.', 'wpvivid-backuprestore'); ?></p></div>
|
643 |
+
</div>
|
644 |
+
<div><strong><?php _e('Chunk Size', 'wpvivid-backuprestore'); ?></strong></div>
|
645 |
+
<div class="setting-tab-block">
|
646 |
+
<input type="text" placeholder="2" option="setting" name="migrate_size" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_common_setting']['migrate_size']); ?>" onkeyup="value=value.replace(/\D/g,'')" />KB
|
647 |
+
<div><p><?php _e('e.g. if you choose a chunk size of 2MB, a 8MB file will use 4 chunks. Decreasing this value will break the ISP\'s transmission limit, for example:512KB', 'wpvivid-backuprestore'); ?></p></div>
|
648 |
+
</div>
|
649 |
+
<div>
|
650 |
+
<?php
|
651 |
+
$max_count_option = '';
|
652 |
+
for($resume_count=3; $resume_count<10; $resume_count++){
|
653 |
+
if($resume_count === $wpvivid_max_resume_count){
|
654 |
+
$max_count_option .= '<option selected="selected" value="'.$resume_count.'">'.$resume_count.'</option>';
|
655 |
+
}
|
656 |
+
else{
|
657 |
+
$max_count_option .= '<option value="'.$resume_count.'">'.$resume_count.'</option>';
|
658 |
+
}
|
659 |
+
}
|
660 |
+
$max_count_select = '<select option="setting" name="max_resume_count">'.$max_count_option.'</select>';
|
661 |
+
echo sprintf(__('<strong>Retrying </strong>%s<strong> times when encountering a time-out error</strong>', 'wpvivid-backuprestore'), $max_count_select);
|
662 |
+
?>
|
663 |
+
</div>
|
664 |
+
</div>
|
665 |
+
</div>
|
666 |
+
<?php
|
667 |
+
}
|
668 |
+
|
669 |
+
function wpvivid_add_setting_tab_page($setting_array){
|
670 |
+
$setting_array['general_setting'] = array('index' => '1', 'tab_func' => 'wpvivid_settingpage_add_tab_general', 'page_func' => 'wpvivid_settingpage_add_page_general');
|
671 |
+
$setting_array['advance_setting'] = array('index' => '2', 'tab_func' => 'wpvivid_settingpage_add_tab_advance', 'page_func' => 'wpvivid_settingpage_add_page_advance');
|
672 |
+
return $setting_array;
|
673 |
+
}
|
674 |
+
|
675 |
+
function wpvivid_settingpage_add_tab_general(){
|
676 |
+
?>
|
677 |
+
<a href="#" id="wpvivid_tab_general_setting" class="nav-tab setting-nav-tab nav-tab-active" onclick="switchsettingTabs(event,'page-general-setting')"><?php _e('General Settings', 'wpvivid-backuprestore'); ?></a>
|
678 |
+
<?php
|
679 |
+
}
|
680 |
+
|
681 |
+
function wpvivid_settingpage_add_tab_advance(){
|
682 |
+
?>
|
683 |
+
<a href="#" id="wpvivid_tab_advance_setting" class="nav-tab setting-nav-tab" onclick="switchsettingTabs(event,'page-advance-setting')"><?php _e('Advanced Settings', 'wpvivid-backuprestore'); ?></a>
|
684 |
+
<?php
|
685 |
+
}
|
686 |
+
|
687 |
+
function wpvivid_settingpage_add_page_general(){
|
688 |
+
?>
|
689 |
+
<div class="setting-tab-content wpvivid_tab_general_setting" id="page-general-setting" style="margin-top: 10px;">
|
690 |
+
<?php do_action('wpvivid_setting_add_general_cell'); ?>
|
691 |
+
</div>
|
692 |
+
<?php
|
693 |
+
}
|
694 |
+
|
695 |
+
function wpvivid_settingpage_add_page_advance(){
|
696 |
+
?>
|
697 |
+
<div class="setting-tab-content wpvivid_tab_advance_setting" id="page-advance-setting" style="margin-top: 10px; display: none;">
|
698 |
+
<?php do_action('wpvivid_setting_add_advance_cell'); ?>
|
699 |
+
</div>
|
700 |
+
<?php
|
701 |
+
}
|
702 |
+
|
703 |
+
add_filter('wpvivid_add_setting_tab_page', 'wpvivid_add_setting_tab_page', 10);
|
704 |
+
|
705 |
+
add_action('wpvivid_setting_add_general_cell','wpvivid_general_settings',10);
|
706 |
+
add_action('wpvivid_setting_add_advance_cell','wpvivid_advanced_settings',13);
|
707 |
+
add_action('wpvivid_setting_add_general_cell','wpvivid_email_report',14);
|
708 |
+
add_action('wpvivid_setting_add_general_cell','wpvivid_clean_junk',15);
|
709 |
+
add_action('wpvivid_setting_add_general_cell','wpvivid_export_import_settings',16);
|
710 |
+
?>
|
trunk/admin/partials/wpvivid-website-info-page-display.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script>
|
2 |
+
function wpvivid_get_ini_memory_limit() {
|
3 |
+
var ajax_data = {
|
4 |
+
'action': 'wpvivid_get_ini_memory_limit'
|
5 |
+
};
|
6 |
+
wpvivid_post_request(ajax_data, function (data) {
|
7 |
+
try {
|
8 |
+
jQuery('#wpvivid_websiteinfo_list tr').each(function (i) {
|
9 |
+
jQuery(this).children('td').each(function (j) {
|
10 |
+
if (j == 0) {
|
11 |
+
if (jQuery(this).html().indexOf('memory_limit') >= 0) {
|
12 |
+
jQuery(this).next().html(data);
|
13 |
+
}
|
14 |
+
}
|
15 |
+
});
|
16 |
+
});
|
17 |
+
}
|
18 |
+
catch (err) {
|
19 |
+
setTimeout(function ()
|
20 |
+
{
|
21 |
+
wpvivid_get_ini_memory_limit();
|
22 |
+
}, 3000);
|
23 |
+
}
|
24 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
25 |
+
setTimeout(function ()
|
26 |
+
{
|
27 |
+
wpvivid_get_ini_memory_limit();
|
28 |
+
}, 3000);
|
29 |
+
});
|
30 |
+
}
|
31 |
+
jQuery(document).ready(function ()
|
32 |
+
{
|
33 |
+
wpvivid_get_ini_memory_limit();
|
34 |
+
});
|
35 |
+
</script>
|
trunk/includes/class-wpvivid-additional-db-method.php
ADDED
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPvivid_Additional_DB_Method
|
4 |
+
{
|
5 |
+
private $dbuser;
|
6 |
+
private $dbpass;
|
7 |
+
private $dbhost;
|
8 |
+
private $use_mysqli = false;
|
9 |
+
private $dbh;
|
10 |
+
private $has_connected = false;
|
11 |
+
public $charset;
|
12 |
+
public $collate;
|
13 |
+
|
14 |
+
public function __construct($dbuser, $dbpass, $dbhost){
|
15 |
+
$this->dbuser = $dbuser;
|
16 |
+
$this->dbpass = $dbpass;
|
17 |
+
$this->dbhost = $dbhost;
|
18 |
+
|
19 |
+
if ( function_exists( 'mysqli_connect' ) ) {
|
20 |
+
$this->use_mysqli = true;
|
21 |
+
|
22 |
+
if ( defined( 'WP_USE_EXT_MYSQL' ) ) {
|
23 |
+
$this->use_mysqli = ! WP_USE_EXT_MYSQL;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
public function wpvivid_parse_db_host( $host ) {
|
29 |
+
$port = null;
|
30 |
+
$socket = null;
|
31 |
+
$is_ipv6 = false;
|
32 |
+
|
33 |
+
// First peel off the socket parameter from the right, if it exists.
|
34 |
+
$socket_pos = strpos( $host, ':/' );
|
35 |
+
if ( $socket_pos !== false ) {
|
36 |
+
$socket = substr( $host, $socket_pos + 1 );
|
37 |
+
$host = substr( $host, 0, $socket_pos );
|
38 |
+
}
|
39 |
+
|
40 |
+
// We need to check for an IPv6 address first.
|
41 |
+
// An IPv6 address will always contain at least two colons.
|
42 |
+
if ( substr_count( $host, ':' ) > 1 ) {
|
43 |
+
$pattern = '#^(?:\[)?(?P<host>[0-9a-fA-F:]+)(?:\]:(?P<port>[\d]+))?#';
|
44 |
+
$is_ipv6 = true;
|
45 |
+
} else {
|
46 |
+
// We seem to be dealing with an IPv4 address.
|
47 |
+
$pattern = '#^(?P<host>[^:/]*)(?::(?P<port>[\d]+))?#';
|
48 |
+
}
|
49 |
+
|
50 |
+
$matches = array();
|
51 |
+
$result = preg_match( $pattern, $host, $matches );
|
52 |
+
|
53 |
+
if ( 1 !== $result ) {
|
54 |
+
// Couldn't parse the address, bail.
|
55 |
+
return false;
|
56 |
+
}
|
57 |
+
|
58 |
+
$host = '';
|
59 |
+
foreach ( array( 'host', 'port' ) as $component ) {
|
60 |
+
if ( ! empty( $matches[ $component ] ) ) {
|
61 |
+
$$component = $matches[ $component ];
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
return array( $host, $port, $socket, $is_ipv6 );
|
66 |
+
}
|
67 |
+
|
68 |
+
public function db_version() {
|
69 |
+
if ( $this->use_mysqli ) {
|
70 |
+
$server_info = mysqli_get_server_info( $this->dbh );
|
71 |
+
} else {
|
72 |
+
$server_info = mysql_get_server_info( $this->dbh );
|
73 |
+
}
|
74 |
+
return preg_replace( '/[^0-9.].*/', '', $server_info );
|
75 |
+
}
|
76 |
+
|
77 |
+
public function has_cap( $db_cap ) {
|
78 |
+
$version = $this->db_version();
|
79 |
+
|
80 |
+
switch ( strtolower( $db_cap ) ) {
|
81 |
+
case 'collation': // @since 2.5.0
|
82 |
+
case 'group_concat': // @since 2.7.0
|
83 |
+
case 'subqueries': // @since 2.7.0
|
84 |
+
return version_compare( $version, '4.1', '>=' );
|
85 |
+
case 'set_charset':
|
86 |
+
return version_compare( $version, '5.0.7', '>=' );
|
87 |
+
case 'utf8mb4': // @since 4.1.0
|
88 |
+
if ( version_compare( $version, '5.5.3', '<' ) ) {
|
89 |
+
return false;
|
90 |
+
}
|
91 |
+
if ( $this->use_mysqli ) {
|
92 |
+
$client_version = mysqli_get_client_info();
|
93 |
+
} else {
|
94 |
+
$client_version = mysql_get_client_info();
|
95 |
+
}
|
96 |
+
|
97 |
+
/*
|
98 |
+
* libmysql has supported utf8mb4 since 5.5.3, same as the MySQL server.
|
99 |
+
* mysqlnd has supported utf8mb4 since 5.0.9.
|
100 |
+
*/
|
101 |
+
if ( false !== strpos( $client_version, 'mysqlnd' ) ) {
|
102 |
+
$client_version = preg_replace( '/^\D+([\d.]+).*/', '$1', $client_version );
|
103 |
+
return version_compare( $client_version, '5.0.9', '>=' );
|
104 |
+
} else {
|
105 |
+
return version_compare( $client_version, '5.5.3', '>=' );
|
106 |
+
}
|
107 |
+
case 'utf8mb4_520': // @since 4.6.0
|
108 |
+
return version_compare( $version, '5.6', '>=' );
|
109 |
+
}
|
110 |
+
|
111 |
+
return false;
|
112 |
+
}
|
113 |
+
|
114 |
+
public function determine_charset( $charset, $collate ) {
|
115 |
+
if ( ( $this->use_mysqli && ! ( $this->dbh instanceof mysqli ) ) || empty( $this->dbh ) ) {
|
116 |
+
return compact( 'charset', 'collate' );
|
117 |
+
}
|
118 |
+
|
119 |
+
if ( 'utf8' === $charset && $this->has_cap( 'utf8mb4' ) ) {
|
120 |
+
$charset = 'utf8mb4';
|
121 |
+
}
|
122 |
+
|
123 |
+
if ( 'utf8mb4' === $charset && ! $this->has_cap( 'utf8mb4' ) ) {
|
124 |
+
$charset = 'utf8';
|
125 |
+
$collate = str_replace( 'utf8mb4_', 'utf8_', $collate );
|
126 |
+
}
|
127 |
+
|
128 |
+
if ( 'utf8mb4' === $charset ) {
|
129 |
+
// _general_ is outdated, so we can upgrade it to _unicode_, instead.
|
130 |
+
if ( ! $collate || 'utf8_general_ci' === $collate ) {
|
131 |
+
$collate = 'utf8mb4_unicode_ci';
|
132 |
+
} else {
|
133 |
+
$collate = str_replace( 'utf8_', 'utf8mb4_', $collate );
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
// _unicode_520_ is a better collation, we should use that when it's available.
|
138 |
+
if ( $this->has_cap( 'utf8mb4_520' ) && 'utf8mb4_unicode_ci' === $collate ) {
|
139 |
+
$collate = 'utf8mb4_unicode_520_ci';
|
140 |
+
}
|
141 |
+
|
142 |
+
return compact( 'charset', 'collate' );
|
143 |
+
}
|
144 |
+
|
145 |
+
public function init_charset() {
|
146 |
+
$charset = '';
|
147 |
+
$collate = '';
|
148 |
+
|
149 |
+
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
150 |
+
$charset = 'utf8';
|
151 |
+
if ( defined( 'DB_COLLATE' ) && DB_COLLATE ) {
|
152 |
+
$collate = DB_COLLATE;
|
153 |
+
} else {
|
154 |
+
$collate = 'utf8_general_ci';
|
155 |
+
}
|
156 |
+
} elseif ( defined( 'DB_COLLATE' ) ) {
|
157 |
+
$collate = DB_COLLATE;
|
158 |
+
}
|
159 |
+
|
160 |
+
if ( defined( 'DB_CHARSET' ) ) {
|
161 |
+
$charset = DB_CHARSET;
|
162 |
+
}
|
163 |
+
|
164 |
+
$charset_collate = $this->determine_charset( $charset, $collate );
|
165 |
+
|
166 |
+
$this->charset = $charset_collate['charset'];
|
167 |
+
$this->collate = $charset_collate['collate'];
|
168 |
+
}
|
169 |
+
|
170 |
+
public function wpvivid_do_connect($allow_bail = true){
|
171 |
+
$new_link = defined( 'MYSQL_NEW_LINK' ) ? MYSQL_NEW_LINK : true;
|
172 |
+
$client_flags = defined( 'MYSQL_CLIENT_FLAGS' ) ? MYSQL_CLIENT_FLAGS : 0;
|
173 |
+
|
174 |
+
$error_code = '';
|
175 |
+
$error = 'Unknown Error.';
|
176 |
+
|
177 |
+
if ( $this->use_mysqli ) {
|
178 |
+
$this->dbh = mysqli_init();
|
179 |
+
|
180 |
+
$host = $this->dbhost;
|
181 |
+
$port = null;
|
182 |
+
$socket = null;
|
183 |
+
$is_ipv6 = false;
|
184 |
+
|
185 |
+
if ( $host_data = $this->wpvivid_parse_db_host( $this->dbhost ) ) {
|
186 |
+
list( $host, $port, $socket, $is_ipv6 ) = $host_data;
|
187 |
+
}
|
188 |
+
|
189 |
+
if ( $is_ipv6 && extension_loaded( 'mysqlnd' ) ) {
|
190 |
+
$host = "[$host]";
|
191 |
+
}
|
192 |
+
|
193 |
+
@mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpass, null, $port, $socket, $client_flags );
|
194 |
+
|
195 |
+
if ( $this->dbh->connect_errno ) {
|
196 |
+
$error_code = $this->dbh->connect_errno;
|
197 |
+
$error = $this->dbh->connect_error;
|
198 |
+
$this->dbh = null;
|
199 |
+
$attempt_fallback = true;
|
200 |
+
|
201 |
+
if ( $this->has_connected ) {
|
202 |
+
$attempt_fallback = false;
|
203 |
+
} elseif ( defined( 'WP_USE_EXT_MYSQL' ) && ! WP_USE_EXT_MYSQL ) {
|
204 |
+
$attempt_fallback = false;
|
205 |
+
} elseif ( ! function_exists( 'mysql_connect' ) ) {
|
206 |
+
$attempt_fallback = false;
|
207 |
+
}
|
208 |
+
|
209 |
+
if ( $attempt_fallback ) {
|
210 |
+
$this->use_mysqli = false;
|
211 |
+
return $this->wpvivid_do_connect( $allow_bail );
|
212 |
+
}
|
213 |
+
}
|
214 |
+
}
|
215 |
+
else{
|
216 |
+
$this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpass, $new_link, $client_flags );
|
217 |
+
}
|
218 |
+
|
219 |
+
if($this->dbh){
|
220 |
+
$this->has_connected = true;
|
221 |
+
$ret['result'] = WPVIVID_SUCCESS;
|
222 |
+
}
|
223 |
+
else{
|
224 |
+
$ret['result'] = WPVIVID_FAILED;
|
225 |
+
$ret['error'] = $error_code.': '.$error;
|
226 |
+
}
|
227 |
+
|
228 |
+
return $ret;
|
229 |
+
}
|
230 |
+
|
231 |
+
public function wpvivid_show_additional_databases(){
|
232 |
+
$query = 'SHOW DATABASES;';
|
233 |
+
$result = '';
|
234 |
+
if ( ! empty( $this->dbh ) && $this->use_mysqli ) {
|
235 |
+
$result = mysqli_query( $this->dbh, $query );
|
236 |
+
} elseif ( ! empty( $this->dbh ) ) {
|
237 |
+
$result = mysql_query( $query, $this->dbh );
|
238 |
+
}
|
239 |
+
if ( $this->use_mysqli && $result instanceof mysqli_result ) {
|
240 |
+
while ( $row = mysqli_fetch_object( $result ) ) {
|
241 |
+
$database_array[] = $row;
|
242 |
+
}
|
243 |
+
} elseif ( is_resource( $result ) ) {
|
244 |
+
while ( $row = mysql_fetch_object( $result ) ) {
|
245 |
+
$database_array[] = $row;
|
246 |
+
}
|
247 |
+
}
|
248 |
+
if(!empty($database_array)){
|
249 |
+
foreach ($database_array as $key => $value){
|
250 |
+
$last_result[] = $value->Database;
|
251 |
+
}
|
252 |
+
}
|
253 |
+
return $last_result;
|
254 |
+
}
|
255 |
+
}
|
trunk/includes/class-wpvivid-backup-database.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!defined('WPVIVID_PLUGIN_DIR')){
|
4 |
+
die;
|
5 |
+
}
|
6 |
+
define('NECESSARY','1');
|
7 |
+
define('OPTION','0');
|
8 |
+
class WPvivid_Backup_Database
|
9 |
+
{
|
10 |
+
private $task_id;
|
11 |
+
|
12 |
+
public function __construct()
|
13 |
+
{
|
14 |
+
}
|
15 |
+
|
16 |
+
public function wpvivid_archieve_database_info($databases, $data)
|
17 |
+
{
|
18 |
+
if(isset($data['dump_db']))
|
19 |
+
{
|
20 |
+
$sql_info['file_name'] =$data['sql_file_name'];
|
21 |
+
$sql_info['database'] = DB_NAME;
|
22 |
+
$sql_info['host'] = DB_HOST;
|
23 |
+
$sql_info['user'] = DB_USER;
|
24 |
+
$sql_info['pass'] = DB_PASSWORD;
|
25 |
+
$databases[] = $sql_info;
|
26 |
+
}
|
27 |
+
return $databases;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function backup_database($data,$task_id = '')
|
31 |
+
{
|
32 |
+
global $wpvivid_plugin;
|
33 |
+
$dump=null;
|
34 |
+
|
35 |
+
try
|
36 |
+
{
|
37 |
+
$this->task_id=$task_id;
|
38 |
+
|
39 |
+
//$backup_file =$data['sql_file_name'];
|
40 |
+
|
41 |
+
require_once 'class-wpvivid-mysqldump-method.php';
|
42 |
+
require_once 'class-wpvivid-mysqldump.php';
|
43 |
+
|
44 |
+
$db_method=new WPvivid_DB_Method();
|
45 |
+
$version =$db_method->get_mysql_version();
|
46 |
+
|
47 |
+
if(version_compare('4.1.0',$version) > 0)
|
48 |
+
{
|
49 |
+
return array('result'=>WPVIVID_FAILED,'error'=>'Your MySQL version is too old. Please upgrade at least to MySQL 4.1.0.');
|
50 |
+
}
|
51 |
+
|
52 |
+
if(version_compare('5.3.0',phpversion()) > 0){
|
53 |
+
return array('result'=>WPVIVID_FAILED,'error'=>'Your PHP version is too old. Please upgrade at least to PHP 5.3.0.');
|
54 |
+
}
|
55 |
+
|
56 |
+
$db_method->check_max_allowed_packet();
|
57 |
+
add_filter('wpvivid_exclude_db_table', array($this, 'exclude_table'),10,2);
|
58 |
+
$exclude=array();
|
59 |
+
$exclude = apply_filters('wpvivid_exclude_db_table',$exclude, $data);
|
60 |
+
$include=array();
|
61 |
+
$include = apply_filters('wpvivid_include_db_table',$include, $data);
|
62 |
+
|
63 |
+
$site_url = apply_filters('wpvivid_dump_set_site_url',get_site_url(), $data);
|
64 |
+
$home_url = apply_filters('wpvivid_dump_set_home_url',get_home_url(), $data);
|
65 |
+
$content_url=apply_filters('wpvivid_dump_set_content_url',content_url(), $data);
|
66 |
+
|
67 |
+
global $wpdb;
|
68 |
+
if (is_multisite() && !defined('MULTISITE'))
|
69 |
+
{
|
70 |
+
$prefix = $wpdb->base_prefix;
|
71 |
+
} else {
|
72 |
+
$prefix = $wpdb->get_blog_prefix(0);
|
73 |
+
}
|
74 |
+
$prefix=apply_filters('wpvivid_dump_set_prefix',$prefix, $data);
|
75 |
+
|
76 |
+
add_filter('wpvivid_archieve_database_info', array($this, 'wpvivid_archieve_database_info'), 10, 2);
|
77 |
+
$databases=array();
|
78 |
+
$databases = apply_filters('wpvivid_archieve_database_info', $databases, $data);
|
79 |
+
$is_additional_db = false;
|
80 |
+
if($data['key'] === 'backup_additional_db')
|
81 |
+
{
|
82 |
+
$is_additional_db = true;
|
83 |
+
}
|
84 |
+
|
85 |
+
$backup_files = array();
|
86 |
+
foreach ($databases as $sql_info)
|
87 |
+
{
|
88 |
+
$database_name = $sql_info['database'];
|
89 |
+
$backup_file = $sql_info['file_name'];
|
90 |
+
$backup_files[] = $backup_file;
|
91 |
+
$host = $sql_info['host'];
|
92 |
+
$user = $sql_info['user'];
|
93 |
+
$pass = $sql_info['pass'];
|
94 |
+
|
95 |
+
$dumpSettings=array();
|
96 |
+
$dumpSettings['exclude-tables']=$exclude;
|
97 |
+
$dumpSettings['include-tables']=$include;
|
98 |
+
$dumpSettings['add-drop-table']=true;
|
99 |
+
$dumpSettings['extended-insert']=false;
|
100 |
+
|
101 |
+
$dumpSettings['site_url']=$site_url;
|
102 |
+
$dumpSettings['home_url']=$home_url;
|
103 |
+
$dumpSettings['content_url']=$content_url;
|
104 |
+
$dumpSettings['prefix']=$prefix;
|
105 |
+
|
106 |
+
$dump = new WPvivid_Mysqldump($host, $database_name, $user, $pass, $is_additional_db, $dumpSettings);
|
107 |
+
|
108 |
+
if (file_exists($backup_file))
|
109 |
+
@unlink($backup_file);
|
110 |
+
|
111 |
+
$dump->task_id=$task_id;
|
112 |
+
$dump->start($backup_file);
|
113 |
+
}
|
114 |
+
|
115 |
+
unset($pdo);
|
116 |
+
}
|
117 |
+
catch (Exception $e)
|
118 |
+
{
|
119 |
+
$str_last_query_string='';
|
120 |
+
if(!is_null($dump))
|
121 |
+
{
|
122 |
+
$str_last_query_string=$dump->last_query_string;
|
123 |
+
}
|
124 |
+
if(!empty($str_last_query_string))
|
125 |
+
{
|
126 |
+
$wpvivid_plugin->wpvivid_log->WriteLog('last query string:'.$str_last_query_string,'error');
|
127 |
+
}
|
128 |
+
$message = 'A exception ('.get_class($e).') occurred '.$e->getMessage().' (Code: '.$e->getCode().', line '.$e->getLine().' in '.$e->getFile().')';
|
129 |
+
return array('result'=>WPVIVID_FAILED,'error'=>$message);
|
130 |
+
}
|
131 |
+
|
132 |
+
$files = array();
|
133 |
+
$files = $backup_files;
|
134 |
+
return array('result'=>WPVIVID_SUCCESS,'files'=>$files);
|
135 |
+
}
|
136 |
+
|
137 |
+
public function exclude_table($exclude,$data)
|
138 |
+
{
|
139 |
+
global $wpdb;
|
140 |
+
if (is_multisite() && !defined('MULTISITE'))
|
141 |
+
{
|
142 |
+
$prefix = $wpdb->base_prefix;
|
143 |
+
} else {
|
144 |
+
$prefix = $wpdb->get_blog_prefix(0);
|
145 |
+
}
|
146 |
+
$exclude = array('/^(?!' . $prefix . ')/i');
|
147 |
+
return $exclude;
|
148 |
+
}
|
149 |
+
}
|
trunk/includes/class-wpvivid-backup-site.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!defined('WPVIVID_PLUGIN_DIR')){
|
4 |
+
die;
|
5 |
+
}
|
6 |
+
require_once WPVIVID_PLUGIN_DIR . '/includes/class-wpvivid-zipclass.php';
|
7 |
+
class WPvivid_Backup_Site
|
8 |
+
{
|
9 |
+
private $tools_collection=array();
|
10 |
+
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
add_filter('wpvivid_tools_register', array($this, 'init_tools'),10);
|
14 |
+
$this->tools_collection=apply_filters('wpvivid_tools_register',$this->tools_collection);
|
15 |
+
$this->load_hooks();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function init_tools($tools_collection){
|
19 |
+
$tools_collection['zip'][WPVIVID_COMPRESS_ZIPCLASS] = 'WPvivid_ZipClass';
|
20 |
+
return $tools_collection;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function get_tools($type){
|
24 |
+
if(array_key_exists($type,$this->tools_collection))
|
25 |
+
{
|
26 |
+
foreach ($this -> tools_collection[$type] as $class_name){
|
27 |
+
if(class_exists($class_name)){
|
28 |
+
$object = new $class_name();
|
29 |
+
$last_error = $object -> getLastError();
|
30 |
+
if(empty($last_error))
|
31 |
+
return $object;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
$class_name = $this -> tools_collection['zip'][WPVIVID_COMPRESS_ZIPCLASS];
|
36 |
+
$object = new $class_name();
|
37 |
+
$last_error = $object -> getLastError();
|
38 |
+
if(empty($last_error)){
|
39 |
+
return $object;
|
40 |
+
}else{
|
41 |
+
return array('result' => WPVIVID_FAILED,'error' => $last_error);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
public function load_hooks(){
|
46 |
+
foreach ($this -> tools_collection as $compressType){
|
47 |
+
foreach ($compressType as $className){
|
48 |
+
$object = new $className();
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
trunk/includes/class-wpvivid-backup-uploader.php
ADDED
@@ -0,0 +1,792 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!defined('WPVIVID_PLUGIN_DIR'))
|
4 |
+
{
|
5 |
+
die;
|
6 |
+
}
|
7 |
+
|
8 |
+
class Wpvivid_BackupUploader
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
add_action('wp_ajax_wpvivid_get_file_id',array($this,'get_file_id'));
|
13 |
+
add_action('wp_ajax_wpvivid_upload_files',array($this,'upload_files'));
|
14 |
+
add_action('wp_ajax_wpvivid_upload_files_finish',array($this,'upload_files_finish'));
|
15 |
+
|
16 |
+
add_action('wp_ajax_wpvivid_rescan_local_folder',array($this,'rescan_local_folder_set_backup'));
|
17 |
+
add_action('wp_ajax_wpvivid_get_backup_count',array($this,'get_backup_count'));
|
18 |
+
add_action('wpvivid_rebuild_backup_list', array($this, 'wpvivid_rebuild_backup_list'), 10);
|
19 |
+
}
|
20 |
+
|
21 |
+
function get_file_id()
|
22 |
+
{
|
23 |
+
global $wpvivid_plugin;
|
24 |
+
$wpvivid_plugin->ajax_check_security();
|
25 |
+
if(isset($_POST['file_name']))
|
26 |
+
{
|
27 |
+
if(preg_match('/wpvivid-.*_.*_.*\.zip$/',$_POST['file_name']))
|
28 |
+
{
|
29 |
+
if(preg_match('/wpvivid-(.*?)_/',$_POST['file_name'],$matches))
|
30 |
+
{
|
31 |
+
$id= $matches[0];
|
32 |
+
$id=substr($id,0,strlen($id)-1);
|
33 |
+
if(WPvivid_Backuplist::get_backup_by_id($id)===false)
|
34 |
+
{
|
35 |
+
$ret['result']=WPVIVID_SUCCESS;
|
36 |
+
$ret['id']=$id;
|
37 |
+
}
|
38 |
+
else
|
39 |
+
{
|
40 |
+
$ret['result']=WPVIVID_FAILED;
|
41 |
+
$ret['error']='The uploading backup already exists in Backups list.';
|
42 |
+
}
|
43 |
+
}
|
44 |
+
else
|
45 |
+
{
|
46 |
+
$ret['result']=WPVIVID_FAILED;
|
47 |
+
$ret['error']=$_POST['file_name'] . ' is not created by WPvivid backup plugin.';
|
48 |
+
}
|
49 |
+
}
|
50 |
+
else
|
51 |
+
{
|
52 |
+
$ret['result']=WPVIVID_FAILED;
|
53 |
+
$ret['error']=$_POST['file_name'] . ' is not created by WPvivid backup plugin.';
|
54 |
+
}
|
55 |
+
}
|
56 |
+
else
|
57 |
+
{
|
58 |
+
$ret['result']=WPVIVID_FAILED;
|
59 |
+
$ret['error']='Failed to post file name.';
|
60 |
+
}
|
61 |
+
|
62 |
+
echo json_encode($ret);
|
63 |
+
die();
|
64 |
+
}
|
65 |
+
|
66 |
+
function check_file_is_a_wpvivid_backup($file_name,&$backup_id)
|
67 |
+
{
|
68 |
+
if(preg_match('/wpvivid-.*_.*_.*\.zip$/',$file_name))
|
69 |
+
{
|
70 |
+
if(preg_match('/wpvivid-(.*?)_/',$file_name,$matches))
|
71 |
+
{
|
72 |
+
$id= $matches[0];
|
73 |
+
$id=substr($id,0,strlen($id)-1);
|
74 |
+
|
75 |
+
|
76 |
+
if(WPvivid_Backuplist::get_backup_by_id($id)===false)
|
77 |
+
{
|
78 |
+
$backup_id=$id;
|
79 |
+
return true;
|
80 |
+
}
|
81 |
+
else
|
82 |
+
{
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
else
|
87 |
+
{
|
88 |
+
return false;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
else
|
92 |
+
{
|
93 |
+
return false;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
function upload_files()
|
98 |
+
{
|
99 |
+
global $wpvivid_plugin;
|
100 |
+
$wpvivid_plugin->ajax_check_security();
|
101 |
+
$options['test_form'] =true;
|
102 |
+
$options['action'] ='wpvivid_upload_files';
|
103 |
+
$options['test_type'] = false;
|
104 |
+
$options['ext'] = 'zip';
|
105 |
+
$options['type'] = 'application/zip';
|
106 |
+
|
107 |
+
add_filter('upload_dir', array($this, 'upload_dir'));
|
108 |
+
|
109 |
+
$status = wp_handle_upload($_FILES['async-upload'],$options);
|
110 |
+
|
111 |
+
remove_filter('upload_dir', array($this, 'upload_dir'));
|
112 |
+
|
113 |
+
if (isset($status['error']))
|
114 |
+
{
|
115 |
+
echo json_encode(array('result'=>WPVIVID_FAILED, 'error' => $status['error']));
|
116 |
+
exit;
|
117 |
+
}
|
118 |
+
|
119 |
+
$file_name=basename($_POST['name']);
|
120 |
+
|
121 |
+
if (isset($_POST['chunks']) && isset($_POST['chunk']))
|
122 |
+
{
|
123 |
+
$path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR;
|
124 |
+
rename($status['file'],$path.$file_name.'_'.$_POST['chunk'].'.tmp');
|
125 |
+
$status['file'] = $path.$file_name.'_'.$_POST['chunk'].'.tmp';
|
126 |
+
if($_POST['chunk'] == $_POST['chunks']-1)
|
127 |
+
{
|
128 |
+
$file_handle = fopen($path.$file_name, 'wb');
|
129 |
+
if ($file_handle)
|
130 |
+
{
|
131 |
+
for ($i=0; $i<$_POST['chunks']; $i++)
|
132 |
+
{
|
133 |
+
$chunks_handle=fopen($path.$file_name.'_'.$i.'.tmp','rb');
|
134 |
+
if($chunks_handle)
|
135 |
+
{
|
136 |
+
while ($line = fread($chunks_handle, 1048576*2))
|
137 |
+
{
|
138 |
+
fwrite($file_handle, $line);
|
139 |
+
}
|
140 |
+
fclose($chunks_handle);
|
141 |
+
@unlink($path.$file_name.'_'.$i.'.tmp');
|
142 |
+
}
|
143 |
+
}
|
144 |
+
fclose($file_handle);
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
+
echo json_encode(array('result'=>WPVIVID_SUCCESS));
|
149 |
+
die();
|
150 |
+
}
|
151 |
+
|
152 |
+
function upload_files_finish()
|
153 |
+
{
|
154 |
+
global $wpvivid_plugin;
|
155 |
+
$wpvivid_plugin->ajax_check_security();
|
156 |
+
|
157 |
+
$ret['html']=false;
|
158 |
+
if(isset($_POST['files']))
|
159 |
+
{
|
160 |
+
$files =stripslashes($_POST['files']);
|
161 |
+
$files =json_decode($files,true);
|
162 |
+
if(is_null($files))
|
163 |
+
{
|
164 |
+
die();
|
165 |
+
}
|
166 |
+
|
167 |
+
$path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR;
|
168 |
+
|
169 |
+
$backup_data['result']='success';
|
170 |
+
$backup_data['files']=array();
|
171 |
+
if(preg_match('/wpvivid-.*_.*_.*\.zip$/',$files[0]['name']))
|
172 |
+
{
|
173 |
+
if(preg_match('/wpvivid-(.*?)_/',$files[0]['name'],$matches_id))
|
174 |
+
{
|
175 |
+
if(preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}/',$files[0]['name'],$matches))
|
176 |
+
{
|
177 |
+
$backup_time=$matches[0];
|
178 |
+
$time_array=explode('-',$backup_time);
|
179 |
+
if(sizeof($time_array)>4)
|
180 |
+
$time=$time_array[0].'-'.$time_array[1].'-'.$time_array[2].' '.$time_array[3].':'.$time_array[4];
|
181 |
+
else
|
182 |
+
$time=$backup_time;
|
183 |
+
$time=strtotime($time);
|
184 |
+
}
|
185 |
+
else
|
186 |
+
{
|
187 |
+
$time=time();
|
188 |
+
}
|
189 |
+
$id= $matches_id[0];
|
190 |
+
$id=substr($id,0,strlen($id)-1);
|
191 |
+
$unlinked_file = '';
|
192 |
+
$check_result=true;
|
193 |
+
foreach ($files as $file)
|
194 |
+
{
|
195 |
+
$res=$this->check_is_a_wpvivid_backup($path.$file['name']);
|
196 |
+
if($res === true)
|
197 |
+
{
|
198 |
+
$add_file['file_name']=$file['name'];
|
199 |
+
$add_file['size']=filesize($path.$file['name']);
|
200 |
+
$backup_data['files'][]=$add_file;
|
201 |
+
}
|
202 |
+
else
|
203 |
+
{
|
204 |
+
$check_result=false;
|
205 |
+
$unlinked_file .= 'file name: '.$file['name'].', error: '.$res;
|
206 |
+
}
|
207 |
+
}
|
208 |
+
if($check_result === true){
|
209 |
+
WPvivid_Backuplist::add_new_upload_backup($id,$backup_data,$time,'');
|
210 |
+
$html = '';
|
211 |
+
$html = apply_filters('wpvivid_add_backup_list', $html);
|
212 |
+
$ret['result']=WPVIVID_SUCCESS;
|
213 |
+
$ret['html'] = $html;
|
214 |
+
}
|
215 |
+
else{
|
216 |
+
foreach ($files as $file) {
|
217 |
+
$this->clean_tmp_files($path, $file['name']);
|
218 |
+
@unlink($path . $file['name']);
|
219 |
+
}
|
220 |
+
$ret['result']=WPVIVID_FAILED;
|
221 |
+
$ret['error']='Upload file failed.';
|
222 |
+
$ret['unlinked']=$unlinked_file;
|
223 |
+
}
|
224 |
+
}
|
225 |
+
else
|
226 |
+
{
|
227 |
+
$ret['result']=WPVIVID_FAILED;
|
228 |
+
$ret['error']='The backup is not created by WPvivid backup plugin.';
|
229 |
+
}
|
230 |
+
}
|
231 |
+
else
|
232 |
+
{
|
233 |
+
$ret['result']=WPVIVID_FAILED;
|
234 |
+
$ret['error']='The backup is not created by WPvivid backup plugin.';
|
235 |
+
}
|
236 |
+
}
|
237 |
+
else{
|
238 |
+
$ret['result']=WPVIVID_FAILED;
|
239 |
+
$ret['error']='Failed to post file name.';
|
240 |
+
}
|
241 |
+
echo json_encode($ret);
|
242 |
+
die();
|
243 |
+
}
|
244 |
+
|
245 |
+
function clean_tmp_files($path, $filename){
|
246 |
+
$handler=opendir($path);
|
247 |
+
if($handler===false)
|
248 |
+
return;
|
249 |
+
while(($file=readdir($handler))!==false) {
|
250 |
+
if (!is_dir($path.$file) && preg_match('/wpvivid-.*_.*_.*\.tmp$/', $file)) {
|
251 |
+
$iPos = strrpos($file, '_');
|
252 |
+
$file_temp = substr($file, 0, $iPos);
|
253 |
+
if($file_temp === $filename) {
|
254 |
+
@unlink($path.$file);
|
255 |
+
}
|
256 |
+
}
|
257 |
+
}
|
258 |
+
@closedir($handler);
|
259 |
+
}
|
260 |
+
|
261 |
+
function wpvivid_check_remove_update_backup($path){
|
262 |
+
$backup_list = WPvivid_Setting::get_option('wpvivid_backup_list');
|
263 |
+
$remove_backup_array = array();
|
264 |
+
$update_backup_array = array();
|
265 |
+
$tmp_file_array = array();
|
266 |
+
$remote_backup_list=WPvivid_Backuplist::get_has_remote_backuplist();
|
267 |
+
foreach ($backup_list as $key => $value){
|
268 |
+
if(!in_array($key, $remote_backup_list)) {
|
269 |
+
$need_remove = true;
|
270 |
+
$need_update = false;
|
271 |
+
if (is_dir($path)) {
|
272 |
+
$handler = opendir($path);
|
273 |
+
if($handler===false)
|
274 |
+
return true;
|
275 |
+
while (($filename = readdir($handler)) !== false) {
|
276 |
+
if ($filename != "." && $filename != "..") {
|
277 |
+
if (!is_dir($path . $filename)) {
|
278 |
+
if ($this->check_wpvivid_file_info($filename, $backup_id, $need_update)) {
|
279 |
+
if ($key === $backup_id) {
|
280 |
+
$need_remove = false;
|
281 |
+
}
|
282 |
+
if ($need_update) {
|
283 |
+
if ($this->check_is_a_wpvivid_backup($path . $filename) === true) {
|
284 |
+
if (!in_array($filename, $tmp_file_array)) {
|
285 |
+
$add_file['file_name'] = $filename;
|
286 |
+
$add_file['size'] = filesize($path . $filename);
|
287 |
+
$tmp_file_array[] = $filename;
|
288 |
+
$update_backup_array[$backup_id]['files'][] = $add_file;
|
289 |
+
}
|
290 |
+
}
|
291 |
+
}
|
292 |
+
}
|
293 |
+
}
|
294 |
+
}
|
295 |
+
}
|
296 |
+
if ($handler) {
|
297 |
+
@closedir($handler);
|
298 |
+
}
|
299 |
+
}
|
300 |
+
if ($need_remove) {
|
301 |
+
$remove_backup_array[] = $key;
|
302 |
+
}
|
303 |
+
}
|
304 |
+
}
|
305 |
+
$this->wpvivid_remove_update_local_backup_list($remove_backup_array, $update_backup_array);
|
306 |
+
return true;
|
307 |
+
}
|
308 |
+
|
309 |
+
function check_wpvivid_file_info($file_name, &$backup_id, &$need_update=false){
|
310 |
+
if(preg_match('/wpvivid-.*_.*_.*\.zip$/',$file_name))
|
311 |
+
{
|
312 |
+
if(preg_match('/wpvivid-(.*?)_/',$file_name,$matches))
|
313 |
+
{
|
314 |
+
$id= $matches[0];
|
315 |
+
$id=substr($id,0,strlen($id)-1);
|
316 |
+
$backup_id=$id;
|
317 |
+
|
318 |
+
if(WPvivid_Backuplist::get_backup_by_id($id)===false)
|
319 |
+
{
|
320 |
+
$need_update = false;
|
321 |
+
return true;
|
322 |
+
}
|
323 |
+
else
|
324 |
+
{
|
325 |
+
$need_update = true;
|
326 |
+
return true;
|
327 |
+
}
|
328 |
+
}
|
329 |
+
else
|
330 |
+
{
|
331 |
+
return false;
|
332 |
+
}
|
333 |
+
}
|
334 |
+
else
|
335 |
+
{
|
336 |
+
return false;
|
337 |
+
}
|
338 |
+
}
|
339 |
+
|
340 |
+
function wpvivid_remove_update_local_backup_list($remove_backup_array, $update_backup_array){
|
341 |
+
$backup_list = WPvivid_Setting::get_option('wpvivid_backup_list');
|
342 |
+
foreach ($remove_backup_array as $remove_backup_id){
|
343 |
+
unset($backup_list[$remove_backup_id]);
|
344 |
+
}
|
345 |
+
foreach ($update_backup_array as $update_backup_id => $data){
|
346 |
+
$backup_list[$update_backup_id]['backup']['files'] = $data['files'];
|
347 |
+
}
|
348 |
+
WPvivid_Setting::update_option('wpvivid_backup_list', $backup_list);
|
349 |
+
}
|
350 |
+
|
351 |
+
function _rescan_local_folder_set_backup(){
|
352 |
+
$path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir().DIRECTORY_SEPARATOR;
|
353 |
+
|
354 |
+
$this->wpvivid_check_remove_update_backup($path);
|
355 |
+
|
356 |
+
$backups=array();
|
357 |
+
$count = 0;
|
358 |
+
if(is_dir($path))
|
359 |
+
{
|
360 |
+
$handler = opendir($path);
|
361 |
+
if($handler!==false)
|
362 |
+
{
|
363 |
+
while (($filename = readdir($handler)) !== false)
|
364 |
+
{
|
365 |
+
if ($filename != "." && $filename != "..")
|
366 |
+
{
|
367 |
+
$count++;
|
368 |
+
|
369 |
+
if (is_dir($path . $filename))
|
370 |
+
{
|
371 |
+
continue;
|
372 |
+
} else {
|
373 |
+
if($this->check_file_is_a_wpvivid_backup($filename,$backup_id))
|
374 |
+
{
|
375 |
+
if($this->zip_check_sum($path . $filename))
|
376 |
+
{
|
377 |
+
if($this->check_is_a_wpvivid_backup($path.$filename) === true)
|
378 |
+
$backups[$backup_id]['files'][]=$filename;
|
379 |
+
}
|
380 |
+
}
|
381 |
+
}
|
382 |
+
}
|
383 |
+
}
|
384 |
+
if($handler)
|
385 |
+
@closedir($handler);
|
386 |
+
}
|
387 |
+
}
|
388 |
+
else{
|
389 |
+
$ret['result']=WPVIVID_FAILED;
|
390 |
+
$ret['error']='Failed to get local storage directory.';
|
391 |
+
}
|
392 |
+
if(!empty($backups))
|
393 |
+
{
|
394 |
+
foreach ($backups as $backup_id =>$backup)
|
395 |
+
{
|
396 |
+
$backup_data['result']='success';
|
397 |
+
$backup_data['files']=array();
|
398 |
+
if(empty($backup['files']))
|
399 |
+
continue;
|
400 |
+
$time=false;
|
401 |
+
foreach ($backup['files'] as $file)
|
402 |
+
{
|
403 |
+
if($time===false)
|
404 |
+
{
|
405 |
+
if(preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}/',$file,$matches))
|
406 |
+
{
|
407 |
+
$backup_time=$matches[0];
|
408 |
+
$time_array=explode('-',$backup_time);
|
409 |
+
if(sizeof($time_array)>4)
|
410 |
+
$time=$time_array[0].'-'.$time_array[1].'-'.$time_array[2].' '.$time_array[3].':'.$time_array[4];
|
411 |
+
else
|
412 |
+
$time=$backup_time;
|
413 |
+
$time=strtotime($time);
|
414 |
+
}
|
415 |
+
else
|
416 |
+
{
|
417 |
+
$time=time();
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
$add_file['file_name']=$file;
|
422 |
+
$add_file['size']=filesize($path.$file);
|
423 |
+
$backup_data['files'][]=$add_file;
|
424 |
+
}
|
425 |
+
|
426 |
+
WPvivid_Backuplist::add_new_upload_backup($backup_id,$backup_data,$time,'');
|
427 |
+
}
|
428 |
+
}
|
429 |
+
$ret['result']=WPVIVID_SUCCESS;
|
430 |
+
$html = '';
|
431 |
+
$tour = true;
|
432 |
+
$html = apply_filters('wpvivid_add_backup_list', $html, 'wpvivid_backup_list', $tour);
|
433 |
+
$ret['html'] = $html;
|
434 |
+
return $ret;
|
435 |
+
}
|
436 |
+
|
437 |
+
function rescan_local_folder_set_backup()
|
438 |
+
{
|
439 |
+
global $wpvivid_plugin;
|
440 |
+
$wpvivid_plugin->ajax_check_security();
|
441 |
+
|
442 |
+
$ret = $this->_rescan_local_folder_set_backup();
|
443 |
+
echo json_encode($ret);
|
444 |
+
die();
|
445 |
+
}
|
446 |
+
|
447 |
+
public function wpvivid_rebuild_backup_list(){
|
448 |
+
$this->_rescan_local_folder_set_backup();
|
449 |
+
}
|
450 |
+
|
451 |
+
static function rescan_local_folder()
|
452 |
+
{
|
453 |
+
$backupdir=WPvivid_Setting::get_backupdir();
|
454 |
+
?>
|
455 |
+
<div style="padding-top: 10px;">
|
456 |
+
<span><?php _e('Tips: Click the button below to scan all uploaded or received backups in directory', 'wpvivid-backuprestore'); ?> <?php echo WP_CONTENT_DIR.'/'.$backupdir; ?></span>
|
457 |
+
</div>
|
458 |
+
<div style="padding-top: 10px;">
|
459 |
+
<input type="submit" class="button-primary" value="<?php esc_attr_e('Scan uploaded backup or received backup', 'wpvivid-backuprestore'); ?>" onclick="wpvivid_rescan_local_folder();" />
|
460 |
+
</div>
|
461 |
+
<script type="text/javascript">
|
462 |
+
function wpvivid_rescan_local_folder()
|
463 |
+
{
|
464 |
+
var ajax_data = {
|
465 |
+
'action': 'wpvivid_rescan_local_folder'
|
466 |
+
};
|
467 |
+
wpvivid_post_request(ajax_data, function (data)
|
468 |
+
{
|
469 |
+
try {
|
470 |
+
var jsonarray = jQuery.parseJSON(data);
|
471 |
+
if(jsonarray.html !== false){
|
472 |
+
jQuery('#wpvivid_backup_list').html('');
|
473 |
+
jQuery('#wpvivid_backup_list').append(jsonarray.html);
|
474 |
+
wpvivid_popup_tour('show');
|
475 |
+
}
|
476 |
+
}
|
477 |
+
catch(err) {
|
478 |
+
alert(err);
|
479 |
+
}
|
480 |
+
}, function (XMLHttpRequest, textStatus, errorThrown)
|
481 |
+
{
|
482 |
+
var error_message = wpvivid_output_ajaxerror('scanning backup list', textStatus, errorThrown);
|
483 |
+
alert(error_message);
|
484 |
+
});
|
485 |
+
}
|
486 |
+
</script>
|
487 |
+
<?php
|
488 |
+
}
|
489 |
+
|
490 |
+
function get_backup_count()
|
491 |
+
{
|
492 |
+
global $wpvivid_plugin;
|
493 |
+
$wpvivid_plugin->ajax_check_security();
|
494 |
+
|
495 |
+
$backuplist=WPvivid_Backuplist::get_backuplist();
|
496 |
+
echo sizeof($backuplist);
|
497 |
+
die();
|
498 |
+
}
|
499 |
+
|
500 |
+
static function upload_meta_box()
|
501 |
+
{
|
502 |
+
?>
|
503 |
+
<div id="wpvivid_plupload-upload-ui" class="hide-if-no-js">
|
504 |
+
<div id="drag-drop-area">
|
505 |
+
<div class="drag-drop-inside">
|
506 |
+
<p class="drag-drop-info"><?php _e('Drop files here', 'wpvivid-backuprestore'); ?></p>
|
507 |
+
<p><?php _ex('or', 'Uploader: Drop files here - or - Select Files'); ?></p>
|
508 |
+
<p class="drag-drop-buttons"><input id="wpvivid_select_file_button" type="button" value="<?php esc_attr_e('Select Files', 'wpvivid-backuprestore'); ?>" class="button" /></p>
|
509 |
+
</div>
|
510 |
+
</div>
|
511 |
+
</div>
|
512 |
+
<div id="wpvivid_upload_file_list" class="hide-if-no-js" style="padding-top: 10px; padding-bottom: 10px;"></div>
|
513 |
+
<input type="submit" class="button-primary" id="wpvivid_upload_submit_btn" value="Upload" onclick="wpvivid_submit_upload();" />
|
514 |
+
<?php
|
515 |
+
$chunk_size = min(wp_max_upload_size()-1024, 1048576*2);
|
516 |
+
$plupload_init = array(
|
517 |
+
'runtimes' => 'html5,silverlight,flash,html4',
|
518 |
+
'browse_button' => 'wpvivid_select_file_button',
|
519 |
+
'container' => 'wpvivid_plupload-upload-ui',
|
520 |
+
'drop_element' => 'drag-drop-area',
|
521 |
+
'file_data_name' => 'async-upload',
|
522 |
+
'max_retries' => 3,
|
523 |
+
'multiple_queues' => true,
|
524 |
+
'max_file_size' => '10Gb',
|
525 |
+
'chunk_size' => $chunk_size.'b',
|
526 |
+
'url' => admin_url('admin-ajax.php'),
|
527 |
+
'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
|
528 |
+
'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
|
529 |
+
'multipart' => true,
|
530 |
+
'urlstream_upload' => true,
|
531 |
+
// additional post data to send to our ajax hook
|
532 |
+
'multipart_params' => array(
|
533 |
+
'_ajax_nonce' => wp_create_nonce('wpvivid_ajax'),
|
534 |
+
'action' => 'wpvivid_upload_files', // the ajax action name
|
535 |
+
),
|
536 |
+
);
|
537 |
+
|
538 |
+
if (is_file(ABSPATH.WPINC.'/js/plupload/Moxie.swf')) {
|
539 |
+
$plupload_init['flash_swf_url'] = includes_url('js/plupload/Moxie.swf');
|
540 |
+
} else {
|
541 |
+
$plupload_init['flash_swf_url'] = includes_url('js/plupload/plupload.flash.swf');
|
542 |
+
}
|
543 |
+
|
544 |
+
if (is_file(ABSPATH.WPINC.'/js/plupload/Moxie.xap')) {
|
545 |
+
$plupload_init['silverlight_xap_url'] = includes_url('js/plupload/Moxie.xap');
|
546 |
+
} else {
|
547 |
+
$plupload_init['silverlight_xap_url'] = includes_url('js/plupload/plupload.silverlight.swf');
|
548 |
+
}
|
549 |
+
|
550 |
+
// we should probably not apply this filter, plugins may expect wp's media uploader...
|
551 |
+
$plupload_init = apply_filters('plupload_init', $plupload_init);
|
552 |
+
$upload_file_image = includes_url( '/images/media/archive.png' );
|
553 |
+
?>
|
554 |
+
|
555 |
+
|
556 |
+
<script type="text/javascript">
|
557 |
+
|
558 |
+
var uploader;
|
559 |
+
jQuery(document).ready(function($)
|
560 |
+
{
|
561 |
+
// create the uploader and pass the config from above
|
562 |
+
jQuery('#wpvivid_upload_submit_btn').hide();
|
563 |
+
uploader = new plupload.Uploader(<?php echo json_encode($plupload_init); ?>);
|
564 |
+
|
565 |
+
// checks if browser supports drag and drop upload, makes some css adjustments if necessary
|
566 |
+
uploader.bind('Init', function(up)
|
567 |
+
{
|
568 |
+
var uploaddiv = $('#wpvivid_plupload-upload-ui');
|
569 |
+
|
570 |
+
if(up.features.dragdrop){
|
571 |
+
uploaddiv.addClass('drag-drop');
|
572 |
+
$('#drag-drop-area')
|
573 |
+
.bind('dragover.wp-uploader', function(){ uploaddiv.addClass('drag-over'); })
|
574 |
+
.bind('dragleave.wp-uploader, drop.wp-uploader', function(){ uploaddiv.removeClass('drag-over'); });
|
575 |
+
|
576 |
+
}else{
|
577 |
+
uploaddiv.removeClass('drag-drop');
|
578 |
+
$('#drag-drop-area').unbind('.wp-uploader');
|
579 |
+
}
|
580 |
+
});
|
581 |
+
uploader.init();
|
582 |
+
// a file was added in the queue
|
583 |
+
var wpvivid_upload_id='';
|
584 |
+
|
585 |
+
function wpvivid_check_plupload_added_files(up,files)
|
586 |
+
{
|
587 |
+
if(wpvivid_upload_id==='')
|
588 |
+
{
|
589 |
+
var file=files[0];
|
590 |
+
|
591 |
+
var ajax_data = {
|
592 |
+
'action': 'wpvivid_get_file_id',
|
593 |
+
'file_name':file.name
|
594 |
+
};
|
595 |
+
wpvivid_post_request(ajax_data, function (data)
|
596 |
+
{
|
597 |
+
var jsonarray = jQuery.parseJSON(data);
|
598 |
+
if (jsonarray.result === "success")
|
599 |
+
{
|
600 |
+
wpvivid_upload_id=jsonarray.id;
|
601 |
+
wpvivid_check_plupload_added_files(up,files);
|
602 |
+
}
|
603 |
+
else if(jsonarray.result === "failed") {
|
604 |
+
uploader.removeFile(file);
|
605 |
+
alert(jsonarray.error);
|
606 |
+
}
|
607 |
+
}, function (XMLHttpRequest, textStatus, errorThrown)
|
608 |
+
{
|
609 |
+
var error_message = wpvivid_output_ajaxerror('uploading backups', textStatus, errorThrown);
|
610 |
+
uploader.removeFile(file);
|
611 |
+
alert(error_message);
|
612 |
+
});
|
613 |
+
}
|
614 |
+
else
|
615 |
+
{
|
616 |
+
var repeat_files = '';
|
617 |
+
plupload.each(files, function(file)
|
618 |
+
{
|
619 |
+
var brepeat=false;
|
620 |
+
var file_list = jQuery('#wpvivid_upload_file_list span');
|
621 |
+
file_list.each(function (index, value) {
|
622 |
+
if (value.innerHTML === file.name) {
|
623 |
+
brepeat=true;
|
624 |
+
}
|
625 |
+
});
|
626 |
+
if(!brepeat) {
|
627 |
+
var wpvivid_file_regex = new RegExp(wpvivid_upload_id + '_.*_.*\\.zip$');
|
628 |
+
if (wpvivid_file_regex.test(file.name)) {
|
629 |
+
jQuery('#wpvivid_upload_file_list').append(
|
630 |
+
'<div id="' + file.id + '" style="width: 100%; height: 36px; background: #fff; margin-bottom: 1px;">' +
|
631 |
+
'<img src=" <?php echo $upload_file_image; ?> " alt="" style="float: left; margin: 2px 10px 0 3px; max-width: 40px; max-height: 32px;">' +
|
632 |
+
'<div style="line-height: 36px; float: left; margin-left: 5px;"><span>' + file.name + '</span></div>' +
|
633 |
+
'<div class="fileprogress" style="line-height: 36px; float: right; margin-right: 5px;"></div>' +
|
634 |
+
'</div>' +
|
635 |
+
'<div style="clear: both;"></div>'
|
636 |
+
);
|
637 |
+
jQuery('#wpvivid_upload_submit_btn').show();
|
638 |
+
jQuery("#wpvivid_upload_submit_btn").prop('disabled', false);
|
639 |
+
}
|
640 |
+
else {
|
641 |
+
alert(file.name + " is not belong to the backup package uploaded.");
|
642 |
+
uploader.removeFile(file);
|
643 |
+
}
|
644 |
+
}
|
645 |
+
else{
|
646 |
+
if(repeat_files === ''){
|
647 |
+
repeat_files += file.name;
|
648 |
+
}
|
649 |
+
else{
|
650 |
+
repeat_files += ', ' + file.name;
|
651 |
+
}
|
652 |
+
}
|
653 |
+
});
|
654 |
+
if(repeat_files !== ''){
|
655 |
+
alert(repeat_files + " already exists in upload list.");
|
656 |
+
repeat_files = '';
|
657 |
+
}
|
658 |
+
}
|
659 |
+
}
|
660 |
+
|
661 |
+
uploader.bind('FilesAdded', wpvivid_check_plupload_added_files);
|
662 |
+
|
663 |
+
uploader.bind('Error', function(up, error)
|
664 |
+
{
|
665 |
+
alert('Upload ' + error.file.name +' error, error code: ' + error.code + ', ' + error.message);
|
666 |
+
console.log(error);
|
667 |
+
});
|
668 |
+
|
669 |
+
uploader.bind('FileUploaded', function(up, file, response)
|
670 |
+
{
|
671 |
+
var jsonarray = jQuery.parseJSON(response.response);
|
672 |
+
if(jsonarray.result == 'failed'){
|
673 |
+
alert('upload ' + file.name + ' failed, ' + jsonarray.error);
|
674 |
+
}
|
675 |
+
});
|
676 |
+
|
677 |
+
uploader.bind('UploadProgress', function(up, file)
|
678 |
+
{
|
679 |
+
jQuery('#' + file.id + " .fileprogress").html(file.percent + "%");
|
680 |
+
});
|
681 |
+
|
682 |
+
uploader.bind('UploadComplete',function(up, files)
|
683 |
+
{
|
684 |
+
jQuery('#wpvivid_upload_file_list').html("");
|
685 |
+
wpvivid_upload_id='';
|
686 |
+
jQuery('#wpvivid_upload_submit_btn').hide();
|
687 |
+
jQuery("#wpvivid_select_file_button").prop('disabled', false);
|
688 |
+
var ajax_data = {
|
689 |
+
'action': 'wpvivid_upload_files_finish',
|
690 |
+
'files':JSON.stringify(files)
|
691 |
+
};
|
692 |
+
wpvivid_post_request(ajax_data, function (data)
|
693 |
+
{
|
694 |
+
try {
|
695 |
+
var jsonarray = jQuery.parseJSON(data);
|
696 |
+
if(jsonarray.result === 'success') {
|
697 |
+
if (jsonarray.html !== false) {
|
698 |
+
var unlinked = '';
|
699 |
+
if(typeof jsonarray.unlinked !== 'undefined'){
|
700 |
+
unlinked = jsonarray.unlinked;
|
701 |
+
}
|
702 |
+
alert('The upload has completed. ' + unlinked);
|
703 |
+
jQuery('#wpvivid_backup_list').html('');
|
704 |
+
jQuery('#wpvivid_backup_list').append(jsonarray.html);
|
705 |
+
wpvivid_click_switch_page('backup', 'wpvivid_tab_backup', true);
|
706 |
+
}
|
707 |
+
}
|
708 |
+
else if(jsonarray.result === 'failed'){
|
709 |
+
var unlinked = '';
|
710 |
+
if(typeof jsonarray.unlinked !== 'undefined'){
|
711 |
+
unlinked = jsonarray.unlinked;
|
712 |
+
}
|
713 |
+
alert(jsonarray.error + ' ' + unlinked);
|
714 |
+
}
|
715 |
+
}
|
716 |
+
catch(err) {
|
717 |
+
alert(err);
|
718 |
+
}
|
719 |
+
}, function (XMLHttpRequest, textStatus, errorThrown)
|
720 |
+
{
|
721 |
+
var error_message = wpvivid_output_ajaxerror('refreshing backup list', textStatus, errorThrown);
|
722 |
+
alert(error_message);
|
723 |
+
});
|
724 |
+
plupload.each(files, function(file)
|
725 |
+
{
|
726 |
+
if(typeof file === 'undefined')
|
727 |
+
{
|
728 |
+
|
729 |
+
}
|
730 |
+
else
|
731 |
+
{
|
732 |
+
uploader.removeFile(file.id);
|
733 |
+
}
|
734 |
+
});
|
735 |
+
})
|
736 |
+
});
|
737 |
+
|
738 |
+
function wpvivid_submit_upload()
|
739 |
+
{
|
740 |
+
var backup_max_count='<?php
|
741 |
+
$general_setting=WPvivid_Setting::get_setting(true, "");
|
742 |
+
$display_backup_count = $general_setting['options']['wpvivid_common_setting']['max_backup_count'];
|
743 |
+
echo intval($display_backup_count);
|
744 |
+
?>';
|
745 |
+
var ajax_data = {
|
746 |
+
'action': 'wpvivid_get_backup_count'
|
747 |
+
};
|
748 |
+
wpvivid_post_request(ajax_data, function (data)
|
749 |
+
{
|
750 |
+
var backuplist_count = data;
|
751 |
+
if(backuplist_count >= backup_max_count){
|
752 |
+
alert("The backup retention limit for localhost(web server) is reached, please either increase the retention from WPvivid General Settings, or manually delete some old backups.");
|
753 |
+
}
|
754 |
+
else {
|
755 |
+
jQuery("#wpvivid_upload_submit_btn").prop('disabled', true);
|
756 |
+
jQuery("#wpvivid_select_file_button").prop('disabled', true);
|
757 |
+
uploader.refresh();
|
758 |
+
uploader.start();
|
759 |
+
}
|
760 |
+
|
761 |
+
}, function (XMLHttpRequest, textStatus, errorThrown)
|
762 |
+
{
|
763 |
+
var error_message = wpvivid_output_ajaxerror('uploading backups', textStatus, errorThrown);
|
764 |
+
alert(error_message);
|
765 |
+
});
|
766 |
+
}
|
767 |
+
</script>
|
768 |
+
<?php
|
769 |
+
}
|
770 |
+
|
771 |
+
public function upload_dir($uploads)
|
772 |
+
{
|
773 |
+
$uploads['path'] = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir();
|
774 |
+
return $uploads;
|
775 |
+
}
|
776 |
+
|
777 |
+
private function check_is_a_wpvivid_backup($file_name)
|
778 |
+
{
|
779 |
+
$ret=WPvivid_Backup_Item::get_backup_file_info($file_name);
|
780 |
+
if($ret['result'] === WPVIVID_SUCCESS){
|
781 |
+
return true;
|
782 |
+
}
|
783 |
+
elseif($ret['result'] === WPVIVID_FAILED){
|
784 |
+
return $ret['error'];
|
785 |
+
}
|
786 |
+
}
|
787 |
+
|
788 |
+
private function zip_check_sum($file_name)
|
789 |
+
{
|
790 |
+
return true;
|
791 |
+
}
|
792 |
+
}
|
trunk/includes/class-wpvivid-backup.php
ADDED
@@ -0,0 +1,2609 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!defined('WPVIVID_PLUGIN_DIR'))
|
4 |
+
{
|
5 |
+
die;
|
6 |
+
}
|
7 |
+
|
8 |
+
define('WPVIVID_BACKUP_TYPE_DB','backup_db');
|
9 |
+
define('WPVIVID_BACKUP_TYPE_THEMES','backup_themes');
|
10 |
+
define('WPVIVID_BACKUP_TYPE_PLUGIN','backup_plugin');
|
11 |
+
define('WPVIVID_BACKUP_TYPE_UPLOADS','backup_uploads');
|
12 |
+
define('WPVIVID_BACKUP_TYPE_UPLOADS_FILES','backup_uploads_files');
|
13 |
+
//define('WPVIVID_BACKUP_TYPE_UPLOADS_FILES_OTHER','backup_uploads_files_other');
|
14 |
+
define('WPVIVID_BACKUP_TYPE_CONTENT','backup_content');
|
15 |
+
define('WPVIVID_BACKUP_TYPE_CORE','backup_core');
|
16 |
+
define('WPVIVID_BACKUP_TYPE_OTHERS','backup_others');
|
17 |
+
define('WPVIVID_BACKUP_TYPE_MERGE','backup_merge');
|
18 |
+
|
19 |
+
define('WPVIVID_BACKUP_ROOT_WP_CONTENT','wp-content');
|
20 |
+
define('WPVIVID_BACKUP_ROOT_CUSTOM','custom');
|
21 |
+
define('WPVIVID_BACKUP_ROOT_WP_ROOT','root');
|
22 |
+
define('WPVIVID_BACKUP_ROOT_WP_UPLOADS','uploads');
|
23 |
+
class WPvivid_Backup_Task
|
24 |
+
{
|
25 |
+
protected $task;
|
26 |
+
|
27 |
+
public $backup_type_collect;
|
28 |
+
|
29 |
+
public function __construct($task_id=false,$task=false)
|
30 |
+
{
|
31 |
+
if($task_id!==false)
|
32 |
+
{
|
33 |
+
$this->task=WPvivid_taskmanager::get_task($task_id);
|
34 |
+
}
|
35 |
+
|
36 |
+
if($task!==false)
|
37 |
+
{
|
38 |
+
$this->task=$task;
|
39 |
+
}
|
40 |
+
|
41 |
+
$this->backup_type_collect[WPVIVID_BACKUP_TYPE_DB]=1;
|
42 |
+
$this->backup_type_collect[WPVIVID_BACKUP_TYPE_THEMES]=1;
|
43 |
+
$this->backup_type_collect[WPVIVID_BACKUP_TYPE_PLUGIN]=1;
|
44 |
+
$this->backup_type_collect[WPVIVID_BACKUP_TYPE_UPLOADS]=1;
|
45 |
+
$this->backup_type_collect[WPVIVID_BACKUP_TYPE_UPLOADS_FILES]=1;
|
46 |
+
//$this->backup_type_collect[WPVIVID_BACKUP_TYPE_UPLOADS_FILES_OTHER]=1;
|
47 |
+
$this->backup_type_collect[WPVIVID_BACKUP_TYPE_CONTENT]=1;
|
48 |
+
$this->backup_type_collect[WPVIVID_BACKUP_TYPE_CORE]=1;
|
49 |
+
$this->backup_type_collect[WPVIVID_BACKUP_TYPE_OTHERS]=1;
|
50 |
+
$this->backup_type_collect[WPVIVID_BACKUP_TYPE_MERGE]=1;
|
51 |
+
|
52 |
+
add_filter('wpvivid_set_backup', array($this, 'wpvivid_set_backup'),10);
|
53 |
+
add_filter('wpvivid_exclude_plugins',array($this,'exclude_plugins'),20);
|
54 |
+
add_filter('wpvivid_get_backup_exclude_regex',array($this, 'get_backup_exclude_regex'),10,2);
|
55 |
+
}
|
56 |
+
|
57 |
+
public function get_backup_exclude_regex($exclude_regex,$backup_type)
|
58 |
+
{
|
59 |
+
if($backup_type==WPVIVID_BACKUP_TYPE_UPLOADS||$backup_type==WPVIVID_BACKUP_TYPE_UPLOADS_FILES)
|
60 |
+
{
|
61 |
+
$upload_dir = wp_upload_dir();
|
62 |
+
$backup_data['files_root']=$this -> transfer_path($upload_dir['basedir']);
|
63 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR.'backwpup', '/').'#'; // BackWPup backup directory
|
64 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR.'ShortpixelBackups', '/').'#';//ShortpixelBackups
|
65 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR.'backup', '/').'#';
|
66 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR.'backwpup', '/').'#'; // BackWPup backup directory
|
67 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR.'backup-guard', '/').'#'; // Wordpress Backup and Migrate Plugin backup directory
|
68 |
+
}
|
69 |
+
else if($backup_type==WPVIVID_BACKUP_TYPE_CONTENT)
|
70 |
+
{
|
71 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'updraft', '/').'#'; // Updraft Plus backup directory
|
72 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'ai1wm-backups', '/').'#'; // All-in-one WP migration backup directory
|
73 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'backups', '/').'#'; // Xcloner backup directory
|
74 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'upgrade', '/').'#';
|
75 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'wpvivid', '/').'#';
|
76 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir(), '/').'#';
|
77 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'plugins', '/').'#';
|
78 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'cache', '/').'#';
|
79 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'wphb-cache', '/').'#';
|
80 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'backup', '/').'#';
|
81 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'Dropbox_Backup', '/').'#';
|
82 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.'mysql.sql', '/').'#';//mysql
|
83 |
+
if(defined('WPVIVID_UPLOADS_ISO_DIR'))
|
84 |
+
{
|
85 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.WPVIVID_UPLOADS_ISO_DIR, '/').'#';
|
86 |
+
}
|
87 |
+
$upload_dir = wp_upload_dir();
|
88 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']), '/').'$#';
|
89 |
+
$exclude_regex[]='#^'.preg_quote($this->transfer_path(get_theme_root()), '/').'#';
|
90 |
+
}
|
91 |
+
|
92 |
+
return $exclude_regex;
|
93 |
+
}
|
94 |
+
|
95 |
+
public function exclude_plugins($exclude_plugins)
|
96 |
+
{
|
97 |
+
if(in_array('wpvivid-backuprestore',$exclude_plugins))
|
98 |
+
{
|
99 |
+
$exclude_plugins[]='wpvivid-backuprestore';
|
100 |
+
}
|
101 |
+
|
102 |
+
if(in_array('wp-cerber',$exclude_plugins))
|
103 |
+
{
|
104 |
+
$exclude_plugins[]='wp-cerber';
|
105 |
+
}
|
106 |
+
|
107 |
+
if(in_array('.',$exclude_plugins))
|
108 |
+
{
|
109 |
+
$exclude_plugins[]='.';
|
110 |
+
}
|
111 |
+
|
112 |
+
if(in_array('wpvivid-backup-pro',$exclude_plugins))
|
113 |
+
{
|
114 |
+
$exclude_plugins[]='wpvivid-backup-pro';
|
115 |
+
}
|
116 |
+
|
117 |
+
return $exclude_plugins;
|
118 |
+
}
|
119 |
+
|
120 |
+
public function get_id()
|
121 |
+
{
|
122 |
+
return $this->task['id'];
|
123 |
+
}
|
124 |
+
|
125 |
+
public function new_backup_task($options,$type,$action='backup')
|
126 |
+
{
|
127 |
+
$id=uniqid('wpvivid-');
|
128 |
+
$this->task=false;
|
129 |
+
$this->task['id']=$id;
|
130 |
+
$this->task['action']=$action;
|
131 |
+
$this->task['type']=$type;
|
132 |
+
|
133 |
+
$this->task['status']['start_time']=time();
|
134 |
+
$this->task['status']['run_time']=time();
|
135 |
+
$this->task['status']['timeout']=time();
|
136 |
+
$this->task['status']['str']='ready';
|
137 |
+
$this->task['status']['resume_count']=0;
|
138 |
+
|
139 |
+
if(isset($options['remote']))
|
140 |
+
{
|
141 |
+
if($options['remote']=='1')
|
142 |
+
{
|
143 |
+
if(isset($options['remote_options']))
|
144 |
+
{
|
145 |
+
$this->task['options']['remote_options']=$options['remote_options'];
|
146 |
+
}
|
147 |
+
else
|
148 |
+
{
|
149 |
+
$this->task['options']['remote_options']=WPvivid_Setting::get_remote_options();
|
150 |
+
}
|
151 |
+
|
152 |
+
}
|
153 |
+
else {
|
154 |
+
$this->task['options']['remote_options']=false;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
else
|
158 |
+
{
|
159 |
+
$this->task['options']['remote_options']=false;
|
160 |
+
}
|
161 |
+
|
162 |
+
$this->task['options']['remote_options'] = apply_filters('wpvivid_set_remote_options', $this->task['options']['remote_options'],$options);
|
163 |
+
|
164 |
+
if(isset($options['local']))
|
165 |
+
{
|
166 |
+
if($options['local']=='1')
|
167 |
+
{
|
168 |
+
$this->task['options']['save_local']=1;
|
169 |
+
}
|
170 |
+
else
|
171 |
+
{
|
172 |
+
$this->task['options']['save_local']=0;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
else
|
176 |
+
{
|
177 |
+
$this->task['options']['save_local']=1;
|
178 |
+
}
|
179 |
+
|
180 |
+
if(isset($options['lock']))
|
181 |
+
{
|
182 |
+
$this->task['options']['lock']=$options['lock'];
|
183 |
+
}
|
184 |
+
else
|
185 |
+
{
|
186 |
+
$this->task['options']['lock']=0;
|
187 |
+
}
|
188 |
+
|
189 |
+
$general_setting=WPvivid_Setting::get_setting(true, "");
|
190 |
+
|
191 |
+
if(isset($options['backup_prefix']) && !empty($options['backup_prefix']))
|
192 |
+
{
|
193 |
+
$backup_prefix=$options['backup_prefix'];
|
194 |
+
}
|
195 |
+
else
|
196 |
+
{
|
197 |
+
if(isset($general_setting['options']['wpvivid_common_setting']['domain_include'])&&$general_setting['options']['wpvivid_common_setting']['domain_include'])
|
198 |
+
{
|
199 |
+
$check_addon = apply_filters('wpvivid_check_setting_addon', 'not_addon');
|
200 |
+
if (isset($general_setting['options']['wpvivid_common_setting']['backup_prefix']) && $check_addon == 'addon')
|
201 |
+
{
|
202 |
+
$backup_prefix = $general_setting['options']['wpvivid_common_setting']['backup_prefix'];
|
203 |
+
}
|
204 |
+
else {
|
205 |
+
$home_url_prefix = get_home_url();
|
206 |
+
$home_url_prefix = $this->parse_url_all($home_url_prefix);
|
207 |
+
$backup_prefix = $home_url_prefix;
|
208 |
+
}
|
209 |
+
}
|
210 |
+
else
|
211 |
+
{
|
212 |
+
$backup_prefix='';
|
213 |
+
}
|
214 |
+
}
|
215 |
+
$this->task['options']['backup_prefix']=$backup_prefix;
|
216 |
+
$offset=get_option('gmt_offset');
|
217 |
+
if(empty($backup_prefix))
|
218 |
+
$this->task['options']['file_prefix'] = $this->task['id'] . '_' . date('Y-m-d-H-i', $this->task['status']['start_time']+$offset*60*60);
|
219 |
+
else
|
220 |
+
$this->task['options']['file_prefix'] = $backup_prefix . '_' . $this->task['id'] . '_' . date('Y-m-d-H-i', $this->task['status']['start_time']+$offset*60*60);
|
221 |
+
|
222 |
+
$this->task['options']['file_prefix'] = apply_filters('wpvivid_backup_file_prefix',$this->task['options']['file_prefix'],$backup_prefix,$this->task['id'],$this->task['status']['start_time']);
|
223 |
+
|
224 |
+
if(isset($general_setting['options']['wpvivid_common_setting']['ismerge']))
|
225 |
+
{
|
226 |
+
if($general_setting['options']['wpvivid_common_setting']['ismerge']==1)
|
227 |
+
{
|
228 |
+
$this->task['options']['backup_options']['ismerge']=1;
|
229 |
+
}
|
230 |
+
else {
|
231 |
+
$this->task['options']['backup_options']['ismerge']=0;
|
232 |
+
}
|
233 |
+
}
|
234 |
+
else {
|
235 |
+
$this->task['options']['backup_options']['ismerge']=1;
|
236 |
+
}
|
237 |
+
$this->task['options']['backup_options']['ismerge']=apply_filters('wpvivid_set_backup_ismerge',$this->task['options']['backup_options']['ismerge'],$options);
|
238 |
+
|
239 |
+
$this->task['options']['log_file_name']=$id.'_backup';
|
240 |
+
$log=new WPvivid_Log();
|
241 |
+
$log->CreateLogFile($this->task['options']['log_file_name'],'no_folder','backup');
|
242 |
+
//$log->WriteLog(get_home_path(),'test');
|
243 |
+
$this->task['options']['backup_options']['prefix']=$this->task['options']['file_prefix'];
|
244 |
+
$this->task['options']['backup_options']['compress']=WPvivid_Setting::get_option('wpvivid_compress_setting');
|
245 |
+
$this->task['options']['backup_options']['dir']=WPvivid_Setting::get_backupdir();
|
246 |
+
$this->task['options']['backup_options']['backup']=array();
|
247 |
+
|
248 |
+
if(isset($options['backup_files']))
|
249 |
+
{
|
250 |
+
if($options['backup_files']=='files+db')
|
251 |
+
{
|
252 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_DB);
|
253 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_THEMES);
|
254 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_PLUGIN);
|
255 |
+
$general_setting=WPvivid_Setting::get_setting(true, "");
|
256 |
+
if(isset($general_setting['options']['wpvivid_compress_setting']['subpackage_plugin_upload']) && !empty($general_setting['options']['wpvivid_compress_setting']['subpackage_plugin_upload'])){
|
257 |
+
if($general_setting['options']['wpvivid_compress_setting']['subpackage_plugin_upload']){
|
258 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_UPLOADS_FILES);
|
259 |
+
//$this->set_backup(WPVIVID_BACKUP_TYPE_UPLOADS_FILES_OTHER);
|
260 |
+
}
|
261 |
+
else{
|
262 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_UPLOADS);
|
263 |
+
}
|
264 |
+
}
|
265 |
+
else{
|
266 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_UPLOADS);
|
267 |
+
}
|
268 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_CONTENT);
|
269 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_CORE);
|
270 |
+
}
|
271 |
+
else if($options['backup_files']=='files')
|
272 |
+
{
|
273 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_THEMES);
|
274 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_PLUGIN);
|
275 |
+
$general_setting=WPvivid_Setting::get_setting(true, "");
|
276 |
+
if(isset($general_setting['options']['wpvivid_compress_setting']['subpackage_plugin_upload']) && !empty($general_setting['options']['wpvivid_compress_setting']['subpackage_plugin_upload'])){
|
277 |
+
if($general_setting['options']['wpvivid_compress_setting']['subpackage_plugin_upload']){
|
278 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_UPLOADS_FILES);
|
279 |
+
//$this->set_backup(WPVIVID_BACKUP_TYPE_UPLOADS_FILES_OTHER);
|
280 |
+
}
|
281 |
+
else{
|
282 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_UPLOADS);
|
283 |
+
}
|
284 |
+
}
|
285 |
+
else{
|
286 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_UPLOADS);
|
287 |
+
}
|
288 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_CONTENT);
|
289 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_CORE);
|
290 |
+
}
|
291 |
+
else if($options['backup_files']=='db')
|
292 |
+
{
|
293 |
+
$this->set_backup(WPVIVID_BACKUP_TYPE_DB);
|
294 |
+
}
|
295 |
+
}
|
296 |
+
else
|
297 |
+
{
|
298 |
+
$this->task['options']['backup_options'] = apply_filters('wpvivid_set_backup_type', $this->task['options']['backup_options'],$options);
|
299 |
+
}
|
300 |
+
|
301 |
+
$this->task['data']['doing']='backup';
|
302 |
+
$this->task['data']['backup']['doing']='';
|
303 |
+
$this->task['data']['backup']['finished']=0;
|
304 |
+
$this->task['data']['backup']['progress']=0;
|
305 |
+
$this->task['data']['backup']['job_data']=array();
|
306 |
+
$this->task['data']['backup']['sub_job']=array();
|
307 |
+
$this->task['data']['backup']['db_size']='0';
|
308 |
+
$this->task['data']['backup']['files_size']['sum']='0';
|
309 |
+
$this->task['data']['upload']['doing']='';
|
310 |
+
$this->task['data']['upload']['finished']=0;
|
311 |
+
$this->task['data']['upload']['progress']=0;
|
312 |
+
$this->task['data']['upload']['job_data']=array();
|
313 |
+
$this->task['data']['upload']['sub_job']=array();
|
314 |
+
WPvivid_Setting::update_task($id,$this->task);
|
315 |
+
$ret['result']='success';
|
316 |
+
$ret['task_id']=$this->task['id'];
|
317 |
+
$log->CloseFile();
|
318 |
+
return $ret;
|
319 |
+
}
|
320 |
+
|
321 |
+
protected function parse_url_all($url)
|
322 |
+
{
|
323 |
+
$parse = parse_url($url);
|
324 |
+
$path=str_replace('/','_',$parse['path']);
|
325 |
+
return $parse['host'].$path;
|
326 |
+
}
|
327 |
+
|
328 |
+
public function set_backup($backup, $task_type='')
|
329 |
+
{
|
330 |
+
if(is_string($backup))
|
331 |
+
{
|
332 |
+
if(!function_exists('get_home_path'))
|
333 |
+
require_once(ABSPATH . 'wp-admin/includes/file.php');
|
334 |
+
$backup_data['key']=$backup;
|
335 |
+
$backup_data['result']=false;
|
336 |
+
$backup_data['compress']=$this->task['options']['backup_options']['compress'];
|
337 |
+
$backup_data['finished']=0;
|
338 |
+
$backup_data['path']=WP_CONTENT_DIR.DIRECTORY_SEPARATOR. $this->task['options']['backup_options']['dir'].DIRECTORY_SEPARATOR;
|
339 |
+
if($backup==WPVIVID_BACKUP_TYPE_DB)
|
340 |
+
{
|
341 |
+
//$backup_data['root_path']=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$this->task['options']['backup_options']['dir'];
|
342 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_CUSTOM;
|
343 |
+
$backup_data['dump_db']=1;
|
344 |
+
$backup_data['sql_file_name']=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$this->task['options']['backup_options']['dir'].DIRECTORY_SEPARATOR.$this->get_prefix().'_backup_db.sql';
|
345 |
+
$backup_data['json_info']['dump_db']=1;
|
346 |
+
$backup_data['json_info']['home_url']=home_url();
|
347 |
+
$backup_data['json_info']['file_type']='databases';
|
348 |
+
if(is_multisite())
|
349 |
+
{
|
350 |
+
$backup_data['json_info']['is_mu']=1;
|
351 |
+
}
|
352 |
+
$backup_data['prefix']=$this->get_prefix().'_backup_db';
|
353 |
+
}
|
354 |
+
else if($backup==WPVIVID_BACKUP_TYPE_THEMES)
|
355 |
+
{
|
356 |
+
//$backup_data['root_path']=WP_CONTENT_DIR;
|
357 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_WP_CONTENT;
|
358 |
+
$backup_data['prefix']=$this->get_prefix().'_backup_themes';
|
359 |
+
$backup_data['files_root']=$this->transfer_path(get_theme_root());
|
360 |
+
$backup_data['exclude_regex']=array();
|
361 |
+
$backup_data['include_regex']=array();
|
362 |
+
$backup_data['json_info']['file_type']='themes';
|
363 |
+
$backup_data['json_info']['themes']=$this->get_themes_list();
|
364 |
+
$this->task['options']['backup_options']['backup'][$backup_data['key']]=$backup_data;
|
365 |
+
}
|
366 |
+
else if($backup==WPVIVID_BACKUP_TYPE_PLUGIN)
|
367 |
+
{
|
368 |
+
//$backup_data['root_path']=WP_CONTENT_DIR;
|
369 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_WP_CONTENT;
|
370 |
+
$backup_data['prefix']=$this->get_prefix().'_backup_plugin';
|
371 |
+
if(isset($backup_data['compress']['subpackage_plugin_upload'])&&$backup_data['compress']['subpackage_plugin_upload'])
|
372 |
+
{
|
373 |
+
$backup_data['plugin_subpackage']=1;
|
374 |
+
}
|
375 |
+
$backup_data['files_root']=$this->transfer_path(WP_PLUGIN_DIR);
|
376 |
+
|
377 |
+
$exclude_plugins=array();
|
378 |
+
$exclude_plugins=apply_filters('wpvivid_exclude_plugins',$exclude_plugins);
|
379 |
+
$exclude_regex=array();
|
380 |
+
foreach ($exclude_plugins as $exclude_plugin)
|
381 |
+
{
|
382 |
+
$exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_PLUGIN_DIR.DIRECTORY_SEPARATOR.$exclude_plugin), '/').'#';
|
383 |
+
}
|
384 |
+
$backup_data['exclude_regex']=$exclude_regex;
|
385 |
+
$backup_data['include_regex']=array();
|
386 |
+
$backup_data['json_info']['file_type']='plugin';
|
387 |
+
$backup_data['json_info']['plugin']=$this->get_plugins_list();
|
388 |
+
}
|
389 |
+
else if($backup==WPVIVID_BACKUP_TYPE_UPLOADS)
|
390 |
+
{
|
391 |
+
//$backup_data['root_path']=WP_CONTENT_DIR;
|
392 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_WP_CONTENT;
|
393 |
+
$backup_data['prefix']=$this->get_prefix().'_backup_uploads';
|
394 |
+
$upload_dir = wp_upload_dir();
|
395 |
+
$backup_data['files_root']=$this -> transfer_path($upload_dir['basedir']);
|
396 |
+
|
397 |
+
$exclude_regex=array();
|
398 |
+
$exclude_regex=apply_filters('wpvivid_get_backup_exclude_regex',$exclude_regex,WPVIVID_BACKUP_TYPE_UPLOADS);
|
399 |
+
$backup_data['exclude_regex']=$exclude_regex;
|
400 |
+
$backup_data['include_regex']=array();
|
401 |
+
$backup_data['json_info']['file_type']='upload';
|
402 |
+
}
|
403 |
+
else if($backup==WPVIVID_BACKUP_TYPE_UPLOADS_FILES)
|
404 |
+
{
|
405 |
+
//$backup_data['root_path']=WP_CONTENT_DIR;
|
406 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_WP_CONTENT;
|
407 |
+
$backup_data['prefix']=$this->get_prefix().'_backup_uploads';
|
408 |
+
$backup_data['uploads_subpackage']=1;
|
409 |
+
$upload_dir = wp_upload_dir();
|
410 |
+
$backup_data['files_root']=$this -> transfer_path($upload_dir['basedir']);
|
411 |
+
$exclude_regex=array();
|
412 |
+
$exclude_regex=apply_filters('wpvivid_get_backup_exclude_regex',$exclude_regex,WPVIVID_BACKUP_TYPE_UPLOADS_FILES);
|
413 |
+
$backup_data['include_regex']=array();
|
414 |
+
$backup_data['exclude_regex']=$exclude_regex;
|
415 |
+
//$backup_data['include_regex'][]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']).DIRECTORY_SEPARATOR, '/').'[0-9]{4}#';
|
416 |
+
$backup_data['json_info']['file_type']='upload';
|
417 |
+
}
|
418 |
+
else if($backup==WPVIVID_BACKUP_TYPE_CONTENT)
|
419 |
+
{
|
420 |
+
//$backup_data['root_path']=get_home_path();
|
421 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_WP_ROOT;
|
422 |
+
$backup_data['prefix']=$this->get_prefix().'_backup_content';
|
423 |
+
$backup_data['files_root']=$this -> transfer_path(WP_CONTENT_DIR);
|
424 |
+
$exclude_regex=array();
|
425 |
+
$exclude_regex=apply_filters('wpvivid_get_backup_exclude_regex',$exclude_regex,WPVIVID_BACKUP_TYPE_CONTENT);
|
426 |
+
$backup_data['exclude_regex']=$exclude_regex;
|
427 |
+
$backup_data['include_regex']=array();
|
428 |
+
$backup_data['json_info']['file_type']='wp-content';
|
429 |
+
}
|
430 |
+
else if($backup==WPVIVID_BACKUP_TYPE_CORE)
|
431 |
+
{
|
432 |
+
//$backup_data['root_path']=ABSPATH;
|
433 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_WP_ROOT;
|
434 |
+
$backup_data['prefix']=$this->get_prefix().'_backup_core';
|
435 |
+
$backup_data['files_root']=$this -> transfer_path(ABSPATH);
|
436 |
+
$backup_data['json_info']['include_path'][]='wp-includes';
|
437 |
+
$backup_data['json_info']['include_path'][]='wp-admin';
|
438 |
+
$backup_data['json_info']['wp_core']=1;
|
439 |
+
$backup_data['json_info']['home_url']=home_url();
|
440 |
+
$include_regex[]='#^'.preg_quote($this -> transfer_path(ABSPATH.DIRECTORY_SEPARATOR.'wp-admin'), '/').'#';
|
441 |
+
$include_regex[]='#^'.preg_quote($this->transfer_path(ABSPATH.DIRECTORY_SEPARATOR.'wp-includes'), '/').'#';
|
442 |
+
$exclude_regex[]='#^'.preg_quote($this->transfer_path(ABSPATH.DIRECTORY_SEPARATOR.'wp-admin'.DIRECTORY_SEPARATOR), '/').'pclzip-.*\.tmp#';
|
443 |
+
$exclude_regex[]='#^'.preg_quote($this->transfer_path(ABSPATH.DIRECTORY_SEPARATOR.'wp-admin'.DIRECTORY_SEPARATOR), '/').'pclzip-.*\.gz#';
|
444 |
+
$exclude_regex[]='#session_mm_cgi-fcgi#';
|
445 |
+
$exclude_regex=apply_filters('wpvivid_get_backup_exclude_regex',$exclude_regex,WPVIVID_BACKUP_TYPE_CORE);
|
446 |
+
$backup_data['exclude_regex']=$exclude_regex;
|
447 |
+
$backup_data['include_regex']=$include_regex;
|
448 |
+
$backup_data['json_info']['file_type']='wp-core';
|
449 |
+
}
|
450 |
+
else if($backup==WPVIVID_BACKUP_TYPE_MERGE)
|
451 |
+
{
|
452 |
+
//$backup_data['root_path']=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$this->task['options']['backup_options']['dir'];
|
453 |
+
$backup_data['root_flag']=WPVIVID_BACKUP_ROOT_CUSTOM;
|
454 |
+
$file_name = $this->get_prefix().'_backup_all';
|
455 |
+
$file_name = apply_filters('wpvivid_set_incremental_backup_file_name', $file_name, $this->get_prefix(), $task_type);
|
456 |
+
$backup_data['prefix']=$file_name;
|
457 |
+
$backup_data['files']=array();
|
458 |
+
$backup_data['json_info']['has_child']=1;
|
459 |
+
foreach ($this->task['options']['backup_options']['backup'] as $backup_finished_data)
|
460 |
+
{
|
461 |
+
$backup_data['files']=array_merge($backup_data['files'],$this->get_backup_file($backup_finished_data['key']));
|
462 |
+
}
|
463 |
+
$backup_data['json_info']['home_url']=home_url();
|
464 |
+
}
|
465 |
+
else
|
466 |
+
{
|
467 |
+
$backup_data=false;
|
468 |
+
}
|
469 |
+
if($backup_data!==false)
|
470 |
+
{
|
471 |
+
$backup_data=apply_filters('wpvivid_set_backup',$backup_data);
|
472 |
+
$this->task['options']['backup_options']['backup'][$backup_data['key']]=$backup_data;
|
473 |
+
}
|
474 |
+
}
|
475 |
+
}
|
476 |
+
|
477 |
+
public function get_themes_list()
|
478 |
+
{
|
479 |
+
$themes_list=array();
|
480 |
+
$list=wp_get_themes();
|
481 |
+
foreach ($list as $key=>$item)
|
482 |
+
{
|
483 |
+
$themes_list[$key]['slug']=$key;
|
484 |
+
$themes_list[$key]['size']=$this->get_folder_size(get_theme_root().DIRECTORY_SEPARATOR.$key,0);
|
485 |
+
}
|
486 |
+
return $themes_list;
|
487 |
+
}
|
488 |
+
|
489 |
+
public function get_plugins_list()
|
490 |
+
{
|
491 |
+
$plugins_list=array();
|
492 |
+
|
493 |
+
if(!function_exists('get_plugins'))
|
494 |
+
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
495 |
+
|
496 |
+
$list=get_plugins();
|
497 |
+
|
498 |
+
$exclude_plugins[]='wpvivid-backuprestore';
|
499 |
+
$exclude_plugins[]='wp-cerber';
|
500 |
+
$exclude_plugins[]='.';
|
501 |
+
$exclude_plugins=apply_filters('wpvivid_exclude_plugins',$exclude_plugins);
|
502 |
+
|
503 |
+
foreach ($list as $key=>$item)
|
504 |
+
{
|
505 |
+
if(in_array(dirname($key),$exclude_plugins))
|
506 |
+
{
|
507 |
+
continue;
|
508 |
+
}
|
509 |
+
|
510 |
+
$plugins_list[dirname($key)]['slug']=dirname($key);
|
511 |
+
$plugins_list[dirname($key)]['size']=$this->get_folder_size(WP_PLUGIN_DIR.DIRECTORY_SEPARATOR.dirname($key),0);
|
512 |
+
//
|
513 |
+
}
|
514 |
+
return $plugins_list;
|
515 |
+
}
|
516 |
+
|
517 |
+
public function get_folder_size($root,$size)
|
518 |
+
{
|
519 |
+
$count = 0;
|
520 |
+
if(is_dir($root))
|
521 |
+
{
|
522 |
+
$handler = opendir($root);
|
523 |
+
if($handler!==false)
|
524 |
+
{
|
525 |
+
while (($filename = readdir($handler)) !== false)
|
526 |
+
{
|
527 |
+
if ($filename != "." && $filename != "..") {
|
528 |
+
$count++;
|
529 |
+
|
530 |
+
if (is_dir($root . DIRECTORY_SEPARATOR . $filename))
|
531 |
+
{
|
532 |
+
$size=$this->get_folder_size($root . DIRECTORY_SEPARATOR . $filename,$size);
|
533 |
+
} else {
|
534 |
+
$size+=filesize($root . DIRECTORY_SEPARATOR . $filename);
|
535 |
+
}
|
536 |
+
}
|
537 |
+
}
|
538 |
+
if($handler)
|
539 |
+
@closedir($handler);
|
540 |
+
}
|
541 |
+
|
542 |
+
}
|
543 |
+
return $size;
|
544 |
+
}
|
545 |
+
|
546 |
+
public function wpvivid_set_backup($backup_data)
|
547 |
+
{
|
548 |
+
if(isset($backup_data['uploads_subpackage'])||isset($backup_data['plugin_subpackage']))
|
549 |
+
{
|
550 |
+
$backup_data['resume_packages'] = 1;
|
551 |
+
}
|
552 |
+
else if($backup_data['key']==WPVIVID_BACKUP_TYPE_MERGE)
|
553 |
+
{
|
554 |
+
|