diff options
Diffstat (limited to 'rt/html')
283 files changed, 28184 insertions, 0 deletions
diff --git a/rt/html/Admin/CustomFields/GroupRights.html b/rt/html/Admin/CustomFields/GroupRights.html new file mode 100644 index 000000000..380fee479 --- /dev/null +++ b/rt/html/Admin/CustomFields/GroupRights.html @@ -0,0 +1,170 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/CustomFieldTabs, + id => $id, + current_tab => "Admin/CustomFields/GroupRights.html?id=".$id, + Title => $title +&> +<& /Elements/ListActions, actions => \@results &> + + <FORM METHOD=POST ACTION="GroupRights.html"> + <INPUT TYPE=HIDDEN NAME=id VALUE="<% $CustomFieldObj->id %>"> + + +<h1><&|/l&>System groups</&></h1> +<TABLE> +% $Groups = RT::Groups->new($session{'CurrentUser'}); +% $Groups->LimitToSystemInternalGroups(); +% while (my $Group = $Groups->Next()) { + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% loc($Group->Type) %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId, + Object => $CustomFieldObj &> + </TD> + </TR> +% } +</TABLE> +<h1><&|/l&>User defined groups</&></h1> +<TABLE> +% $Groups = RT::Groups->new($session{'CurrentUser'}); +% $Groups->LimitToUserDefinedGroups(); +% while (my $Group = $Groups->Next()) { + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% $Group->Name %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId, + Object => $CustomFieldObj &> + </TD> + </TR> +% } +</TABLE> + + <& /Elements/Submit, Caption => loc("Be sure to save your changes"), Reset => 1 &> + + </FORM> + +<%INIT> + + + + + + +if (!defined $id) { + $m->comp("/Elements/Error", Why => loc("No CustomField defined")); +} + +my $CustomFieldObj = RT::CustomField->new($session{'CurrentUser'}); +$CustomFieldObj->Load($id) || $m->comp("/Elements/Error", Why => loc("Couldn't load CustomField [_1]",$id)); + +my $Groups; + + my ( $ACL, @results ); + + foreach my $arg (keys %ARGS) { + if ($arg =~ /GrantRight-(\d+)-(.*?)-(\d+)$/) { + my $principal_id = $1; + my $object_type = $2; + my $object_id = $3; + my $rights = $ARGS{$arg}; + + my $principal = RT::Principal->new($session{'CurrentUser'}); + $principal->Load($principal_id); + my $obj; + + if ($object_type eq 'RT::CustomField') { + $obj = RT::CustomField->new($session{'CurrentUser'}); + $obj->Load($object_id); + } else { + push (@results, loc("System Error"). + loc("Rights could not be granted for [_1]", $object_type)); + next; + } + + my @rights = ref($ARGS{$arg}) eq 'ARRAY' ? @{$ARGS{$arg}} : ($ARGS{$arg}); + foreach my $right (@rights) { + next unless ($right); + my ($val, $msg) = $principal->GrantRight(Object => $obj, Right => $right); + push (@results, $msg); + } + } + elsif ($arg =~ /RevokeRight-(\d+)-(.*?)-(\d+)-(.*?)$/) { + my $principal_id = $1; + my $object_type = $2; + my $object_id = $3; + my $right = $4; + + my $principal = RT::Principal->new($session{'CurrentUser'}); + $principal->Load($principal_id); + next unless ($right); + my $obj; + + if ($object_type eq 'RT::CustomField') { + $obj = RT::CustomField->new($session{'CurrentUser'}); + $obj->Load($object_id); + } else { + push (@results, loc("System Error"). + loc("Rights could not be revoked for [_1]", $object_type)); + next; + } + my ($val, $msg) = $principal->RevokeRight(Object => $obj, Right => $right); + push (@results, $msg); + } +} + +my $title = loc('Modify group rights for custom field [_1]', $CustomFieldObj->Name); + +</%INIT> + +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/html/Admin/CustomFields/Modify.html b/rt/html/Admin/CustomFields/Modify.html new file mode 100644 index 000000000..4c3c92114 --- /dev/null +++ b/rt/html/Admin/CustomFields/Modify.html @@ -0,0 +1,212 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/CustomFieldTabs, + id => $CustomFieldObj->Id , + current_tab => $current_tab, + Title => $title &> +<& /Elements/ListActions, actions => \@results &> + + +<FORM METHOD="POST" ACTION="Modify.html" NAME="ModifyCustomField"> +<INPUT TYPE=HIDDEN NAME="id" VALUE="<%$id %>"> +<table> +<tr> +<td class="label"><&|/l&>Name</&></td> +<td><input name="Name" VALUE="<%$CustomFieldObj->Name%>" SIZE=20></td></tr> +<tr> +<td class="label"><&|/l&>Description</&></td> +<td><input name="Description" VALUE="<%$CustomFieldObj->Description%>" SIZE=80></td> +</tr> + +<tr> +<td class="label"><&|/l&>Type</&></td> +<td><& /Admin/Elements/SelectCustomFieldType, + Name => "TypeComposite", + Default => $CustomFieldObj->TypeComposite, &> +</td> +</tr> +<tr> +<td class="label"><&|/l&>Applies to</&></td> +<td><& /Admin/Elements/SelectCustomFieldLookupType, + Name => "LookupType", + Default => $CustomFieldObj->LookupType, &> +</td> +</tr> +<tr> +<td class="label"> </td> +<td> +<INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1"> +<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> <&|/l&>Enabled (Unchecking this box disables this custom field)</&> +</td> +</tr> +</table> +<BR> +% if ($CustomFieldObj->Id && $CustomFieldObj->Type =~ /^Select/i) { +<H2><&|/l&>Values</&></H2> +<div> +<& /Admin/Elements/EditCustomFieldValues, CustomField => $CustomFieldObj &> +<& /Admin/Elements/AddCustomFieldValue, CustomField => $CustomFieldObj &> +</div> +% } +<&/Elements/Submit&> +</FORM> + + + +<%INIT> + + + +my $CustomFieldObj = RT::CustomField->new( $session{'CurrentUser'} ); +my ( $title, @results, $EnabledChecked, $Disabled); +$EnabledChecked = "CHECKED"; + +if ( !$id ) { + $title = loc("Create a CustomField"); + $id = 'new'; +} +else { + + if ( $id eq 'new' ) { + my ( $val, $msg ) = $CustomFieldObj->Create(Name => $Name, + TypeComposite => $TypeComposite, + LookupType => $LookupType, + Description => $Description,); + $m->comp("/Elements/Error", Why => loc( "Could not create CustomField", $msg ) ) unless ($val); + push @results, $msg; + $title = loc( 'Created CustomField [_1]', $CustomFieldObj->Name() ); + } + else { + $CustomFieldObj->Load($id) || $m->comp("/Elements/Error", Why => loc('No CustomField') ); + $title = loc( 'Editing CustomField [_1]', $CustomFieldObj->Name() ); + + my @attribs = qw( Name TypeComposite LookupType Description); + my @aresults = UpdateRecordObject( AttributesRef => \@attribs, + Object => $CustomFieldObj, + ARGSRef => \%ARGS ); + + push @results, @aresults; + + #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 != $CustomFieldObj->Disabled) ) { + my ($code, $msg) = $CustomFieldObj->SetDisabled($Disabled); + push @results, loc('Enabled status: [_1]', loc_fuzzy($msg)); + } + + if ($CustomFieldObj->Disabled()) { + $EnabledChecked =""; + } + } + + $id = $CustomFieldObj->id; +} + + + + +my $paramtag = "CustomField-".$CustomFieldObj->Id."-Value-"; +# Delete any fields that want to be deleted +foreach my $key (keys %ARGS) { + + next unless ($key =~ /^Delete-$paramtag(\d+)$/); + my ($val, $msg) = $CustomFieldObj->DeleteValue($1); + push (@results, $msg); + + +} +# Update any existing values +my $values = $CustomFieldObj->ValuesObj; +while (my $value = $values->Next) { + foreach my $attr qw(Name Description SortOrder) { + my $param = $paramtag.$value->Id."-".$attr; + + if ( $ARGS{$param} && ($value->$attr() ne $ARGS{$param})) { + my $mutator = "Set$attr"; + my ($id, $msg) = $value->$mutator($ARGS{$param}); + push (@results, $msg); + } + } + + +} + + + +# Add any new values +if ($ARGS{$paramtag."new-Name"}) { + my ($id, $msg) = $CustomFieldObj->AddValue ( Name => $ARGS{$paramtag."new-Name"}, + Description => $ARGS{$paramtag."new-Description"}, + SortOrder => $ARGS{$paramtag."new-SortOrder"}); + push (@results, $msg); +} + +my $current_tab; +if ($ARGS{'Create'}){ + $current_tab = "Admin/CustomFields/Modify.html?Create=1"; +} else { + $current_tab = "Admin/CustomFields/Modify.html?id=".$id; + } + + +</%INIT> +<%ARGS> +$id => undef +$TypeComposite => undef +$LookupType => undef +$MaxValues => undef +$SortOrder => undef +$Description => undef +$Name => undef +$SetEnabled => undef +$Enabled => undef +</%ARGS> diff --git a/rt/html/Admin/CustomFields/Objects.html b/rt/html/Admin/CustomFields/Objects.html new file mode 100644 index 000000000..8f9e3657b --- /dev/null +++ b/rt/html/Admin/CustomFields/Objects.html @@ -0,0 +1,145 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/CustomFieldTabs, + id => $id, + current_tab => "Admin/CustomFields/Objects.html?id=".$id, + Title => $title + &> + +<& /Elements/ListActions, actions => \@results &> + +<FORM ACTION="Objects.html" METHOD=POST> +<INPUT TYPE=HIDDEN NAME="id" VALUE="<% $id %>"> +<INPUT TYPE=HIDDEN NAME="UpdateObjs" VALUE="1"> + +<h2><&|/l&>Selected objects</&></h2> +<& /Admin/Elements/PickObjects, Objects => \@AssignedObjs, id => $id, Checked => 1 &> +<h2><&|/l&>Unselected objects</&></h2> +<& /Admin/Elements/PickObjects, Objects => \@UnassignedObjs, id => $id &> + +<& /Elements/Submit, CheckAll => 1, ClearAll => 1 &> +</FORM> + +<%INIT> +my $CF = RT::CustomField->new($session{'CurrentUser'}); +$CF->Load($id) or Abort(loc("Could not load CustomField [_1]"), $id); +my $LookupType = $CF->LookupType; +$LookupType =~ /^(.*?)-/ || + Abort(loc("Object of type [_1] cannot take custom fields", $LookupType)); + +my $Class = $1; +my $CollectionClass; +if (UNIVERSAL::can($Class.'Collection', 'new') ) { +$CollectionClass = $Class.'Collection'; + +} elsif (UNIVERSAL::can($Class.'es', 'new') ) { + $CollectionClass = $Class.'es'; + +} elsif (UNIVERSAL::can($Class.'s', 'new') ) { + $CollectionClass = $Class.'s'; + +} else { + Abort(loc("Can't find a collection class for '[_1]'", $Class)); +} + + +my $title = loc('Modify associated objects for [_1]', $CF->Name); + +my $Objects = $CollectionClass->new($session{'CurrentUser'}); +my (@results); +my (@AssignedObjs, @UnassignedObjs); + +$Objects->UnLimit; +$Objects->OrderBy( FIELD => 'Name' ); + + +my $ObjectCFs; +$ObjectCFs = RT::ObjectCustomFields->new($session{'CurrentUser'}); +$ObjectCFs->UnLimit; +$ObjectCFs->LimitToCustomField($id); + +my %seen; +while (my $OCF = $ObjectCFs->Next) { + $seen{$OCF->ObjectId}++; +} + +while (my $obj = $Objects->Next) { + my $obj_id = $obj->Id; + + if ($UpdateObjs) { + # Go through and delete all the custom field relationships that this object + # no longer has + my $key = "Object-$obj_id-CF-$id"; + if ($ARGS{$key}) { + if (!$seen{$obj_id}) { + my ($val, $msg) = $CF->AddToObject($obj); + push (@results, $msg); + push @UnassignedObjs, $obj if !$val; + } + } + else { + push @UnassignedObjs, $obj; + if ($seen{$obj_id}) { + my ($val, $msg) = $CF->RemoveFromObject($obj); + push (@results, $msg); + pop @UnassignedObjs if !$val; + } + } + } + elsif (!$seen{$obj_id}) { + push @UnassignedObjs, $obj; + } + next if @UnassignedObjs and $UnassignedObjs[-1] == $obj; + push @AssignedObjs, $obj; +} + +</%INIT> +<%ARGS> +$id => undef +$FindDisabledObjects => 0 +$UpdateObjs => 0 +</%ARGS> diff --git a/rt/html/Admin/CustomFields/UserRights.html b/rt/html/Admin/CustomFields/UserRights.html new file mode 100644 index 000000000..e2df3a058 --- /dev/null +++ b/rt/html/Admin/CustomFields/UserRights.html @@ -0,0 +1,168 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/CustomFieldTabs, id => $id, +current_tab => "Admin/CustomFields/UserRights.html?id=".$id, +Title => $title, &> +<& /Elements/ListActions, actions => \@results &> + + <FORM METHOD=POST ACTION="UserRights.html"> + <INPUT TYPE=HIDDEN NAME=id VALUE="<% $CustomFieldObj->id %>"> + + +<TABLE> + +% while (my $Member = $Users->Next()) { +% my $UserObj = $Member->MemberObj->Object(); +% my $group = RT::Group->new($session{'CurrentUser'}); +% $group->LoadACLEquivalenceGroup($Member->MemberObj); + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% $UserObj->Name %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId=> $group->PrincipalId, + Object => $CustomFieldObj &> + </TD> + </TR> +% } + </TABLE> + + <& /Elements/Submit, Caption => loc("Be sure to save your changes"), Reset => 1 &> + + </FORM> + +<%INIT> + + #Update the acls. + my @results; +foreach my $arg (keys %ARGS) { + if ($arg =~ /GrantRight-(\d+)-(.*?)-(\d+)$/) { + my $principal_id = $1; + my $object_type = $2; + my $object_id = $3; + my $rights = $ARGS{$arg}; + + my $principal = RT::Principal->new($session{'CurrentUser'}); + $principal->Load($principal_id); + my $obj; + + if ($object_type eq 'RT::CustomField') { + $obj = RT::CustomField->new($session{'CurrentUser'}); + $obj->Load($object_id); + + } else { + push (@results, loc("System Error"). + loc("Rights could not be granted for [_1]", +$object_type)); + next; + } + + my @rights = ref($ARGS{$arg}) eq 'ARRAY' ? @{$ARGS{$arg}} : +($ARGS{$arg}); + foreach my $right (@rights) { + next unless ($right); + my ($val, $msg) = $principal->GrantRight(Object => $obj, Right +=> $right); + push (@results, $msg); + } + } + elsif ($arg =~ /RevokeRight-(\d+)-(.*?)-(\d+)-(.*?)$/) { + my $principal_id = $1; + my $object_type = $2; + my $object_id = $3; + my $right = $4; + + my $principal = RT::Principal->new($session{'CurrentUser'}); + $principal->Load($principal_id); + next unless ($right); + my $obj; + + if ($object_type eq 'RT::CustomField') { + $obj = RT::CustomField->new($session{'CurrentUser'}); + $obj->Load($object_id); + } else { + push (@results, loc("System Error"). + loc("Rights could not be revoked for [_1]", +$object_type)); + next; + } + my ($val, $msg) = $principal->RevokeRight(Object => $obj, Right => +$right); + push (@results, $msg); + } +} + + +# {{{ Deal with setting up the display of current rights. + + + +if (!defined $id) { + $m->comp("/Elements/Error", Why => loc("No Class defined")); +} + +my $CustomFieldObj = RT::CustomField->new($session{'CurrentUser'}); +$CustomFieldObj->Load($id) || $m->comp("/Elements/Error", Why => loc("Couldn't load Class [_1]",$id)); + +# Find out which users we want to display ACL selects for +my $Privileged = RT::Group->new($session{'CurrentUser'}); +$Privileged->LoadSystemInternalGroup('Privileged'); +my $Users = $Privileged->MembersObj(); + + +my $title = loc('Modify user rights for custom field [_1]', $CustomFieldObj->Name); + +# }}} + +</%INIT> + +<%ARGS> +$id => undef +$UserString => undef +$UserOp => undef +$UserField => undef +</%ARGS> diff --git a/rt/html/Admin/CustomFields/index.html b/rt/html/Admin/CustomFields/index.html new file mode 100644 index 000000000..9854fb0ec --- /dev/null +++ b/rt/html/Admin/CustomFields/index.html @@ -0,0 +1,76 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => loc('Select a Custom Field') &> +<& /Admin/Elements/CustomFieldTabs, + current_tab => 'Admin/CustomFields/', + Title => loc('Select a Custom Field') &> + +% my $prev_lookup = ''; +% while (my $CustomFieldObj = $CustomFields->Next) { +% $CustomFieldObj->CurrentUserHasRight('AdminCustomField') or next; +% my $lookup = $CustomFieldObj->FriendlyLookupType; +% if ($lookup ne $prev_lookup) { +% if ($prev_lookup) { +</UL> +% } +<H2><% loc("Custom Fields for [_1]", $lookup) %></H2> +<UL> +% $prev_lookup = $lookup; +% } +% +<LI> +<A HREF="Modify.html?id=<%$CustomFieldObj->id()%>"><%$CustomFieldObj->Name%>: <%$CustomFieldObj->Description%></a> +</LI> +% } +% if ($prev_lookup) { +</UL> +% } + +<%INIT> +my $CustomFields = RT::CustomFields->new($session{'CurrentUser'}); +$CustomFields->UnLimit(); +$CustomFields->OrderByCols( { FIELD => 'LookupType' }, { FIELD => 'Name' } ); +</%INIT> diff --git a/rt/html/Admin/Elements/AddCustomFieldValue b/rt/html/Admin/Elements/AddCustomFieldValue new file mode 100644 index 000000000..3e3f414b3 --- /dev/null +++ b/rt/html/Admin/Elements/AddCustomFieldValue @@ -0,0 +1,66 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<b><&|/l&>Add Value</&></b></b></b></b> +<TABLE BORDER="0"> +<TR><TD><small> +<&|/l&>Sort</&>:<br> +<input size=3 name="CustomField-<%$CustomField->Id%>-Value-new-SortOrder" > +</TD> +<TD><small> +<&|/l&>Name</&>:<br> +<input type="text" size=30 name="CustomField-<%$CustomField->Id%>-Value-new-Name" > +</TD> +<TD><small> +<&|/l&>Description</&>:<br> +<input type="text" size=50 name="CustomField-<%$CustomField->Id%>-Value-new-Description"> +</TD></TR> +</TABLE> + +<%init> +</%init> +<%args> +$CustomField => undef +</%args> diff --git a/rt/html/Admin/Elements/CreateUserCalled b/rt/html/Admin/Elements/CreateUserCalled new file mode 100644 index 000000000..0dc6ac792 --- /dev/null +++ b/rt/html/Admin/Elements/CreateUserCalled @@ -0,0 +1,48 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<FORM METHOD=get ACTION="<% $RT::WebPath %>/Admin/Users/Create.html"> +<&|/l&>New user called</&> <INPUT NAME="Name" size=10><input type=submit value="<&|/l&>Create</&>"> +</form> diff --git a/rt/html/Admin/Elements/CustomFieldTabs b/rt/html/Admin/Elements/CustomFieldTabs new file mode 100644 index 000000000..d7acf33cc --- /dev/null +++ b/rt/html/Admin/Elements/CustomFieldTabs @@ -0,0 +1,116 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Tabs, + current_tab => 'Admin/CustomFields/', + subtabs => $tabs, + current_subtab => $current_tab, + Title => $Title &> +<%INIT> +my $tabs; + +if ($id) { + my $cf = RT::CustomField->new( $session{'CurrentUser'} ); + $cf->Load($id); + $tabs = { + this => { + title => $cf->Name, + path => "Admin/CustomFields/Modify.html?id=" . $id, + current_subtab => $current_tab, + + subtabs => { + + C => { title => loc('Basics'), + path => "Admin/CustomFields/Modify.html?id=" . $id, + }, + F => { title => loc('Group Rights'), + path => "Admin/CustomFields/GroupRights.html?id=" + . $id, }, + G => { + title => loc('User Rights'), + path => "Admin/CustomFields/UserRights.html?id=" . $id, + }, + + } } + + }; + + + if ($cf->LookupType =~ /^RT::Queue/io) { + $tabs->{'this'}->{subtabs}->{D} = { + title => loc('Applies to'), + path => "Admin/CustomFields/Objects.html?id=" . $id, + }; + } +} + +if ($session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminCustomField')) { + $tabs->{"A"} = { title => loc('Select custom field'), + path => "Admin/CustomFields/", + }; + $tabs->{"B"} = { title => loc('New custom field'), + path => "Admin/CustomFields/Modify.html?Create=1", + separator => 1, + }; +} + + # Now let callbacks add their extra tabs + $m->comp('/Elements/Callback', tabs => $tabs, %ARGS); + +foreach my $tab (sort keys %{$tabs->{'this'}->{'subtabs'}}) { + if ($tabs->{'this'}->{'subtabs'}->{$tab}->{'path'} eq $current_tab) { + $tabs->{'this'}->{'subtabs'}->{$tab}->{'subtabs'} = $subtabs; + $tabs->{'this'}->{'subtabs'}->{$tab}->{'current_subtab'} = $current_subtab; + } +} +if( $id ) { $current_tab = "Admin/CustomFields/Modify.html?id=" . $id } +</%INIT> +<%ARGS> +$Title => undef +$id => undef +$current_tab => undef +$subtabs => undef +$current_subtab => undef +</%ARGS> diff --git a/rt/html/Admin/Elements/EditCustomField b/rt/html/Admin/Elements/EditCustomField new file mode 100644 index 000000000..d8c5b29b2 --- /dev/null +++ b/rt/html/Admin/Elements/EditCustomField @@ -0,0 +1,157 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/ListActions, actions => \@results &> + + +<FORM METHOD=POST ACTION="CustomField.html"> +<INPUT TYPE=HIDDEN NAME="CustomField" VALUE="<%$id %>"> +<INPUT TYPE=HIDDEN name="Queue" value="<%$Queue%>"> + +<TABLE WIDTH="100%" BORDER="0"> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Name</&>: +</TD><TD> +<input name="Name" VALUE="<%$CustomFieldObj->Name%>" SIZE=20> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Description</&>: +</TD><TD> +<input name="Description" VALUE="<%$CustomFieldObj->Description%>" SIZE=80> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Type</&>: +</TD><TD> +<& /Admin/Elements/SelectCustomFieldType, Name => "Type", Default => $CustomFieldObj->Type &> +</TD></TR> +<TR><TD> +</TD><TD> +<INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1"> +<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> <&|/l&>Enabled (Unchecking this box disables this custom field)</&> +</TD></TR> +</TABLE> + +<P> +% if ($CustomFieldObj->Id and $CustomFieldObj->Type =~ /Select/) { +<h2><&|/l&>Values</&></h2> +<font size=-1> +<& /Admin/Elements/EditCustomFieldValues, CustomField => $CustomFieldObj &> +<& /Admin/Elements/AddCustomFieldValue, CustomField => $CustomFieldObj &> +</font> +% } +<&/Elements/Submit, Label => loc('Create') &> +</FORM> + + + +<%INIT> + +my $CustomFieldObj = RT::CustomField->new($session{'CurrentUser'}); +my $EnabledChecked = "CHECKED"; +my (@results); + +if (! $CustomField ) { + $title = loc("Create a CustomField"); + $id = 'new'; +} else { + + if ($CustomField eq 'new') { + my ($val, $msg) = $CustomFieldObj->Create(Queue => $Queue, + Name => $Name, + Type => $Type, + Description => $Description, + ); + + # if there is an error, then abort. But since at this point there's + # stuff already printed, clear it out. + # (This only works in conjunction with temporarily turning autoflush + # off in the files that use this component.) + unless ($val) { + $m->clear_buffer; + Abort(loc("Could not create CustomField: [_1]", $msg)); + } + push @results, $msg; + $CustomFieldObj->SetSortOrder($CustomFieldObj->id); + $title = loc('Created CustomField [_1]', $CustomFieldObj->Name()); + } else { + $CustomFieldObj->Load($CustomField) || Abort(loc('No CustomField')); + $title = loc('Editing CustomField [_1]', $CustomFieldObj->Name()); + + my @aresults = ProcessCustomFieldUpdates ( + CustomFieldObj => $CustomFieldObj, + ARGSRef => \%ARGS ); + push @results, @aresults; + } + + +$id = $CustomFieldObj->id; + + #we're asking about enabled on the web page but really care about disabled. + my $Disabled = ($Enabled ? 0 : 1); + + if ( ($SetEnabled) and ( $Disabled != $CustomFieldObj->Disabled) ) { + my ($code, $msg) = $CustomFieldObj->SetDisabled($Disabled); + push @results, loc('Enabled status [_1]', loc_fuzzy($msg)); + } + + if ($CustomFieldObj->Disabled()) { + $EnabledChecked =""; + } + +} + + +</%INIT> +<%ARGS> +$id => undef +$title => undef +$Queue => undef +$CustomField => undef +$Type => undef +$Description => undef +$Name => undef +$SetEnabled => undef +$Enabled => undef +</%ARGS> diff --git a/rt/html/Admin/Elements/EditCustomFieldValues b/rt/html/Admin/Elements/EditCustomFieldValues new file mode 100644 index 000000000..9cc3858b9 --- /dev/null +++ b/rt/html/Admin/Elements/EditCustomFieldValues @@ -0,0 +1,84 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% if (!$values->Count) { +<p><em><&|/l&>(no values)</&></em></p> +% return; +% } +<i><&|/l&>(Check box to delete)</&></i> +<table> +<tr> +<td> </td> +<td><&|/l&>Sort</&></td> +<td><&|/l&>Name</&></td> +<td><&|/l&>Description</&></td> +</tr> +% while (my $value = $values->Next) { +<tr> +<td> +<input type="checkbox" name="Delete-CustomField-<%$CustomField->Id%>-Value-<%$value->Id%>"> +</td> +<td> +<input size=3 name="CustomField-<%$CustomField->Id%>-Value-<%$value->Id%>-SortOrder" value="<%$value->SortOrder%>"> +</td> +<td> +<input type="text" size=30 name="CustomField-<%$CustomField->Id%>-Value-<%$value->Id%>-Name" value="<%$value->Name%>"> +</td> +<td> +<font size="-1"> +<input type="text" size=50 name="CustomField-<%$CustomField->Id%>-Value-<%$value->Id%>-Description" value="<%$value->Description%>"> +</font> +</td> +</tr> +% } +</table> +<%init> + +my $values = $CustomField->ValuesObj(); + +</%init> +<%args> +$CustomField => undef +</%args> diff --git a/rt/html/Admin/Elements/EditCustomFields b/rt/html/Admin/Elements/EditCustomFields new file mode 100644 index 000000000..1cd3df568 --- /dev/null +++ b/rt/html/Admin/Elements/EditCustomFields @@ -0,0 +1,189 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/ListActions, actions => \@results &> + +<FORM ACTION="<%$RT::WebPath%><% $m->request_comp->path |n %>" METHOD="POST" NAME="EditCustomFields"> +<INPUT TYPE=HIDDEN NAME="id" VALUE="<% $Object->Id %>"/> +<INPUT TYPE=HIDDEN NAME="ObjectType" VALUE="<% $ObjectType %>"/> +<INPUT TYPE=HIDDEN NAME="SubType" VALUE="<% $SubType %>"/> +<INPUT TYPE=HIDDEN NAME="UpdateCFs" VALUE="1"/> + +% if ($Object->Id) { +<h2><&|/l&>Global Custom Fields</&></h2> +<& PickCustomFields, CustomFields => \@GlobalCFs, ReadOnly => 1, id => $id, SubType => $SubType &> +% } +<h2><&|/l&>Selected Custom Fields</&></h2> +<& PickCustomFields, CustomFields => [$ObjectCFs->CustomFields], id => $id, Checked => 1, SubType => $SubType &> +<h2><&|/l&>Unselected Custom Fields</&></h2> +<& PickCustomFields, CustomFields => \@UnassignedCFs, id => $id, SubType => $SubType &> + +<& /Elements/Submit, CheckAll => 1, ClearAll => 1 &> +</FORM> + + +<%INIT> +my $CustomFields = RT::CustomFields->new($session{'CurrentUser'}); +my @results; +my (@GlobalCFs, @UnassignedCFs); + +my $id = $Object->Id; +if ($id and !$Object->CurrentUserHasRight('AssignCustomFields')) { + $m->out('<P><i>', loc('(No custom fields)'), '</i></P>'); + return; +} + +my $lookup = $ObjectType; +$lookup .= "-$SubType" if $SubType; + +$CustomFields->LimitToLookupType($lookup); +$CustomFields->OrderBy( FIELD => 'Name' ); + + +my ($GlobalCFs, $ObjectCFs); +$ObjectCFs = RT::ObjectCustomFields->new($session{'CurrentUser'}); +$ObjectCFs->UnLimit; +$ObjectCFs->LimitToObjectId($id); +$ObjectCFs->LimitToLookupType($lookup); + +# {{{ deal with moving sortorder of custom fields +if ($CustomField and $Move) { + my $SourceObj = RT::ObjectCustomField->new($session{'CurrentUser'}); + $SourceObj->LoadByCols( ObjectId => $id, CustomField => $CustomField ); + + my $TargetObj; + my $target_order = $SourceObj->SortOrder + $Move; + while (my $ObjectCF = $ObjectCFs->Next) { + my $this_order = $ObjectCF->SortOrder; + + # if we have an exact match, finish the loop now + ($TargetObj = $ObjectCF, last) if $this_order == $target_order; + + # otherwise, we need to apropos toward the general direction + # ... first, check the sign is correct + next unless ($this_order - $SourceObj->SortOrder) * $Move > 0; + + # ... next, see if we already have a candidate + if ($TargetObj) { + # ... if yes, compare the delta and choose the smaller one + my $orig_delta = abs($TargetObj->SortOrder - $target_order); + my $this_delta = abs($this_order - $target_order); + next if $orig_delta < $this_delta; + } + + $TargetObj = $ObjectCF; + } + + if ($TargetObj) { + # swap their sort order + my ($s, $t) = ($SourceObj->SortOrder, $TargetObj->SortOrder); + $TargetObj->SetSortOrder($s); + $SourceObj->SetSortOrder($t); + # because order changed, we must redo search for subsequent uses + } + + $ObjectCFs->GotoFirstItem; +} +# }}} + +if ($id) { + $GlobalCFs = RT::ObjectCustomFields->new($session{'CurrentUser'}); + $GlobalCFs->LimitToObjectId(0); + $GlobalCFs->LimitToLookupType($lookup); +} + +while (my $cf = $CustomFields->Next) { + my $cf_id = $cf->Id; + + if ($GlobalCFs and $GlobalCFs->HasEntryForCustomField($cf_id)) { + push @GlobalCFs, $cf; + next; + } + + if ($UpdateCFs) { + # Go through and delete all the custom field relationships that this object + # no longer has + my $key = "Object-$id-CF-$cf_id"; + if ($ARGS{$key}) { + if (!$ObjectCFs->HasEntryForCustomField($cf_id)) { + my ($val, $msg) = $cf->AddToObject($Object); + push (@results, $msg); + push @UnassignedCFs, $cf if !$val; + } + } + else { + push @UnassignedCFs, $cf; + if ($ObjectCFs->HasEntryForCustomField($cf_id)) { + my ($val, $msg) = $cf->RemoveFromObject($Object); + push (@results, $msg); + pop @UnassignedCFs if !$val; + } + } + } + elsif (!$ObjectCFs->HasEntryForCustomField($cf_id)) { + push @UnassignedCFs, $cf; + } + else { + } +} + +# redo search... +$ObjectCFs = RT::ObjectCustomFields->new($session{'CurrentUser'}); +$ObjectCFs->UnLimit; +$ObjectCFs->LimitToObjectId($id); +$ObjectCFs->LimitToLookupType($lookup); + +</%INIT> +<%ARGS> +$title => undef +$Move => undef +$Source => undef +$CustomField => undef +$FindDisabledCustomFields => undef +$UpdateCFs => 0 +$Object +$ObjectType +$SubType => '' +</%ARGS> diff --git a/rt/html/Admin/Elements/EditQueueWatchers b/rt/html/Admin/Elements/EditQueueWatchers new file mode 100644 index 000000000..c93bf81f5 --- /dev/null +++ b/rt/html/Admin/Elements/EditQueueWatchers @@ -0,0 +1,76 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%if ($Members->Count == 0 ) { +<ul> +<li><i><&|/l&>none</&></i> +% } else { +<i><&|/l&>(Check box to delete)</&></i><br><BR> +<ul> +% while (my $watcher=$Members->Next) { +<li> +<INPUT TYPE=CHECKBOX NAME="Queue-<%$QueueObj->Id%>-DeleteWatcher-Type-<%$Watchers->Type%>-Principal-<%$watcher->MemberId%>" value="1" + UNCHECKED> +% if ($watcher->MemberObj->IsUser) { +<a href="<%$RT::WebPath%>/Admin/Users/Modify.html?id=<%$watcher->MemberObj->ObjectId%>"> +% } else { +<a href="<%$RT::WebPath%>/Admin/Groups/Modify.html?id=<%$watcher->MemberObj->ObjectId%>"> +% } +<%$watcher->MemberObj->Object->Name%></a> +% } +% } +</ul> + +<%INIT> +my $Members = $Watchers->MembersObj; +</%INIT> + +<%ARGS> +$QueueObj => undef +$Watchers => undef +</%ARGS> + + + diff --git a/rt/html/Admin/Elements/EditScrip b/rt/html/Admin/Elements/EditScrip new file mode 100644 index 000000000..907ae9a92 --- /dev/null +++ b/rt/html/Admin/Elements/EditScrip @@ -0,0 +1,197 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/ListActions, actions => \@actions &> + + +<FORM METHOD=POST ACTION="Scrip.html"> +<input type="hidden" name="id" value="<%$id%>"> +<input type="hidden" name="Queue" value="<%$Queue%>"> +<& /Elements/TitleBoxStart, title => loc('Scrip Fields') &> +<TABLE> +<TR> +<TD ALIGN=RIGHT> +<&|/l&>Description</&>: +</TD> +<TD> +<input Name="Scrip-<%$id%>-Description" value="<%$scrip->Description%>"> +</TR> +<TR> +<TD ALIGN=RIGHT> +<&|/l&>Condition</&>: +</TD> +<TD> +<& /Admin/Elements/SelectScripCondition, Name => "Scrip-$id-ScripCondition", Default => $scrip->ConditionObj->Id &><BR> +</TD> +</TR> +<TR> +<TD ALIGN=RIGHT> +<&|/l&>Action</&>: +</TD> +<TD> +<& /Admin/Elements/SelectScripAction, Name => "Scrip-$id-ScripAction", Default => $scrip->ActionObj->Id &> +</TD> +</TR> +<TR> +<TD ALIGN=RIGHT> +<&|/l&>Template</&>: +</TD> +<TD> +<& /Admin/Elements/SelectTemplate, Name => "Scrip-$id-Template", Default => $scrip->TemplateObj->Id, Queue => $Queue &> +</TD> +</TR> +<TR> +<TD ALIGN=RIGHT> +<&|/l&>Stage</&>: +</TD> +<TD> +<& /Admin/Elements/SelectStage, Name => "Scrip-$id-Stage", Default => $scrip->Stage &> +</TD> +</TR> +</table> +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit, Caption => loc("Be sure to save your changes"), Reset => 1 &> + +<br> +<& /Elements/TitleBoxStart, title => loc('User Defined conditions and actions') &> +<table> +<TR> +<TD colspan=2> +<i><&|/l&>(Use these fields when you choose 'User Defined' for a condition or action)</&></i> +</TD> +</TR> +<TR> +<TD class=labeltop> +<&|/l&>Custom condition</&>: +</TD> +<TD> +<TEXTAREA COLS=80 ROWS=5 NAME="Scrip-<%$id%>-CustomIsApplicableCode"><%$scrip->CustomIsApplicableCode%></TEXTAREA> +</TD> +</TR> +<TR> +<TD class=labeltop> +<&|/l&>Custom action preparation code</&>: +</TD> +<TD> +<TEXTAREA COLS=80 ROWS=5 NAME="Scrip-<%$id%>-CustomPrepareCode"><%$scrip->CustomPrepareCode%></TEXTAREA> +</TD> +</TR> +<TR> +<TD class=labeltop> +<&|/l&>Custom action cleanup code</&>: +</TD> +<TD> +<TEXTAREA COLS=80 ROWS=5 NAME="Scrip-<%$id%>-CustomCommitCode"><%$scrip->CustomCommitCode%></TEXTAREA> +</TD> +</TR> +</table> +<& /Elements/TitleBoxEnd &> + +<& /Elements/Submit, Label => loc('Create'), Reset => 1 &> + +</FORM> +<%init> +my (@actions); + + +my $scrip = new RT::Scrip($session{'CurrentUser'}); + +if ( $id eq 'new' ) { + + my ( $retval, $msg ) = $scrip->Create( + Queue => $Queue, + ScripAction => $ARGS{"Scrip-new-ScripAction"}, + ScripCondition => $ARGS{"Scrip-new-ScripCondition"}, + Template => $ARGS{"Scrip-new-Template"}, + Description => $ARGS{"Scrip-new-Description"}, + CustomPrepareCode => $ARGS{"Scrip-new-CustomPrepareCode"}, + CustomCommitCode => $ARGS{"Scrip-new-CustomCommitCode"}, + CustomIsApplicableCode => $ARGS{"Scrip-new-CustomIsApplicableCode"}, + ); + if ( defined $retval ) { + push @actions, $msg; + $id = $scrip->id; + } + else { + Abort( $msg); + } +} +elsif ($id) { + my ($val,$msg) =$scrip->Load($id); + if ($val) { + $id = $scrip->id; + } else { + Abort ($msg); + } + my @attribs = qw ( + Queue + ScripAction + ScripCondition + Template + Stage + Description + CustomPrepareCode + CustomCommitCode + CustomIsApplicableCode + ); + my @results = UpdateRecordObject( AttributesRef => \@attribs, + AttributePrefix => 'Scrip-'.$scrip->Id, + Object => $scrip, + ARGSRef => \%ARGS ); + push (@actions, @results); +} + +elsif ($ARGS{'create'}) { + $id = 'new'; +} + +# }}} +</%init> + +<%ARGS> +$id => undef +$title => undef +$Queue => 0 +</%ARGS> diff --git a/rt/html/Admin/Elements/EditScrips b/rt/html/Admin/Elements/EditScrips new file mode 100644 index 000000000..9526118b5 --- /dev/null +++ b/rt/html/Admin/Elements/EditScrips @@ -0,0 +1,121 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/ListActions, actions => \@actions &> + +<form action="Scrips.html" method="post"> +<input type="hidden" name="id" value="<%$id%>"> + +<h2><&|/l&>Current Scrips</&></h2> +% if ($Scrips->Count == 0 ) { +<P><i><&|/l&>(No scrips)</&></i></P> +% } else { +<TABLE> +<P><i><&|/l&>(Check box to delete)</&></i></P> + +% while (my $scrip = $Scrips->Next ) { +<TR> +<TD> +<input type="checkbox" name="DeleteScrip-<%$scrip->Id%>" value="1"> +</TD> +<TD> +<a href="Scrip.html?id=<%$scrip->Id%>&Queue=<%$id%>"><% $scrip->Description || "<i>(".loc('no value').")</i>" |n %></a><br> +<small><&|/l, loc($scrip->ConditionObj->Name), loc($scrip->ActionObj->Name), loc($scrip->TemplateObj->Name) &>[_1] [_2] with template [_3]</&></small> +</TD> +</TR> +% } + +</TABLE> + +% } +<& /Elements/Submit, + Caption => loc("Delete selected scrips"), + Label => loc("Delete") &> +</form> +<%init> +my (@actions); + +my $Scrips = RT::Scrips->new($session{'CurrentUser'}); + + +my $QueueObj = RT::Queue->new($session{'CurrentUser'}); +if ($id) { + $QueueObj->Load($id); +} + +if ($QueueObj->id) { + $Scrips->LimitToQueue($id); +} +else { + $Scrips->LimitToGlobal(); +} + + + + +# {{{ deal with modifying and deleting existing scrips +foreach my $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, loc("Scrip deleted"); + } + else { + push @actions, $msg; + } + } + # }}} +} +# }}} +</%init> + +<%ARGS> +$id => undef +$title => undef +</%ARGS> diff --git a/rt/html/Admin/Elements/EditTemplates b/rt/html/Admin/Elements/EditTemplates new file mode 100644 index 000000000..207ffd001 --- /dev/null +++ b/rt/html/Admin/Elements/EditTemplates @@ -0,0 +1,126 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/ListActions, actions => \@actions &> + +<FORM METHOD=GET ACTION="Templates.html"> +<INPUT TYPE="Hidden" NAME="id" VALUE="<%$id%>"> + +% if ($Templates->Count == 0 ) { +<P><i><&|/l&>(No templates)</&></i></P> +% } else { +<TABLE> +<TR> +<TH> +<i><&|/l&>(Check box to delete)</&></i> +</TH> +<TH> +</TH> +</TR> +% my $count; +% while (my $TemplateObj = $Templates->Next) { +<TR> +<TD> +<input type="checkbox" name="DeleteTemplate-<%$TemplateObj->Id%>" value="1"> +</TD> +<TD> +<A HREF="Template.html?Queue=<%$id%>&Template=<%$TemplateObj->id()%>"> +<B><% loc($TemplateObj->Name) %></B></A> +<br><% loc($TemplateObj->Description) %> +</TD> +</TR> + +% } +</TABLE> +% } + +<& /Elements/Submit, Label => loc('Delete Template') &> +</FORM> + +<%INIT> +my $Templates = RT::Templates->new($session{'CurrentUser'}); +my $QueueObj = RT::Queue->new($session{'CurrentUser'}); +my @actions; + +if ($id) { + $QueueObj->Load($id); +} + +if ($QueueObj->id) { + $Templates->LimitToQueue($id); +} +else { + $Templates->LimitToGlobal(); +} + +# Now let callbacks add their extra limits +$m->comp('/Elements/Callback', Templates => $Templates, %ARGS); + +# {{{ deal with deleting existing templates +foreach my $key (keys %ARGS) { + # {{{ if we're trying to delete the template + if ($key =~ /^DeleteTemplate-(\d+)/) { + my $id = $1; + my $TemplateObj = RT::Template->new($session{'CurrentUser'}); + $TemplateObj->Load($id); + my ($retval, $msg) = $TemplateObj->Delete; + if ($retval) { + push @actions, loc("Template deleted"); + } + else { + push @actions, $msg; + } + } + # }}} +} +# }}} +</%INIT> +<%ARGS> +$id => 0 +$title => undef +$Move => undef +$Source => undef +$Template => undef +</%ARGS> diff --git a/rt/html/Admin/Elements/EditUserComments b/rt/html/Admin/Elements/EditUserComments new file mode 100644 index 000000000..fb96dc09a --- /dev/null +++ b/rt/html/Admin/Elements/EditUserComments @@ -0,0 +1,54 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => "Comments about $name" &> +<&|/l&>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/html/Admin/Elements/GlobalCustomFieldTabs b/rt/html/Admin/Elements/GlobalCustomFieldTabs new file mode 100755 index 000000000..8d4eaca23 --- /dev/null +++ b/rt/html/Admin/Elements/GlobalCustomFieldTabs @@ -0,0 +1,93 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/SystemTabs, subtabs => $tabs, + current_tab => 'Admin/Global/CustomFields/index.html', + current_subtab => $current_tab, + Title => $Title &> +<%INIT> + + + my $tabs = { + + A => { title => loc('Users'), + text => loc('Modify scrips which apply to all queues'), + path => 'Admin/Global/CustomFields/Users.html', + }, + B => { title => loc('Groups'), + text => loc('Edit system templates'), + path => 'Admin/Global/CustomFields/Groups.html', + }, + + F => { title => loc('Tickets'), + text => loc('Modify global custom fields'), + path => 'Admin/Global/CustomFields/Queue-Tickets.html', + }, + + G => { title => loc('Ticket Transactions'), + text => loc('Modify global group rights'), + path => 'Admin/Global/CustomFields/Queue-Transactions.html', + }, + +}; + # Now let callbacks add their extra tabs + $m->comp('/Elements/Callback', tabs => $tabs, %ARGS); + + foreach my $tab (sort keys %{$tabs}) { + if ($tabs->{$tab}->{'path'} eq $current_tab) { + $tabs->{$tab}->{"subtabs"} = $subtabs; + $tabs->{$tab}->{"current_subtab"} = $current_subtab; + } + } +</%INIT> + + +<%ARGS> +$id => undef +$current_tab => undef +$subtabs => undef +$current_subtab => undef +$Title => undef +</%ARGS> diff --git a/rt/html/Admin/Elements/GroupTabs b/rt/html/Admin/Elements/GroupTabs new file mode 100644 index 000000000..60edda40e --- /dev/null +++ b/rt/html/Admin/Elements/GroupTabs @@ -0,0 +1,100 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Tabs, + subtabs => $tabs, + current_tab => 'Admin/Groups/', + current_subtab => $current_tab, + Title => $Title &> +<%INIT> +my $tabs; + +if ( $GroupObj and $GroupObj->id ) { +$tabs->{"this"} = { class => "currentnav", + path => "Admin/Groups/Modify.html?id=" . $GroupObj->id, + title => $GroupObj->Name, + current_subtab => $current_subtab, + subtabs => { + C => { title => loc('Basics'), + path => "Admin/Groups/Modify.html?id=" . $GroupObj->id }, + + D => { title => loc('Members'), + path => "Admin/Groups/Members.html?id=" . $GroupObj->id }, + + F => { title => loc('Group Rights'), + path => "Admin/Groups/GroupRights.html?id=" . $GroupObj->id, }, + G => { title => loc('User Rights'), + path => "Admin/Groups/UserRights.html?id=" . $GroupObj->id, }, + H => { title => loc('History'), + path => "Admin/Groups/History.html?id=" . $GroupObj->id }, + } +} +} +$tabs->{"A"} = { title => loc('Select group'), + path => "Admin/Groups/", }; +$tabs->{"B"} = { title => loc('New group'), + path => "Admin/Groups/Modify.html?Create=1", + separator => 1, }; + +# Now let callbacks add their extra tabs +$m->comp( '/Elements/Callback', tabs => $tabs, %ARGS ); +foreach my $tab ( sort keys %{$tabs->{'this'}->{'subtabs'}} ) { + if ( $tabs->{'this'}->{'subtabs'}->{$tab}->{'path'} eq $current_tab ) { + $tabs->{'this'}->{'subtabs'}->{$tab}->{"subtabs"} = $subtabs; + $tabs->{'this'}->{'subtabs'}->{$tab}->{"current_subtab"} = $current_subtab; + } +} + $tabs->{'this'}->{"current_subtab"} = $current_tab; + $current_tab = "Admin/Groups/Modify.html?id=".$GroupObj->id if $GroupObj; + +</%INIT> +<%ARGS> +$GroupObj => undef +$subtabs => undef +$current_subtab => undef +$current_tab => undef +$Title => undef +</%ARGS> + diff --git a/rt/html/Admin/Elements/Header b/rt/html/Admin/Elements/Header new file mode 100644 index 000000000..b80908094 --- /dev/null +++ b/rt/html/Admin/Elements/Header @@ -0,0 +1,50 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, %ARGS &> + +<%ARGS> +$Title => undef +</%ARGS> diff --git a/rt/html/Admin/Elements/ListGlobalCustomFields b/rt/html/Admin/Elements/ListGlobalCustomFields new file mode 100644 index 000000000..3df9d6292 --- /dev/null +++ b/rt/html/Admin/Elements/ListGlobalCustomFields @@ -0,0 +1,59 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% my $count = 0; +% while (my $CustomFieldObj = $CustomFields->Next) { +% $count++; +<font size="-1"><%$CustomFieldObj->id%>/<% loc($CustomFieldObj->Type) %>/<%$CustomFieldObj->Name%>: <%$CustomFieldObj->Description%></font> +<BR> +% } +% if (!$count) { +<font size="-1"><&|/l&>(No custom fields)</&></font> +% } + +<%init> +my $CustomFields = new RT::CustomFields ($session{'CurrentUser'}); +$CustomFields->LimitToGlobal(); +</%INIT> diff --git a/rt/html/Admin/Elements/ListGlobalScrips b/rt/html/Admin/Elements/ListGlobalScrips new file mode 100644 index 000000000..2e3791257 --- /dev/null +++ b/rt/html/Admin/Elements/ListGlobalScrips @@ -0,0 +1,75 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} + +% if ($Scrips->Count == 0) { + +<P><i><&|/l&>(No scrips)</&></i></P> + +% } else { + +<UL> + +% while (my $scrip = $Scrips->Next ) { +<LI> +<a href="<%$RT::WebPath%>/Admin/Global/Scrip.html?id=<%$scrip->Id%>&Queue=<%0%>"> +% if ($scrip->Description) { +<% $scrip->Description %> +% } else { +<i>(<&|/l, $scrip->Id&>Scrip #[_1]</&>)</i> +% } +</a><br> +<small><&|/l, loc($scrip->ConditionObj->Name), loc($scrip->ActionObj->Name), loc($scrip->TemplateObj->Name) &>[_1] [_2] with template [_3]</&></small> +</LI> +% } + +</UL> + +% } + +<%init> +my $Scrips = new RT::Scrips ($session{'CurrentUser'}); +$Scrips->LimitToGlobal(); +</%INIT> diff --git a/rt/html/Admin/Elements/ModifyTemplate b/rt/html/Admin/Elements/ModifyTemplate new file mode 100644 index 000000000..6749f3e65 --- /dev/null +++ b/rt/html/Admin/Elements/ModifyTemplate @@ -0,0 +1,82 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<TABLE> +<TR> +<TD ALIGN=RIGHT> +<&|/l&>Name</&>: +</TD> +<TD> +<input name="Name" VALUE="<%$Name%>" SIZE=20><BR> +</TD> +</TR> +<TR> +<TD ALIGN=RIGHT> +<&|/l&>Description</&>: +</TD> +<TD> +<input name="Description" VALUE="<%$Description%>" SIZE=80><BR> +</TD> +</TR> +<TR> +<TD ALIGN=RIGHT VALIGN=TOP> +<&|/l&>Content</&>:<BR> +</TD> +<TD> +<TEXTAREA NAME=Content ROWS=25 COLS=80 WRAP=SOFT> +<%$Content%></TEXTAREA> +</TD> +</TR> +</TABLE> + +<%INIT> + +</%INIT> + +<%ARGS> +$Name => undef +$Description => undef +$Content => undef +</%ARGS> diff --git a/rt/html/Admin/Elements/ObjectCustomFields b/rt/html/Admin/Elements/ObjectCustomFields new file mode 100644 index 000000000..a87e1579d --- /dev/null +++ b/rt/html/Admin/Elements/ObjectCustomFields @@ -0,0 +1,109 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& $ObjectTabs, +$id ? ( + id => $Object->id, + current_tab => "Admin/$Types/CustomFields.html?$sub_type_url&id=".$id, + current_subtab => "Admin/$Types/CustomFields.html?$sub_type_url&id=".$id, + "${Type}Obj" => $Object, +) : ( + current_tab => "Admin/Global/CustomFields/${QualifiedType}s.html", +), + Title => $title + &> + +<& /Admin/Elements/EditCustomFields, %ARGS, title => $title, Object => $Object &> +<%INIT> +# XXX TODO: Validate here? +#$ObjectType =~ /^RT::(Queue|User|Group)$/ +# or Abort(loc("Object of type [_1] cannot take custom fields", $ObjectType)); + + + +my $Type = $1; +my $Types = $Type.'s'; +my $ObjectTabs; +my $Object = $ObjectType->new($session{'CurrentUser'}); + + +my $QualifiedType; +my $FriendlySubTypes; +if ($SubType =~/^RT::(.*)$/) { + $FriendlySubTypes = RT::CustomField->new($session{'CurrentUser'})->FriendlyLookupType($Object->CustomFieldLookupType); + $QualifiedType = "$Type-$1"; +} else { + $QualifiedType = $Type; +} + +if ($id) { + $Object->Load($id) || Abort(loc("Couldn't load object [_1]", $id)); + $ObjectTabs = "/Admin/Elements/${Type}Tabs"; +} else { + $ObjectTabs = "/Admin/Elements/GlobalCustomFieldTabs"; + +} + +my $title; +if ($id) { +$title = loc('Edit Custom Fields for [_1]', $Object->Name); +} +elsif ($SubType) { + + $title= loc("Modify Custom Fields which apply to [_1] for all [_2]", loc(lc($FriendlySubTypes)), loc(lc($Types))); +} else { + $title =loc("Modify Custom Fields which apply to all [_1]", loc(lc($Types))); + +} +my $sub_type_url; +$sub_type_url = "SubType=$SubType" if $SubType; + +</%INIT> +<%ARGS> +$id => undef +$ObjectType +$SubType => undef +</%ARGS> diff --git a/rt/html/Admin/Elements/PickCustomFields b/rt/html/Admin/Elements/PickCustomFields new file mode 100644 index 000000000..c2a30f9a3 --- /dev/null +++ b/rt/html/Admin/Elements/PickCustomFields @@ -0,0 +1,96 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% if (@CustomFields == 0) { +<p><i><&|/l&>(None)</&></i></p> +% } else { +<TABLE cellspacing=0 cellpadding=2> +% my $count; +% foreach my $CustomFieldObj (@CustomFields) { +<TR> +% if (!$ReadOnly) { + <TD valign="TOP"> +<input type="checkbox" name="Object-<%$id%>-CF-<%$CustomFieldObj->Id%>" value="1" <% $Checked ? 'CHECKED' : '' %> +> + </TD> +% } + <TD valign="TOP"> + <A HREF="<%$RT::WebPath%>/Admin/CustomFields/Modify.html?id=<%$CustomFieldObj->id()%>"> +% if ($CustomFieldObj->Name) { +<b><%$CustomFieldObj->Name%></b> +% } else { +<i>(<&|/l&>no name</&>)</i> +% } +</a><br> + <%$CustomFieldObj->Description%> + </TD> + <TD valign="TOP"> + <i><% $CustomFieldObj->FriendlyTypeComposite %></i> + </TD> +% # show 'move up' unless it's the first item +% if ($count++ and $Checked) { + <TD valign="TOP"> + [<a href="<%$RT::WebPath%><% $m->request_comp->path |n %>?id=<%$id%>&SubType=<%$SubType%>&CustomField=<%$CustomFieldObj->id%>&Move=-1"><&|/l&>Move up</&></a>] +% } else { + <TD valign="TOP" ALIGN=RIGHT> +% } + +% # show 'move down' unless it's the last item +% if ($count != @CustomFields and $Checked) { +% $m->print(' | ') if $count > 1; + [<a href="<%$RT::WebPath%><% $m->request_comp->path |n %>?id=<%$id%>&SubType=<%$SubType%>&CustomField=<%$CustomFieldObj->id%>&Move=1"><&|/l&>Move down</&></a>] +% } + </TD> +</TR> +% } +</TABLE> +% } +<%ARGS> +@CustomFields +$id +$ReadOnly => 0 +$Checked => 0 +$SubType +</%ARGS> diff --git a/rt/html/Admin/Elements/PickObjects b/rt/html/Admin/Elements/PickObjects new file mode 100644 index 000000000..b07a88240 --- /dev/null +++ b/rt/html/Admin/Elements/PickObjects @@ -0,0 +1,80 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% if (@Objects == 0) { +<P><i><&|/l&>(None)</&></i></P> +% } else { +<TABLE cellspacing=0 cellpadding=2> +% my $count; +% foreach my $Object (@Objects) { +<TR> +% if (!$ReadOnly) { + <TD valign="TOP"> +<input type="checkbox" name="Object-<%$Object->id%>-CF-<%$id%>" value="1" <% $Checked ? 'CHECKED' : ''%> +> + </TD> +% } + <TD valign="TOP"> +% if ($Object->Name) { + <b><%$Object->Name%></b><br> +% } else { + <i>(<%loc("no name")%>)</i><br> +% } + <%$Object->can('Description') && $Object->Description%> + </TD> +%# <TD valign="TOP"> +%# <i><% $CustomFieldObj->FriendlyTypeComposite %></i> +%# </TD> + </TD> +</TR> +% } +</TABLE> +% } +<%ARGS> +@Objects +$id +$ReadOnly => 0 +$Checked => 0 +</%ARGS> diff --git a/rt/html/Admin/Elements/QueueRightsForUser b/rt/html/Admin/Elements/QueueRightsForUser new file mode 100644 index 000000000..01f294a59 --- /dev/null +++ b/rt/html/Admin/Elements/QueueRightsForUser @@ -0,0 +1,62 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<UL> +%while(my $ACE = $ACL->Next) { + +<LI><checkbox name="delete_ace_<%$ACE->id%>" value="1"> <% loc($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/html/Admin/Elements/QueueTabs b/rt/html/Admin/Elements/QueueTabs new file mode 100644 index 000000000..93522d0a2 --- /dev/null +++ b/rt/html/Admin/Elements/QueueTabs @@ -0,0 +1,118 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Tabs, + subtabs => $tabs, + current_tab => 'Admin/Queues/', + current_subtab => $current_tab, + Title => $Title &> + +<%INIT> +my $tabs; +if ($id) { + $tabs->{'this'} = { + title => $QueueObj->Name, + path => "Admin/Queues/Modify.html?id=".$id, + current_subtab => $current_tab, + subtabs => { + C => { title => loc('Basics'), + path => "Admin/Queues/Modify.html?id=".$id, + }, + D => { title => loc('Watchers'), + path => "Admin/Queues/People.html?id=".$id, + }, + + E => { title => loc('Scrips'), + path => "Admin/Queues/Scrips.html?id=".$id, + }, + F => { title => loc('Templates'), + path => "Admin/Queues/Templates.html?id=".$id, + }, + + G1 => { title => loc('Ticket Custom Fields'), + path => 'Admin/Queues/CustomFields.html?SubType=RT::Ticket&id='.$id, + }, + + G2 => { title => loc('Transaction Custom Fields'), + path => 'Admin/Queues/CustomFields.html?SubType=RT::Ticket-RT::Transaction&id='.$id, + }, + + H => { title => loc('Group Rights'), + path => "Admin/Queues/GroupRights.html?id=".$id, + }, + I => { title => loc('User Rights'), + path => "Admin/Queues/UserRights.html?id=".$id, + } + } + }; +} +if ($session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminQueue')) { + $tabs->{"A"} = { title => loc('Select queue'), + path => "Admin/Queues/", + }; + $tabs->{"B"} = { title => loc('New queue'), + path => "Admin/Queues/Modify.html?Create=1", + separator => 1, }; +} + + # Now let callbacks add their extra tabs + $m->comp('/Elements/Callback', tabs => $tabs, %ARGS); +foreach my $tab ( sort keys %{$tabs->{'this'}->{'subtabs'}} ) { + if ( $tabs->{'this'}->{'subtabs'}->{$tab}->{'path'} eq $current_tab ) { + $tabs->{'this'}->{'subtabs'}->{$tab}->{"subtabs"} = $subtabs; + $tabs->{'this'}->{'subtabs'}->{$tab}->{"current_subtab"} = $current_subtab; + } +} + $current_tab = "Admin/Queues/Modify.html?id=".$id if $id; +</%INIT> + +<%ARGS> +$QueueObj => undef +$id => undef +$subtabs => undef +$current_subtab => undef +$current_tab => undef +$Title => undef +</%ARGS> diff --git a/rt/html/Admin/Elements/SelectCustomFieldLookupType b/rt/html/Admin/Elements/SelectCustomFieldLookupType new file mode 100644 index 000000000..ec9f740b9 --- /dev/null +++ b/rt/html/Admin/Elements/SelectCustomFieldLookupType @@ -0,0 +1,58 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME ="<%$Name%>"> +%for my $option ($cf->LookupTypes) { +<OPTION VALUE="<%$option%>" <%$option eq $Default && "SELECTED"%>><% $cf->FriendlyLookupType($option) %></OPTION> +%} +</SELECT> +<%INIT> +my $cf = RT::CustomField->new($session{'CurrentUser'}); + +</%INIT> +<%ARGS> +$Default=>undef +$Name => 'LookupType' +</%ARGS> diff --git a/rt/html/Admin/Elements/SelectCustomFieldType b/rt/html/Admin/Elements/SelectCustomFieldType new file mode 100644 index 000000000..3f25b8e71 --- /dev/null +++ b/rt/html/Admin/Elements/SelectCustomFieldType @@ -0,0 +1,58 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME ="<%$Name%>"> +%for my $option ($cf->TypeComposites) { +<OPTION VALUE="<%$option%>" <%$option eq $Default && "SELECTED"%>><% $cf->FriendlyTypeComposite($option) %></OPTION> +%} +</SELECT> +<%INIT> +my $cf = RT::CustomField->new($session{'CurrentUser'}); + +</%INIT> +<%ARGS> +$Default=>undef +$Name => 'TypeComposite' +</%ARGS> diff --git a/rt/html/Admin/Elements/SelectGroups b/rt/html/Admin/Elements/SelectGroups new file mode 100644 index 000000000..92bd47587 --- /dev/null +++ b/rt/html/Admin/Elements/SelectGroups @@ -0,0 +1,60 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT MULTIPLE NAME="<%$Name%>" SIZE=10> +%while (my $group = $groups->Next) { +<OPTION VALUE="<%$group->id%>"><%$group->Name%> +%} +</SELECT> + +<%INIT> +my $groups = new RT::Groups($session{'CurrentUser'}); +$groups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => $Domain); + +</%INIT> +<%ARGS> +$Name => 'groups' +$Domain => 'UserDefined'; +</%ARGS> diff --git a/rt/html/Admin/Elements/SelectModifyGroup b/rt/html/Admin/Elements/SelectModifyGroup new file mode 100644 index 000000000..272e1f0c7 --- /dev/null +++ b/rt/html/Admin/Elements/SelectModifyGroup @@ -0,0 +1,55 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%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/html/Admin/Elements/SelectModifyQueue b/rt/html/Admin/Elements/SelectModifyQueue new file mode 100644 index 000000000..3a30d09c8 --- /dev/null +++ b/rt/html/Admin/Elements/SelectModifyQueue @@ -0,0 +1,55 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%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/html/Admin/Elements/SelectModifyUser b/rt/html/Admin/Elements/SelectModifyUser new file mode 100644 index 000000000..fc6c01205 --- /dev/null +++ b/rt/html/Admin/Elements/SelectModifyUser @@ -0,0 +1,71 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%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/html/Admin/Elements/SelectNewGroupMembers b/rt/html/Admin/Elements/SelectNewGroupMembers new file mode 100644 index 000000000..95056aec9 --- /dev/null +++ b/rt/html/Admin/Elements/SelectNewGroupMembers @@ -0,0 +1,93 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% if ($Show ne 'Groups') { +<b><&|/l&>Users</&></b> +<SELECT MULTIPLE NAME="<%$Name%>Users" SIZE=10> +%while (my $user = $users->Next) { +<OPTION VALUE="User-<%$user->id%>"><%$user->Name%></OPTION> +%} +</SELECT> +<br> +% } +% if ($Show ne 'Users') { +<b><&|/l&>Groups</&></b> +<SELECT MULTIPLE NAME="<%$Name%>Groups" SIZE=10> +%while (my $group = $groups->Next) { +<OPTION VALUE="Group-<%$group->id%>"><%$group->Name%></OPTION> +%} +</SELECT> +% } + +<%INIT> +my $users = new RT::Users($session{'CurrentUser'}); + +$users->Limit( + FIELD => 'id', + VALUE => $RT::SystemUser->id, + OPERATOR => '!=', + ENTRYAGGREGATOR => 'AND' +); +$users->Limit( + FIELD => 'id', + VALUE => $RT::Nobody->id, + OPERATOR => '!=', + ENTRYAGGREGATOR => 'AND' +); +$users->LimitToPrivileged(); + +my $groups = new RT::Groups($session{'CurrentUser'}); + +# self-recursive group membership considered harmful! +$groups->Limit(FIELD => 'id', VALUE => $Group->id, OPERATOR => '!=' ); +$groups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => 'UserDefined'); + + +</%INIT> +<%ARGS> +$Name => 'Users' +$Show => 'All' +$Group +</%ARGS> diff --git a/rt/html/Admin/Elements/SelectRights b/rt/html/Admin/Elements/SelectRights new file mode 100644 index 000000000..3e61d5071 --- /dev/null +++ b/rt/html/Admin/Elements/SelectRights @@ -0,0 +1,116 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<INPUT TYPE=HIDDEN NAME="CheckACL" VALUE="<%$ACLDesc%>"> + <TABLE BORDER=0> +<TR> +<TD valign=top width="180" align="left"> +% my %current_rights; +<h3><&|/l&>Current rights</&></h3> +% if ($ACLObj->Count() == 0) { +<i><&|/l&>No rights granted.</&></i> <BR> +% } else { +<i>(<&|/l&>Check box to revoke right</&>)</i> <BR> +% while (my $right = $ACLObj->Next()) { +% if ($right->RightName) { +% $current_rights{$right->RightName} = 1; +<input type=checkbox value="<%$right->Id%>" name="RevokeRight-<%$ACLDesc%>-<%$right->RightName%>"> <% loc($right->RightName) %><br> +% } +% } +% } +</TD> +<TD valign=top> +<h3><&|/l&>New rights</&></h3> +<SELECT SIZE=5 MULTIPLE NAME="GrantRight-<%$ACLDesc%>"> +% foreach $right (sort keys %Rights) { +% next if $current_rights{$right}; + <OPTION VALUE="<%$right%>" + ><% loc($right) %></OPTION> +% } +<OPTION VALUE="" SELECTED><&|/l&>(no value)</&></OPTION> +</SELECT> +</TD> +</TR> +</TABLE> +<%INIT> + my ($right, $ACLDesc, $AppliesTo, %Rights); + + # if the principal id points to a user, we really want to point + # to their ACL equivalence group. The machinations we're going through + # lead me to start to suspect that we really want users and groups + # to just be the same table. or _maybe_ that we want an object db. + my $princ = RT::Principal->new($RT::SystemUser); + $princ->Load($PrincipalId); + if ($princ->PrincipalType eq 'User') { + my $group = RT::Group->new($RT::SystemUser); + $group->LoadACLEquivalenceGroup($princ); + $PrincipalId = $group->PrincipalId; + } + + + my $ACLObj = new RT::ACL($session{'CurrentUser'}); + my $ACE = new RT::ACE($session{'CurrentUser'}); + + + $ACLObj->LimitToObject( $Object); + $ACLObj->LimitToPrincipal( Id => $PrincipalId); + $ACLObj->OrderBy(FIELD=>'RightName'); + + if (ref($Object) && UNIVERSAL::can($Object, 'AvailableRights')) { + %Rights = %{$Object->AvailableRights}; + } + + else { + %Rights = ( loc('System Error') => loc("No rights found") ); + } + + $ACLDesc = "$PrincipalId-".ref($Object)."-".$Object->Id; +</%INIT> + +<%ARGS> +$PrincipalType => undef +$PrincipalId => undef +$Object =>undef +</%ARGS> diff --git a/rt/html/Admin/Elements/SelectScrip b/rt/html/Admin/Elements/SelectScrip new file mode 100644 index 000000000..a9e979699 --- /dev/null +++ b/rt/html/Admin/Elements/SelectScrip @@ -0,0 +1,70 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME=<%$Name%>> +<OPTION VALUE="" +<% $Default eq undef && 'SELECTED' %> +>-</OPTION> +%while (my $Scrip = $Scrips->Next) { +<OPTION VALUE=<% $Scrip->Id %> +<% $Scrip->Id == $Default && 'SELECTED' %> +><% loc($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/html/Admin/Elements/SelectScripAction b/rt/html/Admin/Elements/SelectScripAction new file mode 100644 index 000000000..8d88d6458 --- /dev/null +++ b/rt/html/Admin/Elements/SelectScripAction @@ -0,0 +1,70 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME=<%$Name%>> +<OPTION VALUE="" +<% ! defined $Default && 'SELECTED' %> +>-</OPTION> +%while (my $ScripAction = $ScripActions->Next) { +<OPTION VALUE=<%$ScripAction->Id%> +<% defined $Default && $ScripAction->Id == $Default && 'SELECTED' %> +><% loc($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/html/Admin/Elements/SelectScripCondition b/rt/html/Admin/Elements/SelectScripCondition new file mode 100644 index 000000000..faa99fda6 --- /dev/null +++ b/rt/html/Admin/Elements/SelectScripCondition @@ -0,0 +1,70 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME=<%$Name%>> +<OPTION VALUE="" +<% ! defined $Default && 'SELECTED' %> +>-</OPTION> +%while (my $ScripCondition = $ScripConditions->Next) { +<OPTION VALUE=<%$ScripCondition->Id%> +<% defined $Default && $ScripCondition->Id == $Default && 'SELECTED' %> +><% loc($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/html/Admin/Elements/SelectSingleOrMultiple b/rt/html/Admin/Elements/SelectSingleOrMultiple new file mode 100644 index 000000000..571695091 --- /dev/null +++ b/rt/html/Admin/Elements/SelectSingleOrMultiple @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} + <select name="<%$Name%>"> + <option value="1" <%$SingleDefault%>><&|/l&>Single</&></option> + <option value="0" <%$MultipleDefault%>><&|/l&>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/html/Admin/Elements/SelectStage b/rt/html/Admin/Elements/SelectStage new file mode 100644 index 000000000..0fbf5c609 --- /dev/null +++ b/rt/html/Admin/Elements/SelectStage @@ -0,0 +1,64 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME=<%$Name%>> +% foreach my $stage (@stages) { +<OPTION VALUE=<%$stage%> +<% ($stage eq $Default) && 'SELECTED' %> +><% loc($stage) %> +</OPTION> +% } +<%INIT> +if ($Default eq '') { + $Default = 'TransactionCreate'; +} +my @stages = 'TransactionCreate'; +push @stages, 'TransactionBatch' if $RT::UseTransactionBatch; +push @stages, 'Disabled'; +</%INIT> +<%ARGS> +$Default => 'TransactionCreate' +$Name => 'Stage' +</%ARGS> diff --git a/rt/html/Admin/Elements/SelectTemplate b/rt/html/Admin/Elements/SelectTemplate new file mode 100644 index 000000000..7d83b6768 --- /dev/null +++ b/rt/html/Admin/Elements/SelectTemplate @@ -0,0 +1,83 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME=<%$Name%>> +<OPTION VALUE="" +<% $Default eq 'none' && 'SELECTED' %> +>-</OPTION> +%while (my $Template = $PrimaryTemplates->Next) { +<OPTION VALUE=<%$Template->Id%> +<% ($Template->Id == $Default) && 'SELECTED' %> +><% loc($Template->Name) %> +</OPTION> +%} +%while (my $Template = $OtherTemplates->Next) { +<OPTION VALUE=<%$Template->Id%> +<% ($Template->Id == $Default) && 'SELECTED'%> +><&|/l, loc($Template->Name) &>Global template: [_1]</&> +</OPTION> +%} +</SELECT> + +<%INIT> + + +my $PrimaryTemplates = RT::Templates->new($session{'CurrentUser'}); +if ($Queue != 0) { +$PrimaryTemplates->LimitToQueue($Queue); +} + +my $OtherTemplates = RT::Templates->new($session{'CurrentUser'}); +$OtherTemplates->LimitToGlobal($DefaultQueue); + +</%INIT> +<%ARGS> + +$Queue => undef +$Default => 'none' +$DefaultQueue => undef +$Name => 'Template' + +</%ARGS> diff --git a/rt/html/Admin/Elements/SelectUsers b/rt/html/Admin/Elements/SelectUsers new file mode 100644 index 000000000..a88aa8ff7 --- /dev/null +++ b/rt/html/Admin/Elements/SelectUsers @@ -0,0 +1,62 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<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/html/Admin/Elements/SystemTabs b/rt/html/Admin/Elements/SystemTabs new file mode 100644 index 000000000..646f552f5 --- /dev/null +++ b/rt/html/Admin/Elements/SystemTabs @@ -0,0 +1,92 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Tabs, subtabs => $tabs, + current_tab => 'Admin/Global/', + current_subtab => $current_tab, + Title => $Title &> + +<%INIT> + my $tabs = { + + A => { title => loc('Scrips'), + path => 'Admin/Global/Scrips.html', + }, + B => { title => loc('Templates'), + path => 'Admin/Global/Templates.html', + }, + + F => { title => loc('Custom Fields'), + path => 'Admin/Global/CustomFields/index.html', + }, + + G => { title => loc('Group Rights'), + path => 'Admin/Global/GroupRights.html', + }, + H => { title => loc('User Rights'), + path => 'Admin/Global/UserRights.html', + } + +}; + + # Now let callbacks add their extra tabs + $m->comp('/Elements/Callback', tabs => $tabs, %ARGS); + + foreach my $tab (sort keys %{$tabs}) { + if ($tabs->{$tab}->{'path'} eq $current_tab) { + $tabs->{$tab}->{"subtabs"} = $subtabs; + $tabs->{$tab}->{"current_subtab"} = $current_subtab; + } + } +</%INIT> + + +<%ARGS> +$id => undef +$current_tab => undef +$subtabs => undef +$current_subtab => undef +$Title => undef +</%ARGS> diff --git a/rt/html/Admin/Elements/Tabs b/rt/html/Admin/Elements/Tabs new file mode 100644 index 000000000..f90a629a2 --- /dev/null +++ b/rt/html/Admin/Elements/Tabs @@ -0,0 +1,91 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Tabs, + tabs => $tabs, + current_toptab => 'Admin/', + current_tab => $current_tab, + Title => $Title &> + +<%INIT> + my $tabs = { A => { title => loc('Users'), + path => 'Admin/Users/', + }, + B => { title => loc('Groups'), + path => 'Admin/Groups/', + }, + C => { title => loc('Queues'), + path => 'Admin/Queues/', + }, + D => { 'title' => loc('Custom Fields'), + path => 'Admin/CustomFields/', + }, + E => { 'title' => loc('Global'), + path => 'Admin/Global/', + }, + F => { 'title' => loc('Tools'), + path => 'Admin/Tools/', + }, + }; + + # Now let callbacks add their extra tabs + $m->comp('/Elements/Callback', tabs => $tabs, %ARGS); + + foreach my $tab (sort keys %{$tabs}) { + if ($tabs->{$tab}->{'path'} eq $current_tab) { + $tabs->{$tab}->{"subtabs"} = $subtabs; + $tabs->{$tab}->{"current_subtab"} = $current_subtab; + } + } + +</%INIT> + + +<%ARGS> +$subtabs => undef +$current_tab => undef +$current_subtab => undef +$Title => undef +</%ARGS> diff --git a/rt/html/Admin/Elements/ToolTabs b/rt/html/Admin/Elements/ToolTabs new file mode 100755 index 000000000..773b81099 --- /dev/null +++ b/rt/html/Admin/Elements/ToolTabs @@ -0,0 +1,78 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Tabs, subtabs => $tabs, + current_tab => 'Admin/Tools/', + current_subtab => $current_tab, + Title => $Title &> + +<%INIT> + my $tabs = { + + A => { title => loc('System Configuration'), + path => 'Admin/Tools/Configuration.html', + } + +}; + + # Now let callbacks add their extra tabs + $m->comp('/Elements/Callback', tabs => $tabs, %ARGS); + + foreach my $tab (sort keys %{$tabs}) { + if ($tabs->{$tab}->{'path'} eq $current_tab) { + $tabs->{$tab}->{"subtabs"} = $subtabs; + $tabs->{$tab}->{"current_subtab"} = $current_subtab; + } + } +</%INIT> + + +<%ARGS> +$id => undef +$current_tab => undef +$subtabs => undef +$current_subtab => undef +$Title => undef +</%ARGS> diff --git a/rt/html/Admin/Elements/UserTabs b/rt/html/Admin/Elements/UserTabs new file mode 100644 index 000000000..0ffd29b0f --- /dev/null +++ b/rt/html/Admin/Elements/UserTabs @@ -0,0 +1,108 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Tabs, + subtabs => $tabs, + current_tab => 'Admin/Users/', + current_subtab => $current_tab, + Title => $Title &> +<%INIT> +my $tabs; +if ($id) { +$tabs->{'this'} = { title => eval { $UserObj->Name }, + + path => "Admin/Users/Modify.html?id=".$id, +subtabs => { + Basics => { title => loc('Basics'), + path => "Admin/Users/Modify.html?id=".$id + }, + Memberships => { title => loc('Memberships'), + path => "Admin/Users/Memberships.html?id=".$id + }, + History => { title => loc('History'), + path => "Admin/Users/History.html?id=".$id + }, +# Scrips => { title => loc('Rights'), +# path => "Admin/Users/Rights.html?id=".$id +# } + + } +} +} +if ($session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminUsers')) { + $tabs->{"A"} = { title => loc('Select user'), + path => "Admin/Users/", + }; + $tabs->{"B"} = { title => loc('New user'), + path => "Admin/Users/Modify.html?Create=1", + separator => 1, + }; +} + + # Now let callbacks add their extra tabs + $m->comp('/Elements/Callback', tabs => $tabs, %ARGS); + +#foreach my $tab ( sort keys %{$tabs} ) { +# if ( $tabs->{$tab}->{'path'} eq $current_subtab ) { +# $tabs->{$tab}->{"current_subtab"} = $current_subtab; +# } +#} +foreach my $tab ( sort keys %{$tabs->{'this'}->{'subtabs'}} ) { + if ( $tabs->{'this'}->{'subtabs'}->{$tab}->{'path'} eq $current_tab ) { + $tabs->{'this'}->{'subtabs'}->{$tab}->{"subtabs"} = $subtabs; + $tabs->{'this'}->{'subtabs'}->{$tab}->{"current_subtab"} = $current_subtab; + } +} +$tabs->{'this'}->{"current_subtab"} = $current_tab; +$current_tab = "Admin/Users/Modify.html?id=".$id if $id; +</%INIT> +<%ARGS> +$UserObj => undef +$id => undef +$current_tab => undef +$subtabs => undef +$current_subtab => undef +$Title => undef +</%ARGS> diff --git a/rt/html/Admin/Global/CustomFields/Groups.html b/rt/html/Admin/Global/CustomFields/Groups.html new file mode 100644 index 000000000..bffde016f --- /dev/null +++ b/rt/html/Admin/Global/CustomFields/Groups.html @@ -0,0 +1,11 @@ +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/GlobalCustomFieldTabs, + current_tab => "Admin/Global/CustomFields/Groups.html", + current_subtab => "Admin/Global/CustomFields/Groups.html", + Title => $title + &> + <& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::Group', Object=> $object &> +<%INIT> + my $title = loc( 'Edit Custom Fields for all groups'); + my $object = RT::Group->new($session{'CurrentUser'}); +</%INIT> diff --git a/rt/html/Admin/Global/CustomFields/Queue-Tickets.html b/rt/html/Admin/Global/CustomFields/Queue-Tickets.html new file mode 100755 index 000000000..396559a17 --- /dev/null +++ b/rt/html/Admin/Global/CustomFields/Queue-Tickets.html @@ -0,0 +1,11 @@ +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/GlobalCustomFieldTabs, + current_tab => "Admin/Global/CustomFields/Queue-Tickets.html", + current_subtab => "Admin/Global/CustomFields/Queue-Tickets.html", + Title => $title + &> + <& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::Queue', Object=> $object, SubType => 'RT::Ticket' &> +<%INIT> + my $title = loc( 'Edit Custom Fields for tickets in all queues'); + my $object = RT::Queue->new($session{'CurrentUser'}); +</%INIT> diff --git a/rt/html/Admin/Global/CustomFields/Queue-Transactions.html b/rt/html/Admin/Global/CustomFields/Queue-Transactions.html new file mode 100755 index 000000000..63b4cfe6b --- /dev/null +++ b/rt/html/Admin/Global/CustomFields/Queue-Transactions.html @@ -0,0 +1,11 @@ +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/GlobalCustomFieldTabs, + current_tab => "Admin/Global/CustomFields/Queue-Transactions.html", + current_subtab => "Admin/Global/CustomFields/Queue-Transactions.html", + Title => $title + &> + <& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::Queue', Object=> $object, SubType => 'RT::Ticket-RT::Transaction' &> +<%INIT> + my $title = loc( 'Edit Custom Fields for tickets in all queues'); + my $object = RT::Queue->new($session{'CurrentUser'}); +</%INIT> diff --git a/rt/html/Admin/Global/CustomFields/Users.html b/rt/html/Admin/Global/CustomFields/Users.html new file mode 100644 index 000000000..6b79743d2 --- /dev/null +++ b/rt/html/Admin/Global/CustomFields/Users.html @@ -0,0 +1,11 @@ +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/GlobalCustomFieldTabs, + current_tab => "Admin/Global/CustomFields/Users.html", + current_subtab => "Admin/Global/CustomFields/Users.html", + Title => $title + &> + <& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::User', Object=> $object &> +<%INIT> + my $title = loc( 'Edit Custom Fields for all users'); + my $object = RT::User->new($session{'CurrentUser'}); +</%INIT> diff --git a/rt/html/Admin/Global/CustomFields/index.html b/rt/html/Admin/Global/CustomFields/index.html new file mode 100644 index 000000000..9cdcfd549 --- /dev/null +++ b/rt/html/Admin/Global/CustomFields/index.html @@ -0,0 +1,91 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Callback, tabs => $tabs, %ARGS &> +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/GlobalCustomFieldTabs, Title => $title &> + +<ul> +% foreach my $key (sort keys %$tabs) { +<li><font size="+2"><a href="<% $tabs->{$key}{path} %>"><% $tabs->{$key}{title} %></a></font><br> +<% $tabs->{$key}{text} %> +</li> +% } +</ul> + +<%INIT> +my $title = loc("Global custom field configuration"); + +my $tabs = { + + A => { + title => loc('Users'), + text => loc('Select custom fields for all users'), + path => 'Users.html', + }, + B => { + title => loc('Groups'), + text => loc('Select custom fields for all user groups'), + path => 'Groups.html', + }, + + F => { + title => loc('Tickets'), + text => loc('Select custom fields for tickets in all queues'), + path => 'Queue-Tickets.html', + }, + + G => { + title => loc('Ticket Transactions'), + text => + loc('Select custom fields for transactions on tickets in all queues'), + path => 'Queue-Transactions.html', + }, + +}; + + +$m->comp('/Elements/Callback', tabs => $tabs); +</%INIT> diff --git a/rt/html/Admin/Global/GroupRights.html b/rt/html/Admin/Global/GroupRights.html new file mode 100644 index 000000000..8d71432e0 --- /dev/null +++ b/rt/html/Admin/Global/GroupRights.html @@ -0,0 +1,121 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => loc('Modify global group rights') &> +<& /Admin/Elements/SystemTabs, + current_tab => 'Admin/Global/GroupRights.html', + Title => loc('Modify global group rights') &> +<& /Elements/ListActions, actions => \@results &> + + <FORM METHOD=POST ACTION="GroupRights.html"> + +<& /Elements/TitleBoxStart, title => loc('Modify global group rights.')&> + +<h1><&|/l&>System groups</&></h1> +<TABLE> +% $Groups = RT::Groups->new($session{'CurrentUser'}); +% $Groups->LimitToSystemInternalGroups(); +% while (my $Group = $Groups->Next()) { + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% loc($Group->Type) %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId, + Object =>$RT::System &> + </TD> + </TR> +% } +</TABLE> +<h1><&|/l&>Roles</&></h1> +<TABLE> +% $Groups = RT::Groups->new($session{'CurrentUser'}); +% $Groups->LimitToRolesForSystem(); +% while (my $Group = $Groups->Next()) { + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% loc($Group->Type) %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId, + Object => $RT::System &> + </TD> + </TR> +% } +</TABLE> +<h1><&|/l&>User defined groups</&></h1> +<TABLE> +% $Groups = RT::Groups->new($session{'CurrentUser'}); +% $Groups->LimitToUserDefinedGroups(); +% while (my $Group = $Groups->Next()) { + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% $Group->Name %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId, + Object => $RT::System &> + </TD> + </TR> +% } +</TABLE> + + <& /Elements/TitleBoxEnd &> + <& /Elements/Submit, Label => loc('Modify Group Rights'), Reset => 1 &> + + </FORM> + +<%INIT> + + #Update the acls. + my @results = ProcessACLChanges(\%ARGS); + + +my $Groups; + +</%INIT> + +<%ARGS> +</%ARGS> diff --git a/rt/html/Admin/Global/Scrip.html b/rt/html/Admin/Global/Scrip.html new file mode 100644 index 000000000..4e0c1f466 --- /dev/null +++ b/rt/html/Admin/Global/Scrip.html @@ -0,0 +1,78 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/SystemTabs, + current_tab => 'Admin/Global/Scrips.html', + current_subtab => $current_subtab, + subtabs => $subtabs, + Title => $title &> + +<& /Admin/Elements/EditScrip, title => $title, %ARGS &> + +<%init> +my ($title, $current_subtab); +my $subtabs = { + A => { title => loc('Select scrip'), + path => "Admin/Global/Scrips.html", + }, + B => { title => loc('New scrip'), + path => "Admin/Global/Scrip.html?create=1&Queue=0", + separator => 1, + } + }; + +if ($ARGS{'id'}) { + $current_subtab = "Admin/Global/Scrip.html?id=".$ARGS{'id'}."&Queue=0"; + $title = loc("Modify a scrip which applies to all queues"); + $subtabs->{"C"} = { title => loc('Scrip #[_1]', $ARGS{'id'}), + path => "Admin/Global/Scrip.html?id=".$ARGS{'id'}."&Queue=0" + } +} +else { + $current_subtab = "Admin/Global/Scrip.html?create=1&Queue=0"; + $title = loc("Add a scrip which will apply to all queues"); +} +</%init> diff --git a/rt/html/Admin/Global/Scrips.html b/rt/html/Admin/Global/Scrips.html new file mode 100644 index 000000000..dcfa6ff07 --- /dev/null +++ b/rt/html/Admin/Global/Scrips.html @@ -0,0 +1,75 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/SystemTabs, + current_tab => 'Admin/Global/Scrips.html', + current_subtab => 'Admin/Global/Scrips.html', + subtabs => $subtabs, + Title => $title &> +<& /Admin/Elements/EditScrips, title => $title, id => $id, %ARGS &> +</form> +<%init> + +my $subtabs = { + A => { title => loc('Select scrip'), + path => "Admin/Global/Scrips.html", + }, + B => { title => loc('New scrip'), + path => "Admin/Global/Scrip.html?create=1&Queue=0", + separator => 1, + } + }; +my $title = loc("Modify scrips which apply to all queues"); + +my (@actions); + +</%init> + + + +<%ARGS> +$id => 0 +</%ARGS> diff --git a/rt/html/Admin/Global/Template.html b/rt/html/Admin/Global/Template.html new file mode 100644 index 000000000..17da59b9e --- /dev/null +++ b/rt/html/Admin/Global/Template.html @@ -0,0 +1,123 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => loc("Modify template [_1]", $TemplateObj->id) &> +<& /Admin/Elements/SystemTabs, + current_tab => 'Admin/Global/Templates.html', + current_subtab => $current_subtab, + subtabs => $subtabs, + Title => loc("Modify template [_1]", $TemplateObj->id) &> +<& /Elements/ListActions, actions => \@results &> + + +<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%>"> + +<& /Admin/Elements/ModifyTemplate, Name => $TemplateObj->Name, Description => $TemplateObj->Description, Content => $TemplateObj->Content &> + +<& /Elements/Submit, Label => loc('Save Changes'), Reset => 1 &> +</FORM> + + + +<%INIT> + +my $TemplateObj = new RT::Template($session{'CurrentUser'}); +my ($title, @results, $current_subtab); + +my $subtabs = { + A => { title => loc('Select template'), + path => "Admin/Global/Templates.html" + }, + B => { title => loc('New template'), + path => "Admin/Global/Template.html?Create=1&Queue=0", + separator => 1, + } + }; + + +if ($Create) { + $current_subtab = "Admin/Global/Template.html?Create=1&Queue=0"; + $title = loc("Create a template"); +} + +else { + if ($Template eq 'new') { + my ($val, $msg) = $TemplateObj->Create(Queue => $Queue, Name => $Name); + Abort(loc("Could not create template: [_1]", $msg)) unless ($val); + push @results, $msg; + } + else { + $TemplateObj->Load($Template) || Abort(loc('No Template')); + } + $title = loc('Modify template [_1]', loc($TemplateObj->Name())); + + +} +if ($TemplateObj->Id()) { + my @attribs = qw( Description Content Queue Name); + my @aresults = UpdateRecordObject( AttributesRef => \@attribs, + Object => $TemplateObj, + ARGSRef => \%ARGS); + $current_subtab = "Admin/Global/Template.html?Queue=0&Template=".$TemplateObj->Id(); + $subtabs->{"C"} = { title => loc('Template #[_1]', $TemplateObj->Id()), + path => "Admin/Global/Template.html?Queue=0&Template=".$TemplateObj->Id(), + }; + push @results, @aresults; +} +</%INIT> +<%ARGS> +$Queue => undef +$Template => undef +$Create => undef +$Name => undef +</%ARGS> diff --git a/rt/html/Admin/Global/Templates.html b/rt/html/Admin/Global/Templates.html new file mode 100644 index 000000000..387326cd1 --- /dev/null +++ b/rt/html/Admin/Global/Templates.html @@ -0,0 +1,75 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title, FeedURI => 'templates' &> +<& /Admin/Elements/SystemTabs, + current_tab => 'Admin/Global/Templates.html', + current_subtab => 'Admin/Global/Templates.html', + subtabs => $subtabs, + Title => $title &> +<& /Admin/Elements/EditTemplates, title => $title, %ARGS &> +</form> +<%init> + +my $subtabs = { + A => { title => loc('Select template'), + path => "Admin/Global/Templates.html" + }, + B => { title => loc('New template'), + path => "Admin/Global/Template.html?Create=1&Queue=0", + separator => 1, + } + }; +my $title = loc("Modify templates which apply to all queues"); + +my (@actions); + +</%init> + + + +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/html/Admin/Global/UserRights.html b/rt/html/Admin/Global/UserRights.html new file mode 100644 index 000000000..14a4de368 --- /dev/null +++ b/rt/html/Admin/Global/UserRights.html @@ -0,0 +1,99 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => loc('Modify global user rights') &> +<& /Admin/Elements/SystemTabs, + current_tab => 'Admin/Global/UserRights.html', + Title => loc('Modify global user rights') &> +<& /Elements/ListActions, actions => \@results &> + + <FORM METHOD=POST ACTION="UserRights.html"> + +<& /Elements/TitleBoxStart, title => loc('Modify global user rights.') &> + +<TABLE> + +% while (my $Member = $Users->Next()) { +% my $UserObj = $Member->MemberObj->Object(); +% my $group = RT::Group->new($session{'CurrentUser'}); +% $group->LoadACLEquivalenceGroup($Member->MemberObj); + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% $UserObj->Name %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId => $group->PrincipalId, + Object => $RT::System &> + </TD> + </TR> +% } +</TABLE> + + <& /Elements/TitleBoxEnd &> + <& /Elements/Submit, Label => loc('Modify User Rights'), Reset => 1 &> + + </FORM> + +<%INIT> + + #Update the acls. + my @results = ProcessACLChanges(\%ARGS); + +# {{{ Deal with setting up the display of current rights. + + +# Find out which users we want to display ACL selects for +my $Privileged = RT::Group->new($session{'CurrentUser'}); +$Privileged->LoadSystemInternalGroup('Privileged'); +my $Users = $Privileged->MembersObj(); + + + +# }}} + +</%INIT> + +<%ARGS> +</%ARGS> diff --git a/rt/html/Admin/Global/index.html b/rt/html/Admin/Global/index.html new file mode 100644 index 000000000..af7a9ddd9 --- /dev/null +++ b/rt/html/Admin/Global/index.html @@ -0,0 +1,86 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Callback, tabs => $tabs, %ARGS &> +<& /Admin/Elements/Header, Title => loc('Admin/Global configuration') &> +<& /Admin/Elements/SystemTabs, + Title => loc('Admin/Global configuration') &> + +<ul> +% foreach my $key (sort keys %$tabs) { +<li><font size="+2"><a href="<% $tabs->{$key}{path} %>"><% $tabs->{$key}{title} %></a></font><br> +<% $tabs->{$key}{text} %> +</li> +% } +</ul> + +<%INIT> + my $tabs = { + + A => { title => loc('Scrips'), + text => loc('Modify scrips which apply to all queues'), + path => 'Scrips.html', + }, + B => { title => loc('Templates'), + text => loc('Edit system templates'), + path => 'Templates.html', + }, + + F => { title => loc('Custom Fields'), + text => loc('Modify global custom fields'), + path => 'CustomFields/index.html', + }, + + G => { title => loc('Group Rights'), + text => loc('Modify global group rights'), + path => 'GroupRights.html', + }, + H => { title => loc('User Rights'), + text => loc('Modify global user rights'), + path => 'UserRights.html', + } + +}; +</%INIT> diff --git a/rt/html/Admin/Groups/CustomFields.html b/rt/html/Admin/Groups/CustomFields.html new file mode 100644 index 000000000..c2336b042 --- /dev/null +++ b/rt/html/Admin/Groups/CustomFields.html @@ -0,0 +1,46 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/ObjectCustomFields, %ARGS, ObjectType => 'RT::Group' &> diff --git a/rt/html/Admin/Groups/GroupRights.html b/rt/html/Admin/Groups/GroupRights.html new file mode 100644 index 000000000..d95bdae07 --- /dev/null +++ b/rt/html/Admin/Groups/GroupRights.html @@ -0,0 +1,117 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => loc('Modify group rights for group [_1]', $GroupObj->Name) &> +<& /Admin/Elements/GroupTabs, + GroupObj => $GroupObj, + current_tab => 'Admin/Groups/GroupRights.html?id='.$id, + Title => loc('Modify group rights for group [_1]', $GroupObj->Name) &> +<& /Elements/ListActions, actions => \@results &> + + <FORM METHOD=POST ACTION="GroupRights.html"> + <INPUT TYPE=HIDDEN NAME=id VALUE="<% $GroupObj->id %>"> + +<& /Elements/TitleBoxStart, title => loc('Modify group rights for group [_1]', $GroupObj->Name) &> + +<h1><&|/l&>System groups</&></h1> +<TABLE> +% $Groups = RT::Groups->new($session{'CurrentUser'}); +% $Groups->LimitToSystemInternalGroups(); +% while (my $Group = $Groups->Next()) { + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% loc($Group->Type) %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId, + PrincipalType => 'Group', + Object => $GroupObj &> + </TD> + </TR> +% } +</TABLE> +<h1><&|/l&>User defined groups</&></h1> +<TABLE> +% $Groups = RT::Groups->new($session{'CurrentUser'}); +% $Groups->LimitToUserDefinedGroups(); +% while (my $Group = $Groups->Next()) { + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% $Group->Name %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId, + PrincipalType => 'Group', + Object => $GroupObj &> + </TD> + </TR> +% } +</TABLE> + + <& /Elements/TitleBoxEnd &> + <& /Elements/Submit, Label => loc('Modify Group Rights'), Reset => 1 &> + + </FORM> + +<%INIT> + + #Update the acls. + my @results = ProcessACLChanges(\%ARGS); + + +if (!defined $id) { + Abort(loc("No Group defined")); +} + +my $GroupObj = RT::Group->new($session{'CurrentUser'}); +$GroupObj->Load($id) || Abort(loc("Couldn't load group [_1]",$id)); + +my $Groups; + +</%INIT> + +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/html/Admin/Groups/History.html b/rt/html/Admin/Groups/History.html new file mode 100644 index 000000000..40dab46e9 --- /dev/null +++ b/rt/html/Admin/Groups/History.html @@ -0,0 +1,66 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/GroupTabs, + id => $id, + GroupObj => $GroupObj, + current_subtab => $current_tab, + Title => $title &> + +<& /Ticket/Elements/ShowHistory, + Ticket => $GroupObj, + ShowHeaderModes => 0, +&> + +<%INIT> +my $current_tab = 'Admin/Groups/History.html?id='.$id; +my $GroupObj = new RT::Group($session{'CurrentUser'}); +$GroupObj->Load($id) || Abort("Couldn't load group '$id'"); +my $title = loc("History of the group [_1]", $GroupObj->Name); +</%INIT> +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/html/Admin/Groups/Members.html b/rt/html/Admin/Groups/Members.html new file mode 100644 index 000000000..fd25b2d7f --- /dev/null +++ b/rt/html/Admin/Groups/Members.html @@ -0,0 +1,156 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => "RT/Admin/Edit the group ". $Group->Name &> +<& /Admin/Elements/GroupTabs, GroupObj => $Group, + current_tab => 'Admin/Groups/Members.html?id='.$id, + Title => "RT/Admin/Edit the group ". $Group->Name &> +<& /Elements/ListActions, actions => \@results &> + + +<& /Elements/TitleBoxStart, title => loc('Editing membership for group [_1]', $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> +<h3><&|/l&>Current members</&></h3> +</TD> +<TD> +<h3><&|/l&>Add members</&></h3> +</TD> +</TR> + +<TR> +<TD VALIGN=TOP> + +% if ($Group->MembersObj->Count == 0 ) { +<i><&|/l&>(No members)</&></i> +% } else { +<i><&|/l&>(Check box to delete)</&></i> +<br> +<br> +<&|/l&>Users</&> +% my $UserMembers = $Group->MembersObj; +% $UserMembers->LimitToUsers(); +<UL> +% while (my $member = $UserMembers->Next()) { +<LI><INPUT TYPE=CHECKBOX Name="DeleteMember-<%$member->MemberId%>" value="1"> +<%$member->MemberObj->Object->Name%> (<%$member->MemberObj->Object->RealName%>) +% } +</ul> +<&|/l&>Groups</&> +<ul> +% my $GroupMembers = $Group->MembersObj; +% $GroupMembers->LimitToGroups(); +% while (my $member = $GroupMembers->Next()) { +<LI><INPUT TYPE=CHECKBOX Name="DeleteMember-<%$member->MemberId%>" value="1"> +<%$member->MemberObj->Object->Name%> +% } +% } +</UL> +</TD> +<TD VALIGN=TOP> +<& /Admin/Elements/SelectNewGroupMembers, Name => "AddMembers", Group => $Group &> +</TD> +</TR> +</TABLE> +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit, Label => loc('Modify Members'), Reset => 1 &> +</form> + + +<%INIT> + +my $Group = new RT::Group($session{'CurrentUser'}); +$Group->Load($id) || Abort(loc('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 $AddMembersUsers eq 'ARRAY') ? @{$AddMembersUsers} : ($AddMembersUsers)), + ((ref $AddMembersGroups eq 'ARRAY') ? @{$AddMembersGroups} : ($AddMembersGroups)), +); + +foreach my $member (@AddMembers) { + next unless ($member); + + my $principal; + + if ($member =~ /^Group-(\d+)$/) { + $principal = RT::Group->new($session{'CurrentUser'}); + $principal->Load($1); + } elsif ($member =~ /^User-(\d+)$/) { + $principal = RT::User->new($session{'CurrentUser'}); + $principal->Load($1); + } else { + next; + } + + + my ($val, $msg) = $Group->AddMember($principal->PrincipalId); + push (@results, $msg); +} + + +</%INIT> + +<%ARGS> +$AddMembersUsers => undef +$AddMembersGroups => undef +$id => undef +</%ARGS> diff --git a/rt/html/Admin/Groups/Modify.html b/rt/html/Admin/Groups/Modify.html new file mode 100644 index 000000000..94c0203b1 --- /dev/null +++ b/rt/html/Admin/Groups/Modify.html @@ -0,0 +1,168 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> + +<& /Admin/Elements/GroupTabs, + GroupObj => $Group, + current_tab => $current_tab, + Title => $title &> +<& /Elements/ListActions, actions => \@results &> + + + +<FORM ACTION="<%$RT::WebPath%>/Admin/Groups/Modify.html" METHOD=POST ENCTYPE="multipart/form-data"> + +%unless ($Group->Id) { +<INPUT TYPE=HIDDEN NAME=id VALUE="new"> +% } else { +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$Group->Id%>"> +% } +<TABLE> +<TR><TD ALIGN=RIGHT> +<&|/l&>Name</&>: +</TD> +<TD><INPUT name="Name" value="<%$Group->Name%>"></TD> +</TR> +<TR> +<TD ALIGN=RIGHT> +<&|/l&>Description</&>:</TD><TD COLSPAN=3><INPUT name="Description" value="<%$Group->Description%>" size=60></TD> +</TR> +% my $CFs = $Group->CustomFields; +% while (my $CF = $CFs->Next) { +<TR VALIGN="TOP"><TD ALIGN="RIGHT"> +<% $CF->Name %>: +</TD><TD> +<& /Elements/EditCustomField, CustomField => $CF, Object => $Group &> +</TD></TR> +% } +<TR> +<TD COLSPAN=2> +<INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1"> +<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> <&|/l&>Enabled (Unchecking this box disables this group)</&><BR> +</TR> +<& /Elements/Callback, GroupObj => $Group, results => \@results, %ARGS &> +</TABLE> +<& /Elements/Submit, Label => loc('Save Changes'), Reset => 1 &> +</form> +<%INIT> + +my $current_tab; +my ($title, @results, $Disabled, $EnabledChecked); + +my $Group = RT::Group->new($session{'CurrentUser'}); + +if ($Create) { + $current_tab = 'Admin/Groups/Modify.html?Create=1'; + $title = loc("Create a new group"); +} + +else { + $current_tab = 'Admin/Groups/Modify.html?id='.$id; + if ($id eq 'new' ) { + + my ($create_id, $create_msg) = $Group->CreateUserDefinedGroup(Name => + "$Name"); + unless ($create_id) { + Abort (loc("Group could not be created: [_1]", $create_msg)); + } + $id = $Group->Id; + } + else { + $Group->Load($id) || Abort('Could not load group'); + } + + + if ($id) { + $title = loc("Modify the group [_1]", $Group->Name); + + } + + # If the create failed + else { + $title = loc("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); + push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $Group ); +} + +#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 != $Group->Disabled) ) { + my ($code, $msg) = $Group->SetDisabled($Disabled); + push @results, loc('Enabled status [_1]', loc_fuzzy($msg)); +} + +unless ($Group->Disabled()) { + $EnabledChecked ="CHECKED"; +} + + +</%INIT> + + +<%ARGS> +$Create => undef +$Name => undef +$Description => undef +$SetEnabled => undef +$Enabled => undef +$id => undef +</%ARGS> diff --git a/rt/html/Admin/Groups/UserRights.html b/rt/html/Admin/Groups/UserRights.html new file mode 100644 index 000000000..5237b1578 --- /dev/null +++ b/rt/html/Admin/Groups/UserRights.html @@ -0,0 +1,114 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => loc('Modify user rights for group [_1]', $GroupObj->Name) &> +<& /Admin/Elements/GroupTabs, + GroupObj => $GroupObj, + current_tab => 'Admin/Groups/UserRights.html?id='.$id, + Title => loc('Modify user rights for group [_1]', $GroupObj->Name) &> +<& /Elements/ListActions, actions => \@results &> + + <FORM METHOD=POST ACTION="UserRights.html"> + <INPUT TYPE=HIDDEN NAME=id VALUE="<% $GroupObj->id %>"> + +<& /Elements/TitleBoxStart, title => loc('Modify user rights for group [_1]', $GroupObj->Name) &> + +<TABLE> + +% while (my $Member = $Users->Next()) { +% my $UserObj = $Member->MemberObj->Object(); + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% $UserObj->Name %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId => $Member->MemberObj->Id, + PrincipalType => 'User', + Object => $GroupObj &> + </TD> + </TR> +% } + </TABLE> + + <& /Elements/TitleBoxEnd &> + <& /Elements/Submit, Label => loc('Modify User Rights'), Reset => 1 &> + + </FORM> + +<%INIT> + + #Update the acls. + my @results = ProcessACLChanges(\%ARGS); + +# {{{ Deal with setting up the display of current rights. + + +#Define vars used in html above + + +if (!defined $id) { + Abort(loc("No Group defined")); +} + +my $GroupObj = RT::Group->new($session{'CurrentUser'}); +$GroupObj->Load($id) || Abort(loc("Couldn't load group [_1]",$id)); + +# Find out which users we want to display ACL selects for +my $Privileged = RT::Group->new($session{'CurrentUser'}); +$Privileged->LoadSystemInternalGroup('Privileged'); +my $Users = $Privileged->MembersObj(); + + + +# }}} + +</%INIT> + +<%ARGS> +$id => undef +$UserString => undef +$UserOp => undef +$UserField => undef +</%ARGS> diff --git a/rt/html/Admin/Groups/index.html b/rt/html/Admin/Groups/index.html new file mode 100644 index 000000000..073440696 --- /dev/null +++ b/rt/html/Admin/Groups/index.html @@ -0,0 +1,107 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/GroupTabs, current_tab => 'Admin/Groups/', + current_subtab => 'Admin/Groups/', + Title => $title &> +<%$caption%>:<BR> <UL> +%if ($Groups->Count == 0) { +<LI> <i><&|/l&>No groups matching search criteria found.</&></i> +% } +%my @ids; +%while ( my $Group = $Groups->Next) { +% push @ids, $Group->Id; +<LI><A HREF="Modify.html?id=<%$Group->id%>"><%$Group->Name || loc('(empty)')%></a><BR> +%} +</UL> +%if (my $ids = join(',', @ids)) { +<em>(<a href="<%$RT::WebPath%>/Download/Tabular/Group/<% $ids %>/Groups.tsv"><&|/l&>Download as a tab-delimited file</&></a>)</em><br> +%} +<br><br> +<FORM METHOD=POST ACTION="<% $RT::WebPath %>/Admin/Groups/index.html"> +<input type="checkbox" name="FindDisabledGroups" value="1"> <&|/l&>Include disabled groups in listing.</&> +<BR> +<div align=right><input type=submit value="<&|/l&>Go!</&>"></div> +</FORM> + +<br><br> +<FORM METHOD=POST ACTION="<% $RT::WebPath %>/Admin/Groups/index.html"> +<&|/l&>Find groups whose</&> <& /Elements/SelectGroups &><BR> +<div align=right><input type=submit value="<&|/l&>Go!</&>"></div> +</FORM> +<%INIT> +my $Groups = RT::Groups->new($session{'CurrentUser'}); +$Groups->LimitToUserDefinedGroups(); +my $title = loc('Select a group'); +my $caption; + +if (length $GroupString) { + $caption = loc("Groups matching search criteria"); + if ($GroupField =~ /^CustomField-(\d+)/) { + $Groups->LimitCustomField( + CUSTOMFIELD => $1, + OPERATOR => $GroupOp, + VALUE => $GroupString, + ); + } + else { + $Groups->Limit( + FIELD => $GroupField, + OPERATOR => $GroupOp, + VALUE => $GroupString, + ); + } +} +else { + $caption = loc("User-defined groups"); +} +</%INIT> +<%ARGS> +$GroupString => undef +$GroupOp => '=' +$GroupField => 'Name' +$FindDisabledGroups => 0 +</%ARGS> diff --git a/rt/html/Admin/Queues/CustomField.html b/rt/html/Admin/Queues/CustomField.html new file mode 100644 index 000000000..5beba58c8 --- /dev/null +++ b/rt/html/Admin/Queues/CustomField.html @@ -0,0 +1,85 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/QueueTabs, id => $QueueObj->Id, + QueueObj => $QueueObj, + current_tab => 'Admin/Queues/CustomFields.html?id='.$QueueObj->id, + current_subtab => $current_subtab, + subtabs => $subtabs, + Title => $title &> + +<& /Admin/Elements/EditCustomField, title => $title, %ARGS &> + +<%INIT> +my $QueueObj = new RT::Queue($session{'CurrentUser'}); +$QueueObj->Load($Queue); + +my ($title, $current_subtab); + +unless($QueueObj->id) { + Abort(loc("Queue [_1] not found", $Queue)); +} +if ($CustomField) { + $title = loc('Modify a CustomField for queue [_1]', $QueueObj->Name()); +}else { + $current_subtab = "Admin/Queues/CustomField.html?create=1&Queue=".$QueueObj->id; + $title = loc('Create a CustomField for queue [_1]', $QueueObj->Name()); +} + +my $subtabs = { + A => { title => loc('New custom field'), + path => "Admin/Queues/CustomField.html?create=1&Queue=".$QueueObj->id + } + }; + +</%INIT> +<%ARGS> +$CustomField => undef +$Queue => 0 +</%ARGS> +<%ATTR> +AutoFlush => 0 +</%ATTR> diff --git a/rt/html/Admin/Queues/CustomFields.html b/rt/html/Admin/Queues/CustomFields.html new file mode 100644 index 000000000..4d7e08875 --- /dev/null +++ b/rt/html/Admin/Queues/CustomFields.html @@ -0,0 +1,70 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/QueueTabs, + id => $Object->id, + current_tab => "Admin/Queues/CustomFields.html?SubType=$SubType&id=$id", + current_subtab => "Admin/Queues/CustomFields.html?SubType=$SubType&id=$id", + QueueObj => $Object, + Title => $title + &> + + <& /Admin/Elements/EditCustomFields, %ARGS, title => $title, Object => $Object, ObjectType => 'RT::Queue' &> +<%INIT> +my $Object = RT::Queue->new( $session{'CurrentUser'} ); + +$Object->Load($id) || Abort( loc( "Couldn't load object [_1]", $id ) ); +my $FriendlySubTypes = + RT::CustomField->new( $session{'CurrentUser'} ) + ->FriendlyLookupType( $Object->CustomFieldLookupType ); + +my $title = loc( 'Edit Custom Fields for [_1]', $Object->Name ); + +</%INIT> +<%ARGS> +$id => undef +$SubType => 'RT::Queue-RT::Ticket' +</%ARGS> diff --git a/rt/html/Admin/Queues/GroupRights.html b/rt/html/Admin/Queues/GroupRights.html new file mode 100644 index 000000000..c5a12bfa3 --- /dev/null +++ b/rt/html/Admin/Queues/GroupRights.html @@ -0,0 +1,132 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => loc('Modify group rights for queue [_1]', $QueueObj->Name) &> +<& /Admin/Elements/QueueTabs, id => $id, + QueueObj => $QueueObj, + current_tab => $current_tab, + Title => loc('Modify group rights for queue [_1]', $QueueObj->Name) &> +<& /Elements/ListActions, actions => \@results &> + + <FORM METHOD=POST ACTION="GroupRights.html"> + <INPUT TYPE=HIDDEN NAME=id VALUE="<% $QueueObj->id %>"> + + +<h1><&|/l&>System groups</&></h1> +<TABLE> +<& /Elements/Callback, QueueObj => $QueueObj, results => \@results, %ARGS &> +% $Groups = RT::Groups->new($session{'CurrentUser'}); +% $Groups->LimitToSystemInternalGroups(); +% while (my $Group = $Groups->Next()) { + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% loc($Group->Type) %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId, + Object => $QueueObj &> + </TD> + </TR> +% } +</TABLE> +<h1><&|/l&>Roles</&></h1> +<TABLE> +% $Groups = RT::Groups->new($session{'CurrentUser'}); +% $Groups->LimitToRolesForQueue($QueueObj->Id); +% while (my $Group = $Groups->Next()) { + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% loc($Group->Type) %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId, + Object => $QueueObj &> + </TD> + </TR> +% } +</TABLE> +<h1><&|/l&>User defined groups</&></h1> +<TABLE> +% $Groups = RT::Groups->new($session{'CurrentUser'}); +% $Groups->LimitToUserDefinedGroups(); +% while (my $Group = $Groups->Next()) { + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% $Group->Name %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId, + Object => $QueueObj &> + </TD> + </TR> +% } +</TABLE> + + <& /Elements/Submit, Label => loc('Modify Group Rights'), Reset => 1 &> + + </FORM> + +<%INIT> + + #Update the acls. + my @results = ProcessACLChanges(\%ARGS); + + +if (!defined $id) { + Abort(loc("No Queue defined")); +} + +my $QueueObj = RT::Queue->new($session{'CurrentUser'}); +$QueueObj->Load($id) || Abort(loc("Couldn't load queue [_1]",$id)); + +my $Groups; +my $current_tab; +$current_tab = 'Admin/Queues/GroupRights.html?id='.$QueueObj->id; + +</%INIT> + +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/html/Admin/Queues/Modify.html b/rt/html/Admin/Queues/Modify.html new file mode 100644 index 000000000..5517a80c0 --- /dev/null +++ b/rt/html/Admin/Queues/Modify.html @@ -0,0 +1,191 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/QueueTabs, id => $QueueObj->id, + QueueObj => $QueueObj, + current_tab => $current_tab, + Title => $title &> +<& /Elements/ListActions, actions => \@results &> + + + +<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> +<&|/l&>Queue Name</&>: +</TD> +<TD><INPUT name="Name" value="<% ($Create) ? "" : $QueueObj->Name %>"></TD> +</TR><TR> +<TD ALIGN=RIGHT> +<&|/l&>Description</&>:</TD><TD COLSPAN=3><INPUT name="Description" value="<% ($Create) ? "" : $QueueObj->Description %>" size=60></TD></TR> +<TR> +<TD ALIGN=RIGHT> +<&|/l&>Reply Address</&>: +</TD><TD> +<INPUT name="CorrespondAddress" value="<% ($Create) ? "" : $QueueObj->CorrespondAddress %>"> +<BR><font size="-1"><i><&|/l , $RT::CorrespondAddress&>(If left blank, will default to [_1])</&></i></font> +</TD> +<TD ALIGN=RIGHT> + +<&|/l&>Comment Address</&>: </TD><TD> +<INPUT NAME="CommentAddress" value="<% ($Create) ? "" : $QueueObj->CommentAddress %>"> +<BR><font size="-1"><i><&|/l , $RT::CommentAddress&>(If left blank, will default to [_1])</&></i></font> +</TD> +</TR><TR> + +<TD ALIGN=RIGHT> +<&|/l&>Priority starts at</&>: +</TD><TD><INPUT NAME="InitialPriority" value="<% ($Create) ? "" : $QueueObj->InitialPriority %>"> +</TD> +<TD ALIGN=RIGHT> +<&|/l&>Over time, priority moves toward</&>: +</TD><TD><INPUT NAME="FinalPriority" value="<% ($Create) ? "" : $QueueObj->FinalPriority %>"> +</TD> +</TR> +<TR> +<TD ALIGN=RIGHT> +<&|/l&>Requests should be due in</&>: +</TD><TD> +<INPUT NAME="DefaultDueIn" VALUE="<% ($Create) ? "" : $QueueObj->DefaultDueIn%>"> <&|/l&>days</&>. +</TD> +</TR> +<TR> +<TD> +</TD> +<TD COLSPAN=4><INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1"> +<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> <&|/l&>Enabled (Unchecking this box disables this queue)</&><BR> +<& /Elements/Callback, QueueObj => $QueueObj, results => \@results, %ARGS &> +</TD> +</TR> + +</TABLE> +<& /Elements/Submit, Label => loc('Save Changes') &> +</form> + + + +<%INIT> +my $current_tab; +my $QueueObj = new RT::Queue($session{'CurrentUser'}); +$QueueObj->Load($id); +my ($title, @results, $Disabled, $EnabledChecked); +$EnabledChecked = "CHECKED"; + +if ($Create) { + $current_tab = 'Admin/Queues/Modify.html?Create=1'; + $title = loc("Create a queue"); +} else { + if ($id eq 'new') { + my ($val, $msg) = $QueueObj->Create(Name => $Name); + delete $session{'create_in_queues'}; + if ($val == 0 ) { + Abort("$msg"); + } + else { + push @results, $msg; + } + } + else { + $QueueObj->Load($id) || $QueueObj->Load($Name) || Abort("Couldn't load queue '$Name'"); + } + $title = loc('Editing Configuration for queue [_1]', $QueueObj->Name); + + $current_tab = 'Admin/Queues/Modify.html?id='.$QueueObj->id; +} +if ($QueueObj->Id()) { + delete $session{'create_in_queues'}; +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, loc('Enabled status: [_1]', loc_fuzzy($msg)); + } + + if ($QueueObj->Disabled()) { + $EnabledChecked =""; + } + + my @linkresults; + $m->comp('/Elements/Callback', results => \@linkresults, + RecordObj => $QueueObj, ARGSRef => \%ARGS, + _CallbackName => 'ProcessLinks'); + push @results, @linkresults; +} +</%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/html/Admin/Queues/People.html b/rt/html/Admin/Queues/People.html new file mode 100644 index 000000000..e29b9d34f --- /dev/null +++ b/rt/html/Admin/Queues/People.html @@ -0,0 +1,208 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => loc('Modify people related to queue [_1]', $QueueObj->Name) &> +<& /Admin/Elements/QueueTabs, id => $id, + QueueObj => $QueueObj, + current_tab => $current_tab, + Title => loc('Modify people related to queue [_1]', $QueueObj->Name) &> + +<& /Elements/ListActions, actions => \@results &> + + +<FORM METHOD=POST ACTION="People.html"> +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$QueueObj->Id%>"> + +<TABLE WIDTH=100%> +<TR> +<TD VALIGN=TOP > + +<h3><&|/l&>Current watchers</&></h3> + + +<&|/l&>Cc</&>: + +<& /Admin/Elements/EditQueueWatchers, QueueObj => $QueueObj, Watchers => $QueueObj->Cc &> + +<&|/l&>Administrative Cc</&>: + +<& /Admin/Elements/EditQueueWatchers, QueueObj => $QueueObj, Watchers => $QueueObj->AdminCc &> + + +</TD> +<TD VALIGN=TOP> +<h3><&|/l&>New watchers</&></h3> + +<&|/l&>Find people whose</&><BR> +<& /Elements/SelectUsers &> +<input type=submit name="OnlySearchForPeople" value="<&|/l&>Go!</&>"> +<BR> +<&|/l&>Find groups whose</&><BR> +<& /Elements/SelectGroups &> +<input type=submit name="OnlySearchForGroup" value="<&|/l&>Go!</&>"> + +<p> +<&|/l&>Add new watchers</&>:<br> +<p> +<b><&|/l&>Users</&></b> +% if ($user_msg) { +<br> +<i><%$user_msg%></i> +% } elsif ($Users) { +<ul> +% while (my $u = $Users->Next ) { +<li><&/Elements/SelectWatcherType, Scope=>'queue', Name => +"Queue-AddWatcher-Principal-".$u->PrincipalId &> <%$u->Name%> +(<%$u->RealName%>) +% } +</ul> +% } + +<p> +<b><&|/l&>Groups</&></b> + +% if ($group_msg) { +<br> +<i><%$group_msg%></i> +% } elsif ($Groups) { +<ul> +% while (my $g = $Groups->Next ) { +<li><&/Elements/SelectWatcherType, Scope=>'queue', Name => +"Queue-AddWatcher-Principal-".$g->PrincipalId &> <%$g->Name%> +(<%$g->Description%>) +% } +</ul> +% } + +</TD> +</TR> +</TABLE> + + + + +<& /Elements/Submit, Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), Reset => 1 &> +</form> + +<%INIT> + +my $current_tab; +my ($field, @results, $User, $Users, $Groups, $watcher, $user_msg, $group_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(loc("Couldn't load queue", $id)); +# }}} + +# {{{ Delete deletable watchers + +foreach my $key (keys %ARGS) { + my $id = $QueueObj->Id; + + if (($key =~ /^Queue-$id-DeleteWatcher-Type-(.*?)-Principal-(\d*)$/)) {; + my ($code, $msg) = $QueueObj->DeleteWatcher(Type => $1, + PrincipalId => $2); + push @results, $msg; + } +} +# }}} + +# {{{ Add new watchers +foreach my $key (keys %ARGS) { + #They're in this order because otherwise $1 gets clobbered :/ + if ( ($ARGS{$key} =~ /^(AdminCc|Cc)$/) and + ($key =~ /^Queue-AddWatcher-Principal-(\d*)$/) ) { + $RT::Logger->debug("Adding a watcher $1 to ".$ARGS{$key}."\n"); + my ($code, $msg) = $QueueObj->AddWatcher(Type => $ARGS{$key}, + PrincipalId => $1); + push @results, $msg; + } +} + +# }}} + + + +if (!length $ARGS{'UserString'}) { +$user_msg = loc("No principals selected."); + } +else { + $Users = new RT::Users($session{'CurrentUser'}); + $Users->Limit(FIELD => $ARGS{'UserField'}, + VALUE => $ARGS{'UserString'}, + OPERATOR => $ARGS{'UserOp'}); + } + +if (!length $ARGS{'GroupString'}) { +$group_msg = loc("No principals selected."); + } +else { +$Groups = new RT::Groups($session{'CurrentUser'}); +$Groups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => 'UserDefined'); +$Groups->Limit(FIELD => $ARGS{'GroupField'}, + VALUE => $ARGS{'GroupString'}, + OPERATOR => $ARGS{'GroupOp'}); + } + +$current_tab = 'Admin/Queues/People.html?id='.$QueueObj->id; +</%INIT> + +<%ARGS> +$UserField => 'Name' +$UserOp => '=' +$UserString => undef +$GroupField => 'Name' +$GroupOp => '=' +$GroupString => undef +$Type => undef +$id => undef +</%ARGS> + diff --git a/rt/html/Admin/Queues/Scrip.html b/rt/html/Admin/Queues/Scrip.html new file mode 100644 index 000000000..1223fbfed --- /dev/null +++ b/rt/html/Admin/Queues/Scrip.html @@ -0,0 +1,89 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/QueueTabs, id => $QueueObj->Id, + QueueObj => $QueueObj, + current_tab => 'Admin/Queues/Scrips.html?id='.$QueueObj->id, + current_subtab => $current_subtab, + subtabs => $subtabs, + Title => $title &> + +<& /Admin/Elements/EditScrip, title => $title, %ARGS &> +<%init> +my $QueueObj = new RT::Queue($session{'CurrentUser'}); +$QueueObj->Load($Queue); + +my ($title, $current_subtab); +my $subtabs = { + A => { title => loc('Select scrip'), + path => "Admin/Queues/Scrips.html?id=".$QueueObj->id, + }, + B => { title => loc('New scrip'), + path => "Admin/Queues/Scrip.html?create=1&Queue=".$QueueObj->id, + separator => 1, + }, + }; + +unless($QueueObj->id) { + Abort(loc("Queue [_1] not found",$id)); +} +if ($id) { + $current_subtab = "Admin/Queues/Scrip.html?id=".$id."&Queue=".$QueueObj->id; + $title = loc("Modify a scrip for queue [_1]", $QueueObj->Name); + $subtabs->{"C"} = { title => loc("Scrip #[_1]",$id), + path => "Admin/Queues/Scrip.html?id=$id&Queue=".$QueueObj->id }; +} else { + $current_subtab = "Admin/Queues/Scrip.html?create=1&Queue=".$QueueObj->id; + $title = loc("Create a scrip for queue [_1]", $QueueObj->Name); +} + + +</%init> + +<%ARGS> +$id => undef +$Queue => undef +</%ARGS> diff --git a/rt/html/Admin/Queues/Scrips.html b/rt/html/Admin/Queues/Scrips.html new file mode 100644 index 000000000..e7092fb22 --- /dev/null +++ b/rt/html/Admin/Queues/Scrips.html @@ -0,0 +1,85 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/QueueTabs, id => $QueueObj->id, + QueueObj => $QueueObj, + current_tab => 'Admin/Queues/Scrips.html?id='.$id, + current_subtab => 'Admin/Queues/Scrips.html?id='.$id, + subtabs => $subtabs, + Title => $title &> + +% if (!$QueueObj->Disabled) { # Global scrips does not apply to disabled queues +<h2><&|/l&>Scrips which apply to all queues</&></h2> +<& /Admin/Elements/ListGlobalScrips &> +<BR> +% } +<& /Admin/Elements/EditScrips, title => $title, %ARGS &> +<%init> +my $QueueObj = new RT::Queue($session{'CurrentUser'}); +$QueueObj->Load($id); + +my $title; + +if ($QueueObj->id) { + $title = loc("Modify scrips for queue [_1]", $QueueObj->Name); +} else { + Abort(loc("Queue [_1] not found",$id)); +} + +my $subtabs = { + A => { title => loc('Select scrip'), + path => "Admin/Queues/Scrips.html?id=".$id, + }, + B => { title => loc('New scrip'), + path => "Admin/Queues/Scrip.html?create=1&Queue=".$id, + separator => 1, + } + }; +</%init> + +<%ARGS> +$id => undef #some identifier that a Queue could +</%ARGS> diff --git a/rt/html/Admin/Queues/Template.html b/rt/html/Admin/Queues/Template.html new file mode 100644 index 000000000..c60a90900 --- /dev/null +++ b/rt/html/Admin/Queues/Template.html @@ -0,0 +1,128 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/QueueTabs, id => $Queue, + QueueObj => $QueueObj, + current_tab => 'Admin/Queues/Templates.html?id='.$Queue, + current_subtab => $current_subtab, + subtabs => $subtabs, + Title => $title &> +<& /Elements/ListActions, actions => \@results &> + +<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%>"> +<& /Admin/Elements/ModifyTemplate, Name => $TemplateObj->Name, Description => +$TemplateObj->Description, Content => $TemplateObj->Content &> +<& /Elements/Submit, Label => loc('Create'), Reset => 1 &> +</FORM> + + +<%INIT> + +my $TemplateObj = new RT::Template($session{'CurrentUser'}); +my ($title, @results, $current_subtab); + +my $subtabs = { + A => { title => loc('Select template'), + path => "Admin/Queues/Templates.html?id=$Queue" + }, + B => { title => loc('New template'), + path => "Admin/Queues/Template.html?Create=1&Queue=$Queue", + separator => 1, + } + }; + +if ($Create) { + $title = loc("Create a template"); + $current_subtab = "Admin/Queues/Template.html?Create=1&Queue=".$Queue; +} + +else { + if ($Template eq 'new') { + my ($val, $msg) = $TemplateObj->Create(Queue => $Queue, Name => $Name); + Abort(loc("Could not create template: [_1]", $msg)) unless ($val); + push @results, $msg; + } + else { + $TemplateObj->Load($Template) || Abort(loc('No Template')); + } + $title = loc('Modify template [_1]', loc($TemplateObj->Name())); + + +} +my $QueueObj; +if ($TemplateObj->Id()) { + $Queue = $TemplateObj->Queue; + $QueueObj = $TemplateObj->QueueObj; + + my @attribs = qw( Description Content Queue Name); + my @aresults = UpdateRecordObject( AttributesRef => \@attribs, + Object => $TemplateObj, + ARGSRef => \%ARGS); + $current_subtab = "Admin/Queues/Template.html?Queue=$Queue&Template=".$TemplateObj->Id(); + $subtabs->{"C"} = { title => loc('Template #[_1]', $TemplateObj->Id()), + path => "Admin/Queues/Template.html?Queue=$Queue&Template=".$TemplateObj->Id(), + }; + push @results, @aresults; +} else { + $QueueObj = RT::Queue->new($session{'CurrentUser'}); + $QueueObj->Load($Queue); +} + +</%INIT> +<%ARGS> +$Queue => undef +$Template => undef +$Create => undef +$Name => undef +</%ARGS> diff --git a/rt/html/Admin/Queues/Templates.html b/rt/html/Admin/Queues/Templates.html new file mode 100644 index 000000000..888fdbc8a --- /dev/null +++ b/rt/html/Admin/Queues/Templates.html @@ -0,0 +1,79 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/QueueTabs, id => $QueueObj->id, + current_tab => 'Admin/Queues/Templates.html?id='.$id, + current_subtab => 'Admin/Queues/Templates.html?id='.$id, + QueueObj => $QueueObj, + subtabs => $subtabs, + Title => $title &> + +<& /Admin/Elements/EditTemplates, title => $title, %ARGS &> + +<%INIT> +my $QueueObj = new RT::Queue($session{'CurrentUser'}); +$QueueObj->Load($id); + +my ($title, $current_subtab); + +if ($QueueObj->id) { + $title = loc("Edit Templates for queue [_1]", $QueueObj->Name); +} else { + Abort(loc("Queue [_1] not found",$id)); +} +my $subtabs = { + A => { title => loc('Select template'), + path => "Admin/Queues/Templates.html?id=".$id, + }, + B => { title => loc('New template'), + path => "Admin/Queues/Template.html?Create=1&Queue=".$id, + } + }; + +</%INIT> +<%ARGS> +$id => undef #some identifier that a Queue could +</%ARGS> diff --git a/rt/html/Admin/Queues/UserRights.html b/rt/html/Admin/Queues/UserRights.html new file mode 100644 index 000000000..399992ae2 --- /dev/null +++ b/rt/html/Admin/Queues/UserRights.html @@ -0,0 +1,112 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => loc('Modify user rights for queue [_1]', $QueueObj->Name) &> +<& /Admin/Elements/QueueTabs, id => $id, + QueueObj => $QueueObj, + current_tab => $current_tab, + Title => loc('Modify user rights for queue [_1]', $QueueObj->Name) &> +<& /Elements/ListActions, actions => \@results &> + + <FORM METHOD=POST ACTION="UserRights.html"> + <INPUT TYPE=HIDDEN NAME=id VALUE="<% $QueueObj->id %>"> + + +<TABLE> +<& /Elements/Callback, QueueObj => $QueueObj, results => \@results, %ARGS &> +% while (my $Member = $Users->Next()) { +% my $UserObj = $Member->MemberObj->Object(); +% my $group = RT::Group->new($session{'CurrentUser'}); +% $group->LoadACLEquivalenceGroup($Member->MemberObj); + <TR ALIGN=RIGHT> + <TD VALIGN=TOP> + <% $UserObj->Name %> + </TD> + <TD> + <& /Admin/Elements/SelectRights, PrincipalId=> $group->PrincipalId, + Object => $QueueObj &> + </TD> + </TR> +% } + </TABLE> + + <& /Elements/Submit, Label => loc('Modify User Rights'), Reset => 1 &> + + </FORM> + +<%INIT> + + #Update the acls. + my @results = ProcessACLChanges(\%ARGS); + +# {{{ Deal with setting up the display of current rights. + + + +if (!defined $id) { + Abort(loc("No Queue defined")); +} + +my $QueueObj = RT::Queue->new($session{'CurrentUser'}); +$QueueObj->Load($id) || Abort(loc("Couldn't load queue [_1]",$id)); + +# Find out which users we want to display ACL selects for +my $Privileged = RT::Group->new($session{'CurrentUser'}); +$Privileged->LoadSystemInternalGroup('Privileged'); +my $Users = $Privileged->MembersObj(); + + + +# }}} +my $current_tab; +$current_tab = 'Admin/Queues/UserRights.html?id='.$QueueObj->id; +</%INIT> + +<%ARGS> +$id => undef +$UserString => undef +$UserOp => undef +$UserField => undef +</%ARGS> diff --git a/rt/html/Admin/Queues/index.html b/rt/html/Admin/Queues/index.html new file mode 100644 index 000000000..28adf531c --- /dev/null +++ b/rt/html/Admin/Queues/index.html @@ -0,0 +1,84 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => loc("Admin queues") &> +<& /Admin/Elements/QueueTabs, current_tab => 'Admin/Queues/', + current_subtab => 'Admin/Queues/', + Title => loc("Admin queues") &> + + + +<h1><%$caption%></h1> +<p><&|/l&>Select a queue</&>:</p> +<UL> +%if ($queues->Count == 0) { +<li><i><&|/l&>No queues matching search criteria found.</&></i></li> +% } +%while ( $queue = $queues->Next) { +<li><A HREF="Modify.html?id=<%$queue->id%>"><%$queue->Name%></a></li> +%} +</UL> +<BR> +<FORM METHOD=POST ACTION="<% $RT::WebPath %>/Admin/Queues/index.html"> +<input type="checkbox" name="FindDisabledQueues" value="1"> <&|/l&>Include disabled queues in listing.</&> +<div align=right><input type=submit value="<&|/l&>Go!</&>"></div> +</FORM> + +<%INIT> +my ($queue, $caption); +my $queues = new RT::Queues($session{'CurrentUser'}); +$queues->UnLimit(); + +if ($FindDisabledQueues) { + $caption = loc("All Queues"); + $queues->{'find_disabled_rows'} = 1; +} else { + $caption = loc("Enabled Queues"); +} + +</%INIT> +<%ARGS> +$FindDisabledQueues => 0 +</%ARGS> diff --git a/rt/html/Admin/Tools/Configuration.html b/rt/html/Admin/Tools/Configuration.html new file mode 100644 index 000000000..bc5ca69a1 --- /dev/null +++ b/rt/html/Admin/Tools/Configuration.html @@ -0,0 +1,98 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%init> +require Module::Versions::Report; +my $title = loc('System Configuration'); +unless ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser')) { + Abort(loc('This feature is only available to system administrators')); +} + + +</%init> +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/ToolTabs, + current_tab => 'Admin/Tools/Configuration.html', + current_subtab => 'Admin/Tools/Configuration.html', + Title => $title &> + + + + +<h2><&|/l&>Loaded perl modules</&></h2> +<pre> +% my $report = Module::Versions::Report::report(); +% my @report = grep { /v\d/ } split("\n",$report); +<%join('<br>', @report)|n%> + + +</pre> + +<h2><&|/l&>RT Variables</&></h2> +<table> +%{ +%no strict qw/refs/; + +%foreach my $key (sort keys %{*RT::}) { +% next unless (${'RT::'.$key} ); +% next if (ref ${'RT::'.$key} ); +<tr><td>RT::<%$key%></td> +<td> +% if ($key =~ /Password(?!Length)/i) { +<i>Password not printed</i> +% } else { +<%${'RT::'.$key} %> +% } +</td> +</tr> +% } +%} +</table> + +<h2><&|/l&>Perl configuration</&></h2> +% require Config; +<pre> +<%Config::myconfig()%> +</pre> diff --git a/rt/html/Admin/Tools/index.html b/rt/html/Admin/Tools/index.html new file mode 100644 index 000000000..49cfac3ee --- /dev/null +++ b/rt/html/Admin/Tools/index.html @@ -0,0 +1,53 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%init> +my $title = loc('System Tools'); +</%init> +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/ToolTabs, + current_tab => 'Admin/Tools/index.html', + current_subtab => 'Admin/Tools/Configuration.html', + Title => $title &> diff --git a/rt/html/Admin/Users/CustomFields.html b/rt/html/Admin/Users/CustomFields.html new file mode 100644 index 000000000..5662c6c16 --- /dev/null +++ b/rt/html/Admin/Users/CustomFields.html @@ -0,0 +1,69 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/UserTabs, + id => $Object->id, + current_tab => "Admin/Users/CustomFields.html?$id=".$id, + current_subtab => "Admin/Users/CustomFields.html?id=".$id, + UserObj => $Object, + Title => $title + &> + + <& /Admin/Elements/EditCustomFields, %ARGS, title => $title, Object => $Object, ObjectType => 'RT::User' &> +<%INIT> +my $Object = RT::User->new( $session{'CurrentUser'} ); + +$Object->Load($id) || Abort( loc( "Couldn't load object [_1]", $id ) ); +my $FriendlySubTypes = + RT::CustomField->new( $session{'CurrentUser'} ) + ->FriendlyLookupType( $Object->CustomFieldLookupType ); + +my $title = loc( 'Edit Custom Fields for [_1]', $Object->Name ); + +</%INIT> +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/html/Admin/Users/History.html b/rt/html/Admin/Users/History.html new file mode 100644 index 000000000..024a90b00 --- /dev/null +++ b/rt/html/Admin/Users/History.html @@ -0,0 +1,66 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/UserTabs, + id => $id, + UserObj => $UserObj, + current_tab => $current_tab, + Title => $title &> + +<& /Ticket/Elements/ShowHistory, + Ticket => $UserObj, + ShowHeaderModes => 0, +&> + +<%INIT> +my $current_tab = 'Admin/Users/History.html?id='.$id; +my $UserObj = new RT::User($session{'CurrentUser'}); +$UserObj->Load($id) || Abort("Couldn't load user '$id'"); +my $title = loc("History of the user [_1]", $UserObj->Name); +</%INIT> +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/html/Admin/Users/Memberships.html b/rt/html/Admin/Users/Memberships.html new file mode 100644 index 000000000..3e632393f --- /dev/null +++ b/rt/html/Admin/Users/Memberships.html @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/UserTabs, + id => $id, + UserObj => $UserObj, + current_tab => $current_tab, + Title => $title &> + +<h2><&|/l&>Groups</&></h2> + +<& /Elements/ShowMemberships, UserObj => $UserObj &> + +<%INIT> +my $UserObj = RT::User->new($session{'CurrentUser'}); +$UserObj->Load($id) || Abort("Couldn't load user '$id'"); +my $title = loc("Memberships of the user [_1]", $UserObj->Name); +my $current_tab = 'Admin/Users/Memberships.html?id='.$id; +</%INIT> +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/html/Admin/Users/Modify.html b/rt/html/Admin/Users/Modify.html new file mode 100644 index 000000000..8a24f9c4a --- /dev/null +++ b/rt/html/Admin/Users/Modify.html @@ -0,0 +1,421 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/UserTabs, + id => $id, + UserObj => $UserObj, + current_tab => $current_tab, + Title => $title &> + +<& /Elements/ListActions, actions => \@results &> + +<FORM ACTION="<%$RT::WebPath%>/Admin/Users/Modify.html" METHOD=POST ENCTYPE="multipart/form-data"> +%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 class="boxcontainer"> +<& /Elements/TitleBoxStart, title => loc('Identity') &> + +<TABLE> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Username</&>: +</TD><TD> +<input name="Name" value="<%$UserObj->Name%>"> <b><&|/l&>(required)</&></b> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Email</&>: +</TD><TD> +<input name="EmailAddress" value="<%$UserObj->EmailAddress%>"> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Real Name</&>: +</TD><TD> +<input name="RealName" value="<%$UserObj->RealName%>"> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Nickname</&>: +</TD><TD> +<input name="NickName" value="<%$UserObj->NickName%>"> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Unix login</&>: +</TD><TD> +<input name="Gecos" value="<%$UserObj->Gecos%>"> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Language</&>: +</TD><TD> +<& /Elements/SelectLang, Name => 'Lang', Default => $UserObj->Lang &> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Extra info</&>: +</TD><TD> +<textarea name="FreeformContactInfo" cols=20 rows=5><%$UserObj->FreeformContactInfo%></TEXTAREA> +</TD></TR> +</TABLE> +<& /Elements/TitleBoxEnd &> +<br> +<& /Elements/TitleBoxStart, title => loc('Access control') &> +<INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1"> +<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> +<&|/l&>Let this user access RT</&><BR> + + +<INPUT TYPE=HIDDEN NAME="SetPrivileged" VALUE="1"> +<INPUT TYPE=CHECKBOX NAME="Privileged" VALUE="1" <%$PrivilegedChecked%>> <&|/l&>Let this user be granted rights</&><BR> + +% unless ($RT::WebExternalAuth and !$RT::WebFallbackToInternalAuth) { +<TABLE> +<TR> +<TD ALIGN=RIGHT> +<&|/l&>New Password</&>: +</TD> +<TD ALIGN=LEFT> +<input type=password name="Pass1"> +</TD> +</TR> +<TR><TD ALIGN=RIGHT> +<&|/l&>Retype Password</&>: +</TD> +<TD> +<input type=password name="Pass2"> +</TD> +</TR> +</TABLE> +% } +<& /Elements/TitleBoxEnd &> +</TD> + +<TD VALIGN=TOP class="boxcontainer"> +<& /Elements/TitleBoxStart, title => loc('Location') &> +<TABLE> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Organization</&>: +</TD><TD> +<input name="Organization" value="<%$UserObj->Organization%>"> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Address1</&>: +</TD><TD> +<input name="Address1" value="<%$UserObj->Address1%>"> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Address2</&>: +</TD><TD> +<input name="Address2" value="<%$UserObj->Address2%>"> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>City</&>: +</TD><TD> +<input name="City" value="<%$UserObj->City%>" size=14> + +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>State</&>: +</TD><TD> +<input name="State" value="<%$UserObj->State%>" size=3> + +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Zip</&>: +</TD><TD> +<input name="Zip" value="<%$UserObj->Zip%>" size=9> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Country</&>: +</TD><TD> +<input name="Country" value="<%$UserObj->Country%>"> +</TD></TR> +</TABLE> +<& /Elements/TitleBoxEnd &> +<br> +<& /Elements/TitleBoxStart, title => loc('Phone numbers') &> +<TABLE> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Residence</&>: +</TD><TD> +<input name="HomePhone" value="<%$UserObj->HomePhone%>" size=13><br> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Work</&>: +</TD><TD> +<input name="WorkPhone" value="<%$UserObj->WorkPhone%>" size=13><br> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Mobile</&>: +</TD><TD> +<input name="MobilePhone" value="<%$UserObj->MobilePhone%>" size=13><br> +</TD></TR> +<TR><TD ALIGN="RIGHT"> +<&|/l&>Pager</&>: +</TD><TD> +<input name="PagerPhone" value="<%$UserObj->PagerPhone%>" size=13><br> +<& /Elements/TitleBoxEnd &> +</TD> + +<TR> +</TR> +</TABLE> +<BR> +<& /Elements/TitleBoxStart, title => loc('Custom Fields') &> +<TABLE> +% my $CFs = $UserObj->CustomFields; +% while (my $CF = $CFs->Next) { +<TR VALIGN="TOP"><TD ALIGN="RIGHT"> +<% $CF->Name %>: +</TD><TD> +<& /Elements/EditCustomField, %ARGS, Object => $UserObj, CustomField => $CF &> +</TD></TR> +% } +<TR> +</TR> +</TABLE> +<& /Elements/TitleBoxEnd &> +<TR> +<TD colspan="2"> +<& /Elements/TitleBoxStart, title => loc('Comments about this user') &> +<TEXTAREA class="comments" name="Comments" COLS=80 ROWS=5 WRAP=VIRTUAL><%$UserObj->Comments%></TEXTAREA> +<& /Elements/TitleBoxEnd &> +%if ($UserObj->Privileged) { +<BR> +<& /Elements/TitleBoxStart, title => loc('Signature') &> +<TEXTAREA class="signature" COLS=80 ROWS=5 name="Signature" WRAP=HARD><%$UserObj->Signature%></TEXTAREA> +<& /Elements/TitleBoxEnd &> +% } + +</TD> +</TR> +</TABLE> + +<& /Elements/Submit, Label => loc('Save Changes') &> +</form> + +<%INIT> + +my $current_tab; +my $UserObj = new RT::User($session{'CurrentUser'}); +my ($title, $PrivilegedChecked, $EnabledChecked, $Disabled, $result, @results); + +my ($val, $msg); + +if ($Create) { + $current_tab = 'Admin/Users/Modify.html?Create=1'; + $title = loc("Create a new user"); +} +else { + + $current_tab = 'Admin/Users/Modify.html?id='.$id; + if ($id eq 'new') { + ( $val, $msg ) = $UserObj->Create( + Name => $Name, + EmailAddress => $ARGS{'EmailAddress'}, + Name => $ARGS{'Name'}, + Comments => $ARGS{'Comments'}, + Signature => $ARGS{'Signature'}, + EmailAddress => $ARGS{'EmailAddress'}, + FreeformContactInfo => $ARGS{'FreeformContactInfo'}, + Organization => $ARGS{'Organization'}, + RealName => $ARGS{'RealName'}, + NickName => $ARGS{'NickName'}, + Lang => $ARGS{'Lang'}, + EmailEncoding => $ARGS{'EmailEncoding'}, + WebEncoding => $ARGS{'WebEncoding'}, + ExternalContactInfoId => $ARGS{'ExternalContactInfoId'}, + ContactInfoSystem => $ARGS{'ContactInfoSystem'}, + Gecos => $ARGS{'Gecos'}, + ExternalAuthId => $ARGS{'ExternalAuthId'}, + AuthSystem => $ARGS{'AuthSystem'}, + HomePhone => $ARGS{'HomePhone'}, + WorkPhone => $ARGS{'WorkPhone'}, + MobilePhone => $ARGS{'MobilePhone'}, + PagerPhone => $ARGS{'PagerPhone'}, + Address1 => $ARGS{'Address1'}, + Address2 => $ARGS{'Address2'}, + City => $ARGS{'City'}, + State => $ARGS{'State'}, + Zip => $ARGS{'Zip'}, + Country => $ARGS{'Country'}, + Privileged => $ARGS{'Privileged'}, + Disabled => ($ARGS{'Enabled'} ? 0 : 1) + ); + + if ($val) { + push @results, $msg; + } else { + push @results, loc('User could not be created: [_1]', $msg); + } + } else { + $UserObj->Load($id) || $UserObj->Load($Name) || Abort("Couldn't load user '$Name'"); + $val = $UserObj->Id(); + } + + if ($val) { + $title = loc("Modify the user [_1]", $UserObj->Name); + } + + # If the create failed + else { + $title = loc("Create a new user"); + $Create = 1; + } +} + + + + +# If we have a user to modify, lets try. +if ($UserObj->Id && $id ne 'new') { + + 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); + push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $UserObj ); + + + # {{{ Deal with special fields: Privileged, Enabled + if ( $SetPrivileged and $Privileged != $UserObj->Privileged ) { + my ($code, $msg) = $UserObj->SetPrivileged($Privileged); + push @results, loc('Privileged status: [_1]', loc_fuzzy($msg)); + } + + #we're asking about enabled on the web page but really care about disabled. + $Disabled = $Enabled ? 0 : 1; + + if ( ($SetEnabled) and ( $Disabled != $UserObj->Disabled) ) { + my ($code, $msg) = $UserObj->SetDisabled($Disabled); + push @results, loc('Enabled status [_1]', loc_fuzzy($msg)); + } + + + # }}} +} + +if ( $UserObj->Id ) { + my $password_not_set; + # Deal with Password field + if ( !$Pass1 and !$Pass2 ) { + $password_not_set = 1; + } elsif ( $Pass1 ne $Pass2 ) { + $password_not_set = 1; + push @results, loc("Passwords do not match."); + } elsif ( $Pass1 eq $Pass2 and !$UserObj->IsPassword($Pass1) ) { + my ($code, $msg) = $UserObj->SetPassword($Pass1); + push @results, loc_fuzzy($msg); + $password_not_set = 1 unless $code; + } + if ($id eq 'new' and $password_not_set) { + push @results, loc("A password was not set, so user won't be able to login."); + } +} + + +# {{{ Do some setup for the ui +unless ($UserObj->Disabled()) { + $EnabledChecked ="CHECKED"; +} + +if ($UserObj->Privileged()) { + $PrivilegedChecked = "CHECKED"; +} + +# }}} + +# set the id, so the the menu will have the right info, this needs to +# be done here to avoid creating and then modifying a user +$id = $UserObj->Id; + +</%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/html/Admin/Users/index.html b/rt/html/Admin/Users/index.html new file mode 100644 index 000000000..1bbe867f7 --- /dev/null +++ b/rt/html/Admin/Users/index.html @@ -0,0 +1,113 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => loc('Select a user') &> +<& /Admin/Elements/UserTabs, current_tab => 'Admin/Users/', + current_subtab => 'Admin/Users/', + Title => loc('Select a user') &> + +<h1><%$caption%></h1> +<p><&|/l&>Select a user</&>:</p> +<ul> +%if ($users->Count == 0) { +<li><i><&|/l&>No users matching search criteria found.</&></i></li> +% } +%my @ids; +%while ( $user = $users->Next) { +% push @ids, $user->Id; +<LI><A HREF="Modify.html?id=<%$user->id%>"><%$user->Name || loc('(no name listed)')%></a></LI> +%} +</UL> +%if (my $ids = join(',', @ids)) { +<em>(<a href="<%$RT::WebPath%>/Download/Tabular/User/<% $ids %>/Users.tsv"><&|/l&>Download as a tab-delimited file</&></a>)</em><br> +%} + +<br><br> +<FORM METHOD=POST ACTION="<% $RT::WebPath %>/Admin/Users/index.html"> + +<&|/l&>Find people whose</&> <& /Elements/SelectUsers &><BR> +<input type="checkbox" name="FindDisabledUsers" value="1"> <&|/l&>Include disabled users in search.</&> +<BR> +<div align=right><input type=submit value="<&|/l&>Go!</&>"></div> +</FORM> + +<%INIT> +my ($user, $caption); +my $users = new RT::Users($session{'CurrentUser'}); + +if ($FindDisabledUsers) { + $users->{'find_disabled_rows'} = 1; +} + +if (length $UserString) { + $caption = loc("Users matching search criteria"); + if ($UserField =~ /^CustomField-(\d+)/) { + $users->LimitCustomField( + CUSTOMFIELD => $1, + OPERATOR => $UserOp, + VALUE => $UserString, + ); + } + else { + $users->Limit( + FIELD => $UserField, + OPERATOR => $UserOp, + VALUE => $UserString, + ); + } +} +else { + $caption = loc("Privileged users"); + $users->LimitToPrivileged; +} +</%INIT> +<%ARGS> +$UserString => undef +$UserOp => '=' +$UserField => 'Name' +$IdLike => undef +$EmailLike => undef +$FindDisabledUsers => 0 +</%ARGS> diff --git a/rt/html/Admin/autohandler b/rt/html/Admin/autohandler new file mode 100644 index 000000000..def61010a --- /dev/null +++ b/rt/html/Admin/autohandler @@ -0,0 +1,51 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%init> +$m->call_next(%ARGS) if $session{'CurrentUser'}->UserObj->HasRight( + Right => 'ShowConfigTab', + Object => $RT::System, +); +</%init>
\ No newline at end of file diff --git a/rt/html/Admin/index.html b/rt/html/Admin/index.html new file mode 100644 index 000000000..01ba24d2d --- /dev/null +++ b/rt/html/Admin/index.html @@ -0,0 +1,99 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices), +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.), +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Admin/Elements/Header, Title => loc('RT Administration') &> +<& /Admin/Elements/Tabs, Title => loc('RT Administration') &> + +<ul> +% foreach my $key (sort keys %$tabs) { +<li><font size="+2"><a href="<%$RT::WebPath%>/<%$tabs->{$key}->{'path'}|n %>"><%$tabs->{$key} ->{'title'}%></a></font><br> +<%$tabs->{$key}->{description}%> +</li> +%} +</ul> +<%init> + + + +my $tabs = { + A => { + title => loc('Users'), + path => 'Admin/Users/index.html', + description => loc('Manage users and passwords'), + }, + B => { + title => loc('Groups'), + path => 'Admin/Groups/index.html', + description => loc('Manage groups and group membership'), + }, + C => { + title => loc('Queues'), + path => 'Admin/Queues/index.html', + description => loc('Manage queues and queue-specific properties'), + }, + D => { + 'title' => loc('Custom Fields'), + description => loc('Manage custom fields and custom field values'), + path => 'Admin/CustomFields/index.html', + }, + E => { + 'title' => loc('Global'), + path => 'Admin/Global/index.html', + description => + loc('Manage properties and configuration which apply to all queues'), + }, + F => { + 'title' => loc('Tools'), + path => 'Admin/Tools/index.html', + description => loc('Use other RT administrative tools') + }, +}; + + $m->comp('/Elements/Callback', tabs => $tabs, %ARGS); + + + + +</%init> diff --git a/rt/html/Approvals/Display.html b/rt/html/Approvals/Display.html new file mode 100644 index 000000000..d9d6df582 --- /dev/null +++ b/rt/html/Approvals/Display.html @@ -0,0 +1,72 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => $title &> + +<& Elements/Tabs, + current_tab => "Approvals/Display.html", + Title => $title &> +<form method=post action="<%$RT::WebPath%>/Approvals/index.html"> + +<& /Elements/TitleBoxStart, title => $title &> +<& /Ticket/Elements/ShowHistory , Ticket => $Ticket, Collapsed => 0, ShowTitle => 0, ShowHeaders => 0, ShowDisplayModes => 0, ShowTitleBarCommands => 0 &> +<hr> +<table width=100%> +<& Elements/Approve, ticket => $Ticket, ShowApproving => 0 &> +</table> +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit&> +</form> +<& Elements/ShowDependency, Ticket => $Ticket &> + +<%init> +my $Ticket = LoadTicket($id); + +my $title = loc("Approval #[_1]: [_2]", $Ticket->Id, $Ticket->Subject); + +</%init> +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/html/Approvals/Elements/Approve b/rt/html/Approvals/Elements/Approve new file mode 100644 index 000000000..bf786fb03 --- /dev/null +++ b/rt/html/Approvals/Elements/Approve @@ -0,0 +1,78 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<tr bgcolor="#b9b9ff"> +<td colspan=2><font size="3"> +<a href="<%$RT::WebPath%>/Approvals/Display.html?id=<%$ticket->Id%>"><% loc("#[_1]: [_2]", $ticket->Id, $ticket->Subject) %></a> (<%loc($ticket->Status)%>)</font></td> +</tr> +% if ($ShowApproving) { +% foreach my $approving ( $ticket->AllDependedOnBy( Type => 'ticket' ) ) { +<tr bgcolor="#e9e9e9"> +<td colspan=2> +<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<% $approving->Id %>"><&|/l, $approving->Id, $approving->Subject &>Originating ticket: #[_1]</&></a> +</td> +</tr> +<tr><td colspan=2> +<& /Ticket/Elements/ShowCustomFields, Ticket => $approving &> +<& /Ticket/Elements/ShowHistory, Ticket => $approving, Collapsed => 0, ShowTitle => 0, ShowHeaders => 0, ShowDisplayModes => 0, ShowTitleBarCommands => 0 &> +</td></tr> +% } +% } +<tr <%$class && "class=\"$class\""%>> +<td valign=top> +<input type="radio" name="Approval-<%$ticket->Id%>-Action" value="approve"><&|/l&>Approve</&><br> +<input type="radio" name="Approval-<%$ticket->Id%>-Action" value="deny"><&|/l&>Deny</&><br> +<input type="radio" name="Approval-<%$ticket->Id%>-Action" value="none" checked><&|/l&>No action</&> +</td> +<td> +<&|/l&>Notes</&><br> +<textarea name="Approval-<%$ticket->Id%>-Notes" rows=2 cols=70></textarea> +</td> +</tr> +<%ARGS> +$ShowApproving => 1 +$ticket => undef +$class => undef +</%ARGS> diff --git a/rt/html/Approvals/Elements/PendingMyApproval b/rt/html/Approvals/Elements/PendingMyApproval new file mode 100644 index 000000000..f13ddf0f3 --- /dev/null +++ b/rt/html/Approvals/Elements/PendingMyApproval @@ -0,0 +1,109 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<table width="100%"> +% my ($i, $class); +% my %done; +% foreach ($tickets, $group_tickets) { +% while (my $ticket = $_->Next() ) { +% next if !$ARGS{'ShowDependent'} and $ticket->HasUnresolvedDependencies( Type => 'approval' ); +% next if $done{$ticket->Id}++; # don't show duplicate tickets +% $i++; +% $class = ($i%2) ? "oddline" : "evenline"; +<& Approve, ticket => $ticket, class => $class &> +% } +% } +</table> + +<& /Elements/TitleBoxStart, title => loc("Search for approvals") &> +<input type=checkbox value="1" name="ShowPending" + <%((!$ARGS{'ShowRejected'} && !$ARGS{'ShowResolved'}) || + $ARGS{'ShowPending'}) + && "checked"%>> <&|/l&>Show pending requests</&><br> +<input type=checkbox value="1" name="ShowResolved" <%$ARGS{'ShowResolved'} && "checked"%>> <&|/l&>Show approved requests</&><br> +<input type=checkbox value="1" name="ShowRejected" <%$ARGS{'ShowRejected'} && "checked"%>> <&|/l&>Show denied requests</&><br> +<input type=checkbox value="1" name="ShowDependent" <%$ARGS{'ShowDependent'} && "checked"%>> <&|/l&>Show requests awaiting other approvals</&><br> + +<&|/l,"<input size='15' value='".($created_before->Unix > 0 &&$created_before->ISO)."' name='CreatedBefore'>"&>Only show approvals for requests created before [_1]</&><br> + +<&|/l, "<input size='15' value='".( $created_after->Unix >0 && $created_after->ISO)."' name='CreatedAfter'>"&>Only show approvals for requests created after [_1]</&> +<& /Elements/TitleBoxEnd &> + +<%init> +my $tickets = RT::Tickets->new( $session{'CurrentUser'} ); +$tickets->LimitOwner( VALUE => $session{'CurrentUser'}->Id ); + +# also consider AdminCcs as potential approvers. +my $group_tickets = RT::Tickets->new( $session{'CurrentUser'} ); + +my $created_before = RT::Date->new( $session{'CurrentUser'} ); +my $created_after = RT::Date->new( $session{'CurrentUser'} ); + +foreach ($tickets, $group_tickets) { + $_->Limit( FIELD => 'Type', VALUE => 'approval' ); + + if ( $ARGS{'ShowResolved'} ) { + $_->LimitStatus( VALUE => 'resolved' ); + } + if ( $ARGS{'ShowRejected'} ) { + $_->LimitStatus( VALUE => 'rejected' ); + } + if ( $ARGS{'ShowPending'} || ( !$ARGS{'ShowRejected'} && !$ARGS{'Resolved'} ) ) { + $_->LimitStatus( VALUE => 'open' ); + $_->LimitStatus( VALUE => 'new' ); + $_->LimitStatus( VALUE => 'stalled' ); + } + + if ( $ARGS{'CreatedBefore'} ) { + $created_before->Set( Format => 'unknown', Value => $ARGS{'CreatedBefore'} ); + $_->LimitCreated( OPERATOR => "<=", VALUE => $created_before->ISO ); + } + if ( $ARGS{'CreatedAfter'} ) { + $created_after->Set( Format => 'unknown', Value => $ARGS{'CreatedAfter'} ); + $_->LimitCreated( OPERATOR => ">=", VALUE => $created_after->ISO ); + } +} + +</%init> diff --git a/rt/html/Approvals/Elements/ShowDependency b/rt/html/Approvals/Elements/ShowDependency new file mode 100644 index 000000000..e8d0b00d5 --- /dev/null +++ b/rt/html/Approvals/Elements/ShowDependency @@ -0,0 +1,107 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% my $approving = $Ticket->DependedOnBy(); +% if ($approving->Count) { +<h3><&|/l&>Tickets which depend on this approval:</&></h3> + +<table width=100%> +<TR> +<TD WIDTH="25" bgcolor="#999999"> </TD><TD> +<%PERL> +my %show; +while (my $link = $approving->Next()) { + next unless ($link->BaseURI->IsLocal()); + my $text = '<a name="' . $link->BaseObj->Id . '">'; + my $head = ''; + my $type = $link->BaseObj->Type; + my $dep = $m->scomp('ShowDependency', Ticket => $link->BaseObj, _seen => $_seen); + + if ($type eq 'approval') { + $head .= $m->scomp('/Elements/TitleBoxStart', title => loc("Approval #[_1]: [_2]", $link->BaseObj->Id, $link->BaseObj->Subject)); + $text .= $head; + $text .= $m->scomp('/Ticket/Elements/ShowCustomFields', Ticket => $link->BaseObj); + } elsif ($type eq 'ticket') { + $head .= $m->scomp('/Elements/TitleBoxStart', title => loc("Ticket #[_1]: [_2]", $link->BaseObj->Id, $link->BaseObj->Subject)); + $text .= $head; + $text .= $m->scomp('/Ticket/Elements/ShowSummary', Ticket => $link->BaseObj); + } else { + $head .= $m->scomp('/Elements/TitleBoxStart', title => loc("#[_1]: [_2]", $link->BaseObj->Id, $link->BaseObj->Subject)); + $text .= $head; + } + + $text .= $m->scomp('/Ticket/Elements/ShowHistory' , Ticket => $link->BaseObj, Collapsed => ($type ne 'ticket'), ShowTitle => 0, ShowHeaders => 0, ShowDisplayModes => 0, ShowTitleBarCommands => 0); + + $head .= $m->scomp('/Elements/TitleBoxEnd'); + $text .= $m->scomp('/Elements/TitleBoxEnd'); + $text .= $dep; + $text .= '</a>'; + $show{$link->BaseObj->Id} = { + text => $text, + head => $head, + }; +} + +my $refer; +foreach my $id (sort keys %show) { + if ($_seen->{$id}++) { + $refer .= "<a href='#txn-$id'>" . $show{$id}{head} . "</a>"; + next; + } + + $m->print($show{$id}{text}); +} +$m->print($refer); + +</%PERL> +</TD> +</TR> +</TABLE> + +% } +<%ARGS> +$Ticket +$_seen => {} +</%ARGS> diff --git a/rt/html/Approvals/Elements/Tabs b/rt/html/Approvals/Elements/Tabs new file mode 100644 index 000000000..03bdc262e --- /dev/null +++ b/rt/html/Approvals/Elements/Tabs @@ -0,0 +1,56 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Tabs, + tabs => $tabs, + current_toptab => 'Approvals/', + current_tab => $current_tab, + Title => $Title &> + +<%ARGS> +$tabs => undef +$current_tab => undef +$Title => undef +</%ARGS> diff --git a/rt/html/Approvals/index.html b/rt/html/Approvals/index.html new file mode 100644 index 000000000..88c277c1e --- /dev/null +++ b/rt/html/Approvals/index.html @@ -0,0 +1,88 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => loc("My approvals") &> +<& /Approvals/Elements/Tabs, Title => loc("My approvals") &> + +<& /Elements/ListActions, actions => \@actions &> +<form method="post"> +<& Elements/PendingMyApproval, %ARGS &> +<& /Elements/Submit, Label => loc('Show Approvals') &> +</form> +<%init> + +my (@actions); +foreach my $arg ( keys %ARGS ) { + + next unless ( $arg =~ /Approval-(\d+)-Action/ ); + + my ( $notesval, $notesmsg ); + + my $ticket = LoadTicket($1); + + if ( $ARGS{ "Approval-" . $ticket->Id . "-Notes" } ) { + my $notes = MIME::Entity->build( + Data => [ $ARGS{ "Approval-" . $ticket->Id . "-Notes" } ] + ); + RT::I18N::SetMIMEEntityToUTF8($notes); # convert text parts into utf-8 + + my ( $notesval, $notesmsg ) = $ticket->Correspond( MIMEObj => $notes ); + if ($notesval) { + push ( @actions, loc("Approval #[_1]: Notes recorded",$ticket->Id )); + } else { + push ( @actions, loc("Approval #[_1]: Notes not recorded due to a system error",$ticket->Id )); + } + } + + my ($val, $msg); + if ( $ARGS{$arg} eq 'deny' ) { + ( $val, $msg ) = $ticket->SetStatus('rejected'); + } + elsif ( $ARGS{$arg} eq 'approve' ) { + ( $val, $msg ) = $ticket->SetStatus('resolved'); + } + push ( @actions, loc("Approval #[_1]: [_2]",$ticket->id, $msg )) if ($msg); +} +</%init> diff --git a/rt/html/Download/CustomFieldValue/dhandler b/rt/html/Download/CustomFieldValue/dhandler new file mode 100644 index 000000000..521968024 --- /dev/null +++ b/rt/html/Download/CustomFieldValue/dhandler @@ -0,0 +1,75 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%perl> +my $id; +my $arg = $m->dhandler_arg; # get rest of path +if ($arg =~ /^(\d+)\//) { + $id = $1; +} +else { + Abort("Corrupted customfieldvalue URL."); +} +my $OCFV = RT::ObjectCustomFieldValue->new($session{'CurrentUser'}); +$OCFV->Load($id) || Abort("OCFV '$id' could not be loaded"); + +unless ($OCFV->id) { + Abort("Bad OCFV id. Couldn't find OCFV '$id'\n"); +} + +my $content_type = $OCFV->ContentType || 'text/plain'; + +unless ($RT::TrustHTMLAttachments) { + $content_type = 'text/plain' if ($content_type =~ /^text\/html/i); +} + +$r->content_type( $content_type ); +$m->clear_buffer(); +$m->out($OCFV->LargeContent); +$m->abort; +</%perl> +<%attr> +AutoFlush => 0 +</%attr> diff --git a/rt/html/Download/Tabular/dhandler b/rt/html/Download/Tabular/dhandler new file mode 100644 index 000000000..3965a990e --- /dev/null +++ b/rt/html/Download/Tabular/dhandler @@ -0,0 +1,74 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%perl> +my ($class, $filename, @ids); +my $arg = $m->dhandler_arg; # get rest of path +if ($arg =~ /^(\w+)\/([,\d]+)(?:\/([^\/]+))?/) { + $class = "RT::$1"; + $filename = $3 || "$1s.tsv"; + @ids = sort split(/,+/, $2); +} +else { + Abort("Corrupted tabular URL."); +} + +my @cols = $class->BasicColumns or return; + +#$r->content_type( 'application/octet-stream' ); +$r->content_type( 'text/plain' ); +$r->headers_out->{'Content-Disposition'} = "attachment; filename=$filename"; +$m->clear_buffer(); +$m->out(join("\t", "Id", map $_->[1], @cols), "\n"); +foreach my $id (@ids) { + my $obj = $class->new; + $obj->Load($id) or next; + $m->out(join("\t", map $obj->$_, "Id", map $_->[0], @cols), "\n"); +} +$m->abort; +</%perl> +<%attr> +AutoFlush => 0 +</%attr> diff --git a/rt/html/Elements/BevelBoxRaisedEnd b/rt/html/Elements/BevelBoxRaisedEnd new file mode 100644 index 000000000..e1d1edb7c --- /dev/null +++ b/rt/html/Elements/BevelBoxRaisedEnd @@ -0,0 +1,48 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} + </TD> +</TR> +</table> diff --git a/rt/html/Elements/BevelBoxRaisedStart b/rt/html/Elements/BevelBoxRaisedStart new file mode 100644 index 000000000..6c5a6137e --- /dev/null +++ b/rt/html/Elements/BevelBoxRaisedStart @@ -0,0 +1,48 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<table cellspacing=0 cellpadding=0 width=100% height=100%> + <TR> + <TD width=100% height=100%> diff --git a/rt/html/Elements/Callback b/rt/html/Elements/Callback new file mode 100644 index 000000000..937e923a1 --- /dev/null +++ b/rt/html/Elements/Callback @@ -0,0 +1,90 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%once> +my %cache; +</%once> +<%init> +$Page = $m->callers(1)->path unless ($Page); + +my $CacheKey = "Callback--$Page--$_CallbackName"; +my $callbacks = $cache{$CacheKey} || $m->notes($CacheKey); + +if (!$callbacks) { + my $path = "/Callbacks/*$Page/$_CallbackName"; + + # Due to API changes after Mason 1.28, we have to check for which + # version we're running when getting the component roots + my @roots = map { $_->[1] } + $HTML::Mason::VERSION <= 1.28 + ? $m->interp->resolver->comp_root_array + : $m->interp->comp_root_array; + + my %seen; + + for my $root (@roots) { + push @$callbacks, + # Skip backup files, files without a leading package name, + # and files we've already seen + grep { !/^\.|~$/ + and $_ ne "/Callbacks/$Page/$_CallbackName" + and not $seen{$_}++ } + $m->interp->resolver->glob_path($path, $root); + } + + $m->notes($CacheKey => $callbacks); + $cache{$Page,$_CallbackName} = $callbacks if !$RT::DevelMode; +} + +my @rv; +foreach my $comp (sort @$callbacks) { + push @rv, $m->comp($comp, %ARGS); +} +return @rv; +</%init> +<%args> +$_CallbackName => 'Default' +$Page => undef +</%args> diff --git a/rt/html/Elements/Checkbox b/rt/html/Elements/Checkbox new file mode 100644 index 000000000..f2256fb78 --- /dev/null +++ b/rt/html/Elements/Checkbox @@ -0,0 +1,61 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<INPUT TYPE="Checkbox" NAME="<%$Name%>" value="1" <%$IsChecked%>> + +<%ARGS> +$Name => undef +$Default => undef +$True => undef +$False => undef +$IsChecked => undef +</%ARGS> + +<%INIT> +$IsChecked = + ($Default && $Default =~ /checked/i) + ? " CHECKED " : ""; +1; +</%INIT> diff --git a/rt/html/Elements/CollectionAsTable/Header b/rt/html/Elements/CollectionAsTable/Header new file mode 100644 index 000000000..9ed4be8ec --- /dev/null +++ b/rt/html/Elements/CollectionAsTable/Header @@ -0,0 +1,123 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +@Format => undef +$FormatString => undef +$AllowSorting => undef +$Order=>undef +$BaseURL => undef +$Query => undef +$Rows => undef +$Page => undef +$maxitems => undef +</%ARGS> +<TR class="collection-as-table"> +<%perl> + +my %generic_query_args = ( Query => $Query, Rows => $Rows, Page => $Page, Format => $FormatString ); + +my $item = 0; +foreach my $col (@Format) { + $item++; + if ( $col->{title} eq 'NEWLINE' ) { + while ( $item < $maxitems ) { + $m->out(qq{<th class="collection-as-table"> </th>\n}); + $item++; + } + + $item = 0; + $m->out(qq{</TR>\n<TR class="collection-as-table">}); + } + else { + $m->out('<TH class="collection-as-table">'); + my $title = $col->{title}; + $title =~ s/^__(.*)__$/$1/o; + $title = ( + $m->comp( + '/Elements/RT__Ticket/ColumnMap', + Name => $title, + Attr => 'title' + ) + || $title + ); + if ( + $AllowSorting + && $col->{'attribute'} + && $m->comp( + '/Elements/RT__Ticket/ColumnMap', + Name => $col->{'attribute'}, + Attr => 'attribute' + ) + ) + { + + $m->out( + '<a href="' . $BaseURL + . $m->comp( + '/Elements/QueryString', + %generic_query_args, + OrderBy => ( + $m->comp( + '/Elements/RT__Ticket/ColumnMap', + Name => $col->{'attribute'}, + Attr => 'attribute' + ) + || $col->{'attribute'} + ), + Order => ( $ARGS{'Order'} eq 'ASC' ? 'DESC' : 'ASC' ) + ) + . '">' + . loc($title) . '</a>' + ); + } + else { + $m->out( loc($title) ); + } + $m->out('</TH>'); + } +} +</%perl> +</TR> diff --git a/rt/html/Elements/CollectionAsTable/ParseFormat b/rt/html/Elements/CollectionAsTable/ParseFormat new file mode 100644 index 000000000..57434efe2 --- /dev/null +++ b/rt/html/Elements/CollectionAsTable/ParseFormat @@ -0,0 +1,102 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$Format +</%ARGS> + +<%init> +use Regexp::Common; +my @Columns; + +while ($Format =~ /($RE{delimited}{-delim=>qq{\'"}}|[{}\w.]+)/go) { + my $col = $1; + + if ($col =~ /^$RE{quoted}$/o) { + substr($col,0,1) = ""; + substr($col,-1,1) = ""; + } + + my $colref; + + if ( $col =~ s!/STYLE:([^/]+)!!io ) { + $colref->{'style'} = $1; + } + if ( $col =~ s!/CLASS:([^/]+)!!io ) { + $colref->{'class'} = $1; + } + if ( $col =~ s!/TITLE:([^/]+)!!io ) { + $colref->{'title'} = $1; + } + if ( $col =~ s!/ALIGN:([^\/]+)!!io ) { + $colref->{'align'} = $1; + } + if ( $col =~ /__(.*?)__/gio ) { + my @subcols; + while ( $col =~ s/^(.*?)__(.*?)__//o ) { + push ( @subcols, $1 ) if ($1); + push ( @subcols, "__$2__" ); + $colref->{'attribute'} = $2; + } + push ( @subcols, $col ); + @{ $colref->{'output'} } = @subcols; + } + else { + @{ $colref->{'output'} } = ( "__" . $col . "__" ); + $colref->{'attribute'} = $col; + } + + if ( !$colref->{'title'} && grep { /^__(.*?)__$/io } + @{ $colref->{'output'} } ) + { + $colref->{'title'} = $1; + $colref->{'attribute'} = $1; + } + + + push @Columns, $colref; +} + return(@Columns); +</%init> diff --git a/rt/html/Elements/CollectionAsTable/Row b/rt/html/Elements/CollectionAsTable/Row new file mode 100644 index 000000000..3316bc027 --- /dev/null +++ b/rt/html/Elements/CollectionAsTable/Row @@ -0,0 +1,111 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$i => undef +@Format => undef +$record => undef +$maxitems => undef +$Depth => undef +$Warning => undef +</%ARGS> + +<%PERL> +$m->out('<TR class="' . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) . '" >' ); +my $item; +foreach my $column (@Format) { + if ( $column->{title} eq 'NEWLINE' ) { + while ( $item < $maxitems ) { + $m->out(qq{<td class="collection-as-table"> </td>\n}); + $item++; + } + $item = 0; + $m->out('</TR>'); + $m->out('<TR class="' + . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) + . '" >' ); + next; + } + $item++; + $m->out('<td class="collection-as-table" '); + $m->out( 'align="' . $column->{align} . '"' ) if ( $column->{align} ); + $m->out('>'); + foreach my $subcol ( @{ $column->{output} } ) { + if ( $subcol =~ /^__(.*?)__$/o ) { + my $col = $1; + my $value = $m->comp( + '/Elements/RT__Ticket/ColumnMap', + Name => $col, + Attr => 'value' + ); + my @out; + + if ( $value && ref($value) ) { + + # All HTML snippets are returned by the callback function + # as scalar references. Data fetched from the objects are + # plain scalars, and needs to be escaped properly. + @out = + map { + ref($_) ? $$_ : $m->interp->apply_escapes( $_ => 'h' ) + } &{$value}( $record, $i ) + ; + } + else { + + # Simple value; just escape it. + @out = $m->interp->apply_escapes( $value => 'h' ); + } + s/\n/<br>/gs for @out; + $m->out( @out ); + } + else { + $m->out($subcol); + } + } + $m->out('</td>'); +} +$m->out('</TR>'); +</%PERL> diff --git a/rt/html/Elements/CreateTicket b/rt/html/Elements/CreateTicket new file mode 100644 index 000000000..bd60bbddf --- /dev/null +++ b/rt/html/Elements/CreateTicket @@ -0,0 +1,48 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<FORM ACTION="<% $RT::WebPath %>/Ticket/Create.html" NAME="CreateTicketInQueue"> +<&|/l, $m->scomp('/Elements/SelectNewTicketQueue')&><input type="submit" value="New ticket in"> [_1]</&> +</FORM> diff --git a/rt/html/Elements/EditCustomField b/rt/html/Elements/EditCustomField new file mode 100644 index 000000000..d2398c9da --- /dev/null +++ b/rt/html/Elements/EditCustomField @@ -0,0 +1,89 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%INIT> +my $Values; +if ($Object) { + $Values = $Object->CustomFieldValues($CustomField->id); + $Values->Columns( qw( id CustomField ObjectType ObjectId Disabled Content ContentType ContentEncoding ) ); + $NamePrefix ||= join('-', 'Object', ref($Object), $Object->Id, 'CustomField', ''); +} +my $Type = $CustomField->Type; + +return unless ($Type); # if we can't see the type, all hell will break loose. + +my $MaxValues = $CustomField->MaxValues; +if ($MaxValues == 1 and $Object and $Values) { + # what exactly is this doing? Without the "unless" it breaks RTFM + # transaction extraction into articles. + $Default = ($Values->First ? $Values->First->Content : '') unless $Default; + $Values->GotoFirstItem; +} +# The "Magic" hidden input causes RT to know that we were trying to edit the field, even if +# we don't see a value later, since browsers aren't compelled to submit empty form fields +$m->out("\n".'<input type="hidden" name="'.$NamePrefix.$CustomField->Id.'-Values-Magic" value="1">'."\n"); + +return $m->comp( + "EditCustomField$Type", + %ARGS, + Rows => $Rows, + Cols => $Cols, + Default => $Default, + Object => $Object, + Values => $Values, + MaxValues => $MaxValues, + Multiple => ($MaxValues != 1), + NamePrefix => $NamePrefix, + CustomField => $CustomField, +); +</%INIT> +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Rows => 5 +$Cols => 15 +$Default => undef +</%ARGS> diff --git a/rt/html/Elements/EditCustomFieldBinary b/rt/html/Elements/EditCustomFieldBinary new file mode 100644 index 000000000..002825660 --- /dev/null +++ b/rt/html/Elements/EditCustomFieldBinary @@ -0,0 +1,60 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% while ($Values and my $value = $Values->Next ) { +%# XXX - let user download the file(s) here? +<input type="checkbox" name="<%$NamePrefix%><%$CustomField->Id%>-DeleteValueIds" value="<% $value->Id %>"><a href="<%$RT::WebPath%>/Download/CustomFieldValue/<% $value->Id %>/<% $value->Content %>"><% $value->Content %></a><br> +% } +% if (!$MaxValues or !$Values or $Values->Count < $MaxValues) { +<input type="file" name="<%$NamePrefix%><%$CustomField->Id%>-Upload"> +% } +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Default => undef +$Values => undef +$MaxValues => undef +</%ARGS> diff --git a/rt/html/Elements/EditCustomFieldFreeform b/rt/html/Elements/EditCustomFieldFreeform new file mode 100644 index 000000000..c097ee0a9 --- /dev/null +++ b/rt/html/Elements/EditCustomFieldFreeform @@ -0,0 +1,68 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% if ($Multiple) { +<textarea cols=<%$Cols%> rows=<%$Rows%> name="<%$NamePrefix%><%$CustomField->Id%>-Values"><%$Default%></textarea> +% } else { +<input name="<%$NamePrefix%><%$CustomField->Id%>-Value" size="<%$Cols%>" value="<%$Default ? $Default : ''%>"> +% } +<%INIT> +if ($Multiple and $Values) { + $Default = ''; + while (my $value = $Values->Next ) { + $Default .= $value->Content."\n"; + } +} +</%INIT> +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Default => undef +$Values => undef +$Multiple => undef +$Cols +$Rows +</%ARGS> diff --git a/rt/html/Elements/EditCustomFieldImage b/rt/html/Elements/EditCustomFieldImage new file mode 100644 index 000000000..b378ceae6 --- /dev/null +++ b/rt/html/Elements/EditCustomFieldImage @@ -0,0 +1,60 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% while ($Values and my $value = $Values->Next ) { +<input type="checkbox" name="<%$NamePrefix%><%$CustomField->Id%>-DeleteValueIds" value="<% $value->Id %>"><& ShowCustomFieldImage, Object => $value &> +<br> +% } +% if (!$MaxValues or !$Values or $Values->Count < $MaxValues) { +<input type="file" name="<%$NamePrefix%><%$CustomField->Id%>-Upload"> +% } +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Default => undef +$Values => undef +$MaxValues => undef +</%ARGS> diff --git a/rt/html/Elements/EditCustomFieldSelect b/rt/html/Elements/EditCustomFieldSelect new file mode 100644 index 000000000..db33a6839 --- /dev/null +++ b/rt/html/Elements/EditCustomFieldSelect @@ -0,0 +1,71 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} + <select name="<%$NamePrefix%><%$CustomField->Id%>-Values" + size="<%$Rows%>" + <% $Multiple && 'MULTIPLE' %>> +% my $selected; +% my $CFVs = $CustomField->Values; +% while ($CFVs and my $value = $CFVs->Next ) { + <option value="<%$value->Name%>" +% if ($Values) { + <% $Values->HasEntry($value->Name) && ($selected = 1) && 'SELECTED' %> +% } elsif ($Default) { + <% ($Default eq $value->Name) && ($selected = 1) && 'SELECTED' %> +% } + ><% $value->Name%></option> +% } + <option value="" <% !$selected && 'SELECTED' %>><&|/l&>(no value)</&></option> + </select> +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Default => undef +$Values => undef +$Multiple => 0 +$Cols +$Rows +</%ARGS> diff --git a/rt/html/Elements/EditCustomFieldText b/rt/html/Elements/EditCustomFieldText new file mode 100644 index 000000000..1aac3283b --- /dev/null +++ b/rt/html/Elements/EditCustomFieldText @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% while ($Values and my $value = $Values->Next ) { +<textarea cols=<%$Cols%> rows=<%$Rows%> name="<%$NamePrefix%><%$CustomField->Id%>-Values"><% $value->Content %></textarea><br> +% } +% if (!$MaxValues or !$Values or $Values->Count < $MaxValues) { +<textarea cols=<%$Cols%> rows=<%$Rows%> name="<%$NamePrefix%><%$CustomField->Id%>-Values"><% $Default %></textarea> +% } +<%INIT> +# XXX - MultiValue textarea is for now outlawed. +$MaxValues = 1; +</%INIT> +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Default => undef +$Values => undef +$MaxValues => undef +$Cols +$Rows +</%ARGS> diff --git a/rt/html/Elements/EditCustomFieldWikitext b/rt/html/Elements/EditCustomFieldWikitext new file mode 100644 index 000000000..1aac3283b --- /dev/null +++ b/rt/html/Elements/EditCustomFieldWikitext @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% while ($Values and my $value = $Values->Next ) { +<textarea cols=<%$Cols%> rows=<%$Rows%> name="<%$NamePrefix%><%$CustomField->Id%>-Values"><% $value->Content %></textarea><br> +% } +% if (!$MaxValues or !$Values or $Values->Count < $MaxValues) { +<textarea cols=<%$Cols%> rows=<%$Rows%> name="<%$NamePrefix%><%$CustomField->Id%>-Values"><% $Default %></textarea> +% } +<%INIT> +# XXX - MultiValue textarea is for now outlawed. +$MaxValues = 1; +</%INIT> +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Default => undef +$Values => undef +$MaxValues => undef +$Cols +$Rows +</%ARGS> diff --git a/rt/html/Elements/EditLinks b/rt/html/Elements/EditLinks new file mode 100755 index 000000000..68c08dd16 --- /dev/null +++ b/rt/html/Elements/EditLinks @@ -0,0 +1,174 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<TABLE width=100%> + <TR> + <TD VALIGN=TOP WIDTH=50%> + <h3><&|/l&>Current Links</&></h3> + +<table> + <tr> + <td></td> + <td><i><&|/l&>(Check box to delete)</&></i></td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Depends on</&>:</td> + <td class="value"> +% while (my $link = $Object->DependsOn->Next) { + <INPUT TYPE=CHECKBOX NAME="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1"> + <& ShowLink, URI => $link->TargetURI &><br> +% } + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Depended on by</&>:</td> + <td class="value"> +% while (my $link = $Object->DependedOnBy->Next) { +% my $member = $link->BaseObj; + <INPUT TYPE=CHECKBOX NAME="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1"> + <& ShowLink, URI => $link->BaseURI &><br> +% } + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Parents</&>:</td> + <td class="value"> +% while (my $link = $Object->MemberOf->Next) { + <INPUT TYPE=CHECKBOX NAME="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1"> + <& ShowLink, URI => $link->TargetURI &><br> +% } + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Children</&>:</td> + <td class="value"> +% while (my $link = $Object->Members->Next) { + <INPUT TYPE=CHECKBOX NAME="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1"> + <& ShowLink, URI => $link->BaseURI &><br> +% } + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Refers to</&>:</td> + <td class="value"> +% while (my $link = $Object->RefersTo->Next) { + <INPUT TYPE=CHECKBOX NAME="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1"> + <& ShowLink, URI => $link->TargetURI &><br> +%} + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Referred to by</&>:</td> + <td class="value"> +% while (my $link = $Object->ReferredToBy->Next) { + <INPUT TYPE=CHECKBOX NAME="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1"> + <& ShowLink, URI => $link->BaseURI &><br> +% } + </td> + </tr> +</table> + +</TD> +<TD VALIGN=TOP> +<h3><&|/l&>New Links</&></h3> +% if (ref($Object) eq 'RT::Ticket') { +<i><&|/l&>Enter tickets or URIs to link tickets to. Separate multiple entries with spaces.</&> +<& /Elements/Callback, _CallbackName => 'ExtraLinkInstructions' &> +</i><br> +% } elsif (ref($Object) eq 'RT::Queue') { +<i><&|/l&>Enter queues or URIs to link queues to. Separate multiple entries with spaces.</&> +</i><br> +% } else { +<i><&|/l&>Enter objects or URIs to link objects to. Separate multiple entries with spaces.</&></i><br> +% } +<TABLE> +% if ($Merge) { + <TR> + <TD class="label"><&|/l&>Merge into</&>:</TD> + <TD class="entry"><input name="<%$id%>-MergeInto"> <i><&|/l&>(only one ticket)</&></i></TD> + </TR> +% } + <TR> + <TD class="label"><&|/l&>Depends on</&>:</TD> + <TD class="entry"><input name="<%$id%>-DependsOn"></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Depended on by</&>:</TD> + <TD class="entry"><input name="DependsOn-<%$id%>"></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Parents</&>:</TD> + <TD class="entry"><input name="<%$id%>-MemberOf"></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Children</&>:</TD> + <TD class="entry"> <input name="MemberOf-<%$id%>"></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Refers to</&>:</TD> + <TD class="entry"><input name="<%$id%>-RefersTo"></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Referred to by</&>:</TD> + <TD class="entry"> <input name="RefersTo-<%$id%>"></TD> + </TR> +</TABLE> +</TD> +</TR> +</TABLE> + +<%INIT> +my $id; +if ($Object && $Object->Id) { + $id = $Object->Id; +} else { + $id = 'new'; +} +</%INIT> + +<%ARGS> +$Object => undef +$Merge => 0 +</%ARGS> diff --git a/rt/html/Elements/Error b/rt/html/Elements/Error new file mode 100644 index 000000000..bc5a1880a --- /dev/null +++ b/rt/html/Elements/Error @@ -0,0 +1,86 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Callback, %ARGS, error => $error &> +<& /Elements/Header, Code => $Code, Why => $Why &> +<& /Elements/Tabs &> +<& /Elements/TitleBoxStart, class=> "error", title => $Title &> +<%$Why%> +<br> +<font size=-1> +<%$Details%> +</font> +<& /Elements/TitleBoxEnd &> + +<%cleanup> +$m->comp('/Elements/Footer'); +$m->abort(); +</%cleanup> + +<%args> +$Code => undef +$Details => undef +$Title => loc("RT Error") +$Why => loc("the calling component did not specify why") +</%args> + +<%INIT> +my $error = "WebRT: $Why ($Details)"; + +# TODO: Log::Dispatch isn't UTF-8 safe. Autrijus needs to talk to dave rolsky about getting this fixed +if ($] >= 5.007001) { + require Encode; + Encode::_utf8_off($error); +} + +$RT::Logger->error($error); + +if ( $session{'SessionType'} eq 'REST' ) { + $r->content_type('text/plain'); + $m->out( "Error: " . $Why . "\n" ); + $m->out( $Details . "\n" ); + $m->abort(); +} +</%INIT> diff --git a/rt/html/Elements/Footer b/rt/html/Elements/Footer new file mode 100644 index 000000000..78a116f38 --- /dev/null +++ b/rt/html/Elements/Footer @@ -0,0 +1,85 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% if ($Menu) { +</td> +</tr> +<tr> +<td> +% } +<& /Elements/Callback, %ARGS &> +<!-- +<div class="bpscredits"> +<&|/l, '»|«', $RT::VERSION, '2005', '<a href="http://www.bestpractical.com?rt='.$RT::VERSION.'">Best Practical Solutions, LLC</a>', &>[_1] RT [_2] Copyright 1996-[_3] [_4].</&><br> +% if (!$Menu) { +<&|/l&>Distributed under version 2 <a href="http://www.gnu.org/copyleft/gpl.html"> of the GNU GPL.</a></&><br> +<&|/l, '<a href="mailto:sales@bestpractical.com">sales@bestpractical.com</a>' &>To inquire about support, training, custom development or licensing, please contact [_1].</&><br> +% } +</div> +--> +% if ($Debug >= 2 ) { +% require Data::Dumper; +% my $d = Data::Dumper->new([\%ARGS], [qw(%ARGS)]); +<pre> +<%$d->Dump() %> +</pre> +% } +<div class="page-stats"><&|/l&>Time to display</&>: <%Time::HiRes::tv_interval( $m->{'rt_base_time'} )%></div> +% if ($Menu) { +</TD> +</TR> +</TABLE> +</TD> +</TR> +</TABLE> +% } +</BODY> +</HTML> +% $m->abort(); + +<%ARGS> +$Debug => 0 +$Menu => 1 +</%ARGS> diff --git a/rt/html/Elements/GotoTicket b/rt/html/Elements/GotoTicket new file mode 100644 index 000000000..869d57ef1 --- /dev/null +++ b/rt/html/Elements/GotoTicket @@ -0,0 +1,46 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<FORM ACTION="<%$RT::WebPath%>/Ticket/Display.html"><input type=submit value="<&|/l&>Goto ticket</&>"> <input size=5 name=id accesskey="0"></FORM> diff --git a/rt/html/Elements/Header b/rt/html/Elements/Header new file mode 100644 index 000000000..a2563fee3 --- /dev/null +++ b/rt/html/Elements/Header @@ -0,0 +1,143 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%#<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<HTML> +<HEAD> +<TITLE><%$Title%></TITLE> +% if ($Refresh > 0) { +<META HTTP-EQUIV="REFRESH" CONTENT="<%$Refresh%>"> +% } + +<link rel="shortcut icon" href="<%$RT::WebImagesURL%>/favicon.png" type="image/png"> +<link rel="stylesheet" href="<%$RT::WebPath%>/NoAuth/webrt.css" type="text/css"> +<script> +function hideshow(num) { + idstring = "element-" + num; + chunk = document.getElementById(idstring); + if ( chunk.style.display == "none") { + chunk.style.display = chunk.style.tag; + } else { + chunk.style.tag = chunk.style.display; + chunk.style.display = "none"; + } +} +</script> +<& /Elements/Callback, _CallbackName => 'Head', %ARGS &> +</HEAD> +<BODY BGCOLOR="<%$BgColor%>" +% if ($Focus) { +ONLOAD=" + var tmp = (document.getElementsByName('<% $Focus %>')); + if (tmp.length > 0) tmp[tmp.length-1].focus(); +" +% } +> +<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF"> + <tr> + <td colspan=2 rowspan=2><img border=0 alt="freeside" src="<%$RT::WebImagesURL%>/small-logo.png" width="92" height="62"></td> + <td align="left" rowspan=2><font size=6><% &RT::URI::freeside::FreesideGetConfig('company_name') %> Ticketing</font></td> + <td align="right" valign="top"> +% if ($session{'CurrentUser'} && $session{'CurrentUser'}->Id && $LoggedIn) { +<SPAN STYLE="display: none"><A HREF="#skipnav"><&|/l&>Skip Menu</&></A> |</SPAN> +%if ($session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => $RT::System )) { +<A HREF="<%$RT::WebPath%><% $Prefs %>" ><&|/l&>Preferences</&></A> +% } +<& /Elements/Callback, %ARGS &> +% unless ($RT::WebExternalAuth and !$RT::WebFallbackToInternalAuth) { +| <A HREF="<%$RT::WebPath%>/NoAuth/Logout.html<%$URL ? "?URL=".$URL : ''%>"><&|/l&>Logout</&></a> +% } +<BR> +<&|/l, "<b>".$session{'CurrentUser'}->Name."</b>" &>Logged in as [_1]</&> +% } else { +<&|/l&>Not logged in.</&> +% } + </td> + + </tr> + <tr> + + <td align=right valign=bottom> + <table> + <tr> + <td align=right> + <FONT SIZE="-3"> + <A HREF="http://www.sisd.com/freeside">Freeside</A> v<% &RT::URI::freeside::FreesideVersion() %><BR> + <A HREF="../docs/">Documentation</A><BR> + </FONT> + </td> + <td bgcolor=#000000></td> + <td align=left> + <FONT SIZE="-3"> + <A HREF="http://www.bestpractical.com/rt">RT</A> v<% $RT::VERSION %><BR> + <A HREF="http://wiki.bestpractical.com/">Documentation</A><BR> + </FONT> + </td> + + </tr> + </table> + </td> + + </tr> +</table> +<%INIT> + +$r->headers_out->{'Pragma'} = 'no-cache'; +$r->headers_out->{'Cache-control'} = 'no-cache'; +require RT::URI::freeside; +</%INIT> + +<%ARGS> +$Prefs => '/User/Prefs.html' +$Focus => 'focus' +$Title => 'RT' +$Code => undef +$Refresh => 0 +$Why => undef +$BgColor => '#ffffff' +$ShowBar => 1 +$LoggedIn => 1 +$URL => undef +</%ARGS> diff --git a/rt/html/Elements/ListActions b/rt/html/Elements/ListActions new file mode 100644 index 000000000..8433d17e0 --- /dev/null +++ b/rt/html/Elements/ListActions @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% if ($actions[0] ) { +<& /Elements/TitleBoxStart, title => loc('Results') &> +<UL> +% foreach my $action (@actions) { +% next unless ($action); +% my $skip = 0; +% $m->comp('/Elements/Callback', _CallbackName => 'ModifyRow', row => \$action, skip => \$skip, %ARGS); +% next if $skip; +<LI><%$action%></LI> +% } +</UL> +<& /Elements/TitleBoxEnd &> +<BR> +% } +<%init> +@actions = grep (/./,@actions); +</%init> +<%ARGS> +@actions => undef +</%ARGS> diff --git a/rt/html/Elements/Login b/rt/html/Elements/Login new file mode 100644 index 000000000..1d4bfd5ec --- /dev/null +++ b/rt/html/Elements/Login @@ -0,0 +1,122 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%INIT> +if ($m->request_comp->path =~ '^/REST/\d+\.\d+/') { + $r->content_type("text/plain"); + $m->error_format("text"); + $m->out("RT/$RT::VERSION 401 Credentials required\n"); + $m->out("\n$Error\n") if $Error; + $m->abort; +} +</%INIT> + +<& /Elements/Callback, %ARGS, _CallbackName => 'Header' &> +<& /Elements/Header, Title => loc('Login'), Focus => 'user' &> + +<DIV ALIGN=CENTER> +% if ($Error) { +<& /Elements/TitleBoxStart, title => loc('Error') &> +<% $Error %> +<& /Elements/TitleBoxEnd &> +% } +<BR> +<& /Elements/TitleBoxStart, width=> "40%", titleright => loc("RT [_1]", $RT::VERSION), title => loc('Login') , +contentbg=>"#cccccc" &> + +% unless ($RT::WebExternalAuth and !$RT::WebFallbackToInternalAuth) { +<FORM id="login" name="login" METHOD=POST ACTION="<% (UNIVERSAL::can($r, 'uri') && ($r->uri) =~ m!.*/(.*)!) %>" > +<TABLE BORDER=0 WIDTH=100%> +<TR ALIGN=RIGHT> +<TD ALIGN=RIGHT><&|/l&>Username</&>:</TD><TD ALIGN=LEFT><input name=user value="<%$user%>"></TD></TR> +<TR><TD ALIGN=RIGHT><&|/l&>Password</&>:</TD><TD ALIGN=LEFT><input type=password name=pass></TD></TR> +<TR><TD colspan=2 align=right> +<input type=submit Value="<&|/l&>Login</&>"> +</TD></TR> +</TABLE> + +%# Give callbacks a chance to add more control elements +<& /Elements/Callback, %ARGS &> + +<&/Elements/TitleBoxEnd&> +% # From mason 1.0.1 forward, this doesn't work. in fact, it breaks things. +% # But on Mason 1.15 it's fixed again, so we still use it. +% # The code below iterates through everything in the passed in arguments +% # Preserving all the old parameters +% # This would be easier, except mason is 'smart' and calls multiple values +% # arrays rather than multiple hash keys +% my $key; my $val; +% foreach $key (keys %ARGS) { +% if (($key ne 'user') and ($key ne 'pass')) { +% if (ref($ARGS{$key}) =~ /ARRAY/) { +% foreach $val (@{$ARGS{$key}}) { +<input type=hidden name="<%$key %>" value="<% $val %>"> +% } +% } +% else { +<input type="hidden" name="<% $key %>" value="<% $ARGS{$key} %>"> +% } +% } +% } +</FORM> +% } +</DIV> + +<BR> +<!-- TODO: not yet implemented +If you've forgotten your username or password, RT can <A +href="/NoAuth/Reminder.html">send you a reminder</a>. +--> +<BR> +<BR> +<BR> +<HR> +<& /Elements/Footer, Menu => 0 &> +<%ARGS> +$user => "" +$pass => undef +$goto => undef +$Error => undef +</%ARGS> diff --git a/rt/html/Elements/Menu b/rt/html/Elements/Menu new file mode 100644 index 000000000..398e3ab07 --- /dev/null +++ b/rt/html/Elements/Menu @@ -0,0 +1,108 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# font size depends on level +% if ($level ge 3) { +% $size = $basesize-(6); +% } elsif ($level gt 0) { +% $size = $basesize-($level * 2); +% $padding = 2; +% } +% else { +% $size = $basesize; +% $padding = 5; +% } +<ul class="topnav" > +% my $sep=0; +% my $accesskey="1"; +% foreach $tab (sort keys %{$toptabs}) { +% my $current = $current_toptab || ""; +% my $path = $toptabs->{$tab}->{'path'} || ""; +% $path =~ s#/index.html$##gi; +% $current =~ s#/index.html$##gi; +% if ( $path eq $current) { +% $class="currenttopnav" +% } else { +% $class="topnav" +% } +% my $style=""; +% if ($sep) { +% $style="minor"; +% } elsif ($level == 0 ) { +% $style="major"; +% } +% if ($toptabs->{$tab}->{'separator'}) { +% $sep=1; +% } else { +% $sep=0; +% } +% my $url = $toptabs->{$tab}->{'path'} =~ /^https?:/i ? $toptabs->{$tab}->{'path'} : $RT::WebPath . "/" . $toptabs->{$tab}->{'path'}; +<li class="<%$class%>-<%$level%>-<%$style%>"><A HREF="<% $url %>" class="<%$class%>-<%$level%>" +<%($class eq 'currenttopnav') ? "name='focus'" : ""|n %> +<% !$level && "accesskey='".$accesskey++."'" |n%>><% $toptabs->{$tab}->{'title'}%></A> +%# Second-level items +%# if ($current_toptab eq $toptabs->{$tab}->{'path'}) { +%# commented out by jesse on 4 jan 2003 so that tickets/search and ticket/# can +%# both have menu items +% if ($toptabs->{$tab}->{'subtabs'}) { + <& /Elements/Menu, level => $level+1, + current_toptab => $toptabs->{$tab}->{'current_subtab'}, + toptabs => $toptabs->{$tab}->{'subtabs'} &></li> +% } +%# } +% } +</ul> + +<%INIT> +my ($tab, $subtab, $class, $size, $padding); +my $basesize=16; + +</%INIT> + +<%ARGS> +$current_toptab => "" +$toptabs => undef +$level => 0 +</%ARGS> diff --git a/rt/html/Elements/MessageBox b/rt/html/Elements/MessageBox new file mode 100644 index 000000000..dd48bec9a --- /dev/null +++ b/rt/html/Elements/MessageBox @@ -0,0 +1,72 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<textarea class="messagebox" COLS=<%$Width%> ROWS=<%$Height%> WRAP=<%$Wrap%> NAME="<%$Name%>"><& /Elements/Callback, %ARGS &><% $Default %><%$message%><%$IncludeSignature ? $signature : ''%></textarea> +<%INIT> + +my ($message); + +if ($QuoteTransaction) { + my $transaction=RT::Transaction->new($session{'CurrentUser'}); + $transaction->Load($QuoteTransaction); + $message=$transaction->Content(Quote => 1); +} + +my $signature = ''; +if ($IncludeSignature && $session{'CurrentUser'}->UserObj->Signature) { + $signature = "-- \n".$session{'CurrentUser'}->UserObj->Signature; +} + +</%INIT> +<%ARGS> +$QuoteTransaction => undef +$Name => 'Content' +$Default => '' +$Width => $RT::MessageBoxWidth || 72 +$Height => $RT::MessageBoxHeight || 15 +$Wrap => $RT::MessageBoxWrap || 'HARD' +$IncludeSignature => 1 +</%ARGS> + diff --git a/rt/html/Elements/MyRequests b/rt/html/Elements/MyRequests new file mode 100644 index 000000000..172b4a4fa --- /dev/null +++ b/rt/html/Elements/MyRequests @@ -0,0 +1,70 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<&|/Elements/TitleBox, + title => loc("[_1] newest unowned tickets", $rows), + title_href => "Search/Results.html".$QueryString &> +<& /Elements/TicketList, + Format => "'<a href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__id__</a>/TITLE:#', '<a href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__Subject__</a>/TITLE:Subject', QueueName, ExtendedStatus, CreatedRelative, '<A HREF=\"$RT::WebPath/Ticket/Display.html?Action=Take&id=__id__\">".loc('Take')."</a>/TITLE: ' ", + Query => $Query, + OrderBy => 'Created', + Order => 'DESC', + ShowNavigation => 0, + Rows => $rows + + &> +</&> +<%init> +my $rows = $RT::MyRequestsLength; + +my $Query = "Owner = 'Nobody' AND ( Status = 'new' OR Status = 'open')"; + +my $QueryString = ""; +$QueryString = '?' . $m->comp('/Elements/QueryString', + Query => $Query, + Order => 'DESC', + OrderBy => 'Priority') if ($Query); + +</%init> diff --git a/rt/html/Elements/MyTickets b/rt/html/Elements/MyTickets new file mode 100644 index 000000000..cf5225abc --- /dev/null +++ b/rt/html/Elements/MyTickets @@ -0,0 +1,71 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<&|/Elements/TitleBox, + title => loc('[_1] highest priority tickets I own', $rows), + title_href => "Search/Results.html".$QueryString &> +<& /Elements/TicketList, + Format => "'<a href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__id__</a>/TITLE:#', '<a href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__Subject__</a>/TITLE:Subject', Priority, QueueName, ExtendedStatus", + + Query => $Query, + OrderBy => 'Priority', + Order => 'DESC', + Rows => $rows, + ShowNavigation => 0 + &> +</&> +<%init> +my $rows = $RT::MyTicketsLength; + +my $Query = " Owner = '".$session{'CurrentUser'}->Id."' AND ( Status = 'new' OR Status = 'open')"; + +my $QueryString = ""; +$QueryString = '?' . $m->comp('/Elements/QueryString', + Query => $Query, + Order => 'DESC', + OrderBy => 'Priority') if ($Query); + +</%init> + diff --git a/rt/html/Elements/PageLayout b/rt/html/Elements/PageLayout new file mode 100644 index 000000000..94bdbe194 --- /dev/null +++ b/rt/html/Elements/PageLayout @@ -0,0 +1,123 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<table class="lightgray" border=0 cellspacing=0 cellpadding=0 width="100%"> + <th class="lightgray" align="left" width=42%><span class="rtname"><%$AppName%></span> + </th> + <span class="topactions"> +% foreach my $action (sort keys %{$topactions}) { + <td class="lightgrayright"> + <%$topactions->{"$action"}->{'html'} |n %> + </td> +% } + </span> +</table> +<table border=0 cellspacing=0 cellpadding=0 width="100%" height="100%"> +%# Vertical menu +<TR height="100%"> +<TD valign="top" width="140" class="lightgray"> + <& /Elements/Menu, toptabs => $toptabs, current_toptab => $current_toptab &> +</TD> +<td valign="top"> +<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> +<tr> + <td class="mediumgray" valign="top"> + <span class="title"><%$title%></span> +</td> +</tr> +<tr> +<td class="mediumgrayright" valign="top"> + <span class="nav"> +% if ($actions) { +% my @actions; +% foreach my $action (sort keys %{$actions}) { +% if ($actions->{"$action"}->{'html'}) { +% push @actions, $actions->{"$action"}->{'html'}; +% } else { +% push @actions, qq|<a class="nav" href="|.$RT::WebPath."/".$actions->{$action}->{'path'}.qq|">|.$actions->{$action}->{'title'}."</a>"; +% } +% } +%#<% join(" | ", @actions) | n %> +<% '['. join("] [", @actions). ']' | n %> +% if ($subactions) { +% my @actions; +% foreach my $action (sort keys %{$subactions}) { +% push @actions, $subactions->{"$action"}->{'html'}; +% } +<% join(" | ", @actions) | n %> +% } +% } + </span> + </td> +</tr> +<TR valign="top"> +<TD valign="top" width="100%" height="100%" class="mainbody" > +<& /Elements/Callback, _CallbackName => 'BeforeBody', %ARGS &> +%$m->flush_buffer(); # we've got the page laid out, let's flush the buffer; +<%INIT> + + foreach my $tab (sort keys %{$toptabs}) { + if ($current_toptab && $toptabs->{$tab}->{'path'} eq $current_toptab) { + $toptabs->{$tab}->{"subtabs"} = $tabs; + $toptabs->{$tab}->{"current_subtab"} = $current_tab; + } + } + +if (! defined($AppName)) { + $AppName = loc("RT for [_1]", $RT::rtname); +} + +</%INIT> +<%ARGS> +$current_toptab => undef +$current_tab => undef +$toptabs => undef +$topactions => undef +$tabs => undef +$actions => undef +$subactions => undef +$title => $m->callers(-1)->path +$AppName => '' +</%ARGS> diff --git a/rt/html/Elements/QueryString b/rt/html/Elements/QueryString new file mode 100644 index 000000000..7d41f15e0 --- /dev/null +++ b/rt/html/Elements/QueryString @@ -0,0 +1,52 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%init> +my @params; +while ( (my $key, my $value) = each %ARGS ){ + push @params, $key."=".$m->interp->apply_escapes($value,'u'); +} +return(join('&',@params)); +</%init> diff --git a/rt/html/Elements/QuickCreate b/rt/html/Elements/QuickCreate new file mode 100644 index 000000000..0d2489c61 --- /dev/null +++ b/rt/html/Elements/QuickCreate @@ -0,0 +1,70 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/TitleBoxStart, title => loc('Quick ticket creation') &> +<form method="post" action="<%$RT::WebPath%>/index.html"> +<input type="hidden" name="QuickCreate" value="1"> +<table> +<tr> +<td> +<font size="-2"><&|/l&>Subject</&>:<br><input size="15" name="Subject"></font> +</td> +<td> +<font size="-2"><&|/l&>Queue</&>:<br><& /Elements/SelectQueue, Name => 'Queue', ShowNullOption => 0 &></font> +</td> +<td> +<font size="-2"><&|/l&>Owner</&>:<br> +<select type="select" name="Owner"> +<option value="<%$session{'CurrentUser'}->id%>" SELECTED><%$session{'CurrentUser'}->Name %></option> +<option value="<%$RT::Nobody->id%>"><%loc('Nobody')%></option> +</select> +</font> +</td> +</tr> +%#<tr><td colspan="3"><font size="-2"><textarea cols="50" rows="3"></textarea></font></td></tr> +</table> +<div align="right"><input type="submit" value="<%loc('Create')%>"></div> +</form> +<& /Elements/TitleBoxEnd &> diff --git a/rt/html/Elements/Quicksearch b/rt/html/Elements/Quicksearch new file mode 100644 index 000000000..d54f72e88 --- /dev/null +++ b/rt/html/Elements/Quicksearch @@ -0,0 +1,88 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/TitleBoxStart, title => loc("Quick search"), bodyclass => "" &> + +<TABLE BORDER=0 cellspacing=0 cellpadding=1 WIDTH=100%> +<tr> + <th class="collection-as-table" align=left><&|/l&>Queue</&></th> + <th class="collection-as-table" align=right><&|/l&>New</&></th> + <th class="collection-as-table" align=right><&|/l&>Open</&></th> +</tr> + +<%PERL> +my $i; +while (my $queue = $Queues->Next) { + next unless ($queue->CurrentUserHasRight('ShowTicket')); + + my $name = $queue->Name; + $name =~ s|(['\\])|\\$1|g; + + my $new_q = "Queue = '$name' AND Status = 'new'"; + my $open_q = "Queue = '$name' AND Status = 'open'"; + my $all_q = "Queue = '$name' AND (Status = 'open' OR Status = 'new')"; + + $Tickets->FromSQL($open_q); + my $open = $Tickets->Count(); + + $Tickets->FromSQL($new_q); + my $new = $Tickets->Count(); + + $i++; +</%PERL> +<TR class="<% $i%2 ? 'oddline' : 'evenline'%>" > +<td><A HREF="<% $RT::WebPath%>/Search/Results.html?Query=<%$all_q |nu%>&Rows=50" TITLE="<% $queue->Description %>"><%$queue->Name%></a></TD> +<td align="right"><A HREF="<% $RT::WebPath%>/Search/Results.html?Query=<%$new_q |nu%>&Rows=50"><%$new%></a></TD> +<td align="right"><A HREF="<% $RT::WebPath%>/Search/Results.html?Query=<%$open_q |nu%>&Rows=50"><%$open%></a></TD> +</TR> +% } +</TABLE> +<& /Elements/TitleBoxEnd &> + +<%INIT> +my $Queues = RT::Queues->new($session{'CurrentUser'}); +$Queues->UnLimit(); +my $Tickets = RT::Tickets->new($session{'CurrentUser'}); +</%INIT> diff --git a/rt/html/Elements/RT__Ticket/ColumnMap b/rt/html/Elements/RT__Ticket/ColumnMap new file mode 100644 index 000000000..dade91494 --- /dev/null +++ b/rt/html/Elements/RT__Ticket/ColumnMap @@ -0,0 +1,300 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$Name => undef +$Attr => undef +</%ARGS> + + +<%ONCE> +our ( $COLUMN_MAP ); + +sub ColumnMap { + my $name = shift; + my $attr = shift; + + # First deal with the simple things from the map + if ( $COLUMN_MAP->{$name} ) { + return ( $COLUMN_MAP->{$name}->{$attr} ); + } + + # now, let's deal with harder things, like Custom Fields + + elsif ( $name =~ /^(?:CF|CustomField)\.\{(.+)\}$/ ) { + my $field = $1; + + if ( $attr eq 'attribute' ) { + return (undef); + } + elsif ( $attr eq 'title' ) { + return ( $field ); + } + elsif ( $attr eq 'value' ) { + # Display custom field contents, separated by newlines. + # For Image custom fields we also show a thumbnail here. + return sub { + my $values = $_[0]->CustomFieldValues($field); + return map { + ( + ($_->CustomFieldObj->Type eq 'Image') + ? \($m->scomp( '/Elements/ShowCustomFieldImage', Object => $_ )) + : $_->Content + ), + \'<br>', + } @{ $values->ItemsArrayRef } + }; + } + } +} + +sub LinkCallback { + my $method = shift; + + my $mode = $RT::Ticket::LINKTYPEMAP{$method}{Mode}; + my $type = $RT::Ticket::LINKTYPEMAP{$method}{Type}; + my $mode_uri = $mode.'URI'; + my $local_type = 'Local'.$mode; + + return sub { + map { + \'<A HREF="', + $_->$mode_uri->Resolver->HREF, + \'">', + ( $_->$mode_uri->IsLocal ? $_->$local_type : $_->$mode ), + \'</A><BR>', + } @{ $_[0]->Links($mode,$type)->ItemsArrayRef } + } +} + +$COLUMN_MAP = { + QueueName => { + attribute => 'Queue', + title => 'Queue', + value => sub { return $_[0]->QueueObj->Name } + }, + OwnerName => { + title => 'Owner', + attribute => 'Owner', + value => sub { return $_[0]->OwnerObj->Name } + }, + id => { + attribute => 'id', + align => 'right', + value => sub { return $_[0]->id } + }, + Status => { + attribute => 'Status', + value => sub { return loc($_[0]->Status) } + }, + Subject => { + attribute => 'Subject', + value => sub { return $_[0]->Subject || "(" . loc('No subject') . ")" } + }, + ExtendedStatus => { + title => 'Status', + attribute => 'Status', + value => sub { + my $Ticket = shift; + + if ( $Ticket->HasUnresolvedDependencies ) { + if ( $Ticket->HasUnresolvedDependencies( Type => 'approval' ) + or $Ticket->HasUnresolvedDependencies( Type => 'code' ) ) + { + return \'<em>', loc('(pending approval)'), \'</em>'; + } + else { + return \'<em>', loc('(pending other Collection)'), \'</em>'; + } + } + else { + return loc( $Ticket->Status ); + } + + } + }, + Priority => { + attribute => 'Priority', + value => sub { return $_[0]->Priority } + }, + InitialPriority => { + attribute => 'InitialPriority', + name => 'Initial Priority', + value => sub { return $_[0]->InitialPriority } + }, + FinalPriority => { + attribute => 'FinalPriority', + name => 'Final Priority', + value => sub { return $_[0]->FinalPriority } + }, + EffectiveId => { + attribute => 'EffectiveId', + value => sub { return $_[0]->EffectiveId } + }, + Type => { + attribute => 'Type', + value => sub { return $_[0]->Type } + }, + TimeWorked => { + attribute => 'TimeWorked', + title => 'Time Worked', + value => sub { return $_[0]->TimeWorked } + }, + TimeLeft => { + attribute => 'TimeLeft', + title => 'Time Left', + value => sub { return $_[0]->TimeLeft } + }, + TimeEstimated => { + attribute => 'TimeEstimated', + title => 'Time Estimated', + value => sub { return $_[0]->TimeEstimated } + }, + Requestors => { + value => sub { return $_[0]->Requestors->MemberEmailAddressesAsString } + }, + Cc => { + value => sub { return $_[0]->Cc->MemberEmailAddressesAsString } + }, + AdminCc => { + value => sub { return $_[0]->AdminCc->MemberEmailAddressesAsString } + }, + StartsRelative => { + title => 'Starts', + attribute => 'Starts', + value => sub { return $_[0]->StartsObj->AgeAsString } + }, + StartedRelative => { + title => 'Started', + attribute => 'Started', + value => sub { return $_[0]->StartedObj->AgeAsString } + }, + CreatedRelative => { + title => 'Created', + attribute => 'Created', + value => sub { return $_[0]->CreatedObj->AgeAsString } + }, + LastUpdatedRelative => { + title => 'Last Updated', + attribute => 'LastUpdated', + value => sub { return $_[0]->LastUpdatedObj->AgeAsString } + }, + ToldRelative => { + title => 'Told', + attribute => 'Told', + value => sub { return $_[0]->ToldObj->AgeAsString } + }, + DueRelative => { + title => 'Due', + attribute => 'Due', + value => sub { + my $date = $_[0]->DueObj; + if ($date && $date->Unix > 0 && $date->Unix < time()) { + return (\'<span class="overdue">' , $date->AgeAsString , \'</span>'); + } else { + return $date->AgeAsString; + } + } + }, + ResolvedRelative => { + title => 'Resolved', + attribute => 'Resolved', + value => sub { return $_[0]->ResolvedObj->AgeAsString } + }, + Starts => { + attribute => 'Starts', + value => sub { return $_[0]->StartsObj->AsString } + }, + Started => { + attribute => 'Started', + value => sub { return $_[0]->StartedObj->AsString } + }, + Created => { + attribute => 'Created', + value => sub { return $_[0]->CreatedObj->AsString } + }, + CreatedBy => { + attribute => 'CreatedBy', + title => 'Created By', + value => sub { return $_[0]->CreatorObj->Name } + }, + LastUpdated => { + attribute => 'LastUpdated', + title => 'Last Updated', + value => sub { return $_[0]->LastUpdatedObj->AsString } + }, + LastUpdatedBy => { + attribute => 'LastUpdatedBy', + title => 'Last Updated By', + value => sub { return $_[0]->LastUpdatedByObj->Name } + }, + Told => { + attribute => 'Told', + value => sub { return $_[0]->ToldObj->AsString } + }, + Due => { + attribute => 'Due', + value => sub { return $_[0]->DueObj->AsString } + }, + Resolved => { + attribute => 'Resolved', + value => sub { return $_[0]->ResolvedObj->AsString } + }, + + # Everything from LINKTYPEMAP + (map { + $_ => { value => LinkCallback( $_ ) } + } keys %RT::Ticket::LINKTYPEMAP), + + '_CLASS' => { + value => sub { return $_[1] % 2 ? 'oddline' : 'evenline' } + }, + +}; +</%ONCE> +<%init> +$m->comp( '/Elements/Callback', COLUMN_MAP => $COLUMN_MAP, _CallbackName => 'ColumnMap'); +return ColumnMap($Name, $Attr); +</%init> diff --git a/rt/html/Elements/Refresh b/rt/html/Elements/Refresh new file mode 100644 index 000000000..9f241d279 --- /dev/null +++ b/rt/html/Elements/Refresh @@ -0,0 +1,67 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME="<%$Name%>"> +<OPTION VALUE="-1" +%unless ($Default) { + SELECTED +%} +><&|/l&>Don't refresh this page.</&></OPTION> +%foreach my $value (@refreshevery) { +<OPTION VALUE="<%$value%>" +% if ( $Default && ($value == $Default)) { +SELECTED +% } +><&|/l, $value/60 &>Refresh this page every [_1] minutes.</&></OPTION> +%} +</SELECT> + +<%INIT> +my @refreshevery = qw(120 300 600 1200 3600 7200); +</%INIT> +<%ARGS> +$Name => undef +$Default => 0 +</%ARGS> diff --git a/rt/html/Elements/ScrubHTML b/rt/html/Elements/ScrubHTML new file mode 100644 index 000000000..94a729907 --- /dev/null +++ b/rt/html/Elements/ScrubHTML @@ -0,0 +1,71 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%init> +my $scrubber = HTML::Scrubber->new(); + +$scrubber->default( + 0, + { + '*' => 0, + id => 1, + class => 1, + href => qr{^(?:http:|ftp:|https:|/)}i, + # Match http, ftp and relative urls + face => 1, + size => 1, + target => 1 + } +); + +$scrubber->deny(qw[*]); +$scrubber->allow( + qw[A B U P BR I HR BR SMALL EM FONT SPAN DIV UL OL LI DL DT DD]); +$scrubber->comment(0); +return ( $scrubber->scrub($Content) ); +</%init> +<%args> +$Content => undef +</%args> diff --git a/rt/html/Elements/Section b/rt/html/Elements/Section new file mode 100644 index 000000000..afbb9cf38 --- /dev/null +++ b/rt/html/Elements/Section @@ -0,0 +1,56 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<TABLE WIDTH=100%> +<TR> +<TD> +<font size=+4><%$title%></font> +</TD> +</TR> +</TABLE> + +<%ARGS> +$title => undef +</%ARGS> diff --git a/rt/html/Elements/SelectAttachmentField b/rt/html/Elements/SelectAttachmentField new file mode 100644 index 000000000..ea1528c03 --- /dev/null +++ b/rt/html/Elements/SelectAttachmentField @@ -0,0 +1,54 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME="<%$Name%>"> +<OPTION VALUE="Subject"><&|/l&>Subject</&></OPTION> +<OPTION VALUE="Content"><&|/l&>Content</&></OPTION> +<OPTION VALUE="ContentType"><&|/l&>Content-Type</&></OPTION> +<OPTION VALUE="Filename"><&|/l&>Filename</&></OPTION> +</SELECT> +<%ARGS> +$Name => 'AttachmentField' +</%ARGS> diff --git a/rt/html/Elements/SelectBoolean b/rt/html/Elements/SelectBoolean new file mode 100644 index 000000000..a3f08fdbc --- /dev/null +++ b/rt/html/Elements/SelectBoolean @@ -0,0 +1,68 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME ="<%$Name%>"> +<OPTION VALUE="<%$TrueVal%>" <%$TrueDefault%>><%$True%></OPTION> +<OPTION VALUE="<%$FalseVal%>" <%$FalseDefault%>><%$False%></OPTION> +</SELECT> + +<%ARGS> +$Name => undef +$True => loc("is") +$Default => 'true' +$TrueVal => 1 +$FalseVal => 0 +$False => loc("isn't") +</%ARGS> + +<%INIT> +my ($TrueDefault, $FalseDefault); +if ($Default && $Default !~ /true/i) { + $FalseDefault = "SELECTED"; +} +else { + $TrueDefault = "SELECTED"; +} +</%INIT> diff --git a/rt/html/Elements/SelectCustomFieldOperator b/rt/html/Elements/SelectCustomFieldOperator new file mode 100644 index 000000000..8f7ea618b --- /dev/null +++ b/rt/html/Elements/SelectCustomFieldOperator @@ -0,0 +1,62 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME ="<%$Name%>"> +% while (my $option = shift @Options) { +% my $value = shift @Values; +<OPTION VALUE="<%$value%>" +% if ($Default eq $value) { +SELECTED +% } +><%$option%></OPTION> +% } +</SELECT> + +<%ARGS> +$Name => undef +@Options => ( loc('contains'), loc("doesn't contain"), loc('is'), loc("isn't"), loc('less than'), loc('greater than')) +@Values => ('LIKE', 'NOT LIKE', '=', '!=', '<', '>') +$Default => undef +</%ARGS> diff --git a/rt/html/Elements/SelectCustomFieldValue b/rt/html/Elements/SelectCustomFieldValue new file mode 100644 index 000000000..27d6c4995 --- /dev/null +++ b/rt/html/Elements/SelectCustomFieldValue @@ -0,0 +1,63 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Callback, %ARGS &> +% if ($CustomField->Type =~ /Select/i) { +% my $values = $CustomField->Values; +<select name="<%$Name%>"> +<option value="" SELECTED>-</option> +<option value="NULL"><&|/l&>(no value)</&></option> +% while (my $value = $values->Next) { +<option value="<%$value->Name%>"><%$value->Name%></option> +% } +</select> +% } +% else { +<input name="<%$Name%>" size="20"> +% } +<%args> +$Name => undef +$CustomField =>undef +</%args> diff --git a/rt/html/Elements/SelectDate b/rt/html/Elements/SelectDate new file mode 100644 index 000000000..d3815798b --- /dev/null +++ b/rt/html/Elements/SelectDate @@ -0,0 +1,71 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<INPUT NAME="<%$Name%>" VALUE="<%$Default%>" size=<%$Size%>> + +<%init> +unless ((defined $Default) or + ($current <= 0)) { + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = + localtime($current); + $Default = sprintf("%04d-%02d-%02d %02d:%02d", + $year+1900,$mon+1,$mday, + $hour,$min); +} + +unless ($Name) { + $Name = $menu_prefix. "_Date"; +} +</%init> + +<%args> + +$ShowTime => undef +$menu_prefix=>'' +$current=>time +$Default => undef +$Name => undef +$Size => 16 +</%args> diff --git a/rt/html/Elements/SelectDateRelation b/rt/html/Elements/SelectDateRelation new file mode 100644 index 000000000..ccf0c1121 --- /dev/null +++ b/rt/html/Elements/SelectDateRelation @@ -0,0 +1,58 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME ="<%$Name%>"> +<OPTION VALUE="<"><%$Before%></OPTION> +<OPTION VALUE="="><%$On%></OPTION> +<OPTION VALUE=">"><%$After%></OPTION> +</SELECT> + +<%ARGS> +$Name => undef +$Default => undef +$Before => loc('Before') +$On => loc('On') +$After => loc('After') +</%ARGS> diff --git a/rt/html/Elements/SelectDateType b/rt/html/Elements/SelectDateType new file mode 100644 index 000000000..7b3f0990f --- /dev/null +++ b/rt/html/Elements/SelectDateType @@ -0,0 +1,58 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME="<%$Name%>"> +<OPTION VALUE="Created"><&|/l&>Created</&></OPTION> +<OPTION VALUE="Started"><&|/l&>Started</&></OPTION> +<OPTION VALUE="Resolved"><&|/l&>Resolved</&></OPTION> +<OPTION VALUE="Told"><&|/l&>Last Contacted</&></OPTION> +<OPTION VALUE="LastUpdated"><&|/l&>Last Updated</&></OPTION> +<OPTION VALUE="Starts"><&|/l&>Starts</&></OPTION> +<OPTION VALUE="Due"><&|/l&>Due</&></OPTION> +<OPTION VALUE="Updated"><&|/l&>Updated</&></OPTION> +</SELECT> +<%ARGS> +$Name => 'DateType' +</%ARGS> diff --git a/rt/html/Elements/SelectEqualityOperator b/rt/html/Elements/SelectEqualityOperator new file mode 100644 index 000000000..0f8deea89 --- /dev/null +++ b/rt/html/Elements/SelectEqualityOperator @@ -0,0 +1,62 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME ="<%$Name%>"> +% while (my $option = shift @Options) { +% my $value = shift @Values; +<OPTION VALUE="<%$value%>" +% if ($Default eq $value) { +SELECTED +% } +><%$option%></OPTION> +% } +</SELECT> + +<%ARGS> +$Name => undef +@Options => (loc('less than'), loc('equal to'), loc('greater than'), loc('not equal to')) +@Values => qw(< = > !=) +$Default =>'' +</%ARGS> diff --git a/rt/html/Elements/SelectGroups b/rt/html/Elements/SelectGroups new file mode 100644 index 000000000..bc37fd69a --- /dev/null +++ b/rt/html/Elements/SelectGroups @@ -0,0 +1,60 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<select name="GroupField"> +% foreach my $col (RT::Group->BasicColumns) { +<option value="<% $col->[0] %>"><% loc($col->[1]) %> +% } +% while (my $CF = $CFs->Next) { +<option value="CustomField-<% $CF->Id %>"><&|/l&>CustomField</&>: <% $CF->Name %> +% } +</select> +<& /Elements/SelectMatch, Name=> 'GroupOp' &> +<input size=8 name="GroupString"> +<%INIT> +my $CFs = RT::CustomFields->new($session{'CurrentUser'}); +$CFs->LimitToChildType('RT::Group'); +$CFs->OrderBy( FIELD => 'Name' ); +</%INIT> diff --git a/rt/html/Elements/SelectLang b/rt/html/Elements/SelectLang new file mode 100644 index 000000000..a439ea330 --- /dev/null +++ b/rt/html/Elements/SelectLang @@ -0,0 +1,78 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME ="<%$Name%>"> +% if ($ShowNullOption) { +<OPTION VALUE="">-</OPTION> +% } +% foreach my $lang (@lang) { +<OPTION VALUE="<%$lang%>" <%($Default && ($lang eq $Default)) && 'SELECTED'%>><% $lang_to_desc{$lang} %> +% if (($Verbose) and (my $description = I18N::LangTags::List::native_name($lang)) ){ +(<%$description%>) +% } +</OPTION> +% } +</SELECT> +<%ARGS> +$ShowNullOption => 1 +$ShowAllQueues => 1 +$Name => undef +$Verbose => undef +$Default => 0 +$Lite => 0 +</%ARGS> + +<%ONCE> +use I18N::LangTags::List; +my (@lang, %lang_to_desc); +foreach my $lang (map { s/:://; s/_/-/g; $_ } grep { /^\w+::$/ } keys %RT::I18N::) { + next if $lang =~ /i-default|en-us/; + my $desc = I18N::LangTags::List::name($lang); + next unless ($desc); + $desc =~ s/(.*) (.*)/$2 ($1)/; + $lang_to_desc{$lang} = $desc; +} +@lang = sort { $lang_to_desc{$a} cmp $lang_to_desc{$b} } keys %lang_to_desc; +</%ONCE> diff --git a/rt/html/Elements/SelectLinkType b/rt/html/Elements/SelectLinkType new file mode 100644 index 000000000..28cb4419a --- /dev/null +++ b/rt/html/Elements/SelectLinkType @@ -0,0 +1,59 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME ="<%$Name%>"> +<OPTION VALUE="MemberOf"><&|/l&>Member of</&></OPTION> +<OPTION VALUE="DependsOn"><&|/l&>Depends on</&></OPTION> +<OPTION VALUE="RefersTo"><&|/l&>Refers to</&></OPTION> +</SELECT> + +<%ARGS> +$Name => "LinkType" +$Default => undef +</%ARGS> + +<%INIT> +# TODO handle Default +</%INIT> diff --git a/rt/html/Elements/SelectMatch b/rt/html/Elements/SelectMatch new file mode 100644 index 000000000..60949d979 --- /dev/null +++ b/rt/html/Elements/SelectMatch @@ -0,0 +1,80 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME ="<%$Name%>"> +<OPTION VALUE="LIKE" <%$LikeDefault%>><%$Like%></OPTION> +<OPTION VALUE="NOT LIKE" <%$NotLikeDefault%>><%$NotLike%></OPTION> +<OPTION VALUE="=" <%$TrueDefault%>><%$True%></OPTION> +<OPTION VALUE="!=" <%$FalseDefault%>><%$False%></OPTION> +</SELECT> + +<%ARGS> +$Name => undef +$Like => loc('contains') +$NotLike => loc("doesn't contain") +$True => loc('is') +$False => loc("isn't") +$Default => undef +</%ARGS> +<%INIT> + +my $TrueDefault = ''; +my $FalseDefault=''; +my $LikeDefault=''; +my $NotLikeDefault =''; + +if ($Default && $Default =~ /false/i) { + $FalseDefault = "SELECTED"; +} +elsif ($Default && $Default =~ /true/i) { + $TrueDefault = "SELECTED"; +} +elsif ($Default && $Default =~ /notlike/i) { + $NotLikeDefault = "SELECTED"; +} +else { + $LikeDefault = "SELECTED"; +} +</%INIT> diff --git a/rt/html/Elements/SelectNewTicketQueue b/rt/html/Elements/SelectNewTicketQueue new file mode 100644 index 000000000..d47b58a83 --- /dev/null +++ b/rt/html/Elements/SelectNewTicketQueue @@ -0,0 +1,81 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<LABEL ACCESSKEY="9"> +<SELECT NAME ="<%$Name%>"> +% foreach my $queue (@{$session{'create_in_queues'}}) { +<OPTION + VALUE="<%$queue->{'id'}%>" + <%$Default && ($queue->{'id'} == $Default) && 'SELECTED'%>> +<%$queue->{'Name'}%> +% if (($Verbose) and ($queue->{'Description'}) ){ +(<%$queue->{'Description'}%>) +% } +</OPTION> +% } +</SELECT> +</LABEL> + +<%INIT> +unless ($session{'create_in_queues'}) { + +@{$session{'create_in_queues'}} = (); +my $q=new RT::Queues($session{'CurrentUser'}); +$q->UnLimit; +while (my $queue=$q->Next) { + if ($queue->CurrentUserHasRight('CreateTicket')) { + my $ds = { Name => $queue->Name, Description => $queue->Description, id => $queue->id }; + push (@{$session{'create_in_queues'}}, $ds); + } +} +} +</%INIT> + + +<%ARGS> +$Name => 'Queue' +$Verbose => 0 +$Default => 0 +</%ARGS> diff --git a/rt/html/Elements/SelectOwner b/rt/html/Elements/SelectOwner new file mode 100644 index 000000000..85843e5f0 --- /dev/null +++ b/rt/html/Elements/SelectOwner @@ -0,0 +1,108 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME="<%$Name%>"> +%if ($DefaultValue) { +<OPTION <% !$Default ? "SELECTED" : '' %> VALUE=""><%$DefaultLabel%></OPTION> +%} +%foreach my $User ( @users) { +<OPTION <% ($User->Id == $Default) ? "SELECTED" : ''%> +%if ($ValueAttribute eq 'id') { + value="<%$User->id%>" +%} elsif ($ValueAttribute eq 'Name') { + value="<%$User->Name%>" +%} +><%$User->Name()%></OPTION> +%} +</SELECT> +<%INIT> +my @objects; +my @users; + +if ($TicketObj) { + @objects = ($TicketObj); +} +elsif ($QueueObj) { + @objects = ($QueueObj); +} +elsif ($cfqueues) { + @objects = keys %{$cfqueues}; +} +else { + # Let's check rights on an empty queue object. that will do a search for any queue. + my $queue = RT::Queue->new($session{'CurrentUser'}); + push( @objects, $queue ); +} + +my %user_uniq_hash; + + +foreach my $object (@objects) { + my $Users = RT::Users->new($session{CurrentUser}); + $Users->WhoHaveRight(Right => 'OwnTicket', Object => $object, IncludeSystemRights => 1, IncludeSuperusers => 0); + while (my $User = $Users->Next()) { + next if ($User->id == $RT::Nobody->id); # skip nobody here, so we can make them first later + $user_uniq_hash{$User->Id()} = $User; + } +} + +@users = sort { uc($a->Name) cmp uc($b->Name) } values %user_uniq_hash; +unshift(@users, $RT::Nobody); + + + +</%INIT> + +<%ARGS> +$QueueObj => undef +$Name => undef +$Default => 0 +$User => undef +$TicketObj => undef +$DefaultValue => 1 +$DefaultLabel => "-" +$ValueAttribute => 'id' +$cfqueues => undef +</%ARGS> diff --git a/rt/html/Elements/SelectQueue b/rt/html/Elements/SelectQueue new file mode 100644 index 000000000..56aede89f --- /dev/null +++ b/rt/html/Elements/SelectQueue @@ -0,0 +1,82 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% if ($Lite) { +% my $d = new RT::Queue($session{'CurrentUser'}); +% $d->Load($Default); +<INPUT NAME="<%$Name%>" size=25 DEFAULT="<%$d->Name%>"> +% } else { +<SELECT NAME ="<%$Name%>"> +% if ($ShowNullOption) { +<OPTION VALUE="">-</OPTION> +% } +% while (my $queue=$q->Next) { +% if ($ShowAllQueues || $queue->CurrentUserHasRight($CheckQueueRight)) { +<OPTION VALUE="<%($NamedValues ? $queue->Name : $queue->Id) %>" <%( $queue->Id eq $Default ? 'SELECTED' : '')%>><%$queue->Name%> +% if (($Verbose) and ($queue->Description) ){ +(<%$queue->Description%>) +% } +</OPTION> +% } +% } +</SELECT> +% } +<%ARGS> +$CheckQueueRight => 'CreateTicket' +$ShowNullOption => 1 +$ShowAllQueues => 1 +$Name => undef +$Verbose => undef +$NamedValues => 0 +$Default => 0 +$Lite => 0 +</%ARGS> + +<%INIT> + +my $q=new RT::Queues($session{'CurrentUser'}); +$q->UnLimit; + +</%INIT> diff --git a/rt/html/Elements/SelectResultsPerPage b/rt/html/Elements/SelectResultsPerPage new file mode 100644 index 000000000..65ed536d6 --- /dev/null +++ b/rt/html/Elements/SelectResultsPerPage @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# TODO: Better default handling + +<SELECT NAME ="<%$Name%>"> +% foreach my $value (@values) { +<OPTION VALUE="<%$value%>" <% $value == $Default && 'SELECTED' %>> +<% shift @labels %> +</OPTION> +% } +</SELECT> + +<%INIT> +my @values = qw(0 10 25 50 100); +my @labels = (loc('Unlimited'), qw(10 25 50 100)); +</%INIT> +<%ARGS> + +$Name => undef +$Default => 50 + +</%ARGS> diff --git a/rt/html/Elements/SelectSortOrder b/rt/html/Elements/SelectSortOrder new file mode 100644 index 000000000..f6dd70ded --- /dev/null +++ b/rt/html/Elements/SelectSortOrder @@ -0,0 +1,63 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME="<%$Name%>"> +%foreach my $order (@orders) { +<OPTION VALUE="<%$order%>" <%$order eq $Default && 'SELECTED' %>> +<% shift @order_names %> +</OPTION> +% } +</SELECT> + +<%INIT> +my @orders = qw (ASC DESC); +my @order_names = (loc('Ascending'), loc('Descending')); + +</%INIT> + +<%ARGS> +$Name => 'SortOrder' +$Default => 'ASC' +</%ARGS> diff --git a/rt/html/Elements/SelectStatus b/rt/html/Elements/SelectStatus new file mode 100644 index 000000000..fa76a3e5d --- /dev/null +++ b/rt/html/Elements/SelectStatus @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME ="<%$Name%>"> +%if ($DefaultValue) { +<OPTION <% !$Default && "SELECTED" %> VALUE=""><%$DefaultLabel%></OPTION> +%} +%foreach my $status (@status) { +%next if ($SkipDeleted && $status eq 'deleted'); +<OPTION <% ($status eq $Default) && "SELECTED" %> VALUE="<%$status%>"><%loc($status)%></OPTION> +% } +</SELECT> +<%ONCE> +my $queue = new RT::Queue($session{'CurrentUser'}); +my @status = $queue->StatusArray(); +</%ONCE> +<%ARGS> +$Name => undef +$Default => '' +$SkipDeleted => 0 +$DefaultValue => 1 +$DefaultLabel => "-" +</%ARGS> diff --git a/rt/html/Elements/SelectTicketSortBy b/rt/html/Elements/SelectTicketSortBy new file mode 100644 index 000000000..3e05dcce9 --- /dev/null +++ b/rt/html/Elements/SelectTicketSortBy @@ -0,0 +1,60 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME="<%$Name%>"> +% foreach my $field (@sortfields) { +<OPTION VALUE="<%$field%>" <% $field eq $Default && 'SELECTED'%>><% loc($field) %></OPTION> +% } +</SELECT> + +<%INIT> +my $tickets = new RT::Tickets($session{'CurrentUser'}); +my @sortfields = $tickets->SortFields(); + +</%INIT> +<%ARGS> +$Name => 'SortTicketsBy' +$Default => 'id' +</%ARGS> diff --git a/rt/html/Elements/SelectTicketTypes b/rt/html/Elements/SelectTicketTypes new file mode 100644 index 000000000..a905f6067 --- /dev/null +++ b/rt/html/Elements/SelectTicketTypes @@ -0,0 +1,56 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME="<%$Name%>"> +%foreach (@Types) { +<OPTION VALUE="<% $_ %>" <% ($_ eq $Default) && "SELECTED" %>><&|/l&><% $_ %></&> +%} +</SELECT> + +<%ARGS> +$Name => 'TickType' +$Default => undef +@Types => qw(Approval Ticket) +</%ARGS> diff --git a/rt/html/Elements/SelectUsers b/rt/html/Elements/SelectUsers new file mode 100644 index 000000000..dfe816e49 --- /dev/null +++ b/rt/html/Elements/SelectUsers @@ -0,0 +1,60 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<select name="UserField"> +% foreach my $col (RT::User->BasicColumns) { +<option value="<% $col->[0] %>"><% loc($col->[1]) %> +% } +% while (my $CF = $CFs->Next) { +<option value="CustomField-<% $CF->Id %>"><&|/l&>CustomField</&>: <% $CF->Name %> +% } +</select> +<& /Elements/SelectMatch, Name=> 'UserOp' &> +<input size=8 name="UserString"> +<%INIT> +my $CFs = RT::CustomFields->new($session{'CurrentUser'}); +$CFs->LimitToChildType('RT::User'); +$CFs->OrderBy( FIELD => 'Name' ); +</%INIT> diff --git a/rt/html/Elements/SelectWatcherType b/rt/html/Elements/SelectWatcherType new file mode 100644 index 000000000..6ba9c7aa0 --- /dev/null +++ b/rt/html/Elements/SelectWatcherType @@ -0,0 +1,69 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME ="<%$Name%>"> +% if ($AllowNull) { +<OPTION VALUE="">-</OPTION> +% } +%for my $option (@types) { +<OPTION VALUE="<%$option%>" <%$option eq $Default && "SELECTED"%>><%loc($option)%></OPTION> +%} +</SELECT> + +<%INIT> +my @types; +if ($Scope =~ 'queue') { + @types = qw(Cc AdminCc); +} +else { + @types = qw(Requestor Cc AdminCc); +} +</%INIT> +<%ARGS> +$AllowNull => 1 +$Default=>undef +$Scope => 'ticket' +$Name => 'WatcherType' +</%ARGS> diff --git a/rt/html/Elements/SetupSessionCookie b/rt/html/Elements/SetupSessionCookie new file mode 100644 index 000000000..bd7861355 --- /dev/null +++ b/rt/html/Elements/SetupSessionCookie @@ -0,0 +1,114 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%init> +return if $m->is_subrequest; # avoid reentrancy, as suggested by masonbook + +my %cookies = CGI::Cookie->fetch(); +my $cookiename = "RT_SID_".$RT::rtname.".".$ENV{'SERVER_PORT'}; +my %backends = ( + mysql => 'Apache::Session::MySQL', + Pg => 'Apache::Session::Postgres', +# Oracle => 'Apache::Session::Oracle', +) unless $RT::WebSessionClass; +my $session_class = $RT::WebSessionClass || $backends{$RT::DatabaseType} || 'Apache::Session::File'; +my $pm = "$session_class.pm"; $pm =~ s|::|/|g; require $pm; + + # morning bug avoidance attempt -- pdh 20030815 + unless ($RT::Handle->dbh && $RT::Handle->dbh->ping) { + $RT::Handle->Connect(); + } + eval { + tie %session, $session_class, + $SessionCookie || ( $cookies{$cookiename} ? $cookies{$cookiename}->value() : undef ), + $backends{$RT::DatabaseType} ? { + Handle => $RT::Handle->dbh, + LockHandle => $RT::Handle->dbh, + } : { + Directory => $RT::MasonSessionDir, + LockDirectory => $RT::MasonSessionDir, + }; + }; + if ($@) { + + # If the session is invalid, create a new session. + if ( $@ =~ /Object does not/i ) { + tie %session, $session_class, undef, $backends{$RT::DatabaseType} + ? { + Handle => $RT::Handle->dbh, + LockHandle => $RT::Handle->dbh, + } + : { + Directory => $RT::MasonSessionDir, + LockDirectory => $RT::MasonSessionDir, + }; + undef $cookies{$cookiename}; + } + else { + die loc("RT couldn't store your session.") . "\n" + . loc( +"This may mean that that the directory '[_1]' isn't writable or a database table is missing or corrupt.", + $RT::MasonSessionDir + ) + . "\n\n" + . $@; + } + } + + if ( !$cookies{$cookiename} ) { + my $cookie = new CGI::Cookie( + -name => $cookiename, + -value => $session{_session_id}, + -path => '/', + ); + $r->headers_out->{'Set-Cookie'} = $cookie->as_string; + + } + + return(); +</%init> +<%args> +$SessionCookie => '' +</%args> diff --git a/rt/html/Elements/ShowCustomFieldBinary b/rt/html/Elements/ShowCustomFieldBinary new file mode 100644 index 000000000..ea9e5ae83 --- /dev/null +++ b/rt/html/Elements/ShowCustomFieldBinary @@ -0,0 +1,49 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<a href="<%$RT::WebPath%>/Download/CustomFieldValue/<% $Object->Id %>/<% $Object->Content %>"><% $Object->Content %></a> +<%ARGS> +$Object => undef +</%ARGS> diff --git a/rt/html/Elements/ShowCustomFieldImage b/rt/html/Elements/ShowCustomFieldImage new file mode 100644 index 000000000..7fa5e46d1 --- /dev/null +++ b/rt/html/Elements/ShowCustomFieldImage @@ -0,0 +1,51 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% my $url = $RT::WebPath . "/Download/CustomFieldValue/".$Object->Id.'/'.$Object->Content; +<a href="<% $url %>"><% $Object->Content %></a> +<img type="<% $Object->ContentType %>" height=64 src="<% $url %>" align="middle"> +<%ARGS> +$Object +</%ARGS> diff --git a/rt/html/Elements/ShowCustomFieldWikitext b/rt/html/Elements/ShowCustomFieldWikitext new file mode 100644 index 000000000..ab7c27b8b --- /dev/null +++ b/rt/html/Elements/ShowCustomFieldWikitext @@ -0,0 +1,55 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% my $content = $Object->LargeContent || $Object->Content; +% $content = $m->comp('/Elements/ScrubHTML', Content => $content); +% my $wiki_content = Text::WikiFormat::format( $content."\n" , {}, { extended => 1, absolute_links => 1 }); +<%$wiki_content|n%> +<%init> +use Text::WikiFormat; +</%init> +<%ARGS> +$Object +</%ARGS> diff --git a/rt/html/Elements/ShowCustomFields b/rt/html/Elements/ShowCustomFields new file mode 100644 index 000000000..7591fa3aa --- /dev/null +++ b/rt/html/Elements/ShowCustomFields @@ -0,0 +1,77 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<table> +% my @entry_fields; +% while (my $CustomField = $CustomFields->Next()) { +% my $Values = $Object->CustomFieldValues($CustomField->Id); + <tr> + <td class="label"><%$CustomField->Name%>:</td> + <td class="value"> +<ul> +% while (my $Value = $Values->Next()) { +<li> +% my $comp = "ShowCustomField".$CustomField->Type; +% if ($m->comp_exists($comp)) { +<& $comp, Object => $Value &> +% } else { +<%$Value->Content%> +% } +</li> +% } +% unless ($Values->Count()) { +<li><i><&|/l&>(no value)</&></i></li> +% } +</ul> + </td> + </tr> +% } +</table> +<%INIT> +my $CustomFields = $Object->CustomFields; +</%INIT> +<%ARGS> +$Object => undef +</%ARGS> diff --git a/rt/html/Elements/ShowLink b/rt/html/Elements/ShowLink new file mode 100644 index 000000000..5929a968e --- /dev/null +++ b/rt/html/Elements/ShowLink @@ -0,0 +1,62 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<A href="<%$URI->Resolver->HREF%>"> +% if ($URI->IsLocal) { +% my $member = $URI->Object; +% if (UNIVERSAL::isa($member, "RT::Ticket")) { +<%$member->Id%>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> [<% loc($member->Status) %>] +% } elsif ( UNIVERSAL::can($member, 'Name')) { +<%$URI->Resolver->AsString%>: <%$member->Name%> +% } else { +<%$URI->Resolver->AsString%> +% } +% } else { +<%$URI->Resolver->AsString%> +% } +</a> +<%ARGS> +$URI => undef +</%ARGS> diff --git a/rt/html/Elements/ShowLinks b/rt/html/Elements/ShowLinks new file mode 100755 index 000000000..c9279a5db --- /dev/null +++ b/rt/html/Elements/ShowLinks @@ -0,0 +1,109 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<table> + <tr> + <td class="labeltop"><&|/l&>Depends on</&>:</td> + <td class="value"> +<ul> +% while (my $Link = $Ticket->DependsOn->Next) { +<li><& ShowLink, URI => $Link->TargetURI &> +% } +</ul> + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Depended on by</&>:</td> + <td class="value"> +<ul> +% while (my $Link = $Ticket->DependedOnBy->Next) { +<li><& ShowLink, URI => $Link->BaseURI &> +% } +</ul> + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Parents</&>:</td> + <td class="value"> +<ul> +% while (my $Link = $Ticket->MemberOf->Next) { +<li><& ShowLink, URI => $Link->TargetURI &> +% } +</ul> + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Children</&>:</td> + <td class="value"><& /Ticket/Elements/ShowMembers, Ticket => $Ticket &></td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Refers to</&>:</td> + <td class="value"> +<ul> +% while (my $Link = $Ticket->RefersTo->Next) { +<li><& ShowLink, URI => $Link->TargetURI &> +% } +</ul> + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Referred to by</&>:</td> + <td class="value"> + <ul> +% while (my $Link = $Ticket->ReferredToBy->Next) { +<li><& ShowLink, URI => $Link->BaseURI &> +% } +</ul> + </td> + </tr> + +% # Allow people to add more rows to the table +% $m->comp('/Elements/Callback', %ARGS ); + +</table> + +<%ARGS> +$Ticket => undef +</%ARGS> diff --git a/rt/html/Elements/ShowMemberships b/rt/html/Elements/ShowMemberships new file mode 100644 index 000000000..3936d5080 --- /dev/null +++ b/rt/html/Elements/ShowMemberships @@ -0,0 +1,86 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<ul> +% while ( my $GroupMember = $GroupMembers->Next ) { +% my $Group = RT::Group->new($session{'CurrentUser'}); +% $Group->Load($GroupMember->GroupId) or next; +% if ($Group->Domain eq 'UserDefined') { +<li><a href="<%$RT::WebPath%>/Admin/Groups/Modify.html?id=<% $Group->Id %>"><% $Group->Name %></a></li> +% } elsif ($Group->Domain eq 'SystemInternal') { +<li><em><% loc($Group->Type) %></em></li> +% } +% } +</ul> +<%INIT> +my $GroupMembers = RT::GroupMembers->new($session{'CurrentUser'}); +$GroupMembers->Limit( FIELD => 'MemberId', VALUE => $UserObj->Id ); +my $alias = $GroupMembers->Join( + TYPE => 'left', + ALIAS1 => 'main', + FIELD1 => 'GroupId', + TABLE2 => 'Groups', + FIELD2 => 'id' +); +$GroupMembers->Limit( + ALIAS => $alias, + FIELD => 'Domain', + OPERATOR => '=', + VALUE => 'SystemInternal', +); +$GroupMembers->Limit( + ALIAS => $alias, + FIELD => 'Domain', + OPERATOR => '=', + VALUE => 'UserDefined', +); +$GroupMembers->OrderByCols( + { ALIAS => $alias, FIELD => 'Domain' }, + { ALIAS => $alias, FIELD => 'Name' }, +); +</%INIT> +<%ARGS> +$UserObj +</%ARGS> diff --git a/rt/html/Elements/SimpleSearch b/rt/html/Elements/SimpleSearch new file mode 100644 index 000000000..e76f801df --- /dev/null +++ b/rt/html/Elements/SimpleSearch @@ -0,0 +1,49 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<form action="<% $RT::WebPath %>/index.html"> +<input size="12" name="q" autocomplete="off" accesskey="0"> +<input type="submit" value="<&|/l&>Search tickets</&>"> +</form> diff --git a/rt/html/Elements/Submit b/rt/html/Elements/Submit new file mode 100644 index 000000000..9d8dca20f --- /dev/null +++ b/rt/html/Elements/Submit @@ -0,0 +1,105 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% if ($CheckAll or $ClearAll) { +<script><!-- +function set_checkbox (obj, val) { + var i; + var myfield = obj.form.getElementsByTagName('input'); + for (i = 0; i < myfield.length; i++) { + if (myfield[i].type == 'checkbox') { + myfield[i].checked = val; + } + } +} +--></script> +% } +<TABLE WIDTH=100% BGCOLOR="<%$color%>" CELLSPACING=0 BORDER=0 CELLPADDING=0 > +<TR> +<TD> +% if ($CheckAll) { +<INPUT TYPE=BUTTON VALUE="<%$CheckAllLabel%>" ONCLICK="set_checkbox(this, true)"> +% } +% if ($ClearAll) { +<INPUT TYPE=BUTTON VALUE="<%$ClearAllLabel%>" ONCLICK="set_checkbox(this, false)"> +% } +% if ($Reset) { +<INPUT TYPE=RESET VALUE="<%$ResetLabel%>"> +%} +</TD> +<TD> + +</TD> +<TD ALIGN=RIGHT VALIGN=CENTER><FONT COLOR=#ffd800> +% if ($AlternateLabel) { +<B><%$AlternateCaption%> +<INPUT TYPE=SUBMIT +%if ($Name) { +NAME="<%$Name%>" +%} +VALUE='<%$AlternateLabel%>'></B> +% } +<B><%$Caption%> <INPUT TYPE=SUBMIT +%if ($Name) { +NAME="<%$Name%>" +% } + VALUE='<%$Label%>'></B></FONT> +</TD> +</TR> +</TABLE> +<%ARGS> +$color => "#336699" +$Caption => '' +$AlternateCaption => undef +$AlternateLabel => undef +$Label => loc('Submit') +$Name => undef +$CheckAll => undef +$CheckAllLabel => loc('Check All') +$ClearAll => undef +$ClearAllLabel => loc('Clear All') +$Reset => undef +$ResetLabel => loc('Reset') +</%ARGS> diff --git a/rt/html/Elements/Tabs b/rt/html/Elements/Tabs new file mode 100644 index 000000000..f5839a9e5 --- /dev/null +++ b/rt/html/Elements/Tabs @@ -0,0 +1,122 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/PageLayout, + current_toptab => $current_toptab, + current_tab => $current_tab, + toptabs => $toptabs, + topactions => $topactions, + tabs => $tabs, + actions => $actions, + subactions => $subactions, + title => $Title +&> +<a name="skipnav" id="skipnav" accesskey="8"></a> +<%INIT> +my $action; +my $basetopactions = { + A => { html => $m->scomp('/Elements/CreateTicket') + }, + B => { html => $m->scomp('/Elements/SimpleSearch') + } + }; +my $basetabs = { + ' A'=> { title => 'Billing Main', + path => &RT::URI::freeside::FreesideURL(), + }, + A => { #title => loc('Homepage'), + title => 'Ticketing Main', + path => '', + }, + B => { title => loc('Tickets'), + path => 'Search/Build.html' + }, + C => { title => loc('Tools'), + path => 'Tools/Offline.html' + }, + P => { title => loc('Approval'), + path => 'Approvals/' + }, + }; + +if ($session{'CurrentUser'}->HasRight( Right => 'ShowConfigTab', + Object => $RT::System )) { + $basetabs->{E} = { title => loc('Configuration'), + path => 'Admin/', + }; +} + +if ($session{'CurrentUser'}->HasRight( Right => 'ModifySelf', + Object => $RT::System )) { + $basetabs->{K} = { title => loc('Preferences'), + path => 'User/Prefs.html' + }; +} + +if (!defined $toptabs) { + $toptabs = $basetabs; +} +if (!defined $topactions) { + $topactions = $basetopactions; +} + + require RT::URI::freeside; + + # Now let callbacks add their extra tabs + $m->comp('/Elements/Callback', + topactions => $topactions, + toptabs => $toptabs, %ARGS); + +</%INIT> +<%ARGS> +$current_toptab => undef +$current_tab => undef +$toptabs => undef +$topactions => undef +$tabs => undef +$actions => undef +$subactions => undef +$Title => undef +</%ARGS> diff --git a/rt/html/Elements/TicketList b/rt/html/Elements/TicketList new file mode 100644 index 000000000..1a531274f --- /dev/null +++ b/rt/html/Elements/TicketList @@ -0,0 +1,154 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<TABLE BORDER=0 cellspacing=0 cellpadding=1 WIDTH=100%> + +% if ($ShowHeader) { +<& /Elements/CollectionAsTable/Header, + Format => \@Format, + FormatString => $Format, + AllowSorting => $AllowSorting, + Order => $Order, + Query => $Query, + Rows => $Rows, + Page => $Page, + OrderBy => $OrderBy , + BaseURL => $BaseURL, + maxitems => $maxitems &> +% } + +% my $i; +% while (my $record = $Collection->Next) { +% $i++; +% # Every ten rows, flush the buffer and put something on the page. +% $m->flush_buffer() unless ($i % 10); +<& /Elements/CollectionAsTable/Row, Format => \@Format, i => $i, record => $record, maxitems => $maxitems &> +% } + +</TABLE> + +% if ($Rows && $ShowNavigation) { +<hr> +% my $oddRows; +% if (($TotalFound % $Rows) == 0) { +% $oddRows = 0; +% } else { $oddRows = 1; } +<&|/l, $Page, int($TotalFound/$Rows)+$oddRows&>Page [_1] of [_2]</&> + +<%perl> +my $prev = $m->comp( + '/Elements/QueryString', + Query => $Query, + Format => $Format, + Rows => $Rows, + OrderBy => $OrderBy, + Order => $Order, + Page => ( $Page - 1 ) +); +my $next = $m->comp( + '/Elements/QueryString', + Query => $Query, + Format => $Format, + Rows => $Rows, + OrderBy => $OrderBy, + Order => $Order, + Page => ( $Page + 1 ) +); +</%perl> +% if ($Page > 1) { +<A href="<%$BaseURL%><%$prev%>"><&|/l&>Previous Page</&></a> +% } +% if (($Page * $Rows) < $TotalFound) { +<A href="<%$BaseURL%><%$next%>"><&|/l&>Next Page</&></a> +% } +% } +<%INIT> +my $maxitems = 0; + +$Format ||= $RT::DefaultSearchResultFormat; +# Scrub the html of the format string to remove any potential nasties. +$Format = $m->comp('/Elements/ScrubHTML', Content => $Format); + + +unless ($Collection) { + $Collection = RT::Tickets->new($session{'CurrentUser'}); + $Collection->FromSQL($Query); +} + +my (@Format) = $m->comp('/Elements/CollectionAsTable/ParseFormat', Format => $Format); + +# Find the maximum number of items in any row, so we can pad the table. +my $item = 0; +foreach my $col (@Format) { + $item++; + if ( $col->{title} eq 'NEWLINE' ) { + $item = 0; + } + else { + $maxitems = $item if $item > $maxitems; + } +} + + +$Collection->OrderBy(FIELD => $OrderBy, ORDER => $Order); +$Collection->RowsPerPage($Rows) if ($Rows); +$Collection->GotoPage($Page-1); # SB uses page 0 as the first page +my $TotalFound = $Collection->CountAll(); + +</%INIT> +<%ARGS> +$Query => undef +$Rows => 50 +$Page => 1 +$Title => 'Ticket Search' +$Collection => undef +$AllowSorting => undef +$Order => undef +$OrderBy => undef +$BaseURL => undef +$Format => $RT::DefaultSearchResultFormat +$ShowNavigation => 1 +$ShowHeader => 1 +</%ARGS> diff --git a/rt/html/Elements/TitleBox b/rt/html/Elements/TitleBox new file mode 100644 index 000000000..3c638e2d3 --- /dev/null +++ b/rt/html/Elements/TitleBox @@ -0,0 +1,46 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& TitleBoxStart, %ARGS&><%$m->content|n%><& TitleBoxEnd&> diff --git a/rt/html/Elements/TitleBoxEnd b/rt/html/Elements/TitleBoxEnd new file mode 100644 index 000000000..d791e3a4f --- /dev/null +++ b/rt/html/Elements/TitleBoxEnd @@ -0,0 +1,56 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} + </TD> + </TR> +</TABLE> +% #Manually flush the content buffer after each titlebox is displayed +% $m->flush_buffer(); + +<%ARGS> +$title => undef +$content => undef +</%ARGS> + diff --git a/rt/html/Elements/TitleBoxStart b/rt/html/Elements/TitleBoxStart new file mode 100644 index 000000000..804e5cfaa --- /dev/null +++ b/rt/html/Elements/TitleBoxStart @@ -0,0 +1,88 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<TABLE CLASS="box <%$class|n%>" + BGCOLOR="<%$color%>" + CELLSPACING=0 + BORDER=0 + WIDTH="<%$width%>" + CELLPADDING="0"> + + <TR> + <TH + <%$color && "style=\"color: $color;\""|n%> + <%$class ? "class=\"$class\"" : "class=\"titlebox\""|n%>> + <span class="titleboxclose"> + <a href="#" onClick="hideshow('<%$id%>')">X</A></span> + <span class="titleboxtitle"> + <b><% $title_href && "<A $title_class HREF=\"$title_href\">"|n%><%$title |n %><% $title_href && "</A>" |n%></b> + </span> + </TH> + <TH + <%$color && "style=\"color: $color;\""|n%> + <%$class ? "class=\"$class\"": "class=\"titleboxright\""|n%>> + <span class="titleboxright"><%$titleright ? $titleright : ' ' |n %></span> + </TH> + </TR> + <tr id="element-<%$id%>"> + <td bgcolor="<%$contentbg%>" colspan="3" class="<%defined($bodyclass) ? $bodyclass : $class|n%>"> +<%ARGS> +$width => "100%" +$class => undef +$bodyclass => undef +$title_href => undef +$title => undef +$title_class => '' + +$titleright_href => undef +$titleright => undef +$contentbg => "#dddddd" +$color => "#336699" +</%ARGS> +<%init> +my $id = rand(2000); + +$title_class = "CLASS=\"$title_class\"" if $title_class; +</%init> diff --git a/rt/html/NoAuth/Logout.html b/rt/html/NoAuth/Logout.html new file mode 100644 index 000000000..b6a238bac --- /dev/null +++ b/rt/html/NoAuth/Logout.html @@ -0,0 +1,68 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<HTML> +<HEAD> +<TITLE>RT: Logout</TITLE> + <META HTTP-EQUIV="Refresh" CONTENT="0;URL=<%$URL%>"> +</HEAD> +<BODY> +<p><&|/l&>You have been logged out of RT.</&> + +<br> +<br> +<A HREF="<%$URL%>"><&|/l&>You're welcome to login again</&></a> + + +<%PERL> +if (defined %session) { + tied(%session)->delete; +} +$m->abort(); +</%PERL> + +<%ARGS> +$URL => $RT::WebPath."/" +</%ARGS> diff --git a/rt/html/NoAuth/Reminder.html b/rt/html/NoAuth/Reminder.html new file mode 100644 index 000000000..0793f6c96 --- /dev/null +++ b/rt/html/NoAuth/Reminder.html @@ -0,0 +1,48 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, title => loc('Password Reminder') &> + +<&|/l&>Not yet implemented.</&> diff --git a/rt/html/NoAuth/images/autohandler b/rt/html/NoAuth/images/autohandler new file mode 100644 index 000000000..2e428c157 --- /dev/null +++ b/rt/html/NoAuth/images/autohandler @@ -0,0 +1,24 @@ +<%init> + +# This autohandler will spit out RT's images if the user hasn't +# properly configured their webserver to stop RT from passing +# images through the mason handler. + +my $file = $m->base_comp->source_file; +my $type = "application/octet-stream"; + +if ($file =~ /\.(gif|png|jpe?g)$/i) { + $type = "image/$1"; + $type =~ s/jpg/jpeg/gi; +} + +die unless (-f $file && -r $file); +$r->content_type($type); +open (FILE, "<$file") || die; +{ + local $/ = \16384; + $m->out($_) while (<FILE>); + close(FILE); +} +$m->abort; +</%init> diff --git a/rt/html/NoAuth/images/bplogo.gif b/rt/html/NoAuth/images/bplogo.gif Binary files differnew file mode 100644 index 000000000..e2cf49c42 --- /dev/null +++ b/rt/html/NoAuth/images/bplogo.gif diff --git a/rt/html/NoAuth/images/favicon.png b/rt/html/NoAuth/images/favicon.png Binary files differnew file mode 100644 index 000000000..ed1ee37ff --- /dev/null +++ b/rt/html/NoAuth/images/favicon.png diff --git a/rt/html/NoAuth/images/small-logo.png b/rt/html/NoAuth/images/small-logo.png Binary files differnew file mode 100644 index 000000000..1e415e6d8 --- /dev/null +++ b/rt/html/NoAuth/images/small-logo.png diff --git a/rt/html/NoAuth/images/space.gif b/rt/html/NoAuth/images/space.gif Binary files differnew file mode 100644 index 000000000..1d11fa9ad --- /dev/null +++ b/rt/html/NoAuth/images/space.gif diff --git a/rt/html/NoAuth/webrt.css b/rt/html/NoAuth/webrt.css new file mode 100644 index 000000000..bc688ac1d --- /dev/null +++ b/rt/html/NoAuth/webrt.css @@ -0,0 +1,675 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +SPAN.nav { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 12px; +%# color: #FFFFFF; + color: #000000; + text-decoration: none; + white-space: nowrap} +.nav2 { font-size: 10px; + white-space: nowrap} +.nav { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 13px; +%# font-weight: normal; + font-weight: bold; +%# color: #FFFFFF; + color: #000000; + text-decoration: none; + white-space: nowrap} +.currentnav { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 13px; + font-weight: bold; + color: #FFFF66; + text-decoration: none; + white-space: nowrap} +.topnav { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 16px; + font-weight: normal; +%# color: #FFFFFF; + color: #000000; + text-decoration: none; + white-space: nowrap} + +%# .topnav is the original RT class for the sidebar navigation tabs. +%# Font-sizing by level depth was originally hard-coded into Elements/Menu. +%# This modification sets a different class name for each level, allowing +%# style sheet control over the formats. + +a.topnav-0 { font-family: Verdana, sans-serif; + font-size: 16px; + font-weight: normal; + color: #000000; + text-decoration: none; + white-space: nowrap} +a.topnav-1 { font-family: Verdana, sans-serif; + font-size: 14px; + font-weight: normal; + color: #000000; + text-decoration: none; + white-space: nowrap} +a.topnav-2 { font-family: Verdana, sans-serif; + font-size: 12px; + font-weight: normal; + color: #000000; + text-decoration: none; + white-space: nowrap} +a.topnav-3 { font-family: Verdana, sans-serif; + font-size: 11px; + font-weight: normal; + color: #000000; + text-decoration: none; + white-space: nowrap} +a.topnav-4 { font-family: Verdana, sans-serif; + font-size: 11px; + font-weight: normal; + color: #000000; + text-decoration: none; + white-space: nowrap} +a.topnav-5 { font-family: Verdana, sans-serif; + font-size: 11px; + font-weight: normal; + color: #000000; + text-decoration: none; + white-space: nowrap} +li.topnav-0-minor { + border-top: solid #777777 1px; + padding-top: .1em; + margin-top: .5em; +} +li.topnav-1-minor { + border-top: solid #777777 1px; + padding-top: .1em; + margin-top: .5em; +} +li.topnav-2-minor { + border-top: solid #777777 1px; + padding-top: .1em; + margin-top: .5em; +} +li.topnav-3-minor { + border-top: solid #777777 1px; + padding-top: .1em; + margin-top: .5em; +} +li.topnav-4-minor { + border-top: solid #777777 1px; + padding-top: .1em; + margin-top: .5em; +} +li.topnav-5-minor { + border-top: solid #777777 1px; + padding-top: .1em; + margin-top: .5em; +} +li.topnav-0-major { + border-bottom: solid black 1px; + padding-top: .25em; + padding-bottom: .5em; +} +li.topnav-1-major { + border-bottom: solid black 1px; + padding-top: .25em; + padding-bottom: .5em; +} +li.topnav-2-major { + border-bottom: solid black 1px; + padding-top: .25em; + padding-bottom: .5em; +} +li.topnav-3-major { + border-bottom: solid black 1px; + padding-top: .25em; + padding-bottom: .5em; +} +li.topnav-4-major { + border-bottom: solid black 1px; + padding-top: .25em; + padding-bottom: .5em; +} +li.topnav-5-major { + border-bottom: solid black 1px; + padding-top: .25em; + padding-bottom: .5em; +} + +.currenttopnav { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 16px; + font-weight: bold; +%# color: #FFFF66; + color: #000000; background-color: #cccccc; + text-decoration: none; + white-space: nowrap} + +%# .currenttopnav is the original RT class for the sidebar navigation tabs. +%# Font-sizing by level depth was originally hard-coded into Elements/Menu. +%# This modification sets a different class name for each level, allowing +%# style sheet control over the formats + +a.currenttopnav-0 { font-family: Verdana, sans-serif; + font-size: 16px; + font-weight: bold; + color: #000000; background-color: #cccccc; + text-decoration: none; + white-space: nowrap} +a.currenttopnav-1 { font-family: Verdana, sans-serif; + font-size: 14px; + font-weight: bold; + color: #000000; background-color: #cccccc; + text-decoration: none; + white-space: nowrap} +a.currenttopnav-2 { font-family: Verdana, sans-serif; + font-size: 12px; + font-weight: normal; + color: #000000; background-color: #cccccc; + text-decoration: none; + white-space: nowrap} +a.currenttopnav-3 { font-family: Verdana, sans-serif; + font-size: 11px; + font-weight: normal; + color: #000000; background-color: #cccccc; + text-decoration: none; + white-space: nowrap} +a.currenttopnav-4 { font-family: Verdana, sans-serif; + font-size: 11px; + font-weight: normal; + color: #000000; background-color: #cccccc; + text-decoration: none; + white-space: nowrap} +a.currenttopnav-5 { font-family: Verdana, sans-serif; + font-size: 11px; + font-weight: normal; + color: #000000; background-color: #cccccc; + text-decoration: none; + white-space: nowrap} +li.currenttopnav-0-minor { + border-top: solid #999999 1px; + padding-top: .1em; + margin-top: .5em; +} +li.currenttopnav-1-minor { + border-top: solid #777777 1px; + padding-top: .1em; + margin-top: .5em; +} +li.currenttopnav-2-minor { + border-top: solid #777777 1px; + padding-top: .1em; + margin-top: .5em; +} +li.currenttopnav-3-minor { + border-top: solid #777777 1px; + padding-top: .1em; + margin-top: .5em; +} +li.currenttopnav-4-minor { + border-top: solid #777777 1px; + padding-top: .1em; + margin-top: .5em; +} +li.currenttopnav-5-minor { + border-top: solid #777777 1px; + padding-top: .1em; + margin-top: .5em; +} +li.currenttopnav-0-major { + border-bottom: solid black 1px; + padding-top: .25em; + padding-bottom: .5em; +} +li.currenttopnav-1-major { + border-bottom: solid black 1px; + padding-top: .25em; + padding-bottom: .5em; +} +li.currenttopnav-2-major { + border-bottom: solid black 1px; + padding-top: .25em; + padding-bottom: .5em; +} +li.currenttopnav-3-major { + border-bottom: solid black 1px; + padding-top: .25em; + padding-bottom: .5em; +} +li.currenttopnav-4-major { + border-bottom: solid black 1px; + padding-top: .25em; + padding-bottom: .5em; +} +li.currenttopnav-5-major { + border-bottom: solid black 1px; + padding-top: .25em; + padding-bottom: .5em; +} + +.topactions { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 10px; + color: #FFFFFF; + text-decoration: none; + white-space: nowrap} +.subnav { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + font-weight: normal; + color: #FFFFFF; + text-decoration: none; + white-space: nowrap} +.currentsubnav { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + font-weight: bold; + color: #FFFF66; + text-decoration: none; + white-space: nowrap} +.error { background-color: #ff0000; + background-position: left top; + vertical-align: top; + text-align: left; + } +.oldblue { background-color: #0066CC; + background-position: left top; + vertical-align: top; + text-align: left; + } +.blue { + background-color: #4682B4; +%# background-color: #eeeeee; + background-position: left top; + vertical-align: top; + text-align: left; + } +%# Actually the "topactions" section +.blueright { background-color: #4682B4; + background-position: left top; + vertical-align: top; + text-align: right; + padding-right: 1em; + } +.olddarkblue { background-color: #003399; + background-position: left top; + vertical-align: top; + text-align: left; + } +.darkblue { + background-color: #000080; + background-position: left top; + vertical-align: top; + text-align: left; + } +.darkblueright { + background-color: #000080; + background-position: left top; + vertical-align: top; + text-align: right; + } +.lightgray { + background-color: #eeeeee; + background-position: left top; + vertical-align: top; + text-align: left; + } +.lightgrayright { + background-color: #eeeeee; + background-position: left top; + vertical-align: top; + text-align: right; + } +.mediumgray { + background-color: #cccccc; + background-position: left top; + vertical-align: top; + text-align: left; + } +.mediumgrayright { + background-color: #cccccc; + background-position: left top; + vertical-align: top; + text-align: right; + } +.white { + background-color: #ffffff; + background-position: left top; + vertical-align: top; + text-align: left; + } +.whiteright { + background-color: #ffffff; + background-position: left top; + vertical-align: top; + text-align: right; + } +.overdue { + color: red; +} + +div.messagebody { + padding: 2em; + +} + + +div.downloadattachment { + font-size: 10px; + text-align: right; + +} + + +td { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + background-position: left top; + } +.black { background-color: #000000; + background-position: left top; + } +span.rtname { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 18px; + font-weight: normal; + color: #ffffff} +span.title { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 20px; + font-weight: bold; + color: #ffffff} +.header { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 12px; + font-weight: bold; + color: #0066CC} +.subheader { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + font-weight: bold; + color: #0066CC } +.value { font-weight: bold; } +.entry { font-weight: normal; } +.label { font-weight: normal; + text-align: right; } +.labeltop { font-weight: normal; + text-align: right; + vertical-align: top } +.productnav { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + color: #000000; + text-align: center; + vertical-align: middle; + text-decoration: none} +.rtblue { background-color: #3399FF; + margin-top: 0.2em; + background-position: left top; + vertical-align: top } + + +.currenttab { margin: 0.2em; background: #336699; } +.othertab { margin: 0.2em; background: #efefef; } +.oddline { background-color : #ccccee; } + +UL.topnav LI :focus { text-decoration: underline; } + +TD.mainbody { + padding-top: 0.5em; + padding-left: 1em; + padding-right: 1em; + margin-left: 1em; + margin-right: 1em; +} + +td.boxcontainer + td.boxcontainer { + margin-left: 1em; + padding-left: 1em; + border-collapse: collapse; +} + +th.ticketheader { font-size: 80%; + font-weight: bold; + color: #336699; + background: #cccccc; +} + +th.titlebox { + text-align: left; + padding-left: 0.5em; + padding-right: 0.5em; + margin-left: 0.5em; + margin-right: 0.5em; + border-top: solid black 1px; + border-bottom: solid black 1px; +} +th.titleboxright { + text-align: right; + padding-left: 0.5em; + padding-right: 0.5em; + margin-left: 0.5em; + margin-right: 0.5em; + border-top: solid black 1px; + border-bottom: solid black 1px; +} + +TD.titlebox { + padding-left: 1em; + padding-right: 1em; + padding-top: 1em; + padding-bottom: 1em; +} + +SPAN.message { + font-size: 100%; + font-family: Verdana, Arial, Helvetica, sans-serif; +} + + +BODY { + color: #000; + background: #FFFFFF; + font-family: "Helvetica", sans-serif; + margin-top: 0px; + margin-bottom: 0px; + margin-left: 0px; + margin-right: 0px; + border-top: 0px; + border-bottom: 0px; + border-left: 0px; + border-right: 0px; +} + + +TR.oddline { + background-color : #ffffff; +} + +TR.evenline { + background-color : #ccccee; +} + +H1, H2, H3 { + margin-top: 0.2em; + color: #336699; + font-family: "Helvetica", sans-serif; + + clear: both; +} + + +DIV.endmatter { margin-left: -7% } +.bpscredits {margin-top: 1em; + text-align: right; + color: #666666; + } + + +A { font-weight: bold; color: #000000; + } + +.currenttab { color: #ffffff;} +.othertab { color: #336699; } + +.inverse { color: #ffffff; } + + + +A:link IMG, A:visited IMG { border-style: none } +a:focus {text-decoration: underline } +A IMG { color: white } /* The only way to hide the border in NS 4.x */ + +a:link { text-decoration: none} +a:visited { text-decoration: none} +a:hover { text-decoration: underline} +/* a:focus { background-color: #ccccee } */ + +.hide { + display: none; + color: white; +} + +SPAN.date { font-size: 0.8em } + +span.title { font-size: 1.6em; + vertical-align: middle; +%# color: #ffffff; + color: #000000; + } +span.productname { font-size: 2em; + color: #0066cc;} +SPAN.titleboxtitle, SPAN.titleboxclose { + font-size: 80%; + color: #ffffff; + vertical-align: middle; + text-align: left; + } +SPAN.titleboxtitle a { + color: #ffffff; +} +SPAN.titleboxtitle a:after { + content: "..."; +} + +SPAN.titleboxright { + font-size: 0.8em; + color: #ffffff; + vertical-align: middle; + text-align: right; + } + +SPAN.attribution { + font-weight: bold; +} + +SPAN.label { font-size: 0.8em; +} + +DIV.page-stats { font-size: 0.8em; + color: #cccccc; + text-align: right; + } + + +BLOCKQUOTE { + font-style: italic; +} + +.emphasized { + font-weight: bold +} + + +.oddline { + background-color : #ccccee; +} + +ul.topnav { + list-style: none; + margin-left: 0; + margin-right: 0.25em; + padding-left: 0.25em; + padding-bottom: 0; + padding-top:0; + margin-top: 0; + margin-bottom:0; +} + +.menu-major-separator { + border-bottom: solid white 1px; + padding-top: .25em; + padding-bottom: .5em; +} + +.menu-minor-separator { + border-top: solid #999999 1px; + padding-top: .1em; + margin-top: .5em; +} + +TH.collection-as-table { text-align: center; + font-size: 0.8em; + padding-left: .5em; + padding-right: .5em; + color: #333333; + background-color: #cccccc; + white-space: nowrap; + } + +TD.collection-as-table { text-align: left; + padding-left: .5em; + padding-right: .5em; + } + +textarea.signature { + width: 100%; +} +textarea.comments { + width: 100%; +} + +textarea.messagebox { + width: 100%; +} + +%# Provide a callback for adding/modifying the style sheet. +%# http://www.w3.org/TR/REC-CSS1 - section 3.2, says: +%# "latter specified rule wins" +<& /Elements/Callback &> +<%flags> +inherit => undef +</%flags> +<%init> +$r->content_type('text/css'); +#$r->headers_out->{'Expires'} = '+30m'; +</%init> diff --git a/rt/html/REST/1.0/Forms/queue/default b/rt/html/REST/1.0/Forms/queue/default new file mode 100644 index 000000000..c87c33cce --- /dev/null +++ b/rt/html/REST/1.0/Forms/queue/default @@ -0,0 +1,168 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/Forms/queue/default +%# +<%ARGS> +$id +$format => 's' +$changes => {} +</%ARGS> +<%perl> +my @comments; +my ($c, $o, $k, $e) = ("", [], {}, 0); +my %data = %$changes; +my $queue = new RT::Queue $session{CurrentUser}; +my @fields = qw(Name Description CorrespondAddress CommentAddress + InitialPriority FinalPriority DefaultDueIn); +my %fields = map { lc $_ => $_ } @fields; + +if ($id ne 'new') { + $queue->Load($id); + if (!$queue->Id) { + return [ "# Queue $id does not exist.", [], {}, 1 ]; + } +} +else { + if (%data == 0) { + return [ + "# Required: Name", + [ "id", @fields ], + { + id => 'queue/new', + Name => '<queue name>', + Description => "", + CommentAddress => "", + CorrespondAddress => "", + InitialPriority => "", + FinalPriority => "", + DefaultDueIn => "", + }, + 0 + ]; + } + else { + my %v; + my %create = %fields; + + foreach my $k (keys %data) { + if (exists $create{lc $k}) { + $v{$create{lc $k}} = delete $data{$k}; + } + } + + if ($v{Name} eq '<queue name>') { + my %o = keys %$changes; + delete @o{"id", @fields}; + return [ + "# Please set the queue name.", + [ "id", @fields, keys %o ], $changes, 1 + ]; + } + + $queue->Create(%v); + unless ($queue->Id) { + return [ "# Could not create queue.", [], {}, 1 ]; + } + + delete $data{id}; + $id = $queue->Id; + push(@comments, "# Queue $id created."); + goto DONE if %data == 0; + } +} + +if (%data == 0) { + my @data; + + push @data, [ id => "queue/".$queue->Id ]; + foreach my $key (@fields) { + push @data, [ $key => $queue->$key ]; + } + + my %k = map {@$_} @data; + $o = [ map {$_->[0]} @data ]; + $k = \%k; +} +else { + my ($get, $set, $key, $val, $n, $s); + + foreach $key (keys %data) { + $val = $data{$key}; + $key = lc $key; + $n = 1; + + if (exists $fields{$key}) { + $key = $fields{$key}; + $set = "Set$key"; + + next if $val eq $queue->$key; + ($n, $s) = $queue->$set($val); + } + elsif ($key ne 'id') { + $n = 0; + $s = "Unknown field."; + } + + SET: + if ($n == 0) { + $e = 1; + push @comments, "# $key: $s"; + unless (@$o) { + my %o = keys %$changes; + delete @o{"id", @fields}; + @$o = ("id", @fields, keys %o); + $k = $changes; + } + } + } + + push(@comments, "# Queue $id updated.") unless $n == 0; +} + +DONE: +$c ||= join("\n", @comments) if @comments; +return [ $c, $o, $k, $e ]; +</%perl> diff --git a/rt/html/REST/1.0/Forms/queue/ns b/rt/html/REST/1.0/Forms/queue/ns new file mode 100644 index 000000000..b0ba0036a --- /dev/null +++ b/rt/html/REST/1.0/Forms/queue/ns @@ -0,0 +1,60 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/Forms/queue/ns +%# +<%ARGS> +$id +</%ARGS> +<%perl> +use RT::Queues; + +my $queues = new RT::Queues $session{CurrentUser}; +$queues->Limit(FIELD => 'Name', OPERATOR => '=', VALUE => $id); +if ($queues->Count == 0) { + return (0, "No queue named $id exists."); +} +return $queues->Next->Id; +</%perl> diff --git a/rt/html/REST/1.0/Forms/ticket/attachments b/rt/html/REST/1.0/Forms/ticket/attachments new file mode 100644 index 000000000..ca75ce0d1 --- /dev/null +++ b/rt/html/REST/1.0/Forms/ticket/attachments @@ -0,0 +1,128 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/Forms/ticket/attachments +%# +<%ARGS> +$id +$args => undef +</%ARGS> +<%perl> +my @data; +my ($c, $o, $k, $e) = ("", [], {}, ""); +my $ticket = new RT::Ticket $session{CurrentUser}; + +$ticket->Load($id); +unless ($ticket->Id) { + return [ "# Ticket $id does not exist.", [], {}, 1 ]; +} + +my @arglist = split('/', $args); +my ($aid, $content); + +if ($arglist[1] eq 'content') { + $aid = $arglist[0]; + $content = 1; +} else { + $aid = $args; + $content = 0; +} + +if ($aid) { + unless ($aid =~ /^\d+$/) { + return [ "# Invalid attachment id: $aid", [], {}, 1 ]; + } + my $attachment = new RT::Attachment $session{CurrentUser}; + $attachment->Load($aid); + unless ($attachment->Id eq $aid) { + return [ "# Invalid attachment id: $aid", [], {}, 1 ]; + } + if ($content) { + $c = $attachment->OriginalContent; + } else { + my @data; + push @data, [ id => $attachment->Id ]; + push @data, [ Subject => $attachment->Subject ]; + push @data, [ Creator => $attachment->Creator ]; + push @data, [ Created => $attachment->Created ]; + push @data, [ Transaction => $attachment->TransactionId ]; + push @data, [ Parent => $attachment->Parent ]; + push @data, [ MessageId => $attachment->MessageId ]; + push @data, [ Filename => $attachment->Filename ]; + push @data, [ ContentType => $attachment->ContentType ]; + push @data, [ ContentEncoding => $attachment->ContentEncoding ]; + push @data, [ Headers => $attachment->Headers ]; + push @data, [ Content => $attachment->Content ]; + + my %k = map {@$_} @data; + $o = [ map {$_->[0]} @data ]; + $k = \%k; + } + +} +else { + my @attachments; + my $transactions = $ticket->Transactions; + while (my $t = $transactions->Next) { + my $attachments = $t->Attachments; + while (my $a = $attachments->Next) { + my $size = length($a->Content); + if ($size > 1024) { $size = int($size/102.4)/10 . "k" } + else { $size .= "b" } + push @attachments, $a->Id.": ".$a->Filename." (".$a->ContentType . " / ".$size.")"; + } + } + + if (@attachments) { + $o = [ "id", "Attachments" ]; + $k = { + id => "ticket/".$ticket->Id."/attachments", + Attachments => \@attachments + }; + } +} + +return [ $c, $o, $k, $e ]; +</%perl> diff --git a/rt/html/REST/1.0/Forms/ticket/default b/rt/html/REST/1.0/Forms/ticket/default new file mode 100644 index 000000000..78f6c9562 --- /dev/null +++ b/rt/html/REST/1.0/Forms/ticket/default @@ -0,0 +1,298 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/Forms/ticket/default +%# +<%ARGS> +$id +$changes => {} +$fields => undef +</%ARGS> +<%perl> +use MIME::Entity; + +my @comments; +my ($c, $o, $k, $e) = ("", [], {}, 0); +my %data = %$changes; +my $ticket = new RT::Ticket $session{CurrentUser}; +my @dates = qw(Created Starts Started Due Resolved Told); +my @people = qw(Requestors Cc AdminCc); +my @create = qw(Queue Requestor Subject Cc AdminCc Owner Status Priority + InitialPriority FinalPriority TimeEstimated TimeWorked + TimeLeft Starts Started Due Resolved); +my @simple = qw(Subject Status Priority Disabled TimeEstimated TimeWorked + TimeLeft InitialPriority FinalPriority); +my %dates = map {lc $_ => $_} @dates; +my %people = map {lc $_ => $_} @people; +my %create = map {lc $_ => $_} @create; +my %simple = map {lc $_ => $_} @simple; + +# Are we dealing with an existing ticket? +if ($id ne 'new') { + $ticket->Load($id); + if (!$ticket->Id) { + return [ "# Ticket $id does not exist.", [], {}, 1 ]; + } + elsif (!$ticket->CurrentUserHasRight('ShowTicket') || + (%data && !$ticket->CurrentUserHasRight('ModifyTicket'))) + { + my $act = %data ? "modify" : "display"; + return [ "# You are not allowed to $act ticket $id.", [], {}, 1 ]; + } +} +else { + if (%data == 0) { + # GET ticket/new: Return a suitable default form. + # We get defaults from queue/1 (XXX: What if it isn't there?). + my $due = new RT::Date $session{CurrentUser}; + my $queue = new RT::Queue $session{CurrentUser}; + my $starts = new RT::Date $session{CurrentUser}; + $queue->Load(1); + $due->SetToNow; + $due->AddDays($queue->DefaultDueIn) if $queue->DefaultDueIn; + $starts->SetToNow; + + return [ + "# Required: Queue, Requestor, Subject", + [ qw(id Queue Requestor Subject Cc AdminCc Owner Status Priority + InitialPriority FinalPriority TimeEstimated Starts Due Text) ], + { + id => "ticket/new", + Queue => $queue->Name, + Requestor => $session{CurrentUser}->Name, + Subject => "", + Cc => [], + AdminCc => [], + Owner => "", + Status => "new", + Priority => $queue->InitialPriority, + InitialPriority => $queue->InitialPriority, + FinalPriority => $queue->FinalPriority, + TimeEstimated => 0, + Starts => $starts->ISO, + Due => $due->ISO, + Text => "", + }, + 0 + ]; + } + else { + # We'll create a new ticket, and fall through to set fields that + # can't be set in the call to Create(). + my (%v, $text); + + foreach my $k (keys %data) { + if (exists $create{lc $k}) { + $v{$create{lc $k}} = delete $data{$k}; + } + elsif (lc $k eq 'text') { + $text = delete $data{$k}; + } + } + + if ($text) { + $v{MIMEObj} = + MIME::Entity->build( + From => $session{CurrentUser}->EmailAddress, + Subject => $v{Subject}, + Data => $text + ); + } + + $ticket->Create(%v); + unless ($ticket->Id) { + return [ "# Could not create ticket.", [], {}, 1 ]; + } + + delete $data{id}; + $id = $ticket->Id; + push(@comments, "# Ticket $id created."); + goto DONE if %data == 0; + } +} + +# Now we know we're dealing with an existing ticket. +if (%data == 0) { + my ($time, $key, $val, @data); + + push @data, [ id => "ticket/".$ticket->Id ]; + push @data, [ Queue => $ticket->QueueObj->Name ] + if (!%$fields || exists $fields->{lc 'Queue'}); + push @data, [ Owner => $ticket->OwnerObj->Name ] + if (!%$fields || exists $fields->{lc 'Owner'}); + push @data, [ Creator => $ticket->CreatorObj->Name ] + if (!%$fields || exists $fields->{lc 'Creator'}); + + foreach (qw(Subject Status Priority InitialPriority FinalPriority)) { + next unless (!%$fields || (exists $fields->{lc $_})); + push @data, [$_ => $ticket->$_ ]; + } + + foreach $key (@people) { + next unless (!%$fields || (exists $fields->{lc $key})); + push @data, [ $key => [ $ticket->$key->MemberEmailAddresses ] ]; + } + + $time = new RT::Date ($session{CurrentUser}); + foreach $key (@dates) { + next unless (!%$fields || (exists $fields->{lc $key})); + $time->Set(Format => 'sql', Value => $ticket->$key); + push @data, [ $key => $time->AsString ]; + } + + $time = new RT::Date ($session{CurrentUser}); + foreach $key (qw(TimeEstimated TimeWorked TimeLeft)) { + next unless (!%$fields || (exists $fields->{lc $key})); + $val = $ticket->$key || 0; + $val = $time->DurationAsString($val*60) if $val; + push @data, [ $key => $val ]; + } + + my %k = map {@$_} @data; + $o = [ map {$_->[0]} @data ]; + $k = \%k; +} +else { + my ($get, $set, $key, $val, $n, $s); + + foreach $key (keys %data) { + $val = $data{$key}; + $key = lc $key; + $n = 1; + + if (ref $val eq 'ARRAY') { + unless ($key =~ /^(?:Requestors|Cc|AdminCc)$/i) { + $n = 0; + $s = "$key may have only one value."; + goto SET; + } + } + + if ($key =~ /^queue$/i) { + next if $val eq $ticket->QueueObj->Name; + ($n, $s) = $ticket->SetQueue($val); + } + elsif ($key =~ /^owner$/i) { + next if $val eq $ticket->OwnerObj->Name; + ($n, $s) = $ticket->SetOwner($val); + } + elsif (exists $simple{$key}) { + $key = $simple{$key}; + $set = "Set$key"; + + next if (($val eq $ticket->$key)|| ($ticket->$key =~ /^\d+$/ && $val == $ticket->$key)); + ($n, $s) = $ticket->$set("$val"); + } + elsif (exists $dates{$key}) { + $key = $dates{$key}; + $set = "Set$key"; + + my $time = new RT::Date $session{CurrentUser}; + $time->Set(Format => 'sql', Value => $ticket->$key); + next if ($val =~ /^not set$/i || $val eq $time->AsString); + ($n, $s) = $ticket->$set($val); + } + elsif (exists $people{$key}) { + $key = $people{$key}; + my ($p, @msgs); + + my %new = map {$_=>1} @{ vsplit($val) }; + my %old = map {$_=>1} $ticket->$key->MemberEmailAddresses; + my $type = $key eq 'Requestors' ? 'Requestor' : $key; + + foreach $p (keys %old) { + unless (exists $new{$p}) { + ($s, $n) = $ticket->DeleteWatcher(Type => $type, + Email => $p); + push @msgs, [ $s, $n ]; + } + } + foreach $p (keys %new) { + # XXX: This is a stupid test. + unless ($p =~ /^[\w.+-]+\@([\w.-]+\.)*\w+.?$/) { + $s = 0; + $n = "$p is not a valid email address."; + push @msgs, [ $s, $n ]; + next; + } + unless ($ticket->IsWatcher(Type => $type, Email => $p)) { + ($s, $n) = $ticket->AddWatcher(Type => $type, + Email => $p); + push @msgs, [ $s, $n ]; + } + } + + $n = 1; + if (@msgs = grep {$_->[0] == 0} @msgs) { + $n = 0; + $s = join "\n", map {"# ".$_->[1]} @msgs; + $s =~ s/^# //; + } + } + elsif ($key ne 'id' && $key ne 'type' && $key ne 'creator') { + $n = 0; + $s = "Unknown field."; + } + + SET: + if ($n == 0) { + $e = 1; + push @comments, "# $key: $s"; + unless (@$o) { + my %o = keys %$changes; + delete $o{id}; + @$o = ("id", keys %o); + $k = $changes; + } + } + } + push(@comments, "# Ticket ".$ticket->id." updated.") unless $n == 0; +} + +DONE: +$c ||= join("\n", @comments) if @comments; +return [$c, $o, $k, $e]; + +</%perl> diff --git a/rt/html/REST/1.0/Forms/ticket/history b/rt/html/REST/1.0/Forms/ticket/history new file mode 100644 index 000000000..4663e97ee --- /dev/null +++ b/rt/html/REST/1.0/Forms/ticket/history @@ -0,0 +1,187 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/Forms/ticket/history +%# +<%ARGS> +$id +$args => undef +$format => undef +$fields => undef +</%ARGS> +<%perl> +my $ticket = new RT::Ticket $session{CurrentUser}; +my ($c, $o, $k, $e) = ("", [], {}, ""); + +$ticket->Load($id); +unless ($ticket->Id) { + return [ "# Ticket $id does not exist.", [], {}, 1 ]; +} + +my $trans = $ticket->Transactions(); +my $total = $trans->Count(); + +chomp $args; +my @arglist = split('/', $args); +my ($type, $tid); + +if ($arglist[0] eq 'type') { + $type = $arglist[1]; +} elsif ($arglist[0] eq 'id') { + $tid = $arglist[1]; +} else { + $type = $args; +} + +if ($type) { + # Create, Set, Status, Correspond, Comment, Give, Steal, Take, Told + # CustomField, AddLink, DeleteLink, AddWatcher, DelWatcher + if ($args =~ /^links?$/) { + $trans->Limit(FIELD => 'Type', OPERATOR => 'LIKE', VALUE => '%Link'); + } + elsif ($args =~ /^watchers?$/) { + $trans->Limit(FIELD => 'Type', OPERATOR => 'LIKE', VALUE => '%Watcher'); + } + else { + $trans->Limit(FIELD => 'Type', OPERATOR => '=', VALUE => $type); + } +} elsif ($tid) { + $trans->Limit(FIELD => 'Id', OPERATOR => '=', VALUE => $tid); +} + +if ($tid) { + my @data; + my $t = new RT::Transaction $session{CurrentUser}; + $t->Load($tid); + + push @data, [ id => $t->Id ]; + push @data, [ Ticket => $t->Ticket ] + if (!%$fields || exists $fields->{lc 'Ticket'}); + push @data, [ TimeTaken => $t->TimeTaken ] + if (!%$fields || exists $fields->{lc 'TimeTaken'}); + push @data, [ Type => $t->Type ] + if (!%$fields || exists $fields->{lc 'Type'}); + push @data, [ Field => $t->Field ] + if (!%$fields || exists $fields->{lc 'Field'}); + push @data, [ OldValue => $t->OldValue ] + if (!%$fields || exists $fields->{lc 'OldValue'}); + push @data, [ NewValue => $t->NewValue ] + if (!%$fields || exists $fields->{lc 'NewValue'}); + push @data, [ Data => $t->Data ] + if (!%$fields || exists $fields->{lc 'Data'}); + push @data, [ Description => $t->Description ] + if (!%$fields || exists $fields->{lc 'Description'}); + push @data, [ Content => $t->Content ] + if (!%$fields || exists $fields->{lc 'Content'}); + + + if (!%$fields || exists $fields->{lc 'Content'}) { + my $creator = new RT::User $session{CurrentUser}; + $creator->Load($t->Creator); + push @data, [ Creator => $creator->Name ]; + } + push @data, [ Created => $t->Created ] + if (!%$fields || exists $fields->{lc 'Created'}); + + if (!%$fields || exists $fields->{lc 'Attachments'}) { + my $attachlist; + my $attachments = $t->Attachments; + while (my $a = $attachments->Next) { + my $size = length($a->Content); + if ($size > 1024) { $size = int($size/102.4)/10 . "k" } + else { $size .= "b" } + $attachlist .= "\n" . $a->Id.": ".($a->Filename || "untitled")." (".$size.")"; + } + + push @data, [Attachments => $attachlist]; + } + + my %k = map {@$_} @data; + $o = [ map {$_->[0]} @data ]; + $k = \%k; + +} else { + my (@data, $tids); + $format ||= "s"; + $format = "l" if (%$fields); + + while (my $t = $trans->Next) { + my $tid = $t->Id; + + if ($format eq "l") { + $tids .= "," if $tids; + $tids .= $tid; + } else { + push @$o, $tid; + $k->{$tid} = $t->Description; + } + } + + if ($format eq "l") { + my @tid; + push @tid, "ticket/$id/history/id/$tids"; + my $fieldstring; + foreach my $key (keys %$fields) { + $fieldstring .= "," if $fieldstring; + $fieldstring .= $key; + } + my ($content, $forms); + + $m->subexec("$RT::WebPath/REST/1.0/show", + id => \@tid, + format => $format, + fields => $fieldstring); + return [ $c, $o, $k, $e ]; + } +} + +if (!$c) { + my $sub = $trans->Count(); + $c = "# $sub/$total ($args/total)"; +} + +return [ $c, $o, $k, $e ]; + +</%perl> diff --git a/rt/html/REST/1.0/Forms/ticket/links b/rt/html/REST/1.0/Forms/ticket/links new file mode 100644 index 000000000..9f14da4e3 --- /dev/null +++ b/rt/html/REST/1.0/Forms/ticket/links @@ -0,0 +1,170 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/Forms/ticket/links +%# +<%ARGS> +$id +$format => 's' +$changes => undef +</%ARGS> +<%perl> +my @data; +my $ticket = new RT::Ticket $session{CurrentUser}; + +$ticket->Load($id); +if (!$ticket->Id) { + return [ "# Ticket $id does not exist.", [], {}, 1 ]; +} + +my ($c, $o, $k, $e) = ("", [], {}, 0); +my @fields = qw(DependsOn DependedOnBy RefersTo ReferredToBy Members MemberOf); +my %fields = map { lc $_ => $_ } @fields; + +my %lfields = ( + Members => { Type => 'MemberOf', Mode => 'Base' }, + ReferredToBy => { Type => 'RefersTo', Mode => 'Base' }, + DependedOnBy => { Type => 'DependsOn', Mode => 'Base' }, + MemberOf => { Type => 'MemberOf', Mode => 'Target' }, + RefersTo => { Type => 'RefersTo', Mode => 'Target' }, + DependsOn => { Type => 'DependsOn', Mode => 'Target' }, +); + +if ($changes) { + my ($get, $set, $key, $val, $n, $s); + my %data = %$changes; + my @comments; + + foreach $key (keys %data) { + $val = $data{$key}; + $key = lc $key; + $n = 1; + + if (exists $fields{$key}) { + $key = $fields{$key}; + + my %old; + my $field = $lfields{$key}->{Mode}; + while (my $link = $ticket->$key->Next) { + $old{$link->$field} = 1; + } + + my %new; + foreach my $nkey (@{vsplit($val)}) { + if ($nkey =~ /^\d+$/) { + my $uri = new RT::URI $session{CurrentUser}; + my $tick = new RT::Ticket $session{CurrentUser}; + $tick->Load($nkey); + if ($tick->Id) { + $nkey = $uri->FromObject($tick); + } + else { + $n = 0; + $s = "Ticket $nkey does not exist."; + goto SET; + } + } + $new{$nkey} = 1; + } + + foreach my $u (keys %old) { + if (exists $new{$u}) { + delete $new{$u}; + } + else { + my $type = $lfields{$key}->{Type}; + my $mode = $lfields{$key}->{Mode}; + ($n, $s) = $ticket->DeleteLink(Type => $type, $mode => $u); + goto SET; + } + } + foreach my $u (keys %new) { + my $type = $lfields{$key}->{Type}; + my $mode = $lfields{$key}->{Mode}; + ($n, $s) = $ticket->AddLink(Type => $type, $mode => $u); + goto SET; + } + } + elsif ($key ne 'id' && $key ne 'type') { + $n = 0; + $s = "Unknown field: $key"; + } + + SET: + if ($n == 0) { + $e = 1; + push @comments, "# $key: $s"; + unless (@$o) { + @$o = ("id", @fields); + %$k = %data; + } + } + } + + push(@comments, "# Links for ticket $id updated.") unless @comments; + $c = join("\n", @comments) if @comments; +} +else { + my @data; + + push @data, [ id => "ticket/".$ticket->Id."/links" ]; + foreach my $key (@fields) { + my @val; + + my $field = $lfields{$key}->{Mode}; + while (my $link = $ticket->$key->Next) { + push @val, $link->$field; + } + push(@val, "") if (@val == 0 && $format eq 'l'); + push @data, [ $key => [ @val ] ] if @val; + } + + my %k = map {@$_} @data; + $o = [ map {$_->[0]} @data ]; + $k = \%k; +} + +return [ $c, $o, $k, $e ]; +</%perl> diff --git a/rt/html/REST/1.0/Forms/user/default b/rt/html/REST/1.0/Forms/user/default new file mode 100644 index 000000000..ad2ebd57a --- /dev/null +++ b/rt/html/REST/1.0/Forms/user/default @@ -0,0 +1,186 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/Forms/user/default +%# +<%ARGS> +$id +$format => 's' +$changes => {} +</%ARGS> +<%perl> +my @comments; +my ($c, $o, $k, $e) = ("", [], {}, 0); +my %data = %$changes; +my $user = new RT::User $session{CurrentUser}; +my @fields = qw(RealName NickName Gecos Organization Address1 Address2 City + State Zip Country HomePhone WorkPhone MobilePhone PagerPhone + FreeformContactInfo Comments Signature Lang EmailEncoding + WebEncoding ExternalContactInfoId ContactInfoSystem + ExternalAuthId AuthSystem); +my %fields = map { lc $_ => $_ } @fields; + +if ($id ne 'new') { + $user->Load($id); + if (!$user->Id) { + return [ "# User $id does not exist.", [], {}, 1 ]; + } +} +else { + if (%data == 0) { + return [ + "# Required: Name, EmailAddress", + [ qw(id Name EmailAddress Organization Password Comments) ], + { + id => "user/new", + Name => "", + EmailAddress => "", + Organization => "", + Password => "", + Comments => "" + }, + 0 + ]; + } + else { + my %v; + my %create = %fields; + $create{name} = "Name"; + $create{password} = "Password"; + $create{emailaddress} = "EmailAddress"; + $create{contactinfo} = "FreeformContactInfo"; + # Do any fields need to be excluded here? + + foreach my $k (keys %data) { + if (exists $create{lc $k}) { + $v{$create{lc $k}} = delete $data{$k}; + } + } + + $user->Create(%v); + unless ($user->Id) { + return [ "# Could not create user.", [], {}, 1 ]; + } + + $id = $user->Id; + delete $data{id}; + push(@comments, "# User $id created."); + goto DONE if %data == 0; + } +} + +if (%data == 0) { + my @data; + + push @data, [ id => "user/".$user->Id ]; + push @data, [ Name => $user->Name ]; + push @data, [ Password => '********' ]; + push @data, [ EmailAddress => $user->EmailAddress ]; + + foreach my $key (@fields) { + my $val = $user->$key; + + if ($format eq 'l' || (defined $val && $val ne '')) { + $key = "ContactInfo" if $key eq 'FreeformContactInfo'; + push @data, [ $key => $val ]; + } + } + + my %k = map {@$_} @data; + $o = [ map {$_->[0]} @data ]; + $k = \%k; +} +else { + my ($get, $set, $key, $val, $n, $s); + + foreach $key (keys %data) { + $val = $data{$key}; + $key = lc $key; + $n = 1; + + if ($key eq 'name' || $key eq 'emailaddress' || + $key eq 'contactinfo' || exists $fields{$key}) + { + if (exists $fields{$key}) { + $key = $fields{$key}; + } + else { + $key = "FreeformContactInfo" if $key eq 'contactinfo'; + $key = "EmailAddress" if $key eq 'emailaddress'; + $key = "Name" if $key eq 'name'; + } + $set = "Set$key"; + + next if $val eq $user->$key; + ($n, $s) = $user->$set($val); + } + elsif ($key eq 'password') { + ($n, $s) = $user->SetPassword($val) unless $val =~ /^\**$/; + } + elsif ($key ne 'id') { + $n = 0; + $s = "Unknown field."; + } + + SET: + if ($n == 0) { + $e = 1; + push @comments, "# $key: $s"; + unless (@$o) { + my %o = keys %$changes; + delete @o{"id", @fields}; + @$o = ("id", @fields, keys %o); + $k = $changes; + } + } + } + + push(@comments, "# User $id updated.") unless $n == 0; +} + +DONE: +$c ||= join("\n", @comments) if @comments; +return [ $c, $o, $k, $e ]; +</%perl> diff --git a/rt/html/REST/1.0/Forms/user/ns b/rt/html/REST/1.0/Forms/user/ns new file mode 100644 index 000000000..406156304 --- /dev/null +++ b/rt/html/REST/1.0/Forms/user/ns @@ -0,0 +1,63 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/Forms/user/ns +%# +<%ARGS> +$id +</%ARGS> +<%perl> +use RT::Users; + +my $field = "Name"; +$field = "EmailAddress" if $id =~ /\@/; + +my $users = new RT::Users $session{CurrentUser}; +$users->Limit(FIELD => $field, OPERATOR => '=', VALUE => $id); +if ($users->Count == 0) { + return (0, "No user named $id exists."); +} +return $users->Next->Id; +</%perl> diff --git a/rt/html/REST/1.0/NoAuth/mail-gateway b/rt/html/REST/1.0/NoAuth/mail-gateway new file mode 100644 index 000000000..5252c1968 --- /dev/null +++ b/rt/html/REST/1.0/NoAuth/mail-gateway @@ -0,0 +1,77 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%flags> +inherit => undef # inhibit UTF8 conversion done in /autohandler +</%flags> +<%ARGS> +$queue => 1 +$action => "correspond" +$ticket => undef +</%ARGS> +<%init> +use RT::Interface::Email; +$r->content_type('text/plain; charset=utf-8'); +$m->error_format('text'); +my ( $status, $error, $Ticket ) = RT::Interface::Email::Gateway(\%ARGS); + if ($status == -75 ) { +$m->out("temporary failure - ". $error); + } + elsif ($status == 1) { +$m->out('ok'); + if ( $Ticket->Id ) { +$m->out('Ticket: '. $Ticket->Id); +$m->out('Queue: '. $Ticket->QueueObj->Name ); +$m->out('Owner: '. $Ticket->OwnerObj->Name); +$m->out('Status: '. $Ticket->Status ); +$m->out('Subject: '. $Ticket->Subject ); +$m->out('Requestor: '. $Ticket->Requestors->MemberEmailAddressesAsString ); + } + } else { +$m->out('not ok - '.$error); + } + +$m->abort(); +</%init> diff --git a/rt/html/REST/1.0/autohandler b/rt/html/REST/1.0/autohandler new file mode 100644 index 000000000..8e3fb164d --- /dev/null +++ b/rt/html/REST/1.0/autohandler @@ -0,0 +1,54 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/autohandler +%# +<%INIT> +use RT::Interface::REST; +$r->content_type('text/plain; charset=utf-8'); +$m->error_format('text'); +$m->call_next(); +$m->abort(); +</%INIT> diff --git a/rt/html/REST/1.0/dhandler b/rt/html/REST/1.0/dhandler new file mode 100644 index 000000000..6cf45b000 --- /dev/null +++ b/rt/html/REST/1.0/dhandler @@ -0,0 +1,309 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/dhandler +%# +<%ARGS> +@id => () +$fields => undef +$format => undef +$content => undef +</%ARGS> +<%INIT> +use RT::Interface::REST; + +my $output = ""; +my $status = "200 Ok"; +my $object = $m->dhandler_arg; + +my $name = qr{[\w.-]+}; +my $list = '(?:(?:\d+-)?\d+,)*(?:\d+-)?\d+'; +my $label = '[a-zA-Z0-9@_.+-]+'; +my $field = '[a-zA-Z][a-zA-Z0-9_-]*'; +my $labels = "(?:$label,)*$label"; + +# We must handle requests such as the following: +# +# 1. http://.../REST/1.0/show (with a list of object specifications). +# 2. http://.../REST/1.0/edit (with a self-contained list of forms). +# 3. http://.../REST/1.0/ticket/show (implicit type specification). +# http://.../REST/1.0/ticket/edit +# 4. http://.../REST/1.0/ticket/nn (all possibly with a single form). +# http://.../REST/1.0/ticket/nn/history +# http://.../REST/1.0/ticket/nn/attachment/1 +# +# Objects are specified by their type, and either a unique numeric ID, +# or a unique name (e.g. ticket/1, queue/foo). Multiple objects of the +# same type may be specified by a comma-separated list of identifiers +# (e.g., user/ams,rai or ticket/1-3,5-7). +# +# Ultimately, we want a list of object specifications to operate upon. +# The URLs in (4) provide enough information to identify an object. We +# will assemble submitted information into that format in other cases. +# +my (@objects, $forms); +my $utype; + +if ($object eq 'show' || # $REST/show + (($utype) = ($object =~ m{^($name)/show$}))) # $REST/ticket/show +{ + # We'll convert type/range specifications ("ticket/1-3,7-9/history") + # into a list of singular object specifications ("ticket/1/history"). + # If the URL specifies a type, we'll accept only that one. + foreach my $id (@id) { + $id =~ s|^(?:$utype/)?|$utype/| if $utype; + if (my ($type, $oids, $extra) = + ($id =~ m#^($name)/($list|$labels)(?:(/.*))?$#o)) + { + foreach my $oid (expand_list($oids)) { + if ($extra =~ m{^(?:/($name)(?:/(.*))?)?$}o) { + my ($attr, $args) = ($1, $2); + # expand transaction and attachment range specifications + # (if applicable) + my $tids; + if ($attr eq 'history' && $args =~ m#id/(\d.*)#o) { + $tids = $1; + } + if ($tids) { + push(@objects, "$type/$oid/$attr/id/$_") for expand_list($tids); + } else { + push(@objects, "$type/$oid$extra"); + } + } + } + } + else { + $status = "400 Bad Request"; + $output = "Invalid object ID specified: '$id'"; + goto OUTPUT; + } + } +} +elsif ($object eq 'edit' || # $REST/edit + (($utype) = ($object =~ m{^($name)/edit$}))) # $REST/ticket/edit +{ + # We'll make sure each of the submitted forms is syntactically valid + # and sufficiently identifies an object to operate upon, then add to + # the object list as above. + my @output; + + $forms = form_parse($content); + foreach my $form (@$forms) { + my ($c, $o, $k, $e) = @$form; + + if ($e) { + push @output, [ "# Syntax error.", $o, $k, $e ]; + } + else { + my ($type, $id); + + # Look for matching types in the ID, form, and URL. + $type = exists $k->{type} ? $k->{type} : $utype; + $type =~ s|^(?:$utype)?|$utype/| if $utype; + $type =~ s|/$||; + + if (exists $k->{id}) { + $id = $k->{id}; + $id =~ s|^(?:$type/)?|$type/| if $type; + + if ($id =~ m#^$name/(?:$label|\d+)(?:/.*)?#o) { + push @objects, $id; + } + else { + push @output, [ "# Invalid object ID: '$id'", $o, $k, $e ]; + } + } + else { + push @output, [ "# No object ID specified.", $o, $k, $e ]; + } + } + } + # If we saw any errors at this stage, we won't process any part of + # the submitted data. + if (@output) { + unshift @output, [ "# Please resubmit with errors corrected." ]; + $status = "409 Syntax Error"; + $output = form_compose(\@output); + goto OUTPUT; + } +} +else { + # We'll assume that this is in the correct format already. Otherwise + # it will be caught by the loop below. + push @objects, $object; + + if ($content) { + $forms = form_parse($content); + + if (@$forms > 1) { + $status = "400 Bad Request"; + $output = "You may submit only one form to this object."; + goto OUTPUT; + } + + my ($c, $o, $k, $e) = @{ $forms->[0] }; + if ($e) { + $status = "409 Syntax Error"; + $output = form_compose([ ["# Syntax error.", $o, $k, $e] ]); + goto OUTPUT; + } + } +} + +# Make sure we have something to do. +unless (@objects) { + $status = "400 Bad Request"; + $output = "No objects specified."; + goto OUTPUT; +} + +# Parse and validate any field specifications. +my (%fields, @fields); +if ($fields) { + unless ($fields =~ /^(?:$field,)*$field$/) { + $status = "400 Bad Request"; + $output = "Invalid field specification: $fields"; + goto OUTPUT; + } + @fields = map lc, split /,/, $fields; + @fields{@fields} = (); + unless (exists $fields{id}) { + unshift @fields, "id"; + $fields{id} = (); + } +} + +my (@comments, @output); + +foreach $object (@objects) { + my ($handler, $type, $id, $attr, $args); + my ($c, $o, $k, $e) = ("", ["id"], {id => $object}, 0); + + my $i = 0; + if ($object =~ m{^($name)/(\d+|$label)(?:/($name)(?:/(.*))?)?$}o || + $object =~ m{^($name)/(new)$}o) + { + ($type, $id, $attr, $args) = ($1, $2, ($3 || 'default'), $4); + $handler = "Forms/$type/$attr"; + + unless ($m->comp_exists($handler)) { + $args = "$attr/$args"; + $handler = "Forms/$type/default"; + + unless ($m->comp_exists($handler)) { + $i = 2; + $c = "# Unknown object type: $type"; + } + } + elsif ($id ne 'new' && $id !~ /^\d+$/) { + my $ns = "Forms/$type/ns"; + + # Can we resolve named objects? + unless ($m->comp_exists($ns)) { + $i = 3; + $c = "# Objects of type $type must be specified by numeric id."; + } + else { + my ($n, $s) = $m->comp("Forms/$type/ns", id => $id); + if ($n <= 0) { $i = 4; $c = "# $s"; } + else { $i = 0; $id = $n; } + } + } + else { + $i = 0; + } + } + else { + $i = 1; + $c = "# Invalid object specification: '$object'"; + } + + if ($i != 0) { + if ($content) { + (undef, $o, $k, $e) = @{ shift @$forms }; + } + push @output, [ $c, $o, $k ]; + next; + } + + unless ($content) { + my $d = $m->comp($handler, id => $id, args => $args, format => $format, fields => \%fields); + my ($c, $o, $k, $e) = @$d; + + if (!$e && @$o && keys %fields) { + my %lk = map { lc $_ => $_ } keys %$k; + @$o = map { $lk{$_} } @fields; + foreach my $key (keys %$k) { + delete $k->{$key} unless exists $fields{lc $key}; + } + } + push(@output, [ $c, $o, $k ]) if ($c || @$o || keys %$k); + } + else { + my ($c, $o, $k, $e) = @{ shift @$forms }; + my $d = $m->comp($handler, id => $id, args => $args, format => $format, + changes => $k); + ($c, $o, $k, $e) = @$d; + + # We won't pass $e through to compose, trusting instead that the + # handler added suitable comments for the user. + if ($e) { + $status = "409 Syntax Error" if @$o; + push @output, [ $c, $o, $k ]; + } + else { + push @comments, $c; + } + } +} + +unshift(@output, [ join "\n", @comments ]) if @comments; +$output = form_compose(\@output); + +OUTPUT: +</%INIT> +RT/<% $RT::VERSION %> <% $status %> + +<% $output |n %> diff --git a/rt/html/REST/1.0/logout b/rt/html/REST/1.0/logout new file mode 100644 index 000000000..470cb0915 --- /dev/null +++ b/rt/html/REST/1.0/logout @@ -0,0 +1,49 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%PERL> +tied(%session)->delete if (defined %session); +</%PERL> +RT/<% $RT::VERSION %> 200 Ok diff --git a/rt/html/REST/1.0/search/dhandler b/rt/html/REST/1.0/search/dhandler new file mode 100644 index 000000000..1915a4644 --- /dev/null +++ b/rt/html/REST/1.0/search/dhandler @@ -0,0 +1,54 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/search/dhandler +%# +<%INIT> +my $status = "500 Server Error"; +my $output = "Unsupported object type."; +</%INIT> +RT/<% $RT::VERSION %> <% $status %> + +<% $output |n %> diff --git a/rt/html/REST/1.0/search/ticket b/rt/html/REST/1.0/search/ticket new file mode 100644 index 000000000..d0ab59e98 --- /dev/null +++ b/rt/html/REST/1.0/search/ticket @@ -0,0 +1,141 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/search/ticket +%# +<%ARGS> +$query +$format => undef +$orderby => undef +$fields => undef +</%ARGS> +<%INIT> +my $output = ""; +my $status = "200 Ok"; +my $tickets = new RT::Tickets $session{CurrentUser}; + +# Parse and validate any field specifications. +my $field = '[a-zA-Z][a-zA-Z0-9_-]*'; +my (%fields, @fields); +if ($fields) { + $format = "l"; + unless ($fields =~ /^(?:$field,)*$field$/) { + $status = "400 Bad Request"; + $output = "Invalid field specification: $fields"; + goto OUTPUT; + } + @fields = map lc, split /,/, $fields; + @fields{@fields} = (); + unless (exists $fields{id}) { + unshift @fields, "id"; + $fields{id} = (); + } +} + +$format ||= "s"; +if ($format !~ /^[isl]$/) { + $status = "400 Bad request"; + $output = "Unknown listing format: $format. (Use i, s, or l.)\n"; + goto OUTPUT; +} + +my ($n, $s); +eval { + ($n, $s) = $tickets->FromSQL($query); +}; +my $sortstring = ""; +if ($orderby) { + $sortstring = 'FIELD => '; + my $order = substr($orderby, 0, 1); + if ($order eq '+' || $order eq '-') { + $sortstring .= 'substr($orderby, 1)'; + if ($order eq '+') { + $sortstring .= ", ORDER => 'ASC'"; + } elsif ($order eq '-') { + $sortstring .= ", ORDER => 'DESC'"; + } + } else { + $sortstring .= '$orderby'; + } + my $foo = 'FIELD => '; + $foo .= '$orderby'; + $tickets->OrderBy(eval $sortstring); +} +if ($@ || $n == 0) { + $s ||= $@; + $status = "400 Bad request"; + $output = "Invalid query: '$s'.\n"; + goto OUTPUT; +} + +$n = 0; +my @output; +while (my $ticket = $tickets->Next) { + $n++; + + if ($format eq "i") { + $output .= "ticket/" . $ticket->Id . "\n"; + } + elsif ($format eq "s") { + $output .= $ticket->Id . ": ". $ticket->Subject . "\n"; + } + else { + my $id = $ticket->Id; + my $d = $m->comp("$RT::WebPath/REST/1.0/Forms/ticket/default", id => $id, format => $format, fields => \%fields); + my ($c, $o, $k, $e) = @$d; + push @output, [ $c, $o, $k ]; + } +} +if ($n == 0 && $format ne "i") { + $output = "No matching results.\n"; +} + +$output = form_compose(\@output) if @output; + +OUTPUT: +$m->out("RT/". $RT::VERSION . " " . $status ."\n\n"); + +$m->out($output ); +</%INIT> diff --git a/rt/html/REST/1.0/ticket/comment b/rt/html/REST/1.0/ticket/comment new file mode 100644 index 000000000..e27bfcc1e --- /dev/null +++ b/rt/html/REST/1.0/ticket/comment @@ -0,0 +1,175 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/ticket/comment +%# +<%ARGS> +$content +</%ARGS> +<%INIT> +use MIME::Entity; +use LWP::MediaTypes; +use RT::Interface::REST; +use File::Temp qw(tempfile); + +my $ticket = new RT::Ticket $session{CurrentUser}; +my $object = $r->path_info; +my $status = "200 Ok"; +my $output; +my $action; + +# http://.../REST/1.0/ticket/comment/1 +my ($c, $o, $k, $e) = @{ form_parse($content)->[0] }; +if ($e || !$o) { + if (!$o) { + $output = "Empty form submitted.\n"; + } + else { + $c = "# Syntax error."; + $output = form_compose([[$c, $o, $k, $e]]); + } + $status = "400 Bad Request"; + goto OUTPUT; +} + +$object =~ s#^/##; +$object ||= $k->{Ticket}; +unless ($object =~ /^\d+/) { + $output = "Invalid ticket id: `$object'.\n"; + $status = "400 Bad Request"; + goto OUTPUT; +} +if ($k->{Ticket} && $object ne $k->{Ticket}) { + $output = "The submitted form and URL specify different tickets.\n"; + $status = "400 Bad Request"; + goto OUTPUT; +} + +($action = $k->{Action}) =~ s/^(.)(.*)$/\U$1\L$2\E/; +unless ($action =~ /^(?:Comment|Correspond)$/) { + $output = "Invalid action: `$action'.\n"; + $status = "400 Bad Request"; + goto OUTPUT; +} + +my $text = $k->{Text}; +my @atts = @{ vsplit($k->{Attachment}) }; + +if (!$k->{Text} && @atts == 0) { + $status = "400 Bad Request"; + $output = "Empty comment with no attachments submitted.\n"; + goto OUTPUT; +} + +my $cgi = $m->cgi_object; +my $ent = MIME::Entity->build(Type => "multipart/mixed"); +$ent->attach(Data => $k->{Text}) if $k->{Text}; + +my $i = 1; +foreach my $att (@atts) { + local $/=undef; + my $file = $att; + $file =~ s#^.*[\\/]##; + + my $fh = $cgi->upload("attachment_$i"); + if ($fh) { + my $buf; + my ($w, $tmp) = tempfile(); + my $info = $cgi->uploadInfo(); + + while (sysread($fh, $buf, 8192)) { + syswrite($w, $buf); + } + + $ent->attach( + Path => $tmp, + Type => $info->{'Content-Type'} || guess_media_type($tmp), + Filename => $file, + Disposition => "attachment" + ); + } + else { + $status = "400 Bad Request"; + $output = "No attachment for $att.\n"; + goto OUTPUT; + } + + $i++; +} + +$ticket->Load($object); +unless ($ticket->Id) { + $output = "Couldn't load ticket id: `$object'.\n"; + $status = "404 Ticket not found"; + goto OUTPUT; +} +unless ($ticket->CurrentUserHasRight('ModifyTicket') || + ($action eq "Comment" && + $ticket->CurrentUserHasRight("CommentOnTicket")) || + ($action eq "Correspond" && + $ticket->CurrentUserHasRight("ReplyToTicket"))) +{ + $output = "You are not allowed to $action on ticket $object.\n"; + $status = "403 Permission denied"; + goto OUTPUT; +} + +my $cc = join ", ", @{ vsplit($k->{Cc}) }; +my $bcc = join ", ", @{ vsplit($k->{Bcc}) }; +my ($n, $s) = $ticket->$action(MIMEObj => $ent, + CcMessageTo => $cc, + BccMessageTo => $bcc, + TimeTaken => $k->{TimeWorked} || 0); +$output = $s; +if ($k->{Status}) { + my ($status_n, $status_s) = $ticket->SetStatus($k->{'Status'} ); + $output .= "\n".$status_s; +} + +OUTPUT: +</%INIT> +RT/<% $RT::VERSION %> <% $status %> + +<% $output |n %> diff --git a/rt/html/REST/1.0/ticket/link b/rt/html/REST/1.0/ticket/link new file mode 100644 index 000000000..6556a5ef7 --- /dev/null +++ b/rt/html/REST/1.0/ticket/link @@ -0,0 +1,118 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/ticket/link +%# +<%ARGS> +$id => undef +$del => 0 +$rel +$to +</%ARGS> +<%INIT> +use RT::Interface::REST; + +my $output; +my $status = "200 Ok"; +my $ticket = new RT::Ticket $session{CurrentUser}; +my $object = $r->path_info; + +my @fields = qw(DependsOn DependedOnBy RefersTo ReferredToBy HasMember MemberOf); +my %fields = map { lc $_ => $_ } @fields; +my %lfields = ( + HasMember => { Type => 'MemberOf', Mode => 'Base' }, + ReferredToBy => { Type => 'RefersTo', Mode => 'Base' }, + DependedOnBy => { Type => 'DependsOn', Mode => 'Base' }, + MemberOf => { Type => 'MemberOf', Mode => 'Target' }, + RefersTo => { Type => 'RefersTo', Mode => 'Target' }, + DependsOn => { Type => 'DependsOn', Mode => 'Target' }, +); + +# http://.../REST/1.0/ticket/link/1 + +$object =~ s#^/##; +if ($id && $object && $id != $object) { + $output = "Different ids in URL (`$object') and submitted form (`$id').\n"; + $status = "400 Bad Request"; + goto OUTPUT; +} +$id ||= $object; +unless ($id =~ /^\d+$/ && $to =~ /^\d+$/) { + my $bad = ($id !~ /^\d+$/) ? $id : $to; + $output = $r->path_info. "\n"; + $output .= "Invalid ticket id: '$bad'.\n"; + $status = "400 Bad Request"; + goto OUTPUT; +} +unless (exists $fields{lc $rel}) { + $output = "Invalid link: '$rel'.\n"; + $status = "400 Bad Request"; + goto OUTPUT; +} +$rel = $fields{lc $rel}; + +$ticket->Load($id); +unless ($ticket->Id) { + $output = "Couldn't load ticket id: '$id'.\n"; + $status = "404 Ticket not found"; + goto OUTPUT; +} + +my $type = $lfields{$rel}->{Type}; +my $mode = $lfields{$rel}->{Mode}; + +my $n = 1; +my $op = $del ? "DeleteLink" : "AddLink"; + +($n, $output) = $ticket->$op(Type => $type, $mode => $to); +if ($n == 0) { + $status = "500 Error"; +} + +OUTPUT: +</%INIT> +RT/<% $RT::VERSION %> <% $status %> + +<% $output |n %> diff --git a/rt/html/REST/1.0/ticket/merge b/rt/html/REST/1.0/ticket/merge new file mode 100644 index 000000000..3db52111b --- /dev/null +++ b/rt/html/REST/1.0/ticket/merge @@ -0,0 +1,100 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# REST/1.0/ticket/merge +%# +<%ARGS> +$id => undef +$into +</%ARGS> +<%INIT> +use RT::Interface::REST; + +my $output; +my $status = "200 Ok"; +my $ticket = new RT::Ticket $session{CurrentUser}; +my $object = $r->path_info; + +# http://.../REST/1.0/ticket/merge/1 + +$object =~ s#^/##; +if ($id && $object && $id != $object) { + $output = "Different ids in URL (`$object') and submitted form (`$id').\n"; + $status = "400 Bad Request"; + goto OUTPUT; +} +$id ||= $object; +unless ($id =~ /^\d+$/ && $into =~ /^\d+$/) { + my $bad = ($id !~ /^\d+$/) ? $id : $into; + $output = $r->path_info. "\n"; + $output .= "Invalid ticket id: `$bad'.\n"; + $status = "400 Bad Request"; + goto OUTPUT; +} + +$ticket->Load($id); +unless ($ticket->Id) { + $output = "Couldn't load ticket id: `$id'.\n"; + $status = "404 Ticket not found"; + goto OUTPUT; +} +unless ($ticket->CurrentUserHasRight('ModifyTicket')) { + $output = "You are not allowed to modify ticket $id.\n"; + $status = "403 Permission denied"; + goto OUTPUT; +} + +my ($n, $s) = $ticket->MergeInto($into); + +if ($n == 0) { + $status = "500 Error"; +} +$output = $s; + +OUTPUT: +</%INIT> +RT/<% $RT::VERSION %> <% $status %> + +<% $output |n %> diff --git a/rt/html/Search/Build.html b/rt/html/Search/Build.html new file mode 100644 index 000000000..cb6462651 --- /dev/null +++ b/rt/html/Search/Build.html @@ -0,0 +1,849 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# +%# Data flow here: +%# The page receives a Query from the previous page, and maybe arguments +%# corresponding to actions. (If it doesn't get a Query argument, it pulls +%# one out of the session hash. Also, it could be getting just a raw query from +%# Build/Edit.html (Advanced).) +%# +%# After doing some stuff with default arguments and saved searches, the ParseQuery +%# function (which is similar to, but not the same as, _parser in RT/Tickets_Overlay_SQL) +%# converts the Query into a RT::Interface::Web::QueryBuilder::Tree. This mason file +%# then adds stuff to or modifies the tree based on the actions that had been requested +%# by clicking buttons. It then calls GetQueryAndOptionList on the tree to generate +%# the SQL query (which is saved as a hidden input) and the option list for the Clauses +%# box in the top right corner. +%# +%# Worthwhile refactoring: the tree manipulation code for the actions could use some cleaning +%# up. The node-adding code is different in the "add" actions from in ParseQuery, which leads +%# to things like ParseQuery correctly not quoting numbers in numerical fields, while the "add" +%# action does quote it (this breaks SQLite). +%# +<& /Elements/Header, Title => $title &> +<& /Ticket/Elements/Tabs, + current_tab => "Search/Build.html".$QueryString, + Title => $title, + Format => $Format, + Query => $Query, + Order => $Order, + OrderBy => $OrderBy, + Rows => $RowsPerPage +&> + +<FORM METHOD="POST" ACTION="Build.html" NAME="BuildQuery"> +<input type=hidden name=SearchId value="<%$SearchId%>"> +<input type=hidden name=Query value="<%$Query%>"> +<input type=hidden name=Format value="<%$Format%>"> +<table width=100% border="0" cellpadding="5"> +<tr valign="top"> +<td class="boxcontainer" rowspan="2" width="65%"> +<& Elements/PickCriteria, query => $Query, cfqueues => $queues &> +<& /Elements/Submit, Caption => loc('Add additional criteria'), Label => loc('Add'), Name => 'AddClause'&> +</td> + +<td> +<& Elements/EditQuery, + %ARGS, + actions => \@actions, + optionlist => $optionlist, + Description => $Description &> +</td> +</tr> + +<tr valign="top"> +<td> +<& Elements/EditSearches, CurrentSearch => $search_hash, Dirty => $dirty, SearchId => $SearchId &> +</td> +</tr> + +<tr> +<td colspan=2 class="boxcontainer"> + +<& Elements/DisplayOptions, %ARGS, Format=> $Format, +AvailableColumns => $AvailableColumns, CurrentFormat => $CurrentFormat, RowsPerPage => $RowsPerPage, OrderBy => $OrderBy, Order => $Order &> +</td> +</tr> +<tr> +<td colspan=2 class="boxcontainer"> +<& /Elements/Submit, Caption => loc("Do the Search"), Label => loc('Search'), Name => 'DoSearch'&> +</td> +</tr> +</table> +</FORM> + +<%INIT> +use RT::Interface::Web::QueryBuilder; +use RT::Interface::Web::QueryBuilder::Tree; + +my $search_hash = {}; +my $search; +my $title = loc("Query Builder"); + +# {{{ Clear out unwanted data +if ( $NewQuery or $ARGS{'Delete'} ) { + + # Wipe all data-carrying variables clear if we want a new + # search, or we're deleting an old one.. + $Query = ''; + $Format = ''; + $Description = ''; + $SearchId = ''; + $Order = ''; + $OrderBy = ''; + $RowsPerPage = ''; + + # ($search hasn't been set yet; no need to clear) + + # ..then wipe the session out.. + undef $session{'CurrentSearchHash'}; + + # ..and the search results. + $session{'tickets'}->CleanSlate() if defined $session{'tickets'}; +} + +# }}} + +# {{{ Attempt to load what we can from the session, set defaults + +# We don't read or write to the session again until the end +$search_hash = $session{'CurrentSearchHash'}; + +# These variables are what define a search_hash; this is also +# where we give sane defaults. +$Query ||= $search_hash->{'Query'}; +$Format ||= $search_hash->{'Format'}; +$Description ||= $search_hash->{'Description'}; +$SearchId ||= $search_hash->{'SearchId'} || 'new'; +$Order ||= $search_hash->{'Order'} || 'ASC'; +$OrderBy ||= $search_hash->{'OrderBy'} || 'id'; +$RowsPerPage = ( $search_hash->{'RowsPerPage'} || 50 ) + unless defined($RowsPerPage); +$search ||= $search_hash->{'Object'}; + +# }}} + +my @actions = (); + +# Clean unwanted junk from the format +$Format = $m->comp( '/Elements/ScrubHTML', Content => $Format ) if ($Format); + +# {{{ If we're asked to delete the current search, make it go away and reset the search parameters +if ( $ARGS{'Delete'} ) { + + # We set $SearchId to 'new' above already, so peek into the %ARGS + if ( $ARGS{'SearchId'} =~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ ) { + my $obj_type = $1; + my $obj_id = $2; + my $search_id = $3; + + my $container_object; + if ( $obj_type eq 'RT::User' && $obj_id == $session{'CurrentUser'}->Id ) + { + $container_object = $session{'CurrentUser'}->UserObj; + } + elsif ( $obj_type eq 'RT::Group' ) { + $container_object = RT::Group->new( $session{'CurrentUser'} ); + $container_object->Load($obj_id); + } + + if ( $container_object->id ) { + + # We have the object the entry is an attribute on; delete + # the entry.. + $container_object->Attributes->DeleteEntry( + Name => 'SavedSearch', + id => $search_id + ); + } + + } +} + +# }}} + +# {{{ If the user wants to copy a search, uncouple from the one that this was based on, but don't erase the $Query or $Format +if ( $ARGS{'CopySearch'} ) { + $SearchId = 'new'; + $search = undef; + $Description = loc( "[_1] copy", $Description ); +} + +# }}} + +# {{{ if we're asked to revert the current search, we just want to load it +if ( $ARGS{'Revert'} ) { + $ARGS{'LoadSavedSearch'} = $SearchId; +} + +# }}} + +# {{{ if we're asked to load a search, load it. + +if ( $ARGS{'LoadSavedSearch'} =~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ ) { + my $obj_type = $1; + my $obj_id = $2; + my $search_id = $3; + + # We explicitly list out the available types (user and group) and + # don't trust user input here + if ( ( $obj_type eq 'RT::User' ) + && ( $obj_id == $session{'CurrentUser'}->id ) ) + { + $search = + $session{'CurrentUser'}->UserObj->Attributes->WithId($search_id); + + } + elsif ( $obj_type eq 'RT::Group' ) { + my $group = RT::Group->new( $session{'CurrentUser'} ); + $group->Load($obj_id); + $search = $group->Attributes->WithId($search_id); + } + + # We have a $search and now; import the others + $SearchId = $ARGS{'LoadSavedSearch'}; + $Description = $search->Description; + $Format = $search->SubValue('Format'); + $Query = $search->SubValue('Query'); + $Order = $search->SubValue('Order'); + $OrderBy = $search->SubValue('OrderBy'); + $RowsPerPage = $search->SubValue('RowsPerPage'); +} + +# }}} + +# {{{ Parse the query +my $tree; +ParseQuery( $Query, \$tree, \@actions ); + +# if parsing went poorly, send them to the edit page to fix it +if ( $actions[0] ) { + $m->comp( "Edit.html", Query => $Query, actions => \@actions ); + $m->abort(); +} + +$Query = ""; + +my @options = $tree->GetDisplayedNodes; + +my @current_values = grep { defined } @options[@clauses]; + +# {{{ Try to find if we're adding a clause +foreach my $arg ( keys %ARGS ) { + if ( + $arg =~ m/^ValueOf(.+)/ + && ( ref $ARGS{$arg} eq "ARRAY" + ? grep { $_ ne "" } @{ $ARGS{$arg} } + : $ARGS{$arg} ne "" ) + ) + { + + # We're adding a $1 clause + my $field = $1; + my ( $keyword, $op, $value ); + + #figure out if it's a grouping + if ( $ARGS{ $field . "Field" } ) { + $keyword = $ARGS{ $field . "Field" }; + } + else { + $keyword = $field; + } + + my ( @ops, @values ); + if ( ref $ARGS{ 'ValueOf' . $field } eq "ARRAY" ) { + + # we have many keys/values to iterate over, because there is + # more than one CF with the same name. + @ops = @{ $ARGS{ $field . 'Op' } }; + @values = @{ $ARGS{ 'ValueOf' . $field } }; + } + else { + @ops = ( $ARGS{ $field . 'Op' } ); + @values = ( $ARGS{ 'ValueOf' . $field } ); + } + $RT::Logger->error("Bad Parameters passed into Query Builder") + unless @ops == @values; + + for my $i ( 0 .. @ops - 1 ) { + my ( $op, $value ) = ( $ops[$i], $values[$i] ); + next if $value eq ""; + + if ( $value eq 'NULL' && $op =~ /=/ ) { + if ( $op eq '=' ) { + $op = "IS"; + } + elsif ( $op eq '!=' ) { + $op = "IS NOT"; + } + + # This isn't "right", but... + # It has to be this way until #5182 is fixed + $value = "'NULL'"; + } + else { + $value = "'$value'"; + } + + my $clause = { + Key => $keyword, + Op => $op, + Value => $value + }; + + my $newnode = RT::Interface::Web::QueryBuilder::Tree->new($clause); + if (@current_values) { + foreach my $value (@current_values) { + my $newindex = $value->getIndex() + 1; + $value->insertSibling( $newindex, $newnode ); + $value = $newnode; + } + } + else { + $tree->getChild(0)->addChild($newnode); + @current_values = $newnode; + } + $newnode->getParent()->setNodeValue( $ARGS{'AndOr'} ); + } + } +} + +# }}} + +# {{{ Move things around +if ( $ARGS{"Up"} ) { + if (@current_values) { + foreach my $value (@current_values) { + my $index = $value->getIndex(); + if ( $value->getIndex() > 0 ) { + my $parent = $value->getParent(); + $parent->removeChild($index); + $parent->insertChild( $index - 1, $value ); + $value = $parent->getChild( $index - 1 ); + } + else { + push( @actions, [ loc("error: can't move up"), -1 ] ); + } + } + } + else { + push( @actions, [ loc("error: nothing to move"), -1 ] ); + } +} +elsif ( $ARGS{"Down"} ) { + if (@current_values) { + foreach my $value (@current_values) { + my $index = $value->getIndex(); + my $parent = $value->getParent(); + if ( $value->getIndex() < ( $parent->getChildCount - 1 ) ) { + $parent->removeChild($index); + $parent->insertChild( $index + 1, $value ); + $value = $parent->getChild( $index + 1 ); + } + else { + push( @actions, [ loc("error: can't move down"), -1 ] ); + } + } + } + else { + push( @actions, [ loc("error: nothing to move"), -1 ] ); + } +} +elsif ( $ARGS{"Left"} ) { + if (@current_values) { + foreach my $value (@current_values) { + my $parent = $value->getParent(); + my $grandparent = $parent->getParent(); + if ( !$grandparent->isRoot ) { + my $index = $parent->getIndex(); + $parent->removeChild($value); + $grandparent->insertChild( $index, $value ); + if ( $parent->isLeaf() ) { + $grandparent->removeChild($parent); + } + } + else { + push( @actions, [ loc("error: can't move left"), -1 ] ); + } + } + } + else { + push( @actions, [ loc("error: nothing to move"), -1 ] ); + } +} +elsif ( $ARGS{"Right"} ) { + if (@current_values) { + foreach my $value (@current_values) { + my $parent = $value->getParent(); + my $index = $value->getIndex(); + my $newparent; + if ( $index > 0 ) { + my $sibling = $parent->getChild( $index - 1 ); + if ( ref( $sibling->getNodeValue ) ) { + $parent->removeChild($value); + my $newtree = RT::Interface::Web::QueryBuilder::Tree->new( 'AND', $parent ); + $newtree->addChild($value); + } + else { + $parent->removeChild($index); + $sibling->addChild($value); + } + } + else { + $parent->removeChild($value); + $newparent = RT::Interface::Web::QueryBuilder::Tree->new( 'AND', $parent ); + $newparent->addChild($value); + } + } + } + else { + push( @actions, [ loc("error: nothing to move"), -1 ] ); + } +} +elsif ( $ARGS{"DeleteClause"} ) { + if (@current_values) { + $_->getParent()->removeChild($_) for @current_values; + } + else { + push( @actions, [ loc("error: nothing to delete"), -1 ] ); + } +} +elsif ( $ARGS{"Toggle"} ) { + my $ea; + if (@current_values) { + foreach my $value (@current_values) { + my $parent = $value->getParent(); + + if ( $parent->getNodeValue eq 'AND' ) { + $parent->setNodeValue('OR'); + } + else { + $parent->setNodeValue('AND'); + } + } + } + else { + push( @actions, [ loc("error: nothing to toggle"), -1 ] ); + } +} + +$tree->PruneChildlessAggregators; + +# }}} + +# {{{ Rebuild $Query based on the additions / movements +$Query = ""; +my $optionlist_arrayref; + +($Query, $optionlist_arrayref) = $tree->GetQueryAndOptionList(\@current_values); + +my $optionlist = join "\n", map { qq(<option value="$_->{INDEX}" $_->{SELECTED}>) + . (" " x (5 * $_->{DEPTH})) + . $m->interp->apply_escapes($_->{TEXT}, 'h') . qq(</option>) } @$optionlist_arrayref; + + + + +use Regexp::Common qw /delimited/; + +# States +use constant VALUE => 1; +use constant AGGREG => 2; +use constant OP => 4; +use constant PAREN => 8; +use constant KEYWORD => 16; + +sub ParseQuery { + my $string = shift; + my $tree = shift; + my @actions = shift; + my $want = KEYWORD | PAREN; + my $last = undef; + + my $depth = 1; + + # make a tree root + $$tree = RT::Interface::Web::QueryBuilder::Tree->new; + my $root = RT::Interface::Web::QueryBuilder::Tree->new( 'AND', $$tree ); + my $lastnode = $root; + my $parentnode = $root; + + # get the FIELDS from Tickets_Overlay + my $tickets = new RT::Tickets( $session{'CurrentUser'} ); + my %FIELDS = %{ $tickets->FIELDS }; + + # Lower Case version of FIELDS, for case insensitivity + my %lcfields = map { ( lc($_) => $_ ) } ( keys %FIELDS ); + + my @tokens = qw[VALUE AGGREG OP PAREN KEYWORD]; + my $re_aggreg = qr[(?i:AND|OR)]; + my $re_value = qr[$RE{delimited}{-delim=>qq{\'\"}}|\d+]; + my $re_keyword = qr[$RE{delimited}{-delim=>qq{\'\"}}|(?:\{|\}|\w|\.)+]; + my $re_op = + qr[=|!=|>=|<=|>|<|(?i:IS NOT)|(?i:IS)|(?i:NOT LIKE)|(?i:LIKE)] + ; # long to short + my $re_paren = qr'\(|\)'; + + # assume that $ea is AND if it is not set + my ( $ea, $key, $op, $value ) = ( "AND", "", "", "" ); + + # order of matches in the RE is important.. op should come early, + # because it has spaces in it. otherwise "NOT LIKE" might be parsed + # as a keyword or value. + + while ( + $string =~ /( + $re_aggreg + |$re_op + |$re_keyword + |$re_value + |$re_paren + )/igx + ) + { + my $val = $1; + my $current = 0; + + # Highest priority is last + $current = OP if _match( $re_op, $val ); + $current = VALUE if _match( $re_value, $val ); + $current = KEYWORD + if _match( $re_keyword, $val ) && ( $want & KEYWORD ); + $current = AGGREG if _match( $re_aggreg, $val ); + $current = PAREN if _match( $re_paren, $val ); + + unless ( $current && $want & $current ) { + + # Error + # FIXME: I will only print out the highest $want value + my $token = $tokens[ ( ( log $want ) / ( log 2 ) ) ]; + push @actions, + [ + loc( +"current: $current, want $want, Error near ->$val<- expecting a " + . $token + . " in '$string'\n" + ), + -1 + ]; + } + + # State Machine: + my $parentdepth = $depth; + + # Parens are highest priority + if ( $current & PAREN ) { + if ( $val eq "(" ) { + $depth++; + + # make a new node that the clauses can be children of + $parentnode = RT::Interface::Web::QueryBuilder::Tree->new( $ea, $parentnode ); + } + else { + $depth--; + $parentnode = $parentnode->getParent(); + $lastnode = $parentnode; + } + + $want = KEYWORD | PAREN | AGGREG; + } + elsif ( $current & AGGREG ) { + $ea = $val; + $want = KEYWORD | PAREN; + } + elsif ( $current & KEYWORD ) { + $key = $val; + $want = OP; + } + elsif ( $current & OP ) { + $op = $val; + $want = VALUE; + } + elsif ( $current & VALUE ) { + $value = $val; + + # Remove surrounding quotes from $key, $val + # (in future, simplify as for($key,$val) { action on $_ }) + if ( $key =~ /$RE{delimited}{-delim=>qq{\'\"}}/ ) { + substr( $key, 0, 1 ) = ""; + substr( $key, -1, 1 ) = ""; + } + if ( $val =~ /$RE{delimited}{-delim=>qq{\'\"}}/ ) { + substr( $val, 0, 1 ) = ""; + substr( $val, -1, 1 ) = ""; + } + + # Unescape escaped characters + $key =~ s!\\(.)!$1!g; + $val =~ s!\\(.)!$1!g; + + my $class; + if ( exists $lcfields{ lc $key } ) { + $key = $lcfields{ lc $key }; + $class = $FIELDS{$key}->[0]; + } + if ( $class ne 'INT' ) { + $val = "'$val'"; + } + + push @actions, [ loc("Unknown field: $key"), -1 ] unless $class; + + $want = PAREN | AGGREG; + } + else { + push @actions, [ loc("I'm lost"), -1 ]; + } + + if ( $current & VALUE ) { + if ( $key =~ /^CF./ ) { + $key = "'" . $key . "'"; + } + my $clause = { + Key => $key, + Op => $op, + Value => $val + }; + + # explicity add a child to it + $lastnode = RT::Interface::Web::QueryBuilder::Tree->new( $clause, $parentnode ); + $lastnode->getParent()->setNodeValue($ea); + + ( $ea, $key, $op, $value ) = ( "", "", "", "" ); + } + + $last = $current; + } # while + + push @actions, [ loc("Incomplete query"), -1 ] + unless ( ( $want | PAREN ) || ( $want | KEYWORD ) ); + + push @actions, [ loc("Incomplete Query"), -1 ] + unless ( $last && ( $last | PAREN ) || ( $last || VALUE ) ); + + # This will never happen, because the parser will complain + push @actions, [ loc("Mismatched parentheses"), -1 ] + unless $depth == 1; +} + +sub _match { + + # Case insensitive equality + my ( $y, $x ) = @_; + return 1 if $x =~ /^$y$/i; + + # return 1 if ((lc $x) eq (lc $y)); # Why isnt this equiv? + return 0; +} + +sub debug { + my $message = shift; + $m->print( $message . "<br>" ); +} + +# }}} + +# }}} + +my $queues = $tree->GetReferencedQueues; + +# {{{ Deal with format changes +my ( $AvailableColumns, $CurrentFormat ); +( $Format, $AvailableColumns, $CurrentFormat ) = $m->comp( + 'Elements/BuildFormatString', + cfqueues => $queues, + %ARGS, Format => $Format +); + +# }}} + +# {{{ if we're asked to save the current search, save it +if ( $ARGS{'Save'} ) { + + if ( $search && $search->id ) { + + # This search is based on a previously loaded search -- so + # just update the current search object with new values + $search->SetSubValues( + Format => $Format, + Query => $Query, + Order => $Order, + OrderBy => $OrderBy, + RowsPerPage => $RowsPerPage, + ); + $search->SetDescription($Description); + + } + elsif ( $SearchId eq 'new' && $ARGS{'Owner'} =~ /^(.*?)-(\d+)$/ ) { + + # We're saving a new search + my $obj_type = $1; + my $obj_id = $2; + + # Find out if we're saving on the user, or a group + my $container_object; + if ( $obj_type eq 'RT::User' && $obj_id == $session{'CurrentUser'}->Id ) + { + $container_object = $session{'CurrentUser'}->UserObj; + } + elsif ( $obj_type eq 'RT::Group' ) { + $container_object = RT::Group->new( $session{'CurrentUser'} ); + $container_object->Load($obj_id); + } + + if ( $container_object->id ) { + + # If we got one or the other, add the saerch + my ( $search_id, $search_msg ) = $container_object->AddAttribute( + Name => 'SavedSearch', + Description => $Description, + Content => { + Format => $Format, + Query => $Query, + Order => $Order, + OrderBy => $OrderBy, + RowsPerPage => $RowsPerPage, + } + ); + $search = + $session{'CurrentUser'}->UserObj->Attributes->WithId($search_id); + + # Build new SearchId + $SearchId = + ref( $session{'CurrentUser'}->UserObj ) . '-' + . $session{'CurrentUser'}->UserObj->Id + . '-SavedSearch-' + . $search->Id; + } + unless ( $search->id ) { + push @actions, [ loc("Can't find a saved search to work with"), 0 ]; + } + + } + else { + push @actions, [ loc("Can't save this search"), 0 ]; + } + +} + +# }}} + +# {{{ If we're modifying an old query, check if it has changed +my $dirty = 0; +$dirty = 1 + if defined $search + and ($search->SubValue('Format') ne $Format + or $search->SubValue('Query') ne $Query + or $search->SubValue('Order') ne $Order + or $search->SubValue('OrderBy') ne $OrderBy + or $search->SubValue('RowsPerPage') ne $RowsPerPage ); + +# }}} + +# {{{ Push the updates into the session so we don't loose 'em +$search_hash->{'SearchId'} = $SearchId; +$search_hash->{'Format'} = $Format; +$search_hash->{'Query'} = $Query; +$search_hash->{'Description'} = $Description; +$search_hash->{'Object'} = $search; +$search_hash->{'Order'} = $Order; +$search_hash->{'OrderBy'} = $OrderBy; +$search_hash->{'RowsPerPage'} = $RowsPerPage; + +$session{'CurrentSearchHash'} = $search_hash; + +# }}} + +# {{{ Show the results, if we were asked. +if ( $ARGS{"DoSearch"} ) { + $m->comp( + "Results.html", + Query => $Query, + Format => $Format, + Order => $Order, + OrderBy => $OrderBy, + Rows => $RowsPerPage + ); + $m->abort(); +} + +# }}} + +# {{{ Build a querystring for the tabs + +my $QueryString; +if ($NewQuery) { + $QueryString = '?NewQuery=1'; +} +else { + $QueryString = '?' + . $m->comp( + '/Elements/QueryString', + Query => $Query, + Format => $Format, + Order => $Order, + OrderBy => $OrderBy, + Rows => $RowsPerPage + ) + if ($Query); +} + +# }}} + +</%INIT> + +<%ARGS> +$NewQuery => 0 +$SearchId => undef +$Query => undef +$Format => undef +$Description => undef +$Order => undef +$OrderBy => undef +$RowsPerPage => undef +$HideResults => 0 +@clauses => () +</%ARGS> + diff --git a/rt/html/Search/Bulk.html b/rt/html/Search/Bulk.html new file mode 100644 index 000000000..f9eef26b6 --- /dev/null +++ b/rt/html/Search/Bulk.html @@ -0,0 +1,278 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => loc("Bulk ticket update") &> +<& /Elements/Tabs, Title => loc("Bulk ticket update") &> + +<& /Elements/ListActions, actions => \@results &> +<FORM METHOD="POST" ACTION="<%$RT::WebPath%>/Search/Bulk.html" > +<input type="hidden" name="Query" value="<%$ARGS{'Query'}%>"> +<TABLE WIDTH=100% border=0 cellpadding=3 CELLSPACING=0> +<TR> +<TH><&|/l&>Update</&></TH> +%foreach my $col (@cols) { +% my $colalias = $col; +% $colalias =~ s/(Obj\-\>|)(Name|AsString)//; + +<TH><% loc($colalias) %> </TH> +%} +</TR> + +<%PERL> + +my $i; + +$Tickets->RedoSearch(); +while (my $Ticket = $Tickets->Next) { + $i++; + if ($i % 2) { + $bgcolor = "#dddddd"; + } + else { + $bgcolor = "#ffffff"; + } + </%PERL> +<TR bgcolor="<%$bgcolor%>"> +<TD><input type=checkbox name="UpdateTicket<%$Ticket->Id%>" value="1" CHECKED></TD> +%foreach my $col (@cols) { +<TD> +% if ($col eq 'id') { +<A HREF="<% $RT::WebPath%>/Ticket/Display.html?id=<%$Ticket->Id%>"><%$Ticket->Id()%></A> +% } +%else { +<% eval "\$Ticket->$col()" %> +%} +</TD> +%} +</TR> +%} + + + +</TABLE> + +<HR> + + +<& /Elements/TitleBoxStart, title => loc('Update selected tickets') &> +<TABLE> +<TR> +<TD VALIGN=TOP> +<table> +<tr><td class=label> <&|/l&>Make Owner</&>: </td> +<td class=value> <& /Elements/SelectOwner, Name => "Owner" &> (<input type=checkbox name="ForceOwnerChange"> <&|/l&>Force change</&>) </td></tr> +<tr><td class=label> <&|/l&>Add Requestor</&>: </td> +<td class=value> <INPUT Name="AddRequestor" SIZE=20> </td></tr> +<tr><td class=label> <&|/l&>Remove Requestor</&>: </td> +<td class=value> <INPUT Name="DeleteRequestor" SIZE=20> </td></tr> +<tr><td class=label> <&|/l&>Add Cc</&>: </td> +<td class=value> <INPUT Name="AddCc" SIZE=20> </td></tr> +<tr><td class=label> <&|/l&>Remove Cc</&>: </td> +<td class=value> <INPUT Name="DeleteCc" SIZE=20> </td></tr> +<tr><td class=label> <&|/l&>Add AdminCc</&>: </td> +<td class=value> <INPUT Name="AddAdminCc" SIZE=20> </td></tr> +<tr><td class=label> <&|/l&>Remove AdminCc</&>: </td> +<td class=value> <INPUT Name="DeleteAdminCc" SIZE=20> </td></tr> +</table> +</TD> +<TD VALIGN=TOP> +<table> +<tr><td class=label> <&|/l&>Make subject</&>: </td> +<td class=value> <INPUT Name="Subject" SIZE=20> </td></tr> +<tr><td class=label> <&|/l&>Make priority</&>: </td> +<td class=value> <INPUT Name="Priority" SIZE=4> </td></tr> +<tr><td class=label> <&|/l&>Make queue</&>: </td> +<td class=value> <& /Elements/SelectQueue, Name => "Queue" &> </td></tr> +<tr><td class=label> <&|/l&>Make Status</&>: </td> +<td class=value> <& /Elements/SelectStatus, Name => "Status" &> </td></tr> +<tr><td class=label> <&|/l&>Make date Starts</&>: </td> +<td class=value> <& /Elements/SelectDate, Name => "Starts_Date", ShowTime => 0, Default => '' &> </td></tr> +<tr><td class=label> <&|/l&>Make date Started</&>: </td> +<td class=value> <& /Elements/SelectDate, Name => "Started_Date", ShowTime => 0, Default => '' &> </td></tr> +<tr><td class=label> <&|/l&>Make date Told</&>: </td> +<td class=value> <& /Elements/SelectDate, Name => "Told_Date", ShowTime => 0, Default => '' &> </td></tr> +<tr><td class=label> <&|/l&>Make date Due</&>: </td> +<td class=value> <& /Elements/SelectDate, Name => "Due_Date", ShowTime => 0, Default => '' &> </td></tr> +<tr><td class=label> <&|/l&>Make date Resolved</&>: </td> +<td class=value> <& /Elements/SelectDate, Name => "Resolved_Date", ShowTime => 0, Default => '' &> </td></tr> +</table> + +</TD> +</TR> +</table> +<& /Elements/TitleBoxEnd&> +<& /Elements/TitleBoxStart, title => loc('Add comments or replies to selected tickets') &> +<table> +<tr><td align=right><&|/l&>Update Type</&>:</td> +<td><select name="UpdateType"> + <option value="private" ><&|/l&>Comments (not sent to requestors)</&></option> +<option value="response" ><&|/l&>Reply to requestors</&></option> +</select> +</td></tr> +<tr><td align=right><&|/l&>Subject</&>:</td><td> <input name="UpdateSubject" size=60 value=""></td></tr> +% while (my $CF = $TxnCFs->Next()) { +<TR> +<TD ALIGN=RIGHT><% $CF->Name %>:</TD> +<TD><& /Elements/EditCustomField, + CustomField => $CF, + NamePrefix => "Object-RT::Transaction--CustomField-" + &><em><% $CF->FriendlyType %></em></TD> +</TD></TR> +% } # end if while + <tr><td align=right><&|/l&>Attach</&>:</td><td><input name="UpdateAttachment" type="file"></td></tr> + <tr><td class=labeltop><&|/l&>Message</&>:</td><td> + <& /Elements/MessageBox, Name=>"UpdateContent"&> + </td></tr> + </table> + +<& /Elements/TitleBoxEnd &> + + +<& /Elements/TitleBoxStart, title => loc('Edit Links'), color => "#336633"&> +<i><&|/l&>Enter tickets or URIs to link tickets to. Separate multiple entries with spaces.</&></i><br> +<& /Ticket/Elements/BulkLinks &> +<& /Elements/TitleBoxEnd &> + +<& /Elements/Submit, Label => loc('Update All') &> + + +</FORM> +<%INIT> + +# Iterate through the ARGS hash and remove anything with a null value. +map ($ARGS{$_} =~ /^$/ && (delete $ARGS{$_}), keys %ARGS); + +my ($bgcolor, @results); +my @cols = qw(id Status Priority Subject QueueObj->Name OwnerObj->Name RequestorAddresses DueAsString ); + + +my $Tickets = RT::Tickets->new($session{'CurrentUser'}); +$Tickets->FromSQL($ARGS{'Query'}); + +Abort(loc("No search to operate on.")) unless ($Tickets); + +my %allcfs; +my %cfqnames; +my %cfqs; +my $count = 0; +while (my $Ticket = $Tickets->Next) { + my $cfq = $Ticket->QueueObj; + my $cfqid = $cfq->Id; + my $cfqn = $cfq->Name; + unless ( exists $cfqs{$cfqid} ) { + $cfqs{$cfqid} = 1; + $count++; + my $cfs = $cfq->TicketCustomFields; + while (my $cf = $cfs->Next) { + $allcfs{$cf->Id} = $cf; + $cfqnames{$cf->Id} = $cfqn; + } + } +} + +my $do_comment_reply=0; +# Prepare for ticket updates +$ARGS{'UpdateContent'} =~ s/\r\n/\n/g; +chomp ($ARGS{'UpdateContent'}) ; + +if ($ARGS{'UpdateContent'} && + $ARGS{'UpdateContent'} ne '' && + $ARGS{'UpdateContent'} ne "-- \n" . + $session{'CurrentUser'}->UserObj->Signature) { + $do_comment_reply=1; +} + +#Iterate through each ticket we've been handed +my @linkresults; +my %queues; + +$Tickets->RedoSearch(); +while (my $Ticket = $Tickets->Next) { + $queues{$Ticket->QueueObj->Id}++; + $RT::Logger->debug( "Checking Ticket ".$Ticket->Id ."\n"); + next unless ($ARGS{"UpdateTicket".$Ticket->Id}); + $RT::Logger->debug ("Matched\n"); + my @updateresults; + if ($do_comment_reply) { + ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef => \%ARGS, Actions => \@updateresults); + } + + #Update the basics. + my @basicresults = ProcessTicketBasics(TicketObj => $Ticket, ARGSRef => \%ARGS); + my @dateresults = ProcessTicketDates(TicketObj => $Ticket, ARGSRef => \%ARGS); + #Update the watchers + my @watchresults = ProcessTicketWatchers(TicketObj => $Ticket, ARGSRef => \%ARGS); + + + #Update the links + $ARGS{'id'} = $Ticket; + $ARGS{$Ticket->Id.'-MergeInto'} = $ARGS{'Ticket-MergeInto'}; + $ARGS{$Ticket->Id.'-DependsOn'} = $ARGS{'Ticket-DependsOn'}; + $ARGS{'DependsOn-'.$Ticket->Id} = $ARGS{'DependsOn-Ticket'}; + $ARGS{$Ticket->Id.'-MemberOf'} = $ARGS{'Ticket-MemberOf'}; + $ARGS{'MemberOf-'.$Ticket->Id} = $ARGS{'MemberOf-Ticket'}; + $ARGS{$Ticket->Id.'-RefersTo'} = $ARGS{'Ticket-RefersTo'}; + $ARGS{'RefersTo-'.$Ticket->Id} = $ARGS{'RefersTo-Ticket'}; + @linkresults = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS); + delete $ARGS{'id'}; + delete $ARGS{$Ticket->Id.'-MergeInto'}; + delete $ARGS{$Ticket->Id.'-DependsOn'}; + delete $ARGS{'DependsOn-'.$Ticket->Id}; + delete $ARGS{$Ticket->Id.'-MemberOf'}; + delete $ARGS{'MemberOf-'.$Ticket->Id}; + delete $ARGS{$Ticket->Id.'-RefersTo'}; + delete $ARGS{'RefersTo-'.$Ticket->Id}; + my @tempresults = (@watchresults, @basicresults, @dateresults, + @updateresults, @linkresults); + @tempresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } @tempresults; + + @results = (@results, @tempresults); +} + +my $TxnCFs = RT::CustomFields->new($session{CurrentUser}); +$TxnCFs->LimitToLookupType("RT::Queue-RT::Ticket-RT::Transaction"); +$TxnCFs->LimitToGlobalOrObjectId(sort keys %queues); + +</%INIT> diff --git a/rt/html/Search/Edit.html b/rt/html/Search/Edit.html new file mode 100755 index 000000000..16e8a0e71 --- /dev/null +++ b/rt/html/Search/Edit.html @@ -0,0 +1,86 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => $title&> +<& /Ticket/Elements/Tabs, + current_tab => "Search/Edit.html?".$QueryString, + Title => $title, + Format => $Format, + Query => $Query, + Rows => $ARGS{'Rows'}, + OrderBy => $ARGS{'OrderBy'}, + Order => $ARGS{'Order'} &> + +<& Elements/NewListActions, actions => \@actions &> + +<form method="post" action="Build.html"> +<input type="hidden" name="SearchId" value="<%$SearchId%>"> +<textarea name="Query" rows="8" cols="72"><%$Query%></textarea> +<br> +<textarea name="Format" rows="8" cols="72"><%$Format%></textarea> +<br> +<& /Elements/Submit, Label => loc("Apply"), Reset => 1, Caption => loc("Apply your changes")&> +</form> + +<%INIT> +my $title = loc("Edit Query"); +$Format = $m->comp('/Elements/ScrubHTML', Content => $Format); +my $QueryString = $m->comp('/Elements/QueryString', + Query => $Query, + Format => $Format, + Rows => $ARGS{'Rows'}, + OrderBy => $ARGS{'OrderBy'}, + Order => $ARGS{'Order'}, + ); + +</%INIT> + + +<%ARGS> +$Query => undef +$Format => undef +$SearchId => 'new' +@actions => undef +</%ARGS> diff --git a/rt/html/Search/Elements/BuildFormatString b/rt/html/Search/Elements/BuildFormatString new file mode 100644 index 000000000..639e62c29 --- /dev/null +++ b/rt/html/Search/Elements/BuildFormatString @@ -0,0 +1,243 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +$Format => undef +%cfqueues => undef +$Face => undef +$Size => undef +$Link => undef +$Title => undef +$AddCol => undef +$RemoveCol => undef +$ColUp => undef +$ColDown => undef +$SelectDisplayColumns => undef +$CurrentDisplayColumns => undef +</%args> +<%init> + +unless ($Format) { + $Format = $RT::DefaultSearchResultFormat; +} + + +# All the things we can display in the format string by default +my @fields = qw( + id + Status + ExtendedStatus + Subject + QueueName + OwnerName + Priority + InitialPriority + FinalPriority + Type + TimeWorked + TimeLeft + TimeEstimated + CreatedBy + LastUpdatedBy + Requestors + Cc + AdminCc + Starts + StartsRelative + Started + StartedRelative + Created + CreatedRelative + LastUpdated + LastUpdatedRelative + Told + ToldRelative + Due + DueRelative + Resolved + ResolvedRelative + RefersTo + ReferredToBy + DependsOn + DependedOnBy + MemberOf + Members + Parents + Children + NEWLINE +); + +my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'}); +foreach my $id (keys %cfqueues) { + # What does this _do_? What are the keys to cfqueues + $id =~ s/^.'*(.*).'*$/$1/; + # Gotta load up the $queue object, since queues get stored by name now. + my $queue = RT::Queue->new($session{'CurrentUser'}); + $queue->Load($id); + $CustomFields->LimitToQueue($queue->Id); +} +$CustomFields->LimitToGlobal; + +while ( my $CustomField = $CustomFields->Next ) { + my $queuestr; + if ($CustomField->QueueObj && $CustomField->QueueObj->Id != 0) { + $queuestr = $CustomField->QueueObj->Name . "."; + } + push @fields, "CustomField." . $queuestr . "{" . $CustomField->Name . "}"; +} + +my ( @seen); + +my @format = split( /,\s*/, $Format ); +foreach my $field (@format) { + my %column = (); + $field =~ s/'(.*)'/$1/; + my ( $prefix, $suffix ); + if ( $field =~ m/(.*)__(.*)__(.*)/ ) { + $prefix = $1; + $suffix = $3; + $field = $2; + } + $field = "<blank>" if !$field; + $column{Prefix} = $prefix; + $column{Suffix} = $suffix; + $field =~ s/\s*(.*)\s*/$1/; + $column{Column} = $field; + push @seen, \%column; +} + +if ( $RemoveCol ) { + my $index = $CurrentDisplayColumns; + my $column = $seen[$index]; + if ($index) { + delete $seen[$index]; + my @temp = @seen; + @seen = (); + foreach my $element (@temp) { + next unless $element; + push @seen, $element; + } + } +} +elsif ( $AddCol ) { + if ( defined $SelectDisplayColumns ) { + my $selected = $SelectDisplayColumns; + my @columns; + if (ref($selected) eq 'ARRAY') { + @columns = @$selected; + } else { + push @columns, $selected; + } + foreach my $col (@columns) { + my %column = (); + $column{Column} = $col; + + if ( $Face eq "Bold" ) { + $column{Prefix} .= "<B>"; + $column{Suffix} .= "</B>"; + } + if ( $Face eq "Italic" ) { + $column{Prefix} .= "<I>"; + $column{Suffix} .= "</I>"; + } + if ($Size) { + $column{Prefix} .= "<" . $m->interp->apply_escapes( $Size, 'h' ) . ">"; + $column{Suffix} .= "</" . $m->interp->apply_escapes( $Size, 'h' ) . ">"; + } + if ( $Link eq "Display" ) { + $column{Prefix} .= + "<A HREF=\"" . $RT::WebPath . "/Ticket/Display.html?id=__id__\">"; + $column{Suffix} .= "</a>"; + } + elsif ( $Link eq "Take" ) { + $column{Prefix} .= "<A HREF=\"" . $RT::WebPath + . "/Ticket/Display.html?Action=Take&id=__id__\">"; + $column{Suffix} .= "</a>"; + } + + if ($Title) { + $column{Suffix} .= "/TITLE:" . $m->interp->apply_escapes( $Title, 'h' ); + } + push @seen, \%column; +} +} +} +elsif ( $ColUp ) { + my $index = $CurrentDisplayColumns; + if ( defined $index && ( $index - 1 ) >= 0 ) { + my $column = $seen[$index]; + $seen[$index] = $seen[ $index - 1 ]; + $seen[ $index - 1 ] = $column; + $CurrentDisplayColumns = $index - 1; + } +} +elsif ( $ColDown ) { + my $index = $CurrentDisplayColumns; + if ( defined $index && ( $index + 1 ) < scalar @seen ) { + my $column = $seen[$index]; + $seen[$index] = $seen[ $index + 1 ]; + $seen[ $index + 1 ] = $column; + $CurrentDisplayColumns = $index + 1; + } +} + + +my @format_string; +foreach my $field (@seen) { + next unless $field; + my $row = "'" . $field->{Prefix}; + $row .= "__" . $m->interp->apply_escapes( $field->{Column}, 'h' ) . "__" + unless ( $field->{Column} eq "<blank>" ); + $row .= $field->{Suffix} . "'"; + push( @format_string, $row ); +} + +$Format = join(",\n", @format_string); + + +return($Format, \@fields, \@seen); + +</%init> + diff --git a/rt/html/Search/Elements/DisplayOptions b/rt/html/Search/Elements/DisplayOptions new file mode 100644 index 000000000..43a9d9998 --- /dev/null +++ b/rt/html/Search/Elements/DisplayOptions @@ -0,0 +1,110 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/TitleBoxStart, title => loc("Display Columns") &> +<table> +<tr> +<td> +<& EditFormat, %ARGS &> +</td> +<td valign=top> +<table valign=top> +<tr> +<td class=label> +<&|/l&>Order by</&>: +</td><td class=value> +<select name="OrderBy"> +% foreach my $field (keys %fields) { +% next unless $field; +<option value=<%$field%> +% if ($field =~ /^$OrderBy$/i) { +SELECTED +% } +><&|/l&><%$field%></&></option> +% } +</select> +<select name="Order"> +<option value="ASC" +% if ($Order eq "ASC") { +SELECTED +% } +><&|/l&>Ascending</&></option> +<option value="DESC" +% if ($Order eq "DESC") { +SELECTED +% } +><&|/l&>Descending</&></option> +</select> +</td> +</tr> +<td class=label> +<&|/l&>Rows per page</&>: +</td><td class="value"> +<& /Elements/SelectResultsPerPage, + Name => "RowsPerPage", + Default => $RowsPerPage &> +</td> +</tr> +</table> +</td> +</tr> +</table> +<& /Elements/TitleBoxEnd &> + +<%INIT> +my $tickets = new RT::Tickets($session{'CurrentUser'}); +my %fields = %{$tickets->FIELDS}; +map { $fields{$_}->[0] =~ /^(?:ENUM|INT|DATE|STRING)$/ || delete $fields{$_} } keys %fields; +delete $fields{'EffectiveId'}; + + +</%INIT> + +<%ARGS> +$Order => undef +$OrderBy => undef +$RowsPerPage => undef +$Format => undef +</%ARGS> diff --git a/rt/html/Search/Elements/EditFormat b/rt/html/Search/Elements/EditFormat new file mode 100644 index 000000000..dc8720f26 --- /dev/null +++ b/rt/html/Search/Elements/EditFormat @@ -0,0 +1,114 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<table> +<tr> +<td> +<&|/l&>Add Columns</&>: +</td> +<td> +<&|/l&>Format</&>: +</td> +<td></td> +<td> +<&|/l&>Show Columns</&>: +</td> +<tr> +<td valign=top> +<select size="6" name="SelectDisplayColumns" multiple> +% foreach my $field ( @$AvailableColumns) { +<option value="<%$field%>"><% loc( $field) %></option> +%# $m->comp( '/Elements/RT__Ticket/ColumnMap', Name => $field, Attr => 'title') || +% } +</select> +</td> +<td> +<&|/l&>Link</&>: +<select name="Link"> +<option value="None">-</option> +<option value="Display"><&|/l&>Display</&></option> +<option value="Take"><&|/l&>Take</&></option> +</select> +<br><&|/l&>Title</&>: <input name="Title" size=10> +<br><&|/l&>Size</&>: +<select name="Size"> +<option value="">-</option> +<option value="Small"><&|/l&>Small</&></option> +<option value="Large"><&|/l&>Large</&></option> +</select> +<br><&|/l&>Style</&>: +<select name="Face"> +<option value="">-</option> +<option value="Bold"><&|/l&>Bold</&></option> +<option value="Italic"><&|/l&>Italic</&></option> +</select> +</td> +<td> +<input type=submit name="AddCol" value="->"> +</td> +<td valign=top> +<select size=4 name="CurrentDisplayColumns"> +% my $i=0; +% foreach my $field (@$CurrentFormat) { +<option value="<%$i++%>><%$field->{Column}%>"> +<%loc( $field->{Column}) %></option> +% } +</select> +<br> +<center> +<input type="submit" name="ColUp" value="^"> +<input type="submit" name="ColDown" value="v"> +<input type="submit" name="RemoveCol" value="<%loc('Delete')%>"> +</center> +</td> +<td colspan=3 align=center> +</td> +</tr> +</table> + +<%ARGS> +$CurrentFormat => undef +$AvailableColumns => undef +</%ARGS> diff --git a/rt/html/Search/Elements/EditQuery b/rt/html/Search/Elements/EditQuery new file mode 100644 index 000000000..783541a64 --- /dev/null +++ b/rt/html/Search/Elements/EditQuery @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& NewListActions, actions => $actions &> +<& /Elements/TitleBoxStart, title => join(': ', grep defined, loc("Query"), $Description) &> +<select size="10" name="clauses" style="width: 100%" multiple> +% $m->out($optionlist); +</select> +<p align="center"> +<input type=submit name="Up" value="^"> +<input type=submit name="Down" value="v"> +<input type=submit name="Left" value="<"> +<input type=submit name="Right" value=">"> +<input type=submit name="Toggle" value="<&|/l&>And/Or</&>"> +<input type=submit name="DeleteClause" value="<&|/l&>Delete</&>"> +%#<input type=submit name="EditQuery" value="Advanced"> +</p> +<& /Elements/TitleBoxEnd &> +<%ARGS> +$Description +$optionlist +$actions +</%ARGS> diff --git a/rt/html/Search/Elements/EditSearches b/rt/html/Search/Elements/EditSearches new file mode 100644 index 000000000..bc6b80e6f --- /dev/null +++ b/rt/html/Search/Elements/EditSearches @@ -0,0 +1,104 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/TitleBoxStart, title => loc('Saved searches') &> +%# Hide all the save functionality if the user shouldn't see it. +% if ($session{'CurrentUser'}->HasRight( Right => 'CreateSavedSearch', +% Object=> $RT::System )) { +<&|/l&>Privacy:</&> +% if ($CurrentSearch->{'Object'} && $CurrentSearch->{'Object'}->id) { +<& SearchPrivacy, Object => $CurrentSearch->{'Object'}->Object &><br> +% } else { +<& SelectSearchObject, Name => 'Owner', Objects => \@Objects &><br> +% } +<&|/l&>Description</&>:<br> +<font size="-1"><input size="25" name="Description" value="<%$CurrentSearch->{'Description'}%>"></font> +<nobr> +% if ($SearchId ne 'new') { +% if ($Dirty) { +<input type="submit" name="Revert" value="<%loc('Revert')%>"> +% } +<input type="submit" name="Delete" value="<%loc('Delete')%>"> +<input type="submit" name="CopySearch" value="<%loc('Copy')%>"> +</nobr> + +% } + +% if ($Dirty or $SearchId eq 'new') { +<input type="submit" name="Save" value="<%loc('Save')%>"> +% } +<hr> +% } +<&|/l&>Load saved search:</&><br> +<& SelectSearchesForObjects, Name => 'LoadSavedSearch', Objects => \@Objects&> +<input value="<%loc('Load')%>" type="submit"> +<& /Elements/TitleBoxEnd &> + +<%init> + +unless ($session{'CurrentUser'}->HasRight( Right => 'LoadSavedSearch', + Object=> $RT::System )) { + return; +} +my @Objects; + +push @Objects, $session{CurrentUser}->UserObj; + +my $groups = RT::Groups->new($session{'CurrentUser'}); + +$groups->LimitToUserDefinedGroups; +$groups->WithMember(PrincipalId => $session{'CurrentUser'}->Id, + Recursively => 1); + + push (@Objects, @{$groups->ItemsArrayRef()}); +</%INIT> + +<%ARGS> +$SearchId => undef +$CurrentSearch => undef +$Description => undef +$HideResults => 0 +$Dirty => 0 +</%ARGS> diff --git a/rt/html/Search/Elements/NewListActions b/rt/html/Search/Elements/NewListActions new file mode 100644 index 000000000..eb82544f3 --- /dev/null +++ b/rt/html/Search/Elements/NewListActions @@ -0,0 +1,66 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% if ($actions[0] ) { +<b><%loc('Results')%></b><br> +% foreach my $action (@actions) { +% next unless ($action); +% my @item = @$action; +% if ($item[1] < 0) { +<font color=red> +% } + <%$item[0]%><BR> +% if ($item[1] < 0) { +</font> +% } +% } +<BR> +% } +<%init> +@actions = grep (/./,@actions); +</%init> +<%ARGS> +@actions => undef +</%ARGS> diff --git a/rt/html/Search/Elements/PickBasics b/rt/html/Search/Elements/PickBasics new file mode 100644 index 000000000..8a48f6b18 --- /dev/null +++ b/rt/html/Search/Elements/PickBasics @@ -0,0 +1,187 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<tr> +<td class="label"> +<&|/l&>id</&> +</td><td> +<& /Elements/SelectEqualityOperator, Name => "idOp" &> +</td><td> +<INPUT Name="ValueOfid" SIZE=5> +</td> +</tr> + +<tr><td align=right> +<& /Elements/SelectAttachmentField, Name => 'AttachmentField' &> +</td><td> +<& /Elements/SelectBoolean, Name => "AttachmentOp", + True => loc("matches"), + False => loc("does not match"), + TrueVal => 'LIKE', + FalseVal => 'NOT LIKE' +&> +</td><td> +<Input Name="ValueOfAttachment" Size=20> +</td> +</tr> +<tr> +<td class="label"> +<&|/l&>Queue</&> +</td><td> +<& /Elements/SelectBoolean, Name => "QueueOp" , + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', + FalseVal => '!=' &> +</td><td> +<& /Elements/SelectQueue, + Name => "ValueOfQueue", + NamedValues => 1, + CheckQueueRight => 'ShowTicket' &> +</td> +</tr> +<tr> +<td class="label"> +<&|/l&>Status</&> +</td><td> +<& /Elements/SelectBoolean, Name => "StatusOp", + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', + FalseVal => '!=' +&> +</td><td> +<& /Elements/SelectStatus, Name => "ValueOfStatus", SkipDeleted => 1 &> +</td> +</tr> +<tr><td class="label"> +<SELECT NAME="ActorField"> +<OPTION VALUE="Owner"><&|/l&>Owner</&></OPTION> +<OPTION VALUE="Creator"><&|/l&>Creator</&></OPTION> +<OPTION VALUE="LastUpdatedBy"><&|/l&>LastUpdatedBy</&></OPTION> +</SELECT> +</td><td> +<& /Elements/SelectBoolean, Name => "ActorOp", + TrueVal=> '=', + FalseVal => '!=' +&> +</td><td> +<& /Elements/SelectOwner, Name => "ValueOfActor", ValueAttribute => 'Name' &> +</td> +</tr> +<tr> +<td class="label"> +<& SelectPersonType, Name => 'WatcherField', Default => 'Requestor' &> +</td><td> +<& /Elements/SelectMatch, Name => "WatcherOp" &> +</td><td> +<Input Name="ValueOfWatcher" Size=20> +</tr> +<tr> +<td class="label"> +<& SelectPersonType, Name => 'WatcherGroupField', Default => 'RequestorGroup', Suffix => 'Group' &> +</td><td> +<& /Elements/SelectBoolean, Name => "WatcherGroupOp", + True=> loc('belongs to'), + False=> loc('does not belong to'), + TrueVal=> '=', + FalseVal => '!=' +&> +</td><td> +<& SelectGroup, Name => 'ValueOfWatcherGroup' &> +</td> +</tr> +<tr> +<td class="label"> +<& /Elements/SelectDateType, Name=>"DateField" &> +</td><td> +<& /Elements/SelectDateRelation, Name=>"DateOp" &> +</td><td> +<& /Elements/SelectDate, Name => "ValueOfDate", ShowTime => 0, Default => '' &> +</td></tr> +<tr> +<td class="label"> +<SELECT NAME="TimeField"> +<OPTION VALUE="TimeWorked"><&|/l&>Time Worked</&></OPTION> +<OPTION VALUE="TimeEstimated"><&|/l&>Time Estimated</&></OPTION> +<OPTION VALUE="TimeLeft"><&|/l&>Time Left</&></OPTION> +</SELECT> +</td><td> +<& /Elements/SelectEqualityOperator, Name => "TimeOp" &> +</td><td> +<INPUT Name="ValueOfTime" SIZE=5> +</td> +</tr> +<tr> +<td class="label"> +<SELECT NAME="PriorityField"> +<OPTION VALUE="Priority"><&|/l&>Priority</&></OPTION> +<OPTION VALUE="InitialPriority"><&|/l&>Initial Priority</&></OPTION> +<OPTION VALUE="FinalPriority"><&|/l&>Final Priority</&></OPTION> +</SELECT> +</td><td> +<& /Elements/SelectEqualityOperator, Name => "PriorityOp" &> +</td><td> +<INPUT Name="ValueOfPriority" SIZE=5> +</td> +</tr> +<tr> +<td class="label"> +<& SelectLinks, Name=>"LinksField" &> +</td><td> +<& /Elements/SelectBoolean, Name => "LinksOp", + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', + FalseVal => '!=' &> +</td><td> +<INPUT Name="ValueOfLinks" value="" SIZE=5> +</td></tr> +<%INIT> +my @people = ('Actor', + 'Watcher', + 'WatcherGroup', + ); +</%INIT> diff --git a/rt/html/Search/Elements/PickCFs b/rt/html/Search/Elements/PickCFs new file mode 100644 index 000000000..435a07ad3 --- /dev/null +++ b/rt/html/Search/Elements/PickCFs @@ -0,0 +1,78 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% while ( my $CustomField = $CustomFields->Next ) { +% my $name = "'CF.{" . $CustomField->Name . "}'"; +<tr><td class="label"> +<% $CustomField->Name %> +</td> +<td> + <& /Elements/SelectCustomFieldOperator, Name => $name . "Op", + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', FalseVal => '!=' &> +</td> +<td> +<& /Elements/SelectCustomFieldValue, Name => "ValueOf" . $name, + CustomField => $CustomField, + &> +</td></tr> +% } +<%INIT> +my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'}); +foreach my $id (keys %cfqueues) { + $id =~ s/^.'*(.*).'*$/$1/; + # Gotta load up the $queue object, since queues get stored by name now. my $id + my $queue = RT::Queue->new($session{'CurrentUser'}); + $queue->Load($id); + $CustomFields->LimitToQueue($queue->Id); +} +$CustomFields->LimitToGlobal(); + +</%INIT> + +<%ARGS> +%cfqueues => undef +</%ARGS> diff --git a/rt/html/Search/Elements/PickCriteria b/rt/html/Search/Elements/PickCriteria new file mode 100644 index 000000000..129344443 --- /dev/null +++ b/rt/html/Search/Elements/PickCriteria @@ -0,0 +1,80 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/TitleBoxStart, title => loc('Add Criteria')&> +<table width=100% cellspacing=0 cellpadding=0 border=0> + <tr> + <td> + <table cellspacing=0 border=0> + <tr><td class=label> + <&|/l&>Aggregator</&>: + </td> + <td><& SelectAndOr, Name => "AndOr" &> + </td></tr> + </table> + </td></tr> + <tr> + <td> + <hr> + </td> + </tr> + <tr> + <td valign=top> + <table cellspacing=0 border=0> + <& PickBasics &> + <& PickCFs, cfqueues => \%cfqueues &> + </table> + </td> + </tr> + <tr><td> </td></tr> +</table> + +<& /Elements/TitleBoxEnd &> + +<%ARGS> +$addquery => 0 +$query => undef +%cfqueues => undef +</%ARGS> diff --git a/rt/html/Search/Elements/SearchPrivacy b/rt/html/Search/Elements/SearchPrivacy new file mode 100644 index 000000000..270e1baa3 --- /dev/null +++ b/rt/html/Search/Elements/SearchPrivacy @@ -0,0 +1,53 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +$Object => undef +</%args> +% if (ref($Object) eq 'RT::User' && $Object->id == $session{'CurrentUser'}->Id) { +<&|/l&>My saved searches</&> +% } else { +<&|/l, $Object->Name&>[_1]'s saved searches</&> +% } diff --git a/rt/html/Search/Elements/SelectAndOr b/rt/html/Search/Elements/SelectAndOr new file mode 100644 index 000000000..2f3c70477 --- /dev/null +++ b/rt/html/Search/Elements/SelectAndOr @@ -0,0 +1,51 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<input type=radio NAME="<%$Name%>" CHECKED VALUE="AND"><&|/l&>AND</&></input> +<input type=radio NAME="<%$Name%>" VALUE="OR"><&|/l&>OR</&></input> + +<%ARGS> +$Name => "Operator" +</%ARGS> diff --git a/rt/html/Search/Elements/SelectGroup b/rt/html/Search/Elements/SelectGroup new file mode 100644 index 000000000..edd53713f --- /dev/null +++ b/rt/html/Search/Elements/SelectGroup @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME="<%$Name%>"> +% if ($AllowNull) { +<OPTION VALUE="">-</OPTION> +% } +%while (my $group = $groups->Next) { +<OPTION VALUE="<%$group->id%>" <%$group->id eq $Default && "SELECTED"%>><%$group->Name%></OPTION> +%} +</SELECT> + +<%INIT> +my $groups = new RT::Groups($session{'CurrentUser'}); +$groups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => $Domain); + +</%INIT> +<%ARGS> +$AllowNull => 1 +$Default=> '' +$Name => 'Group' +$Domain => 'UserDefined'; +</%ARGS> diff --git a/rt/html/Search/Elements/SelectLinks b/rt/html/Search/Elements/SelectLinks new file mode 100644 index 000000000..00ec80bd3 --- /dev/null +++ b/rt/html/Search/Elements/SelectLinks @@ -0,0 +1,64 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME="<%$Name%>"> +% foreach (@fields) { +<OPTION VALUE="<%$_%>"><&|/l&><%$_%></&></OPTION> +% } +</SELECT> +<%ARGS> +$Name => 'LinksField' +</%ARGS> + +<%INIT> +my @fields = ('HasMember', + 'MemberOf', + 'DependsOn', + 'DependedOnBy', + 'RefersTo', + 'ReferredToBy', + 'LinkedTo', + ); +</%INIT> diff --git a/rt/html/Search/Elements/SelectPersonType b/rt/html/Search/Elements/SelectPersonType new file mode 100644 index 000000000..d4127c97b --- /dev/null +++ b/rt/html/Search/Elements/SelectPersonType @@ -0,0 +1,82 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<SELECT NAME ="<%$Name%>"> +% if ($AllowNull) { +<OPTION VALUE="">-</OPTION> +% } +% for my $option (@types) { +% if ($Suffix) { +<OPTION VALUE="<% $option %><% $Suffix %>" <%$option eq $Default && "SELECTED"%> ><%loc($option)%></OPTION> +% next; +% } +% foreach my $subtype (@subtypes) { +<OPTION VALUE="<%"$option.$subtype"%>" <%$option eq $Default && $subtype eq 'EmailAddress' && "SELECTED"%> ><% loc($option) %> <% loc($subtype) %></OPTION> +% } +% } +</SELECT> + +<%INIT> +my @types; +if ($Scope =~ 'queue') { + @types = qw(Cc AdminCc); +} +elsif ($Suffix eq 'Group') { + @types = qw(Requestor Cc AdminCc Watcher); +} +else { + @types = qw(Requestor Cc AdminCc Watcher Owner); +} + +my @subtypes = qw(EmailAddress Name RealName Nickname Organization Address1 Address2 WorkPhone HomePhone MobilePhone PagerPhone); + +</%INIT> +<%ARGS> +$AllowNull => 1 +$Suffix => '' +$Default=>undef +$Scope => 'ticket' +$Name => 'WatcherType' +</%ARGS> diff --git a/rt/html/Search/Elements/SelectSearchObject b/rt/html/Search/Elements/SelectSearchObject new file mode 100644 index 000000000..e9df5179f --- /dev/null +++ b/rt/html/Search/Elements/SelectSearchObject @@ -0,0 +1,58 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +@Objects => undef +$Name => undef +</%args> +<select name="<%$Name%>"> +% foreach my $object (@Objects) { +% if (ref($object) eq 'RT::User' && $object->id == $session{'CurrentUser'}->Id) { +<option value="<%ref($object)%>-<%$object->id%>"><&|/l&>My saved searches</&></option> +% } else { +<option value="<%ref($object)%>-<%$object->id%>"><&|/l, $object->Name&>[_1]'s saved searches</&></option> +% } +% } +</select> diff --git a/rt/html/Search/Elements/SelectSearchesForObjects b/rt/html/Search/Elements/SelectSearchesForObjects new file mode 100644 index 000000000..e6be66a58 --- /dev/null +++ b/rt/html/Search/Elements/SelectSearchesForObjects @@ -0,0 +1,66 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +@Objects => undef +$Name => undef +</%args> +<select name="<%$Name%>"> +% foreach my $object (@Objects) { +% if (ref($object) eq 'RT::User' && $object->id == $session{'CurrentUser'}->Id) { +<option value=""><&|/l&>My saved searches</&></option> +% } else { +<option value=""></option> +<option value=""><&|/l, $object->Name&>[_1]'s saved searches</&></option> +% } +% my @searches = $object->Attributes->Named('SavedSearch'); +% foreach my $search (@searches) { +% # Skip it if it is not a ticket search. +% next if ($search->SubValue('SearchType') +% && $search->SubValue('SearchType') ne 'Ticket'); +<option value="<%ref($object)%>-<%$object->id%>-SavedSearch-<%$search->Id%>"> -<%$search->Description||loc('Unnamed search')%></option> +% } +% } +</select> diff --git a/rt/html/Search/Results.html b/rt/html/Search/Results.html new file mode 100755 index 000000000..5849378a8 --- /dev/null +++ b/rt/html/Search/Results.html @@ -0,0 +1,138 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &> +<& /Ticket/Elements/Tabs, + current_tab => "Search/Results.html".$QueryString, + Title => $title, + Format => $Format, + Query => $Query, + Rows => $Rows, + OrderBy => $OrderBy, + Order => $Order &> +<& /Elements/TicketList, + Query => $Query, + AllowSorting => 1, + OrderBy => $OrderBy, + Order => $Order, + Rows => $Rows, + Page => $Page, + Format => $Format, + BaseURL => $RT::WebPath."/Search/Results.html?" + + &> +<div align=right> +<form method=get action="<%$RT::WebPath%>/Search/Results.html"> +<input type="hidden" name="Query" value="<%$Query%>" /> +<input type="hidden" name="Format" value="<%$Format%>" /> +<input type="hidden" name="HideResults" value="<%$HideResults%>" /> +<input type="hidden" name="Rows" value="<%$Rows%>" /> +<input type="hidden" name="Page" value="<%$Page%>" /> +<input type="hidden" name="OrderBy" value="<%$OrderBy%>" /> +<input type="hidden" name="Order" value="<%$Order%>" /> +<& /Elements/Refresh, Name => 'TicketsRefreshInterval', Default => $session {'tickets_refresh_interval'} &> +<input type=submit value="<&|/l&>Go!</&>"> +</form> +</div> +<div align=right> +<a href="<%$RT::WebPath%>/Search/Bulk.html<%$QueryString%>"><&|/l&>Update multiple tickets</&></a><br> +<a href="<%$RT::WebPath%>/Search/Results.html<%$QueryString%>"><&|/l&>Bookmarkable link</&></a><br> +<a href="<%$RT::WebPath%>/Search/Results.tsv<%$QueryString%>"><&|/l&>spreadsheet</&></a> | +<a href="<%$RT::WebPath%>/Search/Results.rdf<%$ShortQueryString%>"><&|/l&>RSS</&></a> | +<a href="<%$RT::WebPath%>/Tools/Offline.html<%$ShortQueryString%>"><&|/l&>Work offline</&></a><br> +<& /Elements/Callback, _CallbackName => 'SearchActions', QueryString => $QueryString&> +</div> +<%INIT> +my ($title, $ticketcount); +$session{'i'}++; +$session{'tickets'} = RT::Tickets->new($session{'CurrentUser'}) ; +$session{'tickets'}->FromSQL($Query) if ($Query); +$session{'tickets'}->OrderBy(FIELD => $OrderBy, ORDER => $Order); + + +$session{'CurrentSearchHash'} = { + Format => $Format, + Query => $Query, + Order => $Order, + OrderBy => $OrderBy, + RowsPerPage => $Rows + }; + + + +if ( $session{'tickets'}->Query()) { + $ticketcount = $session{tickets}->CountAll(); + $title = loc('Found [quant,_1,ticket]', $ticketcount); +} else { + $title = loc("Find tickets"); +} + +my $QueryString = "?".$m->comp('/Elements/QueryString', + Query => $Query, + Format => $Format, + Rows => $Rows, + OrderBy => $OrderBy, + Order => $Order, + Page => $Page); + +my $ShortQueryString = "?".$m->comp('/Elements/QueryString', Query => $Query); + +if ($ARGS{'TicketsRefreshInterval'}) { + $session{'tickets_refresh_interval'} = $ARGS{'TicketsRefreshInterval'}; +} + +</%INIT> +<%CLEANUP> +$session{'tickets'}->PrepForSerialization(); +</%CLEANUP> +<%ARGS> +$Query => undef +$Format => undef +$HideResults => 0 +$Rows => 50 +$Page => 1 +$OrderBy => 'id' +$Order => 'ASC' +</%ARGS> diff --git a/rt/html/Search/Results.rdf b/rt/html/Search/Results.rdf new file mode 100644 index 000000000..ee71fea94 --- /dev/null +++ b/rt/html/Search/Results.rdf @@ -0,0 +1,85 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%INIT> + +my $Tickets = RT::Tickets->new($session{'CurrentUser'}); +$Tickets->FromSQL($ARGS{'Query'}); +$r->content_type('application/rdf+xml'); + + + + # create an RSS 1.0 file (http://purl.org/rss/1.0/) + use XML::RSS; + my $rss = new XML::RSS (version => '1.0'); + $rss->channel( + title => "$RT::rtname: Syndicated Search", + link => $RT::WebURL, + description => "", + dc => { + }, + syn => { + updatePeriod => "hourly", + updateFrequency => "1", + updateBase => "1901-01-01T00:00+00:00", + }, + ); + + + while ( my $Ticket = $Tickets->Next()) { + my $row; + $rss->add_item( + title => $Ticket->Subject, + link => $RT::WebURL."/Ticket/Display.html?id=".$Ticket->id, + description => $Ticket->Transactions->First->Content, + dc => { + subject => $Ticket->Subject, + creator => $Ticket->CreatorObj->RealName . "<".$Ticket->CreatorObj->EmailAddress.">", + }, + ); + } +$m->out($rss->as_string); +$m->abort(); +</%INIT> diff --git a/rt/html/Search/Results.tsv b/rt/html/Search/Results.tsv new file mode 100644 index 000000000..17aa88ae1 --- /dev/null +++ b/rt/html/Search/Results.tsv @@ -0,0 +1,115 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%INIT> + +my $Tickets = RT::Tickets->new($session{'CurrentUser'}); +$Tickets->FromSQL($ARGS{'Query'}); + +my @rows; +my %known_cfs; + +my @attrs = qw( id QueueObj->Name Subject Status TimeEstimated TimeWorked TimeLeft Priority FinalPriority OwnerObj->Name + Requestors->MemberEmailAddressesAsString DueObj->ISO ToldObj->ISO + CreatedObj->ISO ResolvedObj->ISO ); + + $r->content_type('application/vnd.ms-excel'); + while ( my $Ticket = $Tickets->Next()) { + my $row; + foreach my $attr (@attrs) { + my $method = '$Ticket->'.$attr.'()'; + $row->{$attr} = eval $method; + if ($@) {die "Failed to find $attr - ". $@}; + } + + my $cfs = $Ticket->QueueObj->CustomFields(); + while (my $cf = $cfs->Next) { + my @content; + my $values = $Ticket->CustomFieldValues($cf->Id); + while (my $value = $values->Next) { + push @content, $value->Content; + } + $row->{'CustomField-'.$cf->Id} = join(', ',@content); + if ($row->{'CustomField-'.$cf->Id}) { + $known_cfs{$cf->Id} = $cf->Name; + } + } + push @rows, $row; + + + } +{ +my @header; + foreach my $attr (@attrs) { + my $label = $attr; + $label =~ s'Obj-.(?:AsString|Name|ISO)''g; + $label =~ s'-\>MemberEmailAddressesAsString''g; + push @header, $label; + } + foreach my $id (sort keys %known_cfs) { + push @header, $known_cfs{$id}; + } + +$m->out(join("\t", @header)); +$m->out("\n"); +} +foreach my $row (@rows) { + my @row; + foreach my $attr(@attrs) { + push @row, $row->{"$attr"}; + } + foreach my $id (sort keys %known_cfs) { + my $val = $row->{'CustomField-'.$id}; + $val =~ s/(\n|\r)//g; + push @row, $val; + } + + $m->out(join("\t",@row)); + $m->out("\n"); +} + + +$m->abort(); +</%INIT> diff --git a/rt/html/SelfService/Attachment/dhandler b/rt/html/SelfService/Attachment/dhandler new file mode 100644 index 000000000..f953c2486 --- /dev/null +++ b/rt/html/SelfService/Attachment/dhandler @@ -0,0 +1,49 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%init> +$m->comp('/Ticket/Attachment/dhandler', %ARGS); +$m->abort; +</%init> diff --git a/rt/html/SelfService/Closed.html b/rt/html/SelfService/Closed.html new file mode 100644 index 000000000..2d49a6897 --- /dev/null +++ b/rt/html/SelfService/Closed.html @@ -0,0 +1,49 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /SelfService/Elements/Header, Title => loc('Closed tickets') &> + +<& /SelfService/Elements/MyRequests, status => ['rejected', 'resolved'], friendly_status => +loc('closed') &> diff --git a/rt/html/SelfService/Create.html b/rt/html/SelfService/Create.html new file mode 100644 index 000000000..d60ae267a --- /dev/null +++ b/rt/html/SelfService/Create.html @@ -0,0 +1,115 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& Elements/Header, Title => loc("Create a ticket") &> + +<FORM ACTION="Display.html" METHOD="POST" ENCTYPE="multipart/form-data"> +<INPUT TYPE=HIDDEN Name="id" VALUE="new"> + +<TABLE> +<TR> +<TD class="label"> +<&|/l&>Queue</&>: +</td> +<td class="value"> + <input type="hidden" name="Queue" value="<%$queue_obj->id%>"> + <b><%$queue_obj->Name%></b> (<%$queue_obj->Description%>) +</TD> +</TR> +<TR> +<TD class="label"> +<&|/l&>Requestors</&>: +</TD> +<TD class="value"> +<INPUT Name="Requestors" Value="<%$session{CurrentUser}->EmailAddress%>" SIZE=20> +</TD> +</TR> +<TR> +<TD class="label"> +<&|/l&>Cc</&>: +</TD> +<TD class="value"> + <INPUT NAME="Cc" SIZE=20> +</TD> +</TR> +<TR> +<TD class="label"> +<&|/l&>Subject</&>: +</TD> +<TD class="value"> +<INPUT Name="Subject" SIZE=60 MAXSIZE=100 value=""> +</TD> +</TR> +<tr> + <td colspan="2"> + <& /Ticket/Elements/EditCustomFields, QueueObj => $queue_obj &> + </td> +</tr> +<tr> +<TD class="label"> +<&|/l&>Attach file</&>: +</TD> +<TD class="value"> +<INPUT Name="Attach" type="file"> +</TD> +</TR> +<TR> +<TD COLSPAN=2> +<&|/l&>Describe the issue below</&>:<br> +<& /Elements/MessageBox &> +</TD> +</TR> +</TABLE> +<& /Elements/Submit, Label => loc("Create ticket")&> + + +</FORM> +<%args> +$Queue => undef +</%args> +<%init> +my $queue_obj = RT::Queue->new($session{'CurrentUser'}); +$queue_obj->Load($Queue); +</%init> diff --git a/rt/html/SelfService/CreateTicketInQueue.html b/rt/html/SelfService/CreateTicketInQueue.html new file mode 100755 index 000000000..5e8973610 --- /dev/null +++ b/rt/html/SelfService/CreateTicketInQueue.html @@ -0,0 +1,61 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& Elements/Header, Title => loc("Create a ticket") &> + +<h1><&|/l&>Select a queue for your new ticket</&></h1> + +<dl> +% while (my $queue = $queues->Next) { +% next unless $queue->CurrentUserHasRight('CreateTicket'); + +<dt><a href="<%$RT::WebPath%>/SelfService/Create.html?Queue=<%$queue->id%>"><%$queue->Name%></a></dt> +<dd><%$queue->Description%></dd> +% } +</dl> +<%init> +my $queues = RT::Queues->new($session{'CurrentUser'}); +$queues->UnLimit; +</%init> diff --git a/rt/html/SelfService/Display.html b/rt/html/SelfService/Display.html new file mode 100644 index 000000000..f7140df02 --- /dev/null +++ b/rt/html/SelfService/Display.html @@ -0,0 +1,219 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /SelfService/Elements/Header, Title => loc('#[_1]: [_2]', $Ticket->id, $Ticket->Subject) &> + +<& /Elements/ListActions, actions => \@results &> + + <TABLE WIDTH="100%" class="ticketsummary" > + <TR> + <TD VALIGN=TOP WIDTH="50%" class="boxcontainer"> + <& /Elements/TitleBoxStart, title => loc('The Basics'), + title_class=> 'inverse', + color => "#993333" &> + <& /Ticket/Elements/ShowBasics, Ticket => $Ticket &> + <& /Ticket/Elements/ShowCustomFields, Ticket => $Ticket &> + <& /Elements/TitleBoxEnd &> +</TD> + <TD VALIGN=TOP WIDTH="50%" class="boxcontainer"> + <& /Elements/TitleBoxStart, title => loc("Dates"), + title_class=> 'inverse', + color => "#663366" &> + <& /Ticket/Elements/ShowDates, Ticket => $Ticket, UpdatedLink => 0 &> + <& /Elements/TitleBoxEnd &> +</TD> +</TR> +</TABLE> + + + +%#!!pape: selfservice_find_attachments.patch {{ +<& /Ticket/Elements/ShowHistory, + Ticket => $Ticket, + URIFile => "Display.html", + ShowHeaders => $ARGS{'ShowHeaders'}, + AttachPath => "Attachment", + Attachments => $attachments, + UpdatePath => "Update.html" +&> +%#!!pape: selfservice_find_attachments.patch }} + + + +<%INIT> + +my ( $field, @results ); + +# {{{ Load the ticket +#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 @id = ( ref $id eq 'ARRAY' ) ? @{$id} : ($id); + +my $Ticket = new RT::Ticket( $session{'CurrentUser'} ); + +# store the uploaded attachment in session +if ( $ARGS{'Attach'} ) { # attachment? + $session{'Attachments'} = {} unless defined $session{'Attachments'}; + + my $subject = "$ARGS{'Attach'}"; + + # since CGI.pm deutf8izes the magic field, we need to add it back. + Encode::_utf8_on($subject); + + # strip leading directories + $subject =~ s#^.*[\\/]##; + + my $attachment = MakeMIMEEntity( + Subject => $subject, + Body => "", + AttachmentFieldName => 'Attach' + ); + + $session{'Attachments'} = + { %{ $session{'Attachments'} || {} }, + $ARGS{'Attach'} => $attachment }; +} + +if ( $id[0] eq 'new' ) { + + # {{{ Create a new ticket + + my $Queue = new RT::Queue( $session{'CurrentUser'} ); + unless ( $Queue->Load( $ARGS{'Queue'} ) ) { + $m->comp( 'Error.html', Why => loc('Queue not found') ); + $m->abort; + } + + unless ( $Queue->CurrentUserHasRight('CreateTicket') ) { + $m->comp( 'Error.html', + Why => + loc('You have no permission to create tickets in that queue.') ); + $m->abort; + } + + + ( $Ticket, @results ) = + CreateTicket( Attachments => $session{'Attachments'}, %ARGS, Status => 'new' ); + + unless ( $Ticket->id ) { + $m->comp( 'Error.html', Why => join( "\n", @results )); + $m->abort(); + } + + # }}} + + # delete temporary storage entry to make WebUI clean + unless ( keys %{ $session{'Attachments'} } and $ARGS{'UpdateAttach'} ) { + delete $session{'Attachments'}; + } + + # }}} + } + else { + unless ( $Ticket->Load( $id[0] ) ) { + $m->comp( 'Error.html', + Why => loc( "Couldn't load ticket '[_1]'", $id ) ); + $m->abort(); + } + } + + # }}} + + unless ( $Ticket->CurrentUserHasRight('ShowTicket') ) { + $m->comp( 'Error.html', + Why => loc("No permission to display that ticket") ); + $m->abort(); + } + + my ( $code, $msg ); + + #Update the status + if ( ( defined $ARGS{'Status'} ) + and $ARGS{'Status'} + and ( $ARGS{'Status'} ne $Ticket->Status ) ) + { + ( $code, $msg ) = $Ticket->SetStatus( $ARGS{'Status'} ); + push @results, "$msg"; + } + + # }}} + + if ( + $session{'Attachments'} + || ( $ARGS{'UpdateContent'} ne '' + && $ARGS{'UpdateContent'} ne "-- \n" + . $session{'CurrentUser'}->UserObj->Signature ) + ) + { + $ARGS{UpdateAttachments} = $session{'Attachments'}; + } + ProcessUpdateMessage( + ARGSRef => \%ARGS, + Actions => \@results, + TicketObj => $Ticket + ); + + # delete temporary storage entry to make WebUI clean + unless ( keys %{ $session{'Attachments'} } and $ARGS{'UpdateAttach'} ) { + delete $session{'Attachments'}; + } + + my @cfupdates = ProcessObjectCustomFieldUpdates(Object => $Ticket, ARGSRef => \%ARGS); + push (@results, @cfupdates); + + # }}} + + my $Transactions = $Ticket->Transactions; + + my $attachments = + $m->comp( '/Ticket/Elements/FindAttachments', Ticket => $Ticket ); + +</%INIT> + + +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/html/SelfService/Elements/GotoTicket b/rt/html/SelfService/Elements/GotoTicket new file mode 100644 index 000000000..50efaa24e --- /dev/null +++ b/rt/html/SelfService/Elements/GotoTicket @@ -0,0 +1,46 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<FORM ACTION="<%$RT::WebPath%>/SelfService/Display.html"><input type=submit value="<&|/l&>Goto ticket</&>"> <input size=4 name=id></FORM> diff --git a/rt/html/SelfService/Elements/Header b/rt/html/SelfService/Elements/Header new file mode 100644 index 000000000..c7e6a9167 --- /dev/null +++ b/rt/html/SelfService/Elements/Header @@ -0,0 +1,47 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, %ARGS, Prefs => '/SelfService/Prefs.html' &> +<& /SelfService/Elements/Tabs, %ARGS &> diff --git a/rt/html/SelfService/Elements/MyRequests b/rt/html/SelfService/Elements/MyRequests new file mode 100644 index 000000000..2df8ce842 --- /dev/null +++ b/rt/html/SelfService/Elements/MyRequests @@ -0,0 +1,85 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/TitleBoxStart, title => $title &> +<TABLE BORDER=0 cellspacing=1 cellpadding=1 BGCOLOR="#eeeeee" WIDTH=100%> +<TR> +<TH><&|/l&>Subject</&></TH> +<TH><&|/l&>Status</&></TH> +<TH><&|/l&>Owner</&></TH> +</TR> +<TR> +% while (my $Ticket = $MyTickets->Next) { +<TR> +<TD> +<a href="<%$RT::WebPath%>/SelfService/Display.html?id=<%$Ticket->Id%>"><%$Ticket->Id%>: <%$Ticket->Subject%></a> +</TD> +<TD> +<%loc($Ticket->Status)%> +</TD><TD> +<%$Ticket->OwnerObj->Name%> +</TR> +% } +</TABLE> +<& /Elements/TitleBoxEnd &> + + +<%INIT> +$title ||= loc("My [_1] tickets", $friendly_status); +my $MyTickets; +$MyTickets = new RT::Tickets ($session{'CurrentUser'}); +$MyTickets->LimitWatcher(TYPE => 'Requestor', VALUE => $session{'CurrentUser'}->EmailAddress); +$MyTickets->OrderBy(FIELD => 'id', ORDER => 'ASC'); + +foreach my $status (@status) { + + $MyTickets->LimitStatus(VALUE => $status); +} +</%INIT> +<%ARGS> +$title => undef +$friendly_status => loc('open') +@status => ('open', 'new', 'stalled') +</%ARGS> diff --git a/rt/html/SelfService/Elements/Tabs b/rt/html/SelfService/Elements/Tabs new file mode 100644 index 000000000..802fd6525 --- /dev/null +++ b/rt/html/SelfService/Elements/Tabs @@ -0,0 +1,90 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/PageLayout, + current_toptab => $current_toptab, + current_tab => $current_tab, + toptabs => $tabs, + topactions => $actions, + title => $Title +&> +<a name="skipnav" id="skipnav" accesskey="8"></a> +<%INIT> + +if ($Title) { +$Title = loc ("RT Self Service") . " / " . $Title; +} else { +$Title = loc ("RT Self Service"); + +} +my ($tab); +my $tabs = { A => { title => loc('Open tickets'), + path => 'SelfService/', + }, + B => { title => loc('Closed tickets'), + path => 'SelfService/Closed.html', + }, + C => { title => loc('New ticket'), + path => 'SelfService/CreateTicketInQueue.html' + } + }; +if ($session{'CurrentUser'}->HasRight( Right => 'ModifySelf', + Object => $RT::System )) { + $tabs->{Z} = { title => loc('Preferences'), + path => 'SelfService/Prefs.html' + }; +} + +my $actions = { + B => { html => $m->scomp('GotoTicket') + } + }; +</%INIT> +<%ARGS> +$Title => undef +$current_toptab => undef +$current_tab => undef +</%ARGS> + diff --git a/rt/html/SelfService/Error.html b/rt/html/SelfService/Error.html new file mode 100644 index 000000000..8ac9f81ea --- /dev/null +++ b/rt/html/SelfService/Error.html @@ -0,0 +1,68 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /SelfService/Elements/Header, Title => loc('Error') &> +<h2 class="title"><%loc('Error')%></h2> +<& /Elements/TitleBoxStart, title => $Title &> +<%$Why%> +<br> +<font size=-1> +<%$Details%> +</font> +<& /Elements/TitleBoxEnd &> +</body> +</HTML> + + +<%args> +$Code => undef +$Details => undef +$Title => loc("RT Error") +$Why => loc("the calling component did not specify why") +</%args> + +<%INIT> +$RT::Logger->error("WebRT: $Why ($Details)"); +</%INIT> diff --git a/rt/html/SelfService/Prefs.html b/rt/html/SelfService/Prefs.html new file mode 100644 index 000000000..3913203fb --- /dev/null +++ b/rt/html/SelfService/Prefs.html @@ -0,0 +1,90 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /SelfService/Elements/Header, Title => loc('Preferences') &> + +<& /Elements/ListActions, actions => \@results &> +<form method=post> + +% unless ($RT::WebExternalAuth and !$RT::WebFallbackToInternalAuth) { +<& /Elements/TitleBoxStart, title => loc('Change password') &> +<&|/l&>New password</&>: <input type=password name="NewPass1" size=16> +<&|/l&>Confirm</&>: <input type=password name="NewPass2" size=16> +<& /Elements/TitleBoxEnd &> +<BR> +% } +<& /Elements/Submit, Label => loc('Save Changes') &> + </form> + + +<%INIT> +my @results; + +if ($NewPass1) { + if ($NewPass1 ne $NewPass2) { + push (@results, "Passwords did not match."); + } + else { + my ($val, $msg)=$session{'CurrentUser'}->UserObj->SetPassword($NewPass1); + push (@results, "Password: ".$msg); + } +} +if ($Signature) { + $Signature =~ s/(\r\n|\r)/\n/g; + if ($Signature ne $session{'CurrentUser'}->UserObj->Signature) { + my ($val, $msg)=$session{'CurrentUser'}->UserObj->SetSignature($Signature); + push (@results, "Signature: ".$msg); + } +} +#A hack to make sure that session gets rewritten. + +$session{'i'}++; +</%INIT> + +<%ARGS> +$Signature => undef +$NewPass1 => undef +$NewPass2 => undef +</%ARGS> diff --git a/rt/html/SelfService/Update.html b/rt/html/SelfService/Update.html new file mode 100644 index 000000000..816a610aa --- /dev/null +++ b/rt/html/SelfService/Update.html @@ -0,0 +1,127 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /SelfService/Elements/Header, + Title =>loc('Update ticket #[_1]', $Ticket->id) +&> + + +<FORM ACTION="Display.html" METHOD=POST ENCTYPE="multipart/form-data"> +<input type=hidden name="UpdateType" value="response"> +<input TYPE="hidden" NAME="id" VALUE="<%$Ticket->Id%>"> +<table> + <tr> + <td class="label"> + <&|/l&>Status</&> + </td> + <td class="value"> + <& /Elements/SelectStatus, Name=>"Status", DefaultLabel => loc("[_1] (Unchanged)",loc($DefaultStatus)) &> + </td> + </tr> + <tr> + <td class="label"> + <&|/l&>Subject</&> + </td> + <td class="value"> + <input name="UpdateSubject" size=60 value="<% $Ticket->Subject %>"> + </td> + + </tr> +% if (exists $session{'Attachments'}) { +<tr> + <TD class="label"> + <&|/l&>Attached file</&> + </TD> + <TD COLSPAN=5 class="value"> + <&|/l&>Check box to delete</&><BR> +% foreach my $attach_name (keys %{$session{'Attachments'}}) { + <input type="checkbox" name="DeleteAttach-<%$attach_name%>" value="1"><%$attach_name%><BR> +% } # end of foreach + </TD> +</TR> +% } # end of if +<tr> + <td class"label"> + <&|/l&>Attach</&> + </td> + <td class="value"> + <input name="Attach" type="file"> + <input type="hidden" name="UpdateAttach" value="1"> + </td> + </tr> +</table> +<& /Ticket/Elements/EditCustomFields, TicketObj => $Ticket &> +<& /Elements/MessageBox, + Name => "UpdateContent", + QuoteTransaction => $ARGS{QuoteTransaction} + &> + <br> + + +<& /Elements/Submit &> + </FORM> + + + +<%INIT> + +my $Ticket = LoadTicket($id); + +my $title = loc( "Update ticket #[_1]", $Ticket->id ); + +$DefaultStatus = $Ticket->Status() unless ($DefaultStatus); + + +Abort( loc("No permission to view update ticket") ) + unless ( $Ticket->CurrentUserHasRight('ReplyToTicket') + or $Ticket->CurrentUserHasRight('ModifyTicket') ); + +</%INIT> + +<%ARGS> +$id => undef +$Action => undef +$DefaultStatus => undef +</%ARGS> diff --git a/rt/html/SelfService/index.html b/rt/html/SelfService/index.html new file mode 100644 index 000000000..f3ccb8555 --- /dev/null +++ b/rt/html/SelfService/index.html @@ -0,0 +1,48 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /SelfService/Elements/Header, Title => undef &> + +<& /SelfService/Elements/MyRequests &> diff --git a/rt/html/Ticket/Attachment/dhandler b/rt/html/Ticket/Attachment/dhandler new file mode 100644 index 000000000..584fd721d --- /dev/null +++ b/rt/html/Ticket/Attachment/dhandler @@ -0,0 +1,92 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%perl> + my ($ticket, $trans,$attach, $filename); + my $arg = $m->dhandler_arg; # get rest of path + if ($arg =~ '^(\d+)/(\d+)') { + $trans = $1; + $attach = $2; + } + else { + Abort("Corrupted attachment URL."); + } + my $AttachmentObj = new RT::Attachment($session{'CurrentUser'}); + $AttachmentObj->Load($attach) || Abort("Attachment '$attach' could not be loaded"); + + + unless ($AttachmentObj->id) { + Abort("Bad attachment id. Couldn't find attachment '$attach'\n"); + } + unless ($AttachmentObj->TransactionId() == $trans ) { + Abort("Bad transaction number for attachment. $trans should be".$AttachmentObj->TransactionId() ."\n"); + + } + + my $content_type = $AttachmentObj->ContentType || 'text/plain'; + + unless ($RT::TrustHTMLAttachments) { + $content_type = 'text/plain' if ($content_type =~ /^text\/html/i); + } + + if (my $enc = $AttachmentObj->OriginalEncoding) { + # normalize Encode.pm convention with IANA ones + $enc = 'big5' if $enc eq 'big5-eten'; + $enc = 'utf-8' if $enc eq 'utf8'; + $content_type .= ";charset=$enc"; + } + + # unless ($RT::TrustMIMEAttachments) { + # $content_type = 'application/octet-stream'; + # } + + $r->content_type( $content_type ); + $m->clear_buffer(); + $m->out($AttachmentObj->OriginalContent); + $m->abort; +</%perl> +<%attr> +AutoFlush => 0 +</%attr> diff --git a/rt/html/Ticket/Create.html b/rt/html/Ticket/Create.html new file mode 100644 index 000000000..b547242f2 --- /dev/null +++ b/rt/html/Ticket/Create.html @@ -0,0 +1,300 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => loc("Create a new ticket") &> +<& /Elements/Tabs, + current_toptab => "Ticket/Create.html", + Title => loc("Create a new ticket") &> +<FORM ACTION="<%$RT::WebPath%>/Ticket/Create.html" METHOD="POST" ENCTYPE="multipart/form-data" NAME="TicketCreate"> +<INPUT TYPE=HIDDEN Name="id" VALUE="new"> +<A NAME="top"> + + +[<a class="currenttab"><&|/l&>Show basics</&></a>] [<A HREF="#detail"><&|/l&>Show details</&></a>] +<BR> +<& /Elements/TitleBoxStart, contentbg => "#cccccc", title => loc("Create a new ticket") &> +<TABLE border=0 cellpadding=0 cellspacing=0> +<TR><TD class=label><&|/l&>Queue</&>:</TD> +<TD class=value><% $QueueObj->Name %> +<INPUT TYPE=HIDDEN NAME=Queue Value="<%$QueueObj->Name%>"> +</TD> +<TD class=label><&|/l&>Status</&>: +</TD> +<TD class=value> +<& /Elements/SelectStatus, Name => "Status", Default => $ARGS{Status}||'new', DefaultValue => 0 &> +</TD> +<TD class=label> +<&|/l&>Owner</&>: +</TD> +<TD class=value> +<& /Elements/SelectOwner, Name => "Owner", QueueObj => $QueueObj, Default => $ARGS{Owner}||$RT::Nobody->Id, DefaultValue => 0 &> +</TD> +</TR> +<TR> +<TD class=label> +<&|/l&>Requestors</&>: +</TD> +<TD class=value COLSPAN=5> +<INPUT Name="Requestors" Value="<% ($ARGS{Requestors}) || $session{CurrentUser}->EmailAddress %>" SIZE=40> +</TD> +</TR> +<TR> +<TD class=labeltop> +<&|/l&>Cc</&>: +</TD> +<TD class=value COLSPAN=5> +<INPUT NAME="Cc" SIZE=40 VALUE="<% $ARGS{Cc} %>"><BR> +<i><font size=-2> +<&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people <b>will</b> receive future updates.)</&></font></i> +</TD> +</TR> +<TR> +<TD class=labeltop> +<&|/l&>Admin Cc</&>: +</TD> +<TD class=value COLSPAN=5> +<INPUT NAME="AdminCc" SIZE=40 VALUE="<% $ARGS{AdminCc} %>"><BR> +<i><font size=-2> +<&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people <b>will</b> receive future updates.)</&></font></i> +</TD> +</TR> +<TR> +<TD class=label> +<&|/l&>Subject</&>: +</TD> +<TD class=value COLSPAN=5> +<INPUT Name="Subject" SIZE=60 MAXSIZE=100 value="<%$ARGS{Subject} || ''%>"> +</TD> +</TR> +<TR> +<TD COLSPAN=6> +<& /Ticket/Elements/EditCustomFields, QueueObj => $QueueObj &> +</TD> +</TR> +% if ($TxnCFs->Count) { +% while (my $CF = $TxnCFs->Next()) { +<TR> +<TD ALIGN=RIGHT><% $CF->Name %>:</TD> +<TD><& /Elements/EditCustomField, CustomField => $CF, NamePrefix => + "Object-RT::Transaction--CustomField-" &><em><% $CF->FriendlyType %></em></TD> +</TD></TR> +% } +% } +<TR> +% if (exists $session{'Attachments'}) { +<TD class=label> +<&|/l&>Attached file</&>: +</TD> +<TD COLSPAN=5> +<&|/l&>Check box to delete</&><BR> +% foreach my $attach_name (keys %{$session{'Attachments'}}) { +<input type="checkbox" name="DeleteAttach-<%$attach_name%>" value="1"><%$attach_name%><BR> +% } # end of foreach +</TD> +</TR> +<TR> +% } # end of if +<TD> +<&|/l&>Attach file</&>: +</TD> +<TD class=value COLSPAN=5> +<INPUT TYPE=FILE NAME="Attach"> +<INPUT TYPE=SUBMIT NAME="AddMoreAttach" VALUE="<&|/l&>Add More Files</&>"> +</TD> +</TR> +<TR> +<TD COLSPAN=6> +<&|/l&>Describe the issue below</&>:<br> +% if (exists $ARGS{Content}) { +<& /Elements/MessageBox, Default => $ARGS{Content}, IncludeSignature => 0 &> +% } else { +<& /Elements/MessageBox, QuoteTransaction => $QuoteTransaction &> +%} + +<BR> +</TD> +</TR> +<TR> +<TD ALIGN=RIGHT COLSPAN=2> +</TD> +</TR> +</TABLE> +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit, Label => loc("Create")&> + +<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> +<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> +<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> +<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> +<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> + +<A NAME="detail"> + [<A HREF="#top"><&|/l&>Show basics</&></a>] [<a class="currenttab"><&|/l&>Show details</&></a>] +<BR> +<TABLE WIDTH="100%" BORDER=0> +<TR> +<TD WIDTH="50%" VALIGN=TOP> + + <& /Elements/TitleBoxStart, title => loc('The Basics'), + title_class=> 'inverse', + color => "#993333" &> +<TABLE BORDER=0> +<TR><TD ALIGN=RIGHT><&|/l&>Priority</&>:</TD><TD><input size=3 name="InitialPriority" value="<% $ARGS{InitialPriority} ? $ARGS{InitialPriority} : $QueueObj->InitialPriority %>"></TD></TR> +<TR><TD ALIGN=RIGHT><&|/l&>Final Priority</&>:</TD><TD><input size=3 name="FinalPriority" value="<% $ARGS{FinalPriority} ? $ARGS{FinalPriority} : $QueueObj->FinalPriority %>"></TD></TR> +<TR><TD ALIGN=RIGHT><&|/l&>Time Worked</&>:</TD><TD><&|/l,'<input size=3 name="TimeWorked" value="'.$ARGS{TimeWorked}.'">'&>[_1] min</&></TD></TR> +<TR><TD ALIGN=RIGHT><&|/l&>Time Left</&>:</TD><TD><&|/l,'<input size=3 name="TimeLeft" value="'.$ARGS{TimeLeft}.'">'&>[_1] min</&></TD></TR> +</TABLE> +<& /Elements/TitleBoxEnd &> +<br> +<& /Elements/TitleBoxStart, title => loc("Dates"), + title_class=> 'inverse', + color => "#663366" &> + +<TABLE BORDER=0> +<TR><TD ALIGN=RIGHT><&|/l&>Starts</&>:</TD><TD><input size=10 name="Starts" value="<% $ARGS{Starts} %>"></TD></TR> +<TR><TD ALIGN=RIGHT><&|/l&>Due</&>:</TD><TD><input size=10 name="Due" value="<% +$ARGS{Due}%>"></TD></TR> +</TABLE> +<& /Elements/TitleBoxEnd &> +<BR> +</TD> + +<TD VALIGN="TOP"> +<& /Elements/TitleBoxStart, title => loc('Links'), + title_class=> 'inverse', + titleright => '', color=> "#336633" &> + +<i><&|/l&>(Enter ticket ids or URLs, separated with spaces)</&></i> +<TABLE BORDER=0> +<TR><TD ALIGN=RIGHT><&|/l&>Depends on</&></TD><TD><input size=10 name="new-DependsOn" value="<% $ARGS{'new-DependsOn'} %>"></TD></TR> +<TR><TD ALIGN=RIGHT><&|/l&>Depended on by</&></TD><TD><input size=10 name="DependsOn-new" value="<% $ARGS{'DependsOn-new'} %>"></TD></TR> +<TR><TD ALIGN=RIGHT><&|/l&>Parents</&></TD><TD><input size=10 name="new-MemberOf" value="<% $ARGS{'new-MemberOf'} %>"></TD></TR> +<TR><TD ALIGN=RIGHT><&|/l&>Children</&></TD><TD><input size=10 name="MemberOf-new" value="<% $ARGS{'MemberOf-new'} %>"></TD></TR> +<TR><TD ALIGN=RIGHT><&|/l&>Refers to</&></TD><TD><input size=10 name="new-RefersTo" value="<% $ARGS{'new-RefersTo'} %>"></TD></TR> +<TR><TD ALIGN=RIGHT><&|/l&>Referred to by</&></TD><TD><input size=10 name="RefersTo-new" value="<% $ARGS{'RefersTo-new'} %>"></TD></TR> + + +</TABLE> +<& /Elements/TitleBoxEnd &> +<BR> + +</TD> +</TR> +</TABLE> +<& /Elements/Submit, Label => loc("Create") &> +</FORM> +<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> +<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> +<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> +<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> +<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> + +<%INIT> + + + +my $QueueObj = new RT::Queue($session{'CurrentUser'}); +$QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded.")); +my $CFs = $QueueObj->TicketCustomFields(); +my $TxnCFs = $QueueObj->TicketTransactionCustomFields(); + +# if no due date has been set explicitly, then use the +# queue's default if it exists +if ($QueueObj->DefaultDueIn && !$ARGS{'Due'}) { + my $default_due = RT::Date->new($session{'CurrentUser'}); + $default_due->SetToNow(); + $default_due->AddDays($QueueObj->DefaultDueIn); + $ARGS{'Due'} = $default_due->ISO(); +} + +# {{{ deal with deleting uploaded attachments +foreach my $key (keys %ARGS) { + if ($key =~ m/^DeleteAttach-(.+)$/) { + delete $session{'Attachments'}{$1}; + } + $session{'Attachments'} = { %{$session{'Attachments'} || {}} }; +} + +# {{{ store the uploaded attachment in session +if ($ARGS{'Attach'}) { # attachment? + $session{'Attachments'} = {} unless defined $session{'Attachments'}; + + my $subject = "$ARGS{'Attach'}"; + + # strip leading directories + $subject =~ s#^.*[\\/]##; + + my $attachment = MakeMIMEEntity( + Subject => $subject, + Body => "", + AttachmentFieldName => 'Attach' + ); + + $session{'Attachments'} = { %{$session{'Attachments'} || {}}, + $ARGS{'Attach'} => $attachment }; +} +# }}} + +# delete temporary storage entry to make WebUI clean +unless (keys %{$session{'Attachments'}} and $ARGS{'id'} eq 'new') { + delete $session{'Attachments'}; +} + + +# }}} + +if ((!exists $ARGS{'AddMoreAttach'}) && ($ARGS{'id'} eq 'new')) { # new ticket? + $m->comp('Display.html', %ARGS); + return(); +} +</%INIT> + +<%ARGS> +$DependsOn => undef +$DependedOnBy => undef +$MemberOf => undef +$QuoteTransaction => undef +$Queue => undef +</%ARGS> diff --git a/rt/html/Ticket/Display.html b/rt/html/Ticket/Display.html new file mode 100644 index 000000000..dd4c093dc --- /dev/null +++ b/rt/html/Ticket/Display.html @@ -0,0 +1,159 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, + Title => loc("#[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject) &> +<& /Ticket/Elements/Tabs, + Ticket => $TicketObj, + current_tab => 'Ticket/Display.html?id='.$TicketObj->id, + Title => loc("#[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject) &> + +<& /Elements/ListActions, actions => \@Actions &> + +<& /Elements/TitleBoxStart, title => loc('Ticket metadata'), contentbg => +'#ffffff' &> +<& /Ticket/Elements/ShowSummary, Ticket => $TicketObj, Attachments => $attachments &> +<& /Elements/TitleBoxEnd &> + +<BR> + +<& /Elements/Callback, _CallbackName => 'BeforeShowHistory', Ticket => $TicketObj, %ARGS &> + +<& /Ticket/Elements/ShowHistory , + Ticket => $TicketObj, + Tickets => $Tickets, + Collapsed => $ARGS{'Collapsed'}, + ShowHeaders => $ARGS{'ShowHeaders'}, + Attachments => $attachments, + AttachmentContent => $attachment_content + + &> + + +<%ARGS> +$id => undef +$Create => undef +$ShowHeaders => 0 +$Collapsed => undef +$TicketObj => undef +</%ARGS> + +<%INIT> + +$m->comp('/Elements/Callback', _CallbackName => 'Initial', TicketObj => $TicketObj, ARGSRef => \%ARGS); + +my ($linkid, $message, $tid, @Actions, $Tickets); + +unless ($id || $TicketObj) { + Abort('No ticket specified'); +} + +if ($ARGS{'id'} eq 'new') { + # {{{ Create a new ticket + + my $Queue = new RT::Queue($session{'CurrentUser'}); + unless ($Queue->Load($ARGS{'Queue'})) { + Abort('Queue not found'); + } + + unless ($Queue->CurrentUserHasRight('CreateTicket')) { + Abort('You have no permission to create tickets in that queue.'); + } + ($TicketObj, @Actions) = + CreateTicket(Attachments => $session{'Attachments'}, %ARGS); + delete $session{'Attachments'}; + unless ($TicketObj->CurrentUserHasRight('ShowTicket')) { + Abort("No permission to view newly created ticket #".$TicketObj->id."."); + } + # }}} +} else { + if (!$TicketObj) { + + $TicketObj = RT::Ticket->new($session{'CurrentUser'}); + + $TicketObj = LoadTicket($ARGS{'id'}); + unless ($TicketObj->CurrentUserHasRight('ShowTicket')) { + Abort("No permission to view ticket"); + } + } + + if (defined $ARGS{'Action'}) { + if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) { + my $action = $1; + my ($res, $msg)=$TicketObj->$action(); + push(@Actions, $msg); + } + } + + $ARGS{'UpdateContent'} =~ s/\r\n/\n/g if defined $ARGS{'UpdateContent'}; + if ( $ARGS{'UpdateTimeWorked'} || + $session{'Attachments'} || + ( defined $ARGS{'UpdateContent'} + && $ARGS{'UpdateContent'} ne '' + && $ARGS{'UpdateContent'} ne "-- \n" + . $session{'CurrentUser'}->UserObj->Signature )) { + $ARGS{UpdateAttachments} = $session{'Attachments'}; + ProcessUpdateMessage( ARGSRef => \%ARGS, + Actions => \@Actions, + TicketObj => $TicketObj ); + delete $session{'Attachments'}; + } + #Process status updates + my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$TicketObj); + my @results = ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => \%ARGS); + + push (@Actions, @BasicActions, @results); +} + + + +$m->comp('/Elements/Callback', _CallbackName => 'BeforeDisplay', + TicketObj => \$TicketObj, Tickets => \$Tickets, ARGSRef => \%ARGS); + + +my $attachments = $m->comp('Elements/FindAttachments', Ticket => $TicketObj, Tickets => $Tickets); +my $attachment_content = $m->comp('Elements/LoadTextAttachments', Ticket => $TicketObj); + +</%INIT> diff --git a/rt/html/Ticket/Elements/AddCustomers b/rt/html/Ticket/Elements/AddCustomers new file mode 100644 index 000000000..01c7367c4 --- /dev/null +++ b/rt/html/Ticket/Elements/AddCustomers @@ -0,0 +1,50 @@ +%# Copyright (c) 2004 Ivan Kohler <ivan-rt@420.am> +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +<BR> +<%$msg%><br> + +% if (@Customers) { + +<br><i>(Check box to link)<i> +<table> +% foreach my $customer (@Customers) { +<tr> + <td> + <input type="checkbox" name="Ticket-AddCustomer-<% $customer->{'custnum'} %>" VALUE="1" <% scalar(@Customers) == 1 ? 'CHECKED' : '' %>> + <A HREF="<%$freeside_url%>/view/cust_main.cgi?<% $customer->{'custnum'} %>"><% &RT::URI::freeside::small_custview($customer->{'custnum'}, &RT::URI::freeside::FreesideGetConfig('countrydefault'), 1) |n %> + </td> +</tr> +% } + +% } + +<%INIT> +my ($msg); + +my $freeside_url = &RT::URI::freeside::FreesideURL(); + +my @Customers = (); +if ( $CustomerString ) { + @Customers = &RT::URI::freeside::smart_search( 'search' => $CustomerString ); +} + +my @Services = (); +if ($ServiceString) { + @Services = (); #service_search(); +} + +</%INIT> + +<%ARGS> +$CustomerString => undef +$ServiceString => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/AddWatchers b/rt/html/Ticket/Elements/AddWatchers new file mode 100644 index 000000000..98314b9d2 --- /dev/null +++ b/rt/html/Ticket/Elements/AddWatchers @@ -0,0 +1,121 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<BR> +<%$msg%><br> + +<&|/l&>Add new watchers</&>:<br> + +<table> +% if ($Users and $Users->Count) { +<tr><td> +<&|/l&>Type</&> +</td><td> +<&|/l&>Username</&> +</td></tr> +% while (my $u = $Users->Next ) { +<tr><td><&/Elements/SelectWatcherType, Name => "Ticket-AddWatcher-Principal-".$u->PrincipalId &></td><td><%$u->Name%> (<%$u->RealName%>)</td></tr> +% } +% } + +% if ($Groups and $Groups->Count) { +<tr><td> +<&|/l&>Type</&> +</td><td> +<&|/l&>Group</&> +</td></tr> +% while (my $g = $Groups->Next ) { +<tr><td><&/Elements/SelectWatcherType, Name => "Ticket-AddWatcher-Principal-".$g->PrincipalId, Scope => 'queue' &></td><td><%$g->Name%> (<%$g->Description%>)</td></tr> +% } +% } + +<tr><td> +<&|/l&>Type</&> +</td><td> +<&|/l&>Email</&> +</td></tr> +<tr><td> +<&/Elements/SelectWatcherType, Name => "WatcherTypeEmail1" &> +</td><td> +<input name="WatcherAddressEmail1" size=15> +</td></tr> +<tr><td> +<&/Elements/SelectWatcherType, Name => "WatcherTypeEmail2" &> +</td><td> +<input name="WatcherAddressEmail2" size=15> +</td></tr> +<tr><td> +<&/Elements/SelectWatcherType, Name => "WatcherTypeEmail3" &> +</td><td> +<input name="WatcherAddressEmail3" size=15> +</td></tr> +</table> + +<%INIT> +my ($msg, $Users, $Groups); + +if ($UserString) { + $Users = RT::Users->new($session{'CurrentUser'}); + $Users->Limit(FIELD => $UserField, VALUE => $UserString, OPERATOR => $UserOp); + $Users->LimitToPrivileged if $PrivilegedOnly; + } + +if ($GroupString) { + $Groups = RT::Groups->new($session{'CurrentUser'}); + $Groups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => 'UserDefined'); + $Groups->Limit(FIELD => $GroupField, VALUE => $GroupString, OPERATOR => $GroupOp); + } + +</%INIT> + +<%ARGS> +$UserField => 'Name' +$UserOp => '=' +$UserString => undef +$GroupField => 'Name' +$GroupOp => '=' +$GroupString => undef +$PrivilegedOnly => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/BulkLinks b/rt/html/Ticket/Elements/BulkLinks new file mode 100644 index 000000000..6a3859aa3 --- /dev/null +++ b/rt/html/Ticket/Elements/BulkLinks @@ -0,0 +1,75 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<TABLE> + <TR> + <TD class="label"><&|/l&>Merge into</&>:</TD> + <TD class="entry"><input name="Ticket-MergeInto"> <i><&|/l&>(only one ticket)</&></i></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Depends on</&>:</TD> + <TD class="entry"><input name="Ticket-DependsOn"></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Depended on by</&>:</TD> + <TD class="entry"><input name="DependsOn-Ticket"></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Parents</&>:</TD> + <TD class="entry"><input name="Ticket-MemberOf"></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Children</&>:</TD> + <TD class="entry"> <input name="MemberOf-Ticket"></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Refers to</&>:</TD> + <TD class="entry"><input name="Ticket-RefersTo"></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Referred to by</&>:</TD> + <TD class="entry"> <input name="RefersTo-Ticket"></TD> + </TR> +</TABLE> diff --git a/rt/html/Ticket/Elements/EditBasics b/rt/html/Ticket/Elements/EditBasics new file mode 100644 index 000000000..715685153 --- /dev/null +++ b/rt/html/Ticket/Elements/EditBasics @@ -0,0 +1,94 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<TABLE> + <TR> + <td class="label"><&|/l&>Subject</&>:</td> + <td class="value"><input name=Subject value="<%$TicketObj->Subject|h%>" SIZE=50></td> + </TR> + + <TR> + <td class="label"><&|/l&>Status</&>:</td> + <td class="value"><%$SelectStatus|n%></td> + </TR> + <TR> + <td class="label"><&|/l&>Queue</&>:</td> + <td class="value"><%$SelectQueue|n%></td> + </TR> + <TR> + <td class="label"><&|/l&>Time Estimated</&>:</td> + <td class="value"><input name=TimeEstimated value="<%$TicketObj->TimeEstimated|h%>" SIZE="5"></td> + </TR> + <TR> + <td class="label"><&|/l&>Time Worked</&>:</td> + <td class="value"><input name=TimeWorked value="<%$TicketObj->TimeWorked|h%>" SIZE="5"></td> + </TR> + <TR> + <td class="label"><&|/l&>Time Left</&>:</td> + <td class="value"><input name=TimeLeft value="<%$TicketObj->TimeLeft|h%>" SIZE="5"></td> + </TR> + + <TR> + <td class="label"><&|/l&>Priority</&>:</td> + <td class="value"><input name=Priority value="<%$TicketObj->Priority|h%>" SIZE="5"></td> + </TR> + + <TR> + <td class="label"><&|/l&>Final Priority</&>:</td> + <td class="value"><input name=FinalPriority value="<%$TicketObj->FinalPriority|h%>" SIZE="5"></td> + </TR> +<& /Elements/Callback, _CallbackName => 'EndOfList', TicketObj => $TicketObj, %ARGS &> +</TABLE> + +<%INIT> +#It's hard to do this inline, so we'll preload the html of the selectstatus in here. +my $SelectStatus = $m->scomp("/Elements/SelectStatus", Name => 'Status', DefaultLabel => loc("[_1] (Unchanged)",loc($TicketObj->Status))); +my $SelectQueue = $m->scomp("/Elements/SelectQueue", Name => 'Queue', Default =>$TicketObj->QueueObj->Id); + +</%INIT> +<%ARGS> + +$TicketObj => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/EditCustomField b/rt/html/Ticket/Elements/EditCustomField new file mode 100644 index 000000000..63687acd7 --- /dev/null +++ b/rt/html/Ticket/Elements/EditCustomField @@ -0,0 +1,55 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%init> + +# RT 3.2 API compatibility glue + +$RT::Logger->debug("Ticket/Elements/EditCustomField is deprecated in RT 3.4 and will be removed in 3.6."); + +$ARGS{'NamePrefix'} =~ s/^Ticket-/Object-RT::Ticket-/; +$ARGS{'NamePrefix'} =~ s/^CustomField-/Object-RT::Ticket--CustomField-/; +$m->comp('/Elements/EditCustomField', %ARGS, Object=> $ARGS{'TicketObj'}); +</%init> diff --git a/rt/html/Ticket/Elements/EditCustomFields b/rt/html/Ticket/Elements/EditCustomFields new file mode 100644 index 000000000..d566f4e71 --- /dev/null +++ b/rt/html/Ticket/Elements/EditCustomFields @@ -0,0 +1,100 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<table> +<tr> +<td valign="top" width="50%"> +<table> + +% my @entry_fields; +% my $i; +% my $cfcount = $CustomFields->Count; +% $cfcount++ if ($cfcount % 2) ; # if we have an odd number of +% #custom fields, fudge it so we know where to put in the table break +% while (my $CustomField = $CustomFields->Next()) { +% if ($cfcount == 2 * $i) { +</table> +</td> +<td valign="top" width="50%"> +<table> +% } +% $i++; + <tr> + <td class="labeltop"> + <b><%$CustomField->Name%></b><br> + <i><%$CustomField->FriendlyType%></i> + </td> + <td class="entry"><& /Elements/EditCustomField, + Object => $TicketObj, + CustomField => $CustomField, + NamePrefix => $NamePrefix + &></td> + </tr> +% } +</table> +</td> +</tr> +</table> + +<%INIT> +my $CustomFields; +my $NamePrefix; + +if ($TicketObj) { + $CustomFields = $TicketObj->CustomFields(); + $NamePrefix = "Object-RT::Ticket-".$TicketObj->Id."-CustomField-"; + +} else { + $CustomFields = $QueueObj->TicketCustomFields(); + $NamePrefix = "Object-RT::Ticket--CustomField-"; +} + + + +</%INIT> +<%ARGS> +$TicketObj => undef +$QueueObj => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/EditCustomers b/rt/html/Ticket/Elements/EditCustomers new file mode 100644 index 000000000..47d1aa222 --- /dev/null +++ b/rt/html/Ticket/Elements/EditCustomers @@ -0,0 +1,67 @@ +%# Copyright (c) 2004 Ivan Kohler <ivan-rt@420.am> +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +<TABLE width=100%> + <TR> + <TD VALIGN=TOP WIDTH=50%> + <h3><&|/l&>Current Customers</&></h3> + +<table> + <tr> + <td><i><&|/l&>(Check box to disassociate)</&></i></td> + </tr> + <tr> + <td class="value"> +% #while (my $link = $Ticket->MemberOf->Next) { +% foreach my $link ( +% grep { $_->TargetURI->Resolver->{'fstable'} eq 'cust_main' } +% grep { $_->TargetURI->Scheme eq 'freeside' } +% @{ $Ticket->_Links('Base')->ItemsArrayRef } +% ) { + + <INPUT TYPE=CHECKBOX NAME="DeleteLink--<%$link->Type%>-<%$link->Target%>"> +%# <& ShowLink, URI => $link->TargetURI &><br> + <A HREF="<% $link->TargetURI->Resolver->HREF %>"><% $link->TargetURI->Resolver->AsStringLong |n %></A> + <BR> +% } + </td> + </tr> +</table> + +</TD> + +<TD VALIGN=TOP> +<h3><&|/l&>New Customer Links</&></h3> +<&|/l&>Find customer</&><BR> +<input name="CustomerString"> +<input type=submit name="OnlySearchForCustomers" value="<&|/l&>Go!</&>"> +<br><i>cust #, last name, or company</i> +<BR> +%#<BR> +%#<&|/l&>Find service</&><BR> +%#<input name="ServiceString"> +%#<input type=submit name="OnlySearchForServices" value="<&|/l&>Go!</&>"> +%#<br><i>username, username@domain, domain, or IP address</i> +%#<BR> + +<& AddCustomers, Ticket => $Ticket, + CustomerString => $CustomerString, + ServiceString => $ServiceString, &> + +</TD> +</TR> +</TABLE> + +<%ARGS> +$CustomerString => undef +$ServiceString => undef +$Ticket => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/EditDates b/rt/html/Ticket/Elements/EditDates new file mode 100644 index 000000000..a19774192 --- /dev/null +++ b/rt/html/Ticket/Elements/EditDates @@ -0,0 +1,75 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<TABLE> + <TR> + <TD class="label"><&|/l&>Starts</&>:</TD> + <TD class="entry"><& /Elements/SelectDate, menu_prefix => 'Starts', current => 0 &> + (<% $TicketObj->StartsObj->AsString %>)</TD> + </TR> + <TR> + <TD class="label"><&|/l&>Started</&>:</TD> + <TD class="entry"><& /Elements/SelectDate, menu_prefix => 'Started', current => 0 &> (<%$TicketObj->StartedObj->AsString %>)</TD> + </TR> + + <TR> + <TD class="label"> + <&|/l&>Last Contact</&>: + </TD> + <TD class="entry"> + <& /Elements/SelectDate, menu_prefix => 'Told', current => 0 &> (<% $TicketObj->ToldObj->AsString %>) + </TD> + </TR> + <TR> + <TD class="label"><&|/l&>Due</&>:</TD> + <TD class="entry"> + <& /Elements/SelectDate, menu_prefix => 'Due', current => 0 &> (<% $TicketObj->DueObj->AsString %>) + </TD> + </TR> +</TABLE> +<%ARGS> +$TicketObj => undef +</%ARGS> + diff --git a/rt/html/Ticket/Elements/EditPeople b/rt/html/Ticket/Elements/EditPeople new file mode 100644 index 000000000..055d7ba20 --- /dev/null +++ b/rt/html/Ticket/Elements/EditPeople @@ -0,0 +1,91 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<TABLE> +<TR> +<TD VALIGN=TOP> + +<h3><&|/l&>New watchers</&></h3> +<&|/l&>Find people whose</&><BR> +<& /Elements/SelectUsers &> +<input type=submit name="OnlySearchForPeople" value="<&|/l&>Go!</&>"> +<BR> +<&|/l&>Find groups whose</&><BR> +<& /Elements/SelectGroups &> +<input type=submit name="OnlySearchForGroup" value="<&|/l&>Go!</&>"> + +<& AddWatchers, Ticket => $Ticket, UserString => $UserString, + UserOp => $UserOp, UserField => $UserField, + GroupString => $GroupString, GroupOp => $GroupOp, + GroupField => $GroupField, PrivilegedOnly => $PrivilegedOnly &> +</TD><TD VALIGN=TOP> +<h3><&|/l&>Owner</&></h3> +<&|/l&>Owner</&>: <& /Elements/SelectOwner, Name => 'Owner', QueueObj => $Ticket->QueueObj, TicketObj => $Ticket, Default => $Ticket->OwnerObj->Id, DefaultValue => 0&> +<h3><&|/l&>Current watchers</&></h3> +<&|/l&>(Check box to delete)</&><br> + +<&|/l&>Requestors</&>: +<& EditWatchers, TicketObj => $Ticket, Watchers => $Ticket->Requestors &> + +<&|/l&>Cc</&>: +<& EditWatchers, TicketObj => $Ticket, Watchers => $Ticket->Cc &> + +<&|/l&>Administrative Cc</&>: +<& EditWatchers, TicketObj => $Ticket, Watchers => $Ticket->AdminCc &> + +</TD> +</TR> +</TABLE> + +<%ARGS> +$UserField => undef +$UserOp => undef +$UserString => undef +$GroupField => undef +$GroupOp => undef +$GroupString => undef +$PrivilegedOnly => undef +$Ticket => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/EditWatchers b/rt/html/Ticket/Elements/EditWatchers new file mode 100644 index 000000000..0089932f4 --- /dev/null +++ b/rt/html/Ticket/Elements/EditWatchers @@ -0,0 +1,74 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<ul> +%# Print out a placeholder if there are none. +%if ($Members->Count == 0 ) { +<li><i><&|/l&>none</&></i> +% } + + +%while (my $watcher=$Members->Next) { +<li> +<INPUT TYPE=CHECKBOX NAME="Ticket-DeleteWatcher-Type-<%$Watchers->Type%>-Principal-<%$watcher->MemberId%>" value="1" UNCHECKED> +%if ($watcher->MemberObj->IsUser) { +<a href="<%$RT::WebPath%>/Admin/Users/Modify.html?id=<%$watcher->MemberObj->Object->id%>"> +<%$watcher->MemberObj->Object->Name%></a> +%} else { +<a href="<%$RT::WebPath%>/Admin/Groups/Modify.html?id=<%$watcher->MemberObj->Object->id%>"> +<%$watcher->MemberObj->Object->Name%></a> +%} +% } +</ul> +<%INIT> +my $Members = $Watchers->MembersObj; +</%INIT> +<%ARGS> +$TicketObj => undef +$Watchers => undef +</%ARGS> + + + diff --git a/rt/html/Ticket/Elements/FindAttachments b/rt/html/Ticket/Elements/FindAttachments new file mode 100755 index 000000000..017c77288 --- /dev/null +++ b/rt/html/Ticket/Elements/FindAttachments @@ -0,0 +1,93 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%INIT> +my %documents; + +#A default implementation here loops through all transactions and pulls out all their attachments. +# We end up doing an end-run around that to get a bit more performance + +# We force the cache of ticket transactions to get populated up front. otherwise, the +# code that looks at attachments will look at each one in turn. +my $attachments = RT::Attachments->new( $session{'CurrentUser'} ); + +$attachments->Columns( qw( Id Filename ContentType Headers Subject Parent ContentEncoding ContentType TransactionId Created)); + +my $transactions = $attachments->NewAlias('Transactions'); +$attachments->Join( ALIAS1 => 'main', + FIELD1 => 'TransactionId', + ALIAS2 => $transactions, + FIELD2 => 'id' ); + +my $tickets = $attachments->NewAlias('Tickets'); + + $attachments->Join( ALIAS1 => $transactions, + FIELD1 => 'ObjectId', + ALIAS2 => $tickets, + FIELD2 => 'id' ); + + $attachments->Limit( ALIAS => $transactions, + FIELD => 'ObjectType', + VALUE => 'RT::Ticket'); +if ($Tickets) { + while ($Ticket = $Tickets->Next) { + $attachments->Limit( ALIAS => $tickets, + FIELD => 'EffectiveId', + VALUE => $Ticket->id() ); + } +} else { + $attachments->Limit( ALIAS => $tickets, + FIELD => 'EffectiveId', + VALUE => $Ticket->id() ); +} + + +return ($attachments); +</%INIT> +<%ARGS> +$Ticket => undef +$Tickets => undef +</%ARGS> + diff --git a/rt/html/Ticket/Elements/LoadTextAttachments b/rt/html/Ticket/Elements/LoadTextAttachments new file mode 100755 index 000000000..943568fb3 --- /dev/null +++ b/rt/html/Ticket/Elements/LoadTextAttachments @@ -0,0 +1,90 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%INIT> + +my $attachments = RT::Attachments->new( $session{'CurrentUser'} ); + +$attachments->Columns( qw(id Content ContentType TransactionId ContentEncoding)); + +if ( $Ticket->CurrentUserHasRight('ShowTicket') ) { + my $transactions = $attachments->NewAlias('Transactions'); + $attachments->Join( ALIAS1 => 'main', + FIELD1 => 'TransactionId', + ALIAS2 => $transactions, + FIELD2 => 'id' ); + + my $tickets = $attachments->NewAlias('Tickets'); + + + $attachments->Join( ALIAS1 => $transactions, + FIELD1 => 'ObjectId', + ALIAS2 => $tickets, + FIELD2 => 'id' ); + + $attachments->Limit( ALIAS => $transactions, + FIELD => 'ObjectType', + VALUE => 'RT::Ticket'); + + + $attachments->Limit( ALIAS => $tickets, + FIELD => 'EffectiveId', + VALUE => $Ticket->id() ); + # if the user may not see comments do not return them + unless ( $Ticket->CurrentUserHasRight('ShowTicketComments') ) { + $attachments->Limit( ALIAS => $transactions, FIELD => 'Type', OPERATOR => '!=', VALUE => "Comment" ); + } + + $attachments->Limit ( FIELD => 'ContentType', OPERATOR => '=', VALUE => 'text/plain'); + $attachments->Limit ( FIELD => 'ContentType', OPERATOR => 'STARTSWITH', VALUE => 'message/'); + $attachments->Limit ( FIELD => 'ContentType', OPERATOR => '=', VALUE => 'text'); + +} +return ($attachments); +</%INIT> +<%ARGS> +$Ticket => undef +</%ARGS> + diff --git a/rt/html/Ticket/Elements/PreviewScrips b/rt/html/Ticket/Elements/PreviewScrips new file mode 100755 index 000000000..a3492b749 --- /dev/null +++ b/rt/html/Ticket/Elements/PreviewScrips @@ -0,0 +1,124 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +$TicketObj => undef + +</%args> +<%init> + +my $arg = 'Ticket-'.$TicketObj->Id.'-SquelchMailTo'; +my @squelchto = ref($ARGS{$arg}) eq 'ARRAY' ? @{$ARGS{$arg}} : ($ARGS{$arg}); + +foreach my $address (@squelchto) { + $TicketObj->SquelchMailTo($address) if ($address); +} + + +$arg = 'Ticket-'.$TicketObj->Id.'-UnsquelchMailTo'; +my @unsquelchto = ref($ARGS{$arg}) eq 'ARRAY' ? @{$ARGS{$arg}} : ($ARGS{$arg}); + +foreach my $address (@unsquelchto) { + $TicketObj->UnsquelchMailTo($address) if ($address); +} + + +my $action; + +if (( $ARGS{'UpdateType'} eq 'response' ) || ($ARGS{'Action'} eq 'Respond' )) { + $action = 'Correspond'; +} +else { + $action = 'Comment'; +} + +my $Message = MakeMIMEEntity( + Subject => $ARGS{'UpdateSubject'}, + Body => $ARGS{'UpdateContent'}, +); + +my ( $Transaction, $Description, $Object ) = $TicketObj->$action( + CcMessageTo => $ARGS{'UpdateCc'}, + BccMessageTo => $ARGS{'UpdateBcc'}, + MIMEObj => $Message, + TimeTaken => $ARGS{'UpdateTimeWorked'}, + DryRun => 1 +); + + +my @non_recipients = $TicketObj->SquelchMailTo; +</%init> +<h2><&|/l&>This message will be sent to...</&></h2> +<i><&|/l&>(Check boxes to disable notifications to the listed recipients)</&></i><br> +% foreach my $scrip (@{$Object->Scrips->Prepared}) { +% next unless $scrip->ActionObj->Action->isa('RT::Action::SendEmail'); +<b><%$scrip->Description%></b><br> +<&|/l, loc($scrip->ConditionObj->Name), loc($scrip->ActionObj->Name), loc($scrip->TemplateObj->Name)&>[_1] [_2] with template [_3]</&> +<br> +%foreach my $type qw(To Cc Bcc) { +%my @addresses = $scrip->ActionObj->Action->$type(); +<ul> +%foreach my $addr (@addresses) { +<li> <b><%loc($type)%></b>: <input type="checkbox" name="Ticket-<%$TicketObj->id%>-SquelchMailTo" value="<%$addr->address%>"> <%$addr->address%> +% } +</ul> +% } +% if ($RT::PreviewScripMessages) { +<textarea cols=80 rows="5"> +<%$scrip->ActionObj->TemplateObj->MIMEObj->as_string%> +</textarea> +% } +%} +<br> +<h2><&|/l&>Messages about this ticket will not be sent to...</&></h2> +<i><&|/l&>(Check boxes to enable notifications to the listed recipients)</&></i> +<br> +<ul> +% foreach my $recipient (@non_recipients) { +<li><input type="checkbox" name="Ticket-<%$TicketObj->id%>-UnsquelchMailTo" value="<%$recipient->Content%>"> +<% $recipient->Content %> +% } +</ul> +<& /Elements/Submit, Value => 'UpdatePreview', Label => loc('Save changes')&> diff --git a/rt/html/Ticket/Elements/ShowAttachments b/rt/html/Ticket/Elements/ShowAttachments new file mode 100644 index 000000000..82028dd28 --- /dev/null +++ b/rt/html/Ticket/Elements/ShowAttachments @@ -0,0 +1,101 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% if (keys %documents) { +<& /Elements/TitleBoxStart, title => loc('Attachments'), + title_class=> 'inverse', + color => "#336699" &> + +% foreach my $key (keys %documents) { + +<%$key%><br> +<ul> +% foreach my $rev (@{$documents{$key}}) { + +<%PERL> +my $size = $rev->ContentLength; + +if ($size) { + if ($size > 1024) { + $size = int($size/102.4)/10 . "k"; + } + else { + $size = $size ."b"; + } + +</%PERL> + +<li><font size="-2"> +<A HREF="<%$RT::WebPath%>/Ticket/Attachment/<%$rev->TransactionId%>/<%$rev->Id%>/<%$rev->Filename | u%>"> +<&|/l, $rev->CreatedAsString, $size, $rev->CreatorObj->Name &>[_1] ([_2]) by [_3]</&> +</a> +</font></li> +% } +% } +</ul> + +% } +<& /Elements/TitleBoxEnd &> +<BR> +% } + +<%INIT> + +# If we haven't been passed in an Attachments object (through the precaching mechanism) +# then we need to find one +$Attachments ||= $m->comp('FindAttachments', Ticket => $Ticket); + +my %documents; +while ( my $attach = $Attachments->Next() ) { + next unless ($attach->Filename()); + unshift( @{ $documents{ $attach->Filename } }, $attach ); +} + +</%INIT> +<%ARGS> +$Ticket => undef +$Attachments => undef +</%ARGS> + diff --git a/rt/html/Ticket/Elements/ShowBasics b/rt/html/Ticket/Elements/ShowBasics new file mode 100644 index 000000000..00ed3ccd1 --- /dev/null +++ b/rt/html/Ticket/Elements/ShowBasics @@ -0,0 +1,83 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<table> + <tr> + <td class="label"><&|/l&>Id</&>:</td> + <td class="value"><%$Ticket->Id %></td> + </tr> + <tr> + <td class="label"><&|/l&>Status</&>:</td> + <td class="value"><&|/l&><% $Ticket->Status%></&></td> + </tr> +% if ($Ticket->TimeEstimated) { + <tr> + <td class="label"><&|/l&>Estimated</&>:</td> + <td class="value"><&|/l, $Ticket->TimeEstimated &>[_1] min</&></td> + </tr> +% } +% if ($Ticket->TimeWorked) { + <tr> + <td class="label"><&|/l&>Worked</&>:</td> + <td class="value"><&|/l, $Ticket->TimeWorked &>[_1] min</&></td> + </tr> +% } + <tr> + <td class="label"><&|/l&>Left</&>:</td> + <td class="value"><&|/l, $Ticket->TimeLeft &>[_1] min</&></td> + </tr> + <tr> + <td class="label"><&|/l&>Priority</&>:</td> + <td class="value"><%$Ticket->Priority%>/<%$Ticket->FinalPriority %></td> + </tr> + <tr> + <td class="label"><&|/l&>Queue</&>:</td> + <td class="value"><%$Ticket->QueueObj->Name%></td> + </tr> +<& /Elements/Callback, _CallbackName => 'EndOfList', TicketObj => $Ticket, %ARGS &> +</table> +<%ARGS> +$Ticket => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/ShowCustomFields b/rt/html/Ticket/Elements/ShowCustomFields new file mode 100644 index 000000000..eb49212c5 --- /dev/null +++ b/rt/html/Ticket/Elements/ShowCustomFields @@ -0,0 +1,49 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/ShowCustomFields, Object => $Ticket &> +<%ARGS> +$Ticket => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/ShowCustomers b/rt/html/Ticket/Elements/ShowCustomers new file mode 100644 index 000000000..612727ede --- /dev/null +++ b/rt/html/Ticket/Elements/ShowCustomers @@ -0,0 +1,40 @@ +%# Copyright (c) 2004 Ivan Kohler <ivan-rt@420.am> +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +<table> +% my $cust = 0; +% foreach my $customerURI ( +% grep { $_->Resolver->{'fstable'} eq 'cust_main' } +% grep { $_->Scheme eq 'freeside' } +% map { $_->TargetURI } +% @{ $Ticket->_Links('Base')->ItemsArrayRef } +% ) { +% $cust++; +% my $cust_main = ''; + <tr> + <td class="value"> + <A HREF="<% $customerURI->Resolver->HREF %>"><% $customerURI->Resolver->AsStringLong |n %></A> + </td> + </tr> +% } +% unless ( $cust ) { + <tr> + <td class="labeltop"> + <i>(none)<i> + </td> + </tr> + +% } +</table> +<%ARGS> +$Ticket => undef +</%ARGS> + diff --git a/rt/html/Ticket/Elements/ShowDates b/rt/html/Ticket/Elements/ShowDates new file mode 100644 index 000000000..2ccbb3fea --- /dev/null +++ b/rt/html/Ticket/Elements/ShowDates @@ -0,0 +1,84 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<TABLE> + <TR> + <TD class="label"><&|/l&>Created</&>:</TD> + <TD class="value"><% $Ticket->CreatedObj->AsString %></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Starts</&>:</TD> + <TD class="value"><% $Ticket->StartsObj->AsString %></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Started</&>:</TD> + <TD class="value"><% $Ticket->StartedObj->AsString %></TD> + </TR> + <TR> + <TD class="label"><a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$Ticket->id%>&Action=SetTold"><&|/l&>Last Contact</&></a>:</TD> + <TD class="value"><% $Ticket->ToldObj->AsString %></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Due</&>:</TD> + <TD class="value"><% $Ticket->DueObj->AsString %></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Closed</&>:</TD> + <TD class="value"><% $Ticket->ResolvedObj->AsString %></TD> + </TR> + <TR> + <TD class="label"><&|/l&>Updated</&>:</TD> +% my $UpdatedString = $Ticket->LastUpdated ? (loc("[_1] by [_2]", $Ticket->LastUpdatedAsString, $Ticket->LastUpdatedByObj->Name)) : loc("Never"); +% if ($UpdatedLink) { + <TD class="value"><A HREF="#lasttrans"><% $UpdatedString | h %></a></TD> +% } else { + <TD class="value"><% $UpdatedString | h %></TD> +% } + </TR> +</TABLE> +<%ARGS> +$Ticket => undef +$UpdatedLink => 1 +</%ARGS> diff --git a/rt/html/Ticket/Elements/ShowDependencies b/rt/html/Ticket/Elements/ShowDependencies new file mode 100644 index 000000000..f276bc949 --- /dev/null +++ b/rt/html/Ticket/Elements/ShowDependencies @@ -0,0 +1,63 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<&|/l&>Depends on</&>:<BR> +% while (my $Link = $Ticket->DependsOn->Next) { +% my $member = $Link->TargetObj; +<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> +[<%$member->Status%>] + <br> +% } +<&|/l&>Depended on by</&>:<BR> +% while (my $Link = $Ticket->DependedOnBy->Next) { +% my $member = $Link->TargetObj; +<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> +[<%$member->Status%>] + <br> +% } + +<%ARGS> +$Ticket => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/ShowGroupMembers b/rt/html/Ticket/Elements/ShowGroupMembers new file mode 100644 index 000000000..1fdb79aab --- /dev/null +++ b/rt/html/Ticket/Elements/ShowGroupMembers @@ -0,0 +1,60 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# Released under the terms of version 2 of the GNU Public License + +% my $UserMembers = $Group->UserMembersObj; +% while (my $member = $UserMembers->Next()) { +<& ShowUserEntry, User => $member &><br> +% } +% my $GroupMembers = $Group->MembersObj; +% $GroupMembers->LimitToGroups(); +% while (my $member = $GroupMembers->Next()) { +<&|/l&>Group</&>: <%$member->MemberObj->Object->Name%><br> +% } + +<%ARGS> +$Group => undef +</%ARGS>
\ No newline at end of file diff --git a/rt/html/Ticket/Elements/ShowHistory b/rt/html/Ticket/Elements/ShowHistory new file mode 100644 index 000000000..75e34776f --- /dev/null +++ b/rt/html/Ticket/Elements/ShowHistory @@ -0,0 +1,158 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%perl> + if ($ShowDisplayModes or $ShowTitle) { +my $title; +my $titleright; +if ($ShowTitle) { + $title = loc('History'); +} +else { + $title = ' '; +} +$titleright = loc('Display mode') . ":"; +if ($ShowHeaders) { + $titleright .= "[<A HREF=\"" . $URIFile . "?id=" + . $Ticket->id . "\">" + . loc("Brief headers") + . "</a>] <b>[" + . loc("Full headers") . "]</b>"; +} +else { + $titleright .= "<b>[" + . loc("Brief headers") + . "]</b> [<A HREF=\"" + . $URIFile + . "?ShowHeaders=1" + . "&id=" + . $Ticket->id . "\">" + . loc("Full headers") . "</a>]"; +} +</%perl> +<& /Elements/TitleBoxStart, title => $title, titleright => $titleright, bodyclass=> ''&> +% } + +<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=2 BORDER=0> +<%perl> +my @attachments = @{$Attachments->ItemsArrayRef()}; +my @attachment_content = @{$AttachmentContent->ItemsArrayRef()}; + + + + + +while ( my $Transaction = $Transactions->Next ) { + my $skip = 0; + $m->comp( '/Elements/Callback', + _CallbackName => 'SkipTransaction', + Transaction => $Transaction, + skip => \$skip, + %ARGS ); + next if $skip; + $i++; + + my @trans_attachments = grep { $_->TransactionId == $Transaction->Id } @attachments; + + my $trans_content = {}; + grep { ($_->TransactionId == $Transaction->Id ) && ($trans_content->{$_->Id} = $_) } @attachment_content; + + + #Args is first because we're clobbering the "Attachments" parameter + $m->comp( 'ShowTransaction', + %ARGS, + + AttachPath => $AttachPath, + UpdatePath => $UpdatePath, + Ticket => $Ticket, + Transaction => $Transaction, + ShowHeaders => $ShowHeaders, + Collapsed => $Collapsed, + RowNum => $i, + ShowTitleBarCommands => $ShowTitleBarCommands, + Attachments => \@trans_attachments, + AttachmentContent => $trans_content, + LastTransaction => $Transactions->IsLast + ); + +# manually flush the content buffer after each txn, so the user sees +# some update +$m->flush_buffer(); +} + +</%perl> +</TABLE> +% if ($ShowDisplayModes or $ShowTitle) { +<& /Elements/TitleBoxEnd &> +% } +<%INIT> +my $Transactions = new RT::Transactions($session{'CurrentUser'}); +if ($Tickets) { + while (my $t = $Tickets->Next) { + $Transactions->LimitToTicket($t->id); + } +} else { + $Transactions = $Ticket->Transactions; +} +my $i; + +$Attachments ||= $m->comp('/Ticket/Elements/FindAttachments', Ticket => $Ticket, Tickets => $Tickets || undef); +$AttachmentContent ||= $m->comp('/Ticket/Elements/LoadTextAttachments', Ticket => $Ticket); + +</%INIT> +<%ARGS> +$URIFile => $RT::WebPath."/Ticket/Display.html" +$Ticket => undef +$Tickets => undef +$Attachments => undef +$AttachmentContent => undef +$ShowHeaders => undef +$Collapsed => undef +$ShowTitle => 1 +$ShowDisplayModes => 1 +$ShowTitleBarCommands => 1 +$AttachPath => $RT::WebPath."/Ticket/Attachment" +$UpdatePath => $RT::WebPath."/Ticket/Update.html" +</%ARGS> diff --git a/rt/html/Ticket/Elements/ShowMemberOf b/rt/html/Ticket/Elements/ShowMemberOf new file mode 100644 index 000000000..e443132bc --- /dev/null +++ b/rt/html/Ticket/Elements/ShowMemberOf @@ -0,0 +1,57 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<UL> +% my $memberof = $Ticket->MemberOf; +% while (my $member_of = $memberof->Next) { +<LI><a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member_of->Id%>"><%$member_of->Id%></a>: <%$member_of->Subject%> [<%$member_of->Status%>] +% } +</UL> + +<%INIT> +</%INIT> +<%ARGS> +$Ticket => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/ShowMembers b/rt/html/Ticket/Elements/ShowMembers new file mode 100644 index 000000000..f4fec1c7c --- /dev/null +++ b/rt/html/Ticket/Elements/ShowMembers @@ -0,0 +1,67 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% if ($members->Count) { +<UL> +% while (my $link = $members->Next) { +% my $member= $link->BaseObj; +<LI><a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: <%$member->Subject%> [<%loc($member->Status)%>]<br> +% if ($depth < 8) { +<&/Ticket/Elements/ShowMembers, Ticket => $member, depth => ($depth+1) &> +% } +% } +</UL> +% } + +<%INIT> + +my $members = $Ticket->Members; + +</%INIT> + +<%ARGS> +$Ticket => undef +$depth => 1 +</%ARGS> diff --git a/rt/html/Ticket/Elements/ShowMessageHeaders b/rt/html/Ticket/Elements/ShowMessageHeaders new file mode 100644 index 000000000..8dc76bae3 --- /dev/null +++ b/rt/html/Ticket/Elements/ShowMessageHeaders @@ -0,0 +1,88 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% use Data::Dumper; +<table> +% foreach my $header (@headers) { +% next unless ($display_headers{'_all'} || $display_headers{lc($header->{'Tag'})}); +<tr> +<td align="right" class="message-header-key"><%$header->{'Tag'}%>:</td> +<td class="message-header-value"><%$header->{'Value'} | n%></td> +</tr> +% } +</table> +<%INIT> +my $content = $Headers; +$m->comp('/Elements/Callback', content => \$content, %ARGS); + +# apply html escaping on the original content +# we'll display the value without escaping later (for MakeClicky et al.) +$content = $m->interp->apply_escapes($content, 'h'); + +my @lines = split (/\n/,$content); +my $in_header = 0; +my @headers =(); +foreach (@lines) { + if (/^(\S+):\s+(.*)$/) { + push (@headers, { Tag => $1, Value => $2} ); + } elsif ($headers[-1]) { + $headers[-1]->{'Value'} .= $_; + } else { + + push (@headers, { Tag => $_, Value => ''} ); + } +} + +my %display_headers; + +map { $display_headers{lc($_)} = 1 } @$DisplayHeaders; + +$m->comp('/Elements/Callback', _CallbackName => 'Headers', content => \$content, headers => \@headers, display_headers => \%display_headers, %ARGS); + +</%INIT> +<%ARGS> +$Headers => undef +$DisplayHeaders => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/ShowMessageStanza b/rt/html/Ticket/Elements/ShowMessageStanza new file mode 100644 index 000000000..eaf551de9 --- /dev/null +++ b/rt/html/Ticket/Elements/ShowMessageStanza @@ -0,0 +1,83 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% if (ref($Message)) { +<font color="<%$colors[$Depth]%>"> +<%perl> +foreach my $stanza (@$Message) { + if ( ref $stanza eq "ARRAY" ) { + $m->comp( 'ShowMessageStanza', + Depth => $Depth + 1, + Transaction => $Transaction, + Message => $stanza ); + } + elsif ( ref $stanza eq "HASH" ) { + my $content = $stanza->{raw}; + RT::Interface::Web::EscapeUTF8(\$content); + $m->comp('/Elements/Callback', content => \$content, %ARGS); + $content =~ s/\n/<br>/gi if defined $content; + +</%perl> +<%$content |n%><br> +% } +% } # end foreach +</font> +% } else { +% my $content = $Message; +% RT::Interface::Web::EscapeUTF8(\$content); +% $m->comp('/Elements/Callback', content => \$content, %ARGS); +% $content =~ s/\n/<br>/gi; +<%$content |n%><br> +% } +<%INIT> +use URI::URL; +my $server = 'fsck.com'; +my @colors = ('#000000', '#660000', '#006600', '#000066', '#cc0000', '#00cc00', '#0000cc', '#ff0000', '#00ff00', '#0000ff'); +</%INIT> +<%ARGS> +$Message => undef +$Depth => 0 +$Transaction => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/ShowPeople b/rt/html/Ticket/Elements/ShowPeople new file mode 100644 index 000000000..dbec93928 --- /dev/null +++ b/rt/html/Ticket/Elements/ShowPeople @@ -0,0 +1,66 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<table> + <tr> + <td class="label"><&|/l&>Owner</&>:</td> + <td class="value"><& ShowUserEntry, User => $Ticket->OwnerObj &></td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Requestors</&>:</td> + <td class="value"><& ShowGroupMembers, Group => $Ticket->Requestors &></td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Cc</&>:</td> + <td class="value"><& ShowGroupMembers, Group => $Ticket->Cc &></td> + </tr> + <tr> + <td class="labeltop"><&|/l&>AdminCc</&>:</td> + <td class="value"><& ShowGroupMembers, Group => $Ticket->AdminCc &></td> + </tr> +</table> +<%ARGS> +$Ticket => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/ShowReferences b/rt/html/Ticket/Elements/ShowReferences new file mode 100644 index 000000000..bb323f66c --- /dev/null +++ b/rt/html/Ticket/Elements/ShowReferences @@ -0,0 +1,72 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<UL> +% while (my $Link = $Ticket->RefersTo->Next) { +<LI> +% if ($Link->TargetURI->IsLocal) { +% my $member = $Link->TargetObj; + +<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> [<%$member->Status%>]<br> +% } else { +<A HREF="<%$Link->TargetURI->HREF%>"><%$Link->Target%></A> +% } +%} + + + +% while (my $Link = $Ticket->ReferredToBy->Next) { +<LI> +% if ($Link->BaseURI->IsLocal) { +% my $member = $Link->BaseObj; +<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> [<%$member->Status%>]<br> +% } else { +<A HREF="<%$Link->BaseURI->HREF%>"><%$Link->Base%></A> +%} +% } +</UL> +<%ARGS> +$Ticket => undef +</%ARGS> diff --git a/rt/html/Ticket/Elements/ShowRequestor b/rt/html/Ticket/Elements/ShowRequestor new file mode 100644 index 000000000..421d38e0a --- /dev/null +++ b/rt/html/Ticket/Elements/ShowRequestor @@ -0,0 +1,88 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%PERL> +my $rows = 10; +my $people = $Ticket->Requestors->UserMembersObj; +while (my $requestor=$people->Next) { +my $name=$requestor->RealName || $requestor->EmailAddress; +my $tickets = RT::Tickets->new($session{'CurrentUser'}); +$tickets->LimitWatcher(TYPE => 'Requestor', VALUE => $requestor->EmailAddress ); +$tickets->LimitStatus( VALUE => 'open'); +$tickets->LimitStatus( VALUE => 'new'); +$tickets->RowsPerPage($rows); +$tickets->OrderBy(FIELD => 'Priority', + ORDER => 'DESC'); +</%PERL> + +% unless ($requestor->Privileged) { +<& /Elements/TitleBoxStart, + title => "<a class='inverse' href=\"$RT::WebPath/Admin/Users/Modify.html?id=".$requestor->id."\">".loc("More about [_1]", $name)."</a>" &> + +%# Additional information about this user. Empty by default. +<& /Elements/Callback, _CallbackName => 'AboutThisUser', requestor => $requestor, %ARGS &> + +<&|/l&>Comments about this user</&>:<BR> +<B><% ($requestor->Comments || loc("No comment entered about this user")) %></B><BR> + +<&|/l, $rows &>This user's [_1] highest priority tickets</&>:<BR> +<UL> +%while (my $w=$tickets->Next) { +<LI><a href="<%$RT::WebPath%><%$DisplayPath%>?id=<%$w->id%>"><%$w->Id%>: <%$w->Subject%></a> (<%$w->Status%>) +%} +</UL> + +<&|/l&>Groups this user belongs to</&>:<BR> + +<& /Elements/ShowMemberships, UserObj => $requestor &> + +<& /Elements/TitleBoxEnd &> + +% } +%} +<%ARGS> +$Ticket=>undef +$DisplayPath => "/Ticket/Display.html" +</%ARGS> diff --git a/rt/html/Ticket/Elements/ShowSummary b/rt/html/Ticket/Elements/ShowSummary new file mode 100644 index 000000000..5a6e7e099 --- /dev/null +++ b/rt/html/Ticket/Elements/ShowSummary @@ -0,0 +1,114 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} + <TABLE WIDTH="100%" class="ticketsummary" > + <TR> + <TD VALIGN=TOP WIDTH="50%" class="boxcontainer"> + <& /Elements/TitleBoxStart, title => loc('The Basics'), + title_href =>"$RT::WebPath/Ticket/Modify.html?id=".$Ticket->Id, + title_class=> 'inverse', + color => "#993333" &> + <& /Ticket/Elements/ShowBasics, Ticket => $Ticket &> + <& /Elements/TitleBoxEnd &> + <br> +% if ($Ticket->QueueObj->TicketCustomFields->First) { + <& /Elements/TitleBoxStart, title => loc('Custom Fields'), + title_href =>"$RT::WebPath/Ticket/Modify.html?id=".$Ticket->Id, + title_class=> 'inverse', + color => "#993333" &> + <& /Ticket/Elements/ShowCustomFields, Ticket => $Ticket &> + <& /Elements/TitleBoxEnd &> + +<br> +% } + <& /Elements/TitleBoxStart, title => loc('People'), + title_href =>"$RT::WebPath/Ticket/ModifyPeople.html?id=".$Ticket->Id, + title_class=> 'inverse', + color => "#333399" &> + <& /Ticket/Elements/ShowPeople, Ticket => $Ticket &> + <& /Elements/TitleBoxEnd &> + <br> + + <& /Elements/TitleBoxStart, title => loc('Customers'), + title_href =>"$RT::WebPath/Ticket/ModifyCustomers.html?id=".$Ticket->Id, + title_class=> 'inverse', + color => "#7f007b" &> + <& /Ticket/Elements/ShowCustomers, Ticket => $Ticket &> + <& /Elements/TitleBoxEnd &> + + <BR> + </TD> + <TD VALIGN=TOP WIDTH="50%" class="boxcontainer"> + + <& /Elements/TitleBoxStart, title => loc("Dates"), + title_href =>"$RT::WebPath/Ticket/ModifyDates.html?id=".$Ticket->Id, + title_class=> 'inverse', + color => "#663366" &> + <& /Ticket/Elements/ShowDates, Ticket => $Ticket &> + <& /Elements/TitleBoxEnd &> + <BR> + <& /Elements/TitleBoxStart, title => loc('Links'), + title_href => "$RT::WebPath/Ticket/ModifyLinks.html?id=".$Ticket->Id, + title_class=> 'inverse', + titleright => '', color=> "#336633" &> + <& /Elements/ShowLinks, Ticket => $Ticket &> + <& /Elements/TitleBoxEnd &> + <BR> + <& /Ticket/Elements/ShowAttachments, Ticket => $Ticket, Attachments => $Attachments &> + + <& /Ticket/Elements/ShowRequestor, Ticket => $Ticket &> + + + </TD> + </TR> + </TABLE> +<%ARGS> +$Ticket => undef +$Attachments => undef +</%ARGS> + + + + diff --git a/rt/html/Ticket/Elements/ShowTransaction b/rt/html/Ticket/Elements/ShowTransaction new file mode 100644 index 000000000..8bf589d45 --- /dev/null +++ b/rt/html/Ticket/Elements/ShowTransaction @@ -0,0 +1,186 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<TR class="<% $RowNum%2 ? 'oddline' : 'evenline'%>" > +<TD rowspan="2" valign="top" bgcolor="<%$bgcolor%>"><A NAME="txn-<%$Transaction->Id%>" href="<% $DisplayPath %>#txn-<%$Transaction->Id%>">#</A><% $LastTransaction ? '<a name="lasttrans"> </a>' : ' ' |n %></TD> +<TD>  </TD> +<TD><font size=-2><% $transdate|n %></font> </TD> +% my $desc = $Transaction->BriefDescription; +% $m->comp('/Elements/Callback', _CallbackName => 'ModifyDisplay', text => \$desc, Transaction => $Transaction, %ARGS); +<TD ALIGN="LEFT"><b><%$Transaction->CreatorObj->Name%> - <%$TicketString%> <%$desc%> + +</b></TD> +<TD><%$TimeTaken%> </TD> +<TD ALIGN="RIGHT"><font size=-1><%$titlebar_commands|n%></font></TD> +</TR> +<TR class="<% $RowNum%2 ? 'oddline' : 'evenline'%>"><TD colspan=5> +% if ($Transaction->CustomFieldValues->Count) { +<& /Elements/ShowCustomFields, Object => $Transaction &> +% } +% $m->comp('ShowTransactionAttachments', %ARGS, Parent => 0) unless ($Collapsed ||!$ShowBody); +</TD> +</TR> + +<%ARGS> +$Ticket => undef +$Transaction => undef +$ShowHeaders => 0 +$Collapsed => undef +$ShowTitleBarCommands => 1 +$RowNum => 1 +$DisplayPath => $RT::WebPath."/Ticket/Display.html?id=".$Ticket->id +$AttachPath => $RT::WebPath."/Ticket/Attachment" +$UpdatePath => $RT::WebPath."/Ticket/Update.html" +$EmailRecordPath => $RT::WebPath."/Ticket/ShowEmailRecord.html" +$Attachments => undef +$AttachmentContent => undef +$ShowBody => 1 +$LastTransaction => 0 +</%ARGS> + +<%INIT> + +my ( $TimeTaken, $TicketString, $bgcolor ); + +my $transdate = $Transaction->CreatedAsString(); +$transdate =~ s/\s/ /g; + +if ( $Transaction->Type =~ /^(Create|Correspond|Comment$)/ ) { + if ( $Transaction->IsInbound ) { + $bgcolor = "#336699"; + } + else { + $bgcolor = "#339999"; + } +} +elsif ( ( $Transaction->Field =~ /^Owner$/ ) + or ( $Transaction->Type =~ /^(AddWatcher|DelWatcher)$/ ) ) { + $bgcolor = "#333399"; + +} +elsif ( $Transaction->Type =~ /^(AddLink|DeleteLink)$/ ) { + $bgcolor = "#336633"; +} +elsif ( $Transaction->Type =~ /^(Status|Set|Told)$/ ) { + if ( $Transaction->Field =~ /^(Told|Starts|Started|Due)$/ ) { + $bgcolor = "#663366"; + } + else { + $bgcolor = "#993333"; + } +} +else { + $bgcolor = "#cccccc"; +} + +if ( $Ticket->Id != $Transaction->Ticket ) { + $TicketString = "Ticket " . $Transaction->Ticket . ": "; +} +$TicketString ||= ''; + +if ( $Transaction->TimeTaken != 0 ) { + $TimeTaken = $Transaction->TimeTaken . " min"; +} else { + $TimeTaken = ''; +} + +unless ($Attachments) { + my $attachments = $Transaction->Attachments; + $attachments->Columns( qw( Id Filename ContentType Headers Subject Parent ContentEncoding ContentType TransactionId) ); + $Attachments = $attachments->ItemsArrayRef(); +} +my $titlebar_commands = ' '; + +my @DisplayHeaders=qw ( _all); + +if ( $Transaction->Type =~ /EmailRecord$/ ) { + @DisplayHeaders = qw(To Cc Bcc); + + $titlebar_commands .= + "[<a target=\"_blank\" href=\"$EmailRecordPath?id=" + . $Transaction->Ticket + . "&Transaction=" + . $Transaction->Id + . "&Attachment=" + . ( $Transaction->Attachments->First + && $Transaction->Attachments->First->Id ) + + . '">' . loc('Show') . "</a>] "; + $ShowBody = 0; +} + + +# If the transaction has anything attached to it at all +else { + + unless ( $ShowHeaders ) { + @DisplayHeaders = qw(To From RT-Send-Cc Cc Bcc Date Subject); + } + + if ( $Attachments->[0] && $ShowTitleBarCommands ) { + if ( $Transaction->TicketObj->CurrentUserHasRight('ReplyToTicket') + or $Transaction->TicketObj->CurrentUserHasRight('ModifyTicket')) { + $titlebar_commands .= + "[<a href=\"".$UpdatePath."?id=" + . $Transaction->Ticket + . "&QuoteTransaction=" + . $Transaction->Id + . "&Action=Respond\">" + . loc('Reply') + . "</a>] "; + } + if ( $Transaction->TicketObj->CurrentUserHasRight('CommentOnTicket') + or $Transaction->TicketObj->CurrentUserHasRight('ModifyTicket')) { + $titlebar_commands .= + "[<a href=\"".$UpdatePath."?id=" + . $Transaction->Ticket + . "&QuoteTransaction=" + . $Transaction->Id + . "&Action=Comment\">" + . loc('Comment') . "</a>]"; + } + } +} +</%INIT> diff --git a/rt/html/Ticket/Elements/ShowTransactionAttachments b/rt/html/Ticket/Elements/ShowTransactionAttachments new file mode 100644 index 000000000..8dabff421 --- /dev/null +++ b/rt/html/Ticket/Elements/ShowTransactionAttachments @@ -0,0 +1,201 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%perl> +# Find all the attachments which have parent $Parent +# For each of these attachments +foreach my $message ( grep { $_->Parent == $Parent } @$Attachments ) { + + # {{{ show the headers + my $headers = $message->Headers; + chomp $headers; + + # localize the common headers (like 'Subject:'), too. + $headers =~ s/^([^:]+)(?=:)/loc($1)/em; + $m->comp( + 'ShowMessageHeaders', + Headers => $headers, + Transaction => $Transaction, + DisplayHeaders => \@DisplayHeaders + ); + + # }}} + # {{{ if there's any size at all, show the download link + my $size = $message->ContentLength; + if ($size) { + +</%perl> +<div class="downloadattachment"> +<%perl> + + # show a download link + if ( $size > 1024 ) { + $size = loc( "[_1]k", int( $size / 102.4 ) / 10 ); + } + else { + $size = loc( "[_1]b", $size ); + } + +</%PERL> +<A HREF="<%$AttachPath%>/<%$Transaction->Id%>/<%$message->Id%>/<%$message->Filename | u%>"><&|/l&>Download</&> <%$message->Filename || loc('(untitled)') %></a> +<div class="downloadcontenttype"> +<%$message->ContentType%> <% $size %> +</div> +</div> +% } +% # }}} +<div class="messagebody"> +<%perl> +# {{{ if it has a content-disposition: attachment, don't show inline +unless ( $message->GetHeader('Content-Disposition') =~ /attachment/i ) { + + my $content; + + # If it's text + if ( $message->ContentType =~ m{^(text|message)}i + && $size <= $RT::MaxInlineBody ) + { + + if ( + + # it's a toplevel object + !$ParentObj + + # or its parent isn't a multipart alternative + || ( $ParentObj->ContentType !~ m{^multipart/alternative$}i ) + + # or it's of our prefered alterative type + || ( + ( + $RT::PreferRichText + && ( $message->ContentType =~ m{^text/(?:html|enriched)$} ) + ) + || ( !$RT::PreferRichText + && ( $message->ContentType !~ m{^text/(?:html|enriched)$} ) + ) + ) + ) + { + + if ( $AttachmentContent->{ $message->id } ) { + $content = $AttachmentContent->{ $message->id }->Content; + } + else { + $content = $message->Content; + } + + # if it's a text/html clean the body and show it + if ( $message->ContentType =~ m{^text/(?:html|enriched)$}i ) { + $content = + $m->comp( '/Elements/ScrubHTML', Content => $content ); + $m->out($content); + } + + # if it's a text/plain show the body + elsif ( $message->ContentType =~ m{^(text|message|text)}i ) { + + eval { $content = Text::Quoted::extract($content); }; + if ($@) { 1; } + + $m->comp( + 'ShowMessageStanza', + Depth => 0, + Message => $content, + Transaction => $Transaction + ); + } + } + + } + + # if it's an image, show it as an image + elsif ( $message->ContentType =~ /^image\//i ) { + $m->out('<img src="' + . $AttachPath . '/' + . $Transaction->Id . '/' + . $message->Id + . '/">' ); + } +} + +# }}} + +$m->comp( + 'ShowTransactionAttachments', %ARGS, + Parent => $message->id, + ParentObj => $message +); + +} +</%PERL> +</div> +<%ARGS> +$Ticket => undef +$Transaction => undef +$ShowHeaders => 0 +$Collapsed => undef +$ShowTitleBarCommands => 1 +$RowNum => 1 +$AttachPath => $RT::WebPath."/Ticket/Attachment" +$UpdatePath => $RT::WebPath."/Ticket/Update.html" +$EmailRecordPath => $RT::WebPath."/Ticket/ShowEmailRecord.html" +$Attachments => undef +$AttachmentContent => undef +$ShowBody => 1 +$Parent => 0 +$ParentObj => 0 +</%ARGS> +<%INIT> +my @DisplayHeaders=qw( _all); + +if ( $Transaction->Type =~ /EmailRecord$/ ) { + @DisplayHeaders = qw(To Cc Bcc); +} + +# If the transaction has anything attached to it at all +elsif (!$ShowHeaders) { + @DisplayHeaders = qw(To From RT-Send-Cc Cc Bcc Date Subject); +} +</%INIT> diff --git a/rt/html/Ticket/Elements/ShowUserEntry b/rt/html/Ticket/Elements/ShowUserEntry new file mode 100644 index 000000000..163bcbdb1 --- /dev/null +++ b/rt/html/Ticket/Elements/ShowUserEntry @@ -0,0 +1,55 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +%# Released under the terms of version 2 of the GNU Public License + +<%$User->Name%> +% if ($User->EmailAddress && $User->EmailAddress ne $User->Name) { +<<%$User->EmailAddress%>> +% } + +<%ARGS> +$User => undef +</%ARGS>
\ No newline at end of file diff --git a/rt/html/Ticket/Elements/Tabs b/rt/html/Ticket/Elements/Tabs new file mode 100644 index 000000000..46e1d4a27 --- /dev/null +++ b/rt/html/Ticket/Elements/Tabs @@ -0,0 +1,220 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Callback, Ticket => $Ticket, actions=> $actions, tabs => $tabs, %ARGS &> +<& /Elements/Tabs, + tabs => $tabs, + actions => $actions, + current_tab => $current_tab, + current_toptab => $current_toptab, + Title => $Title &> +<%INIT> + +my $tabs = {}; +my $current_toptab = "Search/Build.html", +my $searchtabs = {}; +my $actions; + +if ( $Ticket) { + +my $id = $Ticket->id(); + +if ( defined $session{'tickets'} ) { + + # we have to update session data if we get new ItemMap + my $updatesession = 1 unless($session{'tickets'}->{'item_map'}); + + my $item_map = $session{'tickets'}->ItemMap; + + if ($updatesession) { + $session{'i'}++; + $session{'tickets'}->PrepForSerialization(); + } + + # Don't display prev links if we're on the first ticket + if ($item_map->{$Ticket->Id}->{prev}) { + $searchtabs->{'_a'} = { + class => "nav", + path => "Ticket/Display.html?id=" . $item_map->{first}, + title => '<< ' . loc('First') }; + $searchtabs->{"_b"} = { class => "nav", + path => "Ticket/Display.html?id=" . $item_map->{$Ticket->Id}->{prev}, + title => '< ' . loc('Prev') }; + } + + + # Don't display next links if we're on the last ticket + if ($item_map->{$Ticket->Id}->{next}) { + $searchtabs->{'d'} = { class => "nav", + path => "Ticket/Display.html?id=" . $item_map->{$Ticket->Id}->{next}, + title => loc('Next') . ' >' }; + $searchtabs->{'e'} = { + class => "nav", + path => "Ticket/Display.html?id=" . $item_map->{last}, + title => loc('Last') . ' >>' }; + } +} + + + +$tabs->{"this"} = { class => "currentnav", + path => "Ticket/Display.html?id=" . $Ticket->id, + title => "#" . $id, + current_subtab => $current_subtab }; + +my $ticket_page_tabs = { + _A => { title => loc('Display'), + path => "Ticket/Display.html?id=" . $id, }, + + _Ab => { title => loc('History'), + path => "Ticket/History.html?id=" . $id, }, + _B => { title => loc('Basics'), + path => "Ticket/Modify.html?id=" . $id, }, + + _C => { title => loc('Dates'), + path => "Ticket/ModifyDates.html?id=" . $id, }, + _D => + { title => loc('People'), path => "Ticket/ModifyPeople.html?id=" . $id, }, + _E => { title => loc('Links'), + path => "Ticket/ModifyLinks.html?id=" . $id, }, + _Eb=> { title => loc('Customers'), + path => "Ticket/ModifyCustomers.html?id=" . $id, }, + _F => { title => loc('Jumbo'), + path => "Ticket/ModifyAll.html?id=" . $id, + separator => 1 + }, + +}; + +foreach my $tab ( sort keys %{$ticket_page_tabs} ) { + if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_tab ) { + $ticket_page_tabs->{$tab}->{"subtabs"} = $subtabs; + $tabs->{'this'}->{"current_subtab"} = + $ticket_page_tabs->{$tab}->{"path"}; + } +} +$tabs->{'this'}->{"subtabs"} = $ticket_page_tabs; +$current_tab = "Ticket/Display.html?id=" . $id; + + + + + +if ( $Ticket->CurrentUserHasRight('ModifyTicket') + or $Ticket->CurrentUserHasRight('ReplyToTicket') ) { + $actions->{'A'} = { title => loc('Reply'), + path => "Ticket/Update.html?Action=Respond&id=" . $id, + }; +} + +if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) { + if ( $Ticket->Status ne 'resolved' ) { + $actions->{'B'} = { + + path => "Ticket/Update.html?Action=Comment&DefaultStatus=resolved&id=" . $id, + title => loc('Resolve') }; + } + if ( $Ticket->Status ne 'open' ) { + $actions->{'C'} = { path => "Ticket/Display.html?Status=open&id=" . $id, + title => loc('Open it') }; + } +} + +if ( $Ticket->CurrentUserHasRight('OwnTicket') ) { + if ( $Ticket->OwnerObj->id == $RT::Nobody->id ) { + $actions->{'D'} = { path => "Ticket/Display.html?Action=Take&id=" . $id, + title => loc('Take') }; + } + elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id ) { + $actions->{'E'} = {path => "Ticket/Display.html?Action=Steal&id=" . $id, + title => loc('Steal') }; + } +} + +if ( $Ticket->CurrentUserHasRight('ModifyTicket') + or $Ticket->CurrentUserHasRight('CommentOnTicket') ) { + $actions->{'F'} = { title => loc('Comment'), + path => "Ticket/Update.html?Action=Comment&id=" . $id, + }; +} +} + +my $args = "?" . $m->comp( + '/Elements/QueryString', + Query => $ARGS{'Query'} || $session{'CurrentSearchHash'}->{'Query'}, + Format => $ARGS{'Format'} || $session{'CurrentSearchHash'}->{'Format'}, + OrderBy => $ARGS{'OrderBy'} || $session{'CurrentSearchHash'}->{'OrderBy'}, + Order => $ARGS{'Order'} || $session{'CurrentSearchHash'}->{'Order'}, + Rows => $ARGS{'Rows'}, + ) if ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'}); +$args ||= ''; + +$tabs->{"f"} = { path => "Search/Build.html?NewQuery=1", + title => loc('New Query')}; +$tabs->{"g"} = { path => "Search/Build.html$args", + title => loc('Query Builder')}; +$tabs->{"h"} = { path => "Search/Edit.html$args", + title => loc('Advanced'), + separator => 1 }; +if (defined $session{'tickets'} and $session{'tickets'}->Count) { + $tabs->{"i"} = { path => "Search/Results.html$args", + title => loc('Show Results'), + separator => 1, + subtabs => $searchtabs }; + if ($current_tab =~ "Search/Results.html") { + $current_tab = "Search/Results.html$args"; + } +} + +</%INIT> + + +<%ARGS> +$Ticket => undef +$subtabs => undef +$current_tab => '' +$current_subtab => '' +$Title => undef +</%ARGS> diff --git a/rt/html/Ticket/History.html b/rt/html/Ticket/History.html new file mode 100644 index 000000000..a80cd0002 --- /dev/null +++ b/rt/html/Ticket/History.html @@ -0,0 +1,85 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => loc("Ticket History # [_1] [_2]", $Ticket->Id, $Ticket->Subject) &> +<& /Ticket/Elements/Tabs, + Ticket => $Ticket, current_tab => 'Ticket/History.html?id='.$Ticket->id, + Title => loc("Ticket History # [_1] [_2]", $Ticket->Id, $Ticket->Subject) &> + +<BR> + +<& /Ticket/Elements/ShowHistory , + Ticket => $Ticket, + ShowHeaders => $ARGS{'ShowHeaders'}, + URIFile => 'History.html', + Attachments => $attachments, + AttachmentContent => $attachment_content + &> + + +<%ARGS> +$id => undef +</%ARGS> + +<%INIT> + + + +my $Ticket = LoadTicket ($id); + +unless ($Ticket->CurrentUserHasRight('ShowTicket')) { + Abort("No permission to view ticket"); +} + +my $attachments = $m->comp('Elements/FindAttachments', Ticket => $Ticket); +my $attachment_content = $m->comp('Elements/LoadTextAttachments', Ticket => +$Ticket); + + +</%INIT> + + + + diff --git a/rt/html/Ticket/Modify.html b/rt/html/Ticket/Modify.html new file mode 100644 index 000000000..a6c316141 --- /dev/null +++ b/rt/html/Ticket/Modify.html @@ -0,0 +1,85 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => loc('Modify ticket #[_1]', $TicketObj->Id) &> +<& /Ticket/Elements/Tabs, + Ticket => $TicketObj, current_subtab => "Ticket/Modify.html?id=".$TicketObj->Id, + Title => loc('Modify ticket #[_1]', $TicketObj->Id) &> + +<& /Elements/ListActions, actions => \@results &> +<FORM METHOD=POST ACTION="Modify.html" ENCTYPE="multipart/form-data"> +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$TicketObj->Id%>"> + +<& /Elements/TitleBoxStart, title => loc('Modify ticket #[_1]',$TicketObj->Id), color=> "#993333", width => "100%" &> +<& Elements/EditBasics, TicketObj => $TicketObj &> +<& Elements/EditCustomFields, TicketObj => $TicketObj &> +<& /Elements/TitleBoxEnd &> + +<& /Elements/Submit, Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#993333" &> +</form> +<%INIT> + +my $TicketObj = LoadTicket($id); +my $CustomFields = $TicketObj->QueueObj->TicketCustomFields(); + +# Now let callbacks have a chance at editing %ARGS +$m->comp('/Elements/Callback', TicketObj => $TicketObj, CustomFields => $CustomFields, %ARGS); + +my @results = ProcessTicketBasics(TicketObj => $TicketObj, ARGSRef => \%ARGS); +my @cf_results = ProcessObjectCustomFieldUpdates(Object => $TicketObj, ARGSRef => \%ARGS); +push (@results, @cf_results); + +# TODO: display the results, even if we can't display the ticket + +unless ($TicketObj->CurrentUserHasRight('ShowTicket')) { + Abort("No permission to view ticket"); +} + +</%INIT> + + +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/html/Ticket/ModifyAll.html b/rt/html/Ticket/ModifyAll.html new file mode 100644 index 000000000..23cd93570 --- /dev/null +++ b/rt/html/Ticket/ModifyAll.html @@ -0,0 +1,204 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => loc("Ticket #[_1] Jumbo update: [_2]", $Ticket->Id, $Ticket->Subject) &> +<& /Ticket/Elements/Tabs, + Ticket => $Ticket, + current_tab => "Ticket/ModifyAll.html?id=".$Ticket->Id, + Title => loc("Ticket #[_1] Jumbo update: [_2]", $Ticket->Id, $Ticket->Subject) &> + +<& /Elements/ListActions, actions => \@results &> + +<FORM METHOD=POST ACTION="ModifyAll.html" ENCTYPE="multipart/form-data"> +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$Ticket->Id%>"> + + +<& /Elements/TitleBoxStart, title => loc('Modify ticket # [_1]', $Ticket->Id), color=> "#993333", width => "100%" &> +<& Elements/EditBasics, TicketObj => $Ticket &> +<& Elements/EditCustomFields, TicketObj => $Ticket &> +<& /Elements/TitleBoxEnd &> + +<BR> + +<& /Elements/TitleBoxStart, title => loc('Dates'), width => "100%", color => "#663366" &> +<& Elements/EditDates, TicketObj => $Ticket &> +<& /Elements/TitleBoxEnd &> + +<BR> + + +<& /Elements/TitleBoxStart, title => loc('People'),width => "100%", color=> "#333399" &> +<& Elements/EditPeople, Ticket => $Ticket, UserField => $UserField, UserString => $UserString, UserOp => $UserOp &> +<& /Elements/TitleBoxEnd &> + +<BR> + +<& /Elements/TitleBoxStart, title => loc('Links'), color => "#336633"&> +<& /Elements/EditLinks, Object => $Ticket, Merge => 1 &> +<& /Elements/TitleBoxEnd &> + +<BR> + +<& /Elements/TitleBoxStart, title => loc('Update ticket') &> +<table> + <tr> + <td class="label"><&|/l&>Update Type</&>:</td> + <td class="entry"> + <select name="UpdateType"> +% if ($CanComment) { + <option value="private" ><&|/l&>Comments (Not sent to requestors)</&></option> +% } +% if ($CanRespond) { + <option value="response"><&|/l&>Reply to requestors</&></option> +% } + </select> + </td> + </tr> + <tr> + <td class="label"><&|/l&>Subject</&>:</td> + <td class="entry"><input name="UpdateSubject" size=60 value="<%$Ticket->Subject%>"></td> + </tr> +% if (my $TxnCFs = $Ticket->TransactionCustomFields) { +% while (my $CF = $TxnCFs->Next()) { +<TR> +<TD class="label"><% $CF->Name %>:</TD> +<TD class="entry"><& /Elements/EditCustomField, + CustomField => $CF, + NamePrefix => "Object-RT::Transaction--CustomField-" + &><em><% $CF->FriendlyType %></em></TD> +</TD></TR> +% } # end if while +% } # end of if + <tr> + <td class="label"><&|/l&>Attach</&>:</td> + <td class="entry"><input name="UpdateAttachment" type=file></td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Content</&>:</td> + <td class="entry"><& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &></td> + </tr> +</table> +<& /Elements/TitleBoxEnd &> + + +<& /Elements/Submit, + Label => loc('Save Changes'), + Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &> +</form> + +<%INIT> + + + +my $Ticket = LoadTicket($id); + +my $CanRespond = 0; +my $CanComment = 0; + + +$CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or + $Ticket->CurrentUserHasRight('ModifyTicket') ); + +$CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or + $Ticket->CurrentUserHasRight('ModifyTicket') ); + + +my (@wresults, @results, @dresults, @lresults, @cf_results); + +unless ($OnlySearchForPeople) { + @wresults = ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS); + @cf_results = ProcessObjectCustomFieldUpdates( Object => $Ticket, ARGSRef => \%ARGS); + @dresults = ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS); + @lresults = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS); + + if ($ARGS{'UpdateAttachment'}) { + my $subject = "$ARGS{'UpdateAttachment'}"; + # since CGI.pm deutf8izes the magic field, we need to add it back. + Encode::_utf8_on($subject); + # strip leading directories + $subject =~ s#^.*[\\/]##; + + my $attachment = MakeMIMEEntity( + Subject => $subject, + Body => "", + AttachmentFieldName => 'UpdateAttachment' + ); + delete $ARGS{'UpdateAttachment'}; + $ARGS{'UpdateAttachments'}->{ $subject } = $attachment; + } + + $ARGS{'UpdateContent'} =~ s/\r+\n/\n/g; + + if ($ARGS{'UpdateAttachments'} || ( $ARGS{'UpdateContent'} && $ARGS{'UpdateContent'} ne "-- \n" . + $session{'CurrentUser'}->UserObj->Signature)) { + ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef=>\%ARGS, Actions=>\@results); + } + @results = ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS); +} +push @results, @wresults; +push @results, @dresults; +push @results, @lresults; +push @results, @cf_results; + +# If they've gone and moved the ticket to somewhere they can't see, etc... +# TODO: display the results, even if we can't display the ticket. + +unless ($Ticket->CurrentUserHasRight('ShowTicket')) { + Abort("No permission to view ticket"); +} + + +</%INIT> + + + +<%ARGS> +$OnlySearchForPeople => undef +$UserField => undef +$UserOp => undef +$UserString => undef +$id => undef +</%ARGS> + diff --git a/rt/html/Ticket/ModifyCustomers.html b/rt/html/Ticket/ModifyCustomers.html new file mode 100644 index 000000000..72d103b23 --- /dev/null +++ b/rt/html/Ticket/ModifyCustomers.html @@ -0,0 +1,49 @@ +%# Copyright (c) 2004 Ivan Kohler <ivan-rt@420.am> +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +<& /Elements/Header, Title => loc("Customers for ticket #[_1]", $Ticket->Id) &> +<& /Ticket/Elements/Tabs, + Ticket => $Ticket, + current_tab => "Ticket/ModifyCustomers.html?id=".$Ticket->Id, + Title => loc("Customers for ticket #[_1]", $Ticket->Id) &> + +<& /Elements/ListActions, actions => \@results &> + +<form action="ModifyCustomers.html" method="post"> +<input type="hidden" name="id" value="<%$Ticket->id%>"> + +<& /Elements/TitleBoxStart, title => loc('Edit Customer Links'), color => "#7f007b"&> +<& Elements/EditCustomers, Ticket => $Ticket, CustomerString => $CustomerString, ServiceString => $ServiceString &> +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit, color => "#7f007b", Label => loc('Save Changes') &> +</form> + + +<%INIT> + +my @results = (); +my $Ticket = LoadTicket($id); + +# if we're trying to search for customers/services and nothing else +unless ( $OnlySearchForCustomers || $OnlySearchForServices) { + @results = ProcessTicketCustomers( TicketObj => $Ticket, ARGSRef => \%ARGS); +} + +</%INIT> + + +<%ARGS> +$OnlySearchForCustomers => undef +$OnlySearchForServices => undef +$CustomerString => undef +$ServiceString => undef +$id => undef +</%ARGS> diff --git a/rt/html/Ticket/ModifyDates.html b/rt/html/Ticket/ModifyDates.html new file mode 100644 index 000000000..a4f68f2f5 --- /dev/null +++ b/rt/html/Ticket/ModifyDates.html @@ -0,0 +1,74 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => loc('Modify dates for #[_1]', $TicketObj->Id) &> +<& /Ticket/Elements/Tabs, + Ticket => $TicketObj, + current_tab => "Ticket/ModifyDates.html?id=".$TicketObj->Id, + Title => loc('Modify dates for #[_1]', $TicketObj->Id) &> + +<& /Elements/ListActions, actions => \@results &> + +<FORM METHOD=POST ACTION="ModifyDates.html"> +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$TicketObj->Id%>"> +<& /Elements/TitleBoxStart, title => loc('Modify dates for ticket # [_1]', $TicketObj->Id), width => "100%", color => "#663366" &> + +<& Elements/EditDates, TicketObj => $TicketObj &> +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit, Label => loc('Save Changes'), color => "#663366" &> +</form> + + +<%INIT> + +my $TicketObj = LoadTicket($id); +my @results = ProcessTicketDates( TicketObj => $TicketObj, ARGSRef => \%ARGS); + +</%INIT> + + +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/html/Ticket/ModifyLinks.html b/rt/html/Ticket/ModifyLinks.html new file mode 100644 index 000000000..150597d89 --- /dev/null +++ b/rt/html/Ticket/ModifyLinks.html @@ -0,0 +1,76 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => loc("Link ticket #[_1]", $Ticket->Id) &> +<& /Ticket/Elements/Tabs, + Ticket => $Ticket, + current_tab => "Ticket/ModifyLinks.html?id=".$Ticket->Id, + Title => loc("Link ticket #[_1]", $Ticket->Id) &> + +<& /Elements/ListActions, actions => \@results &> + +<form action="ModifyLinks.html" method="post"> +<input type="hidden" name="id" value="<%$Ticket->id%>"> + +<& /Elements/TitleBoxStart, title => loc('Edit Links'), color => "#336633"&> +<& /Elements/EditLinks, Object => $Ticket, Merge => 1 &> +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit, color => "#336633", Label => loc('Save Changes') &> +</form> + + + + +<%INIT> + +my $Ticket = LoadTicket($id); +my @results = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS); + +</%INIT> + + +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/html/Ticket/ModifyPeople.html b/rt/html/Ticket/ModifyPeople.html new file mode 100644 index 000000000..61cbe6c27 --- /dev/null +++ b/rt/html/Ticket/ModifyPeople.html @@ -0,0 +1,90 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => loc('Modify people related to ticket #[_1]', $Ticket->id) &> +<& /Ticket/Elements/Tabs, + Ticket => $Ticket, + current_tab => "Ticket/ModifyPeople.html?id=".$Ticket->Id, + Title => loc('Modify people related to ticket #[_1]', $Ticket->id) &> + +<& /Elements/ListActions, actions => \@results &> + +<FORM METHOD=POST ACTION="ModifyPeople.html"> +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$Ticket->Id%>"> +<& /Elements/TitleBoxStart, title => loc('Modify people related to ticket #[_1]', $Ticket->Id), width => "100%", color=> "#333399" &> +<& Elements/EditPeople, Ticket => $Ticket, UserField => $UserField, UserString => $UserString, UserOp => $UserOp, GroupString => $GroupString, GroupOp => $GroupOp, GroupField => $GroupField &> +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit, Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &> +</form> + +<%INIT> + +my (@results, @wresults); + +my $Ticket = LoadTicket($id); + +# if we're trying to search for watchers and nothing else +unless ($OnlySearchForPeople or $OnlySearchForGroup) { + @results = ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS); + @wresults = ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS); +} + +push @results, @wresults; +</%INIT> + + + +<%ARGS> +$OnlySearchForPeople => undef +$OnlySearchForGroup => undef +$UserField => undef +$UserOp => undef +$UserString => undef +$GroupField => undef +$GroupOp => undef +$GroupString => undef +$id => undef +</%ARGS> + diff --git a/rt/html/Ticket/ShowEmailRecord.html b/rt/html/Ticket/ShowEmailRecord.html new file mode 100644 index 000000000..38eddd3d2 --- /dev/null +++ b/rt/html/Ticket/ShowEmailRecord.html @@ -0,0 +1,71 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +$Attachment => undef +$Transaction => undef +</%ARGS> +<%init> + my $AttachmentObj = new RT::Attachment($session{'CurrentUser'}); + $AttachmentObj->Load($Attachment) || Abort(loc("Attachment '[_1]' could not be loaded", $Attachment)); + + + unless ($AttachmentObj->id) { + Abort(loc("Attachment '[_1]' could not be loaded", $Attachment)); + } + unless ($AttachmentObj->TransactionId() == $Transaction ) { + Abort(loc("Attachment '[_1]' could not be loaded", $Attachment)); + } + +</%init> +<& /Elements/Header, ShowBar => 0 &> +<pre> +<%$AttachmentObj->Headers%> + +<%$AttachmentObj->Content%> +</pre> +</body> +</html> +%$m->abort; diff --git a/rt/html/Ticket/Update.html b/rt/html/Ticket/Update.html new file mode 100644 index 000000000..df739c9c7 --- /dev/null +++ b/rt/html/Ticket/Update.html @@ -0,0 +1,224 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => $title &> +<& /Ticket/Elements/Tabs, + Ticket => $TicketObj, + Title=> $title &> + +<FORM ACTION="Update.html" NAME="TicketUpdate" + METHOD=POST enctype="multipart/form-data"> +<input type="hidden" name="QuoteTransaction" value="<% $ARGS{QuoteTransaction} %>"> +<input type="hidden" name="DefaultStatus" value="<% $DefaultStatus %>"> +<input type="hidden" name="Action" value="<% $ARGS{Action} %>"> + +<TABLE BORDER=0> + +<tr><td align=right><&|/l&>Status</&>:</td> +<td> +<& /Elements/SelectStatus, Name=>"Status", DefaultLabel => loc("[_1] (Unchanged)", loc($TicketObj->Status)), Default => $ARGS{'Status'} || ($TicketObj->Status eq $DefaultStatus ? undef : $DefaultStatus)&> +<&|/l&>Owner</&>: +<& /Elements/SelectOwner, Name=>"Owner", DefaultLabel => loc("[_1] (Unchanged)", $TicketObj->OwnerObj->Name()), QueueObj => $TicketObj->QueueObj, TicketObj => $TicketObj, Default => $ARGS{'Owner'} &> +<&|/l&>Worked</&>: <input size=4 name="UpdateTimeWorked" value="<% $ARGS{UpdateTimeWorked}%>"> <&|/l&>minutes</&></td></tr> +% my $skip; +<& /Elements/Callback, _CallbackName => 'BeforeUpdateType', skip => \$skip, %ARGS &> +% if (!$skip) { +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$TicketObj->Id%>"><br> +% } +<tr><td align=right><&|/l&>Update Type</&>:</td> +<td><select name="UpdateType"> +% if ($CanComment) { + <option value="private" <%$ARGS{'UpdateType'} eq "private" ? "SELECTED" : !$ARGS{'UpdateType'}&&$CommentDefault%>><&|/l&>Comments (Not sent to requestors)</&></option> +% } +% if ($CanRespond) { + <option value="response" <%$ARGS{'UpdateType'} eq "response" ? "SELECTED" : !$ARGS{'UpdateType'}&&$ResponseDefault%>><&|/l&>Reply to requestors</&></option> +% } +</select> +</td></tr> +<tr><td align=right><&|/l&>Subject</&>:</td><td> <input name="UpdateSubject" size=60 value="<% $ARGS{UpdateSubject} || $TicketObj->Subject()%>"></td></tr> +<tr><td align=right><&|/l&>Cc</&>:</td><td> <input name="UpdateCc" size=60 +value="<% $ARGS{UpdateCc} %>"><BR> +<i><font size=-2> +<&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. Does <b>not</b> change who will receive future updates.)</&></font></i> +</td></tr> +<tr><td align=right><&|/l&>Bcc</&>:</td><td> <input name="UpdateBcc" size=60 VALUE="<%$ARGS{UpdateBcc}%>"><BR> +<i><font size=-2> +<&|/l&>(Sends a blind carbon-copy of this update to a comma-delimited list of email addresses. Does <b>not</b> change who will receive future updates.)</&></font></i> +</td></tr> +% if (exists $session{'Attachments'}) { +<TD> +<&|/l&>Attached file</&>: +</TD> +<TD COLSPAN=5> +<&|/l&>Check box to delete</&><BR> +% foreach my $attach_name (keys %{$session{'Attachments'}}) { +<input type="checkbox" name="DeleteAttach-<%$attach_name%>" value="1"><%$attach_name%><BR> +% } # end of foreach +</TD> +</TR> +<TR> +% } # end of if + +% if (my $TxnCFs = $TicketObj->TransactionCustomFields) { +% while (my $CF = $TxnCFs->Next()) { +<TR> +<TD ALIGN=RIGHT><% $CF->Name %>:</TD> +<TD><& /Elements/EditCustomField, CustomField => $CF, NamePrefix => + "Object-RT::Transaction--CustomField-" &><em><% $CF->FriendlyType %></em></TD> +</TR> +% } # end if while +% } # end of if + +<tr><td align=right><&|/l&>Attach</&>:</td><td><input name="Attach" type="file"><INPUT TYPE=SUBMIT NAME="AddMoreAttach" VALUE="<&|/l&>Add More Files</&>"><input type="hidden" name="UpdateAttach" value="1"> +</td></tr> +<tr><td align="right" valign="top"><&|/l&>Message</&>:</td><td> +<& /Elements/Callback, _CallbackName => 'BeforeMessageBox', %ARGS &> +% if (exists $ARGS{UpdateContent}) { +% # preserve QuoteTransaction so we can use it to set up sane references/in/reply to +% my $temp = $ARGS{'QuoteTransaction'}; +% delete $ARGS{'QuoteTransaction'}; +<& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0, %ARGS&> +% $ARGS{'QuoteTransaction'} = $temp; +% } else { +<& /Elements/MessageBox, Name=>"UpdateContent", %ARGS &> +% } +</td></tr> +</table> + + + + +<& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket' &> +% if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) { +<& /Ticket/Elements/PreviewScrips, TicketObj => $TicketObj, %ARGS &> +% } +</FORM> +<%INIT> +my $CanRespond = 0; +my $CanComment = 0; +my $title; + +my $TicketObj = LoadTicket($id); + +unless($DefaultStatus){ + $DefaultStatus=($ARGS{'Status'} ||$TicketObj->Status()); +} + +if ($DefaultStatus =~ '^new$'){ + $DefaultStatus='open'; +} + +if ($DefaultStatus eq 'resolved') { + $title = loc("Resolve ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject); +} else { + $title = loc("Update ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject); +} + +# Things needed in the template - we'll do the processing here, just +# for the convenience: + +my ($CommentDefault, $ResponseDefault); +if ($Action ne 'Respond') { + $CommentDefault = "SELECTED"; +} else { + $ResponseDefault = "SELECTED"; +} + + +$CanRespond = 1 if ( $TicketObj->CurrentUserHasRight('ReplyToTicket') or + $TicketObj->CurrentUserHasRight('ModifyTicket') ); + +$CanComment = 1 if ( $TicketObj->CurrentUserHasRight('CommentOnTicket') or + $TicketObj->CurrentUserHasRight('ModifyTicket') ); + + +# {{{ deal with deleting uploaded attachments +foreach my $key (keys %ARGS) { + if ($key =~ m/^DeleteAttach-(.+)$/) { + delete $session{'Attachments'}{$1}; + } + $session{'Attachments'} = { %{$session{'Attachments'} || {}} }; +} +# }}} + +# {{{ store the uploaded attachment in session +if ($ARGS{'Attach'}) { # attachment? + $session{'Attachments'} = {} unless defined $session{'Attachments'}; + + my $subject = "$ARGS{'Attach'}"; + # since CGI.pm deutf8izes the magic field, we need to add it back. + Encode::_utf8_on($subject); + # strip leading directories + $subject =~ s#^.*[\\/]##; + + my $attachment = MakeMIMEEntity( + Filename => $subject, + Body => "", + AttachmentFieldName => 'Attach' + ); + + $session{'Attachments'} = { %{$session{'Attachments'} || {}}, + $ARGS{'Attach'} => $attachment }; +} +# }}} + +# delete temporary storage entry to make WebUI clean +unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) { + delete $session{'Attachments'}; +} +# }}} + +if ( exists $ARGS{SubmitTicket} ) { + $m->comp('Display.html', TicketObj => $TicketObj, %ARGS); + return; +} + +</%INIT> + +<%ARGS> +$id => undef +$Action => undef +$DefaultStatus => undef +</%ARGS> diff --git a/rt/html/Tools/Elements/Tabs b/rt/html/Tools/Elements/Tabs new file mode 100644 index 000000000..fc4153b98 --- /dev/null +++ b/rt/html/Tools/Elements/Tabs @@ -0,0 +1,72 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Tabs, + tabs => $tabs, + current_toptab => 'Tools/Offline.html', + current_tab => $current_tab, + Title => $Title &> + +<%INIT> + my $tabs = { a => { title => loc('Offline'), + path => 'Tools/Offline.html', + }, + }; + + foreach my $tab (sort keys %{$tabs}) { + if ($tabs->{$tab}->{'path'} eq $current_tab) { + $tabs->{$tab}->{"subtabs"} = $subtabs; + $tabs->{$tab}->{"current_subtab"} = $current_subtab; + } + } +</%INIT> + + +<%ARGS> +$subtabs => undef +$current_tab => undef +$current_subtab => undef +$Title => undef +</%ARGS> diff --git a/rt/html/Tools/MyDay.html b/rt/html/Tools/MyDay.html new file mode 100644 index 000000000..a20209c9b --- /dev/null +++ b/rt/html/Tools/MyDay.html @@ -0,0 +1,91 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, title => "What I did today" &> +(displaying new and open tickets for <%$session{'CurrentUser'}->Name%>) +<FORM METHOD=POST ACTION="MyDay.html"> +<TABLE width=100% cellpadding=0 cellspacing=0> +% while ( my $Ticket = $Tickets->Next()) { +% my $class; +% $i++; +% if ($i % 2 ) { +% $class = 'class="oddline"'; +% } +<TR <%$class|n%>><TD COLSPAN=2><h2><A +HREF="<%$RT::WebPath%>/Ticket/Display.html?id=<%$Ticket->Id%>"><%$Ticket->Id%>: +<%$Ticket->Subject%></A></h2></td></tr> +<TR <%$class|n%>><TD><SPAN CLASS=label>Worked:</SPAN><input size=3 name="UpdateTimeWorked-<%$Ticket->Id%>"> minutes +</TD> +<TD ROWSPAN=2><SPAN CLASS=label>Comments:<br></SPAN><textarea name="UpdateContent-<%$Ticket->Id%>" rows=5 +cols=60></textarea></TD></TR> +<TR <%$class|n%>> +<TD><SPAN CLASS="label">Status:</SPAN> <& /Elements/SelectStatus, Name=> 'UpdateStatus-'.$Ticket->Id, + DefaultLabel => loc("[_1] (Unchanged)",loc($Ticket->Status())) &></TD> + </TR> + +% } +</TABLE> +<& /Elements/Submit, Label => "Record all updates" , Reset => 'Clear'&> +</FORM> +</HTML> + +<%INIT> + +my $i = 0; + +my $Tickets = RT::Tickets->new($session{'CurrentUser'}); +$Tickets->LimitOwner(VALUE => $session{'CurrentUser'}->Id); +$Tickets->LimitStatus( VALUE => 'open' ); +$Tickets->LimitStatus ( VALUE => 'new'); +$Tickets->OrderBy ( FIELD => 'Priority', ORDER => 'DESC'); + +while (my $Ticket = $Tickets->Next()) { + #Process updates + + +} + +</%INIT> + diff --git a/rt/html/Tools/Offline.html b/rt/html/Tools/Offline.html new file mode 100644 index 000000000..8b12784e8 --- /dev/null +++ b/rt/html/Tools/Offline.html @@ -0,0 +1,166 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => loc("Offline upload") &> +<& Elements/Tabs, + current_tab => "Tools/Offline.html", + Title => loc("Offline edits") &> + +<& /Elements/ListActions, actions => \@results &> + +<& /Elements/Callback, Requestor => \$requestoraddress, + Queue => \$qname, %ARGS &> + +<FORM ACTION="Offline.html" NAME="TicketUpdate" + METHOD=POST enctype="multipart/form-data"> +<table> +<tr> +<td class=label> +<&|/l&>Default Queue</&>: +</td> +<td> +<& /Elements/SelectQueue, Name => "qname", NamedValues => 1 &> +<i><&|/l&>If no queue is specified, create tickets in this queue.</&></i> +</td> +</tr> +<tr> +<td class=label> +<&|/l&>Default Requestor</&>: +</td> +<td> +<input name=requestoraddress value=<%$requestoraddress%>> +<i><&|/l&>If no Requestor is specified, create tickets with this requestor.</&></i> +</td> +</tr> +<tr><td class=labeltop> +<&|/l&>Template</&>: +</td> +<td colspan=2> +<textarea name=string cols=80 rows=30> +<%$string%> +</textarea> +</td> +</tr> +<tr><td class=label> +<&|/l&>Get template from file</&>: +</td> +<td> +<input name="Template" type="file" value="foo"> +<INPUT TYPE=SUBMIT NAME="Parse" VALUE="<&|/l&>Go</&>"> +</td> +</tr> +</table> +<& /Elements/Submit, Name => 'UpdateTickets', Label => loc('Upload'), Caption => loc("Upload your changes"), color => "#993333" &> + +</FORM> +<%args> +$requestoraddress => undef +$qname => undef +$string => undef +</%args> +<%INIT> + +my @results; +use RT::Action::CreateTickets; +my $action = RT::Action::CreateTickets->new(CurrentUser => $session{'CurrentUser'}); +; +if ($ARGS{'Parse'} && $ARGS{'Template'}) { + $string = ""; + my $cgi_object = $m->cgi_object; + my $fh = $cgi_object->upload('Template'); + my $filename = "$fh"; + + my ($buffer, $template); + while ( my $bytesread = read( $fh, $buffer, 4096 ) ) { + $template .= $buffer; + } + $template =~ s/\r\n/\n/gs; + $action->Parse(Content => $template, Queue => $qname, Requestor => $requestoraddress); + foreach ( @{ $action->{'create_tickets'} } ) { + my $id = $_; + $id =~ s/^create\-//; + $string .= "===Create-Ticket: $id\n"; + $string .= $action->{'templates'}->{$_} . "\n"; + } + foreach ( @{ $action->{'update_tickets'} } ) { + my $id = $_; + $id =~ s/^update\-//; + $string .= "===Update-Ticket: $id\n"; + $string .= $action->{'templates'}->{$_} . "\n"; + } + + +} elsif ($ARGS{'UpdateTickets'}) { + $action->Parse(Content => $ARGS{string}, Queue => $qname, Requestor=> $requestoraddress); + push @results, $action->CreateByTemplate(); + push @results, $action->UpdateByTemplate(); +} else { + if ($ARGS{'Query'}) { + my $Tickets = RT::Tickets->new($session{'CurrentUser'}); + $Tickets->FromSQL($ARGS{'Query'}); + + while (my $t = $Tickets->Next) { + $string .= "===Update-Ticket: " . $t->Id . "\n"; + $string .= $action->GetUpdateTemplate($t); + $string .= "" . "\n"; + } + + $string .= "" . "\n"; + $string .= "===# DO NOT EDIT BELOW THIS LINE#===\n"; + $string .= "" . "\n"; + + while (my $t = $Tickets->Next) { + $string .= "===# DO NOT EDIT #===\n"; + $string .= "===Base-Ticket: " . $t->Id . "\n"; + $string .= $action->GetBaseTemplate($t); + $string .= "===# DO NOT EDIT #===\n"; + $string .= "" . "\n"; + } + } else { + $string .= "===Create-Ticket: ticket1\n"; + $string .= $action->GetCreateTemplate(); + } +} +</%INIT> diff --git a/rt/html/User/Delegation.html b/rt/html/User/Delegation.html new file mode 100644 index 000000000..3347fda1f --- /dev/null +++ b/rt/html/User/Delegation.html @@ -0,0 +1,105 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => loc("Delegate rights") &> +<& /User/Elements/Tabs, + current_tab => 'User/Delegation.html', + Title => loc("Delegate rights") &> + +<& /Elements/ListActions, actions => \@results &> + +<form method="post"> +<& Elements/DelegateRights, personalgroups => $personalgroups, objects => $objects, ObjectType => 'RT::System' &> +<& Elements/DelegateRights, personalgroups => $personalgroups, objects => $objects, ObjectType => 'RT::Queue' &> +<& Elements/DelegateRights, personalgroups => $personalgroups, objects => $objects, ObjectType => 'RT::Group' &> + +<& /Elements/Submit, Label => loc('Modify Rights') &> +</form> +<%INIT> + +my (@results, $arg); +foreach $arg (keys %ARGS) { + next unless ($arg =~ /^Delegate-Existing-ACE-(\d+)-to-(\d+)-as-(\d+)$/); + my $parent = $1; + my $principal = $2; + my $delegation = $3; + unless ($ARGS{"Delegate-ACE-$1-to-$2"}) { + my $ace_to_del = RT::ACE->new($session{'CurrentUser'}); + $ace_to_del->Load($delegation); + my ($delval, $delmsg) = $ace_to_del->Delete(); + push (@results, $delmsg); + } +} + +foreach $arg (keys %ARGS) { + next unless ($arg =~ /^Delegate-ACE-(\d+)-to-(\d+)$/); + my $parent = $1; + my $principal = $2; + # if we already delegate it, we just don't care + next if (grep /^Delegate-Existing-ACE-$parent-to-$principal-/, keys %ARGS); + my $ace = RT::ACE->new($session{'CurrentUser'}); + $ace->Load($1); + unless ($ace->Id) { + push (@results, loc('Right not found')); + next; + } + my ($delid, $delmsg) = $ace->Delegate(PrincipalId => $principal); + push (@results, $delmsg); +} + +my $personalgroups = RT::Groups->new($session{'CurrentUser'}); +$personalgroups->LimitToPersonalGroupsFor($session{'CurrentUser'}->PrincipalId); + +my $objects; +my $acl = RT::ACL->new ($session{'CurrentUser'}); +$acl->ExcludeDelegatedRights(); +$acl->LimitToPrincipal(Id => $session{'CurrentUser'}->PrincipalId, + IncludeGroupMembership => 1 + ); + +while(my $right = $acl->Next) { + push @{$objects->{$right->ObjectType}{$right->ObjectId}},$right; +} +</%INIT> diff --git a/rt/html/User/Elements/DelegateRights b/rt/html/User/Elements/DelegateRights new file mode 100644 index 000000000..79ecb5977 --- /dev/null +++ b/rt/html/User/Elements/DelegateRights @@ -0,0 +1,107 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<h2><%$sectionheading%></h2> +<%perl> + +foreach my $object (keys %{$objects->{$ObjectType}}) { +unless ($ObjectType eq 'RT::System') { +my $object_obj = @{$objects->{$ObjectType}{$object}}[0]->Object; + +</%perl> +<h3><% $object_obj->Name %></h3> +% } +<table width="100%" border="0" cellspacing="0" cellpadding="3"> +<tr> + <th width=15%><&|/l&>Personal groups:</&></th> +% while (my $pg = $personalgroups->Next) { +<th><%$pg->Name%></th> +% } +</tr> +<%perl> +my $i; +foreach my $right (@{$objects->{$ObjectType}{$object}}) { +my $delegations = RT::ACL->new($session{'CurrentUser'}); +$delegations->DelegatedBy( Id => $session{'CurrentUser'}->PrincipalId); +$delegations->DelegatedFrom ( Id => $right->Id); + +my $del_hash = {}; +while ( my $delegation = $delegations->Next) { + $del_hash->{$delegation->PrincipalId} = $delegation; +} +</%perl> +% $i++; +% +<tr class="<%($i%2) && 'oddline'%>"> +<td> +<% loc($right->RightName) %><br> +<div align=right><font size="-2" color="#999999"><&|/l, $right->PrincipalObj->Object->SelfDescription &>as granted to [_1]</&></font></div> + </td> +% while (my $pg = $personalgroups->Next) { +<td align=center> + <input name="Delegate-ACE-<% $right->Id %>-to-<% $pg->PrincipalId%>" type=checkbox value="1" <%$ del_hash->{$pg->PrincipalId} && 'CHECKED' %>> +% if ( $del_hash->{$pg->PrincipalId}) { +<input type=hidden name="Delegate-Existing-ACE-<% $right->Id %>-to-<% $pg->PrincipalId%>-as-<%$del_hash->{$pg->PrincipalId}->Id%>"> +% } +</td> +% } +<td> </td> +</tr> +%} +</table> +% } +<%init> + +my $sectionheading = loc("[_1] rights", loc($ObjectType =~ /^RT::(.*)$/)); +# 'System' # loc +# 'Group' # loc +# 'Queue' # loc + +</%init> +<%args> +$ObjectType => undef +$objects => undef +$personalgroups => undef +</%args> diff --git a/rt/html/User/Elements/GroupTabs b/rt/html/User/Elements/GroupTabs new file mode 100644 index 000000000..2e79df268 --- /dev/null +++ b/rt/html/User/Elements/GroupTabs @@ -0,0 +1,82 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /User/Elements/Tabs, + subtabs => $tabs, + current_tab => 'User/Groups/', + current_subtab => $current_subtab, + Title => $Title &> + +<%INIT> +my $tabs; +if ( $GroupObj and $GroupObj->id ) { + $tabs->{"this"} = { + title => $GroupObj->Name, + path => "User/Groups/Modify.html?id=" . $GroupObj->id, + subtabs => { + Basics => { title => loc('Basics'), + path => "User/Groups/Modify.html?id=" . $GroupObj->id + }, + + Members => { title => loc('Members'), + path => "User/Groups/Members.html?id=" . $GroupObj->id + }, + + } }; + $tabs->{'this'}->{'current_subtab'} = $current_subtab; + $current_subtab = "User/Groups/Modify.html?id=" . $GroupObj->id, +} +$tabs->{"A"} = { title => loc('Select group'), + path => "User/Groups/index.html" }; +$tabs->{"B"} = { title => loc('New group'), + path => "User/Groups/Modify.html?Create=1", + separator => 1 }; + +</%INIT> +<%ARGS> +$GroupObj => undef +$current_subtab => undef +$Title => undef +</%ARGS> diff --git a/rt/html/User/Elements/Tabs b/rt/html/User/Elements/Tabs new file mode 100644 index 000000000..1d25fb926 --- /dev/null +++ b/rt/html/User/Elements/Tabs @@ -0,0 +1,78 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Tabs, + tabs => $tabs, + current_toptab => 'User/Prefs.html', + current_tab => $current_tab, + Title => $Title &> + +<%INIT> + my $tabs = { a => { title => loc('About me'), + path => 'User/Prefs.html', + }, + g => { title => loc('Personal Groups'), + path => 'User/Groups/', + }, + h => { title => loc('Delegation'), + path => 'User/Delegation.html', + }, + }; + + foreach my $tab (sort keys %{$tabs}) { + if ($tabs->{$tab}->{'path'} eq $current_tab) { + $tabs->{$tab}->{"subtabs"} = $subtabs; + $tabs->{$tab}->{"current_subtab"} = $current_subtab; + } + } +</%INIT> + + +<%ARGS> +$subtabs => undef +$current_tab => undef +$current_subtab => undef +$Title => undef +</%ARGS> diff --git a/rt/html/User/Groups/Members.html b/rt/html/User/Groups/Members.html new file mode 100644 index 000000000..2068e5a5b --- /dev/null +++ b/rt/html/User/Groups/Members.html @@ -0,0 +1,158 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => $title &> +<& /User/Elements/GroupTabs, + GroupObj => $Group, + current_subtab => "User/Groups/Members.html?id=".$Group->id, + Title => $title &> +<& /Elements/ListActions, actions => \@results &> + + + +<FORM ACTION="<%$RT::WebPath%>/User/Groups/Members.html" METHOD="POST"> +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$Group->Id%>"> +<TABLE WIDTH="100%"> +<TR> +<TD> +<&|/l&>Add members</&> +</TD> +<TD> +<&|/l&>Current members</&> +</TD> +</TR> + +<TR> +<TD VALIGN=TOP> +<& /Admin/Elements/SelectNewGroupMembers, Name => "AddMembers", Group => $Group &> +</TD> +<TD VALIGN=TOP> + +% if ($Group->MembersObj->Count == 0 ) { +<i><&|/l&>(No members)</&></i> +% } else { +<i><&|/l&>(Check box to delete)</&></i> +<br> +<br> +<&|/l&>Users</&> +% my $UserMembers = $Group->MembersObj; +% $UserMembers->LimitToUsers(); +<UL> +% while (my $member = $UserMembers->Next()) { +<LI><INPUT TYPE=CHECKBOX Name="DeleteMember-<%$member->MemberId%>" value="1"> +<%$member->MemberObj->Object->Name%> (<%$member->MemberObj->Object->RealName%>) +% } +</ul> +<&|/l&>Groups</&> +<ul> +% my $GroupMembers = $Group->MembersObj; +% $GroupMembers->LimitToGroups(); +% while (my $member = $GroupMembers->Next()) { +<LI><INPUT TYPE=CHECKBOX Name="DeleteMember-<%$member->MemberId%>" value="1"> +<%$member->MemberObj->Object->Name%> +% } +% } +</UL> +</TD> +</TR> +</TABLE> +<& /Elements/Submit, Label => loc('Modify Members') &> +</form> + + +<%INIT> + +my $Group = new RT::Group($session{'CurrentUser'}); +$Group->Load($id) ; + +unless ($Group->id) { + Abort(loc('Could not load group')); +} + +my (@results); + +foreach my $key (keys %ARGS) { + +if ($key =~ /^DeleteMember-(\d+)$/) { + my $mem_id = $1; + my ($val,$msg) = $Group->DeleteMember($mem_id); + push (@results, $msg); +} +} + +# Make sure AddMembers is always an array +my @AddMembersUsers = (ref $AddMembersUsers eq 'ARRAY') ? @{$AddMembersUsers} : ($AddMembersUsers); +my @AddMembersGroups = (ref $AddMembersGroups eq 'ARRAY') ? @{$AddMembersGroups} : ($AddMembersGroups); + +foreach my $member (@AddMembersUsers, @AddMembersGroups) { + next unless ($member); + + my $principal; + + if ($member =~ /^Group-(\d+)$/) { + $principal = RT::Group->new($session{'CurrentUser'}); + $principal->Load($1); + } elsif ($member =~ /^User-(\d+)$/) { + $principal = RT::User->new($session{'CurrentUser'}); + $principal->Load($1); + } else { + next; + } + + + my ($val, $msg) = $Group->AddMember($principal->PrincipalId); + push (@results, $msg); +} + + +my $title = loc('Editing membership for personal group [_1]', $Group->Name); + +</%INIT> + +<%ARGS> +$AddMembersUsers => undef +$AddMembersGroups => undef +$id => undef +</%ARGS> diff --git a/rt/html/User/Groups/Modify.html b/rt/html/User/Groups/Modify.html new file mode 100644 index 000000000..c0e9ce575 --- /dev/null +++ b/rt/html/User/Groups/Modify.html @@ -0,0 +1,155 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => $title &> + +<& /User/Elements/GroupTabs, + GroupObj => $Group, + current_subtab => $current_tab, + Title => $title &> + +<& /Elements/ListActions, actions => \@results &> + + +<FORM ACTION="<%$RT::WebPath%>/User/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> +<&|/l&>Name</&>: +</TD> +<TD><INPUT name="Name" value="<%$Group->Name%>"></TD> +</TR><TR> +<TD ALIGN=RIGHT> +<&|/l&>Description</&>:</TD><TD COLSPAN=3><INPUT name="Description" value="<%$Group->Description%>" size=60></TD> +</TR><TR> +<TD COLSPAN=2> +<INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1"> +<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> <&|/l&>Enabled (Unchecking this box disables this group)</&><BR> +</TR> +</TABLE> +<& /Elements/Submit, Label => loc('Save Changes'), Reset => 1 &> +</form> +<%INIT> + +my $current_tab; +my ($title, @results, $Disabled, $EnabledChecked); + +my $Group = RT::Group->new($session{'CurrentUser'}); + +if ($Create) { + $current_tab = 'User/Groups/Modify.html?Create=1'; + $title = loc("Create a new personal group"); +} +else { + if ( $id eq 'new' ) { + + my ( $id, $msg ) = $Group->CreatePersonalGroup( + Name => "$Name", + PrincipalId => $session{'CurrentUser'}->PrincipalId + ); + unless ($id) { + Abort( loc("Could not create group") ); + } + $id = $Group->Id; + } + else { + $Group->Load($id) || Abort( loc('Could not load group') ); + } + + if ($id) { + $title = loc( "Modify the group [_1]", $Group->Name ); + + } + + # If the create failed + else { + $title = loc("Create a new personal group"); + $Create = 1; + } + + $current_tab = 'User/Groups/Modify.html?id=' . $Group->Id; +} + +if ($id) { + + my @fields = qw(Description Name ); + my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields, + Object => $Group, + ARGSRef => \%ARGS ); + push (@results,@fieldresults); +} + +#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 != $Group->Disabled) ) { + my ($code, $msg) = $Group->SetDisabled($Disabled); + push @results, loc('Enabled status [_1]', loc_fuzzy($msg)); +} + +unless ($Group->Disabled()) { + $EnabledChecked ="CHECKED"; +} + +</%INIT> + + +<%ARGS> +$Create => undef +$Name => undef +$Description => undef +$SetEnabled => undef +$Enabled => undef +$id => undef +</%ARGS> diff --git a/rt/html/User/Groups/index.html b/rt/html/User/Groups/index.html new file mode 100644 index 000000000..6d2e15d47 --- /dev/null +++ b/rt/html/User/Groups/index.html @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => $title &> +<& /User/Elements/GroupTabs, + current_subtab => 'User/Groups/index.html', + Title => $title &> + +<&|/l&>Personal groups</&>:<BR> +<UL> +%while ( my $Group = $Groups->Next) { +<LI><A HREF="Modify.html?id=<%$Group->id%>"><%$Group->Name || loc('(empty)')%></a><BR> +%} +</UL> + +<%INIT> +my $Groups = RT::Groups->new($session{'CurrentUser'}); +$Groups->LimitToPersonalGroupsFor($session{'CurrentUser'}->PrincipalId()); +my $title = loc('Personal groups'); + +</%INIT> +<%ARGS> +</%ARGS> diff --git a/rt/html/User/Prefs.html b/rt/html/User/Prefs.html new file mode 100644 index 000000000..f1c755826 --- /dev/null +++ b/rt/html/User/Prefs.html @@ -0,0 +1,279 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title=>loc("Preferences") &> +<& /User/Elements/Tabs, + current_tab => 'User/Prefs.html', + Title=>loc("Preferences") &> + +<& /Elements/ListActions, actions => \@results &> + +<FORM ACTION="<%$RT::WebPath%>/User/Prefs.html" METHOD=POST> +<INPUT TYPE=HIDDEN NAME=id VALUE="<%$UserObj->Id%>"> + +<TABLE WIDTH=100% BORDER=0> +<TR> + +<TD VALIGN=TOP class="boxcontainer"> +<& /Elements/TitleBoxStart, title => loc('Identity') &> + +<input type=hidden name="Name" value="<%$UserObj->Name%>"> +<table callspacing=0 cellpadding=0> + <tr> + <td class=label><&|/l&>Email</&>: </td> + <td class=value><input name="EmailAddress" value="<%$UserObj->EmailAddress%>"></td> + </tr> + <tr> + <td class=label><&|/l&>Real Name</&>:</td> + <td class=value><input name="RealName" value="<%$UserObj->RealName%>"></td> </tr> + <tr> + <td class=label><&|/l&>Nickname</&>:</td> + <td class=value><input name="NickName" value="<%$UserObj->NickName%>"></td> + </tr> + <tr> + <td class=label><&|/l&>Language</&>:</td> + <td class=value><& /Elements/SelectLang, Name => 'Lang', Default => $UserObj->Lang &></td> + </tr> +</table> +<& /Elements/TitleBoxEnd &> +<br> +<& /Elements/TitleBoxStart, title => loc('Phone numbers') &> +<table callspacing=0 cellpadding=0> + <tr> + <td class=label><&|/l&>Residence</&>:</td> + <td class=value><input name="HomePhone" value="<%$UserObj->HomePhone%>" size=13></td> + </tr> + <tr> + <td class=label><&|/l&>Work</&>:</td> + <td class=value><input name="WorkPhone" value="<%$UserObj->WorkPhone%>" size=13></td> + </tr> + <tr> + <td class=label><&|/l&>Mobile</&>:</td> + <td class=value><input name="MobilePhone" value="<%$UserObj->MobilePhone%>" size=13></td> + </tr> + <tr> + <td class=label><&|/l&>Pager</&>:</td> + <td class=value><input name="PagerPhone" value="<%$UserObj->PagerPhone%>" size=13></td> + </tr> +</table> +<& /Elements/TitleBoxEnd &> +</TD> +<TD VALIGN=TOP class="boxcontainer"> +% unless ($RT::WebExternalAuth and !$RT::WebFallbackToInternalAuth) { +<& /Elements/TitleBoxStart, title => loc('Password') &> +<TABLE> +<TR> +<TD class=label> +<&|/l&>New Password</&>: +</TD> +<TD class=value> +<input type=password name="Pass1"> +</TD> +</TR> +<TR><TD class=label> +<&|/l&>Retype Password</&>: +</TD> +<TD class=value> +<input type=password name="Pass2"> +</TD> +</TR> +</TABLE> +<& /Elements/TitleBoxEnd &> +% } + +<& /Elements/TitleBoxStart, title => loc('Location') &> +<table callspacing=0 cellpadding=0> + <tr> + <td class=label><&|/l&>Organization</&>:</td> + <td class=value><input name="Organization" value="<%$UserObj->Organization%>"></td> + </tr> + <tr> + <td class=label><&|/l&>Address1</&>:</td> + <td class=value><input name="Address1" value="<%$UserObj->Address1%>"></td> + </tr> + <tr> + <td class=label><&|/l&>Address2</&>:</td> + <td class=value><input name="Address2" value="<%$UserObj->Address2%>"></td> + </tr> + <tr> + <td class=label><&|/l&>City</&>:</td> + <td><input name="City" value="<%$UserObj->City%>" size=14></td> + </tr> + <tr> + <td class=label><&|/l&>State</&>:</td> + <td class=value><input name="State" value="<%$UserObj->State%>" size=3></td> + </tr> + <tr> + <td class=label><&|/l&>Zip</&>:</td> + <td class=value><input name="Zip" value="<%$UserObj->Zip%>" size=9></td> + </tr> + <tr> + <td class=label><&|/l&>Country</&>:</td> + <td class=value><input name="Country" value="<%$UserObj->Country%>"></td> + </tr> +</table> +<& /Elements/TitleBoxEnd &> +</TD> +</TR> +<TR> + + + +<TD COLSPAN=2 VALIGN=TOP class="boxcontainer"> +%if ($UserObj->Privileged) { +<BR> +<& /Elements/TitleBoxStart, title => loc('Signature') &> +<TEXTAREA COLS=80 ROWS=5 name="Signature" class="signature" WRAP=HARD> +<%$UserObj->Signature%></TEXTAREA> +<& /Elements/TitleBoxEnd &> +% } + +</TD> + +</TR> +</TABLE> + + +<& /Elements/Submit, Label => loc('Save Preferences') &> +</form> + + +<%INIT> + +my $UserObj = new RT::User($session{'CurrentUser'}); +my ($title, $PrivilegedChecked, $EnabledChecked, $Disabled, $result, @results); + +my ($val, $msg); + + + $UserObj->Load($id) || $UserObj->Load($Name) || Abort("Couldn't load user '$Name'"); + $val = $UserObj->Id(); + + + + + + +# 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 Lang + ); + + my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields, + Object => $UserObj, + ARGSRef => \%ARGS ); + if ($Lang) { + $session{'CurrentUser'}->LanguageHandle($Lang); + $session{'CurrentUser'} = $session{'CurrentUser'}; # force writeback + } + + 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, loc('Privileged status: [_1]', loc_fuzzy($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, loc('Password: [_1]', loc_fuzzy($msg)); +} elsif ( $Pass1 && ($Pass1 ne $Pass2)) { + push @results, loc("Passwords do not match. Your password has not been changed"); +} + +# }}} +} + + +</%INIT> + + +<%ARGS> +$id => $session{'CurrentUser'}->Id +$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/html/autohandler b/rt/html/autohandler new file mode 100644 index 000000000..c854c2b33 --- /dev/null +++ b/rt/html/autohandler @@ -0,0 +1,230 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%INIT> + +# Roll back any dangling transactions from a previous failed connection +$RT::Handle->ForceRollback() if $RT::Handle->TransactionDepth; + + +local *session unless $m->is_subrequest; # avoid reentrancy, as suggested by masonbook + +# Disable AutoFlush using an attribute +if ($m->request_comp->attr_exists('AutoFlush')) { + $m->autoflush($m->request_comp->attr('AutoFlush')); +} + +%ARGS = map { + # if they've passed multiple values, they'll be an array. if they've + # passed just one, a scalar whatever they are, mark them as utf8 + my $type = ref($_); + (!$type) + ? Encode::is_utf8($_) ? $_ : Encode::decode(utf8 => $_, Encode::FB_PERLQQ) : + ($type eq 'ARRAY') + ? [ map { (ref($_) or Encode::is_utf8($_)) ? $_ : Encode::decode(utf8 => $_, Encode::FB_PERLQQ) } @$_ ] : + ($type eq 'HASH') + ? { map { (ref($_) or Encode::is_utf8($_)) ? $_ : Encode::decode(utf8 => $_, Encode::FB_PERLQQ) } %$_ } : $_ + } %ARGS; + +$m->{'rt_base_time'} = [Time::HiRes::gettimeofday()]; + +$m->comp('/Elements/SetupSessionCookie', %ARGS); + +unless ($session{'CurrentUser'} && $session{'CurrentUser'}->Id) { + $session{'CurrentUser'} = RT::CurrentUser->new(); +} + +# Set the proper encoding for the current language handle +$r->content_type("text/html; charset=utf-8"); + +# If it's a noauth file, don't ask for auth. +if ($m->base_comp->path =~ $RT::WebNoAuthRegex ) +{ + $m->call_next(%ARGS); + $m->abort(); +} + +# If RT is configured for external auth, let's go through and get REMOTE_USER +elsif ( $RT::WebExternalAuth ) { + + # do we actually have a REMOTE_USER equivlent? + if ( RT::Interface::Web::WebCanonicalizeInfo() ) { + + my $orig_user = $user; + + $user = RT::Interface::Web::WebCanonicalizeInfo(); + $session{'CurrentUser'} = RT::CurrentUser->new(); + my $load_method = $RT::WebExternalGecos ? 'LoadByGecos' : 'Load'; + + if ($^O eq 'MSWin32' and $RT::WebExternalGecos) { + my $NodeName = Win32::NodeName(); + $user =~ s/^\Q$NodeName\E\\//i; + } + + $session{'CurrentUser'}->$load_method($user); + + if ($RT::WebExternalAuto and !$session{'CurrentUser'}->Id() ) { + # Create users on-the-fly + + my $UserObj = RT::User->new(RT::CurrentUser->new('RT_System')); + + my ($val, $msg) = $UserObj->Create( + %{ref($RT::AutoCreate) ? $RT::AutoCreate : {}}, + Name => $user, + Gecos => $user, + ); + + if ($val) { + + # now get user specific information, to better create our user. + my $new_user_info = RT::Interface::Web::WebExternalAutoInfo($user); + + # set the attributes that have been defined. + # FIXME: this is a horrible kludge. I'm sure there's something cleaner + foreach my $attribute ('Name', 'Comments', 'Signature', 'EmailAddress', + 'PagerEmailAddress', 'FreeformContactInfo', + 'Organization', 'Disabled', 'Privileged', + 'RealName', 'NickName', 'Lang', 'EmailEncoding', + 'WebEncoding', 'ExternalContactInfoId', + 'ContactInfoSystem', 'ExternalAuthId', 'Gecos', + 'HomePhone', 'WorkPhone', 'MobilePhone', + 'PagerPhone', 'Address1', 'Address2', 'City', + 'State', 'Zip', 'Country') { + $m->comp('/Elements/Callback', %ARGS, _CallbackName => 'NewUser'); + + my $method = "Set$attribute"; + $UserObj->$method($new_user_info->{$attribute}) + if( defined $new_user_info->{$attribute} ); + } + $session{'CurrentUser'}->Load($user); + } + else { + # we failed to successfully create the user. abort abort abort. + delete $session{'CurrentUser'}; + $m->abort() unless $RT::WebFallbackToInternalAuth; + $m->comp('/Elements/Login', %ARGS, + Error=> loc('Cannot create user: [_1]', $msg)); + } + } + + unless ( $session{'CurrentUser'}->Id() ) { + delete $session{'CurrentUser'}; + $user = $orig_user; + + if ( $RT::WebExternalOnly ) { + $m->comp('/Elements/Login', %ARGS, + Error=> loc('You are not an authorized user')); + $m->abort(); + } + } + } + elsif ($RT::WebFallbackToInternalAuth) { + unless (defined($session{'CurrentUser'})) { + $m->comp('/Elements/Login', %ARGS, + Error=> loc('You are not an authorized user')); + $m->abort(); + } + } else { + # WebExternalAuth is set, but we don't have a REMOTE_USER. abort + delete $session{'CurrentUser'} if defined $session{'CurrentUser'}; + } +} + +delete $session{'CurrentUser'} + unless $session{'CurrentUser'} and defined $session{'CurrentUser'}->Id; + + +# Process per-page authentication callbacks +$m->comp('/Elements/Callback', %ARGS, _CallbackName => 'Auth'); + +# If the user is logging in, let's authenticate +if (!$session{'CurrentUser'} && defined ($user) && defined ($pass) ){ + $session{'CurrentUser'} = RT::CurrentUser->new(); + $session{'CurrentUser'}->Load($user); + + if (!$session{'CurrentUser'}->id() || + !$session{'CurrentUser'}->IsPassword($pass)) + { + delete $session{'CurrentUser'}; + $RT::Logger->error("FAILED LOGIN for $user from $ENV{'REMOTE_ADDR'}"); + $m->comp('/Elements/Login', %ARGS, + Error => loc('Your username or password is incorrect')); + $m->abort(); + } + else { + $RT::Logger->info("Successful login for $user from $ENV{'REMOTE_ADDR'}"); + } +} + +# If we've got credentials, let's serve the file up. +if ( (defined $session{'CurrentUser'}) and + ( $session{'CurrentUser'}->Id) ) { + + # Process per-page global callbacks + $m->comp('/Elements/Callback', %ARGS); + + # If the user isn't privileged, they can only see SelfService + if ((! $session{'CurrentUser'}->Privileged) and + ($m->base_comp->path !~ '^(/+)SelfService/') ) { + $m->comp('/SelfService/index.html'); + $m->abort(); + } + else { + $m->call_next(%ARGS); + } +} + +# If we have no credentials +else { + $m->comp('/Elements/Login', %ARGS); + $m->abort(); +} +</%INIT> +<& /Elements/Footer, %ARGS &> +<%ARGS> +$user => undef +$pass => undef +$menu => undef +</%ARGS> diff --git a/rt/html/index.html b/rt/html/index.html new file mode 100644 index 000000000..04d48ece6 --- /dev/null +++ b/rt/html/index.html @@ -0,0 +1,156 @@ +<!-- +% $m->out('--'.'>'); +% if (0) { +%# --> +<html><head> +<META HTTP-EQUIV=Refresh CONTENT="3; URL=http://bestpractical.com/rt/rt-broken-install.html"> +<title>Almost there!</title></head> +<body> + +<img src="http://www.bestpractical.com/images/unconfigured-rtlogo.jpg"> +<br><br> +<h1>You're almost there!</h1> +You haven't yet configured your webserver to run RT. + +You appear to have installed RT's web interface correctly, but haven't yet configured your web +server to "run" the RT server which powers the web interface. + +The next step is to edit your webserver's configuration file to instruct it to use +RT's <b>mod_perl</b>, <b>fastcgi</b> or <b>speedycgi</b> handler. + +If you need commercial support, please contact us at sales@bestpractical.com. + + +<!-- +% } + +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title=>loc("RT at a glance"), Refresh => $session{'home_refresh_interval'} &> +<& /Elements/Tabs, + current_toptab => '', + Title=>loc("RT at a glance") &> +<& /Elements/ListActions, actions => \@results &> +<TABLE BORDER=0 WIDTH=100%> +<TR VALIGN=TOP> +<TD WIDTH=70% class="boxcontainer"> +<& /Elements/MyTickets &> +<BR> +<& /Elements/MyRequests &> +<BR> +<& /Elements/QuickCreate &> +</TD> +<TD class="boxcontainer"> +<& /Elements/Quicksearch &> +<BR> +<form method=get action="<%$RT::WebPath%>/index.html"> +<& /Elements/Refresh, Name => 'HomeRefreshInterval', Default => $session {'home_refresh_interval'} &> +<div align=right><input type=submit value="<&|/l&>Go!</&>"></div> +</form> +</TD> +</TR> +</TABLE> +<%init> + +my @results; + +if ($ARGS{'QuickCreate'} ) { + my $ticket = RT::Ticket->new($session{'CurrentUser'}); + my ($tid, $trans, $tmsg) = $ticket->Create(Queue => $ARGS{'Queue'}, + Owner => $ARGS{'Owner'}, + Subject => $ARGS{'Subject'}); + + + push (@results, $tmsg); +} + + +if ( $ARGS{'q'} ) { + my $query = $ARGS{'q'}; + + if ( $query =~ m/^\s*(\d+)\s*$/ ) { + $m->comp("/Ticket/Display.html" , id=> $1); + return(); + } + + if ($m->comp('/Elements/Callback', _CallbackName => 'SearchPreFilter', + query => $query, %ARGS)) { + return(); + } + + $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} ); + + if ( $query =~ m/\@/ ) { + $m->comp("/Search/Results.html", Query => "Requestor = '$query'"); + + return(); + } + + # + # Any search on queue name or subject will be for new/open tickets + # only. + # + + my $status = "Status = 'new' OR Status = 'open'"; + + my $queue = RT::Queue->new( $session{'CurrentUser'} ); + if ( $queue->Load($query) && $queue->Id ) { + $m->comp("/Search/Results.html", Query => "Queue = '" . $queue->Id . "' AND ($status)"); + return(); + } + + $m->comp("/Search/Results.html", Query => "Subject LIKE '$query' AND ($status)"); + return(); + +} + +if ($ARGS{'HomeRefreshInterval'}) { + $session{'home_refresh_interval'} = $ARGS{'HomeRefreshInterval'}; +} + +</%init> + +%# --></body></html> diff --git a/rt/html/l b/rt/html/l new file mode 100644 index 000000000..dbd146e57 --- /dev/null +++ b/rt/html/l @@ -0,0 +1,50 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%init> + my $hand = ($session{'CurrentUser'} ||= RT::CurrentUser->new)->LanguageHandle; + $m->print($hand->maketext($m->content,@_)); + return(1); +</%init> |