<!DOCTYPE html >
<html lang="en">
<head>
  <title><%site_title%>: Search Form</title>
<%include include_common_head.html%>
</head>
<body id="home">
  <%~if ad_wallpaper%>
  <%ad_wallpaper%>
  <%~endif%>
  <div class="container">
    <%include include_header.html%>

    <div class="main">
      <div class="contentwrapper clearfix">
        <%include include_breadcrumb.html%>

        <section class="section section-has-widgets">
        <div class="sidebar-b">
          <%~set adsize = '300x600'%>
          <%include include_ad.html%>
        </div>
        <div class="content content-has-widgets">
          <div lass="grid">
            <div class="clearfix">
              <h1 class="float-left">Search Form</h1>
            </div>
            <%~if error%><p class="error"><%error%><%endif%>
            <h4>SEARCH SLOWTWITCH.COM KNOWLEDGE BASE</h4>
            <form action="<%config.db_cgi_url%>/search.cgi">
              <div class="dtable form">
                <div class="drow">
                  <div class="dcell name">Search</div>
                  <div class="dcell divider"></div>
                  <div class="dcell value">
                    <input type="text" id="query" name="query" class="txt lngtext" />
                  </div>
                </div>

                <div class="drow">
                  <div class="dcell name">Search Options</div>
                  <div class="dcell divider"></div>
                  <div class="dcell value">
                    <input type="radio" id="bool-and" name="bool" value="and" <%if bool eq 'and' or not bool%>checked="checked" <%endif%>class="radio" /><label for="bool-and">Results must contain all words</label>
                    <input type="radio" id="bool-or" name="bool" value="or" <%if bool eq 'or'%>checked="checked" <%endif%>class="radio" /><label for="bool-or">Results can contain any of the words</label>
                  </div>
                </div>

                <div class="drow">
                  <div class="dcell name"></div>
                  <div class="dcell divider"></div>
                  <div class="dcell value">
                    <input type="radio" id="substring-1" name="substring" value="1" <%if substring%>checked="checked" <%endif%>class="radio" /><label for="substring-1">Find similar words</label>
                    <input type="radio" id="substring-0" name="substring" value="0" <%unless substring%>checked="checked"  <%endif%>class="radio" /><label for="substring-0">Find exact words</label>
                  </div>
                </div>

                <div class="drow">
                  <div class="dcell name">Links per page</div>
                  <div class="dcell divider"></div>
                  <div class="dcell value">
                    <select id="mh" name="mh">
                      <option<%if mh == 10%> selected="selected"<%endif%>>10</option>
                      <option<%if mh == 25 or not mh%> selected="selected"<%endif%>>25</option>
                      <option<%if mh == 50%> selected="selected"<%endif%>>50</option>
                      <option<%if mh == 100%> selected="selected"<%endif%>>100</option>
                    </select>
                  </div>
                </div>
                <div class="drow actions">
                  <div class="dcell name"></div>
                  <div class="dcell divider"></div>
                  <div class="dcell value">
                    <input type="submit" value="Search" class="btn default" />
                  </div>
                </div>
              </div>
            </form>
          </div>

          <h4>Search Forums</h4>
          <form action="<%forum_url%>/forum/">
            <%hidden_form || ''%>
            <input type="hidden" name="do" value="search_results" />
            <div class="dtable form">
              <div class="drow">
                <div class="dcell name">Search</div>
                <div class="dcell divider"></div>
                <div class="dcell value">
                  <select id="search_forum" name="search_forum">
                    <option value="all"<%if not search_forum_type or search_forum_type eq all%> selected="selected"<%endif%>>All forums</option>
                    <%~set indent = '&nbsp;&nbsp;&nbsp;&nbsp;'%>
                    <%~loop everything%>
                    <%~unless forum_id%><%-- A category --%>
                    <option value="cat_<%cat_id%>"<%if search_forum_type eq cat and search_forum_id = $cat_id%> selected="selected"<%endif%>>
                    <%indent x $cat_depth%><%cat_name%> (All forums)
                    </option>
                    <%~else%>
                    <option value="forum_<%forum_id%>"<%if search_forum_type eq forum and search_forum_id = $forum_id%> selected="selected"<%endif%>>
                    <%indent x $cat_depth%>&nbsp;&nbsp;&nbsp;&nbsp;<%forum_name%>
                    </option>
                    <%~endunless%>
                    <%~endloop%>
                  </select>
                </div>
              </div>
              <div class="drow">
                <div class="dcell name">Search String</div>
                <div class="dcell divider"></div>
                <div class="dcell value">
                  <input type="text" id="search_string" name="search_string" <%if not num_results and search_string%> value="<%search_string%>"<%endif%> class="txt midtext" />
                </div>
              </div>
              <div class="drow">
                <div class="dcell name">Type of search</div>
                <div class="dcell divider"></div>
                <div class="dcell value">
                  <select id="search_type" name="search_type">
                    <option value="AND"<%if search_type eq AND%> selected="selected"<%endif%>>All words</option>
                    <option value="OR"<%if search_type eq OR%> selected="selected"<%endif%>>Any words</option>
                    <option value="PHRASE"<%if search_type eq PHRASE%> selected="selected"<%endif%>>Whole Phrase</option>
                  </select>
                </div>
              </div>
              <div class="drow">
                <div class="dcell name">Fields to search</div>
                <div class="dcell divider"></div>
                <div class="dcell value">
                  <select name="search_fields" size="1" class="button">
                    <option value="sb"<%if not search_fields or search_fields eq 'sb'%> selected<%endif%>>
                    Subject and Body
                    </option>
                    <option value="s"<%if search_fields eq 's'%> selected<%endif%>>
                    Subject
                    </option>
                    <option value="b"<%if search_fields eq 'b'%> selected<%endif%>>
                    Body
                    </option>
                    <option value="u"<%if search_fields eq 'u'%> selected<%endif%>>
                    Username
                    </option>
                  </select>
                </div>
              </div>
              <div class="drow">
                <div class="dcell name">Show posts from the last</div>
                <div class="dcell divider"></div>
                <div class="dcell value">
                  <select name="search_time" size="1" class="button">
                    <option value=""<%ifnot search_time%> selected<%endif%>>Show all posts</option>
                    <%if show_last%>
                    <option value="last"<%if search_time eq last%> selected<%endif%>>Since last visit</option>
                    <%endif%>
                    <option value="8h"<%if search_time eq 8h%> selected<%endif%>>8 hours</option>
                    <option value="24h"<%if search_time eq 24h%> selected<%endif%>>24 hours</option>
                    <option value="3d"<%if search_time eq 3d%> selected<%endif%>>3 days</option>
                    <option value="1w"<%if search_time eq 1w%> selected<%endif%>>1 week</option>
                    <option value="2w"<%if search_time eq 2w%> selected<%endif%>>2 weeks</option>
                    <option value="3w"<%if search_time eq 3w%> selected<%endif%>>3 weeks</option>
                    <option value="1m"<%if search_time eq 1m%> selected<%endif%>>1 month</option>
                    <option value="3m"<%if search_time eq 3m%> selected<%endif%>>3 months</option>
                    <option value="6m"<%if search_time eq 6m%> selected<%endif%>>6 months</option>
                    <option value="1y"<%if search_time eq 1y%> selected<%endif%>>1 year</option>
                    <option value="2y"<%if search_time eq 2y%> selected<%endif%>>2 years</option>
                  </select>
                </div>
              </div>
              <div class="drow">
                <div class="dcell name">Only show posts made by</div>
                <div class="dcell divider"></div>
                <div class="dcell value">
                  <input type="text" name="search_user_username"<%if search_user_username%> value="<%search_user_username%>"<%endif%> class="txt shotext" />
                </div>
              </div>
              <div class="drow">
                <div class="dcell name">Only show</div>
                <div class="dcell divider"></div>
                <div class="dcell value">
                  <select name="group" size="1" class="button">
                    <option value="no"<%if lc group eq 'no'%> selected<%endif%>>Posts</option>
                    <option value="yes"<%if not group or lc group eq 'yes'%> selected<%endif%>>Threads</option>
                  </select>
                </div>
              </div>
              <div class="drow">
                <div class="dcell name">Sort posts by</div>
                <div class="dcell divider"></div>
                <div class="dcell value">
                  <select name="sb" size="1" class="button">
                    <option value="post_time"<%if not sb or sb eq 'post_time'%> selected<%endif%>>Post date</option>
                    <option value="score"<%if sb eq 'score'%> selected<%endif%>>Relevance</option>
                  </select>
                </div>
              </div>
              <div class="drow">
                <div class="dcell name">Number of results per page</div>
                <div class="dcell divider"></div>
                <div class="dcell value">
                  <select id="mh" name="mh">
                    <option<%if mh == 10%> selected="selected"<%endif%>>10</option>
                    <option<%if mh == 25 or not mh%> selected="selected"<%endif%>>25</option>
                    <option<%if mh == 50%> selected="selected"<%endif%>>50</option>
                    <option<%if mh == 100%> selected="selected"<%endif%>>100</option>
                  </select>
                </div>
              </div>
              <div class="drow actions">
                <div class="dcell name"></div>
                <div class="dcell divider"></div>
                <div class="dcell value">
                  <input type="submit" value="Search" class="btn default" />
                </div>
              </div>
            </div>
          </form>
        </div><!-- end content -->
        </section><!-- end section -->

        <div class="section-spacer"></div>

      </div><!-- End contentwrapper -->
    </div>
    <%include include_footer.html%>
  </div>
</body>
<%~include include_global_js.html%>
