Today I spent quite a while figuring out upcoming monster changes in SiteAdmin CMS core where we planning to get back to XML Databases as it was in 2003-2005. I wont post here all these details about long time research work and so on, today I just want to drop few words about our JavaScript framework WamlJs that originally was planned as core for WAML (Web Application Markup Language, XML driven markup for UI prototyping that we brought early 2006).
For the content safety and better content roundtrip between client side and server we choose obviously XML, yea, yea, we tried and JSON and whatever, but for the moment the best option seems XML, no matter what.
So one of the things we needed to do is to actually create XML representation of data that we are going to send to the server, including non-content specific data. To do that I've included waml.dom.js and created little helper:
SiteAdmin.CMS.Xml = {};
SiteAdmin.CMS.Xml.createElement = function(name, data) {
var el = Waml.Dom.create(name);
if (data != undefined) {
el.appendChild(Waml.Dom.text(data));
}
return el;
};All that this piece for code does is creating XML DOM element with default TEXT data. Just for your information, whole things works in Safari, FF 2/3 and IE without any issues. Then, I've created little set of actions to collect data from my input fields:
var temp = Waml.Dom.create("temp");Now all I need is to send data on server, that is extremely simple:
var xmlPost = SiteAdmin.CMS.Xml.createElement("PostData");
xmlPost.appendChild(SiteAdmin.CMS.Xml.createElement("mode", "save"));
xmlPost.appendChild(SiteAdmin.CMS.Xml.createElement("pageId", SiteAdmin.CMS.Pages.currentPageId));
xmlPost.appendChild(SiteAdmin.CMS.Xml.createElement("filename", $("fileName").value));
xmlPost.appendChild(SiteAdmin.CMS.Xml.createElement("master", $("masterPages").options[$("masterPages").selectedIndex].value));
xmlPost.appendChild(SiteAdmin.CMS.Xml.createElement("title", $("title").value));
xmlPost.appendChild(SiteAdmin.CMS.Xml.createElement("keywords", $("keywords").value));
xmlPost.appendChild(SiteAdmin.CMS.Xml.createElement("description", $("description").value));
xmlPost.appendChild(SiteAdmin.CMS.Xml.createElement("content", oe.GetXHTML(true)));
Waml.Http.open("POST", "api.aspx?rnd=" + Math.random() * 4096, true, function(req) {
Waml.Dom.show($("networkStatus"));
eval(req.responseText);
$("networkStatus").innerHTML = SiteAdmin.CMS.Pages.serverReply.status;
SiteAdmin.CMS.Pages.currentPageId = SiteAdmin.CMS.Pages.serverReply.pageId;
}, function(req) { }, temp.innerHTML);
That's it for the moment. More cool things still coming these days.
Related information
- http://waml.googlecode.com/svn/trunk/1.7/ -SVN Repository for latest WAML JavaScript core.
- http://skitsanos.com/content/siteadmin.aspx - general information on Skitsanos SiteAdmin CMS©.
- http://www.xing.com/net/waml - initial forums relayed to WAML.
0 comments:
Post a Comment