[Rt-commit] rt branch, 4.2/scrip-custom-code-textareas-visible-only-when-needed, repushed
Dustin Collins
strega at bestpractical.com
Tue Sep 27 14:42:46 EDT 2016
The branch 4.2/scrip-custom-code-textareas-visible-only-when-needed was deleted and repushed:
was 2a74a29af2fcaf955670e5342ba88a4532ba08dd
now 4417c1c33794a6dddbe417dc0f65c6e31304e436
1: 2a74a29 ! 1: 4417c1c Hide scrip custom code fields when appropriate
@@ -28,6 +28,8 @@
RT::Condition object, simillar to the Action method on RT::ScripAction.
Add lazy loading check to RT:ScripAction->Action.
+ Move module name creation logic into own method on both ScripAction and ScripCondition for convenience.
+
Now that we've moved the textareas to be inline with the rest of the
form, there arises a new problem where specifying lots of code would
cause the rest of the page (e.g. Template selection) to scroll
@@ -114,6 +116,46 @@
--- a/lib/RT/ScripAction.pm
+++ b/lib/RT/ScripAction.pm
@@
+ $self->{'TemplateObj'} = $args{'TemplateObj'};
+ }
+
+- $self->ExecModule =~ /^(\w+)$/;
+- my $module = $1;
+- my $type = "RT::Action::". $module;
+-
+- $type->require or die "Require of $type action module failed.\n$@\n";
+-
+- return $self->{'Action'} = $type->new(
++ $self->{'Action'} = $self->ModuleName->new(
+ %args,
+ Argument => $self->Argument,
+ CurrentUser => $self->CurrentUser,
+ ScripActionObj => $self,
+ );
++
++ return $self->{'Action'};
++}
++
++
++=head2 ModuleName
++
++Returns the name for the actual action object as a module.
++
++=cut
++
++sub ModuleName {
++ my $self = shift;
++
++ $self->ExecModule =~ /^(\w+)$/;
++ my $type = "RT::Action::" . $1;
++
++ $type->require or die "Require of $type action module failed.\n$@\n";
++
++ return $type;
+ }
+
+
+@@
sub Action {
my $self = shift;
@@ -131,6 +173,56 @@
diff --git a/lib/RT/ScripCondition.pm b/lib/RT/ScripCondition.pm
--- a/lib/RT/ScripCondition.pm
+++ b/lib/RT/ScripCondition.pm
+@@
+ TicketObj => undef,
+ @_ );
+
+- #TODO: Put this in an eval
++ $self->{'Condition'} = $self->ModuleName->new(
++ 'ScripConditionObj' => $self,
++ 'TicketObj' => $args{'TicketObj'},
++ 'ScripObj' => $args{'ScripObj'},
++ 'TransactionObj' => $args{'TransactionObj'},
++ 'Argument' => $self->Argument,
++ 'ApplicableTransTypes' => $self->ApplicableTransTypes,
++ CurrentUser => $self->CurrentUser
++ );
++}
++
++
++=head2 ModuleName
++
++Returns the name for the actual condition object as a module.
++
++=cut
++
++sub ModuleName {
++ my $self = shift;
++
+ $self->ExecModule =~ /^(\w+)$/;
+- my $module = $1;
+- my $type = "RT::Condition::". $module;
++ my $type = "RT::Condition::". $1;
+
+ $type->require or die "Require of $type condition module failed.\n$@\n";
+
+- $self->{'Condition'} = $type->new ( 'ScripConditionObj' => $self,
+- 'TicketObj' => $args{'TicketObj'},
+- 'ScripObj' => $args{'ScripObj'},
+- 'TransactionObj' => $args{'TransactionObj'},
+- 'Argument' => $self->Argument,
+- 'ApplicableTransTypes' => $self->ApplicableTransTypes,
+- CurrentUser => $self->CurrentUser
+- );
++ return $type;
+ }
+
+
+-
+-
+ =head2 Describe
+
+ Helper method to call the condition module's Describe method.
@@
}
@@ -242,22 +334,22 @@
+
+my $canExecuteCode = ($session{CurrentUser}->HasRight(Object => $RT::System, Right => 'ExecuteCode'));
+
-+my $editableConditionInitiallyHidden = ($Scrip->ConditionObj->Id) ? !$Scrip->ConditionObj->Condition->IsUserEditable : 1;
++my $editableConditionInitiallyHidden = ($Scrip->ConditionObj->Id) ? !$Scrip->ConditionObj->ModuleName->IsUserEditable : 1;
+my @editableConditionIDs;
+my $ScripConditions = RT::ScripConditions->new($session{'CurrentUser'});
+$ScripConditions->UnLimit;
+while (my $ScripCondition = $ScripConditions->Next) {
-+ if ($ScripCondition->Condition->IsUserEditable) {
++ if ($ScripCondition->ModuleName->IsUserEditable) {
+ push @editableConditionIDs, $ScripCondition->Id;
+ }
+}
+
-+my $editableActionInitiallyHidden = ($Scrip->ActionObj->Id) ? !$Scrip->ActionObj->Action->IsUserEditable : 1;
++my $editableActionInitiallyHidden = ($Scrip->ActionObj->Id) ? !$Scrip->ActionObj->ModuleName->IsUserEditable : 1;
+my @editableActionIDs;
+my $ScripActions = RT::ScripActions->new($session{'CurrentUser'});
+$ScripActions->UnLimit;
+while (my $ScripAction = $ScripActions->Next) {
-+ if ($ScripAction->Action->IsUserEditable) {
++ if ($ScripAction->ModuleName->IsUserEditable) {
+ push @editableActionIDs, $ScripAction->Id;
+ }
+}
More information about the rt-commit
mailing list