⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main-decorator.bsh

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 BSH
字号:
/* * Copyright (C) 2006  Open Source Strategies, Inc. *  * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. *  * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. *  * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA *//* *  Copyright (c) 2005-2006 Open Source Strategies, Inc. *  Copyright (c) 2003-2005 The Open For Business Project - www.ofbiz.org * *  Permission is hereby granted, free of charge, to any person obtaining a *  copy of this software and associated documentation files (the "Software"), *  to deal in the Software without restriction, including without limitation *  the rights to use, copy, modify, merge, publish, distribute, sublicense, *  and/or sell copies of the Software, and to permit persons to whom the *  Software is furnished to do so, subject to the following conditions: * *  The above copyright notice and this permission notice shall be included *  in all copies or substantial portions of the Software. * *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *  THE USE OR OTHER DEALINGS IN THE SOFTWARE. */// @author Leon Torres (leon@opensourcestrategies.com)// This file is called by main-decorator and is executed for most screens. Its purpose is to retrieve resources common to all screens.import javolution.util.FastMap;import org.ofbiz.base.util.UtilProperties;import org.ofbiz.base.util.UtilMisc;import com.opensourcestrategies.crmsfa.party.ViewPrefWorker;// configuration properties (if more property files are needed, use putAll() to concatenate the underlying hashmaps of Properties)// TODO: this is also placed in global context in CommonScreens.xml, so is this redundant? Can we do "globalContext.configProperties" in ftl?configProperties = UtilProperties.getProperties("crmsfa.properties");context.put("configProperties", configProperties);// some properties are lists, which have to be split (this split method also works in ftl, but should be done in a script)javascriptFiles = configProperties.get("crmsfa.files.javascript").split("\\s*,\\s*");stylesheetFiles = configProperties.get("crmsfa.files.stylesheets").split("\\s*,\\s*");context.put("javascriptFiles", javascriptFiles);context.put("stylesheetFiles", stylesheetFiles);// userLoginuserLogin = request.getAttribute("userLogin");if (userLogin == null) { // this should *never* happen    return;}context.put("userLogin", userLogin);// securitysecurity = request.getAttribute("security"); context.put("security", security);// external login keyextLogin = request.getAttribute("externalLoginKey"); if (extLogin != null) {    context.put("externalKeyParam", "externalLoginKey=" + requestAttributes.get("externalLoginKey"));}// context pathcontext.put("contextPath", request.getContextPath());// decide what sections to display according to securityaccountsView = false;if (security.hasEntityPermission("CRMSFA_ACCOUNTS", "_VIEW", userLogin)) {    accountsView = true;} contactsView = false;if (security.hasEntityPermission("CRMSFA_CONTACTS", "_VIEW", userLogin)) {    contactsView = true;} opportunitiesView = false;if (security.hasEntityPermission("CRMSFA_OPPS", "_VIEW", userLogin)) {    opportunitiesView = true;} leadsView = false;if (security.hasEntityPermission("CRMSFA_LEADS", "_VIEW", userLogin)) {    leadsView = true;} casesView = false;if (security.hasEntityPermission("CRMSFA_CASES", "_VIEW", userLogin)) {    casesView = true;}activitiesView = true;forecastsView = true;partnersView = false;quotesView = false;if (security.hasEntityPermission("CRMSFA_QUOTES", "_VIEW", userLogin)) {    quotesView = true;}ordersView = false;if (security.hasEntityPermission("CRMSFA_ORDER", "_VIEW", userLogin)) {    ordersView = true;}marketingView = false;if (security.hasEntityPermission("CRMSFA_MKTG", "_VIEW", userLogin)) {    marketingView = true;}// mapping for screens brought in from ofbiz - depending on their headerItems, we set the sections in our CRM applicationif (context.get("headerItem") != null) {    headerItemSections = UtilProperties.getProperties("headerItemSections.properties");    item = "headerItem." + context.get("headerItem");    context.put("sectionName", headerItemSections.get(item));    context.put("pageTitleLabel", headerItemSections.get(item + ".pageTitleLabel"));    context.put("sectionHeaderUiLabel", headerItemSections.get(item + ".sectionHeaderUiLabel"));}// define sectionsuiLabelMap = context.get("uiLabelMap");sections = new ArrayList();sections.add(UtilMisc.toMap("uiLabel", uiLabelMap.get("CrmMyHome"), "uri", "/myHomeMain", "sectionName", "myHome", "hasPermission", true));sections.add(UtilMisc.toMap("uiLabel", uiLabelMap.get("CrmLeads"), "uri", "/leadsMain", "sectionName", "leads", "hasPermission", leadsView));sections.add(UtilMisc.toMap("uiLabel", uiLabelMap.get("CrmContacts"), "uri", "/contactsMain", "sectionName", "contacts", "hasPermission", contactsView));sections.add(UtilMisc.toMap("uiLabel", uiLabelMap.get("CrmAccounts"), "uri", "/accountsMain", "sectionName", "accounts", "hasPermission", accountsView));sections.add(UtilMisc.toMap("uiLabel", uiLabelMap.get("CrmCases"), "uri", "/casesMain", "sectionName", "cases", "hasPermission", casesView));sections.add(UtilMisc.toMap("uiLabel", uiLabelMap.get("CrmActivities"), "uri", "/activitiesMain", "sectionName", "activities", "hasPermission", activitiesView));sections.add(UtilMisc.toMap("uiLabel", uiLabelMap.get("CrmPartners"), "uri", "/partnersMain", "sectionName", "partners", "hasPermission", partnersView));sections.add(UtilMisc.toMap("uiLabel", uiLabelMap.get("CrmOpportunities"), "uri", "/opportunitiesMain", "sectionName", "opportunities", "hasPermission", opportunitiesView));sections.add(UtilMisc.toMap("uiLabel", uiLabelMap.get("OrderOrderQuotes"), "uri", "/quotesMain", "sectionName", "quotes", "hasPermission", quotesView));sections.add(UtilMisc.toMap("uiLabel", uiLabelMap.get("OrderOrders"), "uri", "/ordersMain", "sectionName", "orders", "hasPermission", ordersView));sections.add(UtilMisc.toMap("uiLabel", uiLabelMap.get("CrmForecasts"), "uri", "/forecastsMain", "sectionName", "forecasts", "hasPermission", forecastsView));sections.add(UtilMisc.toMap("uiLabel", uiLabelMap.get("CrmMarketing"), "uri", "/marketingMain", "sectionName", "marketing", "hasPermission", marketingView));// show the ofbiz tab last if so desiredshowOfbizTab = configProperties.get("crmsfa.tab.ofbiz.show");if (showOfbizTab != null) {    showOfbizTab = (showOfbizTab.trim().toLowerCase().equals("true") ?  true : false );    if (showOfbizTab) {        ofbizTabLabel = configProperties.get("crmsfa.tab.ofbiz.label");        ofbizTabTarget = configProperties.get("crmsfa.tab.ofbiz.target");        sections.add(UtilMisc.toMap("uiLabel", ofbizTabLabel, "uri", ofbizTabTarget, "sectionName", "ofbiz", "hasPermission", true, "isExternal", true));    }}//NOTE: ModelScreenWidget.java:545 uses context.get("sections"), so this would crash if we put "sections" into the map.  Hence the name "crmSections"context.put("crmSections", sections);// user view preferences for this sectionviewPreferences = ViewPrefWorker.getViewPreferencesByLocation(userLogin, "crmsfa", context.get("sectionName"));context.get("globalContext").put("viewPreferences", viewPreferences);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -