Pages durch Widgets ablösen #2
151
lib/plankton/plankton.d.ts
vendored
151
lib/plankton/plankton.d.ts
vendored
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
declare type int = number;
|
||||
type int = number;
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
declare type float = number;
|
||||
type float = number;
|
||||
declare class Buffer {
|
||||
constructor(x: string, modifier?: string);
|
||||
toString(modifier?: string): string;
|
||||
|
|
@ -19,7 +19,7 @@ declare namespace lib_plankton.base {
|
|||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
declare type type_pseudopointer<type_value> = {
|
||||
type type_pseudopointer<type_value> = {
|
||||
value: type_value;
|
||||
};
|
||||
/**
|
||||
|
|
@ -1969,7 +1969,7 @@ declare namespace lib_plankton.storage.memory {
|
|||
clear(): Promise<void>;
|
||||
write(key: any, value: any): Promise<boolean>;
|
||||
delete(key: any): Promise<void>;
|
||||
read(key: any): Promise<type_item>;
|
||||
read(key: any): Promise<Awaited<type_item>>;
|
||||
search(term: any): Promise<{
|
||||
key: string;
|
||||
preview: string;
|
||||
|
|
@ -2693,6 +2693,51 @@ declare namespace lib_plankton.map.collatemap {
|
|||
export function implementation_map<type_key, type_value>(subject: type_subject<type_key, type_value>): type_map<type_key, type_value>;
|
||||
export {};
|
||||
}
|
||||
declare namespace lib_plankton.cache {
|
||||
/**
|
||||
*/
|
||||
type type_result<type_value> = {
|
||||
retrieved: boolean;
|
||||
value: type_value;
|
||||
};
|
||||
/**
|
||||
*/
|
||||
type type_entry<type_value> = {
|
||||
value: type_value;
|
||||
expiry: (null | float);
|
||||
};
|
||||
/**
|
||||
*/
|
||||
type type_subject<type_value> = lib_plankton.storage.type_chest<string, type_entry<type_value>, void, any, any>;
|
||||
}
|
||||
declare namespace lib_plankton.cache {
|
||||
/**
|
||||
*/
|
||||
function make<type_value>({ "chest": chest, }?: {
|
||||
chest?: lib_plankton.storage.type_chest<string, type_entry<type_value>, void, any, any>;
|
||||
}): type_subject<type_value>;
|
||||
/**
|
||||
*/
|
||||
function init<type_value>(subject: type_subject<type_value>): Promise<void>;
|
||||
/**
|
||||
*/
|
||||
function clear<type_value>(subject: type_subject<type_value>): Promise<void>;
|
||||
/**
|
||||
*/
|
||||
function invalidate<type_value>(subject: type_subject<type_value>, key: string): Promise<void>;
|
||||
/**
|
||||
*/
|
||||
function query<type_value>(subject: type_subject<type_value>, key: string, lifetime: (null | float), retrieve: (() => Promise<type_value>)): Promise<type_result<type_value>>;
|
||||
/**
|
||||
* syntactic sugar: if the information, whether the value was retrieved, is irrelevant
|
||||
*/
|
||||
function get<type_value>(subject: type_subject<type_value>, key: string, lifetime: (null | float), retrieve: (() => Promise<type_value>)): Promise<type_value>;
|
||||
/**
|
||||
*/
|
||||
function get_complex<type_input, type_value>(cache: type_subject<type_value>, group: string, input: type_input, lifetime: (null | float), retrieve: ((input: type_input) => Promise<type_value>), { "encode_input": encode_input, }?: {
|
||||
encode_input?: ((input: type_input) => string);
|
||||
}): Promise<type_value>;
|
||||
}
|
||||
declare namespace lib_plankton.complex {
|
||||
/**
|
||||
* @author fenris
|
||||
|
|
@ -3809,55 +3854,6 @@ declare namespace lib_plankton.translate {
|
|||
*/
|
||||
function stance(str: string): string;
|
||||
}
|
||||
declare namespace lib_plankton.zoo_page {
|
||||
/**
|
||||
*/
|
||||
export type type_location = {
|
||||
name: string;
|
||||
parameters: Record<string, any>;
|
||||
};
|
||||
/**
|
||||
*/
|
||||
type type_handler = ((parameters: Record<string, any>, target_element: Element) => void);
|
||||
/**
|
||||
*/
|
||||
type type_nav_entry_definition = {
|
||||
location: type_location;
|
||||
label: string;
|
||||
groups: Array<string>;
|
||||
};
|
||||
/**
|
||||
*/
|
||||
export let _pool: Record<string, type_handler>;
|
||||
/**
|
||||
*/
|
||||
export function encode(location: type_location): string;
|
||||
/**
|
||||
* encodes a location in the URL and loads it
|
||||
*/
|
||||
export function set(location: type_location): void;
|
||||
/**
|
||||
*/
|
||||
export function reload(): Promise<void>;
|
||||
/**
|
||||
*/
|
||||
export function register(location_name: string, handler: type_handler): void;
|
||||
/**
|
||||
*/
|
||||
export function nav_set_groups(groups: (null | Array<string>)): void;
|
||||
/**
|
||||
*/
|
||||
export function init(target_element: Element, { "pool": pool, "fallback": fallback, "nav_entries": nav_entries, "nav_initial_groups": nav_initial_groups, }?: {
|
||||
pool?: Record<string, type_handler>;
|
||||
fallback?: (null | type_location);
|
||||
nav_entries?: Array<type_nav_entry_definition>;
|
||||
nav_initial_groups?: (null | Array<string>);
|
||||
}): void;
|
||||
/**
|
||||
*/
|
||||
export function start(): void;
|
||||
export {};
|
||||
}
|
||||
declare namespace lib_plankton.zoo_widget {
|
||||
/**
|
||||
*/
|
||||
|
|
@ -4043,6 +4039,55 @@ declare namespace lib_plankton.zoo_widget {
|
|||
load(target_element: HTMLElement): Promise<void>;
|
||||
}
|
||||
}
|
||||
declare namespace lib_plankton.zoo_page {
|
||||
/**
|
||||
*/
|
||||
export type type_location = {
|
||||
name: string;
|
||||
parameters: Record<string, any>;
|
||||
};
|
||||
/**
|
||||
*/
|
||||
type type_handler = ((parameters: Record<string, any>, target_element: Element) => void);
|
||||
/**
|
||||
*/
|
||||
type type_nav_entry_definition = {
|
||||
location: type_location;
|
||||
label: string;
|
||||
groups: Array<string>;
|
||||
};
|
||||
/**
|
||||
*/
|
||||
export let _pool: Record<string, type_handler>;
|
||||
/**
|
||||
*/
|
||||
export function encode(location: type_location): string;
|
||||
/**
|
||||
* encodes a location in the URL and loads it
|
||||
*/
|
||||
export function set(location: type_location): void;
|
||||
/**
|
||||
*/
|
||||
export function reload(): Promise<void>;
|
||||
/**
|
||||
*/
|
||||
export function register(location_name: string, handler: type_handler): void;
|
||||
/**
|
||||
*/
|
||||
export function nav_set_groups(groups: (null | Array<string>)): void;
|
||||
/**
|
||||
*/
|
||||
export function init(target_element: Element, { "pool": pool, "fallback": fallback, "nav_entries": nav_entries, "nav_initial_groups": nav_initial_groups, }?: {
|
||||
pool?: Record<string, type_handler>;
|
||||
fallback?: (null | type_location);
|
||||
nav_entries?: Array<type_nav_entry_definition>;
|
||||
nav_initial_groups?: (null | Array<string>);
|
||||
}): void;
|
||||
/**
|
||||
*/
|
||||
export function start(): void;
|
||||
export {};
|
||||
}
|
||||
declare namespace lib_plankton.zoo_input {
|
||||
/**
|
||||
* @author fenris
|
||||
|
|
|
|||
|
|
@ -2151,7 +2151,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
|
|
@ -8710,6 +8710,136 @@ var lib_plankton;
|
|||
})(map = lib_plankton.map || (lib_plankton.map = {}));
|
||||
})(lib_plankton || (lib_plankton = {}));
|
||||
/*
|
||||
This file is part of »bacterio-plankton:cache«.
|
||||
|
||||
Copyright 2016-2024 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
|
||||
<info@greenscale.de>
|
||||
|
||||
»bacterio-plankton:cache« is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
»bacterio-plankton:cache« is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with »bacterio-plankton:cache«. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
This file is part of »bacterio-plankton:cache«.
|
||||
|
||||
Copyright 2016-2024 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
|
||||
<info@greenscale.de>
|
||||
|
||||
»bacterio-plankton:cache« is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
»bacterio-plankton:cache« is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with »bacterio-plankton:cache«. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
var lib_plankton;
|
||||
(function (lib_plankton) {
|
||||
var cache;
|
||||
(function (cache_1) {
|
||||
/**
|
||||
*/
|
||||
function make({ "chest": chest = lib_plankton.storage.memory.implementation_chest({}), } = {}) {
|
||||
return chest;
|
||||
}
|
||||
cache_1.make = make;
|
||||
/**
|
||||
*/
|
||||
function init(subject) {
|
||||
return subject.setup(undefined);
|
||||
}
|
||||
cache_1.init = init;
|
||||
/**
|
||||
*/
|
||||
function clear(subject) {
|
||||
return subject.clear();
|
||||
}
|
||||
cache_1.clear = clear;
|
||||
/**
|
||||
*/
|
||||
function invalidate(subject, key) {
|
||||
return subject.delete(key);
|
||||
}
|
||||
cache_1.invalidate = invalidate;
|
||||
/**
|
||||
*/
|
||||
async function query(subject, key, lifetime, retrieve) {
|
||||
const now = lib_plankton.base.get_current_timestamp();
|
||||
return ((subject.read(key)
|
||||
.then((entry) => Promise.resolve({
|
||||
"found": true,
|
||||
"entry": entry,
|
||||
}))
|
||||
.catch(() => Promise.resolve({
|
||||
"found": false,
|
||||
"entry": null,
|
||||
})))
|
||||
.then((item) => {
|
||||
if ((!item.found)
|
||||
||
|
||||
((item.entry.expiry !== null)
|
||||
&&
|
||||
(item.entry.expiry <= now))) {
|
||||
lib_plankton.log.info("plankton.cache.unknown_or_expired", {
|
||||
"key": key,
|
||||
});
|
||||
return (retrieve()
|
||||
.then((value) => (subject.write(key, {
|
||||
"value": value,
|
||||
"expiry": ((lifetime === null)
|
||||
?
|
||||
null
|
||||
:
|
||||
(now + lifetime))
|
||||
})
|
||||
.then(() => Promise.resolve({
|
||||
"retrieved": true,
|
||||
"value": value
|
||||
})))));
|
||||
}
|
||||
else {
|
||||
lib_plankton.log.info("plankton.cache.known_and_valid", {
|
||||
"key": key,
|
||||
});
|
||||
return Promise.resolve({
|
||||
"retrieved": false,
|
||||
"value": item.entry.value
|
||||
});
|
||||
}
|
||||
}));
|
||||
}
|
||||
cache_1.query = query;
|
||||
/**
|
||||
* syntactic sugar: if the information, whether the value was retrieved, is irrelevant
|
||||
*/
|
||||
function get(subject, key, lifetime, retrieve) {
|
||||
return (query(subject, key, lifetime, retrieve)
|
||||
.then(result => Promise.resolve(result.value)));
|
||||
}
|
||||
cache_1.get = get;
|
||||
/**
|
||||
*/
|
||||
function get_complex(cache, group, input, lifetime, retrieve, { "encode_input": encode_input = (input => JSON.stringify(input)), } = {}) {
|
||||
return get(cache, (group + "." + encode_input(input)), lifetime, () => retrieve(input));
|
||||
}
|
||||
cache_1.get_complex = get_complex;
|
||||
})(cache = lib_plankton.cache || (lib_plankton.cache = {}));
|
||||
})(lib_plankton || (lib_plankton = {}));
|
||||
/*
|
||||
This file is part of »bacterio-plankton:complex«.
|
||||
|
||||
Copyright 2016-2024 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
|
||||
|
|
@ -9449,6 +9579,12 @@ var lib_plankton;
|
|||
* @author fenris
|
||||
*/
|
||||
class class_relation {
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
check(value, reference) {
|
||||
return this.predicate(value, reference);
|
||||
}
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
|
|
@ -9458,12 +9594,6 @@ var lib_plankton;
|
|||
this.name = name;
|
||||
this.predicate = predicate;
|
||||
}
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
check(value, reference) {
|
||||
return this.predicate(value, reference);
|
||||
}
|
||||
/**
|
||||
* @author fenris
|
||||
*/
|
||||
|
|
@ -9940,7 +10070,7 @@ var lib_plankton;
|
|||
h = 0;
|
||||
}
|
||||
else if (q === r) {
|
||||
h = ((0 / 3) + ((g - b) / (c * 6)));
|
||||
h = ((0 / 3) + lib_plankton.math.mod((g - b) / (c * 6), 1));
|
||||
}
|
||||
else if (q === g) {
|
||||
h = ((1 / 3) + ((b - r) / (c * 6)));
|
||||
|
|
@ -11738,190 +11868,6 @@ var lib_plankton;
|
|||
})(translate = lib_plankton.translate || (lib_plankton.translate = {}));
|
||||
})(lib_plankton || (lib_plankton = {}));
|
||||
/*
|
||||
This file is part of »bacterio-plankton:zoo-page«.
|
||||
|
||||
Copyright 2016-2024 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
|
||||
<info@greenscale.de>
|
||||
|
||||
»bacterio-plankton:zoo-page« is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
»bacterio-plankton:zoo-page« is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with »bacterio-plankton:zoo-page«. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
var lib_plankton;
|
||||
(function (lib_plankton) {
|
||||
var zoo_page;
|
||||
(function (zoo_page) {
|
||||
/**
|
||||
*/
|
||||
zoo_page._pool = {};
|
||||
/**
|
||||
*/
|
||||
let _fallback = null;
|
||||
/**
|
||||
*/
|
||||
let _current = null;
|
||||
/**
|
||||
*/
|
||||
let _target_element = null;
|
||||
/**
|
||||
*/
|
||||
let _nav_entries;
|
||||
/**
|
||||
*/
|
||||
function encode(location) {
|
||||
return ("#"
|
||||
+
|
||||
([location.name]
|
||||
.concat(Object.entries(location.parameters)
|
||||
.filter(([key, value]) => (value !== null))
|
||||
.map(([key, value]) => (key + "=" + value)))));
|
||||
}
|
||||
zoo_page.encode = encode;
|
||||
/**
|
||||
*/
|
||||
function decode(encoded) {
|
||||
if (encoded === "") {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
if (!encoded.startsWith("#")) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
const parts = encoded.slice(1).split(",");
|
||||
return {
|
||||
"name": parts[0],
|
||||
"parameters": Object.fromEntries(parts.slice(1)
|
||||
.map(part => {
|
||||
const parts_ = part.split("=");
|
||||
return [parts_[0], parts_[1]];
|
||||
})),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* renders a page to the main element
|
||||
*/
|
||||
async function load(location) {
|
||||
// _target_element.innerHTML = "[loading …]";
|
||||
_target_element.innerHTML = "";
|
||||
if (location === null) {
|
||||
// do nothing
|
||||
}
|
||||
else {
|
||||
if (!(location.name in zoo_page._pool)) {
|
||||
_target_element.innerHTML = "not found";
|
||||
}
|
||||
else {
|
||||
await zoo_page._pool[location.name](location.parameters, _target_element);
|
||||
_current = location;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* retrieves the location from the set URL
|
||||
*/
|
||||
function get() {
|
||||
return decode(window.location.hash);
|
||||
}
|
||||
/**
|
||||
* encodes a location in the URL and loads it
|
||||
*/
|
||||
function set(location) {
|
||||
window.location.hash = encode(location);
|
||||
}
|
||||
zoo_page.set = set;
|
||||
/**
|
||||
*/
|
||||
function reload() {
|
||||
return load(get());
|
||||
}
|
||||
zoo_page.reload = reload;
|
||||
/**
|
||||
*/
|
||||
function register(location_name, handler) {
|
||||
zoo_page._pool[location_name] = handler;
|
||||
}
|
||||
zoo_page.register = register;
|
||||
/**
|
||||
*/
|
||||
function nav_set_groups(groups) {
|
||||
_nav_entries.forEach(nav_entry => {
|
||||
const active = ((groups === null)
|
||||
||
|
||||
groups.some(group => nav_entry.definition.groups.includes(group)));
|
||||
nav_entry.element.classList.toggle("active", active);
|
||||
});
|
||||
}
|
||||
zoo_page.nav_set_groups = nav_set_groups;
|
||||
/**
|
||||
*/
|
||||
function init(target_element, { "pool": pool = {}, "fallback": fallback = null, "nav_entries": nav_entries = [], "nav_initial_groups": nav_initial_groups = null, } = {}) {
|
||||
_target_element = target_element;
|
||||
_fallback = fallback;
|
||||
Object.entries(pool).forEach(([location_name, handler]) => {
|
||||
register(location_name, handler);
|
||||
});
|
||||
window.addEventListener("hashchange", () => {
|
||||
const location_old = _current;
|
||||
const location_new = (get() ?? _fallback);
|
||||
if (((location_old === null)
|
||||
&&
|
||||
(location_new !== null))
|
||||
||
|
||||
((location_old !== null)
|
||||
&&
|
||||
(location_new !== null)
|
||||
&&
|
||||
(location_old.name !== location_new.name))) {
|
||||
load(location_new);
|
||||
}
|
||||
else {
|
||||
// do nothing
|
||||
}
|
||||
});
|
||||
// nav
|
||||
{
|
||||
let ul_element = document.querySelector("nav > ul");
|
||||
_nav_entries = nav_entries.map(nav_entry_definition => {
|
||||
let li_element = document.createElement("li");
|
||||
{
|
||||
let a_element = document.createElement("a");
|
||||
a_element.setAttribute("href", encode(nav_entry_definition.location));
|
||||
a_element.textContent = (nav_entry_definition.label ?? nav_entry_definition.location.name);
|
||||
li_element.appendChild(a_element);
|
||||
}
|
||||
ul_element.appendChild(li_element);
|
||||
return {
|
||||
"definition": nav_entry_definition,
|
||||
"element": li_element,
|
||||
};
|
||||
});
|
||||
nav_set_groups(nav_initial_groups);
|
||||
}
|
||||
}
|
||||
zoo_page.init = init;
|
||||
/**
|
||||
*/
|
||||
function start() {
|
||||
const location = (get() ?? _fallback);
|
||||
set(location);
|
||||
load(location);
|
||||
}
|
||||
zoo_page.start = start;
|
||||
})(zoo_page = lib_plankton.zoo_page || (lib_plankton.zoo_page = {}));
|
||||
})(lib_plankton || (lib_plankton = {}));
|
||||
/*
|
||||
This file is part of »bacterio-plankton:zoo-widget«.
|
||||
|
||||
Copyright 2016-2024 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
|
||||
|
|
@ -12441,6 +12387,190 @@ var lib_plankton;
|
|||
})(zoo_widget = lib_plankton.zoo_widget || (lib_plankton.zoo_widget = {}));
|
||||
})(lib_plankton || (lib_plankton = {}));
|
||||
/*
|
||||
This file is part of »bacterio-plankton:zoo-page«.
|
||||
|
||||
Copyright 2016-2024 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
|
||||
<info@greenscale.de>
|
||||
|
||||
»bacterio-plankton:zoo-page« is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
»bacterio-plankton:zoo-page« is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with »bacterio-plankton:zoo-page«. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
var lib_plankton;
|
||||
(function (lib_plankton) {
|
||||
var zoo_page;
|
||||
(function (zoo_page) {
|
||||
/**
|
||||
*/
|
||||
zoo_page._pool = {};
|
||||
/**
|
||||
*/
|
||||
let _fallback = null;
|
||||
/**
|
||||
*/
|
||||
let _current = null;
|
||||
/**
|
||||
*/
|
||||
let _target_element = null;
|
||||
/**
|
||||
*/
|
||||
let _nav_entries;
|
||||
/**
|
||||
*/
|
||||
function encode(location) {
|
||||
return ("#"
|
||||
+
|
||||
([location.name]
|
||||
.concat(Object.entries(location.parameters)
|
||||
.filter(([key, value]) => (value !== null))
|
||||
.map(([key, value]) => (key + "=" + value)))));
|
||||
}
|
||||
zoo_page.encode = encode;
|
||||
/**
|
||||
*/
|
||||
function decode(encoded) {
|
||||
if (encoded === "") {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
if (!encoded.startsWith("#")) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
const parts = encoded.slice(1).split(",");
|
||||
return {
|
||||
"name": parts[0],
|
||||
"parameters": Object.fromEntries(parts.slice(1)
|
||||
.map(part => {
|
||||
const parts_ = part.split("=");
|
||||
return [parts_[0], parts_[1]];
|
||||
})),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* renders a page to the main element
|
||||
*/
|
||||
async function load(location) {
|
||||
// _target_element.innerHTML = "[loading …]";
|
||||
_target_element.innerHTML = "";
|
||||
if (location === null) {
|
||||
// do nothing
|
||||
}
|
||||
else {
|
||||
if (!(location.name in zoo_page._pool)) {
|
||||
_target_element.innerHTML = "not found";
|
||||
}
|
||||
else {
|
||||
await zoo_page._pool[location.name](location.parameters, _target_element);
|
||||
_current = location;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* retrieves the location from the set URL
|
||||
*/
|
||||
function get() {
|
||||
return decode(window.location.hash);
|
||||
}
|
||||
/**
|
||||
* encodes a location in the URL and loads it
|
||||
*/
|
||||
function set(location) {
|
||||
window.location.hash = encode(location);
|
||||
}
|
||||
zoo_page.set = set;
|
||||
/**
|
||||
*/
|
||||
function reload() {
|
||||
return load(get());
|
||||
}
|
||||
zoo_page.reload = reload;
|
||||
/**
|
||||
*/
|
||||
function register(location_name, handler) {
|
||||
zoo_page._pool[location_name] = handler;
|
||||
}
|
||||
zoo_page.register = register;
|
||||
/**
|
||||
*/
|
||||
function nav_set_groups(groups) {
|
||||
_nav_entries.forEach(nav_entry => {
|
||||
const active = ((groups === null)
|
||||
||
|
||||
groups.some(group => nav_entry.definition.groups.includes(group)));
|
||||
nav_entry.element.classList.toggle("active", active);
|
||||
});
|
||||
}
|
||||
zoo_page.nav_set_groups = nav_set_groups;
|
||||
/**
|
||||
*/
|
||||
function init(target_element, { "pool": pool = {}, "fallback": fallback = null, "nav_entries": nav_entries = [], "nav_initial_groups": nav_initial_groups = null, } = {}) {
|
||||
_target_element = target_element;
|
||||
_fallback = fallback;
|
||||
Object.entries(pool).forEach(([location_name, handler]) => {
|
||||
register(location_name, handler);
|
||||
});
|
||||
window.addEventListener("hashchange", () => {
|
||||
const location_old = _current;
|
||||
const location_new = (get() ?? _fallback);
|
||||
if (((location_old === null)
|
||||
&&
|
||||
(location_new !== null))
|
||||
||
|
||||
((location_old !== null)
|
||||
&&
|
||||
(location_new !== null)
|
||||
&&
|
||||
(location_old.name !== location_new.name))) {
|
||||
load(location_new);
|
||||
}
|
||||
else {
|
||||
// do nothing
|
||||
}
|
||||
});
|
||||
// nav
|
||||
{
|
||||
let ul_element = document.querySelector("nav > ul");
|
||||
_nav_entries = nav_entries.map(nav_entry_definition => {
|
||||
let li_element = document.createElement("li");
|
||||
{
|
||||
let a_element = document.createElement("a");
|
||||
a_element.setAttribute("href", encode(nav_entry_definition.location));
|
||||
a_element.textContent = (nav_entry_definition.label ?? nav_entry_definition.location.name);
|
||||
li_element.appendChild(a_element);
|
||||
}
|
||||
ul_element.appendChild(li_element);
|
||||
return {
|
||||
"definition": nav_entry_definition,
|
||||
"element": li_element,
|
||||
};
|
||||
});
|
||||
nav_set_groups(nav_initial_groups);
|
||||
}
|
||||
}
|
||||
zoo_page.init = init;
|
||||
/**
|
||||
*/
|
||||
function start() {
|
||||
const location = (get() ?? _fallback);
|
||||
set(location);
|
||||
load(location);
|
||||
}
|
||||
zoo_page.start = start;
|
||||
})(zoo_page = lib_plankton.zoo_page || (lib_plankton.zoo_page = {}));
|
||||
})(lib_plankton || (lib_plankton = {}));
|
||||
/*
|
||||
This file is part of »bacterio-plankton:zoo-input«.
|
||||
|
||||
Copyright 2016-2024 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@
|
|||
},
|
||||
"misc": {
|
||||
"oidc_redirect_uri_template": "http://localhost:8888/#oidc_finish,session_key={{session_key}}",
|
||||
"use_central_europe_specific_datetime_inputs": false
|
||||
"use_central_europe_specific_datetime_inputs": true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,37 @@
|
|||
namespace _dali
|
||||
{
|
||||
|
||||
/**
|
||||
*/
|
||||
export function access_level_encode(
|
||||
access_level : _dali.type.enum_access_level
|
||||
) : ("none" | "view" | "edit" | "admin")
|
||||
{
|
||||
switch (access_level) {
|
||||
case _dali.type.enum_access_level.none: return "none";
|
||||
case _dali.type.enum_access_level.view: return "view";
|
||||
case _dali.type.enum_access_level.edit: return "edit";
|
||||
case _dali.type.enum_access_level.admin: return "admin";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
export function access_level_decode(
|
||||
representation : /*("none" | "view" | "edit" | "admin")*/string
|
||||
) : _dali.type.enum_access_level
|
||||
{
|
||||
switch (representation)
|
||||
{
|
||||
case "none": return _dali.type.enum_access_level.none;
|
||||
case "view": return _dali.type.enum_access_level.view;
|
||||
case "edit": return _dali.type.enum_access_level.edit;
|
||||
case "admin": return _dali.type.enum_access_level.admin;
|
||||
default: throw (new Error("invalid access level representation: " + representation));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
|||
8
source/base/model.ts
Normal file
8
source/base/model.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
namespace _dali.model
|
||||
{
|
||||
|
||||
/**
|
||||
*/
|
||||
let events : Array<_dali.type.event_entry> = [];
|
||||
|
||||
}
|
||||
|
|
@ -31,6 +31,22 @@ namespace _dali.type
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* @todo deprecate?
|
||||
*/
|
||||
export type local_resource_event_id = int;
|
||||
|
||||
|
||||
/**
|
||||
* info: das ist nicht deckungsgleich mit der Event-ID aus dem Backend; hiermit werden sowohl lokale als auch
|
||||
* extern eingebundene Events kodiert
|
||||
*
|
||||
* @example "local:1234"
|
||||
* @example "ics~2345"
|
||||
*/
|
||||
export type event_key = string;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
export type event_object = {
|
||||
|
|
@ -61,7 +77,11 @@ namespace _dali.type
|
|||
|
||||
/**
|
||||
*/
|
||||
export type local_resource_event_id = int;
|
||||
export type event_entry = {
|
||||
id : (null | local_resource_event_id);
|
||||
key : event_key;
|
||||
object : event_object;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
namespace _dali
|
||||
{
|
||||
|
||||
/**
|
||||
* @todo outsource
|
||||
*/
|
||||
export abstract class class_widget
|
||||
{
|
||||
|
||||
/**
|
||||
*/
|
||||
public abstract load(
|
||||
target_element : Element
|
||||
) : Promise<void>;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
"common.edit": "bearbeiten",
|
||||
"common.show": "zeigen",
|
||||
"common.hide": "ausblenden",
|
||||
"common.cancel": "abbrechen",
|
||||
"access_level.none": "nichts",
|
||||
"access_level.view": "nur lesen",
|
||||
"access_level.edit": "lesen und bearbeiten",
|
||||
|
|
@ -49,6 +50,13 @@
|
|||
"widget.weekview.controls.week": "Woche",
|
||||
"widget.weekview.controls.count": "Anzahl",
|
||||
"widget.weekview.controls.apply": "Laden",
|
||||
"widget.calendar_edit.actions.add": "Kalender anlegen",
|
||||
"widget.calendar_edit.actions.change": "ändern",
|
||||
"widget.calendar_edit.actions.remove": "löschen",
|
||||
"widget.event_edit.actions.add": "anlegen",
|
||||
"widget.event_edit.actions.change": "ändern",
|
||||
"widget.event_edit.actions.remove": "löschen",
|
||||
"widget.sources.create": "anlegen",
|
||||
"page.login.title": "Anmelden",
|
||||
"page.login.internal.name": "Name",
|
||||
"page.login.internal.password": "Kennwort",
|
||||
|
|
@ -70,14 +78,9 @@
|
|||
"page.calendar_add.actions.do": "anlegen",
|
||||
"page.calendar_edit.title.regular": "Kalendar bearbeiten",
|
||||
"page.calendar_edit.title.read_only": "Kalendar-Details",
|
||||
"page.calendar_edit.actions.change": "ändern",
|
||||
"page.calendar_edit.actions.remove": "löschen",
|
||||
"page.event_add.title": "Termin anlegen",
|
||||
"page.event_add.actions.do": "anlegen",
|
||||
"page.event_edit.title.regular": "Termin bearbeiten",
|
||||
"page.event_edit.title.read_only": "Termin-Details",
|
||||
"page.event_edit.actions.change": "ändern",
|
||||
"page.event_edit.actions.remove": "löschen",
|
||||
"page.overview.title": "Übersicht",
|
||||
"page.overview.login_hint": "anmelden um nicht-öffentliche Termine zu sehen",
|
||||
"page.overview.mode.week": "Wochen-Ansicht",
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
"common.edit": "edit",
|
||||
"common.show": "show",
|
||||
"common.hide": "hide",
|
||||
"common.cancel": "cancel",
|
||||
"access_level.none": "none",
|
||||
"access_level.view": "read only",
|
||||
"access_level.edit": "read and write",
|
||||
|
|
@ -49,6 +50,13 @@
|
|||
"widget.weekview.controls.week": "Week",
|
||||
"widget.weekview.controls.count": "Count",
|
||||
"widget.weekview.controls.apply": "Load",
|
||||
"widget.calendar_edit.actions.add": "add calendar",
|
||||
"widget.calendar_edit.actions.change": "change",
|
||||
"widget.calendar_edit.actions.remove": "delete",
|
||||
"widget.event_edit.actions.add": "add",
|
||||
"widget.event_edit.actions.change": "change",
|
||||
"widget.event_edit.actions.remove": "delete",
|
||||
"widget.sources.create": "create",
|
||||
"page.login.title": "Login",
|
||||
"page.login.internal.name": "name",
|
||||
"page.login.internal.password": "password",
|
||||
|
|
@ -69,15 +77,10 @@
|
|||
"page.calendar_add.title": "Add calendar",
|
||||
"page.calendar_add.actions.do": "anlegen",
|
||||
"page.event_add.title": "Add event",
|
||||
"page.event_add.actions.do": "add",
|
||||
"page.calendar_edit.title.regular": "Edit calendar",
|
||||
"page.calendar_edit.title.read_only": "Calendar details",
|
||||
"page.calendar_edit.actions.change": "change",
|
||||
"page.calendar_edit.actions.remove": "delete",
|
||||
"page.event_edit.title.regular": "Edit event",
|
||||
"page.event_edit.title.read_only": "Event details",
|
||||
"page.event_edit.actions.change": "change",
|
||||
"page.event_edit.actions.remove": "delete",
|
||||
"page.overview.title": "Overview",
|
||||
"page.overview.login_hint": "log in to view non-public events",
|
||||
"page.overview.mode.week": "week view",
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ document.addEventListener(
|
|||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="overlay">
|
||||
<div id="overlay_content">
|
||||
</div>
|
||||
</div>
|
||||
<main>
|
||||
</main>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -82,23 +82,11 @@ namespace _dali
|
|||
"label": lib_plankton.translate.get("page.overview.title"),
|
||||
"groups": ["logged_out", "logged_in"],
|
||||
},
|
||||
{
|
||||
"location": {"name": "calendar_add", "parameters": {}},
|
||||
"label": lib_plankton.translate.get("page.calendar_add.title"),
|
||||
"groups": ["logged_in"],
|
||||
},
|
||||
{
|
||||
"location": {"name": "caldav", "parameters": {}},
|
||||
"label": lib_plankton.translate.get("page.caldav.title"),
|
||||
"groups": ["logged_in"],
|
||||
},
|
||||
/*
|
||||
{
|
||||
"location": {"name": "event_add", "parameters": {}},
|
||||
"label": lib_plankton.translate.get("page.event_add.title"),
|
||||
"groups": ["logged_in"],
|
||||
}
|
||||
*/
|
||||
{
|
||||
"location": {"name": "logout", "parameters": {}},
|
||||
"label": lib_plankton.translate.get("page.logout.title"),
|
||||
|
|
@ -109,6 +97,7 @@ namespace _dali
|
|||
}
|
||||
);
|
||||
await update();
|
||||
await _dali.overlay.initialize();
|
||||
lib_plankton.call.loop(
|
||||
() => {
|
||||
update();
|
||||
|
|
|
|||
75
source/overlay.ts
Normal file
75
source/overlay.ts
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
namespace _dali.overlay
|
||||
{
|
||||
|
||||
/**
|
||||
*/
|
||||
function get_container_element(
|
||||
) : HTMLElement
|
||||
{
|
||||
return document.querySelector("#overlay");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
export function get_content_element(
|
||||
) : HTMLElement
|
||||
{
|
||||
return document.querySelector("#overlay_content");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
export function clear(
|
||||
) : void
|
||||
{
|
||||
get_content_element().innerHTML = "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
export function toggle(
|
||||
{
|
||||
"mode": mode = null,
|
||||
}
|
||||
:
|
||||
{
|
||||
mode ?: (null | boolean);
|
||||
}
|
||||
=
|
||||
{
|
||||
}
|
||||
) : void
|
||||
{
|
||||
get_container_element().classList.toggle("overlay_active", mode ?? undefined);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
export function initialize(
|
||||
) : Promise<void>
|
||||
{
|
||||
clear();
|
||||
const container_element : HTMLElement = get_container_element();
|
||||
/*
|
||||
container_element.addEventListener(
|
||||
"click",
|
||||
(event) => {
|
||||
if (event.target == container_element)
|
||||
{
|
||||
toggle({"mode": false});
|
||||
}
|
||||
else
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
);
|
||||
*/
|
||||
return Promise.resolve<void>(undefined);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,228 +0,0 @@
|
|||
namespace _dali.pages
|
||||
{
|
||||
|
||||
/**
|
||||
*/
|
||||
lib_plankton.zoo_page.register(
|
||||
"calendar_add",
|
||||
async (parameters, target_element) => {
|
||||
target_element.innerHTML = "";
|
||||
target_element.innerHTML = await _dali.helpers.template_coin(
|
||||
"calendar_add",
|
||||
"default",
|
||||
{
|
||||
"label": lib_plankton.translate.get("page.calendar_add.title")
|
||||
}
|
||||
);
|
||||
const form : lib_plankton.zoo_form.class_form<
|
||||
{
|
||||
name : string;
|
||||
access : {
|
||||
public : boolean;
|
||||
default_level : _dali.type.enum_access_level;
|
||||
attributed : lib_plankton.map.type_map<
|
||||
_dali.type.user_id,
|
||||
_dali.type.enum_access_level
|
||||
>;
|
||||
};
|
||||
resource_kind : string;
|
||||
hue : (null | float);
|
||||
},
|
||||
{
|
||||
name : string;
|
||||
access : {
|
||||
public : boolean;
|
||||
default_level : _dali.type.enum_access_level;
|
||||
attributed : lib_plankton.map.type_map<
|
||||
_dali.type.user_id,
|
||||
_dali.type.enum_access_level
|
||||
>;
|
||||
};
|
||||
resource_kind : string;
|
||||
hue : (null | float);
|
||||
}
|
||||
> = new lib_plankton.zoo_form.class_form<
|
||||
{
|
||||
name : string;
|
||||
access : {
|
||||
public : boolean;
|
||||
default_level : _dali.type.enum_access_level;
|
||||
attributed : lib_plankton.map.type_map<
|
||||
_dali.type.user_id,
|
||||
_dali.type.enum_access_level
|
||||
>;
|
||||
};
|
||||
resource_kind : string;
|
||||
hue : (null | float);
|
||||
},
|
||||
{
|
||||
name : string;
|
||||
access : {
|
||||
public : boolean;
|
||||
default_level : _dali.type.enum_access_level;
|
||||
attributed : lib_plankton.map.type_map<
|
||||
_dali.type.user_id,
|
||||
_dali.type.enum_access_level
|
||||
>;
|
||||
};
|
||||
resource_kind : string;
|
||||
hue : (null | float);
|
||||
}
|
||||
>(
|
||||
(value) => value,
|
||||
(raw) => raw,
|
||||
new lib_plankton.zoo_input.class_input_group<any>(
|
||||
[
|
||||
{
|
||||
"name": "name",
|
||||
"input": new lib_plankton.zoo_input.class_input_text(),
|
||||
"label": lib_plankton.translate.get("calendar.name")
|
||||
},
|
||||
{
|
||||
"name": "hue",
|
||||
"input": new lib_plankton.zoo_input.class_input_hue(
|
||||
),
|
||||
"label": lib_plankton.translate.get("calendar.hue"),
|
||||
},
|
||||
{
|
||||
"name": "access",
|
||||
"input": new lib_plankton.zoo_input.class_input_group(
|
||||
[
|
||||
{
|
||||
"name": "public",
|
||||
"input": new lib_plankton.zoo_input.class_input_checkbox(),
|
||||
"label": lib_plankton.translate.get("calendar.access.public"),
|
||||
},
|
||||
{
|
||||
"name": "default_level",
|
||||
"input": _dali.helpers.input_access_level(),
|
||||
"label": lib_plankton.translate.get("calendar.access.default_level"),
|
||||
},
|
||||
{
|
||||
"name": "attributed",
|
||||
"input": await _dali.helpers.input_attributed_access(),
|
||||
"label": lib_plankton.translate.get("calendar.access.attributed"),
|
||||
},
|
||||
]
|
||||
),
|
||||
"label": lib_plankton.translate.get("calendar.access.access"),
|
||||
},
|
||||
{
|
||||
"name": "resource_kind",
|
||||
"input": new lib_plankton.zoo_input.class_input_selection(
|
||||
[
|
||||
{
|
||||
"value": "local",
|
||||
"label": lib_plankton.translate.get("resource.kinds.local.title")
|
||||
},
|
||||
{
|
||||
"value": "caldav",
|
||||
"label": lib_plankton.translate.get("resource.kinds.caldav.title")
|
||||
},
|
||||
]
|
||||
),
|
||||
"label": lib_plankton.translate.get("resource.kind")
|
||||
},
|
||||
]
|
||||
),
|
||||
[
|
||||
{
|
||||
"label": lib_plankton.translate.get("page.calendar_add.actions.do"),
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
const value : any = await get_value();
|
||||
const calendar_object : _dali.type.calendar_object = {
|
||||
"name": value.name,
|
||||
"access": {
|
||||
"public": value.access.public,
|
||||
"default_level": value.access.default_level,
|
||||
"attributed": value.access.attributed,
|
||||
},
|
||||
"resource": (() => {
|
||||
switch (value.resource_kind) {
|
||||
case "local":
|
||||
{
|
||||
return {
|
||||
"kind": "local",
|
||||
"data": {
|
||||
"events": [],
|
||||
}
|
||||
};
|
||||
break;
|
||||
}
|
||||
case "caldav":
|
||||
{
|
||||
return {
|
||||
"kind": "caldav",
|
||||
"data": {
|
||||
"url": "", // TODO
|
||||
"read_only": true, // TODO
|
||||
}
|
||||
};
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw (new Error("invalid resource kind: " + value.resource_kind));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}) (),
|
||||
"hue": value.hue,
|
||||
};
|
||||
try
|
||||
{
|
||||
await _dali.backend.calendar_add(
|
||||
calendar_object
|
||||
);
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "overview",
|
||||
"parameters": {}
|
||||
}
|
||||
);
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
// do nothing
|
||||
/*
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "event_add",
|
||||
"parameters": {
|
||||
}
|
||||
}
|
||||
);
|
||||
*/
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
);
|
||||
await form.setup(document.querySelector("#calendar_add_form"));
|
||||
await form.input_write(
|
||||
{
|
||||
"name": "",
|
||||
"access": {
|
||||
"public": false,
|
||||
"default_level": _dali.type.enum_access_level.view,
|
||||
"attributed": lib_plankton.map.hashmap.implementation_map<
|
||||
_dali.type.user_id,
|
||||
_dali.type.enum_access_level
|
||||
>(
|
||||
lib_plankton.map.hashmap.make<
|
||||
_dali.type.user_id,
|
||||
_dali.type.enum_access_level
|
||||
>(
|
||||
user_id => user_id.toFixed(0),
|
||||
)
|
||||
),
|
||||
},
|
||||
"resource_kind": "local",
|
||||
"hue": lib_plankton.random.generate_unit(),
|
||||
}
|
||||
);
|
||||
return Promise.resolve<void>(undefined);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<div id="calendar_add">
|
||||
<h2>{{label}}</h2>
|
||||
<div id="calendar_add_form">
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
namespace _dali.pages
|
||||
{
|
||||
|
||||
/**
|
||||
*/
|
||||
lib_plankton.zoo_page.register(
|
||||
"calendar_edit",
|
||||
async (parameters, target_element) => {
|
||||
const read_only : boolean = ((parameters["read_only"] ?? "yes") === "yes");
|
||||
const calendar_id : int = parseInt(parameters["calendar_id"]);
|
||||
target_element.innerHTML = "";
|
||||
target_element.innerHTML = await _dali.helpers.template_coin(
|
||||
"calendar_edit",
|
||||
"default",
|
||||
{
|
||||
"label": lib_plankton.translate.get("page.calendar_edit.title.regular")
|
||||
}
|
||||
);
|
||||
const form : lib_plankton.zoo_form.class_form<
|
||||
{
|
||||
name : string;
|
||||
hue : float;
|
||||
access : {
|
||||
public : boolean;
|
||||
default_level : _dali.type.enum_access_level;
|
||||
attributed : lib_plankton.map.type_map<
|
||||
_dali.type.user_id,
|
||||
_dali.type.enum_access_level
|
||||
>;
|
||||
};
|
||||
},
|
||||
{
|
||||
name : string;
|
||||
hue : float;
|
||||
access : {
|
||||
public : boolean;
|
||||
default_level : _dali.type.enum_access_level;
|
||||
attributed : lib_plankton.map.type_map<
|
||||
_dali.type.user_id,
|
||||
_dali.type.enum_access_level
|
||||
>;
|
||||
};
|
||||
}
|
||||
> = new lib_plankton.zoo_form.class_form<
|
||||
{
|
||||
name : string;
|
||||
hue : float;
|
||||
access : {
|
||||
public : boolean;
|
||||
default_level : _dali.type.enum_access_level;
|
||||
attributed : lib_plankton.map.type_map<
|
||||
_dali.type.user_id,
|
||||
_dali.type.enum_access_level
|
||||
>;
|
||||
};
|
||||
},
|
||||
{
|
||||
name : string;
|
||||
hue : float;
|
||||
access : {
|
||||
public : boolean;
|
||||
default_level : _dali.type.enum_access_level;
|
||||
attributed : lib_plankton.map.type_map<
|
||||
_dali.type.user_id,
|
||||
_dali.type.enum_access_level
|
||||
>;
|
||||
};
|
||||
}
|
||||
>(
|
||||
(value) => value,
|
||||
(raw) => raw,
|
||||
new lib_plankton.zoo_input.class_input_group<any>(
|
||||
[
|
||||
{
|
||||
"name": "name",
|
||||
"input": new lib_plankton.zoo_input.class_input_text(),
|
||||
"label": lib_plankton.translate.get("calendar.name")
|
||||
},
|
||||
{
|
||||
"name": "hue",
|
||||
"input": new lib_plankton.zoo_input.class_input_hue(
|
||||
),
|
||||
"label": lib_plankton.translate.get("calendar.hue"),
|
||||
},
|
||||
{
|
||||
"name": "access",
|
||||
"input": new lib_plankton.zoo_input.class_input_group(
|
||||
[
|
||||
{
|
||||
"name": "public",
|
||||
"input": new lib_plankton.zoo_input.class_input_checkbox(),
|
||||
"label": lib_plankton.translate.get("calendar.access.public"),
|
||||
},
|
||||
{
|
||||
"name": "default_level",
|
||||
"input": _dali.helpers.input_access_level(),
|
||||
"label": lib_plankton.translate.get("calendar.access.default_level"),
|
||||
},
|
||||
{
|
||||
"name": "attributed",
|
||||
"input": await _dali.helpers.input_attributed_access(),
|
||||
"label": lib_plankton.translate.get("calendar.access.attributed"),
|
||||
},
|
||||
]
|
||||
),
|
||||
"label": lib_plankton.translate.get("calendar.access.access"),
|
||||
},
|
||||
]
|
||||
),
|
||||
(
|
||||
read_only
|
||||
?
|
||||
[
|
||||
]
|
||||
:
|
||||
[
|
||||
{
|
||||
"label": lib_plankton.translate.get("page.calendar_edit.actions.change"),
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
const data : any = await get_value();
|
||||
try {
|
||||
await _dali.backend.calendar_change(
|
||||
calendar_id,
|
||||
data
|
||||
);
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "overview",
|
||||
"parameters": {}
|
||||
}
|
||||
);
|
||||
}
|
||||
catch (error) {
|
||||
// do nothing
|
||||
/*
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "event_add",
|
||||
"parameters": {
|
||||
}
|
||||
}
|
||||
);
|
||||
*/
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": lib_plankton.translate.get("page.calendar_edit.actions.remove"),
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
try {
|
||||
await _dali.backend.calendar_remove(
|
||||
calendar_id
|
||||
);
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "overview",
|
||||
"parameters": {}
|
||||
}
|
||||
);
|
||||
}
|
||||
catch (error) {
|
||||
// do nothing
|
||||
/*
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "event_add",
|
||||
"parameters": {
|
||||
}
|
||||
}
|
||||
);
|
||||
*/
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
)
|
||||
);
|
||||
await form.setup(document.querySelector("#calendar_edit_form"));
|
||||
const calendar_object : _dali.type.calendar_object = await _dali.backend.calendar_get(
|
||||
calendar_id
|
||||
);
|
||||
await form.input_write(calendar_object);
|
||||
return Promise.resolve<void>(undefined);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<div id="calendar_edit">
|
||||
<h2>{{label}}</h2>
|
||||
<div id="calendar_edit_form">
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,235 +0,0 @@
|
|||
namespace _dali.pages
|
||||
{
|
||||
|
||||
/**
|
||||
*/
|
||||
lib_plankton.zoo_page.register(
|
||||
"event_add",
|
||||
async (parameters, target_element) => {
|
||||
const calendar_id : (null | int) = (
|
||||
("calendar_id" in parameters)
|
||||
?
|
||||
parseInt(parameters["calendar_id"])
|
||||
:
|
||||
null
|
||||
);
|
||||
const year : (null | int) = (
|
||||
("year" in parameters)
|
||||
?
|
||||
parseInt(parameters["year"])
|
||||
:
|
||||
null
|
||||
);
|
||||
const month : (null | int) = (
|
||||
("month" in parameters)
|
||||
?
|
||||
parseInt(parameters["month"])
|
||||
:
|
||||
null
|
||||
);
|
||||
const day : (null | int) = (
|
||||
("day" in parameters)
|
||||
?
|
||||
parseInt(parameters["day"])
|
||||
:
|
||||
null
|
||||
);
|
||||
const date : lib_plankton.pit.type_date = (
|
||||
(
|
||||
(year !== null)
|
||||
&&
|
||||
(month !== null)
|
||||
&&
|
||||
(day !== null)
|
||||
)
|
||||
?
|
||||
{
|
||||
"year": year,
|
||||
"month": month,
|
||||
"day": day,
|
||||
}
|
||||
:
|
||||
lib_plankton.pit.to_datetime(lib_plankton.pit.now()).date
|
||||
);
|
||||
target_element.innerHTML = "";
|
||||
target_element.innerHTML = await _dali.helpers.template_coin(
|
||||
"event_add",
|
||||
"default",
|
||||
{
|
||||
"label": lib_plankton.translate.get("page.event_add.title")
|
||||
}
|
||||
);
|
||||
const form : lib_plankton.zoo_form.class_form<
|
||||
{
|
||||
calendar_id : _dali.type.calendar_id;
|
||||
event_object : _dali.type.event_object;
|
||||
},
|
||||
{
|
||||
calendar_id : string;
|
||||
name : string;
|
||||
begin : lib_plankton.pit.type_datetime;
|
||||
end : (null | lib_plankton.pit.type_datetime);
|
||||
location : (null | string);
|
||||
link : (null | string);
|
||||
description : (null | string);
|
||||
}
|
||||
> = new lib_plankton.zoo_form.class_form<
|
||||
{
|
||||
calendar_id : _dali.type.calendar_id;
|
||||
event_object : _dali.type.event_object;
|
||||
},
|
||||
{
|
||||
calendar_id : string;
|
||||
name : string;
|
||||
begin : lib_plankton.pit.type_datetime;
|
||||
end : (null | lib_plankton.pit.type_datetime);
|
||||
location : (null | string);
|
||||
link : (null | string);
|
||||
description : (null | string);
|
||||
}
|
||||
>(
|
||||
(value) => ({
|
||||
"calendar_id": value.calendar_id.toFixed(0),
|
||||
"name": value.event_object.name,
|
||||
"begin": value.event_object.begin,
|
||||
"end": value.event_object.end,
|
||||
"location": value.event_object.location,
|
||||
"link": value.event_object.link,
|
||||
"description": value.event_object.description,
|
||||
}),
|
||||
(representation) => ({
|
||||
"calendar_id": parseInt(representation.calendar_id),
|
||||
"event_object": {
|
||||
"name": representation.name,
|
||||
"begin": representation.begin,
|
||||
"end": representation.end,
|
||||
"location": representation.location,
|
||||
"link": representation.link,
|
||||
"description": representation.description,
|
||||
}
|
||||
}),
|
||||
new lib_plankton.zoo_input.class_input_group<any>(
|
||||
[
|
||||
{
|
||||
"name": "calendar_id",
|
||||
"input": new lib_plankton.zoo_input.class_input_selection(
|
||||
(
|
||||
(await _dali.backend.calendar_list())
|
||||
.filter(
|
||||
(entry) => (
|
||||
(entry.access_level === _dali.type.enum_access_level.edit)
|
||||
||
|
||||
(entry.access_level === _dali.type.enum_access_level.admin)
|
||||
)
|
||||
)
|
||||
.map(
|
||||
(entry) => ({
|
||||
"value": entry.id.toFixed(0),
|
||||
"label": entry.name,
|
||||
})
|
||||
)
|
||||
)
|
||||
),
|
||||
"label": lib_plankton.translate.get("calendar.calendar")
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"input": new lib_plankton.zoo_input.class_input_text(
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.name")
|
||||
},
|
||||
{
|
||||
"name": "begin",
|
||||
"input": _dali.helpers.datetime_input(),
|
||||
"label": lib_plankton.translate.get("event.begin")
|
||||
},
|
||||
{
|
||||
"name": "end",
|
||||
"input": new lib_plankton.zoo_input.class_input_soft<lib_plankton.pit.type_datetime>(
|
||||
_dali.helpers.datetime_input()
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.end")
|
||||
},
|
||||
{
|
||||
"name": "location",
|
||||
"input": new lib_plankton.zoo_input.class_input_soft<string>(
|
||||
new lib_plankton.zoo_input.class_input_text(
|
||||
)
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.location")
|
||||
},
|
||||
{
|
||||
"name": "link",
|
||||
"input": new lib_plankton.zoo_input.class_input_soft<string>(
|
||||
new lib_plankton.zoo_input.class_input_text(
|
||||
)
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.link")
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"input": new lib_plankton.zoo_input.class_input_soft<string>(
|
||||
new lib_plankton.zoo_input.class_input_textarea(
|
||||
)
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.description")
|
||||
},
|
||||
]
|
||||
),
|
||||
[
|
||||
{
|
||||
"label": lib_plankton.translate.get("page.event_add.actions.do"),
|
||||
"target": "submit",
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
const value : any = await get_value();
|
||||
try {
|
||||
await _dali.backend.calendar_event_add(
|
||||
value.calendar_id,
|
||||
value.event_object
|
||||
);
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "overview",
|
||||
"parameters": {}
|
||||
}
|
||||
);
|
||||
}
|
||||
catch (error) {
|
||||
// do nothing
|
||||
/*
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "event_add",
|
||||
"parameters": {
|
||||
}
|
||||
}
|
||||
);
|
||||
*/
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
);
|
||||
await form.setup(document.querySelector("#event_add_form"));
|
||||
await form.input_write(
|
||||
{
|
||||
"calendar_id": (calendar_id ?? 0),
|
||||
"event_object": {
|
||||
"name": "",
|
||||
"begin": {
|
||||
"timezone_shift": 0,
|
||||
"date": date,
|
||||
"time": null
|
||||
},
|
||||
"end": null,
|
||||
"location": null,
|
||||
"link": null,
|
||||
"description": null,
|
||||
}
|
||||
}
|
||||
);
|
||||
return Promise.resolve<void>(undefined);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<div id="event_add">
|
||||
<h2>{{label}}</h2>
|
||||
<div id="event_add_form">
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,195 +0,0 @@
|
|||
namespace _dali.pages
|
||||
{
|
||||
|
||||
/**
|
||||
*/
|
||||
lib_plankton.zoo_page.register(
|
||||
"event_edit",
|
||||
async (parameters, target_element) => {
|
||||
const read_only : boolean = ((parameters["read_only"] ?? "yes") === "yes");
|
||||
const calendar_id : int = parseInt(parameters["calendar_id"]);
|
||||
const event_id : int = parseInt(parameters["event_id"]);
|
||||
target_element.innerHTML = "";
|
||||
target_element.innerHTML = await _dali.helpers.template_coin(
|
||||
"event_edit",
|
||||
"default",
|
||||
{
|
||||
"label": (
|
||||
read_only
|
||||
?
|
||||
lib_plankton.translate.get("page.event_edit.title.read_only")
|
||||
:
|
||||
lib_plankton.translate.get("page.event_edit.title.regular")
|
||||
)
|
||||
}
|
||||
);
|
||||
const form : lib_plankton.zoo_form.class_form<
|
||||
_dali.type.event_object,
|
||||
{
|
||||
name : string;
|
||||
begin : lib_plankton.pit.type_datetime;
|
||||
end : (null | lib_plankton.pit.type_datetime);
|
||||
location : (null | string);
|
||||
link : (null | string);
|
||||
description : (null | string);
|
||||
}
|
||||
> = new lib_plankton.zoo_form.class_form<
|
||||
_dali.type.event_object,
|
||||
{
|
||||
name : string;
|
||||
begin : lib_plankton.pit.type_datetime;
|
||||
end : (null | lib_plankton.pit.type_datetime);
|
||||
location : (null | string);
|
||||
link : (null | string);
|
||||
description : (null | string);
|
||||
}
|
||||
>(
|
||||
(value) => ({
|
||||
"name": value.name,
|
||||
"begin": value.begin,
|
||||
"end": value.end,
|
||||
"location": value.location,
|
||||
"link": value.link,
|
||||
"description": value.description,
|
||||
}),
|
||||
(representation) => ({
|
||||
"name": representation.name,
|
||||
"begin": representation.begin,
|
||||
"end": representation.end,
|
||||
"location": representation.location,
|
||||
"link": representation.link,
|
||||
"description": representation.description,
|
||||
}),
|
||||
new lib_plankton.zoo_input.class_input_group<any>(
|
||||
[
|
||||
{
|
||||
"name": "name",
|
||||
"input": new lib_plankton.zoo_input.class_input_text(
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.name")
|
||||
},
|
||||
{
|
||||
"name": "begin",
|
||||
"input": _dali.helpers.datetime_input(),
|
||||
"label": lib_plankton.translate.get("event.begin")
|
||||
},
|
||||
{
|
||||
"name": "end",
|
||||
"input": new lib_plankton.zoo_input.class_input_soft<lib_plankton.pit.type_datetime>(
|
||||
_dali.helpers.datetime_input()
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.end")
|
||||
},
|
||||
{
|
||||
"name": "location",
|
||||
"input": new lib_plankton.zoo_input.class_input_soft<string>(
|
||||
new lib_plankton.zoo_input.class_input_text(
|
||||
)
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.location")
|
||||
},
|
||||
{
|
||||
"name": "link",
|
||||
"input": new lib_plankton.zoo_input.class_input_soft<string>(
|
||||
new lib_plankton.zoo_input.class_input_text(
|
||||
)
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.link")
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"input": new lib_plankton.zoo_input.class_input_soft<string>(
|
||||
new lib_plankton.zoo_input.class_input_textarea(
|
||||
)
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.description")
|
||||
},
|
||||
]
|
||||
),
|
||||
(
|
||||
read_only
|
||||
?
|
||||
[
|
||||
]
|
||||
:
|
||||
[
|
||||
{
|
||||
"label": lib_plankton.translate.get("page.event_edit.actions.change"),
|
||||
"target": "submit",
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
const value : any = await get_value();
|
||||
try {
|
||||
await _dali.backend.calendar_event_change(
|
||||
calendar_id,
|
||||
event_id,
|
||||
value
|
||||
);
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "overview",
|
||||
"parameters": {}
|
||||
}
|
||||
);
|
||||
}
|
||||
catch (error) {
|
||||
lib_plankton.log.warning("page_event_edit_error", {"error": String(error)});
|
||||
// do nothing
|
||||
/*
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "event_add",
|
||||
"parameters": {
|
||||
}
|
||||
}
|
||||
);
|
||||
*/
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": lib_plankton.translate.get("page.event_edit.actions.remove"),
|
||||
"target": "submit",
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
try {
|
||||
await _dali.backend.calendar_event_remove(
|
||||
calendar_id,
|
||||
event_id
|
||||
);
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "overview",
|
||||
"parameters": {}
|
||||
}
|
||||
);
|
||||
}
|
||||
catch (error) {
|
||||
lib_plankton.log.warning("page_event_edit_error", {"error": String(error)});
|
||||
// do nothing
|
||||
/*
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "event_add",
|
||||
"parameters": {
|
||||
}
|
||||
}
|
||||
);
|
||||
*/
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
)
|
||||
);
|
||||
await form.setup(document.querySelector("#event_edit_form"));
|
||||
const event_object : _dali.type.event_object = await _dali.backend.calendar_event_get(
|
||||
calendar_id,
|
||||
event_id
|
||||
);
|
||||
await form.input_write(
|
||||
event_object
|
||||
);
|
||||
return Promise.resolve<void>(undefined);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<div id="event_edit">
|
||||
<h2>{{label}}</h2>
|
||||
<div id="event_edit_form">
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -27,7 +27,7 @@ namespace _dali.pages.overview
|
|||
|
||||
// mode switcher
|
||||
{
|
||||
const widget_mode_switcher : _dali.class_widget = new _dali.widgets.mode_switcher.class_widget_mode_switcher(
|
||||
const widget_mode_switcher : lib_plankton.zoo_widget.interface_widget = new _dali.widgets.mode_switcher.class_widget_mode_switcher(
|
||||
[
|
||||
{
|
||||
"mode": _dali.type.enum_view_mode.week,
|
||||
|
|
@ -57,8 +57,16 @@ namespace _dali.pages.overview
|
|||
await widget_mode_switcher.load(target_element.querySelector("#overview-mode"));
|
||||
}
|
||||
|
||||
let widget_sources : _dali.widgets.sources.class_widget_sources;
|
||||
let widget_weekview : _dali.widgets.weekview.class_widget_weekview;
|
||||
let widget_listview : _dali.widgets.listview.class_widget_listview;
|
||||
/**
|
||||
* @todo update sources
|
||||
*/
|
||||
const update = async () => {
|
||||
await widget_weekview.update_entries();
|
||||
await widget_sources.update();
|
||||
};
|
||||
// hint
|
||||
{
|
||||
if (! await _dali.backend.is_logged_in())
|
||||
|
|
@ -72,19 +80,56 @@ namespace _dali.pages.overview
|
|||
}
|
||||
// sources
|
||||
{
|
||||
const data : Array<
|
||||
{
|
||||
id : _dali.type.calendar_id;
|
||||
name : string;
|
||||
hue : float;
|
||||
access_level : _dali.type.enum_access_level;
|
||||
}
|
||||
> = await _dali.backend.calendar_list(
|
||||
);
|
||||
const widget_sources = new _dali.widgets.sources.class_widget_sources(
|
||||
data,
|
||||
widget_sources = new _dali.widgets.sources.class_widget_sources(
|
||||
_dali.backend.calendar_list,
|
||||
{
|
||||
"action_create": () => {
|
||||
(async () => {
|
||||
const widget = new _dali.widgets.calendar_edit.class_widget_calendar_edit(
|
||||
{
|
||||
"read_only": false,
|
||||
"action_cancel": () => {
|
||||
_dali.overlay.toggle({"mode": false});
|
||||
},
|
||||
"action_add": (data) => {
|
||||
_dali.backend.calendar_add(
|
||||
{
|
||||
"name": data.name,
|
||||
"hue": data.hue,
|
||||
"access": data.access,
|
||||
"resource": {
|
||||
"kind": "local",
|
||||
"data": {
|
||||
"events": [],
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
.then(
|
||||
() => {
|
||||
update();
|
||||
_dali.overlay.toggle({"mode": false});
|
||||
}
|
||||
)
|
||||
.catch(
|
||||
(reason) => {
|
||||
lib_plankton.log.warning(
|
||||
"dali.overview.calendar_add_error",
|
||||
{"details": String(reason)}
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
"initial_value": null,
|
||||
}
|
||||
);
|
||||
_dali.overlay.clear();
|
||||
_dali.overlay.toggle({"mode": true});
|
||||
await widget.load(_dali.overlay.get_content_element());
|
||||
}) ();
|
||||
},
|
||||
"action_open": (entry) => {
|
||||
let read_only : boolean;
|
||||
switch (entry.access_level)
|
||||
{
|
||||
case _dali.type.enum_access_level.none:
|
||||
|
|
@ -95,31 +140,60 @@ namespace _dali.pages.overview
|
|||
case _dali.type.enum_access_level.edit:
|
||||
case _dali.type.enum_access_level.view:
|
||||
{
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "calendar_edit",
|
||||
"parameters": {
|
||||
"read_only": "yes",
|
||||
"calendar_id": entry.id,
|
||||
}
|
||||
}
|
||||
);
|
||||
read_only = true;
|
||||
break;
|
||||
}
|
||||
case _dali.type.enum_access_level.admin:
|
||||
{
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "calendar_edit",
|
||||
"parameters": {
|
||||
"read_only": "no",
|
||||
"calendar_id": entry.id,
|
||||
}
|
||||
}
|
||||
);
|
||||
read_only = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
(async () => {
|
||||
const calendar_id : _dali.type.calendar_id = entry.id;
|
||||
const calendar_object : _dali.type.calendar_object = await _dali.backend.calendar_get(
|
||||
calendar_id
|
||||
);
|
||||
const widget = new _dali.widgets.calendar_edit.class_widget_calendar_edit(
|
||||
{
|
||||
"read_only": read_only,
|
||||
"action_cancel": () => {
|
||||
_dali.overlay.toggle({"mode": false});
|
||||
},
|
||||
"action_change": (data) => {
|
||||
_dali.backend.calendar_change(
|
||||
calendar_id,
|
||||
data
|
||||
)
|
||||
.then(
|
||||
() => {
|
||||
update();
|
||||
_dali.overlay.toggle({"mode": false});
|
||||
}
|
||||
);
|
||||
},
|
||||
"action_remove": (data) => {
|
||||
_dali.backend.calendar_remove(
|
||||
calendar_id
|
||||
)
|
||||
.then(
|
||||
() => {
|
||||
update();
|
||||
_dali.overlay.toggle({"mode": false});
|
||||
}
|
||||
);
|
||||
},
|
||||
"initial_value": {
|
||||
"name": calendar_object.name,
|
||||
"hue": calendar_object.hue,
|
||||
"access": calendar_object.access,
|
||||
},
|
||||
}
|
||||
);
|
||||
_dali.overlay.clear();
|
||||
_dali.overlay.toggle({"mode": true});
|
||||
await widget.load(_dali.overlay.get_content_element());
|
||||
}) ();
|
||||
},
|
||||
"action_toggle_visibility": (entry) => {
|
||||
widget_weekview.toggle_visibility(entry.id);
|
||||
|
|
@ -139,6 +213,16 @@ namespace _dali.pages.overview
|
|||
}
|
||||
);
|
||||
const action_select_event = (calendar_id, access_level, event_id) => {
|
||||
/*
|
||||
if (! await _dali.backend.is_logged_in())
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
*/
|
||||
let read_only : boolean;
|
||||
switch (access_level)
|
||||
{
|
||||
case _dali.type.enum_access_level.none:
|
||||
|
|
@ -148,34 +232,90 @@ namespace _dali.pages.overview
|
|||
}
|
||||
case _dali.type.enum_access_level.view:
|
||||
{
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "event_edit",
|
||||
"parameters": {
|
||||
"read_only": "yes",
|
||||
"calendar_id": calendar_id,
|
||||
"event_id": event_id,
|
||||
}
|
||||
}
|
||||
);
|
||||
read_only = true;
|
||||
break;
|
||||
}
|
||||
case _dali.type.enum_access_level.edit:
|
||||
case _dali.type.enum_access_level.admin:
|
||||
{
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "event_edit",
|
||||
"parameters": {
|
||||
"read_only": "no",
|
||||
"calendar_id": calendar_id,
|
||||
"event_id": event_id,
|
||||
}
|
||||
}
|
||||
);
|
||||
read_only = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
(async () => {
|
||||
const event_object : _dali.type.event_object = await _dali.backend.calendar_event_get(
|
||||
calendar_id,
|
||||
event_id
|
||||
);
|
||||
const widget = new _dali.widgets.event_edit.class_widget_event_edit(
|
||||
{
|
||||
"calendar_id": calendar_id,
|
||||
"event_name": event_object.name,
|
||||
"event_begin": event_object.begin,
|
||||
"event_end": event_object.end,
|
||||
"event_location": event_object.location,
|
||||
"event_link": event_object.link,
|
||||
"event_description": event_object.description,
|
||||
},
|
||||
{
|
||||
"read_only": read_only,
|
||||
"action_cancel": () => {
|
||||
_dali.overlay.toggle({"mode": false});
|
||||
},
|
||||
"action_change": (data) => {
|
||||
_dali.backend.calendar_event_change(
|
||||
calendar_id,
|
||||
event_id,
|
||||
{
|
||||
"name": data.event_name,
|
||||
"begin": data.event_begin,
|
||||
"end": data.event_end,
|
||||
"location": data.event_location,
|
||||
"link": data.event_link,
|
||||
"description": data.event_description,
|
||||
}
|
||||
)
|
||||
.then(
|
||||
() => {
|
||||
update();
|
||||
_dali.overlay.toggle({"mode": false});
|
||||
}
|
||||
)
|
||||
.catch(
|
||||
(reason) => {
|
||||
lib_plankton.log.warning(
|
||||
"dali.overview.event_change.error",
|
||||
{"details": String(reason)}
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
"action_remove": () => {
|
||||
_dali.backend.calendar_event_remove(
|
||||
calendar_id,
|
||||
event_id
|
||||
)
|
||||
.then(
|
||||
() => {
|
||||
update();
|
||||
_dali.overlay.toggle({"mode": false});
|
||||
}
|
||||
)
|
||||
.catch(
|
||||
(reason) => {
|
||||
lib_plankton.log.warning(
|
||||
"dali.overview.event_remove_error",
|
||||
{"details": String(reason)}
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
}
|
||||
);
|
||||
_dali.overlay.clear();
|
||||
_dali.overlay.toggle({"mode": true});
|
||||
await widget.load(_dali.overlay.get_content_element());
|
||||
}) ();
|
||||
};
|
||||
// listview
|
||||
{
|
||||
|
|
@ -210,17 +350,85 @@ namespace _dali.pages.overview
|
|||
{
|
||||
"action_select_event": action_select_event,
|
||||
"action_select_day": (date) => {
|
||||
lib_plankton.zoo_page.set(
|
||||
{
|
||||
"name": "event_add",
|
||||
"parameters": {
|
||||
/*
|
||||
if (! await _dali.backend.is_logged_in())
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
*/
|
||||
(async () => {
|
||||
const widget = new _dali.widgets.event_edit.class_widget_event_edit(
|
||||
{
|
||||
"calendar_id": null,
|
||||
"year": date.year,
|
||||
"month": date.month,
|
||||
"day": date.day,
|
||||
"event_name": "",
|
||||
"event_begin": lib_plankton.call.convey(
|
||||
date,
|
||||
[
|
||||
x => ({
|
||||
"timezone_shift": 0,
|
||||
"date": date,
|
||||
"time": {"hour": 12, "minute": 0, "second": 0}
|
||||
}),
|
||||
lib_plankton.pit.from_datetime,
|
||||
x => lib_plankton.pit.shift_hour(x, 0),
|
||||
lib_plankton.pit.to_datetime,
|
||||
]
|
||||
),
|
||||
"event_end": lib_plankton.call.convey(
|
||||
date,
|
||||
[
|
||||
x => ({
|
||||
"timezone_shift": 0,
|
||||
"date": date,
|
||||
"time": {"hour": 12, "minute": 0, "second": 0}
|
||||
}),
|
||||
lib_plankton.pit.from_datetime,
|
||||
x => lib_plankton.pit.shift_hour(x, +1),
|
||||
lib_plankton.pit.to_datetime,
|
||||
]
|
||||
),
|
||||
"event_location": null,
|
||||
"event_link": null,
|
||||
"event_description": null,
|
||||
},
|
||||
{
|
||||
"read_only": false,
|
||||
"action_cancel": () => {
|
||||
_dali.overlay.toggle({"mode": false});
|
||||
},
|
||||
"action_add": (data) => {
|
||||
_dali.backend.calendar_event_add(
|
||||
data.calendar_id,
|
||||
{
|
||||
"name": data.event_name,
|
||||
"begin": data.event_begin,
|
||||
"end": data.event_end,
|
||||
"location": data.event_location,
|
||||
"link": data.event_link,
|
||||
"description": data.event_description,
|
||||
}
|
||||
)
|
||||
.then(
|
||||
() => {
|
||||
update();
|
||||
_dali.overlay.toggle({"mode": false});
|
||||
}
|
||||
)
|
||||
.catch(
|
||||
(reason) => {
|
||||
// todo
|
||||
}
|
||||
);
|
||||
},
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
_dali.overlay.clear();
|
||||
_dali.overlay.toggle({"mode": true});
|
||||
await widget.load(_dali.overlay.get_content_element());
|
||||
}) ();
|
||||
},
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,16 @@ namespace _dali.backend
|
|||
|
||||
/**
|
||||
*/
|
||||
var _cache : (
|
||||
null
|
||||
|
|
||||
lib_plankton.cache.type_subject<boolean>
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* meant for translation of the API values
|
||||
*/
|
||||
function access_level_encode(
|
||||
access_level : _dali.type.enum_access_level
|
||||
) : ("none" | "view" | "edit" | "admin")
|
||||
|
|
@ -28,6 +38,7 @@ namespace _dali.backend
|
|||
|
||||
|
||||
/**
|
||||
* meant for translation of the API values
|
||||
*/
|
||||
function access_level_decode(
|
||||
access_level_encoded : ("none" | "view" | "edit" | "admin")
|
||||
|
|
@ -52,6 +63,14 @@ namespace _dali.backend
|
|||
"corner": "zeitbild",
|
||||
}
|
||||
);
|
||||
_cache = lib_plankton.cache.make<boolean>(
|
||||
/*
|
||||
lib_plankton.storage.memory.implementation_chest(
|
||||
{
|
||||
}
|
||||
)
|
||||
*/
|
||||
);
|
||||
return Promise.resolve<void>(undefined);
|
||||
}
|
||||
|
||||
|
|
@ -162,19 +181,27 @@ namespace _dali.backend
|
|||
|
||||
|
||||
/**
|
||||
* @todo mneh …
|
||||
*/
|
||||
export async function is_logged_in(
|
||||
) : Promise<boolean>
|
||||
{
|
||||
// return ((await get_session_key()) !== null);
|
||||
const result : {
|
||||
logged_in : boolean;
|
||||
} = await call(
|
||||
lib_plankton.http.enum_method.get,
|
||||
"/session/status",
|
||||
null
|
||||
return lib_plankton.cache.get(
|
||||
_cache,
|
||||
"status",
|
||||
5,
|
||||
async () => {
|
||||
// return ((await get_session_key()) !== null);
|
||||
const result : {
|
||||
logged_in : boolean;
|
||||
} = await call(
|
||||
lib_plankton.http.enum_method.get,
|
||||
"/session/status",
|
||||
null
|
||||
);
|
||||
return result.logged_in;
|
||||
}
|
||||
);
|
||||
return result.logged_in;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -547,6 +574,7 @@ namespace _dali.backend
|
|||
|
||||
|
||||
/**
|
||||
* @todo Möglichkeit den Kalender zu ändern
|
||||
*/
|
||||
export async function calendar_event_change(
|
||||
calendar_id : _dali.type.calendar_id,
|
||||
|
|
@ -595,12 +623,20 @@ namespace _dali.backend
|
|||
export async function events(
|
||||
from_pit : lib_plankton.pit.type_pit,
|
||||
to_pit : lib_plankton.pit.type_pit,
|
||||
options : {
|
||||
{
|
||||
"calendar_ids": calendar_ids = null,
|
||||
}
|
||||
:
|
||||
{
|
||||
calendar_ids ?: (null | Array<_dali.type.calendar_id>);
|
||||
} = {}
|
||||
}
|
||||
=
|
||||
{
|
||||
}
|
||||
) : Promise<
|
||||
Array<
|
||||
{
|
||||
key : _dali.type.event_key;
|
||||
calendar_id : _dali.type.calendar_id;
|
||||
calendar_name : string;
|
||||
hue : float;
|
||||
|
|
@ -611,13 +647,6 @@ namespace _dali.backend
|
|||
>
|
||||
>
|
||||
{
|
||||
options = Object.assign(
|
||||
{
|
||||
"calendar_ids": null,
|
||||
},
|
||||
options
|
||||
);
|
||||
|
||||
return (
|
||||
call(
|
||||
lib_plankton.http.enum_method.get,
|
||||
|
|
@ -628,11 +657,11 @@ namespace _dali.backend
|
|||
"to": to_pit,
|
||||
},
|
||||
(
|
||||
(options.calendar_ids === null)
|
||||
(calendar_ids === null)
|
||||
?
|
||||
{}
|
||||
:
|
||||
{"calendar_ids": options.calendar_ids.join(",")}
|
||||
{"calendar_ids": calendar_ids.join(",")}
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
@ -641,6 +670,7 @@ namespace _dali.backend
|
|||
data
|
||||
.map(
|
||||
(entry) => ({
|
||||
"key": entry.hash,
|
||||
"calendar_id": entry.calendar_id,
|
||||
"calendar_name": entry.calendar_name,
|
||||
"hue": entry.hue,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,39 @@ header
|
|||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
#overlay
|
||||
{
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.75);
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
#overlay_content
|
||||
{
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
|
||||
transform: translate(-50%,-50%);
|
||||
-ms-transform: translate(-50%,-50%);
|
||||
|
||||
padding: 32px;
|
||||
|
||||
background-color: hsl(0, 0%, 12.5%);
|
||||
color: hsl(0, 0%, 100%);
|
||||
}
|
||||
|
||||
#overlay:not(.overlay_active)
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
nav > ul
|
||||
{
|
||||
list-style-type: none;
|
||||
|
|
@ -56,12 +89,14 @@ nav a:hover
|
|||
a
|
||||
{
|
||||
text-decoration: none;
|
||||
color: hsl(var(--hue), 50%, 50%);
|
||||
color: hsl(var(--hue), 0%, 87.5%);
|
||||
}
|
||||
|
||||
a:hover
|
||||
{
|
||||
color: hsl(var(--hue), 50%, 75%);
|
||||
color: hsl(var(--hue), 0%, 100%);
|
||||
border-bottom: 2px solid hsl(0, 0%, 100%);
|
||||
transition: 1s ease color;
|
||||
}
|
||||
|
||||
input,select,textarea
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
.sources
|
||||
{
|
||||
font-size: 0.75em;
|
||||
}
|
||||
|
||||
.sources-entries
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
font-size: 0.75em;
|
||||
}
|
||||
|
||||
.sources-entry
|
||||
|
|
|
|||
241
source/widgets/calendar_edit/logic.ts
Normal file
241
source/widgets/calendar_edit/logic.ts
Normal file
|
|
@ -0,0 +1,241 @@
|
|||
namespace _dali.widgets.calendar_edit
|
||||
{
|
||||
|
||||
/**
|
||||
*/
|
||||
export type type_value = {
|
||||
name : string;
|
||||
hue : float;
|
||||
access : {
|
||||
public : boolean;
|
||||
default_level : _dali.type.enum_access_level;
|
||||
attributed : lib_plankton.map.type_map<
|
||||
_dali.type.user_id,
|
||||
_dali.type.enum_access_level
|
||||
>;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
export class class_widget_calendar_edit
|
||||
implements lib_plankton.zoo_widget.interface_widget
|
||||
{
|
||||
|
||||
/**
|
||||
*/
|
||||
private read_only : boolean;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
private action_cancel ?: (null | (() => void));
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
private action_add ?: (null | ((value : type_value) => void));
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
private action_change ?: (null | ((value : type_value) => void));
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
private action_remove ?: (null | ((value : type_value) => void));
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
private initial_value : (null | type_value);
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public constructor(
|
||||
{
|
||||
"read_only": read_only = false,
|
||||
"action_cancel": action_cancel = null,
|
||||
"action_add": action_add = null,
|
||||
"action_change": action_change = null,
|
||||
"action_remove": action_remove = null,
|
||||
"initial_value": initial_value = null,
|
||||
}
|
||||
:
|
||||
{
|
||||
read_only ?: boolean;
|
||||
action_cancel ?: (null | (() => void));
|
||||
action_add ?: (null | ((value : type_value) => void))
|
||||
action_change ?: (null | ((value : type_value) => void));
|
||||
action_remove ?: (null | ((value : type_value) => void));
|
||||
initial_value ?: (null | type_value);
|
||||
}
|
||||
=
|
||||
{
|
||||
}
|
||||
)
|
||||
{
|
||||
this.read_only = read_only;
|
||||
this.action_cancel = action_cancel;
|
||||
this.action_add = action_add;
|
||||
this.action_change = action_change;
|
||||
this.action_remove = action_remove;
|
||||
this.initial_value = initial_value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [implementation]
|
||||
*/
|
||||
public async load(
|
||||
target_element : HTMLElement
|
||||
) : Promise<void>
|
||||
{
|
||||
const form : lib_plankton.zoo_form.class_form<
|
||||
type_value,
|
||||
type_value
|
||||
> = new lib_plankton.zoo_form.class_form<
|
||||
type_value,
|
||||
type_value
|
||||
>(
|
||||
(value) => value,
|
||||
(raw) => raw,
|
||||
new lib_plankton.zoo_input.class_input_group<any>(
|
||||
[
|
||||
{
|
||||
"name": "name",
|
||||
"input": new lib_plankton.zoo_input.class_input_text(),
|
||||
"label": lib_plankton.translate.get("calendar.name")
|
||||
},
|
||||
{
|
||||
"name": "hue",
|
||||
"input": new lib_plankton.zoo_input.class_input_hue(
|
||||
),
|
||||
"label": lib_plankton.translate.get("calendar.hue"),
|
||||
},
|
||||
{
|
||||
"name": "access",
|
||||
"input": new lib_plankton.zoo_input.class_input_group(
|
||||
[
|
||||
{
|
||||
"name": "public",
|
||||
"input": new lib_plankton.zoo_input.class_input_checkbox(),
|
||||
"label": lib_plankton.translate.get("calendar.access.public"),
|
||||
},
|
||||
{
|
||||
"name": "default_level",
|
||||
"input": _dali.helpers.input_access_level(),
|
||||
"label": lib_plankton.translate.get("calendar.access.default_level"),
|
||||
},
|
||||
{
|
||||
"name": "attributed",
|
||||
"input": await _dali.helpers.input_attributed_access(),
|
||||
"label": lib_plankton.translate.get("calendar.access.attributed"),
|
||||
},
|
||||
]
|
||||
),
|
||||
"label": lib_plankton.translate.get("calendar.access.access"),
|
||||
},
|
||||
]
|
||||
),
|
||||
(
|
||||
[]
|
||||
// cancel
|
||||
.concat(
|
||||
(! (this.action_cancel === null))
|
||||
?
|
||||
[
|
||||
{
|
||||
"label": lib_plankton.translate.get("common.cancel"),
|
||||
"procedure": async () => {
|
||||
this.action_cancel();
|
||||
}
|
||||
},
|
||||
]
|
||||
:
|
||||
[]
|
||||
)
|
||||
// add
|
||||
.concat(
|
||||
((! this.read_only) && (! (this.action_add === null)))
|
||||
?
|
||||
[
|
||||
{
|
||||
"label": lib_plankton.translate.get("widget.calendar_edit.actions.add"),
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
const value : type_value = await get_value();
|
||||
this.action_add(value);
|
||||
}
|
||||
},
|
||||
]
|
||||
:
|
||||
[]
|
||||
)
|
||||
// change
|
||||
.concat(
|
||||
((! this.read_only) && (! (this.action_change === null)))
|
||||
?
|
||||
[
|
||||
{
|
||||
"label": lib_plankton.translate.get("widget.calendar_edit.actions.change"),
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
const value : type_value = await get_value();
|
||||
this.action_change(value);
|
||||
}
|
||||
},
|
||||
]
|
||||
:
|
||||
[]
|
||||
)
|
||||
// remove
|
||||
.concat(
|
||||
((! this.read_only) && (! (this.action_change === null)))
|
||||
?
|
||||
[
|
||||
{
|
||||
"label": lib_plankton.translate.get("widget.calendar_edit.actions.remove"),
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
const value : type_value = await get_value();
|
||||
this.action_remove(value);
|
||||
}
|
||||
},
|
||||
]
|
||||
:
|
||||
[]
|
||||
)
|
||||
)
|
||||
);
|
||||
await form.setup(target_element);
|
||||
await form.input_write(
|
||||
(! (this.initial_value === null))
|
||||
?
|
||||
this.initial_value
|
||||
:
|
||||
{
|
||||
"name": "",
|
||||
"hue": lib_plankton.random.generate_unit(),
|
||||
"access": {
|
||||
"public": false,
|
||||
"default_level": _dali.type.enum_access_level.view,
|
||||
"attributed": lib_plankton.map.hashmap.implementation_map<
|
||||
_dali.type.user_id,
|
||||
_dali.type.enum_access_level
|
||||
>(
|
||||
lib_plankton.map.hashmap.make<
|
||||
_dali.type.user_id,
|
||||
_dali.type.enum_access_level
|
||||
>(
|
||||
user_id => user_id.toFixed(0),
|
||||
)
|
||||
),
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
282
source/widgets/event_edit/logic.ts
Normal file
282
source/widgets/event_edit/logic.ts
Normal file
|
|
@ -0,0 +1,282 @@
|
|||
namespace _dali.widgets.event_edit
|
||||
{
|
||||
|
||||
/**
|
||||
*/
|
||||
export type type_value = {
|
||||
calendar_id : (null | _dali.type.calendar_id);
|
||||
event_name : string;
|
||||
event_begin : lib_plankton.pit.type_datetime;
|
||||
event_end : (null | lib_plankton.pit.type_datetime);
|
||||
event_location : (null | string);
|
||||
event_link : (null | string);
|
||||
event_description : (null | string);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
export type type_representation = {
|
||||
calendar_id : string;
|
||||
event_name : string;
|
||||
event_begin : lib_plankton.pit.type_datetime;
|
||||
event_end : (null | lib_plankton.pit.type_datetime);
|
||||
event_location : (null | string);
|
||||
event_link : (null | string);
|
||||
event_description : (null | string);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
export class class_widget_event_edit
|
||||
implements lib_plankton.zoo_widget.interface_widget
|
||||
{
|
||||
|
||||
/**
|
||||
*/
|
||||
private read_only : boolean;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
private action_cancel ?: (null | (() => void));
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
private action_add ?: (null | ((value : type_value) => void));
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
private action_change ?: (null | ((value : type_value) => void));
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
private action_remove ?: (null | ((value : type_value) => void));
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
private initial_value : type_value;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public constructor(
|
||||
initial_value : type_value,
|
||||
{
|
||||
"read_only": read_only = false,
|
||||
"action_cancel": action_cancel = null,
|
||||
"action_add": action_add = null,
|
||||
"action_change": action_change = null,
|
||||
"action_remove": action_remove = null,
|
||||
}
|
||||
:
|
||||
{
|
||||
read_only ?: boolean;
|
||||
action_cancel ?: (null | (() => void));
|
||||
action_add ?: (null | ((value : type_value) => void));
|
||||
action_change ?: (null | ((value : type_value) => void));
|
||||
action_remove ?: (null | ((value : type_value) => void));
|
||||
}
|
||||
=
|
||||
{
|
||||
}
|
||||
)
|
||||
{
|
||||
this.read_only = read_only;
|
||||
this.action_cancel = action_cancel;
|
||||
this.action_add = action_add;
|
||||
this.action_change = action_change;
|
||||
this.action_remove = action_remove;
|
||||
this.initial_value = initial_value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [implementation]
|
||||
*/
|
||||
public async load(
|
||||
target_element : HTMLElement
|
||||
) : Promise<void>
|
||||
{
|
||||
const available_calendars : Array<
|
||||
{
|
||||
id : int;
|
||||
name : string;
|
||||
hue : float;
|
||||
access_level : _dali.type.enum_access_level;
|
||||
}
|
||||
> = (
|
||||
(await _dali.backend.calendar_list())
|
||||
.filter(
|
||||
(entry) => (
|
||||
(entry.access_level === _dali.type.enum_access_level.edit)
|
||||
||
|
||||
(entry.access_level === _dali.type.enum_access_level.admin)
|
||||
)
|
||||
)
|
||||
);
|
||||
const form : lib_plankton.zoo_form.class_form<
|
||||
type_value,
|
||||
type_representation
|
||||
> = new lib_plankton.zoo_form.class_form<
|
||||
type_value,
|
||||
type_representation
|
||||
>(
|
||||
(value) => ({
|
||||
"calendar_id": (value.calendar_id ?? available_calendars[0].id).toFixed(0),
|
||||
"event_name": value.event_name,
|
||||
"event_begin": value.event_begin,
|
||||
"event_end": value.event_end,
|
||||
"event_location": value.event_location,
|
||||
"event_link": value.event_link,
|
||||
"event_description": value.event_description,
|
||||
}),
|
||||
(representation) => ({
|
||||
"calendar_id": parseInt(representation.calendar_id),
|
||||
"event_name": representation.event_name,
|
||||
"event_begin": representation.event_begin,
|
||||
"event_end": representation.event_end,
|
||||
"event_location": representation.event_location,
|
||||
"event_link": representation.event_link,
|
||||
"event_description": representation.event_description,
|
||||
}),
|
||||
new lib_plankton.zoo_input.class_input_group<any>(
|
||||
[
|
||||
{
|
||||
"name": "calendar_id",
|
||||
"input": new lib_plankton.zoo_input.class_input_selection(
|
||||
(
|
||||
available_calendars
|
||||
.map(
|
||||
(entry) => ({
|
||||
"value": entry.id.toFixed(0),
|
||||
"label": entry.name,
|
||||
})
|
||||
)
|
||||
)
|
||||
),
|
||||
"label": lib_plankton.translate.get("calendar.calendar")
|
||||
},
|
||||
{
|
||||
"name": "event_name",
|
||||
"input": new lib_plankton.zoo_input.class_input_text(
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.name")
|
||||
},
|
||||
{
|
||||
"name": "event_begin",
|
||||
"input": _dali.helpers.datetime_input(),
|
||||
"label": lib_plankton.translate.get("event.begin")
|
||||
},
|
||||
{
|
||||
"name": "event_end",
|
||||
"input": new lib_plankton.zoo_input.class_input_soft<lib_plankton.pit.type_datetime>(
|
||||
_dali.helpers.datetime_input()
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.end")
|
||||
},
|
||||
{
|
||||
"name": "event_location",
|
||||
"input": new lib_plankton.zoo_input.class_input_soft<string>(
|
||||
new lib_plankton.zoo_input.class_input_text(
|
||||
)
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.location")
|
||||
},
|
||||
{
|
||||
"name": "event_link",
|
||||
"input": new lib_plankton.zoo_input.class_input_soft<string>(
|
||||
new lib_plankton.zoo_input.class_input_text(
|
||||
)
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.link")
|
||||
},
|
||||
{
|
||||
"name": "event_description",
|
||||
"input": new lib_plankton.zoo_input.class_input_soft<string>(
|
||||
new lib_plankton.zoo_input.class_input_textarea(
|
||||
)
|
||||
),
|
||||
"label": lib_plankton.translate.get("event.description")
|
||||
},
|
||||
]
|
||||
),
|
||||
(
|
||||
[]
|
||||
// cancel
|
||||
.concat(
|
||||
(! (this.action_cancel === null))
|
||||
?
|
||||
[
|
||||
{
|
||||
"label": lib_plankton.translate.get("common.cancel"),
|
||||
"procedure": async () => {
|
||||
this.action_cancel();
|
||||
}
|
||||
},
|
||||
]
|
||||
:
|
||||
[]
|
||||
)
|
||||
// add
|
||||
.concat(
|
||||
((! this.read_only) && (! (this.action_add === null)))
|
||||
?
|
||||
[
|
||||
{
|
||||
"label": lib_plankton.translate.get("widget.event_edit.actions.add"),
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
const value : type_value = await get_value();
|
||||
this.action_add(value);
|
||||
}
|
||||
},
|
||||
]
|
||||
:
|
||||
[]
|
||||
)
|
||||
// change
|
||||
.concat(
|
||||
((! this.read_only) && (! (this.action_change === null)))
|
||||
?
|
||||
[
|
||||
{
|
||||
"label": lib_plankton.translate.get("widget.event_edit.actions.change"),
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
const value : type_value = await get_value();
|
||||
this.action_change(value);
|
||||
}
|
||||
},
|
||||
]
|
||||
:
|
||||
[]
|
||||
)
|
||||
// remove
|
||||
.concat(
|
||||
((! this.read_only) && (! (this.action_change === null)))
|
||||
?
|
||||
[
|
||||
{
|
||||
"label": lib_plankton.translate.get("widget.event_edit.actions.remove"),
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
const value : type_value = await get_value();
|
||||
this.action_remove(value);
|
||||
}
|
||||
},
|
||||
]
|
||||
:
|
||||
[]
|
||||
)
|
||||
)
|
||||
);
|
||||
await form.setup(target_element);
|
||||
await form.input_write(this.initial_value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ namespace _dali.widgets.listview
|
|||
|
||||
/**
|
||||
*/
|
||||
export class class_widget_listview extends _dali.class_widget
|
||||
export class class_widget_listview implements lib_plankton.zoo_widget.interface_widget
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -94,7 +94,6 @@ namespace _dali.widgets.listview
|
|||
},
|
||||
options
|
||||
);
|
||||
super();
|
||||
this.get_entries = get_entries;
|
||||
this.container = null;
|
||||
this.action_select_event = options.action_select_event;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace _dali.widgets.mode_switcher
|
|||
|
||||
/**
|
||||
*/
|
||||
export class class_widget_mode_switcher extends _dali.class_widget
|
||||
export class class_widget_mode_switcher implements lib_plankton.zoo_widget.interface_widget
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -47,7 +47,6 @@ namespace _dali.widgets.mode_switcher
|
|||
}
|
||||
)
|
||||
{
|
||||
super();
|
||||
this.options = options;
|
||||
this.initial_selection = initial_selection;
|
||||
this.action_change = action_change;
|
||||
|
|
|
|||
|
|
@ -13,58 +13,234 @@ namespace _dali.widgets.sources
|
|||
|
||||
/**
|
||||
*/
|
||||
export class class_widget_sources extends _dali.class_widget
|
||||
export class class_widget_sources implements lib_plankton.zoo_widget.interface_widget
|
||||
{
|
||||
|
||||
/**
|
||||
* [dependency]
|
||||
*/
|
||||
private keys : Array<string>;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
private data : Record<string, type_entry>;
|
||||
private get_entries : (() => Promise<Array<type_entry>>);
|
||||
|
||||
|
||||
/**
|
||||
* [hook]
|
||||
*/
|
||||
private action_open : ((entry : type_entry) => void);
|
||||
|
||||
|
||||
/**
|
||||
* [hook]
|
||||
*/
|
||||
private action_toggle_visibility : ((entry : type_entry) => void);
|
||||
|
||||
|
||||
/**
|
||||
* [hook]
|
||||
*/
|
||||
private action_create : (() => void);
|
||||
|
||||
|
||||
/**
|
||||
* [state]
|
||||
*/
|
||||
private container : (null | Element);
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public constructor(
|
||||
entries : Array<type_entry>,
|
||||
options : {
|
||||
get_entries : (() => Promise<Array<type_entry>>),
|
||||
{
|
||||
"action_open": action_open = ((calendar_id) => {}),
|
||||
"action_toggle_visibility": action_toggle_visibility = ((calendar_id) => {}),
|
||||
"action_create": action_create = (() => {}),
|
||||
}
|
||||
:
|
||||
{
|
||||
action_open ?: ((entry : type_entry) => void);
|
||||
action_toggle_visibility ?: ((entry : type_entry) => void);
|
||||
} = {}
|
||||
action_create ?: (() => void);
|
||||
}
|
||||
=
|
||||
{
|
||||
}
|
||||
)
|
||||
{
|
||||
options = Object.assign(
|
||||
{
|
||||
"action_open": (calendar_id) => {},
|
||||
"action_toggle_visibility": (calendar_id) => {},
|
||||
},
|
||||
options
|
||||
// dependencies
|
||||
this.get_entries = get_entries;
|
||||
|
||||
// hooks
|
||||
this.action_open = action_open;
|
||||
this.action_toggle_visibility = action_toggle_visibility;
|
||||
this.action_create = action_create;
|
||||
|
||||
// state
|
||||
this.container = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
private static id_encode(
|
||||
id : _dali.type.calendar_id
|
||||
)
|
||||
: string
|
||||
{
|
||||
return id.toFixed(0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
private static id_decode(
|
||||
representation : string
|
||||
)
|
||||
: _dali.type.calendar_id
|
||||
{
|
||||
return parseInt(representation);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public async update(
|
||||
)
|
||||
: Promise<void>
|
||||
{
|
||||
const data : lib_plankton.map.type_map<_dali.type.calendar_id, type_entry> = lib_plankton.map.hashmap.implementation_map(
|
||||
lib_plankton.map.hashmap.make(
|
||||
calendar_id => class_widget_sources.id_encode(calendar_id),
|
||||
{
|
||||
"pairs": (
|
||||
(await this.get_entries())
|
||||
.map(
|
||||
entry => ({
|
||||
"key": entry.id,
|
||||
"value": entry,
|
||||
})
|
||||
)
|
||||
),
|
||||
}
|
||||
)
|
||||
);
|
||||
super();
|
||||
this.keys = [];
|
||||
this.data = {};
|
||||
entries.forEach(
|
||||
(entry) => {
|
||||
const key : string = entry.id.toFixed(0);
|
||||
this.keys.push(key);
|
||||
this.data[key] = entry;
|
||||
}
|
||||
);
|
||||
this.action_open = options.action_open;
|
||||
this.action_toggle_visibility = options.action_toggle_visibility;
|
||||
// structure
|
||||
{
|
||||
this.container.innerHTML = await _dali.helpers.template_coin(
|
||||
"widget-sources",
|
||||
"main",
|
||||
{
|
||||
"label_create": lib_plankton.translate.get("widget.sources.create"),
|
||||
"entries": (
|
||||
(
|
||||
await _dali.helpers.promise_row<string>(
|
||||
lib_plankton.map.dump(data)
|
||||
.map(
|
||||
(pair) => () => {
|
||||
return _dali.helpers.template_coin(
|
||||
"widget-sources",
|
||||
"entry",
|
||||
{
|
||||
"name": pair.value.name,
|
||||
"label_toggle": lib_plankton.string.coin(
|
||||
"{{show}}/{{hide}}",
|
||||
{
|
||||
"show": lib_plankton.translate.get("common.show"),
|
||||
"hide": lib_plankton.translate.get("common.hide"),
|
||||
}
|
||||
),
|
||||
"label_edit": lib_plankton.translate.get("common.edit"),
|
||||
// "access_level": entry.access_level, // TODO
|
||||
// TODO centralize
|
||||
"color_head": lib_plankton.color.output_hex(
|
||||
lib_plankton.color.make_hsv(
|
||||
{
|
||||
"hue": pair.value.hue,
|
||||
/**
|
||||
* @todo const and outsource
|
||||
*/
|
||||
"saturation": 0.375,
|
||||
/**
|
||||
* @todo const and outsource
|
||||
*/
|
||||
"value": 0.375,
|
||||
}
|
||||
),
|
||||
),
|
||||
"color_body": lib_plankton.color.output_hex(
|
||||
lib_plankton.color.make_hsv(
|
||||
{
|
||||
"hue": pair.value.hue,
|
||||
/**
|
||||
* @todo const and outsource
|
||||
*/
|
||||
"saturation": 0.375,
|
||||
/**
|
||||
* @todo const and outsource
|
||||
*/
|
||||
"value": 0.25,
|
||||
}
|
||||
),
|
||||
),
|
||||
"rel": class_widget_sources.id_encode(pair.key),
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
.join("")
|
||||
),
|
||||
}
|
||||
);
|
||||
}
|
||||
// listeners
|
||||
{
|
||||
this.container.querySelector(".sources-create").addEventListener(
|
||||
"click",
|
||||
(event) => {
|
||||
event.preventDefault();
|
||||
this.action_create();
|
||||
}
|
||||
);
|
||||
this.container.querySelectorAll(".sources-entry-head").forEach(
|
||||
(element) => {
|
||||
element.addEventListener(
|
||||
"click",
|
||||
(event) => {
|
||||
element.parentElement.classList.toggle("sources-entry-open");
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
this.container.querySelectorAll(".sources-entry-toggle").forEach(
|
||||
(element) => {
|
||||
element.addEventListener(
|
||||
"click",
|
||||
() => {
|
||||
const key_encoded : string = element.parentElement.parentElement.parentElement.getAttribute("rel");
|
||||
const calendar_id : _dali.type.calendar_id = class_widget_sources.id_decode(key_encoded);
|
||||
const entry : type_entry = data.get(calendar_id);
|
||||
element.parentElement.parentElement.parentElement.classList.toggle("sources-entry-hidden");
|
||||
element.parentElement.parentElement.parentElement.classList.toggle("sources-entry-open", false);
|
||||
this.action_toggle_visibility(entry);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
this.container.querySelectorAll(".sources-entry-edit").forEach(
|
||||
(element) => {
|
||||
element.addEventListener(
|
||||
"click",
|
||||
(event) => {
|
||||
const key_encoded : string = element.parentElement.parentElement.parentElement.getAttribute("rel");
|
||||
const calendar_id : _dali.type.calendar_id = class_widget_sources.id_decode(key_encoded);
|
||||
const entry : type_entry = data.get(calendar_id);
|
||||
this.action_open(entry);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -73,100 +249,11 @@ namespace _dali.widgets.sources
|
|||
*/
|
||||
public async load(
|
||||
target_element : Element
|
||||
) : Promise<void>
|
||||
)
|
||||
: Promise<void>
|
||||
{
|
||||
target_element.innerHTML = await _dali.helpers.template_coin(
|
||||
"widget-sources",
|
||||
"main",
|
||||
{
|
||||
"entries": (
|
||||
(
|
||||
await _dali.helpers.promise_row<string>(
|
||||
this.keys
|
||||
.map(
|
||||
(key) => () => {
|
||||
const entry : type_entry = this.data[key];
|
||||
return _dali.helpers.template_coin(
|
||||
"widget-sources",
|
||||
"entry",
|
||||
{
|
||||
"name": entry.name,
|
||||
"label_toggle": lib_plankton.string.coin(
|
||||
"{{show}}/{{hide}}",
|
||||
{
|
||||
"show": lib_plankton.translate.get("common.show"),
|
||||
"hide": lib_plankton.translate.get("common.hide"),
|
||||
}
|
||||
),
|
||||
"label_edit": lib_plankton.translate.get("common.edit"),
|
||||
// "access_level": entry.access_level, // TODO
|
||||
// TODO centralize
|
||||
"color_head": lib_plankton.color.output_hex(
|
||||
lib_plankton.color.make_hsv(
|
||||
{
|
||||
"hue": entry.hue,
|
||||
"saturation": 0.375,
|
||||
"value": 0.375,
|
||||
}
|
||||
),
|
||||
),
|
||||
"color_body": lib_plankton.color.output_hex(
|
||||
lib_plankton.color.make_hsv(
|
||||
{
|
||||
"hue": entry.hue,
|
||||
"saturation": 0.375,
|
||||
"value": 0.25,
|
||||
}
|
||||
),
|
||||
),
|
||||
"rel": key,
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
.join("")
|
||||
),
|
||||
}
|
||||
);
|
||||
target_element.querySelectorAll(".sources-entry-head").forEach(
|
||||
(element) => {
|
||||
element.addEventListener(
|
||||
"click",
|
||||
(event) => {
|
||||
element.parentElement.classList.toggle("sources-entry-open");
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
target_element.querySelectorAll(".sources-entry-toggle").forEach(
|
||||
(element) => {
|
||||
element.addEventListener(
|
||||
"click",
|
||||
() => {
|
||||
const key : string = element.parentElement.parentElement.parentElement.getAttribute("rel");
|
||||
const entry : type_entry = this.data[key];
|
||||
element.parentElement.parentElement.parentElement.classList.toggle("sources-entry-hidden");
|
||||
element.parentElement.parentElement.parentElement.classList.toggle("sources-entry-open", false);
|
||||
this.action_toggle_visibility(entry);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
target_element.querySelectorAll(".sources-entry-edit").forEach(
|
||||
(element) => {
|
||||
element.addEventListener(
|
||||
"click",
|
||||
(event) => {
|
||||
const key : string = element.parentElement.parentElement.parentElement.getAttribute("rel");
|
||||
const entry : type_entry = this.data[key];
|
||||
this.action_open(entry);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
return Promise.resolve<void>(undefined);
|
||||
this.container = target_element;
|
||||
await this.update();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
<ul class="sources">
|
||||
{{entries}}
|
||||
</ul>
|
||||
<div class="sources">
|
||||
<ul class="sources-entries">
|
||||
{{entries}}
|
||||
</ul>
|
||||
<a class="sources-create" href="">{{label_create}}</a>
|
||||
</div>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -12,7 +12,6 @@
|
|||
<span>{{label_control_count}}</span>
|
||||
<input type="number"/>
|
||||
</label>
|
||||
<input type="submit" class="weekview-control weekview-control-apply" value="{{label_control_apply}}"/>
|
||||
</div>
|
||||
<div class="weekview-table">
|
||||
<table>
|
||||
|
|
|
|||
|
|
@ -36,11 +36,9 @@ templates: \
|
|||
templates-widgets-listview \
|
||||
templates-widgets-weekview \
|
||||
templates-widgets-mode_switcher \
|
||||
templates-widgets-calendar_edit \
|
||||
templates-widgets-event_edit \
|
||||
templates-pages-caldav \
|
||||
templates-pages-calendar_add \
|
||||
templates-pages-calendar_edit \
|
||||
templates-pages-event_add \
|
||||
templates-pages-event_edit \
|
||||
templates-pages-overview \
|
||||
templates-pages-login
|
||||
|
||||
|
|
@ -72,6 +70,20 @@ templates-widgets-mode_switcher: \
|
|||
@ ${cmd_mkdir} ${dir_build}/templates/widget-mode_switcher
|
||||
@ ${cmd_cp} -r -u -v ${dir_source}/widgets/mode_switcher/templates/* ${dir_build}/templates/widget-mode_switcher/
|
||||
|
||||
.PHONY: templates-widgets-calendar_edit
|
||||
templates-widgets-calendar_edit: \
|
||||
$(wildcard ${dir_source}/widgets/calendar_edit/templates/*)
|
||||
@ ${cmd_log} "templates:widgets:calendar_edit …"
|
||||
@ ${cmd_mkdir} ${dir_build}/templates/widget-calendar_edit
|
||||
# @ ${cmd_cp} -r -u -v ${dir_source}/widgets/calendar_edit/templates/* ${dir_build}/templates/widget-calendar_edit/
|
||||
|
||||
.PHONY: templates-widgets-event_edit
|
||||
templates-widgets-event_edit: \
|
||||
$(wildcard ${dir_source}/pages/event_edit/templates/*)
|
||||
@ ${cmd_log} "templates:widgets:event_edit …"
|
||||
@ ${cmd_mkdir} ${dir_build}/templates/widget-event_edit
|
||||
# @ ${cmd_cp} -r -u -v ${dir_source}/pages/event_edit/templates/* ${dir_build}/templates/widget-uevent_edit/
|
||||
|
||||
.PHONY: templates-pages-caldav
|
||||
templates-pages-caldav: \
|
||||
$(wildcard ${dir_source}/pages/caldav/templates/*)
|
||||
|
|
@ -79,34 +91,6 @@ templates-pages-caldav: \
|
|||
@ ${cmd_mkdir} ${dir_build}/templates/caldav
|
||||
@ ${cmd_cp} -r -u -v ${dir_source}/pages/caldav/templates/* ${dir_build}/templates/caldav/
|
||||
|
||||
.PHONY: templates-pages-calendar_add
|
||||
templates-pages-calendar_add: \
|
||||
$(wildcard ${dir_source}/pages/calendar_add/templates/*)
|
||||
@ ${cmd_log} "templates:calendar_add …"
|
||||
@ ${cmd_mkdir} ${dir_build}/templates/calendar_add
|
||||
@ ${cmd_cp} -r -u -v ${dir_source}/pages/calendar_add/templates/* ${dir_build}/templates/calendar_add/
|
||||
|
||||
.PHONY: templates-pages-calendar_edit
|
||||
templates-pages-calendar_edit: \
|
||||
$(wildcard ${dir_source}/pages/calendar_edit/templates/*)
|
||||
@ ${cmd_log} "templates:calendar_edit …"
|
||||
@ ${cmd_mkdir} ${dir_build}/templates/calendar_edit
|
||||
@ ${cmd_cp} -r -u -v ${dir_source}/pages/calendar_edit/templates/* ${dir_build}/templates/calendar_edit/
|
||||
|
||||
.PHONY: templates-pages-event_add
|
||||
templates-pages-event_add: \
|
||||
$(wildcard ${dir_source}/pages/event_add/templates/*)
|
||||
@ ${cmd_log} "templates:event_add …"
|
||||
@ ${cmd_mkdir} ${dir_build}/templates/event_add
|
||||
@ ${cmd_cp} -r -u -v ${dir_source}/pages/event_add/templates/* ${dir_build}/templates/event_add/
|
||||
|
||||
.PHONY: templates-pages-event_edit
|
||||
templates-pages-event_edit: \
|
||||
$(wildcard ${dir_source}/pages/event_edit/templates/*)
|
||||
@ ${cmd_log} "templates:event_edit …"
|
||||
@ ${cmd_mkdir} ${dir_build}/templates/event_edit
|
||||
@ ${cmd_cp} -r -u -v ${dir_source}/pages/event_edit/templates/* ${dir_build}/templates/event_edit/
|
||||
|
||||
.PHONY: templates-pages-overview
|
||||
templates-pages-overview: \
|
||||
$(wildcard ${dir_source}/pages/overview/templates/*)
|
||||
|
|
@ -134,23 +118,22 @@ logic: ${dir_build}/logic.js
|
|||
${dir_temp}/logic-unlinked.js: \
|
||||
${dir_lib}/plankton/plankton.d.ts \
|
||||
${dir_source}/base/helpers.ts \
|
||||
${dir_source}/base/widget.ts \
|
||||
${dir_source}/base/types.ts \
|
||||
${dir_source}/base/functions.ts \
|
||||
${dir_source}/base/model.ts \
|
||||
${dir_source}/resources/conf.ts \
|
||||
${dir_source}/resources/backend.ts \
|
||||
${dir_source}/widgets/sources/logic.ts \
|
||||
${dir_source}/widgets/listview/logic.ts \
|
||||
${dir_source}/widgets/weekview/logic.ts \
|
||||
${dir_source}/widgets/mode_switcher/logic.ts \
|
||||
${dir_source}/widgets/calendar_edit/logic.ts \
|
||||
${dir_source}/widgets/event_edit/logic.ts \
|
||||
${dir_source}/overlay.ts \
|
||||
${dir_source}/pages/login/logic.ts \
|
||||
${dir_source}/pages/logout/logic.ts \
|
||||
${dir_source}/pages/caldav/logic.ts \
|
||||
${dir_source}/pages/oidc_finish/logic.ts \
|
||||
${dir_source}/pages/calendar_add/logic.ts \
|
||||
${dir_source}/pages/calendar_edit/logic.ts \
|
||||
${dir_source}/pages/event_add/logic.ts \
|
||||
${dir_source}/pages/event_edit/logic.ts \
|
||||
${dir_source}/pages/overview/logic.ts \
|
||||
${dir_source}/main.ts
|
||||
@ ${cmd_log} "logic | compile …"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ modules="${modules} json"
|
|||
modules="${modules} string"
|
||||
modules="${modules} random"
|
||||
modules="${modules} map"
|
||||
modules="${modules} cache"
|
||||
modules="${modules} color"
|
||||
# modules="${modules} xml"
|
||||
modules="${modules} map"
|
||||
|
|
@ -23,6 +24,7 @@ modules="${modules} url"
|
|||
modules="${modules} pit"
|
||||
modules="${modules} www_form"
|
||||
modules="${modules} translate"
|
||||
modules="${modules} zoo-widget"
|
||||
modules="${modules} zoo-page"
|
||||
modules="${modules} zoo-form"
|
||||
modules="${modules} zoo-input"
|
||||
|
|
|
|||
Loading…
Reference in a new issue