Files
Facilitor/APPL/ALG/alg_edit_wp.asp
Erik Groener 6ffe86decc FSN#22186 FireFox/Safari compatibiliteit
svn path=/Website/trunk/; revision=5346
2012-01-11 12:21:26 +00:00

186 lines
5.6 KiB
Plaintext

<%@language = "javascript" %>
<%
/* $Revision: 12 $
$Modtime: 11-01-12 8:32 $
File: alg_edit_wp.asp
Description: wijzigen of toevoegen van een werkplek
Parameters: wp_key
Context:
Note:
*/ %>
<!--#include file="../../cust/install.inc" -->
<!--#include file="../Shared/iface.inc" -->
<!--#include file="../Shared/plaatsselector.inc" -->
<!--#include file="../Shared/json2.js" -->
<!-- #include file="alg.inc" -->
<%
FCLTHeader.Requires({plugins:["jQuery"], js: []})
var wp_key = getQParamInt("wp_key");
var room_key = getQParamInt("room_key", -1); // ruimte
var authparams = alg.checkAutorisation();
if (wp_key > 0)
{
sql = " select * "
+ " FROM PRS_WERKPLEK "
+ " WHERE prs_werkplek_key = " + wp_key;
oRs = Oracle.Execute(sql);
var wp_volgnr = oRs("PRS_WERKPLEK_VOLGNR").value;
var wp_oms = oRs("PRS_WERKPLEK_OMSCHRIJVING").value;
var wp_vstopp = oRs("PRS_WERKPLEK_VASTOPP").value;
var wp_opp = oRs("PRS_WERKPLEK_OPP").value;
var wp_vstopp = oRs("PRS_WERKPLEK_VASTOPP").value;
var wp_virt = oRs("PRS_WERKPLEK_VIRTUEEL").value;
room_key = oRs("PRS_ALG_RUIMTE_KEY").value;
oRs.Close();
}
%>
<html>
<head>
<%
FCLTHeader.Generate();
%>
<script>
function alg_submit()
{
document.activeElement.blur(); // trigger laatste onChanges
if (!validateForm("u2"))
return false;
document.forms.u2.submit();
}
function alg_cancel()
{
FcltMgr.closeDetail(window, { cancel: true } );
}
function alg_next()
{
alert("TODO: Next nog niet ondersteund")
}
function enableArea()
{
if( event.srcElement.id != 'fix0' ) {
document.getElementById("wp_opp").disabled = false;
} else {
document.getElementById("wp_opp").disabled = true;
document.getElementById("wp_opp").value = "";
document.getElementById("areah").value = 'null';
}
}
function isGoodNumber(str, checkInteger)
{
var anum=/(^\d+$)|(^\d+\.\d*$)|(^\d*\.\d+$)/
if ( checkInteger ) {
anum=/(^\d+$)/
}
return anum.test(str);
}
function checkArea()
{
if( document.getElementById("area").value != ""
&& !isGoodNumber(document.getElementById("area").value, false )
&& parseInt(document.getElementById("wp_opp").value,10) > 0
&& parseInt(document.getElementById("wp_opp").value,10) < 999999.99) {
alert('<%=lcl_estate_wp_bad_area%>');
return false;
}
if( document.getElementById("wp_opp").value != "" ) {
document.getElementById("areah").value = document.getElementById("area").value;
} else {
document.getElementById("areah").value = 'null';
}
return true;
}
function process_host_info(data)
{
$("#wp_volgnr").val(data.volgnr);
$("#wp_oms").val($("#alg_ruimte_nr").val() + "/" + data.volgnr)
}
function onChangeRoom(room_key)
{
$.getJSON("../alg/get_volgnr_ajax.asp?room_key=" + room_key, process_host_info);
}
function onChangeVolgnr()
{
$("#wp_oms").val($("#alg_ruimte_nr").val() + "/" + $("#wp_volgnr").val()) //TODO: pakt nu ruimte waarde maar moet eigenlijk ruimte code pakken.
}
<% if (wp_key<0) { %>
$(document).ready(function(){ onChangeRoom(<%=room_key%>)});
<% } %>
</script>
</head>
<body id="editbody">
<%
var buttons = [ //{title: lcl_submit, action:"alg_next()", icon: "opslaan.png" },
{title: lcl_submit, action:"alg_submit()", icon: "opslaan.png" },
{title: lcl_cancel, action:"alg_cancel()", icon: "undo.png" } ];
IFRAMER_HEADER(lcl_alg_wp_frame, buttons);
%>
<div id="edit">
<form name="u2"
action="alg_edit_wp_save.asp?wp_key=<%=wp_key%>"
method="post"
target="hidFrameSubmit"
onSubmit="alg_submit();">
<%
BLOCK_START("algInfo", "");
FCLTplaatsselector(authparams.uALGwritelevel, { // ALGUSE schrijfscope bepaalt wat je mag bewerken
ruimtekey: room_key,
onRuiChange: "onChangeRoom(key)",
startlevel: 2, // Regio
eindlevel: 5, // District
readonly: (wp_key > 0),
required: true });
RWFIELDTR("wp_volgnr", "fldshort", lcl_estate_wp_seq, wp_volgnr, {required: true,
html: 'onChange="onChangeVolgnr()"',
datatype: "number",
maxlength: 3});
RWFIELDTR("wp_oms", "fld", lcl_workplace, wp_oms, {maxlength: 30});
%>
<tr>
<td class="label"><label><%=lcl_estate_wp_fixed%>:</label></td>
<td>
<label for="wp_vstopp_v">
<input type="radio" name="wp_vstopp_v" id="wp_vstopp_v" value="" <%= wp_vstopp==null ? " checked " : "" %>><%=lcl_estate_wp_fixed_v%>
</label>
<label for="wp_vstopp_f">
<input type="radio" name="wp_vstopp_v" id="wp_vstopp_f" value="1" <%= wp_vstopp==1 ? " checked " : "" %>><%=lcl_estate_wp_fixed_f%>
</label>
</td>
</tr>
<%
RWFIELDTR("wp_opp", "fld", lcl_estate_wp_area, wp_opp, {maxlength: 10, float: true}); //TODO: in de toekomst ook kijken naar tussen 0 en 99999.99 ?
CHECKBOXTR(lcl_estate_wp_virt, "fldalgbez", "wp_virt", wp_virt==1);
BLOCK_END();
%>
</form>
<iframe src="../Shared/empty.html" name="hidFrameSubmit" style="display:none"></iframe>
</div>
</body>
</html>