Author: hansbak
Date: Fri Nov 25 09:30:42 2011 New Revision: 1206093 URL: http://svn.apache.org/viewvc?rev=1206093&view=rev Log: fix for the preference screen in scrum as reported in https://issues.apache.org/jira/browse/OFBIZ-4586 Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumPreferenceSecurityGroup.groovy (with props) Modified: ofbiz/trunk/specialpurpose/scrum/config/scrumUiLabels.xml ofbiz/trunk/specialpurpose/scrum/widget/CommonScreens.xml ofbiz/trunk/specialpurpose/scrum/widget/ResourceForms.xml ofbiz/trunk/specialpurpose/scrum/widget/ResourceScreens.xml ofbiz/trunk/specialpurpose/scrum/widget/scrumMenus.xml Modified: ofbiz/trunk/specialpurpose/scrum/config/scrumUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/config/scrumUiLabels.xml?rev=1206093&r1=1206092&r2=1206093&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/config/scrumUiLabels.xml (original) +++ ofbiz/trunk/specialpurpose/scrum/config/scrumUiLabels.xml Fri Nov 25 09:30:42 2011 @@ -671,6 +671,9 @@ <property key="ScrumMoveToUnplannedSprint"> <value xml:lang="en">Move to unplanned sprint</value> </property> + <property key="ScrumMyProfile"> + <value xml:lang="en">My Profile</value> + </property> <property key="ScrumMyWork"> <value xml:lang="en">My Work</value> </property> Added: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumPreferenceSecurityGroup.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumPreferenceSecurityGroup.groovy?rev=1206093&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumPreferenceSecurityGroup.groovy (added) +++ ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumPreferenceSecurityGroup.groovy Fri Nov 25 09:30:42 2011 @@ -0,0 +1,172 @@ +/* +* 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.condition.*; +import org.ofbiz.base.util.*; +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.condition.EntityOperator; +import javolution.util.FastList; + +partyId = parameters.partyId; + +andCond = FastList.newInstance(); +orCond = FastList.newInstance(); +combinedCondList = FastList.newInstance(); + +andCond.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)); +andCond.add(EntityCondition.makeCondition("partyStatusId", EntityOperator.EQUALS, "PARTY_ENABLED")); + +orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_PRODUCT_OWNER")); +orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_MASTER")); +orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_TEAM")); +orCond.add(EntityCondition.makeCondition("enabled", EntityOperator.EQUALS, "Y")); +orCond.add(EntityCondition.makeCondition("enabled", EntityOperator.EQUALS, null)); + +orCondList = EntityCondition.makeCondition(orCond, EntityOperator.OR); +andCondList = EntityCondition.makeCondition(andCond, EntityOperator.AND); + +combinedCondList.add(orCondList); +combinedCondList.add(andCondList); + +combinedConds = EntityCondition.makeCondition(combinedCondList, EntityOperator.AND); + +scrumUserLoginSecurityGroupList = delegator.findList("ScrumMemberUserLoginAndSecurityGroup", combinedConds, null, null, null, false); +userPreferenceList = []; +userPreferenceOutList = []; +if (scrumUserLoginSecurityGroupList) { + scrumUserLoginSecurityGroupList.each { scrumUserLoginSecurityGroupMap -> + if (scrumUserLoginSecurityGroupMap.groupId == "SCRUM_PRODUCT_OWNER") { + ownerCond = FastList.newInstance(); + ownerCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE")); + ownerCond.add(EntityCondition.makeCondition("enumId", EntityOperator.NOT_EQUAL, "MASTER_NOTIFY")); + ownerConds = EntityCondition.makeCondition(ownerCond, EntityOperator.AND); + userPreferenceList = delegator.findList("Enumeration" , ownerConds, null, null, null, false); + } else if (scrumUserLoginSecurityGroupMap.groupId == "SCRUM_MASTER") { + masterCond = FastList.newInstance(); + masterCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE")); + masterCond.add(EntityCondition.makeCondition("enumId", EntityOperator.EQUALS, "MASTER_NOTIFY")); + masterConds = EntityCondition.makeCondition(masterCond, EntityOperator.AND); + userPreferenceList = delegator.findList("Enumeration" , masterConds, null, null, null, false); + } /*else if (scrumUserLoginSecurityGroupMap.groupId == "SCRUM_TEAM") { + teamCond = FastList.newInstance(); + teamCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE")); + teamCond.add(EntityCondition.makeCondition("enumId", EntityOperator.EQUALS, "INVITE_NOTIFI")); + teamConds = EntityCondition.makeCondition(teamCond, EntityOperator.AND); + userPreferenceList = delegator.findList("Enumeration" , teamConds, null, null, null, false); + }*/ + if (userPreferenceList) { + userPreferenceList.each { userPreferenceMap -> + userPreferenceOutList.add(userPreferenceMap); + } + } + } + context.userPreferenceList = userPreferenceOutList; +} else { + if (security.hasEntityPermission("SCRUM", "_ADMIN", session)) { + userPreferenceList = delegator.findByAnd("Enumeration", [enumTypeId : "SCRUM_PREFERENCE"], ["sequenceId"]); + context.userPreferenceList = userPreferenceList; + } + } +/* +* 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.condition.*; +import org.ofbiz.base.util.*; +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.condition.EntityOperator; +import javolution.util.FastList; + +partyId = parameters.partyId; + +andCond = FastList.newInstance(); +orCond = FastList.newInstance(); +combinedCondList = FastList.newInstance(); + +andCond.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)); +andCond.add(EntityCondition.makeCondition("partyStatusId", EntityOperator.EQUALS, "PARTY_ENABLED")); + +orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_PRODUCT_OWNER")); +orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_MASTER")); +orCond.add(EntityCondition.makeCondition("groupId", EntityOperator.EQUALS, "SCRUM_TEAM")); +orCond.add(EntityCondition.makeCondition("enabled", EntityOperator.EQUALS, "Y")); +orCond.add(EntityCondition.makeCondition("enabled", EntityOperator.EQUALS, null)); + +orCondList = EntityCondition.makeCondition(orCond, EntityOperator.OR); +andCondList = EntityCondition.makeCondition(andCond, EntityOperator.AND); + +combinedCondList.add(orCondList); +combinedCondList.add(andCondList); + +combinedConds = EntityCondition.makeCondition(combinedCondList, EntityOperator.AND); + +scrumUserLoginSecurityGroupList = delegator.findList("ScrumMemberUserLoginAndSecurityGroup", combinedConds, null, null, null, false); +userPreferenceList = []; +userPreferenceOutList = []; +if (scrumUserLoginSecurityGroupList) { + scrumUserLoginSecurityGroupList.each { scrumUserLoginSecurityGroupMap -> + if (scrumUserLoginSecurityGroupMap.groupId == "SCRUM_PRODUCT_OWNER") { + ownerCond = FastList.newInstance(); + ownerCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE")); + ownerCond.add(EntityCondition.makeCondition("enumId", EntityOperator.NOT_EQUAL, "MASTER_NOTIFY")); + ownerConds = EntityCondition.makeCondition(ownerCond, EntityOperator.AND); + userPreferenceList = delegator.findList("Enumeration" , ownerConds, null, null, null, false); + } else if (scrumUserLoginSecurityGroupMap.groupId == "SCRUM_MASTER") { + masterCond = FastList.newInstance(); + masterCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE")); + masterCond.add(EntityCondition.makeCondition("enumId", EntityOperator.EQUALS, "MASTER_NOTIFY")); + masterConds = EntityCondition.makeCondition(masterCond, EntityOperator.AND); + userPreferenceList = delegator.findList("Enumeration" , masterConds, null, null, null, false); + } /*else if (scrumUserLoginSecurityGroupMap.groupId == "SCRUM_TEAM") { + teamCond = FastList.newInstance(); + teamCond.add(EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "SCRUM_PREFERENCE")); + teamCond.add(EntityCondition.makeCondition("enumId", EntityOperator.EQUALS, "INVITE_NOTIFI")); + teamConds = EntityCondition.makeCondition(teamCond, EntityOperator.AND); + userPreferenceList = delegator.findList("Enumeration" , teamConds, null, null, null, false); + }*/ + if (userPreferenceList) { + userPreferenceList.each { userPreferenceMap -> + userPreferenceOutList.add(userPreferenceMap); + } + } + } + context.userPreferenceList = userPreferenceOutList; +} else { + if (security.hasEntityPermission("SCRUM", "_ADMIN", session)) { + userPreferenceList = delegator.findByAnd("Enumeration", [enumTypeId : "SCRUM_PREFERENCE"], ["sequenceId"]); + context.userPreferenceList = userPreferenceList; + } + } Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumPreferenceSecurityGroup.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumPreferenceSecurityGroup.groovy ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/ListScrumPreferenceSecurityGroup.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/specialpurpose/scrum/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/widget/CommonScreens.xml?rev=1206093&r1=1206092&r2=1206093&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/widget/CommonScreens.xml (original) +++ ofbiz/trunk/specialpurpose/scrum/widget/CommonScreens.xml Fri Nov 25 09:30:42 2011 @@ -324,7 +324,7 @@ <screen name="CommonPartyDecorator"> <section> <actions> - <set field="headerItem" value="ProjectMember"/> + <set field="headerItem" value="myProfile"/> <set field="partyId" from-field="parameters.partyId"/> <entity-one entity-name="Party" value-field="party"/> <entity-one entity-name="Person" value-field="lookupPerson"/> Modified: ofbiz/trunk/specialpurpose/scrum/widget/ResourceForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/widget/ResourceForms.xml?rev=1206093&r1=1206092&r2=1206093&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/widget/ResourceForms.xml (original) +++ ofbiz/trunk/specialpurpose/scrum/widget/ResourceForms.xml Fri Nov 25 09:30:42 2011 @@ -160,25 +160,25 @@ </field> </form> <form name="ListPreference" type="multi" target="updatePreference?partyId=${parameters.partyId}" list-name="userPreferenceList" - odd-row-style="alternate-row" default-table-style="basic-table hover-bar" separate-columns="true" use-row-submit="true" > + odd-row-style="alternate-row" default-table-style="basic-table hover-bar" separate-columns="true"> <row-actions> <service service-name="getUserPreference" result-map="values"> <field-map field-name="userPrefTypeId" from-field="enumId"/> </service> - <set field="userPrefValue" from-field="values.userPrefValue"/> + <set field="userPrefValue" from-field="values.userPrefValue" default-value="Y"/> <entity-and entity-name="UserLogin" list="userLogins"> <field-map field-name="partyId" from-field="parameters.partyId"/> + <field-map field-name="userLoginId" from-field="userLogin.userLoginId"/> </entity-and> <set field="userLoginId" from-field="userLogins[0].userLoginId"/> </row-actions> - <field name="_rowSubmit"><hidden value="Y"/></field> <field name="enumId" parameter-name="userPrefTypeId"><hidden value="${enumId}"/></field> <field name="enumTypeId" parameter-name="userPrefGroupTypeId"><hidden value="${enumTypeId}"/></field> <field name="description" title="${uiLabelMap.CommonDescription}"><display/></field> <field name="partyId"><hidden value="${parameters.partyId}"/></field> <field name="userLoginId"><hidden/></field> <field name="userPrefValue" title="Enable"> - <drop-down> + <drop-down allow-empty="false" no-current-selected-key="Y"> <option key="N" description="No"/> <option key="Y" description="Yes"/> </drop-down> @@ -186,6 +186,7 @@ <field name="submit" title="${uiLabelMap.CommonSubmit}"><submit/></field> </form> <form name="ListPreferenceNoAction" extends="ListPreference"> + <field name="userPrefValue" title="Enable"><display/></field> <field name="submit"><hidden/></field> </form> <form name="FindPartyRevision" type="single" target="findPartyRevision"> Modified: ofbiz/trunk/specialpurpose/scrum/widget/ResourceScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/widget/ResourceScreens.xml?rev=1206093&r1=1206092&r2=1206093&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/widget/ResourceScreens.xml (original) +++ ofbiz/trunk/specialpurpose/scrum/widget/ResourceScreens.xml Fri Nov 25 09:30:42 2011 @@ -209,12 +209,14 @@ under the License. <section> <actions> <set field="titleProperty" value="PageTitleViewPartyPreferences"/> - <set field="headerItem" value="projectMember"/> <set field="tabButtonItem" value="preferences"/> <set field="partyId" from-field="parameters.partyId"/> - <entity-and entity-name="Enumeration" list="userPreferenceList"> - <field-map field-name="enumTypeId" value="SCRUM_PREFERENCE"/> + <entity-and entity-name="UserLogin" list="userLogins"> + <field-map field-name="partyId" from-field="parameters.partyId"/> + <field-map field-name="userLoginId" from-field="userLogin.userLoginId"/> </entity-and> + <set field="userLoginId" from-field="userLogins[0].userLoginId"/> + <script location="component://scrum/webapp/scrum/WEB-INF/actions/ListScrumPreferenceSecurityGroup.groovy"/> </actions> <widgets> <decorator-screen name="CommonPartyDecorator" location="${parameters.mainDecoratorLocation}"> @@ -223,12 +225,12 @@ under the License. <condition> <and> <not><if-empty field="partyId"></if-empty></not> - <if-service-permission service-name="scrumPermissionCheck" main-action="CREATE" resource-description="MEMBER"/> + <!-- <if-service-permission service-name="scrumPermissionCheck" main-action="CREATE" resource-description="BACKLOG"/> --> <if-compare-field field="partyId" operator="equals" to-field="userLogin.partyId"/> </and> </condition> <widgets> - <screenlet title="${uiLabelMap.CommonPreferences}" > + <screenlet title="${uiLabelMap.CommonPreferences} : ${userLoginId}" > <include-form name="ListPreference" location="component://scrum/widget/ResourceForms.xml"/> </screenlet> </widgets> Modified: ofbiz/trunk/specialpurpose/scrum/widget/scrumMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/widget/scrumMenus.xml?rev=1206093&r1=1206092&r2=1206093&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/widget/scrumMenus.xml (original) +++ ofbiz/trunk/specialpurpose/scrum/widget/scrumMenus.xml Fri Nov 25 09:30:42 2011 @@ -54,6 +54,11 @@ </condition> <link target="adminScrum"/> </menu-item> + <menu-item name="myProfile" title="${uiLabelMap.ScrumMyProfile}"> + <link target="viewprofile"> + <parameter param-name="partyId" from-field="userLogin.partyId"/> + </link> + </menu-item> </menu> <menu name="ScrumAdminSubMenu" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml"> @@ -721,32 +726,52 @@ </link> </menu-item> <menu-item name="preferences" title="${uiLabelMap.CommonPreferences}"> + <condition> + <and> + <if-service-permission service-name="scrumPermissionCheck" main-action="VIEW" resource-description="BACKLOG"/> + <if-compare-field field="userLogin.partyId" operator="equals" to-field="partyId"/> + </and> + </condition> <link target="Preferences"> <parameter param-name="partyId"/> </link> </menu-item> - <menu-item name="viewroles" title="${uiLabelMap.PartyRoles}"> + <condition> + <if-has-permission permission="SCRUM" action="_ADMIN"/> + </condition> <link target="viewroles"> <parameter param-name="partyId"/> </link> </menu-item> <menu-item name="listResourcesProject" title="${uiLabelMap.ScrumProjects}"> + <condition> + <if-service-permission service-name="scrumPermissionCheck" main-action="VIEW" resource-description="BACKLOG"/> + </condition> <link target="listResourcesProject"> <parameter param-name="partyId"/> </link> </menu-item> <menu-item name="listResourcesTask" title="${uiLabelMap.ScrumTasks}"> + <condition> + <if-service-permission service-name="scrumPermissionCheck" main-action="UPDATE" resource-description="TASK"/> + </condition> <link target="listResourcesTask"> <parameter param-name="partyId"/> </link> </menu-item> <menu-item name="EditPartyRates" title="${uiLabelMap.CommonRates}"> + <condition> + <if-has-permission permission="SCRUM" action="_ADMIN"/> + </condition> <link target="EditPartyRates"> <parameter param-name="partyId"/> </link> </menu-item> <menu-item name="findPartyRevision" title="${uiLabelMap.ScrumRevisions}"> + <condition> + <if-service-permission service-name="scrumPermissionCheck" main-action="UPDATE" resource-description="TASK"/> + </condition> <link target="findPartyRevision"> <parameter param-name="partyId"/> </link> @@ -873,7 +898,7 @@ <if-has-permission permission="SCRUM" action="_ADMIN"/> </and> </condition> - <link target="setTaskStatus"> + <link target="setTaskStatus"> <parameter param-name="workEffortId" from-field="parameters.taskId"/> <parameter param-name="taskId" from-field="parameters.taskId"/> <parameter param-name="currentStatusId" value="STS_CANCELLED"/> |
Free forum by Nabble | Edit this page |