-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpolicy.js
39 lines (34 loc) · 1.29 KB
/
policy.js
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
$(function(){
$("#submitbutton").on("click", function createsurvey(e){
e.preventDefault();
var timestamp = new Date().getTime();
var campaign_urn = "urn:campaign:lausd:admin:account_policy";
var campaign_timestamp = "2013-08-15 10:35:03"
var json = '['
+'{ "survey_key":"'+uuid()+'", "time":'+timestamp+', "timezone":"America/Los_Angeles", "location_status":"unavailable", '
+'"survey_launch_context": { "launch_time":'+timestamp+', "launch_timezone":"America/Los_Angeles", "active_triggers":[] }, '
+'"survey_id":"policy1", "responses": [ { "prompt_id":"confirmPolicy", "value":1 } ] } ]';
oh.survey.upload(campaign_urn, campaign_timestamp, json, function(){
alert("Thanks for your submission, your account should be prepared in 15 minutes.");
window.location.href = "index.html";
});
});
//uuid generator
function uuid() {
var uuid = "", i, random;
for (i = 0; i < 32; i++) {
random = Math.random() * 16 | 0;
if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid += "-"
}
uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
}
return uuid;
}
//init page
oh.ping(function(){
oh.user.whoami(function(x){
oh.keepalive();
});
});
});