Instructor and Admin Crosslisting Tool (Updated 7/26/21)

chadscott
Community Contributor
41
10085

Howdy! Well, I guess it's time to share this out with everyone. We are using this script I wrote this school year with our teachers. I taught myself Javascript as well as the Canvas API in order to save everyone the pain and strife of crosslisting.

*Updated 11/19/2021 - I added a filter to only load courses that the user role is "teacher".

*Updated 7/26/2021 - I fixed the maxTerm function - it wasn't evaluating correctly. 

*Updated 7/13/2021* - I fixed the "undefined" error some users were getting. I had to redo the maxTerm function as it had stopped working correctly.

This is a robust script in which the instructor's current term courses are loaded in a dropdown menu to choose the parent course. Then the remaining courses are dynamically created and are selectable to be child courses. Finally, the instructor can rename the parent course and submit to finalize the crosslisting and renaming actions. The instructor can also choose to crosslist without renaming and rename without crosslisting. On the subaccount page, it also adds the ability for admins to search for a user and then perform the same tasks as an instructor as well as decrosslist a course.

 

Instructor and Admin Crosslisting Tools 

 

If you want to test, use TamperMonkey in Chrome or other userscript extension.

 

If you want to deploy to all staff, copy the script into the custom Javascript folder.

 

I welcome those with better programming chops to help me improve the script. If you have any questions about what any part of the script does (my documentation isn't all done yet!) please let me know and I'll be more than happy to help. Otherwise, let me know what you think and what other features you may want to see implemented!

All Courses List

 

Crosslist Courses

 

Crosslist a Course

41 Comments
James
Community Champion

I'm glad you found my scripts useful. Inspiring other people to do great things was one of the goals I had when I started.

You probably figured this out, but the jj_ stuff I used in the IDs was just because that was my initials and I didn't figure Canvas was using them anywhere.

If you name your files with a .user.js extension (instead of just .js), then the user managers will automatically recognize them when you click on the Raw file. That's a trick I figured out after about 3 or 4 scripts.

chadscott
Community Contributor
Author

I did figure that out after awhile, but then it just stuck as homage I suppose. I'll fix the file names as well!

stuart_freeman
Community Explorer

I'd like to turn this into an LTI so it doesn't rely on the structure of the Canvas HTML and injecting javascript. Is there a license for this code? Is it published in public source control somewhere (github)?

dgrobani
Community Champion

 @stuart_freeman ‌, there's a link labeled "Instructor and Admin Crosslisting Tools" in Chad's original post to a JavaScript file within his repository, GitHub - sukotsuchido/CanvasUserScripts: UserScripts for Canvas LMS.

stuart_freeman
Community Explorer

Thanks, I found that and forgot to come back here and update my post.

jeneen_hill
Community Contributor

Help!  This looks like a great tool, but I can't figure out how to use it!  It is in my "Tampermonkey," I just don't know what to do next.

Thanks in advance

James
Community Champion

 @jeneen_hill , you responded to me in a thread about a script I didn't write, so I'm not sure if you mean the Importing Rubrics from a Spreadsheet‌ script, which has a ton of documentation if you follow that link I just gave, or the script on this page. Sometimes the response mechanism in the Community is a little wonky and replies end up going to someone other than who you intended.

jeneen_hill
Community Contributor

I apologize!  

SHEBENE
Community Champion

Did you end up making an LTI for this? We're considering this path.

SHEBENE
Community Champion

If there isn't a feature request for this, I will make one. This is a much more intuitive process. It would need to allow for linking out to more info on what cross-listing is and that your grades don't come with the section when cross-listing. Otherwise, it's a far superior way to go.

stuart_freeman
Community Explorer

We did create an LTI for this (a complete rewrite from scratch). It's one of the tools we'll be talking about at our InstructureCon 2019 talk about using Amazon ECS for rapid LTI development. You can find the source at https://github.com/c21u/canvascrosslist the master branch still relies on some things specific to the way we've set up our sis integration, but I'm in the process of fixing that in the test branch which should get merged in the next week or so.

SHEBENE
Community Champion

Here's what I came up with: https://community.canvaslms.com/ideas/14091-intuitive-cross-listing-tool 

Hopefully this can come to be a core element. In the meantime, we will want to look into making an LTI version of it.

kmeeusen
Community Champion

Our SMS/Canvas integration was developed for  us at the state level, since we all use both tools, and the tool includes the ability to cross-list/decross-list at the admin level quickly and easily.

jbarton
Community Participant

I installed this script and overall it is working well, much easier on the teachers and admins. However, there is a small percentage of teachers that see all their course names as "undefined" when they try to use the tool. Any ideas on that? 

jayavangala1
Community Novice
 
 

Hello, Please let me know how can i use Canvas Crosslisting.user.js. Do I need to install in .js in the canvas admin themes? 

 

chadscott
Community Contributor
Author

Howdy,

I'm bumping this for those subscribed - I've updated the script to fix the "undefined" error some users were getting. The maxTerm function stopped working properly, so I reworked it and updated its references throughout.
@jbarton 

chadscott
Community Contributor
Author

Howdy,

Updated again as the maxTerm function wasn't evaluating correctly. I've updated on gitHub.

patfm
Community Explorer

@chadscott 

Does your crosslisting javascript tool keep the rosters with the sections that come from the SIS?  We will be using Ellucian Banner ILP and want to make sure grades go back to the correct section when the automatic send of grades from Canvas takes place.  If Banner doesn't recognize the Canvas section ID (SIS_ID) that was originally sent by ILP it won't be able to retrieve the grades.  We currently use a 3rd party tool to do this but are not sure it will work with ILP. 

Thanks

chadscott
Community Contributor
Author

@patfm The script mimics the normal crosslisting process. Sections maintain their SIS IDs.

Cheers,

Chad Scott
Katy ISD

patfm
Community Explorer

Thanks!  

Pat

hhiggins8113
Community Explorer

@chadscott 

Hi Chad,

Thanks for sharing this awesome tool! We installed it in our test environment and for some reason, it is only pulling courses from a manually created term that does not have a start or end date. What change can we make so it will grab only the courses created by our SIS? 

Also, at what point would courses from the future term be accessible? We need the instructors to cross-list before the first day of class.

Thanks!

Hannah

chadscott
Community Contributor
Author

@hhiggins8113 The way the tool works is it will pull the most currently available term in a users course list. So if you are testing on yourself and you don't have any courses but manually created, it will only pull those (MCC are default term, which is 1).

As far as access to complete the crosslisting process, as soon as you load in courses for that term, instructors/teachers will be able to complete the crosslisting process. If you load multiple future terms, you'll need to modify the code a bit otherwise they will only see the most future term of the set.

If you have impersonated as an instructor/teacher that does have courses in a term and having this issue, feel free to private message me and I'll see what I can work out.

 

hhiggins8113
Community Explorer

@chadscott  Thanks so much! We might take you up on that! We'll keep testing for now. 😊

MarcusAldridge
Community Explorer

Hey @chadscott ,

 

Im trying to get the instructor and admin crosslisting tool working but we're having a weirdness where if we have a course that covers 2 terms then its the only one showing up when trying to do crosslisting and cant see any others to crosslist. You had commented that we may need to modify the code to rectify this. Where would I need to make this modification?

MattHanes
Community Champion

@MarcusAldridge , I'm not sure if this will help in your particular case, but we wanted only very specific courses to appear in the cross-listing tool list so I made these modifications to explicitly pull only the courses for specific term ids. 

So in the setParent function, I changed this:

if (o.enrollment_term_id == termId)

To this (there is probably a more succinct way to write this in Javascript, but I'm no programmer): 

if (o.enrollment_term_id == 238 || o.enrollment_term_id == 239 || o.enrollment_term_id == 240)

  

And then modified the getChildren() function the same way but leave that parentId part at the end. So this:

if (o.enrollment_term_id == termId && o.id != parentId) 

Becomes this:

if ((o.enrollment_term_id == 238 || o.enrollment_term_id == 239 || o.enrollment_term_id == 240) && o.id != parentId)
MarcusAldridge
Community Explorer

@MattHanes 

Unfortunately it doesn't appear that that worked, I think the issue is because our advisory classes are set in our SIS as being for terms 1 - 2 and everything else is either term 1 or 2 so when I go to use the crosslisting tool it ONLY lists the advisory class which is term 1 - 2

MattHanes
Community Champion

@MarcusAldridge , I was under the impression that only one term could be associated with a course in Canvas. I'm sorry that didn't work for you!

MarcusAldridge
Community Explorer

@MattHanes 

I wonder if that's what's actually happening then, WE see it on our side as Term 1, Term 2, and Term 1 - 2, but canvas is most likely interpreting it as 3 separate terms, not one of those terms overlapping.

chadscott
Community Contributor
Author

Howdy,

@MarcusAldridge the script looks for the highest number term in a user's term list. If your teachers have courses across all 3 terms and you load all 3 at once, you will need to do the following -

--------

If you have multiple terms active at the same time, you will need to change the term filter in a few spots. In my example, I did it for 2 active terms, but you will have 3 I assume (Term 1, Term 2, and Term 1-2) all loaded at once.

chadscott_0-1635164465378.png

 

chadscott_1-1635164465515.png

 

chadscott_2-1635164465513.png

 

Where I have termId-1 in each example, you will want to have termId-2 (for 3 active terms). This will allow for the 3 most recent terms to be active - again assuming you load 3 every semester. If you change (like during the summer), you will need to update this number to reflect that.

The downside to this will be teachers could crosslist those courses together and that may be not what you want.

You could build in another Step, where they pick which term, but that would be tricky as teacher roles don't have access to the TERMS in the API, so getting the Term name, etc. would be hard. You could hard code it, but I don't like having to update every semester, so avoided that.

Cheers,

Chad

MattHanes
Community Champion

@MarcusAldridge , that is the way it works for us. In my example I listed above, the enrollment_term_id = 238 is our term we use for full year courses and the other two are terms we use for courses that are only one semester long. So my if statement is basically checking to see if the term id is the full year, semester 1 only, or semester 2 only. 

MattHanes
Community Champion

@chadscott , updating it each year is definitely a pain! I like your solution better, but we have too many hands in the cookie jar and I can't count on someone not errantly adding more terms without telling me about it. This script has been great for my district, thank you for posting it for us all to use!

MarcusAldridge
Community Explorer

@chadscott 

The changes you recommended worked for the admin side but when the teacher tries to use the tool on their side they still only see advisory, is there something else I need to edit?

chadscott
Community Contributor
Author

@MarcusAldridge 

Make sure you edited in all 3 places. You have to change the comparator as well. Instead of =, gotta change it to >= -2 .

Also, make sure those entire functions matches what you have in your code. I updated that a few times in rapid succession as what I had there prior to July broke.

Cheers,
Chad Scott

MarcusAldridge
Community Explorer

@chadscott 

I have updated it in 4 places actually cause when I just did the 3 you showed then when I did the dropdown in the admin crosslisting it showed all of the courses but then when I selected one then it ONLY showed the advisory one, but I found a 4th location with the 

"o.enrollment_term_id == termId" and updated it so you could pick the course and the one to crosslist it with, and it all works right with it changed in those 4 locations, line 234, 262, 721, and 753.

And all that works great on the admin side and if I try to do it for a user, but when the actual teacher tries then all they see still is that advisory class.

chadscott
Community Contributor
Author

Howdy,

@MarcusAldridge If you can have them capture the dev panel (F12) when trying to crosslist, it will capture any errors. Feel free to send that to me in a PM and we can work through it from there.

Cheers,
Chad Scott 

bcarmona4156
Community Member

Hello Scott,

Thanks so much for sharing this amazing tool you have created. I wanted to ask if there is a way to add a filter so that only Teachers of a course can cross-list it. As I am testing, I find that the tool allows a "student" to cross-list a course, even if they are not the teacher (so long as they are a teacher in at least one course in that same semester, if that makes sense). I hope to hear from you soon!

Kind regards! 

Brenda

chadscott
Community Contributor
Author

@bcarmona4156 Yes, that's doable. I know I had it in at one point awhile ago, but must have taken it out when trying to fix the getTerm issue. We generally don't have teachers as students in courses that are in the current term, so it hasn't come up before.

Anyway - you'll want to add && o.enrollments[0].type == "teacher" to the following functions

setParent()

 

if (o.enrollment_term_id == termId && o.enrollments[0].type == "teacher") {

 


getChildren()

 

if (o.enrollment_term_id == termId && o.enrollments[0].type == "teacher" && o.id != parentId) {

 

 

getCoursesAdmin()

 

if (o.enrollment_term_id == termId && o.enrollments[0].type == "teacher") {

 

 

setParentDecross()

 

if (o.enrollment_term_id == termId && o.enrollments[0].type == "teacher" && o.sections.length > 1) {

 

 

I'll add these changes to Github as well.

Cheers,
Chad Scott

bcarmona4156
Community Member

@chadscott Thanks so much, Chad! This works great

agdeyoe
Community Explorer

Love this tool - but we're experiencing a problem with half year courses where they either don't see courses in the correct term to crosslist, or they see the wrong term and no associated classes.

I had thought it might be because the date of the term had not started, but the date has come and still no luck. Any problems people can report with courses and enrollment term not showing up using this tool?

Our teachers love this and your tool has made it easier for us, so greatly appreciated.

penny_christens
Community Participant

@All, both Chad and Matt have moved on - brilliant guys!
Did anyone implement this for use with only Admins/Not Teachers? I am interested in any thoughts around that approach as well.

Thanks for the group knowledge shared here!

JamesSekcienski
Community Coach
Community Coach

@penny_christens 

We haven't implemented this specific feature, but we don't allow instructors to cross-list on their own.  Thus, a feature like this wouldn't be applicable to our teachers.

Nonetheless, this might be something for us to look into making available to admins to use to support the cross-listing process for special requests.  If we were to add this to our theme to make it available to admins, from a quick check of the code it looks like lines 25-27 would need to be updated.  We wouldn't want teachers to have access and only certain admin roles in our Canvas site after the permission to cross-list, so we wouldn't want it to apply to all admins either.  We would need to test it fully to ensure it works as expected, but I would potentially update lines 25-27 to the following to try to make it only available to Account Admins.

var roles = ENV.current_user_types;
var cxbuttonRoles = ["AccountAdmin"];
var admincxbuttonRoles = ["AccountAdmin"];

 It is also important to note that this code is written with a dependency on jQuery.  Due to recent issues with jQuery upgrades and concerns about the future support for jQuery in Canvas, it is important to understand this may need additional updates in the future to align with changes to jQuery in Canvas and/or may fully stop working.  Instructure is encouraging developers to move away from relying on jQuery being in Canvas for their custom code. Updating jQuery in Canvas