From 16c7d82f02525563560a5e53e8eb1540bf81d8a2 Mon Sep 17 00:00:00 2001 From: Carson Tam Date: Fri, 12 Apr 2024 21:57:45 -0700 Subject: [PATCH] Fix errors from eslint:yui, stylelint:css, and jshint checks. --- .../moodle-atto_kalturamedia-button-debug.js | 304 +++++++++--------- .../moodle-atto_kalturamedia-button-min.js | 2 +- .../moodle-atto_kalturamedia-button.js | 304 +++++++++--------- .../kalturamedia/yui/src/button/js/button.js | 16 +- local/kaltura/styles.css | 1 + ...moodle-local_kaltura-lticontainer-debug.js | 47 +-- .../moodle-local_kaltura-lticontainer-min.js | 2 +- .../moodle-local_kaltura-lticontainer.js | 47 +-- .../moodle-local_kaltura-ltipanel-debug.js | 25 +- .../moodle-local_kaltura-ltipanel-min.js | 2 +- .../moodle-local_kaltura-ltipanel.js | 25 +- .../moodle-local_kaltura-ltiservice-debug.js | 251 ++++++++------- .../moodle-local_kaltura-ltiservice-min.js | 2 +- .../moodle-local_kaltura-ltiservice.js | 251 ++++++++------- ...dle-local_kaltura-ltitinymcepanel-debug.js | 272 ++++++++-------- ...oodle-local_kaltura-ltitinymcepanel-min.js | 2 +- .../moodle-local_kaltura-ltitinymcepanel.js | 272 ++++++++-------- .../yui/src/lticontainer/js/lticontainer.js | 48 +-- local/kaltura/yui/src/ltipanel/js/ltipanel.js | 25 +- .../yui/src/ltiservice/js/ltiservice.js | 5 +- .../src/ltitinymcepanel/js/ltitinymcepanel.js | 16 +- mod/kalvidassign/styles.css | 6 +- mod/kalvidres/styles.css | 5 +- 23 files changed, 991 insertions(+), 939 deletions(-) diff --git a/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-debug.js b/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-debug.js index 2d22a45c5d254..105417ea9f19c 100644 --- a/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-debug.js +++ b/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-debug.js @@ -1,155 +1,159 @@ YUI.add('moodle-atto_kalturamedia-button', function (Y, NAME) { -// 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 . - -/* - * @package atto_kalturamedia - * @copyright 2Kaltura - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * @module moodle-atto_kalturamedia-button - */ - -/** - * Atto text editor kalturamedia plugin. - * - * @namespace M.atto_kalturamedia - * @class button - * @extends M.editor_atto.EditorPlugin - */ - -var COMPONENTNAME = 'atto_kalturamedia', - CSS = { - URLINPUT: 'atto_kalturamedia_urlentry', - NAMEINPUT: 'atto_kalturamedia_nameentry' - }, - SELECTORS = { - URLINPUT: '.' + CSS.URLINPUT, - NAMEINPUT: '.' + CSS.NAMEINPUT - }; - -Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { - _currentSelection: null, - embedWindow: null, - - initializer: function() { - this.addButton({ - icon: 'icon', - iconComponent: COMPONENTNAME, - callback: this._kalturamedia - }); - }, - _kalturamedia: function() { - this._currentSelection = this.get('host').getSelection(); - if (this._currentSelection === false) { - return; - } - - var w = 1200; - var h = 700; - var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; - var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; - - var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; - var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; - - var left = ((width / 2) - (w / 2)) + dualScreenLeft; - var top = ((height / 2) - (h / 2)) + dualScreenTop; - var newWindow = window.open(this._getIframeURL(), M.util.get_string("browse_and_embed", COMPONENTNAME), 'scrollbars=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); - - window.buttonJs = this; - - if (window.focus) { - newWindow.focus(); - } - - this.embedWindow = newWindow; - }, - - _getIframeURL: function() { - - var args = Y.mix({ - elementid: this.get('host').get('elementid'), - contextid: this.get('contextid'), - height: '600px', - width: '1112px' - }, - this.get('area')); - return M.cfg.wwwroot + '/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php?' + - Y.QueryString.stringify(args); - }, - - _getCourseId: function() { - var courseId; - var bodyClasses = document.getElementsByTagName('body')[0].className; - var classes = bodyClasses.split(' '); - for(i in classes) - { - if(classes[i].indexOf('course-') > -1) - { - var parts = classes[i].split('-'); - courseId = parts[1]; - } - } - - return courseId; - }, - - _removeProtocolFromUrl: function(fullUrl) { - return fullUrl.replace(/^https?:\/\//,''); - }, - - embedItem: function(what, data) { - var sourceUrl = data.url; - var url = this._removeProtocolFromUrl(sourceUrl); - var parser = document.createElement('a'); - parser.href = sourceUrl; - url += parser.search; - - var content = 'tinymce-kalturamedia-embed||'+data.title+'||'+data.width+'||'+data.height+''; - - host = this.get('host'); - host.setSelection(this._currentSelection); - host.insertContentAtFocusPoint(content); - this.markUpdated(); - this.embedWindow.close(); - } - - } , { - ATTRS: { - /** - * The contextid to use when generating this preview. - * - * @attribute contextid - * @type String - */ - contextid: { - value: null - }, - - /** - * The KAF URI, as configured in Kaltura's plugin settings. - */ - kafuri: { - value: null - } - }} -); +// 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 . + +/* + * @package atto_kalturamedia + * @copyright 2Kaltura + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * @module moodle-atto_kalturamedia-button + */ + +/** + * Atto text editor kalturamedia plugin. + * + * @namespace M.atto_kalturamedia + * @class button + * @extends M.editor_atto.EditorPlugin + */ + +var COMPONENTNAME = 'atto_kalturamedia', + CSS = { + URLINPUT: 'atto_kalturamedia_urlentry', + NAMEINPUT: 'atto_kalturamedia_nameentry' + }, + // jshint unused:false + SELECTORS = { + URLINPUT: '.' + CSS.URLINPUT, + NAMEINPUT: '.' + CSS.NAMEINPUT + }; + +Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { + _currentSelection: null, + embedWindow: null, + + initializer: function() { + this.addButton({ + icon: 'icon', + iconComponent: COMPONENTNAME, + callback: this._kalturamedia + }); + }, + _kalturamedia: function() { + this._currentSelection = this.get('host').getSelection(); + if (this._currentSelection === false) { + return; + } + + var w = 1200; + var h = 700; + var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; + var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; + + var width = window.innerWidth || document.documentElement.clientWidth || screen.width; + var height = window.innerHeight || document.documentElement.clientHeight || screen.height; + + var left = ((width / 2) - (w / 2)) + dualScreenLeft; + var top = ((height / 2) - (h / 2)) + dualScreenTop; + var newWindow = window.open(this._getIframeURL(), + M.util.get_string("browse_and_embed", COMPONENTNAME), + 'scrollbars=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); + + window.buttonJs = this; + + if (window.focus) { + newWindow.focus(); + } + + this.embedWindow = newWindow; + }, + + _getIframeURL: function() { + + var args = Y.mix({ + elementid: this.get('host').get('elementid'), + contextid: this.get('contextid'), + height: '600px', + width: '1112px' + }, + this.get('area')); + return M.cfg.wwwroot + '/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php?' + + Y.QueryString.stringify(args); + }, + + _getCourseId: function() { + var courseId; + var bodyClasses = document.getElementsByTagName('body')[0].className; + var classes = bodyClasses.split(' '); + for(var i in classes) + { + if(classes[i].indexOf('course-') > -1) + { + var parts = classes[i].split('-'); + courseId = parts[1]; + } + } + + return courseId; + }, + + _removeProtocolFromUrl: function(fullUrl) { + return fullUrl.replace(/^https?:\/\//,''); + }, + + embedItem: function(what, data) { + var sourceUrl = data.url; + var url = this._removeProtocolFromUrl(sourceUrl); + var parser = document.createElement('a'); + parser.href = sourceUrl; + url += parser.search; + + var content = 'tinymce-kalturamedia-embed||' + + data.title + '||' + data.width + '||' + data.height + ''; + + var host = this.get('host'); + host.setSelection(this._currentSelection); + host.insertContentAtFocusPoint(content); + this.markUpdated(); + this.embedWindow.close(); + } + + } , { + ATTRS: { + /** + * The contextid to use when generating this preview. + * + * @attribute contextid + * @type String + */ + contextid: { + value: null + }, + + /** + * The KAF URI, as configured in Kaltura's plugin settings. + */ + kafuri: { + value: null + } + }} +); }, '@VERSION@', {"requires": ["moodle-editor_atto-plugin"]}); diff --git a/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-min.js b/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-min.js index 196c77e72be25..fe4ab416a5775 100644 --- a/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-min.js +++ b/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-min.js @@ -1 +1 @@ -YUI.add("moodle-atto_kalturamedia-button",function(e,t){var n="atto_kalturamedia",r={URLINPUT:"atto_kalturamedia_urlentry",NAMEINPUT:"atto_kalturamedia_nameentry"},s={URLINPUT:"."+r.URLINPUT,NAMEINPUT:"."+r.NAMEINPUT};e.namespace("M.atto_kalturamedia").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,embedWindow:null,initializer:function(){this.addButton({icon:"icon",iconComponent:n,callback:this._kalturamedia})},_kalturamedia:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1)return;var e=1200,t=700,r=window.screenLeft!=undefined?window.screenLeft:screen.left,i=window.screenTop!=undefined?window.screenTop:screen.top,s=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,o=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,u=s/2-e/2+r,a=o/2-t/2+i,f=window.open(this._getIframeURL(),M.util.get_string("browse_and_embed",n),"scrollbars=no, width="+e+", height="+t+", top="+a+", left="+u);window.buttonJs=this,window.focus&&f.focus(),this.embedWindow=f},_getIframeURL:function(){var t=e.mix({elementid:this.get("host").get("elementid"),contextid:this.get("contextid"),height:"600px",width:"1112px"},this.get("area"));return M.cfg.wwwroot+"/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php?"+e.QueryString.stringify(t)},_getCourseId:function(){var e,t=document.getElementsByTagName("body")[0].className,n=t.split(" ");for(i in n)if(n[i].indexOf("course-")>-1){var r=n[i].split("-");e=r[1]}return e},_removeProtocolFromUrl:function(e){return e.replace(/^https?:\/\//,"")},embedItem:function(e,t){var n=t.url,r=this._removeProtocolFromUrl(n),i=document.createElement("a");i.href=n,r+=i.search;var s='tinymce-kalturamedia-embed||'+t.title+"||"+t.width+"||"+t.height+"";host=this.get("host"),host.setSelection(this._currentSelection),host.insertContentAtFocusPoint(s),this.markUpdated(),this.embedWindow.close()}},{ATTRS:{contextid:{value:null},kafuri:{value:null}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); +YUI.add("moodle-atto_kalturamedia-button",function(t,e){var n="atto_kalturamedia";t.namespace("M.atto_kalturamedia").Button=t.Base.create("button",t.M.editor_atto.EditorPlugin,[],{_currentSelection:null,embedWindow:null,initializer:function(){this.addButton({icon:"icon",iconComponent:n,callback:this._kalturamedia})},_kalturamedia:function(){var e,t;this._currentSelection=this.get("host").getSelection(),!1!==this._currentSelection&&(e=window.screenLeft!=undefined?window.screenLeft:screen.left,t=window.screenTop!=undefined?window.screenTop:screen.top,e=(window.innerWidth||document.documentElement.clientWidth||screen.width)/2-600+e,t=(window.innerHeight||document.documentElement.clientHeight||screen.height)/2-350+t,t=window.open(this._getIframeURL(),M.util.get_string("browse_and_embed",n),"scrollbars=no, width=1200, height=700, top="+t+", left="+e),window.buttonJs=this,window.focus&&t.focus(),this.embedWindow=t)},_getIframeURL:function(){var e=t.mix({elementid:this.get("host").get("elementid"),contextid:this.get("contextid"),height:"600px",width:"1112px"},this.get("area"));return M.cfg.wwwroot+"/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php?"+t.QueryString.stringify(e)},_getCourseId:function(){var e,t,n=document.getElementsByTagName("body")[0].className,i=n.split(" ");for(t in i)-1tinymce-kalturamedia-embed||'+t.title+"||"+t.width+"||"+t.height+"",(o=this.get("host")).setSelection(this._currentSelection),o.insertContentAtFocusPoint(n),this.markUpdated(),this.embedWindow.close()}},{ATTRS:{contextid:{value:null},kafuri:{value:null}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); \ No newline at end of file diff --git a/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button.js b/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button.js index 2d22a45c5d254..105417ea9f19c 100644 --- a/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button.js +++ b/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button.js @@ -1,155 +1,159 @@ YUI.add('moodle-atto_kalturamedia-button', function (Y, NAME) { -// 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 . - -/* - * @package atto_kalturamedia - * @copyright 2Kaltura - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * @module moodle-atto_kalturamedia-button - */ - -/** - * Atto text editor kalturamedia plugin. - * - * @namespace M.atto_kalturamedia - * @class button - * @extends M.editor_atto.EditorPlugin - */ - -var COMPONENTNAME = 'atto_kalturamedia', - CSS = { - URLINPUT: 'atto_kalturamedia_urlentry', - NAMEINPUT: 'atto_kalturamedia_nameentry' - }, - SELECTORS = { - URLINPUT: '.' + CSS.URLINPUT, - NAMEINPUT: '.' + CSS.NAMEINPUT - }; - -Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { - _currentSelection: null, - embedWindow: null, - - initializer: function() { - this.addButton({ - icon: 'icon', - iconComponent: COMPONENTNAME, - callback: this._kalturamedia - }); - }, - _kalturamedia: function() { - this._currentSelection = this.get('host').getSelection(); - if (this._currentSelection === false) { - return; - } - - var w = 1200; - var h = 700; - var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; - var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; - - var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; - var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; - - var left = ((width / 2) - (w / 2)) + dualScreenLeft; - var top = ((height / 2) - (h / 2)) + dualScreenTop; - var newWindow = window.open(this._getIframeURL(), M.util.get_string("browse_and_embed", COMPONENTNAME), 'scrollbars=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); - - window.buttonJs = this; - - if (window.focus) { - newWindow.focus(); - } - - this.embedWindow = newWindow; - }, - - _getIframeURL: function() { - - var args = Y.mix({ - elementid: this.get('host').get('elementid'), - contextid: this.get('contextid'), - height: '600px', - width: '1112px' - }, - this.get('area')); - return M.cfg.wwwroot + '/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php?' + - Y.QueryString.stringify(args); - }, - - _getCourseId: function() { - var courseId; - var bodyClasses = document.getElementsByTagName('body')[0].className; - var classes = bodyClasses.split(' '); - for(i in classes) - { - if(classes[i].indexOf('course-') > -1) - { - var parts = classes[i].split('-'); - courseId = parts[1]; - } - } - - return courseId; - }, - - _removeProtocolFromUrl: function(fullUrl) { - return fullUrl.replace(/^https?:\/\//,''); - }, - - embedItem: function(what, data) { - var sourceUrl = data.url; - var url = this._removeProtocolFromUrl(sourceUrl); - var parser = document.createElement('a'); - parser.href = sourceUrl; - url += parser.search; - - var content = 'tinymce-kalturamedia-embed||'+data.title+'||'+data.width+'||'+data.height+''; - - host = this.get('host'); - host.setSelection(this._currentSelection); - host.insertContentAtFocusPoint(content); - this.markUpdated(); - this.embedWindow.close(); - } - - } , { - ATTRS: { - /** - * The contextid to use when generating this preview. - * - * @attribute contextid - * @type String - */ - contextid: { - value: null - }, - - /** - * The KAF URI, as configured in Kaltura's plugin settings. - */ - kafuri: { - value: null - } - }} -); +// 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 . + +/* + * @package atto_kalturamedia + * @copyright 2Kaltura + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * @module moodle-atto_kalturamedia-button + */ + +/** + * Atto text editor kalturamedia plugin. + * + * @namespace M.atto_kalturamedia + * @class button + * @extends M.editor_atto.EditorPlugin + */ + +var COMPONENTNAME = 'atto_kalturamedia', + CSS = { + URLINPUT: 'atto_kalturamedia_urlentry', + NAMEINPUT: 'atto_kalturamedia_nameentry' + }, + // jshint unused:false + SELECTORS = { + URLINPUT: '.' + CSS.URLINPUT, + NAMEINPUT: '.' + CSS.NAMEINPUT + }; + +Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { + _currentSelection: null, + embedWindow: null, + + initializer: function() { + this.addButton({ + icon: 'icon', + iconComponent: COMPONENTNAME, + callback: this._kalturamedia + }); + }, + _kalturamedia: function() { + this._currentSelection = this.get('host').getSelection(); + if (this._currentSelection === false) { + return; + } + + var w = 1200; + var h = 700; + var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; + var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; + + var width = window.innerWidth || document.documentElement.clientWidth || screen.width; + var height = window.innerHeight || document.documentElement.clientHeight || screen.height; + + var left = ((width / 2) - (w / 2)) + dualScreenLeft; + var top = ((height / 2) - (h / 2)) + dualScreenTop; + var newWindow = window.open(this._getIframeURL(), + M.util.get_string("browse_and_embed", COMPONENTNAME), + 'scrollbars=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); + + window.buttonJs = this; + + if (window.focus) { + newWindow.focus(); + } + + this.embedWindow = newWindow; + }, + + _getIframeURL: function() { + + var args = Y.mix({ + elementid: this.get('host').get('elementid'), + contextid: this.get('contextid'), + height: '600px', + width: '1112px' + }, + this.get('area')); + return M.cfg.wwwroot + '/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php?' + + Y.QueryString.stringify(args); + }, + + _getCourseId: function() { + var courseId; + var bodyClasses = document.getElementsByTagName('body')[0].className; + var classes = bodyClasses.split(' '); + for(var i in classes) + { + if(classes[i].indexOf('course-') > -1) + { + var parts = classes[i].split('-'); + courseId = parts[1]; + } + } + + return courseId; + }, + + _removeProtocolFromUrl: function(fullUrl) { + return fullUrl.replace(/^https?:\/\//,''); + }, + + embedItem: function(what, data) { + var sourceUrl = data.url; + var url = this._removeProtocolFromUrl(sourceUrl); + var parser = document.createElement('a'); + parser.href = sourceUrl; + url += parser.search; + + var content = 'tinymce-kalturamedia-embed||' + + data.title + '||' + data.width + '||' + data.height + ''; + + var host = this.get('host'); + host.setSelection(this._currentSelection); + host.insertContentAtFocusPoint(content); + this.markUpdated(); + this.embedWindow.close(); + } + + } , { + ATTRS: { + /** + * The contextid to use when generating this preview. + * + * @attribute contextid + * @type String + */ + contextid: { + value: null + }, + + /** + * The KAF URI, as configured in Kaltura's plugin settings. + */ + kafuri: { + value: null + } + }} +); }, '@VERSION@', {"requires": ["moodle-editor_atto-plugin"]}); diff --git a/lib/editor/atto/plugins/kalturamedia/yui/src/button/js/button.js b/lib/editor/atto/plugins/kalturamedia/yui/src/button/js/button.js index 146ce93438101..5881723ba12f4 100644 --- a/lib/editor/atto/plugins/kalturamedia/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/kalturamedia/yui/src/button/js/button.js @@ -36,6 +36,7 @@ var COMPONENTNAME = 'atto_kalturamedia', URLINPUT: 'atto_kalturamedia_urlentry', NAMEINPUT: 'atto_kalturamedia_nameentry' }, + // jshint unused:false SELECTORS = { URLINPUT: '.' + CSS.URLINPUT, NAMEINPUT: '.' + CSS.NAMEINPUT @@ -63,12 +64,14 @@ Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_a var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; - var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; - var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; + var width = window.innerWidth || document.documentElement.clientWidth || screen.width; + var height = window.innerHeight || document.documentElement.clientHeight || screen.height; var left = ((width / 2) - (w / 2)) + dualScreenLeft; var top = ((height / 2) - (h / 2)) + dualScreenTop; - var newWindow = window.open(this._getIframeURL(), M.util.get_string("browse_and_embed", COMPONENTNAME), 'scrollbars=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); + var newWindow = window.open(this._getIframeURL(), + M.util.get_string("browse_and_embed", COMPONENTNAME), + 'scrollbars=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); window.buttonJs = this; @@ -96,7 +99,7 @@ Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_a var courseId; var bodyClasses = document.getElementsByTagName('body')[0].className; var classes = bodyClasses.split(' '); - for(i in classes) + for(var i in classes) { if(classes[i].indexOf('course-') > -1) { @@ -119,9 +122,10 @@ Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_a parser.href = sourceUrl; url += parser.search; - var content = 'tinymce-kalturamedia-embed||'+data.title+'||'+data.width+'||'+data.height+''; + var content = 'tinymce-kalturamedia-embed||' + + data.title + '||' + data.width + '||' + data.height + ''; - host = this.get('host'); + var host = this.get('host'); host.setSelection(this._currentSelection); host.insertContentAtFocusPoint(content); this.markUpdated(); diff --git a/local/kaltura/styles.css b/local/kaltura/styles.css index 5de54bd6efc86..f427de8888f6c 100644 --- a/local/kaltura/styles.css +++ b/local/kaltura/styles.css @@ -1,3 +1,4 @@ +/* stylelint-disable declaration-no-important */ #contentframe { border-style: none; } diff --git a/local/kaltura/yui/build/moodle-local_kaltura-lticontainer/moodle-local_kaltura-lticontainer-debug.js b/local/kaltura/yui/build/moodle-local_kaltura-lticontainer/moodle-local_kaltura-lticontainer-debug.js index 17f2f1d3666d6..fa9d63f617321 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-lticontainer/moodle-local_kaltura-lticontainer-debug.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-lticontainer/moodle-local_kaltura-lticontainer-debug.js @@ -42,7 +42,8 @@ Y.extend(LTICONTAINER, Y.Base, { lastheight: null, /** - * Add padding to make the bottom of the iframe visible. The iframe wasn't visible on some themes. Probably because of border widths, etc. + * Add padding to make the bottom of the iframe visible. The iframe wasn't + * visible on some themes. Probably because of border widths, etc. * @property padding * @type {Integer} * @default 15 @@ -110,11 +111,10 @@ Y.extend(LTICONTAINER, Y.Base, { * @property params * @type {Object} */ - init : function(params) { - var bodynode = Y.one('body[class~='+params.bodyclass+']'); + init: function(params) { + var bodynode = Y.one('body[class~=' + params.bodyclass + ']'); - if(params.height && params.width) - { + if (params.height && params.width) { this.height = params.height; this.width = params.width; } @@ -134,13 +134,15 @@ Y.extend(LTICONTAINER, Y.Base, { /** * This function resizes the iframe height and width. */ - resize : function() { + resize: function() { if (this.lastheight !== Math.min(this.documentheight, this.viewportheight)) { var newheight = this.viewportheight - this.ltiframe.getY() - this.padding; - var originalheight = this.ltiframe._node.height.slice(0,this.ltiframe._node.height.length-2); - if (newheight < originalheight) + // Get the original height which is 600px, but we're getting it as 600px and need to remove the last two characters + var originalheight = this.ltiframe._node.height.slice(0, this.ltiframe._node.height.length - 2); + if (newheight < originalheight) { return; - this.ltiframe.setStyle('height', newheight+'px'); + } + this.ltiframe.setStyle('height', newheight + 'px'); this.lastheight = Math.min(this.documentheight, this.viewportheight); } @@ -155,32 +157,31 @@ Y.extend(LTICONTAINER, Y.Base, { // If "newsize" if over allowed size then set it to the maximum allowed. if (newsize > allowedsize) { - this.ltiframe.setStyle('width', allowedsize+'px'); + this.ltiframe.setStyle('width', allowedsize + 'px'); } else { - this.ltiframe.setStyle('width', newsize+'px'); + this.ltiframe.setStyle('width', newsize + 'px'); } } } - // if we have the entry's dimensions - use them to adjust the iframe size. - if(this.height && this.width) - { - this.ltiframe.setStyle('width', this.width+'px'); - this.ltiframe.setStyle('height', this.height+'px'); + // If we have the entry's dimensions - use them to adjust the iframe size. + if (this.height && this.width) { + this.ltiframe.setStyle('width', this.width + 'px'); + this.ltiframe.setStyle('height', this.height + 'px'); } } }, { - NAME : 'moodle-local_kaltura-lticontainer', - ATTRS : { - bodyclass : { - value : null + NAME: 'moodle-local_kaltura-lticontainer', + ATTRS: { + bodyclass: { + value: null }, - lastheight : { - value : null + lastheight: { + value: null }, padding: { - value : 15 + value: 15 } } }); diff --git a/local/kaltura/yui/build/moodle-local_kaltura-lticontainer/moodle-local_kaltura-lticontainer-min.js b/local/kaltura/yui/build/moodle-local_kaltura-lticontainer/moodle-local_kaltura-lticontainer-min.js index b0c315673601c..f5a8e7c1a72dd 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-lticontainer/moodle-local_kaltura-lticontainer-min.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-lticontainer/moodle-local_kaltura-lticontainer-min.js @@ -1 +1 @@ -YUI.add("moodle-local_kaltura-lticontainer",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Base,{lastheight:null,padding:15,viewportheight:null,documentheight:null,clientheight:null,kalvidwidth:null,ltiframe:null,width:null,height:null,init:function(t){var n=e.one("body[class~="+t.bodyclass+"]");t.height&&t.width&&(this.height=t.height,this.width=t.width),this.lastheight=t.lastheight,this.padding=t.padding,this.viewportheight=n.get("winHeight"),this.documentheight=n.get("docHeight"),this.clientheight=n.getDOMNode.clientHeight,this.ltiframe=e.one("#contentframe"),this.kalvidwidth=t.kalvidwidth,this.resize(),this.timer=e.later(250,this,this.resize)},resize:function(){if(this.lastheight!==Math.min(this.documentheight,this.viewportheight)){var t=this.viewportheight-this.ltiframe.getY()-this.padding,n=this.ltiframe._node.height.slice(0,this.ltiframe._node.height.length-2);if(ts?this.ltiframe.setStyle("width",s+"px"):this.ltiframe.setStyle("width",o+"px")}}this.height&&this.width&&(this.ltiframe.setStyle("width",this.width+"px"),this.ltiframe.setStyle("height",this.height+"px"))}},{NAME:"moodle-local_kaltura-lticontainer",ATTRS:{bodyclass:{value:null},lastheight:{value:null},padding:{value:15}}}),M.local_kaltura=M.local_kaltura||{},M.local_kaltura.init=function(e){return new n(e)}},"@VERSION@",{requires:["base","node"]}); +YUI.add("moodle-local_kaltura-lticontainer",function(h,t){var i=function(){i.superclass.constructor.apply(this,arguments)};h.extend(i,h.Base,{lastheight:null,padding:15,viewportheight:null,documentheight:null,clientheight:null,kalvidwidth:null,ltiframe:null,width:null,height:null,init:function(t){var i=h.one("body[class~="+t.bodyclass+"]");t.height&&t.width&&(this.height=t.height,this.width=t.width),this.lastheight=t.lastheight,this.padding=t.padding,this.viewportheight=i.get("winHeight"),this.documentheight=i.get("docHeight"),this.clientheight=i.getDOMNode.clientHeight,this.ltiframe=h.one("#contentframe"),this.kalvidwidth=t.kalvidwidth,this.resize(),this.timer=h.later(250,this,this.resize)},resize:function(){var t,i;if(this.lastheight!==Math.min(this.documentheight,this.viewportheight)){if((t=this.viewportheight-this.ltiframe.getY()-this.padding) allowedsize) { - this.ltiframe.setStyle('width', allowedsize+'px'); + this.ltiframe.setStyle('width', allowedsize + 'px'); } else { - this.ltiframe.setStyle('width', newsize+'px'); + this.ltiframe.setStyle('width', newsize + 'px'); } } } - // if we have the entry's dimensions - use them to adjust the iframe size. - if(this.height && this.width) - { - this.ltiframe.setStyle('width', this.width+'px'); - this.ltiframe.setStyle('height', this.height+'px'); + // If we have the entry's dimensions - use them to adjust the iframe size. + if (this.height && this.width) { + this.ltiframe.setStyle('width', this.width + 'px'); + this.ltiframe.setStyle('height', this.height + 'px'); } } }, { - NAME : 'moodle-local_kaltura-lticontainer', - ATTRS : { - bodyclass : { - value : null + NAME: 'moodle-local_kaltura-lticontainer', + ATTRS: { + bodyclass: { + value: null }, - lastheight : { - value : null + lastheight: { + value: null }, padding: { - value : 15 + value: 15 } } }); diff --git a/local/kaltura/yui/build/moodle-local_kaltura-ltipanel/moodle-local_kaltura-ltipanel-debug.js b/local/kaltura/yui/build/moodle-local_kaltura-ltipanel/moodle-local_kaltura-ltipanel-debug.js index 5ff93958118dc..316b2baaaa78b 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-ltipanel/moodle-local_kaltura-ltipanel-debug.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-ltipanel/moodle-local_kaltura-ltipanel-debug.js @@ -56,7 +56,9 @@ Y.extend(LTIPANEL, Y.Base, { */ init : function(params) { // Check to make sure parameters are initialized - if ('0' === params.addvidbtnid || '0' === params.ltilaunchurl || 0 === params.courseid || 0 === params.height || 0 === params.width) { + if ('0' === params.addvidbtnid || '0' === params.ltilaunchurl + || 0 === params.courseid || 0 === params.height || 0 === params.width) { + // jshint undef:false alert('Some parameters were not initialized.'); return; } @@ -79,12 +81,13 @@ Y.extend(LTIPANEL, Y.Base, { var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; - var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; - var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; + width = window.innerWidth || document.documentElement.clientWidth || screen.width; + height = window.innerHeight || document.documentElement.clientHeight || screen.height; var left = ((width / 2) - (w / 2)) + dualScreenLeft; var top = ((height / 2) - (h / 2)) + dualScreenTop; - var bsePopup = window.open(url, M.util.get_string("browse_and_embed", "local_kaltura"), 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); + var bsePopup = window.open(url, M.util.get_string("browse_and_embed", "local_kaltura"), + 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); if (window.focus) { bsePopup.focus(); @@ -166,8 +169,8 @@ Y.extend(LTIPANEL, Y.Base, { /** * This method calls the base class constructor. The primary difference between LTIPANELMEDIAASSIGNMENT and LTIPANEL is that - * LTIPANELMEDIAASSIGNMENT creates a node and appends it to the body tag of the page. The reason for this is due to an issue with the Moodle - * navbar covering up part of the YUI panel, if the panel markup is appended to a child element within the body tag. + * LTIPANELMEDIAASSIGNMENT creates a node and appends it to the body tag of the page. The reason for this is due to an issue with + * the Moodle navbar covering up part of the YUI panel, if the panel markup is appended to a child element within the body tag. * @method LTIPANELMEDIAASSIGNMENT */ var LTIPANELMEDIAASSIGNMENT = function() { @@ -182,7 +185,8 @@ Y.extend(LTIPANELMEDIAASSIGNMENT, Y.Base, { */ init : function(params) { // Check to make sure parameters are initialized - if ('0' === params.addvidbtnid || '0' === params.ltilaunchurl || 0 === params.courseid || 0 === params.height || 0 === params.width) { + if ('0' === params.addvidbtnid || '0' === params.ltilaunchurl + || 0 === params.courseid || 0 === params.height || 0 === params.width) { return; } @@ -201,12 +205,13 @@ Y.extend(LTIPANELMEDIAASSIGNMENT, Y.Base, { var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; - var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; - var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; + width = window.innerWidth || document.documentElement.clientWidth || screen.width; + height = window.innerHeight || document.documentElement.clientHeight || screen.height; var left = ((width / 2) - (w / 2)) + dualScreenLeft; var top = ((height / 2) - (h / 2)) + dualScreenTop; - var bsePopup = window.open(url, M.util.get_string("browse_and_embed", "local_kaltura"), 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); + var bsePopup = window.open(url, M.util.get_string("browse_and_embed", "local_kaltura"), + 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); if (window.focus) { bsePopup.focus(); diff --git a/local/kaltura/yui/build/moodle-local_kaltura-ltipanel/moodle-local_kaltura-ltipanel-min.js b/local/kaltura/yui/build/moodle-local_kaltura-ltipanel/moodle-local_kaltura-ltipanel-min.js index 44cc819ca1843..83e6afa907d44 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-ltipanel/moodle-local_kaltura-ltipanel-min.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-ltipanel/moodle-local_kaltura-ltipanel-min.js @@ -1 +1 @@ -YUI.add("moodle-local_kaltura-ltipanel",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Base,{modulename:null,addvidbtnid:null,init:function(t){if("0"===t.addvidbtnid||"0"===t.ltilaunchurl||0===t.courseid||0===t.height||0===t.width){alert("Some parameters were not initialized.");return}this.modulename=t.modulename,this.addvidbtnid=t.addvidbtnid;var n=e.one("#"+t.addvidbtnid);n.on("click",this.open_bse_popup_callback,this,t.ltilaunchurl,t.height,t.width)},open_bse_popup_callback:function(e,t,n,r){var i=1200,s=700,o=window.screenLeft!=undefined?window.screenLeft:screen.left,u=window.screenTop!=undefined?window.screenTop:screen.top,r=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,n=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,a=r/2-i/2+o,f=n/2-s/2+u,l=window.open(t,M.util.get_string("browse_and_embed","local_kaltura"),"scrollbars=yes, width="+i+", height="+s+", top="+f+", left="+a);window.focus&&l.focus(),document.body.bsePopup=l;var c=this.createEntrySelectedEvent();document.body.entrySelectedEvent=c,document.body.addEventListener("entrySelected",this.close_popup_callback.bind(this),!1)},createEntrySelectedEvent:function(){var e;return typeof window.CustomEvent=="function"?e=new CustomEvent("entrySelected"):(e=document.createEvent("CustomEvent"),e.initCustomEvent("entrySelected",!1,!1,{})),e},close_popup_callback:function(){var t=e.one("img[id=video_thumbnail]");t.setStyle("display","none");var n=e.one("iframe[id=contentframe]");n.setAttribute("width",e.one("input[id=width]").getAttribute("value")),n.setAttribute("height",e.one("input[id=height]").getAttribute("value")),n.setStyle("display","inline");var r=e.one("input[name=modulename]");undefined!==r&&"kalvidres"===this.modulename&&this.lti_panel_change_add_media_button_caption(),document.body.bsePopup.close()},lti_panel_change_add_media_button_caption:function(){var t=M.util.get_string("replace_video",this.modulename);t!==e.one("#"+this.addvidbtnid).getAttribute("value")&&e.one("#"+this.addvidbtnid).setAttribute("value",t)}},{NAME:"moodle-local_kaltura-ltipanel",ATTRS:{addvidbtnid:{value:"0"},ltilaunchurl:{value:"0"},height:{value:0},width:{value:0},modulename:{value:""}}});var r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,e.Base,{init:function(t){if("0"===t.addvidbtnid||"0"===t.ltilaunchurl||0===t.courseid||0===t.height||0===t.width)return;var n=e.one("#"+t.addvidbtnid);n.on("click",this.open_bse_popup_callback,this,t.ltilaunchurl,t.height,t.width)},open_bse_popup_callback:function(e,t,n,r){var i=1200,s=700,o=window.screenLeft!=undefined?window.screenLeft:screen.left,u=window.screenTop!=undefined?window.screenTop:screen.top,r=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,n=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,a=r/2-i/2+o,f=n/2-s/2+u,l=window.open(t,M.util.get_string("browse_and_embed","local_kaltura"),"scrollbars=yes, width="+i+", height="+s+", top="+f+", left="+a);window.focus&&l.focus(),document.body.bsePopup=l;var c=this.createEntrySelectedEvent();document.body.entrySelectedEvent=c,document.body.addEventListener("entrySelected",this.close_popup_callback.bind(this),!1)},createEntrySelectedEvent:function(){var e;return typeof window.CustomEvent=="function"?e=new CustomEvent("entrySelected"):(e=document.createEvent("CustomEvent"),e.initCustomEvent("entrySelected",!1,!1,{})),e},close_popup_callback:function(){e.one("input[id=submit_video]").removeAttribute("disabled");var t=e.one("img[id=video_thumbnail]");t.setStyle("display","none");var n=e.one("iframe[id=contentframe]");n.setAttribute("width",e.one("input[id=width]").getAttribute("value")),n.setAttribute("height",e.one("input[id=height]").getAttribute("value")),n.setStyle("display","inline"),e.one("#id_add_video").set("value",M.util.get_string("replacevideo","kalvidassign")),e.one("#id_add_video").addClass("btn-secondary"),e.one("#submit_video").addClass("btn-primary"),e.one("#id_add_video").removeClass("btn-primary"),e.one("#submit_video").removeClass("btn-secondary"),document.body.bsePopup.close()}},{NAME:"moodle-local_kaltura-ltipanel",ATTRS:{addvidbtnid:{value:"0"},ltilaunchurl:{value:"0"},height:{value:0},width:{value:0}}});var i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,e.Base,{ltimediaassignment:null,init:function(t){this.ltimediaassignment=t,e.one("form[id=fastgrade]").delegate("click",this.review_submission,"a[name=submission_source]",this)},review_submission:function(e){e.preventDefault();var t,n,r;e.target.test("a")?(t=e.target.getAttribute("href"),n=e.target.ancestor("div[name=media_submission]").get("childNodes").filter("input[name=height]").get("value"),r=e.target.ancestor("div[name=media_submission]").get("childNodes").filter("input[name=width]").get("value")):(t=e.target.ancestor("a[name=submission_source]").getAttribute("href"),n=e.target.ancestor("div[name=media_submission]").get("childNodes").filter("input[name=height]").get("value"),r=e.target.ancestor("div[name=media_submission]").get("childNodes").filter("input[name=width]").get("value")),this.ltimediaassignment.open_bse_popup_callback(null,t,n,r)}},{NAME:"moodle-local_kaltura-ltipanel"}),M.local_kaltura=M.local_kaltura||{},M.local_kaltura.init=function(e){return new n(e)},M.local_kaltura.initmediaassignment=function(e){return new r(e)},M.local_kaltura.initreviewsubmission=function(){var e={addvidbtnid:"0",ltilaunchurl:"0",courseid:0,height:0,width:0},t=new r(e);return new i(t)}},"@VERSION@",{requires:["base","node","panel","node-event-simulate"]}); +YUI.add("moodle-local_kaltura-ltipanel",function(t,e){var n,i,d=function(){d.superclass.constructor.apply(this,arguments)};t.extend(d,t.Base,{modulename:null,addvidbtnid:null,init:function(e){"0"!==e.addvidbtnid&&"0"!==e.ltilaunchurl&&0!==e.courseid&&0!==e.height&&0!==e.width?(this.modulename=e.modulename,this.addvidbtnid=e.addvidbtnid,t.one("#"+e.addvidbtnid).on("click",this.open_bse_popup_callback,this,e.ltilaunchurl,e.height,e.width)):alert("Some parameters were not initialized.")},open_bse_popup_callback:function(e,t,n,i){var d=window.screenLeft!=undefined?window.screenLeft:screen.left,o=window.screenTop!=undefined?window.screenTop:screen.top,d=(window.innerWidth||document.documentElement.clientWidth||screen.width)/2-600+d,o=(window.innerHeight||document.documentElement.clientHeight||screen.height)/2-350+o,t=window.open(t,M.util.get_string("browse_and_embed","local_kaltura"),"scrollbars=yes, width=1200, height=700, top="+o+", left="+d);window.focus&&t.focus(),document.body.bsePopup=t,o=this.createEntrySelectedEvent(),document.body.entrySelectedEvent=o,document.body.addEventListener("entrySelected",this.close_popup_callback.bind(this),!1)},createEntrySelectedEvent:function(){var e;return"function"==typeof window.CustomEvent?e=new CustomEvent("entrySelected"):(e=document.createEvent("CustomEvent")).initCustomEvent("entrySelected",!1,!1,{}),e},close_popup_callback:function(){var e=t.one("img[id=video_thumbnail]");e.setStyle("display","none"),(e=t.one("iframe[id=contentframe]")).setAttribute("width",t.one("input[id=width]").getAttribute("value")),e.setAttribute("height",t.one("input[id=height]").getAttribute("value")),e.setStyle("display","inline"),e=t.one("input[name=modulename]"),undefined!==e&&"kalvidres"===this.modulename&&this.lti_panel_change_add_media_button_caption(),document.body.bsePopup.close()},lti_panel_change_add_media_button_caption:function(){var e=M.util.get_string("replace_video",this.modulename);e!==t.one("#"+this.addvidbtnid).getAttribute("value")&&t.one("#"+this.addvidbtnid).setAttribute("value",e)}},{NAME:"moodle-local_kaltura-ltipanel",ATTRS:{addvidbtnid:{value:"0"},ltilaunchurl:{value:"0"},height:{value:0},width:{value:0},modulename:{value:""}}}),t.extend(n=function(){n.superclass.constructor.apply(this,arguments)},t.Base,{init:function(e){"0"!==e.addvidbtnid&&"0"!==e.ltilaunchurl&&0!==e.courseid&&0!==e.height&&0!==e.width&&t.one("#"+e.addvidbtnid).on("click",this.open_bse_popup_callback,this,e.ltilaunchurl,e.height,e.width)},open_bse_popup_callback:function(e,t,n,i){var d=window.screenLeft!=undefined?window.screenLeft:screen.left,o=window.screenTop!=undefined?window.screenTop:screen.top,d=(window.innerWidth||document.documentElement.clientWidth||screen.width)/2-600+d,o=(window.innerHeight||document.documentElement.clientHeight||screen.height)/2-350+o,t=window.open(t,M.util.get_string("browse_and_embed","local_kaltura"),"scrollbars=yes, width=1200, height=700, top="+o+", left="+d);window.focus&&t.focus(),document.body.bsePopup=t,o=this.createEntrySelectedEvent(),document.body.entrySelectedEvent=o,document.body.addEventListener("entrySelected",this.close_popup_callback.bind(this),!1)},createEntrySelectedEvent:function(){var e;return"function"==typeof window.CustomEvent?e=new CustomEvent("entrySelected"):(e=document.createEvent("CustomEvent")).initCustomEvent("entrySelected",!1,!1,{}),e},close_popup_callback:function(){var e;t.one("input[id=submit_video]").removeAttribute("disabled"),t.one("img[id=video_thumbnail]").setStyle("display","none"),(e=t.one("iframe[id=contentframe]")).setAttribute("width",t.one("input[id=width]").getAttribute("value")),e.setAttribute("height",t.one("input[id=height]").getAttribute("value")),e.setStyle("display","inline"),t.one("#id_add_video").set("value",M.util.get_string("replacevideo","kalvidassign")),t.one("#id_add_video").addClass("btn-secondary"),t.one("#submit_video").addClass("btn-primary"),t.one("#id_add_video").removeClass("btn-primary"),t.one("#submit_video").removeClass("btn-secondary"),document.body.bsePopup.close()}},{NAME:"moodle-local_kaltura-ltipanel",ATTRS:{addvidbtnid:{value:"0"},ltilaunchurl:{value:"0"},height:{value:0},width:{value:0}}}),t.extend(i=function(){i.superclass.constructor.apply(this,arguments)},t.Base,{ltimediaassignment:null,init:function(e){this.ltimediaassignment=e,t.one("form[id=fastgrade]").delegate("click",this.review_submission,"a[name=submission_source]",this)},review_submission:function(e){var t,n;e.preventDefault(),e=(n=(t=(e.target.test("a")?e.target:e.target.ancestor("a[name=submission_source]")).getAttribute("href"),e.target.ancestor("div[name=media_submission]").get("childNodes").filter("input[name=height]").get("value")),e.target.ancestor("div[name=media_submission]").get("childNodes").filter("input[name=width]").get("value")),this.ltimediaassignment.open_bse_popup_callback(null,t,n,e)}},{NAME:"moodle-local_kaltura-ltipanel"}),M.local_kaltura=M.local_kaltura||{},M.local_kaltura.init=function(e){return new d(e)},M.local_kaltura.initmediaassignment=function(e){return new n(e)},M.local_kaltura.initreviewsubmission=function(){var e={addvidbtnid:"0",ltilaunchurl:"0",courseid:0,height:0,width:0},e=new n(e);return new i(e)}},"@VERSION@",{requires:["base","node","panel","node-event-simulate"]}); \ No newline at end of file diff --git a/local/kaltura/yui/build/moodle-local_kaltura-ltipanel/moodle-local_kaltura-ltipanel.js b/local/kaltura/yui/build/moodle-local_kaltura-ltipanel/moodle-local_kaltura-ltipanel.js index 5ff93958118dc..316b2baaaa78b 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-ltipanel/moodle-local_kaltura-ltipanel.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-ltipanel/moodle-local_kaltura-ltipanel.js @@ -56,7 +56,9 @@ Y.extend(LTIPANEL, Y.Base, { */ init : function(params) { // Check to make sure parameters are initialized - if ('0' === params.addvidbtnid || '0' === params.ltilaunchurl || 0 === params.courseid || 0 === params.height || 0 === params.width) { + if ('0' === params.addvidbtnid || '0' === params.ltilaunchurl + || 0 === params.courseid || 0 === params.height || 0 === params.width) { + // jshint undef:false alert('Some parameters were not initialized.'); return; } @@ -79,12 +81,13 @@ Y.extend(LTIPANEL, Y.Base, { var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; - var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; - var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; + width = window.innerWidth || document.documentElement.clientWidth || screen.width; + height = window.innerHeight || document.documentElement.clientHeight || screen.height; var left = ((width / 2) - (w / 2)) + dualScreenLeft; var top = ((height / 2) - (h / 2)) + dualScreenTop; - var bsePopup = window.open(url, M.util.get_string("browse_and_embed", "local_kaltura"), 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); + var bsePopup = window.open(url, M.util.get_string("browse_and_embed", "local_kaltura"), + 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); if (window.focus) { bsePopup.focus(); @@ -166,8 +169,8 @@ Y.extend(LTIPANEL, Y.Base, { /** * This method calls the base class constructor. The primary difference between LTIPANELMEDIAASSIGNMENT and LTIPANEL is that - * LTIPANELMEDIAASSIGNMENT creates a node and appends it to the body tag of the page. The reason for this is due to an issue with the Moodle - * navbar covering up part of the YUI panel, if the panel markup is appended to a child element within the body tag. + * LTIPANELMEDIAASSIGNMENT creates a node and appends it to the body tag of the page. The reason for this is due to an issue with + * the Moodle navbar covering up part of the YUI panel, if the panel markup is appended to a child element within the body tag. * @method LTIPANELMEDIAASSIGNMENT */ var LTIPANELMEDIAASSIGNMENT = function() { @@ -182,7 +185,8 @@ Y.extend(LTIPANELMEDIAASSIGNMENT, Y.Base, { */ init : function(params) { // Check to make sure parameters are initialized - if ('0' === params.addvidbtnid || '0' === params.ltilaunchurl || 0 === params.courseid || 0 === params.height || 0 === params.width) { + if ('0' === params.addvidbtnid || '0' === params.ltilaunchurl + || 0 === params.courseid || 0 === params.height || 0 === params.width) { return; } @@ -201,12 +205,13 @@ Y.extend(LTIPANELMEDIAASSIGNMENT, Y.Base, { var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; - var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; - var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; + width = window.innerWidth || document.documentElement.clientWidth || screen.width; + height = window.innerHeight || document.documentElement.clientHeight || screen.height; var left = ((width / 2) - (w / 2)) + dualScreenLeft; var top = ((height / 2) - (h / 2)) + dualScreenTop; - var bsePopup = window.open(url, M.util.get_string("browse_and_embed", "local_kaltura"), 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); + var bsePopup = window.open(url, M.util.get_string("browse_and_embed", "local_kaltura"), + 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); if (window.focus) { bsePopup.focus(); diff --git a/local/kaltura/yui/build/moodle-local_kaltura-ltiservice/moodle-local_kaltura-ltiservice-debug.js b/local/kaltura/yui/build/moodle-local_kaltura-ltiservice/moodle-local_kaltura-ltiservice-debug.js index 16da69c2f1921..8e87b822f3786 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-ltiservice/moodle-local_kaltura-ltiservice-debug.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-ltiservice/moodle-local_kaltura-ltiservice-debug.js @@ -1,130 +1,131 @@ YUI.add('moodle-local_kaltura-ltiservice', function (Y, NAME) { -// 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 . - -/** - * YUI module for displaying an LTI launch within a YUI panel. - * - * @package local_kaltura - * @author Remote-Learner.net Inc - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @copyright (C) 2014 Remote Learner.net Inc http://www.remote-learner.net - */ - -/** - * This method calls the base class constructor - * @method LTISERVICE - */ -var LTISERVICE = function() { - LTISERVICE.superclass.constructor.apply(this, arguments); -}; - -Y.extend(LTISERVICE, Y.Base, { - /** - * Init function for triggering a custom event and setting attributes. Also checks whether optional elements exist in the parent window. - * @property params - * @type {Object} - */ - init : function(params) { - var documentElement = window.opener ? window.opener.parent.document : window.parent.document; - if (documentElement.getElementById('video_title')) { - Y.one(documentElement.getElementById('video_title')).setAttribute('value', params.title); - } - - if (documentElement.getElementById('entry_id')) { - Y.one(documentElement.getElementById('entry_id')).setAttribute('value', params.entryid); - } - - if (documentElement.getElementById('height')) { - Y.one(documentElement.getElementById('height')).setAttribute('value', params.height); - } - - if (documentElement.getElementById('width')) { - Y.one(documentElement.getElementById('width')).setAttribute('value', params.width); - } - - if (documentElement.getElementById('uiconf_id')) { - Y.one(documentElement.getElementById('uiconf_id')).setAttribute('value', '1'); - } - - if (documentElement.getElementById('widescreen')) { - Y.one(documentElement.getElementById('widescreen')).setAttribute('value', '1'); - } - - if (documentElement.getElementById('video_preview_frame')) { - Y.one(documentElement.getElementById('video_preview_frame')).setAttribute('src', params.previewltilauncher); - } else if (documentElement.getElementById('contentframe')) { - Y.one(documentElement.getElementById('contentframe')).setAttribute('src', decodeURIComponent(params.iframeurl)); - Y.one(documentElement.getElementById('contentframe')).setStyle('width', params.width + 'px'); - Y.one(documentElement.getElementById('contentframe')).setStyle('height', params.height + 'px'); - } - - // This element must exist. - Y.one(documentElement.getElementById('source')).setAttribute('value', decodeURIComponent(params.iframeurl)); - - if (documentElement.getElementById('metadata')) { - Y.one(documentElement.getElementById('metadata')).setAttribute('value', params.metadata); - } - - if (window.parent.insertMedia) { - window.parent.insertMedia(); - return; - } - - if (documentElement.getElementById('closeltipanel')) { - Y.one(documentElement.getElementById('closeltipanel')).simulate('click'); - } - - documentElement.body.dispatchEvent(documentElement.body.entrySelectedEvent); - } - }, - { - NAME : 'moodle-local_kaltura-ltiservice', - ATTRS : { - iframeurl : { - value: '' - }, - width : { - value: '' - }, - height : { - value: '' - }, - entryid : { - value: '' - }, - title : { - value: '' - }, - metadata : { - value: '' - } - } - - }); -M.local_kaltura = M.local_kaltura || {}; - -/** - * Entry point for ltiservice module - * @param string params additional parameters. - * @return object the ltiservice object - */ -M.local_kaltura.init = function(params) { - return new LTISERVICE(params); -}; +// 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 . + +/** + * YUI module for displaying an LTI launch within a YUI panel. + * + * @package local_kaltura + * @author Remote-Learner.net Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2014 Remote Learner.net Inc http://www.remote-learner.net + */ + + /** + * This method calls the base class constructor + * @method LTISERVICE + */ +var LTISERVICE = function() { + LTISERVICE.superclass.constructor.apply(this, arguments); +}; + +Y.extend(LTISERVICE, Y.Base, { + /** + * Init function for triggering a custom event and setting attributes. + * Also checks whether optional elements exist in the parent window. + * @property params + * @type {Object} + */ + init : function(params) { + var documentElement = window.opener ? window.opener.parent.document : window.parent.document; + if (documentElement.getElementById('video_title')) { + Y.one(documentElement.getElementById('video_title')).setAttribute('value', params.title); + } + + if (documentElement.getElementById('entry_id')) { + Y.one(documentElement.getElementById('entry_id')).setAttribute('value', params.entryid); + } + + if (documentElement.getElementById('height')) { + Y.one(documentElement.getElementById('height')).setAttribute('value', params.height); + } + + if (documentElement.getElementById('width')) { + Y.one(documentElement.getElementById('width')).setAttribute('value', params.width); + } + + if (documentElement.getElementById('uiconf_id')) { + Y.one(documentElement.getElementById('uiconf_id')).setAttribute('value', '1'); + } + + if (documentElement.getElementById('widescreen')) { + Y.one(documentElement.getElementById('widescreen')).setAttribute('value', '1'); + } + + if (documentElement.getElementById('video_preview_frame')) { + Y.one(documentElement.getElementById('video_preview_frame')).setAttribute('src', params.previewltilauncher); + } else if (documentElement.getElementById('contentframe')) { + Y.one(documentElement.getElementById('contentframe')).setAttribute('src', decodeURIComponent(params.iframeurl)); + Y.one(documentElement.getElementById('contentframe')).setStyle('width', params.width + 'px'); + Y.one(documentElement.getElementById('contentframe')).setStyle('height', params.height + 'px'); + } + + // This element must exist. + Y.one(documentElement.getElementById('source')).setAttribute('value', decodeURIComponent(params.iframeurl)); + + if (documentElement.getElementById('metadata')) { + Y.one(documentElement.getElementById('metadata')).setAttribute('value', params.metadata); + } + + if (window.parent.insertMedia) { + window.parent.insertMedia(); + return; + } + + if (documentElement.getElementById('closeltipanel')) { + Y.one(documentElement.getElementById('closeltipanel')).simulate('click'); + } + + documentElement.body.dispatchEvent(documentElement.body.entrySelectedEvent); + } +}, +{ + NAME : 'moodle-local_kaltura-ltiservice', + ATTRS : { + iframeurl : { + value: '' + }, + width : { + value: '' + }, + height : { + value: '' + }, + entryid : { + value: '' + }, + title : { + value: '' + }, + metadata : { + value: '' + } + } + +}); +M.local_kaltura = M.local_kaltura || {}; + +/** + * Entry point for ltiservice module + * @param string params additional parameters. + * @return object the ltiservice object + */ +M.local_kaltura.init = function(params) { + return new LTISERVICE(params); +}; }, '@VERSION@', {"requires": ["base", "node", "node-event-simulate"]}); diff --git a/local/kaltura/yui/build/moodle-local_kaltura-ltiservice/moodle-local_kaltura-ltiservice-min.js b/local/kaltura/yui/build/moodle-local_kaltura-ltiservice/moodle-local_kaltura-ltiservice-min.js index 387c0016e21fe..71bce3687a2a4 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-ltiservice/moodle-local_kaltura-ltiservice-min.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-ltiservice/moodle-local_kaltura-ltiservice-min.js @@ -1 +1 @@ -YUI.add("moodle-local_kaltura-ltiservice",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Base,{init:function(t){var n=window.opener?window.opener.parent.document:window.parent.document;n.getElementById("video_title")&&e.one(n.getElementById("video_title")).setAttribute("value",t.title),n.getElementById("entry_id")&&e.one(n.getElementById("entry_id")).setAttribute("value",t.entryid),n.getElementById("height")&&e.one(n.getElementById("height")).setAttribute("value",t.height),n.getElementById("width")&&e.one(n.getElementById("width")).setAttribute("value",t.width),n.getElementById("uiconf_id")&&e.one(n.getElementById("uiconf_id")).setAttribute("value","1"),n.getElementById("widescreen")&&e.one(n.getElementById("widescreen")).setAttribute("value","1"),n.getElementById("video_preview_frame")?e.one(n.getElementById("video_preview_frame")).setAttribute("src",t.previewltilauncher):n.getElementById("contentframe")&&(e.one(n.getElementById("contentframe")).setAttribute("src",decodeURIComponent(t.iframeurl)),e.one(n.getElementById("contentframe")).setStyle("width",t.width+"px"),e.one(n.getElementById("contentframe")).setStyle("height",t.height+"px")),e.one(n.getElementById("source")).setAttribute("value",decodeURIComponent(t.iframeurl)),n.getElementById("metadata")&&e.one(n.getElementById("metadata")).setAttribute("value",t.metadata);if(window.parent.insertMedia){window.parent.insertMedia();return}n.getElementById("closeltipanel")&&e.one(n.getElementById("closeltipanel")).simulate("click"),n.body.dispatchEvent(n.body.entrySelectedEvent)}},{NAME:"moodle-local_kaltura-ltiservice",ATTRS:{iframeurl:{value:""},width:{value:""},height:{value:""},entryid:{value:""},title:{value:""},metadata:{value:""}}}),M.local_kaltura=M.local_kaltura||{},M.local_kaltura.init=function(e){return new n(e)}},"@VERSION@",{requires:["base","node","node-event-simulate"]}); +YUI.add("moodle-local_kaltura-ltiservice",function(n,e){var t=function(){t.superclass.constructor.apply(this,arguments)};n.extend(t,n.Base,{init:function(e){var t=(window.opener||window).parent.document;t.getElementById("video_title")&&n.one(t.getElementById("video_title")).setAttribute("value",e.title),t.getElementById("entry_id")&&n.one(t.getElementById("entry_id")).setAttribute("value",e.entryid),t.getElementById("height")&&n.one(t.getElementById("height")).setAttribute("value",e.height),t.getElementById("width")&&n.one(t.getElementById("width")).setAttribute("value",e.width),t.getElementById("uiconf_id")&&n.one(t.getElementById("uiconf_id")).setAttribute("value","1"),t.getElementById("widescreen")&&n.one(t.getElementById("widescreen")).setAttribute("value","1"),t.getElementById("video_preview_frame")?n.one(t.getElementById("video_preview_frame")).setAttribute("src",e.previewltilauncher):t.getElementById("contentframe")&&(n.one(t.getElementById("contentframe")).setAttribute("src",decodeURIComponent(e.iframeurl)),n.one(t.getElementById("contentframe")).setStyle("width",e.width+"px"),n.one(t.getElementById("contentframe")).setStyle("height",e.height+"px")),n.one(t.getElementById("source")).setAttribute("value",decodeURIComponent(e.iframeurl)),t.getElementById("metadata")&&n.one(t.getElementById("metadata")).setAttribute("value",e.metadata),window.parent.insertMedia?window.parent.insertMedia():(t.getElementById("closeltipanel")&&n.one(t.getElementById("closeltipanel")).simulate("click"),t.body.dispatchEvent(t.body.entrySelectedEvent))}},{NAME:"moodle-local_kaltura-ltiservice",ATTRS:{iframeurl:{value:""},width:{value:""},height:{value:""},entryid:{value:""},title:{value:""},metadata:{value:""}}}),M.local_kaltura=M.local_kaltura||{},M.local_kaltura.init=function(e){return new t(e)}},"@VERSION@",{requires:["base","node","node-event-simulate"]}); \ No newline at end of file diff --git a/local/kaltura/yui/build/moodle-local_kaltura-ltiservice/moodle-local_kaltura-ltiservice.js b/local/kaltura/yui/build/moodle-local_kaltura-ltiservice/moodle-local_kaltura-ltiservice.js index 16da69c2f1921..8e87b822f3786 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-ltiservice/moodle-local_kaltura-ltiservice.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-ltiservice/moodle-local_kaltura-ltiservice.js @@ -1,130 +1,131 @@ YUI.add('moodle-local_kaltura-ltiservice', function (Y, NAME) { -// 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 . - -/** - * YUI module for displaying an LTI launch within a YUI panel. - * - * @package local_kaltura - * @author Remote-Learner.net Inc - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @copyright (C) 2014 Remote Learner.net Inc http://www.remote-learner.net - */ - -/** - * This method calls the base class constructor - * @method LTISERVICE - */ -var LTISERVICE = function() { - LTISERVICE.superclass.constructor.apply(this, arguments); -}; - -Y.extend(LTISERVICE, Y.Base, { - /** - * Init function for triggering a custom event and setting attributes. Also checks whether optional elements exist in the parent window. - * @property params - * @type {Object} - */ - init : function(params) { - var documentElement = window.opener ? window.opener.parent.document : window.parent.document; - if (documentElement.getElementById('video_title')) { - Y.one(documentElement.getElementById('video_title')).setAttribute('value', params.title); - } - - if (documentElement.getElementById('entry_id')) { - Y.one(documentElement.getElementById('entry_id')).setAttribute('value', params.entryid); - } - - if (documentElement.getElementById('height')) { - Y.one(documentElement.getElementById('height')).setAttribute('value', params.height); - } - - if (documentElement.getElementById('width')) { - Y.one(documentElement.getElementById('width')).setAttribute('value', params.width); - } - - if (documentElement.getElementById('uiconf_id')) { - Y.one(documentElement.getElementById('uiconf_id')).setAttribute('value', '1'); - } - - if (documentElement.getElementById('widescreen')) { - Y.one(documentElement.getElementById('widescreen')).setAttribute('value', '1'); - } - - if (documentElement.getElementById('video_preview_frame')) { - Y.one(documentElement.getElementById('video_preview_frame')).setAttribute('src', params.previewltilauncher); - } else if (documentElement.getElementById('contentframe')) { - Y.one(documentElement.getElementById('contentframe')).setAttribute('src', decodeURIComponent(params.iframeurl)); - Y.one(documentElement.getElementById('contentframe')).setStyle('width', params.width + 'px'); - Y.one(documentElement.getElementById('contentframe')).setStyle('height', params.height + 'px'); - } - - // This element must exist. - Y.one(documentElement.getElementById('source')).setAttribute('value', decodeURIComponent(params.iframeurl)); - - if (documentElement.getElementById('metadata')) { - Y.one(documentElement.getElementById('metadata')).setAttribute('value', params.metadata); - } - - if (window.parent.insertMedia) { - window.parent.insertMedia(); - return; - } - - if (documentElement.getElementById('closeltipanel')) { - Y.one(documentElement.getElementById('closeltipanel')).simulate('click'); - } - - documentElement.body.dispatchEvent(documentElement.body.entrySelectedEvent); - } - }, - { - NAME : 'moodle-local_kaltura-ltiservice', - ATTRS : { - iframeurl : { - value: '' - }, - width : { - value: '' - }, - height : { - value: '' - }, - entryid : { - value: '' - }, - title : { - value: '' - }, - metadata : { - value: '' - } - } - - }); -M.local_kaltura = M.local_kaltura || {}; - -/** - * Entry point for ltiservice module - * @param string params additional parameters. - * @return object the ltiservice object - */ -M.local_kaltura.init = function(params) { - return new LTISERVICE(params); -}; +// 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 . + +/** + * YUI module for displaying an LTI launch within a YUI panel. + * + * @package local_kaltura + * @author Remote-Learner.net Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2014 Remote Learner.net Inc http://www.remote-learner.net + */ + + /** + * This method calls the base class constructor + * @method LTISERVICE + */ +var LTISERVICE = function() { + LTISERVICE.superclass.constructor.apply(this, arguments); +}; + +Y.extend(LTISERVICE, Y.Base, { + /** + * Init function for triggering a custom event and setting attributes. + * Also checks whether optional elements exist in the parent window. + * @property params + * @type {Object} + */ + init : function(params) { + var documentElement = window.opener ? window.opener.parent.document : window.parent.document; + if (documentElement.getElementById('video_title')) { + Y.one(documentElement.getElementById('video_title')).setAttribute('value', params.title); + } + + if (documentElement.getElementById('entry_id')) { + Y.one(documentElement.getElementById('entry_id')).setAttribute('value', params.entryid); + } + + if (documentElement.getElementById('height')) { + Y.one(documentElement.getElementById('height')).setAttribute('value', params.height); + } + + if (documentElement.getElementById('width')) { + Y.one(documentElement.getElementById('width')).setAttribute('value', params.width); + } + + if (documentElement.getElementById('uiconf_id')) { + Y.one(documentElement.getElementById('uiconf_id')).setAttribute('value', '1'); + } + + if (documentElement.getElementById('widescreen')) { + Y.one(documentElement.getElementById('widescreen')).setAttribute('value', '1'); + } + + if (documentElement.getElementById('video_preview_frame')) { + Y.one(documentElement.getElementById('video_preview_frame')).setAttribute('src', params.previewltilauncher); + } else if (documentElement.getElementById('contentframe')) { + Y.one(documentElement.getElementById('contentframe')).setAttribute('src', decodeURIComponent(params.iframeurl)); + Y.one(documentElement.getElementById('contentframe')).setStyle('width', params.width + 'px'); + Y.one(documentElement.getElementById('contentframe')).setStyle('height', params.height + 'px'); + } + + // This element must exist. + Y.one(documentElement.getElementById('source')).setAttribute('value', decodeURIComponent(params.iframeurl)); + + if (documentElement.getElementById('metadata')) { + Y.one(documentElement.getElementById('metadata')).setAttribute('value', params.metadata); + } + + if (window.parent.insertMedia) { + window.parent.insertMedia(); + return; + } + + if (documentElement.getElementById('closeltipanel')) { + Y.one(documentElement.getElementById('closeltipanel')).simulate('click'); + } + + documentElement.body.dispatchEvent(documentElement.body.entrySelectedEvent); + } +}, +{ + NAME : 'moodle-local_kaltura-ltiservice', + ATTRS : { + iframeurl : { + value: '' + }, + width : { + value: '' + }, + height : { + value: '' + }, + entryid : { + value: '' + }, + title : { + value: '' + }, + metadata : { + value: '' + } + } + +}); +M.local_kaltura = M.local_kaltura || {}; + +/** + * Entry point for ltiservice module + * @param string params additional parameters. + * @return object the ltiservice object + */ +M.local_kaltura.init = function(params) { + return new LTISERVICE(params); +}; }, '@VERSION@', {"requires": ["base", "node", "node-event-simulate"]}); diff --git a/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-debug.js b/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-debug.js index fe9a0df2f07f7..879ca081fc659 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-debug.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-debug.js @@ -1,133 +1,139 @@ -YUI.add('moodle-local_kaltura-ltitinymcepanel', function (Y, NAME) { - -// 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 . - -/** - * YUI module for displaying an LTI launch within a YUI panel. - * - * @package local_kaltura - * @author Remote-Learner.net Inc - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @copyright (C) 2014 Remote Learner.net Inc http://www.remote-learner.net - */ - -/** - * This method calls the base class constructor - * @method LTITINYMCEPANEL - */ -var LTITINYMCEPANEL = function() { - LTITINYMCEPANEL.superclass.constructor.apply(this, arguments); -}; - -Y.extend(LTITINYMCEPANEL, Y.Base, { - /** - * The context id the editor was launched in. - * @property contextid - * @type {Integer} - * @default null - */ - contextid: 0, - - /** - * Init function for the checkboxselection module - * @property {Object} params Data to help initialize the YUI module. - */ - init : function(params) { - // Check to make sure parameters are initialized. - if ('' === params.ltilaunchurl || '' === params.objecttagheight || '' === params.objecttagid || '' === params.previewiframeid) { - alert('Some parameters were not initialized.'); - return; - } - - // Initialize the the browse when the window is initially rendered. - this.load_lti_content(params.ltilaunchurl, params.objecttagid, params.objecttagheight); - - // Listen to simulated click event send from local/kaltura/service.php - Y.one('#closeltipanel').on('click', this.user_selected_video_callback, this, params.objecttagid, params.previewiframeid, params.objecttagheight); - - if (null !== Y.one('#page-footer')) { - Y.one('#page-footer').setStyle('display', 'none'); - } - }, - - /** - * A funciton to load the LTI content. This is called when the YUI module is first initialized. - * @property {String} url LTI launch URL. - * @property {String} iframeid iframe tag id. - * @property {String} iframeheight iframe tag height. - */ - load_lti_content : function(url, iframeid, iframeheight) { - if (0 === this.contextid) { - this.contextid = Y.one('#lti_launch_context_id').get('value'); - } - - var content = ''; - Y.one('#'+iframeid).setContent(content); - }, - - /** - * This function serves as a call back method for when the closeltipanel div has been clicked. It means that the user has - * selected a video for embedding into the TinyMCE edotor. Enabling the insert button, removing the contents LTI launch element and - * adding content to the media preview element. - * @property {Object} e Event object. - * @property {String} objecttagid Object tag id. - * @property {String} previewiframeid Preview iframe tag id. - * @property {String} height Height of the iframe. - */ - user_selected_video_callback : function(e, objecttagid, previewiframeid, height) { - Y.one('#'+objecttagid).setContent(''); - - var center = Y.Node.create('
'); - var iframe = Y.Node.create(''); - iframe.setAttribute('allowfullscreen', ''); - iframe.setAttribute('width', Y.one('#width').get('value')+'px'); - iframe.setAttribute('height', height+'px'); - iframe.setAttribute('src', Y.one('#video_preview_frame').getAttribute('src')); - - center.append(iframe); - Y.one('#'+previewiframeid).append(center); - } - }, - { - NAME : 'moodle-local_kaltura-ltitinymcepanel', - ATTRS : { - ltilaunchurl : { - value : '' - }, - objecttagheight : { - value : '' - }, - objecttagid : { - value : '' - }, - previewiframeid : { - value : '' - } - } - }); -M.local_kaltura = M.local_kaltura || {}; - -/** - * Entry point for ltipanel module - * @param {Object} params Additional parameters. - * @return {Object} the ltipanel object - */ -M.local_kaltura.init = function(params) { - return new LTITINYMCEPANEL(params); -}; - - -}, '@VERSION@', {"requires": ["base", "node", "panel", "node-event-simulate"]}); +YUI.add('moodle-local_kaltura-ltitinymcepanel', function (Y, NAME) { + +// 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 . + +/** + * YUI module for displaying an LTI launch within a YUI panel. + * + * @package local_kaltura + * @author Remote-Learner.net Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2014 Remote Learner.net Inc http://www.remote-learner.net + */ + +/** + * This method calls the base class constructor + * @method LTITINYMCEPANEL + */ +var LTITINYMCEPANEL = function() { + LTITINYMCEPANEL.superclass.constructor.apply(this, arguments); +}; + +Y.extend(LTITINYMCEPANEL, Y.Base, { + /** + * The context id the editor was launched in. + * @property contextid + * @type {Integer} + * @default null + */ + contextid: 0, + + /** + * Init function for the checkboxselection module + * @property {Object} params Data to help initialize the YUI module. + */ + init : function(params) { + // Check to make sure parameters are initialized. + if ('' === params.ltilaunchurl || '' === params.objecttagheight + || '' === params.objecttagid || '' === params.previewiframeid) { + // jshint undef:false + alert('Some parameters were not initialized.'); + return; + } + + // Initialize the the browse when the window is initially rendered. + this.load_lti_content(params.ltilaunchurl, params.objecttagid, params.objecttagheight); + + // Listen to simulated click event send from local/kaltura/service.php + Y.one('#closeltipanel').on('click', this.user_selected_video_callback, this, params.objecttagid, + params.previewiframeid, params.objecttagheight); + + if (null !== Y.one('#page-footer')) { + Y.one('#page-footer').setStyle('display', 'none'); + } + }, + + /** + * A funciton to load the LTI content. This is called when the YUI module is first initialized. + * @property {String} url LTI launch URL. + * @property {String} iframeid iframe tag id. + * @property {String} iframeheight iframe tag height. + */ + load_lti_content : function(url, iframeid, iframeheight) { + if (0 === this.contextid) { + this.contextid = Y.one('#lti_launch_context_id').get('value'); + } + + var content = ''; + Y.one('#'+iframeid).setContent(content); + }, + + /** + * This function serves as a call back method for when the closeltipanel div has been clicked. It means that the user has + * selected a video for embedding into the TinyMCE edotor. Enabling the insert button, removing the contents LTI launch + * element and adding content to the media preview element. + * @property {Object} e Event object. + * @property {String} objecttagid Object tag id. + * @property {String} previewiframeid Preview iframe tag id. + * @property {String} height Height of the iframe. + */ + user_selected_video_callback : function(e, objecttagid, previewiframeid, height) { + Y.one('#'+objecttagid).setContent(''); + + var center = Y.Node.create('
'); + var iframe = Y.Node.create(''); + iframe.setAttribute('allowfullscreen', ''); + iframe.setAttribute('width', Y.one('#width').get('value')+'px'); + iframe.setAttribute('height', height+'px'); + iframe.setAttribute('src', Y.one('#video_preview_frame').getAttribute('src')); + + center.append(iframe); + Y.one('#'+previewiframeid).append(center); + } + }, + { + NAME : 'moodle-local_kaltura-ltitinymcepanel', + ATTRS : { + ltilaunchurl : { + value : '' + }, + objecttagheight : { + value : '' + }, + objecttagid : { + value : '' + }, + previewiframeid : { + value : '' + } + } + }); +M.local_kaltura = M.local_kaltura || {}; + +/** + * Entry point for ltipanel module + * @param {Object} params Additional parameters. + * @return {Object} the ltipanel object + */ +M.local_kaltura.init = function(params) { + return new LTITINYMCEPANEL(params); +}; + + +}, '@VERSION@', {"requires": ["base", "node", "panel", "node-event-simulate"]}); diff --git a/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-min.js b/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-min.js index 60b17a61a109b..06da10f82eee7 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-min.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-min.js @@ -1 +1 @@ -YUI.add("moodle-local_kaltura-ltitinymcepanel",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Base,{contextid:0,init:function(t){if(""===t.ltilaunchurl||""===t.objecttagheight||""===t.objecttagid||""===t.previewiframeid){alert("Some parameters were not initialized.");return}this.load_lti_content(t.ltilaunchurl,t.objecttagid,t.objecttagheight),e.one("#closeltipanel").on("click",this.user_selected_video_callback,this,t.objecttagid,t.previewiframeid,t.objecttagheight),null!==e.one("#page-footer")&&e.one("#page-footer").setStyle("display","none")},load_lti_content:function(t,n,r){0===this.contextid&&(this.contextid=e.one("#lti_launch_context_id").get("value"));var i='';e.one("#"+n).setContent(i)},user_selected_video_callback:function(t,n,r,i){e.one("#"+n).setContent("");var s=e.Node.create("
"),o=e.Node.create("");o.setAttribute("allowfullscreen",""),o.setAttribute("width",e.one("#width").get("value")+"px"),o.setAttribute("height",i+"px"),o.setAttribute("src",e.one("#video_preview_frame").getAttribute("src")),s.append(o),e.one("#"+r).append(s)}},{NAME:"moodle-local_kaltura-ltitinymcepanel",ATTRS:{ltilaunchurl:{value:""},objecttagheight:{value:""},objecttagid:{value:""},previewiframeid:{value:""}}}),M.local_kaltura=M.local_kaltura||{},M.local_kaltura.init=function(e){return new n(e)}},"@VERSION@",{requires:["base","node","panel","node-event-simulate"]}); +YUI.add("moodle-local_kaltura-ltitinymcepanel",function(n,e){var t=function(){t.superclass.constructor.apply(this,arguments)};n.extend(t,n.Base,{contextid:0,init:function(e){""!==e.ltilaunchurl&&""!==e.objecttagheight&&""!==e.objecttagid&&""!==e.previewiframeid?(this.load_lti_content(e.ltilaunchurl,e.objecttagid,e.objecttagheight),n.one("#closeltipanel").on("click",this.user_selected_video_callback,this,e.objecttagid,e.previewiframeid,e.objecttagheight),null!==n.one("#page-footer")&&n.one("#page-footer").setStyle("display","none")):alert("Some parameters were not initialized.")},load_lti_content:function(e,t,i){0===this.contextid&&(this.contextid=n.one("#lti_launch_context_id").get("value"));i='';n.one("#"+t).setContent(i)},user_selected_video_callback:function(e,t,i,a){var l;n.one("#"+t).setContent(""),t=n.Node.create("
"),(l=n.Node.create("")).setAttribute("allowfullscreen",""),l.setAttribute("width",n.one("#width").get("value")+"px"),l.setAttribute("height",a+"px"),l.setAttribute("src",n.one("#video_preview_frame").getAttribute("src")),t.append(l),n.one("#"+i).append(t)}},{NAME:"moodle-local_kaltura-ltitinymcepanel",ATTRS:{ltilaunchurl:{value:""},objecttagheight:{value:""},objecttagid:{value:""},previewiframeid:{value:""}}}),M.local_kaltura=M.local_kaltura||{},M.local_kaltura.init=function(e){return new t(e)}},"@VERSION@",{requires:["base","node","panel","node-event-simulate"]}); \ No newline at end of file diff --git a/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel.js b/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel.js index fe9a0df2f07f7..879ca081fc659 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel.js @@ -1,133 +1,139 @@ -YUI.add('moodle-local_kaltura-ltitinymcepanel', function (Y, NAME) { - -// 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 . - -/** - * YUI module for displaying an LTI launch within a YUI panel. - * - * @package local_kaltura - * @author Remote-Learner.net Inc - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @copyright (C) 2014 Remote Learner.net Inc http://www.remote-learner.net - */ - -/** - * This method calls the base class constructor - * @method LTITINYMCEPANEL - */ -var LTITINYMCEPANEL = function() { - LTITINYMCEPANEL.superclass.constructor.apply(this, arguments); -}; - -Y.extend(LTITINYMCEPANEL, Y.Base, { - /** - * The context id the editor was launched in. - * @property contextid - * @type {Integer} - * @default null - */ - contextid: 0, - - /** - * Init function for the checkboxselection module - * @property {Object} params Data to help initialize the YUI module. - */ - init : function(params) { - // Check to make sure parameters are initialized. - if ('' === params.ltilaunchurl || '' === params.objecttagheight || '' === params.objecttagid || '' === params.previewiframeid) { - alert('Some parameters were not initialized.'); - return; - } - - // Initialize the the browse when the window is initially rendered. - this.load_lti_content(params.ltilaunchurl, params.objecttagid, params.objecttagheight); - - // Listen to simulated click event send from local/kaltura/service.php - Y.one('#closeltipanel').on('click', this.user_selected_video_callback, this, params.objecttagid, params.previewiframeid, params.objecttagheight); - - if (null !== Y.one('#page-footer')) { - Y.one('#page-footer').setStyle('display', 'none'); - } - }, - - /** - * A funciton to load the LTI content. This is called when the YUI module is first initialized. - * @property {String} url LTI launch URL. - * @property {String} iframeid iframe tag id. - * @property {String} iframeheight iframe tag height. - */ - load_lti_content : function(url, iframeid, iframeheight) { - if (0 === this.contextid) { - this.contextid = Y.one('#lti_launch_context_id').get('value'); - } - - var content = ''; - Y.one('#'+iframeid).setContent(content); - }, - - /** - * This function serves as a call back method for when the closeltipanel div has been clicked. It means that the user has - * selected a video for embedding into the TinyMCE edotor. Enabling the insert button, removing the contents LTI launch element and - * adding content to the media preview element. - * @property {Object} e Event object. - * @property {String} objecttagid Object tag id. - * @property {String} previewiframeid Preview iframe tag id. - * @property {String} height Height of the iframe. - */ - user_selected_video_callback : function(e, objecttagid, previewiframeid, height) { - Y.one('#'+objecttagid).setContent(''); - - var center = Y.Node.create('
'); - var iframe = Y.Node.create(''); - iframe.setAttribute('allowfullscreen', ''); - iframe.setAttribute('width', Y.one('#width').get('value')+'px'); - iframe.setAttribute('height', height+'px'); - iframe.setAttribute('src', Y.one('#video_preview_frame').getAttribute('src')); - - center.append(iframe); - Y.one('#'+previewiframeid).append(center); - } - }, - { - NAME : 'moodle-local_kaltura-ltitinymcepanel', - ATTRS : { - ltilaunchurl : { - value : '' - }, - objecttagheight : { - value : '' - }, - objecttagid : { - value : '' - }, - previewiframeid : { - value : '' - } - } - }); -M.local_kaltura = M.local_kaltura || {}; - -/** - * Entry point for ltipanel module - * @param {Object} params Additional parameters. - * @return {Object} the ltipanel object - */ -M.local_kaltura.init = function(params) { - return new LTITINYMCEPANEL(params); -}; - - -}, '@VERSION@', {"requires": ["base", "node", "panel", "node-event-simulate"]}); +YUI.add('moodle-local_kaltura-ltitinymcepanel', function (Y, NAME) { + +// 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 . + +/** + * YUI module for displaying an LTI launch within a YUI panel. + * + * @package local_kaltura + * @author Remote-Learner.net Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2014 Remote Learner.net Inc http://www.remote-learner.net + */ + +/** + * This method calls the base class constructor + * @method LTITINYMCEPANEL + */ +var LTITINYMCEPANEL = function() { + LTITINYMCEPANEL.superclass.constructor.apply(this, arguments); +}; + +Y.extend(LTITINYMCEPANEL, Y.Base, { + /** + * The context id the editor was launched in. + * @property contextid + * @type {Integer} + * @default null + */ + contextid: 0, + + /** + * Init function for the checkboxselection module + * @property {Object} params Data to help initialize the YUI module. + */ + init : function(params) { + // Check to make sure parameters are initialized. + if ('' === params.ltilaunchurl || '' === params.objecttagheight + || '' === params.objecttagid || '' === params.previewiframeid) { + // jshint undef:false + alert('Some parameters were not initialized.'); + return; + } + + // Initialize the the browse when the window is initially rendered. + this.load_lti_content(params.ltilaunchurl, params.objecttagid, params.objecttagheight); + + // Listen to simulated click event send from local/kaltura/service.php + Y.one('#closeltipanel').on('click', this.user_selected_video_callback, this, params.objecttagid, + params.previewiframeid, params.objecttagheight); + + if (null !== Y.one('#page-footer')) { + Y.one('#page-footer').setStyle('display', 'none'); + } + }, + + /** + * A funciton to load the LTI content. This is called when the YUI module is first initialized. + * @property {String} url LTI launch URL. + * @property {String} iframeid iframe tag id. + * @property {String} iframeheight iframe tag height. + */ + load_lti_content : function(url, iframeid, iframeheight) { + if (0 === this.contextid) { + this.contextid = Y.one('#lti_launch_context_id').get('value'); + } + + var content = ''; + Y.one('#'+iframeid).setContent(content); + }, + + /** + * This function serves as a call back method for when the closeltipanel div has been clicked. It means that the user has + * selected a video for embedding into the TinyMCE edotor. Enabling the insert button, removing the contents LTI launch + * element and adding content to the media preview element. + * @property {Object} e Event object. + * @property {String} objecttagid Object tag id. + * @property {String} previewiframeid Preview iframe tag id. + * @property {String} height Height of the iframe. + */ + user_selected_video_callback : function(e, objecttagid, previewiframeid, height) { + Y.one('#'+objecttagid).setContent(''); + + var center = Y.Node.create('
'); + var iframe = Y.Node.create(''); + iframe.setAttribute('allowfullscreen', ''); + iframe.setAttribute('width', Y.one('#width').get('value')+'px'); + iframe.setAttribute('height', height+'px'); + iframe.setAttribute('src', Y.one('#video_preview_frame').getAttribute('src')); + + center.append(iframe); + Y.one('#'+previewiframeid).append(center); + } + }, + { + NAME : 'moodle-local_kaltura-ltitinymcepanel', + ATTRS : { + ltilaunchurl : { + value : '' + }, + objecttagheight : { + value : '' + }, + objecttagid : { + value : '' + }, + previewiframeid : { + value : '' + } + } + }); +M.local_kaltura = M.local_kaltura || {}; + +/** + * Entry point for ltipanel module + * @param {Object} params Additional parameters. + * @return {Object} the ltipanel object + */ +M.local_kaltura.init = function(params) { + return new LTITINYMCEPANEL(params); +}; + + +}, '@VERSION@', {"requires": ["base", "node", "panel", "node-event-simulate"]}); diff --git a/local/kaltura/yui/src/lticontainer/js/lticontainer.js b/local/kaltura/yui/src/lticontainer/js/lticontainer.js index 80a825f1e9caa..7111bd8758b73 100644 --- a/local/kaltura/yui/src/lticontainer/js/lticontainer.js +++ b/local/kaltura/yui/src/lticontainer/js/lticontainer.js @@ -40,7 +40,8 @@ Y.extend(LTICONTAINER, Y.Base, { lastheight: null, /** - * Add padding to make the bottom of the iframe visible. The iframe wasn't visible on some themes. Probably because of border widths, etc. + * Add padding to make the bottom of the iframe visible. The iframe wasn't + * visible on some themes. Probably because of border widths, etc. * @property padding * @type {Integer} * @default 15 @@ -108,11 +109,10 @@ Y.extend(LTICONTAINER, Y.Base, { * @property params * @type {Object} */ - init : function(params) { - var bodynode = Y.one('body[class~='+params.bodyclass+']'); + init: function(params) { + var bodynode = Y.one('body[class~=' + params.bodyclass + ']'); - if(params.height && params.width) - { + if (params.height && params.width) { this.height = params.height; this.width = params.width; } @@ -132,14 +132,15 @@ Y.extend(LTICONTAINER, Y.Base, { /** * This function resizes the iframe height and width. */ - resize : function() { + resize: function() { if (this.lastheight !== Math.min(this.documentheight, this.viewportheight)) { var newheight = this.viewportheight - this.ltiframe.getY() - this.padding; - //Get the original height which is 600px, but we're getting it as 600px and need to remove the last two characters - var originalheight = this.ltiframe._node.height.slice(0,this.ltiframe._node.height.length-2); - if (newheight < originalheight) + // Get the original height which is 600px, but we're getting it as 600px and need to remove the last two characters + var originalheight = this.ltiframe._node.height.slice(0, this.ltiframe._node.height.length - 2); + if (newheight < originalheight) { return; - this.ltiframe.setStyle('height', newheight+'px'); + } + this.ltiframe.setStyle('height', newheight + 'px'); this.lastheight = Math.min(this.documentheight, this.viewportheight); } @@ -154,32 +155,31 @@ Y.extend(LTICONTAINER, Y.Base, { // If "newsize" if over allowed size then set it to the maximum allowed. if (newsize > allowedsize) { - this.ltiframe.setStyle('width', allowedsize+'px'); + this.ltiframe.setStyle('width', allowedsize + 'px'); } else { - this.ltiframe.setStyle('width', newsize+'px'); + this.ltiframe.setStyle('width', newsize + 'px'); } } } - // if we have the entry's dimensions - use them to adjust the iframe size. - if(this.height && this.width) - { - this.ltiframe.setStyle('width', this.width+'px'); - this.ltiframe.setStyle('height', this.height+'px'); + // If we have the entry's dimensions - use them to adjust the iframe size. + if (this.height && this.width) { + this.ltiframe.setStyle('width', this.width + 'px'); + this.ltiframe.setStyle('height', this.height + 'px'); } } }, { - NAME : 'moodle-local_kaltura-lticontainer', - ATTRS : { - bodyclass : { - value : null + NAME: 'moodle-local_kaltura-lticontainer', + ATTRS: { + bodyclass: { + value: null }, - lastheight : { - value : null + lastheight: { + value: null }, padding: { - value : 15 + value: 15 } } }); diff --git a/local/kaltura/yui/src/ltipanel/js/ltipanel.js b/local/kaltura/yui/src/ltipanel/js/ltipanel.js index 1410ed51cf0c2..840e67de47ef5 100644 --- a/local/kaltura/yui/src/ltipanel/js/ltipanel.js +++ b/local/kaltura/yui/src/ltipanel/js/ltipanel.js @@ -54,7 +54,9 @@ Y.extend(LTIPANEL, Y.Base, { */ init : function(params) { // Check to make sure parameters are initialized - if ('0' === params.addvidbtnid || '0' === params.ltilaunchurl || 0 === params.courseid || 0 === params.height || 0 === params.width) { + if ('0' === params.addvidbtnid || '0' === params.ltilaunchurl + || 0 === params.courseid || 0 === params.height || 0 === params.width) { + // jshint undef:false alert('Some parameters were not initialized.'); return; } @@ -77,12 +79,13 @@ Y.extend(LTIPANEL, Y.Base, { var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; - var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; - var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; + width = window.innerWidth || document.documentElement.clientWidth || screen.width; + height = window.innerHeight || document.documentElement.clientHeight || screen.height; var left = ((width / 2) - (w / 2)) + dualScreenLeft; var top = ((height / 2) - (h / 2)) + dualScreenTop; - var bsePopup = window.open(url, M.util.get_string("browse_and_embed", "local_kaltura"), 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); + var bsePopup = window.open(url, M.util.get_string("browse_and_embed", "local_kaltura"), + 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); if (window.focus) { bsePopup.focus(); @@ -164,8 +167,8 @@ Y.extend(LTIPANEL, Y.Base, { /** * This method calls the base class constructor. The primary difference between LTIPANELMEDIAASSIGNMENT and LTIPANEL is that - * LTIPANELMEDIAASSIGNMENT creates a node and appends it to the body tag of the page. The reason for this is due to an issue with the Moodle - * navbar covering up part of the YUI panel, if the panel markup is appended to a child element within the body tag. + * LTIPANELMEDIAASSIGNMENT creates a node and appends it to the body tag of the page. The reason for this is due to an issue with + * the Moodle navbar covering up part of the YUI panel, if the panel markup is appended to a child element within the body tag. * @method LTIPANELMEDIAASSIGNMENT */ var LTIPANELMEDIAASSIGNMENT = function() { @@ -180,7 +183,8 @@ Y.extend(LTIPANELMEDIAASSIGNMENT, Y.Base, { */ init : function(params) { // Check to make sure parameters are initialized - if ('0' === params.addvidbtnid || '0' === params.ltilaunchurl || 0 === params.courseid || 0 === params.height || 0 === params.width) { + if ('0' === params.addvidbtnid || '0' === params.ltilaunchurl + || 0 === params.courseid || 0 === params.height || 0 === params.width) { return; } @@ -199,12 +203,13 @@ Y.extend(LTIPANELMEDIAASSIGNMENT, Y.Base, { var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; - var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; - var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; + width = window.innerWidth || document.documentElement.clientWidth || screen.width; + height = window.innerHeight || document.documentElement.clientHeight || screen.height; var left = ((width / 2) - (w / 2)) + dualScreenLeft; var top = ((height / 2) - (h / 2)) + dualScreenTop; - var bsePopup = window.open(url, M.util.get_string("browse_and_embed", "local_kaltura"), 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); + var bsePopup = window.open(url, M.util.get_string("browse_and_embed", "local_kaltura"), + 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); if (window.focus) { bsePopup.focus(); diff --git a/local/kaltura/yui/src/ltiservice/js/ltiservice.js b/local/kaltura/yui/src/ltiservice/js/ltiservice.js index 94b9ac185d9d3..b4f0de2cc1711 100644 --- a/local/kaltura/yui/src/ltiservice/js/ltiservice.js +++ b/local/kaltura/yui/src/ltiservice/js/ltiservice.js @@ -32,7 +32,8 @@ var LTISERVICE = function() { Y.extend(LTISERVICE, Y.Base, { /** - * Init function for triggering a custom event and setting attributes. Also checks whether optional elements exist in the parent window. + * Init function for triggering a custom event and setting attributes. + * Also checks whether optional elements exist in the parent window. * @property params * @type {Object} */ @@ -72,7 +73,7 @@ Y.extend(LTISERVICE, Y.Base, { // This element must exist. Y.one(documentElement.getElementById('source')).setAttribute('value', decodeURIComponent(params.iframeurl)); - + if (documentElement.getElementById('metadata')) { Y.one(documentElement.getElementById('metadata')).setAttribute('value', params.metadata); } diff --git a/local/kaltura/yui/src/ltitinymcepanel/js/ltitinymcepanel.js b/local/kaltura/yui/src/ltitinymcepanel/js/ltitinymcepanel.js index 91c3a9af2d78f..0ae9349aff628 100644 --- a/local/kaltura/yui/src/ltitinymcepanel/js/ltitinymcepanel.js +++ b/local/kaltura/yui/src/ltitinymcepanel/js/ltitinymcepanel.js @@ -45,7 +45,9 @@ Y.extend(LTITINYMCEPANEL, Y.Base, { */ init : function(params) { // Check to make sure parameters are initialized. - if ('' === params.ltilaunchurl || '' === params.objecttagheight || '' === params.objecttagid || '' === params.previewiframeid) { + if ('' === params.ltilaunchurl || '' === params.objecttagheight + || '' === params.objecttagid || '' === params.previewiframeid) { + // jshint undef:false alert('Some parameters were not initialized.'); return; } @@ -54,7 +56,8 @@ Y.extend(LTITINYMCEPANEL, Y.Base, { this.load_lti_content(params.ltilaunchurl, params.objecttagid, params.objecttagheight); // Listen to simulated click event send from local/kaltura/service.php - Y.one('#closeltipanel').on('click', this.user_selected_video_callback, this, params.objecttagid, params.previewiframeid, params.objecttagheight); + Y.one('#closeltipanel').on('click', this.user_selected_video_callback, this, params.objecttagid, + params.previewiframeid, params.objecttagheight); if (null !== Y.one('#page-footer')) { Y.one('#page-footer').setStyle('display', 'none'); @@ -72,14 +75,17 @@ Y.extend(LTITINYMCEPANEL, Y.Base, { this.contextid = Y.one('#lti_launch_context_id').get('value'); } - var content = ''; + var content = ''; Y.one('#'+iframeid).setContent(content); }, /** * This function serves as a call back method for when the closeltipanel div has been clicked. It means that the user has - * selected a video for embedding into the TinyMCE edotor. Enabling the insert button, removing the contents LTI launch element and - * adding content to the media preview element. + * selected a video for embedding into the TinyMCE edotor. Enabling the insert button, removing the contents LTI launch + * element and adding content to the media preview element. * @property {Object} e Event object. * @property {String} objecttagid Object tag id. * @property {String} previewiframeid Preview iframe tag id. diff --git a/mod/kalvidassign/styles.css b/mod/kalvidassign/styles.css index 63409ce1f10f8..0eb5b4892a421 100644 --- a/mod/kalvidassign/styles.css +++ b/mod/kalvidassign/styles.css @@ -1,5 +1,5 @@ #page-mod-kalvidassign-single_submission #page #page-header .navbar { - display:none; + display: none; } @@ -10,7 +10,7 @@ #page-mod-kalvidassign-view .feedback { border: 1px solid #DDDDDD; - margin:10px auto; + margin: 10px auto; } #page-mod-kalvidassign-view .feedback .grade { @@ -30,7 +30,7 @@ } #slider_border { - width: 10%; + width: 10%; height: 18px; border: 1px solid #000000; overflow: hidden; diff --git a/mod/kalvidres/styles.css b/mod/kalvidres/styles.css index 129e37c40e949..9efeaa54b9767 100644 --- a/mod/kalvidres/styles.css +++ b/mod/kalvidres/styles.css @@ -2,13 +2,14 @@ float: left; } -#id_video_properties, #id_video_preview { +#id_video_properties, +#id_video_preview { float: left; margin-left: 5px; } #slider_border { - width: 100%; + width: 100%; height: 18px; border: 1px solid #000000; overflow: hidden;