summaryrefslogtreecommitdiff
path: root/rt/webrt/Admin/Groups/Modify.html
blob: 7104a6937d2f4662d70fea7e9310f3ee5830cfd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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>