diff --git a/HTTPHandler.cpp b/HTTPHandler.cpp index 1ff8a03..457a692 100644 --- a/HTTPHandler.cpp +++ b/HTTPHandler.cpp @@ -9,7 +9,9 @@ namespace http { int HTTPHandler::processCommand(std::string request, core::TCPSession *session, std::stringstream &data) { - + + coreutils::Log(coreutils::LOG_DEBUG_4) << "DATA[" << request << "]"; + coreutils::PString request1(request); HTTPRequest httpRequest(request1); diff --git a/HTTPPageList.h b/HTTPPageList.h index 8aaff2d..e085ed6 100644 --- a/HTTPPageList.h +++ b/HTTPPageList.h @@ -1,41 +1,45 @@ #ifndef __HTTPPageList_h__ -#define __HTTPPageList_h__ +# define __HTTPPageList_h__ -#include "TCPSession.h" -#include "HTTPRequest.h" -#include "__index.h" -#include "__script.h" -#include "__editview.h" -#include "__style.h" -#include "__setupadmin.h" -#include "__favicon_ico.h" -#include "__welcome.h" -#include "__mainmenu.h" -#include "__newview.h" -#include "__configure.h" -#include "__viewlist.h" +# include "TCPSession.h" +# include "HTTPRequest.h" +# include "__index.h" +# include "__script.h" +# include "__editview.h" +# include "__editview_js.h" +# include "__style.h" +# include "__setupadmin.h" +# include "__favicon_ico.h" +# include "__welcome.h" +# include "__mainmenu.h" +# include "__configure.h" +# include "__viewlist.h" +# include "__workflow.h" +# include "__workflow_js.h" namespace http { - + class HTTPPageList { - + public: HTTPPageList() { add(index, "/"); add(script, "/script"); add(editview, "/editview"); + add(editview_js, "/__editview_js"); add(style, "/style"); add(setupadmin, "/setupadmin"); add(favicon_ico, "/favicon.ico"); add(welcome, "/welcome"); add(mainmenu, "/mainmenu"); - add(newview, "/newview"); add(configure, "/configure"); add(viewlist, "/viewlist"); + add(workflow, "/workflow"); + add(workflow_js, "/__workflow_js"); } - + bool processRequest(HTTPRequest &httpRequest, core::TCPSession *session, HTTPSession *httpSession, std::stringstream &data); - + void add(HTTPPage &page, std::string name = ""); void remove(HTTPPage &page); @@ -48,13 +52,15 @@ namespace http { __script script; __style style; __editview editview; + __editview_js editview_js; __setupadmin setupadmin; __favicon_ico favicon_ico; __welcome welcome; __mainmenu mainmenu; - __newview newview; __configure configure; __viewlist viewlist; + __workflow workflow; + __workflow_js workflow_js; }; diff --git a/HTTPServer b/HTTPServer index 0ebb4cb..44be2a9 100755 Binary files a/HTTPServer and b/HTTPServer differ diff --git a/JETServer_Programmers_Guide.tex b/JETServer_Programmers_Guide.tex new file mode 100644 index 0000000..42e9cb9 --- /dev/null +++ b/JETServer_Programmers_Guide.tex @@ -0,0 +1,86 @@ + +JETServer Programmer's Guide + +JETServer offers a unique set of tools for rapid application +deployment of complex workflows. + +Provides libraries of already created functionality that you can snap +into your website. + +Themes and theme management provide huge flexibility in style, feel and +functionality. + +Complete work flow pattern design system provides graphical tools to +create complex data flow logic around described data base entities. + +\chapter{Work Flow Concepts} + +Work Flow within a data system can primarily be described as the +activities required in accessing, maintanining and interacting with +the data base entities and managing complex activities based upon +these interactions. + +JETServer Work Flow allows you to combine various Qs (queues) to +perform various activities required in supporting workflow operations. +These Qs are: + + 1. Action Queue + 2. External Queue + 3. Decision Queue + 4. Wait Queue + 5. Process Queue + 6. Event Queue + +Each Q can have a list of associated reasons for exiting the queue and +these reasons are linked to the next queue in the flow. +Interconnecting these Qs is how work flow operations on data patterns are designed. + +Action Queue (AQ) + +This Q is the wrapper for the embedded work patterns and is the entry +point to initiate the work flow pattern. + +External Queue (XQ) + +This Q is used to interface a view on the workflows viewpoint. First +the view is rendered to XHTML and then inserted as the innerHTML on +viewpoint. + +Within the placed data is the form for generating a POST request back +to the viewpoint's associated URL to provide the user response back to +the XQ and provide the link to the next queue based upon the resulting +user response from the XQ. + +Decision Queue (DQ) + +Decision queues are basically process queues but are designed to leave +no residual actions to the data and are considered faster. The +resulting decision is returned as a path to the the next queue. + +Wait Queue (WQ) + +Wait queues provide a place to `hang' a work flow unit until another +event happens or a timeout occurs. + +If an event occurs and a work flow unit is in the wait queue and the +wait queue contains a response handler for the event then the workflow +unit will be forwarded to the linked queue for further work flow +processing. + +Process Queue (PQ) + +Process queues perform a function that produces a persistent result. +The resulting path can also be determined. + +Event Queue (EQ) + +Send a unit to an event queue to tell all waiting work flow units in +wait queues that the event has occured and to continue processing to +the the next queue. Only wait queues that have a handler for the event +type will respond. + + + + + + diff --git a/__editview.h b/__editview.h index 4f0e26c..1ba0d21 100644 --- a/__editview.h +++ b/__editview.h @@ -68,204 +68,7 @@ namespace http { data << " " << std::endl; data << " " << std::endl; data << "" << std::endl; - data << " " << std::endl; + data << " " << std::endl; httpRequest.response.addHeader("Content-Type", "script/javascript"); diff --git a/__editbiew.js b/__editview.js similarity index 100% rename from __editbiew.js rename to __editview.js diff --git a/__editview_js.h b/__editview_js.h new file mode 100644 index 0000000..4b89042 --- /dev/null +++ b/__editview_js.h @@ -0,0 +1,217 @@ +#ifndef ____editview_js_h__ +#define ____editview_js_h__ + +#include "HTTPPage.h" + +namespace http { + + class __editview_js : public HTTPPage { + + int processCommand(std::string request, core::TCPSession *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override { + data << " var mainpage;" << std::endl; + data << " var result;" << std::endl; + data << " var mousedownx;" << std::endl; + data << " var mousedowny;" << std::endl; + data << " var mouseDownWidth;" << std::endl; + data << " var mouseDownHeight;" << std::endl; + data << " var ismousedown = false;" << std::endl; + data << " var dragobject;" << std::endl; + data << " var dragHint = \"move\";" << std::endl; + data << " var data;" << std::endl; + data << " var showGrid = false;" << std::endl; + data << " var snapToGrid = false;" << std::endl; + data << " var gridSize = 10;" << std::endl; + data << " var selected;" << std::endl; + data << " var itemparameters;" << std::endl; + data << "" << std::endl; + data << " mainpage = document.getElementById(\"mainpage\");" << std::endl; + data << " data = document.getElementById(\"data\");" << std::endl; + data << " itemparameters = document.getElementById(\"itemparameters\");" << std::endl; + data << " var gridsize = document.getElementById(\"gridsize\");" << std::endl; + data << " gridsize.value = gridSize;" << std::endl; + data << " drawGrid();" << std::endl; + data << "" << std::endl; + data << " function drawGrid() {" << std::endl; + data << " var grid = document.getElementById(\"grid\");" << std::endl; + data << " var context = grid.getContext(\"2d\");" << std::endl; + data << " if(showGrid == true) {" << std::endl; + data << " context.clearRect(0,0,grid.width,grid.height);" << std::endl; + data << " context.globalAlpha = 0.2;" << std::endl; + data << " context.lineWidth = 0.5; " << std::endl; + data << " for(ix = 0; ix < grid.width; ix += gridSize) {" << std::endl; + data << " context.beginPath();" << std::endl; + data << " context.moveTo(ix, 0);" << std::endl; + data << " context.lineTo(ix, grid.height);" << std::endl; + data << " context.stroke();" << std::endl; + data << " context.beginPath();" << std::endl; + data << " context.moveTo(0, ix);" << std::endl; + data << " context.lineTo(grid.width, ix);" << std::endl; + data << " context.stroke(); " << std::endl; + data << " }" << std::endl; + data << " } else {" << std::endl; + data << " context.clearRect(0,0,grid.width,grid.height);" << std::endl; + data << " }" << std::endl; + data << " }" << std::endl; + data << "" << std::endl; + data << " function setDragHint(hint) {" << std::endl; + data << " dragHint = hint;" << std::endl; + data << " }" << std::endl; + data << " " << std::endl; + data << " function getMouseX(e) {" << std::endl; + data << " return e.clientX - mainpage.offsetLeft - parseFloat(mainpage.style.borderWidth);" << std::endl; + data << " }" << std::endl; + data << " " << std::endl; + data << " function getMouseY(e) {" << std::endl; + data << " return e.clientY - mainpage.offsetTop - parseFloat(mainpage.style.borderWidth);" << std::endl; + data << " }" << std::endl; + data << "" << std::endl; + data << " function mousedown(obj, e) {" << std::endl; + data << " var mouseX = getMouseX(e);" << std::endl; + data << " var mouseY = getMouseY(e);" << std::endl; + data << " mousedownx = mouseX - obj.offsetLeft;" << std::endl; + data << " mousedowny = mouseY - obj.offsetTop;" << std::endl; + data << " mouseDownLeft = parseFloat(obj.style.left);" << std::endl; + data << " mouseDownTop = parseFloat(obj.style.top);" << std::endl; + data << " mouseDownWidth = parseFloat(obj.style.width);" << std::endl; + data << " mouseDownHeight = parseFloat(obj.style.height);" << std::endl; + data << " dragobject = obj;" << std::endl; + data << " selected = obj;" << std::endl; + data << " ismousedown = true;" << std::endl; + data << " displayParameters();" << std::endl; + data << " }" << std::endl; + data << " " << std::endl; + data << " function mouseup() {" << std::endl; + data << " ismousedown = false;" << std::endl; + data << " dragobject = null;" << std::endl; + data << " console.log(mainpage.innerHTML);" << std::endl; + data << " }" << std::endl; + data << "" << std::endl; + data << " function mousemove(e) {" << std::endl; + data << " var mouseX = getMouseX(e);" << std::endl; + data << " var mouseY = getMouseY(e);" << std::endl; + data << " if(ismousedown) {" << std::endl; + data << " " << std::endl; + data << " if(dragHint == \"move\") {" << std::endl; + data << " if(snapToGrid == false) {" << std::endl; + data << " dragobject.style.left = (mouseX - mousedownx) + \"px\";" << std::endl; + data << " dragobject.style.top = (mouseY - mousedowny) + \"px\";" << std::endl; + data << " } else {" << std::endl; + data << " dragobject.style.left = (Math.round((mouseX - mousedownx) / gridSize) * gridSize) + \"px\";" << std::endl; + data << " dragobject.style.top = (Math.round((mouseY - mousedowny) / gridSize) * gridSize) + \"px\";" << std::endl; + data << " }" << std::endl; + data << " if((mouseX - mousedownx) < 0)" << std::endl; + data << " dragobject.style.left = \"0px\";" << std::endl; + data << " if((mouseY - mousedowny) < 0)" << std::endl; + data << " dragobject.style.top = \"0px\";" << std::endl; + data << " if((mouseX - mousedownx + parseFloat(dragobject.style.width)) > parseFloat(mainpage.style.width)) " << std::endl; + data << " dragobject.style.left = (mouseX - mousedownx) + \"px\"; " << std::endl; + data << " } else if(dragHint == \"rightbottomresize\") { " << std::endl; + data << " dragobject.style.width = (mouseX - mouseDownLeft) + \"px\";" << std::endl; + data << " dragobject.style.height = (mouseY - mouseDownTop) + \"px\";" << std::endl; + data << " } else if(dragHint == \"rightresize\") { " << std::endl; + data << " if(snapToGrid == false) {" << std::endl; + data << " dragobject.style.width = (mouseX - mouseDownLeft) + \"px\"; " << std::endl; + data << " } else {" << std::endl; + data << " dragobject.style.width = (Math.round((mouseX - mouseDownLeft) / gridSize) * gridSize) + \"px\"; " << std::endl; + data << " }" << std::endl; + data << " } else if(dragHint == \"bottomresize\") { " << std::endl; + data << " if(snapToGrid == false) {" << std::endl; + data << " dragobject.style.height = (mouseY - mouseDownTop) + \"px\";" << std::endl; + data << " } else {" << std::endl; + data << " dragobject.style.height = (Math.round((mouseY - mouseDownTop) / gridSize) * gridSize) + \"px\";" << std::endl; + data << " }" << std::endl; + data << " } else if(dragHint == \"leftresize\") { " << std::endl; + data << " dragobject.style.left = mouseX + \"px\";" << std::endl; + data << " dragobject.style.width = (mouseDownWidth + (mouseDownLeft - mouseX)) + \"px\";" << std::endl; + data << " } else if(dragHint == \"topresize\") { " << std::endl; + data << " dragobject.style.top = mouseY + \"px\";" << std::endl; + data << " dragobject.style.height = (mouseDownHeight + (mouseDownTop - mouseY)) + \"px\";" << std::endl; + data << " }" << std::endl; + data << " " << std::endl; + data << " data.innerHTML = \"
\" + dragobject.nodeName + \"
\" + " << std::endl;
+ data << " \"Action: \" + dragHint + \"
\" +" << std::endl;
+ data << " \"MouseLocation: \" + mouseX + \":\" + mouseY + \"
\" +" << std::endl;
+ data << " \"MouseOver Location: \" + (mouseX - dragobject.offsetLeft) + \":\" + (mouseY - dragobject.offsetTop) + \"
\" + " << std::endl;
+ data << " \"Location: \" + dragobject.style.left + \":\" + dragobject.style.top + \"
\" + " << std::endl;
+ data << " \"Size: \" + dragobject.style.width + \":\" + dragobject.style.height + \"
\" + " << std::endl;
+ data << " \"
\" + mouseabove.nodeName + \"
\" + " << std::endl;
+ data << " \"Action: \" + dragHint + \"
\" +" << std::endl;
+ data << " \"MouseLocation: \" + mouseX + \":\" + mouseY + \"
\" +" << std::endl;
+ data << " \"MouseOver Location: \" + (mouseX - mouseabove.offsetLeft) + \":\" + (mouseY - mouseabove.offsetTop) + \"
\" + " << std::endl;
+ data << " \"Location: \" + mouseabove.style.left + \":\" + mouseabove.style.top + \"
\" + " << std::endl;
+ data << " \"Size: \" + mouseabove.style.width + \":\" + mouseabove.style.height + \"
\" + " << std::endl;
+ data << " \"
\" + selected.nodeName + \": \" + selected.id + \"
\" + " << std::endl;
+ data << " \"Location: \" + selected.style.left + \":\" + selected.style.top + \"
\" + " << std::endl;
+ data << " \"Size: \" + selected.style.width + \":\" + selected.style.height + \"
\" + " << std::endl;
+ data << " \"