<{*
$http_vars: association array of parameters to send to next page
$i: general
$ids: ids of all items to display
$item_htmls: information of items(association array).
    array( 'selected' => (1:checked 0:not checked),
           'html'     => (summary of item in HTML),
           'item_id'  => id of item )
$item_per_page:      number of items displaying a page
$submit_url URL to go when submit
$maxpage
$order_by_select
$page
$page_no_label
$search_var[]:   array of parameter names that send in submit.
$selected
$search_tabs tabname of [item] [metadata] and [file] array('label'=>tab label,'count'=>nuber of result in the tab)
$search_tab 
$url_for_get:    url for displaying this page directly
$export_enabled: when items in this page can export, this parameter is defined.
*}>

<script type="text/javascript" src="js/prototype.js">
</script>

<h3><{$smarty.const._MD_XOONIPS_ITEM_LISTING_ITEM}></h3>

<{if !empty($error_message) }>
<span style='color:#ff0000;'><{$error_message}></span>
<{else}>
<form id="xoonips_itemselect" action="" method="post">
<{if isset($indexes) }>
<{$smarty.const._MD_XOONIPS_ITEM_INDEX_LABEL}>&nbsp;
<{foreach item=index from=$indexes}>
 / <a href="javascript:void(0);" onclick="$('xoonips_hidden_index_id').value=<{$index.index_id}>; $('xoonips_hidden_op').value='select_item_index'; $('xoonips_itemselect').submit();"><{$index.title}></a>
<{/foreach}>
<{/if}>
<br />
<br />

<input type='hidden' id='xoonips_hidden_op' name='op' value='<{$op}>_pagenavi' />
<{include file="db:xoonips_item_list_header.html"
 order_by=$order_by
 order_dir=$order_dir
 item_per_page=$item_per_page form_id="xoonips_itemselect"}>

<{if $op=='select_item_index'}>
<{$smarty.const._MD_XOONIPS_ITEM_SELECT_INDEX_LABEL}>
<select id='xoonips_select_index' name='index_id'
    onchange="$('xoonips_hidden_index_id').value=$('xoonips_select_index').options[$('xoonips_select_index').selectedIndex].value; $('xoonips_hidden_op').value='select_item_index'; $('xoonips_itemselect').submit();">
<{foreach item=index from=$indexes_to_select}>
 <option id='xoonips_select_index_id_<{$index.id}>' value='<{$index.id}>' <{if $index.id==$index_id}>selected="selected"<{/if}>><{$index.name|indent:$index.depth:"&nbsp;&nbsp;"}>(<{$index.number_of_items}>)</option>
<{/foreach}>
</select>
<{/if}>

<{if $op=='select_item_index'}>
<{include file="db:xoonips_pagenavi.html" maxpage=$maxpage page=$page pages=$pages form_id="xoonips_itemselect" pagenavi_extra_onclick="$('xoonips_hidden_op').value='select_item_index_pagenavi';"}>
<{elseif $op=='select_item_useritem'}>
<{include file="db:xoonips_pagenavi.html" maxpage=$maxpage page=$page pages=$pages form_id="xoonips_itemselect" pagenavi_extra_onclick="$('xoonips_hidden_op').value='select_item_useritem_pagenavi';"}>
<{elseif $op=='select_item_advancedsearch'}>
<{include file="db:xoonips_pagenavi.html" maxpage=$maxpage page=$page pages=$pages form_id="xoonips_itemselect" pagenavi_extra_onclick="$('xoonips_hidden_op').value='select_item_advancedsearch_pagenavi';"}>
<{else}>
<{include file="db:xoonips_pagenavi.html" maxpage=$maxpage page=$page form_id="xoonips_itemselect"}>
<{/if}>

<{if count( $item_htmls ) > 0 }>
<input type='hidden' id='xoonips_page' name='page' value='<{$page}>' />
<input id='xoonips_button_select' class="formButton" type="submit"
 value="<{$smarty.const._MD_XOONIPS_ITEM_SELECT_BUTTON_LABEL}>"
 onclick="$('xoonips_itemselect').action='<{$submit_url}>'; $('xoonips_hidden_op').value='add_selected_item'" />
<input id='xoonips_button_cancel' class="formButton" type="submit"
 value="<{$smarty.const._MD_XOONIPS_ITEM_SELECT_CANCEL_BUTTON_LABEL}>"
 onclick="$('xoonips_itemselect').action='<{$submit_url}>'; $('xoonips_hidden_op').value=''" />

