Index: lams_central/src/java/org/lamsfoundation/lams/web/tag/HelpTag.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/tag/HelpTag.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_central/src/java/org/lamsfoundation/lams/web/tag/HelpTag.java 21 Sep 2006 05:34:15 -0000 1.1 @@ -0,0 +1,150 @@ +/*************************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * ***********************************************************************/ +/* $$Id: HelpTag.java,v 1.1 2006/09/21 05:34:15 mseaton Exp $$ */ +package org.lamsfoundation.lams.web.tag; + +import java.io.IOException; +import java.util.Locale; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspWriter; +import javax.servlet.jsp.tagext.TagSupport; + +import org.apache.log4j.Logger; + +import org.lamsfoundation.lams.authoring.web.AuthoringConstants; +import org.lamsfoundation.lams.tool.service.*; +import org.lamsfoundation.lams.tool.IToolVO; +import org.lamsfoundation.lams.web.filter.LocaleFilter; + +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +/** + * Output the required css based in the user's details. Will output one or more + * lines. If the user has a theme then exports the default and then the user's + * style sheet. If the user doesn't have a theme then it just exports + * the default. This way, if the user's entry points to a stylesheet that + * doesn't exist, the default one is always available. + * + * @jsp.tag name="help" + * body-content="empty" + * display-name="Help tag" + * description="Help tag" + * + * @author Fiona Malikoff + */ +public class HelpTag extends TagSupport { + + private static final Logger log = Logger.getLogger(HelpTag.class); + private String module = null; + private String toolSignature = null; + + /** + * + */ + public HelpTag() { + super(); + } + + public int doStartTag() throws JspException { + try { + HttpSession session = ((HttpServletRequest) this.pageContext.getRequest()).getSession(); + + String language = null; + String country = null; + String helpURL = null; + String fullURL = null; + String toolSig = getToolSignature(); + + JspWriter writer = pageContext.getOut(); + ILamsToolService toolService = (ILamsToolService) getContext().getBean(AuthoringConstants.TOOL_SERVICE_BEAN_NAME); + IToolVO tool = toolService.getToolBySignature(toolSig); + + helpURL = tool.getHelpUrl(); + + Locale locale = (Locale) session.getAttribute(LocaleFilter.PREFERRED_LOCALE_KEY); + if ( locale != null ) { + language = locale.getLanguage(); + country = locale.getCountry(); + } + + fullURL = helpURL + module + "#" + toolSig + module + "-" + language + country; + + writer.println("?"); + + } catch (IOException e) { + log.error("HelpTag unable to write out due to IOException.", e); + // don't throw a JSPException as we want the system to still function. + } + return SKIP_BODY; + } + + public int doEndTag() { + return EVAL_PAGE; + } + /** + * @return module + * + * @jsp.attribute required="true" + * rtexprvalue="true" + * description="Module Name" + */ + public String getModule() { + return module; + } + + /** + * + * @param module + */ + public void setModule(String module) { + this.module = module; + } + + private WebApplicationContext getContext() { + WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext()); + return ctx; + } + + /** + * @return + * + * @jsp.attribute required="true" + * rtexprvalue="true" + * description="Tool Signature" + */ + public String getToolSignature() { + return toolSignature; + } + + /** + * + * @param toolSignature + */ + public void setToolSignature(String toolSignature) { + this.toolSignature = toolSignature; + } + +} Index: lams_central/web/WEB-INF/lams.tld =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/WEB-INF/Attic/lams.tld,v diff -u -r1.27 -r1.28 --- lams_central/web/WEB-INF/lams.tld 7 Sep 2006 01:34:57 -0000 1.27 +++ lams_central/web/WEB-INF/lams.tld 21 Sep 2006 05:34:15 -0000 1.28 @@ -64,6 +64,34 @@ + Help tag + Help tag + + + help + org.lamsfoundation.lams.web.tag.HelpTag + empty + + + Help tag + module + true + + true + + + + Help tag + toolSignature + true + + true + + + + + + Output a random number for the learner and passon flash movies to communicate directly. generate unique ID @@ -353,6 +381,6 @@ DefineLater /WEB-INF/tags/DefineLater.tag - + Index: lams_tool_nb/web/WEB-INF/lams.tld =================================================================== RCS file: /usr/local/cvsroot/lams_tool_nb/web/WEB-INF/Attic/lams.tld,v diff -u -r1.11 -r1.12 --- lams_tool_nb/web/WEB-INF/lams.tld 20 Sep 2006 01:37:25 -0000 1.11 +++ lams_tool_nb/web/WEB-INF/lams.tld 21 Sep 2006 05:34:16 -0000 1.12 @@ -64,6 +64,17 @@ + Help tag + Help tag + + + help + org.lamsfoundation.lams.web.tag.HelpTag + empty + + + + Output a random number for the learner and passon flash movies to communicate directly. generate unique ID @@ -353,6 +364,6 @@ DefineLater /WEB-INF/tags/DefineLater.tag - + Index: lams_tool_nb/web/authoring/authoring.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_nb/web/authoring/authoring.jsp,v diff -u -r1.13 -r1.14 --- lams_tool_nb/web/authoring/authoring.jsp 19 Sep 2006 08:33:07 -0000 1.13 +++ lams_tool_nb/web/authoring/authoring.jsp 21 Sep 2006 05:34:16 -0000 1.14 @@ -91,7 +91,7 @@
<%@ include file="../errorbox.jsp"%> - +