[Rt-commit] rt branch, 4.2/cf-mandatory-binary-fix, created. rt-4.1.8-314-g560cd38

? sunnavy sunnavy at bestpractical.com
Fri May 17 12:05:03 EDT 2013


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

- Log -----------------------------------------------------------------
commit c0c28a486c70e65543eef02aa68bc4dcea2c4ae5
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri May 17 20:04:10 2013 +0800

    binary cf inputs end up with "-Upload" instead of "-Value"

diff --git a/share/html/Elements/ValidateCustomFields b/share/html/Elements/ValidateCustomFields
index bca5830..ae63fbf 100644
--- a/share/html/Elements/ValidateCustomFields
+++ b/share/html/Elements/ValidateCustomFields
@@ -60,6 +60,7 @@ while ( my $CF = $CustomFields->Next ) {
     # submitting a field.
     next if not $ValidateUnsubmitted
         and not exists $submitted->{"Value"}
+        and not exists $submitted->{"Upload"}
         and not exists $submitted->{"Values"}
         and not $submitted->{"Values-Magic"};
 
@@ -71,7 +72,7 @@ while ( my $CF = $CustomFields->Next ) {
 
     my @values = _NormalizeObjectCustomFieldValue(
         CustomField => $CF,
-        Value       => $submitted->{Values} || $submitted->{Value},
+        Value       => $submitted->{Values} || $submitted->{Value} || $submitted->{Upload},
     );
     push @values, '' unless @values;
 

commit cc81e74dfddb0bb80a59a897fdc4378c30c5d5f2
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri May 17 19:50:15 2013 +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 f9719b7..96b637d 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" name="<%$NamePrefix%><%$CustomField->Id%>-DeleteValueIds" class="checkbox 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 9316fbc..6547223 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 560cd38382d2014bdec439eeb8ee82ce67e8091e
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri May 17 19:51:49 2013 +0800

    good to warn that old values would be overridden

diff --git a/share/html/Elements/EditCustomFieldBinary b/share/html/Elements/EditCustomFieldBinary
index 96b637d..e79580b 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" name="<%$NamePrefix%><%$CustomField->Id%>-DeleteValueIds" class="checkbox 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 6547223..b28a72b 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