mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Some fixes for tile view after Typescript conversion
This commit is contained in:
parent
7e1da8d909
commit
3350f3a024
@ -104,23 +104,23 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
||||
* @memberOf et2_nextmatch
|
||||
*/
|
||||
function et2_nextmatch(_parent, _attrs, _child) {
|
||||
var _this = _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_nextmatch._attributes, _child || {})) || this;
|
||||
// When printing, we change the layout around. Keep some values so it can be restored after
|
||||
_this.print = {
|
||||
old_height: 0,
|
||||
row_selector: '',
|
||||
orientation_style: null
|
||||
};
|
||||
_this.activeFilters = {col_filter: {}};
|
||||
_this.columns = [];
|
||||
// keeps sorted columns
|
||||
_this.sortedColumnsList = [];
|
||||
// Directly set current col_filters from settings
|
||||
jQuery.extend(_this.activeFilters.col_filter, _this.options.settings.col_filter);
|
||||
/*
|
||||
Process selected custom fields here, so that the settings are correctly
|
||||
set before the row template is parsed
|
||||
*/
|
||||
var _this = _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_nextmatch._attributes, _child || {})) || this;
|
||||
// When printing, we change the layout around. Keep some values so it can be restored after
|
||||
_this.print = {
|
||||
old_height: 0,
|
||||
row_selector: '',
|
||||
orientation_style: null
|
||||
};
|
||||
_this.activeFilters = { col_filter: {} };
|
||||
_this.columns = [];
|
||||
// keeps sorted columns
|
||||
_this.sortedColumnsList = [];
|
||||
// Directly set current col_filters from settings
|
||||
jQuery.extend(_this.activeFilters.col_filter, _this.options.settings.col_filter);
|
||||
/*
|
||||
Process selected custom fields here, so that the settings are correctly
|
||||
set before the row template is parsed
|
||||
*/
|
||||
var prefs = _this._getPreferences();
|
||||
var cfs = {};
|
||||
for (var i = 0; i < prefs.visible.length; i++) {
|
||||
@ -740,6 +740,17 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
||||
else {
|
||||
colName = this._getColumnName(_row[i].widget);
|
||||
}
|
||||
_colData[i].visible = negated;
|
||||
var stop_1 = false;
|
||||
for (var j = 0; j < columnDisplay.length && !stop_1; j++) {
|
||||
if (columnDisplay[j] == colName) {
|
||||
_colData[i].visible = !negated;
|
||||
stop_1 = true;
|
||||
}
|
||||
}
|
||||
if (!negated) {
|
||||
_colData[i].order = typeof order[colName] === 'undefined' ? i : order[colName];
|
||||
}
|
||||
if (!colName)
|
||||
continue;
|
||||
if (size[colName]) {
|
||||
@ -751,16 +762,6 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
||||
_colData[i].width = parseInt(size[colName]) + 'px';
|
||||
}
|
||||
}
|
||||
if (!negated) {
|
||||
_colData[i].order = typeof order[colName] === 'undefined' ? i : order[colName];
|
||||
}
|
||||
for (var j = 0; j < columnDisplay.length; j++) {
|
||||
if (columnDisplay[j] == colName) {
|
||||
_colData[i].visible = !negated;
|
||||
continue RowLoop;
|
||||
}
|
||||
}
|
||||
_colData[i].visible = negated;
|
||||
}
|
||||
}
|
||||
_colData.sort(function (a, b) {
|
||||
@ -956,53 +957,54 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
||||
}
|
||||
};
|
||||
et2_nextmatch.prototype._parseDataRow = function (_row, _rowData, _colData) {
|
||||
var columnWidgets = [];
|
||||
_row.sort(function (a, b) {
|
||||
return a.colData.order - b.colData.order;
|
||||
});
|
||||
for (var x = 0; x < this.columns.length; x++) {
|
||||
if (!this.columns[x].visible) {
|
||||
continue;
|
||||
}
|
||||
if (typeof _row[x] != "undefined" && _row[x].widget) {
|
||||
columnWidgets[x] = _row[x].widget;
|
||||
// Append the widget to this container
|
||||
this.addChild(_row[x].widget);
|
||||
} else {
|
||||
columnWidgets[x] = _row[x].widget;
|
||||
}
|
||||
// Pass along column alignment
|
||||
if (_row[x].align && columnWidgets[x]) {
|
||||
columnWidgets[x].align = _row[x].align;
|
||||
}
|
||||
}
|
||||
this.rowProvider.setDataRowTemplate(columnWidgets, _rowData, this);
|
||||
// Create the grid controller
|
||||
this.controller = new et2_extension_nextmatch_controller_1.et2_nextmatch_controller(null, this.egw(), this.getInstanceManager().etemplate_exec_id, this, null, this.dataview.grid, this.rowProvider, this.options.settings.action_links, null, this.options.actions);
|
||||
// Need to trigger empty row the first time
|
||||
if (total == 0)
|
||||
this.controller._emptyRow();
|
||||
// Set data cache prefix to either provided custom or auto
|
||||
if (!this.options.settings.dataStorePrefix && this.options.settings.get_rows) {
|
||||
// Use jsapi data module to update
|
||||
var list = this.options.settings.get_rows.split('.', 2);
|
||||
if (list.length < 2)
|
||||
list = this.options.settings.get_rows.split('_'); // support "app_something::method"
|
||||
this.options.settings.dataStorePrefix = list[0];
|
||||
}
|
||||
this.controller.setPrefix(this.options.settings.dataStorePrefix);
|
||||
// Set the view
|
||||
this.controller._view = this.view;
|
||||
// Load the initial order
|
||||
/*this.controller.loadInitialOrder(this._getInitialOrder(
|
||||
this.options.settings.rows, this.options.settings.row_id
|
||||
));*/
|
||||
// Set the initial row count
|
||||
var total = typeof this.options.settings.total != "undefined" ?
|
||||
this.options.settings.total : 0;
|
||||
// This triggers an invalidate, which updates the grid
|
||||
this.dataview.grid.setTotalCount(total);
|
||||
// Insert any data sent from server, so invalidate finds data already
|
||||
var columnWidgets = [];
|
||||
_row.sort(function (a, b) {
|
||||
return a.colData.order - b.colData.order;
|
||||
});
|
||||
for (var x = 0; x < this.columns.length; x++) {
|
||||
if (!this.columns[x].visible) {
|
||||
continue;
|
||||
}
|
||||
if (typeof _row[x] != "undefined" && _row[x].widget) {
|
||||
columnWidgets[x] = _row[x].widget;
|
||||
// Append the widget to this container
|
||||
this.addChild(_row[x].widget);
|
||||
}
|
||||
else {
|
||||
columnWidgets[x] = _row[x].widget;
|
||||
}
|
||||
// Pass along column alignment
|
||||
if (_row[x].align && columnWidgets[x]) {
|
||||
columnWidgets[x].align = _row[x].align;
|
||||
}
|
||||
}
|
||||
this.rowProvider.setDataRowTemplate(columnWidgets, _rowData, this);
|
||||
// Create the grid controller
|
||||
this.controller = new et2_extension_nextmatch_controller_1.et2_nextmatch_controller(null, this.egw(), this.getInstanceManager().etemplate_exec_id, this, null, this.dataview.grid, this.rowProvider, this.options.settings.action_links, null, this.options.actions);
|
||||
// Need to trigger empty row the first time
|
||||
if (total == 0)
|
||||
this.controller._emptyRow();
|
||||
// Set data cache prefix to either provided custom or auto
|
||||
if (!this.options.settings.dataStorePrefix && this.options.settings.get_rows) {
|
||||
// Use jsapi data module to update
|
||||
var list = this.options.settings.get_rows.split('.', 2);
|
||||
if (list.length < 2)
|
||||
list = this.options.settings.get_rows.split('_'); // support "app_something::method"
|
||||
this.options.settings.dataStorePrefix = list[0];
|
||||
}
|
||||
this.controller.setPrefix(this.options.settings.dataStorePrefix);
|
||||
// Set the view
|
||||
this.controller._view = this.view;
|
||||
// Load the initial order
|
||||
/*this.controller.loadInitialOrder(this._getInitialOrder(
|
||||
this.options.settings.rows, this.options.settings.row_id
|
||||
));*/
|
||||
// Set the initial row count
|
||||
var total = typeof this.options.settings.total != "undefined" ?
|
||||
this.options.settings.total : 0;
|
||||
// This triggers an invalidate, which updates the grid
|
||||
this.dataview.grid.setTotalCount(total);
|
||||
// Insert any data sent from server, so invalidate finds data already
|
||||
if (this.options.settings.rows && this.options.settings.num_rows) {
|
||||
this.controller.loadInitialData(this.options.settings.dataStorePrefix, this.options.settings.row_id, this.options.settings.rows);
|
||||
// Remove, to prevent duplication
|
||||
@ -1101,37 +1103,37 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
||||
if (!this.selectPopup) {
|
||||
var select_1 = et2_createWidget("select", {
|
||||
multiple: true,
|
||||
rows: 8,
|
||||
empty_label: this.egw().lang("select columns"),
|
||||
selected_first: false,
|
||||
value_class: "selcolumn_sortable_"
|
||||
}, this);
|
||||
select_1.set_select_options(columns);
|
||||
select_1.set_value(columns_selected);
|
||||
var autoRefresh_1 = et2_createWidget("select", {
|
||||
"empty_label": "Refresh"
|
||||
}, this);
|
||||
autoRefresh_1.set_id("nm_autorefresh");
|
||||
autoRefresh_1.set_select_options({
|
||||
// Cause [unknown] problems with mail
|
||||
//30: "30 seconds",
|
||||
//60: "1 Minute",
|
||||
180: "3 Minutes",
|
||||
300: "5 Minutes",
|
||||
900: "15 Minutes",
|
||||
1800: "30 Minutes"
|
||||
});
|
||||
autoRefresh_1.set_value(this._get_autorefresh());
|
||||
autoRefresh_1.set_statustext(egw.lang("Automatically refresh list"));
|
||||
var defaultCheck = et2_createWidget("select", {"empty_label": "Preference"}, this);
|
||||
defaultCheck.set_id('nm_col_preference');
|
||||
defaultCheck.set_select_options({
|
||||
'default': {label: 'Default', title: 'Set these columns as the default'},
|
||||
'reset': {label: 'Reset', title: "Reset all user's column preferences"},
|
||||
'force': {label: 'Force', title: 'Force column preference so users cannot change it'}
|
||||
});
|
||||
defaultCheck.set_value(this.options.settings.columns_forced ? 'force' : '');
|
||||
var okButton = et2_createWidget("buttononly", {"background_image": true, image: "check"}, this);
|
||||
rows: 8,
|
||||
empty_label: this.egw().lang("select columns"),
|
||||
selected_first: false,
|
||||
value_class: "selcolumn_sortable_"
|
||||
}, this);
|
||||
select_1.set_select_options(columns);
|
||||
select_1.set_value(columns_selected);
|
||||
var autoRefresh_1 = et2_createWidget("select", {
|
||||
"empty_label": "Refresh"
|
||||
}, this);
|
||||
autoRefresh_1.set_id("nm_autorefresh");
|
||||
autoRefresh_1.set_select_options({
|
||||
// Cause [unknown] problems with mail
|
||||
//30: "30 seconds",
|
||||
//60: "1 Minute",
|
||||
180: "3 Minutes",
|
||||
300: "5 Minutes",
|
||||
900: "15 Minutes",
|
||||
1800: "30 Minutes"
|
||||
});
|
||||
autoRefresh_1.set_value(this._get_autorefresh());
|
||||
autoRefresh_1.set_statustext(egw.lang("Automatically refresh list"));
|
||||
var defaultCheck = et2_createWidget("select", { "empty_label": "Preference" }, this);
|
||||
defaultCheck.set_id('nm_col_preference');
|
||||
defaultCheck.set_select_options({
|
||||
'default': { label: 'Default', title: 'Set these columns as the default' },
|
||||
'reset': { label: 'Reset', title: "Reset all user's column preferences" },
|
||||
'force': { label: 'Force', title: 'Force column preference so users cannot change it' }
|
||||
});
|
||||
defaultCheck.set_value(this.options.settings.columns_forced ? 'force' : '');
|
||||
var okButton = et2_createWidget("buttononly", { "background_image": true, image: "check" }, this);
|
||||
okButton.set_label(this.egw().lang("ok"));
|
||||
okButton.onclick = function () {
|
||||
// Update visibility
|
||||
@ -1421,7 +1423,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
||||
// We don't use iterateOver because it checks sub-children
|
||||
for (var i = this._children.length - 1; i >= 0; i--) {
|
||||
var _node = this._children[i];
|
||||
if (_node != this.header) {
|
||||
if (_node != this.header && _node !== template) {
|
||||
this.removeChild(_node);
|
||||
_node.destroy();
|
||||
}
|
||||
@ -1433,9 +1435,6 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
||||
}
|
||||
this.dataview = new et2_dataview_1.et2_dataview(this.innerDiv, this.egw());
|
||||
}
|
||||
// Create the template
|
||||
if (template_name) {
|
||||
}
|
||||
if (!template) {
|
||||
this.egw().debug("error", "Error while loading definition template for " +
|
||||
"nextmatch widget.", template_name);
|
||||
|
@ -1054,6 +1054,20 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
{
|
||||
colName = this._getColumnName(_row[i].widget);
|
||||
}
|
||||
_colData[i].visible = negated;
|
||||
let stop = false;
|
||||
for(var j = 0; j < columnDisplay.length && !stop; j++)
|
||||
{
|
||||
if(columnDisplay[j] == colName)
|
||||
{
|
||||
_colData[i].visible = !negated;
|
||||
stop = true;
|
||||
}
|
||||
}
|
||||
if(!negated)
|
||||
{
|
||||
_colData[i].order = typeof order[colName] === 'undefined' ? i : order[colName];
|
||||
}
|
||||
if(!colName) continue;
|
||||
|
||||
if(size[colName])
|
||||
@ -1068,20 +1082,6 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
_colData[i].width = parseInt(size[colName])+'px';
|
||||
}
|
||||
}
|
||||
if(!negated)
|
||||
{
|
||||
_colData[i].order = typeof order[colName] === 'undefined' ? i : order[colName];
|
||||
}
|
||||
for(var j = 0; j < columnDisplay.length; j++)
|
||||
{
|
||||
if(columnDisplay[j] == colName)
|
||||
{
|
||||
_colData[i].visible = !negated;
|
||||
|
||||
continue RowLoop;
|
||||
}
|
||||
}
|
||||
_colData[i].visible = negated;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1941,7 +1941,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
// We don't use iterateOver because it checks sub-children
|
||||
for (let i = this._children.length - 1; i >= 0; i--) {
|
||||
const _node = this._children[i];
|
||||
if (_node != this.header) {
|
||||
if (_node != this.header && _node !== template) {
|
||||
this.removeChild(_node);
|
||||
_node.destroy();
|
||||
}
|
||||
@ -1955,11 +1955,6 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
this.dataview = new et2_dataview(this.innerDiv, this.egw());
|
||||
}
|
||||
|
||||
// Create the template
|
||||
if (template_name)
|
||||
{
|
||||
}
|
||||
|
||||
if (!template)
|
||||
{
|
||||
this.egw().debug("error", "Error while loading definition template for " +
|
||||
|
@ -37,9 +37,9 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
* @memberOf app.filemanager
|
||||
*/
|
||||
function filemanagerAPP() {
|
||||
var _this =
|
||||
// call parent
|
||||
_super.call(this, 'filemanager') || this;
|
||||
var _this =
|
||||
// call parent
|
||||
_super.call(this, 'filemanager') || this;
|
||||
/**
|
||||
* path widget, by template
|
||||
*/
|
||||
@ -302,12 +302,18 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
*/
|
||||
filemanagerAPP.prototype._upload_callback = function (_data) {
|
||||
if (_data.msg || _data.uploaded)
|
||||
window.egw_refresh(_data.msg, this.appname);
|
||||
window.egw_refresh(_data.msg, this.appname);
|
||||
var that = this;
|
||||
for (var file in _data.uploaded) {
|
||||
if (_data.uploaded[file].confirm && !_data.uploaded[file].confirmed) {
|
||||
var buttons = [
|
||||
{ text: this.egw.lang("Yes"), id: "overwrite", class: "ui-priority-primary", "default": true, image: 'check' },
|
||||
{
|
||||
text: this.egw.lang("Yes"),
|
||||
id: "overwrite",
|
||||
class: "ui-priority-primary",
|
||||
"default": true,
|
||||
image: 'check'
|
||||
},
|
||||
{ text: this.egw.lang("Rename"), id: "rename", image: 'edit' },
|
||||
{ text: this.egw.lang("Cancel"), id: "cancel" }
|
||||
];
|
||||
@ -513,7 +519,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
* @param _data
|
||||
*/
|
||||
filemanagerAPP.prototype._do_action_callback = function (_data) {
|
||||
window.egw_refresh(_data.msg, this.appname);
|
||||
window.egw_refresh(_data.msg, this.appname);
|
||||
};
|
||||
/**
|
||||
* Force download of a file by appending '?download' to it's download url
|
||||
@ -612,14 +618,14 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
}
|
||||
// Toggle button icon to the other view
|
||||
//todo: nm.controller needs to be changed to nm.getController after merging typescript branch into master
|
||||
button_widget.set_image("list_" + (view == nm.getController().VIEW_ROW ? nm.getController().VIEW_TILE : nm.getController().VIEW_ROW));
|
||||
button_widget.set_statustext(view == nm.getController().VIEW_ROW ? this.egw.lang("Tile view") : this.egw.lang('List view'));
|
||||
button_widget.set_image("list_" + (view == et2_nextmatch_controller.VIEW_ROW ? et2_nextmatch_controller.VIEW_TILE : et2_nextmatch_controller.VIEW_ROW));
|
||||
button_widget.set_statustext(view == et2_nextmatch_controller.VIEW_ROW ? this.egw.lang("Tile view") : this.egw.lang('List view'));
|
||||
}
|
||||
nm.set_view(view);
|
||||
// Put it into active filters (but don't refresh)
|
||||
nm.activeFilters["view"] = view;
|
||||
// Change template to match
|
||||
var template = view == nm.getController().VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile';
|
||||
var template = view == et2_nextmatch_controller.VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile';
|
||||
nm.set_template(template);
|
||||
// Wait for template to load, then refresh
|
||||
template = nm.getWidgetById(template);
|
||||
@ -724,8 +730,8 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
(dir && dir.data && dir.data.class && dir.data.class.indexOf('noEdit') === -1 || !dir)
|
||||
});
|
||||
// Last 10 folders
|
||||
var previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname));
|
||||
var action_index = 0;
|
||||
var previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname));
|
||||
var action_index = 0;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
var path = i < previous_dsts.length ? previous_dsts[i] : '';
|
||||
actions.push({
|
||||
@ -806,10 +812,10 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
}
|
||||
}
|
||||
// Remember the target for next time
|
||||
var previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname));
|
||||
var previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname));
|
||||
previous_dsts.unshift(dst);
|
||||
previous_dsts = Array.from(new Set(previous_dsts)).slice(0, 9);
|
||||
egw.set_preference(this.appname, 'drop_history', previous_dsts);
|
||||
previous_dsts = Array.from(new Set(previous_dsts)).slice(0, 9);
|
||||
egw.set_preference(this.appname, 'drop_history', previous_dsts);
|
||||
// Actual action id will be something like file_drop_{move|copy|link}[_other_id],
|
||||
// but we need to send move, copy or link
|
||||
var action_id = _action.id.replace("file_drop_", '').split('_', 1)[0];
|
||||
@ -976,7 +982,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
|
||||
*/
|
||||
filemanagerAPP.prototype._share_link_callback = function (_data) {
|
||||
if (_data.msg || _data.share_link)
|
||||
window.egw_refresh(_data.msg, this.appname);
|
||||
window.egw_refresh(_data.msg, this.appname);
|
||||
console.log("_data", _data);
|
||||
var app = this;
|
||||
var copy_link_to_clipboard = function (evt) {
|
||||
|
@ -744,9 +744,9 @@ export class filemanagerAPP extends EgwApp
|
||||
|
||||
// Toggle button icon to the other view
|
||||
//todo: nm.controller needs to be changed to nm.getController after merging typescript branch into master
|
||||
button_widget.set_image("list_"+(view == nm.getController().VIEW_ROW ? nm.getController().VIEW_TILE : nm.getController().VIEW_ROW));
|
||||
button_widget.set_image("list_"+(view == et2_nextmatch_controller.VIEW_ROW ? et2_nextmatch_controller.VIEW_TILE : et2_nextmatch_controller.VIEW_ROW));
|
||||
|
||||
button_widget.set_statustext(view == nm.getController().VIEW_ROW ? this.egw.lang("Tile view") : this.egw.lang('List view'));
|
||||
button_widget.set_statustext(view == et2_nextmatch_controller.VIEW_ROW ? this.egw.lang("Tile view") : this.egw.lang('List view'));
|
||||
}
|
||||
|
||||
nm.set_view(view);
|
||||
@ -754,7 +754,7 @@ export class filemanagerAPP extends EgwApp
|
||||
nm.activeFilters["view"]= view;
|
||||
|
||||
// Change template to match
|
||||
let template : any = view == nm.getController().VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile';
|
||||
let template : any = view == et2_nextmatch_controller.VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile';
|
||||
nm.set_template(template);
|
||||
|
||||
// Wait for template to load, then refresh
|
||||
|
Loading…
Reference in New Issue
Block a user