You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2010/01/05 22:36:09 UTC
svn commit: r896232 - in
/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp:
WEB-INF/jetui/yui/jetui-portlet.jsp WEB-INF/jetui/yui/jetui.jsp
javascript/jetspeed/jetui/jetui-portal.js
Author: taylor
Date: Tue Jan 5 21:36:05 2010
New Revision: 896232
URL: http://svn.apache.org/viewvc?rev=896232&view=rev
Log:
JS2-1084
improvements and bug fixes to attach and detach
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/WEB-INF/jetui/yui/jetui.jsp
portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-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=896232&r1=896231&r2=896232&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 Tue Jan 5 21:36:05 2010
@@ -43,9 +43,10 @@
{
String x = fragment.getProperty(ContentFragment.X_PROPERTY_NAME);
String y = fragment.getProperty(ContentFragment.Y_PROPERTY_NAME);
-
+ int row = fragment.getLayoutRow();
+ int col = fragment.getLayoutColumn();
%>
- <div class="portal-layout-cell" x='<%=x%>' y='<%=y%>' id="<%=fragment.getId()%>" name="<%=fragment.getName()%>" column="0" row="0" style='position: absolute; top: <%=x%>px; left: <%=y%>px;' detached='true' locked='<%=fragment.isLocked()%>'>
+ <div class="portal-layout-cell" x='<%=x%>' y='<%=y%>' id="<%=fragment.getId()%>" name="<%=fragment.getName()%>" column="<%=col%>" row="<%=row%>" style='position: absolute; top: <%=x%>px; left: <%=y%>px;' detached='true' locked='<%=fragment.isLocked()%>'>
<%
}
else
@@ -75,9 +76,9 @@
%>
<span style='cursor: pointer; z-index: 1000;' id='jetspeed-close-<%=fragment.getId()%>' title="close" class="portlet-action-close"><img src="<%=request.getContextPath()%>/decorations/images/close.gif" alt="Close" border="0" /></span>
<% if (detached != null) { %>
- <span style='cursor: pointer; z-index: 1000;' id='jetspeed-detach-<%=fragment.getId()%>' title="attach" class="portlet-action-attach"><img src="<%=request.getContextPath()%>/decorations/images/attach.gif" alt="Attach" border="0" /></span>
+ <span style='cursor: pointer; z-index: 1000;' id='jetspeed-detach-<%=fragment.getId()%>' title="attach" class="portlet-action-attach"><img src="<%=request.getContextPath()%>/decorations/images/attach.gif" alt="Attach" border="0" id='jetspeed-detach-img-<%=fragment.getId()%>'/></span>
<% } else { %>
- <span style='cursor: pointer; z-index: 1000;' id='jetspeed-detach-<%=fragment.getId()%>' title="detach" class="portlet-action-detach"><img src="<%=request.getContextPath()%>/decorations/images/detach.gif" alt="Detach" border="0" /></span>
+ <span style='cursor: pointer; z-index: 1000;' id='jetspeed-detach-<%=fragment.getId()%>' title="detach" class="portlet-action-detach"><img src="<%=request.getContextPath()%>/decorations/images/detach.gif" alt="Detach" border="0" id='jetspeed-detach-img-<%=fragment.getId()%>'/></span>
<% } } } %>
</div>
</div>
Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp?rev=896232&r1=896231&r2=896232&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp Tue Jan 5 21:36:05 2010
@@ -298,12 +298,14 @@
{
String x = fragment.getProperty(ContentFragment.X_PROPERTY_NAME);
String y = fragment.getProperty(ContentFragment.Y_PROPERTY_NAME);
+ int row = fragment.getLayoutRow();
+ int col = fragment.getLayoutColumn();
String content = jetui.getRenderedContent((ContentFragment)fragment, rc);
Decoration.ActionsOption option = fragment.getDecoration().getActionsOption();
if (option == Decoration.ActionsOption.HIDE) // TODO: HOVER, DROP DOWN not yet implemented
{
%>
- <div id='<%=fragment.getId()%>' detached='true' locked='<%=fragment.isLocked()%>' name='<%=fragment.getName()%>' column='0' row='0' x='<%=x%>' y='<%=y%>' style='position: absolute; top: <%=x%>px; left: <%=y%>px;'>
+ <div id='<%=fragment.getId()%>' detached='true' locked='<%=fragment.isLocked()%>' name='<%=fragment.getName()%>' column='<%=col%>' row='<%=row%>' x='<%=x%>' y='<%=y%>' style='position: absolute; top: <%=x%>px; left: <%=y%>px;'>
<%=content%>
</div>
<% } else {
Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js?rev=896232&r1=896231&r2=896232&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js Tue Jan 5 21:36:05 2010
@@ -285,13 +285,8 @@
*/
detachPortlet : function(e) {
var portal = JETUI_YUI.getPortalInstance();
- var windowId = null;
- if (e instanceof String) {
- windowId = e;
- } else {
- windowId = e.currentTarget.getAttribute("id");
- windowId = windowId.replace(/^jetspeed-detach-/, "");
- }
+ var actionId = e.currentTarget.getAttribute("id");
+ var windowId = actionId.replace(/^jetspeed-detach-/, "");
var window = Y.one("[id='" + windowId + "']");
var jetspeedZone = Y.one('#jetspeedZone');
if (!Y.Lang.isNull(jetspeedZone)) {
@@ -330,14 +325,21 @@
groups: ['grid']
});
}
- e.currentTarget.on('click', portal.attachPortlet);
- e.currentTarget.setAttribute("title", "attach");
- e.currentTarget.setAttribute("class", "portlet-action-attach");
- var imgsrc = e.target.getAttribute("src");
- if (imgsrc != null) {
- e.target.setAttribute("src", imgsrc.replace("/detach/", "attach"));
- e.target.setAttribute("alt", "Attach");
- }
+ var action = Y.one("[id='" + actionId + "']");
+ if (!Y.Lang.isNull(action)) {
+ Y.Event.purgeElement("[id='" + actionId + "']", false, "click");
+ action.on('click', portal.attachPortlet);
+ action.setAttribute("title", "attach");
+ action.setAttribute("class", "portlet-action-attach");
+ var imgid = actionId.replace(/^jetspeed-detach-/, "jetspeed-detach-img-");
+ var img = Y.one("[id='" + imgid + "']");;
+ var imgsrc = img.getAttribute("src");
+ if (imgsrc != null) {
+ var s = imgsrc.replace("detach", "attach");
+ img.setAttribute("src", s);
+ img.setAttribute("alt", "Attach");
+ }
+ }
var uri = portal.portalContextPath + "/services/pagelayout/fragment/" + windowId + "/pos/?_type=json";
uri += "&x=" + x + "&y=" + y + "&layout=detach";
var config = {
@@ -355,13 +357,8 @@
*/
attachPortlet : function(e) {
var portal = JETUI_YUI.getPortalInstance();
- var windowId = null;
- if (e instanceof String) {
- windowId = e;
- } else {
- windowId = e.currentTarget.getAttribute("id");
- windowId = windowId.replace(/^jetspeed-detach-/, "");
- }
+ var actionId = e.currentTarget.getAttribute("id");
+ var windowId = actionId.replace(/^jetspeed-detach-/, "");
var window = Y.one("[id='" + windowId + "']");
var col = window.data.get("column");
var layout = null;
@@ -383,14 +380,22 @@
window.setStyle('top', '');
window.setStyle('left', '');
window.data.set('detached', false);
- e.currentTarget.on('click', portal.detachPortlet);
- e.currentTarget.setAttribute("title", "detach");
- e.currentTarget.setAttribute("class", "portlet-action-detach");
- var imgsrc = e.target.getAttribute("src");
- if (imgsrc != null) {
- e.target.setAttribute("src", imgsrc.replace("/attach/", "detach"));
- e.target.setAttribute("alt", "Detach");
- }
+
+ var action = Y.one("[id='" + actionId + "']");
+ if (!Y.Lang.isNull(action)) {
+ Y.Event.purgeElement("[id='" + actionId + "']", false, "click");
+ action.on('click', portal.detachPortlet);
+ action.setAttribute("title", "detach");
+ action.setAttribute("class", "portlet-action-detach");
+ var imgid = actionId.replace(/^jetspeed-detach-/, "jetspeed-detach-img-");
+ var img = Y.one("[id='" + imgid + "']");;
+ var imgsrc = img.getAttribute("src");
+ if (imgsrc != null) {
+ var s = imgsrc.replace("attach", "detach");
+ img.setAttribute("src", s);
+ img.setAttribute("alt", "Detach");
+ }
+ }
var drag = Y.DD.DDM.getDrag(window);
drag.removeFromGroup("detached");
drag.addToGroup("grid");
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org