From 17d48ed40f3829266e4554f18650ce0967442368 Mon Sep 17 00:00:00 2001 From: eduard93 Date: Sat, 12 Dec 2015 19:37:18 +0300 Subject: [PATCH 1/2] For https://github.com/intersystems-ru/webterminal/issues/41 --- export/template.xml | 234 ++++++++++++++++++++++---------------------- 1 file changed, 117 insertions(+), 117 deletions(-) diff --git a/export/template.xml b/export/template.xml index 825a7ca..b95d0b6 100644 --- a/export/template.xml +++ b/export/template.xml @@ -20,130 +20,130 @@ How long to wait for authorization key when connection established 5 - + %Char -"EXEC" - +EXEC + - + %Char -"SQL" - +SQL + - + %Char -"AC" - +AC + - + %Char -"TRACE" - +TRACE + - + %Char -"STOP_TRACE_ALL" - +STOP_TRACE_ALL + - + %Char -"CT" - +CT + - + %Char -"R" - +R + - + %Char -"E" - +E + - + %Char -"CU" - +CU + - + %Char -"U" - +U + - + %String -"PROMPT#" - +PROMPT# + - + %String -"EST#" - +EST# + - + %String -"END#" - +END# + - + %String -"O#" - +O# + - + %String -"OL#" - +OL# + - + %String -"NS#" - +NS# + - + %String -"AC#" - +AC# + - + %String -"R#" - +R# + - + %String -"RC#" - +RC# + - + %String -"AUTH#" - +AUTH# + - + %String -"TRACE#" - +TRACE# + - + %String -"STOP_TRACE#" - +STOP_TRACE# + - + %String -"I#" - +I# + - + %String -"CLRSCR#" - +CLRSCR# + - + %String -"PROMPT_UPDATE#" - +PROMPT_UPDATE# + set ..Watches = ..Watches _ $LISTBUILD(name) set ..WatchesCaret(name,0) = $QUERY(@name@(""),-1) // last set ..WatchesCaret(name,1) = "?" - do ..SendData(name, ..ConstClientTrace) + do ..SendData(name, ..#ConstClientTrace) q 1 } } else { // watch file @@ -446,7 +446,7 @@ Returns status of this operation set file = ##class(%File).%New(name) set ..WatchesCaret(name,0) = file.Size // current watch cursor position set ..WatchesCaret(name,1) = file.DateModified - do ..SendData(name, ..ConstClientTrace) + do ..SendData(name, ..#ConstClientTrace) q 1 } } @@ -469,7 +469,7 @@ Returns success status set ..Watches = $LISTFROMSTRING($EXTRACT(newWatches, 2, *-1), s) if (watches '= newWatches) { k ..WatchesCaret(name) // really removed - do ..SendData(name, ..ConstClientStopTrace) + do ..SendData(name, ..#ConstClientStopTrace) } quit watches '= newWatches ]]> @@ -635,11 +635,11 @@ system classes generates one time and forever. @@ -754,7 +754,7 @@ Function sends data derectly to server with specified action query:%String="",action:%String="" %Status @@ -788,7 +788,7 @@ Sends to client new namespace if last was changed @@ -798,7 +798,7 @@ Sends to client new namespace if last was changed Starts clear I/O mode @@ -810,7 +810,7 @@ Ends clear I/O mode @@ -834,7 +834,7 @@ This method transforms error do ..SendData($C(27)_"[32mOK" _ $C(27) _ "[0m") if ($isobject(httprequest.HttpResponse.Data)) { do ..SendData($C(13,10)) - do ..SendData("35", ..ConstClientOutputLocalized) + do ..SendData("35", ..#ConstClientOutputLocalized) do ..SendData($C(13,10)) set stload = $system.OBJ.LoadStream(httprequest.HttpResponse.Data,"",.error,.items) if $$$ISERR(stload) { do ..SendData(System.Status.GetErrorText(stload)) quit $$$NOTOK } @@ -873,7 +873,7 @@ This method transforms error quit $$$NOTOK } if ($isobject(httprequest.HttpResponse.Data)) { - do ..SendData(httprequest.HttpResponse.Data.Read(), ..ConstClientPromptUpdate) + do ..SendData(httprequest.HttpResponse.Data.Read(), ..#ConstClientPromptUpdate) } quit $$$OK ]]> @@ -977,7 +977,7 @@ Main method for every new client. kill // clear junk vars - do ..SendData($NAMESPACE, ..ConstClientPrompt) + do ..SendData($NAMESPACE, ..#ConstClientPrompt) for { @@ -986,7 +986,7 @@ Main method for every new client. if $$$ISERR(status) { try { - do ..SendData("40", ..ConstClientOutputLocalized) + do ..SendData("40", ..#ConstClientOutputLocalized) } catch e { } quit:($$$GETERRORCODE(status)=$$$CSPWebSocketClosed) @@ -996,78 +996,78 @@ Main method for every new client. set action = $EXTRACT(data, 1, pos-2) set data = $EXTRACT(data, pos, *) - if (action = ..ConstServerActionExecute) { + if (action = ..#ConstServerActionExecute) { do ..ExecuteCommand(data) - do ..SendData($NAMESPACE, ..ConstClientPrompt) + do ..SendData($NAMESPACE, ..#ConstClientPrompt) - } elseif (action = ..ConstServerActionCheckTrace) { + } elseif (action = ..#ConstServerActionCheckTrace) { set changes = ..CheckTracing() if (changes '= "") { do ..SendData(changes) } - } elseif (action = ..ConstServerActionTrace) { // add/remove + } elseif (action = ..#ConstServerActionTrace) { // add/remove set result = ..Trace(data) if ('$$$ISOK(result)) { set result = ..StopTracing(data) if ('$$$ISOK(result)) { - do ..SendData("!" _ data, ..ConstClientTrace) + do ..SendData("!" _ data, ..#ConstClientTrace) } } - do ..SendData($NAMESPACE, ..ConstClientPrompt) + do ..SendData($NAMESPACE, ..#ConstClientPrompt) - } elseif (action = ..ConstServerActionStopTraceAll) { // add/remove + } elseif (action = ..#ConstServerActionStopTraceAll) { // add/remove for i=1:1:$LISTLENGTH(..Watches) { d ..StopTracing($LIST(..Watches, i)) } - do ..SendData($NAMESPACE, ..ConstClientPrompt) + do ..SendData($NAMESPACE, ..#ConstClientPrompt) - } elseif (action = ..ConstServerActionExecuteSQL) { // sql + } elseif (action = ..#ConstServerActionExecuteSQL) { // sql do ..ExecuteSQL(data) - do ..SendData($NAMESPACE, ..ConstClientPrompt) + do ..SendData($NAMESPACE, ..#ConstClientPrompt) - } elseif (action = ..ConstServerActionGenerateAutocomplete) { + } elseif (action = ..#ConstServerActionGenerateAutocomplete) { // data shows if system classes required if ('..AutocompleteExists("%")) || (data = "1") { do ..GenerateAutocomplete("%SYS", 1) - do ..SendData("%", ..ConstClientLoadAutocomplete) + do ..SendData("%", ..#ConstClientLoadAutocomplete) } do ..GenerateAutocomplete(..CurrentNamespace, 0) - do ..SendData(..CurrentNamespace, ..ConstClientLoadAutocomplete) + do ..SendData(..CurrentNamespace, ..#ConstClientLoadAutocomplete) - } elseif (action = ..ConstServerActionReset) { + } elseif (action = ..#ConstServerActionReset) { do ..Reset() - do ..SendData($NAMESPACE, ..ConstClientPrompt) + do ..SendData($NAMESPACE, ..#ConstClientPrompt) - } elseif (action = ..ConstServerActionEcho) { + } elseif (action = ..#ConstServerActionEcho) { do ..StartClearIO() write data do ..EndClearIO() - do ..SendData($NAMESPACE, ..ConstClientPrompt) + do ..SendData($NAMESPACE, ..#ConstClientPrompt) - } elseif (action = ..ConstServerActionCheckUpdate) { + } elseif (action = ..#ConstServerActionCheckUpdate) { do ..CheckUpdate() - } elseif (action = ..ConstServerActionUpdate) { + } elseif (action = ..#ConstServerActionUpdate) { do ..Update(data) - do ..SendData("39", ..ConstClientOutputLocalized) + do ..SendData("39", ..#ConstClientOutputLocalized) } else { // something scary - do ..SendData("38", ..ConstClientOutputLocalized) + do ..SendData("38", ..#ConstClientOutputLocalized) do ..SendData(" " _ action) - do ..SendData($NAMESPACE, ..ConstClientPrompt) + do ..SendData($NAMESPACE, ..#ConstClientPrompt) } @@ -1086,15 +1086,15 @@ New connection established: require auth key, login and start client loop. Date: Sun, 13 Dec 2015 14:31:13 +0300 Subject: [PATCH 2/2] $System usage unification --- export/template.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/export/template.xml b/export/template.xml index b95d0b6..72f6318 100644 --- a/export/template.xml +++ b/export/template.xml @@ -848,10 +848,10 @@ This method transforms error do ..SendData($C(13,10)) do ..SendData("35", ..#ConstClientOutputLocalized) do ..SendData($C(13,10)) - set stload = $system.OBJ.LoadStream(httprequest.HttpResponse.Data,"",.error,.items) - if $$$ISERR(stload) { do ..SendData(System.Status.GetErrorText(stload)) quit $$$NOTOK } - set st2 = $system.OBJ.CompileList(.items) - if $$$ISERR(st2) { do ..SendData(System.Status.GetErrorText(st2)) quit $$$NOTOK } + set stload = $System.OBJ.LoadStream(httprequest.HttpResponse.Data,"",.error,.items) + if $$$ISERR(stload) { do ..SendData($System.Status.GetErrorText(stload)) quit $$$NOTOK } + set st2 = $System.OBJ.CompileList(.items) + if $$$ISERR(st2) { do ..SendData($System.Status.GetErrorText(st2)) quit $$$NOTOK } if $$$ISERR(error) { do ..SendData($C(27)_"[31mFAILED" _ $C(27) _ "[0m" _ $C(13,10)) quit $$$NOTOK @@ -942,7 +942,7 @@ the client - it includes authorization key. continue:($order(userProps("")) = "") set namespace = $case(namespace, "":userProps("NameSpace"), :namespace) - set loginStatus = ##class(%SYSTEM.Security).Login(username) // login user + set loginStatus = $System.Security.Login(username) // login user kill ^%WebTerminal.AuthUser(key) @@ -952,7 +952,7 @@ the client - it includes authorization key. // kill "old" auth tickets set time = $LISTGET(lb, 2) - if (time '= "") && ($SYSTEM.SQL.DATEDIFF("s", time, $h) > 100) { // if older than 100 sec + if (time '= "") && ($System.SQL.DATEDIFF("s", time, $h) > 100) { // if older than 100 sec kill ^%WebTerminal.AuthUser(key) } @@ -1163,7 +1163,7 @@ This method is invoked when a class is compiled. set Properties("TempGlobals") = "CACHETEMP" set status = ##Class(Config.Namespaces).Create("%All", .Properties) if ($$$ISERR(status)) { - do $SYSTEM.Status.DisplayError(status) + do $System.Status.DisplayError(status) quit status } else { w !, "%All namespace is created."