Author: michiel
Date: 2010-04-28 17:12:18 +0200 (Wed, 28 Apr 2010)
New Revision: 42069
Added:
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/block-content.jspx
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/block.jspx
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/page.css
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/page.js
Modified:
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/index.jspx
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/index.jspx
Log:
some progress with an editor with drag/drop
Added:
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/block-content.jspx
===================================================================
---
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/block-content.jspx
(rev 0)
+++
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/block-content.jspx
2010-04-28 15:12:18 UTC (rev 42069)
@@ -0,0 +1,32 @@
+<jsp:root
+ version="2.0"
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+ xmlns:mm-sr="http://www.mmbase.org/tags/mm/searchrelate"
+ xmlns:mm="http://www.mmbase.org/mmbase-taglib-2.0"
+ xmlns:mm-portal="http://www.mmbase.org/tags/mm/portal"
+ xmlns:mm-portalt="urn:jsptagdir:/WEB-INF/tags/mm/portal"
+ xmlns:os="http://www.opensymphony.com/oscache"
+ >
+ <mm:import externid="x">0</mm:import>
+ <mm:import externid="y">0</mm:import>
+ <mm:import externid="block" from="request"/>
+
+ <select class="width" name="width">
+ <c:forEach begin="1" end="4" var="w">
+ <mm:option value="${w}" compare="${blockposrel.width}">${w}</mm:option>
+ </c:forEach>
+ </select>
+ x
+ <select class="height" name="height">
+ <c:forEach begin="1" end="3" var="h">
+ <mm:option value="${h}" compare="${blockposrel.height}">${h}</mm:option>
+ </c:forEach>
+ </select>
+ <div class="coor">(<span class="x">${x}</span>,<span
class="y">${y}</span>)</div>
+ <mm:node referid="block">
+ <mm:field name="name" />
+ <mm:field name="description" />
+ </mm:node>
+</jsp:root>
Added:
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/block.jspx
===================================================================
---
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/block.jspx
(rev 0)
+++
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/block.jspx
2010-04-28 15:12:18 UTC (rev 42069)
@@ -0,0 +1,15 @@
+<jsp:root
+ version="2.0"
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:mm="http://www.mmbase.org/mmbase-taglib-2.0"
+ >
+ <mm:content type="text/html">
+ <mm:import externid="x">0</mm:import>
+ <mm:import externid="y">0</mm:import>
+ <mm:import externid="block" required="true" />
+ <div class="block x${x} y${y} width1 height1">
+ <mm:include page="block-content.jspx" attributes="block"/>
+ </div>
+ </mm:content>
+</jsp:root>
Modified:
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/index.jspx
===================================================================
---
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/index.jspx
2010-04-28 15:11:36 UTC (rev 42068)
+++
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/index.jspx
2010-04-28 15:12:18 UTC (rev 42069)
@@ -26,64 +26,19 @@
<mm:param name="absolutepositions">false</mm:param>
<link rel="stylesheet" type="text/css" href="${_}" />
</mm:link>
+ <mm:link page="/mmbase/searchrelate/page.css.jsp">
+ <link rel="stylesheet" type="text/css" href="${_}" />
+ </mm:link>
+ <mm:link page="page.css">
+ <link rel="stylesheet" type="text/css" href="${_}" />
+ </mm:link>
<mm:include page="/mmbase/jquery/jquery-ui.jspx" />
<mm:link
page="/mmbase/jquery/css/jquery-ui-${requestScope['org.mmbase.jquery.ui.version']}.custom.css">
<link type="text/css" href="${_}" rel="stylesheet" />
</mm:link>
- <style type="text/css">
- .mm_portal_content {
- margin-left: 0px;
- position: relative;
- background-color: yellow;
-
- }
- .mm_portal_content .block {
- position: relative;
- float: left;
- margin: 0; padding: 0px;
- border: dashed 1px green;
-
- }
- </style>
-
- <script type="text/javascript">
- $(function() {
- $("#test").draggable({
- cursor: 'move',
- init: function() {
- console.log("hi");
- },
- start: function(event, ui) {
- var el = event.target;
- alert('hoi');
- console.log(event);
- console.log(el);
- console.log(ui);
- $(el).removeClass("x0 x1 x2 x3 y0 y1 y2 y4");
- },
-
- helper: function(event) {
- console.log(event);
- }
- });
-
-
- $("select.width").live("change", function() {
- $(this).closest(".block").removeClass("width1 width2 width3
width4");
- $(this).closest(".block").addClass("width" + $(this).val());
- });
- $("select.height").live("change", function() {
- $(this).closest(".block").removeClass("height1 height2 height3
height4");
- $(this).closest(".block").addClass("height" + $(this).val());
- });
- });
- </script>
-
+ <script type="text/javascript" src="page.js"><jsp:text>
</jsp:text></script>
</head>
<body>
- <div id="test">
- KOLERE
- </div>
<c:choose>
<c:when test="${empty page}">
<table>
@@ -116,25 +71,10 @@
</table>
<mm-sr:search type="blocks" implicit="false" />
<mm-portal:blocks>
- <select class="width" name="width">
- <c:forEach begin="1" end="4" var="w">
- <mm:option value="${w}"
compare="${blockposrel.width}">${w}</mm:option>
- </c:forEach>
- </select>
- x
- <select class="height" name="height">
- <c:forEach begin="1" end="3" var="h">
- <mm:option value="${h}"
compare="${blockposrel.height}">${h}</mm:option>
- </c:forEach>
- </select>
- <br />
- ${blockposrel.number} /
- ${blockposrel.x} ${blockposrel.y}
-
- <mm:node referid="block">
- <mm:field name="name" />
- <mm:field name="description" />
- </mm:node>
+ <mm:include page="block-content.jspx" attributes="block">
+ <mm:param name="x">${blockposrel.x}</mm:param>
+ <mm:param name="y">${blockposrel.y}</mm:param>
+ </mm:include>
</mm-portal:blocks>
</mm:node>
</c:otherwise>
Added:
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/page.css
===================================================================
---
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/page.css
(rev 0)
+++
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/page.css
2010-04-28 15:12:18 UTC (rev 42069)
@@ -0,0 +1,16 @@
+.mm_portal_content {
+ margin-left: 0px;
+ position: relative;
+ background-color: yellow;
+
+}
+.mm_portal_content .block {
+ position: relative;
+ float: left;
+ margin: 0; padding: 0px;
+ border: dashed 1px green;
+
+}
+div.searchresult.implicit {
+ display: none;
+}
\ No newline at end of file
Added:
speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/page.js
===================================================================
--- speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/page.js
(rev 0)
+++ speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/edit/page/page.js
2010-04-28 15:12:18 UTC (rev 42069)
@@ -0,0 +1,51 @@
+$(function() {
+ var draggableOptions =
+ {
+ containment: 'parent',
+ cursor: 'move',
+ grid: [150, 150],
+ start: function(event, ui) {
+ var el = event.target;
+ $(el).removeClass("x0 x1 x2 x3 y0 y1 y2 y4");
+ },
+ stop: function(event, ui) {
+ var x = $(event.target).find("span.x");
+ var y = $(event.target).find("span.y");
+ if (x[0].orig == null) {
+ x[0].orig = parseInt(x.text());
+ y[0].orig = parseInt(y.text());
+ }
+ var dx = ui.position.left / 150;
+ var dy = ui.position.top / 150;
+ x.text("" + (x[0].orig + dx));
+ y.text("" + (y[0].orig + dy));
+ }
+ };
+ $(".mm_portal_content .block")
+ .draggable(draggableOptions);
+ $("select.width")
+ .live("change",
+ function() {
+ $(this).closest(".block").removeClass("width1 width2 width3
width4");
+ $(this).closest(".block").addClass("width" + $(this).val());
+ });
+ $("select.height")
+ .live("change",
+ function() {
+ $(this).closest(".block").removeClass("height1 height2
height3 height4");
+ $(this).closest(".block").addClass("height" +
$(this).val());
+ });
+
+ $("div.mm_related").
+ live("mmsrRelate",
+ function (e, tr, relater) {
+ $.get("block.jspx?block=" + relater.getNumber(tr),
+ function(data){
+ var newBlock = $(data);
+ $(".mm_portal_content").append(newBlock);
+ newBlock.draggable(draggableOptions);
+ }
+ );
+ }
+ );
+ });
\ No newline at end of file
Modified: speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/index.jspx
===================================================================
--- speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/index.jspx
2010-04-28 15:11:36 UTC (rev 42068)
+++ speeltuin/mihxil/portal/trunk/test-webapp/src/main/webapp/index.jspx
2010-04-28 15:12:18 UTC (rev 42069)
@@ -23,7 +23,8 @@
<mm:link page="/mmbase/portal/portal.css.jsp">
<link rel="stylesheet" type="text/css" href="${_}" />
</mm:link>
- <mm:link page="/mmbase/jquery/css/jquery-ui-1.7.2.custom.css">
+ <mm:include page="/mmbase/jquery/jquery-ui.jspx" />
+ <mm:link
page="/mmbase/jquery/css/jquery-ui-${requestScope['org.mmbase.jquery.ui.version']}.custom.css">
<link type="text/css" href="${_}" rel="stylesheet" />
</mm:link>
<!--
@@ -35,6 +36,7 @@
<mm:include page="/mmbase/jquery/jquery-ui.jspx" />
<c:if test="${! empty param.edit}">
<mm:link page="/mmbase/portal/portal.js.jsp">
+ <mm:param name="xml">true</mm:param>
<script type="text/javascript" src="${_}"><jsp:text>
</jsp:text></script>
<script type="text/javascript">
var portal = new MMBasePortal();
@@ -47,10 +49,9 @@
<h1><mm:field name="title" /></h1>
<p>path: ${_node.path}</p>
<mm-portal:blocks>
- <mm:node node="page">
-
+ <mm-portal:block group="" block="${block}"
blockposrel="${blockposrel}">
<mm:component name="${block.component}" block="${block.name}" />
- </mm:node>
+ </mm-portal:block>
</mm-portal:blocks>
</body>
</mm:node>
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs