Disable adding gadgets

Is it possible to disable the adding gadgets button in the dashboard? I tried to search some extension point, but I found nothing about it…

1 votes

2 answers

2149 views

ANSWER



Hi,

Those actions are currently defined in the xhtml template. To override it and remove the Add gagdet action, you need to override the user_opensocial_dashboard.xhtml template in nuxeo.war/incl/dashboard/ in your own bundle and remove the following line:

<a id="addGadgetButton" href="#{baseURL}site/gadgets?language=#{localeSelector.language}">#{messages['label.opensocial.container.add.gadget']}</a>
0 votes



I tried this way..I modified user_opensocial_dashboard in my bundle, and bind it to the dashboard button with this component:

&lt;component name=&quot;org.nuxeo.dashboard.dashboard&quot; version=&quot;1.0&quot;&gt;

    &lt;extension target=&quot;org.nuxeo.ecm.platform.actions.ActionService&quot; point=&quot;actions&quot;&gt;
        &lt;action id=&quot;DashboardMain&quot; link=&quot;/incl/dashboard/user_opensocial_dashboard.xhtml&quot;/&gt;
    &lt;/extension&gt;

&lt;/component&gt;

In my Eclipse project it works, but when I create the corresponding jar and put it into the plugins folder of my nuxeo distribution, it returns an error (it does not find the .xhtml) or simply it does nothing.

03/06/2012

You just need to override the template in your bundle and put the following require in your deployment-fragment.xml to be sure that your template will be deployed after the default one in Nuxeo:

&lt;require&gt;org.nuxeo.ecm.user.center.dashboard.opensocial&lt;/require&gt;
03/06/2012

It does not want to work even in this way :( … Here my deployment-fragment:

&lt;fragment version=&quot;1&quot;&gt;
&lt;require&gt;org.nuxeo.ecm.user.center.dashboard.opensocial&lt;/require&gt;
&lt;install&gt; 
    &lt;unzip prefix=&quot;web&quot; to=&quot;/&quot; from=&quot;${bundle.fileName}&quot;&gt; 
        &lt;include&gt;web/nuxeo.war/**&lt;/include&gt; 
    &lt;/unzip&gt; 
&lt;/install&gt; 
&lt;/fragment&gt;

Any other idea?

03/06/2012

Any error in your server logs? Does the user_opensocial_dashboard.xhtml file is deployed on your server (in nxserver/nuxeo.war/incl/dashboard/)?
03/06/2012

No error in server log, but the file is not deployed…I'm going mad, this is a nonsense!
03/06/2012

Is there anything in nxserver/nuxeo.war/incl/dashboard/? There should be at least the default xhtml templates of Nuxeo regarding the Dashboard.
03/06/2012

Yes,there are the standard templates… the standard user_opensocial_dashboard.xhtml, but not mine…
03/06/2012

Can you give us the localization into the eclipse project of this xhtml file? $project/src/main/resources/web/nuxeo.war/incl/dashboard ?
03/06/2012

The localization is exactly that. $project/src/main/resources/web/nuxeo.war/incl/dashboard
03/07/2012

can you :

  • rename the xhtml file user_opensocial_dashboard.xhtml by user_opensocial_dashboard2.xhtml
  • build again your project
  • copy your jar (from target/name_of_your_project-version.jar) in $Nuxeo/nxserver/bundles
  • Start again your server

Can you check that $nuxeo/nxserver/nuxeo.war/incl/dashboard/user_opensocial_dashboard2.xhtml exists. I want to check if the problem you have is the order of deployment or the deployment itself.

03/07/2012

Ok, I tried… but nothing happens. The dashboard page returns an error (it does not find the template) and in nxserver/nuxeo.war/incl/dashboard/ there isn't my .xhtml …

It is strange, in the same distribution I've already deployed other plugins…

03/07/2012

Ok so your problem is in your project definition somewhere. The predeployment instruction described in deployment-fragment.xml are not executed.

Here is the fast way to make your stuff working:

  • Create a Nuxeo Plugin Project with Nuxeo IDE
  • Create a web/incl/dashboard directory in src/main/resources/
  • copy you xhtml
  • do "mvn install" into the root of the project
  • copy the jar created into the bundle

You will not need to have to create the deployment-fragment.xml

The longer way will be to check all the element of your current project. Here is the checklist you can follow:

  • Unzip your jar. look if you have into the root of your jar a directory web/nuxeo.war/incl/dashboard with your xhtml in it.

  • check that your deployment-fragment is exactly this one:

    <?xml version="1.0"?> <fragment version="1"> <require>org.nuxeo.ecm.user.center.dashboard.opensocial </require> <install>

    &lt;!--  unzip the war template --&gt;
    &lt;unzip from=&quot;${bundle.fileName}&quot; to=&quot;/&quot; prefix=&quot;web&quot;&gt;
      &lt;include&gt;web/nuxeo.war/**&lt;/include&gt;
    &lt;/unzip&gt;
    

    </install> </fragment>

  • check that your MANIFEST is well formed (you have to know that the JVM is really strict on the format. we give here thing to take care into the Create a "MANIFEST.MF" file section (red square).

  • be careful of your bundle name, check that you don't have named like another bundle deployed

  • check that you don't have 2 versions of your project deployed into the nxserver/bundle server.

Maybe other elements but I see just these ones.

03/07/2012

I performed all of the steps and chacked the rest, but nothing happens… Perchance, is there some incompatibilities with postgreSQL? Because, it is the only difference between the distribution I use with eclipse and the distribution in which I put my .jars …
03/08/2012

No relation, not.
03/08/2012

Can you tell us a bit more information about this Nuxeo instance that doesn't deploy your ? How did you install it. How do you start it ? Can copy in pastebin.com the result of recursive ls?

Can you unzip the jar generated and list the content.

03/08/2012

It's a nuxeo-5.5-tomcat distribution, I have started the server and configured it with postgreSQL, as I previously said. The rest is a standard configuration. It deployed my other bundles, even the ones with other templates…but not this ones…quite absurd!

Inside the bundle, you can find the following folders and files:

META-INF

…….|_MANIFEST.MF

…….|_maven (with other sudirectories…will I post those too?)

org

..|_nuxeo

……..|_dashboard

………………|_dashboard.class

OSGI-INF

…….|_extensions

……………..|_deployment-fragment.xml

……………..|_dashboard.xml

web

..|_nuxeo.war

………..|_incl

…………….|_dashboard

……………………..|_user_opensocial_dashboard2.xhtml

03/09/2012

Did you install he Document Management module? Do you have nuxeo-user-dashboard-opensocial-5.5.jar in $Nuxeo/nxserver/bundles?
03/09/2012

Ok deployment-fragment must be in OSGI-INF directory. Can you test that?
03/09/2012

any update ? Is Thomas or me that was right. The suspense is unbearable ! :D
03/13/2012

Here I am, sorry, I was ill!

During these days my distribution must have decided that it was time to stop those strange behaviours… I put the deployment-fragment into OSGI-INF directory and now, FINALLY, it works!!! However I'm quite sure to have already tested this solution, without results…but now it works and that's all! Thank you very much for the help :) !!

03/14/2012


Hello, About this question, is it possible to disabled gagdet but keep it for Administrator group ? thanks

0 votes