diff --git a/Tag.cpp b/Tag.cpp index 0975404..53ed10e 100644 --- a/Tag.cpp +++ b/Tag.cpp @@ -1254,6 +1254,17 @@ namespace jet { (*global.sessionFile)[sessionName] = value; return; } + if(coreutils::MString(scope).toLower() == "session") { + // - the supported way to write a + // session variable (sessionctl's and the "@name" prefix + // above are deprecated). Any name, no '@'. Copied into its own + // MString for the same JString::locate() reason as above. + coreutils::MString sessionName(variable); + if(global.sessionFile == NULL) + throw coreutils::Exception("scope=\"session\" requested but no session is active (missing sessiondir keyword, or cgi mode is off)."); + (*global.sessionFile)[sessionName] = value; + return; + } if((scope == "global") || (scope == "")) global.variables[variable] = value; else if(scope == "local") { @@ -1309,38 +1320,19 @@ namespace jet { } void Tag::storeVariable(coreutils::ZString variable) { - if(keywordDefined("expr")) { - if(!keywordDefined("scope") || (resolveKeyword("scope").toLower() == "global")) - assignVariable(variable, Operand(keywords["expr"], *this).string, "global"); - else if(resolveKeyword("scope").toLower() == "local") - assignVariable(variable, Operand(keywords["expr"], *this).string, "local"); - else if(resolveKeyword("scope").toLower() == "parent") - assignVariable(variable, Operand(keywords["expr"], *this).string, "parent"); - } else if(hasContainer) { + coreutils::MString scope("global"); + if(keywordDefined("scope")) + scope = resolveKeyword("scope").toLower(); + if(keywordDefined("expr")) + assignVariable(variable, Operand(keywords["expr"], *this).string, scope); + else if(hasContainer) { processContainer(container); - if(evaluate) { - if(!keywordDefined("scope") || (resolveKeyword("scope").toLower() == "global")) - assignVariable(variable, out, "global"); - else if(resolveKeyword("scope").toLower() == "local") - assignVariable(variable, out, "local"); - else if(resolveKeyword("scope").toLower() == "parent") - assignVariable(variable, out, "parent"); - } else { - if(!keywordDefined("scope") || (resolveKeyword("scope").toLower() == "global")) - assignVariable(variable, container, "global"); - else if(resolveKeyword("scope").toLower() == "local") - assignVariable(variable, container, "local"); - else if(resolveKeyword("scope").toLower() == "parent") - assignVariable(variable, container, "parent"); - } - } else { - if(!keywordDefined("scope") || (resolveKeyword("scope").toLower() == "global")) - assignVariable(variable, resolveKeyword("value"), "global"); - else if(resolveKeyword("scope").toLower() == "local") - assignVariable(variable, resolveKeyword("value"), "local"); - else if(resolveKeyword("scope").toLower() == "parent") - assignVariable(variable, resolveKeyword("value"), "parent"); - } + if(evaluate) + assignVariable(variable, out, scope); + else + assignVariable(variable, container, scope); + } else + assignVariable(variable, resolveKeyword("value"), scope); } coreutils::MString Tag::processModifier(coreutils::MString &value, coreutils::MString &modifier) { diff --git a/docs/JetCore.pdf b/docs/JetCore.pdf index d60d536..026da6c 100644 Binary files a/docs/JetCore.pdf and b/docs/JetCore.pdf differ diff --git a/docs/JetCore.tex b/docs/JetCore.tex index 5a43435..61d713f 100644 --- a/docs/JetCore.tex +++ b/docs/JetCore.tex @@ -95,9 +95,12 @@ specifying the scope of global. \item Keyword - within a tag's container we may access the keyword values specified on the containing tag. -\item Environment - +\item Session - values stored in the session file with the set tag and +a scope of session. They persist across requests from the same browser. -\item CGI Variables - +\item Environment - + +\item CGI Variables - \end{itemize} @@ -120,6 +123,32 @@ the container where they are defined. Some containers may not be capable of storing local variables (i.e. set tag) and are inheriting the local scope from their parent tag. +\section{Session Variables} + +Session variables are stored in the session file for the current +session and remain available to later requests from the same browser. +Session control must be enabled (see Session Control). + +A session variable is written with the set tag and a scope of +session: + +\begin{verbatim} + +\end{verbatim} + +The name can be any variable name. It does not need an @ prefix. +Session variables are read with the \$[@name] syntax, for example +\$[@\_login\_id]. + +Setting a session variable does not also set a global variable of +the same name. When the same request needs to read the value as +\$[name], set it with both scopes: + +\begin{verbatim} + + +\end{verbatim} + \section{Keyword Variables} Keyword variables are set when they are specified on a containing tag. @@ -299,8 +328,16 @@ into the directory named after the token. Captured session data will become available to future requests coming into the server and made available through the variable formats for the session. -The tag will also have an additional scope value that can be -used to store the value in the session. This is scope="session". +Under APIServer, session control is enabled for a site by its +sessionDir setting in the server configuration instead of the +tag. + +Use the tag with scope="session" to store a value in the +session, and \$[@name] to read it back (see Session Variables). + +The session tags in SESSIONCTL.tag are deprecated for session +management. Its setenv tag has been removed, and the startsession and +endsession tags are no longer provided. Use scope="session" instead. @@ -488,7 +525,16 @@ value container -scope +scope - where the variable is stored. The values are: + +\begin{itemize} +\item global - the default. Available to all logic for the rest of the +request. +\item local - available only within the container where it is set. +\item parent - stored in the scope of the enclosing tag. +\item session - stored in the session file and kept across requests. +Requires session control. See Session Variables. +\end{itemize} \section{sql} diff --git a/jetc/barant-site/src/SESSIONCTL.tag b/jetc/barant-site/src/SESSIONCTL.tag index 6283969..f250733 100755 --- a/jetc/barant-site/src/SESSIONCTL.tag +++ b/jetc/barant-site/src/SESSIONCTL.tag @@ -113,12 +113,6 @@ document.forms[0].requestSubmit();">   - - - - - - diff --git a/jetc/barant-site/src/crystal.page b/jetc/barant-site/src/crystal.page index 77b874c..1ec0066 100755 --- a/jetc/barant-site/src/crystal.page +++ b/jetc/barant-site/src/crystal.page @@ -1,7 +1,7 @@ CRYSTAL - +

Coming soon. High security communications apps for iPhone and diff --git a/jetc/barant-site/src/login.method b/jetc/barant-site/src/login.method index 33731de..b08a1c8 100755 --- a/jetc/barant-site/src/login.method +++ b/jetc/barant-site/src/login.method @@ -8,11 +8,11 @@ - $[login_id] - $[login_name] - $[login_email] - $[login_type] - $[login_uuid] + + + + + update users set last_login=now() where id=$[login_id] select group_concat(to_base64(host),':',to_base64(email),':',to_base64(password) order by id separator ';') as accounts_list, (select host from email_accounts where user_id=$[login_id] order by id limit 1) as first_host, diff --git a/jetc/barant-site/src/login.page b/jetc/barant-site/src/login.page index 2c161f9..1e5faaf 100755 --- a/jetc/barant-site/src/login.page +++ b/jetc/barant-site/src/login.page @@ -1,7 +1,7 @@ LOGIN -$[start:0] +

Please enter your information below to login.

diff --git a/jetc/barant-site/src/main.page b/jetc/barant-site/src/main.page index 92c7788..cad6d8c 100755 --- a/jetc/barant-site/src/main.page +++ b/jetc/barant-site/src/main.page @@ -1,7 +1,7 @@ BARANT Technology Group - +
diff --git a/jetc/barant-site/src/make_invoice.method b/jetc/barant-site/src/make_invoice.method index 40e4114..8efba15 100755 --- a/jetc/barant-site/src/make_invoice.method +++ b/jetc/barant-site/src/make_invoice.method @@ -52,7 +52,7 @@ Payment already processed. select last_insert_id() as invoice_id - $[invoice_id] + diff --git a/jetc/barant-site/src/modular1_patches.page b/jetc/barant-site/src/modular1_patches.page index 52e29e2..bf9ea54 100755 --- a/jetc/barant-site/src/modular1_patches.page +++ b/jetc/barant-site/src/modular1_patches.page @@ -16,7 +16,7 @@ audio.play(); } - +
diff --git a/jetc/barant-site/src/projman.page b/jetc/barant-site/src/projman.page index d5fd4d2..d2503f0 100755 --- a/jetc/barant-site/src/projman.page +++ b/jetc/barant-site/src/projman.page @@ -3,7 +3,7 @@ PROJECT MANAGER - projman.bar +

