[1544] | 1 | C0CEWD ; CCDCCR/GPL - CCR EWD utilities; 1/6/11
|
---|
[1586] | 2 | ;;1.2;CCD/CCR GENERATION UTILITIES;;Oct 30, 2012;Build 50
|
---|
[1544] | 3 | ;
|
---|
[1586] | 4 | ;Copyright 2011 George Lilly.
|
---|
[1544] | 5 | ;
|
---|
[1586] | 6 | ; This program is free software: you can redistribute it and/or modify
|
---|
| 7 | ; it under the terms of the GNU Affero General Public License as
|
---|
| 8 | ; published by the Free Software Foundation, either version 3 of the
|
---|
| 9 | ; License, or (at your option) any later version.
|
---|
[1544] | 10 | ;
|
---|
[1586] | 11 | ; This program is distributed in the hope that it will be useful,
|
---|
| 12 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | ; GNU Affero General Public License for more details.
|
---|
[1544] | 15 | ;
|
---|
[1586] | 16 | ; You should have received a copy of the GNU Affero General Public License
|
---|
| 17 | ; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 18 | ;
|
---|
[1544] | 19 | Q
|
---|
| 20 | ;
|
---|
| 21 | TOKEN() ; EXTRINSIC WHICH RETURNS A NEW RANDOM TOKEN
|
---|
| 22 | Q $$UUID^C0CUTIL ; USE THE UUID FUNCTION IN THE CCR PACKAGE
|
---|
| 23 | ;
|
---|
| 24 | STORE(ZARY) ; STORE AN ARRAY OF VALUES INDEXED BY A NEW TOKEN
|
---|
| 25 | ; IN ^TMP("C0E","TOKEN") FOR LATER RETRIEVAL FROM INSIDE AN EWD SESSION
|
---|
| 26 | ; RETURNS THE TOKEN. ZARY IS PASSED BY NAME
|
---|
| 27 | N ZT
|
---|
| 28 | S ZT=$$TOKEN ; GET A NEW TOKEN
|
---|
| 29 | M ^TMP("C0E","TOKEN",ZT)=@ZARY ;
|
---|
| 30 | Q ZT
|
---|
| 31 | ;
|
---|
| 32 | GET(C0ERTN,C0ETOKEN,NOKILL) ; RETRIEVE A STORED ARRAY INDEXED BY ZTOKEN
|
---|
| 33 | ; KILL THE ARRAY AFTER RETRIEVAL UNLESS NOKILL=1
|
---|
| 34 | ; C0ERTN IS PASSED BY NAME
|
---|
| 35 | I '$D(^TMP("C0E","TOKEN",C0ETOKEN)) D Q ; DOESN'T EXIST
|
---|
| 36 | . S @C0ERTN="" ; PASS BACK NULL
|
---|
| 37 | M @C0ERTN=^TMP("C0E","TOKEN",C0ETOKEN) ; RETRIEVE
|
---|
| 38 | I $G(NOKILL)'=1 K ^TMP("C0E","TOKEN",C0ETOKEN) ; DELETE
|
---|
| 39 | Q
|
---|
| 40 | ;
|
---|
| 41 | URLTOKEN(sessid) ; EXTRINSIC WHICH RETRIEVES THE TOKEN PASSED ON THE URL
|
---|
| 42 | ; IN EWD EXAMPLE: https://example.com/ewd/myApp/index.ewd?token="12345"
|
---|
| 43 | N token
|
---|
| 44 | S token=""
|
---|
| 45 | s token=$$getRequestValue^%zewdAPI("token",sessid)
|
---|
| 46 | s token=$tr(token,"""") ; strip out quotes
|
---|
| 47 | Q token
|
---|
| 48 | ;
|
---|
| 49 | cbTestMethod(prefix,seedValue,lastSeedValue,optionNo,options)
|
---|
| 50 | ;
|
---|
| 51 | n maxNo,noFound
|
---|
| 52 | ;
|
---|
| 53 | s maxNo=50
|
---|
| 54 | s noFound=0
|
---|
| 55 | f s seedValue=$o(^DPT("B",seedValue)) q:seedValue="" q:noFound=maxNo d
|
---|
| 56 | . s lastSeedValue=seedValue
|
---|
| 57 | . i prefix'="",$e(seedValue,1,$l(prefix))'=prefix q
|
---|
| 58 | . s optionNo=optionNo+1
|
---|
| 59 | . s noFound=noFound+1
|
---|
| 60 | . s options(optionNo)=seedValue
|
---|
| 61 | QUIT
|
---|
| 62 | ;
|
---|
| 63 | set1 ;
|
---|
| 64 | s ^zewd("comboPlus","methodMap","test")="cbTestMethod^C0PEREW"
|
---|
| 65 | q
|
---|
| 66 | ;
|
---|
| 67 | test1(sessid) ;
|
---|
| 68 | d setSessionValue^%zewdAPI("testing","ZZ",sessid)
|
---|
| 69 | q 0
|
---|
| 70 | ;
|
---|