-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScript1.js
More file actions
80 lines (53 loc) · 1.72 KB
/
Script1.js
File metadata and controls
80 lines (53 loc) · 1.72 KB
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
var root; //i know, sorry
$(document).ready(function () {
$//('.MyProgramIssuesTable').DataTable();
$('.MyProgramIssuesTable').on('click', 'tr', function (e) {
clearCube();
var likelihood = $(this).find('td:eq(5)').text();
var consequence = $(this).find('td:eq(6)').text();
var $cube = $('.cube');
var cell = likelihood + consequence;
var square = $cube.find('#' + cell);
square.text('X');
});
$(".MyProgramIssuesTable").on('dblclick', 'tr', function (e) {
var windowTitle = 'Issue View';
var id = $(this).find('td:eq(0)').text();
formPath = '/Lists/ProgramIssuesAndRisks/DispForm.aspx?ID=' + id;
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', getForm(formPath, 'Issue View'));
});
getMyIssues();
});
function getMyIssues() {
}
function getProgramEvents() {
}
function getProgramRisks() {
}
function clearCube() {
$('.cube').find('td').each(function () {
if ($(this).text() === 'X')
$(this).text('');
});
}
function getForm(path, windowTitle) {
clientContext = SP.ClientContext.get_current();
website = clientContext.get_web();
root = website.get_url()
clientContext.executeQueryAsync(SPModalWindow(path, windowTitle), console.log('unable to retrieve website'));
}
function SPModalWindow(path, windowTitle) {
var formPath = root + path;
var options = {
url: formPath,
width: 1200,
height: 1200,
allowMaximize: true,
showClose: true,
allowResize: true,
menubar: true,
toolbar: true,
title: windowTitle
};
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
}