Skip to content

Commit

Permalink
Merge pull request #3 from Panopto/ahrnjica/2024070900-release-code
Browse files Browse the repository at this point in the history
2024070900 release code
  • Loading branch information
zeroAps authored Jul 9, 2024
2 parents 347aa26 + bda2d8d commit 9362423
Show file tree
Hide file tree
Showing 42 changed files with 2,229 additions and 897 deletions.
9 changes: 9 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Description


## Testing
<!-- How and what have you tested? What needs later verification? -->


## Jira Link
<!-- E.g. PC-### (link to Jira will populate automatically). Optional and Jira# must still be added to the PR title. -->
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore node modules
node_modules/
41 changes: 41 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),

// Configuration for uglify task to minify JS files.
uglify: {
build: {
files: [
{
expand: true,
cwd: "amd/src",
src: "*.js",
dest: "amd/build",
ext: ".min.js",
},
],
},
},

// Configuration for watch task to monitor changes in JS files.
watch: {
scripts: {
files: ["amd/src/**/*.js"],
tasks: ["uglify"],
options: {
spawn: false,
},
},
},
});

// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks("grunt-contrib-uglify");

// Load the plugin that provides the "watch" task.
grunt.loadNpmTasks("grunt-contrib-watch");

// Default task(s).
grunt.registerTask("default", ["uglify", "watch"]);
};
Binary file modified README.md
Binary file not shown.
1 change: 1 addition & 0 deletions amd/build/contentselectionpanel.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

