1 7 package org.tigris.scarab.screens; 8 9 import java.util.ArrayList ; 10 11 import org.apache.turbine.RunData; 12 import org.apache.turbine.tool.TemplateLink; 13 import org.tigris.scarab.om.Module; 14 import org.tigris.scarab.om.ModuleManager; 15 import org.tigris.scarab.om.ScarabUser; 16 import org.tigris.scarab.util.Log; 17 import org.tigris.scarab.util.ScarabLink; 18 19 25 public class ModuleSwitchingLink extends ScarabLink 26 { 27 private RunData data; 28 29 public ModuleSwitchingLink(RunData data) 30 { 31 super(); 32 this.data = data; 33 init((Object )data); 34 } 35 36 39 public TemplateLink setPage(String moduleId) 40 { 41 String homePage = null; 42 try 43 { 44 Module module = ModuleManager 45 .getInstance(new Integer (moduleId)); 46 ScarabUser user = (ScarabUser)data.getUser(); 47 homePage = user.getHomePage(module); 48 } 49 catch (Exception e) 50 { 51 Log.get().error("Could not determine homepage", e); 52 homePage = "Index.vm"; 53 } 54 TemplateLink link = super.setPage(homePage, moduleId); 55 return link; 56 } 57 58 66 protected void addPair(ArrayList list, 67 String name, 68 String value) 69 { 70 int hah = 0; 71 Object [] tmp = new Object [2]; 72 73 tmp[0] = data.getParameters().convertAndTrim(name); 74 tmp[1] = value; 75 76 list.add(tmp); 77 } 78 79 } 80 81 | Popular Tags |