Commit ec0ba13f authored by Bas Lijnse's avatar Bas Lijnse

Cleaned up the GUI startup. The GUI is now a completely self contained...

Cleaned up the GUI startup. The GUI is now a completely self contained javascript application interacting with the Clean server only through JSON data exchange.

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/branches/fancyTasks@356 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent f4fbf165
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>iTasks</title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="ext/resources/css/xtheme-gray.css" />
<link rel="stylesheet" type="text/css" href="ext-ux-livegrid/build/resources/css/ext-ux-livegrid.css" />
<link rel="stylesheet" type="text/css" href="css/itasks.css" />
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all-debug.js"></script>
<script type="text/javascript" src="ext-ux-livegrid/build/livegrid-all.js"></script>
<script type="text/javascript" src="js/itasks.util.js"></script>
<script type="text/javascript" src="js/itasks.LoginWindow.js"></script>
<script type="text/javascript" src="js/itasks.LoaderWindow.js"></script>
<script type="text/javascript" src="js/itasks.CurrentWorkPanel.js"></script>
<script type="text/javascript" src="js/itasks.NewWorkPanel.js"></script>
<script type="text/javascript" src="js/itasks.DebugPanel.js"></script>
<script type="text/javascript" src="js/itasks.WorkListPanel.js"></script>
<script type="text/javascript" src="js/itasks.HomeTabPanel.js"></script>
<script type="text/javascript" src="js/itasks.TaskForestTabPanel.js"></script>
<script type="text/javascript" src="js/itasks.ThreadTableTabPanel.js"></script>
<script type="text/javascript" src="js/itasks.ProcessTableTabPanel.js"></script>
<script type="text/javascript" src="js/itasks.WorkTabPanel.js"></script>
<script type="text/javascript" src="js/itasks.WorkTabsPanel.js"></script>
<script type="text/javascript" src="js/itasks.ApplicationPanel.js"></script>
<script type="text/javascript" src="js/itasks.Application.js"></script>
<script type="text/javascript" src="js/itasks.js"></script>
<style type="text/css">
html, body {
font: normal 12px Verdana;
margin: 0;
padding: 0;
border: 0 none;
overflow: hidden;
height: 100%;
}
.bg {
background: #3a81ad url('img/body.png') top repeat-x;
}
</style>
</head>
<body>
</body>
</html>
\ No newline at end of file
......@@ -43,7 +43,7 @@ itasks.ProcessTableTabPanel = Ext.extend(Ext.Panel, {
refresh: function() {
Ext.Ajax.request({
method: 'GET',
url: 'handlers/processtable',
url: 'handlers/debug/processtable',
params: this.applicationPanel.addSessionParam({}),
callback: this.processResponse,
scope: this
......
......@@ -43,7 +43,7 @@ itasks.TaskForestTabPanel = Ext.extend(Ext.Panel, {
refresh: function() {
Ext.Ajax.request({
method: 'GET',
url: 'handlers/tasktreeforest',
url: 'handlers/debug/tasktreeforest',
params: this.applicationPanel.addSessionParam({}),
callback: this.processResponse,
scope: this
......
......@@ -43,7 +43,7 @@ itasks.ThreadTableTabPanel = Ext.extend(Ext.Panel, {
refresh: function() {
Ext.Ajax.request({
method: 'GET',
url: 'handlers/threadtable',
url: 'handlers/debug/threadtable',
params: this.applicationPanel.addSessionParam({}),
callback: this.processResponse,
scope: this
......
definition module FilterListHandler //iTasks.Handlers.FilterListHandler
import Http
/**
* Handles the ajax requests from the current work filter panel.
*/
handleFilterListRequest :: !HTTPRequest *World -> (!HTTPResponse, !*World)
\ No newline at end of file
implementation module FilterListHandler
import Http
handleFilterListRequest :: !HTTPRequest *World -> (!HTTPResponse, !*World)
handleFilterListRequest req world = ({http_emptyResponse & rsp_data = data},world)
where
data = "[{id: 'new',text: 'New work', leaf: true},{id: 'updated',text: 'Updated work',leaf: true}]"
definition module IndexHandler //iTasks.Handlers.IndexHandler
import Http
/**
* Handles the 'index' request. This generates a minimal page which loads the required
* javascript code to jumpstart the client driven boot process.
*/
handleIndexRequest :: !HTTPRequest *World -> (!HTTPResponse, !*World)
\ No newline at end of file
implementation module IndexHandler
import StdEnv
import Http
import Html
handleIndexRequest :: !HTTPRequest *World -> (!HTTPResponse, !*World)
handleIndexRequest req world = ({http_emptyResponse & rsp_data = toString mkPage }, world)
mkPage = HtmlTag [] [mkHead, BodyTag [] []]
mkHead = HeadTag [] [mkTitle : mkCssLibs ++ mkJsLibs ++ mkStartCss]
mkTitle = TitleTag [] [Text "iTasks"]
mkJsLibs = [ScriptTag [TypeAttr "text/javascript", SrcAttr src] [] \\ src <- jslibs]
where
jslibs = ["ext/adapter/ext/ext-base.js"
,"ext/ext-all-debug.js"
,"ext-ux-livegrid/build/livegrid-all.js"
,"js/itasks.util.js"
,"js/itasks.LoginWindow.js"
,"js/itasks.LoaderWindow.js"
,"js/itasks.CurrentWorkPanel.js"
,"js/itasks.NewWorkPanel.js"
,"js/itasks.DebugPanel.js"
,"js/itasks.WorkListPanel.js"
,"js/itasks.HomeTabPanel.js"
,"js/itasks.TaskForestTabPanel.js"
,"js/itasks.ThreadTableTabPanel.js"
,"js/itasks.ProcessTableTabPanel.js"
,"js/itasks.WorkTabPanel.js"
,"js/itasks.WorkTabsPanel.js"
,"js/itasks.ApplicationPanel.js"
,"js/itasks.Application.js"
,"js/itasks.js"
]
mkCssLibs = [LinkTag [RelAttr "stylesheet", TypeAttr "text/css", HrefAttr src] [] \\ src <- csslibs]
where
csslibs =["ext/resources/css/ext-all.css"
,"ext/resources/css/xtheme-gray.css"
,"ext-ux-livegrid/build/resources/css/ext-ux-livegrid.css"
,"css/itasks.css"
]
mkStartCss = [StyleTag [TypeAttr "text/css"] [Text htmlStyle, Text bgStyle]]
where
htmlStyle = "html, body {font: normal 12px Verdana; margin: 0; padding: 0; border: 0 none; overflow: hidden; height: 100%;} "
bgStyle = ".bg {background: #3a81ad url('img/body.png') top repeat-x;} "
\ No newline at end of file
......@@ -13,14 +13,13 @@ import iTasksSettings, InternaliTasksCommon, InternaliTasksThreadHandling
import BasicCombinators, iTasksProcessHandling
import Http, HttpUtil, HttpServer, HttpTextUtil, sapldebug
import IndexHandler, AuthenticationHandler, DeauthenticationHandler, NewListHandler, NewStartHandler, FilterListHandler, WorkListHandler, WorkTabHandler //iTasks.Framework.Handlers.*
import AuthenticationHandler, DeauthenticationHandler, NewListHandler, NewStartHandler, WorkListHandler, WorkTabHandler //iTasks.Framework.Handlers.*
import TaskTreeForestHandler, ProcessTableHandler, ThreadTableHandler
import TaskTree, TaskTreeFilters
import Session //iTasks.Framework.Session
import JSON
import StdDebug
derive JSONDecode HtmlState, StorageFormat, Lifespan
// ******************************************************************************************************
......@@ -42,7 +41,7 @@ where
instructions world
# (console, world) = stdio world
# console = fwrites "HTTP server started...\n" console
# console = fwrites ("Please point your browser to http://localhost/" +++ ThisExe +++ "/\n") console
# console = fwrites ("Please point your browser to http://localhost/\n") console
# (_,world) = fclose console world
= world
......@@ -57,40 +56,33 @@ where
startServer :: (Task a) !*World -> *World | iData a
startServer mainTask world
# options = ServerOptions ++ (if TraceHTTP [HTTPServerOptDebug True] [])
= http_startServer options [((==) "/", handleRedirectRequest)
,((==) ("/" +++ ThisExe), handleRedirectRequest)
,((==) ("/" +++ ThisExe +++ "/"), handleIndexRequest)
,((==) ("/" +++ ThisExe +++ "/handlers/authenticate"), handleAnonRequest handleAuthenticationRequest)
,((==) ("/" +++ ThisExe +++ "/handlers/deauthenticate"), handleSessionRequest handleDeauthenticationRequest)
,((==) ("/" +++ ThisExe +++ "/handlers/filters"), handleFilterListRequest)
,((==) ("/" +++ ThisExe +++ "/handlers/new/list"), handleSessionRequest handleNewListRequest)
,((==) ("/" +++ ThisExe +++ "/handlers/new/start"), handleSessionRequest handleNewStartRequest)
,((==) ("/" +++ ThisExe +++ "/handlers/work/list"), handleSessionRequest (handleWorkListRequest mainTask))
,((==) ("/" +++ ThisExe +++ "/handlers/work/tab"), handleSessionRequest (handleWorkTabRequest mainTask))
,((==) ("/" +++ ThisExe +++ "/handlers/tasktreeforest"), handleSessionRequest (handleTaskTreeForestRequest mainTask))
,((==) ("/" +++ ThisExe +++ "/handlers/processtable"), handleSessionRequest (handleProcessTableRequest mainTask))
,((==) ("/" +++ ThisExe +++ "/handlers/threadtable"), handleSessionRequest (handleThreadTableRequest mainTask))
= http_startServer options [((==) "/handlers/authenticate", handleAnonRequest handleAuthenticationRequest)
,((==) "/handlers/deauthenticate", handleSessionRequest handleDeauthenticationRequest)
,((==) "/handlers/new/list", handleSessionRequest handleNewListRequest)
,((==) "/handlers/new/start", handleSessionRequest handleNewStartRequest)
,((==) "/handlers/work/list", handleSessionRequest (handleWorkListRequest mainTask))
,((==) "/handlers/work/tab", handleSessionRequest (handleWorkTabRequest mainTask))
,((==) "/handlers/debug/tasktreeforest", handleSessionRequest (handleTaskTreeForestRequest mainTask))
,((==) "/handlers/debug/processtable", handleSessionRequest (handleProcessTableRequest mainTask))
,((==) "/handlers/debug/threadtable", handleSessionRequest (handleThreadTableRequest mainTask))
,(\_ -> True, handleStaticResourceRequest)
] world
// Request handler which points the browser to the index page
handleRedirectRequest :: !HTTPRequest *World -> (!HTTPResponse, !*World)
handleRedirectRequest req world = ({http_emptyResponse & rsp_headers = [("Status", "301 Moved Permanently"),("Location","/" +++ ThisExe +++ "/")]},world)
// Request handler which serves static resources from the application directory,
// or a system wide default directory if it is not found locally.
// This request handler is used for serving system wide javascript, css, images, etc...
handleStaticResourceRequest :: !HTTPRequest *World -> (!HTTPResponse, !*World)
handleStaticResourceRequest req world
# filename = MyAbsDir +++ req.req_path
# path = if (req.req_path == "/") "/index.html" req.req_path
# filename = MyAbsDir +++ path
# (type, world) = http_staticFileMimeType filename world
# (ok, content, world) = http_staticFileContent filename world
| ok = ({rsp_headers = [("Status","200 OK"),
("Content-Type", type),
("Content-Length", toString (size content))]
,rsp_data = content}, world)
# filename = ResourceDir +++ (req.req_path % ((size ThisExe) + 1, size req.req_path)) //Remove the /(ThisExe)/ from the filename
# filename = ResourceDir +++ path
# (type, world) = http_staticFileMimeType filename world
# (ok, content, world) = http_staticFileContent filename world
| ok = ({rsp_headers = [("Status","200 OK"),
......
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