From af2fa0115a1a7504665cb34aabd0a60a2dc4e496 Mon Sep 17 00:00:00 2001 From: Hans Bakker Date: Fri, 2 Jan 2009 03:35:41 +0000 Subject: [PATCH] major cleanup of of the portalpages, files split between display and configure, user can now create/update a copy of the system pages and revert back, example component working now....next week we will do the portal component. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@730665 13f79535-47bb-0310-9956-ffa450edef68 --- framework/common/data/PortalDemoData.xml | 10 +- framework/common/entitydef/entitymodel.xml | 19 ++- .../org/ofbiz/common/PortalPageMethods.xml | 129 ++++++++---------- .../org/ofbiz/common/PortalPageServices.xml | 83 +++-------- framework/common/servicedef/services.xml | 18 +-- .../actions/includes/ListPortalPages.groovy | 53 +++++++ .../actions/includes/ShowPortalPage.groovy | 36 +++++ .../webcommon/WEB-INF/portal-controller.xml | 41 +++--- .../common/webcommon/portal/appheader.ftl | 18 +-- .../{portalPage.ftl => editPortalPage.ftl} | 57 ++++---- .../webcommon/portal/listPortalPortlets.ftl | 4 +- .../webcommon/portal/portalPageHeader.ftl | 6 +- .../webcommon/portal/showPortalPage.ftl | 48 +++++++ framework/common/widget/PortalPageForms.xml | 43 ++---- framework/common/widget/PortalPageScreens.xml | 44 +++--- .../example/widget/example/CommonScreens.xml | 17 +-- 16 files changed, 331 insertions(+), 295 deletions(-) create mode 100644 framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy create mode 100644 framework/common/webcommon/WEB-INF/actions/includes/ShowPortalPage.groovy rename framework/common/webcommon/portal/{portalPage.ftl => editPortalPage.ftl} (62%) create mode 100644 framework/common/webcommon/portal/showPortalPage.ftl diff --git a/framework/common/data/PortalDemoData.xml b/framework/common/data/PortalDemoData.xml index 7166f86f4f..3e8a74a22a 100644 --- a/framework/common/data/PortalDemoData.xml +++ b/framework/common/data/PortalDemoData.xml @@ -20,9 +20,9 @@ under the License. - - - + + + @@ -30,6 +30,6 @@ under the License. screenName="loginPortlet" screenLocation="component://common/widget/PortletScreens.xml" editFormName="LoginPortletEdit" editFormLocation="component://common/widget/PortletEditForms.xml"/> - - + + diff --git a/framework/common/entitydef/entitymodel.xml b/framework/common/entitydef/entitymodel.xml index 399e540162..4a89276395 100644 --- a/framework/common/entitydef/entitymodel.xml +++ b/framework/common/entitydef/entitymodel.xml @@ -573,14 +573,27 @@ under the License. - + - + The system portal page this page is derived from + the parent this page is belonging to, normally the startpage of the portal page group + + + - + + + + + + + + + + diff --git a/framework/common/script/org/ofbiz/common/PortalPageMethods.xml b/framework/common/script/org/ofbiz/common/PortalPageMethods.xml index 02808918ab..8dfcd6c267 100644 --- a/framework/common/script/org/ofbiz/common/PortalPageMethods.xml +++ b/framework/common/script/org/ofbiz/common/PortalPageMethods.xml @@ -22,25 +22,25 @@ under the License. xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd"> - - - - + + + + - - - + + + - + - + @@ -51,16 +51,16 @@ under the License. - - + + - - + + - + @@ -72,69 +72,52 @@ under the License. - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - + - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/common/script/org/ofbiz/common/PortalPageServices.xml b/framework/common/script/org/ofbiz/common/PortalPageServices.xml index ba0cc038c8..c5306891ec 100644 --- a/framework/common/script/org/ofbiz/common/PortalPageServices.xml +++ b/framework/common/script/org/ofbiz/common/PortalPageServices.xml @@ -41,7 +41,9 @@ under the License. - + + + @@ -107,78 +109,29 @@ under the License. - - + + + + - - - + - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/framework/common/servicedef/services.xml b/framework/common/servicedef/services.xml index 4162f77364..cc6a1b267c 100644 --- a/framework/common/servicedef/services.xml +++ b/framework/common/servicedef/services.xml @@ -607,19 +607,18 @@ under the License. Create a new Portal Page - + Update a Portal Page - + - Delete a Portal Page + Delete a Portal Page, related colums and used portlets - @@ -628,7 +627,7 @@ under the License. Add a new Column to a PortalPage - + Update a Portal Page Column @@ -655,13 +654,4 @@ under the License. - - - - GetListPreferences - - - - diff --git a/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy b/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy new file mode 100644 index 0000000000..edae802618 --- /dev/null +++ b/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy @@ -0,0 +1,53 @@ +/* + * 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.ofbiz.entity.*; +import org.ofbiz.base.util.*; +import org.ofbiz.entity.condition.*; + +ppCond = + EntityCondition.makeCondition([ + EntityCondition.makeCondition([ + EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, parameters.parentPortalPageId), + EntityCondition.makeCondition("portalPageId", EntityOperator.EQUALS, parameters.parentPortalPageId), + EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, parameters.parentPortalPageId) + ],EntityOperator.OR), + EntityCondition.makeCondition([ + EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, parameters.userLogin.userLoginId), + EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, "_NA_") + ],EntityOperator.OR), + ],EntityOperator.AND); +sortField = parameters.sortField; +if (UtilValidate.isEmpty(sortField)) { + sortField = "portalPageName"; +} +orderBy = [sortField]; +portalPages = delegator.findList("PortalPage", ppCond, null, orderBy, null, false); +// remove overridden system pages +portalPages.each { portalPage -> + if (portalPage.ownerUserLoginId.equals("_NA_")) { + userPortalPages = delegator.findByAnd("PortalPage", [originalPortalPageId : portalPage.portalPageId, ownerUserLoginId : parameters.userLogin.userLoginId]); + if (userPortalPages) { + portalPages.remove(portalPage); + } + } +} + +context.portalPages = portalPages; + diff --git a/framework/common/webcommon/WEB-INF/actions/includes/ShowPortalPage.groovy b/framework/common/webcommon/WEB-INF/actions/includes/ShowPortalPage.groovy new file mode 100644 index 0000000000..39588a158c --- /dev/null +++ b/framework/common/webcommon/WEB-INF/actions/includes/ShowPortalPage.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.ofbiz.entity.*; +import org.ofbiz.base.util.*; +import org.ofbiz.entity.condition.*; + +portalPage = delegator.findByPrimaryKey("PortalPage", [portalPageId : parameters.portalPageId]); +// check if the user created a private page for a system page +if (portalPage.ownerUserLoginId.equals("_NA_")) { + portalPages = delegator.findByAnd("PortalPage", [originalPortalPageId : parameters.portalPageId, ownerUserLoginId : parameters.userLogin.userLoginId]); + if (UtilValidate.isNotEmpty(portalPages)) { + portalPage = portalPages.get(0); + } +} +parameters.portalPageId = portalPage.portalPageId; +context.portalPage = portalPage; +context.portalPageColumns = portalPage.getRelated("PortalPageColumn"); +context.portalPagePortlets = delegator.findByAnd("PortalPagePortletView", [portalPageId : portalPage.portalPageId]); + diff --git a/framework/common/webcommon/WEB-INF/portal-controller.xml b/framework/common/webcommon/WEB-INF/portal-controller.xml index 03d7528ac2..7adb6a87d6 100644 --- a/framework/common/webcommon/WEB-INF/portal-controller.xml +++ b/framework/common/webcommon/WEB-INF/portal-controller.xml @@ -24,10 +24,14 @@ under the License. Copyright 2001-2008 The Apache Software Foundation - + - - + + + + + + @@ -45,26 +49,26 @@ under the License. - - + + - - + + - - + + - - + + @@ -93,24 +97,25 @@ under the License. - - + + - - + + - - + + - + + diff --git a/framework/common/webcommon/portal/appheader.ftl b/framework/common/webcommon/portal/appheader.ftl index 0f3e15000e..15fa79a7cc 100644 --- a/framework/common/webcommon/portal/appheader.ftl +++ b/framework/common/webcommon/portal/appheader.ftl @@ -26,23 +26,13 @@ under the License.
  • class="selected">${uiLabelMap.ExampleFeature}
  • class="selected">${uiLabelMap.ExampleFormWidgetExamples}
  • class="selected">${uiLabelMap.ExampleAjaxExamples}
  • - <#if getMainPage?has_content> - <#list getMainPage as page> - class="selected">${page.portalName} - - <#else> - <#list getNA as page> - class="selected">${page.portalName} - - - <#if pages?has_content> - <#list pages as page> - class="selected">${page.portalName} + <#if portalPages?has_content> + <#list portalPages as page> + class="selected">${page.portalPageName}
  • ${uiLabelMap.CommonLogout}
  • - <#--li class="opposed">${uiLabelMap.CommonHelp}--> -
  • ${uiLabelMap.CommonDashboard}
  • +
  • ${uiLabelMap.CommonDashboard}
  • <#else>
  • ${uiLabelMap.CommonLogin}
  • diff --git a/framework/common/webcommon/portal/portalPage.ftl b/framework/common/webcommon/portal/editPortalPage.ftl similarity index 62% rename from framework/common/webcommon/portal/portalPage.ftl rename to framework/common/webcommon/portal/editPortalPage.ftl index 12a24ff2ce..5f0998f47a 100644 --- a/framework/common/webcommon/portal/portalPage.ftl +++ b/framework/common/webcommon/portal/editPortalPage.ftl @@ -16,43 +16,43 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - -<#if currentPortalPage?has_content> - <#if configurePortalPage?has_content> -
    +<#if portalPage?has_content> +
    +
    +
    +

    -
    - +
    - <#if configurePortalPage?has_content> <#list portalPageColumnList?if_exists as portalPageColumn> - <#list portalPageColumnList?if_exists as portalPageColumn>
    • - ${uiLabelMap.CommonDelete} + ${uiLabelMap.CommonDelete}
    • - ${uiLabelMap.CommonAddAPortlet} + ${uiLabelMap.CommonAddAPortlet}
    @@ -62,7 +62,6 @@ under the License.
    @@ -70,8 +69,7 @@ under the License. <#list portalPagePortletViewList as portlet> <#if (!portlet.columnSeqId?has_content && portalPageColumn_index == 0) || (portlet.columnSeqId?if_exists == portalPageColumn.columnSeqId)> <#if portlet.screenName?has_content> - <#if configurePortalPage?has_content> - <#assign portletUrlLink = "portalPageId="+currentPortalPage.portalPageId+"&portalPortletId="+portlet.portalPortletId+"&portletSeqId="+portlet.portletSeqId+"&configurePortalPage=true&originalPortalPageId="+parameters.originalPortalPageId+"&mainPortalPageId="+parameters.mainPortalPageId/> + <#assign portletUrlLink = "portalPageId="+portalPage.portalPageId+"&portalPortletId="+portlet.portalPortletId+"&portletSeqId="+portlet.portletSeqId+"&parentPortalPageId="+parentPortalPageId/>
    @@ -107,8 +105,8 @@ under the License. <#list portalPages as portalPage> - <#if (currentPortalPage.portalName != portalPage.portalName)> - + <#if (portalPage.portalPageName != portalPage.portalPageName)> + @@ -118,21 +116,18 @@ under the License.
    - <#assign screenFileName = portlet.screenLocation + "#" + portlet.screenName/>
    - ${setRequestAttribute("portalPageId", currentPortalPage.portalPageId)} + ${setRequestAttribute("portalPageId", portalPage.portalPageId)} ${setRequestAttribute("portalPortletId", portlet.portalPortletId)} ${setRequestAttribute("portletSeqId", portlet.portletSeqId)} ${screens.render(screenFileName)}
    - <#if configurePortalPage?has_content>
    - <#assign firstInColumn = false/> diff --git a/framework/common/webcommon/portal/listPortalPortlets.ftl b/framework/common/webcommon/portal/listPortalPortlets.ftl index f3152f3ba4..00078f7a30 100644 --- a/framework/common/webcommon/portal/listPortalPortlets.ftl +++ b/framework/common/webcommon/portal/listPortalPortlets.ftl @@ -27,7 +27,7 @@ margin: 1em; @@ -45,7 +45,7 @@ margin: 1em;
    ${portalPortlet.description} diff --git a/framework/common/webcommon/portal/portalPageHeader.ftl b/framework/common/webcommon/portal/portalPageHeader.ftl index 304527b0e0..b2ebe4b075 100644 --- a/framework/common/webcommon/portal/portalPageHeader.ftl +++ b/framework/common/webcommon/portal/portalPageHeader.ftl @@ -19,9 +19,9 @@ under the License.
      - <#if currentPortalPage.portalName?has_content> + <#if currentPortalPage.portalPageName?has_content>
    • - ${currentPortalPage.portalName} + ${currentPortalPage.portalPageName}
    • @@ -31,7 +31,7 @@ under the License. <#list portalPages as portalPage> <#if (currentPortalPage.portalPageId != portalPage.portalPageId)> - + diff --git a/framework/common/webcommon/portal/showPortalPage.ftl b/framework/common/webcommon/portal/showPortalPage.ftl new file mode 100644 index 0000000000..286c54d090 --- /dev/null +++ b/framework/common/webcommon/portal/showPortalPage.ftl @@ -0,0 +1,48 @@ +<#-- +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. +--> + +<#if portalPage?has_content> + + + <#list portalPageColumns?if_exists as portalPageColumn> + + + + +
      + <#assign firstInColumn = true/> + <#list portalPagePortlets as portlet> + <#if (!portlet.columnSeqId?has_content && portalPageColumn_index == 0) || (portlet.columnSeqId?if_exists == portalPageColumn.columnSeqId)> + <#if portlet.screenName?has_content> + <#assign screenFileName = portlet.screenLocation + "#" + portlet.screenName/> +
      + ${setRequestAttribute("portalPageId", portalPage.portalPageId)} + ${setRequestAttribute("portalPortletId", portlet.portalPortletId)} + ${setRequestAttribute("portletSeqId", portlet.portletSeqId)} + ${screens.render(screenFileName)} +
      + + <#assign firstInColumn = false/> + + + <#if portalPageColumn_has_next> +
       
      +<#else/> +

      No portal page data found. You may not have the necessary seed or other data for it.

      + \ No newline at end of file diff --git a/framework/common/widget/PortalPageForms.xml b/framework/common/widget/PortalPageForms.xml index 5f4a517e53..6a7d6ef6c7 100644 --- a/framework/common/widget/PortalPageForms.xml +++ b/framework/common/widget/PortalPageForms.xml @@ -21,20 +21,16 @@ under the License. -
      - - - - - +