roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r819250 - in /roller/trunk/apps/weblogger: src/java/org/apache/roller/weblogger/business/ src/java/org/apache/roller/weblogger/ui/struts2/editor/ web/WEB-INF/ web/WEB-INF/classes/ web/WEB-INF/jsps/editor/ web/WEB-INF/jsps/tiles/ web/roller-...
Date Sun, 27 Sep 2009 03:16:32 GMT
Author: snoopdave
Date: Sun Sep 27 03:16:24 2009
New Revision: 819250

URL: http://svn.apache.org/viewvc?rev=819250&view=rev
Log:
Fixed broken image chooser in the EntryAdd and EntryEdit pages, see also:
   https://issues.apache.org/jira/browse/ROL-1835

Added:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java
    roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileImageChooser.jsp
Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/MultiWeblogURLStrategy.java
    roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml
    roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/EntryAdd.jsp
    roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/EntryEdit.jsp
    roller/trunk/apps/weblogger/web/WEB-INF/jsps/tiles/tiles-popuppage.jsp
    roller/trunk/apps/weblogger/web/WEB-INF/tiles.xml
    roller/trunk/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp
    roller/trunk/apps/weblogger/web/roller-ui/styles/roller.css

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/MultiWeblogURLStrategy.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/MultiWeblogURLStrategy.java?rev=819250&r1=819249&r2=819250&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/MultiWeblogURLStrategy.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/MultiWeblogURLStrategy.java
Sun Sep 27 03:16:24 2009
@@ -115,8 +115,9 @@
             url.append(WebloggerRuntimeConfig.getRelativeContextURL());
         }
         
-        url.append("/mediaresource/");
+        url.append("/");
         url.append(weblog.getHandle());
