[opencms-dev] Show content expired or unreleased in online mode

Yamit David Moreno Socha yamit.moreno at uptc.edu.co
Tue Nov 21 17:01:14 CET 2017


Hi Kai, thanks for your help

i'm modifying "events" and they shown in normal font and this are in folder
"./content/events/"
i have 50 events and i modified only one event from context menu "Date
released" = 11/29/17 09:29 AM and "Date expired" = 12/1/17 09:29 AM and it
shown in italic font i did same with other event but i created those same
dates from  nav tab "avability" located in "content" of event and it shown
in normal font, i deleted those dates from other events and i publish they
after

In System element "list of content" i add the path on option "Folder" =
"./content/events/" and the Sorl query in "Filter options" =
"&fq=released:[NOW TO NOW+10MONTH]" without this query the list show all
events exept the event with dates created in context menu
"Advanced->Availability" it shown only in offline mode



********************************************************************************************

event.xsd source (path: /system/modules/org.opencms.apollo/schemas/)

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">

<xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd" />
<xsd:include
schemaLocation="opencms://system/modules/org.opencms.apollo/schemas/nested/paragraph.xsd"
/>
<xsd:include
schemaLocation="opencms://system/modules/org.opencms.apollo/schemas/nested/address.xsd"
/>
<xsd:include
schemaLocation="opencms://system/modules/org.opencms.apollo/schemas/nested/availability.xsd"
/>

<xsd:element name="ApolloEvents" type="OpenCmsApolloEvents" />

<xsd:complexType name="OpenCmsApolloEvents">
<xsd:sequence>
<xsd:element name="ApolloEvent" type="OpenCmsApolloEvent" minOccurs="0"
maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="OpenCmsApolloEvent">
<xsd:sequence>
<xsd:element name="Title" type="OpenCmsString" />
<xsd:element name="Date" type="OpenCmsDateTime" />
<xsd:element name="EndDate" type="OpenCmsDateTime" minOccurs="0" />
<xsd:element name="Type" type="OpenCmsString" minOccurs="0" />
<xsd:element name="Teaser" type="OpenCmsString" minOccurs="0" />
<xsd:element name="Paragraph" type="OpenCmsApolloParagraph" maxOccurs="5" />
<xsd:element name="Location" type="OpenCmsString" minOccurs="0" />
<xsd:element name="Address" type="OpenCmsHtml" minOccurs="0" />
<xsd:element name="AddressDetails" type="OpenCmsApolloAddress"
minOccurs="0" />
<xsd:element name="Category" type="OpenCmsDynamicCategory" />
<xsd:element name="Availability" type="OpenCmsApolloAvailability"
minOccurs="0" />
<xsd:element name="GalleryTitle" type="OpenCmsString" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="language" type="OpenCmsLocale" use="required" />
</xsd:complexType>

<xsd:annotation>
<xsd:appinfo>
<resourcebundle name="org.opencms.apollo.template.event.messages" />
<tabs>
<tab element="Title" collapse="false" name="TabGeneral" />
<tab element="Location" collapse="false" name="TabLocation" />
<tab element="Category" collapse="true" name="TabAvailability" />
</tabs>
<mappings>
<mapping element="GalleryTitle" mapto="property:Title" useDefault="true" />
<mapping element="GalleryTitle" mapto="urlName" useDefault="true" />
<!--mapping element="Availability/Release" mapto="attribute:datereleased" />
<mapping element="Availability/Expiration" mapto="attribute:dateexpired" /
-->
</mappings>
<defaults>
<default element="Title" value="%(key.title.a-event)" />
<default element="Paragraph/Text" value="%(key.apollo.event.default.Text)"
/>
<default element="Date" value="%(currenttime)" />
<default element="EndDate" value="%(currenttime + 604800000)" />
<default element="Availability/Release" value="%(currenttime)" />
<default element="Availability/Expiration" value="%(currenttime +
31536000000)" />
<default element="GalleryTitle" value="%(value:Title)"
resolveMacros="false" />
</defaults>
<layouts>
<layout element="Teaser" widget="TextareaWidget" configuration="4" />
<layout element="Category" widget="CategoryWidget"
configuration="onlyleafs=false" />
</layouts>
<validationrules>
<rule element="Title" regex=".+" type="error" message="Title must not be
empty." />
</validationrules>
<relations>
<relation element="Paragraph/Image/Image" invalidate="parent" />
</relations>
<searchsettings containerPageOnly="false">
<searchsetting element="Date" searchcontent="false">
<solrfield targetfield="event-date" sourcefield="*_dt" />
<solrfield targetfield="newsdate" sourcefield="*_dt" />
</searchsetting>
<searchsetting element="Title" searchcontent="false">
<solrfield targetfield="disptitle" sourcefield="*_s" />
</searchsetting>
<searchsetting element="Type">
<solrfield targetfield="event-type" sourcefield="*_s" />
</searchsetting>
<searchsetting element="Location">
<solrfield targetfield="event-location" sourcefield="*_s" />
</searchsetting>
<searchsetting element="AddressDetails/Locality">
<solrfield targetfield="event-locality" sourcefield="*_s" />
</searchsetting>
<searchsetting element="GalleryTitle" searchcontent="false" />
</searchsettings>
<visibilities>
<visibility element="GalleryTitle" params="ROLE.GALLERY_EDITOR" />
</visibilities>
<editorchangehandlers>
<editorchangehandler
class="org.opencms.ade.contenteditor.CmsEditorChangeHandlerProperty"
scope="Paragraph*/Image*/Image" configuration="Copyright|../Copyright" />
</editorchangehandlers>
</xsd:appinfo>
</xsd:annotation>

