svn commit: r831415 - in /portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp: WEB-INF/jetui/yui/jetui-portlet.jsp jetui/engine/portal.js

View: New views
1 Messages — Rating Filter:   Alert me  

svn commit: r831415 - in /portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp: WEB-INF/jetui/yui/jetui-portlet.jsp jetui/engine/portal.js

by taylor-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Author: taylor
Date: Fri Oct 30 18:29:47 2009
New Revision: 831415

URL: http://svn.apache.org/viewvc?rev=831415&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-1057
implementation of Close action (remove portlet api called over Jetspeed Ajax api)

Modified:
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui-portlet.jsp
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui-portlet.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui-portlet.jsp?rev=831415&r1=831414&r2=831415&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui-portlet.jsp (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui-portlet.jsp Fri Oct 30 18:29:47 2009
@@ -38,7 +38,7 @@
  <div class="portal-layout-cell" id="<%=fragment.getId()%>" name="<%=fragment.getName()%>">
  <div class="portlet <%=pageDec%>">
     <div class="PTitle" >
-          <div class="PTitleContent"><%=title%></div>
+          <div class="PTitleContent"><%=title%></div>              
       <div class="PActionBar">
 <%
     for(DecoratorAction action : (List<DecoratorAction>)fragment.getDecoration().getActions())
@@ -48,6 +48,11 @@
             target = "";
  %>    
      <a href="<%=action.getAction()%>" title="<%=action.getName()%>" class="action portlet-action" <%=target%>><img src="<%=request.getContextPath()%>/<%=action.getLink()%>" alt="<%=action.getAlt()%>" border="0" /></a>
+<% }
+if (request.getUserPrincipal() != null)
+{
+%>
+ <span style='cursor: pointer; z-index: 1000;' id='jetspeed-close-<%=fragment.getId()%>' title="close" class="portlet-action-close"><img src="<%=request.getContextPath()%>/decorations/portlet/jetspeed/images/close.gif" alt="Close" border="0" /></span>
 <% } %>
     </div>
       </div>

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js?rev=831415&r1=831414&r2=831415&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js Fri Oct 30 18:29:47 2009
@@ -1,5 +1,5 @@
 //Use loader to grab the modules needed
-YUI(yuiConfig).use('console', 'dd', 'anim', 'io', 'cookie', 'json', 'widget', function(Y) {
+YUI(yuiConfig).use('console', 'dd', 'anim', 'io', 'cookie', 'json', 'node-base', function(Y) {
  //new Y.Console().render();
     //Make this an Event Target so we can bubble to it
     var Portal = function() {
@@ -207,7 +207,45 @@
      });
         }
     });
+
+    var onComplete = function(id, o, args) {
+     var id = id; // Transaction ID.
+     var data = o.responseText; // Response data.
+     var widgetId = args[0];
+     Y.log("widget removed = " + widgetId);
+     // now remove it from the dom
+     var widget = Y.one("#" + widgetId);
+     if (widget)
+     {
+     var parent = widget.get('parentNode');
+     widget.remove();
+        if (parent.get('children').size() == 0)
+        {
+         //node.plug(Y.Plugin.Drag);
+     var drop = new Y.DD.Drop({
+        node: parent,
+        groups: ['portlets']            
+     });
+        }
+     }
+    };    
     
+    var onClickWindow = function(e) {
+     var uri = document.location.href;
+     uri = uri.replace("/ui", "/ajaxapi");
+     var windowId =  e.currentTarget.getAttribute('id');
+     windowId = windowId.replace("jetspeed-close-", "");
+     var uri = uri + "?action=remove&id=" + windowId;
+     Y.log("delete uri = " + uri);    
+        Y.on('io:complete', onComplete, this, [windowId]);
+        var request = Y.io(uri);
+    };
+    
+    var closeWindows = Y.Node.all('.portlet-action-close');    
+    closeWindows.each(function(v, k) {
+        v.on('click', onClickWindow);
+    });
+        
     Portal.prototype.toggleToolbar = function(toolbar, toggler, compareStyle) {
         toggler.toggleClass('jstbToggle1');
         toggler.toggleClass('jstbToggle2');
@@ -281,6 +319,7 @@
          }
          i++;
         }
+        // I don't think this is working
         e.drop.unplug(Y.Plugin.Drop);
     }
 



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