## Número de resultado que mostraremos por página
#set ($numResults4Page = 2)
#set ($muvas = $portal.getClass().forName("es.muvas.MuvasSemanticServices").newInstance())
#set($museum = $httpUtil.getParameter($httpUtil.decodeURL($request.attributes.CURRENT_URL), "museum", false))
#set($author = $httpUtil.getParameter($httpUtil.decodeURL($request.attributes.CURRENT_URL), "author", false))
#set($type = $httpUtil.getParameter($httpUtil.decodeURL($request.attributes.CURRENT_URL), "type", false))
#set($topic = $httpUtil.getParameter($httpUtil.decodeURL($request.attributes.CURRENT_URL), "topic", false))
#set($search = $httpUtil.getParameter($httpUtil.decodeURL($request.attributes.CURRENT_URL), "search", false))
#set ($page = $getterUtil.getInteger($httpUtil.getParameter($httpUtil.decodeURL($request.attributes.CURRENT_URL), "page", false)))
#set ($renderUrlWithoutPage = $stringUtil.remove($httpUtil.decodeURL($request.attributes.CURRENT_URL), "&page=$page",""))
#if ($page == 0)
#set ($page = 1)
#end
#set ($company = ""+$companyId)
#set ($renderUrl = $request.get("render-url"))
#set ($namespace = $request.get("portlet-namespace"))
#set ($museums = $muvas.findMuseums())
#set ($authors = $muvas.findAuthors())
#set ($types = $muvas.fingTypes())
#set ($topics = $muvas.fingTopics())
<form action="$renderUrl" method="get" name="${namespace}fm2">
<label for="museum">Museo: </label>
<select name="museum" id="museum">
#if($museum == "")
<option selected="selected" value="">Todas</option>
#else
<option value="">Todas</option>
#end
#foreach ($each in $museums)
#if($museum == $each.id)
<option selected="selected" value="$each.id">$each.title</option>
#else
<option value="$each.id">$each.title</option>
#end
#end
</select>
<label for="author">Autor: </label>
<select name="author" id="author">
#if($author == "")
<option selected="selected" value="">Todas</option>
#else
<option value="">Todas</option>
#end
#foreach ($each in $authors)
#if($author == $each.id)
<option selected="selected" value="$each.id">$each.title</option>
#else
<option value="$each.id">$each.title</option>
#end
#end
</select>
<label for="type">Tipo: </label>
<select name="type" id="type">
#if($type == "")
<option selected="selected" value="">Todas</option>
#else
<option value="">Todas</option>
#end
#foreach ($each in $types)
#if($type ==$each)
<option selected="selected" value="$each">$each</option>
#else
<option value="$each">$each</option>
#end
#end
</select>
<label for="topic">Tema: </label>
<select name="topic" id="topic">
#if($topic == "")
<option selected="selected" value="">Todas</option>
#else
<option value="">Todas</option>
#end
#foreach ($each in $topics)
#if($topic == $each)
<option selected="selected" value="$each">$each</option>
#else
<option value="$each">$each</option>
#end
#end
</select>
<label for="search">Búsqueda: </label>
<input type="text" value="$!search" id="search" name="search"/>
<input type="submit" value="Buscar"/>
</form>
#if ($search && $search.trim() != "")
<div class="results-grid">
<table class="taglib-search-iterator">
<tr class="portlet-section-header results-header">
<th class="col-1">#</th>
<th class="col-2">Nombre</th>
<th class="col-3">Contenido</th>
</tr>
#set($articlesVisorBaseUrl = "/web/guest/article/-/journal_content/56_INSTANCE_2ABK/")
$museum
$author
$type
$topic
$muvas.searchJournalArticlesPiece($company, "", "", "", "", $search).length
#set($searchContainer = $muvas.searchJournalArticlesPiece($company, $museum, $author, $type, $topic, $search))
#set ($results = $searchContainer.getResults($numResults4Page, $page))
#set ($numPages = $searchContainer.getNumPages($numResults4Page))
#foreach ($result in $results)
#set ($articleUrl = $articlesVisorBaseUrl + $result.groupId + "/" + $result.articleId)
#if ($velocityCount % 2 == 0)
<tr class="portlet-section-alternate results-row alt"
onmouseover="this.className = 'portlet-section-alternate-hover results-row alt hover';" onmouseout="this.className = 'portlet-section-alternate results-row alt';">
<td align="left" class="col-1" colspan="1" valign="middle">
$result.index.
</td>
<td align="left" class="col-2" colspan="1" valign="middle">
$result.titlehighlight
</td>
<td align="left" class="col-3" colspan="1" valign="middle">
$result.content
<br />
<span style="font-size: xx-small;">
<br /><a title="Ver artículo: $result.title" href="$articleUrl">$result.title</a>
</span>
</td>
</tr>
#else
<tr class="portlet-section-body results-row"
onmouseover="this.className = 'portlet-section-body-hover results-row hover';" onmouseout="this.className = 'portlet-section-body results-row';">
<td align="left" class="col-1" colspan="1" valign="middle">
$result.index.
</td>
<td align="left" class="col-2" colspan="1" valign="middle">
$result.titlehighlight
</td>
<td align="left" class="col-3" colspan="1" valign="middle">
$result.content
<br />
<span style="font-size: xx-small;">
<br /><a title="Ver artículo: $result.title" href="$articleUrl">$result.title</a>
</span>
</td>
</tr>
#end
#end
</table>
#if ($searchContainer.length > 0)
<div class="taglib-search-iterator-page-iterator-bottom">
<div class="taglib-page-iterator">
#set ($last= $results.size() - 1)
<div class="search-results">
#set ($beginIndex = $results.get(0).index)
#set ($lastIndex = $results.get($last).index)
#if ($beginIndex == $lastIndex)
Mostrando resultado $beginIndex de $searchContainer.length resultados.
#else
Mostrando resultados $beginIndex - $lastIndex de $searchContainer.length resultados.
#end
</div>
<div class="search-pages">
<div class="delta-selector"> Items per Page
<select>
<option value="5">5</option>
<option value="10">10</option>
<option selected="selected" value="20">20</option>
<option value="30">30</option>
<option value="50">50</option>
<option value="75">75</option>
</select>
</div>
<script type="text/javascript">
function _submitMyPageIterator() {
var curValue = jQuery("option:selected", this).val();
var href = "${renderUrlWithoutPage}&page="+curValue;
location.href = href;
}
jQuery(
function() {
jQuery('.page-selector-select').change(_submitMyPageIterator);
}
);
</script>
<div class="page-selector"> Página
<select class="page-selector-select">
#foreach ($i in [1..$numPages])
#if ($i == $page)
<option selected="selected" value="$i">$i</option>
#else
<option value="$i">$i</option>
#end
#end
</select> de $numPages
</div>
<div class="page-links">
#set ($prev = $page - 1)
#set ($next = $page + 1)
#if ($page == 1)
<span class="first"> Primero </span>
<span class="previous"> Anterior </span>
#else
<a class="first" href="$httpUtil.addParameter($renderUrlWithoutPage, "page", 1)"> Primero </a>
<a class="previous" href="$httpUtil.addParameter($renderUrlWithoutPage, "page", $prev)"> Anterior </a>
#end
#if ($numPages == $page)
<span class="next"> Siguiente </span>
<span class="last"> Último </span>
#else
<a class="next" href="$httpUtil.addParameter($renderUrlWithoutPage, "page", $next)"> Siguiente </a>
<a class="last" href="$httpUtil.addParameter($renderUrlWithoutPage, "page", $numPages)"> Último </a>
#end
</div>
</div>
</div>
</div>
#end
</div>
#end
martes, 16 de junio de 2009
Liferay: Mi buscador avanzado
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario