{$context->oPage->requireJSResource("resources/js/taillog.js")}
{$context->oPage->requireJSResource("resources/js/constructed_search.js")}

{$context->oPage->requireJSResource("resources/js/kt3calendar.js")}
{$context->oPage->requireJSResource("thirdpartyjs/jscalendar-1.0/calendar.js")}
{$context->oPage->requireJSResource("thirdpartyjs/jscalendar-1.0/lang/calendar-en.js")}
{$context->oPage->requireJSResource("thirdpartyjs/jscalendar-1.0/calendar-setup.js")}
{$context->oPage->requireCSSResource("thirdpartyjs/jscalendar-1.0/calendar-system.css")}

{capture assign=sJS}
{literal}
function testStartup() {
    simpleLog('INFO','Log initialised.');
}

addLoadEvent(testStartup);
{/literal}
{/capture}
{$context->oPage->requireJSStandalone($sJS)}

{capture assign=sCSS}
{literal}
fieldset { border: 1px dotted #999; }
legend { border: 1px dotted #999;}

.helpText { color: #666; }

/*   logging support */
#brad-log thead th { border-bottom: 1px solid black; }
#brad-log {font-size: smaller; }
#brad-log .severity-INFO { color: blue; font-weight: bold; }
#brad-log .severity-DEBUG { color: green; font-weight: bold; }
#brad-log .severity-ERROR { color: red; font-weight: bold; }
#brad-log .explanation { font-family: monospace; white-space: pre; }
{/literal}
{/capture}
{$context->oPage->requireCSSStandalone($sCSS)}

<!-- this is bad, but we really don't need a roundtrip -->
<div style="display: none" id="search-criteria-container">
    <select name="querytype">
        {foreach item=oCriteria from=$aCriteria}  {if ($oCriteria->bVisible == true)}
        <option value="{$oCriteria->getNamespace()}">{$oCriteria->headerDisplay()}</option>
		{/if}
        {/foreach}
    </select>
</div>

{capture assign=defaulttitle}
{i18n}Boolean Search{/i18n}
{/capture}
<h2>{$title|default:$defaulttitle}</h2>

<form method="POST">
    <input type="hidden" name="action" value="performSearch" />
{if $sNameTitle}
    {$sNameTitle}: <input type="text" name="name" value="" /> <br />
{/if}

{capture assign=options}
<select name="boolean_search[join]"><option value="AND">{i18n}all{/i18n}</option><option value="OR">{i18n}any{/i18n}</option></select>
{/capture}

   <p class="helpText">{i18n arg_options=$options}Return items which match &nbsp;#options# of the <strong>criteria groups</strong> specified.{/i18n}</p>    
    
    <fieldset>
        <legend>{i18n}Criteria Group{/i18n}</legend>

	{capture assign=options}
	<select name="boolean_search[subgroup][0][join]"><option value="AND">{i18n}all{/i18n}</option><option value="OR">{i18n}any{/i18n}</option></select>
	{/capture}
        <p class="helpText">{i18n arg_options=$options}Return items which match &nbsp;#options# of the criteria specified below.{/i18n}</p>

        <table class="advanced-search-form">
            <tbody>
                <tr>
                <th>{i18n}Criteria{/i18n}</th>
                <th>{i18n}Values{/i18n}</th>
                <th>&nbsp;</th>
                </tr>
                <tr>
                    <td><select name="querytype">
                         {foreach item=oCriteria from=$aCriteria} {if ($oCriteria->bVisible == true)}
                             <option value="{$oCriteria->getNamespace()}">{$oCriteria->headerDisplay()}</option>
							 {/if}
                        {/foreach}
                        </select>
                        </td>
                    <td><p class="helpText">{i18n}first select a type of query{/i18n}</p></td>
                    <td><input type="button" value="{i18n}Add{/i18n}" onclick="addNewCriteria(this);" /></td>                    
                </tr>
            </tbody>
        </table>

    </fieldset>
    
    <input type="button" value="{i18n}Add another set of criteria{/i18n}" onclick="addBooleanGroup(this)" />
    
    
{capture assign=defaultsubmit}
{i18n}Search{/i18n}
{/capture}
    <input type="submit" name="submit" value="{$searchButton|default:$defaultsubmit}" />
</form>

<!--
<table id="brad-log" width="100%">
<thead>
    <tr>
        <th width="10%">Severity</th>
        <th width="10%">Time</th>
        <th>Entry</th>
    </tr>
</thead>
<tbody>
   
</tbody>
</table>
-->