213 changes: 213 additions & 0 deletions amd/src/contentselectionpanel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* AMD module for displaying an LTI launch within a modal.
*
* @package mod_panoptocurseembed
* @copyright Panopto 2021
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define([
"jquery",
"core/notification",
"core/modal_factory",
"core/str",
], ($, notification, ModalFactory, str) =>
{
let courseId = null;
let isResponsive = false;

var init = (params) =>
{
// Check to make sure parameters are initialized.
if ( "0" === params.folderviewbtnid
|| "0" === params.selectvidbtnid
|| "0" === params.lticimlaunchurl
|| "0" === params.ltilaunchurl
|| 0 === params.courseid
|| 0 === params.height
|| 0 === params.width
|| 0 === params.isresponsive)
{
return;
}

courseId = params.courseid;
isResponsive = params.isresponsive;

let selectVidBtn = $("#" + params.selectvidbtnid);
let folderViewBtn = $("#" + params.folderviewbtnid);
selectVidBtn.on("click", () =>
{
open_panopto_window_callback(
params.lticimlaunchurl,
params.height,
params.width
);
});
folderViewBtn.on("click", () =>
{
panopto_folder_view_callback(params.ltilaunchurl, 600, 800);
});

createResourceLinkId = ((base) => () => base + "_" + new Date().getTime())(params.resourcebase);
};

var open_panopto_window_callback = (url, height, width) =>
{
// Modal custom size class.
let modalClass = "mod-panoptocourseembed-modal-custom-size";

// Ensure unique class names for dynamic styling.
let modalDialogClass = "mod-panoptocourseembed-modal-dialog-custom";
let modalContentClass = "mod-panoptocourseembed-modal-content-custom";
let modalBodyClass = "mod-panoptocourseembed-modal-body-custom";
let iframeClass = "mod-panoptocourseembed-iframe-custom";

Promise.all([
str.get_string("selectvideo", "panoptocourseembed"),
ModalFactory.create({
type: ModalFactory.types.DEFAULT,
body: `<iframe class="${iframeClass}" src="${url}" frameborder="0"></iframe>`,
large: true,
}),
])
.then(([selectText, modal]) =>
{
modal.setTitle(selectText);
modal.getRoot().addClass(modalClass);
modal
.getRoot()
.find(".modal-dialog")
.addClass(modalDialogClass)
.css({
width: `${width}px`,
"max-width": `${width}px`,
});
modal
.getRoot()
.find(".modal-content")
.addClass(modalContentClass)
.css({
height: `${height}px`,
"max-height": `${height}px`,
});
modal
.getRoot()
.find(".modal-body")
.addClass(modalBodyClass);
modal.show();

document.body.panoptoWindow = modal;
document.body.addEventListener(
"sessionSelected",
close_popup_callback.bind(this),
false
);
}).catch(notification.exception);
};

var panopto_folder_view_callback = (url, height, width) =>
{
let newContentSource = new URL(url);
let newIntro;

if (isResponsive)
{
newIntro = '<p><iframe src="' + newContentSource.toString() + '"' +
' style="width:100%;' +
' height:auto;' +
' aspect-ratio: ' + width + ' / ' + height + ';"' +
' allowfullscreen="true">' +
'</iframe><br /></p>';
}
else
{
newIntro = '<p><iframe src="' + newContentSource.toString() + '"' +
' width="' + width + '"' +
' height="' + height + '"' +
' allowfullscreen="true">' +
'</iframe><br /></p>';
}

$("input[name=intro]").val(newIntro);
$("#panopto-intro-preview").html(newIntro);

str.get_string("selectvideo", "panoptocourseembed")
.done((selectText) =>
{
$("#id_select_video").val(selectText);
})
.fail(notification.exception);

$("#id_select_video")
.removeClass("btn-secondary")
.addClass("btn-primary");
};

var close_popup_callback = (closeEvent) =>
{
let newContentSource = new URL(closeEvent.detail.ltiViewerUrl);
let searchParams = newContentSource.searchParams;

searchParams.set("course", courseId);
searchParams.set("custom", decodeURI(closeEvent.detail.customData));
searchParams.set("contentUrl", closeEvent.detail.contentUrl);
searchParams.set("resourcelinkid", createResourceLinkId());

newContentSource.search = searchParams.toString();

let newIntro;
let width = closeEvent.detail.width ?? 800;
let height = closeEvent.detail.height ?? 600;

if (isResponsive)
{
newIntro = '<p><iframe src="' + newContentSource.toString() + '"' +
' style="width:100%;' +
' height:auto;' +
' aspect-ratio: ' + width + ' / ' + height + ';"' +
' allowfullscreen="true">' +
'</iframe><br /></p>';
}
else
{
newIntro = '<p><iframe src="' + newContentSource.toString() + '"' +
' width="' + width + '"' +
' height="' + height + '"' +
' allowfullscreen="true">' +
'</iframe><br /></p>';
}

$("input[name=intro]").val(newIntro);
$("#panopto-intro-preview").html(newIntro);
str.get_string("replacevideo", "panoptocourseembed")
.done((replaceText) =>
{
$("#id_select_video").val(replaceText);
})
.fail(notification.exception);

$("#id_select_video")
.addClass("btn-secondary")
.removeClass("btn-primary");
document.body.panoptoWindow.destroy();
};

return {
initselectionpanel: init,
};
});
6 changes: 3 additions & 3 deletions backup/moodle2/backup_panoptocourseembed_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ protected function define_structure() {
$userinfo = $this->get_setting_value('userinfo');

// Define each element separated.
$panoptocourseembed = new backup_nested_element('panoptocourseembed', array('id'), array(
'name', 'intro', 'introformat', 'timemodified'));
$panoptocourseembed = new backup_nested_element('panoptocourseembed', ['id'],
['name', 'intro', 'introformat', 'timemodified']);

// Build the tree.
// (love this).

// Define sources.
$panoptocourseembed->set_source_table('panoptocourseembed', array('id' => backup::VAR_ACTIVITYID));
$panoptocourseembed->set_source_table('panoptocourseembed', ['id' => backup::VAR_ACTIVITYID]);

// Define id annotations.
// (none).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ protected function define_my_steps() {
* processed by the link decoder
*/
public static function define_decode_contents() {
$contents = array();
$contents = [];

$contents[] = new restore_decode_content('panoptocourseembed', array('intro'), 'panoptocourseembed');
$contents[] = new restore_decode_content('panoptocourseembed', ['intro'], 'panoptocourseembed');

return $contents;
}
Expand All @@ -68,7 +68,7 @@ public static function define_decode_contents() {
* to the activity to be executed by the link decoder
*/
public static function define_decode_rules() {
return array();
return [];
}

/**
Expand All @@ -78,7 +78,7 @@ public static function define_decode_rules() {
* of restore_log_rule objects
*/
public static function define_restore_log_rules() {
$rules = array();
$rules = [];

$rules[] = new restore_log_rule('panoptocourseembed', 'add', 'view.php?id={course_module}', '{panoptocourseembed}');
$rules[] = new restore_log_rule('panoptocourseembed', 'update', 'view.php?id={course_module}', '{panoptocourseembed}');
Expand All @@ -98,7 +98,7 @@ public static function define_restore_log_rules() {
* activity level. All them are rules not linked to any module instance (cmid = 0)
*/
public static function define_restore_log_rules_for_course() {
$rules = array();
$rules = [];

$rules[] = new restore_log_rule('panoptocourseembed', 'view all', 'index.php?id={course}', null);

Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/restore_panoptocourseembed_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class restore_panoptocourseembed_activity_structure_step extends restore_activit
*/
protected function define_structure() {

$paths = array();
$paths = [];
$paths[] = new restore_path_element('panoptocourseembed', '/activity/panoptocourseembed');

// Return the paths wrapped into standard activity structure.
Expand Down
2 changes: 1 addition & 1 deletion classes/analytics/indicator/cognitive_depth.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class cognitive_depth extends activity_base {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('indicator:cognitivedepth', 'mod_panoptocourseembed');
}

Expand Down
2 changes: 1 addition & 1 deletion classes/analytics/indicator/social_breadth.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class social_breadth extends activity_base {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('indicator:socialbreadth', 'mod_panoptocourseembed');
}

Expand Down
Loading

0 comments on commit 9362423

Please sign in to comment.