Skip to content

Commit 57142e1

Browse files
Initial commit
1 parent 4bafb1e commit 57142e1

19 files changed

+1003
-0
lines changed

README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
alfresco-site-groups
2+
====================
3+
4+
This extension adds a new ```Groups management``` option in Alfresco Share site configuration menu.
5+
6+
The plugin is licensed under the [GPL v3.0](http://www.gnu.org/licenses/gpl-3.0.html). The current version is compatible with Alfresco **5.0** CE.
7+
8+
This plugin is based on [Alfresco Aikau](https://github.com/Alfresco/Aikau/blob/master/tutorial/chapters/About.md) and is experimental by now.
9+
10+
Downloading the ready-to-deploy-plugin
11+
--------------------------------------
12+
The binary distribution is made of one AMP file for repo and another AMP file for share:
13+
14+
* [share AMP](https://github.com/keensoft/alfresco-site-groups/releases/download/1.0-SNAPSHOT/agreement-site-groups-1.0-SNAPSHOT.amp)
15+
16+
You can install it by using standard [Alfresco deployment tools](http://docs.alfresco.com/community/tasks/dev-extensions-tutorials-simple-module-install-amp.html)
17+
18+
Building the artifacts
19+
----------------------
20+
If you are new to Alfresco and the Alfresco Maven SDK, you should start by reading [Jeff Potts' tutorial on the subject](http://ecmarchitect.com/alfresco-developer-series-tutorials/maven-sdk/tutorial/tutorial.html).
21+
22+
You can build the artifacts from source code using maven
23+
```sh
24+
$ mvn clean package
25+
```

pom.xml

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>es.keensoft.alfresco</groupId>
6+
<artifactId>site-groups</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
<name>site-groups AMP project</name>
9+
<packaging>amp</packaging>
10+
<description>Manages the lifecycle of the site-groups AMP (Alfresco Module Package)</description>
11+
12+
<parent>
13+
<groupId>org.alfresco.maven</groupId>
14+
<artifactId>alfresco-sdk-parent</artifactId>
15+
<version>2.1.0</version>
16+
</parent>
17+
18+
<!--
19+
SDK properties have sensible defaults in the SDK parent,
20+
but you can override the properties below to use another version.
21+
For more available properties see the alfresco-sdk-parent POM.
22+
-->
23+
<properties>
24+
<!-- The following are default values for data location and Alfresco version.
25+
Uncomment if you need to change
26+
<alfresco.version>${alfresco.community.default.version}</alfresco.version> -->
27+
28+
<!-- This control the root logging level for all apps uncomment and change, defaults to WARN
29+
<app.log.root.level>WARN</app.log.root.level>
30+
-->
31+
32+
<!-- Set the enviroment to use, this controls which properties will be picked in src/test/properties
33+
for embedded run, defaults to the 'local' environment. See SDK Parent POM for more info.
34+
<env>other environment name</env>
35+
-->
36+
37+
<!-- The Maven artifact ID to use when loading the Share.WAR that the AMP should be applied to,
38+
defaults to the alfresco.war artifact ID, so we need to override here. -->
39+
<app.amp.client.war.artifactId>${alfresco.share.artifactId}</app.amp.client.war.artifactId>
40+
41+
<!-- Since Alfresco.WAR (i.e. the Repository) is already running on port 8080, we run Share.WAR on port 8081 -->
42+
<maven.tomcat.port>8081</maven.tomcat.port>
43+
44+
<!-- Used in share-config-custom.xml. By default points to local installation of Alfresco Repo -->
45+
<alfresco.repo.url>http://localhost:8080/alfresco</alfresco.repo.url>
46+
47+
</properties>
48+
49+
<!-- Here we realize the connection with the Alfresco selected platform
50+
(e.g.version and edition) -->
51+
<dependencyManagement>
52+
<dependencies>
53+
<!-- This will import the dependencyManagement for all artifacts in the selected Alfresco version/edition
54+
(see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies)
55+
NOTE: You still need to define dependencies in your POM, but you can omit version as it's enforced by this dependencyManagement. NOTE: It defaults
56+
to the latest version this SDK pom has been tested with, but alfresco version can/should be overridden in your project's pom -->
57+
<dependency>
58+
<groupId>${alfresco.groupId}</groupId>
59+
<artifactId>alfresco-platform-distribution</artifactId>
60+
<version>${alfresco.version}</version>
61+
<type>pom</type>
62+
<scope>import</scope>
63+
</dependency>
64+
</dependencies>
65+
</dependencyManagement>
66+
67+
<!-- Following dependencies are needed for compiling Java code in src/main/java; -->
68+
<dependencies>
69+
<dependency>
70+
<groupId>${alfresco.groupId}</groupId>
71+
<artifactId>share</artifactId>
72+
<version>${alfresco.version}</version>
73+
<classifier>classes</classifier>
74+
<scope>provided</scope>
75+
</dependency>
76+
<dependency>
77+
<groupId>org.springframework.extensions.surf</groupId>
78+
<artifactId>spring-surf-api</artifactId>
79+
<scope>provided</scope>
80+
</dependency>
81+
</dependencies>
82+
83+
<build>
84+
<plugins>
85+
<!-- Compress JavaScript files and store as *-min.js -->
86+
<plugin>
87+
<groupId>net.alchim31.maven</groupId>
88+
<artifactId>yuicompressor-maven-plugin</artifactId>
89+
</plugin>
90+
</plugins>
91+
</build>
92+
93+
<profiles>
94+
<!--
95+
Brings in the extra Enterprise specific share classes,
96+
if the 'enterprise' profile has been activated, needs to be activated manually. -->
97+
<profile>
98+
<id>enterprise</id>
99+
<dependencies>
100+
<dependency>
101+
<groupId>${alfresco.groupId}</groupId>
102+
<artifactId>share-enterprise</artifactId>
103+
<version>${alfresco.version}</version>
104+
<classifier>classes</classifier>
105+
<scope>provided</scope>
106+
</dependency>
107+
</dependencies>
108+
</profile>
109+
</profiles>
110+
</project>

run.bat

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2+
:: Dev environment startup script for Alfresco Community. ::
3+
:: ::
4+
:: Downloads the spring-loaded lib if not existing and ::
5+
:: runs the Share AMP applied to Share WAR. ::
6+
:: Note. requires Alfresco.war to be running in another ::
7+
:: Tomcat on port 8080. ::
8+
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9+
@echo off
10+
11+
set springloadedfile=%HOME%\.m2\repository\org\springframework\springloaded\1.2.3.RELEASE\springloaded-1.2.3.RELEASE.jar
12+
13+
if not exist %springloadedfile% (
14+
mvn validate -Psetup
15+
)
16+
17+
set MAVEN_OPTS=-javaagent:"%springloadedfile%" -noverify
18+
19+
mvn integration-test -Pamp-to-war -nsu
20+
:: mvn integration-test -Pamp-to-war

run.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
# Downloads the spring-loaded lib if not existing and runs the Share AMP applied to Share WAR
3+
# Note. requires Alfresco.war to be running in another Tomcat on port 8080
4+
springloadedfile=~/.m2/repository/org/springframework/springloaded/1.2.3.RELEASE/springloaded-1.2.3.RELEASE.jar
5+
6+
if [ ! -f $springloadedfile ]; then
7+
mvn validate -Psetup
8+
fi
9+
10+
MAVEN_OPTS="-javaagent:$springloadedfile -noverify" mvn integration-test -Pamp-to-war
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<extension>
2+
<modules>
3+
<module>
4+
<id>Site Groups</id>
5+
<version>1.0</version>
6+
<auto-deploy>true</auto-deploy>
7+
<configurations>
8+
<config evaluator="string-compare" condition="WebFramework" replace="false">
9+
<web-framework>
10+
<dojo-pages>
11+
<packages>
12+
<package name="site-groups" location="js/site-groups"/>
13+
</packages>
14+
</dojo-pages>
15+
</web-framework>
16+
</config>
17+
</configurations>
18+
<customizations>
19+
<customization>
20+
<targetPackageRoot>org.alfresco.share.header</targetPackageRoot>
21+
<sourcePackageRoot>es.keensoft.alfresco.share-header</sourcePackageRoot>
22+
</customization>
23+
</customizations>
24+
</module>
25+
</modules>
26+
</extension>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
var siteConfig = widgetUtils.findObject(model.jsonModel, "id",
2+
"HEADER_SITE_CONFIGURATION_DROPDOWN");
3+
4+
var sites = [];
5+
var result = remote.call("/api/people/" + encodeURIComponent(user.name) + "/sites");
6+
model.role = "Undefined";
7+
if (result.status == 200)
8+
{
9+
var managers, i, ii, j, jj;
10+
11+
// Create javascript objects from the server response
12+
sites = eval('(' + result + ')');
13+
14+
if (sites.length > 0)
15+
{
16+
for (var index = 0; index < sites.length; index++)
17+
{
18+
site = sites[index];
19+
20+
// Is current user a Site Manager for this site?
21+
site.isSiteManager = false;
22+
if (page.url.templateArgs.site == site.shortName && site.siteManagers)
23+
{
24+
managers = site.siteManagers;
25+
for (j = 0, jj = managers.length; j < jj; j++)
26+
{
27+
if (managers[j] == user.name)
28+
{
29+
model.role = "SiteManager";
30+
break;
31+
}
32+
}
33+
}
34+
}
35+
}
36+
}
37+
38+
if (siteConfig != null && model.role == "SiteManager") {
39+
40+
// Add Customize Dashboard
41+
siteConfig.config.widgets.push({
42+
id : "HEADER_GROUPS_MANAGEMENT",
43+
name : "alfresco/menus/AlfMenuItem",
44+
config : {
45+
id : "HEADER_GROUPS_MANAGEMENT",
46+
label : "link.groupsManagement",
47+
title: "link.groupsManagement",
48+
iconAltText: "link.groupsManagement",
49+
iconClass : "alf-profile-icon",
50+
targetUrl : "site/" + page.url.templateArgs.site + "/hdp/ws/groups-management",
51+
}
52+
});
53+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
link.groupsManagement=Groups management
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
link.groupsManagement=Groups management
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
link.groupsManagement=Gesti\u00F3n de grupos
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<webscript>
2+
<shortname>Groups Management</shortname>
3+
<description>Groups Management Tool</description>
4+
<url>/groups-management</url>
5+
</webscript>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<#-- PLEASE NOTE:
2+
<#-- Use of .head.ftl WebScript files has now been deprecated from WebScripts that render Share Components. -->
3+
<#-- Dependencies are now loaded through the use of the <@script> and <@link> tags in the main .html.ftl file. -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- Management Groups Panel -->
2+
<@processJsonModel/>

0 commit comments

Comments
 (0)