[Rt-commit] rt branch, 4.0/numeric-field-errors, created. rt-4.0.1-227-ga8291b0
Jason May
jasonmay at bestpractical.com
Thu Aug 4 12:41:21 EDT 2011
The branch, 4.0/numeric-field-errors has been created
at a8291b0d1a6dab9a5a4bbd11edaef79e3740777a (commit)
- Log -----------------------------------------------------------------
commit a8291b0d1a6dab9a5a4bbd11edaef79e3740777a
Author: Jason May <jasonmay at bestpractical.com>
Date: Thu Aug 4 12:35:40 2011 -0400
Show results on the same page instead of redirecting to an error page
http://issues.bestpractical.com/Ticket/Display.html?id=18092
Since we don't redirect anymore, the field values had to be preserved
among form submissions -- for rationale, see Alex's description in
commit 6fd2cb6c.
diff --git a/share/html/Admin/CustomFields/Modify.html b/share/html/Admin/CustomFields/Modify.html
index 4558bc6..43d5e9c 100644
--- a/share/html/Admin/CustomFields/Modify.html
+++ b/share/html/Admin/CustomFields/Modify.html
@@ -56,10 +56,10 @@
<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,
@@ -95,13 +95,13 @@
<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.</&>
@@ -109,7 +109,7 @@
</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.</&>
@@ -122,7 +122,7 @@
<& /Admin/Elements/SelectCustomField,
Name => "BasedOn",
LookupType => $CustomFieldObj->LookupType,
- Default => $CustomFieldObj->BasedOnObj,
+ Default => $CustomFieldObj->BasedOnObj || $BasedOn,
Not => $CustomFieldObj->id,
&>
</td></tr>
@@ -175,11 +175,16 @@ else {
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("CustomField created");
+ $title = loc( 'Created CustomField [_1]', $CustomFieldObj->Name );
+ }
} else {
- $CustomFieldObj->Load( $id ) || $m->comp("/Elements/Error", Why => loc('No CustomField') );
+ $CustomFieldObj->Load( $id ) || push @results, loc('No CustomField');
$title = loc( 'Editing CustomField [_1]', $CustomFieldObj->Name );
}
}
@@ -272,12 +277,6 @@ CustomFieldObj => $CustomFieldObj, CustomFieldValueObj => $cfv, ARGSRef => \%ARG
$id = $CustomFieldObj->id if $CustomFieldObj->id;
-# This code does automatic redirection if any updates happen.
-MaybeRedirectForResults(
- Actions => \@results,
- Arguments => { id => $id },
-);
-
my $EnabledChecked = qq[checked="checked"];
$EnabledChecked = '' if $CustomFieldObj->Disabled;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list