cancel
Showing results for 
Search instead for 
Did you mean: 

[solved]Detailed view with some metadata+edit metadata link

coffman
Champ in-the-making
Champ in-the-making
Hi
Is it possible to extend the detailed view to show some metadata ?
I am planning to make documents on a folder of type invoice with customer, id and some other attributes.

I need that the Invoice folder detailed view shows some metada (Customer for example) and a link to directly "Edit metadata".

Also I need to show this view ONLY to the folder Invoices, for the rest of folders the default view is ok.

Is this possible ?
How can i achieve this ? or how can i look for more information ?

Thanks
10 REPLIES 10

gavinc
Champ in-the-making
Champ in-the-making
There isn't a way to override the metadata shown in the detailed view. You will need to edit browse.jsp directly.

In browse.jsp you will find various "a:column" components, these define the metadata to show. You can add new columns here or remove existing ones if you wish.

As for property editing, there is a dialog pre-defined that will allow you to edit properties, it's called 'editContentProperties', you can configure a new action to launch this dialog. See the following wiki pages for more info:

http://wiki.alfresco.com/wiki/Actions
http://wiki.alfresco.com/wiki/Adding_a_Custom_Dialog

coffman
Champ in-the-making
Champ in-the-making
Ok thanks a lot …
For the second part of the question, i write the following custom action to the group of actions for every document:
         
<action id="edit_metadata_doc">
            <label-id>editmeta</label-id>
            <image>/images/icons/edit_icon.gif</image>
            <action-listener>#{CheckinCheckoutBean.setupContentAction}</action-listener>
            <action>dialog:editContentProperties</action>
            <params>
               <param name="id">#{actionContext.id}</param>
            </params>
         </action>


I always get the same error when clicking on the action:
java.lang.NullPointerException
        at org.alfresco.web.bean.content.EditContentPropertiesDialog.initEditableNode(EditContentPropertiesDialog.java:86)
        at org.alfresco.web.bean.content.EditContentPropertiesDialog.init(EditContentPropertiesDialog.java:69)
        at org.alfresco.web.bean.dialog.DialogManager.setCurrentDialog(DialogManager.java:102)
        at org.alfresco.web.app.AlfrescoNavigationHandler.handleDialogOpen(AlfrescoNavigationHandler.java:538)
        at org.alfresco.web.app.AlfrescoNavigationHandler.handleNavigation(AlfrescoNavigationHandler.java:111)
        at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:84)
        at javax.faces.component.UICommand.broadcast(UICommand.java:106)
        at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
        at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:105)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:81)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:595)

Any suggestion would be gratefull

Regards …

coffman
Champ in-the-making
Champ in-the-making
Hi.
I fix the error on the previous post with this code:

         <action id="edit_metadata_doc">
            <permissions>
               <permission allow="true">Write</permission>
            </permissions>
            <label-id>edit_properties</label-id>
            <image>/images/icons/edit_properties.gif</image>
            <action>dialog:editContentProperties</action>
            <action-listener>#{BrowseBean.setupContentAction}</action-listener>
            <params>
               <param name="id">#{actionContext.id}</param>
            </params>
         </action>

The problem is the following:
The user can see the "edit metadata" button, click it and edit the metadata, but when the user "Accept" the changes, this error raises:

org.alfresco.service.cmr.repository.ScriptException: Failed to execute script 'workspace://SpacesStore/bbf69b2e-09df-11dc-a717-cf0ce923f32d': Wrapped java.lang.IllegalArgumentException: Destination Node is a mandatory parameter (AlfrescoScript#15)
        at org.alfresco.repo.jscript.RhinoScriptService.executeScript(RhinoScriptService.java:168)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


Anyone has any suggestion on how to fix it ?

Thanks

coffman
Champ in-the-making
Champ in-the-making
Ups , sorry …
Its my mistake …

The action works perfectly, the error comes from my script.

Thanks

schneika
Champ in-the-making
Champ in-the-making
I have modified browse.jsp with an additional colum for the category (aspect):

<%– Category column for all view modes –%>
<a:column id="col19" style="text-align:left">
<f:facet name="header">
<a:sortLink id="col19-sort" label="#{msg.category}" value="category" styleClass="header"/>
</f:facet>
<hutputText id="col19-txt" value="#{r.category}" />
</a:column>

The column "Category" will be displayed, but not the related value of the category, the column is empty… how ca i get the value of the category-aspect?

gavinc
Champ in-the-making
Champ in-the-making
You will need to write a property resolver object to display the category name. The category is stored as an association on the node, you'll need to navigate the association and get the name of the node at the target.

Have a look at UICategorySelector for an example of displaying the category names.

Also see BrowseBean for examples of adding property resolvers.

Hope this helps.

howil
Champ in-the-making
Champ in-the-making
I need this feature, viewing the categories in one of the views, also.

has anyone done this till now??
I mean writing a property resolver object… because I have no experience in writing JavaServerApplets and it would take me an immense amount of time to learn what i should do.

Would be great if it would be implemented as standard options to modify the view. I saw a 'Costum View' - Tab in the Icon-View-Entry but couldn't find where to change it or how to select it.

Thanks in advance,
howil

johnwalsh
Champ in-the-making
Champ in-the-making
Hi,

I must be missing something basic here. I tried to do what coffman said he got working, and I can't get it. I've added some new custom properties in a new name space that has a prefix of "dwr". I want to show one of those properties for each child space within a given space. When I add a new a:column component to browse.jsp, it's not clear to me how I get it to show the value dwr:analyst.

If I try just "analyst", nothing is displayed for a column value (Makes sense, it's assuming the "cm" namespace, based on the code in QName.resolveToQNameString(…)). If I try "dwr:analyst", the expression language parser complains about the ":". I've tried various ways of escaping or quoting the string, to no avail.

Should I be able to dot notate into the contained properties map using dwr:analyst as the key?

Any help would be appreciated.

Here's one variation of my JSP snippet:
    <a:column id="col4-1" style="text-align:left">
        <f:facet name="header">
            <a:sortLink id="col4-1-sort" label="Analyst" value="analyst" styleClass="header"/>
        </f:facet>
        <h:outputText id="col4-1-txt" value='#{r.dwr:analyst}'/>
    </a:column>

Thanks,
John

tara_b
Champ in-the-making
Champ in-the-making
Hi,

I've been able to customise browse.jsp to include the title for the Icons View, as below:

<%– Primary column for icons view mode –%>
<a:column id="col11" primary="true" style="padding:2px;text-align:left;vertical-align:top;" rendered="#{BrowseBean.browseViewMode == 'icons'}">
<f:facet name="large-icon">
<a:actionLink id="col11-act1" value="#{r.title}" href="#{r.url}" target="new" image="#{r.fileType32}" showLink="false" styleClass="inlineAction" />
</f:facet>
<a:actionLink id="col11-act2" value="#{r.title}" href="#{r.url}" target="new" styleClass="header" />
<r:lockIcon id="col11-lock" value="#{r.nodeRef}" align="absmiddle" />
<h:outputLabel id="col11-lang" value="#{r.lang}" styleClass="langCode" rendered="#{r.lang != null}"/>
<r:nodeInfo id="col11-info" value="#{r.id}">
<h:graphicImage id="col11-img" url="/images/icons/popup.gif" styleClass="popupImage" width="16" height="16" />
</r:nodeInfo>
</a:column>


However i cant work out how to add the Author. I've searched through this forum and tried many different things - this is my latest attempt:

<%– Author column for all view modes –%>
<a:column id="col13" style="text-align:left" rendered="#{BrowseBean.browseViewMode == 'icons'}">
<f:facet name="header">
<a:sortLink id="col13-sort" label="#{msg.author}" value="#{r.properties['cm:author']}" styleClass="header"/>
</f:facet>
<h:outputText id="col13-txt" value="#{r.properties['cm:author']}" />
</a:column>

I think the problem is that the property cm:author is not recognised. Gavin mentioned a Property Resolver. Can anyone explain more about what this is?

Thanks!