You are here

function theme_kaltura_contribution_wizard_simple in Kaltura 6.2

1 theme call to theme_kaltura_contribution_wizard_simple()
kaltura_contribution_wizard in includes/kaltura.themeing.inc

File

includes/kaltura.themeing.inc, line 506

Code

function theme_kaltura_contribution_wizard_simple($theme_params, $navigate_back = TRUE) {
  $goto_url = kaltura_cw_destination();
  $javascript = '
    var kshowId = -1;
    var goto_url = "' . $goto_url . '";
    var node_url = "' . ($theme_params->mix_id ? url('node/' . $theme_params->mix_id) . '/edit' : '') . '";
        var flashObj;
        var delegate = {};
        var mediaTypeInput;

        //KSU handlers
        delegate.readyHandler = function()
        {
                flashObj = document.getElementById("kalturaCw");';
  $javascript .= $theme_params->mix_id ? '' : 'flashObj.setMaxUploads(1);';
  $javascript .= '

        }

        delegate.selectHandler = function()
        {
                flashObj.upload();
//              console.log("selectHandler()");
//              console.log(flashObj.getTotalSize());
        }

        function setMediaType()
        {
                var mediaType = document.getElementById("mediaTypeInput").value;
                //alert(mediaType);
//              console.log(mediaType);
                flashObj.setMediaType(mediaType);
        }

        delegate.singleUploadCompleteHandler = function(args)
        {

                flashObj.addEntries();
                console.log("singleUploadCompleteHandler", args[0].title);

        }

        delegate.allUploadsCompleteHandler = function()
        {
                console.log("allUploadsCompleteHandler");
        }

        delegate.entriesAddedHandler = function(entries)
        {
            var entriesStr = (node_url.indexOf("?") == -1) ? "?entries=" : "&entries=" ;
                if (entries && entries.length > 0)
                {
                        for (i=0; i < entries.length; i++)
                        {
                                entryId = (entries[i].uniqueID == null ? entries[i].entryId : entries[i].uniqueID);
                                entriesStr += entryId + ",";
                        }
                }
                node_url = node_url + entriesStr;

                //console.log(entries);
                document.getElementById("filStatus").innerHTML = "Upload Complete!";
                ';
  $javascript .= $theme_params->mix_id ? 'setTimeout("SendTopToNodePage();", 0);' : 'setTimeout("SendTopToEntriesPage();",0);';
  $javascript .= '}

        delegate.progressHandler = function(args)
        {
                document.getElementById("simpleStatus").style.display="inline";
//              document.getElementById("divKalturaCw").style.display="none";
                document.getElementById("btnSimpleUpload").style.display="none";
                document.getElementById("fileName").innerHTML = args[2].title;
                document.getElementById("filSize").innerHTML = Math.round(args[1]/1000) + "KB";
                document.getElementById("filStatus").innerHTML = "Do not leave this page!!";
                document.getElementById("progress").innerHTML = Math.round((args[0]*100 / args[1])*100)/100 + "%";
                console.log(args[2].title + ": " + args[0] + " / " + args[1]);
        }

        delegate.uiConfErrorHandler = function()
        {
                console.log("ui conf loading error");
        }

    function onContributionWizardAfterAddEntry(obj) {
      var entries = (node_url.indexOf("?") == -1) ? "?entries=" : "&entries=" ;
                if (obj && obj.length > 0)
                {
                        for (i=0; i < obj.length; i++)
                        {
                                entryId = (obj[i].uniqueID == null ? obj[i].entryId : obj[i].uniqueID);
                                entries += entryId + ",";
                        }
                }
                node_url = node_url + entries;
//      if (obj && obj.length > 0 && obj[0].kshowId)
//      kshowId = obj[0].kshowId;
    }

    function onContributionWizardClose(modified) {
      if (modified == "0")';
  $javascript .= $theme_params->mix_id ? 'setTimeout("SendTopToNodePage();", 0);' : $navigate_back ? 'setTimeout("window.top.history.back();", 0);' : 'setTimeout("window.top.kalturaCloseModalBox();",0);';
  $javascript .= ' else ';
  $javascript .= $theme_params->mix_id ? 'setTimeout("SendTopToNodePage();", 0);' : 'setTimeout("SendTopToEntriesPage();",0);';
  $javascript .= '}';
  $flash_embed = '

    <div id="divKalturaCw" style="position:absolute; top:130; left:240; z-index:999;"></div>
    <script type="text/javascript">
      var kso = new SWFObject("' . $theme_params->swfUrl . '", "kalturaCw", "' . '200' . '", "' . '30' . '", "9", "#000000");
      kso.addParam("flashVars", "' . $theme_params->flashVarsStr . '");
      kso.addParam("allowScriptAccess", "always");
      kso.addParam("allowFullScreen", "TRUE");
      kso.addParam("allowNetworking", "all");
      kso.addParam("wmode", "transparent");
      kso.write("divKalturaCw");
    </script>
                <div id="userInput" style="height:100px">
                <form>
                        <input type="button" id="btnSimpleUpload" style="position:absolute; top:130; left:240; margin:0;padding:0;" value="Click to upload">
                        <span style="position:absolute; top:230; left:240; margin:0;padding:0;width:200px"><div id="simpleStatus" style="position:absolute; margin-top:20px;margin-bottom:20px;display:none"><span id="fileName">&nbsp;</span><br/><span>Size: </span><span id="filSize">&nbsp;</span><br/><span>Progress: </span><span id="progress">&nbsp;</span><br/><span id="filStatus">&nbsp;</span></div></span>
                </form>
                </div>

  ';
  return theme("kaltura_modal", array(
    "javascript" => $javascript,
    "flashEmbed" => $flash_embed,
  ));
}