diff --git a/etemplate/js/et2_dataview_controller.js b/etemplate/js/et2_dataview_controller.js index d6c630f34f..c9d0e31270 100644 --- a/etemplate/js/et2_dataview_controller.js +++ b/etemplate/js/et2_dataview_controller.js @@ -64,6 +64,9 @@ var et2_dataview_controller = Class.extend({ this._rowCallback = _rowCallback; this._linkCallback = _linkCallback; this._context = _context; + + // Initialize list of child controllers + this._children = []; // Initialize the "index map" which contains all currently displayed // containers hashed by the "index" @@ -88,6 +91,12 @@ var et2_dataview_controller = Class.extend({ this._makeIndexVisible, this ); + + // Record the child + if(this._parentController != null) + { + this._parentController._children.push(this); + } }, destroy: function () { @@ -97,7 +106,19 @@ var et2_dataview_controller = Class.extend({ // Clear the selection timeout this._clearTimer(); + + // Remove the child from the child list + if(this._parentController != null) + { + var idx = this._parentController._children.indexOf(this); + if (idx >= 0) + { + // This element is no longer parent of the child + this._parentController._children.splice(idx, 1); + this._parentController = null; + } + } }, /** @@ -189,6 +210,49 @@ var et2_dataview_controller = Class.extend({ this.dataStorePrefix = prefix; }, + /** + * Returns the row information of the passed node, or null if not available + * + * @param {DOMNode} node + * @return {string|false} UID, or false if not found + */ + getRowByNode: function(node) { + // Whatever the node, find a TR + var row_node = $j(node).closest('tr'); + var row = false + + // Check index map - simple case + var indexed = this._getIndexEntry(row_node.index()); + if(indexed && indexed.row && indexed.row.getDOMNode() == row_node[0]) + { + row = indexed; + } + else + { + // Check whole index map + for(var index in this._indexMap) + { + indexed = this._indexMap[index]; + if( indexed && indexed.row && indexed.row.getDOMNode() == row_node[0]) + { + row = indexed; + break; + } + } + } + + // Check children + for(var i = 0; !row && i < this._children.length; i++) + { + var child_row = this._children[i].getRowByNode(node); + if(child_row !== false) row = child_row; + } + if(row && !row.controller) + { + row.controller = this; + } + return row; + }, /* -- PRIVATE FUNCTIONS -- */ diff --git a/etemplate/js/et2_extension_nextmatch.js b/etemplate/js/et2_extension_nextmatch.js index 45040dfd8a..2de077b184 100644 --- a/etemplate/js/et2_extension_nextmatch.js +++ b/etemplate/js/et2_extension_nextmatch.js @@ -237,13 +237,20 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput], // Register a handler $j('table.egwGridView_grid',this.div) .on('dragenter','tr',function(e) { - var row = self.controller._getIndexEntry($j(this).index()); + // Figure out _which_ row + var row = self.controller.getRowByNode(this); + if(!row || !row.uid) { return false; } e.stopPropagation(); e.preventDefault(); - self.controller._selectionMgr.setFocused(row.uid,true); + + // Indicate acceptance + if(row.controller && row.controller._selectionMgr) + { + row.controller._selectionMgr.setFocused(row.uid,true); + } return false; }) .on('dragexit','tr', function(e) { @@ -1250,11 +1257,8 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput], handle_drop: function(event, target) { // Check to see if we can handle the link // First, find the UID - var row = this.controller._getIndexEntry($j(target).index()); - if(!row || !row.uid) - { - return false; - } + var row = this.controller.getRowByNode(target); + if(!row || !row.uid) return false; var uid = row.uid; // Get the file information @@ -1294,7 +1298,6 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput], // Ignore most of the UI, just use the status indicators var status = $j(document.createElement("div")) .addClass('et2_link_to') - .height(row.row.tr.height()) .width(row.row.tr.width()) .position({my: "left top", at: "left top", of: row.row.tr}) .append(link.status_span) diff --git a/etemplate/templates/default/etemplate2.css b/etemplate/templates/default/etemplate2.css index 4b1779ce35..98384bf219 100644 --- a/etemplate/templates/default/etemplate2.css +++ b/etemplate/templates/default/etemplate2.css @@ -452,7 +452,6 @@ action buttons, left aligned for "extra" controls } .et2_file .progress li { - margin: .5ex; } /* Hide progress bar when completed */ .et2_file .progress li.success > span.progressBar { @@ -550,6 +549,7 @@ div.et2_link_entry input.ui-autocomplete-input { } .et2_link_to .progress { max-height: 12em; + overflow-y: scroll; } .et2_link_to .progress > .success input { width: 100%; @@ -557,6 +557,8 @@ div.et2_link_entry input.ui-autocomplete-input { } .et2_link_to .progress li { list-style: none; + padding-bottom: 1px; + padding-top: 0px; } .et2_link_to .progress li.success span.ui-icon-comment { display: none; @@ -785,7 +787,7 @@ div.message.floating { border-color: #a93030; background-image:url(images/error.png); background-repeat: no-repeat; - padding-left: 6px; + padding-left: 20px; } .message.success { @@ -795,7 +797,7 @@ div.message.floating { border-color: #9ea930; background-image:url(images/tick.png); background-repeat: no-repeat; - padding-left: 6px; + padding-left: 20px; } .message.hint { @@ -805,7 +807,7 @@ div.message.floating { color: #56729a; background-image:url(images/hint.png); background-repeat: no-repeat; - padding-left: 6px; + padding-left: 20px; } /** @@ -981,7 +983,7 @@ div.message.floating { .et2_nextmatch * .et2_link_to { position: fixed; left: 0px; - background: white; + background-color: white; border: 1px gray; padding: 5px; }