Index: trunk/kernel/admin_templates/incs/grid.js =================================================================== diff -u -r5104 -r5257 --- trunk/kernel/admin_templates/incs/grid.js (.../grid.js) (revision 5104) +++ trunk/kernel/admin_templates/incs/grid.js (.../grid.js) (revision 5257) @@ -5,22 +5,22 @@ this.AlternativeGrids = new Array(); } -GridManager.prototype.AddAlternativeGrid = function ($source_grid, $destination_grid, $reciprocal) +GridManager.prototype.AddAlternativeGrid = function ($source_grid, $destination_grid, $reciprocal) { if ($source_grid == $destination_grid) { return false; } - + if (typeof(this.AlternativeGrids[$source_grid]) == 'undefined') { // alternative grids not found, create empty list this.AlternativeGrids[$source_grid] = new Array(); } - + if (!in_array($destination_grid, this.AlternativeGrids[$source_grid])) { // alternative grids found, check if not added already this.AlternativeGrids[$source_grid].push($destination_grid); } - + if ($reciprocal) { this.AddAlternativeGrid($destination_grid, $source_grid); } @@ -29,7 +29,7 @@ GridManager.prototype.ClearAlternativeGridsSelection = function ($source_prefix) { if (!this.AlternativeGrids[$source_prefix]) return false; - + var $i = 0; var $destination_prefix = ''; while ($i < this.AlternativeGrids[$source_prefix].length) { @@ -49,20 +49,20 @@ this.id = an_element.id; this.ItemId = item_id; this.sequence = parseInt(an_element.getAttribute('sequence')); - this.class_on = class_on; + this.class_on = class_on; if (class_off == ':original') { this.class_off = an_element.className; } else this.class_off = class_off; this.HTMLelement = an_element; this.CheckBox = cb; - + this.value = this.ItemId; this.ItemType = 11; } -GridItem.prototype.Init = function () +GridItem.prototype.Init = function () { this.HTMLelement.GridItem = this; this.HTMLelement.onclick = function(ev) { @@ -82,7 +82,7 @@ } } -GridItem.prototype.DisableClicking = function () +GridItem.prototype.DisableClicking = function () { this.HTMLelement.onclick = function(ev) { return false; @@ -107,9 +107,12 @@ } this.Grid.LastSelectedId = this.ItemId; this.Grid.SelectedCount++; - + // this is for in-portal only (used in relation select) LastCheckedItem = this; + if (typeof (this.Grid.OnSelect) == 'function' ) { + this.Grid.OnSelect(this.ItemId); + } } GridItem.prototype.UnSelect = function ( force ) @@ -121,6 +124,9 @@ this.CheckBox.checked = false; } this.Grid.SelectedCount--; + if (typeof (this.Grid.OnUnSelect) == 'function' ) { + this.Grid.OnUnSelect(this.ItemId); + } } GridItem.prototype.ClearBrowserSelection = function() { @@ -131,15 +137,15 @@ window.getSelection().removeAllRanges(); } } else if (document.selection && !is.opera) { // IE - document.selection.empty(); + document.selection.empty(); } } GridItem.prototype.Click = function (ev) { - this.ClearBrowserSelection(); + this.ClearBrowserSelection(); this.Grid.ClearAlternativeGridsSelection('GridItem.Click'); - + var e = !is.ie ? ev : window.event; if (e.shiftKey && !this.Grid.RadioMode) { this.Grid.SelectRangeUpTo(this.sequence); @@ -150,7 +156,7 @@ } else { this.Grid.ClearSelection(null,'GridItem.Click'); - this.Toggle(); + this.Toggle(); } } this.Grid.CheckDependencies(); @@ -184,7 +190,7 @@ GridItem.prototype.FallsInRange = function (from, to) { - return (from <= to) ? + return (from <= to) ? (this.sequence >= from && this.sequence <= to) : (this.sequence >= to && this.sequence <= from); } @@ -219,12 +225,12 @@ } if ( !elements[i].id.match(mask)) continue; $item_id=RegExp.$1; - + cb_name = cb_mask.replace('$$ID$$',$item_id); - + cb = document.getElementById(cb_name); if (typeof(cb) == 'undefined') alert ('No Checkbox defined for item '+elements[i].id); - + this.AddItem( new GridItem( this, elements[i], cb, $item_id, this.class_on, this.class_off ) ); } } @@ -260,7 +266,7 @@ if (this.Items[i].selected) { $ret[$ret.length] = this.Items[i].ItemId; } - + } return $ret; } @@ -329,7 +335,7 @@ else { toolbar.disableButton(button_name, true); - } + } } } else { @@ -338,7 +344,7 @@ } else { this.ToolBar.SetVisible(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]); - } + } } } //if (enabling) this.ClearAlternativeGridsSelection('Grid.CheckDependencies'); @@ -350,7 +356,7 @@ $GridManager.ClearAlternativeGridsSelection(this.prefix); } -Grid.prototype.AddAlternativeGrid = function (alt_grid, reciprocal) +Grid.prototype.AddAlternativeGrid = function (alt_grid, reciprocal) { var $dst_prefix = typeof('alt_grid') == 'string' ? alt_grid : alt_grid.prefix; $GridManager.AddAlternativeGrid(this.prefix, $dst_prefix, reciprocal); @@ -362,7 +368,7 @@ var res = null for (var i in this.Items) { if (!this.Items[i].selected) continue; - if (min_sequence == null) + if (min_sequence == null) min_sequence = this.Items[i].sequence; if (this.Items[i].sequence <= min_sequence) { res = this.Items[i].ItemId;