]>
git.wh0rd.org - tt-rss.git/blob - plugins/import_export/import_export.js
1 function exportData () {
4 var query
= "backend.php?op=pluginhandler&plugin=import_export&method=exportData" ;
6 if ( dijit
. byId ( "dataExportDlg" ))
7 dijit
. byId ( "dataExportDlg" ). destroyRecursive ();
11 dialog
= new dijit
. Dialog ({
13 title
: __ ( "Export Data" ),
14 style
: "width: 600px" ,
17 notify_progress ( "Loading, please wait..." );
19 new Ajax
. Request ( "backend.php" , {
20 parameters
: "op=pluginhandler&plugin=import_export&method=exportrun&offset=" + exported
,
21 onComplete : function ( transport
) {
23 var rv
= JSON
. parse ( transport
. responseText
);
25 if ( rv
&& rv
. exported
!= undefined ) {
26 if ( rv
. exported
> 0 ) {
28 exported
+= rv
. exported
;
30 $( "export_status_message" ). innerHTML
=
31 "<img src='images/indicator_tiny.gif'> " +
32 "Exported %d articles, please wait..." . replace ( "%d" ,
35 setTimeout ( 'dijit.byId("dataExportDlg").prepare()' , 2000 );
39 $( "export_status_message" ). innerHTML
=
40 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
)
41 . replace ( "%d" , exported
)
42 . replace ( "%u" , "backend.php?op=pluginhandler&plugin=import_export&subop=exportget" );
49 $( "export_status_message" ). innerHTML
=
50 "Error occured, could not export data." ;
53 exception_error ( "exportData" , e
, transport
. responseText
);
62 if ( this . validate ()) {
74 exception_error ( "exportData" , e
);
78 function dataImportComplete ( iframe
) {
80 if (! iframe
. contentDocument
. body
. innerHTML
) return false ;
86 if ( dijit
. byId ( 'dataImportDlg' ))
87 dijit
. byId ( 'dataImportDlg' ). destroyRecursive ();
89 var content
= iframe
. contentDocument
. body
. innerHTML
;
91 dialog
= new dijit
. Dialog ({
93 title
: __ ( "Data Import" ),
94 style
: "width: 600px" ,
95 onCancel : function () {
103 exception_error ( "dataImportComplete" , e
);
107 function importData () {
109 var file
= $( "export_file" );
111 if ( file
. value
. length
== 0 ) {
112 alert ( __ ( "Please choose the file first." ));
115 notify_progress ( "Importing, please wait..." , true );
117 Element
. show ( "data_upload_iframe" );