Cambiar el selector de ficheros en las asociaciones
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2011 12:33 PM
Hola,
He creado una asociación entre dos tipos de ficheros. Cuando voy a establecer los fichero asociados editando las propiedades de un documento, aparece un componente que quisiera cambiar. Quisiera utilizar un buscador como el utilizado para seleccionar el avatar de un usuario, es decir, navegando por los espacios hasta encontrar el fichero. ¿Alguien ha hecho algo parecido?
Gracias,
He creado una asociación entre dos tipos de ficheros. Cuando voy a establecer los fichero asociados editando las propiedades de un documento, aparece un componente que quisiera cambiar. Quisiera utilizar un buscador como el utilizado para seleccionar el avatar de un usuario, es decir, navegando por los espacios hasta encontrar el fichero. ¿Alguien ha hecho algo parecido?
Gracias,
Labels:
- Labels:
-
Archive
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2011 07:07 AM
Hola agey,
Esos formularios se cargan usando el Form Service de Alfresco y su configuracion para Share esta definido en el fichero share-form-config.xml. Puedes especificar que plantilla usar para cada propiedad del tipo de contenido.
Puedes echar un vistazo a http://wiki.alfresco.com/wiki/Forms
Espero te ayude.
Esos formularios se cargan usando el Form Service de Alfresco y su configuracion para Share esta definido en el fichero share-form-config.xml. Puedes especificar que plantilla usar para cada propiedad del tipo de contenido.
Puedes echar un vistazo a http://wiki.alfresco.com/wiki/Forms
Espero te ayude.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2011 08:47 AM
Hola fstnboy,
Gracias por contestar. Estoy utilizando Alfresco versión 3.0 y al final lo solucioné siguiendo el componente utilizado para categorias: un multiValueSelector junto con el ajaxFileSelector para navegar por los espacios y seleccionar los ficheros. El ajaxFileSelector permite especificar el mimetype de los ficheros pero yo además quería especificar el tipo del fichero así que he creado UIAjaxFileAssocPicker y AjaxFileAssocSelectorTag para añadir un nuevo parámetro que sea el type de los ficheros disponibles en el selector. El problema es que este parámetro siempre me lo coge a null y no se que es lo que me falta.
Esta es la clase UIAjaxFileAssocPicker
Esta es la clase AjaxFileAssocSelectorTag
En faces-config.xml he especificado el componente:
y en repo.tld he añadido la definición del nuevo tag:
Por último en edit-content-properties.jsp he añadido lo siguiente:
El selector funciona y se muestra como yo quiero. El problema es que el parámetro type="{FacturaModel.model}facturas" no lo coge. El parámetro type en EditContentPropertiesDialog.getFileFolderNodes() es null. Este es el código que utilizo en dicha función para recuperar el parámetro pero en System.out.println("typeParam " + typeParam) veo que es null:
¿porqué no me coge el valor que le indico en el tag?¿me falta alguna configuración?
Muchas gracias de antemano.
Gracias por contestar. Estoy utilizando Alfresco versión 3.0 y al final lo solucioné siguiendo el componente utilizado para categorias: un multiValueSelector junto con el ajaxFileSelector para navegar por los espacios y seleccionar los ficheros. El ajaxFileSelector permite especificar el mimetype de los ficheros pero yo además quería especificar el tipo del fichero así que he creado UIAjaxFileAssocPicker y AjaxFileAssocSelectorTag para añadir un nuevo parámetro que sea el type de los ficheros disponibles en el selector. El problema es que este parámetro siempre me lo coge a null y no se que es lo que me falta.
Esta es la clase UIAjaxFileAssocPicker
public class UIAjaxFileAssocPicker extends BaseAjaxItemPicker{ /** list of mimetypes to restrict the available file list */ private String mimetypes = null; private String type = null; @Override public String getFamily() { return "org.alfresco.faces.AjaxFileAssocPicker"; } /** * @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext, java.lang.Object) */ public void restoreState(FacesContext context, Object state) { Object values[] = (Object[])state; super.restoreState(context, values[0]); this.mimetypes = (String)values[1]; this.type = (String)values[2]; } /** * @see javax.faces.component.StateHolder#saveState(javax.faces.context.FacesContext) */ public Object saveState(FacesContext context) { Object values[] = new Object[] { super.saveState(context), this.mimetypes, this.type}; return values; } @Override protected String getServiceCall() { return "EditContentPropertiesDialog.getFileFolderNodes"; } @Override protected String getDefaultIcon() { // none required - we always return an icon name in the service call return null; } @Override protected String getRequestAttributes() { String mimetypes = getMimetypes(); String type = getType(); String string = null; if (mimetypes != null) { string = "mimetypes=" + URLEncoder.encode(mimetypes); } if (type != null) { if(string != null && string.length() > 0){ string += " types=" + URLEncoder.encode(type); }else{ string = " types=" + URLEncoder.encode(type); } } return string; } // —————————————————————————— // Strongly typed component property accessors /** * @return Returns the mimetypes to restrict the file list. */ public String getMimetypes() { ValueBinding vb = getValueBinding("mimetypes"); if (vb != null) { this.mimetypes = (String)vb.getValue(getFacesContext()); } return this.mimetypes; } /** * @param mimetypes The mimetypes restriction list to set. */ public void setMimetypes(String mimetypes) { this.mimetypes = mimetypes; } public String getType() { ValueBinding vb = getValueBinding("type"); if (vb != null) { this.type = (String)vb.getValue(getFacesContext()); } return this.type; } public void setType(String type) { this.type = type; }}
Esta es la clase AjaxFileAssocSelectorTag
public class AjaxFileAssocSelectorTag extends AjaxItemSelectorTag{ /** * @see javax.faces.webapp.UIComponentTag#getComponentType() */ public String getComponentType() { return "org.alfresco.faces.AjaxFileAssocPicker"; } /** * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent) */ protected void setProperties(UIComponent component) { super.setProperties(component); setStringProperty(component, "mimetypes", this.mimetypes); setStringProperty(component, "type", this.type); } /** * @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release() */ public void release() { super.release(); this.mimetypes = null; this.type = null; } /** * Set the mimetypes * * @param mimetypes the mimetypes */ public void setMimetypes(String mimetypes) { this.mimetypes = mimetypes; } public void setType(String type) { this.type = type; } /** the mimetypes */ private String mimetypes; private String type;}
En faces-config.xml he especificado el componente:
<component> <component-type>org.alfresco.faces.AjaxFileAssocPicker</component-type> <component-class>org.alfresco.module.assocSelector.ui.UIAjaxFileAssocPicker</component-class> </component>
y en repo.tld he añadido la definición del nuevo tag:
<tag> <name>ajaxFileAssocSelector</name> <tag-class>org.alfresco.module.assocSelector.ui.tag.AjaxFileAssocSelectorTag</tag-class> <body-content>JSP</body-content> <attribute> <name>id</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>binding</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>rendered</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>style</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>styleClass</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>value</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>label</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>initialSelection</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>singleSelect</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>disabled</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>height</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>mimetypes</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>type</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> </tag>
Por último en edit-content-properties.jsp he añadido lo siguiente:
<h:panelGrid columns="2" style="padding-top: 4px; padding-bottom: 4px;" width="100%"> <h:outputLabel for="multi-associations-selector" value="#{msj.frasRelacionadas}"/> <r:multiValueSelector id="multi-associations-selector" value="#{DialogManager.bean.associations}" lastItemAdded="#{DialogManager.bean.fileAssocAdded}" selectItemMsg="#{msj.select_fras_assoc}" selectedItemsMsg="#{msj.selected_fras_assoc}" noSelectedItemsMsg="#{msg.no_selected_fras}" styleClass="multiValueSelector"> <f:subview id="associationSelector"> <r:ajaxFileAssocSelector id="associations" value="#{DialogManager.bean.fileAssocAdded}" label="#{msj.select_fras_assoc}" initialSelection="#{NavigationBean.currentNode.nodeRefAsString}" mimetypes="application/pdf" type="{FacturaModel.model}facturas" styleClass="selector" singleSelect="true" height="105px" /> </f:subview> </r:multiValueSelector> </h:panelGrid>
El selector funciona y se muestra como yo quiero. El problema es que el parámetro type="{FacturaModel.model}facturas" no lo coge. El parámetro type en EditContentPropertiesDialog.getFileFolderNodes() es null. Este es el código que utilizo en dicha función para recuperar el parámetro pero en System.out.println("typeParam " + typeParam) veo que es null:
Set<String> types = null; String typeParam = (String)params.get("type"); System.out.println("typeParam " + typeParam); if (typeParam != null && typeParam.length() != 0) { // convert to a set of types to test each file against types = new HashSet<String>(); for (StringTokenizer t = new StringTokenizer(typeParam, ","); t.hasMoreTokens(); /**/) { types.add(t.nextToken()); } }
¿porqué no me coge el valor que le indico en el tag?¿me falta alguna configuración?
Muchas gracias de antemano.
