diff options
Diffstat (limited to 'rt/webrt/Admin/Global')
-rwxr-xr-x | rt/webrt/Admin/Global/GroupRights.html | 78 | ||||
-rw-r--r-- | rt/webrt/Admin/Global/Keywords.html | 97 | ||||
-rwxr-xr-x | rt/webrt/Admin/Global/Scrips.html | 95 | ||||
-rwxr-xr-x | rt/webrt/Admin/Global/Template.html | 66 | ||||
-rwxr-xr-x | rt/webrt/Admin/Global/Templates.html | 24 | ||||
-rwxr-xr-x | rt/webrt/Admin/Global/UserRights.html | 42 | ||||
-rwxr-xr-x | rt/webrt/Admin/Global/index.html | 2 |
7 files changed, 404 insertions, 0 deletions
diff --git a/rt/webrt/Admin/Global/GroupRights.html b/rt/webrt/Admin/Global/GroupRights.html new file mode 100755 index 000000000..26b7e1fe2 --- /dev/null +++ b/rt/webrt/Admin/Global/GroupRights.html @@ -0,0 +1,78 @@ +<& /Admin/Elements/Header, Title => 'Modify System ACLS' &> +<& /Admin/Elements/SystemTabs &> + +<& /Elements/ListActions, actions => \@results &> + <FORM METHOD=POST action="GroupRights.html"> + + + +<h2>Modify global rights for groups</h2> + +<TABLE> +<TR><TD>Pseudogroups</TD></TR> +% while (my $GroupObj = $PseudoGroups->Next()) { + + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% $GroupObj->Name %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalObj => $GroupObj, + PrincipalType => 'Group', + Scope => 'System' &> + </TD> + </TR> + +% } + +<TR><TD>Groups</TD></TR> + +% while (my $GroupObj = $Groups->Next()) { + + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% $GroupObj->Name %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalObj => $GroupObj, + PrincipalType => 'Group', + Scope => 'System' &> + </TD> + </TR> + +% } + + </TABLE> + <& /Elements/Submit, Caption => "Be sure to save your changes", Reset => 1 &> + </FORM> + + <%INIT> + + #Update the acls. + my @results = ProcessACLChanges(\@CheckACL, \%ARGS); + + + # {{{ do basic initialization. + + + + # Find out which groups we want to display ACL selects for. + my $Groups = new RT::Groups($session{'CurrentUser'}); + #TODO: limit this to non-pseudogroups + $Groups->LimitToReal(); + + + my $PseudoGroups = new RT::Groups($session{'CurrentUser'}); + #TODO: limit this to non-pseudogroups + $PseudoGroups->LimitToPseudo; + + # }}} + + + + + </%INIT> + +<%ARGS> +@CheckACL => undef +</%ARGS> diff --git a/rt/webrt/Admin/Global/Keywords.html b/rt/webrt/Admin/Global/Keywords.html new file mode 100644 index 000000000..bf7bbd266 --- /dev/null +++ b/rt/webrt/Admin/Global/Keywords.html @@ -0,0 +1,97 @@ +<& /Admin/Elements/Header, Title => 'Edit keywords' &> +<& /Admin/Elements/SystemTabs &> +<& /Elements/ListActions, actions => \@actions &> + +<& /Elements/TitleBoxStart, title => $description &> + + <FORM METHOD=POST ACTION="Keywords.html"> + +% if ($KeywordSelects->Count > 0 ) { +<TABLE> +<TR><TD>Delete</TD></TR> +% while (my $keywordselect = $KeywordSelects->Next ) { +<TR> + <TD><INPUT TYPE="CHECKBOX" NAME="KeywordSelect-<%$keywordselect->Id%>-Delete"></TD> + <TD><& /Admin/Elements/SelectKeywordSelect, KeywordSelect => $keywordselect &></TD> +</TR> +% } +</TABLE> +% } + +Add a global keyword selection: +%my $ks = new RT::KeywordSelect($session{'CurrentUser'}); +<ul> +<li><& /Admin/Elements/SelectKeywordSelect, KeywordSelect => $ks, NamePrefix => 'new' &></li> +</ul> + +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit &> +</FORM> + + + +<%init> +my (@actions); + +my $description = "Modify global Keyword selections"; + +my $KeywordSelects = new RT::KeywordSelects ($session{'CurrentUser'}); + +unless ($KeywordSelects->LimitToGlobals()) { + Abort("Couldn't load KeywordSelects."); +} + + +# {{{ if we're trying to create a new keyword select + +if ($ARGS{'KeywordSelect-new-Name'}) { + my $NewKeywordSelect = new RT::KeywordSelect($session{'CurrentUser'}); + + my ($retval, $msg) = $NewKeywordSelect->Create ( Keyword => $ARGS{'KeywordSelect-new-Keyword'}, + ObjectField => 'Queue', + ObjectType => 'Ticket', + ObjectValue => 0, + Name => $ARGS{'KeywordSelect-new-Name'}, + Single => $ARGS{'KeywordSelect-new-Single'}, + Depth => $ARGS{'KeywordSelect-new-Depth'} + ); + push (@actions, $msg); +} +# }}} + +# {{{ if we're trying to delete the keywordselect +foreach my $key (keys %ARGS) { + if ($key =~ /^KeywordSelect-(\d+)-Delete$/) { + my $id = $1; + my $keywordselect = new RT::KeywordSelect($session{'CurrentUser'}); + $keywordselect->Load($id) || push @actions, "Couldn't load keywordSelect"; + my ($val, $msg) = $keywordselect->SetDisabled(1); + if ($val) { + push @actions, 'KeywordSelect disabled.'; + } + else { + push @actions, $msg; + } + } +} +# }}} +# {{{ if we're modifying keyword selects +my @fields = qw(Name Keyword Single Depth); + +while (my $ks = $KeywordSelects->Next) { + foreach my $field (@fields) { + if (defined ($ARGS{"KeywordSelect-".$ks->Id."-".$field}) && + ($ARGS{"KeywordSelect-".$ks->Id."-".$field} ne $ks->$field())) { + + my $method = "Set$field"; + my ($val, $msg) = $ks->$method($ARGS{"KeywordSelect-".$ks->Id."-".$field}); + push @actions, "Keyword Select ". $ks->Name."/$field:".$msg; + } + } +} +# }}} + +</%init> + +<%ARGS> +</%ARGS> diff --git a/rt/webrt/Admin/Global/Scrips.html b/rt/webrt/Admin/Global/Scrips.html new file mode 100755 index 000000000..e55f8b3de --- /dev/null +++ b/rt/webrt/Admin/Global/Scrips.html @@ -0,0 +1,95 @@ +<& /Admin/Elements/Header, Title => 'Edit scrips' &> +<& /Admin/Elements/SystemTabs &> + +<& /Elements/ListActions, actions => \@actions &> + +<& /Elements/TitleBoxStart, title => "Modify global scrips" &> + + <FORM METHOD=POST ACTION="Scrips.html"> + +% if ($Scrips->Count > 0 ) { +<TABLE> +<TR> +<TD>Delete +</TD> +<TD> +</TR> + +% while (my $scrip = $Scrips->Next ) { +<TR> +<TD> +<INPUT TYPE="CHECKBOX" NAME="DeleteScrip-<%$scrip->Id%>"> +</TD> +<TD> +<% $scrip->ConditionObj->Name %> +<% $scrip->ActionObj->Name %> +with template <% $scrip->TemplateObj->Name %> +</TD> +</TR> +% } + +</TABLE> + +% } +Add a scrip which will apply to all queues: +<ul> +<li>Condition: <& /Admin/Elements/SelectScripCondition, Name => 'NewScripCondition' &> + Action: <& /Admin/Elements/SelectScripAction, Name => 'NewScripAction' &> + Template: <& /Admin/Elements/SelectTemplate, Name => 'NewScripTemplate' &> + +</ul> + +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit &> +</FORM> +<%init> +my (@actions, $description); + +my $Scrips = new RT::Scrips ($session{'CurrentUser'}); +$Scrips->LimitToGlobal(); + + + + +if ($NewScripAction and $NewScripCondition) { + my $NewScrip = new RT::Scrip($session{'CurrentUser'}); + + my ($retval, $msg) = $NewScrip->Create ( ScripAction => $NewScripAction, + ScripCondition => $NewScripCondition, + Stage => 'TransactionCreate', + Queue => 0, + Template => $NewScripTemplate); + if (defined $retval) { + push @actions, $msg; + } + else { + push @actions, $msg; + } +} + +# {{{ deal with modifying and deleting existing scrips +my ($key ); +foreach $key (keys %ARGS) { + # {{{ if we're trying to delete the scrip + if ($key =~ /^DeleteScrip-(\d+)/) { + my $id = $1; + my $scrip = new RT::Scrip($session{'CurrentUser'}); + $scrip->Load($id); + my ($retval, $msg) = $scrip->Delete; + if ($retval) { + push @actions, "Scrip deleted"; + } + else { + push @actions, $msg; + } + } + # }}} +} +# }}} +</%init> + +<%ARGS> +$NewScripCondition => undef +$NewScripAction => undef +$NewScripTemplate => undef +</%ARGS> diff --git a/rt/webrt/Admin/Global/Template.html b/rt/webrt/Admin/Global/Template.html new file mode 100755 index 000000000..856d2ee8f --- /dev/null +++ b/rt/webrt/Admin/Global/Template.html @@ -0,0 +1,66 @@ +<& /Admin/Elements/Header, title => "Modify template ".$TemplateObj->id&> +<& /Admin/Elements/SystemTabs &> +<& /Elements/ListActions, actions => \@results &> + +<& /Elements/TitleBoxStart, title => $title &> + +<FORM METHOD=POST ACTION="Template.html"> +%if ($create ) { +<INPUT TYPE=HIDDEN NAME=template VALUE="new"> +% } else { +<INPUT TYPE=HIDDEN NAME=template VALUE="<%$TemplateObj->Id%>"> +% } + +%# hang onto the queue id +<INPUT TYPE=HIDDEN name="Queue" value="<%$Queue%>"> + + +Name: <input name="Name" VALUE="<%$TemplateObj->Name%>" SIZE=20><BR> +Description: <input name="Description" VALUE="<%$TemplateObj->Description%>" SIZE=80><BR> + +<TEXTAREA NAME=Content ROWS=25 COLS=80 WRAP=SOFT> +<%$TemplateObj->Content%></TEXTAREA> + +<& /Elements/TitleBoxEnd&> +<&/Elements/Submit&> +</FORM> + + + +<%INIT> + +my $TemplateObj = new RT::Template($session{'CurrentUser'}); +my ($title, @results); + +if ($create) { + $title = "Create a template"; +} + +else { + if ($template eq 'new') { + my ($val, $msg) = $TemplateObj->Create(Queue => $Queue, Name => $Name); + Abort("Could not create template: $msg") unless ($val); + push @results, $msg; + $title = 'Created template ' . $TemplateObj->Name(); + } + else { + $TemplateObj->Load($template) || Abort('No Template'); + $title = 'Editing template ' . $TemplateObj->Name(); + } + + +} +if ($TemplateObj->Id()) { + my @attribs = qw( Description Content Queue Name); + my @aresults = UpdateRecordObject( AttributesRef => \@attribs, + Object => $TemplateObj, + ARGSRef => \%ARGS); + push @results, @aresults; +} +</%INIT> +<%ARGS> +$Queue => undef +$template => undef +$create => undef +$Name => undef +</%ARGS> diff --git a/rt/webrt/Admin/Global/Templates.html b/rt/webrt/Admin/Global/Templates.html new file mode 100755 index 000000000..cf388e521 --- /dev/null +++ b/rt/webrt/Admin/Global/Templates.html @@ -0,0 +1,24 @@ +<& /Admin/Elements/Header, Title => 'Edit system templates' &> +<& /Admin/Elements/SystemTabs &> + +<& /Elements/TitleBoxStart, title => 'Edit system templates' &> +<UL> +<LI><A href="Template.html?create=1&Queue=0">Create a new template</A><BR><BR> + + +%while (my $TemplateObj = $Templates->Next) { + +<LI><A HREF="Template.html?template=<%$TemplateObj->id()%>"><%$TemplateObj->id()%>/<%$TemplateObj->Name%>: <%$TemplateObj->Description%></a><BR> + +%} + +<& /Elements/TitleBoxEnd &> +<%INIT> + +my $Templates = RT::Templates->new($session{'CurrentUser'}); +$Templates->LimitToGlobal(); + +</%INIT> +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/webrt/Admin/Global/UserRights.html b/rt/webrt/Admin/Global/UserRights.html new file mode 100755 index 000000000..351f4b8c6 --- /dev/null +++ b/rt/webrt/Admin/Global/UserRights.html @@ -0,0 +1,42 @@ +<& /Admin/Elements/Header, Title => 'Modify System ACLS' &> +<& /Admin/Elements/SystemTabs &> + +<& /Elements/ListActions, actions => \@results &> + <FORM METHOD=POST action="UserRights.html"> + + +<h2>Modify global rights for users</h2> +<TABLE> +% while (my $UserObj = $Users->Next()) { + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <A HREF="<%$RT::WebPath%>/Admin/Users/Modify.html?id=<%$UserObj->id%>"><% $UserObj->Name %></A> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalObj => $UserObj, + PrincipalType => 'User', + Scope => 'System' &> + + </TD> + </TR> + +% } + </TABLE> + + <& /Elements/Submit, Caption => "Be sure to save your changes", Reset => 1 &> + </FORM> + +<%INIT> + + my @results = ProcessACLChanges(\@CheckACL, \%ARGS); + + # Find out which users we want to display ACL selects for + my $Users = new RT::Users($session{'CurrentUser'}); + + $Users->LimitToPrivileged(); + +</%INIT> + +<%ARGS> +@CheckACL => undef +</%ARGS> diff --git a/rt/webrt/Admin/Global/index.html b/rt/webrt/Admin/Global/index.html new file mode 100755 index 000000000..5907ed1e8 --- /dev/null +++ b/rt/webrt/Admin/Global/index.html @@ -0,0 +1,2 @@ +<& /Admin/Elements/Header, Title => 'Admin/Global configuration' &> +<& /Admin/Elements/SystemTabs &> |