Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved: Ecommerce website content (OFBIZ-12330) #67

Open
wants to merge 9 commits into
base: trunk
Choose a base branch
from
Open
6 changes: 3 additions & 3 deletions ecommerce/data/DemoContentAltUrl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ under the License.

<!-- Demo Content Alternative Url -->
<!-- The content alternative url come from the contentName in the Content entity.-->
<DataResource dataResourceId="DRS_CNT_URL005" dataResourceTypeId="ELECTRONIC_TEXT" statusId="CTNT_IN_PROGRESS" objectInfo="/Cute-Kid-BLG10000-content" localeString="en_US"/>
<DataResource dataResourceId="DRS_CNT_URL005" dataResourceTypeId="ELECTRONIC_TEXT" statusId="CTNT_IN_PROGRESS" objectInfo="Cute-Kid-BLG10000-content" localeString="en_US"/>
<ElectronicText dataResourceId="DRS_CNT_URL005" textData="Cute Kid"/>
<Content contentId="CNT_ALTURL_005" contentTypeId="DOCUMENT" dataResourceId="DRS_CNT_URL005" statusId="CTNT_IN_PROGRESS" localeString="en_US"/>
<ContentAssoc contentId="BLG10000" contentIdTo="CNT_ALTURL_005" contentAssocTypeId="ALTERNATIVE_URL" fromDate="2011-06-23 01:01:01"></ContentAssoc>

<DataResource dataResourceId="DRS_CNT_URL006" dataResourceTypeId="ELECTRONIC_TEXT" statusId="CTNT_IN_PROGRESS" objectInfo="/Next-Linus-BLG10010-content" localeString="en_US"/>
<DataResource dataResourceId="DRS_CNT_URL006" dataResourceTypeId="ELECTRONIC_TEXT" statusId="CTNT_IN_PROGRESS" objectInfo="Next-Linus-BLG10010-content" localeString="en_US"/>
<ElectronicText dataResourceId="DRS_CNT_URL006" textData="Next Linus"/>
<Content contentId="CNT_ALTURL_006" contentTypeId="DOCUMENT" dataResourceId="DRS_CNT_URL006" statusId="CTNT_IN_PROGRESS" localeString="en_US"/>
<ContentAssoc contentId="BLG10010" contentIdTo="CNT_ALTURL_006" contentAssocTypeId="ALTERNATIVE_URL" fromDate="2011-06-23 01:01:01"></ContentAssoc>

<DataResource dataResourceId="DRS_CNT_URL007" dataResourceTypeId="ELECTRONIC_TEXT" statusId="CTNT_IN_PROGRESS" objectInfo="/2008-Elections-BLG10007-content" localeString="en_US"/>
<DataResource dataResourceId="DRS_CNT_URL007" dataResourceTypeId="ELECTRONIC_TEXT" statusId="CTNT_IN_PROGRESS" objectInfo="2008-Elections-BLG10007-content" localeString="en_US"/>
<ElectronicText dataResourceId="DRS_CNT_URL007" textData="2008 Elections"/>
<Content contentId="CNT_ALTURL_007" contentTypeId="DOCUMENT" dataResourceId="DRS_CNT_URL007" statusId="CTNT_IN_PROGRESS" localeString="en_US"/>
<ContentAssoc contentId="BLG10007" contentIdTo="CNT_ALTURL_007" contentAssocTypeId="ALTERNATIVE_URL" fromDate="2011-06-23 01:01:01"></ContentAssoc>
Expand Down
5 changes: 5 additions & 0 deletions ecommerce/data/DemoWebSitePublishPointData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,9 @@ under the License.
contentName="Cookie Policy" description="Cookie Policy Description" mimeTypeId="text/html" localeString="en_US" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/>
<ContentAssoc contentId="WebStoreCONTENT" contentIdTo="COOKIE_POLICY" mapKey="cookiePolicy" contentAssocTypeId="SUB_CONTENT"
fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/>

