1 |
<%-- |
2 |
Copyright 2008-2009 Hippo |
3 |
|
4 |
Licensed under the Apache License, Version 2.0 (the "License"); |
5 |
you may not use this file except in compliance with the License. |
6 |
You may obtain a copy of the License at |
7 |
|
8 |
http://www.apache.org/licenses/LICENSE-2.0 |
9 |
|
10 |
Unless required by applicable law or agreed to in writing, software |
11 |
distributed under the License is distributed on an "AS IS" |
12 |
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 |
See the License for the specific language governing permissions and |
14 |
limitations under the License. --%> |
15 |
|
16 |
<%@ page language="java" %> |
17 |
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> |
18 |
<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %> |
19 |
<%@ taglib uri="http://www.hippoecm.org/jsp/hst/core" prefix='hst'%> |
20 |
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> |
21 |
|
22 |
<hst:defineObjects /> |
23 |
<c:set var="basePath" value="${hstRequest.contextPath}${hstRequest.servletPath}" /> |
24 |
|
25 |
<jsp:useBean id='contentRewriter' class='org.onehippo.portal.collab.rewriter.CollabContentLinksRewriter' scope='page'> |
26 |
<jsp:setProperty name='contentRewriter' property='prefix' value='<%=("" + pageContext.getAttribute("basePath") + "/content/")%>' /> |
27 |
</jsp:useBean> |
28 |
|
29 |
<hst:element var="xinhaConfig" name="script"> |
30 |
<hst:attribute name="id" value="xinhaConfig" /> |
31 |
<hst:attribute name="type" value="text/javascript" /> |
32 |
_editor_url = "/site/xinha/"; |
33 |
_editor_lang = "en"; |
34 |
_editor_skin = "blue-look"; |
35 |
</hst:element> |
36 |
<hst:element var="xinhaCore" name="script"> |
37 |
<hst:attribute name="id" value="xinhaCore" /> |
38 |
<hst:attribute name="type" value="text/javascript" /> |
39 |
<hst:attribute name="src" value="/site/xinha/XinhaCore.js"/> |
40 |
</hst:element> |
41 |
<hst:head-contribution keyHint="xinhaConfig" element="${xinhaConfig}" /> |
42 |
<hst:head-contribution keyHint="xinhaCore" element="${xinhaCore}" /> |
43 |
|
44 |
<hst:element var="xinhaInit" name="script"> |
45 |
<hst:attribute name="id" value="xinhaInit" /> |
46 |
<hst:attribute name="type" value="text/javascript" /> |
47 |
<hst:attribute name="src" value="/site/javascript/xinha-init.js"/> |
48 |
</hst:element> |
49 |
<hst:head-contribution keyHint="xinhaInit" element="${xinhaInit}" /> |
50 |
|
51 |
<script language="javascript" type="text/javascript"> |
52 |
function <hst:namespace/>showEditMode(editMode) { |
53 |
var viewer = document.getElementById("<hst:namespace/>contentViewer"); |
54 |
var editor = document.getElementById("<hst:namespace/>contentEditor"); |
55 |
var editorPane = document.getElementById("<hst:namespace/>contentEditorPane"); |
56 |
var editorButtons = document.getElementById("<hst:namespace/>editorButtons"); |
57 |
if (viewer && editor) { |
58 |
if (editMode) { |
59 |
editor.innerHTML = viewer.innerHTML; |
60 |
} |
61 |
viewer.style.display = (editMode ? "none" : ""); |
62 |
editorButtons.style.display = (!editMode ? "none" : ""); |
63 |
|
64 |
if (editMode) { |
65 |
editorPane.style.position = "relative"; |
66 |
editorPane.style.zIndex = 0; |
67 |
editorPane.style.visibility = "visible"; |
68 |
} else { |
69 |
editorPane.style.position = "absolute"; |
70 |
editorPane.style.zIndex = -100; |
71 |
editorPane.style.visibility = "hidden"; |
72 |
} |
73 |
|
74 |
var form = document.getElementById("<hst:namespace/>pageform"); |
75 |
form.save.disabled = !editMode; |
76 |
form.cancel.disabled = !editMode; |
77 |
} |
78 |
} |
79 |
</script> |
80 |
|
81 |
<%-- Redirect to edit mode page for newly created wiki page. --%> |
82 |
<c:if test="${empty document.node}"> |
83 |
<c:if test="${not empty editUrl}"> |
84 |
<script language="javascript"> |
85 |
location.href = "${editUrl}"; |
86 |
</script> |
87 |
</c:if> |
88 |
</c:if> |
89 |
|
90 |
<c:choose> |
91 |
<c:when test="${showPageInfo}"> |
92 |
<p> |
93 |
<c:set var="authorFullName" value="${wikiPageInfo['authorInfo']['user.name.given']} ${wikiPageInfo['authorInfo']['user.name.family']}" /> |
94 |
<c:if test="${not empty document.date}"> |
95 |
<fmt:formatDate var="lastModifiedDate" value="${document.date.time}" type="both" /> |
96 |
</c:if> |
97 |
Page owner: <!--<a href="#" title="${authorFullName}">${authorFullName}</a>,-->${authorFullName}, |
98 |
<!-- Last changed by <a href="#" title="Lars Peters">Lars Peters</a> --> |
99 |
on ${lastModifiedDate} |
100 |
<!-- (<a href="#" title="View change">View change</a>) --> |
101 |
<c:if test="${not empty editUrl}"> |
102 |
<a href="${editUrl}" title="Edit content" class="edit">Edit content</a> |
103 |
</c:if> |
104 |
</p> |
105 |
<!-- |
106 |
<p> |
107 |
From department: Marketing, valid since ${lastModifiedDate}. |
108 |
</p> |
109 |
<ul id="collab-pagefunctions"> |
110 |
<li class="twitter"><a href="#" title="Twitter"></a></li> |
111 |
<li class="bookmark"><a href="#" title="Bookmark"></a></li> |
112 |
<li class="print"><a href="#" title="Print"></a></li> |
113 |
</ul> |
114 |
--> |
115 |
</c:when> |
116 |
<c:otherwise> |
117 |
<c:if test="${not empty editUrl}"> |
118 |
<div class="right"><a href="${editUrl}"><img src="<hst:link path="/images/edit.png"/>" class="noborder" alt="Edit content" title="Edit Content" /></a></div> |
119 |
</c:if> |
120 |
</c:otherwise> |
121 |
</c:choose> |
122 |
|
123 |
<div> |
124 |
<form id="<hst:namespace/>pageform" method="POST" action="<hst:actionURL/>"> |
125 |
<div> |
126 |
<c:choose> |
127 |
<c:when test="${not empty document.node}"> |
128 |
<!-- <h2 class="InnerContent">${document.title}</h2> handled in the title --> |
129 |
</c:when> |
130 |
<c:otherwise> |
131 |
<span class="InnerContent" id="title"><input type="text" name="title" size="40" style="WIDTH: 60%" value="" /></span> |
132 |
</c:otherwise> |
133 |
</c:choose> |
134 |
<p> |
135 |
<c:choose> |
136 |
<c:when test="${isPreview}"> |
137 |
<c:choose> |
138 |
<c:when test="${not empty document.node}"> |
139 |
<span id="<hst:namespace/>contentViewer" class="InnerContent"><hst:html hippohtml="${document.html}" contentRewriter="${contentRewriter}" /></span> |
140 |
<span id="<hst:namespace/>contentEditorPane" style="VISIBILITY: hidden; POSITION: absolute; Z-INDEX: -100"> |
141 |
<textarea id="<hst:namespace/>contentEditor" xinhaEditor="true" name="content" rows="10" cols="80" style="WIDTH: 96%"><span class="collab"><span class="InnerContent"><hst:html hippohtml="${document.html}" contentRewriter="${contentRewriter}" /></span></span></textarea> |
142 |
</span> |
143 |
</c:when> |
144 |
<c:otherwise> |
145 |
<span id="<hst:namespace/>contentEditorPane" style="VISIBILITY: visible"> |
146 |
<textarea id="<hst:namespace/>contentEditor" class="InnerContent" xinhaEditor="true" name="content" rows="10" cols="80" style="WIDTH: 96%"></textarea> |
147 |
</span> |
148 |
</c:otherwise> |
149 |
</c:choose> |
150 |
</c:when> |
151 |
<c:otherwise> |
152 |
<c:if test="${not empty document.node}"> |
153 |
<span class="InnerContent"> |
154 |
<hst:html hippohtml="${document.html}" contentRewriter="${contentRewriter}" /> |
155 |
</span> |
156 |
</c:if> |
157 |
</c:otherwise> |
158 |
</c:choose> |
159 |
</p> |
160 |
</div> |
161 |
|
162 |
<c:if test="${empty editUrl}"> |
163 |
<div align="center"> |
164 |
<span id="<hst:namespace/>editorButtons"> |
165 |
<c:if test="${isPreview}"> |
166 |
<c:choose> |
167 |
<c:when test="${not empty document.node}"> |
168 |
<input type="hidden" name="type" value="updatePage"/> |
169 |
<input type="submit" name="save" value="Save" disabled="true"/> |
170 |
<input type="button" name="cancel" value="Cancel" disabled="true" onclick="return <hst:namespace/>showEditMode(false);"/> |
171 |
</c:when> |
172 |
<c:otherwise> |
173 |
<input type="hidden" name="type" value="addPage"/> |
174 |
<input type="submit" name="save" value="Save"/> |
175 |
<input type="button" name="cancel" value="Cancel" onclick="return <hst:namespace/>showEditMode(false);"/> |
176 |
</c:otherwise> |
177 |
</c:choose> |
178 |
</c:if> |
179 |
</span> |
180 |
</div> |
181 |
</c:if> |
182 |
|
183 |
</form> |
184 |
|
185 |
<c:if test="${not empty document.node}"> |
186 |
<c:if test="${not empty document.resource}"> |
187 |
<h2>resource link:</h2> |
188 |
<hst:link var="resource" hippobean="${document.resource}" /> |
189 |
<a href="${resource}">${document.resource.name}</a> |
190 |
<br/><br/> |
191 |
</c:if> |
192 |
<c:if test="${not empty document.image}"> |
193 |
<img src="<hst:link hippobean="${document.image.picture}"/>"/> |
194 |
</c:if> |
195 |
</c:if> |
196 |
|
197 |
<p> </p> |
198 |
<hst:include ref="relateddocs" /> |
199 |
|
200 |
</div> |