roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r798011 - in /roller/trunk/apps/weblogger: src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileView.java web/WEB-INF/jsps/editor/MediaFileView.jsp
Date Mon, 27 Jul 2009 01:38:44 GMT
Author: snoopdave
Date: Mon Jul 27 01:38:44 2009
New Revision: 798011

URL: http://svn.apache.org/viewvc?rev=798011&view=rev
Log:
Make sort-by-name the default

Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileView.java
    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/MediaFileView.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileView.java?rev=798011&r1=798010&r2=798011&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileView.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileView.java
Mon Jul 27 01:38:44 2009
@@ -146,20 +146,26 @@
             this.childFiles = new ArrayList<MediaFile>();
             this.childFiles.addAll(directory.getMediaFiles());
 
-            if (!StringUtils.isEmpty(this.sortBy)) {
-                if ("name".equals(sortBy)) {
-                    Collections.sort(this.childDirectories, new MediaFileDirectoryComparator(DirectoryComparatorType.NAME));
-                    Collections.sort(this.childFiles, new MediaFileComparator(MediaFileComparatorType.NAME));
-                } else if ("type".equals(sortBy)) {
-                    Collections.sort(this.childFiles, new MediaFileComparator(MediaFileComparatorType.TYPE));
-                } else if ("date_uploaded".equals(sortBy)) {
-                    Collections.sort(this.childFiles, new MediaFileComparator(MediaFileComparatorType.DATE_UPLOADED));
-                }
+            if ("type".equals(sortBy)) {
+                Collections.sort(this.childFiles,
+                        new MediaFileComparator(MediaFileComparatorType.TYPE));
+                
+            } else if ("date_uploaded".equals(sortBy)) {
+                Collections.sort(this.childFiles,
+                        new MediaFileComparator(MediaFileComparatorType.DATE_UPLOADED));
+
+            } else { // default to sort by name
+                sortBy = "name";
+                Collections.sort(this.childDirectories,
+                        new MediaFileDirectoryComparator(DirectoryComparatorType.NAME));
+                Collections.sort(this.childFiles,
+                        new MediaFileComparator(MediaFileComparatorType.NAME));
             }
 
             this.currentDirectory = directory;
 
             return SUCCESS;
+
         } catch (FileIOException ex) {
             log.error("Error viewing media file directory ", ex);
             addError("MediaFile.error.view");

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=798011&r1=798010&r2=798011&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 Mon Jul 27 01:38:44
2009
@@ -285,46 +285,47 @@
   <ul id = "myMenu">
 
     <s:iterator id="directory" value="childDirectories">
-        <li class="align-images" >
+    <li class="align-images" >
         <div style="border:1px solid #000000;width:120px;height:100px;margin:5px;">
-        <img  border="0" src='<s:url value="/images/folder.png"/>' class="dir-image"
alt="mediaFolder.png" onclick="onSelectDirectory('<s:property value="#directory.id"/>')"/>
+            <img  border="0" src='<s:url value="/images/folder.png"/>' class="dir-image"
alt="mediaFolder.png" onclick="onSelectDirectory('<s:property value="#directory.id"/>')"/>
         </div>
         <div style="clear:left;width:130px;margin-left:10px;font-size:11px;"><label><s:property
value="#directory.name" /></label>
         </div>
-        </li>
+    </li>
     </s:iterator>
 
 
     <s:iterator id="mediaFile" value="childFiles">
-        <li class="align-images" >
+    <li class="align-images" >
         <s:if test="#mediaFile.imageFile">
-        <s:url id="mediaFileURL" value="/roller-ui/rendering/media-resources/%{#mediaFile.id}"></s:url>
+            <s:url id="mediaFileURL" value="/roller-ui/rendering/media-resources/%{#mediaFile.id}"></s:url>
         </s:if>
         <s:else>
-        <s:url id="mediaFileURL" value="/images/page.png"></s:url>
+            <s:url id="mediaFileURL" value="/images/page.png"></s:url>
         </s:else>
         <div style="border:1px solid #000000;width:120px;height:100px;margin:5px;">
-        <img border="0" src='<s:property value="%{mediaFileURL}" />' <s:if test="#mediaFile.imageFile">
width="120px" height="100px" </s:if> <s:else>style="padding:40px 50px;"</s:else>/>
+            <img border="0" src='<s:property value="%{mediaFileURL}" />' <s:if
test="#mediaFile.imageFile"> width="120px" height="100px" </s:if> <s:else>style="padding:40px
50px;"</s:else>/>
         </div>
         <div style="clear:left;width:130px;margin-left:5px;font-size:11px;">
 
-        <label>
-           <str:truncateNicely upper="50">
-               <s:property value="#mediaFile.name" />
-           </str:truncateNicely>
-        </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'/>">
-
-        <div style="float:right;">
-        <a  href="#" id="<s:property value='#mediaFile.id'/>" onclick="onClickEdit(this.id)">Edit</a>
-        <a  class="contextMenu" href="#">More...</a>
+            <label>
+               <str:truncateNicely upper="50">
+                   <s:property value="#mediaFile.name" />
+               </str:truncateNicely>
+            </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'/>">
+
+                <div style="float:right;">
+                    <a  href="#" id="<s:property value='#mediaFile.id'/>" onclick="onClickEdit(this.id)">Edit</a>
+                    <a  class="contextMenu" href="#">More...</a>
+                </div>
+            </div>  <!-- one -->
+            
         </div>
-        </div>  <!-- one -->
-        </div>
-        </li>
+    </li>
     </s:iterator>
 
   </ul>



Mime
View raw message