roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1618065 - in /roller/trunk: ./ app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/ app/src/main/resources/ app/src/main/webapp/WEB-INF/jsps/editor/
Date Thu, 14 Aug 2014 21:45:48 GMT
Author: gmazza
Date: Thu Aug 14 21:45:48 2014
New Revision: 1618065

URL: http://svn.apache.org/r1618065
Log:
Added ability to add non-image media files from Entry Edit screen; creating blog entries from
Media File Add success operative again.

Modified:
    roller/trunk/LICENSE.txt
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBean.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java
    roller/trunk/app/src/main/resources/ApplicationResources.properties
    roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/EntryEditor.jsp
    roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileAddSuccess.jsp
    roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileImageChooser.jsp
    roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileView.jsp

Modified: roller/trunk/LICENSE.txt
URL: http://svn.apache.org/viewvc/roller/trunk/LICENSE.txt?rev=1618065&r1=1618064&r2=1618065&view=diff
==============================================================================
--- roller/trunk/LICENSE.txt (original)
+++ roller/trunk/LICENSE.txt Thu Aug 14 21:45:48 2014
@@ -14,11 +14,18 @@ http://yuilibrary.com/license/
 
 jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license
 
-
-And Roller contains some snippets of code from the Blojsom and Pebble
+Roller contains some snippets of code from the Blojsom and Pebble
 blog servers, which are both licensed under the terms of the BSD license 
 (http://www.opensource.org/licenses/bsd-license.php).
 
+-------------------------------------------------------------------------------
+
+Some themes packaged with Roller use Font Awesome by Dave Gandy
+(http://fontawesome.io), whose licensing is subject to the SIL OFL 1.1:
+http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL
+
+Some themes packaged with Roller use the MIT-licensed Bootstrap:
+https://github.com/twbs/bootstrap/blob/master/LICENSE
 
 -------------------------------------------------------------------------------
 

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java?rev=1618065&r1=1618064&r2=1618065&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java
Thu Aug 14 21:45:48 2014
@@ -37,8 +37,9 @@ public class EntryAddWithMediaFile exten
     private EntryBean bean = new EntryBean();
 
     private String   weblog = null;
-    private String   type = null;
+    // used by MediaFileView.jsp: multiple images and optional enclosure URL to create a
blog post
     private String[] selectedImages = null;
+    // used by MediaFileView.jsp: single image to create a blog post
     private String   selectedImage = null;
     
 
@@ -65,11 +66,10 @@ public class EntryAddWithMediaFile exten
 
             StringBuilder sb = new StringBuilder();
 
-            if ("weblog".equals(type) && selectedImages != null) {
-
-                for (int i=0; i<selectedImages.length; i++) {
-                    MediaFile mediaFile = manager.getMediaFile(selectedImages[i]);
-                    String link = "";
+            if (selectedImages != null) {
+                for (String image : selectedImages) {
+                    MediaFile mediaFile = manager.getMediaFile(image);
+                    String link;
 
                     if (mediaFile.isImageFile()) {
                         link = "<p>" + mediaFile.getName() + "</p>";
@@ -90,15 +90,13 @@ public class EntryAddWithMediaFile exten
                 }
             }
 
-            else if ("podcast".equals(type) && StringUtils.isNotEmpty(selectedImage))
{
-                MediaFile podcastFile = manager.getMediaFile(selectedImage);
+            if (bean.getEnclosureURL() != null) {
                 sb.append("<p>")
                   .append(getText("mediaFileEdit.includesEnclosure"))
                   .append("<br />")
                   .append("<a href=''>")
-                  .append(podcastFile.getPermalink())
+                  .append(bean.getEnclosureURL())
                   .append("</a></p>");
-                bean.setEnclosureURL(podcastFile.getPermalink());
             }
 
             bean.setText(sb.toString());
@@ -132,20 +130,6 @@ public class EntryAddWithMediaFile exten
     }
 
     /**
-     * @return the type
-     */
-    public String getType() {
-        return type;
-    }
-
-    /**
-     * @param type the enclosureUrl to set
-     */
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    /**
      * @return the weblog
      */
     public String getWeblog() {

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBean.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBean.java?rev=1618065&r1=1618064&r2=1618065&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBean.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBean.java
Thu Aug 14 21:45:48 2014
@@ -219,8 +219,8 @@ public class EntryBean {
         return enclosureURL;
     }
     
-    public void setEnclosureURL(String trackbackUrl) {
-        this.enclosureURL = trackbackUrl;
+    public void setEnclosureURL(String enclosureUrl) {
+        this.enclosureURL = enclosureUrl;
     }
     
     public String getSearchDescription() {

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java?rev=1618065&r1=1618064&r2=1618065&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java
Thu Aug 14 21:45:48 2014
@@ -91,11 +91,8 @@ public class MediaFileImageChooser exten
 
             this.childFiles = new ArrayList<MediaFile>();
 
-            // only add image files
             for (MediaFile mf : directory.getMediaFiles()) {
-                if (mf.isImageFile()) {
-                    this.childFiles.add(mf);
-                }
+                this.childFiles.add(mf);
             }
 
             Collections.sort(this.childFiles, new MediaFileComparator(

Modified: roller/trunk/app/src/main/resources/ApplicationResources.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/ApplicationResources.properties?rev=1618065&r1=1618064&r2=1618065&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/ApplicationResources.properties (original)
+++ roller/trunk/app/src/main/resources/ApplicationResources.properties Thu Aug 14 21:45:48
2014
@@ -35,6 +35,7 @@ generic.delete=Delete
 generic.tagline=Tagline
 generic.error.check.logs=Roller system error - Have administrator check Roller logs for more
information.
 generic.changes.saved=Changes saved
+generic.toggle=Toggle
 
 # ------------------------------------------------------------- BookmarkForm.jsp
 
@@ -725,7 +726,6 @@ maintenance.message.reset=Successfully r
 
 # ----------------------------------------------------------- Media file management
 
-mediaFileChooser.popupTitle=Insert Media File
 mediaFileImageChooser.subtitle=Choose an image
 mediaFileImageChooser.rootPageTip=Click to choose an image or click on a \
 directory to enter it.
@@ -817,7 +817,6 @@ mediaFileView.sortBy=Sort by
 
 mediaFileView.deleteSelected=Delete selected
 mediaFileView.moveSelected=Move selected to:
-mediaFileView.toggleSelected=Select all/none
 mediaFileView.deleteFolder=Delete folder
 
 mediaFileView.gt=>
@@ -1490,6 +1489,7 @@ weblogEdit.entryRemoved=Entry "{0}" dele
 weblogEdit.draft=Draft
 weblogEdit.draftEntries=Recent Drafts
 weblogEdit.deleteEntry=Delete Entry
+weblogEdit.insertMediaFile=Insert Media File
 weblogEdit.fullPreviewMode=Full Preview
 weblogEdit.locale=Language
 weblogEdit.pendingEntries=Pending Entries

Modified: roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/EntryEditor.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/EntryEditor.jsp?rev=1618065&r1=1618064&r2=1618065&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/EntryEditor.jsp (original)
+++ roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/EntryEditor.jsp Thu Aug 14 21:45:48
2014
@@ -29,7 +29,7 @@
     <h3>
         <s:text name="weblogEdit.content" />
         <span style="font-weight:normal;float:right;">
-            <a href="#" onClick="onClickAddImage();">Add Image</a>
+            <a href="#" onClick="onClickAddImage();"><s:text name="weblogEdit.insertMediaFile"
/></a>
         </span>
     </h3>
     <div>
@@ -45,7 +45,7 @@
 <%-- ********************************************************************* --%>
 <%-- Lightbox for popping up image chooser --%>
 
-<div id="mediafile_edit_lightbox" title="<s:text name='mediaFileChooser.popupTitle'/>"
style="display:none">
+<div id="mediafile_edit_lightbox" title="<s:text name='weblogEdit.insertMediaFile'/>"
style="display:none">
     <iframe id="mediaFileEditor"
             style="visibility:inherit"
             height="100%"
@@ -77,10 +77,14 @@
         $("#mediaFileEditor").attr('src','about:blank');
     }
 
-    function onSelectImage(name, url) {
+    function onSelectMediaFile(name, url, isImage) {
         $("#mediafile_edit_lightbox").dialog("close");
         $("#mediaFileEditor").attr('src','about:blank');
-        insertImage('<a href="' + url + '"><img src="' + url + '?t=true" alt="'
+ name+ '"></img></a>');
+        if (isImage == "true") {
+            insertMediaFile('<a href="' + url + '"><img src="' + url + '?t=true"
alt="' + name+ '"></img></a>');
+        } else {
+            insertMediaFile('<a href="' + url + '">' + name + '</a>');
+        }
     }
 </script>
 
@@ -92,8 +96,8 @@
             $( "#accordion" ).accordion({
             });
         });
-        function insertImage(imageURL) {
-            insertAtCursor(document.getElementById('edit_content'), imageURL);
+        function insertMediaFile(anchorTag) {
+            insertAtCursor(document.getElementById('edit_content'), anchorTag);
         }
         function insertAtCursor(textAreaElement, valueForInsertion) {
             if (document.selection) {
@@ -149,8 +153,8 @@
             });
         });
 
-        function insertImage(imageURL) {
-            xinha_editors.edit_content.insertHTML(imageURL);
+        function insertMediaFile(anchorTag) {
+            xinha_editors.edit_content.insertHTML(anchorTag);
         }
 
         summary_editor_initialized = false;

Modified: roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileAddSuccess.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileAddSuccess.jsp?rev=1618065&r1=1618064&r2=1618065&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileAddSuccess.jsp (original)
+++ roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileAddSuccess.jsp Thu Aug 14
21:45:48 2014
@@ -33,30 +33,32 @@
 
 <script>
     $(document).ready(function() {
-
         $("#submit").attr("disabled", true);
 
         $("input[type='checkbox']").change(function() {
-            $("#submit").attr("disabled", true);
-            var boxes = $("input[type='checkbox']");
-            for (var i=0; i<boxes.length; i++) {
-                if (boxes.get(i).checked) {
-                    $("#submit").attr("disabled", false);
-                    break;
-                }
-            }
-            if ($("#enclosureUrl").get(0).getAttribute("value") != '') {
+            if ($("#enclosureURL").get(0).getAttribute("value") != '') {
+                $("#submit").attr("disabled", false);
+                return;
             }
+            $("#submit").attr("disabled", isImageChecked() ? false : true);
         });
     });
-
+    function isImageChecked() {
+        var boxes = $("input[type='checkbox']");
+        for (var i=0; i<boxes.length; i++) {
+            if (boxes.get(i).checked) {
+                return true;
+            }
+        }
+        return false;
+    }
     function setEnclosure(url) {
-        $("#enclosureUrl").get(0).value = url;
-        if (url != '') {
+        $("#enclosureURL").get(0).value = url;
+        if (isImageChecked()) {
             $("#submit").attr("disabled", false);
-        } else {
-            $("#submit").attr("disabled", true);
+            return;
         }
+        $("#submit").attr("disabled", url == '' ? true : false);
     }
 </script>
 
@@ -68,12 +70,10 @@
     <s:text name="mediaFileSuccess.pageTip" />
 </p>
 
-<s:form id="entry" action="entryAddWithMediaFile">
+<s:form id="entry">
 	<s:hidden name="salt" />
     <s:hidden name="weblog" />
-    <s:hidden name="enclosureUrl" id="enclosureUrl" />
-    <input type="hidden" name="type" value="weblog" />
-
+    <s:hidden name="bean.enclosureURL" id="enclosureURL" />
 
     <s:if test="newImages.size() > 0">
         <p><s:text name="mediaFileSuccess.selectImages" /></p>
@@ -120,7 +120,7 @@
     <s:if test="newFiles.size() > 0">
         <p><s:text name="mediaFileSuccess.selectEnclosure" /></p>
 
-        <%-- checkboxed list of other files uploaded uploaded --%>
+        <%-- checkboxed list of other files uploaded --%>
         <table class="mediaFileTable">
             <s:iterator value="newFiles" id="newFile">
             <tr>
@@ -151,7 +151,7 @@
     <div style="margin-top:20px"">
 
         <p><s:text name="mediaFileSuccess.createPostPrompt" /></p>
-        <input type="submit" id="submit" value='<s:text name="mediaFileSuccess.createPost"
/>' />
+        <s:submit id="submit" value="%{getText('mediaFileSuccess.createPost')}" action="entryAddWithMediaFile"/>
         <br/>
         <br/>
         <br/>

Modified: roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileImageChooser.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileImageChooser.jsp?rev=1618065&r1=1618064&r2=1618065&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileImageChooser.jsp (original)
+++ roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileImageChooser.jsp Thu Aug
14 21:45:48 2014
@@ -148,7 +148,8 @@
                             value="%{#mediaFile.thumbnailURL}"></s:url>
 
                         <div class="mediaObject"
-                             onclick="onSelectImage('<s:property value="#mediaFile.name"/>','<s:property
value="%{mediaFileURL}" />')" >
+                             onclick="onSelectMediaFile('<s:property value="#mediaFile.name"/>',
+                             '<s:property value="%{mediaFileURL}" />','<s:property
value="#mediaFile.isImageFile()"/>')" >
 
                             <s:if test="#mediaFile.imageFile">
 
@@ -185,9 +186,7 @@
 
 
 <script>
-<!--
-    function onSelectImage(name, url) {
-        window.parent.onSelectImage(name, url);
+    function onSelectMediaFile(name, url, isImage) {
+        window.parent.onSelectMediaFile(name, url, isImage);
     }
--->
 </script>

Modified: roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileView.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileView.jsp?rev=1618065&r1=1618064&r2=1618065&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileView.jsp (original)
+++ roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileView.jsp Thu Aug 14 21:45:48
2014
@@ -383,7 +383,7 @@
             <span style="padding-left:7px">
                 <s:if test="(!pager && childFiles.size() > 0) || (pager &&
pager.items.size() > 0)">
                     <input id="toggleButton" type="button"
-                       value='<s:text name="mediaFileView.toggleSelected" />' onclick="onToggle()"
/>
+                       value='<s:text name="generic.toggle" />' onclick="onToggle()"
/>
 
                     <input id="deleteButton" type="button"
                        value='<s:text name="mediaFileView.deleteSelected" />' onclick="onDeleteSelected()"
/>
@@ -397,9 +397,9 @@
 
             <s:if test="currentDirectory.name != 'default' && !pager">
                 <!-- need a clearfix to use this float -->
-                <!-- <span style="float:right"> -->
+                <span style="float:right">
                     <s:submit value="%{getText('mediaFileView.deleteFolder')}" action="mediaFileView!deleteFolder"
onclick="onDeleteFolder();return false;"/>
-                <!-- </span> -->
+                </span>
             </s:if>
         </div>
     </s:if>
@@ -411,7 +411,7 @@
 
 <%-- ***************************************************************** --%>
 
-<div id="mediafile_edit_lightbox" title="<s:text name='mediaFileEdit.popupTitle'/>">
+<div id="mediafile_edit_lightbox" title="<s:text name='mediaFileEdit.popupTitle'/>"
style="display:none">
     <iframe id="mediaFileEditor"
             style="visibility:inherit"
             height="100%"



Mime
View raw message