assorted DnD and pref layout fixes

This commit is contained in:
Andrew Dolgov 2010-11-18 10:15:14 +03:00
parent 2148e0d5cc
commit 49c6c279ab
5 changed files with 47 additions and 17 deletions

View file

@ -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"));
}
},
});

View file

@ -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)
},

View file

@ -967,8 +967,12 @@
if ($num_errors > 0) {
print format_notice("<a href=\"javascript:showFeedsWithErrors()\">".
__('Some feeds have update errors (click for details)')."</a>");
$error_button = "<button dojoType=\"dijit.form.Button\"
onclick=\"showFeedsWithErrors\" id=\"errorButton\">" .
__("Feeds with errors") . "</button>";
// print format_notice("<a href=\"javascript:showFeedsWithErrors()\">".
// __('Some feeds have update errors (click for details)')."</a>");
}
$feed_search = db_escape_string($_REQUEST["search"]);
@ -1012,6 +1016,8 @@
__('Edit categories')."</button dojoType=\"dijit.form.Button\"> ";
}
print $error_button;
print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedFeeds()\">"
.__('Unsubscribe')."</button dojoType=\"dijit.form.Button\"> ";

View file

@ -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;

View file

@ -1559,4 +1559,6 @@ div#pref-tabs .dijitContentPane h3 {
border-width : 0px;
}
#errorButton {
color : red;
}