Skip to content

Commit

Permalink
Update to 'Kaltura release 3.1.01 (RL: 2.5.1.6)';
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bezemer committed Apr 8, 2014
1 parent f57d4e7 commit 4a0583d
Show file tree
Hide file tree
Showing 21 changed files with 493 additions and 299 deletions.
4 changes: 2 additions & 2 deletions filter/kaltura/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2013071805;
$plugin->release = 'Kaltura release 3.0.99 (RL: 2.5.1.4)';
$plugin->version = 2013071807;
$plugin->release = 'Kaltura release 3.1.01 (RL: 2.5.1.6)';
$plugin->requires = 2013051400;
$plugin->maturity = MATURITY_STABLE;
46 changes: 22 additions & 24 deletions local/kaltura/js/kaltura.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ M.local_kaltura.init_config = function (Y, test_script) {

M.local_kaltura.video_assignment = function (Y, conversion_script, panel_markup,
video_properties, kcw_code, kaltura_session,
kaltura_partner_id, script_location) {
kaltura_partner_id, script_location, modalwidth, modalheight) {

// Adding makup to the body of the page for the kalvidassign
if (null !== Y.one("#page-mod-kalvidassign-view")) { // Body tag for kalvidassign
Expand Down Expand Up @@ -632,17 +632,16 @@ M.local_kaltura.video_assignment = function (Y, conversion_script, panel_markup,


// Create preview panel
var preview_panel = new Y.YUI2.widget.Panel("id_video_preview",
{ width: "450px",
height: "430px",
fixedcenter: false,
constraintoviewport: true,
dragable: false,
visible: false,
close: true,
modal: true,
context: ["region-main", "tl", "tl", ["beforeShow", "windowResize"]]
});
var preview_panel = new Y.YUI2.widget.Panel("id_video_preview", {
width: modalwidth+"px",
height: modalheight+"px",
fixedcenter: false,
constraintoviewport: true,
dragable: false,
visible: false,
close: true,
modal: true,
context: ["region-main", "tl", "tl", ["beforeShow", "windowResize"]]});

preview_panel.render();

Expand Down Expand Up @@ -739,7 +738,7 @@ M.local_kaltura.video_assignment = function (Y, conversion_script, panel_markup,

};

M.local_kaltura.video_asignment_submission_view = function (Y, conversion_script, panel_markup, uiconf_id) {
M.local_kaltura.video_asignment_submission_view = function (Y, conversion_script, panel_markup, uiconf_id, modalwidth, modalheight, videowidth, videoheight) {

// Adding makup to the body of the page for the video assignment - grade submissions page
if (null !== Y.one("#page-mod-kalvidassign-grade_submissions")) { // Body tag for grade submissions page
Expand Down Expand Up @@ -767,16 +766,15 @@ M.local_kaltura.video_asignment_submission_view = function (Y, conversion_script


// Create preview panel
var preview_panel = new Y.YUI2.widget.Panel("id_video_preview",
{ width: "410px",
height: "450px",
fixedcenter: false,
visible: false,
constraintoviewport: true,
close: true,
modal: true,
context: ["region-main", "tl", "tl", ["beforeShow", "windowResize"]]
});
var preview_panel = new Y.YUI2.widget.Panel("id_video_preview", {
width: modalwidth+"px",
height: modalheight+"px",
fixedcenter: false,
visible: false,
constraintoviewport: true,
close: true,
modal: true,
context: ["region-main", "tl", "tl", ["beforeShow", "windowResize"]]});

preview_panel.render();

Expand Down Expand Up @@ -838,7 +836,7 @@ M.local_kaltura.video_asignment_submission_view = function (Y, conversion_script

Y.io(conversion_script + entry_id + "&" +
"uiconf_id=" + uiconf_id + "&" +
"height=400&width=365"/*, vid_assign_preview_cfg*/);
"height="+videoheight+"&width="+videowidth/*, vid_assign_preview_cfg*/);

}

Expand Down
25 changes: 24 additions & 1 deletion local/kaltura/lang/en/local_kaltura.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
<?php
// 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/>.

/**
* Kaltura video assignment locallib
*
* @package local_kaltura
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/


// Kaltura settings and generic messages
$string['pluginname'] = 'Kaltura package libraries';
$string['hostedconn'] = 'Kaltura Hosted Solution (SaaS)';
$string['ceconn'] = 'Kaltura CE';
Expand Down Expand Up @@ -105,6 +124,10 @@
$string['kaltura_simple_uploader_desc'] = 'Widget used to upload a document when adding a video presentation';
$string['kaltura_simple_uploader_cust_desc'] = 'Only used if you have a custom simple uploader widget';
$string['kaltura_simple_uploader_cust'] = 'Custom Kaltura Simple Uploader UIConf ID';
$string['kalvidassign_player_height'] = 'Player height';
$string['kalvidassign_player_height_desc'] = 'Adjust this setting if your Kaltura player is being cut off when submitting and/or viewing video submissions.';
$string['kalvidassign_player_width'] = 'Player width';
$string['kalvidassign_player_width_desc'] = 'Adjust this setting if your Kaltura player is being cut off when submitting and/or viewing video submissions.';
$string['simple_uploader'] = 'Simple Uploader (1002613)';
$string['enable_reports'] = 'Enable reports';
$string['enable_reports_desc'] = 'Kaltura reports are only compatible with Kaltura version Falcon or above';
Expand Down
6 changes: 6 additions & 0 deletions local/kaltura/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@

define('KALTURA_FILTER_VIDEO_WIDTH', 400);
define('KALTURA_FILTER_VIDEO_HEIGHT', 300);
define('KALTURA_ASSIGN_VIDEO_WIDTH', 400);
define('KALTURA_ASSIGN_VIDEO_HEIGHT', 365);

// YUI panel popup border adjustments to make the embedded video look centered
define('KALTURA_POPUP_WIDTH_ADJUSTMENT', 30);
define('KALTURA_POPUP_HEIGHT_ADJUSTMENT', 50);

define('KALTURA_SESSION_LENGTH', 10800); // 3 hours

Expand Down
9 changes: 9 additions & 0 deletions local/kaltura/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,15 @@
$adminsetting->plugin = KALTURA_PLUGIN_NAME;
$settings->add($adminsetting);

$adminsetting = new admin_setting_configtext('kalvidassign_player_width', get_string('kalvidassign_player_width', 'local_kaltura'),
get_string('kalvidassign_player_width_desc', 'local_kaltura'), '400', PARAM_INT);
$adminsetting->plugin = KALTURA_PLUGIN_NAME;
$settings->add($adminsetting);

$adminsetting = new admin_setting_configtext('kalvidassign_player_height', get_string('kalvidassign_player_height', 'local_kaltura'),
get_string('kalvidassign_player_height_desc', 'local_kaltura'), '365', PARAM_INT);
$adminsetting->plugin = KALTURA_PLUGIN_NAME;
$settings->add($adminsetting);

// Kaltura resource regular player
$settings->add(new admin_setting_heading('kaltura_kalvidres_heading',
Expand Down
8 changes: 4 additions & 4 deletions local/kaltura/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}

$plugin->version = 2013071805;
$plugin->component = 'local_kaltura';
$plugin->release = 'Kaltura release 3.0.99 (RL: 2.5.1.4)';
$plugin->version = 2013071807;
$plugin->component = 'local_kaltura';
$plugin->release = 'Kaltura release 3.1.01 (RL: 2.5.1.6)';
$plugin->requires = 2013051400;
$plugin->maturity = MATURITY_STABLE;
$plugin->system_version = 2.1; // Used to send information to Kaltura
$plugin->system_version = 2.1; // Used to send information to Kaltura
4 changes: 2 additions & 2 deletions local/mymedia/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}

$plugin->version = 2013071805;
$plugin->version = 2013071807;
$plugin->component = 'local_mymedia';
$plugin->release = 'Kaltura release 3.0.99 (RL: 2.5.1.4)';
$plugin->release = 'Kaltura release 3.1.01 (RL: 2.5.1.6)';
$plugin->requires = 2013051400;
$plugin->maturity = MATURITY_STABLE;
$plugin->dependencies = array(
Expand Down
16 changes: 11 additions & 5 deletions mod/kalvidassign/grade_submissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
/**
* Kaltura video assignment grade submission page
*
* @package mod
* @subpackage kalvidassign
* @package mod_kalvidassign
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand Down Expand Up @@ -102,10 +101,17 @@
$markup = $renderer->display_video_preview_markup();
$markup .= $renderer->display_loading_markup();
$uiconf_id = local_kaltura_get_player_uiconf('player');
$modalwidth = 0;
$modalheight = 0;
$videowidth = 0;
$videoheight = 0;

$PAGE->requires->js_init_call('M.local_kaltura.video_asignment_submission_view',
array($conversion_script,
$markup, $uiconf_id), true, $jsmodule);
list($modalwidth, $modalheight) = kalvidassign_get_player_dimensions();
$videowidth = $modalwidth - KALTURA_POPUP_WIDTH_ADJUSTMENT;
$videoheight = $modalheight - KALTURA_POPUP_HEIGHT_ADJUSTMENT;

$PAGE->requires->js_init_call('M.local_kaltura.video_asignment_submission_view', array($conversion_script, $markup, $uiconf_id, $modalwidth, $modalheight,
$videowidth, $videoheight), true, $jsmodule);

echo $OUTPUT->header();

Expand Down
20 changes: 18 additions & 2 deletions mod/kalvidassign/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
/**
* Kaltura video assignment locallib
*
* @package mod
* @subpackage kalvidassign
* @package mod_kalvidassign
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand All @@ -35,6 +34,7 @@

require_once(dirname(dirname(dirname(__FILE__))) . '/lib/gradelib.php');
require_once($CFG->dirroot.'/mod/kalvidassign/renderable.php');
require_once(dirname(dirname(dirname(__FILE__))).'/local/kaltura/locallib.php');

/**
* Check if the assignment submission end date has passed or if late submissions
Expand Down Expand Up @@ -366,3 +366,19 @@ function kalvidassign_get_assignment_students($cm) {

return $users;
}

/**
* This functions returns an array with the height and width used in the configiruation for displaying a video.
* @return array An array whose first value is the width and second value is the height.
*/
function kalvidassign_get_player_dimensions() {
$kalturaconfig = get_config(KALTURA_PLUGIN_NAME);

$width = (isset($kalturaconfig->kalvidassign_player_width) && !empty($kalturaconfig->kalvidassign_player_width)) ?
$kalturaconfig->kalvidassign_player_width : KALTURA_ASSIGN_VIDEO_WIDTH;

$height = (isset($kalturaconfig->kalvidassign_player_height) && !empty($kalturaconfig->kalvidassign_player_height)) ?
$kalturaconfig->kalvidassign_player_height : KALTURA_ASSIGN_VIDEO_HEIGHT;

return array($width, $height);
}
10 changes: 6 additions & 4 deletions mod/kalvidassign/single_submission.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
/**
* Kaltura video assignment single submission page
*
* @package mod
* @subpackage kalvidassign
* @package mod_kalvidassign
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand Down Expand Up @@ -49,9 +48,12 @@
$url->params(array('cmid' => $id,
'userid' => $userid));

$context = context_module::instance($cm->id);

$PAGE->set_url($url);
$PAGE->set_title(format_string($kalvidassignobj->name));
$PAGE->set_heading($course->fullname);
$PAGE->set_context($context);

$previousurl = new moodle_url('/mod/kalvidassign/grade_submissions.php',
array('cmid' => $cm->id,
Expand All @@ -61,8 +63,6 @@
$prevousurlstring = get_string('singlesubmissionheader', 'kalvidassign');
$PAGE->navbar->add($prevousurlstring, $previousurl);

$context = get_context_instance(CONTEXT_MODULE, $cm->id);

require_capability('mod/kalvidassign:gradesubmission', $context);

add_to_log($course->id, 'kalvidassign', 'view submission page', 'single_submission.php?id='.$cm->id, $kalvidassignobj->id, $cm->id);
Expand Down Expand Up @@ -251,3 +251,5 @@
$submissionform->set_data($formdata);

$submissionform->display();

echo $OUTPUT->footer();
35 changes: 19 additions & 16 deletions mod/kalvidassign/single_submission_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
/**
* Kaltura video assignment single submission form
*
* @package mod
* @subpackage kalvidassign
* @package mod_kalvidassign
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand All @@ -29,7 +28,10 @@

class kalvidassign_singlesubmission_form extends moodleform {

function definition() {
/**
* This function defines the forums elments that are to be displayed
*/
public function definition() {
global $CFG, $PAGE;

$mform =& $this->_form;
Expand All @@ -38,10 +40,15 @@ function definition() {
$userid = $this->_customdata->userid;

$mform->addElement('hidden', 'cmid', $cm->id);
$mform->setType('cmid', PARAM_INT);
$mform->addelement('hidden', 'userid', $userid);
$mform->setType('userid', PARAM_INT);
$mform->addElement('hidden', 'tifirst', $this->_customdata->tifirst);
$mform->setType('tifirst', PARAM_TEXT);
$mform->addElement('hidden', 'tilast', $this->_customdata->tilast);
$mform->setType('tilast', PARAM_TEXT);
$mform->addElement('hidden', 'page', $this->_customdata->page);
$mform->setType('page', PARAM_INT);

/* Submission section */
$mform->addElement('header', 'single_submission_1', get_string('submission', 'kalvidassign'));
Expand All @@ -55,7 +62,7 @@ function definition() {

$submission = $this->_customdata->submission;
$grading_info = $this->_customdata->grading_info;
$entry_object = '';
$entryobject = '';
$timemodified = '';

if (!empty($submission->entry_id)) {
Expand All @@ -64,32 +71,28 @@ function definition() {
$connection = $kaltura->get_connection(true, KALTURA_SESSION_LENGTH);

if ($connection) {
$entry_object = local_kaltura_get_ready_entry_object($this->_customdata->submission->entry_id);
$entryobject = local_kaltura_get_ready_entry_object($this->_customdata->submission->entry_id);

// Determine the type of video (See KALDEV-28)
if (!local_kaltura_video_type_valid($entry_object)) {
$entry_object = local_kaltura_get_ready_entry_object($entry_object->id, false);
if (!local_kaltura_video_type_valid($entryobject)) {
$entryobject = local_kaltura_get_ready_entry_object($entryobject->id, false);
}
}

}

if (!empty($entry_object)) {

// Force the video to be embedded as large
$entry_object->height = '365';
$entry_object->width = '400';

if (!empty($entryobject)) {
list($entryobject->width, $entryobject->height) = kalvidassign_get_player_dimensions();
$courseid = get_courseid_from_context($this->_customdata->context);

// Set the session
$session = local_kaltura_generate_kaltura_session(array($entry_object->id));
$session = local_kaltura_generate_kaltura_session(array($entryobject->id));


$mform->addElement('static', 'description', get_string('submission', 'kalvidassign'),
local_kaltura_get_kdp_code($entry_object, 0, $courseid));
local_kaltura_get_kdp_code($entryobject, 0, $courseid));

} elseif (empty($entry_object) && isset($submission->timemodified) && !empty($submission->timemodified)) {
} else if (empty($entryobject) && isset($submission->timemodified) && !empty($submission->timemodified)) {

if ($connection) {
// an empty entry object and a time modified timestamp means the video is still converting
Expand Down
Loading

0 comments on commit 4a0583d

Please sign in to comment.