[ofbiz-framework] branch trunk updated: Fixed: PartyProfileContent.js does not work

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Fixed: PartyProfileContent.js does not work

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 1efaa73  Fixed: PartyProfileContent.js does not work
1efaa73 is described below

commit 1efaa73ebb4fe3d5dc1f95ae9a5f985226fe8238
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Sat May 2 09:31:41 2020 +0200

    Fixed: PartyProfileContent.js does not work
   
    (OFBIZ-11633)
    When you upload a content from the party profile page you don't see a progress
    bar. The PartyProfileContent.js is loaded but for some reason is unused or wrong
   
    Mohammad Kathawala mentionned that it was removed with OFBIZ-9299
    It was also broken with OFBIZ-11402
   
    Thanks: Mohammad for the track
---
 applications/party/template/party/profileblocks/Content.ftl | 13 ++++++++++++-
 framework/common/groovyScripts/CommonServices.groovy        |  9 +++++----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/applications/party/template/party/profileblocks/Content.ftl b/applications/party/template/party/profileblocks/Content.ftl
index b3633df..72bdb53 100644
--- a/applications/party/template/party/profileblocks/Content.ftl
+++ b/applications/party/template/party/profileblocks/Content.ftl
@@ -54,5 +54,16 @@ under the License.
         </select>
         <input type="submit" value="${uiLabelMap.CommonUpload}" />
       </form>
+      <div id='progress_bar'><div></div></div>
     </div>
-  </div>
\ No newline at end of file
+  </div>
+  <script type="application/javascript">
+    jQuery("#uploadPartyContent").validate({
+        submitHandler: function(form) {
+            <#-- call upload scripts - functions defined in PartyProfileContent.js -->
+            uploadPartyContent();
+            getUploadProgressStatus();
+            form.submit();
+        }
+    });
+  </script>
diff --git a/framework/common/groovyScripts/CommonServices.groovy b/framework/common/groovyScripts/CommonServices.groovy
index af9832e..35f5af0 100644
--- a/framework/common/groovyScripts/CommonServices.groovy
+++ b/framework/common/groovyScripts/CommonServices.groovy
@@ -23,6 +23,7 @@ import org.apache.ofbiz.base.util.UtilDateTime
 import org.apache.ofbiz.base.util.UtilProperties
 import org.apache.ofbiz.common.CommonWorkers
 import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.webapp.event.FileUploadProgressListener
 
 /**
  * Main permission logic
@@ -157,12 +158,12 @@ def convertUomCustom() {
  * Look up progress made in File Upload process
  */
 def getFileUploadProgressStatus() {
-    GenericValue uploadProgressListener = parameters.uploadProgressListener
+    FileUploadProgressListener uploadProgressListener = parameters.uploadProgressListener
     Map result = success()
     if (uploadProgressListener) {
-        result.contentLength = uploadProgressListener.getContentLength
-        result.bytesRead = uploadProgressListener.getBytesRead
-        result.hasStarted = uploadProgressListener.hasStarted
+        result.contentLength = uploadProgressListener.getContentLength()
+        result.bytesRead = uploadProgressListener.getBytesRead()
+        result.hasStarted = uploadProgressListener.hasStarted()
 
         result.readPercent = (result.bytesRead * 100) / result.contentLength
     }