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) { checkItemAcceptance: function(target, source, position) {
var item = dijit.getEnclosingWidget(target).item; 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); var id = String(item.id);
return (id.match("CAT:") || position != "over"); var source_id = String(source_item.id);
return true;
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

@ -106,7 +106,8 @@ dojo.declare( "lib.CheckBoxStoreModel", dijit.tree.TreeStoreModel,
var currState = undefined; var currState = undefined;
// Special handling required for the 'fake' root entry (the root is NOT a dojo.data.item). // 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" ) { if( typeof(storeItem.checkbox) == "undefined" ) {
this.root.checkbox = undefined; // create a new checbox reference as undefined. this.root.checkbox = undefined; // create a new checbox reference as undefined.
if( this.checkboxRoot ) { if( this.checkboxRoot ) {
@ -121,7 +122,14 @@ dojo.declare( "lib.CheckBoxStoreModel", dijit.tree.TreeStoreModel,
this._setCheckboxState( storeItem, this.checkboxState ); this._setCheckboxState( storeItem, this.checkboxState );
currState = 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) return currState // the current state of the checkbox (true/false or undefined)
}, },

View File

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

View File

@ -323,8 +323,6 @@ function editUser(id, event) {
try { try {
if (!event || !event.ctrlKey) { if (!event || !event.ctrlKey) {
disableHotkeys();
notify_progress("Loading, please wait..."); notify_progress("Loading, please wait...");
selectTableRows('prefUserList', 'none'); selectTableRows('prefUserList', 'none');
@ -358,8 +356,6 @@ function editFilter(id, event) {
if (!event || !event.ctrlKey) { if (!event || !event.ctrlKey) {
disableHotkeys();
notify_progress("Loading, please wait..."); notify_progress("Loading, please wait...");
selectTableRows('prefFilterList', 'none'); selectTableRows('prefFilterList', 'none');
@ -391,8 +387,6 @@ function editFeed(feed, event) {
if (event && !event.ctrlKey) { if (event && !event.ctrlKey) {
disableHotkeys();
notify_progress("Loading, please wait..."); notify_progress("Loading, please wait...");
// selectTableRows('prefFeedList', 'none'); // selectTableRows('prefFeedList', 'none');
@ -963,8 +957,6 @@ function editSelectedFeeds() {
notify(""); notify("");
disableHotkeys();
notify_progress("Loading, please wait..."); notify_progress("Loading, please wait...");
var query = "?op=pref-feeds&subop=editfeeds&ids=" + 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 == 16) return; // ignore lone shift
if (keycode == 17) return; // ignore lone ctrl
if ((keycode == 67 || keycode == 71) && !hotkey_prefix) { if ((keycode == 67 || keycode == 71) && !hotkey_prefix) {
hotkey_prefix = keycode; hotkey_prefix = keycode;

View File

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