Skip to content

Commit 0d82f63

Browse files
^WebTerminal global mapping
1 parent b8287dd commit 0d82f63

File tree

6 files changed

+22
-21
lines changed

6 files changed

+22
-21
lines changed

export/WebTerminal/Autocomplete.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<Method name="AutocompleteExists">
99
<FormalSpec>namespace:%String</FormalSpec>
1010
<ReturnType>%Boolean</ReturnType>
11-
<Implementation><![CDATA[ quit $get(^%WebTerminal.Autocomplete(namespace)) '= ""
11+
<Implementation><![CDATA[ quit $get(^WebTerminal("Autocomplete", namespace)) '= ""
1212
]]></Implementation>
1313
</Method>
1414

@@ -114,7 +114,7 @@ system classes generates one time and forever.
114114
if ('genSystem) set ac = ac _ ",""global"":" _ ..getGlobalsJSON()
115115
set ac = ac _ "}"
116116
117-
set ^%WebTerminal.Autocomplete(trueNs) = ac
117+
set ^WebTerminal("Autocomplete", trueNs) = ac
118118
119119
do ..SendData($C(13, 10))
120120
do ..SendData("33", ..#ClientOutputLocalized)
@@ -132,7 +132,7 @@ Returns terminal to default state</Description>
132132
<ReturnType>%Status</ReturnType>
133133
<Implementation><![CDATA[
134134
// delete autocompletion files
135-
kill ^%WebTerminal.Autocomplete
135+
kill ^WebTerminal("Autocomplete")
136136
quit $$$OK
137137
]]></Implementation>
138138
</Method>

export/WebTerminal/Engine.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,9 @@ the client - it includes authorization key.</Description>
477477
/*
478478
* Find given CSPSessionCookie in WebTerminal auth global. If found, grant access.
479479
*/
480-
SET key = $ORDER(^%WebTerminal.AuthUser(""))
480+
SET key = $ORDER(^WebTerminal("AuthUser", ""))
481481
WHILE (key '= "") {
482-
set lb = $GET(^%WebTerminal.AuthUser(key))
482+
set lb = $GET(^WebTerminal("AuthUser", key))
483483
if ((lb '= "") && (key = authKey)) {
484484
485485
// setup privileges
@@ -493,7 +493,7 @@ the client - it includes authorization key.</Description>
493493
set namespace = $case(namespace, "":userProps("NameSpace"), :namespace)
494494
set loginStatus = $System.Security.Login(username) // login user
495495
496-
kill ^%WebTerminal.AuthUser(key)
496+
kill ^WebTerminal("AuthUser", key)
497497
498498
set ok = loginStatus
499499
@@ -502,10 +502,10 @@ the client - it includes authorization key.</Description>
502502
// kill "old" auth tickets
503503
set time = $LISTGET(lb, 2)
504504
if (time '= "") && ($System.SQL.DATEDIFF("s", time, $h) > 100) { // if older than 100 sec
505-
kill ^%WebTerminal.AuthUser(key)
505+
kill ^WebTerminal("AuthUser", key)
506506
}
507507
508-
SET key = $ORDER(^%WebTerminal.AuthUser(key))
508+
SET key = $ORDER(^WebTerminal("AuthUser", key))
509509
}
510510
511511
if (namespace '= "") {

export/WebTerminal/Installer.xml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This method is invoked when a class is compiled.</Description>
2323
<FormalSpec><![CDATA[cls:%String,&params]]></FormalSpec>
2424
<ReturnType>%Status</ReturnType>
2525
<Implementation><![CDATA[
26-
set ns = $NAMESPACE
26+
set ns = $NAMESPACE // has to be package home namespace!
2727
zn:ns'="%SYS" "%SYS"
2828
do ##class(Security.System).GetInstallationSecuritySetting(.security)
2929
set cspProperties("AutheEnabled") = 32 // password by default, 64 for no password
@@ -73,9 +73,9 @@ This method is invoked when a class is compiled.</Description>
7373
continue:(ns = value)
7474
w " ", value
7575
set status = ##Class(Config.MapPackages).Create(value, "WebTerminal", .Properties)
76-
if ($$$ISERR(status)) {
77-
do $SYSTEM.Status.DisplayError(status)
78-
}
76+
if ($$$ISERR(status)) { do $SYSTEM.Status.DisplayError(status) }
77+
set status = ##Class(Config.MapGlobals).Create(value, "WebTerminal", .Properties)
78+
if ($$$ISERR(status)) { do $SYSTEM.Status.DisplayError(status) }
7979
}
8080
w ".", !, "Mapping complete."
8181
w !, "WebTerminal package successfully mapped into all namespaces."
@@ -91,7 +91,7 @@ This method is invoked when a class is 'uncompiled'.</Description>
9191
<FormalSpec><![CDATA[cls:%String,&params,recompile:%Boolean]]></FormalSpec>
9292
<ReturnType>%Status</ReturnType>
9393
<Implementation><![CDATA[
94-
set ns = $NAMESPACE
94+
set ns = $NAMESPACE // has to be package home namespace!
9595
zn:ns'="%SYS" "%SYS"
9696
if (##class(Security.Applications).Exists("/terminal")) {
9797
do ##class(Security.Applications).Get("/terminal", .props)
@@ -112,13 +112,14 @@ This method is invoked when a class is 'uncompiled'.</Description>
112112
continue:(ns = value)
113113
w " ", value
114114
set status = ##Class(Config.MapPackages).Delete(value, "WebTerminal")
115-
if ($$$ISERR(status)) {
116-
do $SYSTEM.Status.DisplayError(status)
117-
}
115+
if ($$$ISERR(status)) { do $SYSTEM.Status.DisplayError(status) }
116+
set status = ##Class(Config.MapGlobals).Delete(value, "WebTerminal")
117+
if ($$$ISERR(status)) { do $SYSTEM.Status.DisplayError(status) }
118118
}
119119
w ".", !, "Unmapping complete."
120-
kill ^%WebTerminal.Autocomplete
121120
zn:ns'="%SYS" ns
121+
kill ^WebTerminal
122+
w !, "Global ^WebTerminal removed."
122123
QUIT $$$OK
123124
]]></Implementation>
124125
</Method>

export/WebTerminal/Router.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Method returns autocomplete data in JSON format</Description>
3030
set namespace = %request.Get("NS", $znspace)
3131
set %response.CharSet = "utf-8"
3232
set %response.ContentType = "application/json"
33-
write $get(^%WebTerminal.Autocomplete(namespace), "{}")
33+
write $get(^WebTerminal("Autocomplete", namespace), "{}")
3434
return $$$OK
3535
]]></Implementation>
3636
</Method>
@@ -102,7 +102,7 @@ Method writes application HTML.</Description>
102102
<Implementation><![CDATA[
103103
set cookie = %session.CSPSessionCookie
104104
// Put the name of authorized user in a global to authorize WebSocket WebTerminal connection
105-
set ^%WebTerminal.AuthUser(cookie) = $LB(
105+
set ^WebTerminal("AuthUser", cookie) = $LB(
106106
$LISTGET(%session.SecurityContext, 1), // username
107107
$horolog // granting ticket date
108108
)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "Cache WEB Terminal",
44
"description": "Web-based terminal emulator for Caché administering.",
55
"author": "ZitRo",
6-
"version": "3.1.7",
6+
"version": "3.1.8",
77
"releaseNumber": 18,
88
"repository": {
99
"type": "git",

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and import XML file into %SYS namespace. Later you can update application only b
99

1010
### Usage
1111
After installation, you will be able to access application at `http://[host]:[port]/terminal/` (slash at the end is required).
12-
Type "/help" there to get more information.
12+
Type `/help` there to get more information.
1313

1414
### Features
1515
<table>

0 commit comments

Comments
 (0)