MNNL#71719 Autorisatiegroep toegevoegd aan widget pagina voor WGTMAN, incl suggest, fac_widget_page.fac_functie_key uitfaseren
svn path=/Website/trunk/; revision=55875
This commit is contained in:
@@ -22,6 +22,7 @@ function model_fac_widget_page()
|
||||
this.record_title = L("fac_widget_page");
|
||||
this.records_title = L("fac_widget_page_m") ;
|
||||
|
||||
var hasPRSSYS = user.has("WEB_PRSSYS");
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "fac_widget_page_key",
|
||||
@@ -45,11 +46,12 @@ function model_fac_widget_page()
|
||||
"foreign": "prs_perslid",
|
||||
"defaultvalue": { "id": user_key }
|
||||
},
|
||||
"authorization": {
|
||||
"dbs": "fac_functie_key",
|
||||
"label": L("fac_widget_page_auth"),
|
||||
"authorization_group": {
|
||||
"dbs": "fac_groep_key",
|
||||
"label": L("fac_groep"),
|
||||
"typ": "key",
|
||||
"foreign": "fac_functie",
|
||||
"foreign": "fac_groep",
|
||||
"foreignfiltercode": hasPRSSYS ? "" : "SELF",
|
||||
"multiedit": true
|
||||
},
|
||||
"created": {
|
||||
@@ -74,17 +76,27 @@ function model_fac_widget_page()
|
||||
}
|
||||
|
||||
var gparams;
|
||||
var hasPRSSYS = user.has("WEB_PRSSYS");
|
||||
if (!hasPRSSYS || S("wgt_enabled") == 0)
|
||||
{
|
||||
delete this.fields.person;
|
||||
// Dan alleen; openbaar of van jezelf en waar je rechten op hebt
|
||||
gparams = {
|
||||
"GET": {
|
||||
"wheres": [ "fac_widget_page.prs_perslid_key = -1"
|
||||
+ " OR fac_widget_page.prs_perslid_key IS NULL"
|
||||
+ " OR fac_widget_page.prs_perslid_key = " + user_key ]
|
||||
"wheres": [ "(fac_widget_page.prs_perslid_key = -1"
|
||||
+ " OR fac_widget_page.prs_perslid_key IS NULL"
|
||||
+ (S("wgt_enabled") == 1 ? " OR fac_widget_page.prs_perslid_key = " + user_key : "")
|
||||
+ ")",
|
||||
"(fac_widget_page.fac_groep_key IS NULL"
|
||||
+ (S("wgt_enabled") == 1
|
||||
? " OR fac_widget_page.fac_groep_key IN (SELECT fgg.fac_groep_key"
|
||||
+ " FROM fac_gebruikersgroep fgg"
|
||||
+ " WHERE fgg.prs_perslid_key = " + user_key + ")"
|
||||
: "")
|
||||
+ ")" ]
|
||||
}
|
||||
};
|
||||
if (S("wgt_enabled") == 0)
|
||||
delete this.fields.authorization;
|
||||
}
|
||||
|
||||
this.REST_GET = generic_REST_GET(this, gparams);
|
||||
|
||||
@@ -484,7 +484,7 @@ wgt = {
|
||||
if (wgt_page_key > -1) // Bestaande widget-pagina
|
||||
{
|
||||
var sql = "SELECT prs_perslid_key"
|
||||
+ " , fac_functie_key"
|
||||
+ " , fac_groep_key"
|
||||
+ " , fac_widget_page_name"
|
||||
+ " FROM fac_widget_page"
|
||||
+ " WHERE fac_widget_page_key = " + wgt_page_key;
|
||||
@@ -492,12 +492,20 @@ wgt = {
|
||||
if (oRs.EoF) // Omdat de key uit een setting gehaald wordt die vroeger een 0 of 1 was, kan het per ongeluk fout gaan, daarom hieronder een aanwijzing
|
||||
_AiAi("INTERNAL_ERROR: Widgetpagina met key {0} bestaat niet".format(wgt_page_key));
|
||||
var prs_key = oRs("prs_perslid_key").Value || -1;
|
||||
var fac_functie_key = oRs("fac_functie_key").Value || -1;
|
||||
var fac_groep_key = oRs("fac_groep_key").Value || -1;
|
||||
result.title = oRs("fac_widget_page_name").Value || "";
|
||||
oRs.Close();
|
||||
|
||||
if (fac_functie_key > -1)
|
||||
user.checkAutorisation(fac_functie_key); // -> auth_required_or_abort als je de 'Extra autorisatie' niet hebt
|
||||
if (fac_groep_key > -1)
|
||||
{
|
||||
sql = "SELECT 'dummy'"
|
||||
+ " FROM fac_gebruikersgroep"
|
||||
+ " WHERE prs_perslid_key = " + user_key
|
||||
+ " AND fac_groep_key = " + fac_groep_key;
|
||||
oRs = Oracle.Execute(sql);
|
||||
user.auth_required_or_abort(!oRs.EoF);
|
||||
oRs.Close();
|
||||
}
|
||||
|
||||
result.public = prs_key == -1;
|
||||
result.canRead = result.public || // Iedereen mag openbare pagina's zien
|
||||
|
||||
@@ -20,7 +20,7 @@ var scf_params = {
|
||||
"filters" : [
|
||||
"name",
|
||||
"person",
|
||||
"authorization"
|
||||
"authorization_group"
|
||||
]
|
||||
},
|
||||
"list": {
|
||||
@@ -29,7 +29,7 @@ var scf_params = {
|
||||
"name",
|
||||
"person",
|
||||
"isStartPage",
|
||||
"authorization",
|
||||
"authorization_group",
|
||||
"created"
|
||||
],
|
||||
"orderby": [
|
||||
|
||||
@@ -33,6 +33,7 @@ if (mode == "save" || mode == "delete" || mode == "api2")
|
||||
<!-- #include file="../Shared/persoonselector.inc" -->
|
||||
<!-- #include file="../Shared/bedrijfselector.inc" -->
|
||||
<!-- #include file="../Shared/autorisatieselector.inc" -->
|
||||
<!-- #include file="../Shared/autorisatiegroepselector.inc" -->
|
||||
<!-- #include file="../Shared/kostenplaatsselector.inc" -->
|
||||
<!-- #include file="../Shared/stdmeldingselector.inc" -->
|
||||
<!-- #include file="../Shared/disciplineselector.inc" -->
|
||||
@@ -420,6 +421,17 @@ function scf_RWFIELDTR(model, fld, val, key, params)
|
||||
whenEmpty: params.search? L("lcl_search_generic") : null
|
||||
});
|
||||
}
|
||||
else if (predefined == "FAC_GROEP")
|
||||
{
|
||||
FCLTautorisatiegroepselector(fld,
|
||||
"sg" + fld,
|
||||
{ label: field.label,
|
||||
autorisatiegroepKey: val? val.id : null,
|
||||
required: params.required,
|
||||
filtercode: "foreignfiltercode" in field? field.foreignfiltercode : "",
|
||||
whenEmpty: params.search? L("lcl_search_generic") : null
|
||||
});
|
||||
}
|
||||
else if (predefined == "MLD_STDMELDING")
|
||||
{
|
||||
params = { label: field.label,
|
||||
|
||||
51
APPL/Shared/Suggest/SuggestAutorisatiegroep.asp
Normal file
51
APPL/Shared/Suggest/SuggestAutorisatiegroep.asp
Normal file
@@ -0,0 +1,51 @@
|
||||
<%@language = "javascript" %>
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: SuggestAutorisatiegroep.asp
|
||||
Description: Suggereer autorisatiegroep
|
||||
Parameters: k De eerste paar letters
|
||||
bAll Haal alle records op (met nog steeds een maximum van 500)
|
||||
filtcode Beperk de lijst met getoonde autorisatiegroepen: Zie autorisatiegroepfilter.inc
|
||||
Globals:
|
||||
Context:
|
||||
Note:
|
||||
*/ %>
|
||||
|
||||
<%
|
||||
JSON_Result = true;
|
||||
%>
|
||||
|
||||
<!-- #include file="../../Shared/common.inc" -->
|
||||
<!-- #include file="./suggest.inc" -->
|
||||
<!-- #include file="./autorisatiegroepFilter.inc" -->
|
||||
|
||||
<%
|
||||
var chars = getQParam("k", "");
|
||||
var bAll = getQParamInt("SuggestAll", 0) == 1;
|
||||
var filtcode = getQParam("filtcode", "");
|
||||
var extracode = getQParam("extracode", "");
|
||||
|
||||
var filtClause = getFiltClauseAutorisatiegroep(filtcode, {});
|
||||
var extraInf = getExtraInfAutorisatiegroep(extracode);
|
||||
|
||||
var sql = "SELECT fg.fac_groep_key,"
|
||||
+ " fg.fac_groep_omschrijving,"
|
||||
+ " fg.fac_groep_opmerking"
|
||||
+ extraInf.selectstr
|
||||
+ " FROM fac_groep fg"
|
||||
+ extraInf.fromstr
|
||||
+ " WHERE UPPER(fac_groep_omschrijving) LIKE " + safe.quoted_sql_wild2(chars)
|
||||
+ filtClause
|
||||
+ extraInf.wherestr
|
||||
+ " ORDER BY fg.fac_groep_omschrijving";
|
||||
|
||||
var resultParams = { bAll: bAll,
|
||||
fldName: "fac_groep_omschrijving",
|
||||
fldKey: "fac_groep_key",
|
||||
fldDesc: "fac_groep_opmerking"
|
||||
};
|
||||
WriteResult2(sql, resultParams);
|
||||
%>
|
||||
<% ASPPAGE_END(); %>
|
||||
47
APPL/Shared/Suggest/autorisatiegroepFilter.inc
Normal file
47
APPL/Shared/Suggest/autorisatiegroepFilter.inc
Normal file
@@ -0,0 +1,47 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: autorisatiegroepFilter.inc
|
||||
Description: functies voor autorisatiegroep suggest velden
|
||||
Globals:
|
||||
Context:
|
||||
Note:
|
||||
*/
|
||||
|
||||
function getFiltClauseAutorisatiegroep(pfiltcode, params)
|
||||
{
|
||||
var lfiltClause = "";
|
||||
if (pfiltcode && pfiltcode != "")
|
||||
{
|
||||
switch(pfiltcode)
|
||||
{
|
||||
// Al mijn eigen groepen zonder underscore prefix
|
||||
case "SELF": lfiltClause = " AND fg.fac_groep_key IN (SELECT fgg.fac_groep_key"
|
||||
+ " FROM fac_gebruikersgroep fgg"
|
||||
+ " WHERE fgg.prs_perslid_key = " + user_key + ")"
|
||||
+ " AND fg.fac_groep_omschrijving NOT LIKE '\\_%' ESCAPE '\\'";
|
||||
break;
|
||||
// Al mijn eigen groepen, ook met underscore prefix
|
||||
case "_SELF": lfiltClause = " AND fg.fac_groep_key IN (SELECT fgg.fac_groep_key"
|
||||
+ " FROM fac_gebruikersgroep fgg"
|
||||
+ " WHERE fgg.prs_perslid_key = " + user_key + ")";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return lfiltClause;
|
||||
}
|
||||
|
||||
function getExtraInfAutorisatiegroep(pextracode)
|
||||
{
|
||||
var lExtraInf = { selectstr: "", fromstr: "", wherestr: "" };
|
||||
if (pextracode && pextracode != "")
|
||||
{
|
||||
switch(pextracode)
|
||||
{
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return lExtraInf;
|
||||
}
|
||||
%>
|
||||
175
APPL/Shared/autorisatiegroepselector.inc
Normal file
175
APPL/Shared/autorisatiegroepselector.inc
Normal file
@@ -0,0 +1,175 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: autorisatiegroepelector.inc
|
||||
Description: Algemene interface functie om een autorisatiegroep suggestbox te maken
|
||||
Deze moet je kunnen includen en aanroepen.
|
||||
Resulteert dan uiteindelijk in een zichtbaar textveld aangemaakt die de autorisatiegroep-omschrijving bevat (autorisatiegroep veld)
|
||||
en een hidden keyveld die de key van de autorisatiegroep-key bevat (autorisatiekey veld).
|
||||
Het autorisatiecode veld heeft geen naam en wordt niet meegesubmit.
|
||||
Het autorisatiekey veld heeft een naam en wordt meegesubmit.
|
||||
Het resultaat heeft de vorm "[<td>label</td><td>]selectveld[</td>]"
|
||||
parameters: fieldName: veldnaam van het autorisatiegroepkey veld. Dit veld wordt gesubmit.
|
||||
objectName: naam van het suggest object dat wordt aangemaakt.
|
||||
params: object met meegegeven parameters.
|
||||
autorisatiegroepKey: initi<74>le key waarde van de autorisatiegroep die ingevuld moet worden.
|
||||
multitoggle: Sta multi-toggle toe
|
||||
idadd: Identieficatie verschil bij gebruik van meerdere autorisatiegroepselectoren
|
||||
label: label dat voor het autorisatiegroep veld wordt weergegeven.
|
||||
filtercode: extra filtercode voor de query die gebruikt wordt voor de suggest.
|
||||
onChange: onchange op het textveld.
|
||||
trclass: wordt ook op de <tr> gezet.
|
||||
isBad: boolean die aangeeft dat het autorisatiegroep veld als ongeldig
|
||||
en leeg weergegeven moet worden (true|false(default)).
|
||||
readonly: geeft aan of het autorisatiegroep veld readonly weergegeven moet worden (true|false(default)).
|
||||
extracode: filtercode van extra filter clausule voor initi<74>le waarde.
|
||||
suppressEmpty Onderdrukt het veld helemaal indien EN readonly EN leeg.
|
||||
noBad Als autorisatiegroepKey niet gevonden binnen filter dan veld leeglaten
|
||||
(in plaats van standaard gedrag: naam wel opzoeken maar 'Bad' maken).
|
||||
*/ %>
|
||||
|
||||
<!-- #include file="./Suggest/autorisatiegroepFilter.inc" -->
|
||||
|
||||
<%
|
||||
FCLTHeader.Requires({ plugins: ["suggest", "jQuery"], js: ["iface.js"] });
|
||||
|
||||
function FCLTautorisatiegroepselector(fieldName, objectName, params)
|
||||
{
|
||||
params = params || {};
|
||||
if (!(params.autorisatiegroepKey > 0) && params.readonly && params.suppressEmpty)
|
||||
return;
|
||||
var idadd = params.idadd || "";
|
||||
var lwhenEmpty = (params.whenEmpty != null ? params.whenEmpty : (params.readonly ? L("lcl_select_readonly") : L("lcl_select_auth_group")));
|
||||
var lautorisatiegroep = "";
|
||||
var isBad = false;
|
||||
if (params.autorisatiegroepKey && params.autorisatiegroepKey > 0)
|
||||
{
|
||||
var filt_params = params;
|
||||
if (params.urlAdd)
|
||||
{
|
||||
for (i in params.urlAdd)
|
||||
{
|
||||
filt_params[params.urlAdd[i].urlParam] = params.urlAdd[i].init;
|
||||
}
|
||||
}
|
||||
var filtClause = getFiltClauseAutorisatiegroep(params.filtercode, filt_params);
|
||||
var extraInf = getExtraInfAutorisatiegroep(params.extracode);
|
||||
// Is er een initiele waarde meegegeven? Zoek dan de omschrijving erbij
|
||||
|
||||
var sql = "SELECT fg.fac_groep_key, fg.fac_groep_omschrijving autorisatiegroep"
|
||||
+ extraInf.selectstr
|
||||
+ " FROM fac_groep fg"
|
||||
+ extraInf.fromstr
|
||||
+ " WHERE fg.fac_groep_key = " + params.autorisatiegroepKey
|
||||
+ filtClause
|
||||
+ extraInf.wherestr
|
||||
+ " ORDER BY fg.fac_groep_omschrijving";
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (oRs.Eof) // Misschien (tegenwoordig) uit scope?
|
||||
{ // Probeer dan maar zonder extra 'where's
|
||||
oRs.Close(); // close the recordset, oRs will be reused
|
||||
isBad = true;
|
||||
sql = "SELECT fg.fac_groep_key, fg.fac_groep_omschrijving autorisatiegroep"
|
||||
+ extraInf.selectstr
|
||||
+ " FROM fac_groep fg"
|
||||
+ extraInf.fromstr
|
||||
+ " WHERE fg.fac_groep_key = " + params.autorisatiegroepKey
|
||||
+ extraInf.wherestr
|
||||
+ " ORDER BY fg.fac_groep_omschrijving";
|
||||
oRs = Oracle.Execute(sql);
|
||||
}
|
||||
if (isBad && params.noBad)
|
||||
{
|
||||
isBad = false;
|
||||
params.autorisatiegroepKey = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
lautorisatiegroep = oRs("autorisatiegroep").Value;
|
||||
}
|
||||
oRs.Close();
|
||||
}
|
||||
|
||||
// Bouw de url voor de Autorisatiegroepen query op
|
||||
var autorizationQueryUrl = rooturl + "/appl/shared/suggest/SuggestAutorisatiegroep.asp?1=1"
|
||||
+ (params.autorisatiegroepKey > 0? "&autorisatiegroepKey=" + params.autorisatiegroepKey : "") // Kan ook met urlAdd meegegeven worden
|
||||
+ (params.filtercode? "&filtcode=" + params.filtercode : "")
|
||||
+ (params.extracode? "&extracode=" + params.extracode : "");
|
||||
if (params.label)
|
||||
{ %>
|
||||
<tr <%=params.trclass?"class='" + params.trclass+"'":""%>>
|
||||
<td class="label">
|
||||
<label class='selector' for='<%=fieldName%>_show'><%=params.label%></label>
|
||||
</td>
|
||||
<td>
|
||||
<%
|
||||
}
|
||||
|
||||
if (params.readonly) { %>
|
||||
<span id="<%=fieldName%>_show" class="fld readonly">
|
||||
<%=safe.html(lautorisatiegroep)%>
|
||||
</span>
|
||||
<% } else {
|
||||
// data-role none because we want to wrap the input field ourselves (because of "suggestKlikker" placement)
|
||||
if (typeof mobile != "undefined")
|
||||
{ %>
|
||||
<div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset">
|
||||
<% } %>
|
||||
<input id="<%=fieldName%>_show" class="fld<%=params.required? " required" : ""%>" value="<%=safe.htmlattr(lautorisatiegroep)%>" placeholder="<%=lwhenEmpty%>"
|
||||
<%=(typeof mobile != "undefined" ? "data-role=\"none\"" : "")%> <%=params.onChange ? " sgonChange='" + params.onChange + "'" : ""%>>
|
||||
<% if (typeof mobile != "undefined")
|
||||
{ %>
|
||||
</div>
|
||||
<% }
|
||||
} %>
|
||||
<input type="hidden" id="<%=fieldName%>" name="<%=fieldName%>" value="<%=params.autorisatiegroepKey%>">
|
||||
<%
|
||||
if (params.label)
|
||||
{ %>
|
||||
</td>
|
||||
</tr>
|
||||
<%
|
||||
}
|
||||
if (!params.readonly)
|
||||
{
|
||||
if (params.urlAdd)
|
||||
{
|
||||
var urlAddTxt = "[";
|
||||
for (var i = 0; i < params.urlAdd.length; i++)
|
||||
{
|
||||
urlAddTxt += (i > 0? ", " : "") + "{ urlParam: \"" + params.urlAdd[i].urlParam + "\", field: \"" + params.urlAdd[i].field + "\" }";
|
||||
}
|
||||
urlAddTxt += "]"
|
||||
}
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
$(function()
|
||||
{
|
||||
<%=objectName%><%=idadd%> = new Suggest(
|
||||
{ objectName: "<%=objectName%><%=idadd%>",
|
||||
queryField: $("#<%=fieldName%>_show")[0],
|
||||
queryUrl: "<%=autorizationQueryUrl%>",
|
||||
icon: "fa-users",
|
||||
initKey: <%=params.autorisatiegroepKey? params.autorisatiegroepKey : -1%>,
|
||||
noJustOne: true, // Controleer niet of er maar <20><>n waarde is die geselecteerd moet worden.
|
||||
keyField: $("#<%=fieldName%>")[0]
|
||||
<%=params.multitoggle? ", multitoggle: true" : ""%>
|
||||
<%=params.urlAdd? ", urlAdd: " + urlAddTxt : ""%>
|
||||
<%=params.isBad? ", isBad: true": ""%>
|
||||
<%=params.readonly? ", fieldReadonly: true": ""%>
|
||||
});
|
||||
<% if (isBad)
|
||||
{ %>
|
||||
<%=objectName%><%=idadd%>.isBad();
|
||||
<% }
|
||||
if (params.hidden)
|
||||
{ %>
|
||||
<%=objectName%><%=idadd%>.makeHidden();
|
||||
<% } %>
|
||||
});
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -119,6 +119,7 @@ function foreignKeyTable(field)
|
||||
"BES_BESTELOPDR" : { tbl: "bes_bestelopdr", key: "bes_bestelopdr_key", desc: "bes_bestelopdr_id" },
|
||||
"BES_SRTPROD" : { tbl: "bes_srtprod", key: "bes_srtprod_key", desc: "bes_srtprod_omschrijving" },
|
||||
"FAC_FUNCTIE" : { tbl: "fac_functie", key: "fac_functie_key", desc: "lcl.l(fac_functie_omschrijving, 1) || ' (' || fac_functie_code || ')'" },
|
||||
"FAC_GROEP" : { tbl: "fac_groep", key: "fac_groep_key", desc: "fac_groep_omschrijving" },
|
||||
"FAC_SRTNOTIFICATIE" : { tbl: "fac_srtnotificatie", key: "fac_srtnotificatie_key", desc: "fac_srtnotificatie_code" },
|
||||
"FAC_PROFIEL" : { tbl: "fac_profiel", key: "fac_profiel_key", desc: "fac_profiel_omschrijving" },
|
||||
"RES_SRTACTIVITEIT" : { tbl: "res_srtactiviteit", key: "res_srtactiviteit_key", desc: "res_srtactiviteit_omschrijving" }
|
||||
|
||||
Reference in New Issue
Block a user