roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r828305 - in /roller/trunk/apps/weblogger: src/java/org/apache/roller/weblogger/ui/struts2/editor/ web/WEB-INF/classes/ web/WEB-INF/jsps/editor/
Date Thu, 22 Oct 2009 05:05:29 GMT
Author: snoopdave
Date: Thu Oct 22 05:05:29 2009
New Revision: 828305

URL: http://svn.apache.org/viewvc?rev=828305&view=rev
Log:
To make room for a file update field (https://issues.apache.org/jira/browse/ROL-1838) in the
Edit Media File page, I'm moving the "create weblog post" and "create weblog podcast post"
action from the Media File Edit page to the Media File View page. In the Media File View page
each Media File now has an add button, a YUI menu button that offers two options: create weblog
post and create weblog podcast post.

Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java
    roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties
    roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileEdit.jsp
    roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileView.jsp

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java?rev=828305&r1=828304&r2=828305&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java
Thu Oct 22 05:05:29 2009
@@ -36,10 +36,10 @@
     // bean for managing form data
     private EntryBean bean = new EntryBean();
 
-    private String weblog = null;
-    private String enclosureUrl = null;
+    private String   weblog = null;
+    private String   type = null;
     private String[] selectedImages = null;
-    private String selectedImage = null;
+    private String   selectedImage = null;
     
 
     public EntryAddWithMediaFile() {
@@ -65,7 +65,7 @@
 
             StringBuilder sb = new StringBuilder();
 
-            if (selectedImages != null) {
+            if ("weblog".equals(type) && selectedImages != null) {
 
                 for (int i=0; i<selectedImages.length; i++) {
                     MediaFile mediaFile = manager.getMediaFile(selectedImages[i]);
@@ -73,14 +73,14 @@
 
                     if (mediaFile.isImageFile()) {
                         link = "<p>" + mediaFile.getName() + "</p>";
-                        link += "<a href='<url>'><img src='<url>?t=true'
alt='<name>' width='<width>' height='<height>'></img></a>";
-                        link = link.replace("<url>", getMediaFileURL(mediaFile))
+                        link += "<a href='<url>'><img src='<url>' alt='<name>'
width='<width>' height='<height>'></img></a>";
+                        link = link.replace("<url>", mediaFile.getThumbnailURL())
                                    .replace("<name>", mediaFile.getName())
                                    .replace("<width>", ""+mediaFile.getThumbnailWidth())
                                    .replace("<height>", ""+mediaFile.getThumbnailHeight());
                     } else {
                         link = "<a href='<url>'><name></a> (<size>
bytes, <type>)";
-                        link = link.replace("<url>", getMediaFileURL(mediaFile))
+                        link = link.replace("<url>", mediaFile.getPermalink())
                                    .replace("<name>", mediaFile.getName())
                                    .replace("<size>",""+mediaFile.getLength())
                                    .replace("<type>",mediaFile.getContentType());
@@ -89,14 +89,15 @@
                 }
             }
 
-            if (StringUtils.isNotEmpty(enclosureUrl)) {
+            else if ("podcast".equals(type) && StringUtils.isNotEmpty(selectedImage))
{
+                MediaFile podcastFile = manager.getMediaFile(selectedImage);
                 sb.append("<p>")
                   .append(getText("mediaFileEdit.includesEnclosure"))
                   .append("<br />")
                   .append("<a href=''>")
-                  .append(enclosureUrl)
+                  .append(podcastFile.getPermalink())
                   .append("</a></p>");
-                bean.setEnclosureURL(enclosureUrl);
+                bean.setEnclosureURL(podcastFile.getPermalink());
             }
 
             bean.setText(sb.toString());
@@ -130,17 +131,17 @@
     }
 
     /**
-     * @return the enclosureUrl
+     * @return the type
      */
-    public String getEnclosureUrl() {
-        return enclosureUrl;
+    public String getType() {
+        return type;
     }
 
     /**
-     * @param enclosureUrl the enclosureUrl to set
+     * @param type the enclosureUrl to set
      */
-    public void setEnclosureUrl(String enclosureUrl) {
-        this.enclosureUrl = enclosureUrl;
+    public void setType(String type) {
+        this.type = type;
     }
 
     /**

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java?rev=828305&r1=828304&r2=828305&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java
Thu Oct 22 05:05:29 2009
@@ -185,13 +185,6 @@
         }
     }
 
-    /**
-     * Constructs the external URL for a given media file
-     */
-    protected String getMediaFileURL(MediaFile mediaFile) {
-        return mediaFile.getWeblog().getAbsoluteURL() + "/mediaresource/" + mediaFile.getId();
-    }
-
     public String[] getSelectedMediaFiles() {
         return selectedMediaFiles;
     }

Modified: roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties?rev=828305&r1=828304&r2=828305&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties Thu Oct
22 05:05:29 2009
@@ -1043,14 +1043,8 @@
 mediaFileEdit.includeGalleryHelp=Check this box if you would like this media \
 file included in the new media file RSS and Atom feeds for your weblog.
 
-mediaFileEdit.createWeblogPost=Create Weblog Post
-mediaFileEdit.createWeblogPostTip=Create a new weblog post with this file \
-included as an image.
-
-mediaFileEdit.createPodcastPost=Create Podcast Post
-mediaFileEdit.createPodcastPostTip=Create a new weblog post with this file \
-included as a podcast, an enclosure that is included in your RSS/Atom feeds \
-and automatically downloaded by feed readers and podcast clients (e.g. iTunes).
+mediaFile.createWeblogPost=Post in weblog
+mediaFile.createPodcastPost=Post in weblog as podcast
 
 mediaFileEdit.includesEnclosure=This weblog entry includes the following media file enclosure:
 

Modified: roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileEdit.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileEdit.jsp?rev=828305&r1=828304&r2=828305&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileEdit.jsp (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileEdit.jsp Thu Oct 22 05:05:29
2009
@@ -131,20 +131,3 @@
 </s:form>
 
 
-<%-- Create Weblog Entry and Create Podcast Entry links --%>
-<br />
-
-<p>
-<a href='#' onclick='javascript:window.parent.onCreateWeblogPost($("#mediaFileId").get(0).value)'>
-    <s:text name="mediaFileEdit.createWeblogPost" />
-</a><br />
-<s:text name="mediaFileEdit.createWeblogPostTip" />
-</p>
-
-<p>
-<a href='#' onclick='javascript:window.parent.onCreatePodcastPost($("#entry_bean_permalink").get(0).value)'>
-    <s:text name="mediaFileEdit.createPodcastPost" />
-</a><br />
-<s:text name="mediaFileEdit.createPodcastPostTip" /><br />
-</p>
-

Modified: roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileView.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileView.jsp?rev=828305&r1=828304&r2=828305&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileView.jsp (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileView.jsp Thu Oct 22 05:05:29
2009
@@ -19,7 +19,6 @@
 
 <link rel="stylesheet" type="text/css" href="<s:url value='/roller-ui/yui/assets/skins/sam/container.css'/>"
/>
 <link rel="stylesheet" type="text/css" href="<s:url value='/roller-ui/yui/menu/assets/skins/sam/menu.css'/>"
/>
-<link rel="stylesheet" type="text/css" href="<s:url value='/roller-ui/yui/button/assets/skins/sam/button.css'/>"
/>
 
 <script type="text/javascript" src="<s:url value='/roller-ui/yui/yahoo-dom-event/yahoo-dom-event.js'/>"></script>
 <script type="text/javascript" src="<s:url value='/roller-ui/yui/container/container-min.js'/>"></script>
@@ -47,6 +46,23 @@
     #myMenu {
         margin-left: 0;
     }
+    span.button {
+        height:15px;
+        width:15px;
+        float:right;
+    }
+    .yui-button button {
+        border-style: none;
+        background-color:transparent;
+        *overflow:visible;
+        cursor:pointer;
+    }
+    .yui-menu-button button {
+        width:15px; height: 15px;
+        background-repeat: no-repeat;
+        background-position: center;
+        background-image: url(<s:url value="/images/add.png"/>);
+    }
 </style>
 
 
@@ -75,8 +91,41 @@
         }
     }
 
+    var menuButtons = {};
+
+    function setupMenuButton(id) {
+        if (!menuButtons[id]) {
+            var mediaFileMenu = [
+                { text: "<s:text name='mediaFile.createWeblogPost' />", value: 1, onclick:
{ fn: onCreateWeblogPost, obj:id } },
+                { text: "<s:text name='mediaFile.createPodcastPost' />", value: 2,
onclick: { fn: onCreatePodcastPost, obj:id } }
+            ];
+            menuButtons[id] = new YAHOO.widget.Button({
+                type: "menu", label: "", name: id,
+                menu: mediaFileMenu, container: 'addbutton-' + id });
+            $('#addbutton-img' + id).hide();
+        }
+    }
+
+    function onCreateWeblogPost(p_sType, p_aArgs, id) {
+        $("#selectedImage").get(0).value = id;
+        $("#type").get(0).value = 'weblog';
+        $("#createPostForm").get(0).submit();
+    }
+
+    function onCreatePodcastPost(p_sType, p_aArgs, id) {
+        $("#selectedImage").get(0).value = id;
+        $("#type").get(0).value = 'podcast';
+        $("#createPostForm").get(0).submit();
+    }
+
 </script>
 
+<s:form id="createPostForm" action='entryAddWithMediaFile'>
+    <input type="hidden" name="weblog" value='<s:property value="actionWeblog.handle"
/>' />
+    <input type="hidden" name="selectedImage" id="selectedImage" />
+    <input type="hidden" name="type" id="type" />
+</s:form>
+
 
 <%-- ********************************************************************* --%>
 
@@ -164,7 +213,7 @@
                 <s:param name="weblog" value="%{actionWeblog.handle}" />
             </s:url>
             <s:a href="%{getDirectoryByPathUrl}"><s:property value="#directory.value"
/></s:a> /
-            
+
         </s:iterator>
     </p>
     <p class="pagetip">
@@ -241,12 +290,12 @@
                                   onclick="onSelectDirectory('<s:property value="#directory.id"/>')"/>
                         </div>
                         <div class="mediaObjectInfo">
-                            <label><s:property value="#directory.name" /></label>
-                                <input type="checkbox" style="float:right"
-                                       name="selectedMediaFileDirectories"
-                                       value="<s:property value="#directory.id"/>"/>
-                                <inut type="hidden" id="mediadiridentity"
-                                       value="<s:property value='#directory.id'/>">
+                            <input type="checkbox"
+                                   name="selectedMediaFileDirectories"
+                                   value="<s:property value="#directory.id"/>"/>
+                            <inut type="hidden" id="mediadiridentity"
+                                   value="<s:property value='#directory.id'/>">
+                            <s:property value="#directory.name" />
                         </div>
                     </li>
                 </s:iterator>
@@ -275,20 +324,25 @@
 
                         </div>
 
-                        <div class="mediaObjectInfo">
+                        <div class="mediaObjectInfo"
+                             onmouseover='setupMenuButton("<s:property value='#mediaFile.id'
/>")'>
 
-                            <label class="mediaFile">
-                                <str:truncateNicely lower="40" upper="50">
-                                    <s:property value="#mediaFile.name" />
-                                </str:truncateNicely>
-                                <input type="checkbox" style="float:right"
-                                       name="selectedMediaFiles"
-                                       value="<s:property value="#mediaFile.id"/>"/>
-                                <inut type="hidden" id="mediafileidentity"
-                                       value="<s:property value='#mediaFile.id'/>">
-                            </label>
+                            <input type="checkbox"
+                                   name="selectedMediaFiles"
+                                   value="<s:property value="#mediaFile.id"/>" />
+                            <input type="hidden" id="mediafileidentity"
+                                   value="<s:property value='#mediaFile.id'/>" />
+
+                            <str:truncateNicely lower="40" upper="50">
+                                <s:property value="#mediaFile.name" />
+                            </str:truncateNicely>
+
+                            <span class="button" id="addbutton-<s:property value='#mediaFile.id'
/>">
+                                <img id="addbutton-img<s:property value='#mediaFile.id'
/>"
+                                     src="<s:url value="/images/add.png"/>" />
+                            </span>
 
-                        </div>
+                       </div>
 
                     </li>
 
@@ -324,19 +378,23 @@
 
                         </div>
 
-                        <div class="mediaObjectInfo">
+                        <div class="mediaObjectInfo"
+                             onmouseover='setupMenuButton("<s:property value='#mediaFile.id'
/>")'>
 
-                            <label>
-                                <str:truncateNicely lower="40" upper="50">
-                                    <s:property value="#mediaFile.name" />
-                                </str:truncateNicely>
-                                <input type="checkbox" style="float:right"
+                                <input type="checkbox"
                                        name="selectedMediaFiles"
                                        value="<s:property value="#mediaFile.id"/>"/>
                                 <inut type="hidden" id="mediafileidentity"
                                        value="<s:property value='#mediaFile.id'/>">
-                            </label>
 
+                                <str:truncateNicely lower="40" upper="50">
+                                    <s:property value="#mediaFile.name" />
+                                </str:truncateNicely>
+
+                                <span class="button" id="addbutton-<s:property value='#mediaFile.id'
/>">
+                                    <img id="addbutton-img<s:property value='#mediaFile.id'
/>"
+                                         src="<s:url value="/images/add.png"/>" />
+                                </span>
 
                         </div>
 
@@ -371,32 +429,6 @@
 </s:if>
 
 
-
-<%-- ***************************************************************** --%>
-
-<%-- code to create new weblog post when Media File Edit lightbox requests it --%>
-
-<script type="text/javascript">
-
-    function onCreateWeblogPost(mediaFileId) {
-        $("#selectedImage").get(0).value = mediaFileId;
-        $("#createPostForm").get(0).submit();
-    }
-
-    function onCreatePodcastPost(enclosureURL) {
-        $("#enclosureUrl").get(0).value = enclosureURL;
-        $("#createPostForm").get(0).submit();
-    }
-
-</script>
-
-<s:form id="createPostForm" action='entryAddWithMediaFile'>
-    <input type="hidden" name="weblog" value='<s:property value="actionWeblog.handle"
/>' />
-    <input type="hidden" name="selectedImage" id="selectedImage" />
-    <input type="hidden" name="enclosureUrl" id="enclosureUrl" />
-</s:form>
-
-
 <%-- ***************************************************************** --%>
 
 <%-- code to toggle buttons on/off as media file/directory selections change --%>
@@ -475,4 +507,4 @@
         </iframe>
     </div>
     <div class="ft"></div>
-</div> 
+</div>



Mime
View raw message