Re: Dev - [OFBiz] SVN: r7045 - in trunk/framework/widget: dtd src/org/ofbiz/widget/screen

Posted by David E. Jones on
URL: http://ofbiz.116.s1.nabble.com/Re-Dev-OFBiz-SVN-r7045-in-trunk-framework-widget-dtd-src-org-ofbiz-widget-screen-tp167300p167301.html


Yes, Jacopo, that is how it should be.

Sorry everyone for not doing a clean build before committing this.

The fix is in rev 7050.

-David


Jacopo Cappellato wrote:

> David,
>
> after this commit the widget component doesn't compile.
> The attached patch is a *temp* fix for it: with it the component can be
> built but I really don't know if the Map that I'm passing to the method
> is the good one (but probably yes).
>
> Can you have a look at it?
>
> Thanks,
>
> Jacopo
>
>
> [hidden email] wrote:
>> Author: jonesde
>> Date: 2006-03-22 02:46:16 -0600 (Wed, 22 Mar 2006)
>> New Revision: 7045
>>
>> Modified:
>>    trunk/framework/widget/dtd/widget-screen.xsd
>>    
>> trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
>> Log:
>> Applied patch from Al Byers to support dataresource-id attribute as an
>> alternative to the content-id attribute in the content element of the
>> screen widget; also changed the corresponding XSD file to reflect this
>> change and validate files without complaining
>>
>> Modified: trunk/framework/widget/dtd/widget-screen.xsd
>> ===================================================================
>> --- trunk/framework/widget/dtd/widget-screen.xsd    2006-03-22
>> 08:36:34 UTC (rev 7044)
>> +++ trunk/framework/widget/dtd/widget-screen.xsd    2006-03-22
>> 08:46:16 UTC (rev 7045)
>> @@ -811,7 +811,8 @@
>>          </xs:complexType>
>>      </xs:element>
>>      <xs:attributeGroup name="attlist.content">
>> -        <xs:attribute type="xs:string" name="content-id"
>> use="required"/>
>> +        <xs:attribute type="xs:string" name="content-id"/>
>> +        <xs:attribute type="xs:string" name="dataresource-id"/>
>>          <xs:attribute type="xs:string" name="edit-request"/>
>>          <xs:attribute type="xs:string" name="edit-container-style"
>> default="editWrapper"/>
>>          <xs:attribute type="xs:string" name="enable-edit-name"
>> default="enableEdit"/>
>>
>> Modified:
>> trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
>> ===================================================================
>> ---
>> trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java    
>> 2006-03-22 08:36:34 UTC (rev 7044)
>> +++
>> trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java    
>> 2006-03-22 08:46:16 UTC (rev 7045)
>> @@ -818,7 +818,7 @@
>>          protected FlexibleStringExpander editContainerStyle;
>>          protected FlexibleStringExpander enableEditName;
>>          protected boolean xmlEscape = false;
>> -        protected String dataResourceId;
>> +        protected FlexibleStringExpander dataResourceId;
>>          protected String width;
>>          protected String height;
>>          protected String border;
>> @@ -828,6 +828,7 @@
>>  
>>              // put the text attribute first, then the pcdata under
>> the element, if both are there of course
>>              this.contentId = new
>> FlexibleStringExpander(subContentElement.getAttribute("content-id"));
>> +            this.dataResourceId = new
>> FlexibleStringExpander(subContentElement.getAttribute("dataresource-id"));
>>
>>              this.editRequest = new
>> FlexibleStringExpander(subContentElement.getAttribute("edit-request"));
>>              this.editContainerStyle = new
>> FlexibleStringExpander(subContentElement.getAttribute("edit-container-style"));
>>
>>              this.enableEditName = new
>> FlexibleStringExpander(subContentElement.getAttribute("enable-edit-name"));
>>
>> @@ -846,27 +847,29 @@
>>                  // because many times there will be embedded
>> "subcontent" elements
>>                  // that use the syntax: <subcontent
>> content-id="${contentId}"...
>>                  // and this is a step to make sure that it is there.
>> -                String expandedContentId = getContentId(context);
>> -                if (!(context instanceof MapStack)) {
>> -                    context = MapStack.create(context);
>> -                }
>> -                -                // This is an important step to make
>> sure that the current contentId is in the context
>> -                // as templates that contain "subcontent" elements
>> will expect to find the master
>> -                // contentId in the context as "contentId".
>> -                ((MapStack) context).push();
>> -                context.put("contentId", expandedContentId);
>> -                                 GenericDelegator delegator =
>> (GenericDelegator) context.get("delegator");
>>                  GenericValue content = null;
>> -                if (UtilValidate.isNotEmpty(expandedContentId)) {
>> -                    content =
>> delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId",
>> expandedContentId));
>> +                String expandedDataResourceId =
>> getDataResourceId(context);
>> +                if (UtilValidate.isEmpty(expandedDataResourceId)) {
>> +                    String expandedContentId = getContentId(context);
>> +                    if (!(context instanceof MapStack)) {
>> +                        context = MapStack.create(context);
>> +                    }
>> +                    +                    // This is an important step
>> to make sure that the current contentId is in the context
>> +                    // as templates that contain "subcontent"
>> elements will expect to find the master
>> +                    // contentId in the context as "contentId".
>> +                    ((MapStack) context).push();
>> +                    context.put("contentId", expandedContentId);
>> +                    +                    if
>> (UtilValidate.isNotEmpty(expandedContentId)) {
>> +                        content =
>> delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId",
>> expandedContentId));
>> +                    }
>> +                    expandedDataResourceId =
>> content.getString("dataResourceId");
>>                  }
>> -                                 GenericValue dataResource = null;
>> -                this.dataResourceId =
>> content.getString("dataResourceId");
>> -                if (UtilValidate.isNotEmpty(dataResourceId)) {
>> -                    dataResource =
>> delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId",
>> expandedContentId));
>> +                if (UtilValidate.isNotEmpty(expandedDataResourceId)) {
>> +                    dataResource =
>> delegator.findByPrimaryKeyCache("DataResource",
>> UtilMisc.toMap("dataResourceId", expandedDataResourceId));
>>                  }
>>                                   String mimeTypeId = null;
>> @@ -899,6 +902,10 @@
>>              return this.contentId.expandString(context);
>>          }
>>          +        public String getDataResourceId(Map context) {
>> +            return this.dataResourceId.expandString(context);
>> +        }
>> +                 public String getEditRequest(Map context) {
>>              return this.editRequest.expandString(context);
>>          }
>> @@ -920,10 +927,6 @@
>>              return "<content content-id=\"" +
>> this.contentId.getOriginal() + "\" xml-escape=\"" + this.xmlEscape +
>> "\"/>";
>>          }
>>          -        public String getDataResourceId() {
>> -            return this.dataResourceId;
>> -        }
>> -                 public String getWidth() {
>>              return this.width;
>>          }
>>
>>  
>> _______________________________________________
>> Svn mailing list
>> [hidden email]
>> http://lists.ofbiz.org/mailman/listinfo/svn
>>
>    
>
>
> ------------------------------------------------------------------------
>
> Index: framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java
> ===================================================================
> --- framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (revision 7046)
> +++ framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (working copy)
> @@ -374,7 +374,7 @@
>  
>      public void renderContentFrame(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
>      
> -     String dataResourceId = content.getDataResourceId();
> +     String dataResourceId = content.getDataResourceId(context);
>       String urlString = "ViewSimpleContent?dataResourceId=" + dataResourceId;
>      
>       String width = content.getWidth();
>
>
> ------------------------------------------------------------------------
>
>  
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev