Find Questions…

Close ×
First time here? Check out the FAQ!

Why main menu disappear from page in Crowd plugin?

prophe asked this question · 71 karma ·

After clicking on my custom menu item I see this screen without main menu and messages:

As you can see therre is no menu. Why? My atlassian-plugin.xml is:

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
    <plugin-info>
        <description>${project.description}</description>
        <version>${project.version}</version>
        <vendor name="${project.organization.name}" url="${project.organization.url}" />
    </plugin-info>
    
    <component-import key="webResourceManager" interface="com.atlassian.plugin.webresource.WebResourceManager" />
    
    <!-- Header Items -->
    <web-item key="tokens" name="Tokens Management" section="topnav" weight="10">
        <label key="Token management"/>
        <link linkId="topnavTokensManagement">/console/secure/plugins/cargosoft/managetokens.action</link>
    </web-item>
    
    <!-- Application Components - Left-Hand Side -->
    <web-section key="tokensnav" name="Tokens Navigation" location="left" weight="90">
        <condition class="com.atlassian.crowd.plugin.web.conditions.SitemeshPropertiesCondition">
            <param name="propertyName">meta.section</param>
            <param name="propertyValues">tokens</param>
        </condition>
    </web-section>
    
    <xwork name="Tokens Action" key="managetokens">
        <package name="managetokens" extends="default" namespace="/console/secure/plugins/cargosoft">
        	<default-interceptor-ref name="defaultStack"/>
        	
            <action name="managetokens" class="com.cargosoft.crowd.plugin.TokensAction">
                <result name="success" type="freemarker">/templates/view.ftl</result>
                <result name="error" type="freemarker">/templates/view.ftl</result>
            </action>
        </package>
    </xwork>
    
    <resource type="i18n" name="i18n" location="messages.i18n" />
    
</atlassian-plugin>

and view.ftl is:

<html>
  <head>
    <title>Hello</title>
   	<meta name="decorator" content="atl.admin" />
  </head>
  <body>
    Hello ${action.firstName} ${action.lastName}
  </body>
</html>

How can I resolve this problem? and return main menu like at this picture???

1004 views

2 Answers:

Niels Jaeckel · 2,317 karma ·

I haven't developed for Crowd yet, but in other Atlassian Tools you need to call the right decorators for that. Just have a look at some built-in actions.

prophe · 71 karma ·

I've found in folder webapp/WEB-IF/decorators.xml this code:

<decorators>
    <decorator name="error" page="/console/decorator/simple.jsp">
        <pattern>/console/error/*</pattern>
    </decorator>
    <decorator name="license" page="/console/decorator/simple.jsp">
        <pattern>/console/license*</pattern>
    </decorator>
    <decorator name="none" page="/console/decorator/none.jsp">
        <pattern>/console/plugin/secure/saml/*</pattern>
        <pattern>/console/secure/pickers/*</pattern>
    </decorator>
    <decorator name="main" page="/console/decorator/default.jsp">
        <pattern>/*</pattern>
    </decorator>

    <!-- cross-product decorators provided for plugins -->
    <decorator name="atl.general" page="default.jsp"/>
    <decorator name="atl.admin" page="default.jsp"/>
    <decorator name="atl.userprofile" page="default.jsp"/>
    <decorator name="atl.popup" page="popup.jsp"/>
</decorators>

In my template I use meta-tag <meta name="decorator" content="main" /> but main menu doesn't appear. What is a problem it can be??? Have I missed something? And as you can see on the picture all messages i18n are disappear too. May be it is a probleme of crowd?

daviderickson · 271 karma ·

I was able to get this to work by adding the following to my pom.xml:

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-server</artifactId>
            <version>2.3.4</version>
            <scope>provided</scope>
        </dependency>

And then making my Action extend com.atlassian.crowd.console.action.BaseAction and set my view.ftl to look like:

<html>
  <head>
    <title></title>
    <meta name="section" content="administration" />
    <meta name="pagename" content="systeminfo" />
  </head>
  <body>
    <div class="crowdForm">
    
        <div class="formTitle">
            <h3>Title</h3>
        </div>
   
    
    </div>
  
    Hello ${action.firstName} ${action.lastName}
  </body>
</html>

Note I ripped some data from the systeminfo page, replace it with whatever you would normally use. I also changed the package I extended in atlassian-plugin.xml from default to admin to pick up on any customizations.

I still would like to know if there is any way to use JSP, it seems like there would have to be a special mechanism in place that takes the file out of the JAR and makes it appear like its on the file path for the webapp and I'm not sure if there is any existing support for that, although something of this nature is working for this FTL we are using.

I also couldn't manage to get the @ww.component tag to import a template I've created, I think it too is looking on the file path and not inside the classpath, which I also find weird considering the main template for the action works fine. I also couldn't get it to import the existing JSP templates, I get a NPE when it tries to retrieve the JSP PageContext object, I'm guessing JSP templates aren't intended to be rendered inside Freemarker templates?

Edit: Turns out you don't want to put Freemarker tags into your answers here as it will actually render their result...

Looking for something else?

Find Questions…

or Browse other questions tagged:

or Ask a Question