Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/grid.js =================================================================== diff -u -r7027 -r7071 --- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/grid.js (.../grid.js) (revision 7027) +++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/grid.js (.../grid.js) (revision 7071) @@ -164,18 +164,11 @@ if (typeof (this.Grid.OnUnSelect) == 'function' ) { this.Grid.OnUnSelect(this.ItemId); } + this.Grid.LastSelectedId = null; } GridItem.prototype.ClearBrowserSelection = function() { - if (window.getSelection) { - // removeAllRanges will be supported by Opera from v 9+, do nothing by now - var selection = window.getSelection(); - if (selection.removeAllRanges) { // Mozilla & Opera 9+ - window.getSelection().removeAllRanges(); - } - } else if (document.selection && !is.opera) { // IE - document.selection.empty(); - } + ClearBrowserSelection(); } GridItem.prototype.Click = function (ev) @@ -184,6 +177,7 @@ this.Grid.ClearAlternativeGridsSelection('GridItem.Click'); var e = !is.ie ? ev : window.event; + if (e.shiftKey && !this.Grid.RadioMode) { this.Grid.SelectRangeUpTo(this.sequence); } @@ -194,7 +188,14 @@ else { if (!(this.Grid.RadioMode && this.Grid.LastSelectedId == this.ItemId && this.selected)) { // don't clear selection if item same as current is selected - this.Grid.ClearSelection(null,'GridItem.Click'); + if (!this.Grid.StickySelection) { + this.Grid.ClearSelection(null,'GridItem.Click'); + } + else { + if (this.Grid.LastSelectedId == this.ItemId) { + return; + } + } this.Toggle(); } } @@ -250,6 +251,10 @@ this.AlternativeGrids = new Array(); this.DependantButtons = new Array(); this.RadioMode = false; + + // K3-style sticky selection, selection an item does not unselect currently selected + // even w/o Ctrl key pressed + this.StickySelection = false; } Grid.prototype.AddItem = function( an_item ) { @@ -280,6 +285,33 @@ this.Items[i].Init(); } this.ClearSelection( true,'Grid.InitItems' ); + + var a_Grid = this; + addEvent(document, 'keyup', function(ev) { + var e = !is.ie ? ev : window.event; + switch (e.keyCode) { + case 65: +// if (e.ctrlKey) alert('Ctrl A'); + a_Grid.SelectAll(); + ClearBrowserSelection() +// window.setTimeout(ClearBrowserSelection, 500); + break; + case 27: + a_Grid.ClearSelection(); + break; + case 33: + case 37: + //alert('<-') // go to prev page here + break; + case 34: + case 39: + // alert('->') // go to next page here + break; + case 88: + ClearBrowserSelection(); + break; + } + }); } Grid.prototype.DisableClicking = function() {