jimmydivvy
7/7/2009 - 3:40 AM

gistfile1.txt

[@main_template]
[#include "/assessment_macros"]
[#include "/pager_macros"]
[#include "/SearchForm_custom_header"]
[#include "/SearchForm_Results"]
[#include "/SearchForm_Mobile_Results"]

[#assign searchForm = context.componentStorage.getApplicationByIdentity("applicationTest").getChildByIdentity("SearchFormCustom")]
[#assign currentSearch = request.search!{}]
[#assign assessment = currentSearch]

[#assign isLocked = false]

<script type="text/javascript">
function refresh(){} // Stub refresh so components don't cause javascript errors. KERL is not supported on search forms (yet?) so this doesn't need to do anything
</script>

	[#assign query = {}] [#-- Could also do query = {'firstName':'John', 'lastName':'Davies'} --]
    [#assign results = searchForm.performSearch( query, context.user, '', 'ASCENDING' ) ]
    [#assign mapping = searchForm.vocabComponentMapping]

    [#assign pagerView = viewResolver.getView("Pager")]
    [#assign pager = pagerView.getPager( results, 30 )]

        <a name="results"/>

        <form method="POST" action="${here.domainURL}/SearchForm_csv">
            
            <input type="hidden" name="search_form_uid" value="${here.get('component').UID}"/>
                        
            [#list currentSearch?keys as key]                
                    [#assign value = currentSearch[key]!]
                    [#if value?has_content]
                        [#if value?is_sequence]
                            [#list value as item]
                                <input type="hidden" name="search.${key?html}:record:list" value="${item?html}"/>
                            [/#list]
                        [#else]
                            <input type="hidden" name="search.${key?html}:record" value="${value?html}"/>                                                    
                        [/#if]                                            
                    [/#if]                
            [/#list]
            
            [#if ! isMobile]
            <div class="field">
                <input type="submit" value="Export as CSV"/>
            </div>
            [/#if]
            
        </form>

        [#if isMobile]
            [@mobile_search_results results/]
        [#else]
            [@search_results results/]
        [/#if]

    <script type="text/javascript">location.hash="results"</script>

[/@main_template]