-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_WHOME.m
executable file
·137 lines (136 loc) · 3.92 KB
/
_WHOME.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
%WHOME ; VEN/SMH - Home page processor;2018-08-17 9:19 AM
;;
;
EN(RESULT) ; PEP
S RESULT("mime")="text/html; charset=utf-8"
N CRLF S CRLF=$C(13,10)
SET RESULT(1)="<html><b>Home page</b></html>"
quit
N ARGS S ARGS("*")="index.html"
; Retrieve index.html from filesystem before returning default page
D FILESYS^%W0(.RESULT,.ARGS)
I $D(^TMP("HTTPERR",$J)) K ^TMP("HTTPERR",$J),HTTPERR,RESULT
; If we found an index.html don't return the default
I $D(RESULT) QUIT
; return default index.html
S RESULT("mime")="text/html; charset=utf-8"
N I F I=1:1 S RESULT(I)=$P($TEXT(HTML+I),";;",2,99) Q:RESULT(I)="" D
. I RESULT(I)["<%TABLEDATA%>" D
.. N IEN S IEN=0 F J=I:.0001 S IEN=$O(^%W(17.6001,IEN)) Q:'IEN D
... S RESULT(J)="<tr>",J=J+.0001
... S RESULT(J)="<td>"_^%W(17.6001,IEN,0)_"</td>",J=J+.0001
... S RESULT(J)="<td>"_^%W(17.6001,IEN,1)_"</td>",J=J+.0001
... ;
... N EP S EP=^%W(17.6001,IEN,2) N RTN S RTN=$P(EP,"^",2),RTN=$$URLENC^VPRJRUT(RTN)
... S RESULT(J)="<td><a href=""r/"_RTN_""">"_EP_"</td>",J=J+.0001
... ;
... N AUTH S AUTH=$P($G(^%W(17.6001,IEN,"AUTH")),"^",1),AUTH=$S(AUTH:"YES",1:"NO")
... S RESULT(J)="<td>"_AUTH_"</td>",J=J+.0001
... ;
... N KEY S KEY=$P($G(^%W(17.6001,IEN,"AUTH")),"^",2) I KEY S KEY=$P($G(^DIC(19.1,KEY,0)),"^")
... S RESULT(J)="<td>"_KEY_"</td>",J=J+.0001
... ;
... N RKEY S RKEY=$P($G(^%W(17.6001,IEN,"AUTH")),"^",3) I RKEY S RKEY=$P($G(^DIC(19.1,RKEY,0)),"^")
... S RESULT(J)="<td>"_RKEY_"</td>",J=J+.0001
... ;
... N OPT S OPT=$P($G(^%W(17.6001,IEN,"AUTH")),"^",4) I OPT S OPT=$P($G(^DIC(19,OPT,0)),"^")
... S RESULT(J)="<td>"_OPT_"</td>",J=J+.0001
... ;
... S RESULT(J)="</tr>"
. I RESULT(I)="<%FOOTER%>" D
.. S RESULT(I)="$JOB="_$J_" | $SYSTEM="_$SYSTEM_" | ^DD(""SITE"")="_$G(^DD("SITE"))
.. S RESULT(I)=RESULT(I)_" | ^DD(""SITE"",1)="_$G(^DD("SITE",1))
. S RESULT(I)=RESULT(I)_CRLF
KILL RESULT(I) ; Kill last one which is empty.
QUIT
;
HTML ; HTML to Write out
;;<!doctype html>
;;<html>
;;<head>
;;<title>MUMPS Restful Web-Services Portal</title>
;;<style>
;; body {
;; margin: 0 0 0 0;
;; font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
;; font-size: 14px;
;; line-height: 1.428571429;
;; background-color: rgb(245, 217, 181)
;; }
;; header {
;; background-color: rgb(92, 81, 37);
;; box-sizing: border-box;
;; color: rgb(253, 252, 245);
;; text-align: center;
;; vertical-align: middle;
;; padding-top: 1.2em;
;; padding-bottom: 0.5em;
;; position: fixed;
;; top: 0;
;; right: 0;
;; left: 0;
;; }
;; header > span {
;; font-size: 3em;
;; line-height: 1em;
;; }
;; footer {
;; background-color: black;
;; box-sizing: border-box;
;; color: white;
;; #position: fixed;
;; #bottom: 0;
;; width: 100%;
;; text-align: center;
;; }
;; main {
;; box-sizing: border-box;
;; display: block;
;; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
;; padding-bottom: 140px;
;; padding-left: 15px;
;; padding-right: 15px;
;; padding-top: 140px;
;; text-align: left;
;; text-shadow: rgba(0, 0, 0, 0.14902) 0px 1px 0px;
;; }
;; table, td, tr, th {
;; border: 1px solid black;
;; border-collapse:collapse;
;; padding: 15px;
;; }
;;</style>
;;</head>
;;<body>
;;<header>
;; <span>MUMPS Restful Web-Services Portal</span>
;;</header>
;;<main>
;;<p>
;; Welcome to the MUMPS Advanced Shell Web Services.
;;</p>
;;<p>
;; Here is a list of web services configured on this server.
;; <table>
;; <tr>
;; <th>HTTP VERB</th>
;; <th>URI</th>
;; <th>Execution Endpoint</th>
;; <th>Authentication Required?</th>
;; <th>Security Key</th>
;; <th>Reverse Key</th>
;; <th>Access to Option</th>
;; <th>Example Call</th>
;; <th>Description</th>
;; </tr>
;; <%TABLEDATA%>
;; </table>
;;</p>
;;</main>
;;<footer>
;;<span>
;;<%FOOTER%>
;;</span>
;;</footer>
;;</body>
;;</html>