[Rt-commit] rt branch, 4.4/custom-field-html-option, repushed
Craig Kaiser
craig at bestpractical.com
Mon Apr 8 11:47:30 EDT 2019
The branch 4.4/custom-field-html-option was deleted and repushed:
was c0a17ddad900308fe7989ef2df8136f4ebd06c59
now 905b65e3df96d9a26cf1722548b6413930e753d5
1: c0a17ddad ! 1: 905b65e3d Allow HTML to be escaped for custom fields on display
@@ -14,7 +14,7 @@
LastUpdated DATE,
- Disabled NUMBER(11,0) DEFAULT 0 NOT NULL
+ Disabled NUMBER(11,0) DEFAULT 0 NOT NULL,
-+ Escaped NUMBER(11,0) DEFAULT 0 NOT NULL
++ EscapeHTML NUMBER(11,0) DEFAULT 0 NOT NULL
);
@@ -26,7 +26,7 @@
LastUpdatedBy integer NOT NULL DEFAULT 0 ,
LastUpdated TIMESTAMP NULL ,
Disabled integer NOT NULL DEFAULT 0 ,
-+ Escaped integer NOT NULL DEFAULT 0 ,
++ EscapeHTML integer NOT NULL DEFAULT 0 ,
PRIMARY KEY (id)
);
@@ -38,7 +38,7 @@
LastUpdatedBy integer NOT NULL DEFAULT 0 ,
LastUpdated DATETIME NULL ,
Disabled int2 NOT NULL DEFAULT 0 ,
-+ Escaped int2 NOT NULL DEFAULT 0 ,
++ EscapeHTML int2 NOT NULL DEFAULT 0 ,
PRIMARY KEY (id)
) ;
@@ -50,7 +50,7 @@
LastUpdatedBy integer NOT NULL DEFAULT 0 ,
LastUpdated DATETIME NULL ,
Disabled int2 NOT NULL DEFAULT 0 ,
-+ Escaped int2 NOT NULL DEFAULT 0 ,
++ EscapeHTML int2 NOT NULL DEFAULT 0 ,
PRIMARY KEY (id)
) ENGINE=InnoDB CHARACTER SET utf8;
@@ -60,28 +60,28 @@
--- /dev/null
+++ b/etc/upgrade/4.4.5/schema.Oracle
@@
-+ALTER TABLE CustomFields ADD Escaped NUMBER(11,0) DEFAULT 0 NOT NULL;
++ALTER TABLE CustomFields ADD EscapeHTML NUMBER(11,0) DEFAULT 0 NOT NULL;
diff --git a/etc/upgrade/4.4.5/schema.Pg b/etc/upgrade/4.4.5/schema.Pg
new file mode 100644
--- /dev/null
+++ b/etc/upgrade/4.4.5/schema.Pg
@@
-+ALTER TABLE CustomFields ADD COLUMN Escaped integer NOT NULL DEFAULT 0;
++ALTER TABLE CustomFields ADD COLUMN EscapeHTML integer NOT NULL DEFAULT 0;
diff --git a/etc/upgrade/4.4.5/schema.SQLite b/etc/upgrade/4.4.5/schema.SQLite
new file mode 100644
--- /dev/null
+++ b/etc/upgrade/4.4.5/schema.SQLite
@@
-+ALTER TABLE CustomFields ADD COLUMN Escaped int2 NOT NULL DEFAULT 0;
++ALTER TABLE CustomFields ADD COLUMN EscapeHTML int2 NOT NULL DEFAULT 0;
diff --git a/etc/upgrade/4.4.5/schema.mysql b/etc/upgrade/4.4.5/schema.mysql
new file mode 100644
--- /dev/null
+++ b/etc/upgrade/4.4.5/schema.mysql
@@
-+ALTER TABLE CustomFields ADD COLUMN Escaped int2 NOT NULL DEFAULT 0;
++ALTER TABLE CustomFields ADD COLUMN EscapeHTML int2 NOT NULL DEFAULT 0;
diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
--- a/lib/RT/CustomField.pm
@@ -90,7 +90,7 @@
EntryHint => undef,
UniqueValues => 0,
CanonicalizeClass => undef,
-+ Escaped => 0,
++ EscapeHTML => 0,
@_,
);
@@ -98,7 +98,7 @@
LookupType => $args{'LookupType'},
UniqueValues => $args{'UniqueValues'},
CanonicalizeClass => $args{'CanonicalizeClass'},
-+ Escaped => $args{'Escaped'}
++ EscapeHTML => $args{'EscapeHTML'}
);
if ($rv) {
@@ -106,18 +106,18 @@
}
}
-+sub Escaped {
++sub EscapeHTML {
+ my $self = shift;
+ my $val = shift;
+
-+ return $self->_Value('Escaped');
++ return $self->_Value('EscapeHTML');
+}
+
-+sub SetEscaped {
++sub SetEscapeHTML {
+ my $self = shift;
+ my $val = shift;
+
-+ my ($status, $msg) = $self->_Set(Field => 'Escaped', Value => $val);
++ my ($status, $msg) = $self->_Set(Field => 'EscapeHTML', Value => $val);
+
+ unless ($status) {
+ return ($status, $msg);
@@ -139,31 +139,13 @@
+++ b/share/html/Admin/CustomFields/Modify.html
@@
- % if ( $CustomFieldObj->Id and $CustomFieldObj->HasRenderTypes ) {
- <tr>
-- <td class="label"><&|/l&>Render Type</&></td>
-- <td>
-+ <td class="label"><&|/l&>Render Type</&></td>
-+ <td>
- <& /Admin/Elements/SelectCustomFieldRenderType,
- Name => "RenderType",
- TypeComposite => $CustomFieldObj->TypeComposite,
- Default => $CustomFieldObj->RenderType,
- BasedOn => $CustomFieldObj->BasedOnObj->id, &>
-- </td>
-+ </td>
- </tr>
- % }
-
-@@
-
% $m->callback(CallbackName => 'BeforeEnabled', CustomField => $CustomFieldObj, CFvalidations => \@CFvalidations);
+% if ( grep { $CustomFieldObj->Type eq $_ } qw/Freeform Text/ ) {
+ <tr><td class="label"> </td><td>
-+ <input type="hidden" class="hidden" name="SetEscaped" value="1" />
-+ <input type="checkbox" class="checkbox" id="Escaped" name="Escaped" value="1" <% $EscapedChecked |n %> />
-+ <label for="Escaped"><&|/l&>Escape HTML of custom field value</&></label>
++ <input type="hidden" class="hidden" name="SetEscapeHTML" value="1" />
++ <input type="checkbox" class="checkbox" id="EscapeHTML" name="EscapeHTML" value="1" <% $EscapeHTMLChecked |n %> />
++ <label for="EscapeHTML"><&|/l&>Escape HTML of custom field value</&></label>
+ </td></tr>
+% }
+
@@ -174,7 +156,7 @@
Disabled => ($Enabled ? 0 : 1),
EntryHint => $EntryHint,
UniqueValues => $UniqueValues,
-+ Escaped => $Escaped
++ EscapeHTML => $EscapeHTML
);
if (!$val) {
push @results, loc("Could not create CustomField: [_1]", $msg);
@@ -182,10 +164,10 @@
# make sure the unchecked checkbox still causes an update
$ARGS{UniqueValues} ||= 0 if $SetUniqueValues;
-+ $ARGS{Escaped} ||= 0 if $SetEscaped;
++ $ARGS{EscapeHTML} ||= 0 if $SetEscapeHTML;
- my @attribs = qw(Disabled Pattern Name TypeComposite LookupType Description LinkValueTo IncludeContentForValue EntryHint UniqueValues);
-+ my @attribs = qw(Escaped Disabled Pattern Name TypeComposite LookupType Description LinkValueTo IncludeContentForValue EntryHint UniqueValues);
++ my @attribs = qw(EscapeHTML Disabled Pattern Name TypeComposite LookupType Description LinkValueTo IncludeContentForValue EntryHint UniqueValues);
push @results, UpdateRecordObject(
AttributesRef => \@attribs,
@@ -193,8 +175,8 @@
my $EnabledChecked = qq[checked="checked"];
$EnabledChecked = '' if $CustomFieldObj->Disabled;
-+my $EscapedChecked = '';
-+$EscapedChecked = qq[checked="checked"] if $CustomFieldObj->Escaped;
++my $EscapeHTMLChecked = '';
++$EscapeHTMLChecked = qq[checked="checked"] if $CustomFieldObj->EscapeHTML;
+
my $UniqueValuesChecked = qq[checked="checked"];
$UniqueValuesChecked = '' if !$CustomFieldObj->UniqueValues;
@@ -203,8 +185,8 @@
$IncludeContentForValue => undef
$BasedOn => undef
$EntryHint => undef
-+$Escaped => 0
-+$SetEscaped => undef
++$EscapeHTML => 0
++$SetEscapeHTML => undef
</%ARGS>
diff --git a/share/html/Elements/ShowCustomFieldText b/share/html/Elements/ShowCustomFieldText
@@ -216,7 +198,7 @@
my $content = $Object->LargeContent || $Object->Content;
- $content = $m->comp('/Elements/ScrubHTML', Content => $content);
- $content =~ s|\n|<br />|g;
-+ if ( $Escaped ) {
++ if ( $EscapeHTML ) {
+ RT::Interface::Web::EscapeHTML(\$content);
+ } else {
+ $content = $m->comp('/Elements/ScrubHTML', Content => $content);
@@ -226,5 +208,5 @@
<%$content|n%>
<%ARGS>
$Object
-+$Escaped => 0
++$EscapeHTML => 0
</%ARGS>
More information about the rt-commit
mailing list