roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ganes...@apache.org
Subject svn commit: r768205 - in /roller/branches/roller_mediablogging/apps/weblogger: src/java/org/apache/roller/weblogger/ui/struts2/editor/ web/WEB-INF/classes/ web/WEB-INF/jsps/editor/ web/roller-ui/authoring/editors/
Date Fri, 24 Apr 2009 07:39:15 GMT
Author: ganeshmb
Date: Fri Apr 24 07:39:15 2009
New Revision: 768205

URL: http://svn.apache.org/viewvc?rev=768205&view=rev
Log:
Changes to make media file related overlays on entry add page work.

Added:
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp
Modified:
    roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/classes/struts.xml
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddExternalInclude.jsp
    roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileSearch.jsp
    roller/branches/roller_mediablogging/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp

Modified: roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java?rev=768205&r1=768204&r2=768205&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java
Fri Apr 24 07:39:15 2009
@@ -25,6 +25,8 @@
 
     private List<MediaFileDirectory> allDirectories;
     
+    private boolean overlayMode;
+    
     protected void doDeleteMediaFile() {
         
     	try {
@@ -158,5 +160,13 @@
 	public void setMediaFileId(String mediaFileId) {
 		this.mediaFileId = mediaFileId;
 	}
+	
+	public boolean isOverlayMode() {
+		return overlayMode;
+		
+	}
 
+	public void setOverlayMode(boolean mode) {
+	    this.overlayMode = mode; 
+	}
 }

Modified: roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/classes/struts.xml
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/classes/struts.xml?rev=768205&r1=768204&r2=768205&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/classes/struts.xml (original)
+++ roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/classes/struts.xml Fri
Apr 24 07:39:15 2009
@@ -225,13 +225,6 @@
             <result name="error" type="tiles">.MediaFileAdd</result>
         </action>
 
-        <action name="mediaFileAddInclude!*" method="{1}"
-                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileAdd">
-            <result name="input" type="tiles">.MediaFileAddInclude</result>
-            <result name="success" type="tiles">.MediaFileAddSuccessInclude</result>
-			 <result name="error" type="tiles">.MediaFileAddInclude</result>
-        </action>
-
         <action name="mediaFileEdit!*" method="{1}"
                 class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileEdit">
             <result name="input" type="tiles">.MediaFileEdit</result>
@@ -263,13 +256,6 @@
             <result name="success" type="tiles">.MediaFileSearch</result>
         </action>
 		
-	<action name="mediaFileSearchInclude!*" method="{1}"
-                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileSearch">
-            <result name="input" type="tiles">.MediaFileSearchInclude</result>
-            <result name="error" type="tiles">.MediaFileSearchInclude</result>
-            <result name="success" type="tiles">.MediaFileSearchInclude</result>
-        </action>
-
 	<action name="tabular!*" method="{1}"
                 class="org.apache.roller.weblogger.ui.struts2.editor.Resources">
             <result name="list" type="tiles">.TabularView</result>
@@ -462,5 +448,23 @@
         -->
     </package>
     
+    <!-- Weblogger Authoring UI - overlay pages-->
+    <package name="weblogger-authoring-overlay" namespace="/roller-ui/authoring/overlay"
extends="weblogger-authoring">
+        <action name="mediaFileAdd!*" method="{1}"
+                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileAdd">
+            <param name="overlayMode">true</param>
+            <result name="input" type="tiles">.MediaFileAddInclude</result>
+            <result name="success" type="tiles">.MediaFileAddSuccessInclude</result>
+            <result name="error" type="tiles">.MediaFileAddInclude</result>
+        </action>
+	<action name="mediaFileSearch!*" method="{1}"
+                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileSearch">
+            <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>
+        </action>
+    </package>
+
 </struts>
 

Modified: roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddExternalInclude.jsp
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddExternalInclude.jsp?rev=768205&r1=768204&r2=768205&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddExternalInclude.jsp
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddExternalInclude.jsp
Fri Apr 24 07:39:15 2009
@@ -21,8 +21,15 @@
     <s:text name="mediaFile.add.title"  />
 </p>
 
+<script type="text/javascript">
+function submitPage(frm) {
+    var filePointer = "<a href='" + frm.url.value + "'>" + frm.title.value + "</a>";
+    parent.onClose(filePointer);
+}
+</script>
+
 <s:form id="entry" action=" " onsubmit="editorCleanup()" method="POST">
-    
+
 
     <table class="entryEditTable" cellpadding="0" cellspacing="0" width="100%">
 
@@ -31,7 +38,7 @@
                 <label for="status">URL:</label>
             </td>
             <td>
-                <s:textfield name=" " size="50" maxlength="255" tabindex="1" />
+                <s:textfield name="url" size="50" maxlength="255" tabindex="1" />
             </td>
        </tr>
 
@@ -40,7 +47,7 @@
                 <label for="status">Title</label>
             </td>
             <td>
-                <s:textfield name=" " size="50" maxlength="255" />
+                <s:textfield name="title" size="50" maxlength="255" />
             </td>
        </tr>
 
@@ -50,7 +57,7 @@
 
     <br>
     <div class="control">
-       <input type="submit" value="Insert" name="submit" />
+       <input type="button" value="Insert" name="submit" onclick="submitPage(this.form)"
/>
     </div>
 
 </s:form>

Added: roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp?rev=768205&view=auto
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp
(added)
+++ roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileAddSuccessInclude.jsp
Fri Apr 24 07:39:15 2009
@@ -0,0 +1,30 @@
+<%--
+  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" %>
+
+<script type="text/javascript">
+//parent.document.getElementById('overlay_img').style.display = 'none';
+<s:url id="mediaFileURL" value="/roller-ui/rendering/media-resources/%{bean.id}" />
+<s:if test="contentTypeImage">
+var filePointer = "<img src='<s:property value="%{mediaFileURL}" />' alt='<s:property
value="bean.name" />' width='400' height='300' />";
+</s:if>
+<s:else>
+var filePointer = "<a href='<s:property value="%{mediaFileURL}" />'><s:property
value="bean.name" /></a>";
+</s:else>
+parent.onClose(filePointer);
+</script>

Modified: roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileSearch.jsp
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileSearch.jsp?rev=768205&r1=768204&r2=768205&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileSearch.jsp
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/web/WEB-INF/jsps/editor/MediaFileSearch.jsp
Fri Apr 24 07:39:15 2009
@@ -16,15 +16,15 @@
   directory of this distribution.
 --%>
 <%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
-<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.6.0/build/reset-fonts-grids/reset-fonts-grids.css&2.6.0/build/menu/assets/skins/sam/menu.css">

-<!-- Combo-handled YUI JS files: --> 
+<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.6.0/build/reset-fonts-grids/reset-fonts-grids.css&2.6.0/build/menu/assets/skins/sam/menu.css">
+<!-- Combo-handled YUI JS files: -->
 <script type="text/javascript" src="http://yui.yahooapis.com/combo?2.6.0/build/yahoo-dom-event/yahoo-dom-event.js&2.6.0/build/animation/animation-min.js&2.6.0/build/container/container_core-min.js&2.6.0/build/menu/menu-min.js"></script>
 <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/fonts/fonts-min.css"
/>
 <link rel="stylesheet" type="text/css"
 href="http://yui.yahooapis.com/2.6.0/build/container/assets/skins/sam/container.css" />
 
 <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
-<script type="text/javascript" 
+<script type="text/javascript"
 src="http://yui.yahooapis.com/2.6.0/build/container/container-min.js"></script>
 <style type="text/css">
 body {
@@ -36,7 +36,7 @@
 		font-size:20px;
 		font-weight:bold;
 	}
-.yui-overlay { 
+.yui-overlay {
 		position:fixed;
 	  	background: #ffffff;
 	  	z-index: 112;
@@ -52,50 +52,50 @@
 
 
                 var oClones = this;
-              
-    
+
+
                 function deleteMedia(p_oLI) {
-				
+
 				 var oUL =	YAHOO.util.Dom.getAncestorByTagName(p_oLI, "LI");
-				
-				
+
+
 				 var myparent = oUL.parentNode;
-				 
-				
+
+
 		var hidden_mediaFileId = document.getElementById("mediafileidentity");
 		var hidden_mediaFileId_value = hidden_mediaFileId.value;
         myparent.removeChild(oUL);
 		document.mediaFileSearchForm.mediaFileId.value=hidden_mediaFileId_value;
 		document.mediaFileSearchForm.action='<s:url action="mediaFileSearch!delete" />';
 		document.mediaFileSearchForm.submit();
-    
-                                  
+
+
   }
-                           
-    
+
+
                 function createPost() {
-                 
-                
+
+
                 }
-                
-    
+
+
                 function includeMedia() {
 		 var hidden_mediaFileId = document.getElementById("mediafileidentity");
 		 var hidden_mediaFileId_value = hidden_mediaFileId.value;
 		 document.mediaFileSearchForm.mediaFileId.value=hidden_mediaFileId_value;
          document.mediaFileSearchForm.action='<s:url action="mediaFileSearch!includeInGallery"
/>';
          document.mediaFileSearchForm.submit();
-                
+
                 }
-                   
-              
-                
+
+
+
                 function onEweContextMenuClick(p_sType, p_aArgs) {
-    
+
                     /*
-                         The second item in the arguments array (p_aArgs) 
-                         passed back to the "click" event handler is the 
-                         MenuItem instance that was the target of the 
+                         The second item in the arguments array (p_aArgs)
+                         passed back to the "click" event handler is the
+                         MenuItem instance that was the target of the
                          "click" event.
                     */
 
@@ -106,36 +106,36 @@
 
                     if (oItem) {
 
-					oLI = oTarget.className == "contextMenu" ? 
+					oLI = oTarget.className == "contextMenu" ?
 								oTarget : YAHOO.util.Dom.getAncestorByClassName(oTarget, "contextMenu");
 
-						
+
                         switch (oItem.index) {
-                        
+
                             case 0:     // delete
-        
+
                                 deleteMedia(oLI);
-                            
+
                             break;
-        
-        
+
+
                             case 1:     // create post
-        
+
                                 createPost();
-        
+
                             break;
-                            
-        
+
+
                             case 2:     // include in gallery
-        
+
                                 includeMedia();
-        
-                            break;                    
-                        
+
+                            break;
+
                         }
-                    
+
                     }
-                
+
                 }
 
 
@@ -144,33 +144,33 @@
                      added to the ContextMenu instanc.
                 */
 
-                var aMenuItems = ["Delete", "Create Post", "Include in Gallery" ]; 
+                var aMenuItems = ["Delete", "Create Post", "Include in Gallery" ];
 
 
                 /*
 					Instantiate a ContextMenu:  The first argument passed to the constructor
-					is the id for the Menu element to be created, the second is an 
+					is the id for the Menu element to be created, the second is an
 					object literal of configuration properties.
                 */
 
                 var oEweContextMenu = new YAHOO.widget.ContextMenu(
-                                            "ewecontextmenu", 
+                                            "ewecontextmenu",
                                             {
                                                 trigger: oClones.getElementsByClassName("contextMenu"),
                                                 itemdata: aMenuItems,
-                                                lazyload: true                          
         
-                                            } 
+                                                lazyload: true
+                                            }
                                         );
 
 
                 // "render" event handler for the ewe context menu
 
                 function onContextMenuRender(p_sType, p_aArgs) {
-    
+
                  //  Add a "click" event handler to the ewe context menu
-    
+
                     this.subscribe("click", onEweContextMenuClick);
-                
+
                 }
 
 
@@ -185,23 +185,23 @@
 			var $E = YAHOO.util.Event;
 			return {
 				init : function() {
-					var overlay_img = new YAHOO.widget.Overlay("overlay_img", { fixedcenter:true, 
+					var overlay_img = new YAHOO.widget.Overlay("overlay_img", { fixedcenter:true,
 																			visible:false,
 																			width:"577px",height:"487px"
 																		   });
 					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);	
+
+                    document.getElementsByTagName('body')[0].appendChild(overlay);
 					overlay.style.display = 'none';
 			}
 			};
-		
+
 		}();
 
 		YAHOO.util.Event.addListener(window, "load", YAHOO.example.init);
@@ -243,6 +243,19 @@
         document.mediaFileSearchForm.submit();
     }
 }
