function kaltura_insert_widget in Kaltura 6
Same name and namespace in other branches
- 5 includes/kaltura.themeing.inc \kaltura_insert_widget()
- 6.2 includes/kaltura.themeing.inc \kaltura_insert_widget()
1 string reference to 'kaltura_insert_widget'
File
- includes/
kaltura.themeing.inc, line 479
Code
function kaltura_insert_widget() {
global $_kaltura_thumbnail_base_url;
$args = func_get_args();
$entry_list = $args[0];
$field_name = str_replace('_', '-', $args[1]);
$fix_subject = '';
if ($field_name == 'edit-comment') {
$fix_subject = ' if (window.top.document.getElementById("edit-subject").value == "") ';
$fix_subject .= ' window.top.document.getElementById("edit-subject").value = "video comment";';
$entries = explode(',', rtrim($entry_list, ','));
$entry_list = '';
foreach ($entries as $entry) {
$entry_list .= '[kaltura-widget media_type=\\"video\\" comment=\\"' . $entry . '\\" size=\\"large\\" /]';
}
}
$javascript = '
var bodyTextArea = window.top.document.getElementById("' . $field_name . '");
if (bodyTextArea)
bodyTextArea.value += "' . $entry_list . '";
' . $fix_subject;
$javascript .= $field_name == 'edit-comment' ? 'window.top.document.getElementById("edit-preview").click();' : '';
$javascript .= $field_name != 'edit-comment' ? 'update_field_thumbs(window.top.document.getElementById(\'' . $field_name . '\'), \'' . $_kaltura_thumbnail_base_url . '\');' : '';
$javascript .= '
window.top.kalturaCloseModalBox();
';
$flash_embed = '';
echo theme("kaltura_modal", array(
"javascript" => $javascript,
"flashEmbed" => $flash_embed,
));
exit;
}