web/wp-content/plugins/duplicator/inc/javascript.php
author Anthony Ly <anthonyly.com@gmail.com>
Mon, 03 Dec 2012 16:30:36 -0800
changeset 195 c7c0fbc09788
child 204 09a1c134465b
permissions -rw-r--r--
ajout du plugin Duplicator
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
195
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     1
<script type="text/javascript">
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     2
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     3
jQuery.noConflict()(function($) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     4
	jQuery(document).ready(function() {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     5
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     6
	//Unique namespace
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     7
	Duplicator = new Object();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     8
	Duplicator.DEBUG_AJAX_RESPONSE = false;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     9
	Duplicator.AJAX_TIMER = null;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    10
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    11
	Duplicator.startAjaxTimer = function() {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    12
		Duplicator.AJAX_TIMER = new Date();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    13
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    14
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    15
	Duplicator.endAjaxTimer = function() {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    16
		var endTime = new Date();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    17
		Duplicator.AJAX_TIMER =  (endTime.getTime()  - Duplicator.AJAX_TIMER) /1000;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    18
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    19
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    20
	/** **********************************************
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    21
	*  METHOD: Duplicator.setStatus  
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    22
	*  Sets the status of the Duplicator status bar */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    23
	Duplicator.setStatus = function(msg, img, postmsg) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    24
		//Clean Status Bar
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    25
		$("#img-status-error").hide();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    26
		$("#img-status-progress").hide();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    27
		
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    28
		$('#span-status').html(msg);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    29
		switch (img) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    30
			case 'error' 	: $("#img-status-error").show('slow'); break;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    31
			case 'progress' : $("#img-status-progress").show('slow'); break;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    32
		}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    33
		$('#span-status-post').html(postmsg);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    34
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    35
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    36
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    37
	/** **********************************************
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    38
	*  METHOD: Duplicator.toggleToolbarState  
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    39
	*  Disables or enables the toolbar
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    40
	*  @param state		Disabled/Enabled */ 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    41
	Duplicator.toggleToolbarState = function(state) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    42
		if (state == "DISABLED") {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    43
			$('#toolbar-table input, div#duplicator-installer').attr("disabled", "true");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    44
			$('#toolbar-table input, div#duplicator-installer').css("background-color", "#efefef");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    45
		} else {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    46
			$('#toolbar-table input, div#duplicator-installer').removeAttr("disabled");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    47
			$('#toolbar-table input, div#duplicator-installer').css("background-color", "#f9f9f9");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    48
		}	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    49
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    50
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    51
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    52
	/** **********************************************
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    53
	*  METHOD: Duplicator.reload  
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    54
	*  Performs reloading the page and diagnotic handleing */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    55
	Duplicator.reload = function(data) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    56
		if (Duplicator.DEBUG_AJAX_RESPONSE) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    57
			Duplicator.showSystemError('debug on', data);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    58
		} else {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    59
			Duplicator.toggleToolbarState("ENABLED");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    60
			window.location.reload();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    61
		}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    62
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    63
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    64
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    65
	/** **********************************************
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    66
	*  METHOD: Duplicator.createPackage  
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    67
	*  Performs Ajax post to create a new package
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    68
	*  Timeout (10000000 = 166 minutes) */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    69
	Duplicator.createPackage = function(packname) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    70
		Duplicator.toggleToolbarState("DISABLED");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    71
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    72
		$.ajax({
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    73
			type: "POST",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    74
			url: ajaxurl,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    75
			timeout: 10000000,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    76
			data: "package_name=" + packname +"&action=duplicator_create",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    77
			beforeSend: function() {Duplicator.startAjaxTimer(); },
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    78
			complete: function() {Duplicator.endAjaxTimer(); },
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    79
			success:    function(data) { 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    80
				Duplicator.reload(data);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    81
			},
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    82
			error:      function(data) { 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    83
				Duplicator.showSystemError('Duplicator.createPackage', data);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    84
				Duplicator.toggleToolbarState("ENABLED");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    85
			}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    86
		});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    87
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    88
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    89
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    90
	/** **********************************************
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    91
	 *  METHOD: Save Settings
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    92
	 *  Saves the Settings */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    93
	Duplicator.saveSettings = function() {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    94
		var q;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    95
		var email_me   		= $('#email-me').is(':checked') ? 1 : 0;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    96
		var dbiconv    		= $('#dbiconv').is(':checked')  ? 1 : 0;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    97
		var log_level  		= $("select#log_level").val() ? $("select#log_level").val() : 0;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    98
		var email_others	= $("input#email_others").val();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    99
		var dir_bypass 		= $("textarea#dir_bypass").val();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   100
		var rm_snapshot   	= $('#rm_snapshot').is(':checked') ? 1 : 0;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   101
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   102
		//append semicolon if user forgot
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   103
		if (dir_bypass.length > 1) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   104
			var has_semicolon	= dir_bypass.charAt(dir_bypass.length - 1) == ";";
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   105
			var dir_bypass		= (has_semicolon) ? dir_bypass : dir_bypass + ";";
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   106
			$("textarea#dir_bypass").val(dir_bypass);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   107
		}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   108
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   109
		$.ajax({
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   110
			type: "POST",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   111
			url: ajaxurl,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   112
			timeout: 10000000,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   113
			data: 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   114
			{
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   115
				'action'  		: 'duplicator_settings',
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   116
				'dbhost' 		: $("input#dbhost").val(),
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   117
				'dbname'  		: $("input#dbname").val(),
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   118
				'dbuser'  		: $("input#dbuser").val(),
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   119
				'nurl'  		: $("input#nurl").val(),
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   120
				'dbiconv'  		: dbiconv,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   121
				'email-me'  	: email_me,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   122
				'email_others'  : email_others,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   123
				'max_time'  	: $("input#max_time").val(),
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   124
				'max_memory'  	: $("input#max_memory").val(),
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   125
				'skip_ext'  	: $("input#skip_ext").val(),
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   126
				'dir_bypass'  	: $("textarea#dir_bypass").val(),
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   127
				'log_level'  	: log_level,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   128
				'rm_snapshot'  	: rm_snapshot
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   129
			},
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   130
			beforeSend: function() {Duplicator.startAjaxTimer(); },
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   131
			complete: function() {Duplicator.endAjaxTimer(); },
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   132
			success: function(data) { 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   133
				$('#opts-save-btn').val("<?php _e('Saving', 'wpduplicator') ?>...");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   134
				window.location.reload();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   135
			},
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   136
			error: function(data) { 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   137
				Duplicator.showSystemError('Duplicator.saveSettings', data);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   138
			}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   139
		});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   140
	 }
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   141
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   142
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   143
	/** **********************************************
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   144
	 *  METHOD: Delete Package
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   145
	 *  Removes all selected package sets */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   146
	Duplicator.deletePackage = function (event) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   147
		var arr = new Array;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   148
		var count = 0;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   149
		$("input[name=delete_confirm]").each(function() {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   150
			 if (this.checked) { arr[count++] = this.id; }
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   151
		});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   152
		var list = arr.join(',');
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   153
		if (list.length == 0) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   154
			alert("<?php _e('Please select at least one package to delete.', 'wpduplicator') ?>");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   155
			return;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   156
		}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   157
		
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   158
		var answer = confirm("<?php _e('Are you sure, you want to delete the selected package(s)?', 'wpduplicator') ?>");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   159
		if (answer){
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   160
			$.ajax({
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   161
				type: "POST",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   162
				url: ajaxurl,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   163
				data: "duplicator_delid="+list+"&action=duplicator_delete",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   164
				beforeSend: function() {Duplicator.startAjaxTimer(); },
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   165
				complete: function() {Duplicator.endAjaxTimer(); },
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   166
				success: function(data) { 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   167
					Duplicator.reload(data); 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   168
				},
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   169
				error: function(data) { 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   170
					Duplicator.showSystemError('Duplicator.deletePackage', data);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   171
				}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   172
			});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   173
		} else {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   174
			Duplicator.setStatus("<?php _e('Ready to create new package.', 'wpduplicator') ?>");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   175
		}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   176
		if (event)
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   177
			event.preventDefault(); 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   178
	};
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   179
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   180
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   181
	/** **********************************************
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   182
	 *  ATTACHED EVENT: Submit Main Form
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   183
	 *  Process Package and Installer */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   184
	$("#form-duplicator").submit(function (event) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   185
		event.preventDefault();   
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   186
		
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   187
		//Validate length test
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   188
		if ($("input[name=package_name]").val().length <= 0) 	{
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   189
			Duplicator.setStatus("<?php _e('Please enter a backup name.', 'wpduplicator') ?>", "error");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   190
			return;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   191
		}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   192
		
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   193
		//Vatlidate alphanumeric test
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   194
		var newstring = $("input[name=package_name]").val().replace(/ /g, "");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   195
		$("input[name=package_name]").val(newstring)
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   196
		if ( ! /^[0-9A-Za-z|_]+$/.test($("input[name=package_name]").val())) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   197
			Duplicator.setStatus("<?php _e('Alpanumeric characters only on package name', 'wpduplicator') ?>", "error");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   198
			return;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   199
		}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   200
		
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   201
		var packname = $("input[name=package_name]").val();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   202
		
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   203
		$.ajax({
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   204
			type: "POST",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   205
			url: ajaxurl,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   206
			dataType: "json",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   207
			timeout: 10000000,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   208
			data: "duplicator_new="+ packname +"&action=duplicator_system_check",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   209
			beforeSend: function() {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   210
				Duplicator.setStatus("<?php _e("Evaluating WordPress Setup. Please Wait", 'wpduplicator') ?>...", 'progress');
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   211
			},
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   212
			success: function(data) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   213
				Duplicator.setStatus("<?php _e('Ready to create new package.', 'wpduplicator') ?>");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   214
				if (data.Success) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   215
					Duplicator.showCreateConfirmation(packname);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   216
				} else {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   217
					Duplicator.showSystemCheck(data);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   218
				}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   219
			},
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   220
			error: function(data) { 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   221
				Duplicator.showSystemError('form-duplicator submit', data);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   222
			}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   223
		});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   224
	});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   225
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   226
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   227
	/*  ============================================================================
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   228
	MAIN GRID
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   229
	Actions that revolve around the main grid */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   230
	$("input#select-all").click(function (event) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   231
		var state = $('input#select-all').is(':checked') ? 1 : 0;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   232
		$("input[name=delete_confirm]").each(function() {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   233
			 this.checked = (state) ? true : false;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   234
			 Duplicator.rowColor(this);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   235
		});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   236
	});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   237
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   238
	Duplicator.rowColor = function(chk) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   239
		if (chk.checked) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   240
			$(chk).parent().parent().css("text-decoration", "line-through");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   241
		} else {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   242
			$(chk).parent().parent().css("text-decoration", "none");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   243
		}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   244
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   245
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   246
	Duplicator.toggleDetail = function(id) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   247
		$('#' + id).toggle();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   248
		return false;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   249
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   250
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   251
		
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   252
	Duplicator.downloadFile = function(name, button) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   253
		$(button).addClass('dup-button-selected');
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   254
		window.open(name, '_self'); 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   255
		return false;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   256
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   257
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   258
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   259
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   260
	/*  ============================================================================
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   261
	DIALOG: WINDOWS
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   262
	Browser Specific. IE9 does not support modal correctly this is a workaround  */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   263
	Duplicator._dlgCreate = function(evt, ui) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   264
		if (! $.browser.msie) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   265
			$('#' + this.id).dialog('option', 'modal',  	true);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   266
			$('#' + this.id).dialog('option', 'draggable',  true);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   267
		} else {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   268
			$('#' + this.id).dialog('option', 'draggable',  false);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   269
			$('#' + this.id).dialog('option', 'open',  function() {$("div#wpwrap").addClass('ie-simulated-overlay');} );
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   270
		}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   271
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   272
	Duplicator._dlgClose = function(evt, ui) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   273
		if ($.browser.msie) {$("div#wpwrap").removeClass('ie-simulated-overlay');}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   274
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   275
	$("#dialog-options").dialog( {autoOpen:false, height:610, width:750, create:Duplicator._dlgCreate, close:Duplicator._dlgClose });
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   276
	$("#dup-dlg-system-check").dialog({autoOpen:false, height:600, width:700, create:Duplicator._dlgCreate, close:Duplicator._dlgClose, modal: true, buttons: {<?php _e("Cancel", 'wpduplicator') ?>: function() { $(this).dialog("close");}}});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   277
	$("#dup-dlg-system-error").dialog({autoOpen:false, height:550, width:650, create:Duplicator._dlgCreate, close:Duplicator._dlgClose });	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   278
	$("#dup-dlg-quick-path").dialog({autoOpen:false, height:355, width:800, create:Duplicator._dlgCreate, close:Duplicator._dlgClose });	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   279
	$("#dup-dlg-package-confirm").dialog(
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   280
		{autoOpen:false, height:285, width:625, create:Duplicator._dlgCreate, close:Duplicator._dlgClose,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   281
		buttons: {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   282
				"<?php _e('Create Package Set', 'wpduplicator') ?>" : function() {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   283
					$(this).dialog("close");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   284
					Duplicator.processCreateConfirmation(true);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   285
				},
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   286
				Cancel: function() {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   287
					$(this).dialog("close");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   288
					Duplicator.processCreateConfirmation(false);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   289
				}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   290
			}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   291
		}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   292
	);	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   293
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   294
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   295
	/*  ============================================================================
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   296
	DIALOG:	OPTIONS DIALOG 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   297
	Actions that revolve around the options dialog */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   298
	$("#dup-tabs-opts").tabs();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   299
	Duplicator.optionsAppendByPassList = function(path) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   300
		Duplicator.optionsOpen();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   301
		 $('#dir_bypass').append(path + ";");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   302
		 $('#dup-tabs-opts').tabs('option', 'selected', 0);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   303
		 $('#dir_bypass').animate({ borderColor: "blue", borderWidth: 2 }, 3000);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   304
		 $('#dir_bypass').animate({ borderColor: "#dfdfdf", borderWidth: 1  }, 100);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   305
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   306
	Duplicator.optionsOpen  = function() {$("div#dialog-options").dialog("open");}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   307
	Duplicator.optionsClose = function() {$('div#dialog-options').dialog('close');}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   308
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   309
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   310
	/*  ============================================================================
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   311
	DIALOG: SYSTEM-CHECKS
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   312
	Actions that revolve around the systems check dialog */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   313
	Duplicator.showSystemCheck = function(data) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   314
		//Set Pass/Fail Flags
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   315
		for (key in data) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   316
			var html = (data[key] == 'Fail') ? "<div class='dup-sys-fail'>Fail</div>" : "<div class='dup-sys-pass'>Pass</div>";
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   317
			$("#" + key).html(html)
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   318
		}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   319
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   320
		$('#system-check-msg').animate({ scrollTop: $('#system-check-msg').attr("scrollHeight") }, 2000)
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   321
		$("#dup-dlg-system-check").dialog("open");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   322
		Duplicator.setStatus("<?php _e('Ready to create new package.', 'wpduplicator'); ?>");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   323
	}	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   324
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   325
	//Performs the ajax request for a system check
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   326
	Duplicator.getSystemCheck = function() {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   327
		Duplicator.setStatus("<?php _e('Checking System Status.  Please Wait!', 'wpduplicator'); ?>", 'progress');
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   328
		$.ajax({
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   329
			type: "POST",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   330
			url: ajaxurl,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   331
			dataType: "json",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   332
			timeout: 10000000,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   333
			data: "action=duplicator_system_check",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   334
			beforeSend: function() {Duplicator.startAjaxTimer(); },
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   335
			complete: function() {Duplicator.endAjaxTimer(); },			
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   336
			success: function(data) {Duplicator.showSystemCheck(data);},
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   337
			error: function(data)   {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   338
				Duplicator.showSystemError('Duplicator.getSystemCheck', data);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   339
			}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   340
		});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   341
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   342
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   343
	//Show the size and file count of the directory to be zipped
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   344
	Duplicator.getSystemDirectory = function() {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   345
		$.ajax({
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   346
			type: "POST",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   347
			url: ajaxurl,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   348
			dataType: "json",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   349
			timeout: 10000000,
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   350
			data: "action=duplicator_system_directory",
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   351
			beforeSend: function() { 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   352
				Duplicator.startAjaxTimer(); 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   353
				var html = "<?php _e('Scanning Please Wait', 'wpduplicator'); ?>... " + "<img src='<?php echo DUPLICATOR_PLUGIN_URL  ?>img/progress.gif' style='height:7px; width:46px;'  />" ;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   354
				$('#dup-sys-scannow-data, #dup-dlg-package-confirm-scannow-data').html(html);	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   355
			},
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   356
			complete: function() {Duplicator.endAjaxTimer(); },
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   357
			success: function(data) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   358
				var size    =  data.size 	|| "<?php _e('unreadable', 'wpduplicator'); ?>";
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   359
				var count   =  data.count 	|| "<?php _e('unreadable', 'wpduplicator'); ?>";
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   360
				var folders =  data.folders || "<?php _e('unreadable', 'wpduplicator'); ?>";
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   361
				var flag    =  (data.flag || size.indexOf("-") != -1) ? "<?php _e('*Scan Error', 'wpduplicator'); ?>" : "";
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   362
				var html    =  size + " " + count +  " <?php _e('Files', 'wpduplicator'); ?>, " + folders +  " <?php _e('Folders', 'wpduplicator'); ?> " + flag; 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   363
				$('#dup-sys-scannow-data, #dup-dlg-package-confirm-scannow-data').html("<i>" + html + "</i>");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   364
				
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   365
			},
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   366
			error: function(data)   {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   367
				$('#dup-sys-scannow-data, #dup-dlg-package-confirm-scannow-data').html("<?php _e('error scanning directory', 'wpduplicator'); ?>");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   368
				Duplicator.showSystemError('Duplicator.getSystemDirectory', data);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   369
			}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   370
		});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   371
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   372
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   373
	//Toggle the system requirment details
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   374
	Duplicator.showSystemDetails = function() {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   375
		if ($(this).parents('li').children('div.dup-sys-check-data-details').is(":hidden")) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   376
			$(this).children('span').addClass('ui-icon-triangle-1-s').removeClass('ui-icon-triangle-1-e');;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   377
			$(this).parents('li').children('div.dup-sys-check-data-details').show(250);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   378
		} else {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   379
			$(this).children('span').addClass('ui-icon-triangle-1-e').removeClass('ui-icon-triangle-1-s');
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   380
			$(this).parents('li').children('div.dup-sys-check-data-details').hide(250);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   381
		}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   382
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   383
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   384
	//Make the system requirments toggle
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   385
	$('#dup-sys-check-data-reqs a').each(function() {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   386
		$(this).attr('href', 'javascript:void(0)');
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   387
		$(this).click(Duplicator.showSystemDetails);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   388
		$(this).prepend("<span class='ui-icon ui-icon-triangle-1-e dup-toggle' />");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   389
	});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   390
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   391
	/*  ============================================================================
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   392
	DIALOG: QUICK PATH
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   393
	Shows the Quick Path Dialog 'Show Download Links' */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   394
	Duplicator.showQuickPath = function(db, install, pack) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   395
		$("#dup-dlg-quick-path").dialog("open");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   396
		var msg = <?php printf('"%s:\n" + db + "\n\n%s:\n" + install + "\n\n%s:\n" + pack;', 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   397
		__("DATABASE",  'wpduplicator'), 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   398
		__("PACKAGE", 'wpduplicator'), 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   399
		__("INSTALLER",   'wpduplicator')); 
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   400
		?>
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   401
		$("#dup-dlg-quick-path-data").val(msg);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   402
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   403
		return false;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   404
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   405
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   406
	Duplicator.selectQuickPath = function() {$('#dup-dlg-quick-path-data').select();}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   407
	$(".dup-dlg-quick-path-download-link").button({ icons: {primary: "ui-icon-locked"} });
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   408
	$(".dup-dlg-quick-path-database-link").button({ icons: {primary: "ui-icon-script"} });
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   409
	$(".dup-installer-btn").button({ icons: {primary: "ui-icon-disk"} });
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   410
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   411
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   412
	/*  ============================================================================
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   413
	DIALOG: SYSTEM ERROR
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   414
	Show the Sytem Error Dialog */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   415
	Duplicator.showSystemError = function(action, xhrData) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   416
		Duplicator.endAjaxTimer();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   417
		var time = Duplicator.AJAX_TIMER || 'not set';
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   418
		var msg  = '<?php _e('AJAX Response', 'wpduplicator') ?>' + ' ' + action + '<br/>';
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   419
		msg += "duration: " + time + " secs<br/>code: " + xhrData.status + "<br/>status: " + xhrData.statusText + "<br/>response: " +  xhrData.responseText;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   420
		$("#dup-system-err-msg2").html(msg);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   421
		$("#dup-dlg-system-error").dialog("open");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   422
		Duplicator.setStatus("<?php _e('Ready to create new package.', 'wpduplicator'); ?>");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   423
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   424
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   425
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   426
	/*  ============================================================================
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   427
	DIALOG: CREATE PACKAGE CONFIRMATION
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   428
	Show the Create package dialog */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   429
	Duplicator.showCreateConfirmation = function(packname) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   430
		$("#dup-dlg-package-confirm-msg").html(packname);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   431
		$("#dup-dlg-package-confirm").dialog('open');
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   432
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   433
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   434
	Duplicator.processCreateConfirmation = function(result) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   435
		if (result) {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   436
			var msg = "<?php _e('Creating package may take several minutes. Please Wait... ', 'wpduplicator'); ?>";
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   437
			var postmsg = "<?php printf(" &nbsp; <a href='javascript:void(0)' onclick='Duplicator.openLog()'>[%s]</a>", 	__('Preview Log', 'wpduplicator'));?>";
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   438
			Duplicator.setStatus(msg, 'progress', postmsg);
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   439
			Duplicator.createPackage($("input[name=package_name]").val());
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   440
		} else {
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   441
			Duplicator.setStatus("<?php _e('Ready to create new package.', 'wpduplicator') ?>");
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   442
		}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   443
		return result;
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   444
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   445
	
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   446
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   447
	/*  ============================================================================
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   448
	MISC ROUTINES */
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   449
	$("div#div-render-blanket").show();
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   450
	Duplicator.newWindow = function(url) {window.open(url);}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   451
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   452
	Duplicator.openLog = function() { 				
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   453
		window.open('<?php echo DUPLICATOR_PLUGIN_URL .'files/log-view.php'; ?>', 'duplicator_logs');
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   454
	}
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   455
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   456
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   457
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   458
	});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   459
});
c7c0fbc09788 ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   460
</script>