diff options
Diffstat (limited to 'sca-cpp/trunk/modules/edit/htdocs/page/page.html')
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/page/page.html | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sca-cpp/trunk/modules/edit/htdocs/page/page.html b/sca-cpp/trunk/modules/edit/htdocs/page/page.html index e2cd50088e..202fb7aacc 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/page/page.html +++ b/sca-cpp/trunk/modules/edit/htdocs/page/page.html @@ -57,11 +57,9 @@ var editWidget = sca.component("EditWidget"); var pages = sca.reference(editWidget, "pages"); /** - * Return the current app name. + * The current app name. */ -function appname() { - return ui.queryParams()['app']; -} +var appname = ui.queryParams()['app']; /** * Return the page in an ATOM entry. @@ -79,6 +77,7 @@ function getpage(name, edit) { if (isNil(name)) return; pages.get(name, function(doc) { + // Convert the page to XHTML var xhtml = writeStrings(writeXML(atompage(doc), false)); @@ -88,7 +87,7 @@ function getpage(name, edit) { // Append page nodes to editor map(function(e) { - e.style.left = ui.posn(e.style.left) + 350; + e.style.left = ui.csspos(e.style.left) + 350; edit.appendChild(e); return page.cover(e); }, nodeList(buffer.childNodes[0].childNodes)); @@ -99,6 +98,7 @@ function getpage(name, edit) { * Save the current edited page. */ $('saveButton').onclick = function(e) { + // Copy page DOM to hidden buffer var edit = $('page'); var buffer = $('buffer'); @@ -114,8 +114,8 @@ $('saveButton').onclick = function(e) { div.removeChild(e); return e; } - var x = ui.posn(e.style.left) - 350; - if (x < 0 || ui.posn(e.style.top) < 0) { + var x = ui.csspos(e.style.left) - 350; + if (x < 0 || ui.csspos(e.style.top) < 0) { div.removeChild(e); return e; } @@ -128,11 +128,11 @@ $('saveButton').onclick = function(e) { var xhtml = writeStrings(writeXML(lxhtml, false)); // Update the page ATOM entry - var name = appname(); - var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title type="text">' + name + '</title><id>' + name + '</id><content type="application/xml"><item>' + + var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' + + '<title type="text">' + appname + '</title><id>' + appname + '</id><content type="application/xml"><item>' + xhtml + '</item></content></entry>'; - pages.put(name, entry, function(e) {}); + pages.put(appname, entry, function(e) {}); }; // Initialize the page editor @@ -140,7 +140,7 @@ var edit = $('page'); page.initpage(edit); // Get and display the current app page -getpage(appname(), edit); +getpage(appname, edit); </script> </body> |