This is an automated email from the ASF dual-hosted git repository. mraible pushed a commit to branch remove-unused-media-pages in repository https://gitbox.apache.org/repos/asf/roller.git
commit 78eccc23143ba4eaeb82baa6f6100fbbd518d6e0 Author: Matt Raible <[email protected]> AuthorDate: Tue Nov 17 11:28:27 2026 -0700 Remove media pages nothing links to The mediaFileImageDim action and the overlay mediaFileAdd action, with their tiles and JSPs (MediaFileImageDimension.jsp, MediaFileAddSuccessInclude.jsp), aren't linked from any page; the entry editor inserts media through mediaFileImageChooser. Their JSPs built media links that Roller can't serve. --- .../ui/struts2/editor/MediaFileImageDim.java | 73 --------------- app/src/main/resources/struts.xml | 16 ---- .../jsps/editor/MediaFileAddSuccessInclude.jsp | 30 ------ .../jsps/editor/MediaFileImageDimension.jsp | 104 --------------------- app/src/main/webapp/WEB-INF/tiles.xml | 15 --- .../struts2/editor/AuthoringActionScopingTest.java | 8 -- 6 files changed, 246 deletions(-) diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageDim.java b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageDim.java deleted file mode 100644 index ad943c4e3..000000000 --- a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageDim.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.roller.weblogger.ui.struts2.editor; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.roller.weblogger.WebloggerException; -import org.apache.roller.weblogger.business.MediaFileManager; -import org.apache.roller.weblogger.business.WebloggerFactory; -import org.apache.roller.weblogger.pojos.MediaFile; -import org.apache.struts2.convention.annotation.AllowedMethods; -import org.apache.struts2.interceptor.validation.SkipValidation; - -/** - * Action class for choosing image dimensions. - */ -@SuppressWarnings("serial") -// TODO: make this work @AllowedMethods({"execute"}) -public class MediaFileImageDim extends MediaFileBase { - - private static Log log = LogFactory.getLog(MediaFileImageDim.class); - private MediaFileBean bean = new MediaFileBean(); - - public MediaFileImageDim() { - this.actionName = "mediaFileImageDim"; - } - - /** - * Show form for choosing image dimension. - * - * @return String The result of the action. - */ - @SkipValidation - @Override - public String execute() { - try { - MediaFileManager mgr = WebloggerFactory.getWeblogger().getMediaFileManager(); - MediaFile mediaFile = mgr.getMediaFile(getActionWeblog(), getMediaFileId()); - if (mediaFile == null) { - addError("MediaFile.error.view"); - return ERROR; - } - bean.copyFrom(mediaFile); - } catch (WebloggerException ex) { - log.error("Error looking up media file directory", ex); - } - return SUCCESS; - } - - public MediaFileBean getBean() { - return bean; - } - - public void setBean(MediaFileBean bean) { - this.bean = bean; - } -} diff --git a/app/src/main/resources/struts.xml b/app/src/main/resources/struts.xml index 0c5133bae..99456d19a 100644 --- a/app/src/main/resources/struts.xml +++ b/app/src/main/resources/struts.xml @@ -338,13 +338,6 @@ </allowed-methods> </action> - <action name="mediaFileImageDim" - class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileImageDim"> - <result name="success" type="tiles">.MediaFileImageDimension</result> - <result name="error" type="chain">mediaFileView</result> - <allowed-methods>execute</allowed-methods> - </action> - <action name="entryAddWithMediaFile" class="org.apache.roller.weblogger.ui.struts2.editor.EntryAddWithMediaFile"> <result name="success" type="chain">entryAdd</result> @@ -637,15 +630,6 @@ <package name="weblogger-authoring-overlay" namespace="/roller-ui/authoring/overlay" extends="weblogger-authoring" > - <action name="mediaFileAdd" - class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileAdd"> - <param name="overlayMode">true</param> - <result name="input" type="tiles">.MediaFileAddInclude</result> - <result name="success" type="tiles">.MediaFileAddSuccessInclude</result> - <result name="error" type="tiles">.MediaFileAddInclude</result> - <allowed-methods>execute,save</allowed-methods> - </action> - <action name="mediaFileImageChooser" class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileImageChooser"> <param name="overlayMode">true</param> diff --git a/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp b/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp deleted file mode 100644 index 1881275bc..000000000 --- a/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---%> -<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %> - -<s:if test="contentTypeImage"> - <s:include value="/WEB-INF/jsps/editor/MediaFileImageDimension.jsp" /> -</s:if> -<s:else> -<script> - <s:url var="mediaFileURL" value="/roller-ui/rendering/media-resources/%{bean.id}" /> - var filePointer = "<a href=\"<s:property value="%{mediaFileURL}" escapeJavaScript="true" />\"><s:property value="bean.name" escapeJavaScript="true" /></a>"; - parent.onClose(filePointer); -</script> -</s:else> diff --git a/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileImageDimension.jsp b/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileImageDimension.jsp deleted file mode 100644 index 189b78205..000000000 --- a/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileImageDimension.jsp +++ /dev/null @@ -1,104 +0,0 @@ -<%-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---%> -<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %> - -<s:url var="mediaFileURL" value="/roller-ui/rendering/media-resources/%{bean.id}" /> - -<script> -function addImage() { - var filePointer = "<img src=\"<s:property value="%{mediaFileURL}" escapeJavaScript="true" />\" alt=\"<s:property value="bean.name" escapeJavaScript="true" />\" width='<width>' height='<height>' style='<style>' />"; - filePointer = filePointer.replace('<width>', document.imageDimForm.imageWidth.value); - filePointer = filePointer.replace('<height>', document.imageDimForm.imageHeight.value); - var styleDescription = ''; - - var selectedAlignment; - for (i = 0; i < document.imageDimForm.imageAlignment.length; i ++) { - if (document.imageDimForm.imageAlignment[i].checked) { - selectedAlignment = document.imageDimForm.imageAlignment[i].value - } - } - - if (selectedAlignment == 'Left') { - styleDescription='display:inline;float:left;'; - } - else if (selectedAlignment == 'Right') { - styleDescription='display:inline;float:right;'; - } - else if (selectedAlignment == 'Center') { - styleDescription = 'display:block;margin-left:auto;margin-right:auto;'; - } - - var filePointer = filePointer.replace('<style>', styleDescription); - parent.onClose(filePointer); -} -</script> - -<p class="subtitle"> - Choose layout for image -</p> - -<form name="imageDimForm" method="POST" onsubmit="addImage()"> - - <div id="imageAlign" style="border:1px solid #000000;width:120px;height:100px;margin:5px;"> - <img border="0" src="<s:property value="%{mediaFileURL}" />" width="120px" height="100px" /> - </div> - - <table class="entryEditTable" cellpadding="0" cellspacing="0" width="100%"> - - <tr> - <td class="entryEditFormLabel"> - <label for="status">Link URL:</label> - </td> - <td> - <s:a href="%{mediaFileURL}"><s:property value="%{mediaFileURL}" /></s:a> - </td> - </tr> - - <tr> - <td class="entryEditFormLabel"> - <label for="status">Alignment:</label> - </td> - <td> - <input type="radio" name="imageAlignment" value="None" checked> None - <input type="radio" name="imageAlignment" value="Left"> Left - <input type="radio" name="imageAlignment" value="Center"> Center - <input type="radio" name="imageAlignment" value="Right"> Right - </td> - </tr> - - <tr> - <td class="entryEditFormLabel"> - <label for="status">Size:</label> - </td> - <td> - <input type="text" name="imageWidth" size="10" maxlength="15" tabindex="1" /> - <input type="text" name="imageHeight" size="10" maxlength="15" tabindex="1" /> - <div style="float:left;margin-right:60px;">Width</div> <div>Height</div> - </td> - </tr> - - - </table> - <br /> - <div class="control"> - <input type="submit" value="Insert" name="submit" /> - <input type="button" value="Skip" name="Skip" /> - </div> - -</form> diff --git a/app/src/main/webapp/WEB-INF/tiles.xml b/app/src/main/webapp/WEB-INF/tiles.xml index 3f81a4331..264e6498a 100644 --- a/app/src/main/webapp/WEB-INF/tiles.xml +++ b/app/src/main/webapp/WEB-INF/tiles.xml @@ -240,20 +240,6 @@ <put-attribute name="messages" value="/WEB-INF/jsps/tiles/messages.jsp" /> </definition> - <definition name=".MediaFileImageDimension" extends=".tiles-popuppage-only-content" > - <put-attribute name="head" value="/WEB-INF/jsps/tiles/head.jsp" /> - <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileImageDimension.jsp" /> - </definition> - - <definition name=".MediaFileAddInclude" extends=".tiles-popuppage" > - <put-attribute name="head" value="/WEB-INF/jsps/tiles/head.jsp" /> - <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileAdd.jsp" /> - </definition> - - <definition name=".MediaFileAddSuccessInclude" extends=".tiles-popuppage" > - <put-attribute name="head" value="/WEB-INF/jsps/tiles/head.jsp" /> - <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp" /> - </definition> <definition name=".MediaFileView" extends=".tiles-mediapage" > <put-attribute name="head" value="/WEB-INF/jsps/tiles/head.jsp" /> @@ -376,7 +362,6 @@ <put-attribute name="content" value="/WEB-INF/jsps/editor/MemberResign.jsp" /> </definition> - <definition name=".Maintenance" extends=".tiles-tabbedpage" > <put-attribute name="content" value="/WEB-INF/jsps/editor/Maintenance.jsp" /> </definition> diff --git a/app/src/test/java/org/apache/roller/weblogger/ui/struts2/editor/AuthoringActionScopingTest.java b/app/src/test/java/org/apache/roller/weblogger/ui/struts2/editor/AuthoringActionScopingTest.java index 2d5c2d836..d22397634 100644 --- a/app/src/test/java/org/apache/roller/weblogger/ui/struts2/editor/AuthoringActionScopingTest.java +++ b/app/src/test/java/org/apache/roller/weblogger/ui/struts2/editor/AuthoringActionScopingTest.java @@ -326,14 +326,6 @@ public class AuthoringActionScopingTest { @Test public void testMediaActionsReportMissingResources() throws Exception { - MediaFileImageDim dimensions = new MediaFileImageDim(); - prepareText(dimensions); - dimensions.setActionWeblog(TestUtils.getManagedWebsite(weblogOne)); - dimensions.setMediaFileId("missing-media-file"); - - assertEquals(MediaFileImageDim.ERROR, dimensions.execute()); - assertTrue(dimensions.hasActionErrors()); - EntryAddWithMediaFile entry = new EntryAddWithMediaFile(); prepareText(entry); entry.setActionWeblog(TestUtils.getManagedWebsite(weblogOne));
