Merge "Fix build errors in autorelease full clean build"
[vfc/nfvo/wfengine.git] / winery / org.eclipse.winery.repository / src / main / webapp / jsp / documentation.jsp
1 <%--
2 /*******************************************************************************
3  * Copyright (c) 2012-2013 University of Stuttgart.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * and the Apache License 2.0 which both accompany this distribution,
7  * and are available at http://www.eclipse.org/legal/epl-v10.html
8  * and http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Contributors:
11  *    Oliver Kopp - initial API and implementation and/or initial documentation
12  *******************************************************************************/
13 --%>
14 <%@taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
15 <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
16 <%@taglib prefix="w"  uri="http://www.eclipse.org/winery/repository/functions" %>
17
18 <%-- TODO: source (external documentation) and lang attributes not yet supported --%>
19
20 <c:if test="${empty it}">
21         <div class="form-group">
22                 <div class="form-control" id="documentation"></div>
23         </div>
24         <script>
25         $("#documentation").editable({
26                 type: "wysihtml5",
27                 send: "always",
28                 success: function(response, newValue) {
29                         $.ajax({
30                                 type: "POST",
31                                 async: false,
32                                 "data": newValue,
33                                 "url": "documentation/",
34                                 dataType: "text",
35                                 contentType: "text/html",
36                                 error: function(jqXHR, textStatus, errorThrown) {
37                                         vShowAJAXError("Could not create documentation", jqXHR, errorThrown);
38                                 },
39                                 success: function(resData, textStatus, jqXHR) {
40                                         vShowSuccess("Successfully created the documentation");
41                                         doTheTabSelection();
42                                 }
43                         });
44                 }
45         });
46         </script>
47 </c:if>
48
49
50 <c:if test="${not empty it}">
51         <script>var documentationURL = {};</script>
52         <c:forEach var="documentation" items="${it}" varStatus="status">
53                 <div class="form-group">
54                         <%-- we only print a heading if we have multiple documentations. Otherwise, the documentation itself should be displayed --%>
55                         <c:if test="${fn:length(it) > 1}"><label class="label-form">Documentation ${status.index}</label></c:if>
56                         <div class="form-control" id="documentation${status.index}">
57                                 <c:forEach items="${documentation.content}" var="content">${content}</c:forEach>
58                         </div>
59                 </div>
60                 <c:set var="text" value="${w:XML(documentation)}"></c:set><!--  required to calculate the hashCode -->
61                 <c:set var="hash" value="<%=pageContext.getAttribute(\"text\").hashCode()%>"></c:set>
62                 <script>
63                 documentationURL[${status.index}] = "documentation/${hash}";
64                 $("#documentation${status.index}").editable({
65                         type: "wysihtml5",
66                         send: "always",
67                         success: function(response, newValue) {
68                                 $.ajax({
69                                         type: "PUT",
70                                         async: false,
71                                         "data": newValue,
72                                         "url": documentationURL[${status.index}],
73                                         dataType: "text",
74                                         contentType: "text/html",
75                                         error: function(jqXHR, textStatus, errorThrown) {
76                                                 vShowAJAXError("Could not update documentation", jqXHR, errorThrown);
77                                         },
78                                         success: function(resData, textStatus, jqXHR) {
79                                                 vShowSuccess("Successfully updated the documentation");
80                                                 documentationURL[${status.index}] = "documentation/" + resData;
81                                         }
82                                 });
83                         }
84                 });
85                 </script>
86         </c:forEach>
87 </c:if>