cancel
Showing results for 
Search instead for 
Did you mean: 

html controls for content properties

timv
Champ in-the-making
Champ in-the-making
Hi,

1) As I can see, the following html form elements can be used for the datatypes:
- 1 text input line for d:text
- combobox for d:text using constraints
- date input fields for d:date and d:datetime
- the association control for associations

Now, is there e.g. an easy way (preferably only by configuration, without developing) to have an input box for text that has multiple lines?

Also, if I would like to have an html editor control for a certain datatype for example d:text, how would I configure this?


2) Another thing, is it possible to have a "create content"-wizard that skips the page for content type (html or plain text) and just goes to the content properties page. I only want to use the content properties.



The reason for these questions is that I have been using Fatwire Spark before and want to keep the same functionality of content classes as I like it a lot. I'm switching to Alfresco because I don't like all the interface, quality and less extensibility of the Fatwire products.

I see that Alfresco is very powerfull but you need to know how to configure it.

Greets,
timv
6 REPLIES 6

timv
Champ in-the-making
Champ in-the-making
Hi,

I guest for 1) I have to write my own TextfieldWithMultipleLinesComponentGenerator (?) and add it as component generator for my field of type d:text.


2) I don't know ..

gavinc
Champ in-the-making
Champ in-the-making
Hi timv,

Yes, you are right you would have to implement a component generator that creates a HTML textarea and then configure the property to use that component generator.

This is actually something that will be added to the 1.4 release.

You would do the same thing to get a HTML editor for a certain property.

Yes, you can remove the content step for the "Create Content" wizard if you wish, simply override the configuration for the wizard and miss out the 2nd step, the underlying beans can cope with the null content so you should be fine.

devrim
Champ in-the-making
Champ in-the-making
Hello,

I've made a summary for text area generator.

To make a property editable in text area:

- Copy org.alfresco.web.bean.generator.TextFieldGenerator from web-client.jar, paste it in your package

- Rename it to TextAreaGenerator

- In generate function of TextAreaGenerator change the line:
component.setRendererType(ComponentConstants.JAVAX_FACES_TEXT);
to
component.setRendererType("javax.faces.Textarea");

- In generate function, add this line:
component.getAttributes().put("rows", "8");
You might also want to change maxlength and size attributes which are set in this function.

-Build your package and copy the jar file to directory alfresco/tomcat/webapps/alfresco/WEB-INF/lib

- Add this managed bean to alfresco/tomcat/webapps/alfresco/WEB-INF/faces-config-custom.xml
Don't forget to change package_name with your actual package name

<managed-bean>
      <description>
         Bean that generates a text area component
      </description>
      <managed-bean-name>TextAreaGenerator</managed-bean-name>
      <managed-bean-class>package_name.TextAreaGenerator</managed-bean-class>
      <managed-bean-scope>request</managed-bean-scope>
</managed-bean>

- Modify the file extension/web-client-config-custom.xml, add component-generator attribute to show-property element for your model.
Such as:
<config evaluator="node-type" condition="my:docModel">
      <property-sheet>
    <show-property name="my:summary" component-generator="TextAreaGenerator"/>
.. bla.. bla…

- Restart alfresco, now you can edit the property in text area. You can also add a template to view this property as a textarea.

gavinc
Champ in-the-making
Champ in-the-making
There is now a supported TextAreaGenerator as part of the 1.4 release (a preview release should be out this week, hopefully today).

The new TextAreaGenerator component does exactly what you describe below. The rows and columns are configurable via the <managed-property> element. Have a look at faces-config-beans.xml in the preview release for an example.

The default size for a text field and the date range in the date picker are also now configurable in the same manner.

alexeyg
Champ in-the-making
Champ in-the-making
I understand this works when one wants to include additional options to the Web Client screen, correct?  What can I do to change the already-existing Description field to a text area?

alexeyg
Champ in-the-making
Champ in-the-making
Got it (displaying Description as a text area for Alfresco 1.3)!

I'm not very familiar with JSF… also I did not know that Description is handled as an Aspect and not a Type - does that make any sense? 

I'm new to this side of Alfresco, please correct me if I'm wrong…  Not very comfortable with my understanding of what <types> are and how they are different from <aspects>.

Anyways, here are my steps:

1) Get org.alfresco.web.bean.generator.TextAreaGenerator from Alfresco 1.4

2) Added TextAreaGenerator managed bean to

Added to faces-config-beans.xml:

   <managed-bean>
      <description>
         Bean that generates a text area component
      </description>
      <managed-bean-name>TextAreaGenerator</managed-bean-name>
      <managed-bean-class>org.alfresco.web.bean.generator.TextAreaGenerator</managed-bean-class>
      <managed-bean-scope>request</managed-bean-scope>
      <managed-property>
         <property-name>rows</property-name>
         <value>3</value>
      </managed-property>
      <managed-property>
         <property-name>columns</property-name>
         <value>32</value>
      </managed-property>
   </managed-bean>

3) Added component-generator="TextAreaGenerator" to <show-property name="description"> of "titled" aspect. 

Edited in web-client-config-properties.xml:

   <config evaluator="aspect-name" condition="titled">
      <property-sheet>
         <!– The 'name' property isn't part of the titled aspect –>
         <!– but it's presence here will force it to the top of the –>
         <!– list when custom types are defined in  –>
         <!– web-client-config-custom.xml –>
         <show-property name="name" />
         <show-property name="title" />
         <show-property name="description" component-generator="TextAreaGenerator"/>
      </property-sheet>
   </config>