An advanced project management methodology not unlike Agile but with a better definition towards software development and the release diff --git a/jetc/barant-site/src/selectproduct.proc b/jetc/barant-site/src/selectproduct.proc index a52583e..67972a3 100644 --- a/jetc/barant-site/src/selectproduct.proc +++ b/jetc/barant-site/src/selectproduct.proc @@ -1,3 +1,3 @@ - $[sku] + diff --git a/jetc/barant-site/src/selectproject.proc b/jetc/barant-site/src/selectproject.proc index bd7e305..d4f4bfe 100755 --- a/jetc/barant-site/src/selectproject.proc +++ b/jetc/barant-site/src/selectproject.proc @@ -6,7 +6,7 @@ join users on projects.owner_id=users.id where projects.id=$[project_id] $[sqlerror] -$[project_id] -$[projman.text] -projman.bar + + + diff --git a/jetc/barant-site/src/selectrequest.proc b/jetc/barant-site/src/selectrequest.proc index 183c40f..2cfc27f 100755 --- a/jetc/barant-site/src/selectrequest.proc +++ b/jetc/barant-site/src/selectrequest.proc @@ -1,3 +1,3 @@ -$[request_id] + \ No newline at end of file diff --git a/jetc/barant-site/src/selecttask.proc b/jetc/barant-site/src/selecttask.proc index ad97ca3..a4b577f 100755 --- a/jetc/barant-site/src/selecttask.proc +++ b/jetc/barant-site/src/selecttask.proc @@ -9,8 +9,8 @@ join projects on requests.project_id=projects.id where tasks.id=$[task_id] -$[task_id] -$[projman.request_id] -$[projman.project_id] -$[projman.title] + + + + diff --git a/jetc/barant-site/src/services.page b/jetc/barant-site/src/services.page index 846734c..bfec466 100755 --- a/jetc/barant-site/src/services.page +++ b/jetc/barant-site/src/services.page @@ -1,7 +1,7 @@ BARANT Technology Group - +

