Changeset 1428 for ccr/branches/ohum/p/C0CEWD.m
- Timestamp:
- May 11, 2012, 6:06:25 PM (14 years ago)
- File:
-
- 1 edited
-
ccr/branches/ohum/p/C0CEWD.m (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ccr/branches/ohum/p/C0CEWD.m
r1342 r1428 1 C0CEWD ; CCDCCR/GPL - CCR EWD utilities; 1/6/112 ;;0.1;CCDCCR;nopatch;noreleasedate;Build 2 3 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU4 ;General Public License See attached copy of the License.5 ;6 ;This program is free software; you can redistribute it and/or modify7 ;it under the terms of the GNU General Public License as published by8 ;the Free Software Foundation; either version 2 of the License, or9 ;(at your option) any later version.10 ;11 ;This program is distributed in the hope that it will be useful,12 ;but WITHOUT ANY WARRANTY; without even the implied warranty of13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14 ;GNU General Public License for more details.15 ;16 ;You should have received a copy of the GNU General Public License along17 ;with this program; if not, write to the Free Software Foundation, Inc.,18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.19 ;20 Q21 ;22 TOKEN() ; EXTRINSIC WHICH RETURNS A NEW RANDOM TOKEN23 Q $$UUID^C0CUTIL ; USE THE UUID FUNCTION IN THE CCR PACKAGE24 ;25 STORE(ZARY) ; STORE AN ARRAY OF VALUES INDEXED BY A NEW TOKEN26 ; IN ^TMP("C0E","TOKEN") FOR LATER RETRIEVAL FROM INSIDE AN EWD SESSION27 ; RETURNS THE TOKEN. ZARY IS PASSED BY NAME28 N ZT29 S ZT=$$TOKEN ; GET A NEW TOKEN30 M ^TMP("C0E","TOKEN",ZT)=@ZARY ;31 Q ZT32 ;33 GET(C0ERTN,C0ETOKEN,NOKILL) ; RETRIEVE A STORED ARRAY INDEXED BY ZTOKEN34 ; KILL THE ARRAY AFTER RETRIEVAL UNLESS NOKILL=135 ; C0ERTN IS PASSED BY NAME36 I '$D(^TMP("C0E","TOKEN",C0ETOKEN)) D Q ; DOESN'T EXIST37 . S @C0ERTN="" ; PASS BACK NULL38 M @C0ERTN=^TMP("C0E","TOKEN",C0ETOKEN) ; RETRIEVE39 I $G(NOKILL)'=1 K ^TMP("C0E","TOKEN",C0ETOKEN) ; DELETE40 Q41 ;42 URLTOKEN(sessid) ; EXTRINSIC WHICH RETRIEVES THE TOKEN PASSED ON THE URL43 ; IN EWD EXAMPLE: https://example.com/ewd/myApp/index.ewd?token="12345"44 N token45 S token=""46 s token=$$getRequestValue^%zewdAPI("token",sessid)47 s token=$tr(token,"""") ; strip out quotes48 Q token49 ;50 cbTestMethod(prefix,seedValue,lastSeedValue,optionNo,options) 51 ;52 n maxNo,noFound53 ;54 s maxNo=5055 s noFound=056 f s seedValue=$o(^DPT("B",seedValue)) q:seedValue="" q:noFound=maxNo d57 . s lastSeedValue=seedValue58 . i prefix'="",$e(seedValue,1,$l(prefix))'=prefix q59 . s optionNo=optionNo+160 . s noFound=noFound+161 . s options(optionNo)=seedValue62 QUIT63 ;64 set1 ;65 s ^zewd("comboPlus","methodMap","test")="cbTestMethod^C0PEREW"66 q67 ;68 test1(sessid) ;69 d setSessionValue^%zewdAPI("testing","ZZ",sessid)70 q 071 ;1 C0CEWD ; CCDCCR/GPL - CCR EWD utilities; 1/6/11 2 ;;1.2;C0C;;May 11, 2012;Build 46 3 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU 4 ;General Public License See attached copy of the License. 5 ; 6 ;This program is free software; you can redistribute it and/or modify 7 ;it under the terms of the GNU General Public License as published by 8 ;the Free Software Foundation; either version 2 of the License, or 9 ;(at your option) any later version. 10 ; 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 General Public License for more details. 15 ; 16 ;You should have received a copy of the GNU General Public License along 17 ;with this program; if not, write to the Free Software Foundation, Inc., 18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 ; 20 Q 21 ; 22 TOKEN() ; EXTRINSIC WHICH RETURNS A NEW RANDOM TOKEN 23 Q $$UUID^C0CUTIL ; USE THE UUID FUNCTION IN THE CCR PACKAGE 24 ; 25 STORE(ZARY) ; STORE AN ARRAY OF VALUES INDEXED BY A NEW TOKEN 26 ; IN ^TMP("C0E","TOKEN") FOR LATER RETRIEVAL FROM INSIDE AN EWD SESSION 27 ; RETURNS THE TOKEN. ZARY IS PASSED BY NAME 28 N ZT 29 S ZT=$$TOKEN ; GET A NEW TOKEN 30 M ^TMP("C0E","TOKEN",ZT)=@ZARY ; 31 Q ZT 32 ; 33 GET(C0ERTN,C0ETOKEN,NOKILL) ; RETRIEVE A STORED ARRAY INDEXED BY ZTOKEN 34 ; KILL THE ARRAY AFTER RETRIEVAL UNLESS NOKILL=1 35 ; C0ERTN IS PASSED BY NAME 36 I '$D(^TMP("C0E","TOKEN",C0ETOKEN)) D Q ; DOESN'T EXIST 37 . S @C0ERTN="" ; PASS BACK NULL 38 M @C0ERTN=^TMP("C0E","TOKEN",C0ETOKEN) ; RETRIEVE 39 I $G(NOKILL)'=1 K ^TMP("C0E","TOKEN",C0ETOKEN) ; DELETE 40 Q 41 ; 42 URLTOKEN(sessid) ; EXTRINSIC WHICH RETRIEVES THE TOKEN PASSED ON THE URL 43 ; IN EWD EXAMPLE: https://example.com/ewd/myApp/index.ewd?token="12345" 44 N token 45 S token="" 46 s token=$$getRequestValue^%zewdAPI("token",sessid) 47 s token=$tr(token,"""") ; strip out quotes 48 Q token 49 ; 50 cbTestMethod(prefix,seedValue,lastSeedValue,optionNo,options) 51 ; 52 n maxNo,noFound 53 ; 54 s maxNo=50 55 s noFound=0 56 f s seedValue=$o(^DPT("B",seedValue)) q:seedValue="" q:noFound=maxNo d 57 . s lastSeedValue=seedValue 58 . i prefix'="",$e(seedValue,1,$l(prefix))'=prefix q 59 . s optionNo=optionNo+1 60 . s noFound=noFound+1 61 . s options(optionNo)=seedValue 62 QUIT 63 ; 64 set1 ; 65 s ^zewd("comboPlus","methodMap","test")="cbTestMethod^C0PEREW" 66 q 67 ; 68 test1(sessid) ; 69 d setSessionValue^%zewdAPI("testing","ZZ",sessid) 70 q 0 71 ;
Note:
See TracChangeset
for help on using the changeset viewer.
