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/03/11 11:17:27 UTC
svn commit: r752416 - in /ofbiz/trunk: applications/commonext/script/
applications/commonext/widget/ framework/common/webcommon/includes/
Author: hansbak
Date: Wed Mar 11 10:17:26 2009
New Revision: 752416
URL: http://svn.apache.org/viewvc?rev=752416&view=rev
Log:
if there are more than one default party organization to select from, present a drop down in the header so it can easily be changed
Added:
ofbiz/trunk/applications/commonext/script/
ofbiz/trunk/applications/commonext/script/changeOrgPartyId.groovy (with props)
ofbiz/trunk/framework/common/webcommon/includes/insertDropDown.ftl (with props)
Modified:
ofbiz/trunk/applications/commonext/widget/CommonScreens.xml
ofbiz/trunk/framework/common/webcommon/includes/header.ftl
Added: ofbiz/trunk/applications/commonext/script/changeOrgPartyId.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/script/changeOrgPartyId.groovy?rev=752416&view=auto
==============================================================================
--- ofbiz/trunk/applications/commonext/script/changeOrgPartyId.groovy (added)
+++ ofbiz/trunk/applications/commonext/script/changeOrgPartyId.groovy Wed Mar 11 10:17:26 2009
@@ -0,0 +1,49 @@
+/*
+ * 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.base.util.*;
+//last Parameters
+requestParameters.remove("userPrefGroupTypeId");
+requestParameters.remove("userPrefTypeId");
+requestParameters.remove("userPrefValue");
+lastParameters = requestParameters.toString().replaceAll(",","&").replaceAll(" ","");
+if(lastParameters.length() > 2){
+ lastParameters = lastParameters.toString().substring(1,lastParameters.toString().length()-1);
+ globalContext.lastParameters = lastParameters;
+}
+setPreferenceMain="";
+if(!parameters.targetRequestUri.toString().equals("/setUserPreference")){
+ setPreferenceMain= "setUserPreference";
+}
+globalContext.setPreferenceMain = setPreferenceMain;
+//partyAcctgPrefAndGroupList
+partyAcctgPrefAndGroupList = [];
+partyAcctgPrefAndGroup = delegator.findAll("PartyAcctgPrefAndGroup");
+iter = partyAcctgPrefAndGroup.iterator();
+while (iter.hasNext()) {
+ group = iter.next()
+ partyAcctgPrefAndGroupList.add(["key":group.partyId,"value":group.groupName]);
+}
+globalContext.PartyAcctgPrefAndGroupList = partyAcctgPrefAndGroupList;
+//hiddenFileds
+hiddenFields = [];
+hiddenFields.add([name:"userPrefTypeId", value:"ORGANIZATION_PARTY"]);
+hiddenFields.add([name:"userPrefGroupTypeId", value:"GLOBAL_PREFERENCES"]);
+globalContext.hiddenFields = hiddenFields;
+
Propchange: ofbiz/trunk/applications/commonext/script/changeOrgPartyId.groovy
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/commonext/script/changeOrgPartyId.groovy
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/applications/commonext/script/changeOrgPartyId.groovy
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: ofbiz/trunk/applications/commonext/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/widget/CommonScreens.xml?rev=752416&r1=752415&r2=752416&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/applications/commonext/widget/CommonScreens.xml Wed Mar 11 10:17:26 2009
@@ -42,7 +42,16 @@
<set field="line.urlText" value="[${userLogin.userLoginId}]"/>
<set field="line.url" value="/partymgr/control/viewprofile?partyId=${userLogin.partyId}"/>
<set field="layoutSettings.topLines[]" from-field="line" global="true"/>
- <set field="layoutSettings.topLines[]" value="${uiLabelMap.CommonDefaultOrganizationPartyId} : ${defaultOrganizationPartyGroupName} [${defaultOrganizationPartyId}]" global="true"/>
+ <script location="component://commonext/script/changeOrgPartyId.groovy"/>
+ <set field="dropdown.hiddenFieldList" from-field="hiddenFields" global="true"/>
+ <set field="dropdown.formName" value="changeOrganization"/>
+ <set field="dropdown.action" value="setUserPreference?${lastParameters}"/>
+ <set field="dropdown.textBegin" value="${uiLabelMap.CommonDefaultOrganizationPartyId} :"/>
+ <set field="dropdown.dropDownList" from-field="PartyAcctgPrefAndGroupList"/>
+ <set field="dropdown.selectionName" value="userPrefValue"/>
+ <set field="dropdown.selectedKey" value="${defaultOrganizationPartyId}"/>
+ <set field="dropdown.textEnd" value="[${defaultOrganizationPartyId}]"/>
+ <set field="layoutSettings.topLines[]" from-field="dropdown" global="true"/>
</actions>
<widgets>
<include-screen name="GlobalDecorator" location="component://common/widget/CommonScreens.xml"/>
Modified: ofbiz/trunk/framework/common/webcommon/includes/header.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/header.ftl?rev=752416&r1=752415&r2=752416&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/header.ftl (original)
+++ ofbiz/trunk/framework/common/webcommon/includes/header.ftl Wed Mar 11 10:17:26 2009
@@ -81,6 +81,7 @@
${extraHead}
</#list>
</#if>
+ <#if lastParameters?exists><#assign parametersURL = "&" + lastParameters></#if>
</head>
<#if layoutSettings.headerImageLinkUrl?exists>
<#assign logoLinkURL = "${layoutSettings.headerImageLinkUrl}">
@@ -107,6 +108,8 @@
<li>
<#if topLine.text?exists>
${topLine.text}<a href="<@o...@ofbizUrl>">${topLine.urlText?if_exists}</a>
+ <#elseif topLine.dropDownList?exists>
+ <#include "component://common/webcommon/includes/insertDropDown.ftl"/>
<#else>
${topLine?if_exists}
</#if>
@@ -118,7 +121,7 @@
<li class="control-area">
<p class="collapsed">
<a href="<@o...@ofbizUrl>">${uiLabelMap.CommonLogout}</a>
- <a href="setUserPreference?userPrefGroupTypeId=GLOBAL_PREFERENCES&userPrefTypeId=COMPACT_HEADER&userPrefValue=N"> </a>
+ <a href="${setPreferenceMain?if_exists}?userPrefGroupTypeId=GLOBAL_PREFERENCES&userPrefTypeId=COMPACT_HEADER&userPrefValue=N${StringUtil.wrapString(parametersURL?if_exists)}"> </a>
</p>
</li>
<#else>
@@ -136,12 +139,14 @@
<#if userLogin?exists>
<p class="expanded">
<a href="<@o...@ofbizUrl>">${uiLabelMap.CommonLogout}</a>
- <a href="setUserPreference?userPrefGroupTypeId=GLOBAL_PREFERENCES&userPrefTypeId=COMPACT_HEADER&userPrefValue=Y"> </a>
+ <a href="${setPreferenceMain?if_exists}?userPrefGroupTypeId=GLOBAL_PREFERENCES&userPrefTypeId=COMPACT_HEADER&userPrefValue=Y${StringUtil.wrapString(parametersURL?if_exists)}"> </a>
</p>
<#if layoutSettings.topLines?has_content>
<#list layoutSettings.topLines as topLine>
<#if topLine.text?exists>
- <p>${topLine.text}<a href="${topLine.url?if_exists}&externalLoginKey=${externalLoginKey}">${topLine.urlText?if_exists}</a></p>
+ <p>${topLine.text}<a href="${topLine.url?if_exists}&externalLoginKey=${externalLoginKey}">${topLine.urlText?if_exists}</a></p>
+ <#elseif topLine.dropDownList?exists>
+ <p><#include "component://common/webcommon/includes/insertDropDown.ftl"/></p>
<#else>
<p>${topLine?if_exists}</p>
</#if>
Added: ofbiz/trunk/framework/common/webcommon/includes/insertDropDown.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/insertDropDown.ftl?rev=752416&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/insertDropDown.ftl (added)
+++ ofbiz/trunk/framework/common/webcommon/includes/insertDropDown.ftl Wed Mar 11 10:17:26 2009
@@ -0,0 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<#--
+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.
+-->
+
+<form method="post" action="<@o...@ofbizUrl>" onSubmit="javascript:submitFormDisableSubmits(this)" name="${topLine.formName?if_exists}" id="${topLine.formName?if_exists}">
+${StringUtil.wrapString(topLine.textBegin?if_exists)}
+<#assign listSize = topLine.dropDownList.size()>
+ <#if topLine.dropDownList.size() gt 1>
+ <#if topLine.hiddenFieldList?exists>
+ <#list topLine.hiddenFieldList as field>
+ <input type="hidden" name="${field.name}" value="${field.value}"/>
+ </#list>
+ </#if>
+ <select name="${topLine.selectionName?if_exists}" onChange="javascript:document.${topLine.formName?if_exists}.submit();">
+ <#list topLine.dropDownList as option>
+ <option <#if option.key == topLine.selectedKey >selected="selected"</#if> value="${option.key?if_exists}">${option.value?if_exists}</option>
+ </#list>
+ </select>
+<#else>
+ ${topLine.dropDownList[0].value?if_exists}
+</#if>
+${StringUtil.wrapString(topLine.textEnd?if_exists)}
+</form>
Propchange: ofbiz/trunk/framework/common/webcommon/includes/insertDropDown.ftl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/framework/common/webcommon/includes/insertDropDown.ftl
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/framework/common/webcommon/includes/insertDropDown.ftl
------------------------------------------------------------------------------
svn:mime-type = text/plain