First of all please reply to the list, not only me. All your problem can
help others.


I understand in the fragment "create_folder_panel.xhtml", in my example you
add oncomplete event in it and it doesn't work ?
If I'm right, in fact, if you look inside this fragment in nuxeo-dam you
have something like that :

  <a4j:form id="yourFormId" ajaxSingle="true">
   ... here your form ...

      <a4j:commandButton styleClass="button"
        value="#{messages['command.folder.create']}"
action="#{yourActionsBean.yourMethod}"
        data="#{facesContext.maximumSeverity.ordinal ge 2}"
        oncomplete="Richfaces.hideModalPanel('theNameOfYourModalPanel');"
        reRender="id1ToRerender, id2ToRerender" />

  </a4j:form>


In my example, theNameOfYourModalPanel = createFolderFormPanel

Be careful of the signature of your action yourActionsBean.yourMethod :
public void yourMethod() throws ... {
...
}

Benjamin

On 25 March 2010 14:33, Bruce Grant <[email protected]> wrote:

> Hi Benjamin,
>
> Thanks for the suggestion.
>
> I tried this, and can get the popup working (which is nice in itself) but
> this doesnt solve the problem. When I launch the redirect in code the
> oncomplete event of the button on the modal panel never fires, so the panel
> doesnt get hidden.
>
> Any other ideas?
>
> Thanks,
> bruce.
> --------------------
> metaLogic
> ph. +1.905.629.7775 x225
> fax +1.905.629.9887
> http://metaLogic.ca <http://metalogic.ca/>
>
>
>
> From:        Benjamin Jalon <[email protected]>
> To:        Bruce Grant <[email protected]>
> Date:        03/15/2010 06:40 PM
> Subject:        Re: [Ecm] Launching LiveEdit in code
> ------------------------------
>
>
>
> Maybe you can inspire with this code that we use in Nuxeo Dam to create a
> modal popup with rich:modalPanel :
> *
> http://hg.nuxeo.org/nuxeo-dam/file/299e8850213b/nuxeo-dam-webapp/src/main/resources/nuxeo.war/incl/admin/folders.xhtml
> *<http://hg.nuxeo.org/nuxeo-dam/file/299e8850213b/nuxeo-dam-webapp/src/main/resources/nuxeo.war/incl/admin/folders.xhtml>
>
> You can see that to create your popup modal you use that :
>   <rich:modalPanel id="createFolderFormPanel" autosized="true"
>     styleClass="CreateFolderFormPanel">
>     <f:facet name="header">
>       <h:panelGroup>
>         <!-- here the title of the modalPanel -->
>         <h:outputText value="#{messages['title.createFolder']}"/>
>       </h:panelGroup>
>     </f:facet>
>     <f:facet name="controls">
>       <h:panelGroup>
>         <!-- here the the cancel button on the top right of the modalPanel
> -->
>         <a4j:form id="createFolderHideForm">
>           <a4j:commandLink
>             actionListener="#{editableListBean.resetAllListsCachedModels}"
>             id="createFolderHideLink"
>             onclick="Richfaces.hideModalPanel('createFolderFormPanel')"
>             immediate="true" reRender="createFolderPanel">
>             <h:graphicImage value="/img/close.png" styleClass="hidelink"
> />
>           </a4j:commandLink>
>         </a4j:form>
>       </h:panelGroup>
>     </f:facet>
>         <!-- here the content of your modalPanel -->
>     <ui:include src="/incl/create_folder_panel.xhtml" />
>   </rich:modalPanel>
>
>
>
>
> Add this to you commandButton to close your ModalPanel
>
> oncomplete="if (!data) { Richfaces.hideModalPanel('createFolderFormPanel')
> };"
>
> And that to open your panel and call your method to initialize the backend
> :
>
>             <a4j:commandLink
>               action="#{folderAdminActions.resetNewFolder()}"
>               immediate="true"
>               reRender="createFolderPanel"
>               oncomplete=
> "Richfaces.showModalPanel('createFolderFormPanel')"
>               id="folder_creation_button"
>               rendered="#{notReadOnly}">
>               <h:outputText value="#{messages['command.createFolder']}" />
>             </a4j:commandLink>
>
> Hope this help...
>
> Benjamin
>
> On 15 March 2010 15:37, Bruce Grant 
> <*[email protected]*<[email protected]>>
> wrote:
> 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 gets the right title and filename.
>
> However, I also need to be able to force the ajax region that defines the
> form (that captures title and file name) 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.
>
> Does anyone have any ideas on how to force the region to refresh after the
> LiveEdit redirection?
>
> 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>
>
>
> _______________________________________________
> ECM mailing list*
> **[email protected]* <[email protected]>*
> **http://lists.nuxeo.com/mailman/listinfo/ecm*<http://lists.nuxeo.com/mailman/listinfo/ecm>
> To unsubscribe, go to 
> *http://lists.nuxeo.com/mailman/options/ecm*<http://lists.nuxeo.com/mailman/options/ecm>
>
>
>
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Reply via email to