roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ganes...@apache.org
Subject svn commit: r769262 - in /roller/branches/roller_mediablogging/apps/weblogger: src/java/org/apache/roller/weblogger/ui/struts2/editor/ web/WEB-INF/ web/WEB-INF/classes/ web/WEB-INF/jsps/editor/
Date Tue, 28 Apr 2009 06:30:14 GMT
Author: ganeshmb
Date: Tue Apr 28 06:30:13 2009
New Revision: 769262

URL: http://svn.apache.org/viewvc?rev=769262&view=rev
Log: (empty)

Added:
    roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageDim.java
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileImageDimension.jsp
Modified:
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/classes/struts.xml
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileSearch.jsp
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/tiles.xml

Added: roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageDim.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageDim.java?rev=769262&view=auto
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageDim.java
(added)
+++ roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageDim.java
Tue Apr 28 06:30:13 2009
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.weblogger.ui.struts2.editor;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.weblogger.WebloggerException;
+import org.apache.roller.weblogger.business.FileIOException;
+import org.apache.roller.weblogger.business.MediaFileManager;
+import org.apache.roller.weblogger.business.WebloggerFactory;
+import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
+import org.apache.roller.weblogger.pojos.MediaFile;
+import org.apache.roller.weblogger.pojos.MediaFileDirectory;
+import org.apache.roller.weblogger.pojos.MediaFileType;
+import org.apache.struts2.interceptor.validation.SkipValidation;
+
+/**
+ * Adds a new media file.
+ */
+@SuppressWarnings("serial")
+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 adding a new media file.
+     * 
+     * @return String The result of the action.
+     */
+    @SkipValidation
+    public String execute() {
+    	try {
+            MediaFileManager mgr = WebloggerFactory.getWeblogger().getMediaFileManager();
+            MediaFile mediaFile = mgr.getMediaFile(getMediaFileId());
+            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;
+	}
+    
+}

Modified: roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/classes/struts.xml
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/classes/struts.xml?rev=769262&r1=769261&r2=769262&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/classes/struts.xml (original)
+++ roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/classes/struts.xml Tue
Apr 28 06:30:13 2009
@@ -262,12 +262,11 @@
             <result name="success" type="tiles">.MediaFileSearch</result>
         </action>
 		
-	<action name="tabular!*" method="{1}"
-                class="org.apache.roller.weblogger.ui.struts2.editor.Resources">
-            <result name="list" type="tiles">.TabularView</result>
+	<action name="mediaFileImageDim!*" method="{1}"
+                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileImageDim">
+            <result name="success" type="tiles">.MediaFileImageDimension</result>
         </action>
-        
-        
+
         <action name="entryEdit!*" method="{1}"
                 class="org.apache.roller.weblogger.ui.struts2.editor.EntryEdit">
             <result name="input" type="tiles">.EntryEdit</result>

Modified: roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp?rev=769262&r1=769261&r2=769262&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp
Tue Apr 28 06:30:13 2009
@@ -17,14 +17,14 @@
 --%>
 <%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
 
-<script type="text/javascript">
-//parent.document.getElementById('overlay_img').style.display = 'none';
-<s:url id="mediaFileURL" value="/roller-ui/rendering/media-resources/%{bean.id}" />
 <s:if test="contentTypeImage">
-var filePointer = "<img src='<s:property value="%{mediaFileURL}" />' alt='<s:property
value="bean.name" />' width='400' height='300' />";
+   <s:include value="/WEB-INF/jsps/editor/MediaFileImageDimension.jsp" />
 </s:if>
 <s:else>
-var filePointer = "<a href='<s:property value="%{mediaFileURL}" />'><s:property
value="bean.name" /></a>";
-</s:else>
-parent.onClose(filePointer);
+<script type="text/javascript">
+//parent.document.getElementById('overlay_img').style.display = 'none';
+    <s:url id="mediaFileURL" value="/roller-ui/rendering/media-resources/%{bean.id}" />
+    var filePointer = "<a href='<s:property value="%{mediaFileURL}" />'><s:property
value="bean.name" /></a>";
+    parent.onClose(filePointer);
 </script>
+</s:else>

