You are here

function theme_contribution_wizard_field in Kaltura 6

Same name and namespace in other branches
  1. 5 includes/kaltura.themeing.inc \theme_contribution_wizard_field()

File

includes/kaltura.themeing.inc, line 320

Code

function theme_contribution_wizard_field($theme_params, $field_id, $no_collect_entries, $kshow_id, $add_filter = 1) {
  $goto_url = kaltura_cw_destination();
  $javascript = '
    var entry_list = ' . ($no_collect_entries === TRUE ? '"' . $kshow_id . '"' : '-1') . ';
    var goto_url = "' . $goto_url . '";
    var node_url = "' . ($theme_params->mix_id ? url("node/" . $theme_params->mix_id) : '') . '";
    function onContributionWizardAfterAddEntry(obj) {
      str = "";
      for(i=0;i<obj.length;i++) {
        str += obj[i]["entryId"] + ",";
      }
      ' . ($no_collect_entries === TRUE ? '' : 'if (entry_list == "-1") entry_list = str; else entry_list += str;') . '
    }

    function onContributionWizardClose(modified) {
      if (modified == "0")
        setTimeout("window.top.kalturaCloseModalBox();", 0);
      else
        window.location.href = "' . url("kaltura/insert_widget/") . '" + entry_list + "/' . $field_id . '";
    }
  ';
  $add_existing = '';
  $js = '';
  if ($field_id != 'edit-comment') {
    $js = '$(document).ready(function() { window.top.document.getElementById("kaltura_modal_iframe").className = ""; ';
    $js .= PHP_EOL . 'window.top.document.getElementById("kaltura_modal_iframe").scrolling = "no"; });';
    $js .= PHP_EOL . 'window.top.document.getElementById("modalbox").style.height = "380px";';
    $js .= PHP_EOL . 'window.top.document.getElementById("kaltura_modal_iframe").height = "380";';
    $add_existing = '<div id="media-upload-header">
          <ul id="sidemenu">
          <li id="tab-kaltura"><a class="current" href="' . url($_GET['q']) . '">Add Interactive Video</a></li>
          <li id="tab-kaltura_browse"><a href="' . url('kaltura/entries/allow-insert/' . $field_id, array(
      'query' => array(
        'filter' => $add_filter,
        'cwurl' => url($_GET['q']),
      ),
    )) . '">Browse Interactive Videos</a></li>
          <li><a href="#" onclick="window.top.kalturaCloseModalBox();return false;">Close</a></li>
          </ul>
      </div>';
  }
  $flash_embed = '<div id="divKalturaCw"></div>
    <script type="text/javascript">
      var kso = new SWFObject("' . $theme_params->swfUrl . '", "kalturaCw", "' . $theme_params->width . '", "' . $theme_params->height . '", "9", "#000000");
      kso.addParam("flashVars", "' . $theme_params->flashVarsStr . '");
      kso.addParam("allowScriptAccess", "always");
      kso.addParam("allowFullScreen", "TRUE");
      kso.addParam("allowNetworking", "all");
      kso.write("divKalturaCw");
    </script>
  ';
  return theme("kaltura_modal", array(
    "javascript" => $javascript . $js,
    "flashEmbed" => $add_existing . $flash_embed,
  ));
}