You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2009/10/21 09:28:33 UTC

svn commit: r827909 - in /ofbiz/trunk/applications/commonext: ./ config/ data/ script/org/ofbiz/ servicedef/ webapp/WEB-INF/ widget/

Author: hansbak
Date: Wed Oct 21 07:28:32 2009
New Revision: 827909

URL: http://svn.apache.org/viewvc?rev=827909&view=rev
Log:
added the function to create a public system message by the full admin user

Added:
    ofbiz/trunk/applications/commonext/data/CommonExtSecurityData.xml   (with props)
Modified:
    ofbiz/trunk/applications/commonext/config/CommonExtUiLabels.xml
    ofbiz/trunk/applications/commonext/ofbiz-component.xml
    ofbiz/trunk/applications/commonext/script/org/ofbiz/SystemInfoServices.xml
    ofbiz/trunk/applications/commonext/servicedef/services.xml
    ofbiz/trunk/applications/commonext/webapp/WEB-INF/controller.xml
    ofbiz/trunk/applications/commonext/widget/CommonScreens.xml
    ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml
    ofbiz/trunk/applications/commonext/widget/SystemInfoMenus.xml
    ofbiz/trunk/applications/commonext/widget/SystemInfoScreens.xml

Modified: ofbiz/trunk/applications/commonext/config/CommonExtUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/config/CommonExtUiLabels.xml?rev=827909&r1=827908&r2=827909&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/config/CommonExtUiLabels.xml (original)
+++ ofbiz/trunk/applications/commonext/config/CommonExtUiLabels.xml Wed Oct 21 07:28:32 2009
@@ -19,6 +19,9 @@
     under the License.
 -->
 <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <property key="CommonExtCreatePublicMessage">
+        <value xml:lang="en">Create Public Message</value>
+    </property>
     <property key="CommonExtHelpDefinition">
         <value xml:lang="en">Definition, what is it?</value>
     </property>

Added: ofbiz/trunk/applications/commonext/data/CommonExtSecurityData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/data/CommonExtSecurityData.xml?rev=827909&view=auto
==============================================================================
--- ofbiz/trunk/applications/commonext/data/CommonExtSecurityData.xml (added)
+++ ofbiz/trunk/applications/commonext/data/CommonExtSecurityData.xml Wed Oct 21 07:28:32 2009
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<entity-engine-xml>
+    <!-- Common Ext security -->
+    <SecurityPermission description="Create public system information messages." permissionId="COMMONEXT_PUBLMSG"/>
+    <SecurityGroupPermission groupId="FULLADMIN" permissionId="COMMONEXT_PUBLMSG"/>
+</entity-engine-xml>

Propchange: ofbiz/trunk/applications/commonext/data/CommonExtSecurityData.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/commonext/data/CommonExtSecurityData.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/commonext/data/CommonExtSecurityData.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/applications/commonext/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/ofbiz-component.xml?rev=827909&r1=827908&r2=827909&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/commonext/ofbiz-component.xml Wed Oct 21 07:28:32 2009
@@ -26,6 +26,7 @@
     
     <entity-resource type="data" reader-name="seed" loader="main" location="data/EntityDiagramGroupData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/CommonExtSeedData.xml"/>
+    <entity-resource type="data" reader-name="seed" loader="main" location="data/CommonExtSecurityData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/CommonExtHelpData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/SystemInfoPortletData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/SetupData.xml"/>

Modified: ofbiz/trunk/applications/commonext/script/org/ofbiz/SystemInfoServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/script/org/ofbiz/SystemInfoServices.xml?rev=827909&r1=827908&r2=827909&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/script/org/ofbiz/SystemInfoServices.xml (original)
+++ ofbiz/trunk/applications/commonext/script/org/ofbiz/SystemInfoServices.xml Wed Oct 21 07:28:32 2009
@@ -140,6 +140,30 @@
                 <create-value value-field="noteData"/>
             </iterate>
         </if-compare>
