diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-08 08:18:07 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-08 08:18:07 +0000 |
commit | 49b878b1b0f2e52bbd5282c22ac32a68e1e8736c (patch) | |
tree | 1eb26926f9d703c61b329a0f07178090b57cd55d /sca-cpp/trunk/modules/edit/htdocs | |
parent | 5b33dc5c5a87fff146951ca0543bf558454c331d (diff) |
Change ATOM and RSS feed representations to use name value pairs instead of just strings, to allow support for all ATOM and RSS attributes and avoid confusion with non-feed string results.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1079292 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/edit/htdocs')
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/app/app.html | 21 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/dash/dashboard.html | 20 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/graph/graph.html | 16 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/page/page.html | 16 |
4 files changed, 35 insertions, 38 deletions
diff --git a/sca-cpp/trunk/modules/edit/htdocs/app/app.html b/sca-cpp/trunk/modules/edit/htdocs/app/app.html index c4bc54a8d7..faf0372179 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/app/app.html +++ b/sca-cpp/trunk/modules/edit/htdocs/app/app.html @@ -36,7 +36,6 @@ <th class="thl thr">Settings</th> <th class="thl thr" style="padding-top: 0px; padding-bottom: 0px; padding-right: 0px; text-align: right;"> -<span id="source" style="font-weight: normal;">[atom]</span> <input type="button" id="saveButton" style="font-weight: bold;" Value="Saved"/> </th> </tr> @@ -71,7 +70,6 @@ var dashboard = sca.reference(editWidget, "dashboard"); * The current app name. */ var appname = ui.queryParams()['app']; -$('source').innerHTML = '[<a href="/apps/' + appname + '">atom</a>]'; /** * The current app entry and corresponding saved XML content. @@ -92,12 +90,13 @@ var defdesc = 'Enter a short description of your app here'; */ function getapp(name) { dashboard.get(name, function(doc) { - appentry = doc != null? atom.readATOMEntryDocument(doc) : mklist('', name); - $('appTitle').value = car(appentry) != ''? car(appentry) : deftitle; + appentry = doc != null? car(elementsToValues(atom.readATOMEntry(mklist(doc)))) : mklist("'entry", mklist("'title", ''), mklist("'id", name)); + var title = cadr(assoc("'title", cdr(appentry))); + $('appTitle').value = title != ''? title : deftitle; $('appCategory').value = defcategory; $('appUpdated').innerHTML = defdate; $('appDescription').innerHTML = defdesc; - savedappentryxml = car(atom.writeATOMEntry(appentry)); + savedappentryxml = car(atom.writeATOMEntry(valuesToElements(mklist(appentry)))); }); } @@ -114,10 +113,10 @@ $('saveButton').onclick = function() { function save() { $('saveButton').value = 'Saving'; var title = $('appTitle').value; - appentry = mklist(title != deftitle && title != ''? title : appname, appname, mklist()); - savedappentryxml = car(atom.writeATOMEntry(appentry)); + var appentry = mklist("'entry", mklist("'title", title != deftitle && title != ''? title : appname), mklist("'id", appname)); + savedappentryxml = car(atom.writeATOMEntry(valuesToElements(mklist(appentry)))); dashboard.put(appname, savedappentryxml, function() { - if (savedappentryxml == car(atom.writeATOMEntry(appentry))) + if (savedappentryxml == car(atom.writeATOMEntry(valuesToElements(mklist(appentry))))) $('saveButton').value = 'Saved'; return true; }); @@ -129,14 +128,14 @@ function save() { */ function onappchange() { var title = $('appTitle').value; - appentry = mklist(title != deftitle && title != ''? title : appname, appname, mklist()); - if (savedappentryxml == car(atom.writeATOMEntry(appentry))) + var appentry = mklist("'entry", mklist("'title", title != deftitle && title != ''? title : appname), mklist("'id", appname)); + if (savedappentryxml == car(atom.writeATOMEntry(valuesToElements(mklist(appentry))))) return false; $('saveButton').value = 'Save now'; // Autosave after 3 seconds setTimeout(function() { - if (savedappentryxml == car(atom.writeATOMEntry(appentry))) + if (savedappentryxml == car(atom.writeATOMEntry(valuesToElements(mklist(appentry))))) return false; return save(); }, 3000); diff --git a/sca-cpp/trunk/modules/edit/htdocs/dash/dashboard.html b/sca-cpp/trunk/modules/edit/htdocs/dash/dashboard.html index 3307d193ca..a261f75057 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/dash/dashboard.html +++ b/sca-cpp/trunk/modules/edit/htdocs/dash/dashboard.html @@ -79,20 +79,14 @@ function getapps(sync) { var apps = '<table style="width: 100%;">'; apps += '<tr><th class="thl thr">App</th>' + '<th class="thr thl">Title</th>' + - '<th class="thr thl" style="padding-top: 4px; padding-bottom: 4px; padding-right: 2px; text-align: right;">' + - '<span style="font-weight: normal;">' + - '[<a href="/dashboard">atom</a> <a href="/dashboardcache/joe@localhost">json</a>]' + - '</span></th></tr>'; + '<th class="thr thl" style="padding-top: 4px; padding-bottom: 4px; padding-right: 2px; text-align: right;"></th></tr>'; - var entries = cddr(atom.readATOMFeedDocument(doc)); + var feed = car(elementsToValues(atom.readATOMFeed(mklist(doc)))); + var entries = cadr(assoc("'entry", cdr(feed))); for (var i = 0; i < length(entries); i++) { var entry = entries[i]; - var item = caddr(entry); - var composite = cddr(item); - var comps = scdl.components(composite); - - name = cadr(entry); - title = car(entry); + title = cadr(assoc("'title", entry)) + name = cadr(assoc("'id", entry)) apps += '<tr>'; apps += '<td><a href=\"' + '/graph/?app=' + name + '\" target=\"_parent\">' + name + '</a></td>'; @@ -142,8 +136,8 @@ $('createAppOKButton').onclick = function() { if (name == '') return false; var title = $('appTitle').value; - var app = mklist(title != deftitle && title != ''? title : name, name, mklist()); - var entry = atom.writeATOMEntry(app); + var app = mklist(mklist("'entry", mklist("'title", title != deftitle && title != ''? title : name), mklist("'id", name))); + var entry = atom.writeATOMEntry(valuesToElements(app)); dashboard.put(name, car(entry)); getapps(); $('newApp').style.visibility = 'hidden'; diff --git a/sca-cpp/trunk/modules/edit/htdocs/graph/graph.html b/sca-cpp/trunk/modules/edit/htdocs/graph/graph.html index 2a92a5d11e..4a973a1ed6 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/graph/graph.html +++ b/sca-cpp/trunk/modules/edit/htdocs/graph/graph.html @@ -43,7 +43,6 @@ </th> <th class="thl thr" style="padding-top: 0px; padding-bottom: 0px; padding-right: 0px; text-align: right;"> -<span id="source" style="font-weight: normal;">[atom json]</span> <input type="button" id="saveButton" style="font-weight: bold;" Value="Saved"/> </th> </tr> @@ -67,7 +66,6 @@ var apps = sca.reference(editWidget, "apps"); * The current app name. */ var appname = ui.queryParams()['app']; -$('source').innerHTML = '[<a href="/apps/' + appname + '">atom</a> <a href="/appcache/' + appname + '/app.composite">json</a>]'; /** * The current app composite and corresponding saved XML content. @@ -79,9 +77,13 @@ var composite; * Return the composite in an ATOM entry. */ function atomcomposite(doc) { - var entry = atom.readATOMEntryDocument(doc); - var item = caddr(entry); - return cddr(item); + var entry = atom.readATOMEntry(mklist(doc)); + if (isNil(entry)) + return mklist(); + var content = namedElementChild("'content", car(entry)); + if (content == null) + return mklist(); + return elementChildren(content); } /** @@ -151,8 +153,8 @@ function save() { $('saveButton').value = 'Saving'; savedcomposxml = car(writeXML(composite, false)); var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' + - '<title type="text">' + appname + '</title><id>' + appname + '</id><content type="application/xml"><item>' + - savedcomposxml + '</item></content></entry>'; + '<title type="text">' + appname + '</title><id>' + appname + '</id><content type="application/xml">' + + savedcomposxml + '</content></entry>'; apps.put(appname, entry, function() { if (savedcomposxml == car(writeXML(composite, false))) $('saveButton').value = 'Saved'; diff --git a/sca-cpp/trunk/modules/edit/htdocs/page/page.html b/sca-cpp/trunk/modules/edit/htdocs/page/page.html index 7ace732526..297e5c5a69 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/page/page.html +++ b/sca-cpp/trunk/modules/edit/htdocs/page/page.html @@ -42,7 +42,6 @@ </th> <th class="thl thr" style="padding-top: 0px; padding-bottom: 0px; padding-right: 0px; text-align: right;"> -<span id="source" style="font-weight: normal;">[atom json]</span> <input type="button" id="saveButton" style="font-weight: bold;" Value="Saved"/> </th> </tr> @@ -80,15 +79,18 @@ var pages = sca.reference(editWidget, "pages"); * The current app name. */ var appname = ui.queryParams()['app']; -$('source').innerHTML = '[<a href="/pages/' + appname + '">atom</a> <a href="/appcache/' + appname + '/app.html">json</a>]'; /** * Return the page in an ATOM entry. */ function atompage(doc) { - var entry = atom.readATOMEntryDocument(doc); - var item = caddr(entry); - return cddr(item); + var entry = atom.readATOMEntry(mklist(doc)); + if (isNil(entry)) + return mklist(); + var content = namedElementChild("'content", car(entry)); + if (content == null) + return mklist(); + return elementChildren(content); } /** @@ -180,8 +182,8 @@ function save() { // Update the page ATOM entry var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' + - '<title type="text">' + appname + '</title><id>' + appname + '</id><content type="application/xml"><item>' + - savedpagexhtml + '</item></content></entry>'; + '<title type="text">' + appname + '</title><id>' + appname + '</id><content type="application/xml">' + + savedpagexhtml + '</content></entry>'; pages.put(appname, entry, function(e) { if (savedpagexhtml == pagexhtml()) |