Posted By

mattabc on 03/05/09


Tagged

media kickapps KickDeveloper


Versions (?)

Give admins download links for original media


 / Published in: JavaScript
 

When logged in with the Affiliate admin account, the media play page will have a link to download the original media. The link is is displayed at the bottom of the media description, just above the admin tags field.

Thanks to KickApps for their assistance with this code.

Updated for changes to KickApps page code

  1. if (Ka.Info.PAGE == 'pages/mediaPlayPage.jsp' &&
  2. (DWRUtil.getValue('userRole') == 'WEBMASTER' || DWRUtil.getValue('userRole') == 'EDITOR')) {
  3. if (Ka.Info.MEDIATYPE == 'VIDEO') {
  4. var links = '<br><a href="'
  5. + Ka.Info.PATHTOMEDIA
  6. + '">mp4 format (transcoded)</a><br>';
  7. // KickApps renames the media extension to lower case extension, but Ka.Info retains the case of the original upload
  8. // So we must convert to lower to correct it here
  9. links += '<a href="'
  10. + Ka.Info.STATICSERVER
  11. + '/kickapps/images/videos/'
  12. + Ka.Info.MEDIAID
  13. + Ka.Info.ORIGVIDEOFORMAT.toLowerCase()
  14. + '">Original upload</a><br>';
  15. } else if (Ka.Info.MEDIATYPE == 'AUDIO') {
  16. var links = '<br><a href="'
  17. + Ka.Info.AUDIOPHOTOSERVERPATH
  18. + Ka.Info.PATHTOMEDIA
  19. + '">mp3 format</a><br>';
  20. }
  21. document.getElementById("ka_playPageDetails").innerHTML = document.getElementById("ka_playPageDetails").innerHTML + links;
  22. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: NeilShaw on March 24, 2009

Can't get this to work.

Here is the code as pasted into my global page template

if (Ka.Info.PAGE == 'pages/mediaPlayPage.jsp' && (DWRUtil.getValue('userRole') == 'WEBMASTER' || DWRUtil.getValue('userRole') == 'EDITOR')) { if (Ka.Info.MEDIATYPE == 'VIDEO') { var links = 'mp3 format'; document.getElementById("kaplayPageDetails").innerHTML = document.getElementById("kaplayPageDetails").innerHTML + links; }}

But at the front end it comes back unable to find userRole

Posted By: krunkosaurus on May 14, 2009

An updated version:

//Add a link to download original video for editors or admins if (Ka.Info.PAGE === "pages/mediaPlayPage.jsp" && (Ka.Info.USERROLE === 'WEBMASTER' || Ka.Info.USERROLE == 'EDITOR')) { var $links = $j('<strong style="color: green;">Download Options</strong><br /><a href="http://media2.kickapps.com/videos/'>FLV format</a><br /><a href="http://static.kickapps.com/kickapps/images/videos/' + Ka.Info.MEDIAID + Ka.Info.ORIGVIDEOFORMAT + '">Original upload</a><br />'); $links.appendTo('#ka_adminControlWrap'); }

Posted By: krunkosaurus on May 14, 2009

That got really messed up. :(

You need to login to post a comment.