+        
+        <!-- public message -->
+        <if-compare field="parameters.entityName" value="PublicMessage" operator="equals">
+            <if-has-permission permission="COMMONEXT_PUBLMSG">
+                <!-- get all recent visitors logged on the last 3 weeks -->
+                <set field="lastDate" value="${groovy:org.ofbiz.base.util.UtilDateTime.addDaysToTimestamp(org.ofbiz.base.util.UtilDateTime.nowTimestamp(), new Integer(&quot;-21&quot;))}" type="Timestamp"/>
+                <entity-condition list="parties" entity-name="PartyNameVisitView" distinct="true">
+                    <condition-expr field-name="fromDate" operator="greater" from-field="lastDate"/>
+                    <select-field field-name="partyId"/>
+                </entity-condition>
+                <iterate entry="party" list="parties">            
+                    <make-value value-field="noteData" entity-name="NoteData"/>
+                    <now-timestamp field="noteData.noteDateTime"/>
+                    <sequenced-id sequence-name="NoteData" field="noteData.noteId"/>
+                    <set field="noteData.noteParty" from-field="party.partyId"/>
+                    <set field="noteData.noteName" value="SYSTEMNOTE"/>
+                    <set field="noteData.noteInfo" from-field="parameters.noteInfo"/>
+                    <create-value value-field="noteData"/>
+                </iterate>
+                <set field="noteData.noteParty" value="_NA_"/><!-- message for not logged in users -->
+                <sequenced-id sequence-name="NoteData" field="noteData.noteId"/>
+                <create-value value-field="noteData"/>
+            </if-has-permission>
+        </if-compare>
     </simple-method>
 
     <simple-method method-name="getPortletAttributeMap" short-description="get the attributes of the SystemInfoNotes portlet for a userlogin">
@@ -225,13 +249,25 @@
             <field-to-result field="systemInfoNotes"/>
         </if-not-empty>
     </simple-method>
-    
-    <simple-method method-name="getLastSystemInfoNote" short-description="">
-        <entity-and entity-name="NoteData" list="systemInfoNotes">
-            <field-map field-name="noteParty" from-field="parameters.userLogin.partyId"/>
-            <field-map field-name="noteName" value="SYSTEMNOTE"/>
-            <order-by field-name="-noteDateTime"/>
-        </entity-and>
+
+    <simple-method method-name="getLastSystemInfoNote"
+        short-description="Get the last 3 system info notes"
+        login-required="false">
+        <if-not-empty field="parameters.userLogin">
+            <entity-and entity-name="NoteData" list="systemInfoNotes">
+                <field-map field-name="noteParty"
+                    from-field="parameters.userLogin.partyId"/>
+                <field-map field-name="noteName" value="SYSTEMNOTE"/>
+                <order-by field-name="-noteDateTime"/>
+            </entity-and>
+            <else>
+                <entity-and entity-name="NoteData" list="systemInfoNotes">
+                    <field-map field-name="noteParty" value="_NA_"/>
+                    <field-map field-name="noteName" value="SYSTEMNOTE"/>
+                    <order-by field-name="-noteDateTime"/>
+                </entity-and>
+            </else>
+        </if-not-empty>
         <if-not-empty field="systemInfoNotes">
             <set field="lastSystemInfoNote1" from-field="systemInfoNotes[0]"/>
             <field-to-result field="lastSystemInfoNote1"/>

Modified: ofbiz/trunk/applications/commonext/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/servicedef/services.xml?rev=827909&r1=827908&r2=827909&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/commonext/servicedef/services.xml Wed Oct 21 07:28:32 2009
@@ -41,7 +41,7 @@
         <description>Get system notes for the logged on party</description>
         <attribute name="systemInfoNotes" type="List" mode="OUT" optional="true"/>
     </service>
-    <service name="getLastSystemInfoNote" engine="simple" auth="true"
+    <service name="getLastSystemInfoNote" engine="simple" auth="false"
         location="component://commonext/script/org/ofbiz/SystemInfoServices.xml" invoke="getLastSystemInfoNote">
         <description>Get last system note for the logged on party</description>
         <attribute name="lastSystemInfoNote1" type="GenericValue" mode="OUT" optional="true"/>

Modified: ofbiz/trunk/applications/commonext/webapp/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/webapp/WEB-INF/controller.xml?rev=827909&r1=827908&r2=827909&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/webapp/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/commonext/webapp/WEB-INF/controller.xml Wed Oct 21 07:28:32 2009
@@ -39,6 +39,12 @@
         <response name="success" type="view-last"/>
     </request-map>
     
+    <request-map uri="createSystemInfoNote">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="createSystemInfoNote"/>
+        <response name="success" type="view-last"/>
+    </request-map>
+    
     <request-map uri="showHelp">
         <security https="true" auth="true"/>
         <response name="success" type="view" value="showHelp"/>

Modified: ofbiz/trunk/applications/commonext/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/widget/CommonScreens.xml?rev=827909&r1=827908&r2=827909&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/applications/commonext/widget/CommonScreens.xml Wed Oct 21 07:28:32 2009
@@ -23,6 +23,7 @@
     <screen name="ApplicationDecorator">
         <section>
             <actions>
