1

我正在执行在我的 Confluence 设置中添加自定义选项卡的任务。我选择了“高级”区域作为实现这一点的有利位置。所以我点击空间名称。然后我转到“浏览>>高级”并查看 http://imageshack.us/f/405/advanc.png。我们在这张图片中看到的“高速公路项目创建”选项卡是我自定义添加的。我写了这堂课

package com.atlassian.myorg;

import com.atlassian.confluence.core.ConfluenceActionSupport;
import com.atlassian.confluence.pages.AbstractPage;
import com.atlassian.confluence.pages.actions.PageAware;
import com.opensymphony.xwork.Action;

 /**
 * The simplest action possible
  */
public class ExampleAction extends ConfluenceActionSupport
{
    @Override
    public String execute() throws Exception
    {
    return Action.SUCCESS;
    }

  }

使用了这个 atlassian-plugin.xml

   <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>

    <resource type="i18n" name="i18n" location="message"  />
   <web-item name="add-fpc-label-action-web-ui" key="add-fpc-label-action-web-ui" section="system.space" weight="150">
    <description key="item.add-fpc-label-action-web-ui.link.desc">Allows the Create   Freeway Project functionality.</description>
    <label key="Freeway Project Creation"/>
    <link linkId="add-fpc-label-action">/plugins/examples/hello.action?key=$helper.space.key</link>
</web-item>


    <xwork name="My Example Action" key="example-action">
    <description>Shows a simple "Hello, World!" Action</description>
    <package name="examples" extends="default" namespace="/plugins/examples">
        <default-interceptor-ref name="validatingStack" />

        <action name="hello" class="com.atlassian.myorg.ExampleAction">
            <result name="success" type="velocity">/templates/example/hello.vm</result>
        </action>
    </package>
</xwork>          
</atlassian-plugin>

下面看到的是VM

<html>
<head>
   <title>This is my Example action!</title>
   <meta name="decorator" content="atl.general" />
</head>
<body>
 <strong>Hello, Confluence World!</strong>
</body>
</html>

结果,当我点击这个名为“高速公路项目创建”的选项卡时,我看到了这个页面http://imageshack.us/f/846/imageprf.png/

好吧,这已经足够好了。但我想在侧边栏旁边的“正文区域”中看到这个页面。例如,如果我们单击“空间管理员”选项卡,然后单击侧栏中的“编辑空间标签”;我们在标有http://imageshack.us/f/809/bodyarea.png /的“正文区域”中看到生成的页面。

想就如何实现这一目标提出您的建议吗?

谢谢

一种

4

1 回答 1

0

请试试这个

##requireResource("confluence.web.resources:space-admin")
<html>
<head>
   <title>This is my Example action!</title>
   <meta name="decorator" content="atl.general" />   
 </head>

 <content tag="key">$action.space.key</content>

<body>    

#applyDecorator("root")
    #decoratorParam("helper" $action.helper)
    #decoratorParam("context" "space-administration")
    #decoratorParam("mode" "view-space-administration")

    #applyDecorator ("root")
        #decoratorParam ("context" "spaceadminpanel")
        #decoratorParam ("selection" "add-fpc-label-action-web-ui")
        #decoratorParam ("title" $action.getText("action.name"))
        #decoratorParam ("selectedTab" "admin")
        #decoratorParam("helper" $action.helper) 

        <strong>Hello, Confluence World!</strong>
    #end
#end    
</body>
</html>
于 2012-07-06T13:30:07.047 回答