001: /*
002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/comparison/CmsPointerComparisonDialog.java,v $
003: * Date : $Date: 2008-02-27 12:05:55 $
004: * Version: $Revision: 1.6 $
005: *
006: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
007: * All rights reserved.
008: *
009: * This source code is the intellectual property of Alkacon Software GmbH.
010: * It is PROPRIETARY and CONFIDENTIAL.
011: * Use of this source code is subject to license terms.
012: *
013: * In order to use this source code, you need written permission from
014: * Alkacon Software GmbH. Redistribution of this source code, in modified
015: * or unmodified form, is not allowed unless written permission by
016: * Alkacon Software GmbH has been given.
017: *
018: * ALKACON SOFTWARE GMBH MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
019: * OF THIS SOURCE CODE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
020: * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
021: * PURPOSE, OR NON-INFRINGEMENT. ALKACON SOFTWARE GMBH SHALL NOT BE LIABLE FOR ANY
022: * DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
023: * THIS SOURCE CODE OR ITS DERIVATIVES.
024: *
025: * For further information about Alkacon Software GmbH, please see the
026: * company website: http://www.alkacon.com
027: */
028:
029: package org.opencms.workplace.comparison;
030:
031: import org.opencms.file.CmsFile;
032: import org.opencms.jsp.CmsJspActionElement;
033: import org.opencms.util.CmsUUID;
034: import org.opencms.workplace.CmsDialog;
035: import org.opencms.workplace.commons.CmsHistoryList;
036:
037: import javax.servlet.jsp.JspWriter;
038:
039: /**
040: * Provides a GUI for displaying two images.<p>
041: *
042: * @author Jan Baudisch
043: *
044: * @version $Revision: 1.6 $
045: *
046: * @since 6.0.0
047: */
048: public class CmsPointerComparisonDialog extends CmsDialog {
049:
050: /** Parameter value for the structure Id of the first file. */
051: private String m_paramId1;
052:
053: /** Parameter value for the structure Id of the second file. */
054: private String m_paramId2;
055:
056: /** Parameter value for the version of the first file. */
057: private String m_paramVersion1;
058:
059: /** Parameter value for the version of the second file. */
060: private String m_paramVersion2;
061:
062: /**
063: * Default constructor.<p>
064: *
065: * @param jsp an initialized JSP action element
066: */
067: public CmsPointerComparisonDialog(CmsJspActionElement jsp) {
068:
069: super (jsp);
070: }
071:
072: /**
073: * Performs the dialog actions depending on the initialized action and displays the dialog form.<p>
074: *
075: * @throws Exception if writing to the JSP out fails
076: */
077: public void displayDialog() throws Exception {
078:
079: if (getAction() == ACTION_CANCEL) {
080: actionCloseDialog();
081: }
082: CmsFile resource1 = CmsResourceComparisonDialog.readFile(
083: getCms(), new CmsUUID(getParamId1()),
084: getParamVersion1());
085: CmsFile resource2 = CmsResourceComparisonDialog.readFile(
086: getCms(), new CmsUUID(getParamId2()),
087: getParamVersion2());
088: String linkTarget1 = new String(resource1.getContents());
089: String linkTarget2 = new String(resource2.getContents());
090: JspWriter out = getJsp().getJspContext().getOut();
091: out
092: .println(dialogBlockStart(key(Messages.GUI_COMPARE_CONTENT_0)));
093: out.println(dialogContentStart(null));
094: out
095: .println("<table cellpadding='0' cellspacing='0' border='0' class='maxwidth'><tr align='center'><th>");
096: out.println(key(Messages.GUI_COMPARE_VERSION_1,
097: new String[] { CmsHistoryList.getDisplayVersion(
098: m_paramVersion1, getLocale()) }));
099: out.println("</th><th>");
100: out.println(key(Messages.GUI_COMPARE_VERSION_1,
101: new String[] { CmsHistoryList.getDisplayVersion(
102: m_paramVersion2, getLocale()) }));
103: out.println("</th></tr>");
104: out.print("<tr><td><a href=\"");
105: out.print(linkTarget1);
106: out.print("\">");
107: out.print(linkTarget1);
108: out.print("</a>");
109: out.print("</td><td width='50%'>\n");
110: out.print("<a href=\"");
111: out.print(linkTarget2);
112: out.print("\">");
113: out.print(linkTarget2);
114: out.print("</a>");
115: out.println("</td></td></table>");
116: out.println(dialogBlockEnd());
117: out.println(dialogContentEnd());
118: out.println(dialogEnd());
119: out.println(bodyEnd());
120: out.println(htmlEnd());
121: }
122:
123: /**
124: * Returns the paramId1.<p>
125: *
126: * @return the paramId1
127: */
128: public String getParamId1() {
129:
130: return m_paramId1;
131: }
132:
133: /**
134: * Returns the paramId2.<p>
135: *
136: * @return the paramId2
137: */
138: public String getParamId2() {
139:
140: return m_paramId2;
141: }
142:
143: /**
144: * Returns the paramVersion1.<p>
145: *
146: * @return the paramVersion1
147: */
148: public String getParamVersion1() {
149:
150: return m_paramVersion1;
151: }
152:
153: /**
154: * Returns the paramVersion2.<p>
155: *
156: * @return the paramVersion2
157: */
158: public String getParamVersion2() {
159:
160: return m_paramVersion2;
161: }
162:
163: /**
164: * Sets the paramId1.<p>
165: *
166: * @param paramId1 the paramId1 to set
167: */
168: public void setParamId1(String paramId1) {
169:
170: m_paramId1 = paramId1;
171: }
172:
173: /**
174: * Sets the paramId2.<p>
175: *
176: * @param paramId2 the paramId2 to set
177: */
178: public void setParamId2(String paramId2) {
179:
180: m_paramId2 = paramId2;
181: }
182:
183: /**
184: * Sets the paramVersion1.<p>
185: *
186: * @param paramVersion1 the paramVersion1 to set
187: */
188: public void setParamVersion1(String paramVersion1) {
189:
190: m_paramVersion1 = paramVersion1;
191: }
192:
193: /**
194: * Sets the paramVersion2.<p>
195: *
196: * @param paramVersion2 the paramVersion2 to set
197: */
198: public void setParamVersion2(String paramVersion2) {
199:
200: m_paramVersion2 = paramVersion2;
201: }
202: }
|