roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ganes...@apache.org
Subject svn commit: r768674 - in /roller/branches/roller_mediablogging/apps/weblogger: src/java/org/apache/roller/weblogger/business/ src/java/org/apache/roller/weblogger/pojos/ src/java/org/apache/roller/weblogger/ui/struts2/editor/ web/WEB-INF/ web/WEB-INF/c...
Date Sun, 26 Apr 2009 07:39:43 GMT
Author: ganeshmb
Date: Sun Apr 26 07:39:43 2009
New Revision: 768674

URL: http://svn.apache.org/viewvc?rev=768674&view=rev
Log:
Minor bug fixes for media file functionality

Added:
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileEditSuccess.jsp
Modified:
    roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManagerImpl.java
    roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/MediaFile.java
    roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/MediaFileType.java
    roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileAdd.java
    roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileEdit.java
    roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearch.java
    roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearchBean.java
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/classes/struts.xml
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileSearch.jsp
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileView.jsp
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/tiles.xml
    roller/branches/roller_mediablogging/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp

Modified: roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManagerImpl.java?rev=768674&r1=768673&r2=768674&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManagerImpl.java
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManagerImpl.java
Sun Apr 26 07:39:43 2009
@@ -25,7 +25,6 @@
 import java.util.List;
 
 import javax.persistence.NoResultException;
-import javax.persistence.OneToMany;
 import javax.persistence.Query;
 
 import org.apache.commons.lang.StringUtils;
@@ -37,8 +36,8 @@
 import org.apache.roller.weblogger.pojos.MediaFile;
 import org.apache.roller.weblogger.pojos.MediaFileDirectory;
 import org.apache.roller.weblogger.pojos.MediaFileFilter;
+import org.apache.roller.weblogger.pojos.MediaFileType;
 import org.apache.roller.weblogger.pojos.Weblog;
-import org.apache.roller.weblogger.pojos.MediaFileFilter.MediaFileOrder;
 import org.apache.roller.weblogger.util.RollerMessages;
 
 @com.google.inject.Singleton
@@ -302,13 +301,18 @@
         }
         
         if (filter.getType() != null) {
-        	whereClause.append(" AND m.contentType IN (");
-    		for (String contentType: filter.getType().getContentTypes()) {
-        	    params.add(size ++, contentType);
-        	    whereClause.append("?").append(size).append(",");
-    		}
-        	whereClause.deleteCharAt(whereClause.lastIndexOf(","));
-        	whereClause.append(")");
+        	if (filter.getType() == MediaFileType.OTHERS) {
+        		for (MediaFileType type: MediaFileType.values()) {
+        			if (type != MediaFileType.OTHERS) {
+                    	params.add(size ++, type.getContentTypePrefix() + "%");
+                    	whereClause.append(" AND m.contentType not like ?" + size);
+        			}
+        		}
+        	}
+        	else {
+            	params.add(size ++, filter.getType().getContentTypePrefix() + "%");
+            	whereClause.append(" AND m.contentType like ?" + size);
+        	}
         }
         
         switch(filter.getOrder()) {

Modified: roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/MediaFile.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/MediaFile.java?rev=768674&r1=768673&r2=768674&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/MediaFile.java
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/MediaFile.java
Sun Apr 26 07:39:43 2009
@@ -223,12 +223,7 @@
 	
 	public boolean isImageFile() {
 		if (this.contentType == null) return false;
-    	String[] allowedImageContentTypes = MediaFileType.IMAGE.getContentTypes(); 
-    	for (String imageContentType: allowedImageContentTypes) {
-    		if (imageContentType.equals(this.contentType)) {
-    			return true;
-    		}
-    	}
-    	return false;
+		return (this.contentType.toLowerCase().startsWith(
+				MediaFileType.IMAGE.getContentTypePrefix().toLowerCase()));
 	}
 }