Added: roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileImageDimension.jsp
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileImageDimension.jsp?rev=769262&view=auto
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileImageDimension.jsp
(added)
+++ roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileImageDimension.jsp
Tue Apr 28 06:30:13 2009
@@ -0,0 +1,103 @@
+<%--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  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.  For additional information regarding
+  copyright in this work, please see the NOTICE file in the top level
+  directory of this distribution.
+--%>
+<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
+
+<s:url id="mediaFileURL" value="/roller-ui/rendering/media-resources/%{bean.id}" />
+
+<script type="text/javascript">
+function addImage() {
+    var filePointer = "<img src='<s:property value="%{mediaFileURL}" />' alt='<s:property
value="bean.name" />' 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>

Modified: roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileSearch.jsp
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileSearch.jsp?rev=769262&r1=769261&r2=769262&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileSearch.jsp
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileSearch.jsp
Tue Apr 28 06:30:13 2009
@@ -246,16 +246,18 @@
     }
 }
 
-function onClickInsert(url, text, isImage)
+function onClickInsert(id, url, text, isImage)
 {
     var filePointer;
     if (isImage) {
-        filePointer = "<img src='" + url + "' alt='" + text + "' width='400' height='300'
/>";
+        document.mediaFileSearchForm.mediaFileId.value=id;
+        document.mediaFileSearchForm.action='<s:url action="mediaFileImageDim" />';
+        document.mediaFileSearchForm.submit();
     }
     else {
-        filePointer = "<a href='" + url + "'>" + text + "</a>";
+        var filePointer = "<a href='" + url + "'>" + text + "</a>";
+        parent.onClose(filePointer);
     }
-    parent.onClose(filePointer);
 }
 
 function onCreateDirectory()
@@ -294,11 +296,11 @@
 			    	frame.style.height="100%";
 					if (browser=="Microsoft Internet Explorer")
 					{
-					document.getElementById("overlay_img").style.top= "40px"; 
-	                document.getElementById("overlay_img").style.left= "170px"; 
-                    document.getElementById("overlay_img").style.height= "500px"; 
+					document.getElementById("overlay_img").style.top= "40px";
+	                document.getElementById("overlay_img").style.left= "170px";
+                    document.getElementById("overlay_img").style.height= "500px";
 					}
-					
+
 
 	document.getElementById("overlay_img").innerHTML = '<div ><a href="#" class="container-close"
onclick="onClose()"></a></div>';
 
@@ -393,7 +395,7 @@
 	<INPUT TYPE="hidden" id="mediafileidentity" value="<s:property value='#mediaFile.id'/>">
 <s:if test="overlayMode">
 <div style="float:right;">
-       <a  href="#" onclick="onClickInsert('<s:url value="/roller-ui/rendering/media-resources/%{#mediaFile.id}"
/>', '<s:property value="#mediaFile.name" />', <s:property value="#mediaFile.imageFile"
/>)">Insert</a>
+       <a  href="#" onclick="onClickInsert('<s:property value="#mediaFile.id" />',
'<s:url value="/roller-ui/rendering/media-resources/%{#mediaFile.id}" />', '<s:property
value="#mediaFile.name" />', <s:property value="#mediaFile.imageFile" />)">Insert</a>
     </div>
 </s:if>
 <s:else>

Modified: roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/tiles.xml
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/tiles.xml?rev=769262&r1=769261&r2=769262&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/tiles.xml (original)
+++ roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/tiles.xml Tue Apr 28 06:30:13
2009
@@ -226,10 +226,16 @@
         <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileEdit.jsp" />
     </definition>
 
-	<definition name=".MediaFileAddExternalInclude" extends=".tiles-popuppage-only-content"
>
+    <definition name=".MediaFileAddExternalInclude" extends=".tiles-popuppage-only-content"
>
         <put-attribute name="head" value="/WEB-INF/jsps/tiles/head-ajax.jsp" />
         <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileAddExternalInclude.jsp"
/>
     </definition>
+    
+    <definition name=".MediaFileImageDimension" extends=".tiles-popuppage-only-content"
>
+        <put-attribute name="head" value="/WEB-INF/jsps/tiles/head-ajax.jsp" />
+        <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileImageDimension.jsp"
/>
+    </definition>
+    
 
 	<definition name=".MediaFileSearchInclude" extends=".tiles-popuppage" >
         <put-attribute name="head" value="/WEB-INF/jsps/tiles/head-ajax.jsp" />
@@ -243,7 +249,7 @@
 
     <definition name=".MediaFileAddSuccessInclude" extends=".tiles-popuppage" >
         <put-attribute name="head" value="/WEB-INF/jsps/tiles/head-ajax.jsp" />
-        <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileAddSuccess.jsp"
/>
+        <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp"
/>
     </definition>
     
     <definition name=".MediaFileEditSuccess" extends=".tiles-popuppage" >



Mime
View raw message