diff --git a/FeedTree.js b/FeedTree.js index 18112f6b..93ccf002 100644 --- a/FeedTree.js +++ b/FeedTree.js @@ -107,7 +107,7 @@ dojo.declare("fox.FeedTree", dijit.Tree, { menu.addChild(new dijit.MenuItem({ label: __("Edit feed"), onClick: function() { - editFeedDlg(this.getParent().row_id); + editFeed(this.getParent().row_id); }})); menu.addChild(new dijit.MenuItem({ diff --git a/functions.js b/functions.js index 946e29a9..5e315612 100644 --- a/functions.js +++ b/functions.js @@ -1330,7 +1330,7 @@ function has_local_storage() { function catSelectOnChange(elem) { try { - var value = elem[elem.selectedIndex].value; +/* var value = elem[elem.selectedIndex].value; var def = elem.getAttribute('default'); if (value == "ADD_CAT") { @@ -1341,7 +1341,7 @@ function catSelectOnChange(elem) { elem.selectedIndex = 0; quickAddCat(elem); - } + } */ } catch (e) { exception_error("catSelectOnChange", e); @@ -1563,3 +1563,47 @@ function getSelectedTableRowIds(id) { return rows; } +function editFeed(feed, event) { + + try { + var query = "backend.php?op=pref-feeds&subop=editfeed&id=" + + param_escape(feed); + + console.log(query); + + if (dijit.byId("feedEditDlg")) + dijit.byId("feedEditDlg").destroyRecursive(); + + dialog = new dijit.Dialog({ + id: "feedEditDlg", + title: __("Edit Feed"), + style: "width: 600px", + execute: function() { + if (this.validate()) { + console.log(dojo.objectToQuery(this.attr('value'))); + + notify_progress("Saving data...", true); + + new Ajax.Request("backend.php", { + parameters: dojo.objectToQuery(dialog.attr('value')), + onComplete: function(transport) { + dialog.hide(); + if (inPreferences()) { + updateFeedList(); + } else { + notify(''); + dlg_frefresh_callback(transport); + } + }}) + } + }, + href: query}); + + dialog.show(); + + } catch (e) { + exception_error("editFeed", e); + } +} + + diff --git a/functions.php b/functions.php index 2dcf5d3f..3f18392a 100644 --- a/functions.php +++ b/functions.php @@ -2998,7 +2998,7 @@ $line["id"], htmlspecialchars($line["title"])); } - print ""; +# print ""; print ""; } diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index 0596fc07..698aa152 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -245,11 +245,6 @@ } if ($subop == "editfeed") { - header("Content-Type: text/xml"); - - print ""; - print "".__('Feed Editor').""; - print " 0) { - $feed_icon = ""; - } else { - $feed_icon = ""; - } - - print "
"; - - print ""; - print ""; - print ""; + print ""; + print ""; + print ""; print "
".__("Feed")."
"; print "
"; /* Title */ - print ""; + print ""; /* Feed URL */ @@ -292,7 +276,8 @@ print "
"; print __('URL:') . " "; - print ""; /* Category */ @@ -305,7 +290,8 @@ print __('Place in category:') . " "; - print_feed_cat_select($link, "cat_id", $cat_id, $disabled); + print_feed_cat_select($link, "cat_id", $cat_id, + 'dojoType="dijit.form.Select"'); } print "
"; @@ -317,14 +303,17 @@ $update_interval = db_fetch_result($result, 0, "update_interval"); - print_select_hash("update_interval", $update_interval, $update_intervals); + print_select_hash("update_interval", $update_interval, $update_intervals, + 'dojoType="dijit.form.Select"'); /* Update method */ - $update_method = db_fetch_result($result, 0, "update_method"); + $update_method = db_fetch_result($result, 0, "update_method", + 'dojoType="dijit.form.Select"'); print " " . __('using') . " "; - print_select_hash("update_method", $update_method, $update_methods); + print_select_hash("update_method", $update_method, $update_methods, + 'dojoType="dijit.form.Select"'); $purge_interval = db_fetch_result($result, 0, "purge_interval"); @@ -336,7 +325,8 @@ print __('Article purging:') . " "; - print_select_hash("purge_interval", $purge_interval, $purge_intervals); + print_select_hash("purge_interval", $purge_interval, $purge_intervals, + 'dojoType="dijit.form.Select"'); } else { print ""; @@ -353,15 +343,14 @@ print "" . __('Login:') . ""; - print ""; print "" . __("Password:") . ""; $auth_pass = htmlspecialchars(db_fetch_result($result, 0, "auth_pass")); - print ""; print ""; @@ -370,39 +359,39 @@ print "
".__("Options")."
"; print "
"; - print "
"; +# print "
"; $private = sql_bool_to_bool(db_fetch_result($result, 0, "private")); if ($private) { - $checked = "checked"; + $checked = "checked=\"1\""; } else { $checked = ""; } - print " "; $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content")); if ($rtl_content) { - $checked = "checked"; + $checked = "checked=\"1\""; } else { $checked = ""; } - print "
 "; $include_in_digest = sql_bool_to_bool(db_fetch_result($result, 0, "include_in_digest")); if ($include_in_digest) { - $checked = "checked"; + $checked = "checked=\"1\""; } else { $checked = ""; } - print "
 "; @@ -415,7 +404,7 @@ $checked = ""; } - print "
 "; @@ -423,21 +412,19 @@ $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images")); if ($cache_images) { - $checked = "checked"; + $checked = "checked=\"1\""; } else { $checked = ""; } - print "
 "; +# print "
"; print "
"; - print "
"; - - print "
"; /* Icon */ @@ -456,9 +443,9 @@ - - "; @@ -468,14 +455,12 @@ print "
-
- - -
"; - - print "]]>
"; + + + "; return; } diff --git a/prefs.js b/prefs.js index 14af5b60..5ca4e333 100644 --- a/prefs.js +++ b/prefs.js @@ -347,39 +347,6 @@ function editFilter(id, event) { } } -function editFeed(feed, event) { - - try { - - if (event && !event.ctrlKey) { - - notify_progress("Loading, please wait..."); - -// selectTableRows('prefFeedList', 'none'); -// selectTableRowById('FEEDR-'+feed, 'FRCHK-'+feed, true); - - var query = "?op=pref-feeds&subop=editfeed&id=" + - param_escape(feed); - - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - infobox_callback2(transport); - document.forms["edit_feed_form"].title.focus(); - } }); - - } else if (event.ctrlKey) { -// var cb = $('FRCHK-' + feed); -// cb.checked = !cb.checked; -// toggleSelectRow(cb); - } - - - } catch (e) { - exception_error("editFeed", e); - } -} - function getSelectedLabels() { var tree = dijit.byId("labelTree"); var items = tree.model.getCheckedItems(); @@ -679,36 +646,6 @@ function removeSelectedFeedCats() { return false; } -function feedEditCancel() { - closeInfoBox(); - return false; -} - -function feedEditSave() { - - try { - - // FIXME: add parameter validation - - var query = Form.serialize("edit_feed_form"); - - notify_progress("Saving feed..."); - - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - feedlist_callback2(transport); - } }); - - closeInfoBox(); - - return false; - - } catch (e) { - exception_error("feedEditSave", e); - } -} - function userEditCancel() { closeInfoBox(); return false; @@ -1080,6 +1017,7 @@ function init() { dojo.require("dijit.form.Select"); dojo.require("dijit.form.FilteringSelect"); dojo.require("dijit.form.TextBox"); + dojo.require("dijit.form.CheckBox"); dojo.require("dijit.form.ValidationTextBox"); dojo.require("dijit.form.RadioButton"); dojo.require("dijit.form.Select"); diff --git a/tt-rss.js b/tt-rss.js index 5409fe89..1559530b 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -279,6 +279,7 @@ function init() { dojo.require("dijit.form.TextBox"); dojo.require("dijit.form.ValidationTextBox"); dojo.require("dijit.form.FilteringSelect"); + dojo.require("dijit.form.CheckBox"); dojo.require("dijit.Toolbar"); dojo.require("dijit.ProgressBar"); dojo.require("dijit.Menu"); @@ -375,7 +376,7 @@ function quickMenuGo(opid) { } if (opid == "qmcEditFeed") { - editFeedDlg(getActiveFeedId()); + editFeed(getActiveFeedId()); } if (opid == "qmcRemoveFeed") { @@ -530,77 +531,6 @@ function catchupFeedInGroup(id) { } } -function editFeedDlg(feed) { - try { - - if (!feed) { - alert(__("Please select some feed first.")); - return; - } - - if ((feed <= 0) || activeFeedIsCat()) { - alert(__("You can't edit this kind of feed.")); - return; - } - - var query = ""; - - if (feed > 0) { - query = "?op=pref-feeds&subop=editfeed&id=" + param_escape(feed); - } else { - query = "?op=pref-labels&subop=edit&id=" + param_escape(-feed-11); - } - - disableHotkeys(); - - notify_progress("Loading, please wait...", true); - - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - infobox_callback2(transport); - document.forms["edit_feed_form"].title.focus(); - } }); - - } catch (e) { - exception_error("editFeedDlg", e); - } -} - -/* this functions duplicate those of prefs.js feed editor, with - some differences because there is no feedlist */ - -function feedEditCancel() { - closeInfoBox(); - return false; -} - -function feedEditSave() { - - try { - - // FIXME: add parameter validation - - var query = Form.serialize("edit_feed_form"); - - notify_progress("Saving feed..."); - - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - dlg_frefresh_callback(transport); - } }); - - cache_flush(); - closeInfoBox(); - - return false; - - } catch (e) { - exception_error("feedEditSave (main)", e); - } -} - function collapse_feedlist() { try { @@ -913,7 +843,7 @@ function hotkey_handler(e) { } if (keycode == 69) { // e - editFeedDlg(getActiveFeedId()); + editFeed(getActiveFeedId()); return false; }