diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-06-07 00:56:06 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-06-07 00:56:06 -0700 |
commit | 43a06151e47d2c59b833cbd8c26d97865ee850b6 (patch) | |
tree | 42c51d94e7fa265461b508d061562be204ccc2c1 /rt/share/html/Admin | |
parent | 6587f6ba7d047ddc1686c080090afe7d53365bd4 (diff) |
starting to work...
Diffstat (limited to 'rt/share/html/Admin')
108 files changed, 864 insertions, 2347 deletions
diff --git a/rt/share/html/Admin/CustomFields/GroupRights.html b/rt/share/html/Admin/CustomFields/GroupRights.html index 2c516d0b2..31c09afc0 100644 --- a/rt/share/html/Admin/CustomFields/GroupRights.html +++ b/rt/share/html/Admin/CustomFields/GroupRights.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,54 +46,16 @@ %# %# 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/Tabs &> <& /Elements/ListActions, actions => \@results &> - <form method="post" action="GroupRights.html"> + <form method="post" action="GroupRights.html" id="ModifyGroupRights" name="ModifyGroupRights"> <input type="hidden" class="hidden" name="id" value="<% $CustomFieldObj->id %>" /> - - -<h1><&|/l&>System groups</&></h1> -<table> -% my $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 &> - + + <& /Admin/Elements/EditRights, Context => $CustomFieldObj, Principals => \@principals &> + <& /Elements/Submit, Label => loc('Save Changes') &> </form> - + <%INIT> if (!defined $id) { @@ -103,10 +65,12 @@ if (!defined $id) { my $CustomFieldObj = RT::CustomField->new($session{'CurrentUser'}); $CustomFieldObj->Load($id) || $m->comp("/Elements/Error", Why => loc("Couldn't load CustomField [_1]",$id)); -my @results = ProcessACLChanges( \%ARGS ); +my @results = ProcessACLs( \%ARGS ); my $title = loc('Modify group rights for custom field [_1]', $CustomFieldObj->Name); - + +# Principal collections +my @principals = GetPrincipalsMap($CustomFieldObj, qw(System Groups)); </%INIT> <%ARGS> diff --git a/rt/share/html/Admin/CustomFields/Modify.html b/rt/share/html/Admin/CustomFields/Modify.html index 249fdb1b4..20c3e9c4e 100644 --- a/rt/share/html/Admin/CustomFields/Modify.html +++ b/rt/share/html/Admin/CustomFields/Modify.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,23 +46,20 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/CustomFieldTabs, - id => $CustomFieldObj->Id , - current_tab => $current_tab, - Title => $title &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> -<form method="post" action="Modify.html" name="ModifyCustomField"> +<form method="post" action="Modify.html" name="ModifyCustomField" id="ModifyCustomField"> <input type="hidden" class="hidden" name="id" value="<% $id %>" /> <table> <tr><td class="label"><&|/l&>Name</&></td> -<td><input name="Name" value="<% $CustomFieldObj->Name || '' %>" size="20" /></td></tr> +<td><input name="Name" value="<% $CustomFieldObj->Name || $Name || '' %>" size="20" /></td></tr> <tr><td class="label"><&|/l&>Description</&></td> -<td><input name="Description" value="<% $CustomFieldObj->Description || '' %>" size="80" /></td></tr> +<td><input name="Description" value="<% $CustomFieldObj->Description || $Description || '' %>" size="80" /></td></tr> <tr><td class="label"><&|/l&>Type</&></td> <td><& /Admin/Elements/SelectCustomFieldType, @@ -70,6 +67,19 @@ Default => $CustomFieldObj->TypeComposite, &> </td></tr> +% if ( $CustomFieldObj->Id and $CustomFieldObj->HasRenderTypes ) { +<tr> + <td class="label"><&|/l&>Render Type</&></td> + <td> + <& /Admin/Elements/SelectCustomFieldRenderType, + Name => "RenderType", + TypeComposite => $CustomFieldObj->TypeComposite, + Default => $CustomFieldObj->RenderType, + BasedOn => $CustomFieldObj->BasedOnObj->id, &> + </td> +</tr> +% } + % if ( $CustomFieldObj->Id and $CustomFieldObj->IsSelectionType and RT->Config->Get('CustomFieldValuesSources') and ( scalar(@{RT->Config->Get('CustomFieldValuesSources')}) > 0 ) ) { <tr><td class="label"><&|/l&>Field values source:</&></td><td> <& /Admin/Elements/EditCustomFieldValuesSource, CustomField => $CustomFieldObj &> @@ -79,7 +89,7 @@ <tr><td class="label"><&|/l&>Applies to</&></td> <td><& /Admin/Elements/SelectCustomFieldLookupType, Name => "LookupType", - Default => $CustomFieldObj->LookupType, &> + Default => $CustomFieldObj->LookupType || $LookupType, &> </td></tr> % if ( $CustomFieldObj->Id @@ -90,42 +100,44 @@ </td></tr> % } -<tr><td class="label"><&|/l&>Validation</&></td> +<tr class="edit_validation"><td class="label"><&|/l&>Validation</&></td> <td><& /Widgets/ComboBox, Name => 'Pattern', - Default => $CustomFieldObj->Pattern, + Default => $CustomFieldObj->Pattern || $Pattern, Size => 20, Values => \@CFvalidations, &></td></tr> <tr><td class="label"><&|/l&>Link values to</&></td><td> -<input size="60" name="LinkValueTo" value="<% $CustomFieldObj->LinkValueTo || '' %>" /> +<input size="60" name="LinkValueTo" value="<% $CustomFieldObj->LinkValueTo || $LinkValueTo || '' %>" /> <div class="hints"> <&|/l&>RT can make this custom field's values into hyperlinks to another service.</&> <&|/l&>Fill in this field with a URL.</&> -<&|/l&>RT will replace <tt>__id__</tt> and <tt>__CustomField__</tt> with the record id and custom field value, respectively</&> +<&|/l, '<tt>__id__</tt>', '<tt>__CustomField__</tt>' &>RT will replace [_1] and [_2] with the record's id and the custom field's value, respectively.</&> </div></td></tr> <tr><td class="label"><&|/l&>Include page</&></td><td> -<input size="60" name="IncludeContentForValue" value="<% $CustomFieldObj->IncludeContentForValue || '' %>" /> +<input size="60" name="IncludeContentForValue" value="<% $CustomFieldObj->IncludeContentForValue || $IncludeContentForValue || '' %>" /> <div class="hints"> <&|/l&>RT can include content from another web service when showing this custom field.</&> <&|/l&>Fill in this field with a URL.</&> -<&|/l&>RT will replace <tt>__id__</tt> and <tt>__CustomField__</tt> with the record id and custom field value, respectively</&> +<&|/l, '<tt>__id__</tt>', '<tt>__CustomField__</tt>' &>RT will replace [_1] and [_2] with the record's id and the custom field's value, respectively.</&> <i><&|/l&>Some browsers may only load content from the same domain as your RT server.</&></i> </div></td></tr> % if ( $CustomFieldObj->Id && $CustomFieldObj->IsSelectionType && !$CustomFieldObj->IsExternalValues ) { -<tr><td class="label"><&|/l&>Categories are based on</&></td><td> +<tr class="categoriesbasedon"><td class="label"><&|/l&>Categories are based on</&></td><td> <& /Admin/Elements/SelectCustomField, Name => "BasedOn", LookupType => $CustomFieldObj->LookupType, - Default => $CustomFieldObj->BasedOnObj, + Default => $CustomFieldObj->BasedOnObj || $BasedOn, Not => $CustomFieldObj->id, &> </td></tr> % } +% $m->callback(CallbackName => 'BeforeEnabled', CustomField => $CustomFieldObj, CFvalidations => \@CFvalidations); + <tr><td class="label"> </td><td> <input type="checkbox" class="checkbox" name="Required" value="1" <% $RequiredChecked |n%> /> <&|/l&>Required for ticket resolution</&> @@ -137,6 +149,8 @@ <&|/l&>Enabled (Unchecking this box disables this custom field)</&> </td></tr> +% $m->callback(CallbackName => 'EndOfTable', CustomField => $CustomFieldObj, CFvalidations => \@CFvalidations); + </table> % if ( $CustomFieldObj->Id && $CustomFieldObj->IsSelectionType && !$CustomFieldObj->IsExternalValues ) { @@ -151,15 +165,15 @@ </form> <%INIT> -my ($title, @results, $Disabled); +my ($title, @results); my $CustomFieldObj = RT::CustomField->new( $session{'CurrentUser'} ); -my $current_tab = 'Admin/CustomFields/Modify.html'; + +$m->callback(CallbackName => 'Initial', Pattern => \$Pattern, ARGSRef => \%ARGS); unless ( $id ) { $title = loc("Create a CustomField"); $id = 'new'; - $current_tab .= '?Create=1'; } else { if ( $id eq 'new' ) { @@ -172,20 +186,27 @@ else { LinkValueTo => $LinkValueTo, IncludeContentForValue => $IncludeContentForValue, BasedOn => $BasedOn, + Disabled => !$Enabled, ); - $m->comp( "/Elements/Error", Why => loc( "Could not create CustomField", $msg ) ) unless $val; - push @results, $msg; - $title = loc( 'Created CustomField [_1]', $CustomFieldObj->Name ); + if (!$val) { + push @results, loc("Could not create CustomField: [_1]", $msg); + $title = loc( 'Create a CustomField'); + } + else { + push @results, loc("Object created"); + $title = loc( 'Created CustomField [_1]', $CustomFieldObj->Name ); + } } else { - $CustomFieldObj->Load( $id ) || $m->comp("/Elements/Error", Why => loc('No CustomField') ); + push @results, loc('No CustomField') + unless $CustomFieldObj->Load( $id ); + $title = loc( 'Editing CustomField [_1]', $CustomFieldObj->Name ); } - $current_tab .= "?id=$id"; } if ( $ARGS{'Update'} && $id ne 'new' ) { #we're asking about enabled on the web page but really care about disabled. - $ARGS{'Disabled'} = $Disabled = $Enabled? 0 : 1; + $ARGS{'Disabled'} = $Enabled? 0 : 1; $ARGS{'Required'} ||= 0; @@ -197,7 +218,32 @@ if ( $ARGS{'Update'} && $id ne 'new' ) { ); $CustomFieldObj->SetValuesClass( $ValuesClass ); - $CustomFieldObj->SetBasedOn( $BasedOn ); + # Set the render type if we have it, but unset it if the new type doesn't + # support render types + if ( $CustomFieldObj->HasRenderTypes($TypeComposite) ) { + my $original = $CustomFieldObj->RenderType; + + if ( defined $RenderType and $RenderType ne $original ) { + # It's changed! Let's update it. + my ($good, $msg) = $CustomFieldObj->SetRenderType( $RenderType ); + + if ( $good ) { + $msg = loc("[_1] changed from '[_2]' to '[_3]'", + loc("Render Type"), $original, $RenderType ); + } + + push @results, $msg; + } + } + else { + # Delete it if we no longer support render types + $CustomFieldObj->SetRenderType( undef ); + } + + if (($CustomFieldObj->BasedOn||'') ne ($BasedOn||'')) { + my ($good, $msg) = $CustomFieldObj->SetBasedOn( $BasedOn ); + push @results, $msg; + } $CustomFieldObj->SetUILocation( $UILocation ); @@ -227,10 +273,12 @@ if ( $ARGS{'Update'} && $id ne 'new' ) { $ARGS{$param} =~ s/^\s+//; $ARGS{$param} =~ s/\s+$//; next if ($value->$attr()||'') eq ($ARGS{$param}||''); + my $mutator = "Set$attr"; my ($id, $msg) = $value->$mutator( $ARGS{$param} ); push (@results, $msg); } + $m->callback(CallbackName => 'AfterUpdateCustomFieldValue', CustomFieldObj => $CustomFieldObj, CustomFieldValueObj => $value, ARGSRef => \%ARGS ); } # Add any new values @@ -242,11 +290,23 @@ if ( $ARGS{'Update'} && $id ne 'new' ) { $_ => $ARGS{ $paramtag ."-new-$_" } } qw/ Name Description SortOrder Category/ ); push (@results, $msg); + + my $cfv = RT::CustomFieldValue->new( $session{CurrentUser} ); + $cfv->Load($id); + $m->callback(CallbackName => 'AfterCreateCustomFieldValue', +CustomFieldObj => $CustomFieldObj, CustomFieldValueObj => $cfv, ARGSRef => \%ARGS ); } } $id = $CustomFieldObj->id if $CustomFieldObj->id; +# This code does automatic redirection if any updates happen. +MaybeRedirectForResults( + Actions => \@results, + Arguments => { id => $id }, +) if $CustomFieldObj->id; + + my $EnabledChecked = qq[checked="checked"]; $EnabledChecked = '' if $CustomFieldObj->Disabled; @@ -274,6 +334,7 @@ $Name => undef $SetEnabled => undef $Enabled => 0 $ValuesClass => 'RT::CustomFieldValues' +$RenderType => undef $LinkValueTo => undef $IncludeContentForValue => undef $BasedOn => undef diff --git a/rt/share/html/Admin/CustomFields/Objects.html b/rt/share/html/Admin/CustomFields/Objects.html index 8fb00a812..91dc5dcfb 100644 --- a/rt/share/html/Admin/CustomFields/Objects.html +++ b/rt/share/html/Admin/CustomFields/Objects.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,11 +46,7 @@ %# %# 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/Tabs &> <& /Elements/ListActions, actions => \@results &> @@ -67,6 +63,7 @@ <input type="checkbox" name="AddCustomField-<% $CF->id %>" value="0" /> <&|/l&>check this box to apply this Custom Field to all objects.</&> +% unless ( $CF->ApplyGlobally ) { <h2><&|/l&>Selected objects</&></h2> <& /Elements/CollectionList, OrderBy => 'id', @@ -102,12 +99,14 @@ % } +% } + <& /Elements/Submit, Name => 'UpdateObjs' &> </form> <%INIT> my $CF = RT::CustomField->new($session{'CurrentUser'}); -$CF->Load($id) or Abort(loc("Could not load CustomField [_1]"), $id); +$CF->Load($id) or Abort(loc("Could not load CustomField [_1]", $id)); my $class = $CF->RecordClassFromLookupType; Abort(loc("Something wrong. Contact system administrator")) diff --git a/rt/share/html/Admin/CustomFields/UserRights.html b/rt/share/html/Admin/CustomFields/UserRights.html index f581588a8..608d5dc40 100644 --- a/rt/share/html/Admin/CustomFields/UserRights.html +++ b/rt/share/html/Admin/CustomFields/UserRights.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,43 +46,17 @@ %# %# 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/Tabs &> <& /Elements/ListActions, actions => \@results &> - <form method="post" action="UserRights.html"> + <form method="post" action="UserRights.html" name="ModifyUserRights" id="ModifyUserRights"> <input type="hidden" class="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"><& /Elements/ShowUser, User => $UserObj &></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 &> - + <& /Admin/Elements/EditRights, Context => $CustomFieldObj, Principals => \@principals &> + <& /Elements/Submit, Label => loc('Save Changes') &> </form> - <%INIT> - -#Update the acls. -my @results = ProcessACLChanges( \%ARGS ); - -# {{{ Deal with setting up the display of current rights. - - +# Update the acls. +my @results = ProcessACLs( \%ARGS ); if (!defined $id) { $m->comp("/Elements/Error", Why => loc("No Class defined")); @@ -91,20 +65,12 @@ if (!defined $id) { 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); - -# }}} - + +# Principal collections +my @principals = GetPrincipalsMap($CustomFieldObj, qw(Users)); </%INIT> <%ARGS> $id => undef -$UserString => undef -$UserOp => undef -$UserField => undef </%ARGS> diff --git a/rt/share/html/Admin/CustomFields/index.html b/rt/share/html/Admin/CustomFields/index.html index 2835b1292..b8bc447d2 100644 --- a/rt/share/html/Admin/CustomFields/index.html +++ b/rt/share/html/Admin/CustomFields/index.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,10 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/CustomFieldTabs, - current_tab => 'Admin/CustomFields/', - Title => $title, -&> +<& /Elements/Tabs &> % my $tmp = RT::CustomField->new( $session{'CurrentUser'} ); % if ( $Type ) { @@ -84,6 +81,8 @@ <&|/l&>Include disabled custom fields in listing.</&> <br /> +% $m->callback(CallbackName => 'BeforeSubmit'); + <input type="submit" value="<% loc('Go!') %>" /> </form> @@ -107,6 +106,8 @@ $CustomFields->UnLimit; $CustomFields->FindAllRows if $ShowDisabled; $CustomFields->LimitToLookupType( $Type ) if $Type; +$m->callback(CallbackName => 'MassageCustomFields', CustomFields => $CustomFields); + $Format ||= RT->Config->Get('AdminSearchResultFormat')->{'CustomFields'}; </%INIT> diff --git a/rt/share/html/Admin/Elements/AddCustomFieldValue b/rt/share/html/Admin/Elements/AddCustomFieldValue index 4871f7a17..4a68c369d 100755 --- a/rt/share/html/Admin/Elements/AddCustomFieldValue +++ b/rt/share/html/Admin/Elements/AddCustomFieldValue @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -54,7 +54,7 @@ <th><&|/l&>Name</&></th> <th><&|/l&>Description</&></th> % if ( $CustomField->Type ne 'Combobox' ) { -<th><&|/l&>Category</&></th> +<th class="categoryheader"><&|/l&>Category</&></th> % } </tr> @@ -68,16 +68,18 @@ % my $BasedOnObj = $CustomField->BasedOnObj; % if ( $BasedOnObj and $BasedOnObj->id ) { % my $Categories = $BasedOnObj->Values; -<select name="<% $paramtag %>-Category" size="1"> +<select class="editcategory" name="<% $paramtag %>-Category" size="1"> <option value=""><&|/l&>(no value)</&></option> % while (my $Value = $Categories->Next) { <option value="<% $Value->Name %>"><% $Value->Name %></option> % } % } else { -<input type="text" size="10" name="<% $paramtag %>-Category" value="" /> +<input type="text" size="10" class="editcategory" name="<% $paramtag %>-Category" value="" /> % } </td> % } + +% $m->callback(CallbackName => 'AfterCustomFieldValueInput', CustomFieldObj => $CustomField, ARGSRef => \%ARGS ); </tr> </table> diff --git a/rt/share/html/Admin/Elements/ConfigureMyRT b/rt/share/html/Admin/Elements/ConfigureMyRT index f9b472d99..8b625a901 100644 --- a/rt/share/html/Admin/Elements/ConfigureMyRT +++ b/rt/share/html/Admin/Elements/ConfigureMyRT @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/CreateUserCalled b/rt/share/html/Admin/Elements/CreateUserCalled index bf994be85..5f83f4b3d 100755 --- a/rt/share/html/Admin/Elements/CreateUserCalled +++ b/rt/share/html/Admin/Elements/CreateUserCalled @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/CustomFieldTabs b/rt/share/html/Admin/Elements/CustomFieldTabs deleted file mode 100644 index 17b241cb7..000000000 --- a/rt/share/html/Admin/Elements/CustomFieldTabs +++ /dev/null @@ -1,121 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@bestpractical.com> -%# -%# (Except where explicitly superseded by other copyright notices) -%# -%# -%# LICENSE: -%# -%# This work is made available to you under the terms of Version 2 of -%# the GNU General Public License. A copy of that license should have -%# been provided with this software, but in any event can be snarfed -%# from www.gnu.org. -%# -%# This work is distributed in the hope that it will be useful, but -%# WITHOUT ANY WARRANTY; without even the implied warranty of -%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -%# General Public License for more details. -%# -%# You should have received a copy of the GNU General Public License -%# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. -%# -%# -%# CONTRIBUTION SUBMISSION POLICY: -%# -%# (The following paragraph is not intended to limit the rights granted -%# to you to modify and distribute this software under the terms of -%# the GNU General Public License and is only of importance to you if -%# you choose to contribute your changes and enhancements to the -%# community by submitting them to Best Practical Solutions, LLC.) -%# -%# By intentionally submitting any modifications, corrections or -%# derivatives to this work, or any other work intended for use with -%# Request Tracker, to Best Practical Solutions, LLC, you confirm that -%# you are the copyright holder for those contributions and you grant -%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -%# royalty-free, perpetual, license 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|Group)(?:\Z|-)/i) { - $tabs->{'this'}->{subtabs}->{D} = { - title => loc('Applies to'), - path => "Admin/CustomFields/Objects.html?id=" . $id, - }; - } -} - -if ( $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminCustomField') - || $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminCustomFieldValues') ) { - $tabs->{"A"} = { title => loc('Select'), - path => "Admin/CustomFields/", - }; -} -if ($session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminCustomField')) { - $tabs->{"B"} = { title => loc('Create'), - path => "Admin/CustomFields/Modify.html?Create=1", - separator => 1, - }; -} - - # Now let callbacks add their extra tabs - $m->callback( %ARGS, tabs => $tabs ); - -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/share/html/Admin/Elements/EditCustomField b/rt/share/html/Admin/Elements/EditCustomField index 920698d98..632b3d8f8 100755 --- a/rt/share/html/Admin/Elements/EditCustomField +++ b/rt/share/html/Admin/Elements/EditCustomField @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/EditCustomFieldValues b/rt/share/html/Admin/Elements/EditCustomFieldValues index c2a027b81..4d0dc51b8 100755 --- a/rt/share/html/Admin/Elements/EditCustomFieldValues +++ b/rt/share/html/Admin/Elements/EditCustomFieldValues @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -58,7 +58,7 @@ <th><&|/l&>Name</&></th> <th><&|/l&>Description</&></th> % if ($CustomField->Type ne 'Combobox') { -<th><&|/l&>Category</&></th> +<th class="categoryheader"><&|/l&>Category</&></th> % } </tr> @@ -68,22 +68,23 @@ <td><input type="checkbox" class="checkbox" name="Delete-<% $paramtag %>" /></td> <td><input type="text" size="3" name="<% $paramtag %>-SortOrder" value="<% $value->SortOrder %>" /></td> <td><input type="text" size="25" name="<% $paramtag %>-Name" value="<% $value->Name %>" /></td> -<td><input type="text" size="45" name="<% $paramtag %>-Description" value="<% $value->Description %>" /></td> +<td><input type="text" size="45" name="<% $paramtag %>-Description" value="<% $value->Description || '' %>" /></td> % if ( $CustomField->Type ne 'Combobox' ) { <td> % if ( $Categories ) { % my $selected = $value->Category; % $selected = '' unless defined $selected; -<select name="<% $paramtag %>-Category" size="1"> +<select class="editcategory" name="<% $paramtag %>-Category" size="1"> <option value=""<% $selected eq '' ? q[ selected="selected"] : "" |n%>><&|/l&>(no value)</&></option> % while (my $Value = $Categories->Next) { <option value="<% $Value->Name %>"<% $selected eq $Value->Name ? q[ selected="selected"] : "" |n%>><% $Value->Name %></option> % } % } else { -<input type="text" size="10" name="<% $paramtag %>-Category" value="<% $value->Category || '' %>" /> +<input type="text" size="10" class="editcategory" name="<% $paramtag %>-Category" value="<% $value->Category || '' %>" /> % } </td> % } +% $m->callback(CallbackName => 'AfterCustomFieldValueInput', CustomFieldObj => $CustomField, CustomFieldValueObj => $value, ARGSRef => \%ARGS ); </tr> % } diff --git a/rt/share/html/Admin/Elements/EditCustomFieldValuesSource b/rt/share/html/Admin/Elements/EditCustomFieldValuesSource index 9455c74db..5b11ec8e0 100644 --- a/rt/share/html/Admin/Elements/EditCustomFieldValuesSource +++ b/rt/share/html/Admin/Elements/EditCustomFieldValuesSource @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/EditCustomFields b/rt/share/html/Admin/Elements/EditCustomFields index 91d5cffaa..aa7b62204 100755 --- a/rt/share/html/Admin/Elements/EditCustomFields +++ b/rt/share/html/Admin/Elements/EditCustomFields @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/EditQueueWatchers b/rt/share/html/Admin/Elements/EditQueueWatchers index 017c9ec8e..073278c9e 100755 --- a/rt/share/html/Admin/Elements/EditQueueWatchers +++ b/rt/share/html/Admin/Elements/EditQueueWatchers @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/EditScrip b/rt/share/html/Admin/Elements/EditScrip index c2e9de19f..858ab9d9b 100755 --- a/rt/share/html/Admin/Elements/EditScrip +++ b/rt/share/html/Admin/Elements/EditScrip @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -47,7 +47,7 @@ %# END BPS TAGGED BLOCK }}} <& /Elements/ListActions, actions => \@actions &> -<form method="post" action="Scrip.html"> +<form method="post" action="Scrip.html" id="ModifyScrip" name="ModifyScrip"> <input type="hidden" class="hidden" name="id" value="<% $id %>" /> <input type="hidden" class="hidden" name="Queue" value="<% $Queue %>" /> @@ -55,12 +55,13 @@ <table> <tr><td align="right"><&|/l&>Description</&>:</td><td> -<input name="Scrip-<% $id %>-Description" - size="60" +<tr><td class="label"><&|/l&>Description</&>:</td><td class="value">\ +<input name="Scrip-<% $id %>-Description" \ + size="60" \ value="<% $ARGS{"Scrip-$id-Description"} || $scrip->Description || '' %>" /> </td></tr> -<tr><td align="right"><&|/l&>Condition</&>:</td><td> +<tr><td class="label"><&|/l&>Condition</&>:</td><td class="value">\ <& /Admin/Elements/SelectScripCondition, Name => "Scrip-$id-ScripCondition", Default => $ARGS{"Scrip-$id-ScripCondition"} || $scrip->ConditionObj->Id, @@ -75,7 +76,7 @@ ScripX => $ARGS{"Scrip-$id-ScripCondition"} || $scrip->ConditionObj->Id, &> -<tr><td align="right"><&|/l&>Action</&>:</td><td> +<tr><td class="label"><&|/l&>Action</&>:</td><td class="value">\ <& /Admin/Elements/SelectScripAction, Name => "Scrip-$id-ScripAction", Default => $ARGS{"Scrip-$id-ScripAction"} || $scrip->ActionObj->Id, @@ -90,14 +91,14 @@ ScripX => $ARGS{"Scrip-$id-ScripAction"} || $scrip->ActionObj->Id, &> -<tr><td align="right"><&|/l&>Template</&>:</td><td> +<tr><td class="label"><&|/l&>Template</&>:</td><td class="value">\ <& /Admin/Elements/SelectTemplate, Name => "Scrip-$id-Template", Default => $ARGS{"Scrip-$id-Template"} || $scrip->TemplateObj->Id, Queue => $Queue, &></td></tr> -<tr><td align="right"><&|/l&>Stage</&>:</td><td> +<tr><td class="label"><&|/l&>Stage</&>:</td><td class="value">\ <& /Admin/Elements/SelectStage, Name => "Scrip-$id-Stage", Default => $ARGS{"Scrip-$id-Stage"} || $scrip->Stage, @@ -106,6 +107,7 @@ </table> </&> +% if ($session{CurrentUser}->HasRight(Object => $RT::System, Right => 'ExecuteCode')) { <& /Elements/Submit, Label => $SubmitLabel, Reset => 1, @@ -117,21 +119,21 @@ <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> +<tr><td class="labeltop"><&|/l&>Custom condition</&>:</td><td class="value"> % my $code = $ARGS{"Scrip-$id-CustomIsApplicableCode"} || $scrip->CustomIsApplicableCode || ''; % my $lines = @{[ $code =~ /\n/gs ]} + 3; % $lines = $min_lines if $lines < $min_lines; <textarea cols="80" rows="<% $lines %>" name="Scrip-<% $id %>-CustomIsApplicableCode"><% $code %></textarea> </td></tr> -<tr><td class="labeltop"><&|/l&>Custom action preparation code</&>:</td><td> +<tr><td class="labeltop"><&|/l&>Custom action preparation code</&>:</td><td class="value"> % $code = $ARGS{"Scrip-$id-CustomPrepareCode"} || $scrip->CustomPrepareCode || ''; % $lines = @{[ $code =~ /\n/gs ]} + 3; % $lines = $min_lines if $lines < $min_lines; <textarea cols="80" rows="<% $lines %>" name="Scrip-<% $id %>-CustomPrepareCode"><% $code %></textarea> </td></tr> -<tr><td class="labeltop"><&|/l&>Custom action cleanup code</&>:</td><td> +<tr><td class="labeltop"><&|/l&>Custom action cleanup code</&>:</td><td class="value"> % $code = $ARGS{"Scrip-$id-CustomCommitCode"} || $scrip->CustomCommitCode || ''; % $lines = @{[ $code =~ /\n/gs ]} + 3; % $lines = $min_lines if $lines < $min_lines; @@ -141,6 +143,8 @@ </table> </&> +% } + <& /Elements/Submit, Label => $SubmitLabel, Reset => 1, @@ -167,6 +171,9 @@ unless ( $id ) { my $min_lines = 10; +my ($ok, $msg) = $scrip->CompileCheck; +push @actions, $msg if !$ok; + </%init> <%ARGS> diff --git a/rt/share/html/Admin/Elements/EditScrips b/rt/share/html/Admin/Elements/EditScrips index be208d6c4..2fdcae670 100755 --- a/rt/share/html/Admin/Elements/EditScrips +++ b/rt/share/html/Admin/Elements/EditScrips @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -89,12 +89,14 @@ if ( $id ) { if ($QueueObj->id) { $Scrips->LimitToQueue($id); + $Format ||= RT->Config->Get('AdminSearchResultFormat')->{'Scrips'}; } else { $Scrips->LimitToGlobal(); + $Format ||= RT->Config->Get('AdminSearchResultFormat')->{'GlobalScrips'}; } -# {{{ deal with modifying and deleting existing scrips +# deal with modifying and deleting existing scrips # we still support DeleteScrip-id format but array is preferred foreach my $id ( grep $_, @DeleteScrip, map /^DeleteScrip-(\d+)/, keys %ARGS ) { my $scrip = RT::Scrip->new($session{'CurrentUser'}); @@ -107,10 +109,6 @@ foreach my $id ( grep $_, @DeleteScrip, map /^DeleteScrip-(\d+)/, keys %ARGS ) { push @actions, $msg; } } -# }}} - -$Format ||= RT->Config->Get('AdminSearchResultFormat')->{'Scrips'}; - </%init> <%ARGS> diff --git a/rt/share/html/Admin/Elements/EditTemplates b/rt/share/html/Admin/Elements/EditTemplates index 5839720e0..2f681aca3 100755 --- a/rt/share/html/Admin/Elements/EditTemplates +++ b/rt/share/html/Admin/Elements/EditTemplates @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/EditUserComments b/rt/share/html/Admin/Elements/EditUserComments index 9fb2230e8..28563c6a4 100755 --- a/rt/share/html/Admin/Elements/EditUserComments +++ b/rt/share/html/Admin/Elements/EditUserComments @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/GlobalCustomFieldTabs b/rt/share/html/Admin/Elements/GlobalCustomFieldTabs deleted file mode 100755 index 475681b05..000000000 --- a/rt/share/html/Admin/Elements/GlobalCustomFieldTabs +++ /dev/null @@ -1,105 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@bestpractical.com> -%# -%# (Except where explicitly superseded by other copyright notices) -%# -%# -%# LICENSE: -%# -%# This work is made available to you under the terms of Version 2 of -%# the GNU General Public License. A copy of that license should have -%# been provided with this software, but in any event can be snarfed -%# from www.gnu.org. -%# -%# This work is distributed in the hope that it will be useful, but -%# WITHOUT ANY WARRANTY; without even the implied warranty of -%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -%# General Public License for more details. -%# -%# You should have received a copy of the GNU General Public License -%# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. -%# -%# -%# CONTRIBUTION SUBMISSION POLICY: -%# -%# (The following paragraph is not intended to limit the rights granted -%# to you to modify and distribute this software under the terms of -%# the GNU General Public License and is only of importance to you if -%# you choose to contribute your changes and enhancements to the -%# community by submitting them to Best Practical Solutions, LLC.) -%# -%# By intentionally submitting any modifications, corrections or -%# derivatives to this work, or any other work intended for use with -%# Request Tracker, to Best Practical Solutions, LLC, you confirm that -%# you are the copyright holder for those contributions and you grant -%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -%# royalty-free, perpetual, license 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('Select custom fields for all users'), - path => 'Admin/Global/CustomFields/Users.html', - }, - - B => { - title => loc('Groups'), - text => loc('Select custom fields for all user groups'), - path => 'Admin/Global/CustomFields/Groups.html', - }, - - C => { - title => loc('Queues'), - text => loc('Select custom fields for all queues'), - path => 'Admin/Global/CustomFields/Queues.html', - }, - - F => { - title => loc('Tickets'), - text => loc('Select custom fields for tickets in all queues'), - path => 'Admin/Global/CustomFields/Queue-Tickets.html', - }, - - G => { - title => loc('Ticket Transactions'), - text => loc('Select custom fields for transactions on tickets in all queues'), - path => 'Admin/Global/CustomFields/Queue-Transactions.html', - }, - -}; - # Now let callbacks add their extra tabs - $m->callback( %ARGS, tabs => $tabs ); - - 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 => '' -$subtabs => undef -$current_subtab => undef -$Title => undef -</%ARGS> diff --git a/rt/share/html/Admin/Elements/GroupTabs b/rt/share/html/Admin/Elements/GroupTabs deleted file mode 100755 index 7a677ee3c..000000000 --- a/rt/share/html/Admin/Elements/GroupTabs +++ /dev/null @@ -1,102 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@bestpractical.com> -%# -%# (Except where explicitly superseded by other copyright notices) -%# -%# -%# LICENSE: -%# -%# This work is made available to you under the terms of Version 2 of -%# the GNU General Public License. A copy of that license should have -%# been provided with this software, but in any event can be snarfed -%# from www.gnu.org. -%# -%# This work is distributed in the hope that it will be useful, but -%# WITHOUT ANY WARRANTY; without even the implied warranty of -%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -%# General Public License for more details. -%# -%# You should have received a copy of the GNU General Public License -%# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. -%# -%# -%# CONTRIBUTION SUBMISSION POLICY: -%# -%# (The following paragraph is not intended to limit the rights granted -%# to you to modify and distribute this software under the terms of -%# the GNU General Public License and is only of importance to you if -%# you choose to contribute your changes and enhancements to the -%# community by submitting them to Best Practical Solutions, LLC.) -%# -%# By intentionally submitting any modifications, corrections or -%# derivatives to this work, or any other work intended for use with -%# Request Tracker, to Best Practical Solutions, LLC, you confirm that -%# you are the copyright holder for those contributions and you grant -%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -%# royalty-free, perpetual, license 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'), - path => "Admin/Groups/", }; -$tabs->{"B"} = { title => loc('Create'), - path => "Admin/Groups/Modify.html?Create=1", - separator => 1, }; - -# Now let callbacks add their extra tabs -$m->callback( %ARGS, tabs => $tabs ); -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/share/html/Admin/Elements/Header b/rt/share/html/Admin/Elements/Header index fac422520..afb745e0d 100755 --- a/rt/share/html/Admin/Elements/Header +++ b/rt/share/html/Admin/Elements/Header @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/ListGlobalCustomFields b/rt/share/html/Admin/Elements/ListGlobalCustomFields index 1fd8b768b..1d1cd392d 100755 --- a/rt/share/html/Admin/Elements/ListGlobalCustomFields +++ b/rt/share/html/Admin/Elements/ListGlobalCustomFields @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -56,6 +56,6 @@ % } <%init> -my $CustomFields = new RT::CustomFields ($session{'CurrentUser'}); +my $CustomFields = RT::CustomFields->new ($session{'CurrentUser'}); $CustomFields->LimitToGlobal(); </%INIT> diff --git a/rt/share/html/Admin/Elements/ListGlobalScrips b/rt/share/html/Admin/Elements/ListGlobalScrips index 7f1039ed9..701ffbfa7 100755 --- a/rt/share/html/Admin/Elements/ListGlobalScrips +++ b/rt/share/html/Admin/Elements/ListGlobalScrips @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -56,15 +56,12 @@ %ARGS, Format => $Format, Collection => $Scrips, - ShowHeader => 0, &> % } <%init> -my $Format = q{'<a href="__WebPath__/Admin/Global/Scrip.html?id=__id__&Queue=0">__id__</a>/TITLE:#'} - .q{,'<a href="__WebPath__/Admin/Global/Scrip.html?id=__id__&Queue=0">__AutoDescription__</a>/TITLE:Condition, Action and Template'} - .q{__NEWLINE__,'','<small>__Description__</small>'}; +my $Format = RT->Config->Get('AdminSearchResultFormat')->{'GlobalScrips'}; my $Scrips = RT::Scrips->new( $session{'CurrentUser'} ); $Scrips->LimitToGlobal; diff --git a/rt/share/html/Admin/Elements/ModifyTemplate b/rt/share/html/Admin/Elements/ModifyTemplate index 062090531..ebe7c73bc 100755 --- a/rt/share/html/Admin/Elements/ModifyTemplate +++ b/rt/share/html/Admin/Elements/ModifyTemplate @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -47,38 +47,35 @@ %# END BPS TAGGED BLOCK }}} <table> <tr> -<td align="right"> -<&|/l&>Name</&>: -</td> -<td> -<input name="Name" value="<%$Name%>" size="20" /><br /> -</td> +<td class="label"><&|/l&>Name</&>:</td> +<td class="value"><input name="Name" value="<%$Name||''%>" size="20" /></td> </tr> <tr> -<td align="right"> -<&|/l&>Description</&>: -</td> -<td> -<input name="Description" value="<%$Description%>" size="80" /><br /> -</td> +<td class="label"><&|/l&>Description</&>:</td> +<td class="value"><input name="Description" value="<%$Description||''%>" size="80" /></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 class="label"><&|/l&>Type</&>:</td> +<td class="value"> +<input type="radio" name="Type" value="Perl" <% $Type eq "Perl" ? 'checked="checked"' : "" |n %>><&|/l&>Perl</&></input><br /> +<input type="radio" name="Type" value="Simple" <% $Type eq "Simple" ? 'checked="checked"' : "" |n %>><&|/l&>Simple</&></input><br /> </td> </tr> +<tr> +<td class="label" valign="top"><&|/l&>Content</&>:</td> +<td class="value"><textarea name="Content" rows="25" cols="80" wrap="soft"><%$Content||''%></textarea></td> +</tr> </table> <%INIT> +$Type = 'Perl' if !$Type; + </%INIT> <%ARGS> -$Name => undef -$Description => undef -$Content => undef +$Name => '' +$Description => '' +$Content => '' +$Type => 'Perl' </%ARGS> diff --git a/rt/share/html/Admin/Elements/ObjectCustomFields b/rt/share/html/Admin/Elements/ObjectCustomFields deleted file mode 100644 index 7798b8ea8..000000000 --- a/rt/share/html/Admin/Elements/ObjectCustomFields +++ /dev/null @@ -1,111 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@bestpractical.com> -%# -%# (Except where explicitly superseded by other copyright notices) -%# -%# -%# LICENSE: -%# -%# This work is made available to you under the terms of Version 2 of -%# the GNU General Public License. A copy of that license should have -%# been provided with this software, but in any event can be snarfed -%# from www.gnu.org. -%# -%# This work is distributed in the hope that it will be useful, but -%# WITHOUT ANY WARRANTY; without even the implied warranty of -%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -%# General Public License for more details. -%# -%# You should have received a copy of the GNU General Public License -%# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. -%# -%# -%# CONTRIBUTION SUBMISSION POLICY: -%# -%# (The following paragraph is not intended to limit the rights granted -%# to you to modify and distribute this software under the terms of -%# the GNU General Public License and is only of importance to you if -%# you choose to contribute your changes and enhancements to the -%# community by submitting them to Best Practical Solutions, LLC.) -%# -%# By intentionally submitting any modifications, corrections or -%# derivatives to this work, or any other work intended for use with -%# Request Tracker, to Best Practical Solutions, LLC, you confirm that -%# you are the copyright holder for those contributions and you grant -%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -%# royalty-free, perpetual, license 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), SuppressHeader => 1); - - - -my $Type = $1; -my $Types = $Type.'s'; -my $ObjectTabs; -my $Object = $ObjectType->new($session{'CurrentUser'}); - - -my $QualifiedType; -my $FriendlySubTypes; -if (defined $SubType && $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), SuppressHeader => 1); - $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/share/html/Admin/Elements/PickCustomFields b/rt/share/html/Admin/Elements/PickCustomFields index 10699421d..1c58b6ab4 100644 --- a/rt/share/html/Admin/Elements/PickCustomFields +++ b/rt/share/html/Admin/Elements/PickCustomFields @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/PickObjects b/rt/share/html/Admin/Elements/PickObjects index dbf84cb1d..24a9e69a4 100644 --- a/rt/share/html/Admin/Elements/PickObjects +++ b/rt/share/html/Admin/Elements/PickObjects @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/QueueRightsForUser b/rt/share/html/Admin/Elements/QueueRightsForUser index 9acf98fc5..b8ef1b1d8 100755 --- a/rt/share/html/Admin/Elements/QueueRightsForUser +++ b/rt/share/html/Admin/Elements/QueueRightsForUser @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -54,7 +54,7 @@ </ul> <%INIT> -my $ACL = new RT::ACL($session{'CurrentUser'}); +my $ACL = RT::ACL->new($session{'CurrentUser'}); $ACL->LimitToQueue($QueueObj->id); $ACL->LimitPrincipalToUser($PrincipalId); </%INIT> diff --git a/rt/share/html/Admin/Elements/QueueTabs b/rt/share/html/Admin/Elements/QueueTabs deleted file mode 100755 index 8ce08dfd3..000000000 --- a/rt/share/html/Admin/Elements/QueueTabs +++ /dev/null @@ -1,123 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@bestpractical.com> -%# -%# (Except where explicitly superseded by other copyright notices) -%# -%# -%# LICENSE: -%# -%# This work is made available to you under the terms of Version 2 of -%# the GNU General Public License. A copy of that license should have -%# been provided with this software, but in any event can be snarfed -%# from www.gnu.org. -%# -%# This work is distributed in the hope that it will be useful, but -%# WITHOUT ANY WARRANTY; without even the implied warranty of -%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -%# General Public License for more details. -%# -%# You should have received a copy of the GNU General Public License -%# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. -%# -%# -%# CONTRIBUTION SUBMISSION POLICY: -%# -%# (The following paragraph is not intended to limit the rights granted -%# to you to modify and distribute this software under the terms of -%# the GNU General Public License and is only of importance to you if -%# you choose to contribute your changes and enhancements to the -%# community by submitting them to Best Practical Solutions, LLC.) -%# -%# By intentionally submitting any modifications, corrections or -%# derivatives to this work, or any other work intended for use with -%# Request Tracker, to Best Practical Solutions, LLC, you confirm that -%# you are the copyright holder for those contributions and you grant -%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -%# royalty-free, perpetual, license 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, - }, - J => { title => loc('History'), - path => "Admin/Queues/History.html?id=" . $QueueObj->id - }, - } - }; -} -if ($session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminQueue')) { - $tabs->{"A"} = { title => loc('Select'), - path => "Admin/Queues/", - }; - $tabs->{"B"} = { title => loc('Create'), - path => "Admin/Queues/Modify.html?Create=1", - separator => 1, }; -} - - # Now let callbacks add their extra tabs - $m->callback( %ARGS, tabs => $tabs ); -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/share/html/Admin/Elements/SelectCustomField b/rt/share/html/Admin/Elements/SelectCustomField index fac69fad5..7f4e45eb5 100644 --- a/rt/share/html/Admin/Elements/SelectCustomField +++ b/rt/share/html/Admin/Elements/SelectCustomField @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/SelectCustomFieldLookupType b/rt/share/html/Admin/Elements/SelectCustomFieldLookupType index e124dfb64..514264b2e 100644 --- a/rt/share/html/Admin/Elements/SelectCustomFieldLookupType +++ b/rt/share/html/Admin/Elements/SelectCustomFieldLookupType @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/SelectCustomFieldType b/rt/share/html/Admin/Elements/SelectCustomFieldType index 6eb149764..50175cab9 100755 --- a/rt/share/html/Admin/Elements/SelectCustomFieldType +++ b/rt/share/html/Admin/Elements/SelectCustomFieldType @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -52,7 +52,7 @@ </select> <%INIT> my $cf = RT::CustomField->new($session{'CurrentUser'}); - +$Default = "Freeform-1" if $Default eq "-0"; </%INIT> <%ARGS> $Default=>undef diff --git a/rt/share/html/Admin/Elements/SelectGroups b/rt/share/html/Admin/Elements/SelectGroups index d6888adf1..e839f754a 100755 --- a/rt/share/html/Admin/Elements/SelectGroups +++ b/rt/share/html/Admin/Elements/SelectGroups @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -52,7 +52,7 @@ </select> <%INIT> -my $groups = new RT::Groups($session{'CurrentUser'}); +my $groups = RT::Groups->new($session{'CurrentUser'}); $groups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => $Domain); </%INIT> diff --git a/rt/share/html/Admin/Elements/SelectModifyGroup b/rt/share/html/Admin/Elements/SelectModifyGroup index 85dee9e16..8e51fa6b7 100755 --- a/rt/share/html/Admin/Elements/SelectModifyGroup +++ b/rt/share/html/Admin/Elements/SelectModifyGroup @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -50,7 +50,7 @@ %} <%INIT> my ($Group); -my $Groups = new RT::Groups($session{'CurrentUser'}); +my $Groups = RT::Groups->new($session{'CurrentUser'}); $Groups->UnLimit; </%INIT> <%ARGS> diff --git a/rt/share/html/Admin/Elements/SelectModifyQueue b/rt/share/html/Admin/Elements/SelectModifyQueue index d676d0178..e0f7d22b3 100755 --- a/rt/share/html/Admin/Elements/SelectModifyQueue +++ b/rt/share/html/Admin/Elements/SelectModifyQueue @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -50,7 +50,7 @@ %} <%INIT> my ($queue); -my $queues = new RT::Queues($session{'CurrentUser'}); +my $queues = RT::Queues->new($session{'CurrentUser'}); $queues->UnLimit; </%INIT> <%ARGS> diff --git a/rt/share/html/Admin/Elements/SelectModifyUser b/rt/share/html/Admin/Elements/SelectModifyUser index 2941064dc..f170b824f 100755 --- a/rt/share/html/Admin/Elements/SelectModifyUser +++ b/rt/share/html/Admin/Elements/SelectModifyUser @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -50,9 +50,9 @@ %} <%INIT> my ($user); -my $users = new RT::Users($session{'CurrentUser'}); +my $users = RT::Users->new($session{'CurrentUser'}); $users->Limit(FIELD => 'id', - VALUE => $RT::SystemUser->id, + VALUE => RT->SystemUser->id, OPERATOR => '!=' ); if (defined $IdLike) { diff --git a/rt/share/html/Admin/Elements/SelectNewGroupMembers b/rt/share/html/Admin/Elements/SelectNewGroupMembers index 04e99e578..f386ba551 100755 --- a/rt/share/html/Admin/Elements/SelectNewGroupMembers +++ b/rt/share/html/Admin/Elements/SelectNewGroupMembers @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,58 +46,41 @@ %# %# END BPS TAGGED BLOCK }}} % if ( $Show ne 'Groups' ) { -<b><&|/l&>Users</&></b> -<br /> -<select multiple="multiple" name="<% $Name %>Users" size="10"> -<%perl> -my @users = sort { lc($a->[0]) cmp lc($b->[0]) } - map { [$m->scomp("/Elements/ShowUser", User => $_), $_] } - @{ $users->ItemsArrayRef }; -</%perl> -% for (@users) { -% my ($rendered, $user) = @$_; -% next if $SkipUsers->{ $user->id }; -<option value="User-<% $user->id %>"><% $rendered |n%></option> -% } -</select> -<br /> +<label for="<% $Name %>Users"><&|/l&>Add user</&>:</label> +<input type="text" value="" name="<% $Name %>Users" id="<% $Name %>Users" /><br /> +<script type="text/javascript"> +jQuery(function(){ + jQuery("#<% $Name %>Users").autocomplete({ + source: "<% RT->Config->Get('WebPath')%>/Helpers/Autocomplete/Users?return=Name;privileged=1;exclude=<% $user_ids |u %>", + // Auto-submit once a user is chosen + select: function( event, ui ) { + jQuery(event.target).val(ui.item.value); + jQuery(event.target).closest("form").submit(); + } + }); +}); +</script> % } % if ( $Show ne 'Users' ) { -<b><&|/l&>Groups</&></b> -<br /> -<select multiple="multiple" name="<% $Name %>Groups" size="10"> -% while ( my $group = $groups->Next ) { -% next if $SkipGroups->{ $group->id }; -<option value="Group-<% $group->id %>"><% $group->Name %></option> -% } -</select> +<label for="<% $Name %>Groups"><&|/l&>Add group</&>:</label> +<input type="text" value="" name="<% $Name %>Groups" id="<% $Name %>Groups" /><br /> +<script type="text/javascript"> +jQuery(function(){ + jQuery("#<% $Name %>Groups").autocomplete({ + source: "<% RT->Config->Get('WebPath')%>/Helpers/Autocomplete/Groups?exclude=<% $group_ids |u %>", + // Auto-submit once a user is chosen + select: function( event, ui ) { + jQuery(event.target).val(ui.item.value); + jQuery(event.target).closest("form").submit(); + } + }); +}); +</script> % } - <%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'); - - +my $user_ids = join(',', grep { $SkipUsers->{$_} } keys %$SkipUsers); +my $group_ids = join(',', grep { $SkipGroups->{$_} } keys %$SkipGroups); </%INIT> <%ARGS> $Name => 'Users' diff --git a/rt/share/html/Admin/Elements/SelectRights b/rt/share/html/Admin/Elements/SelectRights index 7ec8d1b42..73f5bced3 100755 --- a/rt/share/html/Admin/Elements/SelectRights +++ b/rt/share/html/Admin/Elements/SelectRights @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -95,21 +95,20 @@ while ( my $ace = $ACLObj->Next ) { } - my $ACLObj = new RT::ACL($session{'CurrentUser'}); - my $ACE = new RT::ACE($session{'CurrentUser'}); + my $ACLObj = RT::ACL->new($session{'CurrentUser'}); + my $ACE = RT::ACE->new($session{'CurrentUser'}); $ACLObj->LimitToObject( $Object); $ACLObj->LimitToPrincipal( Id => $PrincipalId); $ACLObj->OrderBy(FIELD=>'RightName'); - if (ref($Object) && UNIVERSAL::can($Object, 'AvailableRights')) { + eval { %Rights = %{$Object->AvailableRights}; - } - - else { - %Rights = ( loc('System Error') => loc("No rights found") ); - } + }; + if ($@) { + %Rights = ( loc('System Error') => loc("No rights found") ); + } $ACLDesc = "$PrincipalId-".ref($Object)."-".$Object->Id; </%INIT> diff --git a/rt/share/html/Admin/Elements/SelectScrip b/rt/share/html/Admin/Elements/SelectScrip index 7e070df8e..f0adab10a 100755 --- a/rt/share/html/Admin/Elements/SelectScrip +++ b/rt/share/html/Admin/Elements/SelectScrip @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/SelectScripAction b/rt/share/html/Admin/Elements/SelectScripAction index 4dd39f55b..750815b07 100755 --- a/rt/share/html/Admin/Elements/SelectScripAction +++ b/rt/share/html/Admin/Elements/SelectScripAction @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -62,10 +62,19 @@ form.submit()"> <%INIT> my $ScripActions = RT::ScripActions->new($session{'CurrentUser'}); -$ScripActions->UnLimit; -$ScripActions->OrderBy(FIELD => 'Name'); +# hide user-defined if the user can't execute code +if ($session{CurrentUser}->HasRight(Object => $RT::System, Right => 'ExecuteCode')) { + $ScripActions->UnLimit; +} else { + $ScripActions->Limit( + FIELD => 'ExecModule', + OPERATOR => '!=', + VALUE => 'UserDefined', + ); +} +$ScripActions->OrderBy(FIELD => 'Name'); </%INIT> <%ARGS> diff --git a/rt/share/html/Admin/Elements/SelectScripCondition b/rt/share/html/Admin/Elements/SelectScripCondition index 67438a72a..1023df6e0 100755 --- a/rt/share/html/Admin/Elements/SelectScripCondition +++ b/rt/share/html/Admin/Elements/SelectScripCondition @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -62,9 +62,19 @@ form.submit()"> <%INIT> my $ScripConditions = RT::ScripConditions->new($session{'CurrentUser'}); -$ScripConditions->UnLimit; -$ScripConditions->OrderBy(FIELD => 'Name'); +# hide user-defined if the user can't execute code +if ($session{CurrentUser}->HasRight(Object => $RT::System, Right => 'ExecuteCode')) { + $ScripConditions->UnLimit; +} else { + $ScripConditions->Limit( + FIELD => 'ExecModule', + OPERATOR => '!=', + VALUE => 'UserDefined', + ); +} + +$ScripConditions->OrderBy(FIELD => 'Name'); </%INIT> <%ARGS> diff --git a/rt/share/html/Admin/Elements/SelectSingleOrMultiple b/rt/share/html/Admin/Elements/SelectSingleOrMultiple index 1a2667840..bf2824397 100755 --- a/rt/share/html/Admin/Elements/SelectSingleOrMultiple +++ b/rt/share/html/Admin/Elements/SelectSingleOrMultiple @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/SelectStage b/rt/share/html/Admin/Elements/SelectStage index 38a7f18a5..369dee9af 100644 --- a/rt/share/html/Admin/Elements/SelectStage +++ b/rt/share/html/Admin/Elements/SelectStage @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Elements/SelectTemplate b/rt/share/html/Admin/Elements/SelectTemplate index ffaebeeb7..8d45c7de1 100755 --- a/rt/share/html/Admin/Elements/SelectTemplate +++ b/rt/share/html/Admin/Elements/SelectTemplate @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -47,19 +47,12 @@ %# END BPS TAGGED BLOCK }}} <select name="<%$Name%>"> <option value="" -<% defined($Default) && $Default eq 'none' && qq[ selected="selected"] |n %> ->-</option> +<% defined($Default) && $Default eq 'none' && qq[ selected="selected"] |n %>>-</option> %while (my $Template = $PrimaryTemplates->Next) { -<option value="<%$Template->Id%>" -<% ($Template->Id == $Default) && qq[ selected="selected"] |n %> -><% loc($Template->Name) %> -</option> +<option value="<%$Template->Id%>" <% ($Template->Id == $Default) && qq[ selected="selected"] |n %>><% loc($Template->Name) %></option> %} %while (my $Template = $OtherTemplates->Next) { -<option value="<%$Template->Id%>" -<% defined($Default) && ($Template->Id == $Default) && qq[ selected="selected"] |n %> -><&|/l, loc($Template->Name) &>Global template: [_1]</&> -</option> +<option value="<%$Template->Id%>" <% defined($Default) && ($Template->Id == $Default) && qq[ selected="selected"] |n %>><&|/l, loc($Template->Name) &>Global template: [_1]</&></option> %} </select> @@ -73,15 +66,12 @@ $PrimaryTemplates->OrderBy(FIELD => 'Name'); } my $OtherTemplates = RT::Templates->new($session{'CurrentUser'}); -$OtherTemplates->LimitToGlobal($DefaultQueue); +$OtherTemplates->LimitToGlobal; $OtherTemplates->OrderBy(FIELD => 'Name'); </%INIT> <%ARGS> - $Queue => undef $Default => 'none' -$DefaultQueue => undef $Name => 'Template' - </%ARGS> diff --git a/rt/share/html/Admin/Elements/SelectUsers b/rt/share/html/Admin/Elements/SelectUsers index 14ebf822c..1851f23f8 100755 --- a/rt/share/html/Admin/Elements/SelectUsers +++ b/rt/share/html/Admin/Elements/SelectUsers @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -54,10 +54,10 @@ </select> <%INIT> -my $users = new RT::Users($session{'CurrentUser'}); +my $users = RT::Users->new($session{'CurrentUser'}); -$users->Limit(FIELD => 'id', VALUE => $RT::SystemUser->id, OPERATOR => '!=' ); -$users->Limit(FIELD => 'id', VALUE => $RT::Nobody->id, OPERATOR => '!=' ); +$users->Limit(FIELD => 'id', VALUE => RT->SystemUser->id, OPERATOR => '!=' ); +$users->Limit(FIELD => 'id', VALUE => RT->Nobody->id, OPERATOR => '!=' ); $users->LimitToPrivileged(); </%INIT> diff --git a/rt/share/html/Admin/Elements/ShowKeyInfo b/rt/share/html/Admin/Elements/ShowKeyInfo index acb51c5de..2ec319a63 100644 --- a/rt/share/html/Admin/Elements/ShowKeyInfo +++ b/rt/share/html/Admin/Elements/ShowKeyInfo @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -80,6 +80,7 @@ $EmailAddress $Type => 'public' </%ARGS> <%INIT> +return if ($m->cache_self( key => join("||",$EmailAddress,$Type, $$), expires_in => '2 minutes')); require RT::Crypt::GnuPG; my %res = RT::Crypt::GnuPG::GetKeyInfo( $EmailAddress, $Type ); diff --git a/rt/share/html/Admin/Elements/SystemTabs b/rt/share/html/Admin/Elements/SystemTabs deleted file mode 100755 index 66183efd2..000000000 --- a/rt/share/html/Admin/Elements/SystemTabs +++ /dev/null @@ -1,99 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@bestpractical.com> -%# -%# (Except where explicitly superseded by other copyright notices) -%# -%# -%# LICENSE: -%# -%# This work is made available to you under the terms of Version 2 of -%# the GNU General Public License. A copy of that license should have -%# been provided with this software, but in any event can be snarfed -%# from www.gnu.org. -%# -%# This work is distributed in the hope that it will be useful, but -%# WITHOUT ANY WARRANTY; without even the implied warranty of -%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -%# General Public License for more details. -%# -%# You should have received a copy of the GNU General Public License -%# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. -%# -%# -%# CONTRIBUTION SUBMISSION POLICY: -%# -%# (The following paragraph is not intended to limit the rights granted -%# to you to modify and distribute this software under the terms of -%# the GNU General Public License and is only of importance to you if -%# you choose to contribute your changes and enhancements to the -%# community by submitting them to Best Practical Solutions, LLC.) -%# -%# By intentionally submitting any modifications, corrections or -%# derivatives to this work, or any other work intended for use with -%# Request Tracker, to Best Practical Solutions, LLC, you confirm that -%# you are the copyright holder for those contributions and you grant -%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -%# royalty-free, perpetual, license 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', - }, - I => { title => loc('RT at a glance'), - path => 'Admin/Global/MyRT.html', - }, - -}; - - # Now let callbacks add their extra tabs - $m->callback( %ARGS, tabs => $tabs ); - - if ($current_tab) { - 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/share/html/Admin/Elements/Tabs b/rt/share/html/Admin/Elements/Tabs deleted file mode 100755 index c56ee2e55..000000000 --- a/rt/share/html/Admin/Elements/Tabs +++ /dev/null @@ -1,95 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@bestpractical.com> -%# -%# (Except where explicitly superseded by other copyright notices) -%# -%# -%# LICENSE: -%# -%# This work is made available to you under the terms of Version 2 of -%# the GNU General Public License. A copy of that license should have -%# been provided with this software, but in any event can be snarfed -%# from www.gnu.org. -%# -%# This work is distributed in the hope that it will be useful, but -%# WITHOUT ANY WARRANTY; without even the implied warranty of -%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -%# General Public License for more details. -%# -%# You should have received a copy of the GNU General Public License -%# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. -%# -%# -%# CONTRIBUTION SUBMISSION POLICY: -%# -%# (The following paragraph is not intended to limit the rights granted -%# to you to modify and distribute this software under the terms of -%# the GNU General Public License and is only of importance to you if -%# you choose to contribute your changes and enhancements to the -%# community by submitting them to Best Practical Solutions, LLC.) -%# -%# By intentionally submitting any modifications, corrections or -%# derivatives to this work, or any other work intended for use with -%# Request Tracker, to Best Practical Solutions, LLC, you confirm that -%# you are the copyright holder for those contributions and you grant -%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -%# royalty-free, perpetual, license 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->callback( %ARGS, tabs => $tabs ); - - if( defined $current_tab ) { - foreach my $tab (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/share/html/Admin/Elements/ToolTabs b/rt/share/html/Admin/Elements/ToolTabs deleted file mode 100755 index c3cb6e397..000000000 --- a/rt/share/html/Admin/Elements/ToolTabs +++ /dev/null @@ -1,82 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@bestpractical.com> -%# -%# (Except where explicitly superseded by other copyright notices) -%# -%# -%# LICENSE: -%# -%# This work is made available to you under the terms of Version 2 of -%# the GNU General Public License. A copy of that license should have -%# been provided with this software, but in any event can be snarfed -%# from www.gnu.org. -%# -%# This work is distributed in the hope that it will be useful, but -%# WITHOUT ANY WARRANTY; without even the implied warranty of -%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -%# General Public License for more details. -%# -%# You should have received a copy of the GNU General Public License -%# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. -%# -%# -%# CONTRIBUTION SUBMISSION POLICY: -%# -%# (The following paragraph is not intended to limit the rights granted -%# to you to modify and distribute this software under the terms of -%# the GNU General Public License and is only of importance to you if -%# you choose to contribute your changes and enhancements to the -%# community by submitting them to Best Practical Solutions, LLC.) -%# -%# By intentionally submitting any modifications, corrections or -%# derivatives to this work, or any other work intended for use with -%# Request Tracker, to Best Practical Solutions, LLC, you confirm that -%# you are the copyright holder for those contributions and you grant -%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -%# royalty-free, perpetual, license 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, - Title => $Title, - current_tab => 'Admin/Tools/', - subtabs => $tabs, - current_subtab => $current_tab, -&> - -<%INIT> - my $tabs = { - A => { title => loc('System Configuration'), - path => 'Admin/Tools/Configuration.html', - }, - E => { title => loc('Shredder'), - path => 'Admin/Tools/Shredder/', - }, - }; - - # Now let callbacks add their extra tabs - $m->callback( %ARGS, tabs => $tabs ); - - foreach my $tab ( values %{$tabs} ) { - next unless $tab->{'path'} eq $current_tab; - - $tab->{"subtabs"} = $subtabs; - $tab->{"current_subtab"} = $current_subtab; - } -</%INIT> - -<%ARGS> -$id => undef -$current_tab => undef -$subtabs => undef -$current_subtab => undef -$Title => undef -</%ARGS> diff --git a/rt/share/html/Admin/Elements/UserTabs b/rt/share/html/Admin/Elements/UserTabs deleted file mode 100755 index 330c442b5..000000000 --- a/rt/share/html/Admin/Elements/UserTabs +++ /dev/null @@ -1,116 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@bestpractical.com> -%# -%# (Except where explicitly superseded by other copyright notices) -%# -%# -%# LICENSE: -%# -%# This work is made available to you under the terms of Version 2 of -%# the GNU General Public License. A copy of that license should have -%# been provided with this software, but in any event can be snarfed -%# from www.gnu.org. -%# -%# This work is distributed in the hope that it will be useful, but -%# WITHOUT ANY WARRANTY; without even the implied warranty of -%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -%# General Public License for more details. -%# -%# You should have received a copy of the GNU General Public License -%# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. -%# -%# -%# CONTRIBUTION SUBMISSION POLICY: -%# -%# (The following paragraph is not intended to limit the rights granted -%# to you to modify and distribute this software under the terms of -%# the GNU General Public License and is only of importance to you if -%# you choose to contribute your changes and enhancements to the -%# community by submitting them to Best Practical Solutions, LLC.) -%# -%# By intentionally submitting any modifications, corrections or -%# derivatives to this work, or any other work intended for use with -%# Request Tracker, to Best Practical Solutions, LLC, you confirm that -%# you are the copyright holder for those contributions and you grant -%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -%# royalty-free, perpetual, license 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 - }, - 'MyRT' => { title => loc('RT at a glance'), - path => "Admin/Users/MyRT.html?id=".$id - }, - } -}; - if ( RT->Config->Get('GnuPG')->{'Enable'} ) { - $tabs->{'this'}{'subtabs'}{'GnuPG'} = { - title => loc('GnuPG'), - path => "Admin/Users/GnuPG.html?id=".$id, - }; - } -} - -if ($session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminUsers')) { - $tabs->{"A"} = { title => loc('Select'), - path => "Admin/Users/", - }; - $tabs->{"B"} = { title => loc('Create'), - path => "Admin/Users/Modify.html?Create=1", - separator => 1, - }; -} - - # Now let callbacks add their extra tabs - $m->callback( %ARGS, tabs => $tabs ); - -#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/share/html/Admin/Global/CustomFields/Groups.html b/rt/share/html/Admin/Global/CustomFields/Groups.html index ef83f8c91..3356a21d4 100644 --- a/rt/share/html/Admin/Global/CustomFields/Groups.html +++ b/rt/share/html/Admin/Global/CustomFields/Groups.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,10 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/GlobalCustomFieldTabs, - current_tab => "Admin/Global/CustomFields/Groups.html", - current_subtab => "Admin/Global/CustomFields/Groups.html", - Title => $title +<& /Elements/Tabs &> <& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::Group', Object=> $object &> <%INIT> diff --git a/rt/share/html/Admin/Global/CustomFields/Queue-Tickets.html b/rt/share/html/Admin/Global/CustomFields/Queue-Tickets.html index 6f5370b65..371b3d6ea 100755 --- a/rt/share/html/Admin/Global/CustomFields/Queue-Tickets.html +++ b/rt/share/html/Admin/Global/CustomFields/Queue-Tickets.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,10 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /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 +<& /Elements/Tabs &> <& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::Queue', Object=> $object, SubType => 'RT::Ticket' &> <%INIT> diff --git a/rt/share/html/Admin/Global/CustomFields/Queue-Transactions.html b/rt/share/html/Admin/Global/CustomFields/Queue-Transactions.html index 4c51b9dc8..ce642935f 100755 --- a/rt/share/html/Admin/Global/CustomFields/Queue-Transactions.html +++ b/rt/share/html/Admin/Global/CustomFields/Queue-Transactions.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,10 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /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 +<& /Elements/Tabs &> <& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::Queue', Object=> $object, SubType => 'RT::Ticket-RT::Transaction' &> <%INIT> diff --git a/rt/share/html/Admin/Global/CustomFields/Queues.html b/rt/share/html/Admin/Global/CustomFields/Queues.html index bc0652ada..6eda3840f 100644 --- a/rt/share/html/Admin/Global/CustomFields/Queues.html +++ b/rt/share/html/Admin/Global/CustomFields/Queues.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,10 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/GlobalCustomFieldTabs, - current_tab => "Admin/Global/CustomFields/Queues.html", - current_subtab => "Admin/Global/CustomFields/Queues.html", - Title => $title +<& /Elements/Tabs &> <& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::Queue', Object=> $object &> <%INIT> diff --git a/rt/share/html/Admin/Global/CustomFields/Users.html b/rt/share/html/Admin/Global/CustomFields/Users.html index 719a44c1d..a1046d1da 100644 --- a/rt/share/html/Admin/Global/CustomFields/Users.html +++ b/rt/share/html/Admin/Global/CustomFields/Users.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,10 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/GlobalCustomFieldTabs, - current_tab => "Admin/Global/CustomFields/Users.html", - current_subtab => "Admin/Global/CustomFields/Users.html", - Title => $title +<& /Elements/Tabs &> <& /Admin/Elements/EditCustomFields, %ARGS, title => $title, ObjectType => 'RT::User', Object=> $object &> <%INIT> diff --git a/rt/share/html/Admin/Global/CustomFields/index.html b/rt/share/html/Admin/Global/CustomFields/index.html index 93cea10c3..e27e93a1d 100644 --- a/rt/share/html/Admin/Global/CustomFields/index.html +++ b/rt/share/html/Admin/Global/CustomFields/index.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -47,7 +47,7 @@ %# END BPS TAGGED BLOCK }}} % $m->callback( %ARGS, tabs => $tabs ); <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/GlobalCustomFieldTabs, Title => $title &> +<& /Elements/Tabs &> <ul> % foreach my $key (sort keys %$tabs) { @@ -91,7 +91,12 @@ my $tabs = { loc('Select custom fields for transactions on tickets in all queues'), path => 'Queue-Transactions.html', }, + H => { + title => loc('Articles'), + text => loc('Select Custom Fields for Articles in all Classes'), + path => 'Class-Article.html' + }, }; diff --git a/rt/share/html/Admin/Global/GroupRights.html b/rt/share/html/Admin/Global/GroupRights.html index 19ead1ca4..702a2e933 100755 --- a/rt/share/html/Admin/Global/GroupRights.html +++ b/rt/share/html/Admin/Global/GroupRights.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,78 +46,18 @@ %# %# 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/Tabs &> <& /Elements/ListActions, actions => \@results &> - <form method="post" action="GroupRights.html"> - -<&| /Widgets/TitleBox, 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/Submit, Label => loc('Modify Group Rights'), Reset => 1 &> - - </form> +<form method="post" action="GroupRights.html" id="ModifyGroupRights" name="ModifyGroupRights"> + <& /Admin/Elements/EditRights, Context => $RT::System, Principals => \@principals &> + <& /Elements/Submit, Label => loc('Save Changes') &> +</form> <%INIT> - - #Update the acls. - my @results = ProcessACLChanges(\%ARGS); +# Update the acls. +my @results = ProcessACLs(\%ARGS); - -my $Groups; - +# Principal collections +my @principals = GetPrincipalsMap($RT::System, qw(System Roles Groups)); </%INIT> - -<%ARGS> -</%ARGS> diff --git a/rt/share/html/Admin/Global/MyRT.html b/rt/share/html/Admin/Global/MyRT.html index edee2df27..3dca78fad 100644 --- a/rt/share/html/Admin/Global/MyRT.html +++ b/rt/share/html/Admin/Global/MyRT.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,10 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => loc("RT at a glance") &> -<& /Admin/Elements/SystemTabs, - current_tab => 'Admin/Global/MyRT.html', - Title => loc("RT at a glance"), -&> +<& /Elements/Tabs &> <& /Widgets/SelectionBox:header, nojs => 1 &> diff --git a/rt/share/html/Admin/Global/Scrip.html b/rt/share/html/Admin/Global/Scrip.html index d5aa9ffd6..3a6ed107d 100755 --- a/rt/share/html/Admin/Global/Scrip.html +++ b/rt/share/html/Admin/Global/Scrip.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,41 +46,18 @@ %# %# 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 &> - +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> <& /Admin/Elements/EditScrip, title => $title, %ARGS, id => $id &> <%init> -my $subtabs = { - A => { - title => loc('Select'), - path => "Admin/Global/Scrips.html", - }, - B => { - title => loc('New'), - path => "Admin/Global/Scrip.html?create=1&Queue=0", - separator => 1, - }, -}; - my ($id, @results) = $m->comp( '/Admin/Elements/EditScrip:Process', %ARGS ); -my ($title, $current_subtab); +my ($title); if ( $id ) { - $current_subtab = "Admin/Global/Scrip.html?id=$id&Queue=0"; $title = loc("Modify a scrip that applies to all queues"); - $subtabs->{"C"} = { - title => loc('Scrip #[_1]', $id), - path => "Admin/Global/Scrip.html?id=$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/share/html/Admin/Global/Scrips.html b/rt/share/html/Admin/Global/Scrips.html index 2ee58f770..808913ba2 100755 --- a/rt/share/html/Admin/Global/Scrips.html +++ b/rt/share/html/Admin/Global/Scrips.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,32 +46,13 @@ %# %# 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 &> +<& /Elements/Tabs &> <& /Admin/Elements/EditScrips, title => $title, id => $id, %ARGS &> </form> <%init> - -my $subtabs = { - A => { title => loc('Select'), - path => "Admin/Global/Scrips.html", - }, - B => { title => loc('New'), - 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/share/html/Admin/Global/Template.html b/rt/share/html/Admin/Global/Template.html index c7652e6aa..70b69053b 100755 --- a/rt/share/html/Admin/Global/Template.html +++ b/rt/share/html/Admin/Global/Template.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,14 +46,10 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/SystemTabs, - current_tab => 'Admin/Global/Templates.html', - current_subtab => $current_subtab, - subtabs => $subtabs, - Title => $title &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> -<form method="post" action="Template.html"> +<form method="post" name="ModifyTemplate" id="ModifyTemplate" action="Template.html"> %if ($Create ) { <input type="hidden" class="hidden" name="Template" value="new" /> % } else { @@ -62,30 +58,23 @@ %# hang onto the queue id <input type="hidden" class="hidden" name="Queue" value="<%$Queue%>" /> -<& /Admin/Elements/ModifyTemplate, Name => $TemplateObj->Name, Description => -$TemplateObj->Description, Content => $TemplateObj->Content &> +<& /Admin/Elements/ModifyTemplate, + Name => $TemplateObj->Name, + Description => $TemplateObj->Description, + Content => $TemplateObj->Content, + Type => $TemplateObj->Type +&> <& /Elements/Submit, Label => $SubmitLabel, Reset => 1 &> </form> <%INIT> -my $TemplateObj = new RT::Template($session{'CurrentUser'}); -my ($title, @results, $current_subtab, $SubmitLabel); - -my $subtabs = { - A => { title => loc('Select'), - path => "Admin/Global/Templates.html" - }, - B => { title => loc('New'), - path => "Admin/Global/Template.html?Create=1&Queue=0", - separator => 1, - } - }; +my $TemplateObj = RT::Template->new($session{'CurrentUser'}); +my ($title, @results, $SubmitLabel); if ($Create) { $title = loc("Create a template"); - $current_subtab = "Admin/Global/Template.html?Create=1&Queue=0"; $SubmitLabel = loc('Create'); } @@ -103,21 +92,20 @@ else { } if ($TemplateObj->Id()) { - my @attribs = qw( Description Content Queue Name); + my @attribs = qw( Description Content Queue Name Type ); 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; + + my ($ok, $msg) = $TemplateObj->CompileCheck; + push @results, $msg if !$ok; } </%INIT> <%ARGS> -$Queue => undef -$Template => undef -$Create => undef -$Name => undef +$Queue => '' +$Template => '' +$Create => '' +$Name => '' </%ARGS> diff --git a/rt/share/html/Admin/Global/Templates.html b/rt/share/html/Admin/Global/Templates.html index 30ad24418..2ff1393cf 100755 --- a/rt/share/html/Admin/Global/Templates.html +++ b/rt/share/html/Admin/Global/Templates.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,32 +46,13 @@ %# %# 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 &> +<& /Elements/Tabs &> <& /Admin/Elements/EditTemplates, title => $title, %ARGS &> </form> <%init> - -my $subtabs = { - A => { title => loc('Select'), - path => "Admin/Global/Templates.html" - }, - B => { title => loc('New'), - 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/share/html/Admin/Global/UserRights.html b/rt/share/html/Admin/Global/UserRights.html index 8011c9b66..f0d094dd4 100755 --- a/rt/share/html/Admin/Global/UserRights.html +++ b/rt/share/html/Admin/Global/UserRights.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,54 +46,14 @@ %# %# 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/Tabs &> <& /Elements/ListActions, actions => \@results &> - <form method="post" action="UserRights.html"> - -<&| /Widgets/TitleBox, title => loc('Modify global user rights.') &> -<table> - -% while ( my $UserObj = $Users->Next ) { -% my $group = RT::Group->new($session{'CurrentUser'}); -% $group->LoadACLEquivalenceGroup( $UserObj ); - <tr align="right"> - <td valign="top"><& /Elements/ShowUser, User => $UserObj &></td> - <td><& /Admin/Elements/SelectRights, - PrincipalId => $group->PrincipalId, - Object => $RT::System, - &></td> - </tr> -% } -</table> -</&> - -<& /Elements/Submit, Label => loc('Modify User Rights'), Reset => 1 &> - +<form method="post" action="UserRights.html" name="ModifyUserRights" id="ModifyUserRights"> + <& /Admin/Elements/EditRights, Context => $RT::System, Principals => \@principals &> + <& /Elements/Submit, Label => loc('Save Changes') &> </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->UserMembersObj(); -$Users->OrderBy( FIELD => $UserOrderBy, ORDER => $UserOrder ); - - - -# }}} - +my @results = ProcessACLs(\%ARGS); +my @principals = GetPrincipalsMap($RT::System, 'Users'); </%INIT> - -<%ARGS> -$UserOrderBy => 'Name' -$UserOrder => 'ASC' -</%ARGS> diff --git a/rt/share/html/Admin/Global/index.html b/rt/share/html/Admin/Global/index.html index 0f7b56d4c..0f245f069 100755 --- a/rt/share/html/Admin/Global/index.html +++ b/rt/share/html/Admin/Global/index.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,42 +45,6 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -% $m->callback( %ARGS, tabs => $tabs ); <& /Admin/Elements/Header, Title => loc('Admin/Global configuration') &> -<& /Admin/Elements/SystemTabs, - Title => loc('Admin/Global configuration') &> - <& /Elements/ListMenu, items => $tabs &> -<%INIT> - my $tabs = { - - A => { title => loc('Scrips'), - text => loc('Modify scrips which apply to all queues'), - path => '/Admin/Global/Scrips.html', - }, - B => { title => loc('Templates'), - text => loc('Edit system templates'), - path => '/Admin/Global/Templates.html', - }, - - F => { title => loc('Custom Fields'), - text => loc('Modify global custom fields'), - path => '/Admin/Global/CustomFields/index.html', - }, - - G => { title => loc('Group Rights'), - text => loc('Modify global group rights'), - path => '/Admin/Global/GroupRights.html', - }, - H => { title => loc('User Rights'), - text => loc('Modify global user rights'), - path => '/Admin/Global/UserRights.html', - }, - I => { title => loc('RT at a glance'), - text => loc('Modify the default "RT at a glance" view'), - path => '/Admin/Global/MyRT.html', - }, - - - -}; -</%INIT> +<& /Elements/Tabs &> +<& /Elements/ListMenu, menu => Menu()->child('tools')->child('config')->child('global') &> diff --git a/rt/share/html/Admin/Groups/CustomFields.html b/rt/share/html/Admin/Groups/CustomFields.html deleted file mode 100644 index 21f15a99b..000000000 --- a/rt/share/html/Admin/Groups/CustomFields.html +++ /dev/null @@ -1,48 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@bestpractical.com> -%# -%# (Except where explicitly superseded by other copyright notices) -%# -%# -%# LICENSE: -%# -%# This work is made available to you under the terms of Version 2 of -%# the GNU General Public License. A copy of that license should have -%# been provided with this software, but in any event can be snarfed -%# from www.gnu.org. -%# -%# This work is distributed in the hope that it will be useful, but -%# WITHOUT ANY WARRANTY; without even the implied warranty of -%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -%# General Public License for more details. -%# -%# You should have received a copy of the GNU General Public License -%# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. -%# -%# -%# CONTRIBUTION SUBMISSION POLICY: -%# -%# (The following paragraph is not intended to limit the rights granted -%# to you to modify and distribute this software under the terms of -%# the GNU General Public License and is only of importance to you if -%# you choose to contribute your changes and enhancements to the -%# community by submitting them to Best Practical Solutions, LLC.) -%# -%# By intentionally submitting any modifications, corrections or -%# derivatives to this work, or any other work intended for use with -%# Request Tracker, to Best Practical Solutions, LLC, you confirm that -%# you are the copyright holder for those contributions and you grant -%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -%# royalty-free, perpetual, license 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/share/html/Admin/Groups/GroupRights.html b/rt/share/html/Admin/Groups/GroupRights.html index fc3ac33b1..4d9c1187f 100755 --- a/rt/share/html/Admin/Groups/GroupRights.html +++ b/rt/share/html/Admin/Groups/GroupRights.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,62 +46,17 @@ %# %# 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/Tabs &> <& /Elements/ListActions, actions => \@results &> - <form method="post" action="GroupRights.html"> + <form method="post" action="GroupRights.html" id="ModifyGroupRights" name="ModifyGroupRights"> <input type="hidden" class="hidden" name="id" value="<% $GroupObj->id %>" /> - -<&| /Widgets/TitleBox, 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/Submit, Label => loc('Modify Group Rights'), Reset => 1 &> - + <& /Admin/Elements/EditRights, Context => $GroupObj, Principals => \@principals &> + <& /Elements/Submit, Label => loc('Save Changes') &> </form> - <%INIT> - - #Update the acls. - my @results = ProcessACLChanges(\%ARGS); - +# Update the acls. +my @results = ProcessACLs(\%ARGS); if (!defined $id) { Abort(loc("No Group defined")); @@ -110,8 +65,7 @@ if (!defined $id) { my $GroupObj = RT::Group->new($session{'CurrentUser'}); $GroupObj->Load($id) || Abort(loc("Couldn't load group [_1]",$id)); -my $Groups; - +my @principals = GetPrincipalsMap($GroupObj, 'System', 'Groups'); </%INIT> <%ARGS> diff --git a/rt/share/html/Admin/Groups/History.html b/rt/share/html/Admin/Groups/History.html index 53b041dee..9a8ca015a 100644 --- a/rt/share/html/Admin/Groups/History.html +++ b/rt/share/html/Admin/Groups/History.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,11 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/GroupTabs, - id => $id, - GroupObj => $GroupObj, - current_subtab => $current_tab, - Title => $title &> +<& /Elements/Tabs &> <& /Ticket/Elements/ShowHistory, Ticket => $GroupObj, @@ -58,8 +54,7 @@ &> <%INIT> -my $current_tab = 'Admin/Groups/History.html?id='.$id; -my $GroupObj = new RT::Group($session{'CurrentUser'}); +my $GroupObj = RT::Group->new($session{'CurrentUser'}); $GroupObj->Load($id) || Abort("Couldn't load group '$id'"); my $title = loc("History of the group [_1]", $GroupObj->Name); </%INIT> diff --git a/rt/share/html/Admin/Groups/Members.html b/rt/share/html/Admin/Groups/Members.html index 4b40e5bd3..3ba5b657b 100755 --- a/rt/share/html/Admin/Groups/Members.html +++ b/rt/share/html/Admin/Groups/Members.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,10 +45,8 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<& /Admin/Elements/Header, Title => loc('RT/Admin/Edit the group [_1]', $Group->Name) &> -<& /Admin/Elements/GroupTabs, GroupObj => $Group, - current_tab => 'Admin/Groups/Members.html?id='.$id, - Title => "RT/Admin/Edit the group ". $Group->Name &> +<& /Admin/Elements/Header, Title => $title &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> <form action="<% RT->Config->Get('WebPath') %>/Admin/Groups/Members.html" method="post"> @@ -113,9 +111,11 @@ my @users = sort { lc($a->[0]) cmp lc($b->[0]) } <%INIT> -my $Group = new RT::Group($session{'CurrentUser'}); +my $Group = RT::Group->new($session{'CurrentUser'}); $Group->Load($id) || Abort(loc('Could not load group')); +my $title = loc("Modify the group [_1]", $Group->Name); + my (%UsersSeen, %GroupsSeen); $GroupsSeen{ $Group->id } = 1; # can't be a member of ourself @@ -129,25 +129,37 @@ foreach my $key (keys %ARGS) { push (@results, $msg); } -foreach my $member (grep $_, @AddMembersUsers, @AddMembersGroups) { +# Process new users +foreach my $member (grep $_, @AddMembersUsers) { + my $principal = RT::User->new($session{'CurrentUser'}); + + if ($member =~ /^User-(\d+)$/) { + # Old style, using id + $principal->Load($1); + } else { + # New style, just a username + $principal->Load($member); + } + + my ($val, $msg) = $Group->AddMember($principal->PrincipalId); + push (@results, $msg); +} - my $principal; +# Process new groups +foreach my $member (grep $_, @AddMembersGroups) { + my $principal = RT::Group->new($session{'CurrentUser'}); if ($member =~ /^Group-(\d+)$/) { - $principal = RT::Group->new($session{'CurrentUser'}); - $principal->Load($1); - } elsif ($member =~ /^User-(\d+)$/) { - $principal = RT::User->new($session{'CurrentUser'}); + # Old style, using id $principal->Load($1); } else { - next; + # New style, just a group name + $principal->LoadUserDefinedGroup($member); } - my ($val, $msg) = $Group->AddMember($principal->PrincipalId); push (@results, $msg); } - </%INIT> <%ARGS> diff --git a/rt/share/html/Admin/Groups/Modify.html b/rt/share/html/Admin/Groups/Modify.html index de3dac4b5..148c98e1f 100755 --- a/rt/share/html/Admin/Groups/Modify.html +++ b/rt/share/html/Admin/Groups/Modify.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -47,15 +47,12 @@ %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/GroupTabs, - GroupObj => $Group, - current_tab => $current_tab, - Title => $title &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> -<form action="<%RT->Config->Get('WebPath')%>/Admin/Groups/Modify.html" method="post" enctype="multipart/form-data"> +<form action="<%RT->Config->Get('WebPath')%>/Admin/Groups/Modify.html" name="ModifyGroup" method="post" enctype="multipart/form-data"> %unless ($Group->Id) { <input type="hidden" class="hidden" name="id" value="new" /> @@ -66,11 +63,11 @@ <tr><td align="right"> <&|/l&>Name</&>: </td> -<td><input name="Name" value="<%$Group->Name||''%>" /></td> +<td><input name="Name" value="<%$Group->Name||$Name||''%>" /></td> </tr> <tr> <td align="right"> -<&|/l&>Description</&>:</td><td colspan="3"><input name="Description" value="<%$Group->Description||''%>" size="60" /></td> +<&|/l&>Description</&>:</td><td colspan="3"><input name="Description" value="<%$Group->Description||$Description||''%>" size="60" /></td> </tr> % my $CFs = $Group->CustomFields; % while (my $CF = $CFs->Next) { @@ -99,67 +96,72 @@ </form> <%INIT> -my $current_tab; -my ($title, @results, $Disabled, $EnabledChecked); +my ($title, @results, @warnings, $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; +} else { 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 { + my ($create_id, $create_msg) = $Group->CreateUserDefinedGroup(Name => $Name ); + if ($create_id) { + $id = $Group->Id; + push @results, $create_msg; + } else { + push @results, loc("Group could not be created: [_1]", $create_msg); + } + } else { $Group->Load($id) || Abort('Could not load group'); } - - if ($id) { + if ($Group->Id) { $title = loc("Modify the group [_1]", $Group->Name); - - } + } # If the create failed else { $title = loc("Create a new group"); $Create = 1; - } - + } } -if ($id) { - +if ($Group->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 ); + + # Warn about duplicate groups + my $dupcheck = RT::Groups->new(RT->SystemUser); + $dupcheck->LimitToUserDefinedGroups(); + $dupcheck->Limit( FIELD => 'Name', VALUE => $Group->Name ); + if ($dupcheck->Count > 1) { + push @warnings, loc("There is more than one group with the name '[_1]'. This may cause inconsistency in parts of the admin interface, and therefore it's recommended you rename the conflicting groups.", $Group->Name); + } } #we're asking about enabled on the web page but really care about disabled. if (defined $Enabled && $Enabled == 1) { $Disabled = 0; -} -else { +} else { $Disabled = 1; } -if ( ($SetEnabled) and ( $Disabled != $Group->Disabled) ) { +if ( $Group->Id and ($SetEnabled) and ( $Disabled != $Group->Disabled) ) { my ($code, $msg) = $Group->SetDisabled($Disabled); push @results, $msg; } +# This code does automatic redirection if any updates happen. +MaybeRedirectForResults( + Actions => \@results, + Arguments => { id => $Group->id }, +) if $Group->Id; + +push @results, @warnings; + unless ($Group->Disabled()) { $EnabledChecked ='checked="checked"'; } diff --git a/rt/share/html/Admin/Groups/UserRights.html b/rt/share/html/Admin/Groups/UserRights.html index aedb55e5e..8e6b09164 100755 --- a/rt/share/html/Admin/Groups/UserRights.html +++ b/rt/share/html/Admin/Groups/UserRights.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,45 +46,18 @@ %# %# 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/Tabs &> <& /Elements/ListActions, actions => \@results &> - <form method="post" action="UserRights.html"> + <form method="post" action="UserRights.html" name="ModifyUserRights" id="ModifyUserRights"> <input type="hidden" class="hidden" name="id" value="<% $GroupObj->id %>" /> - -<&| /Widgets/TitleBox, 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"><& /Elements/ShowUser, User => $UserObj &></td> - <td><& /Admin/Elements/SelectRights, - PrincipalId => $Member->MemberObj->Id, - PrincipalType => 'User', - Object => $GroupObj, - &></td> - </tr> -% } -</table> -</&> - -<& /Elements/Submit, Label => loc('Modify User Rights'), Reset => 1 &> - -</form> + <& /Admin/Elements/EditRights, Context => $GroupObj, Principals => \@principals &> + <& /Elements/Submit, Label => loc('Save Changes') &> + </form> <%INIT> - - #Update the acls. - my @results = ProcessACLChanges(\%ARGS); - -# {{{ Deal with setting up the display of current rights. - - -#Define vars used in html above - +# Update the acls. +my @results = ProcessACLs(\%ARGS); if (!defined $id) { Abort(loc("No Group defined")); @@ -93,20 +66,9 @@ if (!defined $id) { 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(); - - - -# }}} - +my @principals = GetPrincipalsMap($GroupObj, 'Users'); </%INIT> <%ARGS> $id => undef -$UserString => undef -$UserOp => undef -$UserField => undef </%ARGS> diff --git a/rt/share/html/Admin/Groups/index.html b/rt/share/html/Admin/Groups/index.html index 2485ea731..bd07b736a 100755 --- a/rt/share/html/Admin/Groups/index.html +++ b/rt/share/html/Admin/Groups/index.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,14 +46,40 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/GroupTabs, current_tab => 'Admin/Groups/', - current_subtab => 'Admin/Groups/', - Title => $title &> -<% $caption %>:<br /> +<& /Elements/Tabs &> +<h1><% $caption %></h1> + +<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Groups/index.html"> +<input type="hidden" name="GroupField" value="Name" /> +<input type="hidden" name="GroupOp" value="LIKE" /> +<&|/l&>Go to group</&> +<input type="text" name="GroupString" value="" id="autocomplete-GroupString" /> +<script type="text/javascript"> +jQuery(function(){ + jQuery("#autocomplete-GroupString").autocomplete({ + source: "<% RT->Config->Get('WebPath')%>/Helpers/Autocomplete/Groups", + // Auto-submit once a group is chosen + select: function( event, ui ) { + jQuery(event.target).val(ui.item.value); + var form = jQuery(event.target).closest('form'); + form.find('input[name=GroupOp]').val('='); + form.submit(); + } + }); +}); +</script> +</form> + +<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Groups/index.html"> +<&|/l&>Find groups whose</&> <& /Elements/SelectGroups &><br /> +<input type="checkbox" class="checkbox" name="FindDisabledGroups" value="1" <% $FindDisabledGroups? 'checked="checked"': '' |n %> /> <&|/l&>Include disabled groups in listing.</&><br /> +<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" /></div> +</form> % unless ( $Groups->Count ) { <em><&|/l&>No groups matching search criteria found.</&></em> % } else { +<p><&|/l&>Select a group</&>:</p> <& /Elements/CollectionList, OrderBy => 'Name', @@ -65,23 +91,8 @@ AllowSorting => 1, PassArguments => [qw(Format Rows Page Order OrderBy GroupString GroupOp GroupField FindDisabledGroups)], &> - -% my $ids = join ',', map $_->id, @{ $Groups->ItemsArrayRef }; -% if ( $ids ) { -<div align="right"><em> -(<a href="<% RT->Config->Get('WebPath') %>/Download/Tabular/Group/<% $ids %>/Groups.tsv"> -<&|/l&>Download as a tab-delimited file</&> -</a>)</em></div> -% } - -<br /><br /> % } -<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Groups/index.html"> -<input type="checkbox" class="checkbox" name="FindDisabledGroups" value="1" <% $FindDisabledGroups? 'checked="checked"': '' |n %> /> <&|/l&>Include disabled groups in listing.</&><br /> -<&|/l&>Find groups whose</&> <& /Elements/SelectGroups &><br /> -<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" /></div> -</form> <%INIT> my $Groups = RT::Groups->new($session{'CurrentUser'}); $Groups->LimitToUserDefinedGroups(); @@ -108,6 +119,8 @@ if (length $GroupString) { VALUE => $GroupString, ); } + RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Admin/Groups/Modify.html?id=".$Groups->First->id) + if $Groups->Count == 1 and $Groups->First; } else { $caption = loc("User-defined groups"); diff --git a/rt/share/html/Admin/Queues/CustomField.html b/rt/share/html/Admin/Queues/CustomField.html index 2663fabfd..5b9cfd24a 100755 --- a/rt/share/html/Admin/Queues/CustomField.html +++ b/rt/share/html/Admin/Queues/CustomField.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,20 +46,15 @@ %# %# 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 &> +<& /Elements/Tabs &> <& /Admin/Elements/EditCustomField, title => $title, %ARGS &> <%INIT> -my $QueueObj = new RT::Queue($session{'CurrentUser'}); +my $QueueObj = RT::Queue->new($session{'CurrentUser'}); $QueueObj->Load($Queue); -my ($title, $current_subtab); +my ($title); unless($QueueObj->id) { Abort(loc("Queue [_1] not found", $Queue)); @@ -67,16 +62,8 @@ unless($QueueObj->id) { 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 diff --git a/rt/share/html/Admin/Queues/CustomFields.html b/rt/share/html/Admin/Queues/CustomFields.html index 35ce724fd..88d7b7148 100755 --- a/rt/share/html/Admin/Queues/CustomFields.html +++ b/rt/share/html/Admin/Queues/CustomFields.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,12 +46,7 @@ %# %# 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 +<& /Elements/Tabs &> <& /Admin/Elements/EditCustomFields, %ARGS, title => $title, Object => $Object, ObjectType => 'RT::Queue' &> @@ -63,7 +58,7 @@ my $FriendlySubTypes = RT::CustomField->new( $session{'CurrentUser'} ) ->FriendlyLookupType( $Object->CustomFieldLookupType ); -my $title = loc( 'Edit Custom Fields for [_1]', $Object->Name ); +my $title = loc( 'Custom Fields for queue [_1]', $Object->Name ); </%INIT> <%ARGS> diff --git a/rt/share/html/Admin/Queues/GroupRights.html b/rt/share/html/Admin/Queues/GroupRights.html index ed3d5e27e..4c5ca071b 100755 --- a/rt/share/html/Admin/Queues/GroupRights.html +++ b/rt/share/html/Admin/Queues/GroupRights.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,75 +46,22 @@ %# %# 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/Tabs &> <& /Elements/ListActions, actions => \@results &> - <form method="post" action="GroupRights.html"> - <input type="hidden" class="hidden" name="id" value="<% $QueueObj->id %>" /> - - -<h1><&|/l&>System groups</&></h1> -<table> -% $m->callback( %ARGS, QueueObj => $QueueObj, results => \@results ); -% $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); +<form method="post" action="GroupRights.html" id="ModifyGroupRights" name="ModifyGroupRights"> + <input type="hidden" class="hidden" name="id" value="<% $QueueObj->id %>" /> + +% $m->callback( %ARGS, QueueObj => $QueueObj, results => \@results, principals => \@principals ); + + <& /Admin/Elements/EditRights, Context => $QueueObj, Principals => \@principals &> + <& /Elements/Submit, Label => loc('Save Changes') &> +</form> + +<%INIT> +# Update the acls. +my @results = ProcessACLs(\%ARGS); if (!defined $id) { Abort(loc("No Queue defined")); @@ -123,12 +70,9 @@ if (!defined $id) { 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; - +# Principal collections +my @principals = GetPrincipalsMap($QueueObj, qw(System Roles Groups)); </%INIT> - <%ARGS> $id => undef </%ARGS> diff --git a/rt/share/html/Admin/Queues/History.html b/rt/share/html/Admin/Queues/History.html index e3a0e9c4a..49a16fe35 100644 --- a/rt/share/html/Admin/Queues/History.html +++ b/rt/share/html/Admin/Queues/History.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,11 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/QueueTabs, - id => $id, - QueueObj => $QueueObj, - current_subtab => $current_tab, - Title => $title &> +<& /Elements/Tabs &> <& /Ticket/Elements/ShowHistory, Ticket => $QueueObj, @@ -58,8 +54,7 @@ &> <%INIT> -my $current_tab = 'Admin/Queues/History.html?id='.$id; -my $QueueObj = new RT::Queue($session{'CurrentUser'}); +my $QueueObj = RT::Queue->new($session{'CurrentUser'}); $QueueObj->Load($id) || Abort("Couldn't load queue '$id'"); my $title = loc("History of the queue [_1]", $QueueObj->Name); </%INIT> diff --git a/rt/share/html/Admin/Queues/Modify.html b/rt/share/html/Admin/Queues/Modify.html index 5dd7bf00c..5682eee28 100755 --- a/rt/share/html/Admin/Queues/Modify.html +++ b/rt/share/html/Admin/Queues/Modify.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,25 +46,31 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/QueueTabs, id => $QueueObj->id, - QueueObj => $QueueObj, - current_tab => $current_tab, - Title => $title &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> -<form action="<%RT->Config->Get('WebPath')%>/Admin/Queues/Modify.html" method="post"> +<form action="<%RT->Config->Get('WebPath')%>/Admin/Queues/Modify.html" name="ModifyQueue" method="post"> <input type="hidden" class="hidden" name="SetEnabled" value="1" /> <input type="hidden" class="hidden" name="id" value="<% $Create? 'new': $QueueObj->Id %>" /> <table> <tr><td align="right"><&|/l&>Queue Name</&>:</td> -<td colspan="3"><input name="Name" value="<% ($Create) ? "" : $QueueObj->Name %>" /></td> +<td colspan="3"><input name="Name" value="<% $Create ? "" : $QueueObj->Name || $Name %>" /></td> </tr> <tr><td align="right"><&|/l&>Description</&>:</td> -<td colspan="3"><input name="Description" value="<% ($Create) ? "" : $QueueObj->Description %>" size="60" /></td> +<td colspan="3"><input name="Description" value="<% $Create ? "" : $QueueObj->Description || $Description || '' %>" size="60" /></td> +</tr> + +<tr><td align="right"><&|/l&>Lifecycle</&>:</td> +<td colspan="3"><& /Widgets/Form/Select:InputOnly, + Name => 'Lifecycle', + Values => [ sort { loc($a) cmp loc($b) } RT::Lifecycle->List ], + CurrentValue => $Create ? "default" : $QueueObj->Lifecycle || $ARGS{'Lifecycle'}, + Default => 0, +&></td> </tr> <tr><td align="right"><&|/l&>Subject Tag</&>:</td> @@ -72,27 +78,27 @@ </tr> <tr><td align="right"><&|/l&>Reply Address</&>:</td> -<td><input name="CorrespondAddress" value="<% ($Create) ? "" : $QueueObj->CorrespondAddress %>" /> +<td><input name="CorrespondAddress" value="<% $Create ? "" : $QueueObj->CorrespondAddress || $CorrespondAddress || '' %>" /> <br /><span><em><&|/l , RT->Config->Get('CorrespondAddress')&>(If left blank, will default to [_1])</&></em></span></td> <td align="right"><&|/l&>Comment Address</&>:</td> -<td><input name="CommentAddress" value="<% ($Create) ? "" : $QueueObj->CommentAddress %>" /> +<td><input name="CommentAddress" value="<% $Create ? "" : $QueueObj->CommentAddress || $CommentAddress || '' %>" /> <br /><span><em><&|/l , RT->Config->Get('CommentAddress')&>(If left blank, will default to [_1])</&></em></span></td> </tr> <tr><td align="right"><&|/l&>Priority starts at</&>:</td> <td><& /Elements/SelectPriority, Name => "InitialPriority", - Default => $Create? 0: $QueueObj->InitialPriority, + Default => $Create? 0: $QueueObj->InitialPriority || $InitialPriority, &></td> <td align="right"><&|/l&>Over time, priority moves toward</&>:</td> <td><& /Elements/SelectPriority, Name => "FinalPriority", - Default => $Create? 0: $QueueObj->FinalPriority, -&></td> + Default => $Create? 0: $QueueObj->FinalPriority || $FinalPriority, +&><br /><span><em><&|/l&>requires running rt-crontool</&></em></span></td> </tr> <tr><td align="right"><&|/l&>Requests should be due in</&>:</td> -<td colspan="3"><input name="DefaultDueIn" value="<% ($Create) ? "" : $QueueObj->DefaultDueIn%>" /> <&|/l&>days</&>.</td> +<td colspan="3"><input name="DefaultDueIn" value="<% ($Create) ? "" : $QueueObj->DefaultDueIn || $DefaultDueIn || "" %>" /> <&|/l&>days</&>.</td> </tr> % my $CFs = $QueueObj->CustomFields; @@ -154,33 +160,28 @@ <%INIT> -my ($title, $current_tab, @results, $Disabled, $EnabledChecked); +my ($title, @results, @no_redirect_results, $Disabled, $EnabledChecked); my $QueueObj = RT::Queue->new( $session{'CurrentUser'} ); $QueueObj->Load( $id ) if !$id || $id eq 'new'; $EnabledChecked = 'checked="checked"'; -if ($Create) { - $current_tab = 'Admin/Queues/Modify.html?Create=1'; - $title = loc("Create a queue"); -} else { +unless ($Create) { if ( defined $id && $id eq 'new' ) { my ($val, $msg) = $QueueObj->Create( Name => $Name ); - Abort("$msg") unless $val; - delete $session{'create_in_queues'}; - push @results, $msg; - } - else { + if (!$val) { + $Create = 1; # Create failed, so bring us back to step 1 + } + push @results, $msg; + } else { $QueueObj->Load($id) || $QueueObj->Load($Name) || Abort(loc("Couldn't load queue '[_1]'", $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'}; + $title = loc('Configuration for queue [_1]', $QueueObj->Name ); my @attribs= qw(Description CorrespondAddress CommentAddress Name - InitialPriority FinalPriority DefaultDueIn Sign Encrypt SubjectTag Disabled); + InitialPriority FinalPriority DefaultDueIn Sign Encrypt Lifecycle SubjectTag Disabled); # we're asking about enabled on the web page but really care about disabled if ( $SetEnabled ) { @@ -189,6 +190,14 @@ if ( $QueueObj->Id ) { qw(Sign Encrypt Disabled); } + $m->callback( + CallbackName => 'BeforeUpdate', + Queue => $QueueObj, + AttributesRef => \@attribs, + ARGSRef => \%ARGS, + ); + + $ARGS{'Lifecycle'} = undef if defined $ARGS{'Lifecycle'} and $ARGS{'Lifecycle'} eq "default"; push @results, UpdateRecordObject( AttributesRef => \@attribs, Object => $QueueObj, @@ -212,10 +221,20 @@ if ( $QueueObj->Id ) { foreach my $address ( $QueueObj->CorrespondAddress, $QueueObj->CommentAddress ) { next unless defined $address && length $address; next if RT::EmailParser->IsRTAddress( $address ); - push @results, loc("RTAddressRegexp option in the config doesn't match [_1]", $address ); + push @no_redirect_results, loc("RTAddressRegexp option in the config doesn't match [_1]", $address ); } } +} else { + $title = loc("Create a queue"); } + +# This code does automatic redirection if any updates happen. +MaybeRedirectForResults( + Actions => \@results, + Arguments => { id => $QueueObj->Id }, +) if $QueueObj->id; + +push @results, @no_redirect_results; </%INIT> diff --git a/rt/share/html/Admin/Queues/People.html b/rt/share/html/Admin/Queues/People.html index 917d88c33..729749c33 100755 --- a/rt/share/html/Admin/Queues/People.html +++ b/rt/share/html/Admin/Queues/People.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,11 +45,9 @@ %# 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/Header, Title => $title &> + +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> @@ -63,15 +61,11 @@ <h3><&|/l&>Current watchers</&></h3> +% for my $Name (RT::Queue->ManageableRoleGroupTypes) { +<& /Admin/Elements/EditQueueWatcherGroup, Label => loc($Name), QueueObj => $QueueObj, Watchers => $QueueObj->$Name &> +% } -<&|/l&>Cc</&>: - -<& /Admin/Elements/EditQueueWatchers, QueueObj => $QueueObj, Watchers => $QueueObj->Cc &> - -<&|/l&>Administrative Cc</&>: - -<& /Admin/Elements/EditQueueWatchers, QueueObj => $QueueObj, Watchers => $QueueObj->AdminCc &> - +% $m->callback(CallbackName => 'CurrentWatchers', QueueObj => $QueueObj); </td> <td valign="top"> @@ -132,22 +126,13 @@ <%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'}); +my $QueueObj = RT::Queue->new($session{'CurrentUser'}); $QueueObj->Load($id) || Abort(loc("Couldn't load queue", $id)); -# }}} unless ($OnlySearchForPeople or $OnlySearchForGroup) { -# {{{ Delete deletable watchers +# Delete deletable watchers foreach my $key (keys %ARGS) { my $id = $QueueObj->Id; @@ -158,46 +143,49 @@ unless ($OnlySearchForPeople or $OnlySearchForGroup) { 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); + +# Add new watchers + foreach my $key (keys %ARGS) { + my $type = $ARGS{$key}; + + next unless $key =~ /^Queue-AddWatcher-Principal-(\d*)$/; + my $id = $1; + + next unless RT::Queue->IsManageableRoleGroupType($type); + + my ($code, $msg) = $QueueObj->AddWatcher( + Type => $type, + PrincipalId => $id, + ); 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; +if ( $ARGS{'UserString'} ) { + $Users = RT::Users->new( $session{'CurrentUser'} ); + $Users->Limit( FIELD => $ARGS{'UserField'}, + VALUE => $ARGS{'UserString'}, + OPERATOR => $ARGS{'UserOp'} + ); +} else { + $user_msg = loc("No principals selected."); + } + +if ( $ARGS{'GroupString'} ) { + $Groups = RT::Groups->new( $session{'CurrentUser'} ); + $Groups->Limit( FIELD => 'Domain', + OPERATOR => '=', + VALUE => 'UserDefined' + ); + $Groups->Limit( FIELD => $ARGS{'GroupField'}, + VALUE => $ARGS{'GroupString'}, + OPERATOR => $ARGS{'GroupOp'} + ); +} else { + $group_msg = loc("No principals selected."); +} +my $title = loc('People related to queue [_1]', $QueueObj->Name); </%INIT> <%ARGS> diff --git a/rt/share/html/Admin/Queues/Scrip.html b/rt/share/html/Admin/Queues/Scrip.html index b9c2834cb..ac0a783a7 100755 --- a/rt/share/html/Admin/Queues/Scrip.html +++ b/rt/share/html/Admin/Queues/Scrip.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,12 +46,7 @@ %# %# 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 &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> <& /Admin/Elements/EditScrip, title => $title, %ARGS, id => $id &> @@ -63,30 +58,13 @@ unless( $QueueObj->id ) { Abort(loc("Queue [_1] not found", $id)); } -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, - }, -}; +my ($title); ($id, my @results) = $m->comp( '/Admin/Elements/EditScrip:Process', %ARGS ); 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); } diff --git a/rt/share/html/Admin/Queues/Scrips.html b/rt/share/html/Admin/Queues/Scrips.html index 698e7e616..56e44664a 100755 --- a/rt/share/html/Admin/Queues/Scrips.html +++ b/rt/share/html/Admin/Queues/Scrips.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,12 +46,7 @@ %# %# 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 &> +<& /Elements/Tabs &> % unless ( $QueueObj->Disabled ) { # Global scrips does not apply to disabled queues <h2><&|/l&>Scrips which apply to all queues</&></h2> @@ -60,7 +55,7 @@ % } <& /Admin/Elements/EditScrips, title => $title, %ARGS &> <%init> -my $QueueObj = new RT::Queue($session{'CurrentUser'}); +my $QueueObj = RT::Queue->new($session{'CurrentUser'}); $QueueObj->Load($id); my $title; @@ -70,16 +65,6 @@ if ($QueueObj->id) { } 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> diff --git a/rt/share/html/Admin/Queues/Template.html b/rt/share/html/Admin/Queues/Template.html index 640e16119..3dd99e1d7 100755 --- a/rt/share/html/Admin/Queues/Template.html +++ b/rt/share/html/Admin/Queues/Template.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,15 +46,10 @@ %# %# 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/Tabs &> <& /Elements/ListActions, actions => \@results &> -<form method="post" action="Template.html"> +<form method="post" name="ModifyTemplate" id="ModifyTemplate" action="Template.html"> %if ($Create ) { <input type="hidden" class="hidden" name="Template" value="new" /> % } else { @@ -63,64 +58,61 @@ %# hang onto the queue id <input type="hidden" class="hidden" name="Queue" value="<%$Queue%>" /> -<& /Admin/Elements/ModifyTemplate, Name => $TemplateObj->Name, Description => -$TemplateObj->Description, Content => $TemplateObj->Content &> +<& /Admin/Elements/ModifyTemplate, + Name => $TemplateObj->Name, + Description => $TemplateObj->Description, + Content => $TemplateObj->Content, + Type => $TemplateObj->Type +&> <& /Elements/Submit, Label => $SubmitLabel, Reset => 1 &> </form> <%INIT> -my $TemplateObj = new RT::Template($session{'CurrentUser'}); -my ($title, @results, $current_subtab, $SubmitLabel); +my $TemplateObj = RT::Template->new( $session{'CurrentUser'} ); +my $QueueObj; +my $SubmitLabel; +my $title; +my @results; -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 ) { + 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') ); + } -if ($Create) { - $title = loc("Create a template"); - $current_subtab = "Admin/Queues/Template.html?Create=1&Queue=".$Queue; - $SubmitLabel = loc('Create'); } -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())); - $SubmitLabel = loc('Save Changes'); - - +if ( $TemplateObj->Id() ) { + $Queue = $TemplateObj->Queue; + $QueueObj = $TemplateObj->QueueObj; + + my @attribs = qw( Description Content Queue Name Type ); + my @aresults = UpdateRecordObject( AttributesRef => \@attribs, + Object => $TemplateObj, + ARGSRef => \%ARGS + ); + push @results, @aresults; + + my ( $ok, $msg ) = $TemplateObj->CompileCheck; + push @results, $msg if !$ok; +} else { + $QueueObj = RT::Queue->new( $session{'CurrentUser'} ); + $QueueObj->Load($Queue); } -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; +if ($Create) { + $title = loc( 'Create a new template for queue [_1]', $QueueObj->Name ); + $SubmitLabel = loc('Create'); } else { - $QueueObj = RT::Queue->new($session{'CurrentUser'}); - $QueueObj->Load($Queue); + + $title = loc( 'Modify template [_1] for queue [_2]', loc( $TemplateObj->Name()), $QueueObj->Name ); + $SubmitLabel = loc('Save Changes'); } </%INIT> diff --git a/rt/share/html/Admin/Queues/Templates.html b/rt/share/html/Admin/Queues/Templates.html index aac833271..7df0ed2e0 100755 --- a/rt/share/html/Admin/Queues/Templates.html +++ b/rt/share/html/Admin/Queues/Templates.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,34 +46,18 @@ %# %# 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 &> +<& /Elements/Tabs &> <& /Admin/Elements/EditTemplates, title => $title, %ARGS &> <%INIT> -my $QueueObj = new RT::Queue($session{'CurrentUser'}); +my $QueueObj = RT::Queue->new($session{'CurrentUser'}); $QueueObj->Load($id); -my ($title, $current_subtab); - -if ($QueueObj->id) { - $title = loc("Edit Templates for queue [_1]", $QueueObj->Name); -} else { +if (!$QueueObj->id) { 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, - } - }; +my $title = loc("Templates for queue [_1]", $QueueObj->Name); </%INIT> <%ARGS> diff --git a/rt/share/html/Admin/Queues/UserRights.html b/rt/share/html/Admin/Queues/UserRights.html index b45c9968e..a7980dcbf 100755 --- a/rt/share/html/Admin/Queues/UserRights.html +++ b/rt/share/html/Admin/Queues/UserRights.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,44 +46,23 @@ %# %# 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/Tabs &> <& /Elements/ListActions, actions => \@results &> - <form method="post" action="UserRights.html"> - <input type="hidden" class="hidden" name="id" value="<% $QueueObj->id %>" /> - - -<table> -% $m->callback( %ARGS, QueueObj => $QueueObj, results => \@results ); -% 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"><& /Elements/ShowUser, User => $UserObj &></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); +<form method="post" action="UserRights.html" name="ModifyUserRights" id="ModifyUserRights"> + <input type="hidden" class="hidden" name="id" value="<% $QueueObj->id %>" /> -# {{{ Deal with setting up the display of current rights. +%# XXX TODO put this somewhere more reasonable +% $m->callback( %ARGS, QueueObj => $QueueObj, results => \@results ); + <& /Admin/Elements/EditRights, Context => $QueueObj, Principals => \@principals &> + + <& /Elements/Submit, Label => loc('Save Changes') &> +</form> +<%INIT> +# Update the acls. +my @results = ProcessACLs(\%ARGS); if (!defined $id) { Abort(loc("No Queue defined")); @@ -92,16 +71,7 @@ if (!defined $id) { 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; +my @principals = GetPrincipalsMap($QueueObj, 'Users'); </%INIT> <%ARGS> diff --git a/rt/share/html/Admin/Queues/index.html b/rt/share/html/Admin/Queues/index.html index b5a2bb4f2..c7a4701b2 100755 --- a/rt/share/html/Admin/Queues/index.html +++ b/rt/share/html/Admin/Queues/index.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,9 +46,7 @@ %# %# 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") &> +<& /Elements/Tabs &> @@ -91,7 +89,7 @@ </form> <%INIT> -my $queues = new RT::Queues($session{'CurrentUser'}); +my $queues = RT::Queues->new($session{'CurrentUser'}); $queues->FindAllRows if $FindDisabledQueues; my ($caption); @@ -104,6 +102,8 @@ if ( defined $QueueString && length $QueueString ) { OPERATOR => $QueueOp, VALUE => $QueueString, ); + RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Admin/Queues/Modify.html?id=".$queues->First->id) + if $queues->Count == 1; } else { $queues->UnLimit; $caption = $FindDisabledQueues diff --git a/rt/share/html/Admin/Tools/Configuration.html b/rt/share/html/Admin/Tools/Configuration.html index f4c648a11..ed7d4651b 100644 --- a/rt/share/html/Admin/Tools/Configuration.html +++ b/rt/share/html/Admin/Tools/Configuration.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -53,10 +53,7 @@ unless ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'Super } </%init> <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/ToolTabs, - current_tab => 'Admin/Tools/Configuration.html', - current_subtab => 'Admin/Tools/Configuration.html', - Title => $title &> +<& /Elements/Tabs &> <&|/Widgets/TitleBox, title => loc("RT Configuration") &> <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection"> @@ -68,7 +65,7 @@ unless ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'Super <%PERL> my $index_conf; foreach my $key ( RT->Config->Options( Overridable => undef, Sorted => 0 ) ) { - my $val = RT->Config->Get( $key ); + my $val = RT->Config->GetObfuscated( $key ); next unless defined $val; my $meta = RT->Config->Meta( $key ); @@ -91,19 +88,13 @@ foreach my $key ( RT->Config->Options( Overridable => undef, Sorted => 0 ) ) { <td class="collection-as-table"><% $key %></td> <td class="collection-as-table"> % if ( $key =~ /Password(?!Length)/i ) { -<em>Password not printed</em>\ -% } elsif ( !ref $val ) { -<% "$val" %>\ -% } elsif ( ref $val eq 'ARRAY' ) { -<% join ', ', @$val %>\ -% } elsif ( ref $val eq 'HASH' ) { -<% join ', ', %$val %>\ +<em><% loc('Password not printed' ) %></em>\ % } else { -<% ref $val %>\ +<% stringify($val) |n %>\ % } </td> <td class="collection-as-table" style="white-space: nowrap"> -% if ( $description =~ /^.*site config$/ ) { +% if ( $meta->{'Source'}{'SiteConfig'} ) { <span style="font-weight: bold"><% $description %></span> % } else { <% $description %> @@ -134,7 +125,7 @@ foreach my $key ( sort keys %{*RT::} ) { <td class="collection-as-table">RT::<% $key %></td> <td class="collection-as-table"> % if ( $key =~ /Password(?!Length)/i ) { -<em>Password not printed</em> +<em><% loc('Password not printed' ) %></em>\ % } else { <% ${'RT::'.$key} %> % } @@ -157,7 +148,7 @@ for my $type (qw/Tickets Queues Transactions Groups PrivilegedUsers Unprivileged my $count; my $class = 'RT::' . $type; $class =~ s/Privileged|Unprivileged//; - my $collection = $class->new($RT::SystemUser); + my $collection = $class->new(RT->SystemUser); $collection->UnLimit; if ($type =~ /PrivilegedUsers/) { $user_count = $collection->CountAll; @@ -182,7 +173,7 @@ for my $type (qw/Tickets Queues Transactions Groups PrivilegedUsers Unprivileged <&|/Widgets/TitleBox, title => loc("Mason template search order") &> <ol> -% foreach my $path ( map { $_->[1] } $m->interp->comp_root_array ) { +% foreach my $path ( RT::Interface::Web->ComponentRoots ) { <li><% $path %></li> % } </ol> @@ -199,6 +190,30 @@ for my $type (qw/Tickets Queues Transactions Groups PrivilegedUsers Unprivileged </td> </table> +<&|/Widgets/TitleBox, title => loc("Global Attributes") &> +<table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection"> +<tr class="collection-as-table"> +<th class="collection-as-table"><&|/l&>Name</&></th> +<th class="collection-as-table"><&|/l&>Value</&></th> +</tr> +% my $attrs = $RT::System->Attributes; +% my $index_size = 0; +% while ( my $attr = $attrs->Next ) { +<tr class="<% $index_size%2 ? 'oddline' : 'evenline'%>"> +% if ($attr->Name eq 'UserLogo') { +% my $content = $attr->Content; +% $content->{data} = defined $content->{data} ? 'DATA' : 'undef' +% if exists $content->{data}; +<td><% $attr->Name %></td><td><% stringify($content) |n %></td> +% } else { +<td><% $attr->Name %></td><td><% stringify($attr->Content) |n %></td> +% } +</tr> +% $index_size++; +% } +</table> +</&> + <&|/Widgets/TitleBox, title => loc("Loaded perl modules")&> <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection"> <tr class="collection-as-table"> @@ -227,7 +242,7 @@ if ($item =~ /^\s*(.*?)\s*v(\S+);/) { <%$ver%> </td> <td class="collection-as-table"> - <% $INC{$distfile} %> + <% $INC{$distfile} || '' %> </td> </tr> % } @@ -240,3 +255,18 @@ if ($item =~ /^\s*(.*?)\s*v(\S+);/) { <% Config::myconfig() %> </pre> </&> + +<%INIT> +use Data::Dumper; +local $Data::Dumper::Terse = 1; +local $Data::Dumper::Indent = 2; + +sub stringify { + my $value = shift; + my $output = Dumper $value; + RT::Interface::Web::EscapeUTF8(\$output); + $output =~ s/ / /g; + $output =~ s!\n!<br />!g; + return $output; +} +</%INIT> diff --git a/rt/share/html/Admin/Tools/Shredder/Dumps/dhandler b/rt/share/html/Admin/Tools/Shredder/Dumps/dhandler index e742001dd..8b84cf4d9 100644 --- a/rt/share/html/Admin/Tools/Shredder/Dumps/dhandler +++ b/rt/share/html/Admin/Tools/Shredder/Dumps/dhandler @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/DumpFileLink b/rt/share/html/Admin/Tools/Shredder/Elements/DumpFileLink index 0f96b4348..5690377cd 100644 --- a/rt/share/html/Admin/Tools/Shredder/Elements/DumpFileLink +++ b/rt/share/html/Admin/Tools/Shredder/Elements/DumpFileLink @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoRights b/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoRights index 0d4e572ad..429313755 100644 --- a/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoRights +++ b/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoRights @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,10 +46,6 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => 'Error' &> -<& /Admin/Elements/ToolTabs, - current_tab => 'Admin/Tools/Shredder', - current_subtab => 'Admin/Tools/Shredder', - Title => 'Error', -&> +<& /Elements/Tabs &> <div class="error"><% loc("You don't have <b>SuperUser</b> right.") |n%></div> diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoStorage b/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoStorage index bae4685b0..ce934111c 100644 --- a/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoStorage +++ b/rt/share/html/Admin/Tools/Shredder/Elements/Error/NoStorage @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -49,11 +49,8 @@ $Path => '' </%ARGS> <& /Admin/Elements/Header, Title => 'Error' &> -<& /Admin/Elements/ToolTabs, - current_tab => 'Admin/Tools/Shredder', - current_subtab => 'Admin/Tools/Shredder', - Title => 'Error', -&> +<& /Elements/Tabs &> <div class="error"> -<% loc('Shredder needs a directory to write dumps to. Please check that you have <span class="file-path">[_1]</span> and it is writable by your web server.', $m->interp->apply_escapes( $Path ) ) |n%> +% my $path_tag = q{<span class="file-path">} . $m->interp->apply_escapes($Path, 'h') . q{</span>}; +<&|/l, $path_tag &>Shredder needs a directory to write dumps to. Please ensure that the directory [_1] exists and that it is writable by your web server.</&> </div> diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Attachment b/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Attachment index 02ef90b3e..11b876bf2 100644 --- a/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Attachment +++ b/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Attachment @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -48,6 +48,7 @@ <%ARGS> $Object => undef </%ARGS> +% my $name = (defined $Object->Filename and length $Object->Filename) ? $Object->Filename : loc("(no value)"); <a href="<% RT->Config->Get('WebURL') %>/Ticket/Attachment/<% $Object->TransactionId %>/<% $Object->id %>/"> -<% loc('Attachment') %>(<% loc('id') %>:<% $Object->id %>, <% loc('FileName') %>: <% $Object->Filename || loc('(no value)') %>) +<% loc('Attachment') %>(<% loc('id') %>:<% $Object->id %>, <% loc('Filename') %>: <% $name %>) </a> diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Ticket b/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Ticket index ec052d642..13547ad30 100644 --- a/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Ticket +++ b/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--Ticket @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--User b/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--User index 125f4f2c8..f77169a6f 100644 --- a/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--User +++ b/rt/share/html/Admin/Tools/Shredder/Elements/Object/RT--User @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/ObjectCheckBox b/rt/share/html/Admin/Tools/Shredder/Elements/ObjectCheckBox index e14c5c5a8..3c2e1e7b6 100644 --- a/rt/share/html/Admin/Tools/Shredder/Elements/ObjectCheckBox +++ b/rt/share/html/Admin/Tools/Shredder/Elements/ObjectCheckBox @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/PluginArguments b/rt/share/html/Admin/Tools/Shredder/Elements/PluginArguments index 67b46ad9d..d9926af9c 100644 --- a/rt/share/html/Admin/Tools/Shredder/Elements/PluginArguments +++ b/rt/share/html/Admin/Tools/Shredder/Elements/PluginArguments @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -56,7 +56,7 @@ $Plugin => '' </div> <%INIT> use RT::Shredder::Plugin; -my $plugin_obj = new RT::Shredder::Plugin; +my $plugin_obj = RT::Shredder::Plugin->new; my ($status, $msg) = $plugin_obj->LoadByName( $Plugin ); die $msg unless $status; </%INIT> diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/PluginHelp b/rt/share/html/Admin/Tools/Shredder/Elements/PluginHelp index daaa6b74a..7719ec027 100644 --- a/rt/share/html/Admin/Tools/Shredder/Elements/PluginHelp +++ b/rt/share/html/Admin/Tools/Shredder/Elements/PluginHelp @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -53,7 +53,7 @@ $Plugin => '' </div> <%ONCE> use RT::Shredder::Plugin; -my $plugin_obj = new RT::Shredder::Plugin; +my $plugin_obj = RT::Shredder::Plugin->new; my %plugins = $plugin_obj->List; </%ONCE> <%INIT> diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/SelectObjects b/rt/share/html/Admin/Tools/Shredder/Elements/SelectObjects index 2488b73f4..7bae913ae 100644 --- a/rt/share/html/Admin/Tools/Shredder/Elements/SelectObjects +++ b/rt/share/html/Admin/Tools/Shredder/Elements/SelectObjects @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Tools/Shredder/Elements/SelectPlugin b/rt/share/html/Admin/Tools/Shredder/Elements/SelectPlugin index 3835e0b99..e55f60eb0 100644 --- a/rt/share/html/Admin/Tools/Shredder/Elements/SelectPlugin +++ b/rt/share/html/Admin/Tools/Shredder/Elements/SelectPlugin @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -68,6 +68,6 @@ $Plugin => '' </div> <%ONCE> use RT::Shredder::Plugin; -my $plugin_obj = new RT::Shredder::Plugin; +my $plugin_obj = RT::Shredder::Plugin->new; my %plugins = $plugin_obj->List('Search'); </%ONCE> diff --git a/rt/share/html/Admin/Tools/Shredder/autohandler b/rt/share/html/Admin/Tools/Shredder/autohandler index e7f31b575..955206420 100644 --- a/rt/share/html/Admin/Tools/Shredder/autohandler +++ b/rt/share/html/Admin/Tools/Shredder/autohandler @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/Tools/Shredder/index.html b/rt/share/html/Admin/Tools/Shredder/index.html index 8cea3e42c..81b99ec19 100644 --- a/rt/share/html/Admin/Tools/Shredder/index.html +++ b/rt/share/html/Admin/Tools/Shredder/index.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -52,11 +52,7 @@ $Wipeout => '' @WipeoutObject => () </%ARGS> <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/ToolTabs, - current_tab => 'Admin/Tools/Shredder', - current_subtab => 'Admin/Tools/Shredder', - Title => $title, -&> +<& /Elements/Tabs &> <form id="shredder-search-form" action="<% RT->Config->Get('WebPath') %>/Admin/Tools/Shredder/" method="GET"> <div id="shredder-select-plugin"> <& /Elements/ListActions, actions => $messages{'Errors'} &> @@ -96,7 +92,7 @@ my $catch_non_fatals = sub { if( $Plugin ) { { # use additional block({}) to effectively exit block on errors use RT::Shredder::Plugin; - $plugin_obj = new RT::Shredder::Plugin; + $plugin_obj = RT::Shredder::Plugin->new; my( $status, $msg ) = $plugin_obj->LoadByName( $Plugin ); unless( $status ) { push @{ $messages{Errors} }, $msg; @@ -128,8 +124,8 @@ if( $Plugin ) { { # use additional block({}) to effectively exit block on errors my $dump_file = ''; if( $Plugin && $Wipeout ) { { # use additional block({}) to effectively exit block on errors - my $shredder = new RT::Shredder( force => 1 ); - my $backup_plugin = new RT::Shredder::Plugin; + my $shredder = RT::Shredder->new( force => 1 ); + my $backup_plugin = RT::Shredder::Plugin->new; my ($status, $msg) = $backup_plugin->LoadByName('SQLDump'); unless( $status ) { push @{ $messages{Errors} }, $msg; @@ -172,7 +168,7 @@ if( $Plugin && ( $Search || $Wipeout ) ) { { # use additional block({}) to effec } push @{ $messages{Success} }, loc('executed plugin successfuly'); - my $shredder = new RT::Shredder; + my $shredder = RT::Shredder->new; foreach my $o( grep defined, splice @objs ) { eval { push @objs, $shredder->CastObjectsToRecords( Objects => $o ) }; $catch_non_fatals->() && last if $@; diff --git a/rt/share/html/Admin/Tools/index.html b/rt/share/html/Admin/Tools/index.html index 506385bdf..88612704a 100644 --- a/rt/share/html/Admin/Tools/index.html +++ b/rt/share/html/Admin/Tools/index.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,11 +45,6 @@ %# 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 &> +<& /Admin/Elements/Header, Title => loc('System Tools') &> +<& /Elements/Tabs &> +<& /Elements/ListMenu, menu => Menu()->child('tools')->child('config')->child('tools') &> diff --git a/rt/share/html/Admin/Users/CustomFields.html b/rt/share/html/Admin/Users/CustomFields.html index 82e8bbc76..bebb163eb 100644 --- a/rt/share/html/Admin/Users/CustomFields.html +++ b/rt/share/html/Admin/Users/CustomFields.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,12 +46,7 @@ %# %# 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 +<& /Elements/Tabs &> <& /Admin/Elements/EditCustomFields, %ARGS, title => $title, Object => $Object, ObjectType => 'RT::User' &> diff --git a/rt/share/html/Admin/Users/GnuPG.html b/rt/share/html/Admin/Users/GnuPG.html index de1199340..90408e449 100644 --- a/rt/share/html/Admin/Users/GnuPG.html +++ b/rt/share/html/Admin/Users/GnuPG.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,12 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/UserTabs, - id => $id, - UserObj => $UserObj, - current_tab => 'Admin/Users/GnuPG.html?id='. $id, - Title => $title, -&> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> diff --git a/rt/share/html/Admin/Users/History.html b/rt/share/html/Admin/Users/History.html index e8928c8d5..fb51038ee 100644 --- a/rt/share/html/Admin/Users/History.html +++ b/rt/share/html/Admin/Users/History.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,11 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/UserTabs, - id => $id, - UserObj => $UserObj, - current_tab => $current_tab, - Title => $title &> +<& /Elements/Tabs &> <& /Ticket/Elements/ShowHistory, Ticket => $UserObj, @@ -58,8 +54,7 @@ &> <%INIT> -my $current_tab = 'Admin/Users/History.html?id='.$id; -my $UserObj = new RT::User($session{'CurrentUser'}); +my $UserObj = RT::User->new($session{'CurrentUser'}); $UserObj->Load($id) || Abort("Couldn't load user '$id'"); my $title = loc("History of the user [_1]", $UserObj->Name); </%INIT> diff --git a/rt/share/html/Admin/Users/Memberships.html b/rt/share/html/Admin/Users/Memberships.html index 5422e120e..443e189a9 100644 --- a/rt/share/html/Admin/Users/Memberships.html +++ b/rt/share/html/Admin/Users/Memberships.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,11 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/UserTabs, - id => $id, - UserObj => $UserObj, - current_tab => $current_tab, - Title => $title &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> @@ -63,12 +59,12 @@ OrderBy => 'Name', Order => 'ASC', %ARGS, - Rows => 0, + Rows => 20, DisplayFormat => "__CheckBox.{Delete}__,$Format", Format => $Format, Collection => $is_member, AllowSorting => 1, - PassArguments => [qw(Format Rows Order OrderBy id)], + PassArguments => [qw(Format Rows Page Order OrderBy id)], &> <h2><&|/l&>Groups the user is not member of (check box to add)</&></h2> @@ -76,7 +72,7 @@ <& /Elements/CollectionList, OrderBy => 'Name', Order => 'ASC', - Rows => 100, + Rows => 20, %ARGS, DisplayFormat => "__CheckBox.{Add}__,'__HasMemberRecursively.{$id}__/TITLE:Recursive',$Format", Format => $Format, @@ -94,7 +90,6 @@ 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; my @results; if ( $Update ) { diff --git a/rt/share/html/Admin/Users/Modify.html b/rt/share/html/Admin/Users/Modify.html index 28d594377..b14f936f4 100755 --- a/rt/share/html/Admin/Users/Modify.html +++ b/rt/share/html/Admin/Users/Modify.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,11 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/UserTabs, - id => $id, - UserObj => $UserObj, - current_tab => $current_tab, - Title => $title &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> @@ -70,37 +66,37 @@ <tr><td align="right"> <&|/l&>Username</&>: </td><td> -<input name="Name" value="<%$UserObj->Name||''%>" /> <strong><&|/l&>(required)</&></strong> +<input name="Name" value="<%$UserObj->Name||$Name||''%>" /> <strong><&|/l&>(required)</&></strong> </td></tr> <tr><td align="right"> <&|/l&>Email</&>: </td><td> -<input name="EmailAddress" value="<%$UserObj->EmailAddress||''%>" /> +<input name="EmailAddress" value="<%$UserObj->EmailAddress||$EmailAddress||''%>" /> </td></tr> <tr><td align="right"> <&|/l&>Real Name</&>: </td><td> -<input name="RealName" value="<%$UserObj->RealName||''%>" /> +<input name="RealName" value="<%$UserObj->RealName||$RealName||''%>" /> </td></tr> <tr><td align="right"> <&|/l&>Nickname</&>: </td><td> -<input name="NickName" value="<%$UserObj->NickName||''%>" /> +<input name="NickName" value="<%$UserObj->NickName||$NickName||''%>" /> </td></tr> <tr><td align="right"> <&|/l&>Unix login</&>: </td><td> -<input name="Gecos" value="<%$UserObj->Gecos||''%>" /> +<input name="Gecos" value="<%$UserObj->Gecos||$Gecos||''%>" /> </td></tr> <tr><td align="right"> <&|/l&>Language</&>: </td><td> -<& /Elements/SelectLang, Name => 'Lang', Default => $UserObj->Lang &> +<& /Elements/SelectLang, Name => 'Lang', Default => $UserObj->Lang||$Lang &> </td></tr> <tr><td align="right"> <&|/l&>Extra info</&>: </td><td> -<textarea name="FreeformContactInfo" cols="20" rows="5"><%$UserObj->FreeformContactInfo||''%></textarea> +<textarea name="FreeformContactInfo" cols="20" rows="5"><%$UserObj->FreeformContactInfo||$FreeformContactInfo||''%></textarea> </td></tr> </table> </&> @@ -134,39 +130,39 @@ <tr><td align="right"> <&|/l&>Organization</&>: </td><td> -<input name="Organization" value="<%$UserObj->Organization||''%>" /> +<input name="Organization" value="<%$UserObj->Organization||$Organization||''%>" /> </td></tr> <tr><td align="right"> <&|/l&>Address1</&>: </td><td> -<input name="Address1" value="<%$UserObj->Address1||''%>" /> +<input name="Address1" value="<%$UserObj->Address1||$Address1||''%>" /> </td></tr> <tr><td align="right"> <&|/l&>Address2</&>: </td><td> -<input name="Address2" value="<%$UserObj->Address2||''%>" /> +<input name="Address2" value="<%$UserObj->Address2||$Address2||''%>" /> </td></tr> <tr><td align="right"> <&|/l&>City</&>: </td><td> -<input name="City" value="<%$UserObj->City||''%>" size="14" /> +<input name="City" value="<%$UserObj->City||$City||''%>" size="14" /> </td></tr> <tr><td align="right"> <&|/l&>State</&>: </td><td> -<input name="State" value="<%$UserObj->State||''%>" size="3" /> +<input name="State" value="<%$UserObj->State||$State||''%>" size="3" /> </td></tr> <tr><td align="right"> <&|/l&>Zip</&>: </td><td> -<input name="Zip" value="<%$UserObj->Zip||''%>" size="9" /> +<input name="Zip" value="<%$UserObj->Zip||$Zip||''%>" size="9" /> </td></tr> <tr><td align="right"> <&|/l&>Country</&>: </td><td> -<input name="Country" value="<%$UserObj->Country||''%>" /> +<input name="Country" value="<%$UserObj->Country||$Country||''%>" /> </td></tr> </table> </&> @@ -176,22 +172,22 @@ <tr><td align="right"> <&|/l&>Residence</&>: </td><td> -<input name="HomePhone" value="<%$UserObj->HomePhone||''%>" size="13" /><br /> +<input name="HomePhone" value="<%$UserObj->HomePhone||$HomePhone||''%>" size="13" /><br /> </td></tr> <tr><td align="right"> <&|/l&>Work</&>: </td><td> -<input name="WorkPhone" value="<%$UserObj->WorkPhone||''%>" size="13" /><br /> +<input name="WorkPhone" value="<%$UserObj->WorkPhone||$WorkPhone||''%>" size="13" /><br /> </td></tr> <tr><td align="right"> <&|/l&>Mobile</&>: </td><td> -<input name="MobilePhone" value="<%$UserObj->MobilePhone||''%>" size="13" /><br /> +<input name="MobilePhone" value="<%$UserObj->MobilePhone||$MobilePhone||''%>" size="13" /><br /> </td></tr> <tr><td align="right"> <&|/l&>Pager</&>: </td><td> -<input name="PagerPhone" value="<%$UserObj->PagerPhone||''%>" size="13" /><br /> +<input name="PagerPhone" value="<%$UserObj->PagerPhone||$PagerPhone||''%>" size="13" /><br /> </td> </tr> </table> @@ -218,12 +214,12 @@ <tr> <td colspan="2"> <&| /Widgets/TitleBox, title => loc('Comments about this user') &> -<textarea class="comments" name="Comments" cols="80" rows="5" wrap="virtual"><%$UserObj->Comments||''%></textarea> +<textarea class="comments" name="Comments" cols="80" rows="5" wrap="virtual"><%$UserObj->Comments||$Comments||''%></textarea> </&> %if (!$Create && $UserObj->Privileged) { <br /> <&| /Widgets/TitleBox, title => loc('Signature') &> -<textarea class="signature" cols="80" rows="5" name="Signature" wrap="hard"><%$UserObj->Signature||''%></textarea> +<textarea class="signature" cols="80" rows="5" name="Signature" wrap="hard"><%$UserObj->Signature||$Signature||''%></textarea> </&> % } @@ -240,20 +236,16 @@ <%INIT> -my $current_tab; -my $UserObj = new RT::User($session{'CurrentUser'}); +my $UserObj = RT::User->new($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; - if ( defined $id && $id eq 'new') { ( $val, $msg ) = $UserObj->Create( Name => $Name, @@ -318,6 +310,7 @@ else { } +$m->callback( %ARGS, CallbackName => 'BeforeUpdate', User => $UserObj, ARGSRef => \%ARGS, Results => \@results ); # If we have a user to modify, lets try. @@ -354,7 +347,6 @@ if ($UserObj->Id && $id ne 'new') { } - # }}} } @@ -379,13 +371,15 @@ unless ( $UserObj->id && $UserObj->Disabled ) { $EnabledChecked = 'checked="checked"'; } -if (!$Create && $UserObj->Privileged()) { +if ((!$Create && $UserObj->Privileged()) or (!$UserObj->Id and $Privileged)) { $PrivilegedChecked = 'checked="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; +# This code does automatic redirection if any updates happen. +MaybeRedirectForResults( + Actions => \@results, + Arguments => { id => $UserObj->Id }, +) if $UserObj->Id; </%INIT> diff --git a/rt/share/html/Admin/Users/MyRT.html b/rt/share/html/Admin/Users/MyRT.html index 346a2d60c..0fcd63b60 100644 --- a/rt/share/html/Admin/Users/MyRT.html +++ b/rt/share/html/Admin/Users/MyRT.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,11 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/UserTabs, - id => $id, - UserObj => $UserObj, - current_tab => $current_tab, - Title => $title &> +<& /Elements/Tabs &> <& /Widgets/SelectionBox:header, nojs => 1 &> @@ -72,9 +68,7 @@ <%init> my @actions; -my $current_tab; -$current_tab = 'Admin/Users/MyRT.html?id='.$id if $id; -my $UserObj = new RT::User($session{'CurrentUser'}); +my $UserObj = RT::User->new($session{'CurrentUser'}); $UserObj->Load($id) || Abort("Couldn't load user '" . ($id || '') . "'"); my $title = loc("RT at a glance for the user [_1]", $UserObj->Name); @@ -94,7 +88,7 @@ push @items, map {["component-$_", $_]} sort keys %allowed_components; my $sys = RT::System->new( RT::CurrentUser->new($UserObj) ); my @objs = ($sys); -push @objs, RT::SavedSearches->new( RT::CurrentUser->new( $UserObj ) )->_PrivacyObjects; +push @objs, RT::SavedSearch->new( RT::CurrentUser->new( $UserObj ) )->ObjectsForLoading; for my $object (@objs) { for ($m->comp("/Search/Elements/SearchesForObject", Object => $object)) { diff --git a/rt/share/html/Admin/Users/index.html b/rt/share/html/Admin/Users/index.html index 6561abf86..a1e3facd7 100755 --- a/rt/share/html/Admin/Users/index.html +++ b/rt/share/html/Admin/Users/index.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,15 +46,51 @@ %# %# 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') &> - +<& /Elements/Tabs &> + <h1><% $caption %></h1> -<p><&|/l&>Select a user</&>:</p> + +<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Users/index.html"> +% foreach my $field( qw(Format Rows Page Order OrderBy) ) { +% next unless defined $ARGS{ $field } && length $ARGS{ $field }; +<input type="hidden" name="<% $field %>" value="<% $ARGS{ $field } %>" /> +% } +<input type="hidden" name="UserField" value="Name" /> +<input type="hidden" name="UserOp" value="LIKE" /> +<&|/l&>Go to user</&> +<input type="text" name="UserString" value="" id="autocomplete-UserString" /> +<script type="text/javascript"> +jQuery(function(){ + jQuery("#autocomplete-UserString").autocomplete({ + source: "<% RT->Config->Get('WebPath')%>/Helpers/Autocomplete/Users?return=Name", + // Auto-submit once a user is chosen + select: function( event, ui ) { + jQuery(event.target).val(ui.item.value); + var form = jQuery(event.target).closest('form'); + form.find('input[name=UserOp]').val('='); + form.submit(); + } + }); +}); +</script> +</form> + +<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Users/index.html"> +% foreach my $field( qw(Format Rows Page Order OrderBy) ) { +% next unless defined $ARGS{ $field } && length $ARGS{ $field }; +<input type="hidden" name="<% $field %>" value="<% $ARGS{ $field } %>" /> +% } +<&|/l&>Find all users whose</&> <& /Elements/SelectUsers, %ARGS, Fields => \@fields &><br /> +<input type="checkbox" class="checkbox" name="FindDisabledUsers" value="1" <% $FindDisabledUsers? 'checked="checked"': '' %> /> +<&|/l&>Include disabled users in search.</&> +<br /> +<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" /></div> +</form> + % unless ( $users->Count ) { <em><&|/l&>No users matching search criteria found.</&></em> % } else { +<p><&|/l&>Select a user</&>:</p> <& /Elements/CollectionList, OrderBy => 'Name', @@ -67,29 +103,8 @@ PassArguments => [qw(Format Rows Page Order OrderBy UserString UserOp UserField IdLike EmailLike FindDisabledUsers)], &> -% my $ids = join ',', map $_->id, @{ $users->ItemsArrayRef }; -% if ( $ids ) { -<div align="right"><em> -(<a href="<%RT->Config->Get('WebPath')%>/Download/Tabular/User/<% $ids %>/Users.tsv"> -<&|/l&>Download as a tab-delimited file</&> -</a>)</em></div> % } -<br /><br /> -% } - -<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Users/index.html"> -% foreach my $field( qw(Format Rows Page Order OrderBy) ) { -% next unless defined $ARGS{ $field } && length $ARGS{ $field }; -<input type="hidden" name="<% $field %>" value="<% $ARGS{ $field } %>" /> -% } -<&|/l&>Find all users whose</&> <& /Elements/SelectUsers, %ARGS &><br /> -<input type="checkbox" class="checkbox" name="FindDisabledUsers" value="1" <% $FindDisabledUsers? 'checked="checked"': '' %> /> -<&|/l&>Include disabled users in search.</&> -<br /> -<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" /></div> -</form> - <%INIT> my $caption; my $users = RT::Users->new( $session{'CurrentUser'} ); @@ -111,6 +126,8 @@ if ( defined($UserString) && length $UserString ) { VALUE => $UserString, ); } + RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Admin/Users/Modify.html?id=".$users->First->id) + if $users->Count == 1; } else { $caption = loc("Privileged users"); @@ -119,6 +136,29 @@ else { $Format ||= RT->Config->Get('AdminSearchResultFormat')->{'Users'}; +# Build up the list of fields to display for searching +my $i = 0; +my %sorted = map { $_ => $i++ } qw( + Name EmailAddress RealName Organization NickName WorkPhone HomePhone + MobilePhone PagerPhone Address1 Address2 City State Zip Country + Timezone Lang Gecos Comments +); + +my @attrs = sort { $sorted{$a} <=> $sorted{$b} } + grep { !/(?:^id$|ContactInfo|Encoding|^External|System|PGPKey|AuthToken|^Last|^Creat(?:ed|or)$|^Signature$)/ } + RT::User->ReadableAttributes; +my @fields; + +for my $name (@attrs) { + my $label = $m->comp( + '/Elements/ColumnMap', + Class => 'RT__User', + Name => $name, + Attr => 'title' + ); + + push @fields, [ $name, $label || $name ]; +} </%INIT> <%ARGS> $Format => undef, diff --git a/rt/share/html/Admin/autohandler b/rt/share/html/Admin/autohandler index d2fe02aab..6559bec2f 100644 --- a/rt/share/html/Admin/autohandler +++ b/rt/share/html/Admin/autohandler @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Admin/index.html b/rt/share/html/Admin/index.html index 7956bde8b..3dd8ab4f9 100755 --- a/rt/share/html/Admin/index.html +++ b/rt/share/html/Admin/index.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,51 +45,9 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<& //Admin/Elements/Header, Title => loc('RT Administration') &> -<& //Admin/Elements/Tabs, Title => loc('RT Administration') &> - -<& /Elements/ListMenu, items => $tabs &> -<%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->callback( %ARGS, tabs => $tabs ); - - - - -</%init> +<& /Admin/Elements/Header, Title => loc('RT Administration') &> +<& /Elements/Tabs &> +<& /Elements/ListMenu, menu => Menu()->child('tools')->child('config') &> +% if (RT->Config->Get('ShowRTPortal')) { +<& /Admin/Elements/Portal &> +% } |