diff --git a/jetc/barant-site/src/setplayerstate.proc b/jetc/barant-site/src/setplayerstate.proc index 79af9a0..f6ff759 100644 --- a/jetc/barant-site/src/setplayerstate.proc +++ b/jetc/barant-site/src/setplayerstate.proc @@ -1 +1 @@ -$[state] + diff --git a/jetc/barant-site/src/setvolume.proc b/jetc/barant-site/src/setvolume.proc index b430713..34f1418 100644 --- a/jetc/barant-site/src/setvolume.proc +++ b/jetc/barant-site/src/setvolume.proc @@ -1 +1 @@ -$[volume] + diff --git a/jetc/barant-site/src/wordpress.page b/jetc/barant-site/src/wordpress.page index dea59a8..ef8d315 100755 --- a/jetc/barant-site/src/wordpress.page +++ b/jetc/barant-site/src/wordpress.page @@ -1,7 +1,7 @@ Wordpress Plugins - +
diff --git a/jetc/qualityiron-site/src/SESSIONCTL.tag b/jetc/qualityiron-site/src/SESSIONCTL.tag index 6283969..f250733 100755 --- a/jetc/qualityiron-site/src/SESSIONCTL.tag +++ b/jetc/qualityiron-site/src/SESSIONCTL.tag @@ -113,12 +113,6 @@ document.forms[0].requestSubmit();">   - - - - - - diff --git a/jetc/qualityiron-site/src/login.method b/jetc/qualityiron-site/src/login.method index 9dd2051..5bf6cb1 100644 --- a/jetc/qualityiron-site/src/login.method +++ b/jetc/qualityiron-site/src/login.method @@ -6,9 +6,9 @@ - $[_login_id] - $[_login_name] - $[_login_email] + + + update users set last_login=now() where id=$[_login_id] diff --git a/jetc/qualityiron-site/src/logout.proc b/jetc/qualityiron-site/src/logout.proc index 5ef7851..39cd2be 100644 --- a/jetc/qualityiron-site/src/logout.proc +++ b/jetc/qualityiron-site/src/logout.proc @@ -1,6 +1,6 @@ - - - + + + diff --git a/jetc/qualityiron-site/src/selectcontractor.proc b/jetc/qualityiron-site/src/selectcontractor.proc index 0d45284..34ca3c0 100644 --- a/jetc/qualityiron-site/src/selectcontractor.proc +++ b/jetc/qualityiron-site/src/selectcontractor.proc @@ -1,3 +1,3 @@ -$[selected_contractor_id] + diff --git a/jetc/qualityiron-site/src/selectcustomer.proc b/jetc/qualityiron-site/src/selectcustomer.proc index e82ebb1..d96a218 100644 --- a/jetc/qualityiron-site/src/selectcustomer.proc +++ b/jetc/qualityiron-site/src/selectcustomer.proc @@ -1,3 +1,3 @@ -$[selected_customer_id] + diff --git a/jetc/qualityiron-site/src/selectjob.proc b/jetc/qualityiron-site/src/selectjob.proc index b31369e..5da757c 100644 --- a/jetc/qualityiron-site/src/selectjob.proc +++ b/jetc/qualityiron-site/src/selectjob.proc @@ -1,3 +1,3 @@ -$[selected_job_id] + diff --git a/jetc/qualityiron-site/src/selectuser.proc b/jetc/qualityiron-site/src/selectuser.proc index 8484a5f..c4015ec 100644 --- a/jetc/qualityiron-site/src/selectuser.proc +++ b/jetc/qualityiron-site/src/selectuser.proc @@ -1,3 +1,3 @@ -$[selected_user_id] +