+                <property-map resource="CommonExtUiLabels" map-name="uiLabelMap" global="true"/>
                 <service service-name="getUserPreferenceGroup" result-map="prefResult">
                     <field-map field-name="userPrefGroupTypeId" value="GLOBAL_PREFERENCES"/>
                 </service>
@@ -35,6 +36,16 @@
                 <set field="line.url" value="/partymgr/control/viewprofile?partyId=${userLogin.partyId}"/>
                 <set field="layoutSettings.topLines[]" from-field="line" global="true"/>
                 <script location="component://commonext/script/changeOrgPartyId.groovy"/>
+                <!-- system info notes -->
+                <service service-name="getLastSystemInfoNote" result-map="resultNote"/>
+                <set field="linkStart" value="/myportal/control/showPortletDecorator?portalPortletId="/>
+                <set field="layoutSettings.middleTopHeader" value="---------- ${uiLabelMap.CommonLastSytemNotes} ----------"/>
+                <set field="layoutSettings.middleTopMessage1" value="${groovy:resultNote.lastSystemInfoNote1!=null?resultNote.lastSystemInfoNote1.noteDateTime.toString().substring(0,16) + &quot; &quot; + resultNote.lastSystemInfoNote1.noteInfo:&quot;&quot;}"/>
+                <set field="layoutSettings.middleTopLink1" value="${linkStart}${resultNote.lastSystemInfoNote1.moreInfoPortletId}&amp;id=${resultNote.lastSystemInfoNote1.moreInfoItemId}"/>
+                <set field="layoutSettings.middleTopMessage2" value="${groovy:resultNote.lastSystemInfoNote2!=null?resultNote.lastSystemInfoNote2.noteDateTime.toString().substring(0,16) + &quot; &quot; + resultNote.lastSystemInfoNote2.noteInfo:&quot;&quot;}"/>
+                <set field="layoutSettings.middleTopLink2" value="${linkStart}${resultNote.lastSystemInfoNote2.moreInfoPortletId}&amp;id=${resultNote.lastSystemInfoNote2.moreInfoItemId}"/>
+                <set field="layoutSettings.middleTopMessage3" value="${groovy:resultNote.lastSystemInfoNote3!=null?resultNote.lastSystemInfoNote3.noteDateTime.toString().substring(0,16) + &quot; &quot; + resultNote.lastSystemInfoNote3.noteInfo:&quot;&quot;}"/>
+                <set field="layoutSettings.middleTopLink3" value="${linkStart}${resultNote.lastSystemInfoNote3.moreInfoPortletId}&amp;id=${resultNote.lastSystemInfoNote3.moreInfoItemId}"/>
             </actions>
             <widgets>
                 <section>
@@ -58,27 +69,6 @@
                     </actions>
                     <widgets/>
                 </section>
-                <section>
-                    <condition>
-                        <and>
-                            <not><if-empty field="userLogin"/></not>
-                            <not><if-empty field="userLogin.hasLoggedOut"/></not>
-                            <if-compare field="userLogin.hasLoggedOut" operator="equals" value="N"/>
-                        </and>
-                    </condition>
-                    <actions>                
-                        <service service-name="getLastSystemInfoNote" result-map="resultNote"/>
-                        <set field="linkStart" value="/myportal/control/showPortletDecorator?portalPortletId="/>
-                        <set field="layoutSettings.middleTopHeader" value="---------- ${uiLabelMap.CommonLastSytemNotes} ----------"/>
-                        <set field="layoutSettings.middleTopMessage1" value="${groovy:resultNote.lastSystemInfoNote1!=null?resultNote.lastSystemInfoNote1.noteDateTime.toString().substring(0,16) + &quot; &quot; + resultNote.lastSystemInfoNote1.noteInfo:&quot;&quot;}"/>
-                        <set field="layoutSettings.middleTopLink1" value="${linkStart}${resultNote.lastSystemInfoNote1.moreInfoPortletId}&amp;id=${resultNote.lastSystemInfoNote1.moreInfoItemId}"/>
-                        <set field="layoutSettings.middleTopMessage2" value="${groovy:resultNote.lastSystemInfoNote2!=null?resultNote.lastSystemInfoNote2.noteDateTime.toString().substring(0,16) + &quot; &quot; + resultNote.lastSystemInfoNote2.noteInfo:&quot;&quot;}"/>
-                        <set field="layoutSettings.middleTopLink2" value="${linkStart}${resultNote.lastSystemInfoNote2.moreInfoPortletId}&amp;id=${resultNote.lastSystemInfoNote2.moreInfoItemId}"/>
-                        <set field="layoutSettings.middleTopMessage3" value="${groovy:resultNote.lastSystemInfoNote3!=null?resultNote.lastSystemInfoNote3.noteDateTime.toString().substring(0,16) + &quot; &quot; + resultNote.lastSystemInfoNote3.noteInfo:&quot;&quot;}"/>
-                        <set field="layoutSettings.middleTopLink3" value="${linkStart}${resultNote.lastSystemInfoNote3.moreInfoPortletId}&amp;id=${resultNote.lastSystemInfoNote3.moreInfoItemId}"/>
-                    </actions>
-                    <widgets/>
-                </section>
                 <include-screen name="GlobalDecorator" location="component://common/widget/CommonScreens.xml"/>
             </widgets>
         </section>