<table width="100%" border="0" cellspacing="5">
<{* item / file List *}>
<{foreach item=i from=$item_htmls}>
  <tr style="vertical-align: top;">
    <td class="<{cycle values="odd,even" name="cycle1"}>" style="text-align: center;">
     <{if $i.selected==1}>
     <input id='xoonips_checkbox_<{$i.item_id}>' type='checkbox' name='selected[]' value='<{$i.item_id}>' checked="checked" />
     <{else}>
     <input id='xoonips_checkbox_<{$i.item_id}>' type='checkbox' name='selected[]' value='<{$i.item_id}>' />
     <{/if}>
    </td>
    <td class="<{cycle values="odd,even" name="cycle2"}>">
     <{$i.html}>
    </td>
  </tr>
<{/foreach}>
</table>

<input id='xoonips_button_select2' class="formButton" type="submit"
 value="<{$smarty.const._MD_XOONIPS_ITEM_SELECT_BUTTON_LABEL}>"
 onclick="$('xoonips_itemselect').action='<{$submit_url}>'; $('xoonips_hidden_op').value='add_selected_item'" />
<input id='xoonips_button_cancel2' class="formButton" type="submit"
 value="<{$smarty.const._MD_XOONIPS_ITEM_SELECT_CANCEL_BUTTON_LABEL}>"
 onclick="$('xoonips_itemselect').action='<{$submit_url}>'; $('xoonips_hidden_op').value=''" />

<{else}>
<input id='xoonips_button_back' class="formButton" type="submit"
 value="<{$smarty.const._MD_XOONIPS_ITEM_BACK_BUTTON_LABEL}>"
 onclick="$('xoonips_itemselect').action='<{$submit_url}>'; $('xoonips_hidden_op').value='add_selected_item'" />
<{/if}><{* if count( $item_htmls ) > 0 *}>

<{foreach key=k item=v from=$http_vars}>
<input type="hidden" name="<{$k}>" value="<{$v}>" />
<{/foreach}>
<{foreach item=id from=$selected_hidden}>
<input type="hidden" name="selected_hidden[]" value="<{$id}>" />
<{/foreach}>
<{foreach item=id from=$selected_original}>
<input type="hidden" name="selected_original[]" value="<{$id}>" />
<{/foreach}>
<{foreach item=id from=$initially_selected}>
<input type="hidden" name="initially_selected[]" value="<{$id}>" />
<{/foreach}>
<{foreach item=i from=$query_var_name}>
<input type="hidden" name="query_var_name[]" value="<{$i}>" />
<{/foreach}>
<{foreach item=i from=$search_var}>
<input type="hidden" name="search_var[]" value="<{$i}>" />
<{/foreach}>
<input type="hidden" name="submit_url" value="<{$submit_url}>" />

<input type="hidden" id='xoonips_hidden_index_id' name="index_id" value="<{$index_id}>" />
<input type="hidden" name="search_cache_id" value="<{$search_cache_id}>" />

<{if $op=='select_item_index'}>
<{include file="db:xoonips_pagenavi.html" maxpage=$maxpage page=$page pages=$pages form_id="xoonips_itemselect" pagenavi_extra_onclick="$('xoonips_hidden_op').value='select_item_index_pagenavi';"}>
<{elseif $op=='select_item_useritem'}>
<{include file="db:xoonips_pagenavi.html" maxpage=$maxpage page=$page pages=$pages form_id="xoonips_itemselect" pagenavi_extra_onclick="$('xoonips_hidden_op').value='select_item_useritem_pagenavi';"}>
<{elseif $op=='select_item_advancedsearch'}>
<{include file="db:xoonips_pagenavi.html" maxpage=$maxpage page=$page pages=$pages form_id="xoonips_itemselect" pagenavi_extra_onclick="$('xoonips_hidden_op').value='select_item_advancedsearch_pagenavi';"}>
<{else}>
<{include file="db:xoonips_pagenavi.html" maxpage=$maxpage page=$page form_id="xoonips_itemselect"}>
<{/if}>
<{include file="db:xoonips_extra_param.html" extra_param=$extra_param}>
</form>

<{/if}>

<!-- end module search results loop -->
