shuber 2004/10/27 15:35:16 CEST
Modified files:
core/src/java/org/jahia/engines/shared Page_Field.java
core/src/webapp/jsp/jahia/engines/shared page_field.jsp
Log:
Bugfix :
- Error when not selecting a page in move page or link page popup window.
Revision Changes Path
1.9 +10 -1 jahia/core/src/java/org/jahia/engines/shared/Page_Field.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/engines/shared/Page_Field.java.diff?r1=1.8&r2=1.9&f=h
1.5 +50 -18 jahia/core/src/webapp/jsp/jahia/engines/shared/page_field.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/webapp/jsp/jahia/engines/shared/page_field.jsp.diff?r1=1.4&r2=1.5&f=h
Index: Page_Field.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/engines/shared/Page_Field.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Page_Field.java 19 Oct 2004 12:51:47 -0000 1.8
+++ Page_Field.java 27 Oct 2004 13:35:16 -0000 1.9
@@ -79,6 +79,7 @@
import java.io.UnsupportedEncodingException;
import org.jahia.bin.Jahia;
import org.jahia.services.pages.JahiaPageService;
+import org.jahia.exceptions.JahiaPageNotFoundException;
public class Page_Field {
@@ -486,7 +487,11 @@
// the ACL has to be set to the appropriate ID.
if (jahiaPage.getPageType() == JahiaPage.TYPE_DIRECT ||
jahiaPage.getPageType() == JahiaPage.TYPE_URL) {
- ContentPage linkContentPage =
ServicesRegistry.getInstance().getJahiaPageService().
+ ContentPage linkContentPage = null;
+
+ try {
+ linkContentPage =
+
ServicesRegistry.getInstance().getJahiaPageService().
lookupContentPage(pageBean.getPageLinkID(), false);
// The old ACL always exists in the case we return to a
// direct page type. See operation CHANGE_TEMPLATE
@@ -494,6 +499,10 @@
ServicesRegistry.getInstance().getJahiaSiteMapService().
removeUserSiteMap(jParams.getUser().getUserKey());
+ } catch (JahiaPageNotFoundException jpnfe) {
+ // linked page was not found, or set to -1, let's
+ // not update the change.
+ }
}
} else if (LINK_URL.equals(operation)) {
jahiaPage.setRemoteURL(pageBean.getRemoteURL());
Index: page_field.jsp
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/webapp/jsp/jahia/engines/shared/page_field.jsp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- page_field.jsp 14 Oct 2004 15:31:48 -0000 1.4
+++ page_field.jsp 27 Oct 2004 13:35:16 -0000 1.5
@@ -111,10 +111,7 @@
}
function check() {
- // Does these objects exists before test them ?
- if (!(document.mainForm.operation[0] && document.mainForm.operation[<%=
isLinkOnly ? 1 : 3 %>])) {
- return true;
- }
+
// Test if checked
checked = false;
for (var i = 0; i < document.mainForm.operation.length; i++) {
@@ -123,18 +120,53 @@
}
}
if (!checked) return false;
- // Ok, let start the test.
- if (<% if (!isLinkOnly) { %>!document.mainForm.operation[0].checked && <% }
- %>!document.mainForm.operation[<%= isLinkOnly ? 1 : 3 %>].checked &&
- !document.mainForm.operation[<%= isLinkOnly ? 2 : isNewPage ? 4 : 3
%>].checked) {<%
- if ((Page_Field.LINK_JAHIA_PAGE.equals(pageBean.getOperation()) ||
+
+ // now here we will test if the move page or the link page
+ // target page IDs are valid or not.
+
+ // first we test for any of the cases, when both options
+ // are available to the user
+ if ( (document.getElementById('movePageRadio') != null) &&
+ (document.getElementById('linkPageRadio') != null) ) {
+ if (document.getElementById('movePageRadio').checked ||
+ document.getElementById('linkPageRadio').checked) {
+ <% if ((Page_Field.LINK_JAHIA_PAGE.equals(pageBean.getOperation()) ||
Page_Field.MOVE_PAGE.equals(pageBean.getOperation())) && sourcePageID
<= 0) {
%>return false<%
} else {
%>return true<%
+ } %>
}
- %>;
}
+
+ // from now on we have either the move or the link
+ // option present on the display, but not both
+ // (that case was already covered in the previous
+ // test)
+
+ // now let's test only the move case if it is present.
+ if (document.getElementById('movePageRadio') != null) {
+ if (document.getElementById('movePageRadio').checked) {
+ <% if ((Page_Field.LINK_JAHIA_PAGE.equals(pageBean.getOperation()) ||
+ Page_Field.MOVE_PAGE.equals(pageBean.getOperation())) && sourcePageID
<= 0) {
+ %>return false<%
+ } else {
+ %>return true<%
+ } %>
+ }
+ }
+
+ if (document.getElementById('linkPageRadio') != null) {
+ if (document.getElementById('linkPageRadio').checked) {
+ <% if ((Page_Field.LINK_JAHIA_PAGE.equals(pageBean.getOperation()) ||
+ Page_Field.MOVE_PAGE.equals(pageBean.getOperation())) && sourcePageID
<= 0) {
+ %>return false<%
+ } else {
+ %>return true<%
+ } %>
+ }
+ }
+
return true;
}
@@ -178,7 +210,7 @@
<%
if (!templateList.hasMoreElements()) {
%>
- <legend><input class="input" type="radio" name="operation" value="-1"
disabled
+ <legend><input id="directPageRadio" class="input" type="radio"
name="operation" value="-1" disabled
> The user <b><%=jParams.getUser().getUsername()%></b> has no templates access </legend>
<jahia:displayIcon src="org.jahia.pix.image" width="9" height="32"
align="absmiddle"/>Cannot create a new page or change template.
<%
@@ -186,13 +218,13 @@
if (isNewPage) {
%>
<!-- Create a new page -->
- <legend><input class="input" type="radio" name="operation"
value="<%=Page_Field.CREATE_PAGE%>"
+ <legend><input id="directPageRadio" class="input" type="radio"
name="operation" value="<%=Page_Field.CREATE_PAGE%>"
<% if (Page_Field.CREATE_PAGE.equals(pageBean.getOperation()))
{ %>checked<% } %>
> <jahia:engineResourceBundle
resourceName="org.jahia.engines.shared.Page_Field.createPageTemplate.label"/> :</legend>
<%
} else {
%>
- <legend><input class="input" type="radio" name="operation"
value="<%=Page_Field.UPDATE_PAGE%>"
+ <legend><input id="directPageRadio" class="input" type="radio"
name="operation" value="<%=Page_Field.UPDATE_PAGE%>"
<% if (Page_Field.UPDATE_PAGE.equals(pageBean.getOperation()))
{ %>checked<% } %>
> <jahia:engineResourceBundle
resourceName="org.jahia.engines.shared.Page_Field.changePageTemplate.label"/> </legend>
<%
@@ -216,7 +248,7 @@
<!-- Move an existing a new page -->
<fieldset style="width:90%;padding-top:10px;padding-bottom:10px;">
<legend>
- <input class="input" type="radio" name="operation"
value="<%=Page_Field.MOVE_PAGE%>"
+ <input id="movePageRadio" class="input" type="radio"
name="operation" value="<%=Page_Field.MOVE_PAGE%>"
onClick="javascript:callSelectPageMove()"
<% if (Page_Field.MOVE_PAGE.equals(pageBean.getOperation())) {
%>checked<% } %>
> <jahia:engineResourceBundle
resourceName="org.jahia.engines.shared.Page_Field.moveExistingPage.label"/>
@@ -247,7 +279,7 @@
<!-- WARNING !!! Check each radio button operation if uncomment these lines
!!
<tr>
<td>
- <input class="input" type="radio" name="operation"
value="<%=Page_Field.COPY_PAGE%>"
+ <input id="copyPageRadio" class="input" type="radio"
name="operation" value="<%=Page_Field.COPY_PAGE%>"
onClick=""
<% if (Page_Field.COPY_PAGE.equals(pageBean.getOperation())) {
%>checked<% } %>>>
</td>
@@ -275,7 +307,7 @@
%>
<fieldset style="width:90%;padding-top:10px;padding-bottom:10px;">
<legend>
- <input class="input" type="radio" name="operation"
value="<%=Page_Field.LINK_JAHIA_PAGE%>"
+ <input id="linkPageRadio" class="input" type="radio" name="operation"
value="<%=Page_Field.LINK_JAHIA_PAGE%>"
onClick="javascript:callSelectPageLink()"
<% if (Page_Field.LINK_JAHIA_PAGE.equals(pageBean.getOperation()))
{ %>checked<% } %>
> <jahia:engineResourceBundle
resourceName="org.jahia.engines.shared.Page_Field.linkExistingPage.label"/> </legend>
@@ -304,7 +336,7 @@
<!-- Create a link to an external web site -->
<fieldset style="width:90%;padding-top:10px;padding-bottom:10px;">
<legend>
- <input class="input" type="radio" name="operation"
value="<%=Page_Field.LINK_URL%>"
+ <input id="remoteURLRadio" class="input" type="radio" name="operation"
value="<%=Page_Field.LINK_URL%>"
<% if (Page_Field.LINK_URL.equals(pageBean.getOperation())) {
%>checked<% } %>
<% if (!isNewPage) { %> onclick="javascript:setPageURL()" <% } %>
> <jahia:engineResourceBundle
resourceName="org.jahia.engines.shared.Page_Field.createLinkToExternalSite.label"/>
@@ -324,7 +356,7 @@
%>
<fieldset style="width:90%;padding-top:10px;padding-bottom:10px;">
<legend>
- <input class="input" type="radio" name="operation"
value="<%=Page_Field.RESET_LINK%>"<%
+ <input id="noValueRadio" class="input" type="radio"
name="operation" value="<%=Page_Field.RESET_LINK%>"<%
if (Page_Field.RESET_LINK.equals(pageBean.getOperation())) {
%>checked<% } %>> <%
if (isNewPage) {
%><jahia:engineResourceBundle
resourceName="org.jahia.engines.shared.Page_Field.differPageCreation.label"/><%