Commit 45baee6a authored by Bas Lijnse's avatar Bas Lijnse

Small cleanup in services

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@1126 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 88f08baa
......@@ -40,7 +40,7 @@ itasks.NewWorkPanel = Ext.extend(Ext.tree.TreePanel ,{
title: "New task...",
iconCls: "icon-newwork",
loader: new itasks.NewWorkTreeLoader({
baseParams: {_session: itasks.app.session}
baseParams: {session: itasks.app.session}
}),
root: {text: "_ROOT_", nodeType: "async", id: "_ROOT_", expanded: true},
rootVisible: false,
......@@ -59,7 +59,7 @@ itasks.NewWorkPanel = Ext.extend(Ext.tree.TreePanel ,{
Ext.Ajax.request({
method: "POST",
url: "/services/json/tasks/create",
params: {_session: itasks.app.session, workflow: workflow},
params: {session: itasks.app.session, workflow: workflow},
scripts: false,
callback: this.startWorkflowCB,
scope: this
......
......@@ -25,7 +25,7 @@ itasks.RemoteDataPanel = Ext.extend(Ext.Panel, {
this.fireEvent("remoteCallStart");
//Add session id parameter
params["_session"] = itasks.app.session
params["session"] = itasks.app.session
Ext.Ajax.request({
method: 'POST',
......
......@@ -130,7 +130,7 @@ itasks.WorkListPanel = Ext.extend(Ext.Panel,{
conn.request({
url: itasks.config.servicesUrl + "/json/tasks",
params: { '_session' : itasks.app.session },
params: { session : itasks.app.session },
callback: function(options,success,response) {
if(!success) itasks.app.restart('Cannot retrieve work list');
......
......@@ -19,7 +19,7 @@ itasks.WorkPanel = Ext.extend(itasks.RemoteDataPanel, {
autoDestroy: true,
iconCls: "icon-task",
url: itasks.config.servicesUrl + "/json/tasks/" + this.taskId + "/tui",
params: {_session: itasks.app.session},
params: {session: itasks.app.session},
layout: "border",
items: [{
xtype: "itasks.work-header",
......
......@@ -11,7 +11,7 @@ itasks.ttc.GroupContainer = Ext.extend(Ext.Panel,{
, fixedCont: new Ext.util.MixedCollection() // collection of all fixed containers
, floatingCont: new Ext.util.MixedCollection() // collection of all floating containers
, taskUpdates : {}
, url: itasks.config.serverUrl + '/work/tab'
, url: itasks.config.servicesUrl + "/json/tasks/" + this.taskId + "/tui"
});
itasks.ttc.GroupContainer.superclass.initComponent.apply(this,arguments);
......
......@@ -204,7 +204,7 @@ itasks.ttc.parallel.AssignWindow = Ext.extend(Ext.Window,{
c.request({
url: itasks.config.servicesUrl+'/json/tasks/'+win.taskId+ '/managerProperties/worker',
params: { _session: itasks.app.session, update: upd},
params: { session: itasks.app.session, update: upd},
callback: function(){
win.close();
}
......
......@@ -141,7 +141,7 @@ itasks.ttc.common.attachDocumentLinkInformation = function() {
for(var x=0; x < links.length; x++){
var link = links[x];
link.href = Ext.urlAppend(link.href,'_session='+itasks.app.session);
link.href = Ext.urlAppend(link.href,'session='+itasks.app.session);
link.name = "";
for(var y=0; y < plinks.length; y++){
......
......@@ -235,7 +235,7 @@ itasks.tui.document.DownloadPanel = Ext.extend(Ext.form.FormPanel,{
form.getForm().submit({
url: "/services/json/documents/" + dp.document.documentId + "/download",
params: { _session : itasks.app.session },
params: { session : itasks.app.session },
waitMsg: null,
failure: function(form, o){
Ext.Msg.alert('Error',o.result.errors,function(){wt.refresh()});
......@@ -342,7 +342,7 @@ itasks.tui.document.UploadPanel = Ext.extend(Ext.form.FormPanel,{
form.getForm().submit({
url: "/services/json/documents/upload",
params: { _session : itasks.app.session },
params: { session : itasks.app.session },
waitMsg: "Uploading document. Please wait..",
success: function(form,response) {
try {
......
......@@ -22,7 +22,7 @@ itasks.tui.UsernameControl = Ext.extend(Ext.form.ComboBox,{
triggerAction: "all",
listeners: {
"beforequery": function(e) {
e.combo.store.baseParams["_session"] = itasks.app.session;
e.combo.store.baseParams["session"] = itasks.app.session;
delete e.combo.lastQuery;
}
},
......
......@@ -52,8 +52,8 @@ documentService url html path req tst
_
= (notFoundResponse req,tst)
where
sessionParam = paramValue "_session" req
params = [("_session",sessionParam,True)]
sessionParam = paramValue "session" req
params = [("session",sessionParam,True)]
createDocuments [] tst = ([],tst)
createDocuments [u:us] tst
......
......@@ -72,9 +72,9 @@ sessionService url html path req tst
_ = (notFoundResponse req, tst)
where
listParams = [("_session",sessionParam,False),("_user", userParam, False)]
sessionParam = paramValue "_session" req
userParam = paramValue "_user" req
listParams = [("session",sessionParam,False),("user", userParam, False)]
sessionParam = paramValue "session" req
userParam = paramValue "user" req
createParams = [("username",usernameParam,True),("password",passwordParam,True)]
usernameParam = paramValue "username" req
......
......@@ -213,21 +213,21 @@ taskService url html path req tst
_
= (notFoundResponse req, tst)
where
sessionParam = paramValue "_session" req
userParam = paramValue "_user" req
sessionParam = paramValue "session" req
userParam = paramValue "user" req
createParams = [("_session",sessionParam,True),("workflow",workflowParam,True)]
createParams = [("session",sessionParam,True),("workflow",workflowParam,True)]
workflowParam = paramValue "workflow" req
listParams = [("_session",sessionParam,True),("_user",userParam,False)]
listParams = [("session",sessionParam,True),("user",userParam,False)]
debugParams = [("_session",sessionParam,True)]
debugParams = [("session",sessionParam,True)]
detailsParams = [("_session",sessionParam,True)]
tuiParams = [("_session",sessionParam,True),("events",eventsParam,False)]
detailsParams = [("session",sessionParam,True)]
tuiParams = [("session",sessionParam,True),("events",eventsParam,False)]
eventsParam = paramValue "events" req
propParams = [("_session",sessionParam,True),("update",updateParam,False)]
propParams = [("session",sessionParam,True),("update",updateParam,False)]
updateParam = paramValue "update" req
jsonSessionErr (Just error)
......
......@@ -42,8 +42,8 @@ userService url html path req tst
_
= (notFoundResponse req,tst)
where
sessionParam = paramValue "_session" req
params = [("_session",sessionParam,True)]
sessionParam = paramValue "session" req
params = [("session",sessionParam,True)]
jsonSessionErr (Just error)
= JSONObject [("success",JSONBool False),("error", JSONString error)]
\ No newline at end of file
......@@ -32,9 +32,9 @@ workflowService url html path req tst
# json = JSONObject [("success",JSONBool True),("workflows",toJSON items)]
= (serviceResponse html "workflows" url params json, tst)
where
sessionParam= paramValue "_session" req
sessionParam= paramValue "session" req
params = [("_session", sessionParam, False)]
params = [("session", sessionParam, False)]
onPath paths wf = paths == "" || (wf.Workflow.path % (0, (size paths))) == paths +++ "/"
......
implementation module HtmlUtil
import Html, JSON, Http
import Html, JSON, Text, Http
import StdList
embeddedStyle :: HtmlTag
......@@ -30,12 +30,14 @@ where
servicePage :: !String !String ![(String,String,Bool)] JSONNode -> HtmlTag
servicePage title url params json = pageLayout title [parameters, message]
servicePage title url params json = pageLayout title [parameters, message, alternatives]
where
parameters = pageSection "Parameters" [FormTag [ActionAttr url,MethodAttr "get"] [TableTag [ClassAttr "parameters"] (rows ++ send)]]
rows = [TrTag [] [ThTag [] [Text n : if o [Text "*:"] [Text ":"]], TdTag [] [InputTag [NameAttr n, ValueAttr v]]] \\ (n,v,o) <- params]
send = [TrTag [] [TdTag [ColspanAttr "4"] [ButtonTag [TypeAttr "submit"] [Text "Send"]]]]
message = pageSection "Message" [DivTag [ClassAttr "json"] (formatJSON json)]
message = pageSection "Data" [DivTag [ClassAttr "json"] (formatJSON json)]
jsonurl = replaceSubString "services/html" "services/json" url
alternatives= pageSection "Alternative representations" [PTag [] [Text "JSON: ", ATag [HrefAttr jsonurl] [Text jsonurl]]]
serviceResponse :: !Bool !String !String ![(String,String,Bool)] JSONNode -> HTTPResponse
serviceResponse html title url params json =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment