diff options
Diffstat (limited to 'sca-cpp/trunk/hosting')
38 files changed, 344 insertions, 344 deletions
diff --git a/sca-cpp/trunk/hosting/server/accounts.py b/sca-cpp/trunk/hosting/server/accounts.py index 99655620f1..6aa50c9375 100644 --- a/sca-cpp/trunk/hosting/server/accounts.py +++ b/sca-cpp/trunk/hosting/server/accounts.py @@ -28,7 +28,7 @@ def accountid(user): def get(id, user, cache): debug('accounts.py::get::id', id) account = cache.get(accountid(user)) - if isNil(account): + if isNull(account): return mkentry(user.get(()), user.get(()), user.get(()), now(), ()) return account diff --git a/sca-cpp/trunk/hosting/server/apps.py b/sca-cpp/trunk/hosting/server/apps.py index 5b0c1b8831..20c38cb3c5 100644 --- a/sca-cpp/trunk/hosting/server/apps.py +++ b/sca-cpp/trunk/hosting/server/apps.py @@ -34,7 +34,7 @@ def put(id, app, user, cache, dashboard, store, composites, pages, icons): if car(id) == eid: # Check app author eapp = cache.get(appid(id)) - if (not isNil(eapp)) and (author(eapp) != user.get(())): + if (not isNull(eapp)) and (author(eapp) != user.get(())): debug('apps.py::put', 'different author', author(eapp)) return False @@ -45,7 +45,7 @@ def put(id, app, user, cache, dashboard, store, composites, pages, icons): dashboard.put(id, appentry) # Create new page and composite if necessary - if isNil(eapp): + if isNull(eapp): comp = mkentry(car(id), car(id), user.get(()), now(), ()) composites.put(id, comp) page = mkentry(car(id), car(id), user.get(()), now(), ()) @@ -57,13 +57,13 @@ def put(id, app, user, cache, dashboard, store, composites, pages, icons): # Check app author eapp = cache.get(appid(id)) - if (not isNil(eapp)) and (author(eapp) != user.get(())): + if (not isNull(eapp)) and (author(eapp) != user.get(())): debug('apps.py::put', 'different author', author(eapp)) return False # Get app to clone capp = cache.get(appid((eid,))) - if isNil(capp): + if isNull(capp): debug('apps.py::put', 'cloned app not found', (eid,)) return False @@ -80,12 +80,12 @@ def put(id, app, user, cache, dashboard, store, composites, pages, icons): # Get an app from the apps db def get(id, user, cache, dashboard, store, composites, pages, icons): debug('apps.py::get::id', id) - if isNil(id): + if isNull(id): return (("'feed", ("'title", "Apps"), ("'id", "apps")),) # Get the requested app app = cache.get(appid(id)) - if isNil(app): + if isNull(app): debug('apps.py::get', 'app not found', id) return None @@ -99,7 +99,7 @@ def delete(id, user, cache, dashboard, store, composites, pages, icons): # Get the requested app app = cache.get(appid(id)) - if isNil(app): + if isNull(app): debug('apps.py::delete', 'app not found', id) return False diff --git a/sca-cpp/trunk/hosting/server/atomutil.py b/sca-cpp/trunk/hosting/server/atomutil.py index 8f01f81d3a..2fbcaff8ce 100644 --- a/sca-cpp/trunk/hosting/server/atomutil.py +++ b/sca-cpp/trunk/hosting/server/atomutil.py @@ -21,42 +21,42 @@ from time import strftime, gmtime # Make an ATOM entry def mkentry(title, id, author, updated, content): - return (("'entry", ("'title", title), ("'id", id), ("'author", author), ("'updated", updated), ("'content",) if isNil(content) else ("'content", content)),) + return (("'entry", ("'title", title), ("'id", id), ("'author", author), ("'updated", updated), ("'content",) if isNull(content) else ("'content", content)),) # Make an ATOM feed def mkfeed(title, id, author, updated, entries): - return (("'entry", ("'title", title), ("'id", id), ("'author", author), ("'updated", updated), ("'content",) if isNil(content) else ("'content", content)),) + return (("'entry", ("'title", title), ("'id", id), ("'author", author), ("'updated", updated), ("'content",) if isNull(content) else ("'content", content)),) # Return ATOM attributes def title(e): - if isNil(e): + if isNull(e): return () t = assoc("'title", car(e)) - return None if isNil(t) else cadr(t) + return None if isNull(t) else cadr(t) def entryid(e): - if isNil(e): + if isNull(e): return () id = assoc("'id", car(e)) - return None if isNil(id) else cadr(id) + return None if isNull(id) else cadr(id) def author(e): - if isNil(e): + if isNull(e): return () a = assoc("'author", car(e)) - return None if isNil(a) else cadr(a) + return None if isNull(a) else cadr(a) def updated(e): - if isNil(e): + if isNull(e): return () u = assoc("'updated", car(e)) - return None if isNil(u) else cadr(u) + return None if isNull(u) else cadr(u) def content(e): - if isNil(e): + if isNull(e): return () c = assoc("'content", car(e)) - return () if isNil(c) or isNil(cdr(c)) else c[len(c) - 1] + return () if isNull(c) or isNull(cdr(c)) else c[len(c) - 1] # Return the current time def now(): diff --git a/sca-cpp/trunk/hosting/server/authn.py b/sca-cpp/trunk/hosting/server/authn.py index 02c24a2852..e3d6711cbd 100644 --- a/sca-cpp/trunk/hosting/server/authn.py +++ b/sca-cpp/trunk/hosting/server/authn.py @@ -25,7 +25,7 @@ def authnid(id): # Get a user's authentication def get(id, cache): authn = cache.get(authnid(id)) - if isNil(authn): + if isNull(authn): return None return authn diff --git a/sca-cpp/trunk/hosting/server/client-test.hpp b/sca-cpp/trunk/hosting/server/client-test.hpp index 9d887e0558..7620326421 100644 --- a/sca-cpp/trunk/hosting/server/client-test.hpp +++ b/sca-cpp/trunk/hosting/server/client-test.hpp @@ -221,7 +221,7 @@ const list<future<bool> > startPost(const worker& w, const int threads, const bl } const bool checkPost(const list<future<bool> >& r) { - if (isNil(r)) + if (isNull(r)) return true; assert(car(r) == true); return checkPost(cdr(r)); @@ -279,7 +279,7 @@ const list<pid_t> startPost(const int procs, const blambda& l) { } const bool checkPost(const list<pid_t>& r) { - if (isNil(r)) + if (isNull(r)) return true; int status; waitpid(car(r), &status, 0); diff --git a/sca-cpp/trunk/hosting/server/composites.py b/sca-cpp/trunk/hosting/server/composites.py index 9e4b40b669..d0276ab5ee 100644 --- a/sca-cpp/trunk/hosting/server/composites.py +++ b/sca-cpp/trunk/hosting/server/composites.py @@ -31,7 +31,7 @@ def put(id, comp, user, cache, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('composites.py::put', 'app not found', id) return False @@ -48,12 +48,12 @@ def put(id, comp, user, cache, apps): # Get a composite from the composite db def get(id, user, cache, apps): debug('composites.py::get::id', id) - if isNil(id): + if isNull(id): return (("'feed", ("'title", "Composites"), ("'id", "composites")),) # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('composites.py::get', 'app not found', id) # Return a default new composite @@ -61,7 +61,7 @@ def get(id, user, cache, apps): # Get the requested composite comp = cache.get(compid(id)) - if isNil(comp): + if isNull(comp): debug('composites.py::get', 'composite not found', id) # Return a default new composite @@ -78,7 +78,7 @@ def delete(id, user, cache, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('composites.py::delete', 'app not found', id) return False diff --git a/sca-cpp/trunk/hosting/server/dashboards.py b/sca-cpp/trunk/hosting/server/dashboards.py index a87f1fa819..d2dca67ddd 100644 --- a/sca-cpp/trunk/hosting/server/dashboards.py +++ b/sca-cpp/trunk/hosting/server/dashboards.py @@ -28,10 +28,10 @@ def dashboardid(user): def getdashboard(id, cache): debug('dashboards.py::getdashboard::id', id) val = cache.get(id) - if isNil(val): + if isNull(val): return () dashboard = cdddr(car(val)) - if not isNil(dashboard) and isList(car(cadr(car(dashboard)))): + if not isNull(dashboard) and isList(car(cadr(car(dashboard)))): # Expand list of entries edashboard = tuple(map(lambda e: cons("'entry", e), cadr(car(dashboard)))) debug('dashboards.py::getdashboard::edashboard', edashboard) @@ -53,7 +53,7 @@ def put(id, app, user, cache, apps, ratings): debug('dashboards.py::put::app', app) def putapp(id, app, dashboard): - if isNil(dashboard): + if isNull(dashboard): return app if car(id) == entryid(dashboard): return cons(car(app), cdr(dashboard)) @@ -73,15 +73,15 @@ def mergeapps(entries, apps, ratings): debug('store.py::mergeapp::entry', entry) id = (entryid(entry),) app = apps.get(id) - if isNil(app): + if isNull(app): return ((),) info = content(app) rating = ratings.get(id) rates = content(rating) - mergedentry = mkentry(title(app), car(id), author(app), updated(app), ("'info",) + (() if isNil(info) else cdr(info)) + (() if isNil(rates) else cdr(rates))) + mergedentry = mkentry(title(app), car(id), author(app), updated(app), ("'info",) + (() if isNull(info) else cdr(info)) + (() if isNull(rates) else cdr(rates))) return mergedentry - mergedentries = tuple(filter(lambda e: not isNil(e), map(lambda e: car(mergeapp((e,))), entries))) + mergedentries = tuple(filter(lambda e: not isNull(e), map(lambda e: car(mergeapp((e,))), entries))) debug('store.py::mergeapps::mergedentries', mergedentries) return mergedentries @@ -90,13 +90,13 @@ def get(id, user, cache, apps, ratings): debug('dashboards.py::get::id', id) def findapp(id, dashboard): - if isNil(dashboard): + if isNull(dashboard): return None if car(id) == entryid(dashboard): return (car(dashboard),) return findapp(id, cdr(dashboard)) - if isNil(id): + if isNull(id): dashboardapps = mergeapps(getdashboard(dashboardid(user), cache), apps, ratings) dashboard = ((("'feed", ("'title", "Your Apps"), ("'id", user.get(()))) + dashboardapps),) debug('dashboards.py::get::dashboard', dashboard) @@ -109,11 +109,11 @@ def get(id, user, cache, apps, ratings): # Delete apps from the user's dashboard def delete(id, user, cache, apps, ratings): debug('dashboards.py::delete::id', id) - if isNil(id): + if isNull(id): return cache.delete(dashboardid(user)) def deleteapp(id, dashboard): - if isNil(dashboard): + if isNull(dashboard): return () if car(id) == entryid(dashboard): return cdr(dashboard) diff --git a/sca-cpp/trunk/hosting/server/htdocs/account/index.html b/sca-cpp/trunk/hosting/server/htdocs/account/index.html index 47c0ea0e9c..9357a89dd6 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/account/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/account/index.html @@ -133,29 +133,29 @@ var savedpicxml = ''; var acct = cadr(assoc("'content", acctentry)); var email = assoc("'email", acct); - $('userEmail').value = isNil(email) || isNil(cdr(email))? '' : cadr(email); + $('userEmail').value = isNull(email) || isNull(cdr(email))? '' : cadr(email); var desc = assoc("'description", acct); - $('userDescription').innerHTML = isNil(desc) || isNil(cdr(desc))? '' : cadr(desc); + $('userDescription').innerHTML = isNull(desc) || isNull(cdr(desc))? '' : cadr(desc); /* TODO disabled for now var cal = assoc("'calendar", acct); reduce(function(i, evt) { var sched = assoc("'@schedule", evt); var svc = assoc("'@service", evt); - $('sched' + i).value = isNil(sched)? '' : cadr(sched); - $('service' + i).value = isNil(svc)? '' : cadr(svc); + $('sched' + i).value = isNull(sched)? '' : cadr(sched); + $('service' + i).value = isNull(svc)? '' : cadr(svc); return i + 1; - }, 1, isNil(cal)? mklist() : cadr(cadr(cal))); + }, 1, isNull(cal)? mklist() : cadr(cadr(cal))); var keys = assoc("'keys", acct); reduce(function(i, key) { var kn = assoc("'@name", key); var kv = assoc("'@value", key); - $('name' + i).value = isNil(kn)? '' : cadr(kn); - $('value' + i).value = isNil(kv)? '' : cadr(kv); + $('name' + i).value = isNull(kn)? '' : cadr(kn); + $('value' + i).value = isNull(kv)? '' : cadr(kv); return i + 1; - }, 1, isNil(keys)? mklist() : cadr(cadr(keys))); + }, 1, isNull(keys)? mklist() : cadr(cadr(keys))); */ savedacctxml = car(atom.writeATOMEntry(valuesToElements(mklist(acctentry)))); @@ -184,7 +184,7 @@ var savedpicxml = ''; var content = assoc("'content", picentry); var picture = assoc("'picture", content); var img = assoc("'image", picture); - if (!isNil(img)) + if (!isNull(img)) $('userPicture').src = cadr(img); onlinestatus(); @@ -216,11 +216,11 @@ function refreshpic() { var token = assoc("'token", picture); // Update picture - if (isNil(token)) { + if (isNull(token)) { var entryxml = car(atom.writeATOMEntry(valuesToElements(mklist(picentry)))); savedpicxml = entryxml; var img = assoc("'image", picture); - if (!isNil(img)) + if (!isNull(img)) $('userPicture').src = cadr(img); $('refreshingPicture').style.display = 'none'; refreshingpic = false; @@ -237,7 +237,7 @@ function refreshpic() { * Save the user's account. */ function saveacct(entryxml) { - if (isNil(username)) + if (isNull(username)) return false; workingstatus(true); showstatus('Saving'); @@ -261,7 +261,7 @@ function saveacct(entryxml) { * Save the user's picture. */ function savepic(entryxml) { - if (isNil(username)) + if (isNull(username)) return false; workingstatus(true); showstatus('Uploading'); diff --git a/sca-cpp/trunk/hosting/server/htdocs/app/index.html b/sca-cpp/trunk/hosting/server/htdocs/app/index.html index cd033118a3..9ff3a72b0f 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/app/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/app/index.html @@ -207,7 +207,7 @@ window.addEventListener('online', function(e) { * as a list of ids. */ function namedvalue(l, id) { - if (isNil(l)) + if (isNull(l)) return null; var e = car(l); @@ -215,7 +215,7 @@ function namedvalue(l, id) { if (car(id) == elementName(e)) { // Found element matching the whole id path - if (isNil(cdr(id))) + if (isNull(cdr(id))) return e; // Search for next id segments in child elements @@ -267,15 +267,15 @@ function setwidgetvalue(e, dv) { } function vattr(dv) { - return (elementHasValue(dv) && !isNil(elementValue(dv)))? mklist(mklist('value', isNil(elementValue(dv))? '' : elementValue(dv))) : mklist(); + return (elementHasValue(dv) && !isNull(elementValue(dv)))? mklist(mklist('value', isNull(elementValue(dv))? '' : elementValue(dv))) : mklist(); } function sattr(dv) { var s = namedElementChild("'htstyle", dv); - return isNil(s)? mklist() : mklist(mklist('style', elementHasValue(s)? elementValue(s) : elementChildren(s))) + return isNull(s)? mklist() : mklist(mklist('style', elementHasValue(s)? elementValue(s) : elementChildren(s))) } - var attrs = append(append(isNil(htattrs)? mklist() : map(attr, elementChildren(htattrs)), vattr(dv)), sattr(dv)); + var attrs = append(append(isNull(htattrs)? mklist() : map(attr, elementChildren(htattrs)), vattr(dv)), sattr(dv)); // Set the attributes of the widget function setattrs(vsetter, attrs, ce) { @@ -312,7 +312,7 @@ function setwidgetvalue(e, dv) { // Define the stylesheet if (s != '') { var esheet = ui.elementByID(contentdiv, 'style_' + e.id); - if (isNil(esheet)) { + if (isNull(esheet)) { var nesheet = document.createElement('style'); nesheet.id = 'style_' + e.id; nesheet.type = 'text/css'; @@ -330,7 +330,7 @@ function setwidgetvalue(e, dv) { ce.setAttribute('style', p); // Restart current animation if necessary - if (!isNil(aname) && ce.style.webkitAnimationName == aname) { + if (!isNull(aname) && ce.style.webkitAnimationName == aname) { ce.style.webkitAnimationName = ''; ui.async(function restartanimation() { ce.style.webkitAnimationName = aname; @@ -381,12 +381,12 @@ function setwidgetvalue(e, dv) { return setattrs(setselectvalue, attrs, ce); } if (e.className == 'list') { - var dl = ui.datalist(isNil(dv)? mklist() : mklist(dv)); + var dl = ui.datalist(isNull(dv)? mklist() : mklist(dv)); e.innerHTML = dl; return dl; } if (e.className == 'table') { - var dl = ui.datatable(isNil(dv)? mklist() : mklist(dv)); + var dl = ui.datatable(isNull(dv)? mklist() : mklist(dv)); e.innerHTML = dl; return dl; } @@ -422,19 +422,19 @@ function setwidgetvalue(e, dv) { * Update the app page with the given app data. */ function updatepage(l) { - if (isNil(l)) + if (isNull(l)) return true; // Update the widgets values function updatewidget(e) { var dv = namedvalue(l, map(function(t) { return "'" + t; }, e.id.split('.'))); - if (dv == null || isNil(dv)) + if (dv == null || isNull(dv)) return e; setwidgetvalue(e, dv); return e; } - map(updatewidget, filter(function(e) { return !isNil(e.id) && e.id.substring(0, 5) != 'page:'; }, nodeList(ui.elementByID(contentdiv, 'page').childNodes))); + map(updatewidget, filter(function(e) { return !isNull(e.id) && e.id.substring(0, 5) != 'page:'; }, nodeList(ui.elementByID(contentdiv, 'page').childNodes))); return true; } @@ -442,7 +442,7 @@ function updatepage(l) { * Convert a document to application data. */ function docdata(doc) { - if (isNil(doc)) + if (isNull(doc)) return null; if (json.isJSON(mklist(doc))) @@ -566,7 +566,7 @@ function fixupwidget(e) { * Set initial value of a widget. */ function initwidget(e) { - if (!isNil(e.id) && e.id.substring(0, 5) != 'page:') + if (!isNull(e.id) && e.id.substring(0, 5) != 'page:') setwidgetvalue(e, mklist()); return e; } @@ -575,9 +575,9 @@ function initwidget(e) { * Return the component bound to a uri. */ function isbound(uri, comps) { - return !isNil(filter(function(comp) { - return !isNil(filter(function(svc) { - return !isNil(filter(function(b) { + return !isNull(filter(function(comp) { + return !isNull(filter(function(svc) { + return !isNull(filter(function(b) { return uri == scdl.uri(b); }, scdl.bindings(svc))); }, scdl.services(comp))); @@ -592,7 +592,7 @@ function getappdata(appname, page, compos) { // Eval a component init script function evalcompinit(doc) { - if (isNil(doc)) + if (isNull(doc)) return true; var js = car(json.readJSON(mklist(doc))); if (!elementHasValue(js)) @@ -609,7 +609,7 @@ function getappdata(appname, page, compos) { } // Setup the widgets - map(setupwidget, filter(function(e) { return !isNil(e.id); }, nodeList(ui.elementByID(contentdiv, 'page').childNodes))); + map(setupwidget, filter(function(e) { return !isNull(e.id); }, nodeList(ui.elementByID(contentdiv, 'page').childNodes))); // Get the app components var comps = scdl.components(compos); @@ -617,7 +617,7 @@ function getappdata(appname, page, compos) { // Get the component app data if (isbound("start", comps)) { startcomp.get(location.search, function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(start, ' + location.search + ')', e); return false; } @@ -630,7 +630,7 @@ function getappdata(appname, page, compos) { // Get and eval the optional timer, animation and location watch setup scripts if (isbound("timer", comps)) { timercomp.get('setup', function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(timer, setup)', e); return false; } @@ -642,7 +642,7 @@ function getappdata(appname, page, compos) { if (isbound("animation", comps)) { animationcomp.get('setup', function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(animation, setup)', e); return false; } @@ -654,7 +654,7 @@ function getappdata(appname, page, compos) { if (isbound("location", comps)) { locationcomp.get('setup', function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(location, setup)', e); return false; } @@ -677,7 +677,7 @@ function getappdata(appname, page, compos) { */ function atompage(doc) { var entry = atom.readATOMEntry(mklist(doc)); - if (isNil(entry)) + if (isNull(entry)) return mklist(); var content = namedElementChild("'content", car(entry)); if (content == null) @@ -691,7 +691,7 @@ function atompage(doc) { function getapppage(appname, compos) { pagecomp.get(appname, function(doc, e) { //debug('page get'); - if (isNil(doc)) { + if (isNull(doc)) { debug('error in getapppage', e); return false; } @@ -702,7 +702,7 @@ function getapppage(appname, compos) { apppage = page; // Merge in the app data - if (!isNil(appcomposite)) + if (!isNull(appcomposite)) getappdata(appname, apppage, appcomposite); }); @@ -720,10 +720,10 @@ function compquery() { return append(nodeList(n.childNodes), reduce(append, mklist(), map(childrenList, nodeList(n.childNodes)))); } - var args = map(queryarg, filter(function(e) { return !isNil(e.id) && !isNil(inputvalue(e)); }, childrenList(ui.elementByID(contentdiv, 'page')))); + var args = map(queryarg, filter(function(e) { return !isNull(e.id) && !isNull(inputvalue(e)); }, childrenList(ui.elementByID(contentdiv, 'page')))); // Append current location properties if known - if (!isNil(geoposition)) { + if (!isNull(geoposition)) { var g = geoposition; args = append(args, mklist('latitude=' + g.coords.latitude, 'longitude=' + g.coords.longitude, 'altitude=' + g.coords.altitude, 'accuracy=' + g.coords.accuracy, 'altitudeAccuracy=' + g.coords.altitudeAccuracy, 'heading=' + g.coords.heading, @@ -740,7 +740,7 @@ function buttonClickHandler(id, appname) { try { var uri = compquery(); return sca.component(id, appname).get(uri, function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(button, ' + uri + ')', e); return false; } @@ -761,7 +761,7 @@ function intervalHandler() { try { var uri = compquery(); return timercomp.get(uri, function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(timer, ' + uri + ')', e); return false; } @@ -804,7 +804,7 @@ function animationHandler() { updatepage(car(currentAnimationData)); // End of animation? - if (isNil(cdr(currentAnimationData))) { + if (isNull(cdr(currentAnimationData))) { if (currentAnimationLoop == -1) { // Repeat current animation forever currentAnimationData = animationData; @@ -830,12 +830,12 @@ function animationHandler() { } // Get new animation data if necessary - if (isNil(animationData)) { + if (isNull(animationData)) { if (gettingAnimationData) return true; var uri = compquery(); return animationcomp.get(uri, function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(animation, ' + uri + ')', e); return false; } @@ -882,7 +882,7 @@ function locationHandler(pos) { geoposition = pos; var uri = compquery(); return locationcomp.get(uri, function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(location, ' + uri + ')', e); return false; } @@ -897,7 +897,7 @@ function locationHandler(pos) { function locationErrorHandler(e) { debug('location error', e); - if (!isNil(locationWatch)) { + if (!isNull(locationWatch)) { try { navigator.geolocation.clearWatch(locationWatch); } catch(e) {} @@ -911,7 +911,7 @@ function locationErrorHandler(e) { */ function setupLocationHandler() { function installLocationHandler() { - if (!isNil(locationWatch)) + if (!isNull(locationWatch)) return true; try { locationWatch = navigator.geolocation.watchPosition(locationHandler, locationErrorHandler); @@ -940,7 +940,7 @@ document.body.onorientationchange = function(e) { */ function atomcomposite(doc) { var entry = atom.readATOMEntry(mklist(doc)); - if (isNil(entry)) + if (isNull(entry)) return mklist(); var content = namedElementChild("'content", car(entry)); if (content == null) @@ -954,13 +954,13 @@ function atomcomposite(doc) { function getappcomposite(appname) { return composcomp.get(appname, function(doc, e) { //debug('page get'); - if (isNil(doc)) { + if (isNull(doc)) { debug('error in getappcomposite', e); return false; } var compos = atomcomposite(doc); - if (isNil(compos)) { + if (isNull(compos)) { // Create a default empty composite if necessary var x = '<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" ' + @@ -970,7 +970,7 @@ function getappcomposite(appname) { appcomposite = compos; // Merge in the app data - if (!isNil(apppage)) + if (!isNull(apppage)) getappdata(appname, apppage, appcomposite); }); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/clone/index.html b/sca-cpp/trunk/hosting/server/htdocs/clone/index.html index c6a9658ce0..e9de1be1fb 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/clone/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/clone/index.html @@ -72,7 +72,7 @@ var savedappxml = ''; * Get and display the requested app. */ (function getapp() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -149,7 +149,7 @@ $('cloneAppForm').onsubmit = function() { // Check reserved app names var reserved = mklist('account', 'app', 'cache', 'clone', 'create', 'delete', 'graph', 'home', 'login', 'new', 'page', 'proxy', 'public', 'private', 'info', 'store'); - if (!isNil(assoc(name, map(function(r) { return mklist(r, r); }, reserved)))) { + if (!isNull(assoc(name, map(function(r) { return mklist(r, r); }, reserved)))) { errorstatus('App name is taken, please pick another name'); return false; } diff --git a/sca-cpp/trunk/hosting/server/htdocs/config.js b/sca-cpp/trunk/hosting/server/htdocs/config.js index 355174e6f7..20212980f0 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/config.js +++ b/sca-cpp/trunk/hosting/server/htdocs/config.js @@ -17,7 +17,7 @@ * under the License. */ -if (isNil(config)) +if (isNull(config)) config = {}; /** diff --git a/sca-cpp/trunk/hosting/server/htdocs/create/index.html b/sca-cpp/trunk/hosting/server/htdocs/create/index.html index a11c0958f5..3fc26b8515 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/create/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/create/index.html @@ -114,7 +114,7 @@ $('createAppForm').onsubmit = function() { // Check reserved app names var reserved = mklist('account', 'app', 'cache', 'clone', 'create', 'delete', 'graph', 'home', 'login', 'new', 'page', 'proxy', 'public', 'private', 'info', 'store'); - if (!isNil(assoc(name, map(function(r) { return mklist(r, r); }, reserved)))) { + if (!isNull(assoc(name, map(function(r) { return mklist(r, r); }, reserved)))) { errorstatus('App name is taken, please pick another name'); return false; } diff --git a/sca-cpp/trunk/hosting/server/htdocs/delete/index.html b/sca-cpp/trunk/hosting/server/htdocs/delete/index.html index 81cfa0b625..3855a09e3c 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/delete/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/delete/index.html @@ -83,7 +83,7 @@ var appentry; * Get and display the requested app. */ (function getapp() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -103,7 +103,7 @@ var appentry; $('appUpdated').value = xmldatetime(cadr(assoc("'updated", appentry))).toLocaleDateString(); var content = cadr(assoc("'content", appentry)); var description = assoc("'description", content); - $('appDescription').value = isNil(description) || isNil(cadr(description))? '' : cadr(description); + $('appDescription').value = isNull(description) || isNull(cadr(description))? '' : cadr(description); onlinestatus(); workingstatus(false); diff --git a/sca-cpp/trunk/hosting/server/htdocs/graph/index.html b/sca-cpp/trunk/hosting/server/htdocs/graph/index.html index d01bfa1c02..557f427e38 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/graph/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/graph/index.html @@ -32,11 +32,11 @@ */ var appname = ui.fragmentParams(location)['app']; var ispalette = false; -if (isNil(appname)) { +if (isNull(appname)) { appname = ui.fragmentParams(location)['palette']; // Edit a palette instead of a regular app - if (!isNil(appname)) + if (!isNull(appname)) ispalette = true; } @@ -179,7 +179,7 @@ graph.mkedit = function(graphdiv, pos, atitle, cvalue, cadd, ccopy, cdelete, onc //debug('draggable', n); if (n == graphdiv || n == null) return null; - if (n.className == 'g' && !isNil(n.id) && n.id != '') + if (n.className == 'g' && !isNull(n.id) && n.id != '') return n; return draggable(n.parentNode); } @@ -301,7 +301,7 @@ graph.mkedit = function(graphdiv, pos, atitle, cvalue, cadd, ccopy, cdelete, onc if (graph.dragging.parentNode == graphdiv && graph.dragging.id.substring(0, 8) != 'palette:') { // Add new dragged component to the composite - if (isNil(graph.dragging.compos)) { + if (isNull(graph.dragging.compos)) { var compos = scdl.composite(graphdiv.compos); setElement(compos, graph.sortcompos(graph.addcomps(mklist(graph.dragging.comp), compos))); graph.dragging.compos = graphdiv.compos; @@ -311,7 +311,7 @@ graph.mkedit = function(graphdiv, pos, atitle, cvalue, cadd, ccopy, cdelete, onc setElement(graph.dragging.comp, graph.movecomp(graph.dragging.comp, graph.abspos(graph.draggingg))); // Wire component to neighboring reference - if (!isNil(graph.dragging.svcpos)) { + if (!isNull(graph.dragging.svcpos)) { var compos = scdl.composite(graphdiv.compos); setElement(compos, graph.sortcompos(graph.clonerefs(graph.wire(graph.dragging, compos, graphdiv)))); } @@ -332,7 +332,7 @@ graph.mkedit = function(graphdiv, pos, atitle, cvalue, cadd, ccopy, cdelete, onc var nodes = graph.refresh(graphdiv); // Reselect the previously selected component - if (!isNil(graph.selected)) { + if (!isNull(graph.selected)) { graph.selected = graph.findcompnode(scdl.name(graph.selected.comp), nodes); graph.compselect(graph.selected, true, atitle, cvalue, ccopy, cdelete); @@ -544,7 +544,7 @@ graph.mkedit = function(graphdiv, pos, atitle, cvalue, cadd, ccopy, cdelete, onc // Remove selected component var compos = scdl.composite(graphdiv.compos); - if (isNil(graph.selected.compos)) + if (isNull(graph.selected.compos)) setElement(compos, graph.sortcompos(graph.cutwire(graph.selected, compos, graphdiv))); setElement(compos, graph.sortcompos(graph.clonerefs(graph.gcollect(graph.removecomp(graph.selected.comp, compos))))); @@ -752,8 +752,8 @@ graph.drawshape = function(g) { // Draw the shape ctx.fillStyle = g.fillStyle; - ctx.strokeStyle = !isNil(g.strokeStyle)? g.strokeStyle : graph.colors.gray; - ctx.lineWidth = !isNil(g.lineWidth)? g.lineWidth : 1; + ctx.strokeStyle = !isNull(g.strokeStyle)? g.strokeStyle : graph.colors.gray; + ctx.lineWidth = !isNull(g.lineWidth)? g.lineWidth : 1; g.path.draw(ctx); // Reset canvas context @@ -794,7 +794,7 @@ graph.comptitle = function(comp) { */ graph.comptitlewidth = function(comp) { var title = graph.comptitle(comp); - if (isNil(title)) + if (isNull(title)) return 0; return title.clientWidth; }; @@ -803,14 +803,14 @@ graph.comptitlewidth = function(comp) { * Draw a component shape selection. */ graph.compselect = function(g, s, atitle, cvalue, ccopy, cdelete) { - if (isNil(g) || !s) { + if (isNull(g) || !s) { cvalue.value = ''; cvalue.readOnly = true; cvalue.style.display = 'none'; atitle.style.display = 'block'; ccopy.disabled = true; cdelete.disabled = true; - if (isNil(g)) + if (isNull(g)) return true; g.shape.strokeStyle = null; g.shape.lineWidth = null; @@ -836,7 +836,7 @@ graph.compselect = function(g, s, atitle, cvalue, ccopy, cdelete) { * Draw a palette shape selection. */ graph.paletteselect = function(g, s) { - if (isNil(g)) + if (isNull(g)) return true; if (!s) { g.shape.strokeStyle = null; @@ -879,7 +879,7 @@ graph.compnode = function(comp, cassoc, pos) { g.shape = shape; g.style.width = ui.pixpos(shape.width); g.style.height = ui.pixpos(shape.height); - if (!isNil(title)) { + if (!isNull(title)) { title.style.left = ui.pixpos(shape.path.xmin * -1); g.appendChild(title); } @@ -895,14 +895,14 @@ graph.compnode = function(comp, cassoc, pos) { * Find the node representing a component. */ graph.findcompnode = function(name, nodes) { - if (isNil(nodes)) + if (isNull(nodes)) return null; - if (isNil(car(nodes).comp)) + if (isNull(car(nodes).comp)) return graph.findcompnode(name, cdr(nodes)); if (name == scdl.name(car(nodes).comp)) return car(nodes); var node = graph.findcompnode(name, nodeList(car(nodes).childNodes)); - if (!isNil(node)) + if (!isNull(node)) return node; return graph.findcompnode(name, cdr(nodes)); } @@ -969,7 +969,7 @@ graph.move = function(g, pos) { * Return the absolute position of a component node. */ graph.abspos = function(e) { - if (isNil(e) || e == graphdiv) + if (isNull(e) || e == graphdiv) return graph.mkpath(); var gpos = graph.relpos(e); var pgpos = graph.abspos(e.parentNode); @@ -1010,7 +1010,7 @@ graph.title = function(e) { */ graph.property = function(e) { var p = scdl.properties(e); - if (isNil(p)) + if (isNull(p)) return ''; if (scdl.visible(car(p)) == 'false') return ''; @@ -1034,7 +1034,7 @@ graph.propertytitle = function(e) { */ graph.hasproperty = function(e) { var p = scdl.properties(e); - if (isNil(p)) + if (isNull(p)) return false; if (scdl.visible(car(p)) == 'false') return false; @@ -1046,7 +1046,7 @@ graph.hasproperty = function(e) { */ graph.setproperty = function(e, value) { var p = scdl.properties(e); - if (isNil(p)) + if (isNull(p)) return ''; if (scdl.visible(car(p)) == 'false') return ''; @@ -1071,14 +1071,14 @@ graph.color = function(comp) { graph.lsvcs = function(comp) { return memo(comp, 'lsvcs', function() { var svcs = scdl.services(comp); - if (isNil(svcs)) + if (isNull(svcs)) return mklist(mklist("'element","'service","'attribute","'name",scdl.name(comp))); var l = filter(function(s) { var a = scdl.align(s); var v = scdl.visible(s); return (a == null || a == 'left') && v != 'false'; }, svcs); - if (isNil(l)) + if (isNull(l)) return mklist(); return mklist(car(l)); }); @@ -1103,7 +1103,7 @@ graph.rrefs = function(comp) { graph.rrefheight = function(ref, cassoc) { return memo(ref, 'rheight', function() { var target = assoc(scdl.target(ref), cassoc); - if (isNil(target)) + if (isNull(target)) return graph.tabsz * 8; return graph.compclosureheight(cadr(target), cassoc); }); @@ -1113,7 +1113,7 @@ graph.rrefheight = function(ref, cassoc) { * Return the total height of the references on the right side of a component. */ graph.rrefsheight = function(refs, cassoc) { - if (isNil(refs)) + if (isNull(refs)) return 0; return graph.rrefheight(car(refs), cassoc) + graph.rrefsheight(cdr(refs), cassoc); }; @@ -1144,7 +1144,7 @@ graph.compclosureheight = function(comp, cassoc) { * Return the max width of the references on the right side of a component. */ graph.rrefswidth = function(refs, cassoc) { - if (isNil(refs)) + if (isNull(refs)) return 0; return Math.max(graph.rrefwidth(car(refs), cassoc), graph.rrefswidth(cdr(refs), cassoc)); }; @@ -1155,7 +1155,7 @@ graph.rrefswidth = function(refs, cassoc) { graph.compwidth = function(comp, cassoc) { return memo(comp, 'width', function() { var ctw = graph.comptitlewidth(comp); - var rrefsw = (isNil(graph.rrefs(comp))? 0 : (graph.tabsz * 4)); + var rrefsw = (isNull(graph.rrefs(comp))? 0 : (graph.tabsz * 4)); var twidth = (graph.titlex * 2) + ctw + rrefsw; var width = Math.max(twidth, (graph.tabsz * 8) + (graph.tabsz * 4)); return width; @@ -1205,7 +1205,7 @@ graph.comppath = function(comp, cassoc) { * Apply a path rendering function to a list of services or references. */ function renderpath(x, f, cassoc, path, height) { - if (isNil(x)) + if (isNull(x)) return path; return renderpath(cdr(x), f, cassoc, f(car(x), cassoc, path, height), height); } @@ -1290,7 +1290,7 @@ graph.composite = function(compos, pos, aspalette) { */ function renderrref(ref, cassoc, pos, gcomp) { var target = assoc(scdl.target(ref), cassoc); - if (isNil(target)) + if (isNull(target)) return null; // Render the component target of the reference @@ -1304,7 +1304,7 @@ graph.composite = function(compos, pos, aspalette) { return pos.clone().rmove(0, graph.rrefheight(ref, cassoc)); } - if (isNil(refs)) + if (isNull(refs)) return mklist(); // Return list of (ref, comp rendering) pairs @@ -1322,7 +1322,7 @@ graph.composite = function(compos, pos, aspalette) { // Store list of (ref, pos, component rendering) triplets in the component function refposgcomp(refpos, grefs) { - if (isNil(refpos)) + if (isNull(refpos)) return mklist(); // Append component rendering to component @@ -1347,7 +1347,7 @@ graph.composite = function(compos, pos, aspalette) { */ function promcomp(svc, cassoc) { var c = assoc(scdl.promote(svc), cassoc); - if (isNil(c)) + if (isNull(c)) return mklist(); return cadr(c); } @@ -1359,13 +1359,13 @@ graph.composite = function(compos, pos, aspalette) { return pos.clone().rmove(0, graph.compclosureheight(comp, cassoc) + Math.max((graph.tabsz * 2), 8)); } - if (isNil(svcs)) + if (isNull(svcs)) return mklist(); // Render the first promoted component in the list // then recurse to render the rest of the list var comp = promcomp(car(svcs), cassoc); - if (isNil(comp)) + if (isNull(comp)) return renderproms(cdr(svcs), cassoc, rendermove(car(svcs), cassoc, pos)); var cpos = graph.comppos(comp, pos); @@ -1401,14 +1401,14 @@ graph.ucid = function(prefix, compos1, compos2, clone) { // Build an assoc list keyed by component name var comps = map(function(c) { return mklist(scdl.name(c), c); }, append(namedElementChildren("'component", compos1), namedElementChildren("'component", compos2))); - if (!clone && isNil(assoc(prefix, comps))) + if (!clone && isNull(assoc(prefix, comps))) return prefix; /** * Find a free component id. */ function ucid(p, id) { - if (isNil(assoc(p + id, comps))) + if (isNull(assoc(p + id, comps))) return p + id; return ucid(p, id + 1); } @@ -1447,7 +1447,7 @@ graph.clonepalette = function(e, compos) { * Move a SCDL component to the given position. */ graph.movecomp = function(comp, pos) { - if (isNil(pos)) + if (isNull(pos)) return append(mklist(element, "'component"), filter(function(e) { return !(isAttribute(e) && (attributeName(e) == "'x" || attributeName(e) == "'y")); }, elementChildren(comp))); return append(mklist(element, "'component", mklist(attribute, "'x", '' + (pos.x - graph.palcx)), mklist(attribute, "'y", '' + pos.y)), @@ -1469,11 +1469,11 @@ graph.clonecomp = function(e, compos) { // Write the component and the components it references to XML function collectcomp(e) { function collectrefs(refpos) { - if (isNil(refpos)) + if (isNull(refpos)) return mklist(); var r = car(refpos); var n = caddr(r); - if (isNil(n)) + if (isNull(n)) return collectrefs(cdr(refpos)); return append(collectcomp(n), collectrefs(cdr(refpos))); } @@ -1578,7 +1578,7 @@ graph.gcollect = function(compos) { // Filter out the unused components var used = append(proms, refs); return append(mklist(element, "'composite"), - filter(function(c) { return !(isElement(c) && elementName(c) == "'component" && isNil(assoc(scdl.name(c), used))); }, elementChildren(compos))); + filter(function(c) { return !(isElement(c) && elementName(c) == "'component" && isNull(assoc(scdl.name(c), used))); }, elementChildren(compos))); } /** @@ -1592,7 +1592,7 @@ graph.clonerefs = function(compos) { // If the references are clonable var refs = scdl.references(c); - if (isNil(refs)) + if (isNull(refs)) return c; if (scdl.clonable(car(refs)) != 'true') return c; @@ -1611,7 +1611,7 @@ graph.clonerefs = function(compos) { * Refactor references to a component. */ graph.refactorrefs = function(refs, oname, nname) { - if (isNil(refs)) + if (isNull(refs)) return true; var ref = car(refs); if (scdl.target(ref) != oname) @@ -1636,7 +1636,7 @@ graph.renamecomp = function(comp, compos, name) { // Rename the SCDL promoted service and component var proms = filter(function(s) { return scdl.name(s) == oname }, scdl.services(compos)); - if (!isNil(proms)) + if (!isNull(proms)) setElement(car(proms), mklist(element, "'service", mklist(attribute, "'name", name), mklist(attribute, "'promote", name))); setElement(comp, append(mklist(element, "'component"), cons(mklist(attribute, "'name", name), @@ -1655,7 +1655,7 @@ graph.cutwire = function(node, compos, g) { * Find the reference wired to a node and cut its wire. */ function cutref(refs, node) { - if (isNil(refs)) + if (isNull(refs)) return true; var ref = car(refs); if (caddr(ref) == node) { @@ -1702,13 +1702,13 @@ graph.wire = function(n, compos, g) { * references of a node. */ function closerefs(npos, refs, spos, cref) { - if (isNil(refs)) + if (isNull(refs)) return cref; var fdist = cadddr(cref); var ref = car(refs); // Skip wired reference - if (!isNil(filter(function(n) { return isAttribute(n) && attributeName(n) == "'target"; }, car(ref)))) + if (!isNull(filter(function(n) { return isAttribute(n) && attributeName(n) == "'target"; }, car(ref)))) return closerefs(npos, cdr(refs), spos, cref); // Compute distance between service node and reference node @@ -1723,12 +1723,12 @@ graph.wire = function(n, compos, g) { return closerefs(npos, cdr(refs), spos, fdist < rdist? cref : mklist(car(ref), cadr(ref), caddr(ref), rdist)); } - if (isNil(nodes)) + if (isNull(nodes)) return cref; // Skip non-component nodes var node = car(nodes); - if (isNil(node.comp)) + if (isNull(node.comp)) return closecomprefs(cdr(nodes), spos, cref); // Compute the component absolute position @@ -1771,7 +1771,7 @@ graph.display = function(nodes, g) { graph.hide = function(g) { // Remove nodes from the graph - map(function(n) { if (!isNil(n.comp) && n.id.substr(0, 8) != 'palette:') { g.removeChild(n); } return n; }, nodeList(g.childNodes)); + map(function(n) { if (!isNull(n.comp) && n.id.substr(0, 8) != 'palette:') { g.removeChild(n); } return n; }, nodeList(g.childNodes)); return g; }; @@ -1782,7 +1782,7 @@ graph.refresh = function(g) { //debug('refresh'); // Remove existing nodes from the graph - map(function(n) { if (!isNil(n.comp) && n.id.substr(0, 8) != 'palette:') { g.removeChild(n); } return n; }, nodeList(g.childNodes)); + map(function(n) { if (!isNull(n.comp) && n.id.substr(0, 8) != 'palette:') { g.removeChild(n); } return n; }, nodeList(g.childNodes)); // Redisplay the composite associated with the graph var nodes = graph.composite(g.compos, graph.mkpath().pos(graph.palcx,0), false); @@ -1802,7 +1802,7 @@ graph.edit = function(appname, compos, nodes, g) { setElement(scompos, graph.sortcompos(scompos)); // Remove existing nodes from the graph - map(function(n) { if (!isNil(n.comp) && n.id.substr(0, 8) != 'palette:') { g.removeChild(n); } return n; }, nodeList(g.childNodes)); + map(function(n) { if (!isNull(n.comp) && n.id.substr(0, 8) != 'palette:') { g.removeChild(n); } return n; }, nodeList(g.childNodes)); // Display the composite nodes appendNodes(nodes, g); @@ -1829,7 +1829,7 @@ var bpalette = null; * Get and display an application composite. */ function getapp(name, g) { - if (isNil(name)) + if (isNull(name)) return false; workingstatus(true); showstatus('Loading'); @@ -1846,8 +1846,8 @@ function getapp(name, g) { // Get the composite from the ATOM entry var composentry = car(atom.readATOMEntry(mklist(doc))); var content = namedElementChild("'content", composentry); - composite = isNil(content)? mklist() : elementChildren(content); - if (isNil(composite)) { + composite = isNull(content)? mklist() : elementChildren(content); + if (isNull(composite)) { // Create a default empty composite if necessary var x = '<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" ' + @@ -1879,15 +1879,15 @@ function getapp(name, g) { * Display a palette. Get it from the server if needed. */ function displaypalette(name, g, palette, gpalettes) { - if (isNil(name)) + if (isNull(name)) return; - if (isNil(gpalettes[name])) { + if (isNull(gpalettes[name])) { // Get the palette from the server palettes.get(name, function(doc) { var entry = car(atom.readATOMEntry(mklist(doc))); var content = namedElementChild("'content", entry); - var compos = isNil(content)? mklist() : elementChildren(content); + var compos = isNull(content)? mklist() : elementChildren(content); gpalettes[name] = graph.composite(compos, graph.mkpath().move(2580,0), true, g); graph.display(gpalettes[name], g); }); @@ -1985,7 +1985,7 @@ function oncomposchange(prop) { * Return the link to a component. */ function complink(appname, cname) { - if (cname == '' || isNil(cname)) + if (cname == '' || isNull(cname)) return ''; var protocol = location.protocol; var host = location.hostname; @@ -2004,9 +2004,9 @@ function oncompselect(gsel) { return true; gcomp = gsel; - cdelete.disabled = isNil(gsel) || !editable; - ccopy.disabled = isNil(gsel) || !editable; - cplay.disabled = isNil(gsel); + cdelete.disabled = isNull(gsel) || !editable; + ccopy.disabled = isNull(gsel) || !editable; + cplay.disabled = isNull(gsel); return true; } @@ -2016,7 +2016,7 @@ function oncompselect(gsel) { function showdata(gcomp) { if (!gvisible) return true; - if (isNil(gcomp)) + if (isNull(gcomp)) return true; cvalue.value = complink(appname, gcomp.id); cplay.value = '<'; diff --git a/sca-cpp/trunk/hosting/server/htdocs/home/index.html b/sca-cpp/trunk/hosting/server/htdocs/home/index.html index d7a098e998..b5240bfd11 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/home/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/home/index.html @@ -60,7 +60,7 @@ $('getstarted').onclick = function() { */ (function homeanimation() { var anim = $('homeanimation'); - if (!isNil(anim)) { + if (!isNull(anim)) { anim.style.background = 'url(\'' + ui.b64png(appcache.get('/home/home.b64')) + '\')'; var bgpos = 0; setInterval(function homeanimation() { diff --git a/sca-cpp/trunk/hosting/server/htdocs/index.html b/sca-cpp/trunk/hosting/server/htdocs/index.html index 6ea6f80939..7722f96e3f 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/index.html @@ -203,7 +203,7 @@ var appresources = [ * Init status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -221,7 +221,7 @@ var appresources = [ */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -249,7 +249,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -286,10 +286,10 @@ map(function(res) { */ function viewtransition(ouri, uri) { var ot = apptransitions[ouri]; - if (isNil(ot)) + if (isNull(ot)) return 'left'; var t = apptransitions[uri]; - if (isNil(t)) + if (isNull(t)) return 'left'; return t < ot? 'right' : 'left'; } @@ -330,7 +330,7 @@ function showmenu(view, appname) { append(mklist(ui.menu('menuhome', 'Home', '/', '_view', view == 'home'), ui.menu('menustore', 'Store', '/#view=store&category=' + storecat + '&idx=' + storeidx, '_view', view == 'store'), ui.menu('menusearch', 'Search', '/#view=search', '_view', view == 'search')), - (isNil(appname) || appname == 'undefined')? + (isNull(appname) || appname == 'undefined')? mklist() : mklist( ui.menu('menuinfo', 'Info', '/#view=info&app=' + appname, '_view', view == 'info'), @@ -341,7 +341,7 @@ function showmenu(view, appname) { ui.menu('menurun', '<span class="greentext" style="font-weight: bold">Run!</span>', '/' + appname + '/', '_blank', false) */ )), - (isNil(appname) || appname == 'undefined')? mklist( + (isNull(appname) || appname == 'undefined')? mklist( ui.menufunc('menusignout', 'Sign out', 'return logout();', false), ui.menu('menuaccount', 'Account', '/#view=account', '_view', view == 'account')) : mklist()); @@ -376,13 +376,13 @@ function showview(url) { // Determine the view to show var params = ui.fragmentParams(url); - var view = isNil(params['view'])? 'home' : params['view'];; + var view = isNull(params['view'])? 'home' : params['view'];; var uri = '/' + view + '/'; - var idx = isNil(params['idx'])? 0 : parseInt(params['idx']); + var idx = isNull(params['idx'])? 0 : parseInt(params['idx']); // Track store category view if (view == 'store') { - storecat = isNil(params['category'])? 'top' : params['category']; + storecat = isNull(params['category'])? 'top' : params['category']; storeidx = idx; } @@ -406,7 +406,7 @@ function showview(url) { if (ui.isMobile()) { // Prepare current view for transition out var ovdiv = viewdiv; - if (!isNil(ovdiv)) { + if (!isNull(ovdiv)) { ovdiv.skipNode = true; ovdiv.className = 'viewunloading3dm'; } @@ -420,7 +420,7 @@ function showview(url) { ui.async(function mtransitionview() { // Transition the old view out - if (!isNil(ovdiv)) + if (!isNull(ovdiv)) ovdiv.className = vtransition + 'viewunloaded3dm'; // Transition the new view in @@ -430,7 +430,7 @@ function showview(url) { } else { // Prepare current view for transition out var ovdiv = viewdiv; - if (!isNil(ovdiv)) + if (!isNull(ovdiv)) ovdiv.skipNode = true; // Load the requested doc into the view @@ -445,7 +445,7 @@ function showview(url) { vdiv.className = 'viewloaded3d'; // Transition the old view out - if (!isNil(ovdiv)) + if (!isNull(ovdiv)) ovdiv.parentNode.removeChild(ovdiv); }); } @@ -649,7 +649,7 @@ document.body.onorientationchange = function(e) { appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } @@ -697,7 +697,7 @@ window.onload = function() { document.referrer.indexOf('//accounts.google.com/ServiceLogin') != -1 || document.referrer.indexOf('//www.facebook.com/login.php') != -1)) { var lv = lastvisited(); - var url = isNil(lv)? location.pathname : lv; + var url = isNull(lv)? location.pathname : lv; updatelocation(url); if (url == viewurl) return true; diff --git a/sca-cpp/trunk/hosting/server/htdocs/info/index.html b/sca-cpp/trunk/hosting/server/htdocs/info/index.html index 0d72062719..3038d37cf2 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/info/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/info/index.html @@ -100,7 +100,7 @@ var savediconxml; * Get and display the requested app. */ (function getapp() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -118,10 +118,10 @@ var savediconxml; author = cadr(assoc("'author", appentry)); $('appAuthor').value = author.split('@')[0]; var updated = assoc("'updated", appentry); - $('appUpdated').value = isNil(updated)? '' : xmldatetime(cadr(updated)).toLocaleDateString(); + $('appUpdated').value = isNull(updated)? '' : xmldatetime(cadr(updated)).toLocaleDateString(); var content = cadr(assoc("'content", appentry)); var description = assoc("'description", content); - $('appDescription').value = isNil(description) || isNil(cadr(description))? '' : cadr(description); + $('appDescription').value = isNull(description) || isNull(cadr(description))? '' : cadr(description); //var ratingy = -20 * (4 - Math.floor(Math.random() * 4)); //$('appRating').style.backgroundPosition = '0px ' + ratingy + 'px'; //$('appRatings').value = ''; @@ -165,7 +165,7 @@ var savediconxml; var content = assoc("'content", picentry); var picture = assoc("'picture", content); var img = assoc("'image", picture); - if (!isNil(img)) + if (!isNull(img)) $('authorPicture').src = cadr(img); onlinestatus(); @@ -179,7 +179,7 @@ var savediconxml; * Get and display the app icon. */ (function geticon() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -197,7 +197,7 @@ var savediconxml; var content = assoc("'content", iconentry); var icon = assoc("'icon", content); var img = assoc("'image", icon); - if (!isNil(img)) + if (!isNull(img)) $('appIcon').src = cadr(img); onlinestatus(); @@ -212,7 +212,7 @@ var savediconxml; */ var refreshingicon = false; function refreshicon() { - if (isNil(appname)) + if (isNull(appname)) return false; if (!refreshingicon) return false; @@ -231,11 +231,11 @@ function refreshicon() { var token = assoc("'token", icon); // Update icon - if (isNil(token)) { + if (isNull(token)) { var entryxml = car(atom.writeATOMEntry(valuesToElements(mklist(iconentry)))); savediconxml = entryxml; var img = assoc("'image", icon); - if (!isNil(img)) + if (!isNull(img)) $('appIcon').src = cadr(img); $('refreshingIcon').style.display = 'none'; refreshingicon = false; @@ -252,7 +252,7 @@ function refreshicon() { * Get and display the app ratings. */ (function getratings() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -272,8 +272,8 @@ function refreshicon() { var ar2 = assoc("'rating2", aratings); var ar3 = assoc("'rating3", aratings); var ar4 = assoc("'rating4", aratings); - var rating = isNil(ar)? 0 : Number(cadr(ar)); - var reviews = (isNil(ar1)? 0 : Number(cadr(ar1))) + (isNil(ar2)? 0 : Number(cadr(ar2))) + (isNil(ar3)? 0 : Number(cadr(ar3))) + (isNil(ar4)? 0 : Number(cadr(ar4))); + var rating = isNull(ar)? 0 : Number(cadr(ar)); + var reviews = (isNull(ar1)? 0 : Number(cadr(ar1))) + (isNull(ar2)? 0 : Number(cadr(ar2))) + (isNull(ar3)? 0 : Number(cadr(ar3))) + (isNull(ar4)? 0 : Number(cadr(ar4))); var ratingy = -20 * (4 - Math.floor(rating)); $('appRating').style.backgroundPosition = '0px ' + ratingy + 'px'; diff --git a/sca-cpp/trunk/hosting/server/htdocs/login/index.html b/sca-cpp/trunk/hosting/server/htdocs/login/index.html index efc3feaeaa..93d47d3f28 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/login/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/login/index.html @@ -212,7 +212,7 @@ try { * Initialize status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -230,7 +230,7 @@ try { */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -258,7 +258,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -469,7 +469,7 @@ var appresources = [ appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/page/index.html b/sca-cpp/trunk/hosting/server/htdocs/page/index.html index c6e1108ce5..ca89ed34db 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/page/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/page/index.html @@ -132,7 +132,7 @@ var pages = sca.reference(editorComp, 'pages'); */ var msiefixupbounds = ui.isMSIE(); function widgettransform(e) { - if (!isNil(e.xtranslate)) + if (!isNull(e.xtranslate)) return [e.xtranslate, e.ytranslate]; var t = e.style.getPropertyValue('-webkit-transform') || e.style.getPropertyValue('-moz-transform') || e.style.getPropertyValue('-ms-transform') || e.style.getPropertyValue('-o-transform') || @@ -156,7 +156,7 @@ function widgettransform(e) { */ function widgetxpos(e) { var t = widgettransform(e)[0]; - return ui.numpos(e.style.left) + (isNil(t)? 0 : t); + return ui.numpos(e.style.left) + (isNull(t)? 0 : t); } /** @@ -164,7 +164,7 @@ function widgetxpos(e) { */ function widgetypos(e) { var t = widgettransform(e)[1]; - return ui.numpos(e.style.top) + (isNil(t)? 0 : t); + return ui.numpos(e.style.top) + (isNull(t)? 0 : t); } /** @@ -290,7 +290,7 @@ function clonewidget(e) { */ function selectwidget(n, s) { //debug('selectwidget', n, s); - if (isNil(n) || !s) { + if (isNull(n) || !s) { // Clear the widget value field $('widgetValue').value = ''; $('widgetValue').readOnly = true; @@ -304,7 +304,7 @@ function selectwidget(n, s) { $('deleteWidgetButton').disabled = true; // Clear the widget outline - if (!isNil(n)) + if (!isNull(n)) n.style.removeProperty('outline'); return true; } @@ -422,44 +422,44 @@ function setwidgettext(e, t) { e.id = f != ''? f.substring(1) : ('page:' + wc); if (wc == 'hd1' || wc == 'hd2' || wc == 'text' || wc == 'section') { - car(childElements(e)).innerHTML = isNil(c)? f : car(c); + car(childElements(e)).innerHTML = isNull(c)? f : car(c); return t; } if (wc == 'button') { - car(childElements(e)).value = isNil(c)? f : car(c); + car(childElements(e)).value = isNull(c)? f : car(c); return t; } if (wc == 'entry' || wc == 'password') { - car(childElements(e)).defaultValue = isNil(c)? f : car(c); + car(childElements(e)).defaultValue = isNull(c)? f : car(c); return t; } if (wc == 'checkbox') { - car(childElements(e)).value = isNil(c)? f : car(c); - map(function(n) { if (n.nodeName == "SPAN") n.innerHTML = isNil(c)? f : car(c); return n; }, nodeList(e.childNodes)); + car(childElements(e)).value = isNull(c)? f : car(c); + map(function(n) { if (n.nodeName == "SPAN") n.innerHTML = isNull(c)? f : car(c); return n; }, nodeList(e.childNodes)); return t; } if (wc == 'select') { var ce = car(childElements(car(childElements(e)))); - ce.value = isNil(c)? f : car(c); - ce.innerHTML = isNil(c)? f : car(c); + ce.value = isNull(c)? f : car(c); + ce.innerHTML = isNull(c)? f : car(c); return t; } if (wc == 'list') { - e.innerHTML = '<table class="datatable" style="width: 100%;;"><tr><td class="datatd">' + (isNil(c)? f : car(c)) + '</td></tr><tr><td class="datatd">...</td></tr></table>'; + e.innerHTML = '<table class="datatable" style="width: 100%;;"><tr><td class="datatd">' + (isNull(c)? f : car(c)) + '</td></tr><tr><td class="datatd">...</td></tr></table>'; return t; } if (wc == 'table') { - e.innerHTML = '<table class="datatable" style="width: 100%;"><tr><td class="datatdl">' + (isNil(c)? f : car(c)) + '</td><td class="datatdr">...</td></tr><tr><td class="datatdl">...</td><td class="datatdr">...</td></tr></table>'; + e.innerHTML = '<table class="datatable" style="width: 100%;"><tr><td class="datatdl">' + (isNull(c)? f : car(c)) + '</td><td class="datatdr">...</td></tr><tr><td class="datatdl">...</td><td class="datatdr">...</td></tr></table>'; return t; } if (wc == 'link') { var ce = car(childElements(e)); - ce.href = isNil(c)? 'link:/index.html' : ('link:' + car(c)); - car(childElements(ce)).innerHTML = isNil(c)? (f != ''? f : '/index.html') : isNil(cdr(c))? (f != ''? f : car(c)) : cadr(c); + ce.href = isNull(c)? 'link:/index.html' : ('link:' + car(c)); + car(childElements(ce)).innerHTML = isNull(c)? (f != ''? f : '/index.html') : isNull(cdr(c))? (f != ''? f : car(c)) : cadr(c); return t; } if (wc == 'img') { - car(childElements(e)).src = isNil(c)? '/public/img.png' : car(c); + car(childElements(e)).src = isNull(c)? '/public/img.png' : car(c); return t; } return ''; @@ -512,7 +512,7 @@ function widgetbounds(e) { //debug('fixup br', e, br.left, br.top, br.right, br.bottom, t[0], t[1]); function fixuptransform(e) { var t = widgettransform(e); - if (!isNil(e.xtranslate)) + if (!isNull(e.xtranslate)) return [e.xtranslate, e.ytranslate]; var t = e.style.getPropertyValue('-webkit-transform') || e.style.getPropertyValue('-moz-transform') || e.style.getPropertyValue('-ms-transform') || e.style.getPropertyValue('-o-transform') || @@ -538,12 +538,12 @@ function widgetbounds(e) { */ function draggable(x, y, l) { //debug('draggable?', x, y, l); - if (isNil(l)) + if (isNull(l)) return null; var n = car(l); - if (isNil(n.id) || n.id == '') { + if (isNull(n.id) || n.id == '') { var d = draggable(x, y, reverse(nodeList(n.childNodes))); - if (!isNil(d)) + if (!isNull(d)) return d; return draggable(x, y, cdr(l)); } @@ -849,9 +849,9 @@ function mkeditor() { onpagechange(false); // On Firefox > 4, re-apply the outline after the widget has been repositioned - if (fffixupoutline && !isNil(selected)) { + if (fffixupoutline && !isNull(selected)) { ui.delay(function() { - if (!isNil(selected)) + if (!isNull(selected)) selected.style.outline = '2px solid #598edd'; }, 32); } @@ -932,7 +932,7 @@ function mkeditor() { } // Dismiss the palette - if (palvis && isNil(draggable(moveX, moveY, mklist($('palettecontent'))))) + if (palvis && isNull(draggable(moveX, moveY, mklist($('palettecontent'))))) hidepalette(); return true; @@ -1091,7 +1091,7 @@ function mkeditor() { * Get and display the requested app page. */ (function getpage() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -1108,15 +1108,15 @@ function mkeditor() { // Get the page from the ATOM entry, convert it to XHTML and place it in a hidden buffer var pageentry = car(atom.readATOMEntry(mklist(doc))); var content = namedElementChild("'content", pageentry); - var el = isNil(content)? mklist() : elementChildren(content); - if (isNil(el)) + var el = isNull(content)? mklist() : elementChildren(content); + if (isNull(el)) $('xhtmlbuffer').innerHTML = '<div id="page"></div>'; else $('xhtmlbuffer').innerHTML = writeStrings(writeXML(el, false)); // Remove any existing page nodes from the editor div var fnodes = filter(function(e) { - if (isNil(e.id) || e.id == '') + if (isNull(e.id) || e.id == '') return false; return true; }, nodeList($('pagediv').childNodes)); @@ -1169,7 +1169,7 @@ function pagexhtml() { // part of the page, as well as nodes positioned out the // editing area var fnodes = filter(function(e) { - if (isNil(e.id) || e.id == '') + if (isNull(e.id) || e.id == '') return false; return true; }, nodes); diff --git a/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html b/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html index 5ea9d7619d..f7cdab9bf2 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html @@ -161,7 +161,7 @@ try { * Initialize status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -179,7 +179,7 @@ try { */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -207,7 +207,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -329,7 +329,7 @@ var appresources = [ appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/config.js b/sca-cpp/trunk/hosting/server/htdocs/public/config.js index be23c7c01e..e3b966d542 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/config.js +++ b/sca-cpp/trunk/hosting/server/htdocs/public/config.js @@ -17,7 +17,7 @@ * under the License. */ -if (isNil(config)) +if (isNull(config)) config = {}; /** diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html index f453e0491c..cf5f3465d8 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html @@ -161,7 +161,7 @@ try { * Initialize status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -179,7 +179,7 @@ try { */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -207,7 +207,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -328,7 +328,7 @@ var appresources = [ appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html index c8475147d7..ba82ecb897 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html @@ -162,7 +162,7 @@ try { * Initialize status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -180,7 +180,7 @@ try { */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -208,7 +208,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -329,7 +329,7 @@ var appresources = [ appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html index 4bcb3728ae..0597d10942 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html @@ -162,7 +162,7 @@ try { * Initialize status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -180,7 +180,7 @@ try { */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -208,7 +208,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -329,7 +329,7 @@ var appresources = [ appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html index 68554efdb0..788435289f 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html @@ -161,7 +161,7 @@ try { * Initialize status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -179,7 +179,7 @@ try { */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -207,7 +207,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -328,7 +328,7 @@ var appresources = [ appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/rate/index.html b/sca-cpp/trunk/hosting/server/htdocs/rate/index.html index 22f11f631a..90d45bd3ea 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/rate/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/rate/index.html @@ -116,7 +116,7 @@ var savedxml = ''; * Get and display the requested app rating. */ (function getrating() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -133,7 +133,7 @@ var savedxml = ''; appentry = doc != null? car(elementsToValues(atom.readATOMEntry(mklist(doc)))) : mklist("'entry", mklist("'title", ''), mklist("'id", appname)); savedxml = car(atom.writeATOMEntry(valuesToElements(mklist(appentry)))); var content = cadr(assoc("'content", appentry)); - if (!isNil(content)) + if (!isNull(content)) selectrating(parseInt(cadr(content))); onlinestatus(); diff --git a/sca-cpp/trunk/hosting/server/htdocs/search/index.html b/sca-cpp/trunk/hosting/server/htdocs/search/index.html index 47d5a757f3..d46b0528c4 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/search/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/search/index.html @@ -74,7 +74,7 @@ function viewapp(appname) { * Get and display an app icon. */ function geticon(appname) { - if (isNil(appname)) + if (isNull(appname)) return false; return icons.get(appname, function(doc) { @@ -86,9 +86,9 @@ function geticon(appname) { var content = assoc("'content", iconentry); var icon = assoc("'icon", content); var img = assoc("'image", icon); - if (!isNil(img)) { + if (!isNull(img)) { var appimg = $('search_app_img_' + appname); - if (!isNil(appimg)) + if (!isNull(appimg)) appimg.src = cadr(img); } return true; @@ -114,7 +114,7 @@ function getapps(query) { var feed = car(elementsToValues(atom.readATOMFeed(mklist(doc)))); var aentries = assoc("'entry", feed); - var entries = isNil(aentries)? mklist() : isList(car(cadr(aentries)))? cadr(aentries) : mklist(cdr(aentries)); + var entries = isNull(aentries)? mklist() : isList(car(cadr(aentries)))? cadr(aentries) : mklist(cdr(aentries)); var defappimg = ui.b64png(appcache.get('/public/app.b64')); @@ -122,7 +122,7 @@ function getapps(query) { var icons = mklist(); (function displayentries(entries) { - if (isNil(entries)) + if (isNull(entries)) return apps; var entry = car(entries); var title = cadr(assoc("'title", entry)) @@ -136,8 +136,8 @@ function getapps(query) { var ar2 = assoc("'rating2", aratings); var ar3 = assoc("'rating3", aratings); var ar4 = assoc("'rating4", aratings); - var rating = isNil(ar)? 0 : Number(cadr(ar)); - var reviews = (isNil(ar1)? 0 : Number(cadr(ar1))) + (isNil(ar2)? 0 : Number(cadr(ar2))) + (isNil(ar3)? 0 : Number(cadr(ar3))) + (isNil(ar4)? 0 : Number(cadr(ar4))); + var rating = isNull(ar)? 0 : Number(cadr(ar)); + var reviews = (isNull(ar1)? 0 : Number(cadr(ar1))) + (isNull(ar2)? 0 : Number(cadr(ar2))) + (isNull(ar3)? 0 : Number(cadr(ar3))) + (isNull(ar4)? 0 : Number(cadr(ar4))); apps += '<div class="box">' apps += '<div class="appicon">' @@ -165,7 +165,7 @@ function getapps(query) { ui.unmemo$('search_app_'); (function displayicons(icons) { - if (isNil(icons)) + if (isNull(icons)) return true; geticon(car(icons)); return displayicons(cdr(icons)); diff --git a/sca-cpp/trunk/hosting/server/htdocs/store/index.html b/sca-cpp/trunk/hosting/server/htdocs/store/index.html index 15e7aeed0c..57920ede2e 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/store/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/store/index.html @@ -59,10 +59,10 @@ var categories = [ * Find a store category. */ function findcategory(name) { - if (isNil(name)) + if (isNull(name)) return findcategory('featured'); var f = filter(function(c) { return cadr(c) == name }, categories); - if (isNil(f)) + if (isNull(f)) return findcategory('featured'); return car(f); } @@ -121,7 +121,7 @@ $('createApp').onclick = function() { * Get and display an app icon. */ function geticon(appname) { - if (isNil(appname)) + if (isNull(appname)) return false; return icons.get(appname, function(doc) { @@ -133,9 +133,9 @@ function geticon(appname) { var content = assoc("'content", iconentry); var icon = assoc("'icon", content); var img = assoc("'image", icon); - if (!isNil(img)) { + if (!isNull(img)) { var appimg = $('store_app_img_' + appname); - if (!isNil(appimg)) + if (!isNull(appimg)) appimg.src = cadr(img); } return true; @@ -161,7 +161,7 @@ function geticon(appname) { var feed = car(elementsToValues(atom.readATOMFeed(mklist(doc)))); var aentries = assoc("'entry", feed); - var entries = isNil(aentries)? mklist() : isList(car(cadr(aentries)))? cadr(aentries) : mklist(cdr(aentries)); + var entries = isNull(aentries)? mklist() : isList(car(cadr(aentries)))? cadr(aentries) : mklist(cdr(aentries)); var defappimg = ui.b64png(appcache.get('/public/app.b64')); @@ -169,7 +169,7 @@ function geticon(appname) { var icons = mklist(); (function displayentries(entries) { - if (isNil(entries)) + if (isNull(entries)) return apps; var entry = car(entries); var title = cadr(assoc("'title", entry)) @@ -183,8 +183,8 @@ function geticon(appname) { var ar2 = assoc("'rating2", aratings); var ar3 = assoc("'rating3", aratings); var ar4 = assoc("'rating4", aratings); - var rating = isNil(ar)? 0 : Number(cadr(ar)); - var reviews = (isNil(ar1)? 0 : Number(cadr(ar1))) + (isNil(ar2)? 0 : Number(cadr(ar2))) + (isNil(ar3)? 0 : Number(cadr(ar3))) + (isNil(ar4)? 0 : Number(cadr(ar4))); + var rating = isNull(ar)? 0 : Number(cadr(ar)); + var reviews = (isNull(ar1)? 0 : Number(cadr(ar1))) + (isNull(ar2)? 0 : Number(cadr(ar2))) + (isNull(ar3)? 0 : Number(cadr(ar3))) + (isNull(ar4)? 0 : Number(cadr(ar4))); apps += '<div class="box">' apps += '<div class="appicon">' @@ -213,7 +213,7 @@ function geticon(appname) { ui.unmemo$('store_app_'); (function displayicons(icons) { - if (isNil(icons)) + if (isNull(icons)) return true; geticon(car(icons)); return displayicons(cdr(icons)); diff --git a/sca-cpp/trunk/hosting/server/icons.py b/sca-cpp/trunk/hosting/server/icons.py index 7ee9ae9bfb..d9fbcab448 100644 --- a/sca-cpp/trunk/hosting/server/icons.py +++ b/sca-cpp/trunk/hosting/server/icons.py @@ -49,7 +49,7 @@ def put(id, icon, user, cache, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('icons.py::put', 'app not found', id) return False @@ -61,23 +61,23 @@ def put(id, icon, user, cache, apps): # Get image and token from input icon def image(c): img = assoc("'image", c) - return None if isNil(img) else to50x50png(cadr(img)) + return None if isNull(img) else to50x50png(cadr(img)) def token(c): tok = assoc("'token", c) - return None if isNil(tok) else cadr(tok) + return None if isNull(tok) else cadr(tok) img = image(content(icon)) tok = token(content(icon)) # Update the icon # Put with an upload token - if not isNil(tok): + if not isNull(tok): debug('icons.py::put::token', tok) # Token alone, store token with existing image, if any - if isNil(img): + if isNull(img): eicon = cache.get(iconid(id)) - eimg = None if isNil(eicon) else image(content(eicon)) - if isNil(eimg): + eimg = None if isNull(eicon) else image(content(eicon)) + if isNull(eimg): iconentry = mkentry(title(app), car(id), author(app), now(), ("'icon", ("'token", tok))) debug('icons.py::put::iconentry', iconentry) return cache.put(iconid(id), iconentry) @@ -90,9 +90,9 @@ def put(id, icon, user, cache, apps): # Token plus image, put image if token is valid, removing the token debug('icons.py::put::img', img) eicon = cache.get(iconid(id)) - etok = None if isNil(eicon) else token(content(eicon)) + etok = None if isNull(eicon) else token(content(eicon)) debug('icons.py::put::etok', etok) - if isNil(etok) or tok != etok: + if isNull(etok) or tok != etok: debug('icons.py::put', 'invalid token', tok) return False @@ -101,7 +101,7 @@ def put(id, icon, user, cache, apps): return cache.put(iconid(id), iconentry) # Update icon image - if not isNil(img): + if not isNull(img): debug('icons.py::put::img', img) iconentry = mkentry(title(app), car(id), author(app), now(), ("'icon", ("'image", img))) debug('icons.py::put::iconentry', iconentry) @@ -115,12 +115,12 @@ def put(id, icon, user, cache, apps): # Get an icon def get(id, user, cache, apps): debug('icons.py::get::id', id) - if isNil(id): + if isNull(id): return (("'feed", ("'title", "Icons"), ("'id", "icons")),) # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('icons.py::get', 'app not found', id) # Return a default new icon @@ -128,7 +128,7 @@ def get(id, user, cache, apps): # Get the requested icon icon = cache.get(iconid(id)) - if isNil(icon): + if isNull(icon): debug('icons.py::get', 'icon not found', id) # Return a default new icon @@ -137,16 +137,16 @@ def get(id, user, cache, apps): # Get image, token, and updated date from icon def image(c): img = assoc("'image", c) - return None if isNil(img) else cadr(img) + return None if isNull(img) else cadr(img) def token(c): tok = assoc("'token", c) - return None if isNil(tok) else cadr(tok) + return None if isNull(tok) else cadr(tok) img = image(content(icon)) tok = token(content(icon)) # Return the icon - iconc = (() if isNil(img) else (("'image", img),)) + (() if isNil(tok) or (user.get(()) != author(app) and user.get(()) != 'admin') else (("'token", tok),)) - if isNil(iconc): + iconc = (() if isNull(img) else (("'image", img),)) + (() if isNull(tok) or (user.get(()) != author(app) and user.get(()) != 'admin') else (("'token", tok),)) + if isNull(iconc): iconentry = mkentry(title(app), car(id), author(app), updated(icon), ()) debug('icons.py::get::iconentry', iconentry) return iconentry @@ -161,7 +161,7 @@ def delete(id, user, cache, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('icons.py::delete', 'app not found', id) return False diff --git a/sca-cpp/trunk/hosting/server/pages.py b/sca-cpp/trunk/hosting/server/pages.py index d8c774c14d..3d353279ba 100644 --- a/sca-cpp/trunk/hosting/server/pages.py +++ b/sca-cpp/trunk/hosting/server/pages.py @@ -31,7 +31,7 @@ def put(id, page, user, cache, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('pages.py::put', 'app not found', id) return False @@ -48,12 +48,12 @@ def put(id, page, user, cache, apps): # Get a page from the page db def get(id, user, cache, apps): debug('pages.py::get::id', id) - if isNil(id): + if isNull(id): return (("'feed", ("'title", "Pages"), ("'id", "pages")),) # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('pages.py::get', 'app not found', id) # Return a default new page @@ -61,7 +61,7 @@ def get(id, user, cache, apps): # Get the requested page page = cache.get(pageid(id)) - if isNil(page): + if isNull(page): debug('pages.py::get', 'page not found', id) # Return a default new page @@ -80,7 +80,7 @@ def delete(id, user, cache, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('pages.py::delete', 'app not found', id) return False diff --git a/sca-cpp/trunk/hosting/server/palettes.py b/sca-cpp/trunk/hosting/server/palettes.py index 38e012835a..be681f874c 100644 --- a/sca-cpp/trunk/hosting/server/palettes.py +++ b/sca-cpp/trunk/hosting/server/palettes.py @@ -30,7 +30,7 @@ def put(id, palette, cache): # Get a palette from the palettes db def get(id, cache): - if isNil(id): + if isNull(id): return (("'feed", ("'title", "Palettes"), ("'id", "palettes")),) return mkentry(car(id), car(id), None, now(), car(cache.get(paletteid(id)))) diff --git a/sca-cpp/trunk/hosting/server/pictures.py b/sca-cpp/trunk/hosting/server/pictures.py index fab7df47ce..6c5e268e0f 100644 --- a/sca-cpp/trunk/hosting/server/pictures.py +++ b/sca-cpp/trunk/hosting/server/pictures.py @@ -47,7 +47,7 @@ def put(id, picture, user, cache): debug('pictures.py::put::id', id) debug('pictures.py::put::picture', picture) - picid = user.get(()) if isNil(id) else car(id) + picid = user.get(()) if isNull(id) else car(id) # Only the admin can update other user's pictures if picid != user.get(()) and user.get(()) != 'admin': @@ -57,23 +57,23 @@ def put(id, picture, user, cache): # Get image and token from input picture def image(c): img = assoc("'image", c) - return None if isNil(img) else to50x50png(cadr(img)) + return None if isNull(img) else to50x50png(cadr(img)) def token(c): tok = assoc("'token", c) - return None if isNil(tok) else cadr(tok) + return None if isNull(tok) else cadr(tok) img = image(content(picture)) tok = token(content(picture)) # Update the picture # Put with an upload token - if not isNil(tok): + if not isNull(tok): debug('pictures.py::put::token', tok) # Token alone, store token with existing image, if any - if isNil(img): + if isNull(img): epicture = cache.get(pictureid(picid)) - eimg = None if isNil(epicture) else image(content(epicture)) - if isNil(eimg): + eimg = None if isNull(epicture) else image(content(epicture)) + if isNull(eimg): picentry = mkentry(title(picture), picid, picid, now(), ("'picture", ("'token", tok))) debug('pictures.py::put::picentry', picentry) return cache.put(pictureid(picid), picentry) @@ -86,9 +86,9 @@ def put(id, picture, user, cache): # Token plus image, put image if token is valid, removing the token debug('pictures.py::put::img', img) epicture = cache.get(pictureid(picid)) - etok = None if isNil(epicture) else token(content(epicture)) + etok = None if isNull(epicture) else token(content(epicture)) debug('pictures.py::put::etok', etok) - if isNil(etok) or tok != etok: + if isNull(etok) or tok != etok: debug('pictures.py::put', 'invalid token', tok) return False @@ -97,7 +97,7 @@ def put(id, picture, user, cache): return cache.put(pictureid(picid), picentry) # Update picture image - if not isNil(img): + if not isNull(img): debug('pictures.py::put::img', img) picentry = mkentry(title(picture), picid, picid, now(), ("'picture", ("'image", img))) debug('pictures.py::put::picentry', picentry) @@ -113,24 +113,24 @@ def get(id, user, cache): debug('pictures.py::get::id', id) # Get the requested picture - picid = user.get(()) if isNil(id) else car(id) + picid = user.get(()) if isNull(id) else car(id) picture = cache.get(pictureid(picid)) - if isNil(picture): + if isNull(picture): return mkentry(picid, picid, picid, now(), ()) # Get image and token from picture def image(c): img = assoc("'image", c) - return None if isNil(img) else cadr(img) + return None if isNull(img) else cadr(img) def token(c): tok = assoc("'token", c) - return None if isNil(tok) else cadr(tok) + return None if isNull(tok) else cadr(tok) img = image(content(picture)) tok = token(content(picture)) # Return the picture - picc = (() if isNil(img) else (("'image", img),)) + (() if isNil(tok) or (user.get(()) != author(picture) and user.get(()) != 'admin') else (("'token", tok),)) - if isNil(picc): + picc = (() if isNull(img) else (("'image", img),)) + (() if isNull(tok) or (user.get(()) != author(picture) and user.get(()) != 'admin') else (("'token", tok),)) + if isNull(picc): picentry = mkentry(title(picture), picid, author(picture), updated(picture), ()) debug('pictures.py::get::picentry', picentry) return picentry diff --git a/sca-cpp/trunk/hosting/server/ratings.py b/sca-cpp/trunk/hosting/server/ratings.py index 5638d8609f..d36dcad45e 100644 --- a/sca-cpp/trunk/hosting/server/ratings.py +++ b/sca-cpp/trunk/hosting/server/ratings.py @@ -31,7 +31,7 @@ def put(id, ratings, user, cache, db, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('ratings.py::put', 'app not found', id) return False @@ -52,7 +52,7 @@ def patch(id, ratings, user, cache, db, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('ratings.py::patch', 'app not found', id) return False @@ -107,9 +107,9 @@ def get(id, user, cache, db, apps): debug('ratings.py::get::id', id) # Return the top ratings - if isNil(id): + if isNull(id): topentries = db.get((("'regex", '("ratings" .* "app.ratings")'), ("'rank", "(regexp_matches(value, '(.*\(rating )([^\)]+)(\).*)'))[2]::float"), ("'limit", 25))) - flatentries = tuple(map(lambda v: car(v), () if isNil(topentries) else topentries)) + flatentries = tuple(map(lambda v: car(v), () if isNull(topentries) else topentries)) def rating(e): return cadr(assoc("'rating", assoc("'ratings", assoc("'content", e)))) sortedentries = tuple(sorted(flatentries, key = rating, reverse = True)) @@ -119,7 +119,7 @@ def get(id, user, cache, db, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('ratings.py::get', 'app not found', id) # Return default ratings @@ -127,7 +127,7 @@ def get(id, user, cache, db, apps): # Get the requested ratings ratings = cache.get(ratingsid(id)) - if isNil(ratings): + if isNull(ratings): debug('ratings.py::get', 'ratings not found', id) # Return default ratings @@ -144,7 +144,7 @@ def delete(id, user, cache, db, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('ratings.py::delete', 'app not found', id) return False diff --git a/sca-cpp/trunk/hosting/server/reviews.py b/sca-cpp/trunk/hosting/server/reviews.py index 3c175d8a0f..f3c610467e 100644 --- a/sca-cpp/trunk/hosting/server/reviews.py +++ b/sca-cpp/trunk/hosting/server/reviews.py @@ -28,10 +28,10 @@ def reviewsid(user): def getreviews(id, cache): debug('reviews.py::getreviews::id', id) val = cache.get(id) - if isNil(val): + if isNull(val): return () reviews = cdddr(car(val)) - if not isNil(reviews) and isList(car(cadr(car(reviews)))): + if not isNull(reviews) and isList(car(cadr(car(reviews)))): # Expand list of entries ereviews = tuple(map(lambda e: cons("'entry", e), cadr(car(reviews)))) debug('reviews.py::getreviews::ereviews', ereviews) @@ -42,7 +42,7 @@ def getreviews(id, cache): # Get a review from a user's reviews def getreview(id, reviews): - if isNil(reviews): + if isNull(reviews): return None if car(id) == entryid(reviews): return (car(reviews),) @@ -51,20 +51,20 @@ def getreview(id, reviews): # Get reviews from the user's reviews def get(id, user, cache, apps, ratings): debug('reviews.py::get::id', id) - if isNil(id): + if isNull(id): reviews = ((("'feed", ("'title", "Your Reviews"), ("'id", user.get(()))) + getreviews(reviewsid(user), cache)),) debug('reviews.py::get::reviews', reviews) return reviews # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('reviews.py::get', 'app not found', id) return False # Get the review review = getreview(id, getreviews(reviewsid(user), cache)) - if isNil(review): + if isNull(review): debug('reviews.py::get', 'review not found', id) # Return a default empty review @@ -75,7 +75,7 @@ def get(id, user, cache, apps, ratings): # Patch an app ratings def patchratings(id, user, ratings, oreview, nreview): - patch = ("'patch", ("'old", "0" if isNil(oreview) else cadr(content(oreview))), ("'new", "0" if isNil(nreview) else cadr(content(nreview)))) + patch = ("'patch", ("'old", "0" if isNull(oreview) else cadr(content(oreview))), ("'new", "0" if isNull(nreview) else cadr(content(nreview)))) patchentry = mkentry(car(id), car(id), user.get(()), now(), patch); debug('reviews.py::patchratings::patchentry', patchentry) return ratings.patch(id, patchentry) @@ -89,7 +89,7 @@ def putreviews(id, reviews, cache): # Put a review into a user's reviews def putreview(id, review, reviews): - if isNil(reviews): + if isNull(reviews): return review if car(id) == entryid(reviews): return cons(car(review), cdr(reviews)) @@ -102,7 +102,7 @@ def put(id, review, user, cache, apps, ratings): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('reviews.py::put', 'app not found', id) return False @@ -122,7 +122,7 @@ def put(id, review, user, cache, apps, ratings): # Delete a review from a reviews record def deletereview(id, reviews): - if isNil(reviews): + if isNull(reviews): return () if car(id) == entryid(reviews): return cdr(reviews) @@ -131,19 +131,19 @@ def deletereview(id, reviews): # Delete reviews from the user's reviews record def delete(id, user, cache, apps, ratings): debug('reviews.py::delete::id', id) - if isNil(id): + if isNull(id): return cache.delete(reviewsid(user)) # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('reviews.py::delete', 'app not found', id) return False # Get the review reviews = getreviews(reviewsid(user), cache) review = getreview(id, reviews) - if isNil(review): + if isNull(review): debug('reviews.py::delete', 'review not found', id) return False diff --git a/sca-cpp/trunk/hosting/server/search.py b/sca-cpp/trunk/hosting/server/search.py index b1a7d36733..e79ff0ce51 100644 --- a/sca-cpp/trunk/hosting/server/search.py +++ b/sca-cpp/trunk/hosting/server/search.py @@ -30,10 +30,10 @@ def mergeratings(entries, ratings): info = content(app) rating = ratings.get(id) rates = content(rating) - mergedentry = mkentry(title(app), car(id), author(app), updated(app), ("'info",) + (() if isNil(info) else cdr(info)) + (() if isNil(rates) else cdr(rates))) + mergedentry = mkentry(title(app), car(id), author(app), updated(app), ("'info",) + (() if isNull(info) else cdr(info)) + (() if isNull(rates) else cdr(rates))) return mergedentry - mergedentries = tuple(filter(lambda e: not isNil(e), map(lambda e: car(mergerating((e,))), entries))) + mergedentries = tuple(filter(lambda e: not isNull(e), map(lambda e: car(mergerating((e,))), entries))) debug('search.py::mergeratings::mergedentries', mergedentries) return mergedentries @@ -41,7 +41,7 @@ def mergeratings(entries, ratings): def get(id, user, cache, db, apps, ratings): debug('search.py::get::id', id) q = assoc("'q", id) - if isNil(q): + if isNull(q): return None # Run the search @@ -49,7 +49,7 @@ def get(id, user, cache, db, apps, ratings): debug('search.py::get::foundentries', foundentries) # Merge app ratings - appentries = mergeratings(tuple(map(lambda v: car(v), () if isNil(foundentries) else foundentries)), ratings) + appentries = mergeratings(tuple(map(lambda v: car(v), () if isNull(foundentries) else foundentries)), ratings) results = ((("'feed", ("'title", "Search Results"), ("'id", 'search')) + appentries),) debug('search.py::get::results', results) diff --git a/sca-cpp/trunk/hosting/server/selector.py b/sca-cpp/trunk/hosting/server/selector.py index 33cd9512cc..4cbe31ba37 100644 --- a/sca-cpp/trunk/hosting/server/selector.py +++ b/sca-cpp/trunk/hosting/server/selector.py @@ -20,9 +20,9 @@ from util import * # Get the database to use for a particular key def get(id, db): - if isNil(id): + if isNull(id): return db - if not isNil(filter(lambda i: isList(i) and not isNil(i) and car(i) == "'limit", id)): + if not isNull(filter(lambda i: isList(i) and not isNull(i) and car(i) == "'limit", id)): return db if cadr(id)[0:1].lower() < 'm': return (db[0],) diff --git a/sca-cpp/trunk/hosting/server/store.py b/sca-cpp/trunk/hosting/server/store.py index 058505b4ee..aac233f877 100644 --- a/sca-cpp/trunk/hosting/server/store.py +++ b/sca-cpp/trunk/hosting/server/store.py @@ -30,10 +30,10 @@ def getstore(id, cache): # Lookup the requested store val = cache.get(id) - if isNil(val): + if isNull(val): return () store = cdddr(car(val)) - if not isNil(store) and isList(car(cadr(car(store)))): + if not isNull(store) and isList(car(cadr(car(store)))): # Expand list of entries estore = tuple(map(lambda e: cons("'entry", e), cadr(car(store)))) debug('store.py::getstore::estore', estore) @@ -57,7 +57,7 @@ def put(id, app, user, cache, apps, ratings): appid = cdr(id) def putapp(appid, app, store): - if isNil(store): + if isNull(store): return app if car(appid) == entryid(store): return cons(car(app), cdr(store)) @@ -77,15 +77,15 @@ def mergeapps(entries, apps, ratings): debug('store.py::mergeapp::entry', entry) id = (entryid(entry),) app = apps.get(id) - if isNil(app): + if isNull(app): return ((),) info = content(app) rating = ratings.get(id) rates = content(rating) - mergedentry = mkentry(title(app), car(id), author(app), updated(app), ("'info",) + (() if isNil(info) else cdr(info)) + (() if isNil(rates) else cdr(rates))) + mergedentry = mkentry(title(app), car(id), author(app), updated(app), ("'info",) + (() if isNull(info) else cdr(info)) + (() if isNull(rates) else cdr(rates))) return mergedentry - mergedentries = tuple(filter(lambda e: not isNil(e), map(lambda e: car(mergeapp((e,))), entries))) + mergedentries = tuple(filter(lambda e: not isNull(e), map(lambda e: car(mergeapp((e,))), entries))) debug('store.py::mergeapps::mergedentries', mergedentries) return mergedentries @@ -105,13 +105,13 @@ def get(id, user, cache, apps, ratings): # Collect the featured apps appid = cdr(id) def findapp(appid, store): - if isNil(store): + if isNull(store): return None if car(appid) == entryid(store): return (car(store),) return findapp(appid, cdr(store)) - if isNil(appid): + if isNull(appid): storeapps = mergeapps(getstore(storeid(tag), cache), apps, ratings) store = ((("'feed", ("'title", "App Store"), ("'id", tag)) + storeapps),) debug('store.py::get::store', store) @@ -127,11 +127,11 @@ def delete(id, user, cache, apps, ratings): tag = car(id) appid = cdr(id) - if isNil(appid): + if isNull(appid): return cache.delete(storeid(tag)) def deleteapp(appid, store): - if isNil(store): + if isNull(store): return () if car(appid) == entryid(store): return cdr(store) diff --git a/sca-cpp/trunk/hosting/server/util.py b/sca-cpp/trunk/hosting/server/util.py index 791951a71c..bd37eb11af 100644 --- a/sca-cpp/trunk/hosting/server/util.py +++ b/sca-cpp/trunk/hosting/server/util.py @@ -57,9 +57,9 @@ def reverse(l): r.reverse() return tuple(r) -def isNil(l): +def isNull(l): if isinstance(l, streampair): - return l.isNil() + return l.isNull() return l is None or l == () def isSymbol(v): @@ -76,7 +76,7 @@ def isList(v): return True def isTaggedList(v, t): - return isList(v) and not isNil(v) and car(v) == t + return isList(v) and not isNull(v) and car(v) == t # Scheme-like streams @@ -88,7 +88,7 @@ class streampair(object): def __repr__(self): return repr(self[0:len(self)]) - def isNil(self): + def isNull(self): return self.cdr == () def __len__(self): @@ -102,7 +102,7 @@ class streampair(object): return self.cdr()[i - 1] def __getslice__(self, i, j): - if isNil(self): + if isNull(self): return () if i > 0: if j == maxint: @@ -156,7 +156,7 @@ def curry(f, *args): # Convert a path represented as a list of values to a string def path(p): - if isNil(p): + if isNull(p): return "" return "/" + car(p) + path(cdr(p)) |