R34328 - /trunk/etemplate/js/nextmatch_action.js

Author: igel457
New Revision: 34328

URL: http://www.egroupware.org/viewvc/egroupware?rev=34328&view=rev
Log:
Updated aoi code, prevented unwanted browser selection, row is only selectable when a checkbox is found

Modified:
trunk/etemplate/js/nextmatch_action.js

Modified: trunk/etemplate/js/nextmatch_action.js
URL: http://www.egroupware.org/viewvc/egroupware/trunk/etemplate/js/nextmatch_action.js?rev=34328&r1=34327&r2=34328&view=diff

— trunk/etemplate/js/nextmatch_action.js (original)
+++ trunk/etemplate/js/nextmatch_action.js Tue Mar 22 20:55:57 2011
@@ -1,5 +1,20 @@
+/**

-// An action object interface for the listbox - “inherits” from
+/**

    • Contains the action object interface implementation for the nextmatch widget
    • row.
  • */

+// An action object interface for each nextmatch widget row - “inherits” from
// egwActionObjectInterface
function nextmatchRowAOI(_node)
{
@@ -8,36 +23,53 @@
aoi.node = _node;

aoi.checkBox = ($(":checkbox", aoi.node))[0];
  • aoi.checkBox.checked = false;

  • aoi.doGetDOMNode = function() {

  •   return aoi.node;
    
  • }

  • // Rows without a checkbox are unselectable
  • if (typeof aoi.checkBox != “undefined”)
  • {
  •   aoi.doGetDOMNode = function() {
    
  •   	return aoi.node;
    
  •   }
    
  • // Now append some action code to the node
  • $(_node).click(function(e) {
  •   if (e.target != aoi.checkBox)
    
  •   {
    
  •   	var selected = egwBitIsSet(aoi.getState(), EGW_AO_STATE_SELECTED);
    
  •   	var state = egwGetShiftState(e);
    
  •   // Prevent the browser from selecting the content of the element, when
    
  •   // a special key is pressed.
    
  •   $(_node).mousedown(egwPreventSelect);
    
  •   	aoi.updateState(EGW_AO_STATE_SELECTED,
    
  •   		!egwBitIsSet(state, EGW_AO_SHIFT_STATE_MULTI) || !selected,
    
  •   		state);
    
  •   // Now append some action code to the node
    
  •   $(_node).click(function(e) {
    
  •   	// Reset the prevent selection code (in order to allow wanted
    
  •   	// selection of text)
    
  •   	_node.onselectstart = null;
    
  •   	if (e.target != aoi.checkBox)
    
  •   	{
    
  •   		var selected = egwBitIsSet(aoi.getState(), EGW_AO_STATE_SELECTED);
    
  •   		var state = egwGetShiftState(e);
    
  •   		aoi.updateState(EGW_AO_STATE_SELECTED,
    
  •   			!egwBitIsSet(state, EGW_AO_SHIFT_STATE_MULTI) || !selected,
    
  •   			state);
    
  •   	}
    
  •   });
    
  •   $(aoi.checkBox).change(function() {
    
  •   		aoi.updateState(EGW_AO_STATE_SELECTED, this.checked, EGW_AO_SHIFT_STATE_MULTI);
    
  •   	});
    
  •   aoi.doSetState = function(_state) {
    
  •   	var selected = egwBitIsSet(_state, EGW_AO_STATE_SELECTED);
    
  •   	if (this.checkBox)
    
  •   	{
    
  •   		this.checkBox.checked = selected;
    
  •   	}
    
  •   	$(this.node).toggleClass('focused',
    
  •   		egwBitIsSet(_state, EGW_AO_STATE_FOCUSED));
    
  •   	$(this.node).toggleClass('selected',
    
  •   		selected);
      }
    
  • });

  • $(aoi.checkBox).change(function() {

  •   aoi.updateState(EGW_AO_STATE_SELECTED, this.checked, EGW_AO_SHIFT_STATE_MULTI);
    
  • });

  • aoi.doSetState = function(_state) {

  •   var selected = egwBitIsSet(_state, EGW_AO_STATE_SELECTED);
    
  •   this.checkBox.checked = selected;
    
  •   $(this.node).toggleClass('focused',
    
  •   	egwBitIsSet(_state, EGW_AO_STATE_FOCUSED));
    
  •   $(this.node).toggleClass('selected',
    
  •   	selected);
    

    }

    return aoi;


Enable your software for Intel® Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel® vPro ™ technology - will your software
be a part of the solution? Download the Intel® Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar


eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs