| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| |
| <% |
| /* |
| * Licensed to the Apache Software Foundation (ASF) under one or more |
| * contributor license agreements. See the NOTICE file distributed with |
| * this work for additional information regarding copyright ownership. |
| * The ASF licenses this file to You 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. |
| */ |
| %> |
| |
| <html> |
| <% |
| // Check if we have a currentNode |
| var currentNodeProvided = ((typeof currentNode != "undefined") && currentNode.title != null); |
| function getCurrentNodeValue(prop) { |
| var result = ""; |
| if(currentNodeProvided && currentNode[prop]) { |
| result = currentNode[prop]; |
| } |
| return result; |
| } |
| |
| // Compute path to used for the POST request, different |
| // depending on existence of a current node or not |
| var postPath = null; |
| var pageTitle = null; |
| if(currentNodeProvided) { |
| postPath = currentNode.getPath(); |
| pageTitle = currentNode.title; |
| } else { |
| postPath = request.getContextPath() + ""; |
| if(postPath.length > 0) { |
| postPath += "/"; |
| } |
| postPath += request.getPathInfo(); |
| pageTitle = "New post"; |
| } |
| |
| // Load header utility |
| load("header.esp"); |
| %> |
| <body> |
| |
| <div class="title"> |
| <div class="logo"> |
| <a href="http://sling.apache.org"> |
| <img border="0" src="/apps/espblog/sling-logo.png"/> |
| </a> |
| </div> |
| </div> |
| |
| <div class="menu"> |
| <% |
| load("menu.esp"); |
| %> |
| </div> |
| |
| <div class="main"> |
| <h1><%= pageTitle %></h1> |
| |
| <p> |
| Note that you need to <a href="?sling:authRequestLogin=1">login</a> |
| before creating or editing a post. |
| </p> |
| |
| <form class="hform" method="POST" action="<%= postPath %>" enctype="multipart/form-data"> |
| |
| <p><label>Title</label> |
| <input name="title" type="text" size="80" value="<%= getCurrentNodeValue("title") %>"></p> |
| |
| <p><label>Body</label> |
| <textarea name="posttext" cols="40" rows="5"><%= getCurrentNodeValue("posttext") %></textarea></p> |
| |
| <p><label>File</label><input type="file" name="attachments/*"/></p> |
| |
| |
| <input type="hidden" name="created"/> |
| <input name=":redirect" type="hidden" value="/content/espblog/posts.admin.html"/> |
| |
| <input type="submit" value="Post" class="button"> |
| </form> |
| </div> |
| </body> |
| </html> |