1 31 32 package org.opencms.workplace.comparison; 33 34 import org.opencms.file.CmsPropertyDefinition; 35 import org.opencms.jsp.CmsJspActionElement; 36 import org.opencms.main.CmsException; 37 import org.opencms.widgets.CmsDisplayWidget; 38 import org.opencms.workplace.CmsWidgetDialog; 39 import org.opencms.workplace.CmsWidgetDialogParameter; 40 41 import java.util.ArrayList ; 42 43 import javax.servlet.http.HttpServletRequest ; 44 import javax.servlet.http.HttpServletResponse ; 45 import javax.servlet.jsp.PageContext ; 46 47 56 public class CmsFileInfoDialog extends CmsWidgetDialog { 57 58 59 public static final String KEY_PREFIX = "fileinfo"; 60 61 62 public static final String [] PAGES = {"page1"}; 63 64 65 private String m_path; 66 67 68 private String m_title; 69 70 75 public CmsFileInfoDialog(CmsJspActionElement jsp) { 76 77 super(jsp); 78 } 79 80 87 public CmsFileInfoDialog(PageContext context, HttpServletRequest req, HttpServletResponse res) { 88 89 this(new CmsJspActionElement(context, req, res)); 90 } 91 92 95 public void actionCommit() { 96 97 setCommitErrors(new ArrayList ()); 99 } 100 101 106 public String getPath() { 107 108 return m_path; 109 } 110 111 116 public String getTitle() { 117 118 return m_title; 119 } 120 121 126 public void setPath(String file) { 127 128 m_path = file; 129 } 130 131 136 public void setTitle(String title) { 137 138 m_title = title; 139 } 140 141 149 protected String createDialogHtml(String dialog) { 150 151 StringBuffer result = new StringBuffer (1024); 152 153 result.append(createWidgetTableStart()); 154 result.append(createWidgetErrorHeader()); 156 result.append(dialogBlockStart(key(Messages.GUI_HISTORY_FILEINFO_0))); 158 result.append(createWidgetTableStart()); 159 result.append(createDialogRowsHtml(0, 1)); 160 result.append(createWidgetTableEnd()); 161 result.append(dialogBlockEnd()); 162 163 result.append(createWidgetTableEnd()); 164 return result.toString(); 165 } 166 167 170 protected String defaultActionHtmlEnd() { 171 172 return ""; 173 } 174 175 178 protected void defineWidgets() { 179 180 initFileInfo(); 182 183 addWidget(new CmsWidgetDialogParameter(this, "path", PAGES[0], new CmsDisplayWidget())); 184 addWidget(new CmsWidgetDialogParameter(this, "title", PAGES[0], new CmsDisplayWidget())); 185 } 186 187 190 protected String [] getPageArray() { 191 192 return PAGES; 193 } 194 195 198 protected void initFileInfo() { 199 200 try { 201 m_path = getParamResource(); 203 m_title = getCms().readPropertyObject(m_path, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue(); 204 205 } catch (CmsException e) { 206 } 208 } 209 } | Popular Tags |