mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
fixed all errors in calendar, thought it's still not ok
also fixed a couple of errors in egw_action
This commit is contained in:
parent
771d6c727f
commit
4752331427
@ -208,7 +208,7 @@ jQuery(window).on("contextmenu",document, function(event) {
|
||||
/**
|
||||
* Creates an unique key for the given shortcut
|
||||
*/
|
||||
function egw_shortcutIdx(_keyCode, _shift, _ctrl, _alt)
|
||||
export function egw_shortcutIdx(_keyCode, _shift, _ctrl, _alt)
|
||||
{
|
||||
return "_" + _keyCode + "_" +
|
||||
(_shift ? "S" : "") +
|
||||
@ -229,7 +229,7 @@ var egw_registeredShortcuts = {}
|
||||
* parameter.
|
||||
* @param object _context is the context in which the function will be executed
|
||||
*/
|
||||
function egw_registerGlobalShortcut(_keyCode, _shift, _ctrl, _alt, _handler, _context)
|
||||
export function egw_registerGlobalShortcut(_keyCode, _shift, _ctrl, _alt, _handler, _context)
|
||||
{
|
||||
// Generate the hash map index for the shortcut
|
||||
var idx = egw_shortcutIdx(_keyCode, _shift, _ctrl, _alt);
|
||||
@ -250,7 +250,8 @@ function egw_registerGlobalShortcut(_keyCode, _shift, _ctrl, _alt, _handler, _co
|
||||
/**
|
||||
* Unregisters the given shortcut.
|
||||
*/
|
||||
function egw_unregisterGlobalShortcut(_keyCode, _shift, _ctrl, _alt) {
|
||||
export function egw_unregisterGlobalShortcut(_keyCode, _shift, _ctrl, _alt)
|
||||
{
|
||||
// Generate the hash map index for the shortcut
|
||||
var idx = egw_shortcutIdx(_keyCode, _shift, _ctrl, _alt);
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
* @Todo: @new-js-loader port to TypeScript
|
||||
*/
|
||||
import {egwMenuImpl} from './egw_menu_dhtmlx.js';
|
||||
import {egw_shortcutIdx} from './egw_keymanager.js';
|
||||
//Global variable which is used to store the currently active menu so that it
|
||||
//may be closed when another menu openes
|
||||
export var _egw_active_menu = null;
|
||||
@ -221,7 +222,7 @@ egwMenu.prototype.keyHandler = function(_keyCode, _shift, _ctrl, _alt)
|
||||
{
|
||||
for(let i = 0; i < child.children.length; i++)
|
||||
{
|
||||
result = find_func(child.children[i]);
|
||||
const result = find_func(child.children[i]);
|
||||
if(result) return result;
|
||||
}
|
||||
}
|
||||
@ -257,7 +258,7 @@ egwMenu.prototype.keyHandler = function(_keyCode, _shift, _ctrl, _alt)
|
||||
break;
|
||||
case EGW_KEY_ARROW_UP:
|
||||
case EGW_KEY_ARROW_DOWN:
|
||||
direction = _keyCode === EGW_KEY_ARROW_DOWN ? 1 : -1;
|
||||
const direction = _keyCode === EGW_KEY_ARROW_DOWN ? 1 : -1;
|
||||
let parent = current.parent;
|
||||
let index = parent.children.indexOf(current);
|
||||
let cont = false;
|
||||
|
@ -1,39 +1,21 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.listview = exports.planner = exports.month = exports.weekN = exports.week = exports.day4 = exports.day = exports.View = void 0;
|
||||
var View = /** @class */ (function () {
|
||||
function View() {
|
||||
}
|
||||
export class View {
|
||||
/**
|
||||
* Translated label for header
|
||||
* @param {Object} state
|
||||
* @returns {string}
|
||||
*/
|
||||
View.header = function (state) {
|
||||
var formatDate = new Date(state.date);
|
||||
static header(state) {
|
||||
let formatDate = new Date(state.date);
|
||||
formatDate = new Date(formatDate.valueOf() + formatDate.getTimezoneOffset() * 60 * 1000);
|
||||
return View._owner(state) + date(egw.preference('dateformat'), formatDate);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* If one owner, get the owner text
|
||||
*
|
||||
* @param {object} state
|
||||
*/
|
||||
View._owner = function (state) {
|
||||
var owner = '';
|
||||
static _owner(state) {
|
||||
let owner = '';
|
||||
if (state.owner.length && state.owner.length == 1 && app.calendar.sidebox_et2) {
|
||||
var own = app.calendar.sidebox_et2.getWidgetById('owner').getDOMNode();
|
||||
if (own.selectedIndex >= 0) {
|
||||
@ -41,33 +23,33 @@ var View = /** @class */ (function () {
|
||||
}
|
||||
}
|
||||
return owner;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Get the start date for this view
|
||||
* @param {Object} state
|
||||
* @returns {Date}
|
||||
*/
|
||||
View.start_date = function (state) {
|
||||
var d = state.date ? new Date(state.date) : new Date();
|
||||
static start_date(state) {
|
||||
const d = state.date ? new Date(state.date) : new Date();
|
||||
d.setUTCHours(0);
|
||||
d.setUTCMinutes(0);
|
||||
d.setUTCSeconds(0);
|
||||
d.setUTCMilliseconds(0);
|
||||
return d;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Get the end date for this view
|
||||
* @param {Object} state
|
||||
* @returns {Date}
|
||||
*/
|
||||
View.end_date = function (state) {
|
||||
var d = state.date ? new Date(state.date) : new Date();
|
||||
static end_date(state) {
|
||||
const d = state.date ? new Date(state.date) : new Date();
|
||||
d.setUTCHours(23);
|
||||
d.setUTCMinutes(59);
|
||||
d.setUTCSeconds(59);
|
||||
d.setUTCMilliseconds(0);
|
||||
return d;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Get the owner for this view
|
||||
*
|
||||
@ -77,24 +59,24 @@ var View = /** @class */ (function () {
|
||||
* @param {number[]|String} state state.owner List of owner IDs, or a comma seperated list
|
||||
* @returns {number[]|String}
|
||||
*/
|
||||
View.owner = function (state) {
|
||||
static owner(state) {
|
||||
return state.owner || 0;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Should the view show the weekends
|
||||
*
|
||||
* @param {object} state
|
||||
* @returns {boolean} Current preference to show 5 or 7 days in weekview
|
||||
*/
|
||||
View.show_weekend = function (state) {
|
||||
static show_weekend(state) {
|
||||
return state.weekend;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* How big or small are the displayed time chunks?
|
||||
*
|
||||
* @param {object} state
|
||||
*/
|
||||
View.granularity = function (state) {
|
||||
static granularity(state) {
|
||||
var list = egw.preference('use_time_grid', 'calendar');
|
||||
if (list == '0' || typeof list === 'undefined') {
|
||||
return parseInt('' + egw.preference('interval', 'calendar')) || 30;
|
||||
@ -109,10 +91,10 @@ var View = /** @class */ (function () {
|
||||
return list.indexOf(state.view) >= 0 ?
|
||||
0 :
|
||||
parseInt(egw.preference('interval', 'calendar')) || 30;
|
||||
};
|
||||
View.extend = function (sub) {
|
||||
}
|
||||
static extend(sub) {
|
||||
return jQuery.extend({}, this, { _super: this }, sub);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Determines the new date after scrolling. The default is 1 week.
|
||||
*
|
||||
@ -120,94 +102,76 @@ var View = /** @class */ (function () {
|
||||
* forward, negative for backward
|
||||
* @returns {Date}
|
||||
*/
|
||||
View.scroll = function (delta) {
|
||||
static scroll(delta) {
|
||||
var d = new Date(app.calendar.state.date);
|
||||
d.setUTCDate(d.getUTCDate() + (7 * delta));
|
||||
return d;
|
||||
};
|
||||
// List of etemplates to show for this view
|
||||
View.etemplates = ['calendar.view'];
|
||||
return View;
|
||||
}());
|
||||
exports.View = View;
|
||||
}
|
||||
}
|
||||
// List of etemplates to show for this view
|
||||
View.etemplates = ['calendar.view'];
|
||||
/**
|
||||
* Etemplates and settings for the different views. Some (day view)
|
||||
* use more than one template, some use the same template as others,
|
||||
* most need different handling for their various attributes.
|
||||
*/
|
||||
var day = /** @class */ (function (_super_1) {
|
||||
__extends(day, _super_1);
|
||||
function day() {
|
||||
return _super_1 !== null && _super_1.apply(this, arguments) || this;
|
||||
}
|
||||
day.header = function (state) {
|
||||
export class day extends View {
|
||||
static header(state) {
|
||||
var formatDate = new Date(state.date);
|
||||
formatDate = new Date(formatDate.valueOf() + formatDate.getTimezoneOffset() * 60 * 1000);
|
||||
return date('l, ', formatDate) + _super_1.header.call(this, state);
|
||||
};
|
||||
day.start_date = function (state) {
|
||||
var d = _super_1.start_date.call(this, state);
|
||||
return date('l, ', formatDate) + super.header(state);
|
||||
}
|
||||
static start_date(state) {
|
||||
var d = super.start_date(state);
|
||||
state.date = app.calendar.date.toString(d);
|
||||
return d;
|
||||
};
|
||||
day.show_weekend = function (state) {
|
||||
}
|
||||
static show_weekend(state) {
|
||||
state.days = '1';
|
||||
return true;
|
||||
};
|
||||
day.scroll = function (delta) {
|
||||
}
|
||||
static scroll(delta) {
|
||||
var d = new Date(app.calendar.state.date);
|
||||
d.setUTCDate(d.getUTCDate() + (delta));
|
||||
return d;
|
||||
};
|
||||
day.etemplates = ['calendar.view', 'calendar.todo'];
|
||||
return day;
|
||||
}(View));
|
||||
exports.day = day;
|
||||
var day4 = /** @class */ (function (_super_1) {
|
||||
__extends(day4, _super_1);
|
||||
function day4() {
|
||||
return _super_1 !== null && _super_1.apply(this, arguments) || this;
|
||||
}
|
||||
day4.end_date = function (state) {
|
||||
var d = _super_1.end_date.call(this, state);
|
||||
}
|
||||
day.etemplates = ['calendar.view', 'calendar.todo'];
|
||||
export class day4 extends View {
|
||||
static end_date(state) {
|
||||
var d = super.end_date(state);
|
||||
state.days = '4';
|
||||
d.setUTCHours(24 * 4 - 1);
|
||||
d.setUTCMinutes(59);
|
||||
d.setUTCSeconds(59);
|
||||
d.setUTCMilliseconds(0);
|
||||
return d;
|
||||
};
|
||||
day4.show_weekend = function (state) {
|
||||
}
|
||||
static show_weekend(state) {
|
||||
state.weekend = 'true';
|
||||
return true;
|
||||
};
|
||||
day4.scroll = function (delta) {
|
||||
}
|
||||
static scroll(delta) {
|
||||
var d = new Date(app.calendar.state.date);
|
||||
d.setUTCDate(d.getUTCDate() + (4 * delta));
|
||||
return d;
|
||||
};
|
||||
return day4;
|
||||
}(View));
|
||||
exports.day4 = day4;
|
||||
var week = /** @class */ (function (_super_1) {
|
||||
__extends(week, _super_1);
|
||||
function week() {
|
||||
return _super_1 !== null && _super_1.apply(this, arguments) || this;
|
||||
}
|
||||
week.header = function (state) {
|
||||
}
|
||||
export class week extends View {
|
||||
static header(state) {
|
||||
var end_date = state.last;
|
||||
if (!week.show_weekend(state)) {
|
||||
end_date = new Date(state.last);
|
||||
end_date.setUTCDate(end_date.getUTCDate() - 2);
|
||||
}
|
||||
return _super_1._owner.call(this, state) + app.calendar.egw.lang('Week') + ' ' +
|
||||
return super._owner(state) + app.calendar.egw.lang('Week') + ' ' +
|
||||
app.calendar.date.week_number(state.first) + ': ' +
|
||||
app.calendar.date.long_date(state.first, end_date);
|
||||
};
|
||||
week.start_date = function (state) {
|
||||
return app.calendar.date.start_of_week(_super_1.start_date.call(this, state));
|
||||
};
|
||||
week.end_date = function (state) {
|
||||
}
|
||||
static start_date(state) {
|
||||
return app.calendar.date.start_of_week(super.start_date(state));
|
||||
}
|
||||
static end_date(state) {
|
||||
var d = app.calendar.date.start_of_week(state.date || new Date());
|
||||
// Always 7 days, we just turn weekends on or off
|
||||
d.setUTCHours(24 * 7 - 1);
|
||||
@ -215,87 +179,69 @@ var week = /** @class */ (function (_super_1) {
|
||||
d.setUTCSeconds(59);
|
||||
d.setUTCMilliseconds(0);
|
||||
return d;
|
||||
};
|
||||
return week;
|
||||
}(View));
|
||||
exports.week = week;
|
||||
var weekN = /** @class */ (function (_super_1) {
|
||||
__extends(weekN, _super_1);
|
||||
function weekN() {
|
||||
return _super_1 !== null && _super_1.apply(this, arguments) || this;
|
||||
}
|
||||
weekN.header = function (state) {
|
||||
return _super_1._owner.call(this, state) + app.calendar.egw.lang('Week') + ' ' +
|
||||
}
|
||||
export class weekN extends View {
|
||||
static header(state) {
|
||||
return super._owner(state) + app.calendar.egw.lang('Week') + ' ' +
|
||||
app.calendar.date.week_number(state.first) + ' - ' +
|
||||
app.calendar.date.week_number(state.last) + ': ' +
|
||||
app.calendar.date.long_date(state.first, state.last);
|
||||
};
|
||||
weekN.start_date = function (state) {
|
||||
return app.calendar.date.start_of_week(_super_1.start_date.call(this, state));
|
||||
};
|
||||
weekN.end_date = function (state) {
|
||||
}
|
||||
static start_date(state) {
|
||||
return app.calendar.date.start_of_week(super.start_date(state));
|
||||
}
|
||||
static end_date(state) {
|
||||
state.days = '' + (state.days >= 5 ? state.days : egw.preference('days_in_weekview', 'calendar') || 7);
|
||||
var d = app.calendar.date.start_of_week(_super_1.start_date.call(this, state));
|
||||
var d = app.calendar.date.start_of_week(super.start_date(state));
|
||||
// Always 7 days, we just turn weekends on or off
|
||||
d.setUTCHours(24 * 7 * (parseInt(app.calendar.egw.preference('multiple_weeks', 'calendar')) || 3) - 1);
|
||||
return d;
|
||||
};
|
||||
return weekN;
|
||||
}(View));
|
||||
exports.weekN = weekN;
|
||||
var month = /** @class */ (function (_super_1) {
|
||||
__extends(month, _super_1);
|
||||
function month() {
|
||||
return _super_1 !== null && _super_1.apply(this, arguments) || this;
|
||||
}
|
||||
month.header = function (state) {
|
||||
}
|
||||
export class month extends View {
|
||||
static header(state) {
|
||||
var formatDate = new Date(state.date);
|
||||
formatDate = new Date(formatDate.valueOf() + formatDate.getTimezoneOffset() * 60 * 1000);
|
||||
return _super_1._owner.call(this, state) + app.calendar.egw.lang(date('F', formatDate)) + ' ' + date('Y', formatDate);
|
||||
};
|
||||
month.start_date = function (state) {
|
||||
var d = _super_1.start_date.call(this, state);
|
||||
return super._owner(state) + app.calendar.egw.lang(date('F', formatDate)) + ' ' + date('Y', formatDate);
|
||||
}
|
||||
static start_date(state) {
|
||||
var d = super.start_date(state);
|
||||
d.setUTCDate(1);
|
||||
return app.calendar.date.start_of_week(d);
|
||||
};
|
||||
month.end_date = function (state) {
|
||||
var d = _super_1.end_date.call(this, state);
|
||||
}
|
||||
static end_date(state) {
|
||||
var d = super.end_date(state);
|
||||
d = new Date(d.getFullYear(), d.getUTCMonth() + 1, 1, 0, -d.getTimezoneOffset(), 0);
|
||||
d.setUTCSeconds(d.getUTCSeconds() - 1);
|
||||
return app.calendar.date.end_of_week(d);
|
||||
};
|
||||
month.scroll = function (delta) {
|
||||
}
|
||||
static scroll(delta) {
|
||||
var d = new Date(app.calendar.state.date);
|
||||
// Set day to 15 so we don't get overflow on short months
|
||||
// eg. Aug 31 + 1 month = Sept 31 -> Oct 1
|
||||
d.setUTCDate(15);
|
||||
d.setUTCMonth(d.getUTCMonth() + delta);
|
||||
return d;
|
||||
};
|
||||
return month;
|
||||
}(View));
|
||||
exports.month = month;
|
||||
var planner = /** @class */ (function (_super_1) {
|
||||
__extends(planner, _super_1);
|
||||
function planner() {
|
||||
return _super_1 !== null && _super_1.apply(this, arguments) || this;
|
||||
}
|
||||
planner.header = function (state) {
|
||||
}
|
||||
export class planner extends View {
|
||||
static header(state) {
|
||||
var startDate = new Date(state.first);
|
||||
startDate = new Date(startDate.valueOf() + startDate.getTimezoneOffset() * 60 * 1000);
|
||||
var endDate = new Date(state.last);
|
||||
endDate = new Date(endDate.valueOf() + endDate.getTimezoneOffset() * 60 * 1000);
|
||||
return _super_1._owner.call(this, state) + date(egw.preference('dateformat'), startDate) +
|
||||
return super._owner(state) + date(egw.preference('dateformat'), startDate) +
|
||||
(startDate == endDate ? '' : ' - ' + date(egw.preference('dateformat'), endDate));
|
||||
};
|
||||
planner.group_by = function (state) {
|
||||
}
|
||||
static group_by(state) {
|
||||
return state.sortby ? state.sortby : 0;
|
||||
};
|
||||
}
|
||||
// Note: Planner uses the additional value of planner_view to determine
|
||||
// the start & end dates using other view's functions
|
||||
planner.start_date = function (state) {
|
||||
static start_date(state) {
|
||||
// Start here, in case we can't find anything better
|
||||
var d = _super_1.start_date.call(this, state);
|
||||
var d = super.start_date(state);
|
||||
if (state.sortby && state.sortby === 'month') {
|
||||
d.setUTCDate(1);
|
||||
}
|
||||
@ -311,9 +257,9 @@ var planner = /** @class */ (function (_super_1) {
|
||||
return d;
|
||||
}
|
||||
return d;
|
||||
};
|
||||
planner.end_date = function (state) {
|
||||
var d = _super_1.end_date.call(this, state);
|
||||
}
|
||||
static end_date(state) {
|
||||
var d = super.end_date(state);
|
||||
if (state.sortby && state.sortby === 'month') {
|
||||
d.setUTCDate(0);
|
||||
d.setUTCFullYear(d.getUTCFullYear() + 1);
|
||||
@ -330,17 +276,17 @@ var planner = /** @class */ (function (_super_1) {
|
||||
d = app.calendar.date.end_of_week(d);
|
||||
}
|
||||
return d;
|
||||
};
|
||||
planner.hide_empty = function (state) {
|
||||
}
|
||||
static hide_empty(state) {
|
||||
var check = state.sortby == 'user' ? ['user', 'both'] : ['cat', 'both'];
|
||||
return (check.indexOf(egw.preference('planner_show_empty_rows', 'calendar') + '') === -1);
|
||||
};
|
||||
planner.scroll = function (delta) {
|
||||
}
|
||||
static scroll(delta) {
|
||||
if (app.calendar.state.planner_view && !isNaN(delta) && app.calendar.state.sortby !== "month") {
|
||||
return app.classes.calendar.views[app.calendar.state.planner_view].scroll(delta);
|
||||
}
|
||||
var d = new Date(app.calendar.state.date);
|
||||
var days = 1;
|
||||
let d = new Date(app.calendar.state.date);
|
||||
let days = 1;
|
||||
delta = parseInt(delta) || 0;
|
||||
// Yearly view, grouped by month - scroll 1 month
|
||||
if (app.calendar.state.sortby === 'month') {
|
||||
@ -354,7 +300,7 @@ var planner = /** @class */ (function (_super_1) {
|
||||
// makes things buggy
|
||||
if (app.calendar.state.first && app.calendar.state.last) {
|
||||
//@ts-ignore
|
||||
var diff = new Date(app.calendar.state.last) - new Date(app.calendar.state.first);
|
||||
let diff = new Date(app.calendar.state.last) - new Date(app.calendar.state.first);
|
||||
days = Math.round(diff / (1000 * 3600 * 24));
|
||||
}
|
||||
d.setUTCDate(d.getUTCDate() + (days * delta));
|
||||
@ -362,29 +308,21 @@ var planner = /** @class */ (function (_super_1) {
|
||||
d = app.calendar.date.start_of_week(d);
|
||||
}
|
||||
return d;
|
||||
};
|
||||
planner.etemplates = ['calendar.planner'];
|
||||
return planner;
|
||||
}(View));
|
||||
exports.planner = planner;
|
||||
var listview = /** @class */ (function (_super_1) {
|
||||
__extends(listview, _super_1);
|
||||
function listview() {
|
||||
return _super_1 !== null && _super_1.apply(this, arguments) || this;
|
||||
}
|
||||
listview.header = function (state) {
|
||||
}
|
||||
planner.etemplates = ['calendar.planner'];
|
||||
export class listview extends View {
|
||||
static header(state) {
|
||||
var startDate = new Date(state.first || state.date);
|
||||
startDate = new Date(startDate.valueOf() + startDate.getTimezoneOffset() * 60 * 1000);
|
||||
var start_check = '' + startDate.getFullYear() + startDate.getMonth() + startDate.getDate();
|
||||
var endDate = new Date(state.last || state.date);
|
||||
endDate = new Date(endDate.valueOf() + endDate.getTimezoneOffset() * 60 * 1000);
|
||||
var end_check = '' + endDate.getFullYear() + endDate.getMonth() + endDate.getDate();
|
||||
return _super_1._owner.call(this, state) +
|
||||
return super._owner(state) +
|
||||
date(egw.preference('dateformat'), startDate) +
|
||||
(start_check == end_check ? '' : ' - ' + date(egw.preference('dateformat'), endDate));
|
||||
};
|
||||
listview.etemplates = ['calendar.list'];
|
||||
return listview;
|
||||
}(View));
|
||||
exports.listview = listview;
|
||||
}
|
||||
}
|
||||
listview.etemplates = ['calendar.list'];
|
||||
//# sourceMappingURL=View.js.map
|
@ -2,6 +2,12 @@
|
||||
* Super class for the different views.
|
||||
*
|
||||
* Each separate view overrides what it needs
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
*/
|
||||
import {etemplate2} from "../../api/js/etemplate/etemplate2";
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,12 @@
|
||||
/**
|
||||
* EGroupware - Calendar - Javascript UI
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @link https://www.egroupware.org
|
||||
* @package calendar
|
||||
* @author Hadi Nategh <hn-AT-stylite.de>
|
||||
* @author Hadi Nategh <hn-AT-egroupware.org>
|
||||
* @author Nathan Gray
|
||||
* @copyright (c) 2008-16 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2008-21 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/*egw:uses
|
||||
@ -37,6 +36,19 @@ import {et2_selectbox} from "../../api/js/etemplate/et2_widget_selectbox";
|
||||
import {et2_widget} from "../../api/js/etemplate/et2_core_widget";
|
||||
import {et2_nextmatch} from "../../api/js/etemplate/et2_extension_nextmatch";
|
||||
import {et2_inputWidget} from "../../api/js/etemplate/et2_core_inputWidget";
|
||||
import {et2_iframe} from "../../api/js/etemplate/et2_widget_iframe";
|
||||
import {date} from "../../api/js/etemplate/lib/date.js";
|
||||
import {sprintf} from "../../api/js/egw_action/egw_action_common.js";
|
||||
import {egw_registerGlobalShortcut} from "";
|
||||
|
||||
// et2 widgets need to be imported, so they register themselves
|
||||
import "./et2_widget_daycol";
|
||||
import "./et2_widget_event";
|
||||
import "./et2_widget_owner";
|
||||
import "./et2_widget_planner";
|
||||
import "./et2_widget_planner_row";
|
||||
import "./et2_widget_timegrid";
|
||||
import "./et2_widget_view";
|
||||
|
||||
/**
|
||||
* UI for calendar
|
||||
@ -60,7 +72,7 @@ import {et2_inputWidget} from "../../api/js/etemplate/et2_core_inputWidget";
|
||||
* changed, we discard the daywise cache and ask the server for the filtered events.
|
||||
*
|
||||
*/
|
||||
class CalendarApp extends EgwApp
|
||||
export class CalendarApp extends EgwApp
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Egroupware
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage api
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
/*egw:uses
|
||||
et2_core_valueWidget;
|
||||
@ -20,6 +20,8 @@ import { ClassWithAttributes } from "../../api/js/etemplate/et2_core_inheritance
|
||||
import { et2_no_init } from "../../api/js/etemplate/et2_core_common";
|
||||
import { egw } from "../../api/js/jsapi/egw_global";
|
||||
import { egwIsMobile } from "../../api/js/egw_action/egw_action_common.js";
|
||||
import { CalendarApp } from "./app";
|
||||
import { sprintf } from "../../api/js/egw_action/egw_action_common.js";
|
||||
/**
|
||||
* Class which implements the "calendar-timegrid" XET-Tag for displaying a single days
|
||||
*
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Egroupware
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage api
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
|
||||
@ -25,6 +25,8 @@ import {et2_IDetachedDOM, et2_IResizeable} from "../../api/js/etemplate/et2_core
|
||||
import {et2_no_init} from "../../api/js/etemplate/et2_core_common";
|
||||
import {egw} from "../../api/js/jsapi/egw_global";
|
||||
import {egwIsMobile} from "../../api/js/egw_action/egw_action_common.js";
|
||||
import {CalendarApp} from "./app";
|
||||
import {sprintf} from "../../api/js/egw_action/egw_action_common.js";
|
||||
|
||||
/**
|
||||
* Class which implements the "calendar-timegrid" XET-Tag for displaying a single days
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Egroupware Calendar event widget
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage api
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
/*egw:uses
|
||||
/etemplate/js/et2_core_valueWidget;
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Egroupware Calendar event widget
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage api
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,32 +1,17 @@
|
||||
"use strict";
|
||||
/*
|
||||
* Egroupware
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package
|
||||
* @subpackage
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.et2_calendar_owner = void 0;
|
||||
/*egw:uses
|
||||
et2_widget_taglist;
|
||||
*/
|
||||
var et2_core_widget_1 = require("../../api/js/etemplate/et2_core_widget");
|
||||
import { et2_register_widget } from "../../api/js/etemplate/et2_core_widget";
|
||||
import { et2_taglist_email } from "../../api/js/etemplate/et2_widget_taglist";
|
||||
/**
|
||||
* Tag list widget customised for calendar owner, which can be a user
|
||||
* account or group, or an entry from almost any app, or an email address
|
||||
@ -37,12 +22,11 @@ var et2_core_widget_1 = require("../../api/js/etemplate/et2_core_widget");
|
||||
* @see http://nicolasbize.github.io/magicsuggest/
|
||||
* @augments et2_selectbox
|
||||
*/
|
||||
var et2_calendar_owner = /** @class */ (function (_super) {
|
||||
__extends(et2_calendar_owner, _super);
|
||||
function et2_calendar_owner() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
export class et2_calendar_owner extends et2_taglist_email {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
// Allows sub-widgets to override options to the library
|
||||
_this.lib_options = {
|
||||
this.lib_options = {
|
||||
autoSelect: false,
|
||||
groupBy: 'app',
|
||||
minChars: 2,
|
||||
@ -52,18 +36,17 @@ var et2_calendar_owner = /** @class */ (function (_super) {
|
||||
//expandOnFocus: true
|
||||
toggleOnClick: true
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
et2_calendar_owner.prototype.doLoadingFinished = function () {
|
||||
_super.prototype.doLoadingFinished.call(this);
|
||||
doLoadingFinished() {
|
||||
super.doLoadingFinished();
|
||||
var widget = this;
|
||||
// onChange fired when losing focus, which is different from normal
|
||||
this._oldValue = this.taglist.getValue();
|
||||
return true;
|
||||
};
|
||||
et2_calendar_owner.prototype.selectionRenderer = function (item) {
|
||||
}
|
||||
selectionRenderer(item) {
|
||||
if (this && this.options && this.options.allowFreeEntries) {
|
||||
return _super.prototype.selectionRenderer.call(this, item);
|
||||
return super.selectionRenderer(item);
|
||||
}
|
||||
else {
|
||||
var label = jQuery('<span>').text(item.label);
|
||||
@ -84,12 +67,12 @@ var et2_calendar_owner = /** @class */ (function (_super) {
|
||||
}
|
||||
return label;
|
||||
}
|
||||
};
|
||||
et2_calendar_owner.prototype.getValue = function () {
|
||||
}
|
||||
getValue() {
|
||||
if (this.taglist == null)
|
||||
return null;
|
||||
return this.taglist.getValue();
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Override parent to handle our special additional data types (c#,r#,etc.) when they
|
||||
* are not available client side.
|
||||
@ -97,11 +80,11 @@ var et2_calendar_owner = /** @class */ (function (_super) {
|
||||
* @param {string|string[]} _value array of selected owners, which can be a number,
|
||||
* or a number prefixed with one character indicating the resource type.
|
||||
*/
|
||||
et2_calendar_owner.prototype.set_value = function (_value) {
|
||||
_super.prototype.set_value.call(this, _value);
|
||||
set_value(_value) {
|
||||
super.set_value(_value);
|
||||
// If parent didn't find a label, label will be the same as ID so we
|
||||
// can find them that way
|
||||
var missing_labels = [];
|
||||
let missing_labels = [];
|
||||
for (var i = 0; i < this.options.value.length; i++) {
|
||||
var value = this.options.value[i];
|
||||
if (value.id == value.label) {
|
||||
@ -111,19 +94,15 @@ var et2_calendar_owner = /** @class */ (function (_super) {
|
||||
if (Object.keys(missing_labels).length > 0) {
|
||||
// Proper label was not found by parent - ask directly
|
||||
egw.json('calendar_owner_etemplate_widget::ajax_owner', [missing_labels], function (data) {
|
||||
var _loop_1 = function (owner) {
|
||||
for (let owner in data) {
|
||||
if (!owner || typeof owner == "undefined")
|
||||
return "continue";
|
||||
var idx = this_1.options.value.find(function (element) { return element.id == owner; });
|
||||
continue;
|
||||
let idx = this.options.value.find(element => element.id == owner);
|
||||
if (idx) {
|
||||
idx = jQuery.extend(idx, data[owner]);
|
||||
}
|
||||
// Put it in the list of options for next time
|
||||
this_1.options.select_options.push(data[owner]);
|
||||
};
|
||||
var this_1 = this;
|
||||
for (var owner in data) {
|
||||
_loop_1(owner);
|
||||
this.options.select_options.push(data[owner]);
|
||||
}
|
||||
this.set_value(this.options.value);
|
||||
}, this, true, this).sendRequest();
|
||||
@ -132,31 +111,29 @@ var et2_calendar_owner = /** @class */ (function (_super) {
|
||||
this.taglist.clear(true);
|
||||
this.taglist.addToSelection(this.options.value, true);
|
||||
}
|
||||
};
|
||||
et2_calendar_owner._attributes = {
|
||||
"autocomplete_url": {
|
||||
"default": "calendar_owner_etemplate_widget::ajax_owner"
|
||||
},
|
||||
"autocomplete_params": {
|
||||
"name": "Autocomplete parameters",
|
||||
"type": "any",
|
||||
"default": {},
|
||||
"description": "Extra parameters passed to autocomplete URL. It should be a stringified JSON object."
|
||||
},
|
||||
allowFreeEntries: {
|
||||
"default": false,
|
||||
ignore: true
|
||||
},
|
||||
select_options: {
|
||||
"type": "any",
|
||||
"name": "Select options",
|
||||
// Set to empty object to use selectbox's option finding
|
||||
"default": {},
|
||||
"description": "Internally used to hold the select options."
|
||||
}
|
||||
};
|
||||
return et2_calendar_owner;
|
||||
}(et2_taglist_email));
|
||||
exports.et2_calendar_owner = et2_calendar_owner;
|
||||
et2_core_widget_1.et2_register_widget(et2_calendar_owner, ["calendar-owner"]);
|
||||
}
|
||||
}
|
||||
et2_calendar_owner._attributes = {
|
||||
"autocomplete_url": {
|
||||
"default": "calendar_owner_etemplate_widget::ajax_owner"
|
||||
},
|
||||
"autocomplete_params": {
|
||||
"name": "Autocomplete parameters",
|
||||
"type": "any",
|
||||
"default": {},
|
||||
"description": "Extra parameters passed to autocomplete URL. It should be a stringified JSON object."
|
||||
},
|
||||
allowFreeEntries: {
|
||||
"default": false,
|
||||
ignore: true
|
||||
},
|
||||
select_options: {
|
||||
"type": "any",
|
||||
"name": "Select options",
|
||||
// Set to empty object to use selectbox's option finding
|
||||
"default": {},
|
||||
"description": "Internally used to hold the select options."
|
||||
}
|
||||
};
|
||||
et2_register_widget(et2_calendar_owner, ["calendar-owner"]);
|
||||
//# sourceMappingURL=et2_widget_owner.js.map
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Egroupware
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package
|
||||
* @subpackage
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
|
||||
@ -13,9 +13,9 @@
|
||||
et2_widget_taglist;
|
||||
*/
|
||||
|
||||
import {et2_register_widget, WidgetConfig} from "../../api/js/etemplate/et2_core_widget";
|
||||
import {ClassWithAttributes} from "../../api/js/etemplate/et2_core_inheritance";
|
||||
import {et2_register_widget} from "../../api/js/etemplate/et2_core_widget";
|
||||
import {et2_selectbox} from "../../api/js/etemplate/et2_widget_selectbox";
|
||||
import {et2_taglist_email} from "../../api/js/etemplate/et2_widget_taglist";
|
||||
|
||||
/**
|
||||
* Tag list widget customised for calendar owner, which can be a user
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Egroupware Calendar timegrid
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage api
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
/*egw:uses
|
||||
/calendar/js/et2_widget_view.js;
|
||||
@ -21,6 +21,9 @@ import { et2_calendar_planner_row } from "./et2_widget_planner_row";
|
||||
import { egw } from "../../api/js/jsapi/egw_global";
|
||||
import { EGW_AI_DRAG_OVER, EGW_AO_FLAG_IS_CONTAINER, egw_getObjectManager, egwActionObject } from "../../api/js/egw_action/egw_action.js";
|
||||
import { et2_compileLegacyJS } from "../../api/js/etemplate/et2_core_legacyJSFunctions";
|
||||
import { et2_no_init } from "../../api/js/etemplate/et2_core_common";
|
||||
import { CalendarApp } from "./app";
|
||||
import { sprintf } from "../../api/js/egw_action/egw_action_common.js";
|
||||
/**
|
||||
* Class which implements the "calendar-planner" XET-Tag for displaying a longer
|
||||
* ( > 10 days) span of time. Events can be grouped into rows by either user,
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Egroupware Calendar timegrid
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage api
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
|
||||
@ -25,6 +25,9 @@ import {egw} from "../../api/js/jsapi/egw_global";
|
||||
import {EGW_AI_DRAG_OVER, EGW_AO_FLAG_IS_CONTAINER, egw_getObjectManager, egwActionObject} from "../../api/js/egw_action/egw_action.js";
|
||||
import {et2_IDetachedDOM, et2_IPrint, et2_IResizeable} from "../../api/js/etemplate/et2_core_interfaces";
|
||||
import {et2_compileLegacyJS} from "../../api/js/etemplate/et2_core_legacyJSFunctions";
|
||||
import {et2_no_init} from "../../api/js/etemplate/et2_core_common";
|
||||
import {CalendarApp} from "./app";
|
||||
import {sprintf} from "../../api/js/egw_action/egw_action_common.js";
|
||||
|
||||
/**
|
||||
* Class which implements the "calendar-planner" XET-Tag for displaying a longer
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Egroupware
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package
|
||||
* @subpackage
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
/*egw:uses
|
||||
/calendar/js/et2_widget_view.js;
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Egroupware
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package
|
||||
* @subpackage
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/*egw:uses
|
||||
@ -76,7 +76,7 @@ export class et2_calendar_planner_row extends et2_valueWidget implements et2_IRe
|
||||
this.setDOMNode(this.div[0]);
|
||||
|
||||
// Used for its date calculations
|
||||
this._date_helper = et2_createWidget('date-time', {}, null);
|
||||
this._date_helper = <et2_date>et2_createWidget('date-time', {}, null);
|
||||
this._date_helper.loadingFinished();
|
||||
|
||||
this.set_start_date(this.options.start_date);
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Egroupware Calendar timegrid
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage api
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
/*egw:uses
|
||||
/calendar/js/et2_widget_view.js;
|
||||
@ -22,6 +22,8 @@ import { et2_IResizeable } from "../../api/js/etemplate/et2_core_interfaces";
|
||||
import { et2_calendar_event } from "./et2_widget_event";
|
||||
import { EGW_AI_DRAG_OVER, EGW_AI_DRAG_OUT, egwActionObject, egw_getObjectManager } from "../../api/js/egw_action/egw_action.js";
|
||||
import { et2_compileLegacyJS } from "../../api/js/etemplate/et2_core_legacyJSFunctions";
|
||||
import { et2_dialog } from "../../api/js/etemplate/et2_widget_dialog";
|
||||
import { sprintf } from "../../api/js/egw_action/egw_action_common.js";
|
||||
/**
|
||||
* Class which implements the "calendar-timegrid" XET-Tag for displaying a span of days
|
||||
*
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Egroupware Calendar timegrid
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage api
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
|
||||
@ -25,6 +25,8 @@ import {et2_IDetachedDOM, et2_IPrint, et2_IResizeable} from "../../api/js/etempl
|
||||
import {et2_calendar_event} from "./et2_widget_event";
|
||||
import {EGW_AI_DRAG_OVER, EGW_AI_DRAG_OUT, egwActionObject, egw_getObjectManager} from "../../api/js/egw_action/egw_action.js";
|
||||
import {et2_compileLegacyJS} from "../../api/js/etemplate/et2_core_legacyJSFunctions";
|
||||
import {et2_dialog} from "../../api/js/etemplate/et2_widget_dialog";
|
||||
import {sprintf} from "../../api/js/egw_action/egw_action_common.js";
|
||||
|
||||
/**
|
||||
* Class which implements the "calendar-timegrid" XET-Tag for displaying a span of days
|
||||
|
@ -1,30 +1,20 @@
|
||||
"use strict";
|
||||
/*
|
||||
* Egroupware
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package
|
||||
* @subpackage
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.et2_calendar_view = void 0;
|
||||
var et2_core_valueWidget_1 = require("../../api/js/etemplate/et2_core_valueWidget");
|
||||
var et2_core_inheritance_1 = require("../../api/js/etemplate/et2_core_inheritance");
|
||||
/*egw:uses
|
||||
/etemplate/js/et2_core_valueWidget;
|
||||
*/
|
||||
import { et2_createWidget } from "../../api/js/etemplate/et2_core_widget";
|
||||
import { et2_valueWidget } from "../../api/js/etemplate/et2_core_valueWidget";
|
||||
import { ClassWithAttributes } from "../../api/js/etemplate/et2_core_inheritance";
|
||||
import { sprintf } from "../../api/js/egw_action/egw_action_common.js";
|
||||
|
||||
/**
|
||||
* Parent class for the various calendar views to reduce copied code
|
||||
*
|
||||
@ -34,37 +24,34 @@ var et2_core_inheritance_1 = require("../../api/js/etemplate/et2_core_inheritanc
|
||||
*
|
||||
* @augments et2_valueWidget
|
||||
*/
|
||||
var et2_calendar_view = /** @class */ (function (_super) {
|
||||
__extends(et2_calendar_view, _super);
|
||||
export class et2_calendar_view extends et2_valueWidget {
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*/
|
||||
function et2_calendar_view(_parent, _attrs, _child) {
|
||||
var _this =
|
||||
constructor(_parent, _attrs, _child) {
|
||||
// Call the inherited constructor
|
||||
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_calendar_view._attributes, _child || {})) || this;
|
||||
_this.dataStorePrefix = 'calendar';
|
||||
_this.update_timer = null;
|
||||
_this.now_timer = null;
|
||||
super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_calendar_view._attributes, _child || {}));
|
||||
this.dataStorePrefix = 'calendar';
|
||||
this.update_timer = null;
|
||||
this.now_timer = null;
|
||||
// Used for its date calculations
|
||||
_this._date_helper = et2_createWidget('date-time', {}, null);
|
||||
_this._date_helper.loadingFinished();
|
||||
_this.loader = jQuery('<div class="egw-loading-prompt-container ui-front loading"></div>');
|
||||
_this.now_div = jQuery('<div class="calendar_now"/>');
|
||||
_this.update_timer = null;
|
||||
_this.now_timer = null;
|
||||
this._date_helper = et2_createWidget('date-time', {}, null);
|
||||
this._date_helper.loadingFinished();
|
||||
this.loader = jQuery('<div class="egw-loading-prompt-container ui-front loading"></div>');
|
||||
this.now_div = jQuery('<div class="calendar_now"/>');
|
||||
this.update_timer = null;
|
||||
this.now_timer = null;
|
||||
// Used to support dragging on empty space to create an event
|
||||
_this.drag_create = {
|
||||
this.drag_create = {
|
||||
start: null,
|
||||
end: null,
|
||||
parent: null,
|
||||
event: null
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
et2_calendar_view.prototype.destroy = function () {
|
||||
_super.prototype.destroy.call(this);
|
||||
destroy() {
|
||||
super.destroy();
|
||||
// date_helper has no parent, so we must explicitly remove it
|
||||
this._date_helper.destroy();
|
||||
this._date_helper = null;
|
||||
@ -76,9 +63,9 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
if (this.now_timer) {
|
||||
window.clearInterval(this.now_timer);
|
||||
}
|
||||
};
|
||||
et2_calendar_view.prototype.doLoadingFinished = function () {
|
||||
_super.prototype.doLoadingFinished.call(this);
|
||||
}
|
||||
doLoadingFinished() {
|
||||
super.doLoadingFinished();
|
||||
this.loader.hide(0).prependTo(this.div);
|
||||
this.div.append(this.now_div);
|
||||
if (this.options.owner)
|
||||
@ -86,7 +73,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
// Start moving 'now' line
|
||||
this.now_timer = window.setInterval(this._updateNow.bind(this), 60000);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Something changed, and the view need to be re-drawn. We wait a bit to
|
||||
* avoid re-drawing twice if start and end date both changed, then recreate
|
||||
@ -98,9 +85,9 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
*
|
||||
* @memberOf et2_calendar_view
|
||||
*/
|
||||
et2_calendar_view.prototype.invalidate = function (trigger_event) {
|
||||
invalidate(trigger_event) {
|
||||
// If this wasn't a stub, we'd set this.update_timer
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Returns the current start date
|
||||
*
|
||||
@ -108,9 +95,9 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
*
|
||||
* @memberOf et2_calendar_view
|
||||
*/
|
||||
et2_calendar_view.prototype.get_start_date = function () {
|
||||
get_start_date() {
|
||||
return new Date(this.options.start_date);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Returns the current start date
|
||||
*
|
||||
@ -118,9 +105,9 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
*
|
||||
* @memberOf et2_calendar_view
|
||||
*/
|
||||
et2_calendar_view.prototype.get_end_date = function () {
|
||||
get_end_date() {
|
||||
return new Date(this.options.end_date);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Change the start date
|
||||
*
|
||||
@ -133,7 +120,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
*
|
||||
* @memberOf et2_calendar_view
|
||||
*/
|
||||
et2_calendar_view.prototype.set_start_date = function (new_date) {
|
||||
set_start_date(new_date) {
|
||||
if (!new_date || new_date === null) {
|
||||
new_date = new Date();
|
||||
}
|
||||
@ -153,7 +140,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
if (old_date !== this.options.start_date && this.isAttached()) {
|
||||
this.invalidate(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Change the end date
|
||||
*
|
||||
@ -166,7 +153,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
*
|
||||
* @memberOf et2_calendar_view
|
||||
*/
|
||||
et2_calendar_view.prototype.set_end_date = function (new_date) {
|
||||
set_end_date(new_date) {
|
||||
if (!new_date || new_date === null) {
|
||||
new_date = new Date();
|
||||
}
|
||||
@ -186,7 +173,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
if (old_date !== this.options.end_date && this.isAttached()) {
|
||||
this.invalidate(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Set which users to display
|
||||
*
|
||||
@ -200,7 +187,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
*
|
||||
* @memberOf et2_calendar_view
|
||||
*/
|
||||
et2_calendar_view.prototype.set_owner = function (_owner) {
|
||||
set_owner(_owner) {
|
||||
var old = this.options.owner;
|
||||
// 0 means current user, but that causes problems for comparison,
|
||||
// so we'll just switch to the actual ID
|
||||
@ -226,7 +213,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
typeof old === 'string' && '' + old !== '' + this.options.owner)) {
|
||||
this.invalidate(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Provide specific data to be displayed.
|
||||
* This is a way to set start and end dates, owner and event data in one call.
|
||||
@ -245,7 +232,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
* necessarily an entry from the resource app), or a list containing a
|
||||
* combination of both.
|
||||
*/
|
||||
et2_calendar_view.prototype.set_value = function (events) {
|
||||
set_value(events) {
|
||||
if (typeof events !== 'object')
|
||||
return false;
|
||||
if (events.length && events.length > 0 || !jQuery.isEmptyObject(events)) {
|
||||
@ -274,17 +261,13 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
if (!this.update_timer) {
|
||||
window.setTimeout(jQuery.proxy(function () { this.loader.hide(); }, this), 200);
|
||||
}
|
||||
};
|
||||
Object.defineProperty(et2_calendar_view.prototype, "date_helper", {
|
||||
get: function () {
|
||||
return this._date_helper;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
et2_calendar_view.prototype._createNamespace = function () {
|
||||
}
|
||||
get date_helper() {
|
||||
return this._date_helper;
|
||||
}
|
||||
_createNamespace() {
|
||||
return true;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Update the 'now' line
|
||||
*
|
||||
@ -293,7 +276,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
et2_calendar_view.prototype._updateNow = function () {
|
||||
_updateNow() {
|
||||
var tempDate = new Date();
|
||||
var now = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(), tempDate.getHours(), tempDate.getMinutes() - tempDate.getTimezoneOffset(), 0);
|
||||
// Use date widget's existing functions to deal
|
||||
@ -304,7 +287,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
}
|
||||
this.now_div.hide();
|
||||
return false;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Calendar supports many different owner types, including users & resources.
|
||||
* This translates an ID to a user-friendly name.
|
||||
@ -314,7 +297,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
*
|
||||
* @memberOf et2_calendar_view
|
||||
*/
|
||||
et2_calendar_view.prototype._get_owner_name = function (user) {
|
||||
_get_owner_name(user) {
|
||||
var label = undefined;
|
||||
if (parseInt(user) === 0) {
|
||||
// 0 means current user
|
||||
@ -335,7 +318,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
}
|
||||
if (typeof label === 'undefined') {
|
||||
// Not found? Ask the sidebox owner widget (it gets updated) or the original arrayMgr
|
||||
var options = false;
|
||||
let options = false;
|
||||
if (app.calendar && app.calendar.sidebox_et2 && app.calendar.sidebox_et2.getWidgetById('owner')) {
|
||||
options = app.calendar.sidebox_et2.getWidgetById('owner').taglist.getSelection();
|
||||
}
|
||||
@ -365,14 +348,14 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
et2_calendar_view.owner_name_cache[user] = label;
|
||||
}
|
||||
return label;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Find the event information linked to a given DOM node
|
||||
*
|
||||
* @param {HTMLElement} dom_node - It should have something to do with an event
|
||||
* @returns {Object}
|
||||
*/
|
||||
et2_calendar_view.prototype._get_event_info = function (dom_node) {
|
||||
_get_event_info(dom_node) {
|
||||
// Determine as much relevant info as can be found
|
||||
var event_node = jQuery(dom_node).closest('[data-id]', this.div)[0];
|
||||
var day_node = jQuery(event_node).closest('[data-date]', this.div)[0];
|
||||
@ -388,7 +371,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
result.widget_id = 'event_' + widget_id.join('');
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Starting (mousedown) handler to support drag to create
|
||||
*
|
||||
@ -398,7 +381,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
*
|
||||
* @param {String} start Date string (JSON format)
|
||||
*/
|
||||
et2_calendar_view.prototype._drag_create_start = function (start) {
|
||||
_drag_create_start(start) {
|
||||
this.drag_create.start = jQuery.extend({}, start);
|
||||
if (!this.drag_create.start.date) {
|
||||
this.drag_create.start = null;
|
||||
@ -416,12 +399,12 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
// Create event
|
||||
this._drag_create_event();
|
||||
}, this), 250);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Create or update an event used for feedback while dragging on empty space,
|
||||
* so user can see something is happening
|
||||
*/
|
||||
et2_calendar_view.prototype._drag_create_event = function () {
|
||||
_drag_create_event() {
|
||||
if (!this.drag_create.parent || !this.drag_create.start) {
|
||||
return;
|
||||
}
|
||||
@ -447,8 +430,8 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
this.drag_create.event._values_check(value);
|
||||
this.drag_create.event.doLoadingFinished();
|
||||
}
|
||||
};
|
||||
et2_calendar_view.prototype._drag_update_event = function () {
|
||||
}
|
||||
_drag_update_event() {
|
||||
if (!this.drag_create.event || !this.drag_create.start || !this.drag_create.end
|
||||
|| !this.drag_create.parent || !this.drag_create.event._type) {
|
||||
return;
|
||||
@ -459,13 +442,13 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
}
|
||||
this.drag_create.event._update();
|
||||
this.drag_create.parent.position_event(this.drag_create.event);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Ending (mouseup) handler to support drag to create
|
||||
*
|
||||
* @param {String} end Date string (JSON format)
|
||||
*/
|
||||
et2_calendar_view.prototype._drag_create_end = function (end) {
|
||||
_drag_create_end(end) {
|
||||
this.div.css('cursor', '');
|
||||
if (typeof end === 'undefined') {
|
||||
end = {};
|
||||
@ -492,7 +475,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
jQuery.extend(options, this.drag_create.start, end);
|
||||
delete (options.date);
|
||||
// Make sure parent is set, if needed
|
||||
var app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||
let app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
|
||||
if (this.drag_create.parent && this.drag_create.parent.options.owner !== app_calendar.state.owner && !options.owner) {
|
||||
options.owner = this.drag_create.parent.options.owner;
|
||||
}
|
||||
@ -526,7 +509,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
this.drag_create.event = null;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Check if the view should be consolidated into one, or listed seperately
|
||||
* based on the user's preferences
|
||||
@ -536,12 +519,12 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
* @returns {boolean} True of only one is needed, false if each owner needs
|
||||
* to be listed seperately.
|
||||
*/
|
||||
et2_calendar_view.is_consolidated = function (owners, view) {
|
||||
static is_consolidated(owners, view) {
|
||||
// Seperate owners, or consolidated?
|
||||
return !(owners.length > 1 &&
|
||||
(view === 'day' && owners.length < parseInt('' + egw.preference('day_consolidate', 'calendar')) ||
|
||||
view === 'week' && owners.length < parseInt('' + egw.preference('week_consolidate', 'calendar'))));
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Fetch and cache a list of the year's holidays
|
||||
*
|
||||
@ -549,7 +532,7 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
* @param {string|numeric} year
|
||||
* @returns {Array}
|
||||
*/
|
||||
et2_calendar_view.get_holidays = function (widget, year) {
|
||||
static get_holidays(widget, year) {
|
||||
// Loaded in an iframe or something
|
||||
var view = egw.window.et2_calendar_view ? egw.window.et2_calendar_view : this;
|
||||
// No country selected causes error, so skip if it's missing
|
||||
@ -582,29 +565,27 @@ var et2_calendar_view = /** @class */ (function (_super) {
|
||||
else {
|
||||
return cache;
|
||||
}
|
||||
};
|
||||
et2_calendar_view._attributes = {
|
||||
owner: {
|
||||
name: "Owner",
|
||||
type: "any",
|
||||
default: [egw.user('account_id')],
|
||||
description: "Account ID number of the calendar owner, if not the current user"
|
||||
},
|
||||
start_date: {
|
||||
name: "Start date",
|
||||
type: "any"
|
||||
},
|
||||
end_date: {
|
||||
name: "End date",
|
||||
type: "any"
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Cache to map owner & resource IDs to names, helps cut down on server requests
|
||||
*/
|
||||
et2_calendar_view.owner_name_cache = {};
|
||||
et2_calendar_view.holiday_cache = {};
|
||||
return et2_calendar_view;
|
||||
}(et2_core_valueWidget_1.et2_valueWidget));
|
||||
exports.et2_calendar_view = et2_calendar_view;
|
||||
}
|
||||
}
|
||||
et2_calendar_view._attributes = {
|
||||
owner: {
|
||||
name: "Owner",
|
||||
type: "any",
|
||||
default: [egw.user('account_id')],
|
||||
description: "Account ID number of the calendar owner, if not the current user"
|
||||
},
|
||||
start_date: {
|
||||
name: "Start date",
|
||||
type: "any"
|
||||
},
|
||||
end_date: {
|
||||
name: "End date",
|
||||
type: "any"
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Cache to map owner & resource IDs to names, helps cut down on server requests
|
||||
*/
|
||||
et2_calendar_view.owner_name_cache = {};
|
||||
et2_calendar_view.holiday_cache = {};
|
||||
//# sourceMappingURL=et2_widget_view.js.map
|
@ -1,22 +1,23 @@
|
||||
/*
|
||||
* Egroupware
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package
|
||||
* @subpackage
|
||||
* @link http://www.egroupware.org
|
||||
*
|
||||
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package calendar
|
||||
* @subpackage etemplate
|
||||
* @link https://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/*egw:uses
|
||||
/etemplate/js/et2_core_valueWidget;
|
||||
*/
|
||||
|
||||
import {et2_widget, WidgetConfig} from "../../api/js/etemplate/et2_core_widget";
|
||||
import {et2_createWidget, et2_widget, WidgetConfig} from "../../api/js/etemplate/et2_core_widget";
|
||||
import {et2_valueWidget} from "../../api/js/etemplate/et2_core_valueWidget";
|
||||
import {ClassWithAttributes} from "../../api/js/etemplate/et2_core_inheritance";
|
||||
import {et2_date} from "../../api/js/etemplate/et2_widget_date";
|
||||
import {et2_calendar_event} from "./et2_widget_event";
|
||||
import {sprintf} from "../../api/js/egw_action/egw_action_common.js";
|
||||
|
||||
/**
|
||||
* Parent class for the various calendar views to reduce copied code
|
||||
@ -69,7 +70,7 @@ export class et2_calendar_view extends et2_valueWidget
|
||||
|
||||
|
||||
// Used for its date calculations
|
||||
this._date_helper = et2_createWidget('date-time', {}, null);
|
||||
this._date_helper = <et2_date>et2_createWidget('date-time', {}, null);
|
||||
this._date_helper.loadingFinished();
|
||||
|
||||
this.loader = jQuery('<div class="egw-loading-prompt-container ui-front loading"></div>');
|
||||
@ -552,7 +553,7 @@ export class et2_calendar_view extends et2_valueWidget
|
||||
whole_day_on_top: this.drag_create.start.whole_day
|
||||
}
|
||||
);
|
||||
this.drag_create.event = et2_createWidget('calendar-event',{
|
||||
this.drag_create.event = <et2_calendar_event>et2_createWidget('calendar-event',{
|
||||
id:'event_drag',
|
||||
value: value
|
||||
},this.drag_create.parent);
|
||||
|
Loading…
Reference in New Issue
Block a user