diff options
Diffstat (limited to 'rt/webrt/Admin')
62 files changed, 3229 insertions, 0 deletions
diff --git a/rt/webrt/Admin/Elements/CreateQueueCalled b/rt/webrt/Admin/Elements/CreateQueueCalled new file mode 100755 index 000000000..aeed6e786 --- /dev/null +++ b/rt/webrt/Admin/Elements/CreateQueueCalled @@ -0,0 +1,3 @@ +<FORM METHOD=get ACTION="<% $RT::WebPath %>/Admin/Queues/Create.html"> +Create a queue called <INPUT NAME="Name" size=10><input type=submit> +</form> diff --git a/rt/webrt/Admin/Elements/CreateUserCalled b/rt/webrt/Admin/Elements/CreateUserCalled new file mode 100755 index 000000000..7e4bb7554 --- /dev/null +++ b/rt/webrt/Admin/Elements/CreateUserCalled @@ -0,0 +1,3 @@ +<FORM METHOD=get ACTION="<%$RT::WebPath%>/Admin/Users/Create.html"> +New user called <INPUT NAME="Name" size=10><input type=submit value="Create"> +</form> diff --git a/rt/webrt/Admin/Elements/EditUserComments b/rt/webrt/Admin/Elements/EditUserComments new file mode 100755 index 000000000..1ac7e187f --- /dev/null +++ b/rt/webrt/Admin/Elements/EditUserComments @@ -0,0 +1,9 @@ +<& /Elements/Header, Title => "Comments about $name" &> +These comments aren't generally visible to the user:<br> +<input type="hidden" name="id" value="<%$id%>"> +<TEXTAREA COLS=60 ROWS=15 WRAP=SOFT NAME="Comments"><% $UserObj->Comments %></TEXTAREA> +</FORM> + +<%ARGS> +$UserObj => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/GrantQueueRightsTo b/rt/webrt/Admin/Elements/GrantQueueRightsTo new file mode 100755 index 000000000..3850a18f2 --- /dev/null +++ b/rt/webrt/Admin/Elements/GrantQueueRightsTo @@ -0,0 +1,30 @@ +<BR> + +% if ($msg) { +<%$msg%> +% } elsif ($Users) { +<ul> +% while (my $u = $Users->Next ) { +<li> <%$u->Name%> (<%$u->RealName%>) <& SelectQueueRights, Name => "GrantTo".$u->id &> +% } +</ul> +% } + +<%INIT> +my ($msg, $Users); +if (!$ARGS{'UserString'}) { +$msg = "No users selected."; + } +else { + $Users = new RT::Users($session{'CurrentUser'}); + $Users->Limit(FIELD => $ARGS{'UserField'}, + VALUE => $ARGS{'UserString'}, + OPERATOR => $ARGS{'UserOp'}); + } +</%INIT> + +<%ARGS> +$UserField => 'Name' +$UserOp => '=' +$UserString => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/GroupTabs b/rt/webrt/Admin/Elements/GroupTabs new file mode 100755 index 000000000..261bef1e2 --- /dev/null +++ b/rt/webrt/Admin/Elements/GroupTabs @@ -0,0 +1,18 @@ +<& /Admin/Elements/Tabs, subtabs => $subtabs, current_tab => 'Admin/Groups/' &> +<hr> +<%INIT> +my $subtabs = { + Basics => { title => 'Basics', + path => "Admin/Groups/Modify.html?id=". $GroupObj->id + } + }; + +unless ($GroupObj->Pseudo) { +$subtabs->{'Members'} = { title => 'Members', + path => "Admin/Groups/Members.html?id=".$GroupObj->id }; +} +</%INIT> + +<%ARGS> +$GroupObj => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/Header b/rt/webrt/Admin/Elements/Header new file mode 100755 index 000000000..95acdac7e --- /dev/null +++ b/rt/webrt/Admin/Elements/Header @@ -0,0 +1,5 @@ +<& /Elements/Header, Title => $Title &> + +<%ARGS> +$Title => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/ListGlobalKeywordSelects b/rt/webrt/Admin/Elements/ListGlobalKeywordSelects new file mode 100644 index 000000000..b24d68989 --- /dev/null +++ b/rt/webrt/Admin/Elements/ListGlobalKeywordSelects @@ -0,0 +1,15 @@ +% while (my $KeywordSelect = $KeywordSelects->Next()) { + +<%$KeywordSelect->Name %>: +<% $KeywordSelect->Single ? 'Single' : 'Multiple' %> +children of +<% $KeywordSelect->KeywordObj->Path %> +% if ($KeywordSelect->Depth) { + up to <%$KeywordSelect->Depth%> levels deep +% } +<BR> +%} +<%INIT> +my $KeywordSelects = RT::KeywordSelects->new($session{'CurrentUser'}); +$KeywordSelects->LimitToGlobals(); +</%INIT> diff --git a/rt/webrt/Admin/Elements/ListGlobalScrips b/rt/webrt/Admin/Elements/ListGlobalScrips new file mode 100755 index 000000000..2f044bf52 --- /dev/null +++ b/rt/webrt/Admin/Elements/ListGlobalScrips @@ -0,0 +1,10 @@ +% while (my $scrip = $Scrips->Next ) { +<% $scrip->ConditionObj->Name %> +<% $scrip->ActionObj->Name %> +with template <% $scrip->TemplateObj->Name %> +<BR> +% } +<%init> +my $Scrips = new RT::Scrips ($session{'CurrentUser'}); +$Scrips->LimitToGlobal(); +</%INIT> diff --git a/rt/webrt/Admin/Elements/ModifyKeyword b/rt/webrt/Admin/Elements/ModifyKeyword new file mode 100644 index 000000000..4b01c3692 --- /dev/null +++ b/rt/webrt/Admin/Elements/ModifyKeyword @@ -0,0 +1,95 @@ +<FORM METHOD="get" ACTION="<%$RT::WebPath%>/Admin/Keywords/Modify.html"> +[<%$title |n %>]<BR> + +<INPUT TYPE="hidden" NAME="id" VALUE="<% $id %>"> +Keyword <INPUT NAME="Name" VALUE="<% $Keyword->Name %>"><BR> + +Parent <SELECT NAME="Parent"> + <OPTION VALUE=""<% defined($Keyword->Parent) ? '' : ' SELECTED' %>>-</OPTION> +%while ( $parent = $parents->Next ) { + <OPTION VALUE="<% $parent->id %>"<% defined($Keyword->Parent) && $parent->id == $Keyword->Parent ? ' SELECTED' : '' %>><% $parent->Name %></OPTION> +%} +</SELECT> + + +Kids <FONT SIZE="-2">(separate by +<INPUT TYPE="radio" NAME="delim" VALUE="n"<% $delim eq 'n' ? ' CHECKED' : '' %>> +line or +<INPUT TYPE="radio" NAME="delim" VALUE="s"<% $delim eq 's' ? ' CHECKED' : '' %>> +whitespace)</FONT><BR> + +<TEXTAREA NAME="Kids" ROWS=4><% $kidstring %></TEXTAREA> +<BR> + +<& /Elements/Submit, Label => $submit &> +</FORM> + +<%INIT> + +my $Keyword = new RT::Keyword($session{CurrentUser}); +my ($title, $submit, %kids, $kid); + +if ( $Create ) { + $title = "Create a new Keyword"; + $submit = "Create"; + $id = "new"; + %kids = (); + $Parent = ''; #silence +} elsif ( $id eq 'new' ) { + $id = $Keyword->Create( Name => $Name, Parent => $Parent ) + or Abort("can't create keyword Name=>$Name, Parent=>$Parent"); +} else { + $Keyword->Load($id) || Abort("Can't load keyword id $id"); + #foreach my $field ( grep eval "defined(\$$_)", qw( Name Parent )) { + # eval "\$Keyword->Set(\$field=>\$$field); #sigh + #} + $Keyword->SetName($Name) if defined($Name); + $Keyword->SetParent($Parent) if defined($Parent); +} + +$title = "Modify the Keyword <B>". $Keyword->Name. "</B>"; +$submit = "Modify"; + +my $kids = new RT::Keywords($session{CurrentUser}); +$kids->Limit( FIELD => 'Parent', VALUE => $id, OPERATOR => '=' ); +$kids{$kid->Name} = $kid while $kid = $kids->Next; + +if ( defined($Kids) ) { + my %newkids; + if ( $delim eq 'n' ) { + %newkids = map { $_=>1 } split(/\n/, $Kids); + } elsif ( $delim eq 's' ) { + %newkids = map { $_=>1 } split(' ', $Kids); + } else { + Abort("'$delim' isn't a valid keyword delimiter."); + } + foreach ( grep { ! defined($newkids{$_}) } keys %kids ) { + $kids{$_}->Delete; + delete $kids{$_}; + } + foreach ( grep { ! defined($kids{$_}) } keys %newkids ) { + $kids{$_} = new RT::Keyword($session{CurrentUser}); + $kids{$_}->Create( Name => $_, Parent => $id ) + or Abort("can't create keyword Name=>$_, Parent=>$id"); + } + +} + + +my $parent; +my $parents = new RT::Keywords($session{CurrentUser}); +$parents->UnLimit; + +$delim = ( grep /\s/, keys %kids ) ? 'n' : 's'; +my $kidstring = join("\n", keys %kids); + +</%INIT> + +<%ARGS> +$id => undef +$Create => undef +$Name => undef +$Parent => undef +$Kids => undef +$delim => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/ModifyKeywordSelect b/rt/webrt/Admin/Elements/ModifyKeywordSelect new file mode 100644 index 000000000..470e62929 --- /dev/null +++ b/rt/webrt/Admin/Elements/ModifyKeywordSelect @@ -0,0 +1,120 @@ + <FORM NAME="ModifyKeywordSelect" METHOD=POST ACTION="<%$RT::WebPath%>/Admin/KeywordSelects/Modify.html"> + + [<%$title |n %>] + <BR> + + <INPUT TYPE="hidden" NAME="id" VALUE="<% $id %>"> + Keyword + <SELECT NAME="Parent"> + +%while ( $parent = $parents->Next ) { + + <OPTION VALUE="<% $parent->id %>" <% defined($KeywordSelect->Parent) && $parent->id == $KeywordSelect->Parent ? ' SELECTED' : '' %>><% $parent->Name %></OPTION> + +% } + + </SELECT> + <BR> + Object + <SELECT NAME="ObjectType"> + <OPTION SELECTED>Ticket</OPTION> + </SELECT> + <BR> + +<SCRIPT> +function addOption(text, value, defaultselected, selected) { + var option = new Option(text, value, defaultselected, selected ) + var length = document.ModifyKeywordSelect.ObjectValue.length; + document.ModifyKeywordSelect.ObjectValue.options[length] = option +} +function ChangeObjectValue(what) { + Value = what.options[what.selectedIndex].value + if ( Value == "(none)" ) { + document.ModifyKeywordSelect.ObjectValue.options.length = 0 + addOption("(n/a)", "", false, false) + } + if ( Value == "Queue" ) { + document.ModifyKeywordSelect.ObjectValue.options.length = 0 +%foreach $queue ( keys %queues ) { + addOption("<% $queues{$queue} %>", "<% $queue %>", false, <% $queue == $KeywordSelect->ObjectValue ? 'true' : 'false' %> ) +%} + } +} +</SCRIPT> + + Limit to <SELECT NAME="ObjectField" onChange="ChangeObjectValue(this)"> + <OPTION VALUE="" <% $KeywordSelect->ObjectField ? '' : ' SELECTED' %>>(none)</OPTION> + <OPTION VALUE="Queue" <% $KeywordSelect->ObjectField eq 'Queue' ? ' SELECTED' : '' %>>Queue</OPTION> + </SELECT> + <SELECT NAME="ObjectValue"> + <OPTION VALUE="<% $KeywordSelect->ObjectValue %>"> + <% $KeywordSelect->ObjectField ? $queues{$KeywordSelect->ObjectValue} : "(n/a)" %></OPTION> + </SELECT><BR> + <INPUT TYPE="hidden" NAME="SingleMagic" VALUE="1"> + <INPUT TYPE="checkbox" NAME="Single" VALUE="1" <% $KeywordSelect->Single ? ' CHECKED' : '' %>>Allow single selection only<BR> + Limit to <INPUT TYPE="text" NAME="Generations" SIZE="2" VALUE="<% $KeywordSelect->Generations %>"> generations (0 = no limit)<BR> + <& /Elements/Submit, Label => $submit &> + +</FORM> + +<%INIT> + + +my $KeywordSelect = new RT::KeywordSelect($session{CurrentUser}); + +my($title, $submit); + +if ( $Create ) { + $title = "Create a new KeywordSelect"; + $submit = "Create"; + $id = "new"; +} else { + if ( $id eq 'new' ) { + $id = $KeywordSelect->Create ( + Parent => $Parent, + ObjectType => $ObjectType, + ObjectField => $ObjectField, + ObjectValue => $ObjectValue, + Single => $Single, + Generations => $Generations, + ) or Abort "can't create KeywordSelect"; + } else { + $KeywordSelect->Load($id) || Abort("Can't load keyword id $id"); + #false laziness + $KeywordSelect->SetParent($Parent) if defined($Parent); + $KeywordSelect->SetObjectType($ObjectType) if defined($ObjectType); + $KeywordSelect->SetObjectField($ObjectField) if defined($ObjectField); + $KeywordSelect->SetObjectValue($ObjectValue) if defined($ObjectValue); + $KeywordSelect->SetSingle($Single) if defined($SingleMagic); + $KeywordSelect->SetGenerations($Generations) if defined($Generations); + } + $title = "Modify the KeywordSelect <B>". $KeywordSelect->KeywordObj->Name. "</B>"; + $submit = "Modify"; + +} + + my $parents = new RT::Keywords($session{CurrentUser}); + $parents->UnLimit; + my $parent; + +my $queues = new RT::Queues($session{CurrentUser}); +$queues->UnLimit; + +my %queues; +my $queue; +$queues{$queue->id} = $queue->Name while $queue = $queues->Next; + +</%INIT> + +<%ARGS> +$id => undef +$Create => undef +$Parent => undef +$ObjectType => undef +$ObjectField => undef +$ObjectValue => undef +$Single => undef +$SingleMagic => undef +$Generations => undef +</%ARGS> + diff --git a/rt/webrt/Admin/Elements/ModifyQueue b/rt/webrt/Admin/Elements/ModifyQueue new file mode 100755 index 000000000..a641c81af --- /dev/null +++ b/rt/webrt/Admin/Elements/ModifyQueue @@ -0,0 +1,56 @@ + +<& /Elements/TitleBoxStart, title => 'Editing Configuration for queue '.$QueueObj->Id &> + +<FORM ACTION="<%$RT::WebPath%>/Admin/Queues/Modify.html" METHOD=POST> +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$QueueObj->Id%>"> +<TABLE> +<TR><TD ALIGN=RIGHT> +Queue Name: +</TD> +<TD><INPUT name="Name" value="<%$QueueObj->Name%>"></TD> +</TR><TR> +<TD ALIGN=RIGHT> +Description:</TD><TD COLSPAN=3><INPUT name="Description" value="<%$QueueObj->Description%>" size=60></TD></TR> +<TR> +<TD ALIGN=RIGHT> +Correspondence Address: +</TD><TD> +<INPUT name="CorrespondAddress" value="<%$QueueObj->CorrespondAddress%>"> +</TD> +<TD ALIGN=RIGHT> + +Comment Address: </TD><TD> +<INPUT NAME="CommentAddress" value="<%$QueueObj->CommentAddress%>"> +</TD> +</TR><TR> + +<TD ALIGN=RIGHT> +Priority starts at: +</TD><TD><INPUT NAME="InitialPriority" value="<%$QueueObj->InitialPriority %>"> +</TD> +<TD ALIGN=RIGHT> +Over time, priority moves toward: +</TD><TD><INPUT NAME="FinalPriority" value="<%$QueueObj->FinalPriority %>"> +</TD> +</TR> +<TR> +<TD ALIGN=RIGHT> +Requests should be due in: +</TD><TD> +<INPUT NAME="DefaultDueIn" VALUE="<%$QueueObj->DefaultDueIn%>"> days. +</TD> +</TR> +</TABLE> +<& /Elements/Submit &> +</form> +<& /Elements/TitleBoxEnd &> + +<%INIT> + +</%INIT> + +<%ARGS> + + +$QueueObj => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/ModifyTemplate b/rt/webrt/Admin/Elements/ModifyTemplate new file mode 100755 index 000000000..6e4f8a379 --- /dev/null +++ b/rt/webrt/Admin/Elements/ModifyTemplate @@ -0,0 +1,78 @@ + +<& /Elements/TitleBoxStart, title => 'Editing Configuration for user '.$UserObj->Name &> + +<FORM ACTION="<%$RT::WebPath%>/Admin/ModifyUser.html" METHOD=POST> +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$UserObj->Id%>"> + +Name: <input name="Name" value="<%$UserObj->Name%>"> +<BR> +New Password: <input type=password name="Pass1"><BR> +Retype Password: <input type=password name="Pass2"><BR> + +Comments: <TEXTAREA name="Comments" COLS=20 ROWS=5> +<%$UserObj->Comments%></TEXTAREA> + +<BR> +Signature: <TEXTAREA COLS=80 ROWS=5 name="Signature"> +<%$UserObj->Signature%>"></TEXTAREA> +<BR> +EmailAddress: <input name="EmailAddress" value="<%$UserObj->EmailAddress%>"> +<BR> +FreeformContactInfo: <input name="FreeformContactInfo" value="<%$UserObj->FreeformContactInfo%>"> +<BR> +Organization: <input name="Organization" value="<%$UserObj->Organization%>"> +<BR> +RealName: <input name="RealName" value="<%$UserObj->RealName%>"> +<BR> +NickName: <input name="NickName" value="<%$UserObj->NickName%>"> +<BR> +Lang: <input name="Lang" value="<%$UserObj->Lang%>"> +<BR> +EmailEncoding: <input name="EmailEncoding" value="<%$UserObj->EmailEncoding%>"> +<BR> +WebEncoding: <input name="WebEncoding" value="<%$UserObj->WebEncoding%>"> +<BR> +ExternalContactInfoId: <input name="ExternalContactInfoId" value="<%$UserObj->ExternalContactInfoId%>"> +<BR> +ContactInfoSystem: <input name="ContactInfoSystem" value="<%$UserObj->ContactInfoSystem%>"> +<BR> +Gecos: <input name="Gecos" value="<%$UserObj->Gecos%>"> +<BR> +ExternalAuthId: <input name="ExternalAuthId" value="<%$UserObj->ExternalAuthId%>"> +<BR> +AuthSystem: <input name="AuthSystem" value="<%$UserObj->AuthSystem%>"> +<BR> +HomePhone: <input name="HomePhone" value="<%$UserObj->HomePhone%>"> +<BR> +WorkPhone: <input name="WorkPhone" value="<%$UserObj->WorkPhone%>"> +<BR> +MobilePhone: <input name="MobilePhone" value="<%$UserObj->MobilePhone%>"> +<BR> +PagerPhone: <input name="PagerPhone" value="<%$UserObj->PagerPhone%>"> +<BR> +Address1: <input name="Address1" value="<%$UserObj->Address1%>"> +<BR> +Address2: <input name="Address2" value="<%$UserObj->Address2%>"> +<BR> +City: <input name="City" value="<%$UserObj->City%>"> +<BR> +State: <input name="State" value="<%$UserObj->State%>"> +<BR> +Zip: <input name="Zip" value="<%$UserObj->Zip%>"> +<BR> +Country: <input name="Country" value="<%$UserObj->Country%>"> +<BR> + +<input type=submit> +</form> +<& /Elements/TitleBoxEnd &> + +<%INIT> + +</%INIT> + +<%ARGS> + + +$UserObj => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/ModifyUser b/rt/webrt/Admin/Elements/ModifyUser new file mode 100755 index 000000000..53aa027c0 --- /dev/null +++ b/rt/webrt/Admin/Elements/ModifyUser @@ -0,0 +1,77 @@ + +<& /Elements/TitleBoxStart, title => 'Editing Configuration for user '.$UserObj->Name &> + +<FORM ACTION="<%$RT::WebPath%>/Admin/Users/Modify.html" METHOD=POST> +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$UserObj->Id%>"> + +Name: <input name="Name" value="<%$UserObj->Name%>"> +<BR> +New Password: <input type=password name="Pass1"><BR> +Retype Password: <input type=password name="Pass2"><BR> + +Comments: <TEXTAREA name="Comments" COLS=80 ROWS=5 WRAP=VIRTUAL> +<%$UserObj->Comments%></TEXTAREA> + +<BR> +Signature: <TEXTAREA COLS=80 ROWS=5 name="Signature" WRAP=HARD> +<%$UserObj->Signature%></TEXTAREA> +<BR> +EmailAddress: <input name="EmailAddress" value="<%$UserObj->EmailAddress%>"> +<BR> +FreeformContactInfo: <input name="FreeformContactInfo" value="<%$UserObj->FreeformContactInfo%>"> +<BR> +Organization: <input name="Organization" value="<%$UserObj->Organization%>"> +<BR> +RealName: <input name="RealName" value="<%$UserObj->RealName%>"> +<BR> +NickName: <input name="NickName" value="<%$UserObj->NickName%>"> +<BR> +Lang: <input name="Lang" value="<%$UserObj->Lang%>"> +<BR> +EmailEncoding: <input name="EmailEncoding" value="<%$UserObj->EmailEncoding%>"> +<BR> +WebEncoding: <input name="WebEncoding" value="<%$UserObj->WebEncoding%>"> +<BR> +ExternalContactInfoId: <input name="ExternalContactInfoId" value="<%$UserObj->ExternalContactInfoId%>"> +<BR> +ContactInfoSystem: <input name="ContactInfoSystem" value="<%$UserObj->ContactInfoSystem%>"> +<BR> +Gecos: <input name="Gecos" value="<%$UserObj->Gecos%>"> +<BR> +ExternalAuthId: <input name="ExternalAuthId" value="<%$UserObj->ExternalAuthId%>"> +<BR> +AuthSystem: <input name="AuthSystem" value="<%$UserObj->AuthSystem%>"> +<BR> +HomePhone: <input name="HomePhone" value="<%$UserObj->HomePhone%>"> +<BR> +WorkPhone: <input name="WorkPhone" value="<%$UserObj->WorkPhone%>"> +<BR> +MobilePhone: <input name="MobilePhone" value="<%$UserObj->MobilePhone%>"> +<BR> +PagerPhone: <input name="PagerPhone" value="<%$UserObj->PagerPhone%>"> +<BR> +Address1: <input name="Address1" value="<%$UserObj->Address1%>"> +<BR> +Address2: <input name="Address2" value="<%$UserObj->Address2%>"> +<BR> +City: <input name="City" value="<%$UserObj->City%>"> +<BR> +State: <input name="State" value="<%$UserObj->State%>"> +<BR> +Zip: <input name="Zip" value="<%$UserObj->Zip%>"> +<BR> +Country: <input name="Country" value="<%$UserObj->Country%>"> +<BR> +<& /Elements/Submit &> +</form> +<& /Elements/TitleBoxEnd &> + +<%INIT> + +</%INIT> + +<%ARGS> + + +$UserObj => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/QueueRightsForUser b/rt/webrt/Admin/Elements/QueueRightsForUser new file mode 100644 index 000000000..e62a124ce --- /dev/null +++ b/rt/webrt/Admin/Elements/QueueRightsForUser @@ -0,0 +1,17 @@ +<UL> +%while(my $ACE = $ACL->Next) { + +<LI><checkbox name="delete_ace_<%$ACE->id%>"> <%$ACE->RightName%> (<%$ACE->UserObj->RealName%>) + +%} +</UL> + +<%INIT> +my $ACL = new RT::ACL($session{'CurrentUser'}); +$ACL->LimitToQueue($QueueObj->id); +$ACL->LimitPrincipalToUser($PrincipalId); +</%INIT> +<%ARGS> +$PrincipalId => undef +$QueueObj => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/QueueTabs b/rt/webrt/Admin/Elements/QueueTabs new file mode 100755 index 000000000..b7da7e007 --- /dev/null +++ b/rt/webrt/Admin/Elements/QueueTabs @@ -0,0 +1,36 @@ +<& /Admin/Elements/Tabs, subtabs => $subtabs, current_tab => 'Admin/Queues/' &> +<hr> +<%INIT> + my $subtabs = { + A => { title => 'Basics', + path => "Admin/Queues/Modify.html?id=".$id, + }, + B => { title => 'Watchers', + path => "Admin/Queues/People.html?id=".$id, + }, + + C => { title => 'Scrips', + path => "Admin/Queues/Scrips.html?id=".$id, + }, + D => { title => 'Templates', + path => "Admin/Queues/Templates.html?id=".$id, + }, + E => { title => 'Keyword Selections', + path => "Admin/Queues/Keywords.html?id=".$id, + }, + F => { title => 'Group Rights', + path => "Admin/Queues/GroupRights.html?id=".$id, + }, + G => { title => 'User Rights', + path => "Admin/Queues/UserRights.html?id=".$id, + }, + + + +}; +</%INIT> + + +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/SelectKeywordSelect b/rt/webrt/Admin/Elements/SelectKeywordSelect new file mode 100644 index 000000000..f5a8d77cd --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectKeywordSelect @@ -0,0 +1,22 @@ +<input size=10 name="<%$NamePrefix%>-Name" value="<% $KeywordSelect->Name %>">: +<& /Admin/Elements/SelectSingleOrMultiple, + Name => $NamePrefix.'-Single', + Default => $KeywordSelect->Single &> + +children of +<& /Elements/SelectKeyword, Root => '0', + Name => $NamePrefix.'-Keyword', + Default => $KeywordSelect->KeywordObj->Id &> + up to <input name="<%$NamePrefix%>-Depth" size=2 value="<%$KeywordSelect->Depth%>"> levels deep. +<%INIT> +unless ($NamePrefix) { + $NamePrefix = $KeywordSelect->Id; +} +$NamePrefix = "KeywordSelect-$NamePrefix"; + +</%INIT> + +<%ARGS> +$KeywordSelect => undef +$NamePrefix => undef +</%ARGS>
\ No newline at end of file diff --git a/rt/webrt/Admin/Elements/SelectModifyGroup b/rt/webrt/Admin/Elements/SelectModifyGroup new file mode 100644 index 000000000..45d437f41 --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectModifyGroup @@ -0,0 +1,10 @@ +%while ( $Group = $Groups->Next) { +<A HREF="Modify.html?id=<%$Group->id%>"><%$Group->id%>: <%$Group->Name%></a><BR> +%} +<%INIT> +my ($Group); +my $Groups = new RT::Groups($session{'CurrentUser'}); +$Groups->UnLimit; +</%INIT> +<%ARGS> +</%ARGS> diff --git a/rt/webrt/Admin/Elements/SelectModifyKeyword b/rt/webrt/Admin/Elements/SelectModifyKeyword new file mode 100644 index 000000000..6af223229 --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectModifyKeyword @@ -0,0 +1,13 @@ +%while ( $keyword = $keywords->Next ) { +<A HREF="/Admin/Keywords/Modify.html?id=<%$keyword->id%>"><%$keyword->id%>: <%$keyword->Name%></a><BR> +%} + +<%INIT> + +use RT::Keywords; + +my $keyword; +my $keywords = new RT::Keywords $session{CurrentUser}; +$keywords->UnLimit; +</%INIT> + diff --git a/rt/webrt/Admin/Elements/SelectModifyKeywordSelect b/rt/webrt/Admin/Elements/SelectModifyKeywordSelect new file mode 100644 index 000000000..c91eb6cfe --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectModifyKeywordSelect @@ -0,0 +1,13 @@ +%while ( $keywordselect = $keywordselects->Next ) { +<A HREF="/Admin/KeywordSelects/Modify.html?id=<%$keywordselect->id%>"><%$keywordselect->id%>: ( <%$keywordselect->Parent%>: <%$keywordselect->KeywordObj->Name%> )</a><BR> +%} + +<%INIT> + +use RT::KeywordSelects; + +my $keywordselect; +my $keywordselects = new RT::KeywordSelects $session{CurrentUser}; +$keywordselects->UnLimit; +</%INIT> + diff --git a/rt/webrt/Admin/Elements/SelectModifyQueue b/rt/webrt/Admin/Elements/SelectModifyQueue new file mode 100755 index 000000000..1c6cd7d5e --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectModifyQueue @@ -0,0 +1,10 @@ +%while ( $queue = $queues->Next) { +<A HREF="Modify.html?id=<%$queue->id%>"><%$queue->id%>: <%$queue->Name%></a><BR> +%} +<%INIT> +my ($queue); +my $queues = new RT::Queues($session{'CurrentUser'}); +$queues->UnLimit; +</%INIT> +<%ARGS> +</%ARGS> diff --git a/rt/webrt/Admin/Elements/SelectModifyUser b/rt/webrt/Admin/Elements/SelectModifyUser new file mode 100755 index 000000000..da49212e4 --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectModifyUser @@ -0,0 +1,26 @@ +%while ( $user = $users->Next) { +<A HREF="Modify.html?id=<%$user->id%>"><%$user->id%>: <%$user->Name%></a><BR> +%} +<%INIT> +my ($user); +my $users = new RT::Users($session{'CurrentUser'}); +$users->Limit(FIELD => 'id', + VALUE => $RT::SystemUser->id, + OPERATOR => '!=' ); + +if (defined $IdLike) { +$users->Limit(FIELD => 'Name', + VALUE => $IdLike, + OPERATOR => 'LIKE' ); +} +if (defined $EmailLike) { +$users->Limit(FIELD => 'EmailAddress', + VALUE => $EmailLike, + OPERATOR => 'LIKE'); + +} +</%INIT> +<%ARGS> +$IdLike => undef +$EmailLike => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/SelectQueueRights b/rt/webrt/Admin/Elements/SelectQueueRights new file mode 100755 index 000000000..6861d40c6 --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectQueueRights @@ -0,0 +1,29 @@ +%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/Admin/Elements/Attic/SelectQueueRights,v 1.1 2002-08-12 06:17:08 ivan Exp $ + +<SELECT NAME ="<%$Name%>"> +<OPTION VALUE="">-</OPTION> +%foreach $right (@rights) { +<OPTION VALUE="<%$right%>" <%($Default eq $right) && 'SELECTED'%>><%$right%></OPTION> +% } +</SELECT> +<%ONCE> + +use RT::ACE; +my $ACE = new RT::ACE($session{'CurrentUser'}); +my %QueueRights = $ACE->QueueRights; +my %TicketRights = $ACE->TicketRights; + +my ($key, $right, @rights); + +foreach $key (sort keys %QueueRights) { +push (@rights, $QueueRights{$key} . " ($key)"); +} +foreach $key (sort keys %TicketRights) { +push (@rights, $TicketRights{$key} . " ($key)"); +} +</%ONCE> +<%ARGS> +$Name => undef +$Default => undef + +</%ARGS> diff --git a/rt/webrt/Admin/Elements/SelectRights b/rt/webrt/Admin/Elements/SelectRights new file mode 100644 index 000000000..0ac774985 --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectRights @@ -0,0 +1,58 @@ +<INPUT TYPE=HIDDEN NAME="CheckACL" VALUE="<%$ACLDesc%>"> + <TABLE BORDER=0> +<TR> +<TD valign=top> +<h3>New rights</h3> +<SELECT SIZE=5 MULTIPLE NAME="GrantACE-<%$ACLDesc%>"> +% foreach $right (sort keys %Rights) { + <OPTION VALUE="<%$right%>" + ><%$right%></OPTION> +% } +<OPTION VALUE="" SELECTED>(no value)</OPTION> +</SELECT> +</TD> +<TD valign=top> +<h3>Current rights</h3> +<i>(Check box to revoke right)</i> <BR> +% while (my $right = $ACLObj->Next()) { +% if ($right->RightName) { +<input type=checkbox value="<%$right->Id%>" name="RevokeACE"> <%$right->RightName%><br> +% } +% } +</TD> +</TR> +</TABLE> +<%INIT> + my ($right, $ACLDesc, $AppliesTo, %Rights); + + + my $ACLObj = new RT::ACL($session{'CurrentUser'}); + my $ACE = new RT::ACE($session{'CurrentUser'}); + + if ($Scope eq 'Queue') { + $AppliesTo = $QueueObj->Id; + $ACLObj->LimitToQueue($AppliesTo); + %Rights = $ACE->QueueRights(); + } + elsif ($Scope eq 'System') { + $AppliesTo = 0; + $ACLObj->LimitToSystem(); + %Rights = ( $ACE->SystemRights , $ACE->QueueRights()); + } + + if ($PrincipalType eq 'Group') { + $ACLObj->LimitPrincipalToGroup($PrincipalObj->Id); + } + elsif ($PrincipalType eq 'User') { + $ACLObj->LimitPrincipalToUser($PrincipalObj->Id); + } + + $ACLDesc = "$PrincipalType-".$PrincipalObj->Id."-$Scope-$AppliesTo"; +</%INIT> + +<%ARGS> +$PrincipalType => undef +$PrincipalObj => undef +$Scope => undef +$QueueObj => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/SelectScrip b/rt/webrt/Admin/Elements/SelectScrip new file mode 100755 index 000000000..4ae15d8c3 --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectScrip @@ -0,0 +1,25 @@ +<SELECT NAME=<%$Name%>> +<OPTION VALUE="" +<% $Default eq undef && 'SELECTED' %> +>-</OPTION> +%while (my $Scrip = $Scrips->Next) { +<OPTION VALUE=<%$Scrip->Id%> +<% $Scrip->Id == $Default && 'SELECTED' %> +><%$Scrip->Name%> +</OPTION> +%} +</SELECT> + +<%INIT> +my $Scrips = RT::Scrips->new($session{'CurrentUser'}); +$Scrips->UnLimit; + + + +</%INIT> +<%ARGS> + +$Default => undef +$Name => 'Scrip' + +</%ARGS> diff --git a/rt/webrt/Admin/Elements/SelectScripAction b/rt/webrt/Admin/Elements/SelectScripAction new file mode 100644 index 000000000..08a173493 --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectScripAction @@ -0,0 +1,25 @@ +<SELECT NAME=<%$Name%>> +<OPTION VALUE="" +<% $Default eq undef && 'SELECTED' %> +>-</OPTION> +%while (my $ScripAction = $ScripActions->Next) { +<OPTION VALUE=<%$ScripAction->Id%> +<% $ScripAction->Id == $Default && 'SELECTED' %> +><%$ScripAction->Name%> +</OPTION> +%} +</SELECT> + +<%INIT> +my $ScripActions = RT::ScripActions->new($session{'CurrentUser'}); +$ScripActions->UnLimit; + + + +</%INIT> +<%ARGS> + +$Default => undef +$Name => 'ScripAction' + +</%ARGS> diff --git a/rt/webrt/Admin/Elements/SelectScripCondition b/rt/webrt/Admin/Elements/SelectScripCondition new file mode 100644 index 000000000..434f0c4ae --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectScripCondition @@ -0,0 +1,25 @@ +<SELECT NAME=<%$Name%>> +<OPTION VALUE="" +<% $Default eq undef && 'SELECTED' %> +>-</OPTION> +%while (my $ScripCondition = $ScripConditions->Next) { +<OPTION VALUE=<%$ScripCondition->Id%> +<% $ScripCondition->Id == $Default && 'SELECTED' %> +><%$ScripCondition->Name%> +</OPTION> +%} +</SELECT> + +<%INIT> +my $ScripConditions = RT::ScripConditions->new($session{'CurrentUser'}); +$ScripConditions->UnLimit; + + + +</%INIT> +<%ARGS> + +$Default => undef +$Name => 'ScripCondition' + +</%ARGS> diff --git a/rt/webrt/Admin/Elements/SelectSingleOrMultiple b/rt/webrt/Admin/Elements/SelectSingleOrMultiple new file mode 100644 index 000000000..307b0211c --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectSingleOrMultiple @@ -0,0 +1,20 @@ + <select name="<%$Name%>"> + <option value="1" <%$SingleDefault%>>Single</option> + <option value="0" <%$MultipleDefault%>>Multiple</option> + </select> + + +<%INIT> +my ($SingleDefault, $MultipleDefault); +if ($Default == 1) { + $SingleDefault = "SELECTED"; +} +elsif ($Default == 0 ) { + $MultipleDefault = "SELECTED"; +} + +</%INIT> +<%ARGS> +$Name => 'Single' +$Default => 1 +</%ARGS> diff --git a/rt/webrt/Admin/Elements/SelectTemplate b/rt/webrt/Admin/Elements/SelectTemplate new file mode 100755 index 000000000..76550dc4e --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectTemplate @@ -0,0 +1,37 @@ +<SELECT NAME=<%$Name%>> +<OPTION VALUE="" +<% $Default eq 'none' && 'SELECTED' %> +>-</OPTION> +%while (my $Template = $PrimaryTemplates->Next) { +<OPTION VALUE=<%$Template->Id%> +<% ($Template->Id == $Default) && 'SELECTED' %> +><%$Template->Name%> +</OPTION> +%} +%while (my $Template = $OtherTemplates->Next) { +<OPTION VALUE=<%$Template->Id%> +<% ($Template->Id == $Default) && 'SELECTED'%> +>Global template: <%$Template->Name%> +</OPTION> +%} +</SELECT> + +<%INIT> + + +my $PrimaryTemplates = RT::Templates->new($session{'CurrentUser'}); +if ($DefaultQueue != 0) { +$PrimaryTemplates->LimitToQueue($DefaultQueue); +} + +my $OtherTemplates = RT::Templates->new($session{'CurrentUser'}); +$OtherTemplates->LimitToGlobal($DefaultQueue); + +</%INIT> +<%ARGS> + +$Default => 'none' +$DefaultQueue => undef +$Name => 'Template' + +</%ARGS> diff --git a/rt/webrt/Admin/Elements/SelectUsers b/rt/webrt/Admin/Elements/SelectUsers new file mode 100644 index 000000000..af51c60f9 --- /dev/null +++ b/rt/webrt/Admin/Elements/SelectUsers @@ -0,0 +1,17 @@ +<SELECT MULTIPLE NAME="<%$Name%>" SIZE=10> +%while (my $user = $users->Next) { +<OPTION VALUE="<%$user->id%>"><%$user->Name%> +%} +</SELECT> + +<%INIT> +my $users = new RT::Users($session{'CurrentUser'}); + +$users->Limit(FIELD => 'id', VALUE => $RT::SystemUser->id, OPERATOR => '!=' ); +$users->Limit(FIELD => 'id', VALUE => $RT::Nobody->id, OPERATOR => '!=' ); +$users->LimitToPrivileged(); + +</%INIT> +<%ARGS> +$Name => 'Users' +</%ARGS> diff --git a/rt/webrt/Admin/Elements/SystemTabs b/rt/webrt/Admin/Elements/SystemTabs new file mode 100755 index 000000000..f8b23128b --- /dev/null +++ b/rt/webrt/Admin/Elements/SystemTabs @@ -0,0 +1,31 @@ +<& /Admin/Elements/Tabs, subtabs => $subtabs, current_tab => 'Admin/Global/', current_subtab => $current_subtab &> +<hr> +<%INIT> + my $subtabs = { + + A => { title => 'Scrips', + path => 'Admin/Global/Scrips.html', + }, + Ba => { title => 'Keyword Selections', + path => 'Admin/Global/Keywords.html', + }, + + B => { title => 'Templates', + path => 'Admin/Global/Templates.html', + }, + C => { title => 'Group Rights', + path => 'Admin/Global/GroupRights.html', + }, + D => { title => 'User Rights', + path => 'Admin/Global/UserRights.html', + } + + +}; +</%INIT> + + +<%ARGS> +$id => undef +$current_subtab => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/Tabs b/rt/webrt/Admin/Elements/Tabs new file mode 100755 index 000000000..ee6d82b58 --- /dev/null +++ b/rt/webrt/Admin/Elements/Tabs @@ -0,0 +1,31 @@ +<& /Elements/Tabs, tabs => $tabs, subtabs => $subtabs, current_toptab => 'Admin/', current_tab => $current_tab, current_subtab => $current_subtab&> + +<hr> + +<%INIT> + my $tabs = { Users => { title => 'Users', + path => 'Admin/Users/', + }, + Groups => { title => 'Groups', + path => 'Admin/Groups/', + }, + Queues => { title => 'Queues', + path => 'Admin/Queues/', + }, + System => { 'title' => 'Global', + path => 'Admin/Global/', + }, + Keywords => { title => 'Keywords', + path => 'Admin/Keywords/', + }, + + + }; +</%INIT> + + +<%ARGS> +$subtabs => undef +$current_tab => undef +$current_subtab => undef +</%ARGS> diff --git a/rt/webrt/Admin/Elements/UserTabs b/rt/webrt/Admin/Elements/UserTabs new file mode 100755 index 000000000..bbf17314d --- /dev/null +++ b/rt/webrt/Admin/Elements/UserTabs @@ -0,0 +1,21 @@ +<& /Admin/Elements/Tabs, subtabs => $subtabs, + current_tab => 'Admin/Users/', + current_subtab => $current_subtab &> +<hr> +<%INIT> +my $subtabs = { + Queues => { title => 'Basics', + path => "Admin/Users/Modify.html?id=".$id + }, +# Scrips => { title => 'Rights', +# path => "Admin/Users/Rights.html?id=".$id +# } + + }; +</%INIT> + + +<%ARGS> +$id => undef +$current_subtab => undef +</%ARGS> 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 &> 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> diff --git a/rt/webrt/Admin/KeywordSelects/Modify.html b/rt/webrt/Admin/KeywordSelects/Modify.html new file mode 100644 index 000000000..e753c6622 --- /dev/null +++ b/rt/webrt/Admin/KeywordSelects/Modify.html @@ -0,0 +1,17 @@ +<& /Admin/Elements/Header, Title => 'Admin KeywordSelects' &> +<& /Admin/Elements/Tabs &> + +<& /Admin/Elements/ModifyKeywordSelect, Create=>$Create, id=>$id, Parent=>$Parent, ObjectType=>$ObjectType, ObjectField=>$ObjectField, ObjectValue=>$ObjectValue, Single=>$Single, SingleMagic=>$SingleMagic, Generations=>$Generations &> + +<%ARGS> +$Create => undef +$id => undef +$Parent => undef +$ObjectType => undef +$ObjectField => undef +$ObjectValue => undef +$Single => undef +$SingleMagic => undef +$Generations => undef +</%ARGS> + diff --git a/rt/webrt/Admin/KeywordSelects/index.html b/rt/webrt/Admin/KeywordSelects/index.html new file mode 100644 index 000000000..ba3da9f0c --- /dev/null +++ b/rt/webrt/Admin/KeywordSelects/index.html @@ -0,0 +1,137 @@ +<& /Admin/Elements/Header, Title => 'Admin KeywordSelects' &> +<& /Admin/Elements/Tabs, current_tab => 'Admin/KeywordSelects/' &> + +A <B>KeywordSelect</B> is a link between a <B>Keyword</B> and a object +(currently just <B>Tickets</B>), titled by the <I>Name</I> field of the Keyword such that: +<ul> +<li>Object display will contain a field, titled with the <I>Name</I> field of +the <B>Keyword</B> and showing any descendent keywords. +<li>Object creation for this field will contain a field, titled with the +<I>Name</I> field of the <B>Keyword</B> and containing the descendents of +the <B>Keyword</B> as choices. +<li>Searches for this object type will contain a selection field titled with +the <I>Name</I> field of the <B>Keyword</B> and containing the descendents +of the <B>Keyword</B> as choices. +<TABLE WIDTH=100%> + + + + <TD VALIGN=TOP> + <h2>Create KeywordSelect</h2> + <FORM NAME="ModifyKeywordSelect" METHOD="POST" ACTION="<%$RT::WebPath%>/Admin/KeywordSelects/Modify.html"> + [<%$title |n %>] + <BR> + + <INPUT TYPE="hidden" NAME="id" VALUE="<% $id %>"> + Keyword + <SELECT NAME="Parent"> + +%while ( $parent = $parents->Next ) { + + <OPTION VALUE="<% $parent->id %>" <% defined($KeywordSelect->Parent) && $parent->id == $KeywordSelect->Parent ? ' SELECTED' : '' %>><% $parent->Name %></OPTION> + +% } + + </SELECT> + <BR> + Object + <SELECT NAME="ObjectType"> + <OPTION SELECTED>Ticket</OPTION> + </SELECT> + <BR> + +%foreach $queue ( keys %queues ) { + addOption("<% $queues{$queue} %>", "<% $queue %>", false, <% $queue == $KeywordSelect->ObjectValue ? 'true' : 'false' %> ) +%} + } +} +</SCRIPT> + + Limit to <SELECT NAME="ObjectField" onChange="ChangeObjectValue(this)"> + <OPTION VALUE="" <% $KeywordSelect->ObjectField ? '' : ' SELECTED' %>>(none)</OPTION> + <OPTION VALUE="Queue" <% $KeywordSelect->ObjectField eq 'Queue' ? ' SELECTED' : '' %>>Queue</OPTION> + </SELECT> + <SELECT NAME="ObjectValue"> + <OPTION VALUE="<% $KeywordSelect->ObjectValue %>"> + <% $KeywordSelect->ObjectField ? $queues{$KeywordSelect->ObjectValue} : "(n/a)" %></OPTION> + </SELECT><BR> + <INPUT TYPE="hidden" NAME="SingleMagic" VALUE="1"> + <INPUT TYPE="checkbox" NAME="Single" VALUE="1" <% $KeywordSelect->Single ? ' CHECKED' : '' %>>Allow single selection only<BR> + Limit to <INPUT TYPE="text" NAME="Generations" SIZE="2" VALUE="<% $KeywordSelect->Generations %>"> generations (0 = no limit)<BR> + <& /Elements/Submit, Label => $submit &> + +</FORM> + +<%INIT> + + +my $KeywordSelect = new RT::KeywordSelect($session{CurrentUser}); + +my($title, $submit); + +if ( $Create ) { + $title = "Create a new KeywordSelect"; + $submit = "Create"; + $id = "new"; +} else { + if ( $id eq 'new' ) { + $id = $KeywordSelect->Create ( + Parent => $Parent, + ObjectType => $ObjectType, + ObjectField => $ObjectField, + ObjectValue => $ObjectValue, + Single => $Single, + Generations => $Generations, + ) or Abort "can't create KeywordSelect"; + } else { + $KeywordSelect->Load($id) || Abort("Can't load keyword id $id"); + #false laziness + $KeywordSelect->SetParent($Parent) if defined($Parent); + $KeywordSelect->SetObjectType($ObjectType) if defined($ObjectType); + $KeywordSelect->SetObjectField($ObjectField) if defined($ObjectField); + $KeywordSelect->SetObjectValue($ObjectValue) if defined($ObjectValue); + $KeywordSelect->SetSingle($Single) if defined($SingleMagic); + $KeywordSelect->SetGenerations($Generations) if defined($Generations); + } + $title = "Modify the KeywordSelect <B>". $KeywordSelect->KeywordObj->Name. "</B>"; + $submit = "Modify"; + +} + + my $parents = new RT::Keywords($session{CurrentUser}); + $parents->UnLimit; + my $parent; + +my $queues = new RT::Queues($session{CurrentUser}); +$queues->UnLimit; + +my %queues; +my $queue; +$queues{$queue->id} = $queue->Name while $queue = $queues->Next; + +</%INIT> + +<%ARGS> +$id => undef +$Create => undef +$Parent => undef +$ObjectType => undef +$ObjectField => undef +$ObjectValue => undef +$Single => undef +$SingleMagic => undef +$Generations => undef +</%ARGS> + + + <& /Admin/Elements/ModifyKeywordSelect, 'Create'=>'1' &> + </TD> + + <TD VALIGN=TOP> + <H2>Modify KeywordSelect</H2> + + <& /Admin/Elements/SelectModifyKeywordSelect &> + </TD> +</TR> + +</TABLE> diff --git a/rt/webrt/Admin/Keywords/Modify.html b/rt/webrt/Admin/Keywords/Modify.html new file mode 100644 index 000000000..bb7e2db8c --- /dev/null +++ b/rt/webrt/Admin/Keywords/Modify.html @@ -0,0 +1,96 @@ +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/Tabs &> + + +<& /Elements/TitleBoxStart, title => %$title &> +<FORM METHOD="POST" ACTION="<%$RT::WebPath%>/Admin/Keywords/Modify.html"> +<INPUT TYPE="hidden" NAME="id" VALUE="<% $id %>"> +Keyword <INPUT NAME="Name" VALUE="<% $Keyword->Name %>"><BR> + +Parent <SELECT NAME="Parent"> + <OPTION VALUE=""<% defined($Keyword->Parent) ? '' : ' SELECTED' %>>-</OPTION> +%while ( $parent = $parents->Next ) { + <OPTION VALUE="<% $parent->id %>"<% defined($Keyword->Parent) && $parent->id == $Keyword->Parent ? ' SELECTED' : '' %>><% $parent->Name %></OPTION> +%} +</SELECT> + + +New children of this keyword. one per line. +<TEXTAREA NAME="Kids" ROWS=4><% $kidstring %></TEXTAREA> +<BR> + +<& /Elements/Submit, Label => $submit &> +</FORM> +<& /Elements/TitleBoxEnd &> + +<%INIT> + +my $Keyword = new RT::Keyword($session{CurrentUser}); +my ($title, $submit, %kids, $kid); + +if ( $Create ) { + $title = "Create a new Keyword"; + $submit = "Create"; + $id = "new"; + %kids = (); + $Parent = ''; #silence +} +else { + if ( $id eq 'new' ) { + $id = $Keyword->Create( Name => $Name, Parent => $Parent ) + or Abort("can't create keyword Name=>$Name, Parent=>$Parent"); + } else { + $Keyword->Load($id) || Abort("Can't load keyword id $id"); + + #foreach my $field ( grep eval "defined(\$$_)", qw( Name Parent )) { + # eval "\$Keyword->Set(\$field=>\$$field); #sigh + #} + + $Keyword->SetName($Name) if defined($Name); + $Keyword->SetParent($Parent) if defined($Parent); + } + + $title = "Modify the Keyword <B>". $Keyword->Name. "</B>"; + $submit = "Modify"; +} + + +my $kids = $Keyword->Children(new RT::Keywords($session{CurrentUser})); + +$kids{$kid->Name} = $kid while $kid = $kids->Next; + +if ( defined($Kids) ) { + my %newkids; + + %newkids = map { $_=>1 } split(/\r/, $Kids); + + } + foreach ( grep { ! defined($newkids{$_}) } keys %kids ) { + $kids{$_}->Delete; + delete $kids{$_}; + } + foreach ( grep { ! defined($kids{$_}) } keys %newkids ) { + $kids{$_} = new RT::Keyword($session{CurrentUser}); + $kids{$_}->Create( Name => $_, Parent => $id ) + or Abort("can't create keyword Name=>$_, Parent=>$id"); + } + +} + + +my $parent; +my $parents = new RT::Keywords($session{CurrentUser}); +$parents->UnLimit; + +my $kidstring = join("\r", keys %kids); + +</%INIT> + +<%ARGS> +$id => undef +$Create => undef +$Name => undef +$Parent => undef +$Kids => undef + +</%ARGS> diff --git a/rt/webrt/Admin/Keywords/index.html b/rt/webrt/Admin/Keywords/index.html new file mode 100644 index 000000000..12814ec03 --- /dev/null +++ b/rt/webrt/Admin/Keywords/index.html @@ -0,0 +1,110 @@ +<& /Elements/Header, Title => 'Admin/Keywords' &> +<& /Admin/Elements/Tabs, current_tab => 'Admin/Keywords/' &> + +<& /Elements/ListActions, actions => \@Actions &> + +<& /Elements/TitleBoxStart, title => 'Keywords' &> +<a href="<%$RT::WebPath%>/Admin/Keywords/?RootId=<%$Root->Parent%>"><%$Root->Path%></a> +<UL> +<FORM METHOD=POST ACTION="index.html"> +<input type=hidden name=RootId value="<%$RootId%>"> + + +% while (my $key = $Keywords->Next) { + <LI> +% if ($Edit == $key->id) { + <input name="KeyName-<%$key->id%>" value="<%$key->Name%>"> + <input type=submit value="Update"> + <input type=submit name="Disable-<%$key->id%>" value="Disable"> +% } else { + <A HREF="?RootId=<%$key->id%>"><%$key->Name%></A> +% if ($key->Disabled) { + <input type=submit name="Enable-<%$key->id%>" value="Enable"> +% } else { + [<a href="?Edit=<%$key->id%>&RootId=<%$Root->Id%>">edit</a>] +% } +% } + + + </LI> +% } + <LI> + <input name="KeyName-New"> <input type=submit value="Add"> +</UL> +<BR> + <input type="checkbox" name="ShowDisabled"> Include disabled items in listing. + <input type=submit value="Go!"> + +</FORM> + +<& /Elements/TitleBoxEnd &> +<%INIT> +my (@Actions); + +if ($ARGS{'KeyName-New'}) { + my $NewKey = new RT::Keyword($session{'CurrentUser'}); + my ($val, $msg) = $NewKey->Create( Parent => $RootId, Name => $ARGS{'KeyName-New'}); + push (@Actions, $msg); +} + +my $arg; +foreach $arg (keys %ARGS) { + if ($arg =~ /^Disable-(\d*)$/) { + my $id = $1; + my $keyword = new RT::Keyword($session{'CurrentUser'}); + $keyword->Load($id); + my ($val, $msg) = $keyword->SetDisabled(1); + push (@Actions, $msg); + + + } + elsif ($arg =~ /^Enable-(\d*)$/) { + my $id = $1; + my $keyword = new RT::Keyword($session{'CurrentUser'}); + $keyword->Load($id); + my ($val, $msg) = $keyword->SetDisabled(0); + push (@Actions, $msg); + } + elsif ($arg =~ /^KeyName-(\d*)$/) { + my $id = $1; + my $keyword = new RT::Keyword ($session{'CurrentUser'}); + $keyword->Load($id); + if ($keyword->Name() ne $ARGS{"$arg"}) { + my ($val, $msg) = $keyword->SetName($ARGS{"$arg"}); + push (@Actions, $msg); + } + if (($ARGS{"KeyParent-$id"}) && + ($keyword->Parent ne $ARGS{"KeyParent-$id"})) { + my ($val, $msg) = $keyword->SetParent($ARGS{"KeyParent-$id"}); + push (@Actions, $msg); + } + } +} + + +my $Root = new RT::Keyword($session{'CurrentUser'}); +my $Keywords; +#If we have a root load it. +if ($RootId != 0) { + $Root->Load($RootId); + $Keywords = $Root->Children(); + +} +else { + $Keywords = new RT::Keywords($session{'CurrentUser'}); + $Keywords->LimitToParent(0); +} + +if ($ShowDisabled) { + $Keywords->{'find_disabled_rows'} = 1; +} + + + + +</%INIT> +<%ARGS> +$RootId => 0 +$Edit => undef +$ShowDisabled => 0 +</%ARGS> diff --git a/rt/webrt/Admin/Queues/Create.html b/rt/webrt/Admin/Queues/Create.html new file mode 100755 index 000000000..b39d6590c --- /dev/null +++ b/rt/webrt/Admin/Queues/Create.html @@ -0,0 +1,13 @@ +<& /Admin/Elements/Header, Title => 'Create a queue' &> + <h1>Create a queue</h1> + +<& /Admin/Elements/ModifyQueue, QueueObj => $QueueObj &> + +<%INIT> +my $QueueObj = new RT::Queue($session{'CurrentUser'}); +$QueueObj->Create(Name => "$Name"); +</%INIT> + +<%ARGS> +$Name => undef +</%ARGS> diff --git a/rt/webrt/Admin/Queues/GroupRights.html b/rt/webrt/Admin/Queues/GroupRights.html new file mode 100755 index 000000000..a2c669083 --- /dev/null +++ b/rt/webrt/Admin/Queues/GroupRights.html @@ -0,0 +1,103 @@ +<& /Admin/Elements/Header, Title => 'Modify group rights for queue '. $QueueObj->Name &> +<& /Admin/Elements/QueueTabs, id => $id &> +<& /Elements/ListActions, actions => \@results &> + + <FORM METHOD=POST ACTION="GroupRights.html"> + <INPUT TYPE=HIDDEN NAME=id VALUE="<% $QueueObj->id %>"> + + + +<& /Elements/TitleBoxStart, title => 'Modify group rights for queue '.$QueueObj->Name &> + +<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', + QueueObj => $QueueObj, + Scope => 'Queue' &> + + </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', + QueueObj => $QueueObj, + Scope => 'Queue' &> + + </TD> + </TR> + +% } + + </TABLE> + + <& /Elements/TitleBoxEnd &> + <& /Elements/Submit, Caption => "Be sure to save your changes", Reset => 1 &> + </FORM> + +<%INIT> + +#Update the acls. +my @results = ProcessACLChanges(\@CheckACL, \%ARGS); + +# {{{ Deal with setting up the display of current rights. + +# {{{ do basic initialization. + +#Define vars used in html above +my ($GroupObj); + +my ($right); + + +if (!defined $id) { + Abort("No Queue defined"); +} + +my $QueueObj = new RT::Queue($session{'CurrentUser'}); +$QueueObj->Load($id) || + Abort("Couldn't load queue $id"); + + # 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> +$id => undef +$UserString => undef +$UserOp => undef +$UserField => undef +@CheckACL => undef +</%ARGS> diff --git a/rt/webrt/Admin/Queues/Keywords.html b/rt/webrt/Admin/Queues/Keywords.html new file mode 100644 index 000000000..7809805c5 --- /dev/null +++ b/rt/webrt/Admin/Queues/Keywords.html @@ -0,0 +1,114 @@ +<& /Admin/Elements/Header, Title => 'Edit keywords' &> +<& /Admin/Elements/QueueTabs, id => $QueueObj->Id &> + +<& /Elements/ListActions, actions => \@actions &> + +<& /Elements/TitleBoxStart, title => $description &> + +<h2>Global Keyword Selections</h2> +<& /Admin/Elements/ListGlobalKeywordSelects &> +<BR> + + <FORM METHOD=POST ACTION="Keywords.html"> + <INPUT TYPE=HIDDEN NAME=id VALUE="<%$id%>"> + +% if ($KeywordSelects->Count > 0 ) { + + +<h2>Queue Keyword Selections</h2> +<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 keyword selection to this queue: +%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 $KeywordSelects = new RT::KeywordSelects ($session{'CurrentUser'}); +unless ($id =~ /^\d+$/) { + Abort("$id isn't a valid Queue id."); +} + +unless ($KeywordSelects->LimitToQueue($id)) { + Abort("Couldn't load KeywordSelects."); +} + +my $QueueObj = new RT::Queue($session{'CurrentUser'}); +$QueueObj->Load($id); + +my $description = "Modify Keyword selections for queue '". $QueueObj->Name ."'"; + + + +# {{{ 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 => $QueueObj->Id, + 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> +$id => undef #some identifier that a Queue could + +</%ARGS> diff --git a/rt/webrt/Admin/Queues/Modify.html b/rt/webrt/Admin/Queues/Modify.html new file mode 100755 index 000000000..7a200df92 --- /dev/null +++ b/rt/webrt/Admin/Queues/Modify.html @@ -0,0 +1,137 @@ +<& /Admin/Elements/Header, Title => 'Admin/Queue/Basics' &> +<& /Admin/Elements/QueueTabs, id => $QueueObj->id &> +<& /Elements/ListActions, actions => \@results &> + + + +<& /Elements/TitleBoxStart, title => $title &> + + +<FORM ACTION="<%$RT::WebPath%>/Admin/Queues/Modify.html" METHOD=POST> +%if ($Create ) { +<INPUT TYPE=HIDDEN NAME=id VALUE="new"> +% } else { +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$QueueObj->Id%>"> +% } + +<TABLE> +<TR><TD ALIGN=RIGHT> +Queue Name: +</TD> +<TD><INPUT name="Name" value="<%$QueueObj->Name%>"></TD> +</TR><TR> +<TD ALIGN=RIGHT> +Description:</TD><TD COLSPAN=3><INPUT name="Description" value="<%$QueueObj->Description%>" size=60></TD></TR> +<TR> +<TD ALIGN=RIGHT> +Correspondence Address: +</TD><TD> +<INPUT name="CorrespondAddress" value="<%$QueueObj->CorrespondAddress%>"> +<BR><font size="-1"><i>(If left blank, will default to <%$RT::CorrespondAddress%></i></font> +</TD> +<TD ALIGN=RIGHT> + +Comment Address: </TD><TD> +<INPUT NAME="CommentAddress" value="<%$QueueObj->CommentAddress%>"> +<BR><font size="-1"><i>(If left blank, will default to <%$RT::CommentAddress%></i></font> +</TD> +</TR><TR> + +<TD ALIGN=RIGHT> +Priority starts at: +</TD><TD><INPUT NAME="InitialPriority" value="<%$QueueObj->InitialPriority %>"> +</TD> +<TD ALIGN=RIGHT> +Over time, priority moves toward: +</TD><TD><INPUT NAME="FinalPriority" value="<%$QueueObj->FinalPriority %>"> +</TD> +</TR> +<TR> +<TD ALIGN=RIGHT> +Requests should be due in: +</TD><TD> +<INPUT NAME="DefaultDueIn" VALUE="<%$QueueObj->DefaultDueIn%>"> days. +</TD> +</TR> +<TR> +<TD> +</TD> +<TD COLSPAN=4><INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1"> +<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> Enabled (Unchecking this box disables this queue)<BR> +</TD> +</TR> + +</TABLE> +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit &> +</form> + + + +<%INIT> + +my $QueueObj = new RT::Queue($session{'CurrentUser'}); +my ($title, @results, $Disabled, $EnabledChecked); + +if ($Create) { + $title = "Create a queue"; +} + +else { + if ($id eq 'new') { + my ($val, $msg) = $QueueObj->Create(Name => $Name); + if ($val == 0 ) { + Abort("Could not create queue: $msg"); + } + else { + push @results, $msg; + } + } + else { + $QueueObj->Load($id) || $QueueObj->Load($Name) || Abort("Couldn't load queue '$Name'"); + } + $title = 'Editing Configuration for queue '.$QueueObj->Name; + +} +if ($QueueObj->Id()) { +my @attribs= qw(Description CorrespondAddress CommentAddress Name + InitialPriority FinalPriority DefaultDueIn); + + @results = UpdateRecordObject( AttributesRef => \@attribs, + Object => $QueueObj, + ARGSRef => \%ARGS); + +} + +#we're asking about enabled on the web page but really care about disabled. +if ($Enabled == 1) { + $Disabled = 0; +} +else { + $Disabled = 1; +} +if ( ($SetEnabled) and ( $Disabled != $QueueObj->Disabled) ) { + my ($code, $msg) = $QueueObj->SetDisabled($Disabled); + push @results, 'Enabled status '. $msg; +} + +unless ($QueueObj->Disabled()) { + $EnabledChecked ="CHECKED"; +} +</%INIT> + + +<%ARGS> +$id => undef +$result => undef +$Name => undef +$Create => undef +$Description => undef +$CorrespondAddress => undef +$CommentAddress => undef +$InitialPriority => undef +$FinalPriority => undef +$DefaultDueIn => undef +$SetEnabled => undef +$Enabled => undef +</%ARGS> diff --git a/rt/webrt/Admin/Queues/People.html b/rt/webrt/Admin/Queues/People.html new file mode 100755 index 000000000..b495400ed --- /dev/null +++ b/rt/webrt/Admin/Queues/People.html @@ -0,0 +1,161 @@ +<& /Elements/Header, Title => 'Modify people related to queue ' . $QueueObj->Name &> +<& /Admin/Elements/QueueTabs, id => $id &> + +<& /Elements/ListActions, actions => \@results &> + + +<FORM METHOD=POST ACTION="People.html"> +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$QueueObj->Id%>"> +<& /Elements/TitleBoxStart, title => 'Modify watchers for queue \''.$QueueObj->Name ."'", width => "100%" &> + +<TABLE WIDTH=100%> +<TR> +<TD VALIGN=TOP > + +<h3>Current watchers</h3> +<i>(Check box to delete)</i><br><BR> + + +Cc: + +<ul> + +%# Print out a placeholder if there are none. +%if ($cc->Count == 0 ) { +<li><i>none</i> +% } + +%while (my $watcher=$cc->Next) { +<li> +<INPUT TYPE=CHECKBOX NAME="DelWatcher<%$watcher->id%>" UNCHECKED> +%# account +%if ($watcher->IsUser) { +<a href="<%$RT::WebPath%>/Admin/Users/Modify.html?id=<%$watcher->OwnerObj->id%>"> +<%$watcher->OwnerObj->RealName%></a>: +%} else { +Email address: +%} +<i><%$watcher->Email%></i> +%} +</ul> + + +Administrative Cc: +<UL> +%# Print out a placeholder if there are none. +%if ($admincc->Count == 0 ) { +<li><i>none</i> +% } + +%while (my $watcher=$admincc->Next) { +<li><INPUT TYPE=CHECKBOX NAME="DelWatcher<%$watcher->id%>" UNCHECKED> +%# account +%if ($watcher->IsUser) { +<a href="<%$RT::WebPath%>/Admin/Users/Modify.html?id=<%$watcher->OwnerObj->id%>"> +<%$watcher->OwnerObj->RealName%></a>: +%} else { +Email address: +%} +<i><%$watcher->Email%></i> +%} +</UL> +</TD> + +<TD VALIGN=TOP> +<h3>New watchers</h3> +Find people whose<BR> +<& /Elements/SelectUsers &> + +<BR> +Add new watchers:<br> + +% if ($msg) { +<i><%$msg%></i> +% } elsif ($Users) { +<ul> +% while (my $u = $Users->Next ) { +<li><&/Elements/SelectWatcherType, Scope=>'queue', Name => "WatcherTypeUser".$u->Id &> <%$u->Name%> +(<%$u->RealName%>) +% } +</ul> +% } + +</TD> +</TR> +</TABLE> + + + + + +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit, Label => 'Save Changes', Caption => "If you've updated anything above, be sure to" &> +</form> + +<%INIT> + +my ($field, @results, $User, $Users, $watcher, $key, $msg); +# {{{ Load the queue +#If we get handed two ids, mason will make them an array. bleck. +# We want teh first one. Just because there's no other sensible way +# to deal + + + +my $QueueObj = new RT::Queue($session{'CurrentUser'}); +$QueueObj->Load($id) || Abort("Couldn't load queue '$id'"); +# }}} + +# {{{ Delete deletable watchers + +foreach $key (keys %ARGS) { + if (($key =~ /^DelWatcher(\d*)$/) and + ($ARGS{$key})) { + $RT::Logger->debug("Deleting watcher $1\n"); + my ($code, $msg) = $QueueObj->DeleteWatcher($1); + + push @results, $msg; + } +} +# }}} + +# {{{ Add new watchers +foreach $key (keys %ARGS) { + #They're in this order because otherwise $1 gets clobbered :/ + if ( ($ARGS{$key} =~ /^(AdminCc|Cc)$/) and + ($key =~ /^WatcherTypeUser(\d*)$/) ) { + $RT::Logger->debug("Adding a watcher $1 to ".$ARGS{$key}."\n"); + my ($code, $msg) = + $QueueObj->AddWatcher(Type => $ARGS{$key}, + Owner => $1); + push @results, $msg; + } +} + +# }}} + + + +my $admincc = $QueueObj->AdminCc; +my $cc = $QueueObj->Cc; + + +if (!$ARGS{'UserString'}) { +$msg = "No users selected."; + } +else { + $Users = new RT::Users($session{'CurrentUser'}); + $Users->Limit(FIELD => $ARGS{'UserField'}, + VALUE => $ARGS{'UserString'}, + OPERATOR => $ARGS{'UserOp'}); + } +</%INIT> + +<%ARGS> +$UserField => 'Name' +$UserOp => '=' +$UserString => undef +$Type => undef +$id => undef +</%ARGS> + diff --git a/rt/webrt/Admin/Queues/Scrips.html b/rt/webrt/Admin/Queues/Scrips.html new file mode 100755 index 000000000..95b8c4378 --- /dev/null +++ b/rt/webrt/Admin/Queues/Scrips.html @@ -0,0 +1,111 @@ +<& /Admin/Elements/Header, Title => 'Edit scrips' &> +<& /Admin/Elements/QueueTabs, id => $QueueObj->Id &> + +<& /Elements/ListActions, actions => \@actions &> + +<& /Elements/TitleBoxStart, title => $description &> + +<h2>Global Scrips</h2> +<& /Admin/Elements/ListGlobalScrips &> +<BR> + <FORM METHOD=POST ACTION="Scrips.html"> + <INPUT TYPE=HIDDEN NAME=id VALUE=<%$id%>> +<h2>Queue Scrips</h2> +% 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> +% } +<BR> +<h2>Add a scrip to this queue</h2> +Condition: <& /Admin/Elements/SelectScripCondition, Name => 'NewScripCondition' &> + Action: <& /Admin/Elements/SelectScripAction, Name => 'NewScripAction' &> + Template: <& /Admin/Elements/SelectTemplate, Name => 'NewScripTemplate', DefaultQueue => $id &> + +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit &> +</FORM> +<%init> +my (@actions, $description); + +my $Scrips = new RT::Scrips ($session{'CurrentUser'}); +unless ($id =~ /^\d+$/) { + Abort("$id isn't a valid Queue id."); +} + +unless ($Scrips->LimitToQueue($id)) { + Abort("Couldn't load Scrips."); + } + +my $QueueObj = new RT::Queue($session{'CurrentUser'}); +$QueueObj->Load($id); + +if ($QueueObj->id) { + $description = "Modify scrips for queue '". $QueueObj->Name ."'"; +} +else { + $description = "Modify global scrips"; +} + + +if ($NewScripAction and $NewScripCondition) { + my $NewScrip = new RT::Scrip($session{'CurrentUser'}); + + my ($retval, $msg) = $NewScrip->Create ( ScripAction => $NewScripAction, + ScripCondition => $NewScripCondition, + Stage => 'TransactionCreate', + Queue => $id, + 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 +$id => undef #some identifier that a Queue could +</%ARGS> diff --git a/rt/webrt/Admin/Queues/Template.html b/rt/webrt/Admin/Queues/Template.html new file mode 100755 index 000000000..61ee418a6 --- /dev/null +++ b/rt/webrt/Admin/Queues/Template.html @@ -0,0 +1,68 @@ +<& /Admin/Elements/Header, title => "Modify template ".$TemplateObj->id&> +<& /Admin/Elements/QueueTabs, id => $Queue &> +<& /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()) { + $Queue = $TemplateObj->Queue; + + 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/Queues/Templates.html b/rt/webrt/Admin/Queues/Templates.html new file mode 100755 index 000000000..218d41dc9 --- /dev/null +++ b/rt/webrt/Admin/Queues/Templates.html @@ -0,0 +1,24 @@ +<& /Admin/Elements/Header, Title => 'Edit templates for '.$Queue->Name &> +<& /Admin/Elements/QueueTabs, id => $Queue->id &> + +<& /Elements/TitleBoxStart, title => 'Edit templates for '.$Queue->Name &> +<UL> +<LI><A href="Template.html?create=1&Queue=<%$Queue->id%>">Create a new template</A><BR><BR> + +%while (my $TemplateObj = $Templates->Next) { + +<LI><A HREF="Template.html?Queue=<%$id%>&template=<%$TemplateObj->id()%>"><%$TemplateObj->id()%>/<%$TemplateObj->Name%>: <%$TemplateObj->Description%></a><BR> + +%} + +<& /Elements/TitleBoxEnd &> +<%INIT> + +my $Queue = new RT::Queue($session{'CurrentUser'}); +$Queue->Load($id); +my $Templates = $Queue->Templates; + +</%INIT> +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/webrt/Admin/Queues/UserRights.html b/rt/webrt/Admin/Queues/UserRights.html new file mode 100755 index 000000000..75d9cb282 --- /dev/null +++ b/rt/webrt/Admin/Queues/UserRights.html @@ -0,0 +1,72 @@ +<& /Admin/Elements/Header, Title => 'Modify user rights for queue '. $QueueObj->Name &> +<& /Admin/Elements/QueueTabs, id => $id &> +<& /Elements/ListActions, actions => \@results &> + + <FORM METHOD=POST ACTION="UserRights.html"> + <INPUT TYPE=HIDDEN NAME=id VALUE="<% $QueueObj->id %>"> + +<& /Elements/TitleBoxStart, title => 'Modify user rights for queue '.$QueueObj->Name &> + +<TABLE> + +% while (my $UserObj = $Users->Next()) { + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% $UserObj->Name %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalObj => $UserObj, + PrincipalType => 'User', + Scope => 'Queue', + QueueObj => $QueueObj &> + </TD> + </TR> +% } + </TABLE> + + <& /Elements/TitleBoxEnd &> + <& /Elements/Submit, Caption => "Be sure to save your changes", Reset => 1 &> + + </FORM> + +<%INIT> + + #Update the acls. + my @results = ProcessACLChanges(\@CheckACL, \%ARGS); + +# {{{ Deal with setting up the display of current rights. + +# {{{ do basic initialization. + +#Define vars used in html above +my ($GroupObj); + +my ($right); + + +if (!defined $id) { + Abort("No Queue defined"); +} + +my $QueueObj = new RT::Queue($session{'CurrentUser'}); +$QueueObj->Load($id) || + Abort("Couldn't load queue $id"); + +# Find out which users we want to display ACL selects for +my $Users = new RT::Users($session{'CurrentUser'}); +$Users->LimitToPrivileged(); + +# }}} + + +# }}} + +</%INIT> + +<%ARGS> +$id => undef +$UserString => undef +$UserOp => undef +$UserField => undef +@CheckACL => undef +</%ARGS> diff --git a/rt/webrt/Admin/Queues/index.html b/rt/webrt/Admin/Queues/index.html new file mode 100755 index 000000000..52dfb73c8 --- /dev/null +++ b/rt/webrt/Admin/Queues/index.html @@ -0,0 +1,52 @@ +<& /Admin/Elements/Header, Title => 'Admin queues' &> +<& /Admin/Elements/Tabs, current_tab => 'Admin/Queues/' &> + + +<& /Elements/TitleBoxStart, title => 'Select a queue' &> + +<TABLE> +<TR> +<TD VALIGN=TOP> + +<FORM METHOD=POST ACTION="<% $RT::WebPath %>/Admin/Queues/"> + +<input type="checkbox" name="FindDisabledQueues"> Include disabled queues in listing. +<BR> +<div align=right><input type=submit value="Go!"></div> +</FORM> +</TD> +<TD VALIGN=TOP> +<UL> +% if ($session{'CurrentUser'}->HasSystemRight('AdminQueue')) { +<LI><A HREF="<%$RT::WebPath%>/Admin/Queues/Modify.html?Create=1">Create a new queue</A><BR><BR></LI> +</UL> +% } + +<%$caption%><BR> +<UL> +%if ($queues->Count == 0) { +<LI> <i>No queues matching search criteria found.</i> +% } +%while ( $queue = $queues->Next) { +<LI><A HREF="Modify.html?id=<%$queue->id%>"><%$queue->Name%></a></LI> +%} + +</UL> +</TD> +</TR> +</TABLE> +<& /Elements/TitleBoxEnd &> + +<%INIT> +my ($queue, $caption); +my $queues = new RT::Queues($session{'CurrentUser'}); +$queues->UnLimit(); + +if ($FindDisabledQueues) { + $queues->{'find_disabled_rows'} = 1; +} + +</%INIT> +<%ARGS> +$FindDisabledQueues => 0 +</%ARGS> diff --git a/rt/webrt/Admin/Users/Modify.html b/rt/webrt/Admin/Users/Modify.html new file mode 100755 index 000000000..b6daed49b --- /dev/null +++ b/rt/webrt/Admin/Users/Modify.html @@ -0,0 +1,259 @@ +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/UserTabs, id => $id, current_subtab => '/Admin/Elements/Modify.html?id='.$id &> + +<& /Elements/ListActions, actions => \@results &> + +<FORM ACTION="<%$RT::WebPath%>/Admin/Users/Modify.html" METHOD=POST> +%if ($Create) { +<INPUT TYPE=HIDDEN NAME=id VALUE="new"> +% } else { +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$UserObj->Id%>"> +% } + +<TABLE WIDTH=100% BORDER=0> +<TR> + +<TD VALIGN=TOP ROWSPAN=2> +<& /Elements/TitleBoxStart, title => 'Identity' &> + +Username: <input name="Name" value="<%$UserObj->Name%>"> <b>(required)</b> <BR> +Email: <input name="EmailAddress" value="<%$UserObj->EmailAddress%>"><BR> +Real Name: <input name="RealName" value="<%$UserObj->RealName%>"> <BR> +Nickname: <input name="NickName" value="<%$UserObj->NickName%>"> +<BR> +Unix login: <input name="Gecos" value="<%$UserObj->Gecos%>"> +<BR> +Extra info: <textarea name="FreeformContactInfo" cols=20 rows=5><%$UserObj->FreeformContactInfo%></TEXTAREA> +<& /Elements/TitleBoxEnd &> +</TD> +<TD VALIGN=TOP> +<& /Elements/TitleBoxStart, title => 'Access control' &> +<INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1"> +<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> +Let this user access RT<BR> + + +<INPUT TYPE=HIDDEN NAME="SetPrivileged" VALUE="1"> +<INPUT TYPE=CHECKBOX NAME="Privileged" VALUE="1" <%$PrivilegedChecked%>> Let this user be granted rights<BR> + +% unless ($RT::WebExternalAuth) { +<TABLE> +<TR> +<TD ALIGN=RIGHT> +New Password: +</TD> +<TD ALIGN=LEFT> +<input type=password name="Pass1"> +</TD> +</TR> +<TR><TD ALIGN=RIGHT> +Retype Password: +</TD> +<TD> +<input type=password name="Pass2"> +</TD> +</TR> +</TABLE> +% } +<& /Elements/TitleBoxEnd &> +</TD> +<TR> + +<TD VALIGN=TOP> +<& /Elements/TitleBoxStart, title => 'Location' &> +Organization: <input name="Organization" value="<%$UserObj->Organization%>"> +<BR> +Address1: <input name="Address1" value="<%$UserObj->Address1%>"> +<BR> +Address2: <input name="Address2" value="<%$UserObj->Address2%>"> +<BR> +City: <input name="City" value="<%$UserObj->City%>" size=14> + +State: <input name="State" value="<%$UserObj->State%>" size=3> + +Zip: <input name="Zip" value="<%$UserObj->Zip%>" size=9> +<BR> +Country: <input name="Country" value="<%$UserObj->Country%>"> +<BR> + + +<& /Elements/TitleBoxEnd &> +</TD> +</TR> +<TR> +<TD COLSPAN=2 VALIGN=TOP> + + +<& /Elements/TitleBoxStart, title => 'Phone numbers' &> +Home: <input name="HomePhone" value="<%$UserObj->HomePhone%>" size=13> + +Work: <input name="WorkPhone" value="<%$UserObj->WorkPhone%>" size=13> + +Mobile: <input name="MobilePhone" value="<%$UserObj->MobilePhone%>" size=13> + +Pager: <input name="PagerPhone" value="<%$UserObj->PagerPhone%>" size=13> +<& /Elements/TitleBoxEnd &> +<BR> +<& /Elements/TitleBoxStart, title => 'Comments about this user' &> +<TEXTAREA name="Comments" COLS=80 ROWS=5 WRAP=VIRTUAL><%$UserObj->Comments%></TEXTAREA> +<& /Elements/TitleBoxEnd &> + + +%if ($UserObj->Privileged) { +<BR> +<& /Elements/TitleBoxStart, title => 'Signature' &> +<TEXTAREA COLS=80 ROWS=5 name="Signature" WRAP=HARD> +<%$UserObj->Signature%></TEXTAREA> +<& /Elements/TitleBoxEnd &> +% } + +</TD> + +</TR> +</TABLE> + + +<& /Elements/Submit &> +</form> + + +<%INIT> + +my $UserObj = new RT::User($session{'CurrentUser'}); +my ($title, $PrivilegedChecked, $EnabledChecked, $Disabled, $result, @results); + +my ($val, $msg); + +if ($Create) { + $title = "Create a new user"; +} +else { + + if ($id eq 'new') { + ($val, $msg) = $UserObj->Create( Name => $Name, + EmailAddress => $ARGS{'EmailAddress'} + ); + if ($val) { + push @results, $msg; + } else { + push @results, 'User could not be created: '. $msg; + } + + } + else { + $UserObj->Load($id) || $UserObj->Load($Name) || Abort("Couldn't load user '$Name'"); + $val = $UserObj->Id(); + } + + if ($val) { + $title = "Modify the user ". $UserObj->Name; + } + + # If the create failed + else { + $title = "Create a new user"; + $Create = 1; + } + + + +} + + + + +# If we have a user to modify, lets try. +if ($UserObj->Id) { + + my @fields = qw(Name Comments Signature EmailAddress FreeformContactInfo + Organization RealName NickName Lang EmailEncoding WebEncoding + ExternalContactInfoId ContactInfoSystem Gecos ExternalAuthId + AuthSystem HomePhone WorkPhone MobilePhone PagerPhone Address1 + Address2 City State Zip Country + ); + + my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields, + Object => $UserObj, + ARGSRef => \%ARGS ); + push (@results,@fieldresults); + + +# {{{ Deal with special fields: Privileged, Enabled and Password +if ( ($SetPrivileged) and ( $Privileged != $UserObj->Privileged) ) { +my ($code, $msg) = $UserObj->SetPrivileged($Privileged); + push @results, 'Privileged status: '. $msg; +} + +#we're asking about enabled on the web page but really care about disabled. +if ($Enabled == 1) { + $Disabled = 0; +} +else { + $Disabled = 1; +} +if ( ($SetEnabled) and ( $Disabled != $UserObj->Disabled) ) { + my ($code, $msg) = $UserObj->SetDisabled($Disabled); + push @results, 'Enabled status '. $msg; +} + + +#TODO: make this report errors properly +if ((defined $Pass1) and ($Pass1 ne '') and ($Pass1 eq $Pass2) and (!$UserObj->IsPassword($Pass1))) { + my ($code, $msg); + ($code, $msg) = $UserObj->SetPassword($Pass1); + push @results, 'Password: '. $msg; +} + +# }}} +} + + +# {{{ Do some setup for the ui +unless ($UserObj->Disabled()) { + $EnabledChecked ="CHECKED"; +} + +if ($UserObj->Privileged()) { + $PrivilegedChecked = "CHECKED"; +} + +# }}} +</%INIT> + + +<%ARGS> +$id => undef +$Name => undef +$Comments => undef +$Signature => undef +$EmailAddress => undef +$FreeformContactInfo => undef +$Organization => undef +$RealName => undef +$NickName => undef +$Privileged => undef +$SetPrivileged => undef +$Enabled => undef +$SetEnabled => undef +$Lang => undef +$EmailEncoding => undef +$WebEncoding => undef +$ExternalContactInfoId => undef +$ContactInfoSystem => undef +$Gecos => undef +$ExternalAuthId => undef +$AuthSystem => undef +$HomePhone => undef +$WorkPhone => undef +$MobilePhone => undef +$PagerPhone => undef +$Address1 => undef +$Address2 => undef +$City => undef +$State => undef +$Zip => undef +$Country => undef +$Pass1 => undef +$Pass2=> undef +$Create=> undef +</%ARGS> diff --git a/rt/webrt/Admin/Users/Prefs.html b/rt/webrt/Admin/Users/Prefs.html new file mode 100755 index 000000000..4a9fc5cdf --- /dev/null +++ b/rt/webrt/Admin/Users/Prefs.html @@ -0,0 +1,97 @@ +<& /Elements/Header, Title=>"User view" &> + +<& /Elements/ViewUser, User=>$u &> + +%if ($session{CurrentUser} && ($session{CurrentUser}->Id == $id)) { + <& /Elements/TitleBoxStart, title => 'Signature' &> +<form method=post> +<input type="hidden" name="id" value=<%$id%>> +<TEXTAREA COLS=72 ROWS=4 WRAP=HARD NAME="Signature"><% $u->Signature %></TEXTAREA><br><br> +<input type="submit" value="Update signature"> +</form> + <& /Elements/TitleBoxEnd &> + <form method=post> + Open tickets (from listing) in another window: <input type="checkbox" name="NewWindowOption" <%exists $session{NewWindowOption} && "CHECKED"%>><br> + Open tickets (from listing) in a new window: <input type="checkbox" name="AlwaysNewWindowOption" <%exists $session{AlwaysNewWindowOption} && "CHECKED"%>><br> + <input type="submit" name="NewWindowSetting" value="New window setting"> + </form> +%} + + <& /Elements/TitleBoxStart, title => 'Email' &> +<form method=post> +<input type="hidden" name="id" value="<%$id%>"> +<input name="Email" value="<% $u->EmailAddress %>"><input type="submit" value="Update email"> +</form> + <& /Elements/TitleBoxEnd &> + <& /Elements/TitleBoxStart, title => 'Real Name' &> +<form method=post> +<input type="hidden" name="id" value="<%$id%>"> +<input name="RealName" value="<% $u->RealName %>"><input type="submit" value="Update name"> +</form> + <& /Elements/TitleBoxEnd &> + + <& /Elements/TitleBoxStart, title => 'User ID' &> +<form method=post> +<input type="hidden" name="id" value="<%$id%>"> +<input name="Name" value="<% $u->Name %>"><input type="submit" value="Update ID"> +</form> + <& /Elements/TitleBoxEnd &> + +%# TODO: alternative email addresses + merging users + +<%ARGS> +$id => $session{CurrentUser} ? $session{CurrentUser}->Id : 0 +$Signature => undef +$Email => undef +$RealName => undef +$Name => undef +</%ARGS> + +<%INIT> +require RT::User; +my $u=RT::User->new($session{CurrentUser}); +$u->Load($id) || die "Couldn't load that user ($id)"; +if ($Signature) { +my ($val, $msg)=$u->SetSignature($Signature); +$RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg); +} + +if ($Email) { +my ($val, $msg)=$u->SetEmailAddress($Email); +$RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg); +} + +if ($RealName) { +my ($val, $msg)=$u->SetRealName($RealName); +$RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg); +} + +if ($Name) { +my ($val, $msg)=$u->SetName($Name); +$RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg); +} + +if ($ARGS{NewWindowSetting}) { +if ($ARGS{NewWindowOption}) { +$session{NewWindowOption}=1; +} else { +delete $session{NewWindowOption}; +} +if ($ARGS{AlwaysNewWindowOption}) { +$session{NewWindowOption}=1; +$session{AlwaysNewWindowOption}=1; +} else { +delete $session{AlwaysNewWindowOption}; +} +} + +</%INIT> + + + + + + + + + diff --git a/rt/webrt/Admin/Users/Rights.html b/rt/webrt/Admin/Users/Rights.html new file mode 100644 index 000000000..3b94f9157 --- /dev/null +++ b/rt/webrt/Admin/Users/Rights.html @@ -0,0 +1 @@ +Placeholder diff --git a/rt/webrt/Admin/Users/index.html b/rt/webrt/Admin/Users/index.html new file mode 100755 index 000000000..383513710 --- /dev/null +++ b/rt/webrt/Admin/Users/index.html @@ -0,0 +1,71 @@ +<& /Admin/Elements/Header, Title => 'Admin users' &> +<& /Admin/Elements/Tabs, current_tab => 'Admin/Users/' &> + + +<& /Elements/TitleBoxStart, title => 'Select a user' &> + +<TABLE> +<TR> +<TD VALIGN=TOP> + +<FORM METHOD=POST ACTION="<% $RT::WebPath %>/Admin/Users/"> + +Find people whose <& /Elements/SelectUsers &><BR> +<input type="checkbox" name="FindDisabledUsers"> Include disabled users in search. +<BR> +<div align=right><input type=submit value="Go!"></div> +</FORM> +</TD> +<TD VALIGN=TOP> +<UL> +% if ($session{'CurrentUser'}->HasSystemRight('AdminUsers')) { +<LI><A HREF="<%$RT::WebPath%>/Admin/Users/Modify.html?Create=1">Create a new user</A><BR><BR></LI> +</UL> +% } + +<%$caption%><BR> +<UL> +%if ($users->Count == 0) { +<LI> <i>No users matching search criteria found.</i> +% } +%while ( $user = $users->Next) { +<LI><A HREF="Modify.html?id=<%$user->id%>"><%$user->Name || '(no name listed)'%></a></LI> +%} + +</UL> +</TD> +</TR> +</TABLE> +<& /Elements/TitleBoxEnd &> + +<%INIT> +my ($user, $caption); +my $users = new RT::Users($session{'CurrentUser'}); + +if ($FindDisabledUsers) { + $users->{'find_disabled_rows'} = 1; +} + +unless (defined $UserString) { + $users->LimitToPrivileged(); + $caption = "Privileged users"; +} +else { + $caption = "Users matching search criteria"; + + if ($UserString) { + $users->Limit( FIELD => $UserField, + OPERATOR => $UserOp, + VALUE => $UserString); + +} +} +</%INIT> +<%ARGS> +$UserString => undef +$UserOp => '=' +$UserField => 'Name' +$IdLike => undef +$EmailLike => undef +$FindDisabledUsers => 0 +</%ARGS> diff --git a/rt/webrt/Admin/index.html b/rt/webrt/Admin/index.html new file mode 100755 index 000000000..1ed973f7e --- /dev/null +++ b/rt/webrt/Admin/index.html @@ -0,0 +1,4 @@ + <& /Admin/Elements/Header, Title => 'RT Administration' &> +<& /Admin/Elements/Tabs &> + + |