<!-- add WebSiteContent root for ecommerce template -->
<WebSiteContent webSiteId="WebStore" contentId="BLOGROOT" webSiteContentTypeId="BLOG_ROOT" fromDate="2021-01-01 00:00:00"/>
<WebSiteContent webSiteId="WebStore" contentId="WebStoreFORUM" webSiteContentTypeId="FORUM_ROOT" fromDate="2021-01-01 00:00:00"/>
<WebSiteContent webSiteId="WebStore" contentId="WebStoreFACTOID" webSiteContentTypeId="FACTOIDS_ROOT" fromDate="2021-01-01 00:00:00"/>
</entity-engine-xml>
5 changes: 5 additions & 0 deletions ecommerce/data/EcommerceTypeData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ under the License.
<VisualThemeResource visualThemeId="EC_DEFAULT" resourceTypeEnumId="VT_FTR_TMPLT_LOC" resourceValue="component://ecommerce/template/includes/Footer.ftl" sequenceId="07"/>
<VisualThemeResource visualThemeId="EC_DEFAULT" resourceTypeEnumId="VT_SCREENSHOT" resourceValue="/images/ecdefaulttheme.jpg" sequenceId="08"/>
</delete>

<!-- Ecommerce Factoids Content Type -->
<ContentType contentTypeId="FACTOIDS_ROOT" parentTypeId="PLACEHOLDER" hasTable="N" description="Factoids Root"/>
<WebSiteContentType webSiteContentTypeId="FACTOIDS_ROOT" description="Factoids Root" hasTable="N"/>

</entity-engine-xml>
2 changes: 1 addition & 1 deletion ecommerce/groovyScripts/content/Search.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ paramMap = UtilHttp.getParameterMap(request)
queryLine = paramMap.queryLine.toString()
//logInfo("in search, queryLine:" + queryLine)

siteId = paramMap.siteId ?: "WebStoreCONTENT"
siteId = paramMap.siteId ?: defaultSiteId
//logInfo("in search, siteId:" + siteId)
featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(paramMap)
//logInfo("in search, featureIdByType:" + featureIdByType)
Expand Down
1 change: 0 additions & 1 deletion ecommerce/template/content/ContentCategories.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<#assign contentRootId = "WebStoreCONTENT"/>

<#-- variable setup and worker calls -->
<#assign curCategoryId = requestAttributes.curCategoryId!>
Expand Down
1 change: 0 additions & 1 deletion ecommerce/template/content/Factoids.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<#assign factoidRootId = "WebStoreFACTOID"/>

<#-- variable setup and worker calls -->
<#assign curCategoryId = requestAttributes.curCategoryId!>
Expand Down
22 changes: 19 additions & 3 deletions ecommerce/widget/CommonScreens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,19 @@ under the License.

<screen name="policies">
<section>
<actions>
<!-- retrieve configured content root for web site -->
<entity-and entity-name="WebSiteContent" list="contentRoots" filter-by-date="true">
<field-map field-name="webSiteId" from-field="webSiteId"/>
<field-map field-name="webSiteContentTypeId" value="PUBLISH_POINT"/>
</entity-and>
<set field="contentRootId" from-field="contentRoots[0].contentId" default-value="WebStoreCONTENT"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<sub-content content-id="WebStoreCONTENT" map-key="policies"/>
<sub-content content-id="WebStoreCONTENT" map-key="policies2"/>
<sub-content content-id="${contentRootId}" map-key="policies"/>
<sub-content content-id="${contentRootId}" map-key="policies2"/>
</decorator-section>
</decorator-screen>
</widgets>
Expand All @@ -428,10 +436,18 @@ under the License.

<screen name="CookiePolicy">
<section>
<actions>
<!-- retrieve configured content root for web site -->
<entity-and entity-name="WebSiteContent" list="contentRoots" filter-by-date="true">
<field-map field-name="webSiteId" from-field="webSiteId"/>
<field-map field-name="webSiteContentTypeId" value="PUBLISH_POINT"/>
</entity-and>
<set field="contentRootId" from-field="contentRoots[0].contentId" default-value="WebStoreCONTENT"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<sub-content content-id="WebStoreCONTENT" map-key="cookiePolicy"/>
<sub-content content-id="${contentRootId}" map-key="cookiePolicy"/>
</decorator-section>
</decorator-screen>
</widgets>
Expand Down
27 changes: 26 additions & 1 deletion ecommerce/widget/ContentScreens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ under the License.

