1. Atlassian Tutorials
  2. Untitled project
  3. Space Plugin example

Commits

Adrien Ragot  committed 9648ff9

Space Admin action

  • Participants
  • Parent commits 9ce8582
  • Branches master

Comments (0)

Files changed (5)

File README

View file
 
 * How to create Quick Links in the Space Sidebar,
 * How to create Main Links,
-* How to create Main Links using a Context Provider.
+* How to create Main Links using a Context Provider,
+* How to create a Space Advanced screen,
+* How to create a Space Admin screen.
 
 How to run
 ==========

File src/main/java/com/atlassian/examples/MyAdminAction.java

View file
+package com.atlassian.examples;
+
+import com.atlassian.confluence.spaces.actions.SpaceAdminAction;
+
+public class MyAdminAction extends SpaceAdminAction
+{
+    @Override
+    public String doDefault()
+    {
+        return INPUT;
+    }
+}

File src/main/resources/atlassian-plugin.xml

View file
 
     <web-item key="add-quick-link" name="Add Quick Link" section="system.space" weight="100">
         <label key="add.quick.link" />
-        <link linkId="add-quick-link-id">/plugins/space-links/add-link.action?key=$generalUtil.urlEncode($helper.spaceKey)</link>
+        <link linkId="add-quick-link-id">/plugins/${project.artifactId}/add-link.action?key=$generalUtil.urlEncode($helper.spaceKey)</link>
+    </web-item>
+
+    <web-item key="space-admin-example" name="Space Admin example" section="system.space.admin/addons" weight="100">
+        <label key="space.admin.example.link" />
+        <link linkId="space-admin-example-id">/plugins/${project.artifactId}/admin.action?key=$generalUtil.urlEncode($helper.spaceKey)</link>
     </web-item>
 
     <!-- Declare MVC actions for this plugin -->
     <xwork name="Example Actions" key="example-actions">
         <description>Examples of actions</description>
         <package name="space-links-xwork-package" extends="default" namespace="/plugins/${project.artifactId}">
-            <default-interceptor-ref name="defaultStack"/>
+            <default-interceptor-ref name="validatingStack"/>
 
             <!-- Accessible at http://localhost:1990/confluence/plugins/space-links/add-link.action?key=ds -->
             <action name="add-link" class="com.atlassian.examples.MyAction" method="doCreate">
                 <result name="input" type="velocity">/templates/view-custom-content.vm</result>
             </action>
 
+            <action name="admin" class="com.atlassian.examples.MyAdminAction" method="doDefault">
+                <result name="input" type="velocity">/templates/view-admin.vm</result>
+            </action>
         </package>
     </xwork>
 

File src/main/resources/space-links.properties

View file
 #put any key/value pairs here
 my.plugin.name=MyPlugin
 add.quick.link=Add a quick link to this space
-add.link.action=Add Link Action
+add.link.action=Space Page
 plugin.content.title=Plugin Content
-contextual.main.link.title=Contextual Main Link
+contextual.main.link.title=Contextual Main Link
+space.admin.example.link=Space Admin Example

File src/main/resources/templates/view-admin.vm

View file
+<html>
+<head>
+    <title>$action.getText("space.admin.example.link")</title>
+    <meta name="decorator" content="main"/>
+</head>
+
+    #applyDecorator("root")
+    #decoratorParam("helper" $action.helper)
+    #decoratorParam("context" "space-administration")
+
+        <body>
+
+            #applyDecorator ("root")
+                #decoratorParam ("context" "spaceadminpanel") ## The .vmd to use - Displays all the Space Admin sections.
+                #decoratorParam ("selection" "space-admin-example") ## Key of the web-item to highlight
+                #decoratorParam ("helper" $action.helper) ## Everyone likes a bit of help
+
+                <div class="pagecontent">
+                    <p>This is an admin page for the plugin.</p>
+                </div>
+            #end
+        </body>
+
+    #end
+</html>