portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r1093937 - in /portals/jetspeed-2/applications/j2-admin/trunk/src/main: java/org/apache/jetspeed/portlets/toolbox/ resources/org/apache/jetspeed/portlets/toolbox/resources/ webapp/WEB-INF/view/toolbox/
Date Sat, 16 Apr 2011 06:37:17 GMT
Author: woonsan
Date: Sat Apr 16 06:37:16 2011
New Revision: 1093937

URL: http://svn.apache.org/viewvc?rev=1093937&view=rev
Log:
JS2-1247: cloning popup in toolbox portlet. allowed to users which has admin role.

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/toolbox/JetspeedToolbox.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources.properties
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources_en.properties
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources_ko.properties
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/toolbox/JetspeedToolbox.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/toolbox/JetspeedToolbox.java?rev=1093937&r1=1093936&r2=1093937&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/toolbox/JetspeedToolbox.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/toolbox/JetspeedToolbox.java
Sat Apr 16 06:37:16 2011
@@ -36,6 +36,7 @@ import javax.portlet.RenderResponse;
 import org.apache.commons.lang.StringUtils;
 import org.apache.jetspeed.CommonPortletServices;
 import org.apache.jetspeed.JetspeedActions;
+import org.apache.jetspeed.administration.PortalAdministration;
 import org.apache.jetspeed.decoration.DecorationFactory;
 import org.apache.jetspeed.layout.PageLayoutComponent;
 import org.apache.jetspeed.om.page.ContentFragment;