Modified: roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/MediaFileType.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/MediaFileType.java?rev=768674&r1=768673&r2=768674&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/MediaFileType.java
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/MediaFileType.java
Sun Apr 26 07:39:43 2009
@@ -2,22 +2,23 @@
 
 public enum MediaFileType {
 
-	AUDIO("audio", "Audio", "audio/mpeg", "audio/x-ms-wma", "audio/x-wav", "audio/vnd.rn-realaudio"),

-	VIDEO("video", "Video", "video/mpeg", "video/mp4", "video/quicktime", "video/x-ms-wmv"),
 
-	IMAGE("image", "Image", "image/jpeg", "image/gif", "image/png", "image/tiff");
+	AUDIO("audio", "Audio", "audio/"), 
+	VIDEO("video", "Video", "video/"),  
+	IMAGE("image", "Image", "image/"),
+	OTHERS("default", "Others", null);
 
-	String[] contentTypes;
+	String contentTypePrefix;
 	String id;
 	String description;
 	
-	MediaFileType(String id, String desc, String... contentTypes) {
+	MediaFileType(String id, String desc, String prefix) {
 		this.id = id;
 		this.description = desc;
-		this.contentTypes = contentTypes;
+		this.contentTypePrefix = prefix;
 	}
 
-	public String[] getContentTypes() {
-		return contentTypes;
+	public String getContentTypePrefix() {
+		return this.contentTypePrefix;
 	}
 
 	public String getId() {

Modified: roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileAdd.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileAdd.java?rev=768674&r1=768673&r2=768674&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileAdd.java
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileAdd.java
Sun Apr 26 07:39:43 2009
@@ -20,7 +20,6 @@
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.util.Arrays;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
@@ -173,12 +172,8 @@
     }
     
     public boolean isContentTypeImage() {
-    	String[] allowedImageContentTypes = MediaFileType.IMAGE.getContentTypes(); 
-    	for (String imageContentType: allowedImageContentTypes) {
-    		if (imageContentType.equals(this.uploadedFileContentType)) {
-    			return true;
-    		}
-    	}
-    	return false;
+		if (this.uploadedFileContentType == null) return false;
+		return (this.uploadedFileContentType.toLowerCase().startsWith(
+				MediaFileType.IMAGE.getContentTypePrefix().toLowerCase()));
     }
 }

Modified: roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileEdit.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileEdit.java?rev=768674&r1=768673&r2=768674&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileEdit.java
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileEdit.java
Sun Apr 26 07:39:43 2009
@@ -79,7 +79,6 @@
 		try {
 			MediaFile mediaFile = manager.getMediaFile(this.mediaFileId);
 			this.bean.copyFrom(mediaFile);
-    		return SUCCESS;
         } catch (FileIOException ex) {
             addError("uploadFiles.error.upload", bean.getName());
 		} catch (Exception e) {

Modified: roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearch.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearch.java?rev=768674&r1=768673&r2=768674&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearch.java
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearch.java
Sun Apr 26 07:39:43 2009
@@ -51,7 +51,7 @@
     private String newDirectoryPath;
     
     static {
-        fileTypes = Arrays.asList("", "Audio", "Video", "Image");
+        fileTypes = Arrays.asList("", "Audio", "Video", "Image", "Others");
         
         sizeFilterTypes = Arrays.asList(
         		new KeyValueObject(0, "greater than"),

Modified: roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearchBean.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearchBean.java?rev=768674&r1=768673&r2=768674&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearchBean.java
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearchBean.java
Sun Apr 26 07:39:43 2009
@@ -107,6 +107,9 @@
     		else if ("Image".equals(this.type)) {
     			filterType = MediaFileType.IMAGE;
     		}
+    		else if ("Others".equals(this.type)) {
+    			filterType = MediaFileType.OTHERS;
+    		}
     		
     		dataHolder.setType(filterType);
     	}

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=768674&r1=768673&r2=768674&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 Sun
Apr 26 07:39:43 2009
@@ -234,7 +234,7 @@
         <action name="mediaFileEdit!*" method="{1}"
                 class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileEdit">
             <result name="input" type="tiles">.MediaFileEdit</result>
-            <result name="success" type="tiles">.MediaFileEdit</result>
+            <result name="success" type="tiles">.MediaFileEditSuccess</result>
         </action>
 
         <action name="mediaFileAddExternalInclude!*" method="{1}"

Added: roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileEditSuccess.jsp
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileEditSuccess.jsp?rev=768674&view=auto
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileEditSuccess.jsp
(added)
+++ roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileEditSuccess.jsp
Sun Apr 26 07:39:43 2009
@@ -0,0 +1,22 @@
+<%--
+  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" %>
+
+<script type="text/javascript">
+parent.onClose();
+</script>

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=768674&r1=768673&r2=768674&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
Sun Apr 26 07:39:43 2009
@@ -75,9 +75,12 @@
                     document.mediaFileSearchForm.submit();
                 }
 
-                function createPost() {
-
-
+                function createPost(p_oLI) {
+                    var lineItemNode =	YAHOO.util.Dom.getAncestorByTagName(p_oLI, "LI");
+                    var hidden_mediaFileId_value = findMediaFileIdForLineItem(lineItemNode);
+                    document.mediaFileSearchForm.mediaFileId.value = hidden_mediaFileId_value;
+                    document.mediaFileSearchForm.action = '<s:url action="entryAddWithMediaFile"></s:url>';
+                    document.mediaFileSearchForm.submit();
                 }
 
                 function includeMedia(p_oLI) {
@@ -379,12 +382,12 @@
 	<img border="0" <s:if test="#mediaFile.imageFile">src='<s:url value="/roller-ui/rendering/media-resources/%{#mediaFile.id}"
/>' width="120px" height="100px" </s:if> <s:else>src="/images/page.png" style="padding:40px
50px;"</s:else>/>
 	</div><br/>
 	 <div style="clear:left;width:130px;margin-left:5px;font-size:11px;"><label><s:property
-value="#mediaFile.name" /></label>
+value="#mediaFile.name" /></label><br />
+<label style="color:blue"><s:property value="#mediaFile.directory.path" /></label>
 <div style="padding-top:5px;">   <!--  one -->
     <input style="float:left;" type="checkbox" name="selectedMediaFiles" value="<s:property
 value="#mediaFile.id"/>"/>
 	<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>

Modified: roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileView.jsp
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileView.jsp?rev=768674&r1=768673&r2=768674&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileView.jsp
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileView.jsp
Sun Apr 26 07:39:43 2009
@@ -74,21 +74,20 @@
                 function deleteMedia(p_oLI) {
 
                     var lineItemNode =	YAHOO.util.Dom.getAncestorByTagName(p_oLI, "LI");
-                    //var lineItemParentNode = lineItemNode.parentNode;
                     var hidden_mediaFileId_value = findMediaFileIdForLineItem(lineItemNode);
-                    //lineItemParentNode.removeChild(lineItemNode);
                     document.mediaFileViewForm.mediaFileId.value=hidden_mediaFileId_value;
                     document.mediaFileViewForm.action='<s:url action="mediaFileView!delete"
/>';
                     document.mediaFileViewForm.submit();
                 }
 
-
-                function createPost() {
-
-
+                function createPost(p_oLI) {
+                    var lineItemNode =	YAHOO.util.Dom.getAncestorByTagName(p_oLI, "LI");
+                    var hidden_mediaFileId_value = findMediaFileIdForLineItem(lineItemNode);
+                    document.mediaFileViewForm.mediaFileId.value = hidden_mediaFileId_value;
+                    document.mediaFileViewForm.action = '<s:url action="entryAddWithMediaFile"></s:url>';
+                    document.mediaFileViewForm.submit();
                 }
 
-
                 function includeMedia(p_oLI) {
                     var lineItemNode =	YAHOO.util.Dom.getAncestorByTagName(p_oLI, "LI");
                     var hidden_mediaFileId_value = findMediaFileIdForLineItem(lineItemNode);
@@ -99,6 +98,7 @@
 
 
 
+
                 function onEweContextMenuClick(p_sType, p_aArgs) {
 
                     /*

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=768674&r1=768673&r2=768674&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 Sun Apr 26 07:39:43
2009
@@ -240,11 +240,15 @@
         <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileAdd.jsp" />
     </definition>
 
-	<definition name=".MediaFileAddSuccessInclude" extends=".tiles-popuppage" >
+    <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"
/>
     </definition>
-
+    
+    <definition name=".MediaFileEditSuccess" extends=".tiles-popuppage" >
+        <put-attribute name="head" value="/WEB-INF/jsps/tiles/head-ajax.jsp" />
+        <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileEditSuccess.jsp"
/>
+    </definition>
 
     <definition name=".MediaFileView" extends=".tiles-tabbedpage" >
         <put-attribute name="head" value="/WEB-INF/jsps/tiles/head-ajax.jsp" />

Modified: roller/branches/roller_mediablogging/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp?rev=768674&r1=768673&r2=768674&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp
Sun Apr 26 07:39:43 2009
@@ -76,10 +76,9 @@
 {
 	document.getElementById('overlay').style.display = 'none';
 	document.getElementById('overlay_img').style.visibility = 'hidden';
-
-	insertAtCursor(document.getElementById('EntryText'), textForInsertion);
-
-
+	if (textForInsertion && textForInsertion.length > 0) {
+	    insertAtCursor(document.getElementById('EntryText'), textForInsertion);
+	}
 }
 
 function insertAtCursor(textAreaElement, valueForInsertion) {



Mime
View raw message