summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/edit/htdocs/page
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-02-08 08:10:17 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-02-08 08:10:17 +0000
commitd81494d1a0c9daa1897203c9d4b49e29ea697219 (patch)
treea32b16ead22253c60261d7af21c864d9ab3b7d6c /sca-cpp/trunk/modules/edit/htdocs/page
parent3cb164dea51add6d6c26210bc6fa58ab8f098cfe (diff)
Refactor groups of reusable components and improve layout a bit. Fix bug preventing saving empty composites.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1068288 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/edit/htdocs/page')
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/page/page.html21
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/page/page.js22
2 files changed, 27 insertions, 16 deletions
diff --git a/sca-cpp/trunk/modules/edit/htdocs/page/page.html b/sca-cpp/trunk/modules/edit/htdocs/page/page.html
index f3fdb9def7..e1800bcdb5 100644
--- a/sca-cpp/trunk/modules/edit/htdocs/page/page.html
+++ b/sca-cpp/trunk/modules/edit/htdocs/page/page.html
@@ -34,7 +34,7 @@
<table style="width: 100%;">
<tr>
-<th class="thl thr" style="width: 330px; min-width: 330px;">Palette</th><th class="ths" style="width: 3px; min-width: 3px;"></th>
+<th class="thl thr" style="width: 230px; min-width: 230px;">Palette</th><th class="ths" style="width: 3px; min-width: 3px;"></th>
<th class="thl thr" style="padding-top: 0px; padding-bottom: 0px;">
<input id="widgetName" type="text" value="widget name" style="position: relative; width: 150px;"/>
@@ -99,16 +99,21 @@ function getpage(name, edit) {
return;
pages.get(name, function(doc) {
- // Convert the page to XHTML
- var xhtml = writeStrings(writeXML(atompage(doc), false));
-
- // Prepare page DOM in hidden buffer
+ // Convert the page to XHTML and place it in a hidden buffer
var buffer = $('buffer');
- buffer.innerHTML = xhtml;
+ var el = atompage(doc);
+ if (isNil(el)) {
+
+ // Create a default empty page if necessary
+ buffer.innerHTML = '<div id="page"></div>';
+ } else {
+ var xhtml = writeStrings(writeXML(atompage(doc), false));
+ buffer.innerHTML = xhtml;
+ }
// Append page nodes to editor
map(function(e) {
- e.style.left = ui.csspos(e.style.left) + 350;
+ e.style.left = ui.csspos(e.style.left) + 250;
edit.appendChild(e);
return page.cover(e);
}, nodeList(buffer.childNodes[0].childNodes));
@@ -135,7 +140,7 @@ $('saveButton').onclick = function(e) {
div.removeChild(e);
return e;
}
- var x = ui.csspos(e.style.left) - 350;
+ var x = ui.csspos(e.style.left) - 250;
if (x < 0 || ui.csspos(e.style.top) < 0) {
div.removeChild(e);
return e;
diff --git a/sca-cpp/trunk/modules/edit/htdocs/page/page.js b/sca-cpp/trunk/modules/edit/htdocs/page/page.js
index 41273d9824..c1a2311fa2 100644
--- a/sca-cpp/trunk/modules/edit/htdocs/page/page.js
+++ b/sca-cpp/trunk/modules/edit/htdocs/page/page.js
@@ -22,6 +22,12 @@
*/
var page = {};
+/**
+ * Default positions and sizes.
+ */
+var palcx = 250;
+var trashcx = 230;
+
if (ui.isIE()) {
/**
@@ -78,12 +84,12 @@ if (ui.isIE()) {
return false;
// Discard element dragged out of page area
- if (ui.csspos(page.dragging.style.left) < 350 && page.dragging.id.substring(0, 8) != 'palette:') {
- if (ui.csspos(page.dragging.style.left) >= 330) {
+ if (ui.csspos(page.dragging.style.left) < palcx && page.dragging.id.substring(0, 8) != 'palette:') {
+ if (ui.csspos(page.dragging.style.left) >= trashcx) {
// Unless it's close enough to page area, then move it there
- page.dragging.style.left = 350;
- page.dragging.cover.style.left = 350;
+ page.dragging.style.left = palcx;
+ page.dragging.cover.style.left = palcx;
} else {
page.dragging.parentNode.removeChild(page.dragging);
@@ -215,12 +221,12 @@ if (ui.isIE()) {
return false;
// Discard element dragged out of page area
- if (ui.csspos(page.dragging.style.left) < 350 && page.dragging.id.substring(0, 8) != 'palette:') {
- if (ui.csspos(page.dragging.style.left) >= 330) {
+ if (ui.csspos(page.dragging.style.left) < palcx && page.dragging.id.substring(0, 8) != 'palette:') {
+ if (ui.csspos(page.dragging.style.left) >= trashcx) {
// Unless it's close enough to page area, then move it there
- page.dragging.style.left = 350;
- page.dragging.cover.style.left = 350;
+ page.dragging.style.left = palcx;
+ page.dragging.cover.style.left = palcx;
} else {
page.dragging.parentNode.removeChild(page.dragging);