@@ -57,6 +58,7 @@ public class JetspeedToolbox extends Gen
 {
     static Logger log = LoggerFactory.getLogger(JetspeedToolbox.class);
     
+    protected PortalAdministration portalAdministration;
     protected PageLayoutComponent pageLayoutComponent;
     protected DecorationFactory decorationFactory;
     protected String yuiScriptPath = "/javascript/yui/build/yui/yui-min.js";
@@ -67,6 +69,8 @@ public class JetspeedToolbox extends Gen
         
         PortletContext context = getPortletContext();
         
+        portalAdministration = (PortalAdministration) getPortletContext().getAttribute(CommonPortletServices.CPS_PORTAL_ADMINISTRATION);
+        
         pageLayoutComponent = (PageLayoutComponent) context.getAttribute(CommonPortletServices.CPS_PAGE_LAYOUT_COMPONENT);
         
         if (pageLayoutComponent == null)
@@ -116,6 +120,9 @@ public class JetspeedToolbox extends Gen
         PortletPreferences prefs = request.getPreferences();
         request.setAttribute("prefs", prefs.getMap());
         
+        boolean userInAdminRole = portalAdministration.isUserInAdminRole(request);
+        request.setAttribute("userInAdminRole", userInAdminRole ? Boolean.TRUE : Boolean.FALSE);
+        
         boolean hasEditAccess = false;
         
         try

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources.properties?rev=1093937&r1=1093936&r2=1093937&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources.properties
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources.properties
Sat Apr 16 06:37:16 2011
@@ -29,6 +29,8 @@ toolbox.label.moveLast = >>
 toolbox.label.preview = Preview
 toolbox.label.add = Add
 toolbox.label.close = Close
+toolbox.label.clone = Clone
+toolbox.label.clonePortlet = Clone Portlet
 
 toolbox.message.chooseOne = Choose one
 toolbox.message.search = Search portlets

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources_en.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources_en.properties?rev=1093937&r1=1093936&r2=1093937&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources_en.properties
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources_en.properties
Sat Apr 16 06:37:16 2011
@@ -29,6 +29,8 @@ toolbox.label.moveLast = >>
 toolbox.label.preview = Preview
 toolbox.label.add = Add
 toolbox.label.close = Close
+toolbox.label.clone = Clone
+toolbox.label.clonePortlet = Clone Portlet
 
 toolbox.message.chooseOne = Choose one
 toolbox.message.search = Search portlets

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources_ko.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources_ko.properties?rev=1093937&r1=1093936&r2=1093937&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources_ko.properties
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/toolbox/resources/JetspeedToolboxResources_ko.properties
Sat Apr 16 06:37:16 2011
@@ -29,6 +29,8 @@ toolbox.label.moveLast = >>
 toolbox.label.preview = \ubbf8\ub9ac\ubcf4\uae30
 toolbox.label.add = \ucd94\uac00
 toolbox.label.close = \ub2eb\uae30
+toolbox.label.clone = \ubcf5\uc81c
+toolbox.label.clonePortlet = \ud3ec\ud2c0\ub9bf \ubcf5\uc81c
 
 toolbox.message.chooseOne = \uc120\ud0dd
 toolbox.message.search = \ud3ec\ud2c0\ub9bf \uac80\uc0c9

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp?rev=1093937&r1=1093936&r2=1093937&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp
Sat Apr 16 06:37:16 2011
@@ -114,6 +114,7 @@ limitations under the License.
 	       <td class="portlet-section-body">
 	           <a href="#" name="preview" class='tooltext'><fmt:message key="toolbox.label.preview"/></a>
 
 	           <a href="#" name="add" class='tooltext'><fmt:message key="toolbox.label.add"/></a>
+	           <a href="#" name="clone" class='tooltext'><fmt:message key="toolbox.label.clone"/></a>
 	       </td>
 	    </tr>
     </table>
@@ -183,6 +184,27 @@ limitations under the License.
     <div class="yui-widget-ft" align="center"><a id="<portlet:namespace/>previewOverlayClose"
href="#"><fmt:message key="toolbox.label.close"/></a></div>
 </div>
 
+<div style="display: none">
+  <div id="<portlet:namespace/>portletCloneModalHeader">
+    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+      <tr>
+        <td><h2 id="<portlet:namespace/>portletCloneModalHeader"><fmt:message
key='toolbox.label.clonePortlet'/></h2></td>
+        <td align="right"><a id="<portlet:namespace/>portletCloneModalHeaderClose"
href="#"><img border="0" src='<c:url context="${portalContextPathInUrlTag}" value="/decorations/images/close.gif"/>'/></a></td>
+      </tr>
+    </table>
+  </div>
+  <div id="<portlet:namespace/>portletCloneModalBody">
+    <div>
+      <iframe id="<portlet:namespace/>portletCloneModalBodyIFrame" align="BOTTOM"
width="100%" scrolling="AUTO" height="480" frameborder="0" marginwidth="0" marginheight="0">
+      </iframe>
+    </div>
+  </div> 
+  <div id="<portlet:namespace/>portletCloneModalFooter" align="center">
+  </div>
+</div>
+
+<div class="modal-window-close-script" style="DISPLAY: none">var portal = (parent.JETUI_YUI
? parent.JETUI_YUI.getPortalInstance() : null); if (portal) { portal.hideModalPanel(); }</div>
+
 <script language="javascript">
 YUI().use('jetui-portal', 'io', 'json', 'node', 'cookie', 'overlay', 'anim', 'plugin', function(Y)
{
     
@@ -440,6 +462,18 @@ YUI().use('jetui-portal', 'io', 'json', 
 	                clone.all("a").item(1).remove();
 	            </c:otherwise>
 	        </c:choose>
+
+            <c:choose>
+                <c:when test="${userInAdminRole}">
+                    var cloneLink = clone.one("[name='clone']");
+                    var cloneLinkNode = Y.Node.getDOMNode(cloneLink);
+                    cloneLinkNode.setAttribute("portletUniqueName", def.uniqueName);
+                    cloneLink.on("click", clonePortlet);
+                </c:when>
+                <c:otherwise>
+                    clone.all("a").item(1).remove();
+                </c:otherwise>
+            </c:choose>
             
             var previewLink = clone.one("[name='preview']");
             var previewLinkNode = Y.Node.getDOMNode(previewLink);
@@ -643,6 +677,30 @@ YUI().use('jetui-portal', 'io', 'json', 
         previewOverlay.hide();
         e.halt();
     };
+
+    var clonePortlet = function(e) {
+        var a = Y.Node.getDOMNode(e.target);
+        var portletUniqueName = a.getAttribute("portletUniqueName");
+
+        var modalFeatures = {
+            "width": 600,
+            "height": 540
+        };
+        var portal = (JETUI_YUI ? JETUI_YUI.getPortalInstance() : null);
+        if (portal) {
+            var iframe = Y.Node.one("#<portlet:namespace/>portletCloneModalBodyIFrame");
+            iframe.set("src", "${requestContext.portalURL.basePath}/system/prm/cloneportlet.psml?portlet="
+ portletUniqueName);
+            portal.showModalPanel("#<portlet:namespace/>portletCloneModalHeader", "#<portlet:namespace/>portletCloneModalBody",
"#<portlet:namespace/>portletCloneModalFooter", modalFeatures);
+        }
+        e.halt();
+    };
+
+    var hidePortalModalPanel = function() {
+    	var portal = (JETUI_YUI ? JETUI_YUI.getPortalInstance() : null); 
+    	if (portal) { 
+        	portal.hideModalPanel(); 
+        }
+    };
     
     Y.on("click", switchTab, "#<portlet:namespace/>portletsTabAction");
     Y.on("click", switchTab, "#<portlet:namespace/>layoutTabAction");
@@ -665,5 +723,6 @@ YUI().use('jetui-portal', 'io', 'json', 
     switchTab(tabId);
 
     Y.Node.one("#<portlet:namespace/>previewOverlayClose").on("click", closePreviewOverlay);
+    Y.Node.one("#<portlet:namespace/>portletCloneModalHeaderClose").on("click", hidePortalModalPanel);
 });
 </script>
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message