[Rt-commit] rt branch, 4.4/cf-entry-hint, created. rt-4.2.3-22-g5cb5936
? sunnavy
sunnavy at bestpractical.com
Mon Feb 24 12:01:44 EST 2014
The branch, 4.4/cf-entry-hint has been created
at 5cb59368955e63a0b3701081a8edf1af04a7b9cf (commit)
- Log -----------------------------------------------------------------
commit 29cb180440624422710e393382ec7c022ca8283d
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Feb 25 00:10:13 2014 +0800
EntryHint column for CustomFields table
diff --git a/etc/schema.Oracle b/etc/schema.Oracle
index effefc5..58665c7 100755
--- a/etc/schema.Oracle
+++ b/etc/schema.Oracle
@@ -371,6 +371,7 @@ CREATE TABLE CustomFields (
Description VARCHAR2(255),
SortOrder NUMBER(11,0) DEFAULT 0 NOT NULL,
LookupType VARCHAR2(255),
+ EntryHint VARCHAR2(255) NULL,
Creator NUMBER(11,0) DEFAULT 0 NOT NULL,
Created DATE,
LastUpdatedBy NUMBER(11,0) DEFAULT 0 NOT NULL,
diff --git a/etc/schema.Pg b/etc/schema.Pg
index e5e2a04..356441b 100755
--- a/etc/schema.Pg
+++ b/etc/schema.Pg
@@ -553,6 +553,7 @@ CREATE TABLE CustomFields (
BasedOn integer NULL,
Pattern varchar(65536) NULL ,
LookupType varchar(255) NOT NULL ,
+ EntryHint varchar(255) NULL,
Description varchar(255) NULL ,
SortOrder integer NOT NULL DEFAULT 0 ,
diff --git a/etc/schema.SQLite b/etc/schema.SQLite
index c50e5b1..7ba11f7 100755
--- a/etc/schema.SQLite
+++ b/etc/schema.SQLite
@@ -400,6 +400,7 @@ CREATE TABLE CustomFields (
Description varchar(255) collate NOCASE NULL ,
SortOrder integer NOT NULL DEFAULT 0 ,
LookupType varchar(255) collate NOCASE NOT NULL,
+ EntryHint varchar(255) NULL,
Creator integer NOT NULL DEFAULT 0 ,
Created DATETIME NULL ,
diff --git a/etc/schema.mysql b/etc/schema.mysql
index 610a79c..1030eb2 100755
--- a/etc/schema.mysql
+++ b/etc/schema.mysql
@@ -374,6 +374,7 @@ CREATE TABLE CustomFields (
Description varchar(255) NULL ,
SortOrder integer NOT NULL DEFAULT 0 ,
LookupType varchar(255) CHARACTER SET ascii NOT NULL,
+ EntryHint varchar(255) NULL,
Creator integer NOT NULL DEFAULT 0 ,
Created DATETIME NULL ,
diff --git a/etc/upgrade/4.3.1/content b/etc/upgrade/4.3.1/content
new file mode 100644
index 0000000..9c46681
--- /dev/null
+++ b/etc/upgrade/4.3.1/content
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+
+our @Initial = (
+ sub {
+ use RT::CustomFields;
+ my $cfs = RT::CustomFields->new(RT->SystemUser);
+ $cfs->{'find_disabled_rows'} = 1;
+ $cfs->Limit( FIELD => 'EntryHint', VALUE => 'NULL', OPERATOR => 'IS' );
+ while ( my $cf = $cfs->Next ) {
+ my ($ret, $msg) = $cf->SetEntryHint($cf->FriendlyType);
+ RT->Logger->warning("Update Custom Field EntryHint for CF." . $cf->Id . " $msg");
+ }
+ return 1;
+ },
+);
diff --git a/etc/upgrade/4.3.1/schema.Oracle b/etc/upgrade/4.3.1/schema.Oracle
new file mode 100644
index 0000000..6056ee0
--- /dev/null
+++ b/etc/upgrade/4.3.1/schema.Oracle
@@ -0,0 +1 @@
+ALTER TABLE CustomFields ADD EntryHint VARCHAR2(255) NULL;
diff --git a/etc/upgrade/4.3.1/schema.Pg b/etc/upgrade/4.3.1/schema.Pg
new file mode 100644
index 0000000..92c28dc
--- /dev/null
+++ b/etc/upgrade/4.3.1/schema.Pg
@@ -0,0 +1 @@
+ALTER TABLE CustomFields ADD COLUMN EntryHint VARCHAR(255) NULL;
diff --git a/etc/upgrade/4.3.1/schema.SQLite b/etc/upgrade/4.3.1/schema.SQLite
new file mode 100644
index 0000000..92c28dc
--- /dev/null
+++ b/etc/upgrade/4.3.1/schema.SQLite
@@ -0,0 +1 @@
+ALTER TABLE CustomFields ADD COLUMN EntryHint VARCHAR(255) NULL;
diff --git a/etc/upgrade/4.3.1/schema.mysql b/etc/upgrade/4.3.1/schema.mysql
new file mode 100644
index 0000000..92c28dc
--- /dev/null
+++ b/etc/upgrade/4.3.1/schema.mysql
@@ -0,0 +1 @@
+ALTER TABLE CustomFields ADD COLUMN EntryHint VARCHAR(255) NULL;
diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index fe4e5f6..6f52c4e 100644
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -234,6 +234,7 @@ Create takes a hash of values and creates a row in the database:
varchar(255) 'Description'.
int(11) 'SortOrder'.
varchar(255) 'LookupType'.
+ varchar(255) 'EntryHint'.
smallint(6) 'Disabled'.
C<LookupType> is generally the result of either
@@ -2043,6 +2044,16 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
=cut
+=head2 SetEntryHint VALUE
+
+
+Set EntryHint to VALUE.
+Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
+(In the database, EntryHint will be stored as a varchar(255).)
+
+
+=cut
+
=head2 Creator
@@ -2124,6 +2135,8 @@ sub _CoreAccessible {
{read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
LookupType =>
{read => 1, write => 1, sql_type => 12, length => 255, is_blob => 0, is_numeric => 0, type => 'varchar(255)', default => ''},
+ EntryHint =>
+ {read => 1, write => 1, sql_type => 12, length => 255, is_blob => 0, is_numeric => 0, type => 'varchar(255)', default => undef },
Creator =>
{read => 1, auto => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
Created =>
commit 42d7da6c89e96dfc1ed1cc094cfef3a009783754
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Feb 25 00:16:09 2014 +0800
set EntryHint on create and default it to FriendlyType if not define
diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index 6f52c4e..825dff5 100644
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -254,6 +254,7 @@ sub Create {
LookupType => '',
LinkValueTo => '',
IncludeContentForValue => '',
+ EntryHint => undef,
@_,
);
@@ -343,6 +344,8 @@ sub Create {
$self->SetLinkValueTo($args{'LinkValueTo'});
}
+ $self->SetEntryHint( $args{EntryHint} // $self->FriendlyType );
+
if ( exists $args{'IncludeContentForValue'}) {
$self->SetIncludeContentForValue($args{'IncludeContentForValue'});
}
commit 307ed1df2e5608de7032759a11c6bde2492c393e
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Feb 25 00:17:06 2014 +0800
update EntryHint accordingly when Type is updated and EntryHint matches the old FriendlyType
diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index 825dff5..70acf19 100644
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -736,7 +736,11 @@ sub SetType {
);
$self->SetMaxValues($1 ? 1 : 0);
}
- $self->_Set(Field => 'Type', Value =>$type);
+ my $need_to_update_hint;
+ $need_to_update_hint = 1 if $self->EntryHint && $self->EntryHint eq $self->FriendlyType;
+ my ( $ret, $msg ) = $self->_Set( Field => 'Type', Value => $type );
+ $self->SetEntryHint($self->FriendlyType) if $need_to_update_hint && $ret;
+ return ( $ret, $msg );
}
=head2 SetPattern STRING
commit 5cb59368955e63a0b3701081a8edf1af04a7b9cf
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Feb 25 00:49:12 2014 +0800
EntryHint field edit support on cf admin page
diff --git a/share/html/Admin/CustomFields/Modify.html b/share/html/Admin/CustomFields/Modify.html
index 78995f3..30dcbb1 100644
--- a/share/html/Admin/CustomFields/Modify.html
+++ b/share/html/Admin/CustomFields/Modify.html
@@ -97,6 +97,28 @@
Default => $CustomFieldObj->LookupType || $LookupType, &>
</td></tr>
+<script type="text/javascript">
+jQuery( function() {
+ var select = jQuery('select[name=TypeComposite]');
+ var default_hint = select.find('option:selected').text();
+ var hint_input = jQuery('input[name=EntryHint]');
+ select.change(function() {
+ var new_hint = jQuery(this).find('option:selected').text();
+ if ( hint_input.val() == default_hint ) {
+ hint_input.val(new_hint);
+ }
+ default_hint = new_hint;
+ });
+% if ( $id eq 'new' && not defined $EntryHint) {
+ hint_input.val(default_hint);
+% }
+});
+</script>
+
+<tr><td class="label"><&|/l&>Entry Hint</&></td>
+<td><input name="EntryHint" value="<% $CustomFieldObj->EntryHint // $EntryHint // '' %>" size="80" /></td></tr>
+
+
<tr class="edit_validation"><td class="label"><&|/l&>Validation</&></td>
<td><& /Widgets/ComboBox,
Name => 'Pattern',
@@ -179,6 +201,7 @@ else {
IncludeContentForValue => $IncludeContentForValue,
BasedOn => $BasedOn,
Disabled => ($Enabled ? 0 : 1),
+ EntryHint => $EntryHint,
);
if (!$val) {
push @results, loc("Could not create CustomField: [_1]", $msg);
@@ -201,7 +224,7 @@ if ( $ARGS{'Update'} && $id ne 'new' ) {
#we're asking about enabled on the web page but really care about disabled.
$ARGS{'Disabled'} = $Enabled? 0 : 1;
- my @attribs = qw(Disabled Pattern Name TypeComposite LookupType Description LinkValueTo IncludeContentForValue);
+ my @attribs = qw(Disabled Pattern Name TypeComposite LookupType Description LinkValueTo IncludeContentForValue EntryHint);
push @results, UpdateRecordObject(
AttributesRef => \@attribs,
Object => $CustomFieldObj,
@@ -339,4 +362,5 @@ $RenderType => undef
$LinkValueTo => undef
$IncludeContentForValue => undef
$BasedOn => undef
+$EntryHint => undef
</%ARGS>
-----------------------------------------------------------------------
More information about the rt-commit
mailing list