- // detect edit mode
- var arTmp=document.getElementsByTagName("body");
- var theBody=arTmp[0];
- var editMode=theBody.className.search(/editing/gi);
- var middleColumn=document.getElementById("middle-column");
- var hideCourses=/nothing/g;
- var myCoursesBlock=document.getElementById("CoursesBlock"); // that's a div element in an HTML block in the right column
- var courseObjs=middleColumn.getElementsByTagName("div");
- for (i=0;i<courseobjs.length;i++)>
- if (courseObjs[i].className.search("coursebox")!=-1){
- if (courseObjs[i].innerHTML.search(hideCourses)!=-1 && editMode==-1) {
- //do nothing
- //do nothing
- } else {
- myCoursesBlock.innerHTML+='<div class="coursebox courseboxcontent" valign="top">'+courseObjs[i].innerHTML+'</div>';
- myCoursesBlock.innerHTML+='<div class="coursebox courseboxcontent" valign="top">'+courseObjs[i].innerHTML+'</div>';
- }
- if (courseObjs[i].innerHTML.search(hideCourses)!=-1 && editMode==-1) {
- }
- if (courseObjs[i].className.search("coursebox")!=-1){
- }
I use the following javascript for moving the list of courses from the main (middle) column to an HTML block in the right column. If there are courses I don't want to see I add their names to the hideCourses regular expression and they are not added to myCoursesBlock when in normal (not edit) mode (which means that if I want to see the whole list I simply change to edit mode). In the code below I just copy whatever is there but it can be easily modified to add to the list of courses only the course name with the link to the site and omit all the rest (I had to do that in our previous Moodle when the list of courses got bigger and bigger and there were all these assignments) And just in case you wonder why I move the list to the side, it is because I put in the middle an iframe with my own website and so I have an integrated working environment. Hope that helps. 