forked from extern/egroupware
More progress of commit r49059
This commit is contained in:
parent
e8980e5836
commit
0c82167d09
@ -335,7 +335,10 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(et2_IDataProvider,
|
||||
this.append('<br />');
|
||||
}, span);
|
||||
}
|
||||
return helper;
|
||||
// As we wanted to have a general defaul helper interface, we return null here and not using customize helper for links
|
||||
// TODO: Need to decide if we need to create a customized helper interface for links anyway
|
||||
//return helper;
|
||||
return null;
|
||||
},true);
|
||||
}
|
||||
if(this._actionLinks.indexOf(drag_action.id) < 0)
|
||||
|
@ -1642,6 +1642,7 @@ div.et2_image_tooltipPopup {
|
||||
div.et2_egw_action_ddHelper {
|
||||
|
||||
}
|
||||
/* The last div which shows Ctrl tip to user*/
|
||||
div.et2_egw_action_ddHelper_tip {
|
||||
position: relative;
|
||||
text-overflow: ellipsis;
|
||||
@ -1663,10 +1664,20 @@ table.et2_egw_action_ddHelper_row tr {
|
||||
background: none;
|
||||
max-height: 20px;
|
||||
}
|
||||
/* Apply to all displaied rows in order to get same result*/
|
||||
table.et2_egw_action_ddHelper_row * {
|
||||
white-space: nowrap !important;
|
||||
max-height: 15px;
|
||||
overflow:hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 400px;
|
||||
}
|
||||
span.et2_egw_action_ddHelper_itemCnt {
|
||||
/* Last row of items which shows the number of more items*/
|
||||
tr.et2_egw_action_ddHelper_moreRow{
|
||||
|
||||
}
|
||||
/* The big total item counter*/
|
||||
span.et2_egw_action_ddHelper_itemsCnt {
|
||||
background: transparent;
|
||||
position: absolute;
|
||||
left: 20px;
|
||||
|
@ -612,85 +612,6 @@ app.classes.filemanager = AppJS.extend(
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get drag helper, called on drag start
|
||||
*
|
||||
* @param {egwAction} _action
|
||||
* @param {array} _elems
|
||||
* @return some dome objects
|
||||
*/
|
||||
drag: function(_action, _elems)
|
||||
{
|
||||
var icons = [];
|
||||
for (var i = 0; i < _elems.length; i++)
|
||||
{
|
||||
var data = egw.dataGetUIDdata(_elems[i].id);
|
||||
var src = egw.mime_icon(data.data.mime, data.data.path);
|
||||
|
||||
if (_elems[i].getFocused())
|
||||
{
|
||||
icons.unshift(src);
|
||||
}
|
||||
else
|
||||
{
|
||||
icons.push(src);
|
||||
}
|
||||
}
|
||||
|
||||
// Only take a maximum of 10 icons
|
||||
var maxCnt = 10;
|
||||
|
||||
var div = $j(document.createElement("div"))
|
||||
.css({
|
||||
position: 'absolute',
|
||||
top: '0px',
|
||||
left: '0px',
|
||||
width: '300px'
|
||||
});
|
||||
|
||||
var lastIcon = "";
|
||||
var idx = 0;
|
||||
|
||||
for (var i = 0; i < icons.length; i++)
|
||||
{
|
||||
if (icons[i] != lastIcon)
|
||||
{
|
||||
lastIcon = icons[i];
|
||||
|
||||
// Create a stack of images
|
||||
var img = $j(document.createElement('img'));
|
||||
img.css({
|
||||
position: 'absolute',
|
||||
'z-index': 10000-i,
|
||||
top: idx*5,
|
||||
left: idx*5,
|
||||
opacity: (maxCnt - idx) / maxCnt
|
||||
});
|
||||
img.attr('src', icons[i]);
|
||||
div.append(img);
|
||||
|
||||
idx++;
|
||||
if (idx == maxCnt)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var text = $j(document.createElement('div')).css({left: '30px', position: 'absolute'});
|
||||
// add filename or number of files for multiple files
|
||||
text.text(_elems.length > 1 ? _elems.length+' '+this.egw.lang('files') : this.basename(_elems[0].id));
|
||||
div.append(text);
|
||||
|
||||
// Add notice of Ctrl key, if supported
|
||||
if(window.FileReader && 'draggable' in document.createElement('span') &&
|
||||
navigator && navigator.userAgent.indexOf('Chrome') >= 0)
|
||||
{
|
||||
var key = ["Mac68K","MacPPC","MacIntel"].indexOf(window.navigator.platform) < 0 ? 'Ctrl' : 'Command';
|
||||
text.append('<br />' + this.egw.lang('Hold %1 to drag files to your computer',key));
|
||||
}
|
||||
return div;
|
||||
},
|
||||
|
||||
/**
|
||||
* Change readonly state for given directory
|
||||
*
|
||||
|
@ -84,22 +84,15 @@ function egwDragActionImplementation()
|
||||
ai.selected = [];
|
||||
|
||||
// Define default helper DOM
|
||||
// default helper also can be called later in application code in order to customization
|
||||
ai.defaultDDHelper = function (_selected)
|
||||
{
|
||||
// Table containing clone of rows
|
||||
var table = $j(document.createElement("table")).addClass('egwGridView_grid et2_egw_action_ddHelper_row');
|
||||
// tr element to use as last row to show lable more ...
|
||||
var moreRow = $j(document.createElement('tr')).addClass('et2_egw_action_ddHelper_tip');
|
||||
var moreRow = $j(document.createElement('tr')).addClass('et2_egw_action_ddHelper_moreRow');
|
||||
// Main div helper container
|
||||
var div = $j(document.createElement("div")).append(table);
|
||||
// Lable to show number of items
|
||||
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 itemsLabel = '';
|
||||
spanCnt.text(_selected.length + itemsLabel);
|
||||
|
||||
var rows = [];
|
||||
// Maximum number of rows to show
|
||||
@ -117,14 +110,26 @@ function egwDragActionImplementation()
|
||||
index++;
|
||||
if (index == maxRows)
|
||||
{
|
||||
// Lable to show number of items
|
||||
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);
|
||||
|
||||
var restRows = _selected.length - maxRows;
|
||||
if (restRows) moreRow.text((_selected.length - maxRows) +' '+egw.lang('more selected ...'));
|
||||
if (restRows)
|
||||
{
|
||||
moreRow.text((_selected.length - maxRows) +' '+egw.lang('more %1 selected ...', itemLabel));
|
||||
}
|
||||
table.append(moreRow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var text = $j(document.createElement('div')).addClass('et2_egw_action_ddHelper_textArea');
|
||||
var text = $j(document.createElement('div')).addClass('et2_egw_action_ddHelper_tip');
|
||||
div.append(text);
|
||||
|
||||
// Add notice of Ctrl key, if supported
|
||||
@ -132,9 +137,9 @@ function egwDragActionImplementation()
|
||||
navigator && navigator.userAgent.indexOf('Chrome') >= 0)
|
||||
{
|
||||
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, itemsLabel));
|
||||
text.text(egw.lang('Hold %1 to drag %2 to your computer',key, itemLabel));
|
||||
}
|
||||
// Final html DOM return as helper structor
|
||||
return div;
|
||||
}
|
||||
|
||||
@ -288,7 +293,7 @@ function egwDragActionImplementation()
|
||||
}
|
||||
|
||||
// Return an empty div if the helper dom node is not set
|
||||
return $j(document.createElement("div")).addClass('et2_egw_action_ddHelper');
|
||||
return ai.defaultDDHelper(ai.selected);//$j(document.createElement("div")).addClass('et2_egw_action_ddHelper');
|
||||
},
|
||||
"start": function(e) {
|
||||
return ai.helper != null;
|
||||
|
Loading…
Reference in New Issue
Block a user