Browse Source

Kern: REST-basiertes News-Portlet standardmäßig ausliefern

master
Andre Knieschewski 15 hours ago
parent
commit
e797913b00
  1. 43
      superx/WEB-INF/conf/edustore/db/install/schluesseltabellen/release_unloads/sx_portlet.unl

43
superx/WEB-INF/conf/edustore/db/install/schluesseltabellen/release_unloads/sx_portlet.unl

@ -6,3 +6,46 @@
<li>Eine Datenbankbeschreibung im <a href="http://www.superx-projekt.de/doku/kern_modul/kern.html">html</a>-Format.</li>\ <li>Eine Datenbankbeschreibung im <a href="http://www.superx-projekt.de/doku/kern_modul/kern.html">html</a>-Format.</li>\
</ul>\ </ul>\
</ul>^^all^01.01.1900^01.01.3000^ </ul>^^all^01.01.1900^01.01.3000^
2^SuperX News^HTML^^icon-newspaper^<div id="testportlet">News werden geladen ...</div>\
\
<script>\
(async function () {\
const portlet = document.getElementById('testportlet');\
\
try {\
const response = await fetch(\
'https://superxhosting.de/superx/ds/api/report' +\
'?tid=71920' +\
'&kennung=gast_news' +\
'&login=superx',\
{\
method: 'POST',\
headers: {\
'Accept': 'application/json',\
'Content-Type': 'application/json'\
},\
body: '{}'\
}\
);\
\
if (!response.ok) {\
throw new Error('HTTP ' + response.status);\
}\
\
const result = await response.json();\
\
const content = result.rows?.[0]?.cells?.content;\
\
if (!content) {\
throw new Error('Kein News-Inhalt gefunden');\
}\
\
portlet.innerHTML = content;\
\
} catch (e) {\
console.error(e);\
portlet.textContent =\
'News konnten nicht geladen werden: ' + e.message;\
}\
})();\
</script>^-1000^all^01.01.1900^01.01.3000^

Loading…
Cancel
Save