/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws IOException, ServletException { // forward to the edit module screen Map params = new HashMap(); params.put(CmsHistoryList.PARAM_VERSION_1, getParamVersion1()); params.put(CmsHistoryList.PARAM_VERSION_2, getParamVersion2()); params.put(CmsHistoryList.PARAM_ID_1, getParamId1()); params.put(CmsHistoryList.PARAM_ID_2, getParamId2()); params.put(PARAM_COMPARE, CmsResourceComparisonDialog.COMPARE_ATTRIBUTES); params.put(PARAM_RESOURCE, getParamResource()); // forward to the difference screen getToolManager().jspForwardTool(this, "/history/comparison/difference", params); }
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#buttonHtml(org.opencms.workplace.CmsWorkplace) */ @Override public String buttonHtml(CmsWorkplace wp) { return ((CmsAttributeComparisonList)wp).getViewVersionButtonHtml( new CmsUUID(((CmsAttributeComparisonList)wp).getParamId2()), ((CmsAttributeComparisonList)wp).getParamVersion2()); } };
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#buttonHtml(org.opencms.workplace.CmsWorkplace) */ @Override public String buttonHtml(CmsWorkplace wp) { return ((CmsAttributeComparisonList)wp).getViewVersionButtonHtml( new CmsUUID(((CmsAttributeComparisonList)wp).getParamId1()), ((CmsAttributeComparisonList)wp).getParamVersion1()); } };
getCms(), getResource1(), getResource2()).iterator(); while (diffs.hasNext()) { CmsAttributeComparison comparison = (CmsAttributeComparison)diffs.next(); CmsListItem item = getList().newItem(comparison.getName()); item.set(LIST_COLUMN_PROPERTY_NAME, key(comparison.getName())); item.set(LIST_COLUMN_VERSION_1, CmsStringUtil.trimToSize(comparison.getVersion1(), TRIM_AT_LENGTH)); item.set(LIST_COLUMN_VERSION_2, CmsStringUtil.trimToSize(comparison.getVersion2(), TRIM_AT_LENGTH)); if (CmsResourceComparison.TYPE_ADDED.equals(comparison.getStatus())) { item.set(LIST_COLUMN_TYPE, key(Messages.GUI_COMPARE_ADDED_0)); } else if (CmsResourceComparison.TYPE_REMOVED.equals(comparison.getStatus())) { item.set(LIST_COLUMN_TYPE, key(Messages.GUI_COMPARE_REMOVED_0)); } else if (CmsResourceComparison.TYPE_CHANGED.equals(comparison.getStatus())) { item.set(LIST_COLUMN_TYPE, key(Messages.GUI_COMPARE_CHANGED_0)); } else { if (!getList().getMetadata().getItemDetailDefinition(LIST_IACTION_SHOW).isVisible()) { item.set(LIST_COLUMN_TYPE, key(Messages.GUI_COMPARE_UNCHANGED_0)); getList().getMetadata().getIndependentAction(LIST_ACTION_VIEW1).setEnabled(getResource1().isFile()); getList().getMetadata().getIndependentAction(LIST_ACTION_VIEW2).setEnabled(getResource2().isFile()); getList().getMetadata().getColumnDefinition(LIST_COLUMN_VERSION_1).setName( Messages.get().container( Messages.GUI_COMPARE_VERSION_1, CmsHistoryListUtil.getDisplayVersion(getParamVersion1(), getLocale()))); getList().getMetadata().getColumnDefinition(LIST_COLUMN_VERSION_2).setName(Messages.get().container( Messages.GUI_COMPARE_VERSION_1,
CmsHistoryList.getDisplayVersion(version, getLocale())).key(getLocale()); String iconPath = null; try { String typeName = OpenCms.getResourceManager().getResourceType(getResource1().getTypeId()).getTypeName(); iconPath = "filetypes/" + OpenCms.getWorkplaceManager().getExplorerTypeSetting(typeName).getIcon(); } catch (CmsException e) { result.append("<span class='link' onClick=\""); result.append("window.open('"); result.append(getJsp().link(CmsHistoryList.getHistoryLink(getCms(), structureId, version))); result.append("','version','scrollbars=yes', 'resizable=yes', 'width=800', 'height=600')\">"); result.append("<img style='width: 16px; height: 16px;' src='");
CmsAttributeComparisonList attributeDiff = new CmsAttributeComparisonList(getJsp()); List lists = new ArrayList(); lists.add(attributeDiff);
Iterator diffs = CmsResourceComparison.compareAttributes(getCms(), getResource1(), getResource2()).iterator(); while (diffs.hasNext()) { CmsAttributeComparison comparison = (CmsAttributeComparison)diffs.next(); CmsListItem item = getList().newItem(comparison.getName()); item.set(LIST_COLUMN_PROPERTY_NAME, key(comparison.getName())); item.set(LIST_COLUMN_VERSION_1, CmsStringUtil.trimToSize(comparison.getVersion1(), TRIM_AT_LENGTH)); item.set(LIST_COLUMN_VERSION_2, CmsStringUtil.trimToSize(comparison.getVersion2(), TRIM_AT_LENGTH)); if (CmsResourceComparison.TYPE_ADDED.equals(comparison.getStatus())) { item.set(LIST_COLUMN_TYPE, key(Messages.GUI_COMPARE_ADDED_0)); } else if (CmsResourceComparison.TYPE_REMOVED.equals(comparison.getStatus())) { item.set(LIST_COLUMN_TYPE, key(Messages.GUI_COMPARE_REMOVED_0)); } else if (CmsResourceComparison.TYPE_CHANGED.equals(comparison.getStatus())) { item.set(LIST_COLUMN_TYPE, key(Messages.GUI_COMPARE_CHANGED_0)); } else { if (!getList().getMetadata().getItemDetailDefinition(LIST_IACTION_SHOW).isVisible()) { item.set(LIST_COLUMN_TYPE, key(Messages.GUI_COMPARE_UNCHANGED_0)); getList().getMetadata().getIndependentAction(LIST_ACTION_VIEW1).setEnabled(getResource1().isFile()); getList().getMetadata().getIndependentAction(LIST_ACTION_VIEW2).setEnabled(getResource2().isFile()); getList().getMetadata().getColumnDefinition(LIST_COLUMN_VERSION_1).setName( Messages.get().container( Messages.GUI_COMPARE_VERSION_1, CmsHistoryList.getDisplayVersion(getParamVersion1(), getLocale()))); getList().getMetadata().getColumnDefinition(LIST_COLUMN_VERSION_2).setName( Messages.get().container( Messages.GUI_COMPARE_VERSION_1, CmsHistoryList.getDisplayVersion(getParamVersion2(), getLocale())));
if (OpenCms.getResourceManager().getResourceType(getResource1().getTypeId()).isFolder()) { active = false; } else { byte[] content = readFile(getCms(), structureId, version).getContents(); if (content.length < 1) { active = false; String label = Messages.get().container( Messages.GUI_COMPARE_VIEW_VERSION_1, CmsHistoryListUtil.getDisplayVersion(version, getLocale())).key(getLocale()); String iconPath = null; try { String typeName = OpenCms.getResourceManager().getResourceType( getResource1().getTypeId()).getTypeName(); iconPath = CmsWorkplace.RES_PATH_FILETYPES + OpenCms.getWorkplaceManager().getExplorerTypeSetting(typeName).getIcon(); result.append("<span class='link' onClick=\""); result.append("window.open('"); result.append(getJsp().link(CmsHistoryListUtil.getHistoryLink(getCms(), structureId, version))); result.append("','version','scrollbars=yes', 'resizable=yes', 'width=800', 'height=600')\">"); result.append("<img style='width: 16px; height: 16px;' src='");
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#buttonHtml(org.opencms.workplace.CmsWorkplace) */ @Override public String buttonHtml(CmsWorkplace wp) { return ((CmsAttributeComparisonList)wp).getViewVersionButtonHtml( new CmsUUID(((CmsAttributeComparisonList)wp).getParamId2()), ((CmsAttributeComparisonList)wp).getParamVersion2()); } };
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#buttonHtml(org.opencms.workplace.CmsWorkplace) */ @Override public String buttonHtml(CmsWorkplace wp) { return ((CmsAttributeComparisonList)wp).getViewVersionButtonHtml( new CmsUUID(((CmsAttributeComparisonList)wp).getParamId1()), ((CmsAttributeComparisonList)wp).getParamVersion1()); } };
CmsAttributeComparisonList attributeDiff = new CmsAttributeComparisonList(getJsp()); List<A_CmsListDialog> lists = new ArrayList<A_CmsListDialog>(); lists.add(attributeDiff);
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws IOException, ServletException { // forward to the edit module screen Map<String, String[]> params = new HashMap<String, String[]>(); params.put(CmsHistoryList.PARAM_VERSION_1, new String[] {getParamVersion1()}); params.put(CmsHistoryList.PARAM_VERSION_2, new String[] {getParamVersion2()}); params.put(CmsHistoryList.PARAM_ID_1, new String[] {getParamId1()}); params.put(CmsHistoryList.PARAM_ID_2, new String[] {getParamId2()}); params.put(PARAM_COMPARE, new String[] {CmsResourceComparisonDialog.COMPARE_ATTRIBUTES}); params.put(PARAM_RESOURCE, new String[] {getParamResource()}); // forward to the difference screen getToolManager().jspForwardTool(this, "/history/comparison/difference", params); }