163 lines
7.0 KiB
HTML
163 lines
7.0 KiB
HTML
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: rs_columns.inc
|
|
|
|
Description: User-defineable columns for non-scaffolding lists
|
|
Parameters:
|
|
Context: resultset_table_v2.inc
|
|
Note:
|
|
|
|
*/ %>
|
|
<%
|
|
|
|
// Deze zet de kolommen in de juiste volgorde en/of onderdrukt ze, conform de door de gebruiker zelf gemaakte keuze
|
|
// Sommige kolommen sluiten we hard uit met colName "IGNORE", die zijn niet in de tabel geregistreerd en worden ongeacht
|
|
// altijd achteraan volgens de standaard volgorde getoond (bv bij MJOB).
|
|
function reorderPerslidCols(code, cols)
|
|
{
|
|
var index;
|
|
var sql = "SELECT c.prs_perslid_cols_key, c.prs_perslid_cols_column_name, c.prs_perslid_cols_visible, c.prs_perslid_cols_combine"
|
|
+ " FROM prs_perslid_tabs t, prs_perslid_cols c"
|
|
+ " WHERE t.prs_perslid_tabs_code = " + safe.quoted_sql(code)
|
|
+ " AND c.prs_perslid_tabs_key = t.prs_perslid_tabs_key"
|
|
+ " AND t.prs_perslid_key = " + user_key
|
|
+ " ORDER BY c.prs_perslid_tabs_key, c.prs_perslid_cols_volgnr, c.prs_perslid_cols_column_name";
|
|
var oRs = Oracle.Execute(sql);
|
|
if (oRs.eof)
|
|
{
|
|
oRs.close();
|
|
return cols;
|
|
}
|
|
// reorder cols
|
|
else
|
|
{
|
|
var arr = [];
|
|
while (!oRs.eof)
|
|
{
|
|
for (index = 0; index < cols.length; index++)
|
|
{
|
|
if ((cols[index].colName || cols[index].orgContent) == oRs("prs_perslid_cols_column_name").Value)
|
|
{
|
|
cols[index].combine = oRs("prs_perslid_cols_combine").Value == 1;
|
|
cols[index].hidden = oRs("prs_perslid_cols_visible").Value == "I";
|
|
arr.push(cols[index]);
|
|
break;
|
|
}
|
|
}
|
|
oRs.MoveNext();
|
|
}
|
|
oRs.close();
|
|
// add the ignored columns at the end
|
|
for (index = 0; index < cols.length; index++)
|
|
{
|
|
if ((cols[index].colName || cols[index].orgContent) == "IGNORE")
|
|
{
|
|
arr.push(cols[index]);
|
|
}
|
|
}
|
|
return arr;
|
|
}
|
|
}
|
|
|
|
function rs_columns(code, cols)
|
|
{ %>
|
|
<script>
|
|
var $dialog;
|
|
function rscols_submit(method)
|
|
{
|
|
$dialog.dialog("close");
|
|
rscols_doSubmit(method);
|
|
}
|
|
|
|
function rscols_reset(method)
|
|
{
|
|
$dialog.dialog("close");
|
|
rscols_doReset(method);
|
|
}
|
|
|
|
function openColumns()
|
|
{
|
|
var params = { width: "auto",
|
|
minWidth: 200,
|
|
resizable: false,
|
|
position: { my: "right top", at: "right+16 top+30", of: event },
|
|
title: "<%=L("lcl_scf_columns")%>",
|
|
create: FcltMgr.fnCreateCloseButton("div#rscolpicker")
|
|
};
|
|
$dialog = $('div#rscolpicker').dialog(params).dialog('open');
|
|
FcltMgr.resized();
|
|
}
|
|
</script>
|
|
|
|
<div id="rscolpicker" style="display:none;">
|
|
<input type='hidden' name='code' id='code' value="<%=code%>">
|
|
<input type='hidden' name='columns' id='columns' value="">
|
|
<input type='hidden' name='resetcols' id='resetcols' value="0">
|
|
<table id="rscolumnstable" class="no-floating">
|
|
<%
|
|
Response.Write("<thead><tr><th><input id='chkall' type='checkbox'>" + L("lcl_rap_visible") + "</th><th>" + L("lcl_combine") + "</th></tr></thead>");
|
|
|
|
Response.Write("<tbody>");
|
|
|
|
var sql = "SELECT c.prs_perslid_cols_key, c.prs_perslid_cols_column_name, c.prs_perslid_cols_visible, c.prs_perslid_cols_combine"
|
|
+ " FROM prs_perslid_tabs t, prs_perslid_cols c"
|
|
+ " WHERE t.prs_perslid_tabs_code = " + safe.quoted_sql(code)
|
|
+ " AND c.prs_perslid_tabs_key = t.prs_perslid_tabs_key"
|
|
+ " AND t.prs_perslid_key = " + user_key
|
|
+ " ORDER BY c.prs_perslid_tabs_key, c.prs_perslid_cols_volgnr, c.prs_perslid_cols_column_name";
|
|
var oRs = Oracle.Execute(sql);
|
|
// show default columns and combine settings
|
|
if (oRs.eof)
|
|
{
|
|
for (index = 0; index < cols.length; index++)
|
|
{
|
|
if ((cols[index].purpose == undefined || cols[index].purpose == VIEW_ONLY || cols[index].purpose == PRINT_AND_VIEW) && cols[index].colName != "IGNORE")
|
|
{
|
|
combine = cols[index].combine;
|
|
Response.Write("<tr id='" + safe.htmlattr(cols[index].colName || cols[index].orgContent) + "'" + (combine?" class='rscols_combined'":"") + ">"
|
|
+ "<td><label for='usefield"+index+"'><input id='usefield"+index+"' name='usefield' type='checkbox' checked='1'>" + (cols[index].colText || cols[index].caption) + "</label></td>"
|
|
+ "<td><label for='combine"+index+"'><input id='combine"+index+"' name='combine' type='checkbox'" + (combine?" checked='1'":"") + "></label></td>"
|
|
+ "</tr>");
|
|
}
|
|
}
|
|
}
|
|
// show manual columns and combine settings
|
|
else
|
|
{
|
|
var c = -1;
|
|
while (!oRs.eof)
|
|
{
|
|
c++;
|
|
on = oRs("prs_perslid_cols_visible").Value == "V";
|
|
combine = oRs("prs_perslid_cols_combine").Value == 1;
|
|
var text = "";
|
|
for (index = 0; index < cols.length; index++)
|
|
{
|
|
if (oRs("prs_perslid_cols_column_name").Value == (cols[index].colName || cols[index].orgContent))
|
|
{
|
|
text = (cols[index].colText || cols[index].caption);
|
|
break;
|
|
}
|
|
}
|
|
|
|
Response.Write("<tr id='" + safe.htmlattr(oRs("prs_perslid_cols_column_name").Value) + "'" + (combine?" class='rscols_combined'":"") + ">"
|
|
+ "<td><label for='usefield"+c+"'><input id='usefield"+c+"' name='usefield' type='checkbox'" + (on?" checked='1'":"") + ">" + text + "</label></td>"
|
|
+ "<td><label for='combine"+c+"'><input id='combine"+c+"' name='combine' type='checkbox'" + (combine?" checked='1'":"") + "></label></td>"
|
|
+ "</tr>");
|
|
oRs.MoveNext();
|
|
}
|
|
}
|
|
oRs.close(); %>
|
|
</tbody>
|
|
</table>
|
|
<%
|
|
buttons = [];
|
|
buttons.push({title: L("lcl_search"), icon: "fa-fclt-save", action: "rscols_submit('" + Request.ServerVariables("REQUEST_METHOD") + "')", importance: 1 });
|
|
buttons.push({title: L("lcl_reset"), icon: "fa-fclt-cancel", action: "rscols_reset('" + Request.ServerVariables("REQUEST_METHOD") + "')", importance: 3 });
|
|
CreateButtons(buttons, { showIcons: true });
|
|
%>
|
|
</div>
|
|
<% } %>
|