</xsd:schema>

******************************************************************************************************************************************************

List source (controlcode)

<?xml version="1.0" encoding="UTF-8"?>

<ApolloLists xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="opencms://system/modules/org.opencms.apollo/schemas/list.xsd">
  <ApolloList language="en">
    <Headline><![CDATA[Eventos]]></Headline>

<TypesToCollect>a-event:194e26bc-c5b6-11e5-a73e-0242ac11002b</TypesToCollect>
    <Folder>
      <link type="WEAK">
        <target><![CDATA[/sites/default/.content/eventos/]]></target>
        <uuid>03dc9088-463f-11e7-8919-52540022b94b</uuid>
      </link>
    </Folder>
    <Category>
      <!--Categories are read dynamically-->
    </Category>
    <SortOrder><![CDATA[dateasc]]></SortOrder>
    <ItemsPerPage><![CDATA[15]]></ItemsPerPage>
    <Parameters>
      <Key><![CDATA[teaserLength]]></Key>
      <Value><![CDATA[1]]></Value>
    </Parameters>
    <Parameters>
      <Key><![CDATA[displayOption]]></Key>
      <Value><![CDATA[showCalendar]]></Value>
    </Parameters>
    <Parameters>
      <Key><![CDATA[entryButtonText]]></Key>
      <Value><![CDATA[Ver evento]]></Value>
    </Parameters>
    <Parameters>
      <Key><![CDATA[listWrapper]]></Key>
      <Value><![CDATA[eventsList]]></Value>
    </Parameters>
    <Parameters>
      <Key><![CDATA[showExpired]]></Key>
      <Value><![CDATA[true]]></Value>
    </Parameters>
    <FilterQueries><![CDATA[&fq=released:[NOW TO
NOW+10MONTH]]]></FilterQueries>
  </ApolloList>
</ApolloLists>

*****************************************************************************************************************************

event-teaser-elaborate.jsp source (path
/system/modules/org.opencms.apollo/formatters/)

<%@page
    buffer="none"
    session="false"
    trimDirectiveWhitespaces="true"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="apollo" tagdir="/WEB-INF/tags/apollo" %>

<cms:secureparams />
<apollo:init-messages>

<cms:formatter var="content" val="value">
<fmt:setLocale value="${cms.locale}" />
<cms:bundle basename="org.opencms.apollo.template.event.messages">

<c:set var="paragraph" value="${content.valueList.Paragraph['0']}" />
<c:set var="teaserLength" value="${cms.element.settings.teaserLength}" />
<c:set var="showDate" value="${cms.element.settings.showDate}" />
<c:set var="baseUri" value="${cms.element.settings.pageUri}" />

<c:set var="showImageLarge" value="${paragraph.value.Image.exists and
(cms.element.settings.displayOption == 'largeImage')}" />
<c:set var="showImageSmall" value="${paragraph.value.Image.exists and
(cms.element.settings.displayOption == 'smallImage')}" />
<c:set var="showCalendar" value="${cms.element.settings.displayOption ==
'showCalendar'}" />

<c:choose>
    <c:when test="${showImageSmall}">
        <c:set var='divStart' value='<div class="col-sm-4 hidden-xs
teaser-visual">' />
        <c:set var='divCenter' value='</div><div class="col-sm-8
