Changes for page Home

Last modified by Benjamin Fischer on 2025/06/04 14:20

From version 73.14
edited by Benjamin Fischer
on 2024/11/08 10:38
Change comment: There is no comment for this version
To version 72.43
edited by Benjamin Fischer
on 2024/11/06 15:55
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,6 +1,6 @@
1 1  {{box cssClass="floatinginfobox" image="https://wiki.test.erumdatahub.de/bin/download/Main/WebHome/logo_horizontal_23_neu.png?width=200"}}
2 2  {{displayIcon name="application_view_tile"/}} [[Indico>>https://indico.desy.de/category/984/]]
3 -{{displayIcon name="email"/}} [[Mailing Lists>>https://wiki.erumdatahub.de/de/mailing-lists]]
3 +{{displayIcon name="email"/}} [[Mailing Lists]]
4 4  {{displayIcon name="world"/}} [[Website>>https://erumdatahub.de/]]
5 5  {{/box}}
6 6  
XWiki.JavaScriptExtension[0]
Code
... ... @@ -3,121 +3,36 @@
3 3   const E = (tag, ...childs) => {
4 4   const attrs = childs[0]?.constructor === Object ? childs.shift() : {};
5 5   const ret = Element(tag, attrs);
6 - ret.append(...childs.flat().filter(e => e));
6 + ret.append(...childs.flat());
7 7   return ret;
8 8   };
9 - const range = num => Array(num).fill().map((_, i) => i);
10 10   FC.defineView('monthCols', {
11 11   class: FC.View.extend({
12 - renderEvents(events) {
13 - console.debug("renderEvents", events);
14 - debugger;
15 - try {
16 - this._renderFun(events);
17 - } catch (e) {
18 - console.exception(e);
19 - }
20 - },
21 - _renderFun(events) {
22 - const cf = this.opt("columnFormat") ?? "MMM";
23 - const rf = this.opt("rowFormat") ?? "D";
24 - const df = this.opt("cellFormat") ?? "dd";
25 - const wf = this.opt("weekFormat") ?? "w";
26 - const colspan = (df || wf) ? (1 + !!df + !!wf) : null;
11 + render() {
12 + const chf = this.opt("columnFormat") ?? "MMM";
13 + const start = this.start ?? FC.moment({year: FC.moment().year()});
14 + const months = Array(12).fill().map((_, month) => start.clone().add({month}));
27 27  
28 - const ys = this.start;
29 - const ye = this.end;
30 - const yv = events.slice().sort((a,b) => a.start.diff(b.start) || a.end.diff(b.end));
31 -
32 - const cols = [];
33 - const head = [];
34 - const days = Array(31).fill().map(_ => []);
35 -
36 - if (rf) {
37 - cols.push(E("col", {class: "fc-fitCol"}));
38 - head.push(E("th"));
39 - days.forEach((arr, day) => arr.push(E("th", {class: "fc-axis"}, ys.clone().add({day}).format(rf))));
40 - }
41 -
42 - for (const month of range(12)) {
43 - const ms = ys.clone().add({month})
44 - const me = ms.clone().add({month: 1});
45 - const md = me.diff(ms, "days");
46 - const mv = yv.filter(t => ms.isBefore(t.end) && t.start.isBefore(me));
47 -
48 - if (df) cols.push(E("col", {class: "fc-fitCol fc-fade fc-borderLeft"}));
49 - cols.push(E("col", {class: df ? null : "fc-borderLeft"}));
50 - if (wf) cols.push(E("col", {class: "fc-fitCol fc-fade"}));
51 - head.push(E("th", {colspan}, ms.format(cf)));
52 -
53 - const bgc = new Array(md);
54 - let scc = [];
55 - let scu = [];
56 - const scs = col => el => {
57 - const step = 100 / scc.length;
58 - el.style.left = `${col * step}%`;
59 - el.style.width = `${step}%`;
60 - };
61 -
62 - for (const day of range(31)) {
63 - if (day < md) {
64 - const ds = ms.clone().add({day});
65 - const de = ds.clone().add({day: 1});
66 -
67 - const oc = [];
68 - while(mv[0]?.start.isBefore(de)) {
69 - const v = mv.shift();
70 - const d = Math.ceil(v.end.max(me).diff(ds, "days", true));
71 - if (v.rendering == "background") {
72 - if (v.color)
73 - for (const i of range(d))
74 - bgc[day + i] = v.color;
75 - } else {
76 - const href = v.html.match(/<span class="wikiexternallink"><a href="([^"]+)">\1</)?.[1] ?? v.url;
77 - const e = E("div", E("a", {href}, v.title));
78 - e.style.height = `${100 * d}%`;
79 - if (v.color) e.style.borderColor = e.style.backgroundColor = v.color;
80 - if (v.textColor) e.style.color = v.textColor;
81 - if (v.start.isBefore(ms)) e.classList.add("fc-cut-start");
82 - if (me.isBefore(v.end)) e.classList.add("fc-cut-end");
83 - oc.push(e);
84 - const i = scu.indexOf(0);
85 - if (i < 0) {
86 - scc.push([e]);
87 - scu.push(d);
88 - scc.forEach((els, col) => els.forEach(scs(col)));
89 - } else {
90 - scc[i].push(e);
91 - scu[i] = d;
92 - scs(i)(e);
93 - }
94 - }
95 - }
96 -
97 - scu = scu.map(u => Math.max(0, u - 1));
98 - if (!scu.some()) {scc = []; scu = [];}
99 -
100 - const style = bgc[day] && `background-color: ${bgc[day]};`;
101 - const dc = this.getDayClasses(ds);
102 - const da = sub => ({class: dc.concat(sub).join(" "), style});
103 - if (df) days[day].push(E("td", da("fc-dayVal"), ds.format(df)));
104 - days[day].push(E("td", da("fc-mainVal"), oc));
105 - if (wf) days[day].push(E("td", da("fc-weekVal"), ds.weekday() ? "" : ds.format(wf)));
106 - } else
107 - days[day].push(E("td", {colspan}));
108 - }
109 - }
110 -
111 -
112 112   this.el.addClass("fc-month-cols-view").html(
113 113   E(
114 114   "table",
115 - E("colgroup", cols),
116 - E("thead", {class: "fc-head"}, E("tr", head)),
117 - E("tbody", {class: "fc-body"}, days.map(d => E("tr", d))),
19 + E("thead", {class: "fc-head"},
20 + E("tr", E("th"), months.map(m => E("th", m.format(chf))))),
21 + E("tbody", {class: "fc-body"},
22 + Array(31).fill().map((_, day) => E("tr",
23 + E("th", {class: "fc-axis"}, `${day + 1}`),
24 + months.map(m => m.clone().add({day})).map(d =>
25 + d.date() === day + 1
26 + ? E("td", {class: this.getDayClasses(d).join(" ")}, [d.format("dd")])
27 + : E("td")
28 + )))
29 + ),
118 118   )
119 119   );
120 - }
32 + },
33 + renderEvents(ev) {
34 + debugger;
35 + },
121 121   }),
122 122   duration: { year: 1 },
123 123   });
... ... @@ -132,7 +132,6 @@
132 132   },
133 133   monthCols: {
134 134   columnFormat: "MMM",
135 - weekFormat: "W",
136 136   titleFormat: "YYYY",
137 137   buttonText: "year",
138 138   },
... ... @@ -149,7 +149,7 @@
149 149   right: "month,monthCols",
150 150   },
151 151   timeFormat: "H:mm",
152 - defaultView: "monthCols",
66 + defaultView: "month",
153 153   firstDay: "1",
154 154   minTime: "8:00",
155 155   maxTime: "23:00",
XWiki.StyleSheetExtension[0]
Code
... ... @@ -1,70 +1,5 @@
1 -@weekend-color: #f5f5f5;
2 -#calendarCustom.fc {
1 +#calendarCustom {
3 3   td.fc-sat, td.fc-sun {
4 - background-color: @weekend-color;
3 + background-color: #f5f5f5;
5 5   }
6 - .fc-month-cols-view > table {
7 - table-layout: auto;
8 - td, th {
9 - border-width: 0px;
10 - }
11 - col.fc-fitCol {
12 - width: 1px;
13 - }
14 - tbody.fc-body {
15 - td {
16 - background-color: #fff;
17 - &.fc-sat, &.fc-sun {
18 - background-color: @weekend-color;
19 - &.fc-dayVal {
20 - background-color: @weekend-color !important;
21 - }
22 - }
23 - }
24 - tr:nth-child(4n+3) > * {
25 - border-top: 1px solid #ddd;
26 - }
27 - tr:nth-child(4n+5) > * {
28 - border-top: 1px solid #bbb;
29 - }
30 - tr:hover > th {
31 - filter: brightness(0.8);
32 - }
33 - td.fc-mainVal {
34 - position: relative;
35 - & > div {
36 - z-index: 5;
37 - position: absolute;
38 - width: 100%;
39 - overflow: hidden;
40 - border-radius: 4px;
41 - &.fc-cut-start {
42 - border-top-left-radius: 0px;
43 - border-top-right-radius: 0px;
44 - }
45 - &.fc-cut-end {
46 - border-bottom-left-radius: 0px;
47 - border-bottom-right-radius: 0px;
48 - }
49 - &:hover {
50 - width: auto;
51 - max-width: 10vw;
52 - height: auto !important;
53 - z-index: 10;
54 - }
55 - & > a {
56 - display: block;
57 - color: inherit;
58 - background-color: inherit;
59 - }
60 - }
61 - }
62 - td.fc-dayVal, td.fc-weekVal {
63 - color: desaturate(lighten(#1D3B58, 50%), 80%);
64 - }
65 - td.fc-weekVal {
66 - text-align: right;
67 - }
68 - }
69 - }
70 70  }