mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-19 12:55:08 +02:00
Drag & drop files from user's system onto nextmatch row now working with sub-grids too
This commit is contained in:
@@ -65,6 +65,9 @@ var et2_dataview_controller = Class.extend({
|
|||||||
this._linkCallback = _linkCallback;
|
this._linkCallback = _linkCallback;
|
||||||
this._context = _context;
|
this._context = _context;
|
||||||
|
|
||||||
|
// Initialize list of child controllers
|
||||||
|
this._children = [];
|
||||||
|
|
||||||
// Initialize the "index map" which contains all currently displayed
|
// Initialize the "index map" which contains all currently displayed
|
||||||
// containers hashed by the "index"
|
// containers hashed by the "index"
|
||||||
this._indexMap = {};
|
this._indexMap = {};
|
||||||
@@ -88,6 +91,12 @@ var et2_dataview_controller = Class.extend({
|
|||||||
this._makeIndexVisible,
|
this._makeIndexVisible,
|
||||||
this
|
this
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Record the child
|
||||||
|
if(this._parentController != null)
|
||||||
|
{
|
||||||
|
this._parentController._children.push(this);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function () {
|
destroy: function () {
|
||||||
@@ -98,6 +107,18 @@ var et2_dataview_controller = Class.extend({
|
|||||||
// Clear the selection timeout
|
// Clear the selection timeout
|
||||||
this._clearTimer();
|
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;
|
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 -- */
|
/* -- PRIVATE FUNCTIONS -- */
|
||||||
|
|
||||||
|
@@ -237,13 +237,20 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
|
|||||||
// Register a handler
|
// Register a handler
|
||||||
$j('table.egwGridView_grid',this.div)
|
$j('table.egwGridView_grid',this.div)
|
||||||
.on('dragenter','tr',function(e) {
|
.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)
|
if(!row || !row.uid)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
e.stopPropagation(); e.preventDefault();
|
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;
|
return false;
|
||||||
})
|
})
|
||||||
.on('dragexit','tr', function(e) {
|
.on('dragexit','tr', function(e) {
|
||||||
@@ -1250,11 +1257,8 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
|
|||||||
handle_drop: function(event, target) {
|
handle_drop: function(event, target) {
|
||||||
// Check to see if we can handle the link
|
// Check to see if we can handle the link
|
||||||
// First, find the UID
|
// First, find the UID
|
||||||
var row = this.controller._getIndexEntry($j(target).index());
|
var row = this.controller.getRowByNode(target);
|
||||||
if(!row || !row.uid)
|
if(!row || !row.uid) return false;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var uid = row.uid;
|
var uid = row.uid;
|
||||||
|
|
||||||
// Get the file information
|
// 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
|
// Ignore most of the UI, just use the status indicators
|
||||||
var status = $j(document.createElement("div"))
|
var status = $j(document.createElement("div"))
|
||||||
.addClass('et2_link_to')
|
.addClass('et2_link_to')
|
||||||
.height(row.row.tr.height())
|
|
||||||
.width(row.row.tr.width())
|
.width(row.row.tr.width())
|
||||||
.position({my: "left top", at: "left top", of: row.row.tr})
|
.position({my: "left top", at: "left top", of: row.row.tr})
|
||||||
.append(link.status_span)
|
.append(link.status_span)
|
||||||
|
@@ -452,7 +452,6 @@ action buttons, left aligned for "extra" controls
|
|||||||
}
|
}
|
||||||
|
|
||||||
.et2_file .progress li {
|
.et2_file .progress li {
|
||||||
margin: .5ex;
|
|
||||||
}
|
}
|
||||||
/* Hide progress bar when completed */
|
/* Hide progress bar when completed */
|
||||||
.et2_file .progress li.success > span.progressBar {
|
.et2_file .progress li.success > span.progressBar {
|
||||||
@@ -550,6 +549,7 @@ div.et2_link_entry input.ui-autocomplete-input {
|
|||||||
}
|
}
|
||||||
.et2_link_to .progress {
|
.et2_link_to .progress {
|
||||||
max-height: 12em;
|
max-height: 12em;
|
||||||
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
.et2_link_to .progress > .success input {
|
.et2_link_to .progress > .success input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -557,6 +557,8 @@ div.et2_link_entry input.ui-autocomplete-input {
|
|||||||
}
|
}
|
||||||
.et2_link_to .progress li {
|
.et2_link_to .progress li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
padding-bottom: 1px;
|
||||||
|
padding-top: 0px;
|
||||||
}
|
}
|
||||||
.et2_link_to .progress li.success span.ui-icon-comment {
|
.et2_link_to .progress li.success span.ui-icon-comment {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -785,7 +787,7 @@ div.message.floating {
|
|||||||
border-color: #a93030;
|
border-color: #a93030;
|
||||||
background-image:url(images/error.png);
|
background-image:url(images/error.png);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
padding-left: 6px;
|
padding-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.message.success {
|
.message.success {
|
||||||
@@ -795,7 +797,7 @@ div.message.floating {
|
|||||||
border-color: #9ea930;
|
border-color: #9ea930;
|
||||||
background-image:url(images/tick.png);
|
background-image:url(images/tick.png);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
padding-left: 6px;
|
padding-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.message.hint {
|
.message.hint {
|
||||||
@@ -805,7 +807,7 @@ div.message.floating {
|
|||||||
color: #56729a;
|
color: #56729a;
|
||||||
background-image:url(images/hint.png);
|
background-image:url(images/hint.png);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
padding-left: 6px;
|
padding-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -981,7 +983,7 @@ div.message.floating {
|
|||||||
.et2_nextmatch * .et2_link_to {
|
.et2_nextmatch * .et2_link_to {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
background: white;
|
background-color: white;
|
||||||
border: 1px gray;
|
border: 1px gray;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user