Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
muli committed Jul 10, 2016
2 parents dd41628 + 7fd02dc commit e61e374
Show file tree
Hide file tree
Showing 50 changed files with 869 additions and 1,305 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "kaltura/moodle_plugin"
}
2 changes: 1 addition & 1 deletion filter/kaltura/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function filter($text, array $options = array()) {
$uri = str_replace(array('http://', 'https://', '.', '/'), array('https?://', 'https?://', '\.', '\/'), $uri);

$search = '/<a\s[^>]*href="(https?:\/\/'.KALTURA_URI_TOKEN.')\/browseandembed\/index\/media\/entryid\/([\d]+_([a-z0-9]+))\/showDescription\/(true|false)\/showTitle\/(true|false)\/';
$search .= 'showTags\/(true|false)\/showDuration\/(true|false)\/showOwner\/(true|false)\/showUploadDate\/(true|false)\/playerSize\/([0-9]+)x([0-9]+)\/playerSkin\/([0-9]+)\/"[^>]*>([^>]*)<\/a>/is';
$search .= 'showTags\/(true|false)\/showDuration\/(true|false)\/showOwner\/(true|false)\/showUploadDate\/(true|false)\/(?:embedType\/oldEmbed\/)?playerSize\/([0-9]+)x([0-9]+)\/playerSkin\/([0-9]+)\/"[^>]*>([^>]*)<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_kaltura_callback', $newtext);

if (empty($newtext) || $newtext === $text) {
Expand Down
6 changes: 3 additions & 3 deletions filter/kaltura/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
*/
defined('MOODLE_INTERNAL') || die();

$plugin->version = 2016040529;
$plugin->release = 'Kaltura release 4.0.08';
$plugin->version = 2016070729;
$plugin->release = 'Kaltura release 4.0.10';
$plugin->requires = 2014050800;
$plugin->maturity = MATURITY_STABLE;
$plugin->dependencies = array(
'local_kaltura' => 2016040529
'local_kaltura' => 2016070729
);
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@
$string['pluginname'] = 'Kaltura Media';
$string['popuptitle'] = 'Select Media';
$string['embedbuttontext'] = 'Embed';
$string['browse_and_embed'] = 'Browse and Embed';
4 changes: 1 addition & 3 deletions lib/editor/atto/plugins/kalturamedia/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
function atto_kalturamedia_strings_for_js() {
global $PAGE;

$PAGE->requires->strings_for_js(array('popuptitle',
'embedbuttontext',),
'atto_kalturamedia');
$PAGE->requires->strings_for_js(array('popuptitle', 'embedbuttontext', 'browse_and_embed'), 'atto_kalturamedia');
}

function atto_kalturamedia_params_for_js($elementid, $options, $fpoptions) {
Expand Down
40 changes: 40 additions & 0 deletions lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
require_once(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))).'/config.php');
require_login();
global $PAGE;
$PAGE->set_context(context_system::instance());
$PAGE->set_pagelayout('embedded');
echo $OUTPUT->header();
$requestQueryString = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : "";

?>

<iframe id="kafIframe" src="ltibrowse.php?<?php echo $requestQueryString; ?>" width="100%" height="600" style="border: 0;" allowfullscreen>
</iframe>
<div id="kalturaMediaSubmitButton"></div>
<script>
var buttonJs = window.opener.buttonJs;
var embedButton = Y.Node.create('<button></button>');
embedButton.setAttribute('id', 'KalturaMediaSubmit');
embedButton.setAttribute('disabled', 'disabled');
embedButton.setHTML("<?php echo get_string('embedbuttontext', 'atto_kalturamedia'); ?>");
embedButton.hide();
Y.one("#kalturaMediaSubmitButton").append(embedButton);
function kaltura_atto_embed_callback(data)
{
var button = Y.one('#KalturaMediaSubmit');
for(param in data)
{
var attributeName = 'data-embedinfo-'+param;
button.setAttribute(attributeName, data[param]);
}
button.removeAttribute('disabled');
button.show();

embedButton.on('click', buttonJs.embedItem, buttonJs, button._getDataAttributes());
}

