|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
2 |
| -<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2015.1.1 (Build 505U)" ts="2015-12-20 11:26:48"> |
| 2 | +<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2015.1.1 (Build 505U)" ts="2015-12-20 13:41:12"> |
3 | 3 | <Class name="WebTerminal.Engine">
|
4 | 4 | <Description>
|
5 | 5 | Cache WEB Terminal version X.X.X/*build.replace:pkg.version*/ core.
|
6 | 6 | This class is the server-side core of the terminal application.</Description>
|
7 |
| -<Super>%CSP.WebSocket,Common,Trace</Super> |
8 |
| -<TimeChanged>63906,40862.530498</TimeChanged> |
| 7 | +<Super>%CSP.WebSocket,Trace,Autocomplete</Super> |
| 8 | +<TimeChanged>63906,49223.903226</TimeChanged> |
9 | 9 | <TimeCreated>63891,56786.028532</TimeCreated>
|
10 | 10 |
|
11 | 11 | <Property name="SharedConnection">
|
@@ -279,160 +279,6 @@ rchr(timeout = 86400, data)
|
279 | 279 | ]]></Implementation>
|
280 | 280 | </Method>
|
281 | 281 |
|
282 |
| -<Method name="getGlobalsJSON"> |
283 |
| -<ClassMethod>1</ClassMethod> |
284 |
| -<FormalSpec>namespace:%String</FormalSpec> |
285 |
| -<ReturnType>%String</ReturnType> |
286 |
| -<Implementation><![CDATA[ |
287 |
| -
|
288 |
| - set out = "{" |
289 |
| - set rset=##class(%ResultSet).%New("%SYS.GlobalQuery:NameSpaceList") |
290 |
| - set sc=rset.Execute($ZNSPACE,"*",0) |
291 |
| - while (rset.Next()) { |
292 |
| - set out = out _ """" _ $Piece(rset.GetData(1),"(",1) _ """:0," |
293 |
| - } |
294 |
| - set out = $EXTRACT(out,1,$LENGTH(out)-1) _ "}" |
295 |
| -
|
296 |
| - // todo: |
297 |
| - // Set Rset = ##class(%Library.ResultSet).%New("%SYS.GlobalQuery:NameSpaceListChui") |
298 |
| - // s Status=Rset.Execute(NameSpace,Mask,SystemGlobals,.UnavailableDatabases) |
299 |
| -
|
300 |
| - q out |
301 |
| -]]></Implementation> |
302 |
| -</Method> |
303 |
| - |
304 |
| -<Method name="AutocompleteExists"> |
305 |
| -<FormalSpec>namespace:%String</FormalSpec> |
306 |
| -<ReturnType>%Boolean</ReturnType> |
307 |
| -<Implementation><![CDATA[ quit $get(^%WebTerminal.Autocomplete(namespace)) '= "" |
308 |
| -]]></Implementation> |
309 |
| -</Method> |
310 |
| - |
311 |
| -<Method name="GenerateAutocomplete"> |
312 |
| -<Description> |
313 |
| -Generates autocomplete for namespace. Second parameter decides if |
314 |
| -it will be regenerated again. But if namespace equals to "%" - generates |
315 |
| -autocomplete for system classes. Make sure that autocomplete for |
316 |
| -system classes generates one time and forever. |
317 |
| -@param genSystem - Shows if system classes need to be generated. </Description> |
318 |
| -<FormalSpec>namespace:%String,genSystem:%Boolean</FormalSpec> |
319 |
| -<ReturnType>%String</ReturnType> |
320 |
| -<Implementation><![CDATA[ |
321 |
| - set trueNs = $case(genSystem, 1:"%", :namespace) |
322 |
| -
|
323 |
| - do ..SendData("29", ..#ConstClientOutputLocalized) |
324 |
| - do ..SendData(" " _ trueNs _ $C(13, 10)) |
325 |
| -
|
326 |
| - if ('##class(%SYS.Namespace).Exists(namespace)) { |
327 |
| - do ..SendData("30", ..#ConstClientOutputLocalized) |
328 |
| - do ..SendData(" " _ namespace _ $C(13, 10)) |
329 |
| - quit $$$NOTOK |
330 |
| - } |
331 |
| -
|
332 |
| - // get all classes names |
333 |
| - set result = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary") |
334 |
| - do result.Execute() |
335 |
| -
|
336 |
| - /* |
337 |
| - The next COULD BE IMPROVED FOR SPEED, I beleive. |
338 |
| - Generates compressed JSON string of type: |
339 |
| - { |
340 |
| - "class": { |
341 |
| - "%ClassName1": { |
342 |
| - "methodName": 0, |
343 |
| - "propertyName": 0, |
344 |
| - "parameterName": 0, |
345 |
| - ... |
346 |
| - }, |
347 |
| - "ClassName2": { |
348 |
| - ... |
349 |
| - } |
350 |
| - }, |
351 |
| - "global": { |
352 |
| - "^%g1": 0, |
353 |
| - "^g2": 0 |
354 |
| - } |
355 |
| - } |
356 |
| - */ |
357 |
| -
|
358 |
| - do ..SendData($C(13, 10)) |
359 |
| - do ..SendData("32", ..#ConstClientOutputLocalized) |
360 |
| -
|
361 |
| - set ac = "{""class"":{" // string with autocomplete |
362 |
| - set first = "" |
363 |
| - set u = 1 |
364 |
| -
|
365 |
| - while (result.Next()) { // forming autocomplete for each class |
366 |
| -
|
367 |
| - if (genSystem) '= ($Extract(result.Data("Name"), 1) = "%") { |
368 |
| - continue |
369 |
| - } |
370 |
| -
|
371 |
| - set className = result.Data("Name") |
372 |
| -
|
373 |
| - do ..SendData($C(27) _ "[30G" _ u) |
374 |
| - s u = u + 1 |
375 |
| -
|
376 |
| - set ac = ac _ first _ """" _ className _ """:{" |
377 |
| - if (first = "") set first = "," |
378 |
| -
|
379 |
| - set cdefs = ##class(%Dictionary.ClassDefinition).%OpenId(className) |
380 |
| -
|
381 |
| - set countMethods = cdefs.Methods.Count() |
382 |
| - set countParameters = cdefs.Parameters.Count() |
383 |
| - set countProperties = cdefs.Properties.Count() |
384 |
| - set total = countMethods + countParameters + countProperties |
385 |
| - set current = 0 |
386 |
| -
|
387 |
| - for i=1:1:countMethods { |
388 |
| - set current = current + 1 |
389 |
| - set ac = ac _ """" _ cdefs.Methods.GetAt(i).Name _ """:0" |
390 |
| - if (current'=total) set ac = ac _ "," |
391 |
| - } |
392 |
| -
|
393 |
| - for i=1:1:countProperties { |
394 |
| - set current = current + 1 |
395 |
| - set ac = ac _ """" _ cdefs.Properties.GetAt(i).Name _ """:0" |
396 |
| - if (current'=total) set ac = ac _ "," |
397 |
| - } |
398 |
| -
|
399 |
| - for i=1:1:countParameters { |
400 |
| - set current = current + 1 |
401 |
| - set ac = ac _ """" _ cdefs.Parameters.GetAt(i).Name _ """:0" |
402 |
| - if (current'=total) set ac = ac _ "," |
403 |
| - } |
404 |
| -
|
405 |
| - set ac = ac _ "}" |
406 |
| -
|
407 |
| - } |
408 |
| -
|
409 |
| - set ac = ac _ "}" |
410 |
| - if ('genSystem) set ac = ac _ ",""global"":" _ ..getGlobalsJSON() |
411 |
| - set ac = ac _ "}" |
412 |
| -
|
413 |
| - set ^%WebTerminal.Autocomplete(trueNs) = ac |
414 |
| -
|
415 |
| - do ..SendData($C(13, 10)) |
416 |
| - do ..SendData("33", ..#ConstClientOutputLocalized) |
417 |
| - do ..SendData($C(13, 10)) |
418 |
| - //do ..SendData(namespace, ..#ConstClientLoadAutocomplete) |
419 |
| -
|
420 |
| - quit $$$OK |
421 |
| -]]></Implementation> |
422 |
| -</Method> |
423 |
| - |
424 |
| -<Method name="Reset"> |
425 |
| -<Description> |
426 |
| -Returns terminal to default state</Description> |
427 |
| -<ClassMethod>1</ClassMethod> |
428 |
| -<ReturnType>%Status</ReturnType> |
429 |
| -<Implementation><![CDATA[ |
430 |
| - // delete autocompletion files |
431 |
| - kill ^%WebTerminal.Autocomplete |
432 |
| - quit $$$OK |
433 |
| -]]></Implementation> |
434 |
| -</Method> |
435 |
| - |
436 | 282 | <Method name="SendData">
|
437 | 283 | <Description>
|
438 | 284 | Function sends data derectly to server with specified action</Description>
|
|
0 commit comments