如何修改自定义Confluence页面,使其可以像默认选项一样查看

时间:2012-07-06 10:19:12

标签: customization velocity confluence

我正在执行在Confluence设置中添加自定义标签的任务。我选择“先进”地区作为实现这一目标的有利地点。 所以我点击空间名称。然后我转到'Browse>> Advanced'并查看This 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/

这很好。但是我希望在侧边栏旁边的“身体区域”中看到这个页面。例如,如果我们点击“Space Admin”标签,我们点击侧栏中的“编辑空间标签”;我们在标有http://imageshack.us/f/809/bodyarea.png /。

的“正文区域”中看到了结果页面

想了解如何实现这一目标吗?

由于

A

1 个答案:

答案 0 :(得分: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>