source: ePrescribing/trunk/p/_zewdAPI.m@ 730

Last change on this file since 730 was 514, checked in by George Lilly, 16 years ago

web service test routines

File size: 52.5 KB
Line 
1%zewdAPI ; Enterprise Web Developer run-time functions and user APIs
2 ;
3 ; Product: Enterprise Web Developer version 4.0.755
4 ; Build Date: Thu, 12 Feb 2009 09:53:12
5 ;
6 ; ----------------------------------------------------------------------------
7 ; | Enterprise Web Developer for GT.M and m_apache |
8 ; | Copyright (c) 2004-9 M/Gateway Developments Ltd, |
9 ; | Reigate, Surrey UK. |
10 ; | All rights reserved. |
11 ; | |
12 ; | http://www.mgateway.com |
13 ; | Email: rtweed@mgateway.com |
14 ; | |
15 ; | This program is free software: you can redistribute it and/or modify |
16 ; | it under the terms of the GNU Affero General Public License as |
17 ; | published by the Free Software Foundation, either version 3 of the |
18 ; | License, or (at your option) any later version. |
19 ; | |
20 ; | This program is distributed in the hope that it will be useful, |
21 ; | but WITHOUT ANY WARRANTY; without even the implied warranty of |
22 ; | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23 ; | GNU Affero General Public License for more details. |
24 ; | |
25 ; | You should have received a copy of the GNU Affero General Public License |
26 ; | along with this program. If not, see <http://www.gnu.org/licenses/>. |
27 ; ----------------------------------------------------------------------------
28 ;
29 QUIT
30 ;
31 ;
32version() ;
33 QUIT "Enterprise Web Developer (Build "_$$getVersion^%zewdCompiler()_")"
34 ;
35date() ;
36 QUIT $$getDate^%zewdCompiler()
37 ;
38compilePage(app,page,mode,technology,outputPath,multilingual,maxLines)
39 d compilePage^%zewdCompiler($g(app),$g(page),$g(mode),$g(technology),$g(outputPath),$g(multilingual),$g(maxLines))
40 QUIT
41 ;
42compileAll(app,mode,technology,outputPath,multilingual,templatePageName,maxLines)
43 d compileAll^%zewdCompiler($g(app),$g(mode),$g(technology),$g(outputPath),$g(multilingual),$g(templatePageName),$g(maxLines))
44 QUIT
45 ;
46autoTranslate(app,language,verbose)
47 d autoTranslate^%zewdMgr($g(app),$g(language),$g(verbose))
48 ;
49startSession(page,requestArray,serverArray,sessionArray,filesArray) ;
50 ;
51 QUIT $$startSession^%zewdPHP(page,.requestArray,.serverArray,.sessionArray,.filesArray)
52 ;
53closeSession(requestArray) ;
54 ;
55 QUIT $$closeSession^%zewdPHP(.requestArray)
56 ;
57saveSession(sessionArray) ;
58 ;
59 d saveSession^%zewdPHP(.sessionArray)
60 QUIT
61 ;
62endOfPage(sessionArray)
63 ;
64 d endOfPage^%zewdPHP(.sessionArray)
65 QUIT
66 ;
67prePageScript(sessid)
68 QUIT $$prePageScript^%zewdPHP(sessid)
69 ;
70releaseLock(sessid)
71 d releaseLock^%zewdPHP(sessid)
72 QUIT
73 ;
74tokeniseURL(url,sessid)
75 QUIT $$tokeniseURL^%zewdCompiler16($g(url),$g(sessid))
76 ;
77getSessid(token)
78 ;
79 i token="" QUIT ""
80 i $$isTokenExpired(token) QUIT ""
81 QUIT +^%zewdSession("tokens",token)
82 ;
83initialiseSession(sessid)
84 k ^%zewdSession("session",sessid)
85 QUIT
86 ;
87deleteSession(sessid)
88 ;
89 d deleteSession^%zewdPHP(sessid)
90 ;
91 QUIT
92 ;
93setRedirect(toPage,sessid)
94 d setJump(toPage,sessid)
95 QUIT
96 ;
97setJump(toPage,sessid)
98 ;
99 n token
100 ;
101 d setSessionValue("ewd_nextPage",toPage,sessid)
102 d setSessionValue("ewd_jump",toPage,sessid)
103 QUIT:$e(sessid,1,4)="csp:"
104 s token=$$setNextPageToken(toPage,sessid)
105 d setSessionValue("ewd_pageToken",token,sessid)
106 QUIT
107 ;
108setNextPageToken(nextPage,sessid)
109 ;
110 n token,length
111 ;
112 s length=$$getSessionValue("ewd_sessid_length",sessid)
113 i length="" s length=30
114 f s token=$$makeTokenString(length) q:'$d(^%zewdSession("nextPageTokens",sessid,token))
115 i $g(^zewd("trace"))=1 d trace^%zewdAPI("setNextPageToken^%zewdAPI: sessid="_sessid_"; token="_token_"; nextPage="_nextPage)
116 s ^%zewdSession("nextPageTokens",sessid,token,$$zcvt(nextPage,"l"))=""
117 QUIT token
118 ;
119isNextPageTokenValid(token,sessid,page)
120 QUIT $$isNextPageTokenValid^%zewdCompiler13(token,sessid,page)
121 ;
122isCSP(sessid)
123 QUIT $e(sessid,1,4)="csp:"
124 ;
125normaliseTextValue(text)
126 s text=$$replaceAll(text,"&#39;","'")
127 QUIT $$zcvt(text,"o","HTML")
128 ;
129displayOptions(fieldName,listName,escape)
130 ;d displayOptions^%zewdCompiler13($g(fieldName),$g(listName),$g(escape))
131 n codeValue,%d,i,name,nnvp,nvp,pos,textValue,value
132 ;
133 s fieldName=$tr(fieldName,".","_")
134 s listName=$tr(listName,".","_")
135 i 0
136 e d
137 . s escape=+$g(escape)
138 . s pos=""
139 . f s pos=$o(^%zewdSession("session",sessid,"ewd_list",listName,pos)) q:pos="" d
140 . . k %d,textValue,codeValue,codeValueEsc,textValueEsc
141 . . s %d=^%zewdSession("session",sessid,"ewd_list",listName,pos)
142 . . s textValue=$p(%d,$c(1),1)
143 . . ;
144 . . s textValueEsc=textValue
145 . . s textValueEsc=$$replaceAll(textValueEsc,"&#39;","'")
146 . . i escape s textValueEsc=$$zcvt(textValue,"o","HTML")
147 . . ;
148 . . s codeValue=$p(%d,$c(1),2)
149 . . i codeValue="" s codeValue=textValue
150 . . s codeValueEsc=codeValue
151 . . s codeValueEsc=$$replaceAll(codeValueEsc,"&#39;","'")
152 . . i escape s codeValueEsc=$$zcvt(codeValue,"o","HTML")
153 . . w "<option value='"_codeValueEsc_"'"
154 . . i $e(fieldName,1)'="$" d
155 . . . n fn
156 . . . s fn=$tr(fieldName,"_",".")
157 . . . i $$getSessionValue(fn,sessid)=codeValue w " selected='selected'" q
158 . . . i $d(^%zewdSession("session",sessid,"ewd_selected",fieldName,codeValue)) w " selected='selected'" q
159 . . i $e(fieldName,1)="$" d
160 . . . n fieldValue
161 . . . s fieldValue=$e(fieldName,2,$l(fieldName))
162 . . . s fieldValue=$g(@fieldValue)
163 . . . i fieldValue=codeValue w " selected='selected'"
164 . . s nnvp=$l(%d,$c(1))
165 . . f i=3:1:nnvp d
166 . . . s nvp=$p(%d,$c(1),i)
167 . . . i nvp="" q
168 . . . s name=$p(nvp,$c(3),1)
169 . . . s value=$p(nvp,$c(3),2)
170 . . . w " "_name_"='"_value_"'"
171 . . w ">"_textValueEsc_"</option>"_$c(13,10)
172 QUIT
173 ;
174displayTextArea(fieldName)
175 d displayTextArea^%zewdCompiler13($g(fieldName))
176 QUIT
177 ;
178mCSPReq2(fields)
179 ;
180 n i,noOfFields,field,type
181 s noOfFields=$l(fields,"`")
182 f i=1:1:noOfFields d
183 . s field=$p(fields,"`",i)
184 . q:field=""
185 . s type=$p(field,"|",2)
186 . S field=$P(field,"|",1)
187 . d mergeCSPRequestToSession(field,type)
188 d mergeCSPRequestToSession("ewd_pressed","hidden")
189 QUIT
190 ;
191mCSPReq(fieldName,type)
192 d mergeCSPRequestToSession(fieldName,type)
193 QUIT
194 ;
195mergeCSPRequestToSession(fieldName,type)
196 d mergeCSPRequestToSession^%zewdCompiler16($g(fieldName),$g(type))
197 QUIT
198 ;
199 ; note - textarea data storage can be queried using SQL with the following construct
200 ;
201 ; listAttributeFL {type=%Library.String ; sqllisttype=subnode}
202 ;
203displayText(textID,reviewMode,sessid)
204 QUIT $$displayText^%zewdCompiler13($g(textID),$g(reviewMode),$g(sessid))
205 ;
206systemMessage(text,type,sessid,appName,langCode)
207 n textid,fragments,outputText,error,technology,translationMode,typex
208 ;
209 ;d trace^%zewdAPI("systemMessage : text="_text_" ; type="_type_" ; sessid="_sessid)
210 i $g(text)="" QUIT ""
211 ; manual API or where sessid not known
212 i $g(sessid)="" QUIT $$systemMessage^%zewdCompiler5(text,$g(type),$g(appName),$g(langCode))
213 s translationMode=+$$getSessionValue^%zewdAPI("ewd_translationMode",sessid)
214 ;d trace^%zewdAPI("ewd_translationMode="_translationMode)
215 i 'translationMode QUIT text
216 s appName=$$getSessionValue^%zewdAPI("ewd_appName",sessid)
217 ;d trace^%zewdAPI("appName="_appName)
218 s typex=type ; avoid Cache bug !
219 i $$getPhraseIndex^%zewdCompiler5(text)="" QUIT ""
220 i '$$isTextPreviouslyFound^%zewdCompiler5(text,appName,"","",.textid,,,type) d
221 . s textid=$$addTextToIndex^%zewdCompiler5(text,appName,"","",.fragments,.outputText,typex)
222 s error=$$displayText(textid,0,sessid)
223 QUIT error
224 ;
225errorMessage(text,sessid)
226 QUIT $$systemMessage(text,"error",sessid)
227 ;
228 ; ============================================================================
229 ; User API Methods
230 ; ============================================================================
231 ;
232isCSPPage(docOID)
233 ;
234 n docName
235 ;
236 s docName=$$getDocumentName^%zewdDOM(docOID)
237 QUIT $$bypassMode^%zewdCompiler(docName)
238 ;
239getSessionValue(name,sessid)
240 ;
241 n %zt,return,value
242 ;
243 s name=$$stripSpaces(name)
244 s %zt=$zt
245 i $g(name)="" QUIT ""
246 i $g(sessid)="" QUIT ""
247 i name["." d QUIT value
248 . n np,obj,prop
249 . i name["_" s name=$p(name,"_",1)_"."_$p(name,"_",2,200)
250 . s np=$l(name,".")
251 . s obj=$p(name,".",1,np-1)
252 . s prop=$p(name,".",np)
253 . s value=$$getSessionObject(obj,prop,sessid)
254 ;s $zt="extcErr"
255 ;i $r(100)<10 i '$$$licensed("DOM",,,,,,,,,,) d setWarning("You do not have a current eXtc License",sessid)
256 ;i $$isTemp(name) d QUIT value
257 i $e(name,1,4)="tmp_" d QUIT value
258 . s value=$g(zewdSession(name))
259 . i value="",$g(^%zewdSession("session",sessid,"ewd_technology"))="gtm" s value=$g(sessionArray(name))
260 QUIT $g(^%zewdSession("session",sessid,name))
261 ;
262setWLDSymbol(name,sessid)
263 ;
264 ; ------------------------------------------------------
265 ; Duplicate copy for performance: see also %zewdPHP!
266 ; ------------------------------------------------------
267 ;
268 n wldAppName,wldName,wldSessid,%zzname
269 ;
270 QUIT:$zv["GT.M"
271 QUIT
272 ;
273extcErr
274 ;
275 n mess
276 s mess="eXtc does not appear to have been installed or is unavailable in the "_$$namespace()_" namespace where your application is attempting to run. Your application will be unable to run correctly"
277 d setWarning(mess,sessid)
278 s $zt=%zt
279 QUIT ""
280 ;
281valueErr ;
282 s $zt=%zt
283 QUIT ""
284 ;
285 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
286 ;
287exportCustomTags(tagList,filepath)
288 QUIT $$exportCustomTags^%zewdCompiler16(.tagList,$g(filepath))
289 ;
290exportAllCustomTags(filepath)
291 QUIT $$exportAllCustomTags^%zewdCompiler16($g(filepath))
292 ;
293importCustomTags(filePath)
294 QUIT $$importCustomTags^%zewdForm($g(filePath))
295 ;
296setSessionValue(name,value,sessid)
297 ;
298 s name=$$stripSpaces(name)
299 i $g(name)="" QUIT
300 i $g(sessid)="" QUIT
301 i name["." d QUIT
302 . n np,obj,prop
303 . i name["_" s name=$p(name,"_",1)_"."_$p(name,"_",2,200)
304 . s np=$l(name,".")
305 . s obj=$p(name,".",1,np-1)
306 . s prop=$p(name,".",np)
307 . d setSessionObject(obj,prop,value,sessid)
308 s value=$g(value)
309 i $e(name,1,4)="tmp_" s zewdSession(name)=value QUIT
310 s ^%zewdSession("session",sessid,name)=value
311 QUIT
312 ;
313allowJSONAccess(sessionName,access,sessid)
314 ; access="r|rw"
315 s ^%zewdSession("jsonAccess",sessid,sessionName)=access
316 QUIT
317 ;
318disallowJSONAccess(sessionName,sessid)
319 k ^%zewdSession("jsonAccess",sessid,sessionName)
320 QUIT
321 ;
322JSONAccess(sessionName,sessid)
323 QUIT $g(^%zewdSession("jsonAccess",sessid,sessionName))
324 ;
325 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
326 ;
327isTemp(name)
328 QUIT $e(name,1,4)="tmp_"
329 ;
330 ;
331existsInSession(name,sessid)
332 QUIT $$existsInSession^%zewdCompiler13($g(name),$g(sessid))
333 ;
334existsInSessionArray(name,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11)
335 QUIT $$existsInSessionArray^%zewdCompiler13($g(name),$g(p1),$g(p2),$g(p3),$g(p4),$g(p5),$g(p6),$g(p7),$g(p8),$g(p9),$g(p10),$g(p11))
336 ;
337 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
338 ;
339clearSessionArray(arrayName,sessid)
340 s arrayName=$$stripSpaces(arrayName)
341 i $g(sessid)="" QUIT
342 i $g(arrayName)="" QUIT
343 s arrayName=$tr(arrayName,".","_")
344 ;i $$isTemp(arrayName) k zewdSession(arrayName) QUIT
345 i $e(arrayName,1,4)="tmp_" k zewdSession(arrayName) QUIT
346 k ^%zewdSession("session",sessid,arrayName)
347 QUIT
348 ;
349 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
350 ;
351setSessionArray(arrayName,itemName,itemValue,sessid)
352 ;
353 s arrayName=$$stripSpaces(arrayName)
354 QUIT:$g(arrayName)=""
355 QUIT:$g(itemName)=""
356 QUIT:$g(sessid)=""
357 s arrayName=$tr(arrayName,".","_")
358 i $$isTemp(arrayName) s zewdSession(arrayName,itemName)=itemValue QUIT
359 s ^%zewdSession("session",sessid,arrayName,itemName)=itemValue
360 QUIT
361 ;
362 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
363 ;
364getSessionArray(arrayName,sessid,array,clearArray)
365 ;
366 s arrayName=$$stripSpaces(arrayName)
367 QUIT:$g(arrayName)=""
368 s arrayName=$tr(arrayName,".","_")
369 QUIT:$g(sessid)=""
370 set $zt="getSessionArrayErr"
371 i $g(clearArray)=1 k array
372 i $$isTemp(arrayName) m array=zewdSession(arrayName) QUIT
373 m array=^%zewdSession("session",sessid,arrayName)
374 QUIT
375 ;
376getSessionArrayErr ; --- Come here if error occurred in 'getSessionArray' ---
377 set $zt=""
378 QUIT
379 ;
380 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
381 ;
382addToSession(name,sessid)
383 s name=$$stripSpaces(name)
384 QUIT:$g(sessid)=""
385 QUIT:$g(name)=""
386 s name=$tr(name,".","_")
387 i $$isTemp(name) m zewdSession(name)=@name QUIT
388 m ^%zewdSession("session",sessid,name)=@name
389 QUIT
390 ;
391 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
392 ;
393mergeToSession(name,sessid)
394 QUIT:$g(sessid)=""
395 QUIT:$g(name)=""
396 d addToSession(name,sessid)
397 QUIT
398 ;
399 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
400 ;
401mergeGlobalToSession(globalName,sessionName,sessid)
402 d mergeGlobalToSession^%zewdCompiler13($g(globalName),$g(sessionName),$g(sessid))
403 QUIT
404 ;
405mergeGlobalFromSession(globalName,sessionName,sessid)
406 d mergeGlobalFromSession^%zewdCompiler13($g(globalName),$g(sessionName),$g(sessid))
407 QUIT
408 ;
409mergeArrayToSession(array,sessionName,sessid)
410 QUIT:$g(sessid)=""
411 QUIT:$g(sessionName)=""
412 s sessionName=$tr(sessionName,".","_")
413 ;i $$isTemp(sessionName) m zewdSession(sessionName)=array QUIT
414 i $e(sessionName,1,4)="tmp_" m zewdSession(sessionName)=array QUIT
415 m ^%zewdSession("session",sessid,sessionName)=array
416 QUIT
417 ;
418mergeArrayToSessionObject(array,sessionName,sessid)
419 d mergeArrayToSessionObject^%zewdCompiler16(.array,$g(sessionName),$g(sessid))
420 QUIT
421 ;
422 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
423 ;
424mergeArrayFromSession(array,sessionName,sessid)
425 QUIT:$g(sessid)=""
426 QUIT:$g(sessionName)=""
427 s sessionName=$tr(sessionName,".","_")
428 ;i $$isTemp(sessionName) m array=zewdSession(sessionName) QUIT
429 i $e(sessionName,1,4)="tmp_" m array=zewdSession(sessionName) QUIT
430 m array=^%zewdSession("session",sessid,sessionName)
431 QUIT
432 ;
433 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
434 ;
435mergeFromSession(name,sessid)
436 QUIT:$g(sessid)=""
437 QUIT:$g(name)=""
438 s name=$tr(name,".","_")
439 i $$isTemp(name) m @name=zewdSession(name)
440 m @name=^%zewdSession("session",sessid,name)
441 QUIT
442 ;
443 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
444 ;
445deleteFromSession(name,sessid)
446 QUIT:$g(sessid)=""
447 QUIT:$g(name)=""
448 i name["." d QUIT
449 . n np,obj,prop
450 . s np=$l(name,".")
451 . s obj=$p(name,".",1,np-1)
452 . s prop=$p(name,".",np)
453 . d deleteFromSessionObject(obj,prop,sessid)
454 ;i $$isTemp(name) k zewdSession(name) QUIT
455 i $e(name,1,4)="tmp_" k zewdSession(name) QUIT
456 k ^%zewdSession("session",sessid,name)
457 QUIT
458 ;
459sessionNameExists(name,sessid)
460 QUIT:$g(sessid)=""
461 QUIT:$g(name)=""
462 s name=$tr(name,".","_")
463 i $$isTemp(name) QUIT $d(zewdSession(name))
464 QUIT $d(^%zewdSession("session",sessid,name))
465 ;
466getSessionArrayValue(arrayName,subscript,sessid,exists)
467 QUIT $$getSessionArrayValue^%zewdCompiler13($g(arrayName),$g(subscript),$g(sessid),.exists)
468 ;
469sessionArrayValueExists(arrayName,subscript,sessid)
470 QUIT $$sessionArrayValueExists^%zewdCompiler13($g(arrayName),$g(subscript),$g(sessid))
471 ;
472deleteSessionArrayValue(arrayName,subscript,sessid)
473 d deleteSessionArrayValue^%zewdCompiler13($g(arrayName),$g(subscript),$g(sessid))
474 QUIT
475 ;
476 ; Objects
477 ;
478setSessionObject(objectName,propertyName,propertyValue,sessid)
479 ;d setSessionObject^%zewdCompiler13($g(objectName),$g(propertyName),$g(propertyValue),$g(sessid))
480 ;QUIT
481 ;
482 n comma,i,np,p,sessionArray,x
483 ;
484 i $g(objectName)="" QUIT
485 i $g(propertyName)="" QUIT
486 ;i $g(propertyValue)="" QUIT
487 i $g(sessid)="" QUIT
488 s np=$l(objectName,".")
489 ;s objectName=$$replace(objectName,".","_")
490 i objectName["." s objectName=$p(objectName,".",1)_"_"_$p(objectName,".",2,2000)
491 i np=1 d QUIT
492 . i $e(objectName,1,3)="tmp" s zewdSession(objectName_"_"_propertyName)=propertyValue q
493 . s ^%zewdSession("session",sessid,(objectName_"_"_propertyName))=propertyValue
494 ;
495 f i=1:1:np-1 s p(i)=$p(objectName,".",i)
496 s comma=","
497 i $e(objectName,1,4)="tmp_" d
498 . s x="s zewdSession(",comma=""
499 e d
500 . s x="s ^%zewdSession(""session"","_sessid
501 f i=1:1:np-1 s x=x_comma_""""_p(i)_"""",comma=","
502 s x=x_","""_propertyName_""")="""_propertyValue_""""
503 x x
504 QUIT
505 ;
506getSessionObject(objectName,propertyName,sessid)
507 ;
508 n i,np,p,value,x
509 ;
510 i $g(sessid)="" QUIT ""
511 s value=""
512 s np=$l(objectName,".")
513 i objectName[".",objectName'["_" s objectName=$p(objectName,".",1)_"_"_$p(objectName,".",2,2000)
514 ;s objectName=$$replace(objectName,".","_")
515 i np=1 QUIT $g(^%zewdSession("session",sessid,(objectName_"_"_propertyName)))
516 ;
517 f i=1:1:np-1 s p(i)=$p(objectName,".",i)
518 s x="s value=$g(^%zewdSession(""session"","_sessid
519 f i=1:1:np-1 s x=x_","""_p(i)_""""
520 s x=x_","""_propertyName_"""))"
521 x x
522 QUIT value
523 ;
524deleteFromSessionObject(objectName,propertyName,sessid)
525 d deleteFromSessionObject^%zewdCompiler13($g(objectName),$g(propertyName),$g(sessid))
526 QUIT
527 ;
528sessionObjectPropertyExists(objectName,propertyName,sessid)
529 QUIT $$sessionObjectPropertyExists^%zewdCompiler13($g(objectName),$g(propertyName),$g(sessid))
530 ;
531deleteSessionObject(objectName,sessid)
532 n obj
533 s obj=objectName
534 i obj["." s obj=$tr(obj,".","_")
535 i obj'["_" s obj=obj_"_"
536 d clearSessionByPrefix(obj,$g(sessid))
537 ;d deleteSessionObject^%zewdCompiler13($g(objectName),$g(sessid))
538 QUIT
539 ;
540copyObjectToSession(oref,objectName,sessid)
541 d copyObjectToSession^%zewdCompiler13($g(oref),$g(objectName),$g(sessid))
542 QUIT
543 ;
544copyResultSetToSession(oref,objectName,sessid)
545 d copyResultSetToSession^%zewdCompiler13($g(oref),$g(objectName),$g(sessid))
546 QUIT
547 ;
548getResultSetValue(resultSetName,index,propertyName,sessid)
549 QUIT $$getResultSetValue^%zewdCompiler13($g(resultSetName),$g(index),$g(propertyName),$g(sessid))
550 ;
551addToResultSet(sessionName,propertyName,value,sessid)
552 d addToResultSet^%zewdCompiler13($g(sessionName),$g(propertyName),$g(value),$g(sessid))
553 QUIT
554 ;
555mergeRecordArrayToResultSet(sessionName,recordArray,sessid)
556 d mergeRecordArrayToResultSet^%zewdCompiler13($g(sessionName),.recordArray,$g(sessid))
557 QUIT
558 ;
559JSONToSessionObject(objectName,jsonString,sessid)
560 d JSONToSessionObject^%zewdCompiler13($g(objectName),$g(jsonString),$g(sessid))
561 QUIT
562 ;
563sessionObjectToJSON(objectName,sessid)
564 QUIT $$sessionObjectToJSON^%zewdCompiler13($g(objectName),$g(sessid))
565 ;
566objectGlobalToJSON(objectName)
567 QUIT $$objectGlobalToJSON^%zewdCompiler13($g(objectName))
568 ;
569saveJSON(objectName,jsonString)
570 QUIT $$saveJSON^%zewdCompiler13($g(objectName),$g(jsonString))
571 ;
572getJSON(objectName,addRefCol)
573 QUIT $$getJSON^%zewdCompiler13($g(objectName),$g(addRefCol))
574 ;
575setJSONValue(JSONName,objectName,sessid)
576 d setJSONValue^%zewdCompiler16($g(JSONName),$g(objectName),$g(sessid))
577 d allowJSONAccess(objectName,"r",sessid)
578 QUIT
579 ;
580convertToJSON(arrayName,isExtJS)
581 n dojo
582 i '$d(@arrayName) QUIT ""
583 s dojo=""
584 i $g(isExtJS)=1 s dojo=2
585 QUIT $$walkArray^%zewdCompiler13("",arrayName,dojo)
586 ;
587mergeToJSObject(sessionObject,JSObject)
588 QUIT $$mergeToJSObject^%zewdCompiler13($g(sessionObject),$g(JSObject),$g(sessid))
589 ;
590 ; Javascript objects
591 ;
592getJavascriptObjectBlock(objectName,docName,textArray)
593 QUIT $$getJavascriptObjectBlock^%zewdCompiler13($g(objectName),$g(docName),.textArray)
594 ;
595replaceJavascriptObject(objectName,newFunctionText,docName)
596 QUIT $$replaceJavascriptObject^%zewdCompiler13($g(objectName),$g(newFunctionText),$g(docName))
597 ;
598replaceJavascriptObjectBody(functionName,newBody,docName)
599 QUIT $$replaceJavascriptObjectBody^%zewdCompiler13($g(functionName),$g(newBody),$g(docName))
600 ;
601getJavascriptObjectBody(functionName,docName)
602 QUIT $$getJavascriptObjectBody^%zewdCompiler13($g(functionName),$g(docName))
603 ;
604getJavascriptObject(objectName,docName,eOID)
605 QUIT $$getJavascriptObject^%zewdCompiler13($g(objectName),$g(docName),$g(eOID))
606 ;
607javascriptObjectExists(objectName,docName)
608 QUIT $$javascriptObjectExists^%zewdCompiler13($g(objectName),$g(docName))
609 ;
610getLastJavascriptTag(docName,textArray)
611 QUIT $$getLastJavascriptTag^%zewdCompiler13($g(docName),.textArray)
612 ;
613addJavascriptObject(docName,jsText)
614 QUIT $$addJavascriptObject^%zewdCompiler13($g(docName),.jsText)
615 ;
616 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
617 ;
618setSessionValues(nvArray,sessid)
619 ;
620 QUIT:$g(sessid)=""
621 n name,no,value
622 s name=""
623 f s name=$o(nvArray(name)) q:name="" d
624 . d deleteFromSession(name,sessid)
625 . d clearSelected(name,sessid)
626 . s value=$g(nvArray(name))
627 . d setSessionValue(name,value,sessid)
628 . s no=""
629 . f s no=$o(nvArray(name,no)) q:no="" d
630 . . s value=nvArray(name,no)
631 . . d addToSelected(name,value,sessid)
632 QUIT
633 ;
634 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
635 ;
636getSessionValues(prefix,nvArray,sessid)
637 ;
638 n len,name,no,value
639 QUIT:$g(sessid)=""
640 QUIT:$g(prefix)=""
641 set $zt="getSessionValuesErr"
642 s len=$l(prefix)
643 k nvArray
644 s name=prefix
645 f s name=$o(^%zewdSession("session",sessid,name)) q:name="" q:$e(name,1,len)'=prefix d
646 . d setNVArray(name,.nvArray,sessid)
647 s name=prefix,no=0
648 f s name=$o(^%zewdSession("session",sessid,"ewd_selected",name)) q:name="" q:$e(name,1,len)'=prefix d
649 . s value=""
650 . f s value=$o(^%zewdSession("session",sessid,"ewd_selected",name,value)) q:value="" d
651 . . s no=no+1
652 . . s nvArray(name,no)=value
653 QUIT
654 ;
655getSessionValuesErr ; --- Come here if error occurred in 'getSessionValues' ---
656 set $zt=""
657 QUIT
658 ;
659 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
660 ;
661getSessionValuesByPrefix(prefix,sessid)
662 ;
663 n len,name
664 QUIT:$g(sessid)=""
665 QUIT:$g(prefix)=""
666 s prefix=$tr(prefix,".","_")
667 set $zt="getSessionValuesByPrefixErr"
668 s len=$l(prefix)
669 s name=prefix
670 f s name=$o(^%zewdSession("session",sessid,name)) q:name="" q:$e(name,1,len)'=prefix d
671 . i name?1A.AN m @name=^%zewdSession("session",sessid,name)
672 QUIT
673 ;
674getSessionValuesByPrefixErr
675 set $zt=""
676 QUIT
677 ;
678setNVArray(name,nvArray,sessid)
679 n selected,value,no
680 s nvArray(name)=$$getSessionValue(name,sessid)
681 QUIT
682 ;
683clearSessionByPrefix(prefix,sessid)
684 ;
685 n len,name
686 QUIT:$g(sessid)=""
687 QUIT:$g(prefix)=""
688 s prefix=$tr(prefix,".","_")
689 s len=$l(prefix)
690 ;
691 s name=prefix
692 f s name=$o(^%zewdSession("session",sessid,name)) q:name="" q:$e(name,1,len)'=prefix d
693 . i $e(name,1,4)="ewd_" q
694 . d deleteFromSession(name,sessid)
695 s name=prefix
696 f s name=$o(^%zewdSession("session",sessid,"ewd_selected",name)) q:name="" q:$e(name,1,len)'=prefix d
697 . d clearSelected(name,sessid)
698 s name=prefix
699 f s name=$o(^%zewdSession("session",sessid,"ewd_list",name)) q:name="" q:$e(name,1,len)'=prefix d
700 . d clearList(name,sessid)
701 s name=prefix
702 f s name=$o(^%zewdSession("session",sessid,"ewd_textarea",name)) q:name="" q:$e(name,1,len)'=prefix d
703 . d clearTextArea(name,sessid)
704 QUIT
705 ;
706 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
707 ;
708 ; HTML Form-specific APIs
709 ;
710getTextValue(fieldName,sessid)
711 QUIT $$getSessionValue(fieldName,sessid)
712 ;
713setTextValue(fieldName,value,sessid)
714 d setSessionValue(fieldName,value,sessid)
715 QUIT
716 ;
717getPasswordValue(fieldName,sessid)
718 QUIT $$getSessionValue(fieldName,sessid)
719 ;
720getHiddenValue(fieldName,sessid)
721 QUIT $$getSessionValue(fieldName,sessid)
722 ;
723setHiddenValue(fieldName,value,sessid)
724 d setSessionValue(fieldName,value,sessid)
725 ;
726getRadioValue(fieldName,sessid)
727 QUIT $$getSessionValue(fieldName,sessid)
728 ;
729setRadioOn(fieldName,value,sessid)
730 d setSessionValue(fieldName,value,sessid)
731 QUIT
732 ;
733isRadionOn(fieldName,value,sessid)
734 QUIT $$getRadioValue(fieldName,sessid)=value
735 ;
736isCheckboxOn(fieldName,value,sessid)
737 QUIT $$isSelected(fieldName,value,sessid)
738 ;
739getCheckboxValues(fieldName,selectedValueArray,sessid)
740 d mergeFromSelected(fieldName,.selectedValueArray,sessid)
741 QUIT
742 ;
743initialiseCheckbox(fieldName,sessid)
744 d clearSelected(fieldName,sessid)
745 QUIT
746 ;
747setCheckboxOn(fieldName,value,sessid)
748 d addToSelected(fieldName,value,sessid)
749 QUIT
750 ;
751setCheckboxOff(fieldName,value,sessid)
752 d removeFromSelected(fieldName,value,sessid)
753 ;
754setCheckboxValues(fieldName,selectedValueArray,sessid)
755 ;
756 ; array format : array(checkboxValue)=checkboxValue
757 ; eg selected("red")="red"
758 ;
759 d mergeToSelected(fieldName,.selectedValueArray,sessid)
760 QUIT
761 ;
762getSelectValue(fieldName,sessid,nullify)
763 ;
764 n value
765 ;
766 s value=$$getSessionValue(fieldName,sessid)
767 i $a(value)=160 s value=""
768 QUIT value
769 ;
770setSelectValue(fieldName,value,sessid)
771 d setSessionValue(fieldName,value,sessid)
772 ;
773isSelectOn(fieldName,value,sessid)
774 QUIT $$getSelectValue(fieldName,sessid)=value
775 ;
776isMultipleSelectOn(fieldName,value,sessid)
777 QUIT $$isSelected(fieldName,value,sessid)
778 ;
779getMultipleSelectValues(fieldName,selectedValueArray,sessid)
780 d mergeFromSelected(fieldName,.selectedValueArray,sessid)
781 QUIT
782 ;
783initialiseMultipleSelect(fieldName,sessid)
784 d clearSelected(fieldName,sessid)
785 QUIT
786 ;
787setMultipleSelectOn(fieldName,value,sessid)
788 d addToSelected(fieldName,value,sessid)
789 QUIT
790 ;
791setMultipleSelectOff(fieldName,value,sessid)
792 d removeFromSelected(fieldName,value,sessid)
793 ;
794setMultipleSelectValues(fieldName,selectedValueArray,sessid)
795 ;
796 ; array format : array(checkboxValue)=checkboxValue
797 ; eg selected("red")="red"
798 ;
799 d mergeToSelected(fieldName,.selectedValueArray,sessid)
800 QUIT
801 ;
802getTextArea(fieldName,textArray,sessid)
803 d mergeFromTextArea(fieldName,.textArray,sessid)
804 QUIT
805 ;
806setFieldError(fieldName,sessid)
807 ;
808 n errors
809 s errors(fieldName)=$$getSessionValue("ewd_errorClass",sessid)
810 d mergeArrayToSession^%zewdAPI(.errors,"ewd_errorFields",sessid)
811 d setSessionValue^%zewdAPI("ewd_hasErrors",1,sessid)
812 QUIT
813 ;
814setErrorClasses()
815 QUIT $$setErrorClasses^%zewdUtilities()
816 ;
817getRequestValue(fieldName,sessid)
818 set $zt="getRequestValueErr"
819 s sessid=$g(sessid)
820 i $g(fieldName)="" QUIT ""
821 QUIT $g(requestArray(fieldName))
822 ;
823getRequestValueErr
824 set $zt=""
825 QUIT ""
826 ;
827mergeFromRequest(array,fieldName,sessid)
828 QUIT:fieldName=""
829 m array=requestArray(fieldName)
830 QUIT
831 ;
832 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
833 ;
834copyRequestValueToSession(fieldName,sessid)
835 ;
836 QUIT:$g(sessid)=""
837 QUIT:$g(fieldName)=""
838 i $$isTemp(fieldName) m zewdSession(fieldName)=requestArray(fieldName)
839 m ^%zewdSession("session",sessid,fieldName)=requestArray(fieldName)
840 QUIT
841 ;
842 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
843 ;
844getCookieValue(cookieName,sessid)
845 QUIT:$g(cookieName)=""
846 set $zt="getCookieValueErr"
847 QUIT $g(requestArray(cookieName))
848 ;
849getCookieValueErr ; --- Come here if error occurred in 'getCookieValue' ---
850 set $zt=""
851 QUIT ""
852 ;
853 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
854 ;
855deleteCookie(cookieName,sessid)
856 d setCookieValue(cookieName,"",-3600,sessid)
857 QUIT
858 ;
859 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
860 ;
861convertDaysToSeconds(days)
862 QUIT days*86400
863 ;
864 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
865 ;
866parseHTMLFile(filepath,docName)
867 QUIT $$parseHTMLFile^%zewdCompiler16($g(filepath),$g(docName))
868 ;
869parseXMLFile(filepath,docName)
870 QUIT $$parseXMLFile^%zewdCompiler16($g(filepath),$g(docName))
871 ;
872 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
873 ;
874parseStream(streamName,docName,error,isHTML)
875 d parseStream^%zewdCompiler16($g(streamName),$g(docName),.error,$g(isHTML))
876 QUIT
877 ;
878 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
879 ;
880parseHTMLStream(streamName,docName)
881 QUIT $$parseHTMLStream^%zewdCompiler16($g(streamName),$g(docName))
882 ;
883 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
884 ;
885parseURL(server,getPath,docName,port,isHTML,responseTime,browserType,post)
886 ;
887 QUIT $$parseURL^%zewdHTMLParser($g(server),$g(getPath),$g(docName),$g(port),$g(isHTML),.responseTime,$g(browserType),$g(post))
888 ;
889 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
890 ;
891setCookieValue(cookieName,value,expiryDuration,sessid)
892 ;
893 ; expiryDuration is no of seconds
894 ;
895 n expires
896 s expires=expiryDuration
897 i $$isCSP(sessid) d
898 . s expires=$$convertDateToSeconds($h)+expires
899 . s expires=$$convertSecondsToDate(expires)
900 . s expires=$$inetDate(expires)
901 s value=value_$c(1)_expires
902 d setSessionArray("ewd_cookie",cookieName,value,sessid)
903 ;
904 QUIT
905 ;
906 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
907 ;
908setResponseHeader(headerName,headerValue,sessid)
909 d setSessionArray^%zewdAPI("ewd_header",$g(headerName),$g(headerValue),$g(sessid))
910 QUIT
911 ;
912 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
913 ;
914suppressResponseHeader(headerName,sessid)
915 i $$isCSP(sessid) d setResponseHeader(headerName,"",sessid)
916 QUIT
917 ;
918 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
919 ;
920addServerToSession(sessid,serverArray)
921 d addServerToSession^%zewdCompiler13($g(sessid),.serverArray)
922 QUIT
923 ;
924 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
925 ;
926getServerValue(serverFieldName,sessid)
927 ;
928 s sessid=$g(sessid)
929 set $zt="getServerValueErr"
930 s $zt="g "_$zt
931 i $g(serverFieldName)="" QUIT ""
932 ;
933 s $zt=""
934 QUIT $g(serverArray(serverFieldName))
935 ;
936getServerValueErr ; --- Come here if error occurred in 'getServerValue' ---
937 set $zt=""
938 QUIT ""
939 ;
940 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
941 ;
942deleteWarning(sessid)
943 QUIT:$g(sessid)=""
944 d deleteFromSession("ewd_warning",sessid)
945 QUIT
946 ;
947 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
948 ;
949setWarning(warningMessage,sessid)
950 QUIT:$g(sessid)=""
951 QUIT:$g(warningMessage)=""
952 s warningMessage=$$systemMessage(warningMessage,"warning",sessid)
953 i '$$isCSP(sessid) s warningMessage=$$zcvt(warningMessage,"o","JS")
954 d setSessionValue("ewd_warning",warningMessage,sessid)
955 QUIT
956 ;
957 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
958 ;
959clearAllSelected(sessid)
960 k ^%zewdSession("session",sessid,"ewd_selected")
961 QUIT
962 ;
963 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
964 ;
965clearSelected(fieldName,sessid)
966 QUIT:$g(fieldName)=""
967 QUIT:$g(sessid)=""
968 s fieldName=$tr(fieldName,".","_")
969 k ^%zewdSession("session",sessid,"ewd_selected",fieldName)
970 QUIT
971 ;
972 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
973 ;
974addToSelected(fieldName,fieldValue,sessid)
975 ;
976 n shortFieldValue
977 QUIT:$g(fieldName)=""
978 QUIT:$g(sessid)=""
979 QUIT:$g(fieldValue)=""
980 s fieldName=$tr(fieldName,".","_")
981 s shortFieldValue=$e(fieldValue,1,200)
982 s ^%zewdSession("session",sessid,"ewd_selected",fieldName,shortFieldValue)=fieldValue
983 QUIT
984 ;
985removeFromSelected(fieldName,fieldValue,sessid)
986 ;
987 n shortFieldValue
988 QUIT:$g(fieldName)=""
989 QUIT:$g(sessid)=""
990 QUIT:$g(fieldValue)=""
991 s fieldName=$tr(fieldName,".","_")
992 s shortFieldValue=$e(fieldValue,1,200)
993 k ^%zewdSession("session",sessid,"ewd_selected",fieldName,shortFieldValue)
994 QUIT
995 ;
996 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
997 ;
998mergeFromSelected(fieldName,selected,sessid)
999 ;
1000 k selected
1001 s fieldName=$tr(fieldName,".","_")
1002 m selected=^%zewdSession("session",sessid,"ewd_selected",fieldName)
1003 QUIT
1004 ;
1005 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1006 ;
1007mergeToSelected(fieldName,selected,sessid)
1008 ;
1009 s fieldName=$tr(fieldName,".","_")
1010 ;
1011 k ^%zewdSession("session",sessid,"ewd_selected",fieldName)
1012 m ^%zewdSession("session",sessid,"ewd_selected",fieldName)=selected
1013 QUIT
1014 ;
1015 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1016 ;
1017isSelected(fieldName,fieldValue,sessid)
1018 n shortFieldValue
1019 i $g(fieldName)="" QUIT 0
1020 i $g(sessid)="" QUIT 0
1021 i $g(fieldValue)="" QUIT 0
1022 s fieldName=$tr(fieldName,".","_")
1023 set $zt="isSelectedErr"
1024 s shortFieldValue=$e(fieldValue,1,200)
1025 QUIT $d(^%zewdSession("session",sessid,"ewd_selected",fieldName,shortFieldValue))
1026 ;
1027isSelectedErr ; --- Come here if error occurred in 'isSelected' ---
1028 set $zt=""
1029 QUIT 0
1030 ;
1031 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1032 ;
1033clearTextArea(fieldName,sessid)
1034 QUIT:$g(fieldName)=""
1035 QUIT:$g(sessid)=""
1036 s fieldName=$tr(fieldName,".","_")
1037 k ^%zewdSession("session",sessid,"ewd_textarea",fieldName)
1038 s ^%zewdSession("session",sessid,"ewd_textarea",fieldName,1)=""
1039 QUIT
1040 ;
1041 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1042 ;
1043createTextArea(fieldName,textArray,sessid)
1044 ;
1045 QUIT:$g(fieldName)=""
1046 QUIT:$g(sessid)=""
1047 s fieldName=$tr(fieldName,".","_")
1048 m ^%zewdSession("session",sessid,"ewd_textarea",fieldName)=textArray
1049 QUIT
1050 ;
1051 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1052 ;
1053mergeTextAreaFromRequest(fieldName,requestArray,sessid)
1054 ;
1055 q:$g(sessid)=""
1056 s fieldName=$tr(fieldName,".","_")
1057 ;
1058 q:'$d(^%zewdSession("session",sessid,"ewd_textarea",fieldName))
1059 d clearTextArea(fieldName,sessid)
1060 m ^%zewdSession("session",sessid,"ewd_textarea",fieldName)=requestArray(fieldName)
1061 QUIT
1062 ;
1063 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1064 ;
1065appendToTextArea(fieldName,lineOfText,sessid)
1066 ;
1067 n position
1068 ;
1069 QUIT:$g(fieldName)=""
1070 QUIT:$g(sessid)=""
1071 s fieldName=$tr(fieldName,".","_")
1072 ;
1073 s position=$o(^%zewdSession("session",sessid,"ewd_textarea",fieldName,""),-1)+1
1074 s ^%zewdSession("session",sessid,"ewd_textarea",fieldName,position)=lineOfText
1075 QUIT
1076 ;
1077 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1078 ;
1079mergeFromTextArea(fieldName,textArray,sessid)
1080 ;
1081 s fieldName=$tr(fieldName,".","_")
1082 m textArray=^%zewdSession("session",sessid,"ewd_textarea",fieldName)
1083 QUIT
1084 ;
1085 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1086 ;
1087mergeToTextArea(fieldName,textArray,sessid)
1088 ;
1089 s fieldName=$tr(fieldName,".","_")
1090 m ^%zewdSession("session",sessid,"ewd_textarea",fieldName)=textArray
1091 QUIT
1092 ;
1093 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1094 ;
1095clearList(listName,sessid)
1096 QUIT:$g(listName)=""
1097 QUIT:$g(sessid)=""
1098 s listName=$tr(listName,".","_")
1099 k ^%zewdSession("session",sessid,"ewd_list",listName)
1100 k ^%zewdSession("session",sessid,"ewd_listIndex",listName)
1101 QUIT
1102 ;
1103 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1104 ;
1105isListDefined(listName,sessid)
1106 QUIT $d(^%zewdSession("session",sessid,"ewd_list",listName))
1107 ;
1108 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1109 ;
1110countList(listName,sessid)
1111 QUIT $$countList^%zewdCompiler16($g(listName),$g(sessid))
1112 ;
1113 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1114 ;
1115appendToList(listName,textValue,codeValue,sessid,otherAttrs)
1116 ;
1117 n position
1118 ;
1119 QUIT:$g(listName)=""
1120 QUIT:$g(sessid)=""
1121 ;QUIT:$g(textValue)=""
1122 ;QUIT:$g(codeValue)=""
1123 s listName=$tr(listName,".","_")
1124 ;
1125 s position=$o(^%zewdSession("session",sessid,"ewd_list",listName,""),-1)+1
1126 d addToList(listName,textValue,codeValue,position,sessid,.otherAttrs)
1127 QUIT
1128 ;
1129 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1130 ;
1131addToList(listName,textValue,codeValue,position,sessid,otherAttrs)
1132 ;d addToList^%zewdCompiler16($g(listName),$g(textValue),$g(codeValue),$g(position),$g(sessid),.otherAttrs)
1133 ;
1134 n attrList,attrName
1135 ;
1136 QUIT:$g(listName)=""
1137 QUIT:$g(sessid)=""
1138 QUIT:$g(position)=""
1139 i $g(codeValue)="",$g(textValue)="" QUIT
1140 s position=+position
1141 d removeFromList(listName,codeValue,sessid) ; just in case
1142 s attrName="",attrList=""
1143 f s attrName=$o(otherAttrs(attrName)) q:attrName="" d
1144 . s attrList=attrList_attrName_$c(3)_otherAttrs(attrName)_$c(1)
1145 ;
1146 s codeValue=$g(codeValue) i codeValue="" s codeValue=textValue
1147 s ^%zewdSession("session",sessid,"ewd_list",listName,position)=textValue_$c(1)_codeValue_$c(1)_attrList
1148 s ^%zewdSession("session",sessid,"ewd_listIndex",listName,codeValue)=position
1149 k otherAttrs
1150 QUIT
1151 ;
1152 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1153 ;
1154mergeToList(listName,listArray,sessid)
1155 ;
1156 d mergeToList^%zewdCompiler7(listName,.listArray,sessid)
1157 QUIT
1158 ;
1159 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1160 ;
1161removeFromList(listName,codeValue,sessid)
1162 ;
1163 ;d removeFromList^%zewdCompiler7(listName,codeValue,sessid)
1164 n position
1165 ;
1166 QUIT:$g(listName)=""
1167 QUIT:$g(sessid)=""
1168 QUIT:$g(codeValue)=""
1169 ;
1170 s position=$g(^%zewdSession("session",sessid,"ewd_listIndex",listName,codeValue))
1171 QUIT:position=""
1172 k ^%zewdSession("session",sessid,"ewd_list",listName,position)
1173 k ^%zewdSession("session",sessid,"ewd_listIndex",listName,codeValue)
1174 d setWLDSymbol("ewd_list",sessid)
1175 d setWLDSymbol("ewd_listIndex",sessid)
1176 QUIT
1177 ;
1178 ;
1179 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1180 ;
1181copyList(fromListName,toListName,sessid)
1182 ;
1183 d copyList^%zewdCompiler7($g(fromListName),$g(toListName),$g(sessid))
1184 QUIT
1185 ;
1186 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1187 ;
1188getTextFromList(listName,codeValue,sessid)
1189 ;
1190 QUIT $$getTextFromList^%zewdCompiler7(listName,codeValue,sessid)
1191 ;
1192 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1193 ;
1194replaceOptionsByFieldName(formName,fieldName,listName,sessid)
1195 ;
1196 QUIT $$replaceOptionsByFieldName^%zewdCompiler7(formName,fieldName,listName,sessid)
1197 ;
1198 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1199replaceOptionsByID(fieldID,listName,sessid)
1200 ;
1201 QUIT $$replaceOptionsByID^%zewdCompiler7(fieldID,listName,sessid)
1202 ;
1203 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1204 ;
1205getUploadedFileName(fieldName,sessid)
1206 ;
1207 n filename,technology
1208 s technology=$$getSessionValue^%zewdAPI("ewd_technology",sessid)
1209 QUIT 0
1210 ;
1211getUploadedFileNameErr
1212 set $zt=""
1213 QUIT ""
1214 ;
1215 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1216 ;
1217getUploadedFileSize(fieldName,sessid)
1218 ;
1219 set $zt="getUploadedFileSizeErr"
1220 QUIT 0
1221 ;
1222getUploadedFileSizeErr ;
1223 set $zt=""
1224 QUIT ""
1225 ;
1226 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1227 ;
1228getUploadedFileType(fieldName,sessid)
1229 ;
1230 set $zt="getUploadedFileTypeErr"
1231 QUIT 0
1232 ;
1233getUploadedFileTypeErr
1234 set $zt=""
1235 QUIT ""
1236 ;
1237 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1238 ;
1239errorOccurred(sessid)
1240 ;
1241 n warning
1242 ;
1243 i $g(Error)="" QUIT 0
1244 s warning=$$getSessionValue("ewd_warning",sessid)
1245 QUIT Error'=warning
1246 ;
1247 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1248 ;
1249removeQuotes(string)
1250 ;
1251 n quoted,c1,quote
1252 s quote=""
1253 s c1=$e(string,1)
1254 s quoted=0
1255 i c1=""""!(c1="'") s quoted=1,quote=c1
1256 i 'quoted QUIT string
1257 i $e(string,$l(string))'=quote QUIT string
1258 QUIT $e(string,2,$l(string)-1)
1259 ;
1260 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1261 ;
1262escapeQuotes(text)
1263 ;
1264 s text=$$replaceAll(text,"'",$c(4))
1265 s text=$$replaceAll(text,$c(4),"\'")
1266 s text=$$replaceAll(text,"""",$c(4))
1267 s text=$$replaceAll(text,$c(4),"\""")
1268 ;
1269 QUIT text
1270 ;
1271 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1272 ;
1273getAttrValue(attrName,attrValues,technology)
1274 QUIT $$getAttrValue^%zewdCompiler4(attrName,.attrValues,technology)
1275 ;
1276 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1277 ;
1278replaceAll(InText,FromStr,ToStr) ; Replace all occurrences of a substring
1279 ;
1280 n %p
1281 ;
1282 s %p=InText
1283 i ToStr[FromStr d QUIT %p
1284 . n i,stop,tempText,tempTo
1285 . s stop=0
1286 . f i=0:1:255 d q:stop
1287 . . q:InText[$c(i)
1288 . . q:FromStr[$c(i)
1289 . . q:ToStr[$c(i)
1290 . . s stop=1
1291 . s tempTo=$c(i)
1292 . s tempText=$$replaceAll(InText,FromStr,tempTo)
1293 . s %p=$$replaceAll(tempText,tempTo,ToStr)
1294 f q:%p'[FromStr S %p=$$replace(%p,FromStr,ToStr)
1295 QUIT %p
1296 ;
1297replace(InText,FromStr,ToStr) ; replace old with new in string
1298 ;
1299 n %p1,%p2
1300 ;
1301 i InText'[FromStr q InText
1302 s %p1=$p(InText,FromStr,1),%p2=$p(InText,FromStr,2,255)
1303 QUIT %p1_ToStr_%p2
1304 ;
1305 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1306 ;
1307addImmediateOneOffTask(executeCode,startTime,namespace,rc,rm)
1308 QUIT $$addImmediateOneOffTask^%zewdScheduler($g(executeCode),$g(startTime),$g(namespace),.rc,.rm)
1309 ;
1310 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1311 ;
1312getDataTypeErrors(errorArray,sessid)
1313 k errorArray
1314 d mergeArrayFromSession(.errorArray,"ewd_DataTypeError",sessid)
1315 QUIT
1316 ;
1317clearSchemaFormErrors(sessid)
1318 d deleteFromSession("ewd_SchemaFormError",sessid)
1319 QUIT
1320 ;
1321getSchemaFormErrors(errorArray,sessid)
1322 QUIT $$getSchemaFormErrors^%zewdCompiler13(.errorArray,$g(sessid))
1323 ;
1324setSchemaFormErrors(errorArray,sessid)
1325 ;
1326 n sessionName
1327 ;
1328 s sessionName="ewd_SchemaFormError"
1329 d deleteFromSession(sessionName,sessid)
1330 d mergeArrayToSession(.errorArray,sessionName,sessid)
1331 QUIT
1332 ;
1333removeInstanceDocument(instanceName)
1334 ;
1335 n ok
1336 s ok=$$openDOM
1337 i ok'="" QUIT ok
1338 s ok=$$removeDocument^%zewdDOM(instanceName,"","")
1339 d clearXMLIndex^%zewdSchemaForm(instanceName)
1340 s ok=$$closeDOM^%zewdDOM()
1341 QUIT ""
1342 ;
1343 ;
1344makeTokenString(length)
1345 ;
1346 n string,token,i
1347 ;
1348 s string="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
1349 s token=""
1350 f i=1:1:length s token=token_$e(string,($r($l(string))+1))
1351 QUIT token
1352 ;
1353makeString(%char,%len) ; create a string of len characters
1354 ;
1355 n %str
1356 ;
1357 s %str="",$p(%str,%char,%len+1)=""
1358 QUIT %str
1359 ;
1360convertDateToSeconds(hdate)
1361 ;
1362 Q (hdate*86400)+$p(hdate,",",2)
1363 ;
1364convertSecondsToDate(secs)
1365 ;
1366 QUIT (secs\86400)_","_(secs#86400)
1367 ;
1368getTokenExpiry(token)
1369 ;
1370 n sessid
1371 ;
1372 i $g(token)="" QUIT 0
1373 s sessid=+$g(^%zewdSession("tokens",token))
1374 i sessid="" QUIT 0
1375 QUIT $$getSessionValue("ewd_sessionExpiry",sessid)
1376 ;
1377isTokenExpired(token)
1378 ;
1379 ;QUIT $$getTokenExpiry(token)'>$$convertDateToSeconds($h)
1380 QUIT $$getTokenExpiry(token)'>(($h*86400)+$p($h,",",2))
1381 ;
1382randChar()
1383 ;
1384 n string
1385 ;
1386 s string="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
1387 QUIT $e(string,($R($l(string))+1))
1388 ;
1389lowerCase(string)
1390 QUIT $tr(string,"ABCDEFGHIJKLMNOPQRSTUVQXYZ","abcdefghijklmnopqrstuvwxyz")
1391 ;
1392stripSpaces(string)
1393 s string=$$stripLeadingSpaces(string)
1394 QUIT $$stripTrailingSpaces(string)
1395 ;
1396stripLeadingSpaces(string)
1397 n i
1398 ;
1399 f i=1:1:$l(string) QUIT:$e(string,i)'=" "
1400 QUIT $e(string,i,$l(string))
1401 ;
1402stripTrailingSpaces(string)
1403 n i,spaces,new
1404 ;
1405 s spaces=$$makeString(" ",100)
1406 s new=string_spaces
1407 QUIT $p(new,spaces,1)
1408 ;
1409parseMethod(methodString,class,method)
1410 ;
1411 n %p1,%p2,meth
1412 ;
1413 s %p1=$p(methodString,"##class(",2)
1414 s class=$p(%p1,")",1)
1415 s %p2=$p(%p1,")",2,500)
1416 s method=$p(%p2,".",2)
1417 s method=$p(method,"(",1)
1418 QUIT
1419 ;
1420event(requestArray)
1421 QUIT $$event^%zewdPHP(.requestArray)
1422 ;
1423clearURLNVP(urlNo)
1424 ;
1425 QUIT
1426 ;
1427setURLNVP(urlNo,name)
1428 ;
1429 QUIT
1430 ;
1431decodeDataType(name,dataType,sessid)
1432 ;
1433 n value,inputMethod,x,decodedValue
1434 ;
1435 q:$g(name)=""
1436 q:$g(dataType)=""
1437 s value=$$getSessionValue(name,sessid)
1438 s inputMethod=$$getInputMethod^%zewdCompiler(dataType)
1439 q:inputMethod=""
1440 s x="s decodedValue=$$"_inputMethod_"("""_value_""",sessid)"
1441 x x
1442 d setSessionValue(name,decodedValue,sessid)
1443 QUIT
1444 ;
1445encodeDataType(name,dataType,sessid)
1446 QUIT $$encodeDataType^%zewdCompiler13($g(name),$g(dataType),$g(sessid))
1447 ;
1448copyURLNVPsToSession(urlNo)
1449 ;
1450 n name
1451 ;
1452 QUIT
1453 ;
1454doubleQuotes(string)
1455 ;
1456 s string=$$replaceAll(string,"""",$c(1,1))
1457 s string=$tr(string,$c(1),"""")
1458 QUIT string
1459 ;
1460 ; ==========================================================================
1461 ; Error Trap Functions
1462 ; ==========================================================================
1463 ;
1464copySessionToSymbolTable(sessid)
1465 d copySessionToSymbolTable^%zewdCompiler16($g(sessid))
1466 QUIT
1467 ;
1468saveSymbolTable(sessid)
1469 ;
1470 n ok
1471 ;s sessid=0
1472 k ^%zewdError(sessid)
1473 n %zzv
1474 k ^%zewdError(sessid)
1475 s %zzv="%"
1476 f s %zzv=$o(@%zzv) Q:%zzv="" m ^%zewdError(sessid,%zzv)=@%zzv
1477 QUIT
1478 ;
1479recoverSymbolTable(sessid,web)
1480 n (sessid,web)
1481 n %zzv
1482 s %zzv=""
1483 f s %zzv=$o(^%zewdError(sessid,%zzv)) QUIT:%zzv="" d
1484 . m @%zzv=^%zewdError(sessid,%zzv)
1485 d writeSymbolTable(web)
1486 QUIT
1487 ;
1488writeSymbolTable(web)
1489 i $g(web) w "<pre>"
1490 zwrite
1491 i $g(web) w "</pre>"
1492 QUIT
1493 ;
1494loadErrorSymbols(sessid)
1495 d loadErrorSymbols^%zewdCompiler19($g(sessid))
1496 QUIT
1497 ;
1498deleteErrorLog(sessid)
1499 k ^%zewdError(sessid)
1500 QUIT
1501 ;
1502deleteAllErrorLogs
1503 k ^%zewdError
1504 QUIT
1505 ;
1506fileSize(path)
1507 QUIT $$fileSize^%zewdCompiler13($g(path))
1508 ;
1509fileExists(path)
1510 QUIT $$fileExists^%zewdCompiler13($g(path))
1511 ;
1512fileInfo(path,info)
1513 d fileInfo^%zewdCompiler13($g(path),.info)
1514 QUIT
1515 ;
1516directoryExists(path)
1517 QUIT $$directoryExists^%zewdCompiler13($g(path))
1518 ;
1519deleteFile(filepath)
1520 QUIT $$deleteFile^%zewdCompiler13($g(filepath))
1521 ;
1522renameFile(filepath,newpath)
1523 QUIT $$renameFile^%zewdCompiler13($g(filepath),$g(newpath))
1524 ;
1525createDirectory(path)
1526 QUIT $$createDirectory^%zewdCompiler13($g(path))
1527 ;
1528removeCR(string)
1529 i $e(string,$l(string))=$c(13) s string=$e(string,1,$l(string)-1)
1530 QUIT string
1531 ;
1532setApplicationRootPath(path)
1533 d setApplicationRootPath^%zewdCompiler(path)
1534 QUIT
1535 ;
1536applicationRootPath()
1537 QUIT $$applicationRootPath^%zewdCompiler()
1538 ;
1539getApplicationRootPath()
1540 QUIT $$getApplicationRootPath^%zewdCompiler()
1541 ;
1542setOutputRootPath(path,technology)
1543 d setOutputRootPath^%zewdCompiler(path,technology)
1544 QUIT
1545 ;
1546getRootURL(technology)
1547 QUIT $$getRootURL^%zewdCompiler(technology)
1548 ;
1549setRootURL(cspURL,technology)
1550 d setRootURL^%zewdCompiler(cspURL,technology)
1551 QUIT
1552 ;
1553getDefaultTechnology()
1554 QUIT $$getDefaultTechnology^%zewdCompiler()
1555 ;
1556getDefaultMultiLingual()
1557 QUIT $$getDefaultMultiLingual^%zewdCompiler()
1558 ;
1559getOutputRootPath(technology)
1560 QUIT $$getOutputRootPath^%zewdCompiler(technology)
1561 ;
1562getJSScriptsPath(app,technology)
1563 QUIT $$getJSScriptsPath^%zewdCompiler8(app,technology)
1564 ;
1565getJSScriptsPathMode(technology)
1566 QUIT $$getJSScriptsPathMode^%zewdCompiler8(technology)
1567 ;
1568setJSScriptsPathMode(technology,mode)
1569 d setJSScriptsPathMode^%zewdCompiler8(technology,mode)
1570 QUIT
1571 ;
1572getJSScriptsRootPath(technology)
1573 QUIT $$getJSScriptsRootPath^%zewdCompiler8(technology)
1574 ;
1575setJSScriptsRootPath(technology,path)
1576 d setJSScriptsRootPath^%zewdCompiler8(technology,path)
1577 QUIT
1578 ;
1579getHomePage()
1580 QUIT $$getHomePage^%zewdCompiler()
1581 ;
1582setHomePage(homePage)
1583 d setHomePage^%zewdCompiler($g(homePage))
1584 QUIT
1585 ;
1586getApplications(appList)
1587 QUIT $$getApplications^%zewdCompiler16(.appList)
1588 ;
1589getPages(application,pageList)
1590 QUIT $$getPages^%zewdCompiler16($g(application),.pageList)
1591 ;
1592getDefaultFormat()
1593 QUIT $$getDefaultFormat^%zewdCompiler()
1594 ;
1595getNextChild(parentOID,childOID)
1596 i $g(parentOID)="" QUIT ""
1597 i childOID="" QUIT $$getFirstChild^%zewdDOM(parentOID)
1598 QUIT $$getNextSibling^%zewdDOM(childOID)
1599 ;
1600addCSPServerScript(parentOID,text)
1601 QUIT $$addCSPServerScript^%zewdCompiler4(parentOID,text)
1602 ;
1603createPHPCommand(data,docOID)
1604 QUIT $$createPHPCommand^%zewdCompiler4(data,docOID)
1605 ;
1606createJSPCommand(data,docOID)
1607 QUIT $$createJSPCommand^%zewdCompiler4(data,docOID)
1608 ;
1609instantiateJSPVar(var,type,docOID,arraySize,initialValue)
1610 d instantiateJSPVar^%zewdCompiler4(var,type,docOID,arraySize,initialValue)
1611 QUIT
1612 ;
1613removeIntermediateNode(inOID)
1614 d removeIntermediateNode^%zewdCompiler4(inOID)
1615 QUIT
1616 ;
1617getNormalisedAttributeValue(attrName,nodeOID,technology)
1618 QUIT $$getNormalAttributeValue^%zewdCompiler($g(attrName),$g(nodeOID),$g(technology))
1619 ;
1620getNormalAttributeValue(attrName,nodeOID,technology)
1621 QUIT $$getNormalAttributeValue^%zewdCompiler($g(attrName),$g(nodeOID),$g(technology))
1622 ;
1623getTagOID(tagName,docName,lowerCase)
1624 QUIT $$getTagOID^%zewdCompiler($g(tagName),$g(docName),$g(lowerCase))
1625 ;
1626getTagByNameAndAttr(tagName,attrName,attrValue,matchCase,docName)
1627 QUIT $$getTagByNameAndAttr^%zewdCompiler3($g(tagName),$g(attrName),$g(attrValue),$g(matchCase),$g(docName))
1628 ;
1629javascriptFunctionExists(functionName,docName)
1630 QUIT $$javascriptFunctionExists^%zewdCompiler7($g(functionName),$g(docName))
1631 ;
1632addJavascriptFunction(docName,jsTextArray)
1633 QUIT $$addJavascriptFunction^%zewdCompiler7($g(docName),.jsTextArray)
1634 ;
1635getJavascriptFunctionBody(functionName,docName)
1636 QUIT $$getJavascriptFunctionBody^%zewdCompiler7($g(functionName),docName)
1637 ;
1638replaceJavascriptFunctionBody(functionName,jsText,docName)
1639 QUIT $$replaceJavascriptFunctionBody^%zewdCompiler7($g(functionName),$g(jsText),$g(docName))
1640 ;
1641getDelim()
1642 QUIT $$getDelim^%zewdCompiler()
1643 ;
1644 ; ===========================================================================
1645 ; WLD conversion utilities
1646 ; ===========================================================================
1647 ;
1648configureWebLink(webserver,mode,alias,path)
1649 QUIT $$configure^%zewdWLD($g(webserver),$g(mode),$g(alias),$g(path))
1650 ;
1651mergeListToSession(fieldName,sessid)
1652 d mergeListToSession^%zewdCompiler16($g(fieldName),$g(sessid))
1653 QUIT
1654 ;
1655getPREVPAGE(sessid) ;
1656 QUIT $$getPREVPAGE^%zewdCompiler19($g(sessid)) ;
1657 ;
1658copyToWLDSymbolTable(sessid)
1659 d copyToWLDSymbolTable^%zewdCompiler16($g(sessid))
1660 ;
1661getPRESSED(sessid)
1662 QUIT $$getSessionValue("ewd_pressed",sessid)
1663 ;
1664copyToLIST(listName,sessid)
1665 ;
1666 k LIST(listName)
1667 m LIST(listName)=^%zewdSession("session",sessid,"ewd_list",listName)
1668 QUIT
1669 ;
1670copyToSELECTED(fieldName,sessid)
1671 ;
1672 k SELECTED(fieldName)
1673 m SELECTED(fieldName)=^%zewdSession("session",sessid,"ewd_selected",fieldName)
1674 QUIT
1675 ;
1676traceModeOn
1677 s ^zewd("trace")=1
1678 QUIT
1679 ;
1680traceModeOff
1681 k ^zewd("trace")
1682 QUIT
1683 ;
1684getTraceMode()
1685 i $g(^zewd("trace"))=1 QUIT 1
1686 QUIT 0
1687 ;
1688trace(text,clear) ; trace ;
1689 n i
1690 s text=$g(text)
1691 i $g(clear)=1 k ^%zewdTrace
1692 s i=$increment(^%zewdTrace)
1693 s ^%zewdTrace(i)=text
1694 QUIT
1695 ;
1696inetDate(hdate) ; Decode $H date and time to Internet format
1697 ;
1698 N %d,%day,%time,%date
1699 ;
1700 S %time=$P(hdate,",",2)
1701 I %time>86400 D
1702 .S %time=%time-86400
1703 .S hdate=(hdate+1)_","_%time
1704 ;
1705 S %d="Thu,Fri,Sat,Sun,Mon,Tue,Wed"
1706 S %day=(hdate#7)+1
1707 S %day=$P(%d,",",%day)
1708 ;
1709 S %date=$$decDate(hdate)
1710 ;S %date=$TR(%date," ","-")
1711 S %time=$$inetTime(hdate)
1712 S %date=%day_", "_%date_" "_%time
1713 Q %date
1714decDate(hdate) ; Decode a date from $H format
1715 ;
1716 n %yy,%mm,%dd,%d1,%d
1717 i $zv'["GT.M" d
1718 . s %d1=$zd(hdate,5)
1719 . s %yy=$p(%d1,", ",2)
1720 . s %dd=+$p(%d1," ",2) I %dd<10 S %dd="0"_%dd
1721 . s %mm=$p(%d1," ",1)
1722 e d
1723 . n p1,p2
1724 . s %d1=$zd(hdate,2)
1725 . s %dd=$p(%d1,"-",1)
1726 . s %mm=$p(%d1,"-",2)
1727 . s p1=$e(%mm,1),p2=$e(%mm,2,$l(%mm))
1728 . s %mm=p1_$$lowerCase(p2)
1729 . s %yy=$p(%d1,"-",3)
1730 . i hdate>58073 s %yy="20"_%yy
1731 s %d=%dd_" "_%mm_" "_%yy
1732 QUIT %d
1733 ;
1734inetTime(hdate) ; Decode Internet Format Time from $H format
1735 ; Offset is relative to GMT, eg -0500
1736 ;
1737 n hh,mm,ss,time
1738 s time=$p(hdate,",",2)
1739 s hh=time\3600 i hh<10 s hh="0"_hh
1740 s time=time#3600
1741 s mm=time\60 i mm<10 s mm="0"_mm
1742 s ss=time#60 i ss<10 s ss="0"_ss
1743 QUIT hh_":"_mm_":"_ss
1744 ;
1745openNewFile(filepath)
1746 QUIT $$openNewFile^%zewdCompiler($g(filepath))
1747 ;
1748openFile(filepath)
1749 QUIT $$openFile^%zewdCompiler($g(filepath))
1750 ;
1751openDOM()
1752 ;
1753 n i,ok
1754 ;
1755 f i=1:1:20 s ok=$$openDOM^%zewdDOM(0,,,,,,,,,,,,,,,,,) q:$$zcvt(ok,"l")["licensing violation" q:ok="" h 1
1756 i ok'="" s ok="No eXtc Licenses available!"
1757 QUIT ok
1758 ;
1759removeChild(nodeOID,removeFromDOM)
1760 ;
1761 n ver
1762 ;
1763 s ver=""
1764 QUIT $$removeChild^%zewdDOM(nodeOID,$g(removeFromDOM))
1765 ;
1766removeAttribute(attrName,nodeOID,removeFromDOM)
1767 ;
1768 n ver
1769 ;
1770 s ver=""
1771 d removeAttribute^%zewdDOM(attrName,nodeOID,$g(removeFromDOM)) QUIT
1772 ;
1773removeAttributeNS(ns,attrName,nodeOID,removeFromDOM)
1774 ;
1775 n ver
1776 ;
1777 s ver=""
1778 d removeAttributeNS^%zewdDOM(ns,attrName,nodeOID,$g(removeFromDOM)) QUIT
1779 ;
1780removeIntermediateNodeeXtc(nodeOID,removeFromDOM)
1781 ;
1782 n ver
1783 ;
1784 d removeIntermediateNode^%zewdDOM(nodeOID,$g(removeFromDOM))
1785 QUIT
1786 ;
1787export(fileName,prefix,extension)
1788 d export^%zewdCompiler16($g(fileName),$g(prefix),$g(extension))
1789 QUIT
1790 ;
1791import(fileName)
1792 ;
1793 i $g(fileName)="" s fileName="zewd.xml"
1794 QUIT
1795 ;
1796listDOMsByPrefix(prefix)
1797 d listDOMsByPrefix^%zewdCompiler19($g(prefix))
1798 QUIT
1799 ;
1800removeDOMsByPrefix(prefix)
1801 d removeDOMsByPrefix^%zewdCompiler19($g(prefix))
1802 QUIT
1803 ;
1804dumpDOM(docName)
1805 ;
1806 d dumpDOM^%zewdCompiler20($g(docName))
1807 QUIT
1808 ;
1809namespace()
1810 QUIT $zdir
1811 ;
1812setNamespace(namespace)
1813 s $zdir=namespace
1814 QUIT
1815 ;
1816zcvt(string,param,param2)
1817 ;
1818 i $g(param)="" s param="l"
1819 i param="l"!(param="L") QUIT $tr(string,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
1820 i param="u"!(param="U") QUIT $tr(string,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
1821 QUIT string
1822 ;
1823getIP() ; Get own IP address
1824 ;
1825 n ip,ipInfo
1826 ;
1827 QUIT $g(ip)
1828 ;
1829ajaxErrorRedirect(sessid)
1830 ;
1831 n errorPage
1832 ;
1833 s errorPage=$$getSessionValue^%zewdAPI("ewd.errorPage",sessid)
1834 d setRedirect^%zewdAPI(errorPage,sessid)
1835 ;
1836 QUIT ""
1837 ;
1838classExport(className,methods,filepath)
1839 ;
1840 QUIT $$classExport^%zewdCompiler16($g(className),.methods,$g(filepath))
1841 ;
1842strx(string)
1843 n i,c,a,ok
1844 f i=1:1:$l(string) s c=$e(string,i),a=$a(c) w i_": "_c_" : "_a,! r ok
1845 QUIT
1846 ;
1847disableEwdMgr
1848 s ^%zewd("disabled")=1
1849 QUIT
1850 ;
1851enableEwdMgr
1852 k ^%zewd("disabled")
1853 QUIT
1854 ;
1855enableWLDAccess(app,page)
1856 i $g(^zewd("allowWLDAccess",$$zcvt(app,"l"),$$zcvt(page,"l")))'=1 s ^zewd("allowWLDAccess",$$zcvt(app,"l"),$$zcvt(page,"l"))=1
1857 QUIT
1858 ;
1859disableWLDAccess(app,page)
1860 k ^zewd("allowWLDAccess",$$zcvt(app,"l"),$$zcvt(page,"l"))
1861 QUIT
1862isSSOValid(sso,username,password,sessid)
1863 QUIT $$isSSOValid^%zewdMgrAjax2($g(sso),$g(username),$g(password),$g(sessid))
1864 ;
1865uniqueId(nodeOID,filename)
1866 QUIT $p(filename,".ewd",1)_$p(nodeOID,"-",2)
1867 ;
1868exportToGTM(routine)
Note: See TracBrowser for help on using the repository browser.