]> git.wh0rd.org Git - tt-rss.git/commitdiff
rework OPML import process
authorAndrew Dolgov <fox@fakecake.org>
Sun, 21 Nov 2010 15:01:14 +0000 (18:01 +0300)
committerAndrew Dolgov <fox@fakecake.org>
Sun, 21 Nov 2010 15:01:14 +0000 (18:01 +0300)
modules/popup-dialog.php
modules/pref-feeds.php
prefs.js
tt-rss.css

index 6717741952bb8059e4b12f5714c4d2298734a37f..ec41ec4ee2d0acfca8e31584c8372b920ea6562b 100644 (file)
@@ -6,10 +6,8 @@
                print "<dlg id=\"$id\">";
 
                if ($id == "importOpml") {
-                       print "<title>".__('OPML Import')."</title>";
-                       print "<content><![CDATA[";
-
-                       print "<div class=\"prefFeedCatHolder\">";
+                       print "<div class=\"prefFeedOPMLHolder\">";
+                       header("Content-Type: text/html"); # required for iframe
 
                        $owner_uid = $_SESSION["uid"];
 
                        print "</div>";
 
                        print "<div align='center'>";
-
-                       print "<button onclick=\"return opmlImportDone()\">".
+                       print "<button dojoType=\"dijit.form.Button\" 
+                               onclick=\"dijit.byId('opmlImportDlg').hide()\">".
                                __('Close this window')."</button>";
-
                        print "</div>";
 
-                       print "<script type=\"text/javascript\">";
-                       print "parent.opmlImportHandler(this)";
-                       print "</script>";
-
                        print "</div>";
-                       print "]]></content>";
 
                        //return;
                }
index 2b279d2d733c70328cd55612a6056b711b95e016..859b11ee948715a87a9195931c42aa00cc753c07 100644 (file)
                        print "</div>";
 
                        print "<div class='dlgButtons'>
-                               <input type=\"submit\" class=\"button\" 
-                               onclick=\"return dijit.byId('feedEditDlg').execute()\" 
-                                       value=\"".__('Save')."\">
-                               <input type='submit' class='button'                     
-                               onclick=\"return dijit.byId('feedEditDlg').hide()\" 
-                                       value=\"".__('Cancel')."\">
+                               <button dojoType=\"dijit.form.Button\" 
+                                       onclick=\"return dijit.byId('feedEditDlg').execute()\">".
+                                       __('Save')."</button>
+                               <button dojoType=\"dijit.form.Button\"
+                               onclick=\"return dijit.byId('feedEditDlg').hide()\">".
+                                       __('Cancel')."</button>
                                </div>";
                
                        return;
 
                print "</p>";
 
-               print "<iframe name=\"upload_iframe\"
+               print "<iframe id=\"upload_iframe\" 
+                       name=\"upload_iframe\" onload=\"opmlImportComplete(this)\"
                        style=\"width: 400px; height: 100px; display: none;\"></iframe>";
 
                print "<form style='display : block' target=\"upload_iframe\"
index 4851611a384e8f9ca724690ad437d3d8e17d2f76..0eb570f5f3d660476582e9618f4c6dda5801faf5 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -782,6 +782,33 @@ function piggie(enable) {
        }
 }
 
+function opmlImportComplete(iframe) {
+       try {
+               if (!iframe.contentDocument.body.innerHTML) return false;
+
+               notify('');
+
+               if (dijit.byId('opmlImportDlg'))
+                       dijit.byId('opmlImportDlg').destroyRecursive();
+
+               var content = iframe.contentDocument.body.innerHTML;
+
+               dialog = new dijit.Dialog({
+                       id: "opmlImportDlg",
+                       title: __("OPML Import"),
+                       style: "width: 600px",
+                       onCancel: function() {
+                               updateFeedList();       
+                       },
+                       content: content});
+
+               dialog.show();
+
+       } catch (e) {
+               exception_error("opmlImportComplete", e);
+       }
+}
+
 function opmlImport() {
        
        var opml_file = $("opml_file");
@@ -1512,22 +1539,6 @@ function activatePrefProfile() {
        return false;
 }
 
-function opmlImportDone() {
-       closeInfoBox();
-       updateFeedList();
-}
-
-function opmlImportHandler(iframe) {
-       try {
-               var tmp = new Object();
-               tmp.responseText = iframe.document.body.innerHTML;
-               notify('');
-               infobox_callback2(tmp);
-       } catch (e) {
-               exception_error("opml_import_handler", e);
-       }
-}
-
 function clearFeedAccessKeys() {
 
        var ok = confirm(__("This will invalidate all previously generated feed URLs. Continue?"));
index 95ba1c654f44ea6b889e1347f156902fd40eb2ff..d6d06a63de9e60745b50dad5e2eff425c0b72c4e 100644 (file)
@@ -408,7 +408,7 @@ table.prefFeedList td.feedSelect {
        text-align : center;
 }
 
-div.prefFeedCatHolder {
+div.prefFeedCatHolder, div.prefFeedOPMLHolder {
        height : 300px;
        overflow : auto;
        border-width : 0px 1px 1px 1px;
@@ -418,6 +418,10 @@ div.prefFeedCatHolder {
        background-color : #ecf4ff;
 }
 
+div.prefFeedOPMLHolder {
+       border-width : 1px 1px 1px 1px;
+}
+
 a.helpLink {
        color : #808080;
 }