<screen name="content_categories">
<section>
<actions>
<!-- retrieve configured content root for web site -->
<entity-and entity-name="WebSiteContent" list="contentRoots" filter-by-date="true">
<field-map field-name="webSiteId" from-field="webSiteId"/>
<field-map field-name="webSiteContentTypeId" value="PUBLISH_POINT"/>
</entity-and>
<!-- get first valid forum root content -->
<set field="contentRootId" from-field="contentRoots[0].contentId" default-value="WebStoreCONTENT"/>
</actions>
<widgets>
<platform-specific><html><html-template location="component://ecommerce/template/content/ContentCategories.ftl"/></html></platform-specific>
</widgets>
Expand All @@ -45,6 +54,15 @@ under the License.

<screen name="factoids">
<section>
<actions>
<!-- retrieve configured factoids root for web site -->
<entity-and entity-name="WebSiteContent" list="factoidRoots" filter-by-date="true">
<field-map field-name="webSiteId" from-field="webSiteId"/>
<field-map field-name="webSiteContentTypeId" value="FACTOIDS_ROOT"/>
</entity-and>
<!-- get first valid forum root content -->
<set field="factoidRootId" from-field="factoidRoots[0].contentId" default-value="WebStoreFACTOIDS"/>
</actions>
<widgets>
<platform-specific><html><html-template location="component://ecommerce/template/content/Factoids.ftl"/></html></platform-specific>
</widgets>
Expand Down Expand Up @@ -126,7 +144,14 @@ under the License.
<set field="permissionType" value="simple"/>
<set field="queryFormName" value="searchQuery"/>
<set field="listFormName" value="searchList"/>
<set field="defaultSiteId" value="WebStoreCONTENT"/>
<!-- retrieve configured content root for web site -->
<entity-and entity-name="WebSiteContent" list="contentRoots" filter-by-date="true">
<field-map field-name="webSiteId" from-field="webSiteId"/>
<field-map field-name="webSiteContentTypeId" value="PUBLISH_POINT"/>
</entity-and>
<!-- get first valid forum root content -->
<set field="defaultSiteId" from-field="contentRoots[0].contentId" default-value="WebStoreCONTENT"/>

<script location="component://ecommerce/groovyScripts/content/AdvancedSearchPrep.groovy"/>
<script location="component://ecommerce/groovyScripts/content/Search.groovy"/>
</actions>
Expand Down
10 changes: 9 additions & 1 deletion ecommerce/widget/ForumScreens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,17 @@ under the License.
<screen name="forums">
<section>
<actions>
<!-- retrieve configured forum root for web site -->
<entity-and entity-name="WebSiteContent" list="forumRoots" filter-by-date="true">
<field-map field-name="webSiteId" from-field="webSiteId"/>
<field-map field-name="webSiteContentTypeId" value="FORUM_ROOT"/>
</entity-and>
<!-- get first valid forum root content -->
<set field="forumRootId" from-field="forumRoots[0].contentId" default-value="WebStoreFORUM"/>

<entity-condition entity-name="ContentAssocViewTo" list="forums" use-cache="true">
<condition-list combine="and">
<condition-expr field-name="contentIdStart" operator="equals" value="WebStoreFORUM"/>
<condition-expr field-name="contentIdStart" operator="equals" from-field="forumRootId"/>
<condition-list combine="or">
<condition-expr field-name="caFromDate" operator="equals" from-field="null"/>
<condition-expr field-name="caFromDate" operator="less-equals" from-field="nowTimestamp"/>
Expand Down
10 changes: 9 additions & 1 deletion ecommerce/widget/blog/BlogScreens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,17 @@
<screen name="blogs">
<section>
<actions>
<!-- retrieve configured BLOG root for web site -->
<entity-and entity-name="WebSiteContent" list="blogRoots" filter-by-date="true">
<field-map field-name="webSiteId" from-field="webSiteId"/>
<field-map field-name="webSiteContentTypeId" value="BLOG_ROOT"/>
</entity-and>
<!-- get first valid forum root content -->
<set field="blogRootId" from-field="blogRoots[0].contentId" default-value="BLOGROOT"/>

<entity-condition entity-name="ContentAssocViewTo" list="blogs" use-cache="true">
<condition-list combine="and">
<condition-expr field-name="contentIdStart" operator="equals" value="BLOGROOT"/>
<condition-expr field-name="contentIdStart" operator="equals" from-field="blogRootId"/>
<condition-expr field-name="caContentAssocTypeId" operator="equals" value="SUB_CONTENT"/>
<condition-list combine="or">
<condition-expr field-name="caFromDate" operator="equals" from-field="null"/>
Expand Down