[Rt-commit] rt branch, 4.4/config-callbacks, created. rt-4.4.1-1-gc2aec55
Aaron Kondziela
aaron at bestpractical.com
Tue Mar 14 00:09:54 EDT 2017
The branch, 4.4/config-callbacks has been created
at c2aec55ea40abab60c7f29702eeb7d2ee6431864 (commit)
- Log -----------------------------------------------------------------
commit c2aec55ea40abab60c7f29702eeb7d2ee6431864
Author: Aaron Kondziela <aaron at bestpractical.com>
Date: Tue Mar 14 00:09:54 2017 -0400
Add AfterUpdate callbacks to Admin section of web UI
The AfterUpdate callbacks support logging, auditing, etc., for changes made
to RT configuration via the Admin section.
Fixes T#180410
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index e3cf905..eccab26 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -2685,7 +2685,8 @@ submitted.
sub ProcessACLs {
my $ARGSref = shift;
- my (%state, @results);
+ my (%state, @results, $updated);
+ my $m = $HTML::Mason::Commands::m;
my $CheckACL = $ARGSref->{'CheckACL'};
my @check = grep { defined } (ref $CheckACL eq 'ARRAY' ? @$CheckACL : $CheckACL);
@@ -2771,6 +2772,7 @@ sub ProcessACLs {
# Has right and shouldn't have right
my ($val, $msg) = $principal->RevokeRight( Object => $obj, Right => $right );
push @results, $msg;
+ $updated = 1;
}
# For everything left, they don't have the right but they should
@@ -2778,6 +2780,7 @@ sub ProcessACLs {
delete $state{$tuple}->{$right};
my ($val, $msg) = $principal->GrantRight( Object => $obj, Right => $right );
push @results, $msg;
+ $updated = 1;
}
# Check our state for leftovers
@@ -2790,6 +2793,14 @@ sub ProcessACLs {
}
}
+ $m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => undef,
+ ARGSRef => $ARGSref,
+ Results => \@results
+ );
+
return (@results);
}
diff --git a/share/html/Admin/Articles/Classes/Modify.html b/share/html/Admin/Articles/Classes/Modify.html
index f4a6f78..f15a9db 100644
--- a/share/html/Admin/Articles/Classes/Modify.html
+++ b/share/html/Admin/Articles/Classes/Modify.html
@@ -216,6 +216,18 @@ if ( $ClassObj->id && $Submitted ) {
}
}
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $ClassObj->id );
+
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $ClassObj,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
# This code does automatic redirection if any updates happen.
MaybeRedirectForResults(
Actions => \@results,
diff --git a/share/html/Admin/Articles/Classes/Objects.html b/share/html/Admin/Articles/Classes/Objects.html
index 9cc95d1..ea00ea7 100644
--- a/share/html/Admin/Articles/Classes/Objects.html
+++ b/share/html/Admin/Articles/Classes/Objects.html
@@ -133,6 +133,18 @@ if ( $UpdateObjs ) {
}
}
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) );
+
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $Class,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
my $is_global = $Class->IsApplied(0);
my $applied = $Class->AppliedTo;
diff --git a/share/html/Admin/Articles/Elements/Topics b/share/html/Admin/Articles/Elements/Topics
index f29c94a..007f86f 100644
--- a/share/html/Admin/Articles/Elements/Topics
+++ b/share/html/Admin/Articles/Elements/Topics
@@ -204,6 +204,19 @@ for my $topic (@todo) {
push @results, "Reparented orphan ".$topic->Id." to root";
}
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) );
+
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => undef,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
+
</%INIT>
diff --git a/share/html/Admin/Assets/Catalogs/Create.html b/share/html/Admin/Assets/Catalogs/Create.html
index 65a18ba..38acdf9 100644
--- a/share/html/Admin/Assets/Catalogs/Create.html
+++ b/share/html/Admin/Assets/Catalogs/Create.html
@@ -77,6 +77,17 @@ if ($id eq "new") {
push @results, $msg, @{$nonfatal || []};
if ($ok) {
+ my $updated;
+ $updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $catalog->id );
+ $m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $catalog,
+ ARGSRef => \%ARGS,
+ Results => \@results
+ );
+
MaybeRedirectForResults(
Actions => \@results,
Path => "/Admin/Assets/Catalogs/Modify.html",
diff --git a/share/html/Admin/Assets/Catalogs/Modify.html b/share/html/Admin/Assets/Catalogs/Modify.html
index e4e37b8..774a5d4 100644
--- a/share/html/Admin/Assets/Catalogs/Modify.html
+++ b/share/html/Admin/Assets/Catalogs/Modify.html
@@ -80,6 +80,17 @@ if ($Update) {
ARGSRef => \%ARGS,
);
+ my $updated;
+ $updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $catalog->id );
+ $m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $catalog,
+ ARGSRef => \%ARGS,
+ Results => \@results
+ );
+
MaybeRedirectForResults(
Actions => \@results,
Arguments => { id => $catalog->id },
diff --git a/share/html/Admin/Assets/Catalogs/Roles.html b/share/html/Admin/Assets/Catalogs/Roles.html
index 37dd9e9..3298120 100644
--- a/share/html/Admin/Assets/Catalogs/Roles.html
+++ b/share/html/Admin/Assets/Catalogs/Roles.html
@@ -73,6 +73,17 @@ my @results;
if ($Update) {
push @results, ProcessAssetRoleMembers( $catalog => %ARGS );
+
+ my $updated;
+ $updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $catalog->id );
+ $m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $catalog,
+ ARGSRef => \%ARGS,
+ Results => \@results
+ );
MaybeRedirectForResults(
Actions => \@results,
diff --git a/share/html/Admin/CustomFields/Modify.html b/share/html/Admin/CustomFields/Modify.html
index f9a7324..3f054c7 100644
--- a/share/html/Admin/CustomFields/Modify.html
+++ b/share/html/Admin/CustomFields/Modify.html
@@ -344,6 +344,17 @@ if ( $CustomFieldObj->id && $CustomFieldObj->IsOnlyGlobal ) {
$id = $CustomFieldObj->id if $CustomFieldObj->id;
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $CustomFieldObj->id );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $CustomFieldObj,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
# This code does automatic redirection if any updates happen.
MaybeRedirectForResults(
Actions => \@results,
diff --git a/share/html/Admin/CustomFields/Objects.html b/share/html/Admin/CustomFields/Objects.html
index b3aa4fe..9cdddf4 100644
--- a/share/html/Admin/CustomFields/Objects.html
+++ b/share/html/Admin/CustomFields/Objects.html
@@ -153,6 +153,17 @@ my $rows = RT->Config->Get('AdminSearchResultRows')->{$collection_class} || 50;
my $title = loc('Modify associated objects for [_1]', $CF->Name);
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $CF,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
</%INIT>
<%ARGS>
$id => undef
diff --git a/share/html/Admin/CustomRoles/Modify.html b/share/html/Admin/CustomRoles/Modify.html
index 1905cc2..f966f9b 100644
--- a/share/html/Admin/CustomRoles/Modify.html
+++ b/share/html/Admin/CustomRoles/Modify.html
@@ -167,6 +167,17 @@ if ( $RoleObj->Id ) {
$title = loc("Create a custom role");
}
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $RoleObj->id );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $RoleObj,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
MaybeRedirectForResults(
Actions => \@results,
Arguments => { id => $RoleObj->Id },
diff --git a/share/html/Admin/CustomRoles/Objects.html b/share/html/Admin/CustomRoles/Objects.html
index 323229c..8236b2e 100644
--- a/share/html/Admin/CustomRoles/Objects.html
+++ b/share/html/Admin/CustomRoles/Objects.html
@@ -120,6 +120,18 @@ if ( $Update ) {
push @results, $msg;
}
}
+
+ my $updated;
+ $updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $role->id );
+ $m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $role,
+ ARGSRef => \%ARGS,
+ Results => \@results
+ );
+
MaybeRedirectForResults(
Actions => \@results,
Arguments => {
diff --git a/share/html/Admin/Elements/EditCustomField b/share/html/Admin/Elements/EditCustomField
index 4dba36d..acc3942 100644
--- a/share/html/Admin/Elements/EditCustomField
+++ b/share/html/Admin/Elements/EditCustomField
@@ -145,6 +145,16 @@ $id = $CustomFieldObj->id;
}
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $CustomFieldObj,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
</%INIT>
<%ARGS>
diff --git a/share/html/Admin/Elements/EditCustomFields b/share/html/Admin/Elements/EditCustomFields
index a9cd76b..e95f576 100644
--- a/share/html/Admin/Elements/EditCustomFields
+++ b/share/html/Admin/Elements/EditCustomFields
@@ -97,6 +97,7 @@ if ($id and !$Object->CurrentUserHasRight('AssignCustomFields')) {
}
my @results;
+my $updated;
my $lookup = $ObjectType;
$lookup .= "-$SubType" if $SubType;
@@ -112,6 +113,7 @@ if ( $MoveCustomFieldUp ) { {
my ($status, $msg) = $record->MoveUp;
push @results, $msg;
+ $updated = 1;
} }
if ( $MoveCustomFieldDown ) { {
my $record = RT::ObjectCustomField->new( $session{'CurrentUser'} );
@@ -123,6 +125,7 @@ if ( $MoveCustomFieldDown ) { {
my ($status, $msg) = $record->MoveDown;
push @results, $msg;
+ $updated = 1;
} }
if ( $UpdateCFs ) {
@@ -136,6 +139,7 @@ if ( $UpdateCFs ) {
}
my ($status, $msg) = $CF->AddToObject( $Object );
push @results, $msg;
+ $updated = 1;
}
foreach my $cf_id ( @RemoveCustomField ) {
my $CF = RT::CustomField->new( $session{'CurrentUser'} );
@@ -147,6 +151,7 @@ if ( $UpdateCFs ) {
}
my ($status, $msg) = $CF->RemoveFromObject( $Object );
push @results, $msg;
+ $updated = 1;
}
}
@@ -170,6 +175,14 @@ my $display_format = $id
: ("'__CheckBox.{RemoveCustomField}__',". $format .", '__MoveCF.{$id}__'");
$m->callback(CallbackName => 'EditDisplayFormat', DisplayFormat => \$display_format, id => $id);
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => undef,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
</%INIT>
<%ARGS>
$Object
diff --git a/share/html/Admin/Elements/EditScrips b/share/html/Admin/Elements/EditScrips
index 8334cf2..09e0b3f 100644
--- a/share/html/Admin/Elements/EditScrips
+++ b/share/html/Admin/Elements/EditScrips
@@ -180,6 +180,17 @@ if ( $MoveScripDown ) {
}
}
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @actions) );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => undef,
+ ARGSRef => \%ARGS,
+ Results => \@actions
+);
+
</%init>
<%ARGS>
diff --git a/share/html/Admin/Elements/EditTemplates b/share/html/Admin/Elements/EditTemplates
index 6b7fe19..a16342b 100644
--- a/share/html/Admin/Elements/EditTemplates
+++ b/share/html/Admin/Elements/EditTemplates
@@ -116,6 +116,18 @@ foreach my $id( @DeleteTemplates ) {
push @actions, $msg;
}
}
+
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @actions) );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => undef,
+ ARGSRef => \%ARGS,
+ Results => \@actions
+);
+
</%INIT>
<%ARGS>
$id => 0
diff --git a/share/html/Admin/Elements/MembershipsPage b/share/html/Admin/Elements/MembershipsPage
index 75afd49..f054349 100644
--- a/share/html/Admin/Elements/MembershipsPage
+++ b/share/html/Admin/Elements/MembershipsPage
@@ -113,6 +113,18 @@ if ( $Update ) {
my ($status, $msg) = $group->DeleteMember( $id );
push @results, $msg;
}
+
+ my $updated;
+ $updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $object->id );
+ $m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $object,
+ ARGSRef => \%ARGS,
+ Results => \@results
+ );
+
MaybeRedirectForResults(
Arguments => { id => $id },
Actions => \@results,
diff --git a/share/html/Admin/Global/DashboardsInMenu.html b/share/html/Admin/Global/DashboardsInMenu.html
index 68de513..00cd6bb 100644
--- a/share/html/Admin/Global/DashboardsInMenu.html
+++ b/share/html/Admin/Global/DashboardsInMenu.html
@@ -101,6 +101,8 @@ my @panes = $m->comp(
Content => $conf,
);
}
+
+
push @actions, $status ? loc('Global dashboards in menu saved.') : $msg;
}
);
@@ -108,6 +110,16 @@ my @panes = $m->comp(
$m->comp( '/Widgets/SelectionBox:process', %ARGS, self => $_ )
for @panes;
+my $updated;
+$updated = 1
+ if ($ARGS{'dashboards_in_menu-Submit'});
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => undef,
+ ARGSRef => \%ARGS,
+ Results => \@actions
+);
</%init>
diff --git a/share/html/Admin/Global/MyRT.html b/share/html/Admin/Global/MyRT.html
index 2f3374a..458307b 100644
--- a/share/html/Admin/Global/MyRT.html
+++ b/share/html/Admin/Global/MyRT.html
@@ -105,6 +105,16 @@ my @panes = $m->comp(
$m->comp( '/Widgets/SelectionBox:process', %ARGS, self => $_ )
for @panes;
+my $updated;
+$updated = 1
+ if ($ARGS{'body-Submit'});
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $default_portlets,
+ ARGSRef => \%ARGS,
+ Results => \@actions
+);
</%init>
diff --git a/share/html/Admin/Global/Template.html b/share/html/Admin/Global/Template.html
index 4e15dda..d18e802 100644
--- a/share/html/Admin/Global/Template.html
+++ b/share/html/Admin/Global/Template.html
@@ -89,6 +89,17 @@ if ($TemplateObj->Id()) {
ARGSRef => \%ARGS);
push @results, @aresults;
+ my $updated;
+ $updated = 1
+ if(grep {defined $_ and $_ ne ''} @results);
+ $m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $TemplateObj,
+ ARGSRef => \%ARGS,
+ Results => \@results
+ );
+
my ($ok, $msg) = $TemplateObj->CompileCheck;
push @results, $msg if !$ok;
} else {
diff --git a/share/html/Admin/Groups/Members.html b/share/html/Admin/Groups/Members.html
index f6fba06..1476433 100644
--- a/share/html/Admin/Groups/Members.html
+++ b/share/html/Admin/Groups/Members.html
@@ -160,6 +160,18 @@ foreach my $member (grep $_, @AddMembersGroups) {
my ($val, $msg) = $Group->AddMember($principal->PrincipalId);
push (@results, $msg);
}
+
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $Group,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
</%INIT>
<%ARGS>
diff --git a/share/html/Admin/Groups/Modify.html b/share/html/Admin/Groups/Modify.html
index 4c1dd4f..e9af35a 100644
--- a/share/html/Admin/Groups/Modify.html
+++ b/share/html/Admin/Groups/Modify.html
@@ -153,6 +153,17 @@ if ( $Group->Id and ($SetEnabled) and ( $Disabled != $Group->Disabled) ) {
push @results, $msg;
}
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $Group->id );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $Group,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
# This code does automatic redirection if any updates happen.
MaybeRedirectForResults(
Actions => \@results,
diff --git a/share/html/Admin/Queues/DefaultValues.html b/share/html/Admin/Queues/DefaultValues.html
index 0eccee7..832ee95 100644
--- a/share/html/Admin/Queues/DefaultValues.html
+++ b/share/html/Admin/Queues/DefaultValues.html
@@ -173,6 +173,17 @@ elsif ( $ARGS{Update} ) {
}
}
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $queue->id );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $queue,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
MaybeRedirectForResults(
Actions => \@results,
Arguments => { id => $queue->id },
diff --git a/share/html/Admin/Queues/Modify.html b/share/html/Admin/Queues/Modify.html
index e4e9673..9399c98 100644
--- a/share/html/Admin/Queues/Modify.html
+++ b/share/html/Admin/Queues/Modify.html
@@ -245,6 +245,17 @@ if ( $QueueObj->Id ) {
my $InternalQueue = ($QueueObj->Id and $QueueObj->Disabled == 2);
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $QueueObj->id );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $QueueObj,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
# This code does automatic redirection if any updates happen.
MaybeRedirectForResults(
Actions => \@results,
diff --git a/share/html/Admin/Queues/People.html b/share/html/Admin/Queues/People.html
index 456c582..5c642e0 100644
--- a/share/html/Admin/Queues/People.html
+++ b/share/html/Admin/Queues/People.html
@@ -136,7 +136,7 @@
<%INIT>
-my ($field, @results, $User, $Users, $Groups, $watcher, $user_msg, $group_msg);
+my ($field, @results, $User, $Users, $Groups, $watcher, $user_msg, $group_msg, $updated);
my $QueueObj = RT::Queue->new($session{'CurrentUser'});
$QueueObj->Load($id) || Abort(loc("Couldn't load queue", $id));
@@ -151,6 +151,7 @@ unless ($OnlySearchForPeople or $OnlySearchForGroup) {
my ($code, $msg) = $QueueObj->DeleteWatcher(Type => $1,
PrincipalId => $2);
push @results, $msg;
+ $updated = 1;
}
}
@@ -168,6 +169,7 @@ unless ($OnlySearchForPeople or $OnlySearchForGroup) {
PrincipalId => $id,
);
push @results, $msg;
+ $updated = 1;
}
}
@@ -180,7 +182,7 @@ if ( $ARGS{'UserString'} ) {
);
} else {
$user_msg = loc("No principals selected.");
- }
+}
if ( $ARGS{'GroupString'} ) {
$Groups = RT::Groups->new( $session{'CurrentUser'} );
@@ -193,6 +195,15 @@ if ( $ARGS{'GroupString'} ) {
$group_msg = loc("No principals selected.");
}
my $title = loc('People related to queue [_1]', $QueueObj->Name);
+
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $QueueObj,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
</%INIT>
<%ARGS>
diff --git a/share/html/Admin/Queues/Template.html b/share/html/Admin/Queues/Template.html
index faee796..d32a7b8 100644
--- a/share/html/Admin/Queues/Template.html
+++ b/share/html/Admin/Queues/Template.html
@@ -115,6 +115,17 @@ if ($Create) {
$SubmitLabel = loc('Save Changes');
}
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $TemplateObj,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
</%INIT>
<%ARGS>
$Queue => ''
diff --git a/share/html/Admin/Scrips/Create.html b/share/html/Admin/Scrips/Create.html
index 7cc3406..a64befe 100644
--- a/share/html/Admin/Scrips/Create.html
+++ b/share/html/Admin/Scrips/Create.html
@@ -127,6 +127,17 @@ if ( $Create ) {
CustomIsApplicableCode => $ARGS{"CustomIsApplicableCode"},
);
+ my $updated;
+ $updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $scrip->id );
+ $m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $scrip,
+ ARGSRef => \%ARGS,
+ Results => \@results
+ );
+
MaybeRedirectForResults(
Force => 1,
Actions => [ $msg ],
diff --git a/share/html/Admin/Scrips/Modify.html b/share/html/Admin/Scrips/Modify.html
index 618c48d..b28922e 100644
--- a/share/html/Admin/Scrips/Modify.html
+++ b/share/html/Admin/Scrips/Modify.html
@@ -123,6 +123,18 @@ if ( $Update ) {
Object => $scrip,
ARGSRef => \%ARGS
);
+
+ my $updated;
+ $updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $scrip->id );
+ $m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $scrip,
+ ARGSRef => \%ARGS,
+ Results => \@results
+ );
+
MaybeRedirectForResults(
Actions => \@results,
Arguments => {
diff --git a/share/html/Admin/Scrips/Objects.html b/share/html/Admin/Scrips/Objects.html
index 7b012dc..13324dd 100644
--- a/share/html/Admin/Scrips/Objects.html
+++ b/share/html/Admin/Scrips/Objects.html
@@ -152,6 +152,18 @@ if ( $Update ) {
my ($status, $msg) = $global->SetStage($Stage);
push @results, $msg;
}
+
+ my $updated;
+ $updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $scrip->id );
+ $m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $scrip,
+ ARGSRef => \%ARGS,
+ Results => \@results
+ );
+
MaybeRedirectForResults(
Actions => \@results,
Arguments => {
diff --git a/share/html/Admin/Tools/Shredder/index.html b/share/html/Admin/Tools/Shredder/index.html
index 4440691..b60dad5 100644
--- a/share/html/Admin/Tools/Shredder/index.html
+++ b/share/html/Admin/Tools/Shredder/index.html
@@ -179,4 +179,17 @@ if( $Plugin && ( $Search || $Wipeout ) ) { { # use additional block({}) to effec
push @{ $messages{Success} }, loc('see object list below');
}
} }
+
+my $updated;
+$updated = 1
+ if ( @{$messages{Success}} );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => undef,
+ ARGSRef => \%ARGS,
+ Results => $messages{Success}
+);
+
+
</%INIT>
diff --git a/share/html/Admin/Tools/Theme.html b/share/html/Admin/Tools/Theme.html
index 2cc079f..2453d5d 100644
--- a/share/html/Admin/Tools/Theme.html
+++ b/share/html/Admin/Tools/Theme.html
@@ -244,6 +244,8 @@ my $imgdata;
my $colors;
my $valid_image_types;
+my $updated;
+
if (not RT->Config->Get('DisableGD') and Convert::Color->require) {
require GD;
@@ -317,6 +319,7 @@ if (my $file_hash = _UploadedFile( 'logo-upload' )) {
colors => $colors,
},
);
+ $updated = 1;
push @results, loc("Unable to set UserLogo: [_1]", $msg) unless $id;
@@ -324,6 +327,7 @@ if (my $file_hash = _UploadedFile( 'logo-upload' )) {
}
elsif ($ARGS{'reset_logo'}) {
RT->System->DeleteAttribute('UserLogo');
+ $updated = 1;
}
else {
if (my $attr = RT->System->FirstAttribute('UserLogo')) {
@@ -341,11 +345,13 @@ else {
Description => "User-provided logo",
Content => $content,
);
+ $updated = 1;
}
}
}
else {
RT->System->DeleteAttribute('UserLogo');
+ $updated = 1;
}
}
}
@@ -361,6 +367,7 @@ if ($user_css) {
Content => $user_css );
push @results, loc("Unable to set UserCSS: [_1]", $msg) unless $id;
}
+ $updated = 1;
}
if (!$user_css) {
@@ -372,6 +379,15 @@ if (!$user_css) {
} @sections
);
}
+
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => undef,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
</%INIT>
<%ARGS>
$user_css => ''
diff --git a/share/html/Admin/Users/DashboardsInMenu.html b/share/html/Admin/Users/DashboardsInMenu.html
index 53e7356..166ca4a 100644
--- a/share/html/Admin/Users/DashboardsInMenu.html
+++ b/share/html/Admin/Users/DashboardsInMenu.html
@@ -112,6 +112,18 @@ my @panes = $m->comp(
$m->comp( '/Widgets/SelectionBox:process', %ARGS, self => $_ )
for @panes;
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @actions) );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $UserObj,
+ ARGSRef => \%ARGS,
+ Results => \@actions
+);
+
+
</%init>
<%ARGS>
$id => undef
diff --git a/share/html/Admin/Users/Keys.html b/share/html/Admin/Users/Keys.html
index 85e0d52..142df0e 100644
--- a/share/html/Admin/Users/Keys.html
+++ b/share/html/Admin/Users/Keys.html
@@ -114,6 +114,16 @@ if (RT::Crypt->UseForOutgoing eq 'GnuPG') {
if (($ARGS{'PrivateKey'}||'') ne ($UserObj->PrivateKey||'')) {
my ($status, $msg) = $UserObj->SetPrivateKey( $ARGS{'PrivateKey'} );
push @results, $msg;
+ my $updated;
+ $updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) );
+ $m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $UserObj,
+ ARGSRef => \%ARGS,
+ Results => \@results
+ );
}
} else {
push @results, loc("Invalid key [_1] for address '[_2]'", $ARGS{'PrivateKey'}, $email);
@@ -125,6 +135,16 @@ if (RT::Crypt->UseForOutgoing eq 'SMIME') {
if ( $Update and ($ARGS{'SMIMECertificate'}||'') ne ($UserObj->SMIMECertificate||'') ) {
my ($status, $msg) = $UserObj->SetSMIMECertificate( $ARGS{'SMIMECertificate'} );
push @results, $msg;
+ my $updated;
+ $updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) );
+ $m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $UserObj,
+ ARGSRef => \%ARGS,
+ Results => \@results
+ );
}
}
diff --git a/share/html/Admin/Users/Modify.html b/share/html/Admin/Users/Modify.html
index 0b30780..a4faed9 100644
--- a/share/html/Admin/Users/Modify.html
+++ b/share/html/Admin/Users/Modify.html
@@ -303,6 +303,17 @@ if ( $UserObj->Id ) {
}
}
+my $updated;
+$updated = 1
+ if ( (grep {defined $_ and $_ ne ''} @results) and $UserObj->id );
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $UserObj,
+ ARGSRef => \%ARGS,
+ Results => \@results
+);
+
# This code does automatic redirection if any updates happen.
MaybeRedirectForResults(
Actions => \@results,
diff --git a/share/html/Admin/Users/MyRT.html b/share/html/Admin/Users/MyRT.html
index 0bd2473..eb5e3bb 100644
--- a/share/html/Admin/Users/MyRT.html
+++ b/share/html/Admin/Users/MyRT.html
@@ -65,7 +65,7 @@
% }
<%init>
-my @actions;
+my (@actions, $updated);
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);
@@ -73,6 +73,7 @@ my $title = loc("RT at a glance for the user [_1]", $UserObj->Name);
if ($ARGS{Reset}) {
my ($ok, $msg) = $UserObj->SetPreferences('HomepageSettings', {});
push @actions, $ok ? loc('Preferences saved for user [_1].', $UserObj->Name) : $msg;
+ $updated = 1;
}
my ($default_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings');
@@ -115,12 +116,22 @@ my @panes = $m->comp(
my ( $conf, $pane ) = @_;
my ($ok, $msg) = $UserObj->SetPreferences( 'HomepageSettings', $conf );
push @actions, $ok ? loc('Preferences [_1] for user [_2].', $pane, $UserObj->Name) : $msg;
+ $updated = 1;
}
);
$m->comp( '/Widgets/SelectionBox:process', %ARGS, self => $_ )
for @panes;
+$m->callback(
+ CallbackName => 'AfterUpdate',
+ Updated => $updated,
+ Object => $UserObj,
+ ARGSRef => \%ARGS,
+ Results => \@actions
+);
+
+
</%init>
<%ARGS>
$id => undef
-----------------------------------------------------------------------
More information about the rt-commit
mailing list