1 31 32 package org.opencms.workplace.tools.content.check; 33 34 import org.opencms.file.CmsResource; 35 import org.opencms.jsp.CmsJspActionElement; 36 import org.opencms.workplace.list.A_CmsListExplorerDialog; 37 import org.opencms.workplace.list.CmsListItem; 38 import org.opencms.workplace.list.CmsListItemDetails; 39 import org.opencms.workplace.list.CmsListItemDetailsFormatter; 40 import org.opencms.workplace.list.CmsListMetadata; 41 42 import java.util.Iterator ; 43 import java.util.List ; 44 import java.util.Map ; 45 46 import javax.servlet.http.HttpServletRequest ; 47 import javax.servlet.http.HttpServletResponse ; 48 import javax.servlet.jsp.PageContext ; 49 50 59 public class CmsContentCheckFilesDialog extends A_CmsListExplorerDialog { 60 61 62 public static final String LIST_DETAIL_ERROR = "de"; 63 64 65 public static final String LIST_DETAIL_WARNING = "dw"; 66 67 68 public static final String LIST_ID = "checkcontent"; 69 70 71 CmsContentCheckResult m_results; 72 73 78 public CmsContentCheckFilesDialog(CmsJspActionElement jsp) { 79 80 super(jsp, LIST_ID, Messages.get().container(Messages.GUI_CHECKCONTENT_LIST_NAME_0)); 81 } 82 83 90 public CmsContentCheckFilesDialog(PageContext context, HttpServletRequest req, HttpServletResponse res) { 91 92 this(new CmsJspActionElement(context, req, res)); 93 } 94 95 98 public void executeListMultiActions() { 99 100 throwListUnsupportedActionException(); 101 } 102 103 106 public void executeListSingleActions() { 107 108 throwListUnsupportedActionException(); 109 } 110 111 114 protected void fillDetails(String detailId) { 115 116 List resourceNames = getList().getAllContent(); 118 Iterator i = resourceNames.iterator(); 119 while (i.hasNext()) { 120 CmsListItem item = (CmsListItem)i.next(); 121 CmsResource res = getResource(item); 122 StringBuffer html = new StringBuffer (); 124 if (detailId.equals(LIST_DETAIL_ERROR)) { 126 List errors = m_results.getErrors(res.getRootPath()); 128 if (errors != null) { 129 Iterator j = errors.iterator(); 130 while (j.hasNext()) { 131 String errorMessage = (String )j.next(); 132 html.append(errorMessage); 133 html.append("<br>"); 134 } 135 item.set(detailId, html.toString()); 136 } 137 } 138 if (detailId.equals(LIST_DETAIL_WARNING)) { 140 List warnings = m_results.getWarnings(res.getRootPath()); 142 if (warnings != null) { 143 Iterator j = warnings.iterator(); 144 while (j.hasNext()) { 145 String warningsMessage = (String )j.next(); 146 html.append(warningsMessage); 147 html.append("<br>"); 148 } 149 item.set(detailId, html.toString()); 150 } 151 } 152 } 153 } 154 155 158 protected List getListItems() { 159 160 Map objects = (Map )getSettings().getDialogObject(); 162 Object o = objects.get(CmsContentCheckDialog.class.getName()); 163 if ((o != null) && (o instanceof CmsContentCheck)) { 164 m_results = ((CmsContentCheck)o).getResults(); 165 } else { 166 m_results = new CmsContentCheckResult(); 167 } 168 return getListItemsFromResources(m_results.getAllResources()); 169 } 170 171 174 protected void initMessages() { 175 176 addMessages(org.opencms.workplace.tools.content.Messages.get().getBundleName()); 178 addMessages(Messages.get().getBundleName()); 179 super.initMessages(); 180 } 181 182 185 protected void setIndependentActions(CmsListMetadata metadata) { 186 187 CmsListItemDetails errorDetails = new CmsListItemDetails(LIST_DETAIL_ERROR); 189 errorDetails.setAtColumn(LIST_COLUMN_NAME); 190 errorDetails.setShowActionName(Messages.get().container(Messages.GUI_CHECKCONTENT_DETAIL_SHOW_ERRORINFO_NAME_0)); 192 errorDetails.setShowActionHelpText(Messages.get().container( 193 Messages.GUI_CHECKCONTENT_DETAIL_SHOW_ERRORINFO_HELP_0)); 194 errorDetails.setHideActionName(Messages.get().container(Messages.GUI_CHECKCONTENT_DETAIL_HIDE_ERRORINFO_NAME_0)); 195 errorDetails.setHideActionHelpText(Messages.get().container( 196 Messages.GUI_CHECKCONTENT_DETAIL_HIDE_ERRORINFO_HELP_0)); 197 errorDetails.setFormatter(new CmsListItemDetailsFormatter(Messages.get().container( 198 Messages.GUI_CHECKCONTENT_LABEL_ERROR_0))); 199 200 metadata.addItemDetails(errorDetails); 202 203 CmsListItemDetails warningDetails = new CmsListItemDetails(LIST_DETAIL_WARNING); 205 warningDetails.setAtColumn(LIST_COLUMN_NAME); 206 warningDetails.setShowActionName(Messages.get().container( 208 Messages.GUI_CHECKCONTENT_DETAIL_SHOW_WARNINGINFO_NAME_0)); 209 warningDetails.setShowActionHelpText(Messages.get().container( 210 Messages.GUI_CHECKCONTENT_DETAIL_SHOW_WARNINGINFO_NAME_0)); 211 warningDetails.setHideActionName(Messages.get().container( 212 Messages.GUI_CHECKCONTENT_DETAIL_SHOW_WARNINGINFO_NAME_0)); 213 warningDetails.setHideActionHelpText(Messages.get().container( 214 Messages.GUI_CHECKCONTENT_DETAIL_HIDE_WARNINGINFO_HELP_0)); 215 warningDetails.setFormatter(new CmsListItemDetailsFormatter(Messages.get().container( 216 Messages.GUI_CHECKCONTENT_LABEL_WARNING_0))); 217 218 metadata.addItemDetails(warningDetails); 220 221 super.setIndependentActions(metadata); 222 } 223 224 227 protected void setMultiActions(CmsListMetadata metadata) { 228 229 } 231 232 } | Popular Tags |