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

    File:        fac_locale_search.asp (FSN#.....)
    Description: Zoekt in Locale
    Parameters:  -
    Context:     -
    Note:        -
*/ %>
<!--#include file="../Shared/common.inc" -->
<!--#include file="../shared/iface.inc" -->
<!--#include file="../Shared/selector.inc" -->
<%
  FCLTHeader.Requires({plugins:["jQuery"]});
  var autosearch = getQParamInt("autosearch", 0) == 1;
  var sstring = getQParam("s", "");
  var sTaal = "";
  var sDialect = "";

var autfunction = "WEB_LCLSYS";
var authparams = user.checkAutorisation(autfunction);
%>
<html>
  <head>
<%  FCLTHeader.Generate() %>

    <script type="text/javascript">
      function doSubmit(mode)
      {
        if (mode == 0)
          document.forms.u2.sGroep.value = "dialect_key";
        else
        	document.forms.u2.sGroep.value = "lang";

        document.forms.u2.submit();
      }

<%    if (autosearch)
      { %>
        $(document).ready(function() {doSubmit()})
<%    } %>
    </script>
  </head>

  <body id="searchbody">
    <div id="search">
      <form name="u2" method="get" action="fac_locale_list.asp" target="workFrame">
        <input type="hidden" name="sGroep" id="sGroep">
<%      BLOCK_START("searchtable", L("lcl_filterblok"));%>
          <tr>
            <td class="searchkolom1">
              <table><!-- x rijen, 2 kolommen: label + veld -->
                <!-- dialect -->
<%
                // taal
                sql = "SELECT DISTINCT "
                    + "       fac_locale_lang fac_waarde,"
                    + "       fac_locale_lang fac_label "
                    + "FROM fac_v_locale_kolom "
                    + "ORDER BY fac_label ";
                FCLTselector("sTaal",
                             sql,
                             { label: L("lcl_lcl_taal"),
                               trclass: "primsearch",
                               emptyOption: L("lcl_all")
                             })
                // dialect
                sql = "SELECT DISTINCT "
                    + " fac_locale_dialect_key fac_waarde, "
                    + " "+ lcl.xsql('ins_srtdiscipline_omschrijving','D.ins_srtdiscipline_key') +" fac_label "
                    + "FROM fac_v_locale_lcl L, ins_srtdiscipline D "
                    + "WHERE  L.fac_locale_dialect_key = D.ins_srtdiscipline_key "
                    + "ORDER BY fac_label ";
                FCLTselector("sDialect",
                             sql,
                             { label: L("lcl_lcl_dialect"),
                               trclass: "primsearch",
                               emptyOption: L("lcl_all")
                             })
%>
              </table>
            </td>
            <td>
              <table><!-- x rijen, 2 kolommen: label + veld -->
              <!-- Zoektekst -->
                <tr class="primsearch">
                  <td class="label">
                    <label for="sString"><%=L("lcl_lcl_search_fields")%>:</label>
                  </td>
                  <td>
                    <input type="text" class="fld wildcard" name="sString" id="sString">
                  </td>
                </tr>
                <tr>
                  <td class="label">&nbsp;</td>
                </tr>
              </table>
            </td>
          </tr>
<%      BLOCK_END();

      var buttons = [];

      buttons.push ( {title: L("lcl_lcl_overzicht_dialect"), action:"doSubmit(0)" } );
      buttons.push ( {title: L("lcl_lcl_overzicht_taal")   , action:"doSubmit(1)" } );
      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>
