[Rt-commit] r4460 - in rt/branches/QUEBEC-EXPERIMENTAL:
lib/RT/Interface
alexmv at bestpractical.com
alexmv at bestpractical.com
Tue Jan 31 23:42:37 EST 2006
Author: alexmv
Date: Tue Jan 31 23:42:36 2006
New Revision: 4460
Modified:
rt/branches/QUEBEC-EXPERIMENTAL/ (props changed)
rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Web.pm
Log:
r8868 at zoq-fot-pik: chmrr | 2006-01-31 22:24:18 -0500
* Untabify and adjust indenting in one or two places
Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Web.pm (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Web.pm Tue Jan 31 23:42:36 2006
@@ -127,7 +127,7 @@
my $user;
if ( defined $ENV{'REMOTE_USER'} ) {
- $user = lc ( $ENV{'REMOTE_USER'} ) if( length($ENV{'REMOTE_USER'}) );
+ $user = lc ( $ENV{'REMOTE_USER'} ) if( length($ENV{'REMOTE_USER'}) );
}
return $user;
@@ -151,14 +151,14 @@
$user_info{'Privileged'} = 1;
if ($^O !~ /^(?:riscos|MacOS|MSWin32|dos|os2)$/) {
- # Populate fields with information from Unix /etc/passwd
+ # Populate fields with information from Unix /etc/passwd
- my ($comments, $realname) = (getpwnam($user))[5, 6];
- $user_info{'Comments'} = $comments if defined $comments;
- $user_info{'RealName'} = $realname if defined $realname;
+ my ($comments, $realname) = (getpwnam($user))[5, 6];
+ $user_info{'Comments'} = $comments if defined $comments;
+ $user_info{'RealName'} = $realname if defined $realname;
}
elsif ($^O eq 'MSWin32' and eval 'use Net::AdminMisc; 1') {
- # Populate fields with information from NT domain controller
+ # Populate fields with information from NT domain controller
}
# and return the wad of stuff
@@ -194,8 +194,8 @@
return ($u->loc(@_));
}
else {
- # pathetic case -- SystemUser is gone.
- return $_[0];
+ # pathetic case -- SystemUser is gone.
+ return $_[0];
}
}
@@ -349,35 +349,35 @@
my (@dependson, @dependedonby, @parents, @children, @refersto, @referredtoby);
foreach my $luri ( split ( / /, $ARGS{"new-DependsOn"} ) ) {
- $luri =~ s/\s*$//; # Strip trailing whitespace
- push @dependson, $luri;
+ $luri =~ s/\s*$//; # Strip trailing whitespace
+ push @dependson, $luri;
}
$create_args{'DependsOn'} = \@dependson;
foreach my $luri ( split ( / /, $ARGS{"DependsOn-new"} ) ) {
- push @dependedonby, $luri;
+ push @dependedonby, $luri;
}
$create_args{'DependedOnBy'} = \@dependedonby;
foreach my $luri ( split ( / /, $ARGS{"new-MemberOf"} ) ) {
- $luri =~ s/\s*$//; # Strip trailing whitespace
- push @parents, $luri;
+ $luri =~ s/\s*$//; # Strip trailing whitespace
+ push @parents, $luri;
}
$create_args{'Parents'} = \@parents;
foreach my $luri ( split ( / /, $ARGS{"MemberOf-new"} ) ) {
- push @children, $luri;
+ push @children, $luri;
}
$create_args{'Children'} = \@children;
foreach my $luri ( split ( / /, $ARGS{"new-RefersTo"} ) ) {
- $luri =~ s/\s*$//; # Strip trailing whitespace
- push @refersto, $luri;
+ $luri =~ s/\s*$//; # Strip trailing whitespace
+ push @refersto, $luri;
}
$create_args{'RefersTo'} = \@refersto;
foreach my $luri ( split ( / /, $ARGS{"RefersTo-new"} ) ) {
- push @referredtoby, $luri;
+ push @referredtoby, $luri;
}
$create_args{'ReferredToBy'} = \@referredtoby;
# }}}
@@ -893,7 +893,7 @@
if ($object_type eq 'RT::System') {
$obj = $RT::System;
- } elsif ($RT::ACE::OBJECT_TYPES{$object_type}) {
+ } elsif ($RT::ACE::OBJECT_TYPES{$object_type}) {
$obj = $object_type->new($session{'CurrentUser'});
$obj->Load($object_id);
} else {
@@ -922,7 +922,7 @@
if ($object_type eq 'RT::System') {
$obj = $RT::System;
- } elsif ($RT::ACE::OBJECT_TYPES{$object_type}) {
+ } elsif ($RT::ACE::OBJECT_TYPES{$object_type}) {
$obj = $object_type->new($session{'CurrentUser'});
$obj->Load($object_id);
} else {
@@ -964,9 +964,9 @@
my $Object = $args{'Object'};
my @results = $Object->Update(AttributesRef => $args{'AttributesRef'},
- ARGSRef => $args{'ARGSRef'},
+ ARGSRef => $args{'ARGSRef'},
AttributePrefix => $args{'AttributePrefix'}
- );
+ );
return (@results);
}
@@ -1115,11 +1115,11 @@
my %custom_fields_to_mod;
foreach my $arg ( keys %$ARGSRef ) {
if ( $arg =~ /^Ticket-(\d+-.*)/) {
- $ARGSRef->{"Object-RT::Ticket-$1"} = delete $ARGSRef->{$arg};
- }
+ $ARGSRef->{"Object-RT::Ticket-$1"} = delete $ARGSRef->{$arg};
+ }
elsif ( $arg =~ /^CustomField-(\d+-.*)/) {
- $ARGSRef->{"Object-RT::Ticket--$1"} = delete $ARGSRef->{$arg};
- }
+ $ARGSRef->{"Object-RT::Ticket--$1"} = delete $ARGSRef->{$arg};
+ }
}
return ProcessObjectCustomFieldUpdates(%args, ARGSRef => $ARGSRef);
@@ -1141,152 +1141,152 @@
# For each of those objects
foreach my $class ( keys %custom_fields_to_mod ) {
- foreach my $id ( keys %{$custom_fields_to_mod{$class}} ) {
- my $Object = $args{'Object'};
- if (!$Object or ref($Object) ne $class or $Object->id != $id) {
- $Object = $class->new( $session{'CurrentUser'} );
- $Object->Load($id);
- }
-
- # For each custom field
- foreach my $cf ( keys %{ $custom_fields_to_mod{$class}{$id} } ) {
- my $CustomFieldObj = RT::CustomField->new($session{'CurrentUser'});
- $CustomFieldObj->LoadById($cf);
-
- foreach my $arg ( keys %{$ARGSRef} ) {
- # Only interested in args for the current CF:
- next unless ( $arg =~ /^Object-$class-(?:$id)?-CustomField-$cf-/ );
-
- # since http won't pass in a form element with a null value, we need
- # to fake it
- if ($arg =~ /^(.*?)-Values-Magic$/ ) {
- # We don't care about the magic, if there's really a values element;
- next if ($ARGSRef->{$1.'-Value'} || $ARGSRef->{$1.'-Values'}) ;
+ foreach my $id ( keys %{$custom_fields_to_mod{$class}} ) {
+ my $Object = $args{'Object'};
+ if (!$Object or ref($Object) ne $class or $Object->id != $id) {
+ $Object = $class->new( $session{'CurrentUser'} );
+ $Object->Load($id);
+ }
+
+ # For each custom field
+ foreach my $cf ( keys %{ $custom_fields_to_mod{$class}{$id} } ) {
+ my $CustomFieldObj = RT::CustomField->new($session{'CurrentUser'});
+ $CustomFieldObj->LoadById($cf);
+
+ foreach my $arg ( keys %{$ARGSRef} ) {
+ # Only interested in args for the current CF:
+ next unless ( $arg =~ /^Object-$class-(?:$id)?-CustomField-$cf-/ );
+
+ # since http won't pass in a form element with a null value, we need
+ # to fake it
+ if ($arg =~ /^(.*?)-Values-Magic$/ ) {
+ # We don't care about the magic, if there's really a values element;
+ next if ($ARGSRef->{$1.'-Value'} || $ARGSRef->{$1.'-Values'}) ;
# "Empty" values does not mean anything for Image and Binary fields
next if $CustomFieldObj->Type =~ /^(?:Image|Binary)$/;
- $arg = $1."-Values";
- $ARGSRef->{$1."-Values"} = undef;
-
- }
- my @values = ();
- if (ref( $ARGSRef->{$arg} ) eq 'ARRAY' ) {
- @values = @{ $ARGSRef->{$arg} };
- } elsif ($CustomFieldObj->Type =~ /text/i) { # Both Text and Wikitext
- @values = ($ARGSRef->{$arg});
- } else {
- @values = split /\n/, $ARGSRef->{$arg};
- }
-
- if ( ($CustomFieldObj->Type eq 'Freeform'
- && ! $CustomFieldObj->SingleValue) ||
- $CustomFieldObj->Type =~ /text/i) {
- foreach my $val (@values) {
- $val =~ s/\r//g;
- }
- }
-
- if ( ( $arg =~ /-AddValue$/ ) || ( $arg =~ /-Value$/ ) ) {
- foreach my $value (@values) {
- next unless length($value);
- my ( $val, $msg ) = $Object->AddCustomFieldValue(
- Field => $cf,
- Value => $value
- );
- push ( @results, $msg );
- }
- }
- elsif ( $arg =~ /-Upload$/ ) {
+ $arg = $1."-Values";
+ $ARGSRef->{$1."-Values"} = undef;
+
+ }
+ my @values = ();
+ if (ref( $ARGSRef->{$arg} ) eq 'ARRAY' ) {
+ @values = @{ $ARGSRef->{$arg} };
+ } elsif ($CustomFieldObj->Type =~ /text/i) { # Both Text and Wikitext
+ @values = ($ARGSRef->{$arg});
+ } else {
+ @values = split /\n/, $ARGSRef->{$arg};
+ }
+
+ if ( ($CustomFieldObj->Type eq 'Freeform'
+ && ! $CustomFieldObj->SingleValue) ||
+ $CustomFieldObj->Type =~ /text/i) {
+ foreach my $val (@values) {
+ $val =~ s/\r//g;
+ }
+ }
+
+ if ( ( $arg =~ /-AddValue$/ ) || ( $arg =~ /-Value$/ ) ) {
+ foreach my $value (@values) {
+ next unless length($value);
+ my ( $val, $msg ) = $Object->AddCustomFieldValue(
+ Field => $cf,
+ Value => $value
+ );
+ push ( @results, $msg );
+ }
+ }
+ elsif ( $arg =~ /-Upload$/ ) {
my $value_hash = _UploadedFile($arg) or next;
- my ( $val, $msg ) = $Object->AddCustomFieldValue(
+ my ( $val, $msg ) = $Object->AddCustomFieldValue(
%$value_hash,
Field => $cf,
- );
- push ( @results, $msg );
- }
- elsif ( $arg =~ /-DeleteValues$/ ) {
- foreach my $value (@values) {
- next unless length($value);
- my ( $val, $msg ) = $Object->DeleteCustomFieldValue(
- Field => $cf,
- Value => $value
- );
- push ( @results, $msg );
- }
- }
- elsif ( $arg =~ /-DeleteValueIds$/ ) {
- foreach my $value (@values) {
- next unless length($value);
- my ( $val, $msg ) = $Object->DeleteCustomFieldValue(
- Field => $cf,
- ValueId => $value,
- );
- push ( @results, $msg );
- }
- }
- elsif ( $arg =~ /-Values$/ and !$CustomFieldObj->Repeated) {
- my $cf_values = $Object->CustomFieldValues($cf);
-
- my %values_hash;
- foreach my $value (@values) {
- next unless length($value);
-
- # build up a hash of values that the new set has
- $values_hash{$value} = 1;
-
- unless ( $cf_values->HasEntry($value) ) {
- my ( $val, $msg ) = $Object->AddCustomFieldValue(
- Field => $cf,
- Value => $value
- );
- push ( @results, $msg );
- }
-
- }
- while ( my $cf_value = $cf_values->Next ) {
- unless ( $values_hash{ $cf_value->Content } == 1 ) {
- my ( $val, $msg ) = $Object->DeleteCustomFieldValue(
- Field => $cf,
- Value => $cf_value->Content
- );
- push ( @results, $msg);
-
- }
- }
- }
- elsif ( $arg =~ /-Values$/ ) {
- my $cf_values = $Object->CustomFieldValues($cf);
-
- # keep everything up to the point of difference, delete the rest
- my $delete_flag;
- foreach my $old_cf (@{$cf_values->ItemsArrayRef}) {
- if (!$delete_flag and @values and $old_cf->Content eq $values[0]) {
- shift @values;
- next;
- }
-
- $delete_flag ||= 1;
- $old_cf->Delete;
- }
-
- # now add/replace extra things, if any
- foreach my $value (@values) {
- my ( $val, $msg ) = $Object->AddCustomFieldValue(
- Field => $cf,
- Value => $value
- );
- push ( @results, $msg );
- }
- }
- else {
- push ( @results, loc("User asked for an unknown update type for custom field [_1] for [_2] object #[_3]", $cf->Name, $class, $Object->id ) );
- }
- }
- }
- return (@results);
- }
+ );
+ push ( @results, $msg );
+ }
+ elsif ( $arg =~ /-DeleteValues$/ ) {
+ foreach my $value (@values) {
+ next unless length($value);
+ my ( $val, $msg ) = $Object->DeleteCustomFieldValue(
+ Field => $cf,
+ Value => $value
+ );
+ push ( @results, $msg );
+ }
+ }
+ elsif ( $arg =~ /-DeleteValueIds$/ ) {
+ foreach my $value (@values) {
+ next unless length($value);
+ my ( $val, $msg ) = $Object->DeleteCustomFieldValue(
+ Field => $cf,
+ ValueId => $value,
+ );
+ push ( @results, $msg );
+ }
+ }
+ elsif ( $arg =~ /-Values$/ and !$CustomFieldObj->Repeated) {
+ my $cf_values = $Object->CustomFieldValues($cf);
+
+ my %values_hash;
+ foreach my $value (@values) {
+ next unless length($value);
+
+ # build up a hash of values that the new set has
+ $values_hash{$value} = 1;
+
+ unless ( $cf_values->HasEntry($value) ) {
+ my ( $val, $msg ) = $Object->AddCustomFieldValue(
+ Field => $cf,
+ Value => $value
+ );
+ push ( @results, $msg );
+ }
+
+ }
+ while ( my $cf_value = $cf_values->Next ) {
+ unless ( $values_hash{ $cf_value->Content } == 1 ) {
+ my ( $val, $msg ) = $Object->DeleteCustomFieldValue(
+ Field => $cf,
+ Value => $cf_value->Content
+ );
+ push ( @results, $msg);
+
+ }
+ }
+ }
+ elsif ( $arg =~ /-Values$/ ) {
+ my $cf_values = $Object->CustomFieldValues($cf);
+
+ # keep everything up to the point of difference, delete the rest
+ my $delete_flag;
+ foreach my $old_cf (@{$cf_values->ItemsArrayRef}) {
+ if (!$delete_flag and @values and $old_cf->Content eq $values[0]) {
+ shift @values;
+ next;
+ }
+
+ $delete_flag ||= 1;
+ $old_cf->Delete;
+ }
+
+ # now add/replace extra things, if any
+ foreach my $value (@values) {
+ my ( $val, $msg ) = $Object->AddCustomFieldValue(
+ Field => $cf,
+ Value => $value
+ );
+ push ( @results, $msg );
+ }
+ }
+ else {
+ push ( @results, loc("User asked for an unknown update type for custom field [_1] for [_2] object #[_3]", $cf->Name, $class, $Object->id ) );
+ }
+ }
+ }
+ return (@results);
+ }
}
}
@@ -1322,7 +1322,7 @@
}
# Delete watchers in the simple style demanded by the bulk manipulator
- elsif ( $key =~ /^Delete(Requestor|Cc|AdminCc)$/ ) {
+ elsif ( $key =~ /^Delete(Requestor|Cc|AdminCc)$/ ) {
my ( $code, $msg ) = $Ticket->DeleteWatcher( Email => $ARGSRef->{$key}, Type => $1 );
push @results, $msg;
}
@@ -1445,7 +1445,7 @@
my (@results) = ProcessRecordLinks(RecordObj => $Ticket,
- ARGSRef => $ARGSRef);
+ ARGSRef => $ARGSRef);
#Merge if we need to
if ( $ARGSRef->{ $Ticket->Id . "-MergeInto" } ) {
@@ -1550,16 +1550,16 @@
sub _load_container_object {
my ($obj_type, $obj_id) = @_;
if ( $obj_type eq 'RT::User' && $obj_id == $session{'CurrentUser'}->Id) {
- return $session{'CurrentUser'}->UserObj;
+ return $session{'CurrentUser'}->UserObj;
}
elsif ($obj_type eq 'RT::Group') {
- my $group = RT::Group->new($session{'CurrentUser'});
- $group->Load($obj_id);
- return $group;
+ my $group = RT::Group->new($session{'CurrentUser'});
+ $group->Load($obj_id);
+ return $group;
}
elsif ($obj_type eq 'RT::System') {
- # XXX: check hasright
- return RT::System->new($session{'CurrentUser'});
+ # XXX: check hasright
+ return RT::System->new($session{'CurrentUser'});
}
else {
}
@@ -1575,7 +1575,7 @@
sub _parse_saved_search {
my $spec = shift;
if ($spec !~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ ) {
- return;
+ return;
}
my $obj_type = $1;
my $obj_id = $2;
More information about the Rt-commit
mailing list