Produced by Araxis Merge on 6/22/2017 10:29:11 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | RAMS_CIF.zip\RAMS_CIF\RAMS_CIF\scripts\RAMS_SQA_Deployment_Files_V3_20150128\rams-ui\Production Environment RAMS-UI\js | dynamicDashboard.js | Thu Jun 22 12:35:46 2017 UTC |
2 | RAMS_CIF.zip\RAMS_CIF\RAMS_CIF\scripts\RAMS_SQA_Deployment_Files_V3_20150128\rams-ui\Production Environment RAMS-UI\js | dynamicDashboard.js | Thu Jun 22 14:33:23 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 494 |
Changed | 2 | 4 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | /********* ********** ********** ********** ********** ** | |
2 | E1.1.0 RAM Increment 1 Patch C ode | |
3 | January 20 15 | |
4 | Department of Vetera n's Affair s/Booz All en Hamilto n | |
5 | dynamicDas hboard.js | |
6 | ********** ********** ********** ********** ********** */ | |
7 | ||
8 | //Linking in the sql database | |
9 | var restPa th = "http :// SERVER : PORT /RAMS-0.0. 1/"; | |
10 | //Linking in the sha repoint si te | |
11 | var siteUr l = "http: // SERVE R
|
|
12 | ||
13 | //template for usern ame that i s retrieve d from sha repoint | |
14 | var retrie vedUser = "testk"; | |
15 | ||
16 | //globals that have to be shar ed between functions | |
17 | var facili ty, id; | |
18 | var studyI D = 1; | |
19 | ||
20 | //Initial function c alled by H TML. kicks off the p rocess | |
21 | //to grab the userna me from sh arepoint | |
22 | function p rocess(){ | |
23 | //load ing connec tion to sh arepoint | |
24 | var cl ientContex t = new SP .ClientCon text(siteU rl); | |
25 | ||
26 | this.w ebsite = c lientConte xt.get_web (); | |
27 | this.c urrentUser _SP = webs ite.get_cu rrentUser( ); | |
28 | client Context.lo ad(current User_SP); | |
29 | //tryi ng to grab username informatio n from sha repoint | |
30 | client Context.ex ecuteQuery Async(Func tion.creat eDelegate( this, this .userQuery Succeeded) , Function .createDel egate(this , this.use rQueryFail ed)); | |
31 | }; | |
32 | ||
33 | //When we know that we have su ccessfully retrieved a usernam e from | |
34 | //sharepon it, then w e can set up the bas eline info rmation th at is need ed. | |
35 | function u serQuerySu cceeded(se nder, args ) { | |
36 | var us ername_SP, split; | |
37 | ||
38 | //pars ing out th e needed u sername fr om sharepo int | |
39 | userna me_SP = cu rrentUser_ SP.get_log inName(); | |
40 | split = username _SP.split( "\\"); | |
41 | retrie vedUser = split[1]; | |
42 | ||
43 | id = 1 ; | |
44 | ||
45 | //puts together the dashbo ard table | |
46 | create Table(); | |
47 | checkU ser(); | |
48 | ||
49 | //remo ves HTML t races that allow use r to leave dashboard page | |
50 | $('.st art').attr ("href", " irb-applic ations-gen eral.html? " + id + " ?" + retri evedUser); | |
51 | $( '.start'). html("Star t IRB Appl ication"); | |
52 | }; | |
53 | ||
54 | //notifyin g the user that thei r sharepoi nt usernam e couldn't be retrie ved | |
55 | function u serQueryFa iled(sende r, args) { | |
56 | alert( 'request f ailed ' + args.get_m essage() + '\n' + ar gs.get_sta ckTrace()) ; | |
57 | }; | |
58 | ||
59 | //checks t o see if t he current user is i n the sql database | |
60 | function c heckUser() { | |
61 | var us ers; | |
62 | var us erTable = new HashSe t(); | |
63 | ||
64 | //grab bing all t he users i n the data base and f ormatting the reciev ed JSON | |
65 | users = sendREST ("GET", "u ser", null , false); | |
66 | if(use rs.user.le ngth === u ndefined) | |
67 | us ers.user = [users.us er]; | |
68 | ||
69 | //chec king to se e if the u ser is in the sql da tabase | |
70 | for(va r i=0; i<u sers.user. length; i+ +){ | |
71 | us erTable.ad d(users.us er[i].disp layName); | |
72 | } | |
73 | ||
74 | if(!us erTable.co ntains(ret rievedUser )){ | |
75 | va r addUser = { | |
76 | "display Name": ret rievedUser , | |
77 | "loginNa me": curre ntUser_SP. get_title( ), | |
78 | "permane ntLoginIde ntifier": retrievedU ser, | |
79 | "usersID ": current User_SP.ge t_id() | |
80 | }; | |
81 | ||
82 | va r data = { | |
83 | "user": addUser | |
84 | }; | |
85 | ||
86 | se ndREST("PO ST", "mana ge/user", data, fals e); | |
87 | } | |
88 | }; | |
89 | ||
90 | //puts tog ether the dashboard table. Thi s will lis t out any studies th at | |
91 | //the user is associ ated with and provid e informat ion on tho se studies . | |
92 | function c reateTable (){ | |
93 | var re centStage, row, stud ies; | |
94 | var no Studies = true; | |
95 | ||
96 | //grab s all the studies th at have be en created . | |
97 | studie s = sendRE ST("GET", "manage/st udy", null , false); | |
98 | ||
99 | //form atting the recieved JSON | |
100 | if((st udies.stud y.length = == undefin ed) || (st udies.stud y.length = = 0)){ | |
101 | st udyID = 1; | |
102 | }else{ | |
103 | var study Length = s tudies.stu dy.length - 1; | |
104 | st udyID = st udies.stud y[studyLen gth].studi esID + 1; | |
105 | } | |
106 | ||
107 | //filt ering thro ugh the st udies and putting th e necessar y ones in the dashbo ard | |
108 | for(va r i=0; i<s tudies.stu dy.length; i++){ | |
109 | // accounting for recie ved JSON | |
110 | if (studies.s tudy[i].st udyStatusC ollection === undefi ned){ | |
111 | continue ; | |
112 | } | |
113 | ||
114 | // formatting the recie ved JSON | |
115 | if (studies.s tudy[i].st udyStatusC ollection. length === undefined ){ | |
116 | studies. study[i].s tudyStatus Collection = [studie s.study[i] .studyStat usCollecti on]; | |
117 | } | |
118 | ||
119 | // recentStag e relates to whether or not th e study is in draft or review | |
120 | re centStage = studies. study[i].s tudyStatus Collection .length-1; | |
121 | ||
122 | ro w = docume nt.createE lement("tr "); | |
123 | if (studies.s tudy[i].st udyStatusC ollection[ recentStag e].created By.display Name == re trievedUse r){ | |
124 | ||
125 | var cell = documen t.createEl ement("td" ); | |
126 | ||
127 | //allows the user to return to a previ ous study by clickin g on this study ID l ink in the dashboard | |
128 | var anch or = docum ent.create Element("a "); | |
129 | anchor.s etAttribut e("href", "irb-appli cations-ge neral.html ?" + studi es.study[i ].assigned ID + "?" + retrieved User); | |
130 | anchor.s etAttribut e("title", studies.s tudy[i].ti tle); | |
131 | ||
132 | //study ID | |
133 | var text = documen t.createTe xtNode(stu dies.study [i].assign edID); | |
134 | anchor.a ppendChild (text); | |
135 | cell.app endChild(a nchor); | |
136 | row.appe ndChild(ce ll); | |
137 | ||
138 | //study title | |
139 | row.appe ndChild(cr eateCell(s tudies.stu dy[i].titl e)); | |
140 | ||
141 | //Type | |
142 | row.appe ndChild(cr eateCell(" Type TBD") ); | |
143 | ||
144 | //PI Nam e | |
145 | row.appe ndChild(cr eateCell(s tudies.stu dy[i].stud yStatusCol lection[re centStage] .createdBy .displayNa me)); | |
146 | ||
147 | //Status (draft or review) | |
148 | row.appe ndChild(cr eateCell(s tudies.stu dy[i].stud yStatusCol lection[re centStage] .studyStat e.name)); | |
149 | ||
150 | //Expira tion Date | |
151 | row.appe ndChild(cr eateCell(" Expiration TBD")); | |
152 | ||
153 | //IRB Ag enda Date | |
154 | row.appe ndChild(cr eateCell(" IRB DATE T BD")); | |
155 | ||
156 | $('tbody ').append( row); | |
157 | noStudie s = false; | |
158 | } | |
159 | } | |
160 | ||
161 | if(noS tudies){ | |
162 | // no studies linked to user | |
163 | ro w = docume nt.createE lement("tr "); | |
164 | va r cell = d ocument.cr eateElemen t("td") | |
165 | va r text = d ocument.cr eateTextNo de("You ha ve no appl ications") ; | |
166 | ce ll.appendC hild(text) ; | |
167 | ce ll.setAttr ibute("col span", 7); | |
168 | ce ll.setAttr ibute("sty le", "text -align:cen ter"); | |
169 | ro w.appendCh ild(cell); | |
170 | ||
171 | $( 'tbody').a ppend(row) ; | |
172 | } | |
173 | }; | |
174 | ||
175 | //creates a cell in a table. t akes in wh at should be shown | |
176 | //in the c ell | |
177 | function c reateCell( displayTex t){ | |
178 | ||
179 | var ce ll = docum ent.create Element("t d"); | |
180 | ||
181 | var te xt = docum ent.create TextNode(d isplayText ); | |
182 | cell.a ppendChild (text); | |
183 | ||
184 | return cell; | |
185 | }; | |
186 | ||
187 | //connects to a rest endpoint and either sends or | |
188 | //recieves data | |
189 | function s endREST(ht tpMethod, endpoint, data, sync ){ | |
190 | var xm lResponse; | |
191 | ||
192 | //acco unting for internet explorer's needs | |
193 | if(win dow.XMLHtt pRequest){ | |
194 | xm lResponse = new XMLH ttpRequest (); | |
195 | }else{ | |
196 | xm lResponse = new Acti veXObject( "Microsoft .XMLHTTP") ; | |
197 | } | |
198 | ||
199 | try{ | |
200 | // setting up general h eaders | |
201 | xm lResponse. open(httpM ethod, res tPath.conc at(endpoin t), sync); | |
202 | xm lResponse. setRequest Header("Co ntent-Type ", "applic ation/json "); | |
203 | ||
204 | if ((httpMeth od == "PUT ")||(httpM ethod == " DELETE")){ | |
205 | xmlRespo nse.setReq uestHeader ("sm_user" , data); | |
206 | xmlRespo nse.send(n ull); | |
207 | ||
208 | //204 is the respo nse status indicatin g success, while | |
209 | //403 in dicates fa ilure | |
210 | if(xmlRe sponse.sta tus === 20 4){ | |
211 | retu rn true; | |
212 | }else if (xmlRespon se.status === 403){ | |
213 | retu rn false; | |
214 | } | |
215 | } | |
216 | if (httpMetho d == "POST "){ | |
217 | try{ | |
218 | //se nding data | |
219 | xmlR esponse.se nd(JSON.st ringify(da ta)); | |
220 | }catch(e ){ | |
221 | aler t(e.toStri ng()); | |
222 | } | |
223 | } | |
224 | if (httpMetho d == "GET" ){ | |
225 | //retrie ving the n eeded data | |
226 | xmlRespo nse.onread ystatechan ge = funct ion(){ | |
227 | if(x mlResponse .readyStat e === 4){ | |
228 | if(xmlResp onse.statu s === 200) { | |
229 | try{ | |
230 | xm lResponse = JSON.par se(xmlResp onse.respo nseText); | |
231 | ||
232 | }catch (e){ | |
233 | al ert(e.toSt ring()); | |
234 | } | |
235 | ||
236 | }else{ | |
237 | alert( xmlRespons e.statusTe xt); | |
238 | } | |
239 | } | |
240 | }; | |
241 | xmlRespo nse.send(n ull); | |
242 | //passin g the need ed data to the funct ion that i s requesti ng it | |
243 | return x mlResponse ; | |
244 | } | |
245 | ||
246 | }catch (e){ | |
247 | al ert(e.toSt ring()); | |
248 | } | |
249 | }; |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.