cancel
Showing results for 
Search instead for 
Did you mean: 
liuz21
Community Participant

Is that possible to add a "My Media" button on Dashboard or account settings?

My institution has integrated Kaltura in Canvas. Kaltura has two parts: My Media and Media Gallery. My Media is at the account level while Media Gallery is at the course level.

Faculty can enable Kaltura course by course. However, for staff who don't teach any course, we need to create empty courses for them only because they need to use My Media.

Is that possible to add a "My Media" button on Dashboard or account settings or somewhere else that not in a course? Thanks.

20 Replies

For any who may be interested, here is the code that we used to add the link to the flyout menu:

// Add My Media link to user account slide out
$('#global_nav_profile_link').click(function () {
  if ($('.profile-tray .myMediaLink').length === 0) {
    $('.ReactTrayPortal .profile-tray ul').append('<li class="ic-NavMenu-list-item myMediaLink"><a href="https://mydomain.instructure.com/users/' + ENV.current_user_id + '/external_tools/####" class="ic-NavMenu-list-item__link">My Media</a>');
  }
});

You will need to change two pieces in the code above to reuse it. 

  1. Replace mydomain.instructure.com with the domain for your institution.
  2. Replace the #### with the external tool id of the My Media tool for your institution.
liuz21
Community Participant

Thanks Christopher and Kenneth! The result is just what we would like to get! But I am not very familiar with KAF and API codes. I am still not quite sure how did you do it. 

  • Does "Hosted Module" refer to the "Hosted" under "ModulesCustom/corekaf"?
  • 270884_Screen Shot 2018-03-13 at 10.26.00 AM.png
  • If the answer for the question above is yes, did you add a new "It Roles Mapping" in KAF or edit an existed one? 
  • Will this action influence something else in Kaltura?
  • Where to add the code that Kenneth provided?

Thanks very much!

Hello  @liuz21 ‌, here are some answers:

  • That is the correct place to update the roles.
  • For us there was an existing ltiRole set to "none" but if you don't have that you would need to create it. 
  • I'm not sure if it will influence anything else in Kaltura, but we haven't seen any problems. 
  • Lastly, the code that  @kenneth_larsen ‌ provided should go in the JavaScript for your instance of Canvas:
    https://community.canvaslms.com/docs/DOC-10862-4214724282 

Thank you!

Canvas updated some CSS and Javascript this past weekend,  @kenneth_larsen ‌ whipped up some updated code so you can include that link to "My Media" in your slide out tray: 

// Add My Media link to user account slide out
$('#global_nav_profile_link').click(function () {
    setTimeout(function () {
        if ($('._2ULgHK4 .myMediaLink').length === 0) {
            $('._2ULgHK4 ul').append('<li class="ic-NavMenu-list-item myMediaLink"><a href="https://usu.instructure.com/users/' + ENV.current_user_id + '/external_tools/24299" class="ic-NavMenu-list-item__link">My Media</a>');
        }
    }, 300);
});

Canvas moved the "profile-tray" class and seems to have replaced it with a random class, "_2ULgHK4". Hopefully that will last awhile, but no guarantees. Kenneth also indicated that there appears to be a timing issue for that link showing up and for now at least the timeout delay creation in the code seems to be working.

That class changed again. Here is an update to the code that is independent of the class. It will find the list containing the link to user notifications and append it to that list:

// Add My Media link to user account slide out
$('#global_nav_profile_link').click(function () {
    'use strict';
    setTimeout(function () {
        // Find the user navigation link and append to the list it is in
        var $popupPanelList = $('a[href="https://community.canvaslms.com/profile/communication"]').closest('ul');
        if ($popupPanelList.find('.myMediaLink').length === 0) {
            $popupPanelList.append('<li class="ic-NavMenu-list-item myMediaLink"><a href="https://usu.instructure.com/users/' + ENV.current_user_id + '/external_tools/24299" class="ic-NavMenu-list-item__link">My Media</a>');
        }
    }, 300);
});

Hi  @kenneth_larsen ‌. So I'm trying all this, and I don't know what I'm missing right now. When I open up the panel, I see it blip in and out, so I know I'm half way there. Looking at the file, I don't see any other coding effecting that area in the file. Any advice you might give? Is there a step I may have overlooked? Thanks.

For some reason, Canvas rewrites that panel after it opens. We increased the timeout from 300 milliseconds to 500 milliseconds and the appears to have been sufficient to let Canvas rebuild the slideout before inserting the link. I am sure there is a better way to identify that but making that change got it back up and running. 

So, change the 300 on line 10 of the code above to 500. If the flicker continues, you can increase that number.

Thanks  @kenneth_larsen ‌! You're awesome as usual.

jw2546
Community Participant

Is this still working? I just get a "Page Not Found" error.