cancel
Showing results for 
Search instead for 
Did you mean: 

URGENT HELP !!! showing the association as a hyperlink

hey123
Champ in-the-making
Champ in-the-making
Hello,
I am defining a new content type with a child content association. But, when I want to view the properties of an object of this content type, child associations are shown like  below:

Incoming Documents:      /company_home/README.txt
                                     /company_home/11111111README_mysql.txt

(not a hyperlink, just the text version of the xpath of the documents)

But I want to make these association contents (can be text or jpeg files) viewable when I click on them.

Thank you in advance,

My Model Definition:
<type name="my:iadeDosyasi">
         <title>Standard Operating Procedure</title>
         <parent>cm:content</parent>
          <properties>
           <property name="my:EvrakNumarasi">
               <type>d:text</type>
            </property>
</properties>
         <associations>
            <child-association name="my:gelenEvraklar">
               <source>                 
                  <mandatory>true</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:content</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </child-association>
        </associations>
      </type>

My Web Client Configuration :
<config evaluator="node-type" condition="my:iadeDosyasi">
      <property-sheet>
     <show-property name="my:EvrakNumarasi" />
                  <show-child-association name="my:gelenEvraklar" display-                   label="offfff yaaa off" converter="org.alfresco.faces.DisplayPathConverter"/>
    </property-sheet>
   </config>
24 REPLIES 24

aznk
Champ in-the-making
Champ in-the-making
Hi,

I've been also trying to link documents but couldn't find out how to view them as links instead of xpath. I don't know if this could be done only by configuring xml files, maybe that would suppose modifying interface.
I'll be watching this topic.

gavinc
Champ in-the-making
Champ in-the-making
Basically the generic child association editor is being used. This can be overridden by using the component-generator attribute in the config file, however, you need to create a custom component generator.

Have a look at the following wiki pages as a start:

http://wiki.alfresco.com/wiki/Displaying_Custom_Metadata
http://wiki.alfresco.com/wiki/Component_Generator_Framework

Once you have an idea of how to go about it, you'll need to create a component that shows whatever is at the end of the child association i.e. an image when the component is in read-only mode.

hey123
Champ in-the-making
Champ in-the-making
Hi Gavinc,
I looked at the wiki pages.
At the end, I decided to use NodePath component of alfresco and I created a generator for it. Steps that I took were:

1-I created a jar file including the following source code

package org.alfresco.web.bean.generator;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;

import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.ui.repo.RepoConstants;
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet;

/**
* Generates a component to manage child associations.
*
* @author gavinc
*/
public class CustomNodePathGenerator extends BaseComponentGenerator
{
   private String disabled;

   public UIComponent generate(FacesContext context, String id)
   {
      UIComponent component = context.getApplication().
            createComponent("org.alfresco.faces.NodePath");
      FacesHelper.setupComponentId(context, component, id);
      component.getAttributes().put("disabled", this.disabled);     
      return component;
   }
  
   @Override
   protected void setupMandatoryValidation(FacesContext context, UIPropertySheet propertySheet,
         PropertySheetItem item, UIComponent component, boolean realTimeChecking, String idSuffix)
   {
      // Override the setup of the mandatory validation
      // so we can send the _current_value id suffix.
      // We also enable real time so the page load
      // check disables the ok button if necessary, as the user
      // adds or removes items from the multi value list the
      // page will be refreshed and therefore re-check the status.
     
      super.setupMandatoryValidation(context, propertySheet, item,
            component, true, "_current_value");
   }

public String getDisabled() {
   return disabled;
}

public void setDisabled(String disabled) {
   this.disabled = disabled;
}
}


2-Then I add the following lines to faces-config-custom.xml

<managed-bean>
   <managed-bean-name>CustomNodePathGenerator </managed-bean-name>
   <managed-bean-class>org.alfresco.web.bean.generator.CustomNodePathGenerator</managed-bean-class>
   <managed-bean-scope>request</managed-bean-scope>
   <managed-property>
      <property-name>disabled </property-name>
      <value>true</value>
   </managed-property>
</managed-bean>


3-Then I add the following lines to web-client-config-custom.xml
<show-child-association name="my:incomingDocuments" component-generator="CustomNodePathGenerator" display-label="Incoming Documents"/>


But nothing happened.

Even I tried each of the followings:

<show-child-association name="my:incomingDocuments" converter="org.alfresco.faces.DisplayPathConverter" component-generator="CustomNodePathGenerator" display-label="Incoming Documents"/>

<show-child-association name="my:incomingDocuments" converter="org.alfresco.faces.DisplayPathConverter" display-label="Incoming Documents"/>

And again I got nothing. Can you help me please.

Thank you in advance.

gavinc
Champ in-the-making
Champ in-the-making
When you say nothing happens what do you mean?

Do you see the association at all i.e. the default component? Are there any errors reported? Remove the comment for the line "#log4j.logger.org.alfresco.web.ui.common.Utils=info" in log4j.properties and try displaying the property sheet again.

However, this component was not designed to work within the property sheet and has therefore not been tested in this configuration so I'm not sure whether it's going to work, it may well be relying on some context that is not available within the property sheet.

hey123
Champ in-the-making
Champ in-the-making
Nothing changed in the child association part,
while waiting for your answer, to understand whether there is a problem in showing this new generator in the property sheet, I tried using this generator for a text area field, and then the property sheet could not show it, so you are probably right that it is giving error messages in the background.

Sir,
as a result, just to show the text in hyperlinks do I have to write a new component ?

And if this is the only solution, can you advice me a preexisting component to just copy, paste and make as little as possible changes to reach the result.

Thank you very much for your previous quick response. I am trying to finish this for a very important demo to our clients.


When you say nothing happens what do you mean?

Do you see the association at all i.e. the default component? Are there any errors reported? Remove the comment for the line "#log4j.logger.org.alfresco.web.ui.common.Utils=info" in log4j.properties and try displaying the property sheet again.

However, this component was not designed to work within the property sheet and has therefore not been tested in this configuration so I'm not sure whether it's going to work, it may well be relying on some context that is not available within the property sheet.

paulhh
Champ in-the-making
Champ in-the-making
Hopefully that client will want to pay for support 🙂

Urgent help from the core engineers via the forums is asking them to be very nice to you!  They only get their salaries from the paid support that people take out.

Cheers
Paul.

hey123
Champ in-the-making
Champ in-the-making
We were trying to sell(not actually sell you know getting support training etc.) alfresco to them Smiley Sad,
anyway I will say in the demo that, this is just a trial version and at the end they will be able to see the documents.

Thanks.
Hopefully that client will want to pay for support 🙂

Urgent help from the core engineers via the forums is asking them to be very nice to you!  They only get their salaries from the paid support that people take out.

Cheers
Paul.

gavinc
Champ in-the-making
Champ in-the-making
Unfortunately, yes, it looks like you'd need to write a new component to achieve the result you need.

The component you tried to use probably has the code in it you'd need to generate the link. Just follow the pattern for any other self rendering component, for example, UINodeWorkflowInfo.

aznk
Champ in-the-making
Champ in-the-making
couldn't we use the actionLink defined here ?
http://wiki.alfresco.com/wiki/ActionLink
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.