initial commit
[CPE_learningsite] / CPE / CPE.App / CPE.App.Web / static / js / index / sessiondetails.js
1 $(document).ready(function () {
2     $('#sessionDetailsTable').dataTable({
3         "sPaginationType": "full_numbers",
4         "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
5         "iDisplayLength": -1,
6         "sDom": 'Tfrtlip',
7         "oTableTools": {
8             "sSwfPath": "/static/swf/copy.csv.xls.swf",
9             "aButtons": ["copy", "csv"]
10         },
11         "initComplete": function() {
12             $('.overrideCert-icon').click(function() {
13                 var mpsk = $(this).data('mpsk');
14                 var msk = $(this).data('msk');
15                 var creds = $(this).data('creds');
16                 if (confirm('Are you sure you want to update the Poll Response to 100%? This action cannot be reversed. If the user logged in to the Webcast using a magic ticket, they are not eligible for a certificate.')) {
17                     $.post("access/OverridePoll", { mpsk: mpsk, msk: msk, creds: creds }, function (data) {
18                         if (data) {
19                             alert("Certificate marked as Earned. You should now see the option to Send Certificate unless the user logged in to the Webcast using hte Magic Ticket.");
20                             window.location.reload(true);
21                         } else {
22                             alert("Problem Overriding Poll Status. Please contact Customer Support. If the user logged in to the Webcast using a magic ticket, they are not eligible for a certificate.");
23                         }
24                     });
25                 };
26             });
27         }
28     });
29
30     
31     $('#sessionReportTable').dataTable({
32         "sPaginationType": "full_numbers",
33         "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
34         "iDisplayLength": -1,
35         "sDom": 'Tfrtlip',
36         "oTableTools": {
37             "sSwfPath": "/static/swf/copy.csv.xls.swf",
38             "aButtons": ["copy", "csv"]
39         }
40     });
41      
42
43     $('#btnCloseUserSessions').click(function () {
44         var key = $(this).attr('meetingSessionKey');
45         $.ajax({
46             url: "/static/services/engagement/service.asmx/CloseOpenUserSessions",
47             data: { meetingSessionKey: key },
48             dataType: "xml",
49             type: "POST",
50             success: function (data, textStatus, jqXhr) {
51                 if ($(data).find('boolean').text() === "true") {
52                     location.reload();
53                 }
54                 else {
55                     alert("Problem closing active user sessions.");
56                 }
57             },
58             error: function (jqXhr, textStatus, errorThrown) {
59                 alert("Request failed: " + textStatus);
60
61             }
62         });
63     });
64
65     $('#certificateReportTable').dataTable({
66         "sPaginationType": "full_numbers",
67         "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
68         "iDisplayLength": -1,
69         "sDom": 'Tfrtlip',
70         "oTableTools": {
71             "sSwfPath": "/static/swf/copy.csv.xls.swf",
72             "aButtons": ["copy", "csv"]
73         },
74         "initComplete": function() {
75             $('.sendCert-icon').click(function() {
76                 var email = $(this).data('email');
77                 var a = $(this).data('msco');
78                 var b = $(this).data('pdate');
79                 var c = $(this).data('ticket');
80
81                 var emailBody = 'Thank you for attending our Live Webcast!'
82                     + '\r\n' + '\r\n' + 'Please follow the link in this email to download your Certificate of Attendance. We recommend that you print a copy of the Certificate for your records.'
83                     + '\r\n' + '\r\n' + 'To register for another CPE Inc. program from our wide selection of Live Webcasts, Self-Study Webcasts, Seminars and Conferences, please visit us online or call 1-800-544-1114.'
84                     + '\r\n' + '\r\n' + 'http://api.cpeonlinewebcasts.com/Certificate?a=' + a + '&b=' + b + '&c=' + c;
85                 emailBody = encodeURIComponent(emailBody);
86                 var link = 'mailto:' + email
87                     + '?subject=' + escape('Your Certificate of Attendance from CPE, Inc.')
88                     + '&body=' + emailBody;
89                 win = window.open(link);
90                 setTimeout(function() { win.close() }, 500);
91                 return true;
92             });
93
94
95         }
96     });
97 });