function getEmbedInfo(data) {
return embedInfo;
}
</script>
6 changes: 3 additions & 3 deletions lib/editor/atto/plugins/kalturamedia/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

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

$plugin->version = 2016040529; // The current plugin version (Date: YYYYMMDDXX).
$plugin->release = 'Kaltura release 4.0.08';
$plugin->version = 2016070729; // The current plugin version (Date: YYYYMMDDXX).
$plugin->release = 'Kaltura release 4.0.10';
$plugin->requires = 2014050800; // Requires this Moodle version.
$plugin->component = 'atto_kalturamedia'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = array(
'local_kaltura' => 2016040529
'local_kaltura' => 2016070729
);
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ var COMPONENTNAME = 'atto_kalturamedia',

Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
_currentSelection: null,
embedWindow: null,

initializer: function() {
this.addButton({
Expand All @@ -53,43 +54,31 @@ Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_a
callback: this._kalturamedia
});
},
_kalturamedia: function(){
_kalturamedia: function() {
this._currentSelection = this.get('host').getSelection();
if (this._currentSelection === false) {
return;
}

var dialogue = this.getDialogue({
headerContent: M.util.get_string('popuptitle', COMPONENTNAME),
focusAfterHide: true,
width: '1112px',
focusOnShowSelector: SELECTORS.URLINPUT
});

var iframe = Y.Node.create('<iframe></iframe>');
// We set the height here because otherwise it is really small. That might not look
// very nice on mobile devices, but we considered that enough for now.
iframe.setStyles({
height: '600px',
border: 'none',
width: '100%'
});

var embedButton = Y.Node.create('<button></button>');
embedButton.setAttribute('id', 'KalturaMediaSubmit');
embedButton.setAttribute('disabled', 'disabled');
embedButton.setHTML(M.util.get_string('embedbuttontext', COMPONENTNAME));
embedButton.hide();
embedButton.on('click', this.embedItem, this);

iframe.setAttribute('src', this._getIframeURL());

var containter = Y.Node.create('<div></div>');
containter.append(iframe);
containter.append(embedButton);
// Set the dialogue content, and then show the dialogue.
dialogue.set('bodyContent', containter)
.show();

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() {
Expand All @@ -101,7 +90,7 @@ Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_a
width: '1112px'
},
this.get('area'));
return M.cfg.wwwroot + '/lib/editor/atto/plugins/kalturamedia/ltibrowse.php?' +
return M.cfg.wwwroot + '/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php?' +
Y.QueryString.stringify(args);
},

Expand Down Expand Up @@ -131,12 +120,7 @@ Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_a
return fullUrl.replace(/^https?:\/\//,'');
},

embedItem: function(what) {
var dialogue = this.getDialogue({
focusAfterHide: null
});

data = Y.one('#KalturaMediaSubmit')._getDataAttributes();
embedItem: function(what, data) {
embedInfo = {};
for(param in data)
{
Expand All @@ -146,7 +130,7 @@ Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_a
embedInfo[isEmbedInfo[1]] = data[param];
}
}

var token = this.get('kalturauritoken');
var kafUri = this.get('kafuri');
var sourceUrl = embedInfo.url;
Expand All @@ -161,7 +145,7 @@ Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_a
host.setSelection(this._currentSelection);
host.insertContentAtFocusPoint(content);
this.markUpdated();
dialogue.set('bodyContent', "").hide();
this.embedWindow.close();
}

} , {
Expand Down Expand Up @@ -195,14 +179,4 @@ Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_a

}, '@VERSION@', {"requires": ["moodle-editor_atto-plugin"]});

function kaltura_atto_embed_callback(data)
{
var button = Y.one('#KalturaMediaSubmit');
for(param in data)
{
var attributeName = 'data-embedinfo-'+param;
button.setAttribute(attributeName, data[param]);
}
button.removeAttribute('disabled');
button.show();
}

Loading

0 comments on commit e61e374

Please sign in to comment.