@Override public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { if (!Common.checkPerm(request, response, "managenetwork")) { return cpMessage(request, mapping, "cp_no_authority_management_operation"); } try { if (submitCheck(request, "networksubmit")) { Map<String, Object> network = (Map<String, Object>) getParameters(request, "network"); if (network != null) { Pattern pattern = Pattern.compile("[^a-z]", Pattern.CASE_INSENSITIVE); Pattern separatorPattern = Pattern.compile(","); String[] arr = null; Map<Integer, Integer> narr = null; int tempV = 0; for (Entry<String, Object> entry : network.entrySet()) { String type = entry.getKey(); Map<String, Object> values = (Map<String, Object>) entry.getValue(); for (Entry<String, Object> subEntry : values.entrySet()) { String key = subEntry.getKey(); String value = ""; value = ((String) subEntry.getValue()).trim(); if (value.indexOf(",") >= 0) { narr = new HashMap<Integer, Integer>(); arr = separatorPattern.split(value); for (String v : arr) { v = v.trim(); tempV = Common.intval(v); if (tempV != 0) narr.put(tempV, tempV); } value = Common.implode(narr, ","); } else if (pattern.matcher(value).matches()) { value = String.valueOf(Common.intval(value)); } values.put(key, value); } network.put(type, values); } Common.setData("network", network, false); cacheService.network_cache(); } return cpMessage(request, mapping, "do_success", "admincp.jsp?ac=network"); } } catch (Exception e1) { return showMessage(request, response, e1.getMessage()); } Map<String, Map<String, Object>> globalNetWork = Common.getCacheDate(request, response, "/data/cache/cache_network.jsp", "globalNetWork"); Map<String, String> orders = new HashMap<String, String>(); String[] types = new String[] {"blog", "pic", "thread", "poll", "event", "share"}; for (String type : types) { Map<String, Object> netWork = globalNetWork.get(type); if (netWork != null) { orders.put("order_" + type + "_" + netWork.get("order"), " selected"); orders.put("sc_" + type + "_" + netWork.get("sc"), " selected"); } } request.setAttribute("orders", orders); return mapping.findForward("network"); }
package cn.jcenterhome.web.action.admin;