I have a form to capture the title and file name of an office document. The
form has a commandLink to invoke a backend method that then builds the
necessary LiveEdit url and redirects to that url. This works fine and Word is
invoked and the document has the appropriate title and filename.
I also need to be able to force the ajax region that defines the form to
refresh to hide the input fields (for title and file name) and then display a
launch message (not yet included). I have tried a number of different
approaches to make this happen but none have worked. I have attached relevant
code snippets below.
Any pointers/ideas? Need more info?
This is the code that validates the filename and then redirects... to the
livedit URL (liveCreateInContextURL is a modified version of the
Nuxeo-provided liveCreate code)
public String createOfficeDocument() throws ClientException {
// need to validate the date again! date is required
if (!DocumentDatePrefix.isFilePrefixValid(fileName)) {
facesMessages.add("Invalid file name prefix. All file names must
start with a valid date in the format yyyyMMdd");
return ACTION_PAGE_QUICK_LAUNCH;
}
redirectUrl =
officeTemplateListManager.liveCreateInContextUrl(quickLaunchName, docTitle,
fileName);
FacesContext context = FacesContext.getCurrentInstance();
HttpServletResponse httpResponse = (HttpServletResponse)
context.getExternalContext().getResponse();
try {
httpResponse.sendRedirect(redirectUrl);
} catch (IOException e) {
e.printStackTrace();
}
// reset attributes
setDocTitle("");
setFileName("");
return "";
}
The XHTML that collects the data. I have tried a number of different options
and none have worked
<ui:define name="body">
<div>
<a4j:region>
<a4j:form>
<a4j:outputPanel id="panel1"
ajaxRendered="true">
<h3><h:outputText
value="#{messages['ca.metalogic.officedocument.metadata.form.title']}" /></h3>
<h:outputText
value="#{messages['ca.metalogic.officedocument.metadata.form.subtitle']}"
rendered="#{quickLaunchActions.isEditMode}" />
<ui:include
src="/incl/message_banner.xhtml" />
<h:panelGrid columns="2"
styleClass="dataInput"
columnClasses="mckQuickLaunchLabelColumn, mckQuickLaunchFieldColumn"
rendered="#{quickLaunchActions.isEditMode}">
<h:outputLabel for="doctitle"
class="required" value="Document Title:" />
<h:panelGroup>
<h:inputText
id="doctitle" value="#{quickLaunchActions.docTitle}" required="true" size="80"
/>
<h:message
for="doctitle" />
</h:panelGroup>
</h:panelGrid>
<h:panelGrid columns="2"
styleClass="dataInput"
columnClasses="mckQuickLaunchLabelColumn, mckQuickLaunchFieldColumn"
rendered="#{quickLaunchActions.isEditMode}">
<h:outputLabel for="filename"
class="required" value="Office Document Name:" />
<h:panelGroup>
<h:inputText
id="filename" value="#{quickLaunchActions.fileName}" required="true" size="80"
/>
<h:message
for="filename" />
</h:panelGroup>
</h:panelGrid>
</a4j:outputPanel>
<h:panelGrid columns="1" styleClass="dataInput"
rendered="#{quickLaunchActions.isEditMode}">
<a4j:commandLink
id="saveOfficeMetadata" value="Create Document" immediate="true"
action="#{quickLaunchActions.createOfficeDocument}"
reRender="panel1" />
</h:panelGrid>
</a4j:form>
</a4j:region></div>
</ui:define>
--
Posted by "bgrant" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread:
<http://www.nuxeo.org/discussions/thread.jspa?threadID=3415#10361>
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm