File: archive.js.php

package info (click to toggle)
extplorer 2.1.0b6%2Bdfsg.3-4%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,156 kB
  • sloc: php: 14,874; xml: 884; makefile: 124; sh: 35
file content (67 lines) | stat: -rw-r--r-- 1,959 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
// ensure this file is being included by a parent file
if( !defined( '_JEXEC' ) && !defined( '_VALID_MOS' ) ) die( 'Restricted access' );
/**
 * @version $Id: archive.js.php 143 2009-04-01 18:48:16Z soeren $
 * @package eXtplorer
 * @copyright soeren 2007-2009
 * This file is dynamically loaded when something is to be archived
 * It handles the callback to control + show the archive progress
 */
 ?>
 function submitArchiveForm( startfrom, msg ) {
	var form = Ext.getCmp("simpleform").getForm();
	if( startfrom == 0 ) {
		Ext.Msg.show({
			title: 'Please wait',
			msg: msg ? msg : '<?php echo ext_Lang::msg( 'creating_archive', true ) ?>',
			progressText: 'Initializing...',
			width:300,
			progress:true,
			closable:false,
		});
	}
	params = getRequestParams();
	params.action = 'archive',
	params.startfrom = startfrom,
	params.confirm = 'true'
	
	form.submit({
		reset: false,
		success: function(form, action) {
			if( !action.result ) return;

			if( action.result.startfrom > 0 ) {
				submitArchiveForm( action.result.startfrom, action.result.message );

				i = action.result.startfrom/action.result.totalitems;
				Ext.Msg.updateProgress(i, action.result.startfrom + " of "+action.result.totalitems + " (" + Math.round(100*i)+'% completed)');

				return
			} else {

				if( form.findField('download').getValue() ) {
					datastore.reload();
					Ext.getCmp("dialog").destroy();
					Ext.Msg.hide();
					location.href = action.result.newlocation;
					
				} else {
					Ext.Msg.alert('<?php echo ext_Lang::msg('success', true) ?>!', action.result.message);
					datastore.reload();
					Ext.Msg.hide();
					Ext.getCmp("dialog").destroy();
				}
				return;
			}
		},
		failure: function(form, action) {
			if( action.result ) {
				Ext.Msg.alert('<?php echo ext_Lang::err('error', true) ?>', action.result.error);
			}
		},
		scope: form,
		
		params: params
	});
}