]> git.wh0rd.org - tt-rss.git/blobdiff - classes/dlg.php
implement experimental personal data import
[tt-rss.git] / classes / dlg.php
index 33295b9041f54b90df2f7aa53e567b5c5aa2bc3f..55eb5e37e0a2223fba2f7e2eb8eb3fb870036ee1 100644 (file)
@@ -16,9 +16,29 @@ class Dlg extends Protected_Handler {
                print "</dlg>";
        }
 
+       function exportData() {
+
+               print "<p style='text-align : center' id='export_status_message'>You need to prepare exported data first by clicking the button below.</p>";
+
+               print "<div align='center'>";
+               print "<button dojoType=\"dijit.form.Button\"
+                       onclick=\"dijit.byId('dataExportDlg').prepare()\">".
+                       __('Prepare data')."</button>";
+
+               print "<button dojoType=\"dijit.form.Button\"
+                       onclick=\"dijit.byId('dataExportDlg').hide()\">".
+                       __('Close this window')."</button>";
+
+               print "</div>";
+
+
+       }
+
        function importOpml() {
                header("Content-Type: text/html"); # required for iframe
 
+               print __("If you have imported labels and/or filters, you might need to reload preferences to see your new data.") . "</p>";
+
                print "<div class=\"prefFeedOPMLHolder\">";
                $owner_uid = $_SESSION["uid"];
 
@@ -41,7 +61,6 @@ class Dlg extends Protected_Handler {
                /* Handle OPML import by DOMXML/DOMDocument */
 
                print "<ul class='nomarks'>";
-               print "<li>".__("Importing using DOMDocument.")."</li>";
                require_once "opml.php";
                opml_import_domdoc($this->link, $owner_uid);
                print "</ul>";
@@ -49,7 +68,7 @@ class Dlg extends Protected_Handler {
 
                print "<div align='center'>";
                print "<button dojoType=\"dijit.form.Button\"
-                       onclick=\"dijit.byId('opmlImportDlg').hide()\">".
+                       onclick=\"dijit.byId('opmlImportDlg').execute()\">".
                        __('Close this window')."</button>";
                print "</div>";
 
@@ -462,8 +481,16 @@ class Dlg extends Protected_Handler {
                print "<hr/>";
 
                print __("in") . " ";
+
+               print "<span id='filterDlg_feeds'>";
                print_feed_select($this->link, "feed_id", $active_feed_id,
                        'dojoType="dijit.form.FilteringSelect"');
+               print "</span>";
+
+               print "<span id='filterDlg_cats' style='display : none'>";
+               print_feed_cat_select($this->link, "cat_id", $active_cat_id,
+                       'dojoType="dijit.form.FilteringSelect"');
+               print "</span>";
 
                print "</div>";
 
@@ -505,7 +532,11 @@ class Dlg extends Protected_Handler {
                                <label for=\"enabled\">".__('Enabled')."</label><hr/>";
 
                print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\">
-                       <label for=\"inverse\">".__('Inverse match')."</label>";
+                       <label for=\"inverse\">".__('Inverse match')."</label><hr/>";
+
+               print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"cat_filter\" id=\"cat_filter\" onchange=\"filterDlgCheckCat(this)\">
+                               <label for=\"cat_filter\">".__('Apply to category')."</label><hr/>";
+
 
                print "</div>";
 
@@ -923,5 +954,28 @@ class Dlg extends Protected_Handler {
                return;
        }
 
+       function dataImport() {
+               header("Content-Type: text/html"); # required for iframe
+
+               print "<div style='text-align : center'>";
+
+               if (is_file($_FILES['export_file']['tmp_name'])) {
+
+                       perform_data_import($this->link, $_FILES['export_file']['tmp_name'], $_SESSION['uid']);
+
+               } else {
+                       print "<p>" . T_sprintf("Could not upload file. You might need to adjust upload_max_filesize
+                               in PHP.ini (current value = %s)", ini_get("upload_max_filesize")) . " or use CLI import tool.</p>";
+
+               }
+
+               print "<button dojoType=\"dijit.form.Button\"
+                       onclick=\"dijit.byId('dataImportDlg').hide()\">".
+                       __('Close this window')."</button>";
+
+               print "</div>";
+
+       }
+
 }
 ?>