You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2020/05/02 10:50:25 UTC
[ofbiz-framework] 01/03: Fixed: PartyProfileContent.js does not work
This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit 45535e34cb6b2308960fb0e16d6731068225f773
Author: Jacques Le Roux <ja...@les7arts.com>
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
Conflicts handled by hand
applications/party/template/party/profileblocks/Content.ftl
framework/common/groovyScripts/CommonServices.groovy
---
.../party/template/party/profileblocks/Content.ftl | 11 +++++++
.../common/groovyScripts/CommonServices.groovy | 36 ++++++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/applications/party/template/party/profileblocks/Content.ftl b/applications/party/template/party/profileblocks/Content.ftl
index 4e4aeaf..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>
+ <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
new file mode 100644
index 0000000..8afd19e
--- /dev/null
+++ b/framework/common/groovyScripts/CommonServices.groovy
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.ofbiz.webapp.event.FileUploadProgressListener
+
+/**
+ * Look up progress made in File Upload process
+ */
+def getFileUploadProgressStatus() {
+ FileUploadProgressListener uploadProgressListener = parameters.uploadProgressListener
+ Map result = success()
+ if (uploadProgressListener) {
+ result.contentLength = uploadProgressListener.getContentLength()
+ result.bytesRead = uploadProgressListener.getBytesRead()
+ result.hasStarted = uploadProgressListener.hasStarted()
+
+ result.readPercent = (result.bytesRead * 100) / result.contentLength
+ }
+ return result
+}