Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ community.members.history.item.leftOn=Quitt\u00e9 le
community.member.status.committed=Membre
community.member.status.pending=En attente de validation
community.member.status.refused=Refus\u00e9e
community.member.status.removed=Retir\u00e9e
community.member.status.removed=Retir\u00e9e
community.membership.management.label=Gestion des adh�sions
community.membership.management.desc=Application pour g�rer les adh�sions � la communaut�
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ community.members.history.item.leftOn=Abmeldung bei
community.member.status.committed=Mitglied
community.member.status.pending=Wartet auf Validierung
community.member.status.refused=Mitgliedschaft abgelehnt
community.member.status.removed=Entfernt
community.member.status.removed=Entfernt
community.membership.management.desc=Anwendung zur Verwaltung von Community-Mitgliedschaft
community.membership.management.label=Mitgliederverwaltung
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ community.members.history.item.leftOn=Leave on
community.member.status.committed=Member
community.member.status.pending=Pending validation
community.member.status.refused=Membership refused
community.member.status.removed=Removed
community.member.status.removed=Removed
community.membership.management.desc=Application for managing the community membership
community.membership.management.label=Membership Management
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ community.members.history.item.leftOn=Quitt\u00e9 le
community.member.status.committed=Membre
community.member.status.pending=En attente de validation
community.member.status.refused=Refus\u00e9e
community.member.status.removed=Retir\u00e9e
community.member.status.removed=Retir\u00e9e
community.membership.management.desc=Application pour g�rer les adh�sions � la communaut�
community.membership.management.label=Gestion des adh�sions
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</suite>
<inheritSpaceRightsByDefault>false</inheritSpaceRightsByDefault>
<publicByDefault>true</publicByDefault>
<visible>true</visible>
<visible>false</visible>
<portlet>false</portlet>
<profiles>
<profile name="user">
Expand Down Expand Up @@ -113,7 +113,7 @@
</label>
<order>2</order>
<mandatory>true</mandatory>
<value>no</value>
<value>reader</value>
<options>
<option>
<name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ CREATE TABLE IF NOT EXISTS ST_Group
id int NOT NULL,
domainId int NOT NULL,
specificId varchar(500) NOT NULL,
spaceId varchar(500) NULL,
superGroupId int,
name varchar(100) NOT NULL,
description varchar(400),
Expand Down Expand Up @@ -102,6 +103,7 @@ CREATE TABLE IF NOT EXISTS ST_Space
look varchar(50),
displaySpaceFirst smallint,
isPersonal smallint,
isCommunity smallint default 0 NOT NULL,
CONSTRAINT PK_Space PRIMARY KEY (id),
CONSTRAINT UN_Space_1 UNIQUE (domainFatherId, name),
CONSTRAINT FK_Space_1 FOREIGN KEY (createdBy) REFERENCES ST_User (id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ values (-1, 'internal', 'Do not remove - Used by Silverpeas engine', '-', '-', '
'org.silverpeas.core.admin.domain.driver.SilverpeasDomainDriver', 'autDomainSP', '0',
'https://localhost:8000/silverpeas');

INSERT INTO st_space (id, domainFatherId, name, lang, firstPageType, isInheritanceBlocked)
VALUES (1, NULL, 'Space 1', 'fr', 0, 1),
(2, 1, 'Space 1-2', 'fr', 0, 0),
(3, NULL, 'Space 2', 'fr', 0, 1),
(4, NULL, 'Space 3', 'fr', 0, 0);
INSERT INTO st_space (id, domainFatherId, name, lang, firstPageType, isInheritanceBlocked, isCommunity)
VALUES (1, NULL, 'Space 1', 'fr', 0, 1, 1),
(2, 1, 'Space 1-2', 'fr', 0, 0, 1),
(3, NULL, 'Space 2', 'fr', 0, 1, 1),
(4, NULL, 'Space 3', 'fr', 0, 0, 0);

INSERT INTO st_componentinstance (id, spaceId, name, componentName, isPublic, isInheritanceBlocked)
VALUES (1, 1, 'Community 1', 'community', 1, 1),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright (C) 2000 - 2025 Silverpeas
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* As a special exception to the terms and conditions of version 3.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* Open Source Software ("FLOSS") applications as described in Silverpeas's
* FLOSS exception. You should have received a copy of the text describing
* the FLOSS exception, and it is also available here:
* "https://www.silverpeas.org/legal/floss_exception.html"
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.silverpeas.components.community;

import org.silverpeas.core.admin.component.model.ComponentInst;
import org.silverpeas.core.admin.component.model.WAComponent;
import org.silverpeas.core.admin.service.CommunityFactory;
import org.silverpeas.core.admin.space.SpaceInst;
import org.silverpeas.core.admin.user.model.User;
import org.silverpeas.core.annotation.Provider;
import org.silverpeas.kernel.annotation.NonNull;

import java.util.ArrayList;
import java.util.Objects;

/**
* Implementation of the {@link CommunityFactory}. It will automatically creates an instance of this
* Silverpeas component for a given community space.
*
* @author mmoquillon
*/
@Provider
public class CommunityInstanceFactory implements CommunityFactory {

@Override
@NonNull
public ComponentInst createCommunity(@NonNull SpaceInst communitySpace) {
Objects.requireNonNull(communitySpace);
String language = User.getCurrentUser().getUserPreferences().getLanguage();
var bundle = CommunityComponentSettings.getMessagesIn(language);
var maybeComponent = WAComponent.getByName(CommunityComponentSettings.COMPONENT_NAME);
var component = maybeComponent.orElseThrow(() ->
new IllegalStateException("The community application should be defined!"));

ComponentInst membershipMgtApp = new ComponentInst();
membershipMgtApp.setName(component.getName());
membershipMgtApp.setDomainFatherId(communitySpace.getId());
membershipMgtApp.setInheritanceBlocked(true);
membershipMgtApp.setPublic(true);
membershipMgtApp.setHidden(false);
membershipMgtApp.setLabel(bundle.getString("community.membership.management.label"));
membershipMgtApp.setDescription(bundle.getString("community.membership.management.desc"));
membershipMgtApp.setOrderNum(0);
membershipMgtApp.setParameters(new ArrayList<>(component.getParameters()));

return membershipMgtApp;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
import org.silverpeas.components.community.model.CommunityOfUsers;
import org.silverpeas.components.community.notification.CommunityEventNotifier;
import org.silverpeas.components.community.repository.CommunityOfUsersRepository;
import org.silverpeas.core.notification.system.ResourceEvent;
import org.silverpeas.kernel.SilverpeasRuntimeException;
import org.silverpeas.core.admin.component.ComponentInstancePostConstruction;
import org.silverpeas.core.admin.component.model.ComponentInst;
import org.silverpeas.core.admin.service.AdminException;
import org.silverpeas.core.admin.service.Administration;
import org.silverpeas.core.admin.space.SpaceHomePageType;
import org.silverpeas.core.admin.space.SpaceInst;
import org.silverpeas.core.annotation.Bean;
import org.silverpeas.core.notification.system.ResourceEvent;
import org.silverpeas.kernel.SilverpeasRuntimeException;

import javax.inject.Inject;
import javax.inject.Named;
Expand Down Expand Up @@ -68,8 +68,13 @@ public void postConstruct(final String componentInstanceId) {
CommunityOfUsers community = new CommunityOfUsers(instance.getId(), spaceInst.getId());
CommunityOfUsers savedCommunity = repository.save(community);

if (!spaceInst.isCommunitySpace()) {
spaceInst.setFirstPageExtraParam(componentInstanceId);
spaceInst.setInheritanceBlocked(true);
spaceInst.setCommunitySpace(true);
spaceInst.setFirstPageType(SpaceHomePageType.COMPONENT_INST.ordinal());
}
spaceInst.setFirstPageExtraParam(componentInstanceId);
spaceInst.setInheritanceBlocked(true);
spaceInst.setFirstPageType(SpaceHomePageType.COMPONENT_INST.ordinal());
updateSpaceInst(spaceInst);

Expand Down
Loading