martes, 16 de junio de 2009

Liferay: Mi visor 2


## Número de resultado que mostraremos por página

#set ($numResults4Page = 2)



#set ($muvas = $portal.getClass().forName("es.muvas.MuvasSemanticServices").newInstance())

#set($tags= $httpUtil.getParameter($httpUtil.decodeURL($request.attributes.CURRENT_URL), "tags", false))



#set($minusTags= $httpUtil.getParameter($httpUtil.decodeURL($request.attributes.CURRENT_URL), "minusTags", 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",""))

#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"))



## Comienzo div principal

<div class="results-grid">



#set($articlesVisorBaseUrl = "/web/guest/article/-/journal_content/56_INSTANCE_2ABK/")

#set($searchContainer = $muvas.searchJournalArticles($company, $tags, $minusTags, ""))

#set ($results = $searchContainer.getResults($numResults4Page, $page))

#set ($numPages = $searchContainer.getNumPages($numResults4Page))

#foreach ($result in $results)

#set ($articleUrl = $articlesVisorBaseUrl + $result.groupId +  "/" + $result.articleId)



#set($muvasArticle = $muvas.getMuvasArticle($result.groupId, $result.articleId))

<h3>$result.title</h3>



#if($muvasArticle.getIGImage())

          <a class="mini_photo" href="$muvasArticle.imageURL"><img alt="$muvasArticle.getIGImage().description" title="$muvasArticle.getIGImage().name" src="/image/image_gallery?img_id=${muvasArticle.getIGImage().smallImageId}"></a>

#end



<div>

$muvasArticle.description

</div>



<div>

<a title="Ver artículo: $result.title" href="$articleUrl">$result.title</a>

</div>



#end



#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>

No hay comentarios: