Author: buscob
Date: Sun Sep 19 00:09:39 2010 New Revision: 998570 URL: http://svn.apache.org/viewvc?rev=998570&view=rev Log: Added the <include-portal-page> 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. Added: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorkerInterface.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetPortalPageWorker.java Modified: ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml ofbiz/trunk/framework/common/widget/PortalPageForms.xml ofbiz/trunk/framework/common/widget/PortalPageScreens.xml ofbiz/trunk/framework/example/config/ExampleUiLabels.xml ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml ofbiz/trunk/framework/example/widget/example/PortletEditForms.xml ofbiz/trunk/framework/example/widget/example/PortletScreens.xml ofbiz/trunk/framework/widget/dtd/widget-screen.xsd ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextScreenRenderer.java ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl ofbiz/trunk/themes/tomahawk/webapp/tomahawk/css/style.css Modified: ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml (original) +++ ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml Sun Sep 19 00:09:39 2010 @@ -39,6 +39,11 @@ under the License. <security https="true" auth="true"/> <response name="success" type="view" value="showPortletSimpleDecorator"/> </request-map> + <!-- Portlet editing requests --> + <request-map uri="editPortalPortletAttributes"> + <security https="true" auth="true"/> + <response name="success" type="view" value="editPortalPortletAttributes" save-last-view="true"/> + </request-map> <!-- Portal page show requests --> <request-map uri="showPortalPage"> <security https="true" auth="true"/> @@ -52,13 +57,13 @@ under the License. </request-map> <request-map uri="AddPortlet"> <security https="true" auth="true"/> - <response name="success" type="view" value="AddPortlet"/> + <response name="success" type="view" value="AddPortlet" save-last-view="true"/> </request-map> <request-map uri="createPortalPagePortlet"> <security https="true" auth="true"/> <event type="service" invoke="createPortalPagePortlet"/> - <response name="success" type="request" value="ManagePortalPages"/> - <response name="error" type="request" value="ManagePortalPages"/> + <response name="success" type="view-last" value="main"/> + <response name="error" type="request" value="main"/> </request-map> <request-map uri="updatePortalPagePortlet"> <security https="true" auth="true"/> @@ -75,8 +80,8 @@ under the License. <request-map uri="deletePortalPagePortlet"> <security https="true" auth="true"/> <event type="service" invoke="deletePortalPagePortlet"/> - <response name="success" type="request" value="ManagePortalPages"/> - <response name="error" type="request" value="ManagePortalPages"/> + <response name="success" type="view-last" value="main"/> + <response name="error" type="request" value="main"/> </request-map> <request-map uri="movePortletToPortalPage"> <security https="true" auth="true"/> @@ -110,26 +115,26 @@ under the License. <request-map uri="setPortalPortletAttributes"> <security https="true" auth="true"/> <event type="simple" invoke="setPortalPortletAttributes" path="component://common/script/org/ofbiz/common/PortalPageMethods.xml"/> - <response name="success" type="request" value="ManagePortalPages"/> - <response name="error" type="request" value="ManagePortalPages"/> + <response name="success" type="view-last" value="main"/> + <response name="error" type="request" value="main"/> </request-map> <request-map uri="addPortalPageColumn"> <security https="true" auth="true"/> <event type="service" invoke="addPortalPageColumn"/> - <response name="success" type="request" value="ManagePortalPages"/> - <response name="error" type="request" value="ManagePortalPages"/> + <response name="success" type="view-last" value="main"/> + <response name="error" type="request" value="main"/> </request-map> <request-map uri="updatePortalPageColumn"> <security https="true" auth="true"/> <event type="service" invoke="updatePortalPageColumn"/> - <response name="success" type="request" value="ManagePortalPages"/> - <response name="error" type="request" value="ManagePortalPages"/> + <response name="success" type="view-last" value="main"/> + <response name="error" type="request" value="main"/> </request-map> <request-map uri="deletePortalPageColumn"> - <security https="true" auth="true"/> + <security https="true" auth="false"/> <event type="service" invoke="deletePortalPageColumn"/> - <response name="success" type="request" value="ManagePortalPages"/> - <response name="error" type="request" value="ManagePortalPages"/> + <response name="success" type="view-last" value="main"/> + <response name="error" type="request" value="main"/> </request-map> <request-map uri="updatePortalPageSeq"> <security https="true" auth="true"/> @@ -137,6 +142,10 @@ under the License. <response name="success" type="request" value="ManagePortalPages"/> <response name="error" type="request" value="ManagePortalPages"/> </request-map> + <request-map uri="editPortalPageColumnWidth"> + <security https="true" auth="false"/> + <response name="success" type="view" value="editPortalPageColumnWidth" save-last-view="true"/> + </request-map> <!-- View Mappings --> <view-map name="showPortalPage" type="screen" page="component://common/widget/PortalPageScreens.xml#showPortalPage"/> <view-map name="showPortlet" type="screen" page="component://common/widget/PortalPageScreens.xml#showPortlet"/> @@ -145,4 +154,6 @@ under the License. <view-map name="showPortletSimpleDecorator" type="screen" page="component://common/widget/PortalPageScreens.xml#showPortletSimpleDecorator"/> <view-map name="ManagePortalPages" type="screen" page="component://common/widget/PortalPageScreens.xml#ManagePortalPages"/> <view-map name="AddPortlet" type="screen" page="component://common/widget/PortalPageScreens.xml#AddPortlet"/> + <view-map name="editPortalPortletAttributes" type="screen" page="component://common/widget/PortalPageScreens.xml#EditPortalPortletAttributes"/> + <view-map name="editPortalPageColumnWidth" type="screen" page="component://common/widget/PortalPageScreens.xml#EditPortalPageColumnWidth"/> </site-conf> Modified: ofbiz/trunk/framework/common/widget/PortalPageForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/PortalPageForms.xml?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/common/widget/PortalPageForms.xml (original) +++ ofbiz/trunk/framework/common/widget/PortalPageForms.xml Sun Sep 19 00:09:39 2010 @@ -140,4 +140,12 @@ under the License. <hyperlink target="javascript:ajaxUpdateArea('List${entity}Area', 'list${entity}', $(FindGenericEntity).serialize());" target-type="plain" description="${uiLabelMap.CommonSearch}"/> </field> </form> + + <form name="EditPortalPageColumnWidth" type="single" target="updatePortalPageColumn" default-map-name="portalPageColumn"> + <field name="portalPageId"><hidden/></field> + <field name="columnSeqId"><hidden/></field> + <field name="columnWidthPixels"><text/></field> + <field name="columnWidthPercentage"><text/></field> + <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field> + </form> </forms> Modified: ofbiz/trunk/framework/common/widget/PortalPageScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/PortalPageScreens.xml?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/common/widget/PortalPageScreens.xml (original) +++ ofbiz/trunk/framework/common/widget/PortalPageScreens.xml Sun Sep 19 00:09:39 2010 @@ -257,4 +257,36 @@ under the License. </widgets> </section> </screen> + <screen name="EditPortalPortletAttributes"> + <section> + <actions> + <entity-one entity-name="PortalPortlet" value-field="portalPortlet"/> + </actions> + <widgets> + <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="body"> + <screenlet title="${uiLabelMap.CommonEditPortletAttributes}: ${portalPortlet.portletName}"> + <include-form name="${portalPortlet.editFormName}" location="${portalPortlet.editFormLocation}"/> + </screenlet> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> + <screen name="EditPortalPageColumnWidth"> + <section> + <actions> + <entity-one entity-name="PortalPageColumn" value-field="portalPageColumn"/> + </actions> + <widgets> + <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="body"> + <screenlet title="Set column width: ${portalPortlet.portletName}"> + <include-form name="EditPortalPageColumnWidth" location="component://common/widget/PortalPageForms.xml"/> + </screenlet> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> </screens> Modified: ofbiz/trunk/framework/example/config/ExampleUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/config/ExampleUiLabels.xml?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/example/config/ExampleUiLabels.xml (original) +++ ofbiz/trunk/framework/example/config/ExampleUiLabels.xml Sun Sep 19 00:09:39 2010 @@ -525,6 +525,10 @@ <value xml:lang="en">Geolocation via address</value> <value xml:lang="fr">Géolocalisation par l'adresse</value> </property> + <property key="ExamplePortalPageWidgetExamples"> + <value xml:lang="en">include-portal-page widget example</value> + <value xml:lang="it">Esempio widget include-portal-page</value> + </property> <property key="ExamplePortletFirst"> <value xml:lang="en">Hi, this is a first example of portlet</value> <value xml:lang="it">Salve, questo è il primo esempio di portlet</value> Modified: ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml (original) +++ ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml Sun Sep 19 00:09:39 2010 @@ -190,6 +190,7 @@ under the License. </request-map> <request-map uri="FormWidgetExamples"><security https="true" auth="true"/><response name="success" type="view" value="FormWidgetExamples"/></request-map> + <request-map uri="PortalPageWidgetExamples"><security https="true" auth="true"/><response name="success" type="view" value="PortalPageWidgetExamples"/></request-map> <request-map uri="LookupExampleFeature"><security https="true" auth="true"/><response name="success" type="view" value="LookupExampleFeature"/></request-map> <request-map uri="LookupPartyName"><security https="true" auth="true"/><response name="success" type="view" value="LookupPartyName"/></request-map> @@ -250,6 +251,7 @@ under the License. <view-map name="EditExampleFeatureExampleAppls" type="screen" page="component://example/widget/example/ExampleFeatureScreens.xml#EditExampleFeatureExampleAppls"/> <view-map name="FormWidgetExamples" type="screen" page="component://example/widget/example/FormWidgetExampleScreens.xml#FormWidgetExamples"/> + <view-map name="PortalPageWidgetExamples" type="screen" page="component://example/widget/example/ExampleScreens.xml#PortalPageWidgetExampleScreen"/> <view-map name="LookupExampleFeature" type="screen" page="component://example/widget/example/ExampleFeatureScreens.xml#LookupExampleFeature"/> <view-map name="LookupPartyName" type="screen" page="component://example/widget/example/FormWidgetExampleLookupScreens.xml#LookupPartyName"/> Modified: ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml (original) +++ ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml Sun Sep 19 00:09:39 2010 @@ -24,6 +24,7 @@ under the License. <menu-item name="ExampleMenuItem" title="${uiLabelMap.ExampleExample}"><link target="FindExample"/></menu-item> <menu-item name="ExampleFeature" title="${uiLabelMap.ExampleFeature}"><link target="FindExampleFeature"/></menu-item> <menu-item name="FormWidgetExamples" title="${uiLabelMap.ExampleFormWidgetExamples}"><link target="FormWidgetExamples"/></menu-item> + <menu-item name="PortalPageWidgetExamples" title="${uiLabelMap.ExamplePortalPageWidgetExamples}"><link target="PortalPageWidgetExamples"/></menu-item> <menu-item name="AjaxExample" title="${uiLabelMap.ExampleAjaxExamples}"><link target="authview/findExampleAjax"/></menu-item> <menu-item name="portalPage" parent-portal-page-value="${parameters.parentPortalPageId}"/> <menu-item name="Dashboard" title="${uiLabelMap.ExampleDashboard}" align-style="opposed"> Modified: ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml (original) +++ ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml Sun Sep 19 00:09:39 2010 @@ -466,4 +466,18 @@ under the License. </widgets> </section> </screen> + <screen name="PortalPageWidgetExampleScreen"> + <section> + <actions> + <set field="tabButtonItem" value="PortalPageWidgetExamples"/> + </actions> + <widgets> + <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="body"> + <include-portal-page id="PartyProfile" edit-mode="${parameters.editmode}"/> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> </screens> Modified: ofbiz/trunk/framework/example/widget/example/PortletEditForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/PortletEditForms.xml?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/PortletEditForms.xml (original) +++ ofbiz/trunk/framework/example/widget/example/PortletEditForms.xml Sun Sep 19 00:09:39 2010 @@ -22,7 +22,7 @@ under the License. xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd"> <form name="ExamplePortlet1Edit" extends="CommonPortletEdit" extends-resource="component://common/widget/PortletEditForms.xml"> - <field name="ItemsToShow" entry-name="attributeMap.ItemsToShow"> + <field name="ItemsToShow"> <drop-down allow-empty="false"> <option key="5"/> <option key="15"/> @@ -32,20 +32,17 @@ under the License. <option key="35"/> </drop-down> </field> - <field name="SpecificTitle" entry-name="attributeMap.SpecificTitle"> - <text/> - </field> - <field name="Nuovo" entry-name="attributeMap.Nuovo"> + <field name="SpecificTitle"> <text/> </field> <field name="updateButton"><submit/></field> </form> <form name="ExamplePortlet3Edit" extends="CommonPortletEdit" extends-resource="component://common/widget/PortletEditForms.xml"> - <field name="SpecificTitle" entry-name="attributeMap.SpecificTitle"> + <field name="SpecificTitle"> <text/> </field> - <field name="SpecificSubTitle" entry-name="attributeMap.SpecificSubTitle"> + <field name="SpecificSubTitle"> <text/> </field> <field name="updateButton"><submit/></field> Modified: ofbiz/trunk/framework/example/widget/example/PortletScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/PortletScreens.xml?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/PortletScreens.xml (original) +++ ofbiz/trunk/framework/example/widget/example/PortletScreens.xml Sun Sep 19 00:09:39 2010 @@ -25,8 +25,6 @@ under the License. <section> <actions> <property-map resource="ExampleUiLabels" map-name="uiLabelMap" global="true"/> - <!-- TODO: figure out why this isn't getting the request object and requestAttributes is not updated either: <script location="component://common/script/org/ofbiz/common/PortalPageMethods.xml#getPortletAttributes"/>--> - <script location="component://common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy"/> </actions> <widgets> <label text="${uiLabelMap.ExamplePortletFirst}"/> @@ -50,7 +48,6 @@ under the License. <section> <actions> <property-map resource="ExampleUiLabels" map-name="uiLabelMap" global="true"/> - <script location="component://common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy"/> </actions> <widgets> <container style="leftclear"> Modified: ofbiz/trunk/framework/widget/dtd/widget-screen.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-screen.xsd?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-screen.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-screen.xsd Sun Sep 19 00:09:39 2010 @@ -1088,6 +1088,23 @@ under the License. </xs:simpleType> </xs:attribute> </xs:attributeGroup> + <xs:element name="include-portal-page" substitutionGroup="AllWidgets"> + <xs:complexType> + <xs:attributeGroup ref="attlist.include-portal-page"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist.include-portal-page"> + <xs:attribute type="xs:string" name="id"/> + <xs:attribute name="edit-mode" default="false"> + <xs:annotation><xs:documentation>Show the portal in edit mode.</xs:documentation></xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="true"/> + <xs:enumeration value="false"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:attributeGroup> <xs:element name="sub-content" substitutionGroup="AllWidgets"> <xs:complexType> Added: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java?rev=998570&view=auto ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java (added) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java Sun Sep 19 00:09:39 2010 @@ -0,0 +1,40 @@ +/******************************************************************************* + * 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. + *******************************************************************************/ +package org.ofbiz.widget; + +import java.io.IOException; +import java.util.Map; +import org.ofbiz.base.util.GeneralException; +import org.ofbiz.entity.Delegator; + +/** + * PortalPageWorker Class + */ +public class PortalPageWorker implements org.ofbiz.widget.PortalPageWorkerInterface { + + public static final String module = PortalPageWorker.class.getName(); + + public PortalPageWorker() { } + + public String renderPortalPageAsTextExt(Delegator delegator, String portalPageId, Map<String, Object> templateContext, + boolean cache) throws GeneralException, IOException { + return "success"; + } + +} Added: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorkerInterface.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorkerInterface.java?rev=998570&view=auto ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorkerInterface.java (added) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorkerInterface.java Sun Sep 19 00:09:39 2010 @@ -0,0 +1,33 @@ +/******************************************************************************* + * 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. + *******************************************************************************/ +package org.ofbiz.widget; + +import java.io.IOException; +import java.util.Map; + +import org.ofbiz.base.util.GeneralException; +import org.ofbiz.entity.Delegator; + +/** + * PortalPageWorkerInterface + */ +public interface PortalPageWorkerInterface { + public String renderPortalPageAsTextExt(Delegator delegator, String portalPageId, Map<String, Object> templateContext, + boolean cache) throws GeneralException, IOException; +} Added: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetPortalPageWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetPortalPageWorker.java?rev=998570&view=auto ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetPortalPageWorker.java (added) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetPortalPageWorker.java Sun Sep 19 00:09:39 2010 @@ -0,0 +1,41 @@ +/******************************************************************************* + * 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. + *******************************************************************************/ +package org.ofbiz.widget; +import org.ofbiz.base.util.Debug; + +/** + * PortalPageWorker Class + */ +public class WidgetPortalPageWorker { + public static final String module = WidgetPortalPageWorker.class.getName(); + public static PortalPageWorkerInterface portalPageWorker = null; + static { + try { + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + // note: loadClass is necessary for these since this class doesn't know anything about them at compile time + portalPageWorker = (PortalPageWorkerInterface) loader.loadClass("org.ofbiz.widget.PortalPageWorker").newInstance(); + } catch (ClassNotFoundException e) { + Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module); + } catch (IllegalAccessException e) { + Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module); + } catch (InstantiationException e) { + Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module); + } + } +} Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java Sun Sep 19 00:09:39 2010 @@ -28,6 +28,7 @@ import org.ofbiz.widget.ModelWidget; import org.ofbiz.widget.html.HtmlWidgetRenderer; import org.ofbiz.widget.screen.ModelScreenWidget; import org.ofbiz.widget.screen.ScreenStringRenderer; +import org.ofbiz.entity.GenericValue; /** * Widget Library - HTML Form Renderer implementation @@ -162,4 +163,26 @@ public class FoScreenRenderer extends Ht public void renderScreenletEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Screenlet screenlet) throws IOException { // TODO: not implemented } + + public void renderPortalPageBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPageEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPageColumnBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPageColumn) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPageColumnEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPageColumn) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPagePortletBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPagePortletEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPagePortletBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException { + // TODO: not implemented + } } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java Sun Sep 19 00:09:39 2010 @@ -39,6 +39,7 @@ import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericValue; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.webapp.control.RequestHandler; import org.ofbiz.webapp.taglib.ContentUrlTag; @@ -880,4 +881,26 @@ public class HtmlScreenRenderer extends appendWhitespace(writer); } } + + public void renderPortalPageBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPageEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPageColumnBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPageColumn) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPageColumnEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPageColumn) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPagePortletBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPagePortletEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPagePortletBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException { + // TODO: not implemented + } } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Sun Sep 19 00:09:39 2010 @@ -44,6 +44,7 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.template.FreeMarkerWorker; import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericValue; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.webapp.control.RequestHandler; import org.ofbiz.webapp.taglib.ContentUrlTag; @@ -58,10 +59,13 @@ import org.ofbiz.widget.html.HtmlScreenR import org.ofbiz.widget.menu.MenuStringRenderer; import org.ofbiz.widget.screen.ModelScreenWidget; import org.ofbiz.widget.screen.ScreenStringRenderer; +import org.ofbiz.widget.WidgetPortalPageWorker; import freemarker.core.Environment; import freemarker.template.Template; import freemarker.template.TemplateException; +import org.xml.sax.SAXException; +import javax.xml.parsers.ParserConfigurationException; public class MacroScreenRenderer implements ScreenStringRenderer { @@ -776,4 +780,149 @@ public class MacroScreenRenderer impleme executeMacro(writer, "renderScreenletPaginateMenu", parameters); } + public void renderPortalPageBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage) throws GeneralException, IOException { + String portalPageId = portalPage.getId(context); + String originalPortalPageId = portalPage.getOriginalPortalPageId(); + String editMode = portalPage.getEditMode(context); + + StringWriter sr = new StringWriter(); + sr.append("<@renderPortalPageBegin "); + sr.append("originalPortalPageId=\""); + sr.append(originalPortalPageId); + sr.append("\" portalPageId=\""); + sr.append(portalPageId); + sr.append("\" editMode=\""); + sr.append(editMode); + sr.append("\" />"); + executeMacro(writer, sr.toString()); + } + + public void renderPortalPageEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage) throws GeneralException, IOException { + String editMode = portalPage.getEditMode(context); + HttpServletRequest request = (HttpServletRequest) context.get("request"); + + String actualRequest = request.getRequestURL().toString(); + if (actualRequest.indexOf("?") < 0) { + actualRequest += "?"; + } else if (!actualRequest.endsWith("?")) { + actualRequest += "&"; + } + String editOnURL = actualRequest+"editmode=true"; + String editOffURL = actualRequest+"editmode=false"; + + StringWriter sr = new StringWriter(); + sr.append("<@renderPortalPageEnd "); + sr.append("editMode=\""); + sr.append(editMode); + sr.append("\" editOnURL=\""); + sr.append(editOnURL); + sr.append("\" editOffURL=\""); + sr.append(editOffURL); + sr.append("\" />"); + executeMacro(writer, sr.toString()); + } + + public void renderPortalPageColumnBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPageColumn) throws GeneralException, IOException { + String portalPageId = portalPage.getId(context); + String originalPortalPageId = portalPage.getOriginalPortalPageId(); + String columnSeqId = portalPageColumn.getString("columnSeqId"); + String columnWidthPercentage = portalPageColumn.getString("columnWidthPercentage"); + String columnWidthPixels = portalPageColumn.getString("columnWidthPixels"); + String editMode = portalPage.getEditMode(context); + + StringWriter sr = new StringWriter(); + sr.append("<@renderPortalPageColumnBegin "); + sr.append("originalPortalPageId=\""); + sr.append(originalPortalPageId); + sr.append("\" portalPageId=\""); + sr.append(portalPageId); + sr.append("\" columnSeqId=\""); + sr.append(columnSeqId); + sr.append("\" "); + if (UtilValidate.isNotEmpty(columnWidthPixels)) { + sr.append("width=\""); + sr.append(columnWidthPixels); + sr.append("px\""); + } else if (UtilValidate.isNotEmpty(columnWidthPercentage)) { + sr.append("width=\""); + sr.append(columnWidthPercentage); + sr.append("%\""); + } + sr.append(" editMode=\""); + sr.append(editMode); + sr.append("\" />"); + executeMacro(writer, sr.toString()); + } + + public void renderPortalPageColumnEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPageColumn) throws GeneralException, IOException { + StringWriter sr = new StringWriter(); + sr.append("<@renderPortalPageColumnEnd/>"); + executeMacro(writer, sr.toString()); + } + + public void renderPortalPagePortletBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException { + String portalPageId = portalPage.getId(context); + String originalPortalPageId = portalPage.getOriginalPortalPageId(); + String portalPortletId = portalPortlet.getString("portalPortletId"); + String portletSeqId = portalPortlet.getString("portletSeqId"); + String editMode = portalPage.getEditMode(context); + String editFormName = portalPortlet.getString("editFormName"); + String editFormLocation = portalPortlet.getString("editFormLocation"); + + StringWriter sr = new StringWriter(); + sr.append("<@renderPortalPagePortletBegin "); + sr.append("originalPortalPageId=\""); + sr.append(originalPortalPageId); + sr.append("\" portalPageId=\""); + sr.append(portalPageId); + sr.append("\" portalPortletId=\""); + sr.append(portalPortletId); + sr.append("\" portletSeqId=\""); + sr.append(portletSeqId); + sr.append("\" editMode=\""); + sr.append(editMode); + sr.append("\""); + if (UtilValidate.isNotEmpty(editFormName) && UtilValidate.isNotEmpty(editFormLocation)) { + sr.append(" editAttribute=\"true\""); + } + sr.append("/>"); + executeMacro(writer, sr.toString()); + } + + public void renderPortalPagePortletEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException { + String editMode = portalPage.getEditMode(context); + + StringWriter sr = new StringWriter(); + sr.append("<@renderPortalPagePortletEnd "); + sr.append(" editMode=\""); + sr.append(editMode); + sr.append("\" />"); + executeMacro(writer, sr.toString()); + } + + public void renderPortalPagePortletBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException { + String portalPortletId = portalPortlet.getString("portalPortletId"); + String screenName = portalPortlet.getString("screenName"); + String screenLocation = portalPortlet.getString("screenLocation"); + + ModelScreen modelScreen = null; + if (UtilValidate.isNotEmpty(screenName) && UtilValidate.isNotEmpty(screenLocation)) { + try { + modelScreen = ScreenFactory.getScreenFromLocation(screenLocation, screenName); + } catch (IOException e) { + String errMsg = "Error rendering portlet ID [" + portalPortletId + "]: " + e.toString(); + Debug.logError(e, errMsg, module); + throw new RuntimeException(errMsg); + } catch (SAXException e) { + String errMsg = "Error rendering portlet ID [" + portalPortletId + "]: " + e.toString(); + Debug.logError(e, errMsg, module); + throw new RuntimeException(errMsg); + } catch (ParserConfigurationException e) { + String errMsg = "Error rendering portlet ID [" + portalPortletId + "]: " + e.toString(); + Debug.logError(e, errMsg, module); + throw new RuntimeException(errMsg); + } + } + modelScreen.renderScreenString(writer, context, this); + } } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Sun Sep 19 00:09:39 2010 @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.ListIterator; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -61,6 +62,7 @@ import org.ofbiz.widget.tree.TreeFactory import org.ofbiz.widget.tree.TreeStringRenderer; import org.w3c.dom.Element; import org.xml.sax.SAXException; +import org.ofbiz.entity.condition.*; /** @@ -1579,18 +1581,117 @@ public abstract class ModelScreenWidget return "<image id=\"" + this.idExdr.getOriginal() + "\" style=\"" + this.styleExdr.getOriginal() + "\" src=\"" + this.srcExdr.getOriginal() + "\" url-mode=\"" + this.urlMode + "\"/>"; } } -} - - - - - - - + public static class PortalPage extends ModelScreenWidget { + public static final String TAG_NAME = "include-portal-page"; + protected FlexibleStringExpander idExdr; + protected FlexibleStringExpander editModeExdr; + protected String originalPortalPageId; + public PortalPage(ModelScreen modelScreen, Element portalPageElement) { + super(modelScreen, portalPageElement); + this.idExdr = FlexibleStringExpander.getInstance(portalPageElement.getAttribute("id")); + this.editModeExdr = FlexibleStringExpander.getInstance(portalPageElement.getAttribute("edit-mode")); + } + @Override + public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { + try { + Delegator delegator = (Delegator) context.get("delegator"); + GenericValue portalPage = null; + List<GenericValue> portalPageColumns = null; + List<GenericValue> portalPagePortlets = null; + List<GenericValue> portletAttributes = null; + + String expandedPortalPageId = getId(context); + + if (UtilValidate.isNotEmpty(expandedPortalPageId)) { + portalPage = delegator.findByPrimaryKeyCache("PortalPage", UtilMisc.toMap("portalPageId", expandedPortalPageId)); + if (portalPage == null) { + String errMsg = "Could not find PortalPage with portalPageId [" + expandedPortalPageId + "] "; + Debug.logError(errMsg, module); + throw new RuntimeException(errMsg); + } else { + originalPortalPageId = portalPage.getString("originalPortalPageId"); + portalPageColumns = delegator.getRelatedCache("PortalPageColumn", portalPage); + portalPagePortlets = delegator.findByAndCache("PortalPagePortletView", UtilMisc.toMap("portalPageId", expandedPortalPageId), UtilMisc.toList("sequenceNum")); + } + } else { + String errMsg = "portalPageId is empty."; + Debug.logError(errMsg, module); + return; + } + // Renders the portalPage header + screenStringRenderer.renderPortalPageBegin(writer, context, this); + + ListIterator <GenericValue>columnsIterator = portalPageColumns.listIterator(); + while(columnsIterator.hasNext()) { + GenericValue columnValue = columnsIterator.next(); + + // Renders the portalPageColumn header + screenStringRenderer.renderPortalPageColumnBegin(writer, context, this, columnValue); + + ListIterator <GenericValue>portletsIterator = portalPagePortlets.listIterator(); + while(portletsIterator.hasNext()) { + GenericValue portletValue = portletsIterator.next(); + + String portletColumnSeqId = portletValue.getString("columnSeqId"); + String columnSeqId = columnValue.getString("columnSeqId"); + + if ((columnSeqId != null) && (portletColumnSeqId != null)) { + if (columnSeqId.equals(portletColumnSeqId)) { + // Retrieves portlet's attributes + portletAttributes = delegator.findList("PortletAttribute", + EntityCondition.makeCondition(UtilMisc.toMap("portalPageId", portletValue.get("portalPageId"), "portalPortletId", portletValue.get("portalPortletId"), "portletSeqId", portletValue.get("portletSeqId"))), + null, null, null, false); + + + ListIterator <GenericValue>attributesIterator = portletAttributes.listIterator(); + + while (attributesIterator.hasNext()) { + GenericValue attribute = attributesIterator.next(); + context.put(attribute.getString("attrName"), attribute.getString("attrValue")); + } + + // Renders the portalPagePortlet + screenStringRenderer.renderPortalPagePortletBegin(writer, context, this, portletValue); + screenStringRenderer.renderPortalPagePortletBody(writer, context, this, portletValue); + screenStringRenderer.renderPortalPagePortletEnd(writer, context, this, portletValue); + } + } + } + // Renders the portalPageColumn footer + screenStringRenderer.renderPortalPageColumnEnd(writer, context, this, columnValue); + } + // Renders the portalPage footer + screenStringRenderer.renderPortalPageEnd(writer, context, this); + } catch (IOException e) { + String errMsg = "Error rendering PortalPage with portalPageId [" + getId(context) + "]: " + e.toString(); + Debug.logError(e, errMsg, module); + throw new RuntimeException(errMsg); + } catch (GenericEntityException e) { + String errMsg = "Error obtaining PortalPage with portalPageId [" + getId(context) + "]: " + e.toString(); + Debug.logError(e, errMsg, module); + throw new RuntimeException(errMsg); + } + } + public String getId(Map<String, Object> context) { + return this.idExdr.expandString(context); + } + public String getOriginalPortalPageId() { + return this.originalPortalPageId; + } + + public String getEditMode(Map<String, Object> context) { + return this.editModeExdr.expandString(context); + } + @Override + public String rawString() { + return "<include-portal-page id=\"" + this.idExdr.getOriginal() + "\" name=\"" + this.idExdr.getOriginal() + "\">"; + } + } +} Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java Sun Sep 19 00:09:39 2010 @@ -20,6 +20,7 @@ package org.ofbiz.widget.screen; import java.io.IOException; import java.util.Map; +import org.ofbiz.entity.GenericValue; import org.ofbiz.base.util.GeneralException; @@ -50,6 +51,14 @@ public interface ScreenStringRenderer { public void renderScreenletBegin(Appendable writer, Map<String, Object> context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException; public void renderScreenletSubWidget(Appendable writer, Map<String, Object> context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException, IOException; public void renderScreenletEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Screenlet screenlet) throws IOException; + + public void renderPortalPageBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage) throws GeneralException, IOException; + public void renderPortalPageEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage) throws GeneralException, IOException; + public void renderPortalPageColumnBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPageColumn) throws GeneralException, IOException; + public void renderPortalPageColumnEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPageColumn) throws GeneralException, IOException; + public void renderPortalPagePortletBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException; + public void renderPortalPagePortletBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException; + public void renderPortalPagePortletEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException; } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextScreenRenderer.java?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextScreenRenderer.java Sun Sep 19 00:09:39 2010 @@ -25,6 +25,7 @@ import org.ofbiz.base.util.GeneralExcept import org.ofbiz.base.util.UtilValidate; import org.ofbiz.widget.screen.ModelScreenWidget; import org.ofbiz.widget.screen.ScreenStringRenderer; +import org.ofbiz.entity.GenericValue; /** * Widget Library - Text Screen Renderer implementation @@ -121,4 +122,25 @@ public class TextScreenRenderer implemen public void renderScreenletEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Screenlet screenlet) throws IOException { // TODO: not implemented } + public void renderPortalPageBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPageEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPageColumnBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPageColumn) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPageColumnEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPageColumn) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPagePortletBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPagePortletEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException { + // TODO: not implemented + } + public void renderPortalPagePortletBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage, GenericValue portalPortlet) throws GeneralException, IOException { + // TODO: not implemented + } } Modified: ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl Sun Sep 19 00:09:39 2010 @@ -158,3 +158,96 @@ ${menuString} <li class="${paginatePreviousStyle?default("nav-previous")}<#if !previousLinkUrl?has_content> disabled</#if>"><#if previousLinkUrl?has_content><a href="${previousLinkUrl}">${paginatePreviousLabel}</a><#else>${paginatePreviousLabel}</#if></li> <li class="${paginateFirstStyle?default("nav-first")}<#if !firstLinkUrl?has_content> disabled</#if>"><#if firstLinkUrl?has_content><a href="${firstLinkUrl}">${paginateFirstLabel}</a><#else>${paginateFirstLabel}</#if></li> </#macro> + +<#macro renderPortalPageBegin originalPortalPageId portalPageId editMode="false" addColumnLabel="Add column" addColumnHint="Add a new column to this portal"> + <#if editMode == "true"> + <script src="/images/myportal.js" type="text/javascript"></script> + <a class="buttontext" href="javascript:document.addColumn_${portalPageId}.submit()" title="${addColumnHint}">${addColumnLabel}</a> PortalPageId: ${portalPageId} + <form method="post" action="addPortalPageColumn" name="addColumn_${portalPageId}"> + <input name="portalPageId" value="${portalPageId}" type="hidden"/> + </form> + </#if> + <table width="100%"> + <tr> +</#macro> + +<#macro renderPortalPageEnd editMode="false" editOnURL="#" editOffURL="#" editOnLabel="Edit ON" editOffLabel="Edit OFF" editOnHint="Enable portal page editing" editOffHint="Disable portal page editing"> + </tr> + </table> + <#if editMode == "true"> + <a class="buttontext" href="${editOffURL}" title="${editOffHint}">${editOffLabel}</a> + <#else> + <a class="buttontext" href="${editOnURL}" title="${editOnHint}">${editOnLabel}</a> + </#if> +</#macro> + +<#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 = '<input name="portalPageId" value="' + portalPageId + '" type="hidden"/><input name="columnSeqId" value="' + columnSeqId + '" type="hidden"/>'> + <td style="vertical-align: top; <#if width?has_content> width:${width};</#if>" id="portalColumn_${columnSeqId}"> + <#if editMode == "true"> + Column:${portalPageId}-${columnSeqId} + <div class="portal-column-config-title-bar"> + <ul> + <li> + <form method="post" action="deletePortalPageColumn" name="delColumn_${columnKey}"> + ${columnKeyFields} + </form> + <a class="buttontext" href="javascript:document.delColumn_${columnKey}.submit()" title="${delColumnHint}">${delColumnLabel}</a> + </li> + <li> + <form method="post" action="AddPortlet" name="addPortlet_${columnKey}"> + ${columnKeyFields} + </form> + <a class="buttontext" href="javascript:document.addPortlet_${columnKey}.submit()" title="${addPortletHint}">${addPortletLabel}</a> + </li> + <li> + <form method="post" action="editPortalPageColumnWidth" name="setColumnSize_${columnKey}"> + ${columnKeyFields} + </form> + <a class="buttontext" href="javascript:document.setColumnSize_${columnKey}.submit()" title="${setColumnSizeHint}">${width}</a> + </li> + </ul> + </div> + </#if> +</#macro> + +<#macro renderPortalPageColumnEnd> + </td> +</#macro> + +<#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 = '<input name="portalPageId" value="' + portalPageId + '" type="hidden"/><input name="portalPortletId" value="' + portalPortletId + '" type="hidden"/><input name="portletSeqId" value="' + portletSeqId + '" type="hidden"/>'> + <div id="PP_${portletKey}" name="portalPortlet" class="noClass"> + <#if editMode == "true"> + <div class="portlet-config" id="PPCFG_${portletKey}"> + <div class="portlet-config-title-bar"> + <ul> + <li class="title">Portlet : [${portalPortletId}]</li> + <li class="remove"> + <form method="post" action="deletePortalPagePortlet" name="delPortlet_${portletKey}"> + ${portletKeyFields} + </form> + <a href="javascript:document.delPortlet_${portletKey}.submit()" title="${delPortletHint}"> </a> + </li> + <#if editAttribute == "true"> + <li class="edit"> + <form method="post" action="editPortalPortletAttributes" name="editPortlet_${portletKey}"> + ${portletKeyFields} + </form> + <a href="javascript:document.editPortlet_${portletKey}.submit()" title="${editAttributeHint}"> </a> + </li> + </#if> + </ul> + <br class="clear"/> + </div> + </#if> +</#macro> + +<#macro renderPortalPagePortletEnd editMode="false"> + </div> + <#if editMode == "true"> + </div> + </#if> +</#macro> Modified: ofbiz/trunk/themes/tomahawk/webapp/tomahawk/css/style.css URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/tomahawk/webapp/tomahawk/css/style.css?rev=998570&r1=998569&r2=998570&view=diff ============================================================================== --- ofbiz/trunk/themes/tomahawk/webapp/tomahawk/css/style.css (original) +++ ofbiz/trunk/themes/tomahawk/webapp/tomahawk/css/style.css Sun Sep 19 00:09:39 2010 @@ -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 */ } |
Free forum by Nabble | Edit this page |