rework OPML import process

master
Andrew Dolgov 14 years ago
parent 9fe80bcdad
commit e121848048

@ -6,10 +6,8 @@
print "<dlg id=\"$id\">"; print "<dlg id=\"$id\">";
if ($id == "importOpml") { if ($id == "importOpml") {
print "<title>".__('OPML Import')."</title>"; print "<div class=\"prefFeedOPMLHolder\">";
print "<content><![CDATA["; header("Content-Type: text/html"); # required for iframe
print "<div class=\"prefFeedCatHolder\">";
$owner_uid = $_SESSION["uid"]; $owner_uid = $_SESSION["uid"];
@ -50,18 +48,12 @@
print "</div>"; print "</div>";
print "<div align='center'>"; print "<div align='center'>";
print "<button dojoType=\"dijit.form.Button\"
print "<button onclick=\"return opmlImportDone()\">". onclick=\"dijit.byId('opmlImportDlg').hide()\">".
__('Close this window')."</button>"; __('Close this window')."</button>";
print "</div>"; print "</div>";
print "<script type=\"text/javascript\">";
print "parent.opmlImportHandler(this)";
print "</script>";
print "</div>"; print "</div>";
print "]]></content>";
//return; //return;
} }

@ -601,12 +601,12 @@
print "</div>"; print "</div>";
print "<div class='dlgButtons'> print "<div class='dlgButtons'>
<input type=\"submit\" class=\"button\" <button dojoType=\"dijit.form.Button\"
onclick=\"return dijit.byId('feedEditDlg').execute()\" onclick=\"return dijit.byId('feedEditDlg').execute()\">".
value=\"".__('Save')."\"> __('Save')."</button>
<input type='submit' class='button' <button dojoType=\"dijit.form.Button\"
onclick=\"return dijit.byId('feedEditDlg').hide()\" onclick=\"return dijit.byId('feedEditDlg').hide()\">".
value=\"".__('Cancel')."\"> __('Cancel')."</button>
</div>"; </div>";
return; return;
@ -1246,7 +1246,8 @@
print "</p>"; 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>"; style=\"width: 400px; height: 100px; display: none;\"></iframe>";
print "<form style='display : block' target=\"upload_iframe\" print "<form style='display : block' target=\"upload_iframe\"

@ -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() { function opmlImport() {
var opml_file = $("opml_file"); var opml_file = $("opml_file");
@ -1512,22 +1539,6 @@ function activatePrefProfile() {
return false; 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() { function clearFeedAccessKeys() {
var ok = confirm(__("This will invalidate all previously generated feed URLs. Continue?")); var ok = confirm(__("This will invalidate all previously generated feed URLs. Continue?"));

@ -408,7 +408,7 @@ table.prefFeedList td.feedSelect {
text-align : center; text-align : center;
} }
div.prefFeedCatHolder { div.prefFeedCatHolder, div.prefFeedOPMLHolder {
height : 300px; height : 300px;
overflow : auto; overflow : auto;
border-width : 0px 1px 1px 1px; border-width : 0px 1px 1px 1px;
@ -418,6 +418,10 @@ div.prefFeedCatHolder {
background-color : #ecf4ff; background-color : #ecf4ff;
} }
div.prefFeedOPMLHolder {
border-width : 1px 1px 1px 1px;
}
a.helpLink { a.helpLink {
color : #808080; color : #808080;
} }

Loading…
Cancel
Save