AnsweredAssumed Answered

Strange behaviour of new extension/dialog

Question asked by politi on Jan 25, 2008
Latest reply on Jan 30, 2008 by politi
Hello,
I'mt developing an extension that add a new action to spaces (a customized version of the existing import dialog).
The new dialog sould be very similiar to the original one, with only a comboBox (selectOneMenu) placed AFTER the upload button.

I need something like this:

+————————————+  +————+
| 1. locate file to upload           |  |   +—-+   |
|                                    |  |   | OK |   |
|    Location: _______________       |  |   +—-+   |
|                                    |  | +——–+ |
| 2. Press Upload                    |  | | Cancel | |
|                                    |  | +——–+ |
|    +——+                        |  +————+
|    |UPLOAD|                        |
|    +——+                        |
|                                    |
| 3. Select Priority:                |
|                                    |
|    +———–+-+                 |
|    | choice 1  |v|                 |
|    +———–+-+                 |
|                                    |
+————————————+

I copied/pasted some of the code from the import.jsp into my page to reuse some of the classes/method for uploading a file, and then added the selectMenu section, but what I obtain is a messed-up interface.


+————————————+  +————+
| 1. locate file to upload           |  |   +—-+   |
|                                    |  |   | OK |   |
| 2. Press Upload                    |  |   +—-+   |
|                                    |  | +——–+ |
| 3. Select Priority:                |  | | Cancel | |
|                                    |  | +——–+ |
|    +———–+-+                 |  +————+
|    | choice 1  |v|                 |
|    +———–+-+                 |
|                                    |
|    Location: _______________       |
|                                    |
|    +——+                        |
|    |UPLOAD|                        |
|    +——+                        |
|                                    |
+————————————+

It looks like if "pure HTML"  and "JSF generated HTML" are rendered in different places.

Here is some of the code I used to generate the extension.


web-client-config-custom.xml

<alfresco-config>

   <config>
      <actions>

         <action id="my_import">
            <label>My Import</label>
            <image>/images/icons/my_import.gif</image>
            <action>dialog:myImport</action>
            <action-listener>
               #{BrowseBean.setupSpaceAction}
            </action-listener>
            <params>
               <param name="id">#{actionContext.id}</param>
            </params>
         </action>

         <!– Add action to more actions menu for each space –>
         <action-group id="space_browse_menu">
            <action idref="my_import" />
         </action-group>
      </actions>

      <dialogs>
         <dialog name="myImport"
            page="/jsp/extension/my-import.jsp"
            managed-bean="MyImportBean"
            icon="/images/icons/my_import_large.gif"
            title="My Import"
            description="Custom Import" />
      </dialogs>

   </config>

</alfresco-config>


my-import.jsp

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a"%>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%>

<%@ page buffer="32kb" contentType="text/html;charset=UTF-8"%>
<%@ page isELIgnored="true"%>




<!– Upload Form –>
<r:uploadForm>
   <h:outputText value=" 1. Locate the file to upload<br><br>"
      escape="false" />

   <br>
   <br>
       File location:
   <input style="margin-left:12px;" type="file" size="50"
      name="alfFileInput" />
   <br>
   <br>
   <h:outputText value=" 2. Click Upload<br><br>" escape="false" />
   <br>
   <br>
   <input style="margin-left:12px;" type="submit" value="Upload" />
   <br>
</r:uploadForm>
<!– END: Upload Form –>

<!– Priority –>
<h:form acceptcharset="UTF-8" id="import-priority">
   <h:outputText
      value=" 3. Choose desired priority for import operations<br>"
      escape="false" />
   <br>
   <br>
   <h:outputText value="<br>    " escape="false"/>

   <h:selectOneMenu value="#{DialogManager.bean.first}" id="Priority">
      <f:selectItem itemValue="User" itemLabel="User" id="firstUser" />
      <f:selectItem itemValue="Project" itemLabel="Project"
         id="firstProject" />
   </h:selectOneMenu>
   <br>
   <br>
</h:form>
<!– END: Priority –>

As you see, the jsp uses both pure html tags and jsf tags, but for some reasons they cannot be rendered in the correct order. The problem is somehow related with the INPUT tags, since they are rendered "after" everything else, but I need them (as I need JSF to manage the select menu).

Any idea of what I am doing wrong?

Thank you very much.

Roberto

Outcomes