FCLT#87091 savepoint punt 4

svn path=/Website/trunk/; revision=69271
This commit is contained in:
2025-06-03 20:12:04 +00:00
parent dcbe8b0e26
commit 2a59d2c717
6 changed files with 97 additions and 26 deletions

View File

@@ -20,6 +20,8 @@ function model_fac_nieuws_groep()
this.autfunction = "WEB_MSGBOF";
this.record_name = "messagecategory";
this.records_name = "messagecategories";
this.record_title = L("fac_nieuws_groep");
this.records_title = L("fac_nieuws_groep_m");
this.fields = {
"id": {
"dbs": "fac_nieuws_groep_key",

View File

@@ -33,6 +33,7 @@
<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/iface.inc" -->
<!-- #include file="../Shared/FlexFiles.inc" -->
<!-- #include file="../MSG/msg.inc" -->
<%
FCLTHeader.Requires({ plugins:["jQuery"] });
var pkey = getQParamInt("key", user_key);
@@ -44,6 +45,7 @@ var widget = getQParamInt("asWidget", 0) == 1;
var additionalNews = 0;
var canEdit = user.has("WEB_MSGBOF");
var canReact = user.has("WEB_MSGUSE");
var allowHtml_date = null;
if (S("fac_html_strictness") == 0) // Deprecated, maar nog wel backwards compatible voor oude berichten
@@ -79,6 +81,7 @@ var sqln = "SELECT DISTINCT" // Plaatsgebonden berichten alleen zichtbaar voor m
+ " , fac_nieuws_image"
+ " , fac_nieuws_aanmaak"
+ " , fac_nieuws_show"
+ " , mld_melding_key"
+ " FROM fac_nieuws n"
+ " , prs_v_perslid_fullnames_all pf "
+ " , fac_nieuws_groep ng "
@@ -125,6 +128,7 @@ var sqln = "SELECT DISTINCT" // Plaatsgebonden berichten alleen zichtbaar voor m
+ " , fac_nieuws_image"
+ " , fac_nieuws_aanmaak"
+ " , fac_nieuws_show"
+ " , mld_melding_key"
+ " FROM fac_nieuws n"
+ " , prs_v_perslid_fullnames_all pf"
+ " , fac_nieuws_groep ng "
@@ -176,8 +180,33 @@ var sqln = "SELECT DISTINCT" // Plaatsgebonden berichten alleen zichtbaar voor m
}
FcltMgr.resized();
}
<% if (canReact) { %>
function news_react() {
var react_type = this.dataset.type || "metoo";
let msg_key = this.dataset.key;
let data = {
action: "msg_react",
react_type: react_type,
msg_key: msg_key
};
<% protectRequest.dataToken("data"); %>
$.post("../pda/get_mobile_ajax.asp",
data,
reactCallback,
"json");
}
<% if (canEdit)
function reactCallback(json) {
if (json.success) {
var $this_reaction = $("[data-key=" + json.msg_key + "]");
$this_reaction.get(0).dataset.count = json.msg_count;
$this_reaction.find("i").toggleClass("fal", !json.state)
.toggleClass("far", json.state);
}
}
<% }
if (canEdit)
{ %>
function openItemEditor(key)
{
@@ -198,11 +227,15 @@ var sqln = "SELECT DISTINCT" // Plaatsgebonden berichten alleen zichtbaar voor m
{
meerminderberichten();
$("img").one("load error", function () { FcltMgr.resized(); });
<% if (canReact) { %>
$(".fclt-icon-counter").on("click", news_react);
<% } %>
});
</script>
</head>
<body id="nieuwsbody" class="nieuwsbody<%=showmore==1?"full":""%><%=nieuwsgroep_key>0?" newsgrp"+nieuwsgroep_key:""%>">
<%if(showmore==1) {%>
<%if (showmore == 1) { %>
<h1 class="nieuwstitelbigger"><%=safe.html(L("lcl_mynews"))%></h1>
<%}
%> <div class="nieuwscontainer"><%
@@ -211,7 +244,7 @@ var sqln = "SELECT DISTINCT" // Plaatsgebonden berichten alleen zichtbaar voor m
//S("portalmsgmax") berichten worden eerst getoond, rest van oRs.eof onder meer...
while (!oRs.eof)
{
var clss = "newsgrp" + oRs("fac_nieuws_groep_key").value||"";
var clss = "newsgrp" + (oRs("fac_nieuws_groep_key").Value || "");
if (i >= S("portalmsgmax"))
{ /* adjust initial items count */
@@ -221,12 +254,9 @@ var sqln = "SELECT DISTINCT" // Plaatsgebonden berichten alleen zichtbaar voor m
var safe_oms;
var allowHtml = (allowHtml_date ? (new Date(oRs("fac_nieuws_aanmaak").Value).getTime() < allowHtml_date) : false);
if (allowHtml)
{
if (allowHtml) {
safe_oms = oRs("fac_nieuws_omschrijving").value;
}
else
{
} else {
safe_oms = safe.fclthtml(oRs("fac_nieuws_omschrijving").Value, { "file_params": { "key": oRs("fac_nieuws_key").Value, "module": "MSG" } });
}
var nieuwstitel = safe.html(oRs("fac_nieuws_titel").Value)
@@ -235,6 +265,28 @@ var sqln = "SELECT DISTINCT" // Plaatsgebonden berichten alleen zichtbaar voor m
var nieuwsdetails = "<span class='ngrp'>" + safe.html(oRs("fac_nieuws_groep_omschrijving").Value||"")
+ (nieuwsdatum == "" ? "" : "<span class='ndat'> | " + nieuwsdatum + "</span> | ")
+ "<span class='nusr'>" + safe.html(oRs("prs_perslid_naam_friendly").Value)+"</span>";
var me_too_html = "";
if (
canReact
&& (oRs("fac_nieuws_show").Value & 4)
&& oRs("mld_melding_key").Value > 0
) {
var sql_mld = "SELECT COUNT (*) reactions"
+ " FROM fac_nieuws"
+ " WHERE fac_nieuws_parentkey = " + oRs("fac_nieuws_key").Value
+ " AND mld_melding_key = " + oRs("mld_melding_key").Value;
var oRs_mld = Oracle.Execute(sql_mld);
var reactionCount = oRs_mld("reactions").Value;
oRs_mld.Close();
me_too_html = '<span class="fclt-icon-counter default-clickable-icon"'
+ ' data-key="' + oRs("fac_nieuws_key").Value + '"'
+ ' data-type="metoo"'
+ ' data-count="' + reactionCount + '"'
+ ' title="Ik heb hier ook last van">'
+ I("fa-hand-wave")
+ '</span>';
}
%>
<div id="n<%=i%>" class="<%=clss%>">
<div class="nieuwstitel"><%=nieuwstitel%></div>
@@ -243,6 +295,7 @@ var sqln = "SELECT DISTINCT" // Plaatsgebonden berichten alleen zichtbaar voor m
<div class="nieuwsicon"><%=SYMBOL(oRs("fac_nieuws_image").Value, { "module": "NEWS", "key": oRs("fac_nieuws_key").Value })%></div>
<span class="nieuwstekst"><%=safe_oms%></span>
</div>
<%=me_too_html%>
</div>
<%
i++;

View File

@@ -82,24 +82,12 @@ if (nieuws_key === -1 && mld_key > 0) {
"bericht_categorieen": groups
};
var prompt =
"Het volgende is JSON met 'mld_data' en 'bericht_categorieen'."
+ "Genereer hieruit een portal-nieuwsbericht als JSON met *exact* deze 5 velden:"
+ "{"
+ " onderwerp: max 99 tekens,"
+ " categorie: de key van 1 waarde uit bericht_categorieen,"
+ " icon: een passend font awesome pro classic icoon, bijv. fa-megaphone,"
+ " berichttekst: <1-3 korte alinea's (<28>100-200 woorden), beschrijf wat er speelt, impact en vervolg>,"
+ " periode_tot: <DD-MM-YYYY> - tot deze dag is het bericht zichtbaar. Laat leeg, tenzij je expliciet een betere einddatum weet"
+ "}"
+ "**Output = alleen JSON.**";
var result = shared.promptAI(JSON.stringify(input), { "instructions": prompt, "response_format": "json_object" });
var result = shared.promptAI(JSON.stringify(input), { "instructions": L("lcl_mld_publish_portal_message_instructions"), "response_format": "json_object" });
if (result.success) {
try {
var content = JSON.parse(result.content);
subject = content.onderwerp || null;
fac_nieuws_groep_key = content.onderwerp || null;
fac_nieuws_groep_key = content.categorie || null;
image = content.icon || null;
mess_dsc = content.berichttekst || null;
totdate = (content.periode_tot || null) === null ? null : new Date(content.periode_tot || null);
@@ -252,8 +240,9 @@ SUBFRAME_START();
method="post"
target="hidFrameSubmit"
onSubmit="msg_submit()">
<%
<% if (nieuws_key === -1 && mld_key > 0) {
%> <input type="hidden" name="mld_melding_key" value="<%=mld_key%>"><%
}
BLOCK_START("msgMessage", L("lcl_msg_datum"), {icon: "fa-calendar"});
var group = { name: "nieuws_show", label: L("lcl_msg_nieuws_show"), mask: 3, defaultmask: 3, bits: [] };
group.bits.push({ "mask": 1, "label": L("lcl_msg_nieuws_portal") });

View File

@@ -53,7 +53,8 @@ var JSON_Result = true;
{ dbs: "fac_nieuws_omschrijving", typ: "varchar", frm: "ta_message", len: 4000 },
{ dbs: "fac_nieuws_van", typ: "date", frm: "datefrom" },
{ dbs: "fac_nieuws_tot", typ: "date", frm: "dateto" },
{ dbs: "fac_nieuws_show", typ: "number", val: nieuws_show }
{ dbs: "fac_nieuws_show", typ: "number", val: nieuws_show },
{ dbs: "mld_melding_key", typ: "key", frm: "mld_melding_key" }
];
if (nieuws_show == 4) {
fields.push({ dbs: "fac_nieuws_parentkey", typ: "key", frm: "parent_key" });

View File

@@ -20,10 +20,20 @@ FCLTHeader.Requires({ plugins:["jQuery", "suggest"],
var nieuws_key = getQParamInt("nieuws_key", -1);
var urole = getQParamSafe("urole", ""); // Indien niet meegegeven, veronderstel dan frontend gebruik
var mld_key = getQParamInt("mld_key", -1);
var transitParam = buildTransitParam(["mld_key", "urole"]);
%>
if (nieuws_key === -1 && mld_key > 0) {
var sql = "SELECT 1 FROM fac_nieuws WHERE mld_melding_key = " + mld_key;
var oRs = Oracle.Execute(sql);
if (!oRs.EOF) {
oRs.Close();
abort_with_warning(L("lcl_mld_publish_error_duplicate"));
}
oRs.Close();
}
%>
<html>
<head>
<%

View File

@@ -2489,6 +2489,22 @@ div.wbackground {
padding-bottom: 12px;
line-height: 1.3em;
}
.fclt-icon-counter {
font-size: var(--fclt-font-size-l);
display: inline-flex;
align-items: center;
padding: 0.5em 0.75em;
margin: 10px;
border: var(--fclt-border);
border-radius: 1.5em;
& > i {
margin-right: 0.25em;
}
&::after {
content: attr(data-count);
line-height: 1rem;
}
}
span.nusr { /* RWSN#64739 */
display: none;