COM-FSM
Template:MindTouch > Reports > Controls > SearchAnalyticsFilter

SearchAnalyticsFilter

Page last modified 14:15, 31 Oct 2010 by Admin
    Table of contents
    No headers
    /**
     * Search Analytics Filter
     */
    var uri = $uri;
    var preserve = $params;
    var searchQuery = $query;
    var searchTerm = $term;
    var sinceDays = $since;
    var beforeDays = $before;
    
    // 1 week ago, 30 days ago, 90 days ago, 1 year ago
    var dateOptions = [
        {value: 7, label: wiki.localize("MindTouch.SearchAnalytics.option.weekago")},
        {value: 30, label: wiki.localize("MindTouch.SearchAnalytics.option.daysago-30")},
        {value: 90, label: wiki.localize("MindTouch.SearchAnalytics.option.daysago-90")},
        {value: 365, label: wiki.localize("MindTouch.SearchAnalytics.option.yearago")}
    ];
    
    <form class="mt-search-input" method="get" action=(uri)>
        foreach (var paramName:paramValue in preserve where paramName != "term") {
            <input type="hidden" name=(paramName) value=(paramValue) />
        }
        if (searchQuery) {
            <input type="hidden" name="query" value=(searchQuery) />
    
            // user is on the detailed view, provide a back link
            <span class="back">
                <a href=(uri & preserve & {term: searchTerm})>
                    wiki.localize("MindTouch.SearchAnalytics.detail.back");
                </a>
            </span>
        } else {
            <input class="term" type="hidden" name="term" value=(searchTerm) />    
        }
        <label>wiki.localize("MindTouch.SearchAnalytics.search.filter-queries")</label>
        <select name="since_days">
            foreach (var option in dateOptions) {
                <option value=(option.value) selected=(sinceDays == option.value ? "selected" : _)>
                   option.label;
                </option>
            }
        </select>
        <span class="mt-report-search-to">
            wiki.localize("MindTouch.SearchAnalytics.search.to");
        </span>
        <select name="before_days">
            <option value="0" selected=(beforeDays == 0 ? "selected" : _)>
                wiki.localize("MindTouch.SearchAnalytics.option.today");
            </option>
            foreach (var option in dateOptions) {
                <option value=(option.value) selected=(beforeDays == option.value ? "selected" : _)>
                   option.label;
                </option>
            }
        </select>
        <input class="search" type="submit" value=(wiki.localize("MindTouch.SearchAnalytics.search.button")) />
    </form>
    
    // clear current search
    if (searchTerm || searchQuery) {
        <div class="reset-search">
            <a href=(uri & preserve & {since_weeks: nil, before_weeks: nil})>
                wiki.localize("MindTouch.SearchAnalytics.search.reset");
            </a>
        </div>
    }
    Powered by MindTouch Core