X-Git-Url: http://git.onelab.eu/?p=myops.git;a=blobdiff_plain;f=web%2Fquery%2Fevently%2Faccount%2FloggedIn%2Fdata.js;fp=web%2Fquery%2Fevently%2Faccount%2FloggedIn%2Fdata.js;h=3392de05480c935720168e6ea530a9a954afd503;hp=0000000000000000000000000000000000000000;hb=85070b3d456667f238051af1a2f1f2a0c12300ab;hpb=607f0e13927eb18075c375fa9ba5527da4fcbb44 diff --git a/web/query/evently/account/loggedIn/data.js b/web/query/evently/account/loggedIn/data.js new file mode 100644 index 0000000..3392de0 --- /dev/null +++ b/web/query/evently/account/loggedIn/data.js @@ -0,0 +1,19 @@ +function(e, r) { + var app = $$(this).app; + var path = app.require("vendor/couchapp/lib/path").init(app.req); + var data = { + name : r.userCtx.name, + uri_name : encodeURIComponent(r.userCtx.name), + auth_db : encodeURIComponent(r.info.authentication_db) + }; + if (r.userCtx.roles.indexOf("_admin") != -1 || r.userCtx.roles.indexOf("author") != -1) { + if (app.req.path.indexOf("post-page") == -1) { + data.postPath = path.show("edit")+"/"; + data.postMessage = "New post."; + } else { + data.postPath = path.show("edit", app.req.query.startkey[0]); + data.postMessage = "Edit this post."; + } + } + return data; +} \ No newline at end of file