mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-29 09:19:23 +01:00
Implement to set proper lable for dragging item on the drag helper
This commit is contained in:
parent
ffa99fcb01
commit
23c9f70dad
@ -97,6 +97,8 @@ function egwDragActionImplementation()
|
||||
var rows = [];
|
||||
// Maximum number of rows to show
|
||||
var maxRows = 3;
|
||||
// item label
|
||||
var itemLabel = egw.lang(egw.link_get_registry(egw.app_name(),_selected.length > 1?'entries':'entry')||egw.app_name());
|
||||
|
||||
var index = 0;
|
||||
for (var i = 0; i < _selected.length;i++)
|
||||
@ -114,11 +116,9 @@ function egwDragActionImplementation()
|
||||
var spanCnt = $j(document.createElement('span'))
|
||||
.addClass('et2_egw_action_ddHelper_itemsCnt')
|
||||
.appendTo(div);
|
||||
|
||||
// TODO: get the right drag item next to the number
|
||||
var itemLabel = '';
|
||||
spanCnt.text(_selected.length + itemLabel);
|
||||
|
||||
spanCnt.text(_selected.length +' '+ itemLabel);
|
||||
// Number of not shown rows
|
||||
var restRows = _selected.length - maxRows;
|
||||
if (restRows)
|
||||
{
|
||||
@ -134,7 +134,7 @@ function egwDragActionImplementation()
|
||||
|
||||
// Add notice of Ctrl key, if supported
|
||||
if('draggable' in document.createElement('span') &&
|
||||
navigator && navigator.userAgent.indexOf('Chrome') >= 0)
|
||||
navigator && navigator.userAgent.indexOf('Chrome') >= 0 && egw.app_name() == 'filemanager') // currently only filemanager supports drag out
|
||||
{
|
||||
var key = ["Mac68K","MacPPC","MacIntel"].indexOf(window.navigator.platform) < 0 ? 'Ctrl' : 'Command';
|
||||
text.text(egw.lang('Hold %1 to drag %2 to your computer',key, itemLabel));
|
||||
@ -298,6 +298,32 @@ function egwDragActionImplementation()
|
||||
"start": function(e) {
|
||||
return ai.helper != null;
|
||||
},
|
||||
revert: function(valid)
|
||||
{
|
||||
var dTarget = this;
|
||||
if (!valid)
|
||||
{
|
||||
// Tolerance value of pixels arround the draggable target
|
||||
// to distinguish whether the action was intended for dragging or selecting content.
|
||||
var tipTelorance = 10;
|
||||
var helperTop = ai.helper.position().top;
|
||||
|
||||
if (helperTop >= dTarget.offset().top
|
||||
&& helperTop <= (dTarget.height() + dTarget.offset().top) + tipTelorance)
|
||||
{
|
||||
var key = ["Mac68K","MacPPC","MacIntel"].indexOf(window.navigator.platform) < 0 ? 'Ctrl' : 'Command';
|
||||
// Comment this out ATM till we get the ctrl and content selection functionality working
|
||||
//egw.message(egw.lang('Hold %1 key to select content.', key),'info');
|
||||
}
|
||||
// Invalid target
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Valid target
|
||||
return false;
|
||||
}
|
||||
},
|
||||
// Solves problem with scroll position changing in the grid
|
||||
// component
|
||||
"refreshPositions": true,
|
||||
|
Loading…
Reference in New Issue
Block a user