<%@ language = "JavaScript" %>
<% /*
     $Revision$
     $Id$
*/ %>

<!--#include file="../Shared/common.inc"-->
<!--#include file="../Shared/iface.inc"-->
<!--#include file='../CAD/FGII.inc'-->
<!--#include file="../alg/alg.inc"-->
<%
FCLTHeader.Requires({ plugins: ["jQuery"],
                      js: ["jQuery-ui.js"]
                    })

var autfunction = "WEB_CADFOF";
var authparams = user.checkAutorisation(autfunction);
%>

<html>
  <head>
<%  FCLTHeader.Generate()

    var cad_tek_key = getQParamInt("cad_tek_key", -1);
    var loc = getQParam("loc");
    var loc_key = getQParamInt("location_key");
    var bld = getQParam("bld");
    var flr = getQParam("flr");
    var flr_key = getQParamInt("floor_key", -1);
    var file_name = getQParam("file_name", "");

    user.auth_required_or_abort(alg.canWriteVerdieping(flr_key, authparams.ALGwritelevel));
%>

    <title><%=L("lcl_fg_tek_fac_change_file")%></title>
    <script type="text/javascript">
      function cad_tek_submit()
      {
        document.forms.u2.submit();
      }
    </script>
  </head>

  <body class="fclt-modal" id="mod_tekedit">
      <% MODAL_START(); %>
    <form action="tek_file_save.asp" method="post" name="u2" target="hidFrame" onsubmit="cad_tek_submit()">
<%    /* Pass on some relevant paramaters */
      MODAL_BLOCK_START("", L("lcl_fg_tek_change_file"), { icon: "fa-file-edit" });
%>
      <input type=hidden name="cad_tek_key" id="cad_tek_key" value="<%=cad_tek_key%>">
      <input type=hidden name="loc_key" id="loc" value="<%=loc_key%>">
      <input type=hidden name="flr_key" id="flr_key" value="<%=flr_key%>">
<%
      ROFIELDTR("fld", L("lcl_location"), loc);
      ROFIELDTR("fld", L("lcl_building"), bld);
      ROFIELDTR("fld", L("lcl_floor"), flr);
      FILEPICKERTR("file", L("lcl_fg_tek_file"), file_name, { "key": cad_tek_key, "module": "FGII", "icon": "fa-layer-group", "defaultValue": L("lcl_fg_tek_file") });

      MODAL_BLOCK_END();

      var buttons = [{title: L("lcl_submit"), icon: "fa-fclt-save", action: "cad_tek_submit()", importance: 1},
                     {title: L("lcl_cancel"), icon: "fa-fclt-cancel",  action: "FcltMgr.closeDetail(window, { cancel: true })", importance: 3}];
      SIMPLE_BLOCK_START();
        CreateButtons(buttons);
      SIMPLE_BLOCK_END();
IFACE.FORM_END();
%>
    </form>
    <% MODAL_END(); %>
    <iframe src="../Shared/empty.asp" frameborder="0" name="hidFrame" id="hidFrame" style="display:none"></iframe>
  </body>
</html>
<% ASPPAGE_END(); %>
