001: /*
002: * JFolder, Copyright 2001-2006 Gary Steinmetz
003: *
004: * Distributable under LGPL license.
005: * See terms of license at gnu.org.
006: */
007:
008: package org.jfolder.console.web.dictionary;
009:
010: //base classes
011: import java.io.IOException;
012: import java.net.URLEncoder;
013:
014: //project specific classes
015: import org.jfolder.common.UnexpectedSystemException;
016: import org.jfolder.common.utils.web.ParameterSet;
017: import org.jfolder.console.base.ConsolePageParameters;
018:
019: //other classes
020:
021: public class ConceptTagDictionaryFrameContext extends
022: BaseConceptTagDictionaryContext {
023:
024: protected ConceptTagDictionaryFrameContext(ParameterSet inPs) {
025: //
026: super (inPs);
027: }
028:
029: public String getFromPage() {
030: return ConsolePageParameters.SERVLET_DICTIONARY_FRAME;
031: }
032:
033: public String getHandle() {
034: return NULL_HANDLE;
035: }
036:
037: public String getHandleExtension() {
038: throw new UnexpectedSystemException(
039: "This function should not be called in this class");
040: }
041:
042: protected void renderConsolePage() throws IOException {
043:
044: ParameterSet ps = getParameterSet();
045:
046: //
047: String srcCategory = ConsolePageParameters.SERVLET_DICTIONARY_CATEGORY;
048: String srcIndex = ConsolePageParameters.SERVLET_DICTIONARY_INDEX;
049: String srcDisplay = ConsolePageParameters.SERVLET_DICTIONARY_DISPLAY;
050: //
051: if (ps.isParameterString(PARAMETER__PREF_HANDLE)) {
052: String prefHandle = ps.getParameter(PARAMETER__PREF_HANDLE);
053: srcIndex = srcIndex + "?" + PARAMETER__PREF_HANDLE + "="
054: + URLEncoder.encode(prefHandle);
055: }
056: //
057: if (ps.isParameterString(PARAMETER__PREF_HANDLE)) {
058: String prefHandle = ps.getParameter(PARAMETER__PREF_HANDLE);
059: if (ps.isParameterString(PARAMETER__CT_NS)
060: && ps.isParameterString(PARAMETER__CT_NAME)) {
061: //
062: String ctNs = ps.getParameter(PARAMETER__CT_NS);
063: String ctName = ps.getParameter(PARAMETER__CT_NAME);
064: //
065: srcDisplay = srcDisplay + "?" + PARAMETER__PREF_HANDLE
066: + "=" + URLEncoder.encode(prefHandle) + "&"
067: + PARAMETER__CT_NS + "="
068: + URLEncoder.encode(ctNs) + "&"
069: + PARAMETER__CT_NAME + "="
070: + URLEncoder.encode(ctName);
071: } else if (ps.isParameterString(PARAMETER__CT_NS)) {
072: String ctNs = ps.getParameter(PARAMETER__CT_NS);
073: //
074: srcDisplay = srcDisplay + "?" + PARAMETER__PREF_HANDLE
075: + "=" + URLEncoder.encode(prefHandle) + "&"
076: + PARAMETER__CT_NS + "="
077: + URLEncoder.encode(ctNs);
078: } else if (ps.isParameterString(PARAMETER__CT_NAME)) {
079: String ctName = ps.getParameter(PARAMETER__CT_NAME);
080: //
081: srcDisplay = srcDisplay + "?" + PARAMETER__PREF_HANDLE
082: + "=" + URLEncoder.encode(prefHandle) + "&"
083: + PARAMETER__CT_NAME + "="
084: + URLEncoder.encode(ctName);
085: }
086: }
087:
088: printAndIndent("<html>");
089: printAndIndent("<head>");
090: simpleAndPrint("<title>JFolder</title>");
091: revertAndPrint("</head>");
092: printAndIndent("<frameset cols=\"25%,75%\">");
093: printAndIndent("<frameset rows=\"40%,60%\">");
094: simpleAndPrint("<frame name=\"" + TARGET__CATEGORY
095: + "\" src=\"" + srcCategory + "\"/>");
096: simpleAndPrint("<frame name=\"" + TARGET__INDEX + "\" src=\""
097: + srcIndex + "\"/>");
098: revertAndPrint("</frameset>");
099: simpleAndPrint("<frame name=\"" + TARGET__DISPLAY + "\" src=\""
100: + srcDisplay + "\"/>");
101: revertAndPrint("</frameset>");
102: revertAndPrint("</html>");
103: }
104: }
|