Revision: 26491
Author:   bleunis
Date:     2011-01-14 17:40:09 +0100 (Fri, 14 Jan 2011)
Log Message:
-----------
GOGREEN-337 component and jsp

Added Paths:
-----------
    
hippo-demos/hippo-go-green/trunk/site/src/main/java/com/onehippo/gogreen/components/common/Newsletter.java
    
hippo-demos/hippo-go-green/trunk/site/src/main/webapp/WEB-INF/jsp/common/newsletter-detail.jsp

Copied: 
hippo-demos/hippo-go-green/trunk/site/src/main/java/com/onehippo/gogreen/components/common/Newsletter.java
 (from rev 26490, 
hippo-demos/hippo-go-green/trunk/site/src/main/java/com/onehippo/gogreen/components/AboutList.java)
===================================================================
--- 
hippo-demos/hippo-go-green/trunk/site/src/main/java/com/onehippo/gogreen/components/common/Newsletter.java
                          (rev 0)
+++ 
hippo-demos/hippo-go-green/trunk/site/src/main/java/com/onehippo/gogreen/components/common/Newsletter.java
  2011-01-14 16:40:09 UTC (rev 26491)
@@ -0,0 +1,56 @@
+/**
+ * Copyright (C) 2010 Hippo B.V.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.onehippo.gogreen.components.common;
+
+import com.onehippo.gogreen.components.BaseComponent;
+import com.onehippo.gogreen.exceptions.BeanNotFoundException;
+import com.onehippo.gogreen.utils.RepoSiteMenuItem;
+import org.hippoecm.hst.content.beans.standard.HippoBean;
+import org.hippoecm.hst.content.beans.standard.HippoDocumentBean;
+import org.hippoecm.hst.content.beans.standard.HippoFolderBean;
+import org.hippoecm.hst.core.component.HstRequest;
+import org.hippoecm.hst.core.component.HstResponse;
+
+import java.util.List;
+
+public class Newsletter extends BaseComponent {
+
+    @Override
+    public void doBeforeRender(HstRequest request, HstResponse response) {
+        super.doBeforeRender(request, response);
+        
+        HippoBean bean = getContentBean(request);
+        
+        if (bean == null) {
+            throw new BeanNotFoundException("Cannot create document list: 
content bean is null");
+        } else if (bean.isHippoDocumentBean()) {
+            request.setAttribute("document", bean);
+        } else if (bean.isHippoFolderBean()) {
+            HippoFolderBean folder = (HippoFolderBean) bean;
+            List<HippoDocumentBean> documents = folder.getDocuments();
+            
+            if (documents.size() == 1) {
+                request.setAttribute("document", documents.get(0));
+            } else {
+                String folderName = 
RepoSiteMenuItem.retrieveLocalizedName(folder);
+                request.setAttribute("folderName", folderName);
+                request.setAttribute("documents", documents);
+            }
+        }
+    }
+
+}

Added: 
hippo-demos/hippo-go-green/trunk/site/src/main/webapp/WEB-INF/jsp/common/newsletter-detail.jsp
===================================================================
--- 
hippo-demos/hippo-go-green/trunk/site/src/main/webapp/WEB-INF/jsp/common/newsletter-detail.jsp
                              (rev 0)
+++ 
hippo-demos/hippo-go-green/trunk/site/src/main/webapp/WEB-INF/jsp/common/newsletter-detail.jsp
      2011-01-14 16:40:09 UTC (rev 26491)
@@ -0,0 +1,125 @@
+<%--
+
+    Copyright (C) 2010 Hippo B.V.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+--%>
+
+<%@ page language="java"%>
+<%@ page contentType="text/html; charset=UTF-8"%>
+<%@ page trimDirectiveWhitespaces="true"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c"%>
+<%@include file="../includes/tags.jspf" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml"; lang="nl">
+<head>
+    <hst:headContributions 
categoryExcludes="css,jsInternal,jsExternal,hippoPagecomposer" />
+    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+    <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"; />
+    <link rel="schema.DCTERMS" href="http://purl.org/dc/terms/"; />
+    <meta name="DC.keywords" content="<fmt:message 
key="layout.webpage.metadckeywords"/>" />
+    <meta name="description" content="<fmt:message 
key="layout.webpage.metadescription"/>" />
+    <meta name="DC.type" scheme="THC.type" content="webpagina" />
+    <meta name="DCTERMS.issued" scheme="DCTERMS.W3CDTF" 
content="2009-07-09T10:31" />
+    <meta name="DCTERMS.available" scheme="DCTERMS.W3CDTF" 
content="2009-07-09T10:31" />
+    <meta content="<fmt:message key="layout.webpage.metadctitle"/>" 
name="DC.title" />
+    <meta content="en-US" scheme="DCTERMS.RFC3066" name="DC.language" />
+
+    <hst:link var="yuicss" path="/css/yui-css.css"/>
+    <link rel="stylesheet" media="screen" type="text/css" href="${yuicss}"/>
+
+    <hst:link var="screen" path="/css/screen.css"/>
+    <link rel="stylesheet" media="screen" type="text/css" href="${screen}"/>
+
+    <hst:headContributions categoryIncludes="css"/>
+
+    <hst:link var="jquery" path="/js/jquery-1.4.2.min.js"/>
+    <script src="${jquery}" type="text/javascript"></script>
+
+    <hst:link var="favicon" path="/images/favicon.ico"/>
+    <link rel="icon" href="${favicon}" type="image/x-icon"/>
+    <link rel="shortcut icon" href="${favicon}" type="image/x-icon"/>
+
+    <hst:link var="appletouchicon" path="/images/apple-touch-icon.png"/>
+    <link rel="apple-touch-icon" href="${appletouchicon}"/>
+
+    <!--[if lte IE 7]>
+       <hst:link var="ie7css" path="/css/ie7.css"/>
+       <link rel="stylesheet" media="screen" type="text/css" href="${ie7css}">
+       <script type="text/javascript">ie7 = true;</script>
+    <![endif]-->
+
+    <!--
+        <hst:link var="print" path="/css/print.css"/>
+        <link rel="stylesheet" media="print" type="text/css" href="${print}">
+     -->
+</head>
+<body<c:if test="${cookie.textSize.value ne null}"> style="font-size: 
${cookie.textSize.value}px;"</c:if>>
+
+<c:if test="${preview}">
+<jsp:include page="../inc/preview.jsp"/>
+</c:if>
+
+<div class="yui-main">
+<div id="content" class="yui-b left-and-right">
+
+  <c:choose>
+    <c:when test="${documents ne null}">
+      <div id="about">
+        <h2 class="title"><c:out value="${folderName}"/></h2>
+        <c:forEach items="${documents}" var="document">
+          <ul class="about-item <c:if test="${preview}">editable</c:if>">
+            <c:if test="${preview}"><a target="CMS" href="<hst:surfandeditlink 
hippobean="${document}" />&mode=edit" class="hippo-link"><fmt:message 
key="about.edit"/></a></c:if>
+            <hst:link var="link" hippobean="${document}"/>
+            <li class="title"><a href="${link}"><c:out 
value="${document.title}"/></a></li>
+            <li class="description"><c:out value="${document.summary}"/></li>
+          </ul>
+        </c:forEach>
+      </div>
+    </c:when>
+    <c:when test="${document ne null}">
+      <div id="article" class="about <c:if test="${preview}">editable</c:if>">
+        <c:if test="${preview}"><a target="CMS" href="<hst:surfandeditlink 
hippobean="${document}" />&mode=edit" class="hippo-link"><fmt:message 
key="about.edit"/></a></c:if>
+        <h2 class="title"><c:out value="${document.title}"/></h2>
+
+        <p class="intro"><c:out value="${document.summary}"/></p>
+
+        <div class="yui-cssbase body">
+          <hst:html hippohtml="${document.description}"/>
+        </div>
+      </div>
+    </c:when>
+  </c:choose>
+
+</div>
+</div>
+<div>
+  <hst:include ref="boxes-under"/>
+</div>
+<hst:link var="jscommon" path="/js/js-common.js"/>
+<script src="${jscommon}" type="text/javascript"></script>
+
+<hst:link var="jquerytools" path="/js/jquery.tools.min.js"/>
+<script src="${jquerytools}" type="text/javascript"></script>
+
+<hst:link var="helpoverlay" path="/js/help-overlay.js"/>
+<script src="${helpoverlay}" type="text/javascript"></script>
+
+<hst:headContributions categoryIncludes="jsExternal"/>
+<hst:headContributions categoryIncludes="jsInternal"/>
+<hst:headContributions categoryIncludes="hippoPagecomposer"/>
+</body>
+</html>
+
+


Property changes on: 
hippo-demos/hippo-go-green/trunk/site/src/main/webapp/WEB-INF/jsp/common/newsletter-detail.jsp
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

_______________________________________________
Hippocms-svn mailing list
[email protected]
http://lists.hippo.nl/mailman/listinfo/hippocms-svn

Reply via email to