From da0a1bce5b615a6259e0ecbf385e6c3186835fd7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 26 Sep 2023 14:04:33 +0200 Subject: [PATCH] changes for active / inactive user and toc --- .docker/docker-compose.yml | 1 + src/client/app/js/app/core/Dict.js | 4 ++-- src/client/app/js/app/model/Group.js | 6 +++--- src/client/app/js/app/state/GroupDetailEdit.js | 2 +- src/client/app/tmpl/group-detail-edit.html | 6 +++--- src/client/app/tmpl/group-terms.html | 5 +---- .../app/tmpl/home-modal-not-activated.html | 2 +- .../server/control/TB_Server_Control_Auth.php | 2 ++ .../server/control/TB_Server_Control_Team.php | 17 +++++++++++++---- .../teamdata/TB_Shared_Ent_TeamData_Profile.php | 2 +- .../teamdata/TB_Shared_Ent_TeamData_Team.php | 2 +- tools/patches/2addDbTermsConditionsToTeam.php | 2 +- ...ersActive.php => 4addDbNewUsersInactive.php} | 8 +++++--- 13 files changed, 35 insertions(+), 24 deletions(-) rename tools/patches/{4addDbNewUsersActive.php => 4addDbNewUsersInactive.php} (56%) diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml index b80ff96..ab8010e 100644 --- a/.docker/docker-compose.yml +++ b/.docker/docker-compose.yml @@ -1,4 +1,5 @@ version: '3.7' +name: probuddy services: database: diff --git a/src/client/app/js/app/core/Dict.js b/src/client/app/js/app/core/Dict.js index 649eda3..ea3c7fb 100644 --- a/src/client/app/js/app/core/Dict.js +++ b/src/client/app/js/app/core/Dict.js @@ -240,8 +240,8 @@ app.core.Dict = { "EDIT_GROUP" : "Gruppe bearbeiten", "GROUP_NAME" : "Gruppenname", "GROUP_DESCRIPTION" : "Beschreibung", - "GROUP_NEW_USERS_ACTIVE": "Erweiterte Sicherheit", - "GROUP_NEW_USERS_ACTIVE_CHECKBOX": "Hiermit deaktiviere ich die erweiterte Sicherheit im Anmeldeprozess und setze alle neuen Teilnehmer automatisch auf aktiv.", + "GROUP_NEW_USERS_INACTIVE": "Erweiterte Sicherheit aktiv", + "GROUP_NEW_USERS_INACTIVE_CHECKBOX": "Bei erweiterter Sicherheit sind neu registrierte Teilnehmer vorab vom Gruppeninhaber oder Admin in der Mitgliederverwaltung auf \"aktiv\" zu setzen. \"Inaktive\" Teilnehmer können nicht Zusagen und keine Termindetails einsehen. Ist die erweiterte Sicherheit ausgeschaltet, werden neue Teilnehmer automatisch auf aktiv gesetzt.", "GROUP_TERMS": "Nutzungsbedingungen", "GROUP_TERMS_ACCEPT": "akzeptieren", "GROUP_TERMS_ACCEPTED": "Du hast die Nutzungsbedingungen akzeptiert", diff --git a/src/client/app/js/app/model/Group.js b/src/client/app/js/app/model/Group.js index f9b5bfa..63171e2 100644 --- a/src/client/app/js/app/model/Group.js +++ b/src/client/app/js/app/model/Group.js @@ -19,7 +19,7 @@ app.model.Group = function( data, memberData ) termsConditions = data.terms_conditions || null, termsConditionsActive = data.terms_conditions_active == 1, contactInformation = data.contact_information || null, - newUsersActive = data.new_users_active == 1, + newUsersInActive = data.new_users_inactive == 1, emblemUrl = data.emblem_url || null, emblem_cloud_id = data.emblem_cloud_id || null, memberData = memberData || null, @@ -119,9 +119,9 @@ app.model.Group = function( data, memberData ) return contactInformation; }; - this.getNewUsersActive = function() + this.getNewUsersInactive = function() { - return newUsersActive; + return newUsersInActive; }; /** diff --git a/src/client/app/js/app/state/GroupDetailEdit.js b/src/client/app/js/app/state/GroupDetailEdit.js index 8876204..6b1b545 100644 --- a/src/client/app/js/app/state/GroupDetailEdit.js +++ b/src/client/app/js/app/state/GroupDetailEdit.js @@ -41,7 +41,7 @@ app.state.GroupDetailEdit = function() description: app.util.Helper.trim($form.find('[data-id="textarea-team-description"]').first().val()), termsConditions: app.util.Helper.trim($form.find('[data-id="textarea-team-terms-conditions"]').first().val()), termsConditionsActive: $form.find('[data-id="checkbox-team-terms-conditions-active"]').first().is(":checked"), - newUsersActive: $form.find('[data-id="checkbox-new-users-active"]').first().is(":checked"), + newUsersInactive: $form.find('[data-id="checkbox-new-users-active"]').first().is(":checked"), contactInformation: app.util.Helper.trim($form.find('[data-id="textarea-team-contactinformation"]').first().val()), industry: $form.find('[data-id="select-team-industry"]').first().val() }, diff --git a/src/client/app/tmpl/group-detail-edit.html b/src/client/app/tmpl/group-detail-edit.html index 39a7419..3209295 100644 --- a/src/client/app/tmpl/group-detail-edit.html +++ b/src/client/app/tmpl/group-detail-edit.html @@ -86,17 +86,17 @@ placeholder="<%= _lc( 'TEAM_DETAIL_TEAMDESCRIPTION_PLACEHOLDER' ) %>"><%= group.getDescription() ? group.getDescription() : '' %>
- +
+ <%= group.getNewUsersInactive() ? 'checked' : '' %> > + for="checkbox-new-users-active"><%= _lc( 'GROUP_NEW_USERS_INACTIVE_CHECKBOX' ) %>
diff --git a/src/client/app/tmpl/group-terms.html b/src/client/app/tmpl/group-terms.html index 4550c0d..5ee6562 100644 --- a/src/client/app/tmpl/group-terms.html +++ b/src/client/app/tmpl/group-terms.html @@ -19,10 +19,7 @@

<%= _lc( 'GROUP_TERMS_DESCRIPTION' ) %>

- +

<%=raw group.getTermsConditions() ? app.util.Helper.nl2br( group.getTermsConditions() ) : '' %>

<% if ( group.getTermsConditionsActive() ) { %>
diff --git a/src/client/app/tmpl/home-modal-not-activated.html b/src/client/app/tmpl/home-modal-not-activated.html index dc9f7dc..b605655 100644 --- a/src/client/app/tmpl/home-modal-not-activated.html +++ b/src/client/app/tmpl/home-modal-not-activated.html @@ -1,5 +1,5 @@ <%= _lc( 'HOME_MODAL_NOT_ACTIVATED_TEXT1' ) %> <%= groupName %>.

<%= _lc( 'HOME_MODAL_NOT_ACTIVATED_TEXT2' ) %> diff --git a/src/server/server/control/TB_Server_Control_Auth.php b/src/server/server/control/TB_Server_Control_Auth.php index c8efa26..6cbc8e7 100644 --- a/src/server/server/control/TB_Server_Control_Auth.php +++ b/src/server/server/control/TB_Server_Control_Auth.php @@ -690,6 +690,8 @@ class TB_Server_Control_Auth $team->display_name = _xss( $teamName ); $team->category = _xss( $teamCategory ); $team->affiliate_id = is_string( $affiliateId ) ? _xss( $affiliateId ) : NULL; + $team->terms_conditions_active = 0; + $team->new_users_inactive = 1; $team->save(); // Set default course categories diff --git a/src/server/server/control/TB_Server_Control_Team.php b/src/server/server/control/TB_Server_Control_Team.php index 6e41b29..b1767be 100644 --- a/src/server/server/control/TB_Server_Control_Team.php +++ b/src/server/server/control/TB_Server_Control_Team.php @@ -639,11 +639,20 @@ class TB_Server_Control_Team { $category = $params->get( 'industry', $team->category ); $team->display_name = _xss( $displayName ); $team->category = _xss( $category ); - $team->description = _xss( $params->get( 'description' ) ); - $team->terms_conditions = _xss( $params->get( 'termsConditions' ) ); + + $description = _xss($params->get('description')); + $toc = _xss( $params->get('termsConditions')); + $contactInformation = _xss($params->get( 'contactInformation')); + + $description = ($description === '') ? null : TB_Server_Utils_Helper::makeUrltoLink($description); + $toc = ($toc === '') ? null : TB_Server_Utils_Helper::makeUrltoLink($toc); + $contactInformation = ($contactInformation === '') ? null : TB_Server_Utils_Helper::makeUrltoLink($contactInformation); + + $team->description = $description; + $team->terms_conditions = $toc; $team->terms_conditions_active = $params->get( 'termsConditionsActive' ) === true ? 1 : 0; - $team->new_users_active = $params->get( 'newUsersActive' ) === true ? 1 : 0; - $team->contact_information = _xss( $params->get( 'contactInformation' ) ); + $team->new_users_inactive = $params->get( 'newUsersInactive' ) === true ? 1 : 0; + $team->contact_information = $contactInformation; $team->save(); return $resp; diff --git a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Profile.php b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Profile.php index 637f4e1..8cb36d4 100644 --- a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Profile.php +++ b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Profile.php @@ -510,7 +510,7 @@ class TB_Shared_Ent_TeamData_Profile extends Francis_Db_Row { 'role' => TB_Shared_Ent_TeamData_Profile::ROLE_PLAYER, 'is_anonymous' => 0, 'join_dt' => TB_Server_Utils_Helper::getUTCNowDateTime(), - 'status' => $team->new_users_active ? self::STATUS_ACTIVE : self::STATUS_NOT_APPROVED, + 'status' => $team->new_users_inactive ? self::STATUS_NOT_APPROVED : self::STATUS_ACTIVE, 'terms_accepted' => 0 ); diff --git a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Team.php b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Team.php index 1f5804c..5c4c5d6 100644 --- a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Team.php +++ b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Team.php @@ -14,7 +14,7 @@ * @property string|NULL $contact_information * @property string|NULL $terms_conditions * @property bool $terms_conditions_active - * @property bool $new_users_active + * @property bool $new_users_inactive * @property string $emblem_url * @property string $emblem_cloud_id * @property array|null $course_categories_js diff --git a/tools/patches/2addDbTermsConditionsToTeam.php b/tools/patches/2addDbTermsConditionsToTeam.php index 9df7952..f712fb4 100644 --- a/tools/patches/2addDbTermsConditionsToTeam.php +++ b/tools/patches/2addDbTermsConditionsToTeam.php @@ -16,4 +16,4 @@ function patch_addTermsConditionsToTeam() echo "DONE..."; } -patch_addTermsConditionsToTeam(); \ No newline at end of file +patch(); \ No newline at end of file diff --git a/tools/patches/4addDbNewUsersActive.php b/tools/patches/4addDbNewUsersInactive.php similarity index 56% rename from tools/patches/4addDbNewUsersActive.php rename to tools/patches/4addDbNewUsersInactive.php index 2924a4c..5fd8d21 100644 --- a/tools/patches/4addDbNewUsersActive.php +++ b/tools/patches/4addDbNewUsersInactive.php @@ -3,16 +3,18 @@ require_once __DIR__ . '/../../src/server/server/config/boot_global.php'; require_once __DIR__ . '/../../src/server/server/config/boot_local.php'; -function patch_addTermsConditionsToTeam() +function patch() { $db = TB_Shared_Db_TeamData::get(); $sql = "ALTER TABLE team - ADD COLUMN new_users_active TINYINT(1) NOT NULL DEFAULT 0 AFTER terms_conditions_active;"; + ADD COLUMN new_users_inactive TINYINT(1) NOT NULL DEFAULT 1 AFTER terms_conditions_active;"; $stmt = $db->query( $sql ); + $sql = "UPDATE team SET new_users_inactive = 0 WHERE 1"; + $stmt = $db->query( $sql ); echo "DONE..."; } -patch_addTermsConditionsToTeam(); \ No newline at end of file +patch(); \ No newline at end of file