roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r561131 - in /roller/trunk/apps/weblogger: src/java/org/apache/roller/weblogger/config/ src/java/org/apache/roller/weblogger/pojos/ src/java/org/apache/roller/weblogger/ui/struts2/editor/ src/java/org/apache/roller/weblogger/util/ web/WEB-I...
Date Mon, 30 Jul 2007 21:27:15 GMT
Author: snoopdave
Date: Mon Jul 30 14:27:14 2007
New Revision: 561131

URL: http://svn.apache.org/viewvc?view=rev&rev=561131
Log:
Fixing http://opensource.atlassian.com/projects/roller/browse/ROL-1504
Multiple problems with entry enclosure/MediaCast: entry attributes were not being persisted,
MediaCast was not being saved/remove in EntryEdit.java, typo in resource name, etc.  

Fixing http://opensource.atlassian.com/projects/roller/browse/ROL-1487
Added permalink back to entry page, but made it optional (defaulting to enabled)

Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/roller.properties
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntry.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntry.orm.xml
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/MediacastUtil.java
    roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties
    roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/EntryEdit.jsp

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/roller.properties
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/roller.properties?view=diff&rev=561131&r1=561130&r2=561131
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/roller.properties
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/roller.properties
Mon Jul 30 14:27:14 2007
@@ -652,6 +652,9 @@
 # Characters to be allowed in user names (change at your own risk)
 username.allowedChars=A-Za-z0-9
 
+# weblog entry editor
+weblogentry.editor.showFullPermalink=true
+
 # editor theme to be used (corresponds to directory name under /theme)
 editor.theme=tan
 

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntry.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntry.java?view=diff&rev=561131&r1=561130&r2=561131
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntry.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntry.java
Mon Jul 30 14:27:14 2007
@@ -429,9 +429,11 @@
             att.setValue(value);
         }
     }
+    
     public void onRemoveEntryAttribute(WeblogEntryAttribute att) throws WebloggerException
{
         attMap.remove(att.getName());
     }
