Skip to content

Commit

Permalink
Fix #6 Update to Confluence 8 (#7)
Browse files Browse the repository at this point in the history
* Fix #6 Update to Confluence 8

Also fixes an issue with the width of the drop down menu

* Revert tab changes
  • Loading branch information
alangs authored Nov 29, 2023
1 parent b9fc31d commit f5a7d86
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 32 deletions.
39 changes: 19 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.langs</groupId>
<artifactId>pagela-macro</artifactId>
<version>1.0.1</version>
<version>1.1.0</version>

<name>Pagela</name>
<description>Pagela (Page Labeler) Macro for Confluence.</description>
Expand Down Expand Up @@ -46,6 +46,18 @@
</developer>
</developers>

<!-- https://jira.atlassian.com/browse/CONFSERVER-93208 -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.atlassian.struts2</groupId>
<artifactId>struts-support</artifactId>
<version>1.2.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>junit</groupId>
Expand All @@ -64,14 +76,7 @@
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-runtime</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>runtime</scope>
<scope>provided</scope>
</dependency>

<dependency>
Expand Down Expand Up @@ -151,24 +156,18 @@
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<confluence.version>7.15.0</confluence.version>
<confluence.data.version>7.15.0</confluence.data.version>
<amps.version>8.0.0</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
<confluence.version>8.5.3</confluence.version>
<confluence.data.version>8.5.3</confluence.data.version>
<amps.version>8.11.4</amps.version>
<plugin.testrunner.version>2.0.2</plugin.testrunner.version>
<atlassian.spring.scanner.version>2.1.7</atlassian.spring.scanner.version>
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml
and the key to generate bundle. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
Expand Down
16 changes: 7 additions & 9 deletions src/main/java/de/langs/macro/Pagela.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

import com.atlassian.confluence.content.render.xhtml.ConversionContext;
import com.atlassian.confluence.content.render.xhtml.DefaultConversionContext;
import com.atlassian.confluence.macro.Macro;
import com.atlassian.confluence.macro.MacroExecutionException;
import com.atlassian.confluence.plugin.services.VelocityHelperService;
import com.atlassian.confluence.plugin.webresource.ConfluenceWebResourceManager;
import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.renderer.RenderContext;
import com.atlassian.renderer.v2.RenderMode;
import com.atlassian.renderer.v2.macro.BaseMacro;
import com.atlassian.renderer.v2.macro.MacroException;
import com.atlassian.sal.api.message.I18nResolver;

@Scanned
public class Pagela extends BaseMacro implements Macro {

private final VelocityHelperService velocityHelperService;
Expand All @@ -41,10 +41,9 @@ public Pagela(@ComponentImport VelocityHelperService velocityHelperService,
this.i18n = i18n;
}

@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public String execute(Map macroParams, String s, RenderContext renderContext)
throws MacroException {
public String execute(Map macroParams, String s, RenderContext renderContext) throws MacroException {
try {
return execute(macroParams, s, new DefaultConversionContext(renderContext));
} catch (MacroExecutionException e) {
Expand All @@ -53,8 +52,8 @@ public String execute(Map macroParams, String s, RenderContext renderContext)
}

@Override
public String execute(Map<String, String> parameters, String body,
ConversionContext conversionContext) throws MacroExecutionException {
public String execute(Map<String, String> parameters, String body, ConversionContext conversionContext)
throws MacroExecutionException {

String spaceKey = parameters.get("spaceKey");
if (StringUtils.isBlank(spaceKey)) {
Expand Down Expand Up @@ -83,8 +82,7 @@ public String execute(Map<String, String> parameters, String body,

String labels = parameters.get("labels");
List<String> labelsList = new ArrayList<String>();
labelsList = Arrays.asList(labels.split(",")).stream().distinct().sorted()
.collect(Collectors.toList());
labelsList = Arrays.asList(labels.split(",")).stream().distinct().sorted().collect(Collectors.toList());

final Map<String, Object> contextMap = getMacroVelocityContext();
contextMap.put("spaceKey", spaceKey);
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/spring/plugin-context.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:atlassian-scanner="http://www.atlassian.com/schema/atlassian-scanner"
xmlns:atlassian-scanner="http://www.atlassian.com/schema/atlassian-scanner/2"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.atlassian.com/schema/atlassian-scanner
http://www.atlassian.com/schema/atlassian-scanner/atlassian-scanner.xsd">
<atlassian-scanner:scan-indexes/>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/css/pagela-macro.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Adjust width of dropdown on the input page selection field */
#pagela-form .aui-dd-parent .aui-dropdown {
#pagela-form .pagela-select {
min-width: 100%;
}

Expand Down

0 comments on commit f5a7d86

Please sign in to comment.