Modified: ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml?rev=827909&r1=827908&r2=827909&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml (original)
+++ ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml Wed Oct 21 07:28:32 2009
@@ -42,4 +42,11 @@
         <field name="noteDateTime" title="Date Last Changed"><display type="date-time"/></field>
         <field name="noteInfo" title="System Info Status"><hyperlink target="/myportal/control/showPortletDecorator?portalPortletId=${moreInfoPortletId}" target-type="inter-app" description="${noteInfo}"></hyperlink></field>
     </form>
+    
+    <form name="CreateSystemInfoNote" type="single" target="createSystemInfoNote">
+        <field name="entityName"><hidden value="PublicMessage"/></field>
+        <field name="entityNameId"><hidden value="dummy"/></field>
+        <field name="noteInfo"><text size="50"/></field>
+        <field name="createButton"><submit/></field>
+    </form>
 </forms>

Modified: ofbiz/trunk/applications/commonext/widget/SystemInfoMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/widget/SystemInfoMenus.xml?rev=827909&r1=827908&r2=827909&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/widget/SystemInfoMenus.xml (original)
+++ ofbiz/trunk/applications/commonext/widget/SystemInfoMenus.xml Wed Oct 21 07:28:32 2009
@@ -24,6 +24,15 @@
         <menu-item name="deleteAll" title="${uiLabelMap.CommonDeleteAll}">
             <link target="deleteAllSystemNotes"/>
         </menu-item>
+        <menu-item name="createPublicMsg" title="${uiLabelMap.CommonExtCreatePublicMessage}">
+            <condition>
+                <if-has-permission permission="COMMONEXT_PUBLMSG"/>
+            </condition>
+            <link target="${parameters._LAST_VIEW_NAME_}">
+                <parameter param-name="portalPageId" from-field="parameters.portalPageId"/>
+                <parameter param-name="createPublicMsg" value="true"/>
+            </link>
+        </menu-item>
     </menu>
     
 </menus>

Modified: ofbiz/trunk/applications/commonext/widget/SystemInfoScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/widget/SystemInfoScreens.xml?rev=827909&r1=827908&r2=827909&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/widget/SystemInfoScreens.xml (original)
+++ ofbiz/trunk/applications/commonext/widget/SystemInfoScreens.xml Wed Oct 21 07:28:32 2009
@@ -24,21 +24,30 @@
     <screen name="SystemInfoNotes">
         <section>
             <actions>
-                <service service-name="getSystemInfoNotes" result-map="resultMap"/>
+                <service service-name="getSystemInfoNotes"
+                    result-map="resultMap"/>
                 <set field="systemInfoNotes" from-field="resultMap.systemInfoNotes"/>
             </actions>
             <widgets>
+                <screenlet
+                    title="System Info notes for user: ${userLogin.partyId}"
+                    navigation-menu-name="SystemInfoNotes">
                 <section>
                     <condition>
-                        <not><if-empty field="systemInfoNotes"/></not>
+                        <not>
+                            <if-empty field="parameters.createPublicMsg"/>
+                        </not>
                     </condition>
                     <widgets>
-                        <screenlet title="System Info notes for user: ${userLogin.partyId}" navigation-menu-name="SystemInfoNotes">
-                            <include-menu name="SystemInfoNotes" location="component://commonext/widget/SystemInfoMenus.xml"/>
-                            <include-form name="SystemInfoNotes" location="component://commonext/widget/SystemInfoForms.xml"/>
-                        </screenlet>
+                        <include-form name="CreateSystemInfoNote"
+                            location="component://commonext/widget/SystemInfoForms.xml"/>
                     </widgets>
                 </section>
+                    <include-menu name="SystemInfoNotes"
+                        location="component://commonext/widget/SystemInfoMenus.xml"/>
+                    <include-form name="SystemInfoNotes"
+                        location="component://commonext/widget/SystemInfoForms.xml"/>
+                </screenlet>
             </widgets>
         </section>
     </screen>