/******************************************************************************* * Copyright 2014 Federal Chancellery Austria * MOA-ID has been developed in a cooperation between BRZ, the Federal * Chancellery Austria - ICT staff unit, and Graz University of Technology. * * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by * the European Commission - subsequent versions of the EUPL (the "Licence"); * You may not use this work except in compliance with the Licence. * You may obtain a copy of the Licence at: * http://www.osor.eu/eupl/ * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. * * This product combines work with different licenses. See the "NOTICE" text * file for details on the various modules and licenses. * The "NOTICE" text file is part of the distribution. Any derivative works * that you distribute must include a readable copy of the "NOTICE" text file. *******************************************************************************/ package at.gv.egovernment.moa.id.util; import java.util.HashMap; import java.util.Map; import java.util.Set; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; import at.gv.egovernment.moa.util.MiscUtil; public class FormBuildUtils { private static Map defaultmap = null; public static String MAIN_BACKGROUNDCOLOR = "#MAIN_BACKGOUNDCOLOR#"; public static String MAIN_COLOR = "#MAIN_COLOR#"; public static String HEADER_BACKGROUNDCOLOR = "#HEADER_BACKGROUNDCOLOR#"; public static String HEADER_COLOR = "#HEADER_COLOR#"; public static String BUTTON_BACKGROUNDCOLOR = "#BUTTON_BACKGROUNDCOLOR#"; public static String BUTTON_BACKGROUNDCOLOR_FOCUS = "#BUTTON_BACKGROUNDCOLOR_FOCUS#"; public static String BUTTON_COLOR = "#BUTTON_COLOR#"; public static String FONTFAMILY = "#FONTTYPE#"; public static String HEADER_TEXT = "#HEADER_TEXT#"; public static String REDIRECTTARGET = "#REDIRECTTARGET#"; public static String APPLET_HEIGHT = "#APPLETHEIGHT#"; public static String APPLET_WIDTH = "#APPLETWIDTH#"; private static String MANDATEVISIBLE = "#MANDATEVISIBLE#"; private static String MANDATECHECKED = "#MANDATECHECKED#"; private static String STORKVISIBLE = "#STORKVISIBLE#"; private static final String TEMPLATEVISIBLE = " display: none"; private static final String TEMPLATEDISABLED = "disabled=\"true\""; private static final String TEMPLATECHECKED = "checked=\"true\""; private static final String TEMPLATE_ARIACHECKED = "aria-checked="; static { if (defaultmap == null) { defaultmap = new HashMap(); defaultmap.put(MAIN_BACKGROUNDCOLOR, "#F7F8F7"); defaultmap.put(MAIN_COLOR, "#000000"); defaultmap.put(HEADER_BACKGROUNDCOLOR, "#C3D2E2"); defaultmap.put(HEADER_COLOR, "#000000"); defaultmap.put(HEADER_TEXT, "Login"); defaultmap.put(BUTTON_BACKGROUNDCOLOR, "#EBEBEB"); defaultmap.put(BUTTON_BACKGROUNDCOLOR_FOCUS, "#EBEBEB"); defaultmap.put(BUTTON_COLOR, "#000000"); defaultmap.put(FONTFAMILY, "Verdana,Geneva,Arial,sans-serif"); defaultmap.put(REDIRECTTARGET, "_top"); } } public static String customiceLayoutBKUSelection(String value, boolean isShowMandateCheckbox, boolean isOnlyMandateAllowed, Map map, boolean showStorkLogin) { if (isShowMandateCheckbox) value = value.replace(MANDATEVISIBLE, ""); else value = value.replace(MANDATEVISIBLE, TEMPLATEVISIBLE); if (isOnlyMandateAllowed) { value = value.replace(MANDATECHECKED, TEMPLATECHECKED + " " + TEMPLATEDISABLED + " " + TEMPLATE_ARIACHECKED + "\"true\""); } else value = value.replace(MANDATECHECKED, TEMPLATE_ARIACHECKED + "\"false\""); if (showStorkLogin) value = value.replace(STORKVISIBLE, ""); else value = value.replace(STORKVISIBLE, TEMPLATEVISIBLE); String fonttype = map.get(FONTFAMILY); if (MiscUtil.isNotEmpty(fonttype)) { String[] fonttypeList = fonttype.split(","); String fonttypeformated = "\"" + fonttypeList[0].trim().replace("\"", "") + "\""; for (int i=1; i elements = map.keySet(); for (String element: elements) { value = value.replace(element, map.get(element)); } return value; } public static Map getDefaultMap() { return defaultmap; } }