[Rt-commit] rt branch, 4.2/cf-mandatory-binary-fix, created. rt-4.0.0rc7-255-gc1986fa

? sunnavy sunnavy at bestpractical.com
Tue May 24 09:51:43 EDT 2011


The branch, 4.2/cf-mandatory-binary-fix has been created
        at  c1986fafc05e0f3dfd5bb65b3ed465da52a1b458 (commit)

- Log -----------------------------------------------------------------
commit b92bb324d6bb9c6c9593e78f24be8fe7deead07d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue May 24 20:38:42 2011 +0800

    input name of binary cfs ends with "-Upload"

diff --git a/share/html/Elements/ValidateCustomFields b/share/html/Elements/ValidateCustomFields
index 9963039..9609c5a 100644
--- a/share/html/Elements/ValidateCustomFields
+++ b/share/html/Elements/ValidateCustomFields
@@ -49,7 +49,10 @@
 my ($valid, @res) = (1, ());
 $CustomFields->GotoFirstItem;
 while ( my $CF = $CustomFields->Next ) {
-    my $field = $NamePrefix . $CF->Id . "-Value";
+    my $field =
+        $NamePrefix
+      . $CF->Id
+      . ( $CF->Type =~ /^(?:Binary|Image)$/ ? '-Upload' : "-Value" );
 
     my $value;
     if ($ARGSRef->{"${field}s-Magic"} and exists $ARGSRef->{"${field}s"}) {

commit 442d4230a3b91d160bba0ca7dc2ac6f8e12fe72e
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue May 24 21:25:01 2011 +0800

    always show cf file input
    
    if not, people won't be able to update the mandatory "upload one file" cf
    at least in Modify.html

diff --git a/share/html/Elements/EditCustomFieldBinary b/share/html/Elements/EditCustomFieldBinary
index 1128c5a..5335a70 100644
--- a/share/html/Elements/EditCustomFieldBinary
+++ b/share/html/Elements/EditCustomFieldBinary
@@ -49,9 +49,7 @@
 %# XXX - let user download the file(s) here?
 <input type="checkbox" class="checkbox" name="<%$NamePrefix%><%$CustomField->Id%>-DeleteValueIds" class="CF-<%$CustomField->id%>-Edit" value="<% $value->Id %>" /><a href="<%RT->Config->Get('WebPath')%>/Download/CustomFieldValue/<% $value->Id %>/<% $value->Content %>"><% $value->Content %></a><br />
 % }
-% if (!$MaxValues || !$Values || $Values->Count < $MaxValues) {
 <input type="file" name="<% $NamePrefix %><% $CustomField->Id %>-Upload" class="CF-<%$CustomField->id%>-Edit" />
-% }
 <%ARGS>
 $Object => undef
 $CustomField => undef
diff --git a/share/html/Elements/EditCustomFieldImage b/share/html/Elements/EditCustomFieldImage
index 6a3ed4b..6a887a1 100644
--- a/share/html/Elements/EditCustomFieldImage
+++ b/share/html/Elements/EditCustomFieldImage
@@ -49,9 +49,7 @@
 <input type="checkbox" class="checkbox" name="<%$NamePrefix%><%$CustomField->Id%>-DeleteValueIds" class="CF-<%$CustomField->id%>-Edit" value="<% $value->Id %>" /><& ShowCustomFieldImage, Object => $value &>
 <br />
 % }
-% if (!$MaxValues or !$Values or $Values->Count < $MaxValues) {
 <input type="file" name="<%$NamePrefix%><%$CustomField->Id%>-Upload" class="CF-<%$CustomField->id%>-Edit" />
-% }
 <%ARGS>
 $Object => undef
 $CustomField => undef

commit c1986fafc05e0f3dfd5bb65b3ed465da52a1b458
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue May 24 21:32:19 2011 +0800

    good to warn that old values would be overridden in some cases

diff --git a/share/html/Elements/EditCustomFieldBinary b/share/html/Elements/EditCustomFieldBinary
index 5335a70..47759d3 100644
--- a/share/html/Elements/EditCustomFieldBinary
+++ b/share/html/Elements/EditCustomFieldBinary
@@ -49,6 +49,11 @@
 %# XXX - let user download the file(s) here?
 <input type="checkbox" class="checkbox" name="<%$NamePrefix%><%$CustomField->Id%>-DeleteValueIds" class="CF-<%$CustomField->id%>-Edit" value="<% $value->Id %>" /><a href="<%RT->Config->Get('WebPath')%>/Download/CustomFieldValue/<% $value->Id %>/<% $value->Content %>"><% $value->Content %></a><br />
 % }
+% if ($MaxValues && $Values && $Values->Count >= $MaxValues ) {
+<div class="hints">
+<&|/l&>Reached maximum number, so new values will override old ones.</&>
+</div>
+% }
 <input type="file" name="<% $NamePrefix %><% $CustomField->Id %>-Upload" class="CF-<%$CustomField->id%>-Edit" />
 <%ARGS>
 $Object => undef
diff --git a/share/html/Elements/EditCustomFieldImage b/share/html/Elements/EditCustomFieldImage
index 6a887a1..09230b2 100644
--- a/share/html/Elements/EditCustomFieldImage
+++ b/share/html/Elements/EditCustomFieldImage
@@ -49,6 +49,11 @@
 <input type="checkbox" class="checkbox" name="<%$NamePrefix%><%$CustomField->Id%>-DeleteValueIds" class="CF-<%$CustomField->id%>-Edit" value="<% $value->Id %>" /><& ShowCustomFieldImage, Object => $value &>
 <br />
 % }
+% if ($MaxValues && $Values && $Values->Count >= $MaxValues ) {
+<div class="hints">
+<&|/l&>Reached maximum number, so new values will override old ones.</&>
+</div>
+% }
 <input type="file" name="<%$NamePrefix%><%$CustomField->Id%>-Upload" class="CF-<%$CustomField->id%>-Edit" />
 <%ARGS>
 $Object => undef

-----------------------------------------------------------------------


More information about the Rt-commit mailing list