Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Able to view the list of users associated with an Organization #8511

Merged
merged 12 commits into from
Jun 14, 2023
8 changes: 8 additions & 0 deletions lib/ProductOpener/Display.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3898,6 +3898,14 @@ HTML
$user_template_data_ref->{edit_profile} = 1;
$user_template_data_ref->{orgid} = $orgid;
}
if (defined $User{pro_moderator}) {
my @org_members;
foreach my $member_id (sort keys %{$user_or_org_ref->{members}}) {
my $member_user_ref = retrieve_user($member_id);
push @org_members, $member_user_ref;
}
$user_template_data_ref->{org_members} = \@org_members;
}

process_template('web/pages/org_profile/org_profile.tt.html',
$user_template_data_ref, \$profile_html)
Expand Down
10 changes: 10 additions & 0 deletions lib/ProductOpener/Users.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ BEGIN {
&is_admin_user
&create_password_hash
&check_password_hash
&retrieve_user

&check_session

Expand Down Expand Up @@ -921,6 +922,15 @@ sub open_user_session ($user_ref, $request_ref) {
return;
}

sub retrieve_user ($user_id) {
my $user_file = "$data_root/users/" . get_string_id_for_lang("no_language", $user_id) . ".sto";
my $user_ref;
if (-e $user_file) {
$user_ref = retrieve($user_file);
}
return $user_ref;
}

sub init_user ($request_ref) {

my $user_id = undef;
Expand Down
13 changes: 13 additions & 0 deletions po/common/common.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5039,6 +5039,19 @@ msgctxt "official_site"
msgid "Official site"
msgstr "Official site"

msgctxt "organization_members"
msgid "Organization Members"
msgstr "Organization Members"

msgctxt "number_of_members"
msgid "Number of Members"
msgstr "Number of Members"

msgctxt "serial_no"
msgid "S.No"
msgstr "S.No"


msgctxt "contact_form"
msgid "Contact form"
msgstr "Contact form"
Expand Down
13 changes: 13 additions & 0 deletions po/common/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -5076,6 +5076,19 @@ msgctxt "official_site"
msgid "Official site"
msgstr "Official site"

msgctxt "organization_members"
msgid "Organization Members"
msgstr "Organization Members"

msgctxt "number_of_members"
msgid "Number of Members"
msgstr "Number of Members"

msgctxt "serial_no"
msgid "S.No"
msgstr "S.No"


msgctxt "contact_form"
msgid "Contact form"
msgstr "Contact form"
Expand Down
2 changes: 1 addition & 1 deletion scss/_off.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1450,4 +1450,4 @@ a.panel_title {
.button:focus, .button:hover, button:focus, button:hover {
background-color: scale-color($button-bg-color, $lightness: -$button-function-factor / 2);
color: #fff;
}
}
35 changes: 35 additions & 0 deletions templates/web/pages/org_profile/org_profile.tt.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,41 @@
<p>&rarr; <a href="[% link %]">[% lang("official_site") %]</a></p>
[% END %]

[% IF org_members.size %]
<h2>[% lang("organization_members") %]</h2>
<p>[% lang("number_of_members") %][% sep %]: [% org_members.size %]</p>
<div style="position:relative">
<table>
<thead>
<tr>
<th>[% lang("serial_no") %]</th>
<th>[% lang("username") %]</th>
<th>[% lang("name") %]</th>
<th>[% lang("email") %]</th>
<th>[% lang("select_lang") %]</th>
<th>[% lang("select_country") %]</th>

</tr>
</thead>
<tbody>
[% FOREACH users IN org_members %]
[% SET count = 1 %]
<tr>
<td>[% count %].</td>
<td>[% users.userid %]</td>
<td>[% users.name %]</td>
<td>[% users.email %]</td>
<td>[% users.initial_lc %]</td>
<td>[% users.initial_cc %]</td>
</tr>
[% SET count = count + 1 %]
[% END %]
</tbody>
</table>
</div>
[% END %]


<div class="row">

[% FOREACH contact IN ['customer_service', 'commercial_service'] %]
Expand Down