-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
143 lines (127 loc) · 6.18 KB
/
test.html
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
138
139
140
141
142
143
<!--
******************************************************************************************************
MerlinWikiExtensions Extends the functionality of the wiki by adding
extensions for Merlin-specific capabilities.
Copyright (C) 2023 CoderMerlin.Academy
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*******************************************************************************************************
-->
<html>
<head>
<link rel="stylesheet" href="merlin.css" />
<script type="module">
import * as merlinProficiencyProgress from "./merlin-proficiency-progress.mjs";
const urlParams = new URLSearchParams(window.location.search);
const authenticatedUsername = urlParams.get('authenticatedUsernameInput');
const authenticatedSessionID = urlParams.get('authenticatedSessionIDInput');
document.getElementById("authenticatedUsernameInput").value = authenticatedUsername;
document.getElementById("authenticatedSessionIDInput").value = authenticatedSessionID;
// Install handlers for document
document.merlinHandlersLoadMasteryProgress = function(node) {
// Arguments are located within the specified node as follows
// <span class="merlin-arguments">
// <span data-bind="text: userName"></span>
// </span>
let userName = $(node.getElementsByClassName("merlin-arguments")[0]).children("span[data-bind='text: userName']")[0].textContent
let groupUnderAuthority = $(node.getElementsByClassName("merlin-arguments")[0]).children("span[data-bind='text: $parent.pathname']")[0].textContent
console.log("Requesting loading...")
merlinProficiencyProgress.loadMasteryProgress(userName, groupUnderAuthority);
}
window.addEventListener("load", (event) => {
merlinProficiencyProgress.setCredentials(authenticatedUsername, authenticatedSessionID);
merlinProficiencyProgress.loadGroupsUnderAuthority();
merlinProficiencyProgress.loadMasteryProgress(authenticatedUsername, undefined);
});
</script>
</head>
<body>
<h2>Test Form</h2>
<form action="" method="get">
<label for="authenticatedUsernameInput">Authenticated username:</label><br>
<input type="text" id="authenticatedUsernameInput" name="authenticatedUsernameInput"/><br>
<label for="authenticatedSessionIDInput">Session ID:</label><br>
<input type="text" id="authenticatedSessionIDInput" name="authenticatedSessionIDInput"/><br>
<input type="submit" value="Submit"/>
</form>
<div class="merlin-interactive-api-group">
<div class="merlin-interactive-api-status-header">
</div>
<div class="merlin-proficiency-progress-wrapper" id="merlin-proficiency-progress-wrapper">
<div class="merlin-proficiency-progress-group-selector-container" id="merlin-proficiency-progress-group-selector-container">
<div class="merlin-proficiency-progress-group-selector" id="merlin-proficiency-progress-group-selector">
<h2>Groups Under My Authority</h2>
<ul class="merlin-groups-tree" data-bind="template: {name: 'groupTemplate', foreach: groups}" id='merlin-groups-under-authority-tree'></ul>
<script id="groupTemplate" type="text/html">
<!--ko if: children.length > 0-->
<li>
<details>
<summary><span data-bind="text: pathname"></span></summary>
<ul data-bind="template: {name: 'groupTemplate', foreach: children}"></ul>
</details>
</li>
<!--/ko-->
<!--ko if: children.length == 0-->
<li>
<a href="javascript:;"><span class="merlin-groups-tree-group-leaf" data-bind="text: pathname, click: loadUsersInGroup;"></span></a>
<ul data-bind="foreach: users">
<li>
<a href="javascript:;" onClick="document.merlinHandlersLoadMasteryProgress(this);">
<span class="merlin-arguments">
<span data-bind="text: userName"></span>
<span data-bind="text: $parent.pathname"></span>
</span>
<span class="merlin-groups-tree-user-leaf">
<span data-bind="text: firstName"></span><span> </span><span data-bind="text: lastName"></span>
</span>
</a>
</li>
</ul>
</li>
<!--/ko-->
</script>
</div>
</div>
</div>
<div class="merlin-proficiency-progress-table-container">
<div class="merlin-proficiency-progress-table-div">
<h2 id="merlin-proficiency-progress-header" class="merlin-proficiency-progress-header">User Mastery Progress (<span data-bind="text: username"></span>)</h2>
<table id='merlin-proficiency-progress-table' class="merlin-proficiency-progress-table" style="display: none" data-bind="visible: true">
<thead>
<tr>
<th>Program Level Name</th>
<th>Emerging</th>
<th>Developing</th>
<th>Proficient</th>
<th>Exemplary</th>
</tr>
</thead>
<tbody data-bind="foreach: masteryProgresses">
<tr>
<td data-bind="style: {'background-color': color()}, click: toggleMissionDisplay" class="merlin-proficiency-progress-program-level-name">
<span data-bind="text: arrowInnerText()"></span>
<span data-bind="text: standardName()"></span>
<ul data-bind="style: {'display': (shouldShowMissions()) ? 'block' : 'none'},foreach: missions">
<li data-bind="text: standardName()"></li>
</ul>
</td>
<td><span data-bind="class: emergingClassName()"></span></td>
<td><span data-bind="class: developingClassName()"></span></td>
<td><span data-bind="class: proficientClassName()"></span></td>
<td><span data-bind="class: exemplaryClassName()"></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<body/>
</html>