+
+function onClickInsert(url, text, isImage)
+{
+    var filePointer;
+    if (isImage) {
+        filePointer = "<img src='" + url + "' alt='" + text + "' width='400' height='300'
/>";
+    }
+    else {
+        filePointer = "<a href='" + url + "'>" + text + "</a>";
+    }
+    parent.onClose(filePointer);
+}
+
 function onCreateDirectory()
 {
     document.mediaFileSearchForm.action='<s:url action="mediaFileSearch!createDirByPath"
/>';
@@ -261,14 +274,14 @@
 function onClose()
 {
 	document.getElementById('overlay').style.display = 'none';
-	document.getElementById('overlay_img').style.visibility = 'hidden';	
+	document.getElementById('overlay_img').style.visibility = 'hidden';
 }
 function onClickEdit(mediaFileId)
 {
-	
-	document.getElementById("overlay_img").style.visibility = "visible"; 
+
+	document.getElementById("overlay_img").style.visibility = "visible";
 	document.getElementById('overlay').style.display = 'block';
-	
+
 		var frame = document.createElement('iframe');
 				    frame.setAttribute("id","myframe");
 				    frame.setAttribute("frameborder","no");
@@ -278,12 +291,12 @@
 				    frame.style.width="100%";
 			    	frame.style.height="100%";
 					//var mystring="<s:url action='mediaFileEdit'><s:param name='weblog' value='%{actionWeblog.handle}'
/></s:url>&mediaFileId="+mediaFileId;
-					
+
 					//var innerstring = "<iframe id='myframe' frameborder='no' scrolling='auto' src="+mystring+"
width='100%' height='100%'></iframe>";
-					
+
 
 	document.getElementById("overlay_img").innerHTML = '<div ><a href="#" class="container-close"
onclick="onClose()"></a></div>';
-	
+
     document.getElementById("overlay_img").appendChild(frame);
 
 
@@ -340,7 +353,7 @@
         </tr>
      </table>
 	 <div id="overlay_img" style="visibility:hidden">
-	
+
 </div>
 
  <div class="control">
@@ -364,18 +377,25 @@
     <s:iterator id="mediaFile" value="pager.items">
     <li class="align-images">
 	<img style="border:1px solid #000000;margin:5px;" border="0" src='<s:url value="/roller-ui/rendering/media-resources/%{#mediaFile.id}"
/>' width="120px" height="100px" alt="mediaFolder.png"/><br/>
-	 <div style="clear:left;width:130px;margin-left:5px;"><label><s:property

+	 <div style="clear:left;width:130px;margin-left:5px;"><label><s:property
 value="#mediaFile.name" /></label>
 <div style="padding-top:5px;">   <!--  one -->
-    <input style="float:left;" type="checkbox" name="selectedMediaFiles" value="<s:property

+    <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'/>">
-	
+
+<s:if test="overlayMode">
+    <div style="float:right;">
+       <a  href="#" onclick="onClickInsert('<s:url value="/roller-ui/rendering/media-resources/%{#mediaFile.id}"
/>', '<s:property value="#mediaFile.name" />', <s:property value="#mediaFile.imageFile"
/>)">Insert</a>
+    </div>
+</s:if>
+<s:else>
 <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>
+</s:else>
 </div>  <!-- one -->
 	</div>
 	</li>
@@ -384,11 +404,13 @@
 
 
 <br/>
+<s:if test="!overlayMode">
 <div style="width: 100%; clear:both; padding-top:2em">
 <label>New Directory:</label>
 <input type="text" name="newDirectoryPath" size="30" />
 <input type="button" value="Create" onclick="onCreateDirectory()" />
 </div>
+</s:if>
 
 </div>
 
@@ -420,11 +442,13 @@
 
 	<br/>
 	<div class="control">
+     <s:if test="!overlayMode">
      <input type="button" style="padding-left:20px" value="Delete Selected" onclick="onDeleteSelected()"
/>
      <input type="button" style="padding-left:20px" value="Move Selected" onclick="onMoveSelected()"
/>
 	 <span style="padding-left:20px">
          <s:select name="selectedDirectory" list="allDirectories" listKey="id" listValue="path"
/>
 	 </span>
+	 </s:if>
     </div>
 	</s:form>
 

Modified: roller/branches/roller_mediablogging/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp?rev=768205&r1=768204&r2=768205&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/web/roller-ui/authoring/editors/editor-text.jsp
Fri Apr 24 07:39:15 2009
@@ -18,6 +18,162 @@
 <%-- This page is designed to be included in edit-weblog.jsp --%>
 <%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
 
+<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
+<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/container/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%;
+	}
+</style>
+<script type="text/javascript">
+
+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';
+			}
+			};
+
+		}();
+
+		YAHOO.util.Event.addListener(window, "load", YAHOO.example.init);
+
+function onClose(textForInsertion)
+{
+	document.getElementById('overlay').style.display = 'none';
+	document.getElementById('overlay_img').style.visibility = 'hidden';
+
+	insertAtCursor(document.getElementById('EntryText'), 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 = '';
+        }
+        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();
+    }
+}
+
+
+function onClickAdd(){
+	document.getElementById("overlay_img").style.visibility = "visible";
+	document.getElementById('overlay').style.display = 'block';
+
+		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%";
+
+
+	document.getElementById("overlay_img").innerHTML = '<div ><a href="#" class="container-close"
onclick="onClose()"></a></div>';
+
+    document.getElementById("overlay_img").appendChild(frame);
+
+}
+function onClickAddFromUpload(){
+document.getElementById("overlay_img").style.visibility = "visible";
+	document.getElementById('overlay').style.display = 'block';
+
+
+		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%";
+
+
+	document.getElementById("overlay_img").innerHTML = '<div ><a href="#" class="container-close"
onclick="onClose()"></a></div>';
+
+    document.getElementById("overlay_img").appendChild(frame);
+}
+function onClickAddExternal(){
+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 = "300px";
+	document.getElementById("overlay_img").style.top = "130px";
+
+		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%";
+
+
+	document.getElementById("overlay_img").innerHTML = '<div ><a href="#" class="container-close"
onclick="onClose()"></a></div>';
+
+    document.getElementById("overlay_img").appendChild(frame);
+
+}
+
+</script>
+
 <script type="text/javascript">
 <!--
 function editorCleanup() {
@@ -40,10 +196,19 @@
 // -->
 </script>
 
+<div id="overlay_img" style="visibility:hidden"> </div>
+
 <%-- ===================================================================== --%>
-<p class="toplabel"><s:text name="weblogEdit.content" /></p>
+<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>
+    </span>
+</p>
 
-<s:textarea name="bean.text" cols="75" rows="25" cssStyle="width: 100%" tabindex="5"/>
+<s:textarea id="EntryText" name="bean.text" cols="75" rows="25" cssStyle="width: 100%"
tabindex="5"/>
 <script type="text/javascript">
     <!--
     if (getCookie("editorSize1") != null) {



Mime
View raw message