teaser-body">' />
        <c:set var='divEnd' value='</div>' />
        <c:set var="animationClass" value="${cms.element.settings.ieffect
!= 'none' ? cms.element.settings.ieffect : ''}" />
    </c:when>
    <c:when test="${showCalendar}">
        <c:set var='divStart' value='<div class="fixcol-sm-125 hidden-xs
teaser-visual">' />
        <c:set var='divCenter' value='</div><div class="col-xs-12
fixcol-sm-125-rest teaser-body">' />
        <c:set var='divEnd' value='</div>' />
        <c:set var="animationClass" value="ap-raise-animation " />
    </c:when>
    <c:otherwise>
        <c:set var='divStart' value='' />
        <c:set var='divCenter' value='<div class="col-xs-12 teaser-body">'
/>
        <c:set var='divEnd' value='</div>' />
        <c:set var="animationClass" value="${cms.element.settings.ieffect
!= 'none' ? cms.element.settings.ieffect : ''}" />
    </c:otherwise>
</c:choose>

<div class="row ap-teaser ap-event-teaser ${animationClass}${'
'}${cms.element.settings.cssWrapper}">

    <c:if test="${showImageSmall or showCalendar}">
        <c:out value="${divStart}" escapeXml="false" />
        <a class="link" href="<cms:link
baseUri="${baseUri}">${content.filename}</cms:link>" >
            <c:choose>
                <%-- ####### Show small image ######## --%>
                <c:when test="${showImageSmall}">
                    <apollo:image-animated image="${paragraph.value.Image}"
/>
                </c:when>
                <%-- ####### Show calendar sheet ######## --%>
                <c:otherwise>
                    <div class="calendar-sheet animated-box">
                        <div class="day">
                            <fmt:formatDate
value="${cms:convertDate(content.value.Date)}"
                                pattern="EEEE" type="date" />
                        </div>
                        <h3>
                            <fmt:formatDate
value="${cms:convertDate(content.value.Date)}"
                                pattern="d" type="date" />
                        </h3>
                        <div class="monthYear">
                            <fmt:formatDate
value="${cms:convertDate(content.value.Date)}"
                                pattern="MMM yyyy" type="date" />
                        </div>
                    </div>
                </c:otherwise>
            </c:choose>
        </a>
    </c:if>

    <c:out value="${divCenter}" escapeXml="false" />

        <c:if test="${showImageLarge}">
            <c:set var="imgLink"><cms:link
baseUri="${baseUri}">${content.filename}</cms:link></c:set>
            <a href="${imgLink}" class="event-image"><apollo:image-animated
image="${paragraph.value.Image}" /></a>
        </c:if>

        <c:set var="text">${content.value.Teaser}</c:set>
        <c:if test="${empty text}"><c:set
var="text">${cms:trimToSize(cms:stripHtml(paragraph.value.Text),
teaserLength)}</c:set></c:if>
        <c:set var="href"><cms:link
baseUri="${baseUri}">${content.filename}</cms:link></c:set>

        <apollo:teaserbody
            text="${text}"
            textlength="${teaserLength}"
            title="${content.value.Title}"
            href="${href}"
            date="${content.value.Date}"
            enddate="${content.value.EndDate}"
            showdate="${showDate}"
        />

    <c:out value="${divEnd}" escapeXml="false" />

</div>

</cms:bundle>
</cms:formatter>

</apollo:init-messages>

Thank you so much

Regards

Yamit Moreno

-- 
*AVISO DE CONFIDENCIALIDAD*: Este mensaje y sus adjuntos se dirigen 
exclusivamente a su destinatario, puede contener información privilegiada o 
confidencial y es para uso exclusivo de la persona o entidad de destino. Si 
no es usted. el destinatario indicado, queda notificado de que la lectura, 
utilización, divulgación y/o copia sin autorización puede estar prohibida 
en virtud de la legislación vigente. Si ha recibido este mensaje por error, 
le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda 
a su destrucción. 

*CONFIDENTIALITY NOTICE*: The information contained in this transmission is 
privileged and confidential information intended only for the use of the 
individual or entity named above. If the reader of this message is not the 
intended recipient, you are hereby notified that any dissemination, 
distribution or copying of this communication is strictly prohibited. If 
you have received this transmission in error, do not read it. Please 
immediately reply to the sender that you have received this communication 
in error and then delete it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20171121/a7f1d68e/attachment.htm>


More information about the opencms-dev mailing list