1 25 26 package net.killingar.forum.actions.hotlist; 27 28 import net.killingar.forum.internal.Area; 29 import webwork.action.ParameterAware; 30 31 import java.util.Map ; 32 33 public class Current extends ActionHotlistSupport implements ParameterAware 34 { 35 Map parameters; 36 37 public void setParameters(Map map) { this.parameters = map; } 38 39 public void prepare() throws Exception 40 { 41 super.prepare(); 42 43 if (parameters.containsKey("save")) 44 { 45 Area hotlist[][] = new Area[2][]; 46 47 for (int system = 0; system < 2; system++) 48 { 49 hotlist[system] = areaHotlistmgr.getFlatHotlist(system); 50 for (int i = 0; i < hotlist[system].length; i++) 51 { 52 String key = Long.toString(hotlist[system][i].ID); 53 if (parameters.containsKey(key)) 54 { 55 String [] values = (String [])parameters.get(key); 56 57 if (values != null && values.length != 0) 58 { 59 if (values[0].equals("passive")) 60 { 61 if (areaHotlistmgr.hasArea(hotlist[system][i].ID, 0)) 62 { 63 areaHotlistmgr.removeArea(hotlist[system][i].ID, 0); 64 areaHotlistmgr.addArea(hotlist[system][i].ID, 1); 65 } 66 } 67 else if (values[0].equals("active")) 68 { 69 if (areaHotlistmgr.hasArea(hotlist[system][i].ID, 1)) 70 { 71 areaHotlistmgr.removeArea(hotlist[system][i].ID, 1); 72 areaHotlistmgr.addArea(hotlist[system][i].ID, 0); 73 } 74 } 75 } 76 } 77 } 78 } 79 } 80 super.prepare(); 81 } 82 83 protected String doExecute() 84 { 85 return SUCCESS; 86 } 87 } 88 | Popular Tags |