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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
function exportData() {
try {
var query = "backend.php?op=pluginhandler&plugin=import_export&method=exportData";
if (dijit.byId("dataExportDlg"))
dijit.byId("dataExportDlg").destroyRecursive();
var exported = 0;
dialog = new dijit.Dialog({
id: "dataExportDlg",
title: __("Export Data"),
style: "width: 600px",
prepare: function() {
notify_progress("Loading, please wait...");
new Ajax.Request("backend.php", {
parameters: "op=pluginhandler&plugin=import_export&method=exportrun&offset=" + exported,
onComplete: function(transport) {
try {
var rv = JSON.parse(transport.responseText);
if (rv && rv.exported != undefined) {
if (rv.exported > 0) {
exported += rv.exported;
$("export_status_message").innerHTML =
"<img src='images/indicator_tiny.gif'> " +
"Exported %d articles, please wait...".replace("%d",
exported);
setTimeout('dijit.byId("dataExportDlg").prepare()', 2000);
} else {
$("export_status_message").innerHTML =
ngettext("Finished, exported %d article. You can download the data <a class='visibleLink' href='%u'>here</a>.", "Finished, exported %d articles. You can download the data <a class='visibleLink' href='%u'>here</a>.", exported)
.replace("%d", exported)
.replace("%u", "backend.php?op=pluginhandler&plugin=import_export&subop=exportget");
exported = 0;
}
} else {
$("export_status_message").innerHTML =
"Error occured, could not export data.";
}
} catch (e) {
exception_error("exportData", e, transport.responseText);
}
notify('');
} });
},
execute: function() {
if (this.validate()) {
}
},
href: query});
dialog.show();
} catch (e) {
exception_error("exportData", e);
}
}
function dataImportComplete(iframe) {
try {
if (!iframe.contentDocument.body.innerHTML) return false;
Element.hide(iframe);
notify('');
if (dijit.byId('dataImportDlg'))
dijit.byId('dataImportDlg').destroyRecursive();
var content = iframe.contentDocument.body.innerHTML;
dialog = new dijit.Dialog({
id: "dataImportDlg",
title: __("Data Import"),
style: "width: 600px",
onCancel: function() {
},
content: content});
dialog.show();
} catch (e) {
exception_error("dataImportComplete", e);
}
}
function importData() {
var file = $("export_file");
if (file.value.length == 0) {
alert(__("Please choose the file first."));
return false;
} else {
notify_progress("Importing, please wait...", true);
Element.show("data_upload_iframe");
return true;
}
}
|