Update of /cvsroot/struts/dialogs/src/net/jspcontrols/collab In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/collab Added Files: MasterPageAction.java MyForwardAction.java TabControlAction.java TabControlActionInput.java TabControlActionView.java Log Message: --- NEW FILE: MasterPageAction.java --- package net.jspcontrols.collab; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.servlet.ServletContext; import java.util.Map; import java.util.HashMap; /** * */ public class MasterPageAction extends Action { static int[] monitor = new int[1]; public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { HttpSession session = httpServletRequest.getSession(); ServletContext srvCnt = session.getServletContext(); // TODO: Initialize from file, database or web.xml synchronized(monitor) { String[][] availableSections = (String[][]) srvCnt.getAttribute("availableSections"); // if (availableSections == null) { availableSections = new String[][] { {"mypages", "My Pages"}, {"projects", "Projects"}, {"news", "News"} }; srvCnt.setAttribute("availableSections", availableSections); session.setAttribute("section", availableSections[availableSections.length-1][0]); // } } return actionMapping.findForward("FORWARD"); } } --- NEW FILE: MyForwardAction.java --- package net.jspcontrols.collab; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * Created by IntelliJ IDEA. * User: mjouravlev * Date: Jul 7, 2005 * Time: 7:05:14 PM * To change this template use Options | File Templates. */ public class MyForwardAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return mapping.findForward("FORWARD"); } } --- NEW FILE: TabControlAction.java --- package net.jspcontrols.collab; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * Created by IntelliJ IDEA. * User: Mikus * Date: Jul 8, 2005 * Time: 12:52:36 AM * To change this template use Options | File Templates. */ public class TabControlAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); if (request.getParameter("section") != null) { String section = request.getParameter("section"); if (section == null) { // section = "news"; section = ""; } session.setAttribute("section", section); // Redirect to main page, append first sublevel ActionForward actionForward = mapping.findForward("MAINPAGE"); String actionPath = actionForward.getPath(); actionPath += "/" + section + "/dummy"; ActionForward actionRedirect = new ActionForward(actionForward.getName(), actionPath, true /* REDIRECT */ ); return actionRedirect; // Render phase: show all available tabs } else { return mapping.findForward("TABS"); } } } --- NEW FILE: TabControlActionInput.java --- package net.jspcontrols.collab; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.Action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** */ public class TabControlActionInput extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); String section = request.getParameter("section"); if (section == null) { section = "HOME"; } session.setAttribute("SECTION", section); // Redirect to main page if ("mypages".equals(section)) return mapping.findForward("MAINPAGE_MYPAGES"); else if ("projects".equals(section)) return mapping.findForward("MAINPAGE_PROJECTS"); else /*if ("news".equals(section))*/ return mapping.findForward("MAINPAGE_NEWS"); // return mapping.findForward("MAINPAGE"); } } --- NEW FILE: TabControlActionView.java --- package net.jspcontrols.collab; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * */ public class TabControlActionView extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); String section = (String) session.getAttribute("SECTION"); if (section == null) { section = "HOME"; session.setAttribute("SECTION", section); } // Render tabs according to current section return mapping.findForward("TABS"); } } |