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

    File:        fac_locale_search_std.asp
    Description: Zoekt in Locale
                 Bedoelt voor standaard lcl-teksten die tegenwoordig in de database zitten.
    Parameters:  -
    Context:     Menu optie
    Note:        Variant op fac_locale_search.asp die het voor dialect-teksten doet
*/ %>
<!--#include file="../Shared/common.inc" -->
<!--#include file="../shared/iface.inc" -->
<!--#include file="../Shared/selector.inc" -->
<%
  FCLTHeader.Requires({plugins:["jQuery"], js: ["jquery-ui.js"]});
  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)
      {
        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_std.asp" target="workFrame">
<%      BLOCK_START("searchtable", L("lcl_filterblok"));%>
          <tr>
            <td class="searchkolom1">
              <table><!-- x rijen, 2 kolommen: label + veld -->
<%
                // taal
                var sqlA = [];
                for (var l in S("language_toggles"))
                {
                    sqlA.push("SELECT " + safe.quoted_sql(S("language_toggles")[l]) +", " + safe.quoted_sql(S("language_toggles")[l]) + " FROM DUAL");
                }
                sql = sqlA.join(" UNION ALL ");
                FCLTselector("sTaal",
                             sql,
                             { label: L("lcl_lcl_taal"),
                               trclass: "primsearch",
                               initKey: user.lang(),
                               emptyOption: L("lcl_all")
                             })
                // De 'module' zoeken we tussen de 1e en 2e slash
                sql = "WITH modxref "
                    + "        AS (SELECT SUBSTR (fac_locale_xref_filepath, "
                    + "                           INSTR (fac_locale_xref_filepath, '/') + 1, "
                    + "                             INSTR (fac_locale_xref_filepath, "
                    + "                                    '/', "
                    + "                                    1, "
                    + "                                    2) "
                    + "                           - INSTR (fac_locale_xref_filepath, '/') "
                    + "                           - 1) "
                    + "                      module, "
                    + "                   fac_locale_xref_filepath "
                    + "              FROM fac_locale_xref) "
                    + "  SELECT DISTINCT module, COALESCE (fac_module_remark, UPPER (module)) "
                    + "    FROM modxref, fac_module "
                    + "   WHERE UPPER (module) = fac_module_name(+) "
                    + "ORDER BY COALESCE (fac_module_remark, UPPER (module))";
                sql = "SELECT * FROM (" + sql + ")";
                FCLTselector("sModule",
                             sql,
                             { label: L("lcl_fac_module"),
                               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>
            <%
            CHECKBOXTR(L("lcl_lcl_overruled"), "fldlcloverruled", "lcl_overrule", false);
            %>
              </table>
            </td>
          </tr>
<%      BLOCK_END();

      var buttons = [];

      buttons.push ( {title: L("lcl_search")   , 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>
