summaryrefslogtreecommitdiff
path: root/rt/webrt/Admin/Groups
diff options
context:
space:
mode:
Diffstat (limited to 'rt/webrt/Admin/Groups')
-rw-r--r--rt/webrt/Admin/Groups/Members.html76
-rw-r--r--rt/webrt/Admin/Groups/Modify.html83
-rw-r--r--rt/webrt/Admin/Groups/Rights.html1
-rw-r--r--rt/webrt/Admin/Groups/index.html33
4 files changed, 193 insertions, 0 deletions
diff --git a/rt/webrt/Admin/Groups/Members.html b/rt/webrt/Admin/Groups/Members.html
new file mode 100644
index 000000000..4b0e0d04f
--- /dev/null
+++ b/rt/webrt/Admin/Groups/Members.html
@@ -0,0 +1,76 @@
+<& /Admin/Elements/Header, Title => "RT/Admin/Edit the group ". $Group->Name &>
+<& /Admin/Elements/GroupTabs, GroupObj => $Group &>
+<& /Elements/ListActions, actions => \@results &>
+
+
+<& /Elements/TitleBoxStart, title => 'Editing membership for group '.$Group->Name &>
+
+<FORM ACTION="<%$RT::WebPath%>/Admin/Groups/Members.html" METHOD=POST>
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$Group->Id%>">
+<TABLE WIDTH="100%">
+<TR>
+<TD>
+Add members
+</TD>
+<TD>
+Current members
+</TD>
+</TR>
+
+<TR>
+<TD VALIGN=TOP>
+<& /Admin/Elements/SelectUsers, Name => "AddMembers" &>
+</TD>
+<TD VALIGN=TOP>
+% if ($Group->MembersObj->Count == 0 ) {
+<i>(No members)</i>
+% } else {
+(Check box to delete group member)
+<UL>
+% while (my $member = $Group->MembersObj->Next()) {
+<LI><INPUT TYPE=CHECKBOX Name="DeleteMember-<%$member->UserObj->id%>">
+<%$member->UserObj->Name%> (<%$member->UserObj->RealName%>)
+% }
+% }
+</UL>
+</TD>
+</TR>
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+<& /Elements/Submit &>
+</form>
+
+
+<%INIT>
+
+my $Group = new RT::Group($session{'CurrentUser'});
+$Group->Load($id) || Abort('Could not load group');
+
+my (@results);
+
+my $key;
+foreach $key (keys %ARGS) {
+
+if ($key =~ /^DeleteMember-(\d+)$/) {
+ my $id = $1;
+ my ($val,$msg) = $Group->DeleteMember($id);
+ push (@results, $msg);
+}
+}
+
+# Make sure AddMembers is always an array
+my @AddMembers = (ref $AddMembers eq 'ARRAY') ? @{$AddMembers} : ($AddMembers);
+
+foreach my $member (@AddMembers) {
+ next unless ($member);
+ my ($val, $msg) = $Group->AddMember($member);
+ push (@results, $msg);
+}
+
+
+</%INIT>
+
+<%ARGS>
+$AddMembers => undef
+$id => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Groups/Modify.html b/rt/webrt/Admin/Groups/Modify.html
new file mode 100644
index 000000000..7104a6937
--- /dev/null
+++ b/rt/webrt/Admin/Groups/Modify.html
@@ -0,0 +1,83 @@
+<& /Admin/Elements/Header, Title => $title &>
+
+<& /Admin/Elements/GroupTabs, GroupObj => $Group &>
+<& /Elements/ListActions, actions => \@results &>
+
+
+<& /Elements/TitleBoxStart, title => $title &>
+
+<FORM ACTION="<%$RT::WebPath%>/Admin/Groups/Modify.html" METHOD=POST>
+
+%unless ($Group->Id) {
+<INPUT TYPE=HIDDEN NAME=id VALUE="new">
+% } else {
+<INPUT TYPE=HIDDEN NAME=id VALUE="<%$Group->Id%>">
+% }
+<TABLE>
+<TR><TD ALIGN=RIGHT>
+Name:
+</TD>
+<TD><INPUT name="Name" value="<%$Group->Name%>"></TD>
+</TR><TR>
+<TD ALIGN=RIGHT>
+Description:</TD><TD COLSPAN=3><INPUT name="Description" value="<%$Group->Description%>" size=60></TD></TR>
+</TABLE>
+<& /Elements/TitleBoxEnd &>
+
+<& /Elements/Submit &>
+</form>
+<%INIT>
+
+my ($title);
+my (@results);
+
+my $Group = new RT::Group($session{'CurrentUser'});
+
+if ($Create) {
+ $title = "Create a new group";
+}
+
+else {
+
+ if ($id eq 'new' ) {
+
+ $Group->Create(Name => "$Name") || Abort ("Group could not be created.");
+ $id = $Group->Id;
+ }
+ else {
+ $Group->Load($id) || Abort('Could not load group');
+ }
+
+
+ if ($id) {
+ $title = "Modify the group ". $Group->Name;
+
+ }
+
+ # If the create failed
+ else {
+ $title = "Create a new group";
+ $Create = 1;
+ }
+
+}
+
+if ($id) {
+
+ my @fields = qw(Description Name );
+ my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields,
+ Object => $Group,
+ ARGSRef => \%ARGS );
+ push (@results,@fieldresults);
+}
+
+
+</%INIT>
+
+
+<%ARGS>
+$Create => undef
+$Name => undef
+$Description => undef
+$id => undef
+</%ARGS>
diff --git a/rt/webrt/Admin/Groups/Rights.html b/rt/webrt/Admin/Groups/Rights.html
new file mode 100644
index 000000000..5c842a301
--- /dev/null
+++ b/rt/webrt/Admin/Groups/Rights.html
@@ -0,0 +1 @@
+Not yet implemented....
diff --git a/rt/webrt/Admin/Groups/index.html b/rt/webrt/Admin/Groups/index.html
new file mode 100644
index 000000000..d419e7f73
--- /dev/null
+++ b/rt/webrt/Admin/Groups/index.html
@@ -0,0 +1,33 @@
+
+<& /Admin/Elements/Header, Title => 'Admin/Groups' &>
+<& /Admin/Elements/Tabs, current_tab => 'Admin/Groups/' &>
+
+<& /Elements/TitleBoxStart, title => 'Select a group' &>
+
+Pseudogroups:<BR>
+<UL>
+%while ( $Group = $PseudoGroups->Next) {
+<LI><A HREF="Modify.html?id=<%$Group->id%>"><%$Group->Name%></a><BR>
+%}
+
+</UL>
+
+Groups:<BR>
+<UL>
+<LI><A HREF="Modify.html?Create=1">Create a new group</A><BR><BR></LI>
+%while ( $Group = $Groups->Next) {
+<LI><A HREF="Modify.html?id=<%$Group->id%>"><%$Group->Name%></a><BR>
+%}
+</UL>
+
+<& /Elements/TitleBoxEnd &>
+<%INIT>
+my ($Group);
+my $PseudoGroups = new RT::Groups($session{'CurrentUser'});
+$PseudoGroups->LimitToPseudo;
+my $Groups = new RT::Groups($session{'CurrentUser'});
+$Groups->LimitToReal;
+
+</%INIT>
+<%ARGS>
+</%ARGS>