<%@ LANGUAGE = JavaScript %>
<% /*
     $Revision$
     $Id$

    File:        mld_kenmerk_search.asp
    Description: Zoekscherm kenmerken
    Parameters:  urole
    Context:
    Note:

*/ %>

<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/iface.inc" -->
<!-- #include file="../Shared/disciplineselector.inc" -->
<!-- #include file="../Shared/stdmeldingselector.inc" -->
<!-- #include file="../Shared/selector.inc" -->
<!-- #include file="../Shared/kenmerk_beheer.inc" -->

<%
FCLTHeader.Requires({ plugins:["jQuery"]});

var authparams = user.checkAutorisation("WEB_MLDMGT");

var srtdisc_key = getQParamInt("srtdisc_key", -1);
var disc_key = getQParamInt("disc_key", -1);
var stdm_key = getQParamInt("stdm_key", -1);
%>

<html>
  <head>
    <%  FCLTHeader.Generate(); %>
      <script type="text/javascript">
          function doSubmit()
            {
                document.forms.u2.submit();
            }
            function onChangeVakgroep(vakgroep_key)
            {
              sgStdm.setValue(-1, "", true, false, null, true);
              sgStdm.CheckJustOne();
            }
      </script>
  </head>
  <body id="searchbody">
    <div id="search">
<%    BLOCK_START("searchtable", L("lcl_filterblok"));%>
      <form name="u2" target="workFrame" action="mld_kenmerk_search_list.asp" method="get">
          <tr>
            <td class="searchkolom1">
              <table><!-- x rijen, 2 kolommen: label + veld -->
              <tr class="primsearch">
                <td class="label"><label for="searchtext"><%=L("lcl_mld_srtkenmerk_omschrijving")%>:</label></td>
                <td><input type="text" class="fldsrch wildcard" name="searchtext" id="searchtext"></td>
              </tr>
<%
      sql = "select b.ins_srtdiscipline_key, "
          + "       b.ins_srtdiscipline_omschrijving"
          + "  FROM ins_srtdiscipline b"
          + " WHERE ins_srtdiscipline_verwijder IS NULL"
          + " ORDER BY ins_srtdiscipline_omschrijving";
      FCLTselector("srtdisc_key",
                   sql,
                   { initKey: "-1",
                     label: L("lcl_mld_vakgroeptype"),
                     trclass: "primsearch",
                     emptyOption: "",
                     onChange: "sgDisc.setValue(-1, '');sgStdm.setValue(-1, '')"
                   });

      // Vakgroep
      FCLTdisciplineselector("disc_key",
                             "sgDisc",
                             { label: L("lcl_mld_vakgroep"),
                               disc_key: disc_key,
                               module: "MLD",
                               perslidKey: user_key,
                               autfunctionKey: -1, // alles is toegestaan! authparams.autfunctionkey,
                               //srtdisc_key: S("mld_forward_all") == 1? null : srt_disc,
                               urlAdd: [{urlParam: "srtdisc_key", field: "srtdisc_key"}],
                               onChange: "onChangeVakgroep"
                             });
      // Melding
      FCLTstdmeldingselector("stdm",
                             "sgStdm",
                             { label: L("lcl_complain"),
                               perslidKey: user_key,
                               autfunctionKey: -1, // alles is toegestaan! authparams.autfunctionkey,
                               //srtdisc_key: S("mld_forward_all") == 1? null : srt_disc,
                               urlAdd: [{urlParam: "disc_key", field: "disc_key"}],
//                               onChange: "onChangeStdMelding",
                               stdmelding_key: stdm_key,
                               whenEmpty: L("lcl_search_generic")  // blijkt niet supported
                             });
%>
              </table>
            </td><!-- end column 1 -->

            <td class="searchkolom2">
              <table><!-- x rijen, 2 kolommen: label + veld -->
<%
    var types = [];
    for (tp in kenmerk.types)
    {
        types.push ("SELECT " + safe.quoted_sql(tp) + "," + safe.quoted_sql(kenmerk.types[tp]) + " FROM DUAL")
    }
      sql = types.join(" UNION ALL ")
          + " ORDER BY 2";
      FCLTselector("kenmerktype",
                   sql,
                   { initKey: "",
                     label: L("lcl_mld_srtkenmerk_kenmerktype"),
                     trclass: "primsearch",
                     emptyOption: ""
                   });

    var sql = "           SELECT 'S', " + safe.quoted_sql(L("lcl_complain"))         + " FROM DUAL"
            + " UNION ALL SELECT 'D', " + safe.quoted_sql(L("lcl_mld_vakgroep"))     + " FROM DUAL"
            + " UNION ALL SELECT 'T', " + safe.quoted_sql(L("lcl_mld_vakgroeptype")) + " FROM DUAL";
      FCLTselector("niveau",
                   sql,
                   { initKey: "",
                     label: L("lcl_mld_kenmerk_niveau"),
                     trclass: "primsearch",
                     emptyOption: ""
                   });
%>
              </table>
            </td><!-- end column 1 -->
          </tr>
<%    BLOCK_END();

  var buttons =  [ {title: L("lcl_search"), action: "doSubmit()", id: "bSearch" } ];
  CreateButtons(buttons, { entersubmit: true});
%>
      </form>
    </div> <!-- search -->

    <div id="result">
      <iframe width="100%" height="100%"
              src="../Shared/empty.asp"
              name="workFrame" id="workFrame"
              onload="FcltMgr.iframeLoaded(this)"
              frameborder="0" scrolling="no">
      </iframe>
    </div>
  </body>
</html>
