Fixes for ALFCOM-2313, ETHREEOH-1006, ALFCOM-2302, ETHREEOH-1023, ETWOTWO-1069

- correct enable/disable of OK button for applying Templates and RSS feeds to spaces and documents
 - clean up of related bean and JSP pages - conversion to JSF components from horrid verbatim tag based dialogs

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14783 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2009-06-18 11:18:59 +00:00
parent 818c99168d
commit 7bc8553167
7 changed files with 134 additions and 111 deletions

View File

@@ -40,15 +40,14 @@ import org.alfresco.web.ui.common.Utils;
public class ApplyDocTemplateDialog extends BaseDialogBean public class ApplyDocTemplateDialog extends BaseDialogBean
{ {
private static final long serialVersionUID = -9098279672434597354L; private static final long serialVersionUID = -9098279672434597354L;
protected String template;
private static final String DIALOG_CLOSE = "dialog:close"; private static final String DIALOG_CLOSE = "dialog:close";
private static final String MSG_APPLY_TEMPLATE = "apply_template"; private static final String MSG_APPLY_TEMPLATE = "apply_template";
protected String template;
@Override @Override
protected String finishImpl(FacesContext context, String outcome) throws Exception protected String finishImpl(FacesContext context, String outcome) throws Exception
{ {
@@ -80,27 +79,22 @@ public class ApplyDocTemplateDialog extends BaseDialogBean
return DIALOG_CLOSE; return DIALOG_CLOSE;
} }
public boolean getFinishButtonDisabled()
{
return false;
}
public String getContainerTitle() public String getContainerTitle()
{ {
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_APPLY_TEMPLATE) + " '" + getName() + "'"; return Application.getMessage(FacesContext.getCurrentInstance(), MSG_APPLY_TEMPLATE) + " '" + getName() + "'";
} }
public String getTemplate() public String getTemplate()
{ {
// return current template if it exists // return current template if it exists
NodeRef ref = (NodeRef) getNode().getProperties().get(ContentModel.PROP_TEMPLATE); NodeRef ref = (NodeRef) getNode().getProperties().get(ContentModel.PROP_TEMPLATE);
return ref != null ? ref.getId() : this.template; return ref != null ? ref.getId() : this.template;
} }
public void setTemplate(String template) public void setTemplate(String template)
{ {
this.template = template; this.template = template;
} }
public Node getNode() public Node getNode()
{ {
@@ -111,4 +105,4 @@ public class ApplyDocTemplateDialog extends BaseDialogBean
{ {
return getNode().getName(); return getNode().getName();
} }
} }

View File

@@ -41,14 +41,14 @@ import org.alfresco.web.ui.common.Utils;
public class ApplyRssTemplateDialog extends BaseDialogBean public class ApplyRssTemplateDialog extends BaseDialogBean
{ {
private static final long serialVersionUID = 9207265799149337182L; private static final long serialVersionUID = 9207265799149337182L;
private static final String DIALOG_CLOSE = "dialog:close"; private static final String DIALOG_CLOSE = "dialog:close";
private static final String MSG_APPLY_RSS_FEED = "apply_rss_feed"; private static final String MSG_APPLY_RSS_FEED = "apply_rss_feed";
private String rssTemplate; private String rssTemplate;
public void setRSSTemplate(String rssTemplate) public void setRSSTemplate(String rssTemplate)
{ {
this.rssTemplate = rssTemplate; this.rssTemplate = rssTemplate;
@@ -71,11 +71,6 @@ public class ApplyRssTemplateDialog extends BaseDialogBean
return DIALOG_CLOSE; return DIALOG_CLOSE;
} }
public boolean getFinishButtonDisabled()
{
return false;
}
public String getContainerTitle() public String getContainerTitle()
{ {
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_APPLY_RSS_FEED) + " '" + getNode().getName() + "'"; return Application.getMessage(FacesContext.getCurrentInstance(), MSG_APPLY_RSS_FEED) + " '" + getNode().getName() + "'";
@@ -119,4 +114,4 @@ public class ApplyRssTemplateDialog extends BaseDialogBean
{ {
return this.browseBean.getActionSpace(); return this.browseBean.getActionSpace();
} }
} }

View File

@@ -41,15 +41,14 @@ import org.alfresco.web.ui.common.Utils;
public class ApplySpaceTemplateDialog extends BaseDialogBean public class ApplySpaceTemplateDialog extends BaseDialogBean
{ {
private static final long serialVersionUID = -3019234033026890265L; private static final long serialVersionUID = -3019234033026890265L;
protected String template;
private static final String DIALOG_CLOSE = "dialog:close"; private static final String DIALOG_CLOSE = "dialog:close";
private static final String MSG_APPLY_TEMPLATE = "apply_template"; private static final String MSG_APPLY_TEMPLATE = "apply_template";
protected String template;
@Override @Override
protected String finishImpl(FacesContext context, String outcome) throws Exception protected String finishImpl(FacesContext context, String outcome) throws Exception
{ {
@@ -57,11 +56,6 @@ public class ApplySpaceTemplateDialog extends BaseDialogBean
return DIALOG_CLOSE; return DIALOG_CLOSE;
} }
public boolean getFinishButtonDisabled()
{
return false;
}
public String getContainerTitle() public String getContainerTitle()
{ {
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_APPLY_TEMPLATE) + " '" + getNode().getName() + "'"; return Application.getMessage(FacesContext.getCurrentInstance(), MSG_APPLY_TEMPLATE) + " '" + getNode().getName() + "'";
@@ -112,4 +106,4 @@ public class ApplySpaceTemplateDialog extends BaseDialogBean
{ {
this.template = template; this.template = template;
} }
} }

View File

@@ -676,6 +676,11 @@ a.topToolbarLinkHighlight, a.topToolbarLinkHighlight:link, a.topToolbarLinkHighl
width: 20px; width: 20px;
} }
.panelGridLabelColumnAuto
{
white-space: nowrap;
}
.panelGridLabelColumn .panelGridLabelColumn
{ {
white-space: nowrap; white-space: nowrap;

View File

@@ -29,13 +29,32 @@
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%> <%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%>
<f:verbatim> <f:verbatim>
<table cellpadding="2" cellspacing="2" border="0" width="100%"> <script type="text/javascript">
<tr> var finishButtonPressed = false;
<td></f:verbatim><h:outputText value="#{msg.template}" /><f:verbatim>:</td> window.onload = pageLoaded;
<td width=100%><%-- Templates drop-down selector --%> </f:verbatim><h:selectOneMenu
value="#{ApplyDocTemplateDialog.template}"> function pageLoaded()
<f:selectItems value="#{TemplateSupportBean.contentTemplates}" /> {
</h:selectOneMenu><f:verbatim></td> checkButtonState();
</tr> }
</table>
</f:verbatim> function checkButtonState()
{
if (document.getElementById("dialog:dialog-body:template").value == "none")
{
document.getElementById("dialog:finish-button").disabled = true;
}
else
{
document.getElementById("dialog:finish-button").disabled = false;
}
}
</script>
</f:verbatim>
<h:panelGrid id="template-panel" columns="2" cellpadding="2" cellspacing="2" border="0" width="100%" columnClasses="panelGridLabelColumnAuto,panelGridValueColumn">
<h:outputText value="#{msg.template}:" />
<h:selectOneMenu id="template" value="#{ApplyDocTemplateDialog.template}" onchange="checkButtonState();">
<f:selectItems value="#{TemplateSupportBean.contentTemplates}" />
</h:selectOneMenu>
</h:panelGrid>

View File

@@ -35,51 +35,48 @@
<r:loadBundle var="msg"/> <r:loadBundle var="msg"/>
<f:verbatim> <f:verbatim>
<table cellspacing="0" cellpadding="0" border="0" width="100%"> <script type="text/javascript">
<tr> var finishButtonPressed = false;
<%-- TODO: check for Guest user access and hide panel? --%> window.onload = pageLoaded;
<td width="100%" valign="top">
<% function pageLoaded()
PanelGenerator.generatePanelStart(out, request.getContextPath(), {
"yellowInner", "#ffffcc"); checkButtonState();
%> }
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr> function checkButtonState()
<td valign=top style="padding-top:2px" width=20></f:verbatim><h:graphicImage {
url="/images/icons/info_icon.gif" width="16" height="16" /><f:verbatim></td> if (document.getElementById("dialog:dialog-body:template").value == "none")
<td class="mainSubText"></f:verbatim><h:outputText {
value="#{msg.apply_rss_feed_warning1} " /> <a:actionLink document.getElementById("dialog:finish-button").disabled = true;
value="#{msg.manage_invited_users}" }
actionListener="#{BrowseBean.setupSpaceAction}" else
action="dialog:manageInvitedUsers"> {
<f:param name="id" value="#{SpaceDetailsDialog.id}" /> document.getElementById("dialog:finish-button").disabled = false;
</a:actionLink> <h:outputText value=" #{msg.apply_rss_feed_warning2}" /><f:verbatim></td> }
</tr> }
</table> </script>
<%
PanelGenerator.generatePanelEnd(out, request.getContextPath(),
"yellowInner");
%>
<div style="padding:4px"></div> <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc"); %>
<% <table cellpadding="0" cellspacing="0" border="0" width="100%">
PanelGenerator.generatePanelStart(out, request.getContextPath(), <tr>
"white", "white"); <td valign="top" style="padding-top:2px" width="20"></f:verbatim><h:graphicImage url="/images/icons/info_icon.gif" width="16" height="16" /><f:verbatim></td>
%> <td class="mainSubText"></f:verbatim>
<table cellpadding="2" cellspacing="2" border="0" width="100%"> <h:outputText value="#{msg.apply_rss_feed_warning1}" />
<tr> <a:actionLink value=" #{msg.manage_invited_users} " actionListener="#{BrowseBean.setupSpaceAction}" action="dialog:manageInvitedUsers">
<td><nobr></f:verbatim><h:outputText value="#{msg.rss_template}" /><f:verbatim>:</nobr></td> <f:param name="id" value="#{SpaceDetailsDialog.id}" />
<td width=100%><%-- Templates drop-down selector --%> </f:verbatim><h:selectOneMenu </a:actionLink>
value="#{ApplyRssTemplateDialog.RSSTemplate}"> <h:outputText value="#{msg.apply_rss_feed_warning2}" /><f:verbatim></td>
<f:selectItems value="#{TemplateSupportBean.RSSTemplates}" /> </tr>
</h:selectOneMenu><f:verbatim></td> </table>
</tr> <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner"); %>
</table> <div style="padding:4px"></div>
<% <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %></f:verbatim>
PanelGenerator.generatePanelEnd(out, request.getContextPath(), <h:panelGrid id="template-panel" columns="2" cellpadding="2" cellspacing="2" border="0" width="100%" columnClasses="panelGridLabelColumnAuto,panelGridValueColumn">
"white"); <h:outputText value="#{msg.rss_template}:" />
%> <h:selectOneMenu id="template" value="#{ApplyRssTemplateDialog.RSSTemplate}" onchange="checkButtonState();">
</td> <f:selectItems value="#{TemplateSupportBean.RSSTemplates}" />
</tr> </h:selectOneMenu>
</table> </h:panelGrid><f:verbatim>
</f:verbatim> <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
</f:verbatim>

View File

@@ -29,13 +29,32 @@
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%> <%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%>
<f:verbatim> <f:verbatim>
<table cellpadding="2" cellspacing="2" border="0" width="100%"> <script type="text/javascript">
<tr> var finishButtonPressed = false;
<td></f:verbatim><h:outputText value="#{msg.template}" /><f:verbatim>:</td> window.onload = pageLoaded;
<td width=100%><%-- Templates drop-down selector --%> </f:verbatim><h:selectOneMenu
value="#{ApplySpaceTemplateDialog.template}"> function pageLoaded()
<f:selectItems value="#{TemplateSupportBean.contentTemplates}" /> {
</h:selectOneMenu><f:verbatim></td> checkButtonState();
</tr> }
</table>
</f:verbatim> function checkButtonState()
{
if (document.getElementById("dialog:dialog-body:template").value == "none")
{
document.getElementById("dialog:finish-button").disabled = true;
}
else
{
document.getElementById("dialog:finish-button").disabled = false;
}
}
</script>
</f:verbatim>
<h:panelGrid id="template-panel" columns="2" cellpadding="2" cellspacing="2" border="0" width="100%" columnClasses="panelGridLabelColumnAuto,panelGridValueColumn">
<h:outputText value="#{msg.template}:" />
<h:selectOneMenu id="template" value="#{ApplySpaceTemplateDialog.template}" onchange="checkButtonState();">
<f:selectItems value="#{TemplateSupportBean.contentTemplates}" />
</h:selectOneMenu>
</h:panelGrid>