Changes for page Home

Last modified by Benjamin Fischer on 2025/07/11 17:00

From version 114.2
edited by Benjamin Fischer
on 2025/07/11 17:00
Change comment: disable debugger
To version 112.4
edited by Benjamin Fischer
on 2025/05/15 13:12
Change comment: There is no comment for this version

Summary

Details

BMFTR_en_DTP_CMYK_gef_durch.jpg
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.fischer
Size
... ... @@ -1,1 +1,0 @@
1 -69.6 KB
Content
Logos Wiki.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.JudithSteinfeld
Size
... ... @@ -1,0 +1,1 @@
1 +3.7 KB
Content
XWiki.JavaScriptExtension[0]
Code
... ... @@ -10,6 +10,8 @@
10 10   FC.defineView('monthCols', {
11 11   class: FC.View.extend({
12 12   renderEvents(events) {
13 + console.debug("renderEvents", events);
14 + debugger;
13 13   try {
14 14   this._renderFun(events);
15 15   } catch (e) {
... ... @@ -25,7 +25,7 @@
25 25  
26 26   const ys = this.start;
27 27   const ye = this.end;
28 - const yv = events.slice().sort((a, b) => a.start.diff(b.start) || a.end.diff(b.end));
30 + const yv = events.slice().sort((a,b) => a.start.diff(b.start) || a.end.diff(b.end));
29 29  
30 30   const cols = [];
31 31   const head = [];
... ... @@ -32,21 +32,21 @@
32 32   const days = Array(31).fill().map(_ => []);
33 33  
34 34   if (rf) {
35 - cols.push(E("col", { class: "fc-fitCol" }));
37 + cols.push(E("col", {class: "fc-fitCol"}));
36 36   head.push(E("th"));
37 - days.forEach((arr, day) => arr.push(E("th", { class: "fc-axis" }, ys.clone().add({ day }).format(rf))));
39 + days.forEach((arr, day) => arr.push(E("th", {class: "fc-axis"}, ys.clone().add({day}).format(rf))));
38 38   }
39 39  
40 40   for (const month of range(12)) {
41 - const ms = ys.clone().add({ month })
42 - const me = ms.clone().add({ month: 1 });
43 + const ms = ys.clone().add({month})
44 + const me = ms.clone().add({month: 1});
43 43   const md = me.diff(ms, "days");
44 44   const mv = yv.filter(t => ms.isBefore(t.end) && t.start.isBefore(me));
45 45  
46 - if (df) cols.push(E("col", { class: "fc-fitCol" }));
48 + if (df) cols.push(E("col", {class: "fc-fitCol"}));
47 47   cols.push(E("col"));
48 - if (wf) cols.push(E("col", { class: "fc-fitCol" }));
49 - head.push(E("th", { colspan }, ms.format(cf)));
50 + if (wf) cols.push(E("col", {class: "fc-fitCol"}));
51 + head.push(E("th", {colspan}, ms.format(cf)));
50 50  
51 51   const bgc = new Array(md);
52 52   const bgt = new Array(md);
... ... @@ -60,11 +60,11 @@
60 60  
61 61   for (const day of range(31)) {
62 62   if (day < md) {
63 - const ds = ms.clone().add({ day });
64 - const de = ds.clone().add({ day: 1 });
65 + const ds = ms.clone().add({day});
66 + const de = ds.clone().add({day: 1});
65 65  
66 66   const oc = [];
67 - while (mv[0]?.start.isBefore(de)) {
69 + while(mv[0]?.start.isBefore(de)) {
68 68   const v = mv.shift();
69 69   const d = Math.ceil(v.end.max(me).diff(ds, "days", true));
70 70   if (v.rendering == "background") {
... ... @@ -74,7 +74,7 @@
74 74   bgt[day + i] = v.title;
75 75   }
76 76   } else {
77 - const e = E("div", E("a", { href: v.url }, v.title));
79 + const e = E("div", E("a", {href: v.url}, v.title));
78 78   e.style.height = `${100 * d}%`;
79 79   if (v.color) e.style.borderColor = e.style.backgroundColor = v.color;
80 80   if (v.textColor) e.style.color = v.textColor;
... ... @@ -95,16 +95,16 @@
95 95   }
96 96  
97 97   scu = scu.map(u => Math.max(0, u - 1));
98 - if (!scu.some()) { scc = []; scu = []; }
100 + if (!scu.some()) {scc = []; scu = [];}
99 99  
100 100   const style = bgc[day] && `background-color: ${bgc[day]};`;
101 101   const dc = this.getDayClasses(ds);
102 - const da = (sub, title = bgt[day] ?? null) => ({ class: dc.concat(sub).join(" "), style, title });
104 + const da = (sub, title = bgt[day] ?? null) => ({class: dc.concat(sub).join(" "), style, title});
103 103   if (df) days[day].push(E("td", da("fc-dayVal", ds.format("D")), ds.format(df)));
104 104   days[day].push(E("td", da("fc-mainVal"), oc));
105 105   if (wf) days[day].push(E("td", da("fc-weekVal"), ds.weekday() ? "" : ds.format(wf)));
106 106   } else
107 - days[day].push(E("td", { colspan }));
109 + days[day].push(E("td", {colspan}));
108 108   }
109 109   }
110 110  
... ... @@ -113,8 +113,8 @@
113 113   E(
114 114   "table",
115 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))),
118 + E("thead", {class: "fc-head"}, E("tr", head)),
119 + E("tbody", {class: "fc-body"}, days.map(d => E("tr", d))),
118 118   )
119 119   );
120 120   }
... ... @@ -123,54 +123,52 @@
123 123   });
124 124  
125 125   const init = () => {
126 - const cal = jq("#calendarCustom");
127 - if (cal.length)
128 - cal.fullCalendar({
129 - views: {
130 - month: {
131 - columnFormat: "ddd",
132 - titleFormat: "MMMM YYYY",
133 - buttonText: "month",
134 - },
135 - monthCols: {
136 - columnFormat: "MMM",
137 - weekFormat: "W",
138 - titleFormat: "YYYY",
139 - buttonText: "year",
140 - },
128 + jq("#calendarCustom").fullCalendar({
129 + views: {
130 + month: {
131 + columnFormat: "ddd",
132 + titleFormat: "MMMM YYYY",
133 + buttonText: "month",
141 141   },
142 - timeFormat: "h(:mm)t",
143 - axisFormat: "h(:mm)t",
144 - allDayText: "All day",
145 - eventSources: [
146 - "/bin/get/MoccaCalendar/Code/JSONService?xpage=plain&outputSyntax=plain&calendarDoc=Main.WebHome&filter=wiki&classname=MoccaCalendar.MoccaCalendarEventClass&startfield=startDate&endfield=endDate&durationfield=&xpage=plain&outputSyntax=plain&classname=&startfield=datetime&endfield=&durationfield=&extraFields=",
147 - ],
148 - header: {
149 - left: "prev,next today",
150 - center: "title",
151 - right: "month,monthCols",
135 + monthCols: {
136 + columnFormat: "MMM",
137 + weekFormat: "W",
138 + titleFormat: "YYYY",
139 + buttonText: "year",
152 152   },
153 - timeFormat: "H:mm",
154 - defaultView: "monthCols",
155 - firstDay: "1",
156 - minTime: "8:00",
157 - maxTime: "23:00",
158 - validRange: {
159 - start: '2022-01-01',
160 - end: '2027-01-01',
161 - },
162 - editable: false,
163 - eventDataTransform: event => {
164 - const cal = event.url.split("/")[4];
165 - if (cal === "Holidays" || cal == "Blocked" || cal.includes("Conference")) event.rendering = "background";
166 - event.viewUrl = event.url;
167 - event.url = event.html.match(/<span class="wikiexternallink"><a href="([^"]+)">\1</)?.[1] ?? event.url;
168 - return event;
169 - },
170 - eventRender: function (event, element) {
171 - // Render augmentation hook, use: event.html
172 - },
173 - });
141 + },
142 + timeFormat: "h(:mm)t",
143 + axisFormat: "h(:mm)t",
144 + allDayText: "All day",
145 + eventSources: [
146 + "/bin/get/MoccaCalendar/Code/JSONService?xpage=plain&outputSyntax=plain&calendarDoc=Main.WebHome&filter=wiki&classname=MoccaCalendar.MoccaCalendarEventClass&startfield=startDate&endfield=endDate&durationfield=&xpage=plain&outputSyntax=plain&classname=&startfield=datetime&endfield=&durationfield=&extraFields=",
147 + ],
148 + header: {
149 + left: "prev,next today",
150 + center: "title",
151 + right: "month,monthCols",
152 + },
153 + timeFormat: "H:mm",
154 + defaultView: "monthCols",
155 + firstDay: "1",
156 + minTime: "8:00",
157 + maxTime: "23:00",
158 + validRange: {
159 + start: '2022-01-01',
160 + end: '2027-01-01',
161 + },
162 + editable: false,
163 + eventDataTransform: event => {
164 + const cal = event.url.split("/")[4];
165 + if (cal === "Holidays" || cal == "Blocked" || cal.includes("Conference")) event.rendering = "background";
166 + event.viewUrl = event.url;
167 + event.url = event.html.match(/<span class="wikiexternallink"><a href="([^"]+)">\1</)?.[1] ?? event.url;
168 + return event;
169 + },
170 + eventRender: function (event, element) {
171 + // Render augmentation hook, use: event.html
172 + },
173 + });
174 174   };
175 175  
176 176   jq(document).ready(init);
Use this extension
... ... @@ -1,1 +1,1 @@
1 -currentPage
1 +onDemand
XWiki.JavaScriptExtension[1]
Caching policy
... ... @@ -1,0 +1,1 @@
1 +default
Code
... ... @@ -1,0 +1,79 @@
1 +define("xwiki-custom-livetable", [], function () {
2 + const func = (tabName, rowFunc, colTT = {}) => {
3 + let tagCols;
4 +
5 + document.observe('xwiki:livetable:loading', () => {
6 + const tab = document.getElementById(tabName);
7 + if (!tab) return;
8 +
9 + // coulmn data sources
10 + const conf = JSON.parse(tab.dataset.settings);
11 + tagCols = (conf.columnDescriptors.tags ?? { aux: [] }).aux ?? [["Tags", true]];
12 + tagCols.forEach(([name], i) => {
13 + const cn = `tags-${i}`;
14 + conf.columns.splice(conf.columns.indexOf("tags"), 1, cn);
15 + conf.columnDescriptors[cn] = {
16 + displayName: name,
17 + headerClass: "tagsCol",
18 + html: true,
19 + sortable: false,
20 + };
21 + });
22 + tab.dataset.settings = JSON.stringify(conf);
23 +
24 + // column headers
25 + tab.querySelectorAll(".xwiki-livetable-display-header .tagsCol").forEach(
26 + (v, i) => v.textContent = tagCols[i][0]
27 + );
28 +
29 + // column tooltips
30 + tab.querySelectorAll(".xwiki-livetable-display-header-text").forEach(
31 + el => {
32 + const t = el.textContent.trim();
33 + const c = conf.columnDescriptors[t].tooltip ?? colTT[t];
34 + if (c) {
35 + el.title = t;
36 + el.dataset.content = c;
37 + el.dataset.toggle = "popover";
38 + el.dataset.placement = "top";
39 + }
40 + }
41 + )
42 +
43 + // handle clicks for tags
44 + document.getElementById(`${tabName}-display`).addEventListener("click", ev => {
45 + if (ev.button) return; // only left click
46 + if (ev.target.nodeName !== "SPAN") return;
47 + if (!ev.target.classList.contains("ltTag")) return;
48 + const tag = ev.target.textContent;
49 + ev.preventDefault();
50 + const lt = tab.__liveTable;
51 + const st = lt.tagCloud.selectedTags;
52 + if (tag in st) delete st[tag];
53 + else st[tag] = {};
54 + lt.tags = Object.keys(st);
55 + lt.clearCache();
56 + lt.showRows(1, lt.limit);
57 + })
58 + });
59 +
60 + document.observe(`xwiki:livetable:${tabName}:receivedEntries`, ({ memo: { data } }) => {
61 + for (const row of data.rows) {
62 + if (rowFunc) rowFunc(row)
63 +
64 + // tags
65 + const tags = new Set(row.tags_value.slice(1, -1).split(", "));
66 + tagCols.forEach(([name, ...want], i) =>
67 + row[`tags-${i}`] = (
68 + want[0] === true
69 + ? Array.from(tags)
70 + : want.filter(tag => tags.delete(tag))
71 + ).sort().map(tag => `<span class="ltTag" style="cursor:pointer;">${tag}</span>`).join(", ")
72 + );
73 + }
74 + });
75 + };
76 +
77 + func.func = func;
78 + return func;
79 +});
Name
... ... @@ -1,0 +1,1 @@
1 +Livetable - Common Stuff
Parse content
... ... @@ -1,0 +1,1 @@
1 +No
Use this extension
... ... @@ -1,0 +1,1 @@
1 +always