Skip to content

Commit d7ad9ed

Browse files
committed
Bug #14481
Fix the bug by adding the missing Javascript function topicGoTo(String) Refactor the modelUsedList.jsp to replace Java code by JSTL tags.
1 parent 1c93314 commit d7ad9ed

File tree

1 file changed

+106
-118
lines changed

1 file changed

+106
-118
lines changed

kmelia/kmelia-war/src/main/webapp/kmelia/jsp/modelUsedList.jsp

Lines changed: 106 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -24,122 +24,110 @@
2424
along with this program. If not, see <https://www.gnu.org/licenses/>.
2525
2626
--%>
27-
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
28-
<%@ taglib uri="http://www.silverpeas.com/tld/viewGenerator" prefix="view"%>
27+
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
28+
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
29+
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
30+
<%@ taglib uri="http://www.silverpeas.com/tld/viewGenerator" prefix="view" %>
31+
<%@ taglib uri="http://www.silverpeas.com/tld/silverFunctions" prefix="silfn" %>
32+
<%@ taglib prefix="slifn" uri="http://www.silverpeas.com/tld/silverFunctions" %>
2933
<%@ include file="checkKmelia.jsp" %>
30-
31-
<%
32-
List xmlForms = (List) request.getAttribute("XMLForms");
33-
Collection modelUsed = (Collection) request.getAttribute("ModelUsed");
34-
35-
String linkedPathString = kmeliaScc.getSessionPath();
36-
37-
// declaration des boutons
38-
Button validateButton = gef.getFormButton(resources.getString("GML.validate"), "javascript:onClick=sendData();", false);
39-
Button cancelButton = gef.getFormButton(resources.getString("GML.cancel"), "GoToCurrentTopic", false);
40-
41-
%>
42-
<html>
43-
<head>
44-
<view:looknfeel/>
45-
<script language="javaScript">
46-
47-
function sendData() {
48-
document.model.mode.value = 'delete';
49-
document.model.submit();
50-
}
51-
52-
function closeWindows() {
53-
if (window.publicationWindow != null)
54-
window.publicationWindow.close();
55-
}
56-
</script>
57-
</head>
58-
<body onunload="closeWindows()" id="<%=componentId%>">
59-
<%
60-
Window window = gef.getWindow();
61-
Frame frame = gef.getFrame();
62-
Board board = gef.getBoard();
63-
64-
BrowseBar browseBar = window.getBrowseBar();
65-
browseBar.setDomainName(spaceLabel);
66-
browseBar.setComponentName(componentLabel, "Main");
67-
browseBar.setPath(linkedPathString);
68-
69-
out.println(window.printBefore());
70-
71-
out.println(frame.printBefore());
72-
out.println(board.printBefore());
73-
%>
74-
<form name="model" action="SelectModel" method="post">
75-
<input type="hidden" name="mode"/>
76-
77-
<table cellpadding="5" width="100%" id="templates">
78-
<tr><td colspan="3" class="txtnav"><%=resources.getString("kmelia.ModelList")%></td></tr>
79-
<%
80-
int nb = 0;
81-
out.println("<tr>");
82-
if (xmlForms != null) {
83-
PublicationTemplate xmlForm;
84-
String thumbnail = "";
85-
Iterator iterator = xmlForms.iterator();
86-
while (iterator.hasNext()) {
87-
xmlForm = (PublicationTemplate) iterator.next();
88-
89-
if (nb != 0 && nb%3==0)
90-
out.println("</tr><tr>");
91-
92-
nb++;
93-
// recherche si le mod�le est dans la liste
94-
boolean used = false;
95-
if (modelUsed.contains(xmlForm.getFileName()))
96-
{
97-
used = true;
98-
}
99-
String usedCheck = "";
100-
if (used)
101-
usedCheck = "checked";
102-
103-
thumbnail = xmlForm.getThumbnail();
104-
if (!StringUtil.isDefined(thumbnail))
105-
{
106-
thumbnail = PublicationTemplate.DEFAULT_THUMBNAIL;
107-
}
108-
109-
out.println("<td class=\"template\"><img src=\""+thumbnail+"\" border=\"0\" alt=\""+xmlForm.getDescription()+"\"/><br/>"+xmlForm.getName()+"<br/><input type=\"checkbox\" name=\"modelChoice\" value=\""+xmlForm.getFileName()+"\" "+usedCheck+"/></td>");
110-
}
111-
}
112-
113-
if (nb != 0 && nb%3 == 0)
114-
out.println("</tr><tr>");
115-
// recherche si le mod�le est dans la liste
116-
boolean used = false;
117-
Iterator it = modelUsed.iterator();
118-
if (modelUsed.contains("WYSIWYG"))
119-
{
120-
used = true;
121-
}
122-
String usedCheck = "";
123-
if (used)
124-
usedCheck = "checked";
125-
126-
out.println("<td class=\"template\"><img src=\"../../util/icons/model/wysiwyg.gif\" border=\"0\" alt=\"Wysiwyg\"/><br/>WYSIWYG<br/><input type=\"checkbox\" name=\"modelChoice\" value=\"WYSIWYG\" "+usedCheck+"/></a></td>");
127-
out.println("</tr>");
128-
129-
%>
130-
</form>
131-
132-
</table>
133-
134-
<%
135-
out.println(board.printAfter());
136-
ButtonPane buttonPane = gef.getButtonPane();
137-
buttonPane.addButton(validateButton);
138-
buttonPane.addButton(cancelButton);
139-
out.println("<br/><center>"+buttonPane.print()+"</center><br/>");
140-
out.println(frame.printAfter());
141-
%>
142-
143-
<% out.println(window.printAfter()); %>
144-
</body>
145-
</html>
34+
<fmt:setLocale value="${sessionScope[sessionController].language}"/>
35+
<view:setBundle bundle="${requestScope.resources.multilangBundle}"/>
36+
37+
<c:set var="spaceId" value="${requestScope.browse[2]}"/>
38+
<c:set var="componentId" value="${requestScope.browse[3]}"/>
39+
<c:set var="kmelia" value="${requestScope.kmelia}"/>
40+
<jsp:useBean id="kmelia" type="org.silverpeas.components.kmelia.control.KmeliaSessionController"/>
41+
<c:set var="templates" value="${requestScope.XMLForms}"/>
42+
<c:set var="usedTemplates" value="${requestScope.ModelUsed}"/>
43+
44+
<fmt:message var="validateLabel" key="GML.validate"/>
45+
<fmt:message var="cancelLabel" key="GML.cancel"/>
46+
47+
<view:sp-page>
48+
<view:sp-head-part withFieldsetStyle="true">
49+
<title><fmt:message key="kmelia.ModelUsed"/></title>
50+
<script language="javaScript">
51+
52+
function topicGoTo(id) {
53+
location.href = "GoToTopic?Id=" + id;
54+
}
55+
56+
function sendData() {
57+
document.model.mode.value = 'delete';
58+
document.model.submit();
59+
}
60+
61+
function closeWindows() {
62+
if (window.publicationWindow != null)
63+
window.publicationWindow.close();
64+
}
65+
</script>
66+
</view:sp-head-part>
67+
<view:sp-body-part onUnload="closeWindows()"
68+
id="${componentId}">
69+
70+
<view:browseBar spaceId="${spaceId}"
71+
componentId="${componentId}"
72+
path="${kmelia.sessionPath}">
73+
</view:browseBar>
74+
<view:window>
75+
<view:frame>
76+
<view:board>
77+
<form name="model" action="SelectModel" method="post">
78+
<input type="hidden" name="mode"/>
79+
<table cellpadding="5" width="100%" id="templates">
80+
<tr>
81+
<td colspan="3" class="txtnav">
82+
<fmt:message key="kmelia.ModelList"/>
83+
</td>
84+
</tr>
85+
<tr>
86+
<c:set var="idx" value="0"/>
87+
<c:forEach var="template" items="${templates}">
88+
<jsp:useBean id="template"
89+
type="org.silverpeas.core.contribution.template.publication.PublicationTemplate"/>
90+
<c:if test="${idx != 0 && idx % 3 == 0}">
91+
</tr><tr>
92+
</c:if>
93+
<c:set var="idx" value="${idx+1}"/>
94+
<c:set var="checked" value=""/>
95+
<c:if test="${usedTemplates.contains(template.fileName)}">
96+
<c:set var="checked" value="checked"/>
97+
</c:if>
98+
<c:set var="thumbnail" value="${template.thumbnail}"/>
99+
<c:if test="${slifn:isNotDefined(thumbnail)}">
100+
<c:set var="thumbnail"><%= PublicationTemplate.DEFAULT_THUMBNAIL %></c:set>
101+
</c:if>
102+
<td class="template">
103+
<img src="${thumbnail}" alt="${template.description}"/><br/>
104+
${silfn:escapeHtml(template.name)}<br/>
105+
<input type="checkbox" name="modelChoice"
106+
value="${template.fileName}" ${checked} />
107+
</td>
108+
</c:forEach>
109+
<c:if test="${idx != 0 && idx % 3 == 0}">
110+
</tr><tr>
111+
</c:if>
112+
<c:set var="checked" value=""/>
113+
<c:if test="${usedTemplates.contains('WYSIWYG')}">
114+
<c:set var="checked" value="checked"/>
115+
</c:if>
116+
<td class="template">
117+
<img src="../../util/icons/model/wysiwyg.gif" alt="Wysiwyg"/><br/>
118+
WYSIWYG<br/>
119+
<input type="checkbox" name="modelChoice" value="WYSIWYG" ${checked}/>
120+
</td>
121+
</tr>
122+
</table>
123+
</form>
124+
125+
</view:board>
126+
<view:buttonPane cssClass="center">
127+
<view:button label="${validateLabel}" action="javascript:onClick=sendData();"/>
128+
<view:button label="${cancelLabel}" action="GoToCurrentTopic"/>
129+
</view:buttonPane>
130+
</view:frame>
131+
</view:window>
132+
</view:sp-body-part>>
133+
</view:sp-page>

0 commit comments

Comments
 (0)