You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by sa...@apache.org on 2011/03/31 13:22:05 UTC

svn commit: r1087254 - in /ofbiz/trunk: applications/party/webapp/partymgr/js/ applications/party/webapp/partymgr/party/profileblocks/ framework/base/lib/commons/ framework/images/webapp/images/jquery/plugins/validate/

Author: sascharodekamp
Date: Thu Mar 31 11:22:05 2011
New Revision: 1087254

URL: http://svn.apache.org/viewvc?rev=1087254&view=rev
Log:
Bug - Create (upload) content in Party Profile does not work (https://issues.apache.org/jira/browse/OFBIZ-4179). The bug occurs when trying to upload a zip file. Tika was missing a class for dealing with zip files. I added commons-compress-1.1.jar. I also updated the UX for the upload function. When no file purpose was set the upload crashes. Therefore i added a field validation. 

Orig. Msg.:
As it does not work in trunk I 1st thought it was a jQuery migration issue. But it does not work either in R9.04 and I guess this is the initial reason

Added:
    ofbiz/trunk/framework/base/lib/commons/commons-compress-1.1.jar   (with props)
Removed:
    ofbiz/trunk/framework/images/webapp/images/jquery/plugins/validate/jquery.validate.pack.js
Modified:
    ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js
    ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Content.ftl

Modified: ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js?rev=1087254&r1=1087253&r2=1087254&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js Thu Mar 31 11:22:05 2011
@@ -19,7 +19,7 @@ under the License.
 
 /**
  *
- **/
+ */
 var uiLabelJsonObject = null;
 jQuery(document).ready(function() {
 
@@ -29,10 +29,7 @@ jQuery(document).ready(function() {
 
     uiLabelJsonObjects = getJSONuiLabels(labelObject);
 
-    jQuery("#uploadPartyContent").bind("submit", uploadPartyContent);
-    jQuery("#uploadPartyContent").bind("submit", getUploadProgressStatus);
     jQuery("#progress_bar").progressbar({value: 0});
-
 });
 
 function uploadPartyContent(event){
@@ -42,16 +39,22 @@ function uploadPartyContent(event){
     if(infodiv.length < 1){
         jQuery('<div id="content-messages"></div>').insertAfter(jQuery("#partyContentList"));
     }
-    if(targetFrame.length < 1){
+    if (targetFrame.length < 1){
         jQuery('#partyContent').append("<iframe id='target_upload' name='target_upload' style='display: none' src=''> </iframe>");
     }
     jQuery('#uploadPartyContent').attr("target", "target_upload");
+
+    var labelField = jQuery("#progressBarSavingMsg");
+    if (labelField.length) {
+        labelField.remove();
+    }
 }
 
 function uploadCompleted(){
     var iframePartyContentList = jQuery("#target_upload").contents().find("#partyContentList").html();
 
-    // update partyContentList - copy the Data from the iFrame partyContentList to the page partyContentList
+    // update partyContentList - copy the Data from the iFrame partyContentList
+    // to the page partyContentList
     jQuery("#partyContentList").html(iframePartyContentList);
 
     jQuery('#progressBarSavingMsg').html(uiLabelJsonObjects.CommonUiLabels[2]);
@@ -65,7 +68,8 @@ function uploadCompleted(){
 
 function checkIframeStatus() {
     var iframePartyContentList = null;
-    // if the new partyContentList isn't created wait a few ms and call the method again
+    // if the new partyContentList isn't created wait a few ms and call the
+    // method again
     jQuery.fjTimer({
         interval: 500,
         repeat: true,

Modified: ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Content.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Content.ftl?rev=1087254&r1=1087253&r2=1087254&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Content.ftl (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Content.ftl Thu Mar 31 11:22:05 2011
@@ -32,26 +32,38 @@ under the License.
         <input type="hidden" name="contentTypeId" value="DOCUMENT"/>
         <input type="hidden" name="statusId" value="CTNT_PUBLISHED"/>
         <input type="hidden" name="partyId" value="${partyId}" id="contentPartyId"/>
-        <input type="file" name="uploadedFile" size="20"/>
-        <div class="label">${uiLabelMap.PartyIsPublic}</div>
-        <select name="isPublic">
-            <option value="N">${uiLabelMap.CommonNo}</option>
-            <option value="Y">${uiLabelMap.CommonYes}</option>
-        </select>
-        <select name="partyContentTypeId">
+        <input type="file" name="uploadedFile" class="required error" size="25"/>
+        <div>
+        <select name="partyContentTypeId" class="required error">
           <option value="">${uiLabelMap.PartySelectPurpose}</option>
           <#list partyContentTypes as partyContentType>
             <option value="${partyContentType.partyContentTypeId}">${partyContentType.get("description", locale)?default(partyContentType.partyContentTypeId)}</option>
           </#list>
         </select>
+        </div>
+        <div class="label">${uiLabelMap.PartyIsPublic}</div>
+        <select name="isPublic">
+            <option value="N">${uiLabelMap.CommonNo}</option>
+            <option value="Y">${uiLabelMap.CommonYes}</option>
+        </select>
         <select name="roleTypeId">
           <option value="">${uiLabelMap.PartySelectRole}</option>
           <#list roles as role>
             <option value="${role.roleTypeId}" <#if role.roleTypeId == "_NA_">selected="selected"</#if>>${role.get("description", locale)?default(role.roleTypeId)}</option>
           </#list>
         </select>
-        <input type="submit" value="${uiLabelMap.CommonUpload}"/>
+        <input type="submit" value="${uiLabelMap.CommonUpload}" />
       </form>
       <div id='progress_bar'><div></div></div>
     </div>
   </div>
+  <script type="text/javascript">
+    jQuery("#uploadPartyContent").validate({
+        submitHandler: function(form) {
+            <#-- call upload scripts - functions defined in PartyProfileContent.js -->
+            uploadPartyContent();
+            getUploadProgressStatus();
+            form.submit();
+        }
+    });
+  </script>

Added: ofbiz/trunk/framework/base/lib/commons/commons-compress-1.1.jar
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/commons/commons-compress-1.1.jar?rev=1087254&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/trunk/framework/base/lib/commons/commons-compress-1.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream