1 package org.tigris.scarab.actions.admin; 2 3 48 49 import org.apache.fulcrum.parser.ParameterParser; 51 import org.apache.turbine.RunData; 52 import org.apache.turbine.TemplateContext; 53 import org.tigris.scarab.actions.base.RequireLoginFirstAction; 54 import org.tigris.scarab.om.GlobalParameter; 55 import org.tigris.scarab.om.GlobalParameterManager; 56 import org.tigris.scarab.om.GlobalParameterPeer; 57 58 64 public class GlobalEmailSettings 65 extends RequireLoginFirstAction 66 { 67 private static final String [] NAMES = 68 {GlobalParameter.EMAIL_ENABLED, 69 GlobalParameter.EMAIL_INCLUDE_ISSUE_DETAILS, 70 GlobalParameter.EMAIL_ALLOW_MODULE_OVERRIDE}; 71 72 public void doSave(RunData data, TemplateContext context) 73 throws Exception 74 { 75 ParameterParser pp = data.getParameters(); 76 String name = null; 77 for (int i=0; i < NAMES.length; i++) 78 { 79 name = NAMES[i]; 80 GlobalParameterManager.setBoolean(name, pp.getBoolean(name)); 81 } 82 if (!GlobalParameterManager.getBoolean(name)) 84 { 85 String sql = "delete from " + GlobalParameterPeer.TABLE_NAME 87 + " where " + GlobalParameterPeer.NAME + "='" + name 88 + "' and module_id is not null"; 89 GlobalParameterPeer.executeStatement(sql); 90 } 91 92 getScarabRequestTool(context).setConfirmMessage(DEFAULT_MSG); 93 } 94 } 95 | Popular Tags |