← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20772: Added rendering of file upload to custom form file resource inputs. Has a minor issue with displa...

 

------------------------------------------------------------
revno: 20772
committer: Halvdan Hoem Grelland <halvdanhg@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-10-19 17:37:33 +0200
message:
  Added rendering of file upload to custom form file resource inputs. Has a minor issue with displaying the file name (breaks on two lines instead of shortening) but works otherwise.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java	2015-10-12 10:18:30 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java	2015-10-19 15:37:33 +0000
@@ -370,6 +370,28 @@
 
                     appendCode += " name=\"entryfield\" class=\"entryfield entryarea\" tabindex=\"" + i++ + "\"" + "></textarea>";
                 }
+                else if ( ValueType.FILE_RESOURCE == valueType )
+                {
+                    inputHtml = inputHtml.replace( "input", "div" );
+
+                    appendCode += " class=\"entryfileresource\" tabindex=\"" + i++ + "\">" +
+                                    "<input class=\"entryfileresource-input\" id=\"input-"+ dataElementId + "-" + optionComboId + "-val\">" +
+                                    "<div class=\"upload-field\">" +
+                                        "<div class=\"upload-fileinfo\"> " +
+                                            "<div class=\"upload-fileinfo-size\"></div>" +
+                                            "<div class=\"upload-fileinfo-name\"></div>" +
+                                        "</div>" +
+                                        "<div class=\"upload-progress\">" +
+                                            "<div class=\"upload-progress-bar\"></div>" +
+                                            "<div class=\"upload-progress-info\"></div>" +
+                                        "</div>" +
+                                    "</div>" +
+                                    "<div class=\"upload-button-group\">" +
+                                        "<button class=\"upload-button\"></button>" +
+                                    "</div>" +
+                                    "<input type=\"file\" style=\"display: none;\">" +
+                                "</div>";
+                }
                 else
                 {
                     appendCode += " type=\"text\" name=\"entryfield\" class=\"entryfield\" tabindex=\"" + i++ + "\"" + TAG_CLOSE;