cancel
Showing results for 
Search instead for 
Did you mean: 

Where to put custom view-render

riccardog
Champ in-the-making
Champ in-the-making
Hi,

my goal, today, is:  to make my own  custom Documentlibrary View and deploy it be an AMP.
I  begun reading the documentation
http://docs.alfresco.com/4.2/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Fconcepts%2Fdoclib-web-...
and
http://docs.alfresco.com/4.2/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Fconcepts%2Fdoclib-web-...

I also took a look into
share/WEB-INF/classes/surf-config.xml 
and read a lot of blogs;

After all this reading I realized that I can perhaps put my own
<view-render>
  in at least in a couple of places (in my AMP project) , that is
src/main/resourcer/META-INF/share-config-custom.xml
or
amp/config/alfresco/web-extension/share-documentlibrary-config.xml

so,  from   a working copy of
share/WEB-INF/classes/alfresco/share-documentlibrary-config.xml
I pulled out a <b>working</b> example

<view-renderer id="dublin_core" iconClass="table" label="button.view.dublinCore" index="80" widget="Alfresco.DocumentListTableViewRenderer">


and put it in a new xml file.
my brand new file was something like this:

<alfresco-config>
  <config evaluator="string-compare" condition="DocumentLibrary" >
      <doclist>
         <view-renderers>
            <view-renderer id="dublin_core" iconClass="table" label="button.view.dublinCore" index="80" widget="Alfresco.DocumentListTableViewRenderer">
               <dependencies>
                  <js src="components/documentlibrary/documentlist-view-detailed.js" />
                  <js src="components/documentlibrary/documentlist-view-table.js" />
                  <css src="components/documentlibrary/documentlist-view-table.css" />
               </dependencies>
               <json-config>
                  ….
               </json-config>
            </view-renderer>
         </view-renderers>
   </doclist>
   </config>
</alfresco-config>


According to the references,I placed it in some different places and with different names;
I removed/added the nesting into 
<doclist>
and 
< view-renderers>
elements;

After all those attempts , I've never seen my dublinCore table in my document Library Smiley Sad

Into the xml file I also put the flags to popup the js debug window, so I am pretty confident that the xml is ok ( in fact the debug popup works as it should do).

At this point I am sure I am missing something, so the question is:


when I have an AMP project, where  do I have to put my  <view-renderer>?   Is there a working example somewhere?

Thank you,

RIc
7 REPLIES 7

tonyrivet
Champ in-the-making
Champ in-the-making
Hi,

Did you try to add your custom view renderer in amp/config/alfresco/web-extension/share-config-custom.xml ?

riccardog
Champ in-the-making
Champ in-the-making
Hi Tony,
if I put a share-config-custom.xml in  amp/config/alfresco/web-extension/
then the whole share stops working.
Even if my file contains  "nothing", like

<?xml version="1.0" encoding="UTF-8"?>
<alfresco-config>
<config evaluator="string-compare" condition="DocumentLibrary" >
</config>
</alfresco-config>

I get lots of odd  errors, for example: 
<cite>Unable to retrieve License information from Alfresco: 404</cite>
or
<cite>Failed during processing of Google Docs subsystem status configuration from Alfresco: 01110000 Unable to retrieve Google Docs subsystem status from Alfresco: 404</cite>

I think that this  share-config-custom.xml overrides totally the standard share config.


RIc

tonyrivet
Champ in-the-making
Champ in-the-making
As long as you don't put the replace="true" attribute in your config, Share will not override the native config but just extend it, so I think it should work.

Your errors let think Share can't reach the Alfresco Repo.

On which kind of Alfresco are you deploying your AMP ? Is it already customized (i.e. is there a chance your share-config-custom.xml overrides an existing one) ?

riccardog
Champ in-the-making
Champ in-the-making
I Have a few other AMPs in the same Alfresco, each one containing some -context and -config files,
but all my config-custom files are named other than  share-config-custom.

I mean, into  WEB-INF/classes/alfresco/web-extension there is nothing called share-config-custom.xml not even elsewhere (
 find . -name share-config-custom.xml
reports nothing else)


Looking into WEB-INF/classes/alfresco/slingshot-application-context.xml, it seems that you can have more then one share-config-custom , so whi mine should totally override the other?
I am a bit puzzled …

tonyrivet
Champ in-the-making
Champ in-the-making
Hm that's weird…

There is no share-config-custom in your tomcat/shared/classes/alfresco/web-extension directory neither ?
By the way, did you try to put your share-config-custom in your tomcat/shared/classes/alfresco/web-extension directory ?

Are both your Alfreso and Share instances running locally (or at least in the same server) on the 8080 port ?

riccardog
Champ in-the-making
Champ in-the-making
no,no, of course the default
 tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml
does exist
I am speaking of tomcat/webapps/share blabla

Even so If I put my piece of config into that file, I do not see my new renderer. So my main problem is:
which is the correct syntax to have a config with a new instance of a renderer?

my Alfresco configuration:
I've installed alfresco42e community, I have two tomcats, one for Alfresco (port 9080) and one for Share(port 19080) then I use Apache ProxyPass and ProxyPassReverse so I can use an URL without Smiley Tongueort

tonyrivet
Champ in-the-making
Champ in-the-making
Sorry it was not so obvious you already had a share-config-custom configured.
That explains the errors when you put your share-config-custom in the amp/config/alfresco/web-extension directory.

Concerning the view renderers configuration, I thought Share would merge your configuration with the native one but it seems not.
Maybe this merging is only done for one or two levels deep configuration (like the actions configuration for example), whereas the view renderers are set in a three levels deep configuration :

<doclist>
   <view-renderers>
      <view-renderer>


Adding the replace="true" attribute in your config should work. You'll have to copy the default view renderer configurations you want to keep.


<config evaluator="string-compare" condition="DocumentLibrary" replace="true">

</config>