Skip to content

Commit 4b31e6a

Browse files
Add second exemptions questionaire to form
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
1 parent 8219c15 commit 4b31e6a

File tree

5 files changed

+130
-46
lines changed

5 files changed

+130
-46
lines changed

css/styles.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ textarea {
77
}
88

99
#auto-generation,
10-
#exemptions {
10+
.exemptions {
1111
border-radius: 15px;
1212
padding: 20px;
1313
padding-bottom: 25px;
@@ -19,7 +19,7 @@ textarea {
1919
box-sizing: border-box;
2020
}
2121

22-
#exemptions {
22+
.exemptions {
2323
max-width: 1300px;
2424
}
2525

@@ -80,6 +80,11 @@ textarea {
8080
margin: 10px 0px 20px 0px;
8181
}
8282

83+
.not-exempt {
84+
color: green;
85+
display: inline-block;
86+
}
87+
8388
/* .results-container p {
8489
margin: 20px 0px;
8590
} */

index.html

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,25 @@
6060
<body>
6161
<div id="form-header"></div>
6262

63-
<div id="exemptions">
63+
<div class="exemptions" id="share-it-act">
6464
<div id="exemptions-header"></div>
65-
<div class="exemptions-quiz-container">
66-
<h4 id="quiz-subheading"> Answer the series of questions below to determine if your project falls under the
67-
4 exemption categories according to the SHARE IT Act. </h4>
65+
<div id="exemptions-quiz-container" class="exemptions-quiz-container">
66+
<h4 id="quiz-subheading">
67+
Answer the series of questions below to determine if your project falls under the exemption categories
68+
according to the SHARE IT Act.
69+
</h4>
6870
<div id="exemptions-quiz">
6971
<fieldset class="usa-fieldset">
7072
<div class="usa-checkbox">
71-
<input class="usa-checkbox__input" id="check-national-security-systems" type="checkbox"
73+
<input class="usa-checkbox__input" id="check-national-security" type="checkbox"
7274
name="exemption-condition" value="exemptByNationalSecurity">
73-
<label class="usa-checkbox__label" for="check-national-security-systems">
75+
<label class="usa-checkbox__label" for="check-national-security">
7476
Is the project primarily for use in national security systems, as defined in Section 11103
7577
of title 40, USC?</label>
7678
</div>
7779
<div class="usa-checkbox">
7880
<input class="usa-checkbox__input" id="check-intelligence-community" type="checkbox"
79-
name="exemption-condition" value="exemptByIntelligence">
81+
name="exemption-condition" value="exemptByNationalIntelligence">
8082
<label class="usa-checkbox__label" for="check-intelligence-community">Is the project created by
8183
an agency or part of an agency that is an element of the intelligence community, as defined
8284
in section 3(4) of the National Security Act of 1947?</label>
@@ -121,19 +123,75 @@ <h4 id="quiz-subheading"> Answer the series of questions below to determine if y
121123
Does the source code create an identifiable risk to the privacy of an individual?</label>
122124
</div>
123125
<div class="usa-checkbox">
124-
<input class="usa-checkbox__input" id="check-none" type="checkbox" name="exemption-condition"
125-
value="none">
126-
<label class="usa-checkbox__label" for="check-none">None of the above </label>
126+
<input class="usa-checkbox__input" id="share-it-act-check-none" type="checkbox"
127+
name="exemption-condition" value="share-it-act-none">
128+
<label class="usa-checkbox__label" for="share-it-act-check-none">None of the above </label>
129+
</div>
130+
</fieldset>
131+
<button type="button" id="share-it-act" onclick="determineExemptions(event)">Submit</button>
132+
</div>
133+
</div>
134+
<div class="results" style="display: none;">
135+
<div class="results-container">
136+
<p class="exemption-result">Your project </p>
137+
</div>
138+
<button id="share-it-act" onclick="handleClick(event)">Try Again</button>
139+
</div>
140+
</div>
141+
142+
<div class="exemptions" id="m-16-21">
143+
<div id="exemptions2-header"></div>
144+
<div class="exemptions-quiz-container">
145+
<h4 id="quiz-subheading">
146+
Answer the series of questions below to determine if your project falls under the exemption categories
147+
according to M-16-21 Act.
148+
</h4>
149+
<div id="exemptions-quiz">
150+
<fieldset class="usa-fieldset">
151+
<div class="usa-checkbox">
152+
<input class="usa-checkbox__input" id="check-agency-systems" type="checkbox"
153+
name="exemption-condition" value="exemptByAgencySystem">
154+
<label class="usa-checkbox__label" for="check-agency-systems">
155+
Does sharing of the source code create an identifiable risk to the stability, security, or
156+
integrity of the agency’s systems or personnel?
157+
</label>
158+
</div>
159+
<div class="usa-checkbox">
160+
<input class="usa-checkbox__input" id="check-agency-mission" type="checkbox"
161+
name="exemption-condition" value="exemptByAgencyMission">
162+
<label class="usa-checkbox__label" for="check-agency-mission">
163+
Does sharing of the source code create an identifiable risk to agency mission, programs, or
164+
operations?
165+
</label>
166+
</div>
167+
<div class="usa-checkbox">
168+
<input class="usa-checkbox__input" id="check-CIO" type="checkbox" name="exemption-condition"
169+
value="exemptByCIO">
170+
<label class="usa-checkbox__label" for="check-CIO">
171+
Does the CIO believes it is in the national interest to exempt sharing the source code?
172+
</label>
173+
</div>
174+
<div class="usa-checkbox">
175+
<input class="usa-checkbox__input" id="check-date" type="checkbox" name="exemption-condition"
176+
value="exemptByPolicyDate">
177+
<label class="usa-checkbox__label" for="check-date">
178+
Was the release was created prior to the M-16-21 policy (August 8, 2016)
179+
</label>
180+
</div>
181+
<div class="usa-checkbox">
182+
<input class="usa-checkbox__input" id="m-16-21-check-none" type="checkbox"
183+
name="exemption-condition" value="m-16-21-none">
184+
<label class="usa-checkbox__label" for="m-16-21-check-none">None of the above </label>
127185
</div>
128186
</fieldset>
129-
<button type="button" onclick="determineExemptions()">Submit</button>
187+
<button type="button" id="m-16-21" onclick="determineExemptions(event)">Submit</button>
130188
</div>
131189
</div>
132190
<div class="results" style="display: none;">
133191
<div class="results-container">
134192
<p class="exemption-result">Your project </p>
135193
</div>
136-
<button onclick="handleClick(event)">Try Again</button>
194+
<button id="m-16-21" onclick="handleClick(event)">Try Again</button>
137195
</div>
138196
</div>
139197

@@ -152,7 +210,7 @@ <h4 id="quiz-subheading"> Answer the series of questions below to determine if y
152210

153211
<div id="form-subheader">
154212
<div class="step-header">
155-
<div class="step-number">3</div>
213+
<div class="step-number">4</div>
156214
<h3>Complete the entire form to generate the code.json file</h3>
157215
</div>
158216
</div>

js/exemptionQuizHandler.js

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
1-
function determineExemptions() {
2-
const quiz = document.querySelector(".exemptions-quiz");
3-
const quizContainer = document.querySelector(".exemptions-quiz-container");
4-
const resultsContainer = document.querySelector(".results");
5-
const exemptionResult = document.querySelector(".exemption-result");
1+
function determineExemptions(event) {
2+
const legislationName = event.target.id;
63

7-
const checkedValues = Array.from(document.querySelectorAll("input[name='exemption-condition']:checked")).map((input) => input.value);
4+
const quizContainer = document.querySelector(`#${legislationName} .exemptions-quiz-container`);
5+
const resultsContainer = document.querySelector(`#${legislationName} .results`);
6+
const exemptionResult = document.querySelector(`#${legislationName} .exemption-result`);
87

9-
console.log("Selected answers:", checkedValues);
8+
var values = Array.from(document.querySelectorAll(`#${legislationName} input[name='exemption-condition']:checked`)).map((input) => input.value);
9+
var checkedValues = [...new Set(values)];
1010

11-
const results = determineResults(checkedValues);
11+
const results = determineResults(checkedValues, legislationName);
1212

1313
// Display results
1414
quizContainer.style.display = "none";
1515
resultsContainer.style.display = "block";
1616
exemptionResult.innerHTML = results;
17-
1817
}
1918

20-
function determineResults(checkedValues) {
21-
19+
function determineResults(checkedValues, legislationName) {
2220
var text = "";
2321

24-
// Project qualifies for the SHARE IT Act
25-
if (checkedValues.includes("none")) {
26-
text = `<h4>Your project is: <strong>NOT EXEMPTED</strong></h4>
22+
// Project is not exempted
23+
if (checkedValues.length === 1 && checkedValues[0].includes("none")) {
24+
25+
if (legislationName === "share-it-act") {
26+
text = `<h4>Your project is: <div class="not-exempt"><strong>NOT EXEMPTED</strong></div></h4>
27+
<p>Please complete <strong>Part 2</strong> to determine additional project exemptions.</p>`;
28+
}
29+
else {
30+
text = `<h4>Your project is: <div class="not-exempt"><strong>NOT EXEMPTED</strong></div></h4>
31+
<h5>If your project is NOT exempted from both M-16-21 AND the SHARE IT Act, please mark the following on the form: </h5>
2732
<p>If your repository is public, mark <code>usageType</code> as <strong>openSource</strong>.</p>
2833
<p>If your repository is private, mark <code>usageType</code> as <strong>governmentWideReuse</strong>.</p>`;
34+
}
2935
}
3036
// Project is exempted
3137
else {
@@ -37,30 +43,40 @@ function determineResults(checkedValues) {
3743
// Applies value to usageType on form
3844
try {
3945
const form = window.formIOInstance
40-
form.getComponent('usageType').setValue(checkedValues);
46+
47+
const component = form.getComponent('usageType');
48+
var currentSelection = component.getValue() || [];
49+
50+
checkedValues.forEach(selected => {
51+
currentSelection[selected] = true;
52+
});
53+
54+
form.getComponent('usageType').setValue(currentSelection);
4155
}
42-
catch {
56+
catch (error) {
4357
console.error("Form fill error:", error);
4458
}
4559
}
4660

4761
return text;
4862
}
4963

50-
function uncheckAllCheckboxes() {
51-
const checkboxes = document.querySelectorAll(".usa-checkbox__input");
52-
checkboxes.forEach((checkbox) => {
53-
checkbox.checked = false;
54-
});
55-
}
56-
5764
function handleClick(event) {
58-
const quizContainer = document.querySelector(".exemptions-quiz-container");
59-
const resultsContainer = document.querySelector(".results");
65+
const legislationName = event.target.id;
66+
67+
const quizContainer = document.querySelector(`#${legislationName} .exemptions-quiz-container`);
68+
const resultsContainer = document.querySelector(`#${legislationName} .results`);
6069

6170
event.preventDefault();
62-
uncheckAllCheckboxes(); // Clear input
71+
//Uncheck checkboxes
72+
const checkboxes = document.querySelectorAll(`#${legislationName} .usa-checkbox__input`);
73+
checkboxes.forEach((checkbox) => {
74+
checkbox.checked = false;
75+
});
6376

6477
resultsContainer.style.display = "none";
6578
quizContainer.style.display = "block";
66-
}
79+
}
80+
81+
window.determineExemptions = determineExemptions;
82+
window.handleClick = handleClick;

js/generateFormComponents.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,13 @@ function createFormHeading(title, description) {
257257
function createExemptionsBox() {
258258
const container = document.getElementById("exemptions-header")
259259
container.innerHTML = `<div class="step-header"><div class="step-number">1</div><h3>Is my project exempted from the SHARE IT Act?</h3></div>`
260+
const secondContainer = document.getElementById("exemptions2-header")
261+
secondContainer.innerHTML = `<div class="step-header"><div class="step-number">2</div><h3>Is my project exempted from M-16-21?</h3></div>`
260262
}
261263

262264
function createAutoGenerationBox() {
263265
const container = document.getElementById("auto-generation-header")
264-
container.innerHTML = `<div class="step-header"><div class="step-number">2</div><h3>Auto Generate Fields</h3></div> \n <h4> Please enter your repositories GitHub URL in order to automatically pre-fill some of the fields in this form! </h4> \n <h6> <i>This currently only works on <b>public</b> repositories</i> </h6>`
266+
container.innerHTML = `<div class="step-header"><div class="step-number">3</div><h3>Auto Generate Fields</h3></div> \n <h4> Please enter your repositories GitHub URL in order to automatically pre-fill some of the fields in this form! </h4> \n <h6> <i>This currently only works on <b>public</b> repositories</i> </h6>`
265267
}
266268

267269
// Iterates through each json field and creates component array for Form.io

schemas/gov/schema.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,17 @@
6464
"openSource",
6565
"governmentWideReuse",
6666
"exemptByNationalSecurity",
67-
"exemptByIntelligence",
67+
"exemptByNationalIntelligence",
6868
"exemptByFOIA",
6969
"exemptByEAR",
7070
"exemptByITAR",
7171
"exemptByTSA",
7272
"exemptByClassifiedInformation",
73-
"exemptByPrivacyRisk"
73+
"exemptByPrivacyRisk",
74+
"exemptByAgencySystem",
75+
"exemptByAgencyMission",
76+
"exemptByCIO",
77+
"exemptByPolicyDate"
7478
]
7579
},
7680
"description": "A list of enumerated values which describes the usage permissions for the release: (1) openSource: Open source; (2) governmentWideReuse: Government-wide reuse; (3) exemptByLaw: The sharing of the source code is restricted by law or regulation, including—but not limited to—patent or intellectual property law, the Export Asset Regulations, the International Traffic in Arms Regulation, and the Federal laws and regulations governing classified information; (4) exemptByNationalSecurity: The sharing of the source code would create an identifiable risk to the detriment of national security, confidentiality of Government information, or individual privacy; (5) exemptByAgencySystem: The sharing of the source code would create an identifiable risk to the stability, security, or integrity of the agency’s systems or personnel, (6) exemptByAgencyMission: The sharing of the source code would create an identifiable risk to agency mission, programs, or operations; (7) exemptByCIO: The CIO believes it is in the national interest to exempt sharing the source code; (8) exemptByPolicyDate: The release was created prior to the M-16-21 policy (August 8, 2016)",
@@ -172,7 +176,6 @@
172176
"required": [
173177
"name",
174178
"description",
175-
"longDescription",
176179
"permissions",
177180
"repositoryURL",
178181
"repositoryVisibility",

0 commit comments

Comments
 (0)