+    
     //-------------------------------------------------------------------------
     
     /**

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntry.orm.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntry.orm.xml?view=diff&rev=561131&r1=561130&r2=561131
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntry.orm.xml
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntry.orm.xml
Mon Jul 30 14:27:14 2007
@@ -143,7 +143,7 @@
             </many-to-one>
             <one-to-many name="entryAttributes" mapped-by="entry" target-entity="org.apache.roller.weblogger.pojos.WeblogEntryAttribute"
fetch="LAZY">
                 <cascade>
-                    <cascade-remove/>
+                    <cascade-persist/>
                 </cascade>
             </one-to-many>
             <one-to-many name="tags" mapped-by="weblogEntry" target-entity="org.apache.roller.weblogger.pojos.WeblogEntryTag"
fetch="LAZY">

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java?view=diff&rev=561131&r1=561130&r2=561131
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
Mon Jul 30 14:27:14 2007
@@ -35,6 +35,9 @@
 import org.apache.roller.weblogger.pojos.WeblogEntry;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 import org.apache.roller.weblogger.util.MailUtil;
+import org.apache.roller.weblogger.util.MediacastException;
+import org.apache.roller.weblogger.util.MediacastResource;
+import org.apache.roller.weblogger.util.MediacastUtil;
 import org.apache.roller.weblogger.util.RollerMessages;
 import org.apache.roller.weblogger.util.RollerMessages.RollerMessage;
 import org.apache.roller.weblogger.util.Trackback;
@@ -150,13 +153,31 @@
                 entry.setPinnedToMain(getBean().getPinnedToMain());
             }
             
-//            // Fetch MediaCast content type and length
-//            log.debug("Checking MediaCast attributes");
-//            if (!checkMediaCast(entry)) {
-//                log.debug("Invalid MediaCast attributes");
-//            } else {
-//                log.debug("Validated MediaCast attributes");
-//            }
+            if(!StringUtils.isEmpty(getBean().getEnclosureURL())) {
+                try {
+                    // Fetch MediaCast resource
+                    log.debug("Checking MediaCast attributes");
+                    MediacastResource mediacast = MediacastUtil.lookupResource(getBean().getEnclosureURL());
+
+                    // set mediacast attributes
+                    entry.putEntryAttribute("att_mediacast_url", mediacast.getUrl());
+                    entry.putEntryAttribute("att_mediacast_type", mediacast.getContentType());
+                    entry.putEntryAttribute("att_mediacast_length", ""+mediacast.getLength());
+
+                } catch (MediacastException ex) {
+                    addMessage(getText(ex.getErrorKey()));
+                }
+            } else {
+                try {
+                    // if MediaCast string is empty, clean out MediaCast attributes
+                    weblogMgr.removeWeblogEntryAttribute("att_mediacast_url", entry);
+                    weblogMgr.removeWeblogEntryAttribute("att_mediacast_type", entry);
+                    weblogMgr.removeWeblogEntryAttribute("att_mediacast_length", entry);
+                    
+                } catch (WebloggerException e) {
+                    addMessage(getText("weblogEdit.mediaCastErrorRemoving"));
+                }
+            }
             
             if(log.isDebugEnabled()) {
                 log.debug("entry bean is ...\n"+getBean().toString());

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/MediacastUtil.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/MediacastUtil.java?view=diff&rev=561131&r1=561130&r2=561131
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/MediacastUtil.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/MediacastUtil.java
Mon Jul 30 14:27:14 2007
@@ -84,20 +84,7 @@
         } catch (Exception e) {
             log.error("ERROR while checking MediaCast URL: " + url + ": " + e.getMessage());
             throw new MediacastException(CHECK_FAILED, "weblogEdit.mediaCastFailedFetchingInfo",
e);
-        }
-        
-//        if (!valid) {
-//            log.debug("Removing MediaCast attributes");
-//            WeblogManager weblogManager = WebloggerFactory.getRoller().getWeblogManager();
-//            try {
-//                weblogManager.removeWeblogEntryAttribute("att_mediacast_url", entry);
-//                weblogManager.removeWeblogEntryAttribute("att_mediacast_type", entry);
-//                weblogManager.removeWeblogEntryAttribute("att_mediacast_length", entry);
-//            } catch (Exception e) {
-//                log.error("ERROR removing invalid MediaCast attributes");
-//            }
-//        }
-        
+        }      
         return resource;
     }
     

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?view=diff&rev=561131&r1=561130&r2=561131
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties Mon Jul
30 14:27:14 2007
@@ -1752,12 +1752,13 @@
 
 weblogEdit.enclosureURL=Enclosure URL
 weblogEdit.enclosureType=Type
-weblogEdit.encosureLegnth=Length
+weblogEdit.enclosureLength=Length
 weblogEdit.encosureInvalid=Enclosure URL is invalid
 weblogEdit.mediaCastFailedFetchingInfo=Unable to reach the enclosure. Check the hostname
in the URL.
 weblogEdit.mediaCastUrlMalformed=The enclosure URL was malformed.
 weblogEdit.mediaCastResponseError=The enclosure server returned an error. Do you have the
right URL?
 weblogEdit.mediaCastLacksContentTypeOrLength=Unable to use enclosure URL. Server provided
no content type or no length.
+weblogEdit.mediaCastErrorRemoving=Error removing MediaCast from weblog entry
 weblogEdit.error.incompleteEntry=Entry must have a title
 
 # errors from validation

Modified: roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/EntryEdit.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/EntryEdit.jsp?view=diff&rev=561131&r1=561130&r2=561131
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/EntryEdit.jsp (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/EntryEdit.jsp Mon Jul 30 14:27:14
2007
@@ -59,8 +59,12 @@
                         <s:text name="weblogEdit.published" />
                         (<s:text name="weblogEdit.updateTime" />
                         <s:date name="entry.updateTime" format="dd/MM/yyyy hh:mm a" />)
-                        &nbsp;&nbsp;&nbsp;&nbsp;<img src="<s:url value="/images/launch-link.png"/>"
/>
-                        <a href='<s:property value="entry.permalink" />'><s:text
name="weblogEdit.permaLink" /></a>
+                        
+                        <s:if test='!getBooleanProp("weblogentry.editor.showFullPermalink")'>
+                            &nbsp;&nbsp;&nbsp;&nbsp;<img src='<s:url
value="/images/launch-link.png"/>' />
+                            <a href='<s:property value="entry.permalink" />'><s:text
name="weblogEdit.permaLink" /></a>
+                        </s:if>
+                        
                     </span>
                 </s:if>
                 <s:elseif test="bean.draft">
@@ -81,6 +85,23 @@
             </td>
         </tr>
     
+        <s:if test='getBooleanProp("weblogentry.editor.showFullPermalink")'>
+            <tr>
+                <td class="permalinkLabel">
+                    <label for="permalink"><s:text name="weblogEdit.permaLink" /></label>
+                </td>
+                <td>
+                    <s:if test="bean.published">
+                        <a href='<s:property value="entry.permalink" />'><s:property
value="entry.permalink" /></a>
+                        <img src='<s:url value="/images/launch-link.png"/>' />
+                    </s:if>
+                    <s:else>
+                        <s:property value="entry.permalink" />
+                    </s:else>
+                </td>
+            </tr>
+        </s:if>
+        
         <tr>
             <td class="entryEditFormLabel">
                 <label for="categoryId"><s:text name="weblogEdit.category" /></label>
@@ -205,8 +226,8 @@
         
         <s:text name="weblogEdit.enclosureURL" />: <s:textfield name="bean.enclosureURL"
size="40" maxlength="255" />
         <s:if test="bean.enclosureURL != null">
-            <s:text name="weblogEdit.enclosureType" />: <s:property value="entry.attributes['att_mediacast_type']"
/>
-            <s:text name="weblogEdit.enclosureLength" />: <s:property value="entry.attributes['att_mediacast_length']"
/>
+            <s:text name="weblogEdit.enclosureType" />: <s:property value='entry.findEntryAttribute("att_mediacast_type")'
/>
+            <s:text name="weblogEdit.enclosureLength" />: <s:property value='entry.findEntryAttribute("att_mediacast_length")'
/>
         </s:if>
     </div>
     



Mime
View raw message