From 3bbd2d8598ddfe1380ea956970b3fffb89eb4bfc Mon Sep 17 00:00:00 2001 From: Bruno Busco Date: Sun, 19 Sep 2010 00:09:39 +0000 Subject: [PATCH] Added the widget. OFBIZ-3625 https://issues.apache.org/jira/browse/OFBIZ-3625 Using this widget, a PortalPage can now be easily rendered in any screen. At the bottom of the page an "Edit ON/OFF" button can be used to switch the PortalPage edit mode ON and OFF so that the Portal Page can be edited "in place". All the portlet editing requests are handled using the "save-last-view" request attribute so that a dedicated screen can be shown to set the Portlet attributes and the column width and, when submitted, the user is taken back to the portal page he was editing. Those new requests will be used in a later commit to eliminate all the duplicated ****Adm requests that have been introduced when the Webtools portal admin screen has been created. A simple use of the widget has been added in the Example application. TODO: - At the moment the portal page editing is performed on the portal page itself and no portal derivation from the "main" one is performed. This will be done in a later commit. - The portlet moving controls both manually and by drag and drop have not been implemented yet. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@998570 13f79535-47bb-0310-9956-ffa450edef68 --- .../webcommon/WEB-INF/portal-controller.xml | 39 +++-- framework/common/widget/PortalPageForms.xml | 8 + framework/common/widget/PortalPageScreens.xml | 32 ++++ framework/example/config/ExampleUiLabels.xml | 4 + .../webapp/example/WEB-INF/controller.xml | 2 + .../example/widget/example/ExampleMenus.xml | 1 + .../example/widget/example/ExampleScreens.xml | 14 ++ .../widget/example/PortletEditForms.xml | 11 +- .../example/widget/example/PortletScreens.xml | 3 - framework/widget/dtd/widget-screen.xsd | 17 ++ .../org/ofbiz/widget/PortalPageWorker.java | 40 +++++ .../widget/PortalPageWorkerInterface.java | 33 ++++ .../ofbiz/widget/WidgetPortalPageWorker.java | 41 +++++ .../org/ofbiz/widget/fo/FoScreenRenderer.java | 23 +++ .../ofbiz/widget/html/HtmlScreenRenderer.java | 23 +++ .../widget/screen/MacroScreenRenderer.java | 149 ++++++++++++++++++ .../widget/screen/ModelScreenWidget.java | 129 +++++++++++++-- .../widget/screen/ScreenStringRenderer.java | 9 ++ .../ofbiz/widget/text/TextScreenRenderer.java | 22 +++ .../templates/htmlScreenMacroLibrary.ftl | 93 +++++++++++ themes/tomahawk/webapp/tomahawk/css/style.css | 15 +- 21 files changed, 667 insertions(+), 41 deletions(-) create mode 100644 framework/widget/src/org/ofbiz/widget/PortalPageWorker.java create mode 100644 framework/widget/src/org/ofbiz/widget/PortalPageWorkerInterface.java create mode 100644 framework/widget/src/org/ofbiz/widget/WidgetPortalPageWorker.java diff --git a/framework/common/webcommon/WEB-INF/portal-controller.xml b/framework/common/webcommon/WEB-INF/portal-controller.xml index 0e88e01973..4aa49755ce 100644 --- a/framework/common/webcommon/WEB-INF/portal-controller.xml +++ b/framework/common/webcommon/WEB-INF/portal-controller.xml @@ -39,6 +39,11 @@ under the License. + + + + + @@ -52,13 +57,13 @@ under the License. - + - - + + @@ -75,8 +80,8 @@ under the License. - - + + @@ -110,26 +115,26 @@ under the License. - - + + - - + + - - + + - + - - + + @@ -137,6 +142,10 @@ under the License. + + + + @@ -145,4 +154,6 @@ under the License. + + diff --git a/framework/common/widget/PortalPageForms.xml b/framework/common/widget/PortalPageForms.xml index 150121f6f6..3d55c060e0 100644 --- a/framework/common/widget/PortalPageForms.xml +++ b/framework/common/widget/PortalPageForms.xml @@ -140,4 +140,12 @@ under the License. + +
+ + + + + +
diff --git a/framework/common/widget/PortalPageScreens.xml b/framework/common/widget/PortalPageScreens.xml index fe26af1da8..31aa5b5218 100644 --- a/framework/common/widget/PortalPageScreens.xml +++ b/framework/common/widget/PortalPageScreens.xml @@ -257,4 +257,36 @@ under the License. + +
+ + + + + + + + + + + + +
+
+ +
+ + + + + + + + + + + + +
+
diff --git a/framework/example/config/ExampleUiLabels.xml b/framework/example/config/ExampleUiLabels.xml index 965c1662b4..cb94aa8952 100644 --- a/framework/example/config/ExampleUiLabels.xml +++ b/framework/example/config/ExampleUiLabels.xml @@ -525,6 +525,10 @@ Geolocation via address Géolocalisation par l'adresse + + include-portal-page widget example + Esempio widget include-portal-page + Hi, this is a first example of portlet Salve, questo è il primo esempio di portlet diff --git a/framework/example/webapp/example/WEB-INF/controller.xml b/framework/example/webapp/example/WEB-INF/controller.xml index 0b7d1c5d56..9a0a2c0a00 100644 --- a/framework/example/webapp/example/WEB-INF/controller.xml +++ b/framework/example/webapp/example/WEB-INF/controller.xml @@ -190,6 +190,7 @@ under the License.
+ @@ -250,6 +251,7 @@ under the License. + diff --git a/framework/example/widget/example/ExampleMenus.xml b/framework/example/widget/example/ExampleMenus.xml index 7b7d1cc67a..064f83ff65 100644 --- a/framework/example/widget/example/ExampleMenus.xml +++ b/framework/example/widget/example/ExampleMenus.xml @@ -24,6 +24,7 @@ under the License. + diff --git a/framework/example/widget/example/ExampleScreens.xml b/framework/example/widget/example/ExampleScreens.xml index 6e467b2b1d..f0912beb52 100644 --- a/framework/example/widget/example/ExampleScreens.xml +++ b/framework/example/widget/example/ExampleScreens.xml @@ -466,4 +466,18 @@ under the License. + +
+ + + + + + + + + + +
+
diff --git a/framework/example/widget/example/PortletEditForms.xml b/framework/example/widget/example/PortletEditForms.xml index 4d62fb2e38..01452581bd 100644 --- a/framework/example/widget/example/PortletEditForms.xml +++ b/framework/example/widget/example/PortletEditForms.xml @@ -22,7 +22,7 @@ under the License. xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
- + - - - - +
- + - + diff --git a/framework/example/widget/example/PortletScreens.xml b/framework/example/widget/example/PortletScreens.xml index e96742b4d4..14cd7123c2 100644 --- a/framework/example/widget/example/PortletScreens.xml +++ b/framework/example/widget/example/PortletScreens.xml @@ -25,8 +25,6 @@ under the License.
- - + ${addColumnLabel} PortalPageId: ${portalPageId} + + + + + + + + +<#macro renderPortalPageEnd editMode="false" editOnURL="#" editOffURL="#" editOnLabel="Edit ON" editOffLabel="Edit OFF" editOnHint="Enable portal page editing" editOffHint="Disable portal page editing"> + +
+ <#if editMode == "true"> + ${editOffLabel} + <#else> + ${editOnLabel} + + + +<#macro renderPortalPageColumnBegin originalPortalPageId portalPageId columnSeqId editMode="false" width="auto" delColumnLabel="Remove column" delColumnHint="Delete this column" addPortletLabel="Add portlet" addPortletHint="Add a new portlet to this column" setColumnSizeHint="Set column size"> + <#assign columnKey = portalPageId+columnSeqId> + <#assign columnKeyFields = ''> + + <#if editMode == "true"> + Column:${portalPageId}-${columnSeqId} +
+ +
+ + + +<#macro renderPortalPageColumnEnd> + + + +<#macro renderPortalPagePortletBegin originalPortalPageId portalPageId portalPortletId portletSeqId editMode="false" delPortletHint="Remove this portlet" editAttribute="false" editAttributeHint="Edit portlet parameters"> + <#assign portletKey = portalPageId+portalPortletId+portletSeqId> + <#assign portletKeyFields = ''> +
+ <#if editMode == "true"> +
+
+
    +
  • Portlet : [${portalPortletId}]
  • +
  • +
    + ${portletKeyFields} +
    +     +
  • + <#if editAttribute == "true"> +
  • +
    + ${portletKeyFields} +
    +     +
  • + +
+
+
+ + + +<#macro renderPortalPagePortletEnd editMode="false"> +
+ <#if editMode == "true"> +
+ + diff --git a/themes/tomahawk/webapp/tomahawk/css/style.css b/themes/tomahawk/webapp/tomahawk/css/style.css index afeb3d86ec..35c20a936d 100644 --- a/themes/tomahawk/webapp/tomahawk/css/style.css +++ b/themes/tomahawk/webapp/tomahawk/css/style.css @@ -2279,17 +2279,26 @@ color: #000000; /* == Portlet configuration screenlet == */ .portlet-config { -background-color: #D4D0C8; -border: 2px solid #D4D0C8; +background-color: #FFEC6F; +border: 2px solid #FFEC6F; margin-bottom: 5px; } .portlet-config-title-bar .title { color: #555555; -font-size: 1.2em; +background-color: #CFC05A; float: left; } +.portlet-config-title-bar select { +margin: 0; +border: none; +font-size: 10px; +height: auto; +padding: 0; +vertical-align: top; +} + .portlet-config-title-bar ul { display: inline; /* IE Fix */ }