+        url.append("/mediaresource/");
         url.append("/");
         url.append(URLUtilities.encode(fileAnchor));
         

Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java?rev=819250&view=auto
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java
(added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java
Sun Sep 27 03:16:24 2009
@@ -0,0 +1,207 @@
+/*
+ * 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.
+ */
+package org.apache.roller.weblogger.ui.struts2.editor;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.weblogger.business.FileIOException;
+import org.apache.roller.weblogger.business.MediaFileManager;
+import org.apache.roller.weblogger.business.WebloggerFactory;
+import org.apache.roller.weblogger.pojos.MediaFile;
+import org.apache.roller.weblogger.pojos.MediaFileComparator;
+import org.apache.roller.weblogger.pojos.MediaFileComparator.MediaFileComparatorType;
+import org.apache.roller.weblogger.pojos.MediaFileDirectory;
+import org.apache.roller.weblogger.pojos.MediaFileDirectoryComparator;
+import org.apache.roller.weblogger.pojos.MediaFileDirectoryComparator.DirectoryComparatorType;
+import org.apache.roller.weblogger.ui.struts2.util.KeyValueObject;
+import org.apache.struts2.interceptor.validation.SkipValidation;
+
+/**
+ * Browse media files action.
+ */
+@SuppressWarnings("serial")
+public class MediaFileImageChooser extends MediaFileBase {
+    private static Log log = LogFactory.getLog(MediaFileImageChooser.class);
+
+    private String directoryId;
+    private String directoryPath;
+
+    private List<MediaFile>          childFiles;
+    private MediaFileDirectory       currentDirectory;
+    private List<MediaFileDirectory> childDirectories;
+
+    public MediaFileImageChooser() {
+        this.actionName = "mediaFileImageChooser";
+        this.desiredMenu = "editor";
+        this.pageTitle = "mediaFileImaegChooser.title";
+    }
+
+    /**
+     * Prepares view action
+     */
+    public void myPrepare() {
+        refreshAllDirectories();
+    }
+
+    /**
+     * Fetches and displays list of media file for the given directory.
+     * The directory could be chosen by ID or path.
+     *
+     * @return String The result of the action.
+     */
+    @SkipValidation
+    public String execute() {
+        MediaFileManager manager = WebloggerFactory.getWeblogger().getMediaFileManager();
+        try {
+            MediaFileDirectory directory;
+            if (this.directoryId != null) {
+                directory = manager.getMediaFileDirectory(this.directoryId);
+            } else if (this.directoryPath != null) {
+                directory = manager.getMediaFileDirectoryByPath(getActionWeblog(), this.directoryPath);
+                this.directoryId = directory.getId();
+            } else {
+                directory = manager.getMediaFileRootDirectory(getActionWeblog());
+                this.directoryId = directory.getId();
+            }
+
+            this.childDirectories = new ArrayList<MediaFileDirectory>();
+            this.childDirectories.addAll(directory.getChildDirectories());
+
+            this.childFiles = new ArrayList<MediaFile>();
+
+            // only add image files
+            for (MediaFile mf : directory.getMediaFiles()) {
+                if (mf.isImageFile()) {
+                    this.childFiles.add(mf);
+                }
+            }
+
+            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");
+            
+        } catch (Throwable e) {
+            log.error("Error viewing media file directory ", e);
+            addError("MediaFile.error.view");
+        }
+        return SUCCESS;
+    }
+
+    /**
+     * Returns the hierarchy of the current directory. This is useful in
+     * displaying path information as breadcrumb.
+     */
+    public List<KeyValueObject> getCurrentDirectoryHierarchy() {
+        List<KeyValueObject> directoryHierarchy = new ArrayList<KeyValueObject>();
+
+        directoryHierarchy.add(new KeyValueObject("/", "root"));
+        String fullPath = this.currentDirectory.getPath();
+        if (fullPath.length() > 1) {
+            String[] directoryNames = fullPath.substring(1).split("/");
+            String directoryPath = "";
+            for (String directoryName : directoryNames) {
+                directoryPath = directoryPath + "/" + directoryName;
+                directoryHierarchy.add(new KeyValueObject(directoryPath, directoryName));
+            }
+        }
+        return directoryHierarchy;
+    }
+
+    /**
+     * @return the directoryId
+     */
+    public String getDirectoryId() {
+        return directoryId;
+    }
+
+    /**
+     * @param directoryId the directoryId to set
+     */
+    public void setDirectoryId(String directoryId) {
+        this.directoryId = directoryId;
+    }
+
+    /**
+     * @return the directoryPath
+     */
+    public String getDirectoryPath() {
+        return directoryPath;
+    }
+
+    /**
+     * @param directoryPath the directoryPath to set
+     */
+    public void setDirectoryPath(String directoryPath) {
+        this.directoryPath = directoryPath;
+    }
+
+    /**
+     * @return the childFiles
+     */
+    public List<MediaFile> getChildFiles() {
+        return childFiles;
+    }
+
+    /**
+     * @param childFiles the childFiles to set
+     */
+    public void setChildFiles(List<MediaFile> childFiles) {
+        this.childFiles = childFiles;
+    }
+
+    /**
+     * @return the currentDirectory
+     */
+    public MediaFileDirectory getCurrentDirectory() {
+        return currentDirectory;
+    }
+
+    /**
+     * @param currentDirectory the currentDirectory to set
+     */
+    public void setCurrentDirectory(MediaFileDirectory currentDirectory) {
+        this.currentDirectory = currentDirectory;
+    }
+
+    /**
+     * @return the childDirectories
+     */
+    public List<MediaFileDirectory> getChildDirectories() {
+        return childDirectories;
+    }
+
+    /**
+     * @param childDirectories the childDirectories to set
+     */
+    public void setChildDirectories(List<MediaFileDirectory> childDirectories) {
+        this.childDirectories = childDirectories;
+    }
+}

Modified: roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml?rev=819250&r1=819249&r2=819250&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml Sun Sep 27 03:16:24 2009
@@ -233,7 +233,6 @@
             <result name="success" type="chain">entryAdd</result>
         </action>
         
-
         <action name="mediaFileAdd!*" method="{1}"
                 class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileAdd">
             <result name="input" type="tiles">.MediaFileAdd</result>
@@ -476,12 +475,12 @@
             <result name="error" type="tiles">.MediaFileAddInclude</result>
         </action>
 
-	<action name="mediaFileSearch!*" method="{1}"
-                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileSearch">
+	<action name="mediaFileImageChooser!*" method="{1}"
+                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileImageChooser">
             <param name="overlayMode">true</param>
-            <result name="input" type="tiles">.MediaFileSearchInclude</result>
-            <result name="error" type="tiles">.MediaFileSearchInclude</result>
-            <result name="success" type="tiles">.MediaFileSearchInclude</result>
+            <result name="input" type="tiles">.MediaFileImageChooser</result>
+            <result name="error" type="tiles">.MediaFileImageChooser</result>
+            <result name="success" type="tiles">.MediaFileImageChooser</result>
         </action>
 
     </package>

Modified: roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/EntryAdd.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/EntryAdd.jsp?rev=819250&r1=819249&r2=819250&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/EntryAdd.jsp (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/EntryAdd.jsp Sun Sep 27 03:16:24 2009
@@ -17,15 +17,19 @@
 --%>
 <%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
 
-<link rel="stylesheet" type="text/css" href="<s:url value='/roller-ui/styles/yui/fonts-min.css'/>"
/>
-<link rel="stylesheet" type="text/css" href="<s:url value='/roller-ui/styles/yui/autocomplete.css'/>"
/>
 <link rel="stylesheet" type="text/css" href="<s:url value='/roller-ui/styles/yui/container.css'/>"
/>
+<link rel="stylesheet" type="text/css" href="<s:url value='/roller-ui/styles/yui/menu.css'/>"
/>
+<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/container/assets/skins/sam/container.css"
/>
 
 <script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/yahoo-dom-event.js'/>"></script>
-<script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/connection-min.js'/>"></script>
-<script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/animation-min.js'/>"></script>
+<script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/container_core-min.js'/>"></script>
+<script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/menu-min.js'/>"></script>
 <script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/datasource-min.js'/>"></script>
 <script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/autocomplete-min.js'/>"></script>
+<script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/dragdrop/dragdrop-min.js"></script>
+<script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/container/container-min.js"></script>
+
+<script type="text/javascript" src="<s:url value="/roller-ui/scripts/jquery-1.3.1.min.js"
/>"></script>
 
 <style>
 #tagAutoCompleteWrapper {
@@ -210,8 +214,6 @@
 
 <script type="text/javascript">
 
-var tags = ["java","jammy","cool","booger","smell"];
-
 YAHOO.example.RemoteCustomRequest = function() {
     //var oDS = new YAHOO.util.LocalDataSource(tags);
     //oDS.responseSchema = {fields:["tag"]};

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?rev=819250&r1=819249&r2=819250&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/EntryEdit.jsp (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/EntryEdit.jsp Sun Sep 27 03:16:24
2009
@@ -17,15 +17,20 @@
 --%>
 <%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
 
-<link rel="stylesheet" type="text/css" href="<s:url value='/roller-ui/styles/yui/fonts-min.css'/>"
/>
-<link rel="stylesheet" type="text/css" href="<s:url value='/roller-ui/styles/yui/autocomplete.css'/>"
/>
 <link rel="stylesheet" type="text/css" href="<s:url value='/roller-ui/styles/yui/container.css'/>"
/>
+<link rel="stylesheet" type="text/css" href="<s:url value='/roller-ui/styles/yui/menu.css'/>"
/>
+<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/container/assets/skins/sam/container.css"
/>
 
 <script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/yahoo-dom-event.js'/>"></script>
-<script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/connection-min.js'/>"></script>
-<script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/animation-min.js'/>"></script>
+<script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/container_core-min.js'/>"></script>
+<script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/menu-min.js'/>"></script>
 <script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/datasource-min.js'/>"></script>
 <script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/autocomplete-min.js'/>"></script>
+<script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/dragdrop/dragdrop-min.js"></script>
+<script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/container/container-min.js"></script>
+
+<script type="text/javascript" src="<s:url value="/roller-ui/scripts/jquery-1.3.1.min.js"
/>"></script>
+
 
 <style>
 #tagAutoCompleteWrapper {

Added: roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileImageChooser.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileImageChooser.jsp?rev=819250&view=auto
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileImageChooser.jsp (added)
+++ roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileImageChooser.jsp Sun Sep
27 03:16:24 2009
@@ -0,0 +1,204 @@
+<%--
+  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" %>
+
+<link rel="stylesheet" type="text/css" href="<s:url value='/roller-ui/styles/yui/container.css'/>"
/>
+<link rel="stylesheet" type="text/css" href="<s:url value='/roller-ui/styles/yui/menu.css'/>"
/>
+<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/container/assets/skins/sam/container.css"
/>
+
+<script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/yahoo-dom-event.js'/>"></script>
+<script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/container_core-min.js'/>"></script>
+<script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/menu-min.js'/>"></script>
+<script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/dragdrop/dragdrop-min.js"></script>
+<script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/container/container-min.js"></script>
+
+<script type="text/javascript" src="<s:url value="/roller-ui/scripts/jquery-1.3.1.min.js"
/>"></script>
+
+
+<style>
+    .mediaObject {
+         width:120px;
+         height:120px;
+    }
+    .mediaObjectInfo {
+        clear:left;
+        width:130px;
+        margin-left:5px;
+        font-size:11px;
+    }
+    .highlight {
+        border: 1px solid #aaa;
+    }
+    #myMenu {
+        margin-left: 0;
+    }
+</style>
+
+<script type="text/javascript">
+<!--
+    function onSelectDirectory(id) {
+        window.location = "?directoryId=" + id + "&weblog=" + '<s:property value="actionWeblog.handle"
/>';
+    }
+-->
+</script>
+
+
+<%-- ********************************************************************* --%>
+
+<%-- Subtitle and folder path --%>
+
+<s:if test='currentDirectory.path.equals("/")'>
+
+    <p class="subtitle">
+        <s:text name="mediaFileImageChooser.subtitle" >
+            <s:param value="weblog" />
+        </s:text>
+    </p>
+    </p>
+    <p class="pagetip">
+        <s:text name="mediaFileImageChooser.rootPageTip" />
+    </p>
+
+</s:if>
+
+<s:else>
+
+    <p class="subtitle">
+        <s:text name="mediaFileView.path"/> /
+        <s:iterator id="directory" value="currentDirectoryHierarchy">
+            <s:url id="getDirectoryByPathUrl" action="mediaFileImageChooser">
+                <s:param name="directoryPath" value="#directory.key" />
+                <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">
+        <s:text name="mediaFileImageChooser.dirPageTip" />
+    </p>
+
+</s:else>
+
+
+<s:if test="childFiles || childDirectories || (pager && pager.items.size() >
0)">
+
+<s:form id="mediaFileChooserForm" name="mediaFileChooserForm" action="mediaFileView">
+
+    <s:hidden name="weblog" />
+    <s:hidden name="directoryId" />
+    <input type="hidden" name="mediaFileId" value="" />
+
+
+    <%-- ***************************************************************** --%>
+
+    <%-- Media file folder contents --%>
+
+    <script type="text/javascript">
+        function highlight(el, flag) {
+            if (flag) {
+                YAHOO.util.Dom.addClass(el, "highlight");
+            } else {
+                YAHOO.util.Dom.removeClass(el, "highlight");
+            }
+        }
+    </script>
+
+
+    <div  width="720px" height="500px">
+        <ul id = "myMenu">
+
+            <s:if test="childDirectories.size() == 0 && childFiles.size() ==0">
+                <p style="text-align: center"><s:text name="mediaFileView.noFiles"/></p>
+            </s:if>
+
+            <%-- --------------------------------------------------------- --%>
+
+            <%-- List media directories first --%>
+
+            <s:iterator id="directory" value="childDirectories">
+                <li class="align-images"
+                        onmouseover="highlight(this, true)" onmouseout="highlight(this, false)">
+                    <div class="mediaObject">
+                        <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 class="mediaObjectInfo">
+                        <label><s:property value="#directory.name" /></label>
+                    </div>
+                </li>
+            </s:iterator>
+
+            <%-- --------------------------------------------------------- --%>
+
+            <%-- List media files next --%>
+
+            <s:iterator id="mediaFile" value="childFiles">
+
+                <li class="align-images"
+                        onmouseover="highlight(this, true)" onmouseout="highlight(this, false)">
+
+                        <s:url id="mediaFileURL" includeContext="false"
+                            value="/%{#mediaFile.weblog.handle}/mediaresource/%{#mediaFile.id}"></s:url>
+
+                        <s:url id="mediaFileThumbnailURL"
+                            value="/%{#mediaFile.weblog.handle}/mediaresource/%{#mediaFile.id}?t=true"></s:url>
+
+                    <div class="mediaObject"
+                         onclick="onSelectImage('<s:property value="#mediaFile.name"/>','<s:property
value="%{mediaFileURL}" />')" >
+
+                        <s:if test="#mediaFile.imageFile">
+
+                            <img border="0" src='<s:property value="%{mediaFileThumbnailURL}"
/>'
+                                 width='<s:property value="#mediaFile.thumbnailWidth"/>'
+                                 height='<s:property value="#mediaFile.thumbnailHeight"/>'
/>
+                        </s:if>
+
+                    </div>
+
+                    <div class="mediaObjectInfo">
+                        <label>
+                            <str:truncateNicely upper="50">
+                                <s:property value="#mediaFile.name" />
+                            </str:truncateNicely>
+                        </label>
+                    </div>
+
+                </li>
+
+            </s:iterator>
+
+        </ul>
+    </div>
+
+    <div style="clear:left;"></div>
+
+
+</s:form>
+
+</s:if>
+
+
+
+<script type="text/javascript">
+<!--
+    function onSelectImage(name, url) {
+        window.parent.onSelectImage(name, '<s:property value="absoluteSiteURL" />'
+ url);
+    }
+-->
+</script>

Modified: roller/trunk/apps/weblogger/web/WEB-INF/jsps/tiles/tiles-popuppage.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/jsps/tiles/tiles-popuppage.jsp?rev=819250&r1=819249&r2=819250&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/jsps/tiles/tiles-popuppage.jsp (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/jsps/tiles/tiles-popuppage.jsp Sun Sep 27 03:16:24
2009
@@ -21,9 +21,6 @@
     <head>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
         <tiles:insertAttribute name="head" />    
-        <style type="text/css">
-            <tiles:insertAttribute name="styles" />
-        </style>
     </head>
 
     <body class=" yui-skin-sam">

Modified: roller/trunk/apps/weblogger/web/WEB-INF/tiles.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/tiles.xml?rev=819250&r1=819249&r2=819250&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/tiles.xml (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/tiles.xml Sun Sep 27 03:16:24 2009
@@ -68,17 +68,15 @@
         <put-attribute name="footer"       value="/WEB-INF/jsps/tiles/footer.jsp" />
     </definition>
     
-	<definition name=".tiles-popuppage" template="/WEB-INF/jsps/tiles/tiles-popuppage.jsp">
+    <definition name=".tiles-popuppage" template="/WEB-INF/jsps/tiles/tiles-popuppage.jsp">
         <put-attribute name="banner"       value="/WEB-INF/jsps/tiles/empty.jsp" />
         <put-attribute name="messages"     value="/WEB-INF/jsps/tiles/messages.jsp" />
-		<put-attribute name="styles"       value="/WEB-INF/jsps/tiles/empty.jsp" />
+        <put-attribute name="styles"       value="/WEB-INF/jsps/tiles/empty.jsp" />
         <put-attribute name="content"      value="${content}" />
        
     </definition>
-	<definition name=".tiles-popuppage-only-content" template="/WEB-INF/jsps/tiles/tiles-popuppage.jsp">
-       
+    <definition name=".tiles-popuppage-only-content" template="/WEB-INF/jsps/tiles/tiles-popuppage.jsp">
      
         <put-attribute name="content"      value="${content}" />
-       
     </definition>
     
     <!-- error pages -->
@@ -226,7 +224,7 @@
         <put-attribute name="head" value="/WEB-INF/jsps/tiles/head-ajax.jsp" />
         <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileAdd.jsp" />
         <put-attribute name="sidebar" value="/WEB-INF/jsps/tiles/empty.jsp" />
-        <put-attribute name="styles" value="/WEB-INF/jsps/tiles/css-sidebar.jsp" />
+        <put-attribute name="styles" value="/WEB-INF/jsps/tiles/css-nosidebar.jsp" />
     </definition>
 
     <definition name=".MediaFileEdit" extends=".tiles-popuppage" >
@@ -238,14 +236,20 @@
         <put-attribute name="head" value="/WEB-INF/jsps/tiles/head-ajax.jsp" />
         <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileAddExternalInclude.jsp"
/>
     </definition>
-    
+
+    <definition name=".MediaFileImageChooser" extends=".tiles-popuppage-only-content"
>
+        <put-attribute name="head"     value="/WEB-INF/jsps/tiles/head-ajax.jsp" />
+        <put-attribute name="content"  value="/WEB-INF/jsps/editor/MediaFileImageChooser.jsp"
/>
+        <put-attribute name="messages" value="/WEB-INF/jsps/tiles/messages.jsp" />
+    </definition>
+
     <definition name=".MediaFileImageDimension" extends=".tiles-popuppage-only-content"
>
         <put-attribute name="head" value="/WEB-INF/jsps/tiles/head-ajax.jsp" />
         <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileImageDimension.jsp"
/>
     </definition>
     
 
-	<definition name=".MediaFileSearchInclude" extends=".tiles-popuppage" >
+    <definition name=".MediaFileSearchInclude" extends=".tiles-popuppage" >
         <put-attribute name="head" value="/WEB-INF/jsps/tiles/head-ajax.jsp" />
         <put-attribute name="content" value="/WEB-INF/jsps/editor/MediaFileSearch.jsp"
/>
     </definition>

Modified: roller/trunk/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp?rev=819250&r1=819249&r2=819250&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp (original)
+++ roller/trunk/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp Sun Sep 27
03:16:24 2009
@@ -17,233 +17,183 @@
 --%>
 <%-- This page is designed to be included in edit-weblog.jsp --%>
 <%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
-<script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/yahoo-dom-event.js'/>"></script>
-<script type="text/javascript" src="<s:url value='/roller-ui/scripts/yui/container-min.js'/>"></script>
 
 <style>
-a:link, a:visited, a:hover, a:active     { text-decoration:underline; }
-body        {
-                margin:0;
-                padding:0;
-                text-align:left;
-            }
-h1          {
-                font-size:20px;
-                font-weight:bold;
-            }
-.yui-overlay {
-                position:fixed;
-                background: #ffffff;
-                z-index: 112;
-                color:#000000;
-                border: 4px solid #525252;
-                text-align:left;
-                top: 50%;
-                left: 50%;
-        }
+    a:link, a:visited, a:hover, a:active     { text-decoration:underline; }
+    body        {
+        margin:0;
+        padding:0;
+        text-align:left;
+    }
+    h1          {
+        font-size:20px;
+        font-weight:bold;
+    }
+    .yui-overlay {
+        position:fixed;
+        background: #ffffff;
+        z-index: 112;
+        color:#000000;
+        border: 4px solid #525252;
+        text-align:left;
+        top: 50%;
+        left: 50%;
+    }
 </style>
+
 <script type="text/javascript">
+<!--
+    YAHOO.namespace("mediaFileEditor");
 
-YAHOO.example = function() {
-        var $D = YAHOO.util.Dom;
-        var $E = YAHOO.util.Event;
-            return {
-                init : function() {
-                var overlay_img = new YAHOO.widget.Overlay("overlay_img", { fixedcenter:true,
-                                                                            visible:false,
-                                                                            width:"577px",height:"530px"
-                                                                          });
-                overlay_img.render();
-                var overlay = document.createElement('div');
-                overlay.id = 'overlay';
-                // Assign 100% height and width
-                overlay.style.width = '100%';
-                overlay.style.height = '100%';
-
-                document.getElementsByTagName('body')[0].appendChild(overlay);
-                overlay.style.display = 'none';
-              }
-        };
+    function init() {
 
-}();
+        if (getCookie("editorSize1") != null) {
+            document.getElementById('entry_bean_text').rows = getCookie("editorSize1");
+        }
+        if (getCookie("editorSize") != null) {
+            document.getElementById('entry_bean_summary').rows = getCookie("editorSize");
+        }
 
-YAHOO.util.Event.addListener(window, "load", YAHOO.example.init);
+        YAHOO.mediaFileEditor.lightbox = new YAHOO.widget.Panel(
+            "mediafile_edit_lightbox", {
+                modal:    true,
+                width:   "600px",
+                height:  "600px",
+                visible: false,
+                fixedcenter: true,
+                constraintoviewport: true
+            }
+        );
+        YAHOO.mediaFileEditor.lightbox.render(document.body);
+    }
+    YAHOO.util.Event.addListener(window, "load", init);
 
-function onClose(textForInsertion)
-{
+    function onClose(textForInsertion)
+    {
         document.getElementById('overlay').style.display = 'none';
         document.getElementById('overlay_img').style.visibility = 'hidden';
         if (textForInsertion && textForInsertion.length > 0) {
             insertAtCursor(document.getElementById('entry_bean_text'), textForInsertion);
         }
-}
+    }
 
-function insertAtCursor(textAreaElement, valueForInsertion) {
-    if (document.selection) {
-         textAreaElement.focus();
-         var range = document.selection.createRange();
-         range.text = valueForInsertion;
-    }
-    else if (textAreaElement.selectionStart || textAreaElement.selectionStart == '0') {
-
-        var preText;
-        var postText;
-        if (textAreaElement.selectionStart == 0) {
-            preText = '';
-            postText = '';
+    function insertAtCursor(textAreaElement, valueForInsertion) {
+        if (document.selection) {
+            textAreaElement.focus();
+            var range = document.selection.createRange();
+            range.text = valueForInsertion;
         }
-        else {
-            preText = textAreaElement.value.substring(0, textAreaElement.selectionStart);
-            postText = textAreaElement.value.substring(textAreaElement.selectionEnd, textAreaElement.value.length);
+        else if (textAreaElement.selectionStart || textAreaElement.selectionStart == '0')
{
+
+            var preText;
+            var postText;
+            if (textAreaElement.selectionStart == 0) {
+                preText = '';
+                postText = '';
+            }
+            else {
+                preText = textAreaElement.value.substring(0, textAreaElement.selectionStart);
+                postText = textAreaElement.value.substring(textAreaElement.selectionEnd,
textAreaElement.value.length);
+            }
+            textAreaElement.value =  preText + valueForInsertion + postText;
+            textAreaElement.selectionStart = preText.length + valueForInsertion.length;
+            textAreaElement.selectionEnd = textAreaElement.selectionStart;
+            textAreaElement.focus();
+        } else {
+            textAreaElement.value += valueForInsertion;
+            textAreaElement.focus();
         }
-        textAreaElement.value =  preText + valueForInsertion + postText;
-        textAreaElement.selectionStart = preText.length + valueForInsertion.length;
-        textAreaElement.selectionEnd = textAreaElement.selectionStart;
-        textAreaElement.focus();
-    } else {
-        textAreaElement.value += valueForInsertion;
-        textAreaElement.focus();
-    }
-}
-
-
-function onClickAdd(){
-        var browser=navigator.appName;
-        document.getElementById("overlay_img").style.visibility = "visible";
-        document.getElementById('overlay').style.display = 'block';
-        document.getElementById("overlay_img").style.width = "650px";
-        document.getElementById("overlay_img").style.height = "550px";
-        document.getElementById("overlay_img").style.top = "40px";
-
-
-                var frame = document.createElement('iframe');
-                frame.setAttribute("id","myframe");
-                frame.setAttribute("frameborder","no");
-                frame.setAttribute("scrolling","auto");
-
-                frame.setAttribute('src','<s:url action="mediaFileAdd" namespace="overlay"><s:param
name="weblog"    value="%{actionWeblog.handle}" /></s:url>' );
-                frame.style.width="100%";
-                frame.style.height="100%";
-                if (browser=="Microsoft Internet Explorer")
-                {
-                document.getElementById("overlay_img").style.top= "40px";
-                document.getElementById("overlay_img").style.left= "170px";
-                }
-                document.getElementById("overlay_img").innerHTML = '<div ><a href="#"
class="container-close" onclick="onClose()"></a></div>';
-                document.getElementById("overlay_img").appendChild(frame);
-}
-
-function onClickAddFromUpload(){
-        var browser=navigator.appName;
-        document.getElementById("overlay_img").style.visibility = "visible";
-        document.getElementById('overlay').style.display = 'block';
-        document.getElementById("overlay_img").style.width = "650px";
-        document.getElementById("overlay_img").style.height = "500px";
-        document.getElementById("overlay_img").style.top = "40px";
-                var frame = document.createElement('iframe');
-                frame.setAttribute("id","myframe");
-                frame.setAttribute("frameborder","no");
-                frame.setAttribute("scrolling","auto");
-                frame.setAttribute('src','<s:url action="mediaFileSearch" namespace="overlay"><s:param
name="weblog" value="%{actionWeblog.handle}" /></s:url>' );
-                frame.style.width="100%";
-                frame.style.height="100%";
-                if (browser=="Microsoft Internet Explorer")
-                {
-                document.getElementById("overlay_img").style.top= "40px";
-                document.getElementById("overlay_img").style.left= "170px";
-                }
-
-                document.getElementById("overlay_img").innerHTML = '<div ><a href="#"
class="container-close" onclick="onClose()"></a></div>';
-                document.getElementById("overlay_img").appendChild(frame);
-}
-
-function onClickAddExternal(){
-        var browser=navigator.appName;
-        document.getElementById("overlay_img").style.visibility = "visible";
-        document.getElementById('overlay').style.display = 'block';
-        document.getElementById("overlay_img").style.width = "515px";
-        document.getElementById("overlay_img").style.height = "400px";
-        document.getElementById("overlay_img").style.top = "100px";
-
-                var frame = document.createElement('iframe');
-                frame.setAttribute("id","myframe");
-                frame.setAttribute("frameborder","no");
-                frame.setAttribute("scrolling","auto");
-                frame.setAttribute('src','<s:url action="mediaFileAddExternalInclude"><s:param
name="weblog" value="%{actionWeblog.handle}" /></s:url>' );
-                frame.style.width="100%";
-                frame.style.height="100%";
-                if (browser=="Microsoft Internet Explorer")
-                {
-                document.getElementById("overlay_img").style.top= "40px";
-                document.getElementById("overlay_img").style.left= "170px";
-                }
-                document.getElementById("overlay_img").innerHTML = '<div ><a href="#"
class="container-close" onclick="onClose()"></a></div>';
-                document.getElementById("overlay_img").appendChild(frame);
-}
+    }
+
+    function onClickAddImage(){
+        <s:url id="mediaFileImageChooser" action="mediaFileImageChooser" namespace="overlay">
+            <s:param name="weblog" value="%{actionWeblog.handle}" />
+        </s:url>
+        $("#mediaFileEditor").attr('src','<s:property value="%{mediaFileImageChooser}"
/>');
+        YAHOO.mediaFileEditor.lightbox.show();
+    }
+
+    function onClose() {
+        $("#mediaFileEditor").attr('src','about:blank');
+        YAHOO.mediaFileEditor.lightbox.hide();
+    }
 
+    function onSelectImage(name, url) {
+        $("#mediaFileEditor").attr('src','about:blank');
+        YAHOO.mediaFileEditor.lightbox.hide();
+        insertAtCursor(document.getElementById('entry_bean_text'),
+            '<a href="' + url + '"><img src="' + url + '?t=true" alt="' + name+
'"></img></a>');
+    }
+-->
 </script>
 
 <script type="text/javascript">
-<!--
-function editorCleanup() {
-    // no-op
-}
-function changeSize(e, num) {
-    a = e.rows + num;
-    if (a > 0) e.rows = a;
-    var expires = new Date();
-    expires.setTime(expires.getTime() + 24 * 90 * 60 * 60 * 1000); // sets it for approx
90 days.
-    setCookie("editorSize",e.rows,expires);
-}
-function changeSize1(e, num) {
-    a = e.rows + num;
-    if (a > 0) e.rows = a;
-    var expires = new Date();
-    expires.setTime(expires.getTime() + 24 * 90 * 60 * 60 * 1000); // sets it for approx
90 days.
-    setCookie("editorSize1",e.rows,expires);
-}
-// -->
+    <!--
+    function editorCleanup() {
+        // no-op
+    }
+    function changeSize(e, num) {
+        a = e.rows + num;
+        if (a > 0) e.rows = a;
+        var expires = new Date();
+        expires.setTime(expires.getTime() + 24 * 90 * 60 * 60 * 1000); // sets it for approx
90 days.
+        setCookie("editorSize",e.rows,expires);
+    }
+    function changeSize1(e, num) {
+        a = e.rows + num;
+        if (a > 0) e.rows = a;
+        var expires = new Date();
+        expires.setTime(expires.getTime() + 24 * 90 * 60 * 60 * 1000); // sets it for approx
90 days.
+        setCookie("editorSize1",e.rows,expires);
+    }
+    // -->
 </script>
 
-<div id="overlay_img" style="visibility:hidden"> </div>
 
 <%-- ===================================================================== --%>
+
 <p class="toplabel">
     <span style="float:left;"><s:text name="weblogEdit.content" /></span>
     <span style="font-weight:normal;float:right;">
-        <a href="#" onClick="onClickAdd();";>Add media </a>&nbsp;
-            <a href="#" onClick="onClickAddFromUpload();">Attach uploaded file</a>&nbsp;
-            <a href="#" onClick="onClickAddExternal();">Add media from URL</a>
+        <a href="#" onClick="onClickAddImage();">Add Image</a>&nbsp;
     </span>
 </p>
 
 <s:textarea name="bean.text" cols="75" rows="25" cssStyle="width: 100%" tabindex="5"/>
-<script type="text/javascript">
-    <!--
-    if (getCookie("editorSize1") != null) {
-        document.getElementById('entry_bean_text').rows = getCookie("editorSize1");
-    }
-    -->
-</script>
 <table style="width:100%"><tr><td align="right">
-  <!-- Add buttons to make this textarea taller or shorter -->
-  <input type="button" name="taller" value=" &darr; " onclick="changeSize1(document.getElementById('entry_bean_text'),
5)" />
-  <input type="button" name="shorter" value=" &uarr; " onclick="changeSize1(document.getElementById('entry_bean_text'),
-5)" />
+    <!-- Add buttons to make this textarea taller or shorter -->
+    <input type="button" name="taller" value=" &darr; "
+           onclick="changeSize1(document.getElementById('entry_bean_text'), 5)" />
+    <input type="button" name="shorter" value=" &uarr; "
+           onclick="changeSize1(document.getElementById('entry_bean_text'), -5)" />
 </td></tr></table>
 
+
 <%-- ===================================================================== --%>
+
 <p class="toplabel"><s:text name="weblogEdit.summary" /></p>
 
 <s:textarea name="bean.summary" cols="75" rows="5" cssStyle="width: 100%" tabindex="6"/>
-<script type="text/javascript">
-    <!--
-    if (getCookie("editorSize") != null) {
-        document.getElementById('entry_bean_summary').rows = getCookie("editorSize");
-    }
-    -->
-</script>
+
 <table style="width:100%"><tr><td align="right">
-  <!-- Add buttons to make this textarea taller or shorter -->
-  <input type="button" name="taller" value=" &darr; " onclick="changeSize(document.getElementById('entry_bean_summary'),
5)" />
-  <input type="button" name="shorter" value=" &uarr; " onclick="changeSize(document.getElementById('entry_bean_summary'),
-5)" />
+    <!-- Add buttons to make this textarea taller or shorter -->
+    <input type="button" name="taller" value=" &darr; "
+           onclick="changeSize(document.getElementById('entry_bean_summary'), 5)" />
+    <input type="button" name="shorter" value=" &uarr; "
+           onclick="changeSize(document.getElementById('entry_bean_summary'), -5)" />
 </td></tr></table>
+
+
+<div id="mediafile_edit_lightbox" style="visibility:hidden">
+    <div class="hd"><s:text name="mediaFileChooser.popupTitle" /></div>
+    <div class="bd">
+        <iframe id="mediaFileEditor"
+                style="visibility:inherit"
+                height="100%"
+                width="100%"
+                frameborder="no"
+                scrolling="auto">
+        </iframe>
+    </div>
+    <div class="ft"></div>
+</div>

Modified: roller/trunk/apps/weblogger/web/roller-ui/styles/roller.css
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/roller-ui/styles/roller.css?rev=819250&r1=819249&r2=819250&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/web/roller-ui/styles/roller.css (original)
+++ roller/trunk/apps/weblogger/web/roller-ui/styles/roller.css Sun Sep 27 03:16:24 2009
@@ -32,6 +32,7 @@
 
 th, td {
     border: none;
+    vertical-align: top;
 }
 
 a {



Mime
View raw message