updates
diff --git a/dtps.css b/dtps.css
index 634cb1f..9020e4b 100644
--- a/dtps.css
+++ b/dtps.css
@@ -1397,10 +1397,6 @@
transition: background-color 0.2s;
}
-body {
- --cardShadow: 0 5px 15px rgb(0 0 0 / 0.08) !important;
-}
-
.headerArea {
margin: 10px 20px;
width: auto;
diff --git a/scripts/core.js b/scripts/core.js
index 0e6911a..92e015e 100644
--- a/scripts/core.js
+++ b/scripts/core.js
@@ -884,7 +884,7 @@
}
//Set search box content
- if (classNum !== "search") dtps.setSearchBox();
+ dtps.setSearchBox();
if (dtps.classes[classNum]) {
//Show pages tab if the class supports it, otherwise, hide it
@@ -1608,7 +1608,13 @@
//Validate input and tags
var term = $("#dtpsMainSearchBox").val().replace(/(type|class):[a-z]*/gi, "").trim();
if ($("#dtpsMainSearchBox").attr("data-search-type") && $("#dtpsMainSearchBox").attr("data-dtps-course")) {
- fluid.screen("search", term);
+ fluid.screen("search", {
+ term: term,
+ type: $("#dtpsMainSearchBox").attr("data-search-type"),
+ course: $("#dtpsMainSearchBox").attr("data-dtps-course"),
+ ctxType: $("#dtpsMainSearchBox").attr("data-ctx-type"),
+ ctxCourse: $("#dtpsMainSearchBox").attr("data-ctx-course")
+ });
$("#dtpsMainSearchBox").blur();
}
}
diff --git a/scripts/search.js b/scripts/search.js
index 7a0e8f2..9af3aa5 100644
--- a/scripts/search.js
+++ b/scripts/search.js
@@ -12,14 +12,12 @@
*
* @param term {string} The search term typed in the input box
*/
-dtps.globalSearch = function (term) {
- //Validate search and get search vars
- var type = $("#dtpsMainSearchBox").attr("data-search-type");
- var courseNum = $("#dtpsMainSearchBox").attr("data-dtps-course");
- var term = term ? decodeURI(term) : "";
- if (!type || !courseNum) {
- return fluid.screen("dashboard");
- }
+dtps.globalSearch = function (param) {
+ var term = param.term;
+ var type = param.type;
+ var courseNum = param.course;
+
+ $("#dtpsMainSearchBox").attr("data-search-type", param.type).attr("data-dtps-course", param.course).attr("data-ctx-type", param.ctxType).attr("data-ctx-course", param.ctxCourse);
//Ensure classes are rendered in the sidebar
dtps.presentClass("search");
@@ -48,6 +46,7 @@
//Fetch everything
var dataset = [];
var datasetPromises = [];
+ var checkedCourses = [];
(courseNum == "all" ? dtps.classes : [dtps.classes[Number(courseNum)]]).forEach(course => {
if ((type == "assignments") || (type == "coursework") || (type == "everything")) {
@@ -62,10 +61,12 @@
icon: "assignment",
type: "assignment",
infoIcons: [
- assignment.dueAt ? "alarm" : null
+ assignment.dueAt ? "alarm" : null,
+ dtps.user.parent ? "person" : null
].filter(i => i),
info: [
- assignment.dueAt ? "Due: " + dtps.formatDate(assignment.dueAt) : null
+ assignment.dueAt ? "Due: " + dtps.formatDate(assignment.dueAt) : null,
+ dtps.user.parent ? dtps.user.children.find(c => c.id == course.userID).name : null
].filter(i => i).join("$|$"),
icons: [
{
@@ -89,6 +90,61 @@
}));
}
+ if ((type == "grades") || (type == "everything")) {
+ datasetPromises.push(new Promise((resolve, reject) => {
+ if (!course.assignments) return resolve([]);
+ var res = [];
+
+ course.assignments.forEach(assignment => {
+ if (dtpsLMS.useRubricGrades && assignment.rubric) {
+ assignment.rubric.forEach(rubric => {
+ if (rubric.score) {
+ res.push({
+ title: assignment.title,
+ class: course.num,
+ onclick: "dtps.assignment('" + assignment.id + "', " + assignment.class + ")",
+ locatedIn: rubric.title,
+ icon: "assessment",
+ infoIcons: [
+ "bar_chart",
+ dtps.user.parent ? "person" : null
+ ].filter(i => i),
+ info: [
+ "Score: " + rubric.score + "/" + rubric.value + (rubric.scoreName ? " " + rubric.scoreName : ""),
+ dtps.user.parent ? dtps.user.children.find(c => c.id == course.userID).name : null
+ ].filter(i => i).join("$|$"),
+ icons: []
+ });
+ }
+ });
+ } else if (assignment.grade) {
+ res.push({
+ title: assignment.title,
+ class: course.num,
+ onclick: "dtps.assignment('" + assignment.id + "', " + assignment.class + ")",
+ locatedIn: "Grade",
+ icon: "assessment",
+ infoIcons: [
+ "bar_chart",
+ dtps.user.parent ? "person" : null
+ ].filter(i => i),
+ info: [
+ "Score: " + assignment.grade + "/" + assignment.value + " (" + Math.round((assignment.grade / assignment.value) * 100) + "%" + (assignment.letter ? ", " + assignment.letter : "") + ")",
+ dtps.user.parent ? dtps.user.children.find(c => c.id == course.userID).name : null
+ ].filter(i => i).join("$|$"),
+ icons: []
+ });
+ }
+ });
+
+ resolve(res);
+ }));
+ }
+
+ //Check if this course has already been checked
+ if (checkedCourses.includes(course.lmsID)) return;
+ checkedCourses.push(course.lmsID);
+
if ((type == "modules") || (type == "coursework") || (type == "everything")) {
datasetPromises.push(new Promise((resolve, reject) => {
if (!course.modules) return resolve([]);
@@ -251,53 +307,6 @@
}));
}
- if ((type == "grades") || (type == "everything")) {
- datasetPromises.push(new Promise((resolve, reject) => {
- if (!course.assignments) return resolve([]);
- var res = [];
-
- course.assignments.forEach(assignment => {
- if (dtpsLMS.useRubricGrades && assignment.rubric) {
- assignment.rubric.forEach(rubric => {
- if (rubric.score) {
- res.push({
- title: assignment.title,
- class: course.num,
- onclick: "dtps.assignment('" + assignment.id + "', " + assignment.class + ")",
- locatedIn: rubric.title,
- icon: "assessment",
- infoIcons: [
- "bar_chart"
- ].filter(i => i),
- info: [
- "Score: " + rubric.score + "/" + rubric.value + (rubric.scoreName ? " " + rubric.scoreName : "")
- ].filter(i => i).join("$|$"),
- icons: []
- });
- }
- });
- } else if (assignment.grade) {
- res.push({
- title: assignment.title,
- class: course.num,
- onclick: "dtps.assignment('" + assignment.id + "', " + assignment.class + ")",
- locatedIn: "Grade",
- icon: "assessment",
- infoIcons: [
- "bar_chart"
- ].filter(i => i),
- info: [
- "Score: " + assignment.grade + "/" + assignment.value + " (" + Math.round((assignment.grade / assignment.value) * 100) + "%" + (assignment.letter ? ", " + assignment.letter : "") + ")"
- ].filter(i => i).join("$|$"),
- icons: []
- });
- }
- });
-
- resolve(res);
- }));
- }
-
if ((type == "announcements") || (type == "everything")) {
datasetPromises.push(new Promise((resolve, reject) => {
dtpsLMS.fetchAnnouncements(course.lmsID).then(announcements => {