Advertisement
Guest User

send to editor code

a guest
Oct 1st, 2011
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.66 KB | None | 0 0
  1. <?php if (!defined("WP_ADMIN")) die();?>
  2.  
  3. <?php if ($viewData["uiConfId"]): ?>
  4.  
  5. <script type="text/javascript">
  6.  
  7. var playerWidth = "<?php echo $viewData["playerWidth"]; ?>";
  8.  
  9. var playerHeight = "<?php echo $viewData["playerHeight"]; ?>";
  10.  
  11. var uiConfId = "<?php echo $viewData["uiConfId"]; ?>";
  12.  
  13. var entryId = "<?php echo $viewData["entryId"]; ?>";
  14.  
  15. var addPermission = "<?php echo $viewData["addPermission"]; ?>";
  16.  
  17. var editPermission = "<?php echo $viewData["editPermission"]; ?>";
  18.  
  19.  
  20.  
  21. var htmlArray = [];
  22.  
  23. htmlArray.push('[');
  24.  
  25. htmlArray.push('kaltura-widget ');
  26.  
  27. htmlArray.push('uiconfid="'+uiConfId+'" ');
  28.  
  29. htmlArray.push('entryid="'+entryId+'" ');
  30.  
  31. htmlArray.push('width="'+playerWidth+'" ');
  32.  
  33. htmlArray.push('height="'+playerHeight+'" ');
  34.  
  35. htmlArray.push('addpermission="'+addPermission+'" ');
  36.  
  37. htmlArray.push('editpermission="'+editPermission+'" ');
  38.  
  39. htmlArray.push('/]');
  40.  
  41. htmlArray.push('\n');
  42.  
  43.  
  44.  
  45.  
  46.  
  47. var html = htmlArray.join('');
  48.  
  49.  
  50.  
  51. // lets make it safe
  52.  
  53. try
  54.  
  55. {
  56.  
  57. var topWindow = Kaltura.getTopWindow();
  58.  
  59.  
  60.  
  61. if (topWindow.tinyMCE && topWindow.tinyMCE.get('content') && !topWindow.tinyMCE.get('content').isHidden())
  62.  
  63. {
  64.  
  65. topWindow.tinyMCE.execCommand('mceInsertRawHTML', false, html);
  66.  
  67. }
  68.  
  69. else
  70.  
  71. {
  72.  
  73. if (topWindow.edInsertContent)
  74.  
  75. {
  76.  
  77. topWindow.edInsertContent(topWindow.document.getElementById('content'), html);
  78.  
  79. }
  80.  
  81. else
  82.  
  83. {
  84.  
  85. var content = topWindow.jQuery('#content');
  86.  
  87. content.val(content.val() + html);
  88.  
  89. }
  90.  
  91. }
  92.  
  93.  
  94.  
  95. <?php if (count($viewData["nextEntryIds"]) > 0): ?>
  96.  
  97. var url = "<?php echo KalturaHelpers::generateTabUrl(array("tab" => "kaltura_upload", "kaction" => "sendtoeditor", "firstedit" => "true", "entryIds" => $viewData["nextEntryIds"])); ?>";
  98.  
  99. window.location.href = url;
  100.  
  101. <?php else: ?>
  102.  
  103. setTimeout('topWindow.tb_remove()', 0);
  104.  
  105. <?php endif; ?>
  106.  
  107. }
  108.  
  109. catch(e)
  110.  
  111. {
  112.  
  113. var displayEditTable = true;
  114.  
  115. }
  116.  
  117. </script>
  118.  
  119. <div id="sendToEditor" class="kalturaTab">
  120.  
  121. <form method="post" class="kalturaForm">
  122.  
  123. <table class="form-table" style="display: none;">
  124.  
  125. <tr>
  126.  
  127. <td>
  128.  
  129. <b>We were unable to insert the player code into the editor. Please copy and paste the code as it appears below.</b>
  130.  
  131. <br />
  132.  
  133. <br />
  134.  
  135. <textarea id="txtCode" rows="3" style="width: 90%" readonly="readonly"></textarea>
  136.  
  137. <br />
  138.  
  139. <br />
  140.  
  141. <center>
  142.  
  143. <input type="button" value="<?php echo attribute_escape( __( 'Close' ) ); ?>" onclick="setTimeout('topWindow.tb_remove()', 0);" name="close" class="button-secondary" />
  144.  
  145. </center>
  146.  
  147. </td>
  148.  
  149. </tr>
  150.  
  151. </table>
  152.  
  153. </form>
  154.  
  155. </div>
  156.  
  157. <script>
  158.  
  159. if (displayEditTable)
  160.  
  161. {
  162.  
  163. jQuery("table").show();
  164.  
  165. jQuery("#txtCode").val(html);
  166.  
  167. }
  168.  
  169. </script>
  170.  
  171. <?php else: ?>
  172.  
  173. <?php
  174.  
  175. $flashVarsStr = KalturaHelpers::flashVarsToString($viewData["flashVars"]);
  176.  
  177. ?>
  178.  
  179.  
  180.  
  181. <div id="sendToEditor" class="kalturaTab">
  182.  
  183. <?php if (@$_GET["firstedit"] != "true"): ?>
  184.  
  185. <div class="backDiv">
  186.  
  187. <a href="<?php echo KalturaHelpers::generateTabUrl(array('tab' => 'kaltura_browse')); ?>"><img src="<?php echo KalturaHelpers::getPluginUrl(); ?>/images/back.gif" alt="Back"/></a>
  188.  
  189. </div>
  190.  
  191. <?php endif; ?>
  192.  
  193. <form method="post" class="kalturaForm" action="<?php echo KalturaHelpers::generateTabUrl(array("tab" => "kaltura_upload", "kaction" => "sendtoeditor", "firstedit" => "true", "entryIds" => $viewData["nextEntryIds"])); ?>">
  194.  
  195. <table class="form-table">
  196.  
  197. <tr>
  198.  
  199. <td valign="top" width="240">
  200.  
  201. <div id="divKalturaPlayer"></div>
  202.  
  203. <script type="text/javascript">
  204.  
  205. function updateRatio() {
  206.  
  207. var ratio = jQuery("input[name=playerRatio]:checked").val();
  208.  
  209. if (ratio == "16:9")
  210.  
  211. {
  212.  
  213. jQuery("#playerWidthLarge").next().text("Large (400x290)");
  214.  
  215. jQuery("#playerWidthMedium").next().text("Small (260x211)");
  216.  
  217. }
  218.  
  219. else
  220.  
  221. {
  222.  
  223. jQuery("#playerWidthLarge").next().text("Large (400x365)");
  224.  
  225. jQuery("#playerWidthMedium").next().text("Small (260x260)");
  226.  
  227. }
  228.  
  229. }
  230.  
  231. </script>
  232.  
  233. </td>
  234.  
  235. <td valign="top">
  236.  
  237. <table class="options">
  238.  
  239. <tr>
  240.  
  241. <td style="padding-bottom:22px;" colspan="2">
  242.  
  243. <?php if ($viewData["isLibrary"])?>
  244.  
  245. <label for="ktitle">Title:</label>
  246.  
  247. <input type="text" name="ktitle" id="ktitle" size="32" value="<?php echo $viewData["entry"]->name; ?>" style="margin-left:6px;" />
  248.  
  249. <span style="color:red; font-size: 20px; font-weight: bold; display: none; line-height: 20px">*</span>
  250.  
  251. </td>
  252.  
  253. </tr>
  254.  
  255. <tr>
  256.  
  257. <td valign="top">
  258.  
  259. <div class="selectBox">
  260.  
  261. <label for="uiConfId">Select player design:</label>
  262.  
  263. <select name="uiConfId" id="uiConfId"></select>
  264.  
  265. <?php if ($selectedPlayerName): ?>
  266.  
  267. <script type="text/javascript">
  268.  
  269. embedPreviewPlayer('<?php echo $selectedPlayerName; ?>');
  270.  
  271. </script>
  272.  
  273. <?php endif; ?>
  274.  
  275. </div>
  276.  
  277. <?php if ($viewData["entry"]->type == KalturaEntryType_MIX): ?>
  278.  
  279. <div class="selectBox">
  280.  
  281. <label for="addPermission">Who can add to video:</label>
  282.  
  283. <select name="addPermission" id="addPermission">
  284.  
  285. <option value="3" <?php echo @get_option("kaltura_permissions_add") == "3" ? "selected=\"selected\"" : ""; ?>>Blog Administrators</option>
  286.  
  287. <option value="2" <?php echo @get_option("kaltura_permissions_add") == "2" ? "selected=\"selected\"" : ""; ?>>Blog Editors/Contributors & Authors</option>
  288.  
  289. <option value="1" <?php echo @get_option("kaltura_permissions_add") == "1" ? "selected=\"selected\"" : ""; ?>>Blog Subscribers</option>
  290.  
  291. <option value="0" <?php echo @get_option("kaltura_permissions_add") == "0" ? "selected=\"selected\"" : ""; ?>>Everybody</option>
  292.  
  293. </select>
  294.  
  295. </div>
  296.  
  297. <div class="selectBox">
  298.  
  299. <label for="editPermission">Who can edit the video:</label>
  300.  
  301. <select name="editPermission" id="editPermission">
  302.  
  303. <option value="3" <?php echo @get_option("kaltura_permissions_edit") == "3" ? "selected=\"selected\"" : ""; ?>>Blog Administrators</option>
  304.  
  305. <option value="2" <?php echo @get_option("kaltura_permissions_edit") == "2" ? "selected=\"selected\"" : ""; ?>>Blog Editors/Contributors & Authors</option>
  306.  
  307. <option value="1" <?php echo @get_option("kaltura_permissions_edit") == "1" ? "selected=\"selected\"" : ""; ?>>Blog Subscribers</option>
  308.  
  309. <option value="0" <?php echo @get_option("kaltura_permissions_edit") == "0" ? "selected=\"selected\"" : ""; ?>>Everybody</option>
  310.  
  311. </select>
  312.  
  313. </div>
  314.  
  315. <?php else: ?>
  316.  
  317. <input type="hidden" name="addPermission" value="-1" />
  318.  
  319. <input type="hidden" name="editPermission" value="-1" />
  320.  
  321. <?php endif; ?>
  322.  
  323. </td>
  324.  
  325. <td valign="top" style="padding-left:25px;">
  326.  
  327. <strong>Player Dimensions:</strong>
  328.  
  329. <div class="playerRatioDiv">
  330.  
  331. <span><input type="radio" class="iradio" name="playerRatio" id="playerRatioNormal" onclick="updateRatio();" value="4:3" checked="checked" /><label for="playerRatioNormal">Normal</label></span>&nbsp;&nbsp;
  332.  
  333. <span><input type="radio" class="iradio" name="playerRatio" id="playerRatioWide" onclick="updateRatio();" value="16:9" <?php echo $wideScreenDisabled; ?>/><label for="playerRatioWide">Widescreen</label></span>
  334.  
  335. </div>
  336.  
  337. <strong>Select player size:</strong>
  338.  
  339. <div class="radioBox">
  340.  
  341. <input type="radio" class="iradio" name="playerWidth" id="playerWidthLarge" value="400" checked="checked" /><label for="playerWidthLarge"></label><br />
  342.  
  343. </div>
  344.  
  345. <div class="radioBox">
  346.  
  347. <input type="radio" class="iradio" name="playerWidth" id="playerWidthMedium" value="260" /><label for="playerWidthMedium"></label>
  348.  
  349. </div>
  350.  
  351. <div class="radioBox">
  352.  
  353. <input type="radio" class="iradio" name="playerWidth" id="playerWidthCustom" value="" /><label for="playerCustomWidth">Custom width</label>
  354.  
  355. <input type="text" name="playerCustomWidth" id="playerCustomWidth" maxlength="3" size="3" />
  356.  
  357. </div>
  358.  
  359. </td>
  360.  
  361. </tr>
  362.  
  363. </table>
  364.  
  365. </td>
  366.  
  367. </tr>
  368.  
  369. </table>
  370.  
  371. <?php if ($viewData["entry"]->type == KalturaEntryType_MIX): ?>
  372.  
  373. <p class="note"><?php _e('Note: If your custom player includes the "Edit" and/or "Upload" actions make sure you allow users to edit this video.'); ?></p>
  374.  
  375. <?php elseif ($viewData["entry"]->type == KalturaEntryType_MEDIA_CLIP): ?>
  376.  
  377. <p class="note"><?php _e('Note: Make sure you do not use a player that includes the "Edit" and/or "Upload" actions, as this video is not editable.'); ?></p>
  378.  
  379. <?php endif; ?>
  380.  
  381. <p class="submit">
  382.  
  383. <input type="submit" value="<?php echo attribute_escape( __( 'Insert into Post' ) ); ?>" name="sendToEditorButton" class="button-secondary" />
  384.  
  385. </p>
  386.  
  387. </form>
  388.  
  389. </div>
  390.  
  391. <script type="text/javascript">
  392.  
  393. updateRatio();
  394.  
  395.  
  396.  
  397. jQuery("#playerCustomWidth").click(function(){
  398.  
  399. jQuery(this).siblings("[type=radio]").attr("checked", "checked");
  400.  
  401. });
  402.  
  403.  
  404.  
  405. jQuery("input[type=submit]").click(function () {
  406.  
  407. jQuery("#ktitle").css("border-color", "").siblings("span").hide();
  408.  
  409. if (jQuery("#ktitle").val().replace(/ /g, "").length == 0) {
  410.  
  411. jQuery("#ktitle").css("border-color", "red").siblings("span").show();
  412.  
  413. return false;
  414.  
  415. }
  416.  
  417. jQuery("#playerWidthCustom").val(jQuery("#playerCustomWidth").val());
  418.  
  419. if (jQuery("#playerWidthCustom").attr("checked"))
  420.  
  421. {
  422.  
  423. customWidth = jQuery("#playerCustomWidth").val();
  424.  
  425. if (!customWidth.match(/^[0-9]+$/))
  426.  
  427. {
  428.  
  429. jQuery("#playerCustomWidth").css("background-color", "red");
  430.  
  431. return false;
  432.  
  433. }
  434.  
  435. }
  436.  
  437. return true;
  438.  
  439. });
  440.  
  441.  
  442.  
  443. jQuery().kalturaPlayerSelector({
  444.  
  445. url: '<?php echo KalturaHelpers::getPluginUrl() ?>/ajax_get_players.php',
  446.  
  447. defaultId: '<?php echo get_option("kaltura_default_player_type"); ?>',
  448.  
  449. swfBaseUrl: '<?php echo KalturaHelpers::getSwfUrlForWidget(); ?>',
  450.  
  451. previewId: 'divKalturaPlayer',
  452.  
  453. entryId: '<?php echo $viewData["entry"]->id; ?>',
  454.  
  455. playersList: '#uiConfId',
  456.  
  457. dimensions: 'input[name=playerRatio]',
  458.  
  459. submit: 'input[name=sendToEditorButton]',
  460.  
  461. onSelect: function() {
  462.  
  463. fixHeight();
  464.  
  465. }
  466.  
  467. });
  468.  
  469.  
  470.  
  471. function fixHeight() {
  472.  
  473. var topWindow = Kaltura.getTopWindow();
  474.  
  475. topWindow.Kaltura.animateModalSize(680,jQuery("#sendToEditor").height() + 70);
  476.  
  477. }
  478.  
  479.  
  480.  
  481. fixHeight();
  482.  
  483. </script>
  484.  
  485. <?php endif; ?>
  486.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement