From 49c6c279ab7dd42fe972225c50622ed263f81e7b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 18 Nov 2010 10:15:14 +0300 Subject: [PATCH] assorted DnD and pref layout fixes --- PrefFeedTree.js | 29 +++++++++++++++++++++++++---- lib/CheckBoxTree.js | 12 ++++++++++-- modules/pref-feeds.php | 10 ++++++++-- prefs.js | 9 +-------- tt-rss.css | 4 +++- 5 files changed, 47 insertions(+), 17 deletions(-) diff --git a/PrefFeedTree.js b/PrefFeedTree.js index f8d1e7b15..026e5d489 100644 --- a/PrefFeedTree.js +++ b/PrefFeedTree.js @@ -6,11 +6,32 @@ dojo.declare("fox.PrefFeedTree", lib.CheckBoxTree, { checkItemAcceptance: function(target, source, position) { var item = dijit.getEnclosingWidget(target).item; - console.log(source.currentWidget); - + // disable copying items + source.copyState = function() { return false; } + + var source_item = false; + + source.forInSelectedItems(function(node) { + source_item = node.data.item; + }); + + if (!source_item || !item) return false; + var id = String(item.id); - return (id.match("CAT:") || position != "over"); - return true; + var source_id = String(source_item.id); + + var id = this.tree.model.store.getValue(item, 'id'); + var source_id = source.tree.model.store.getValue(source_item, 'id'); + + //console.log(id + " " + position + " " + source_id); + + if (source_id.match("FEED:")) { + return ((id.match("CAT:") && position == "over") || + (id.match("FEED:") && position != "over")); + } else if (source_id.match("CAT:")) { + return ((id.match("CAT:") && position != "over") || + (id.match("root") && position == "over")); + } }, }); diff --git a/lib/CheckBoxTree.js b/lib/CheckBoxTree.js index 35e7039ba..fb532801c 100644 --- a/lib/CheckBoxTree.js +++ b/lib/CheckBoxTree.js @@ -104,9 +104,10 @@ dojo.declare( "lib.CheckBoxStoreModel", dijit.tree.TreeStoreModel, // | var currState = model.getCheckboxState(item); // var currState = undefined; - + // Special handling required for the 'fake' root entry (the root is NOT a dojo.data.item). - if ( storeItem == this.root ) { + // this stuff is only relevant for Forest store -fox +/* if ( storeItem == this.root ) { if( typeof(storeItem.checkbox) == "undefined" ) { this.root.checkbox = undefined; // create a new checbox reference as undefined. if( this.checkboxRoot ) { @@ -121,7 +122,14 @@ dojo.declare( "lib.CheckBoxStoreModel", dijit.tree.TreeStoreModel, this._setCheckboxState( storeItem, this.checkboxState ); currState = this.checkboxState; } + } */ + + currState = this.store.getValue(storeItem, this.checkboxIdent); + if( currState == undefined && this.checkboxAll) { + this._setCheckboxState( storeItem, this.checkboxState ); + currState = this.checkboxState; } + return currState // the current state of the checkbox (true/false or undefined) }, diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index 10b7462ec..3eb3c4621 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -967,8 +967,12 @@ if ($num_errors > 0) { - print format_notice("". - __('Some feeds have update errors (click for details)').""); + $error_button = ""; + +// print format_notice("". +// __('Some feeds have update errors (click for details)').""); } $feed_search = db_escape_string($_REQUEST["search"]); @@ -1012,6 +1016,8 @@ __('Edit categories')." "; } + print $error_button; + print " "; diff --git a/prefs.js b/prefs.js index 42f51087d..556c71dbb 100644 --- a/prefs.js +++ b/prefs.js @@ -323,8 +323,6 @@ function editUser(id, event) { try { if (!event || !event.ctrlKey) { - disableHotkeys(); - notify_progress("Loading, please wait..."); selectTableRows('prefUserList', 'none'); @@ -358,8 +356,6 @@ function editFilter(id, event) { if (!event || !event.ctrlKey) { - disableHotkeys(); - notify_progress("Loading, please wait..."); selectTableRows('prefFilterList', 'none'); @@ -391,8 +387,6 @@ function editFeed(feed, event) { if (event && !event.ctrlKey) { - disableHotkeys(); - notify_progress("Loading, please wait..."); // selectTableRows('prefFeedList', 'none'); @@ -963,8 +957,6 @@ function editSelectedFeeds() { notify(""); - disableHotkeys(); - notify_progress("Loading, please wait..."); var query = "?op=pref-feeds&subop=editfeeds&ids=" + @@ -1271,6 +1263,7 @@ function pref_hotkey_handler(e) { } if (keycode == 16) return; // ignore lone shift + if (keycode == 17) return; // ignore lone ctrl if ((keycode == 67 || keycode == 71) && !hotkey_prefix) { hotkey_prefix = keycode; diff --git a/tt-rss.css b/tt-rss.css index b1d3ea582..4cab27e9f 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -1559,4 +1559,6 @@ div#pref-tabs .dijitContentPane h3 { border-width : 0px; } - +#errorButton { + color : red; +}