at-tools / moodle-block_massaction

The Mass Action block for Moodle 2
6 stars 12 forks source link

Adds support for single section view and non consecutive sections #9

Closed Syxton closed 8 years ago

Syxton commented 8 years ago

The version number needs to be bumped if this pull is accepted so that the upgrade process will clear the cached javascript.

cdsmith-umn commented 8 years ago

@Syxton Sorry for the delay in paying attention to this and attempting to merge it in. I just wanted to check that this is supposed to do what I think it is supposed to do and that is to get the Mass Actions block working with the OneTopic format. Is this correct?

Syxton commented 8 years ago

@cdsmith-umn Sorry, I actually misunderstood the bug issue. This is a fix to better work with single section view and to work on sections that my not be in order. The second situation happens for instance when section 2 is empty and section 3 has content and you set the course sections to 1. Then section 1 will show, section 2 will be gone, and section 3 will be an "orphaned" section. This fix allows you to move content to that orphaned section even though there is a missing section in-between section 1 and the orphan.

I will take a look at the OneTopic format and see what it looks like there. sorry

cdsmith-umn commented 8 years ago

@Syxton Thanks for the clarification. OneTopic is its own nightmare. From what I've been able to figure out, OneTopic format prevents the content from being written to tabs other than the default-selected tab on page load. That content's html is only written to the screen when you click on its tab.

Mass Actions can only add checkboxes and any other controls for content which html is present for on page load. From what I can see, I think the solution would be to have a JS function that performs the same function as the init function and add an onclick event to each of the tabs so that the JS function is called any time a tab is clicked. The other possibility would be to have clicking a tab cause a page reload, but this would increase the demand on the server since it would have to reload all the resources on the page.

cdsmith-umn commented 8 years ago

@Syxton It doesn't seem we have the Single Section format installed in our Moodle instances. Where can I get a copy of this format to install in my developer instance? I have Single Activity format, but this is apparently quite different from Single Section. Thanks!

Syxton commented 8 years ago

The core course formats. Look for Course Layout: one section per page

cdsmith-umn commented 8 years ago

Hmmm. I'm having trouble getting the course set up correctly to test the changes. I've got a course in Topics format, with "Course layout" set to "Show one section per page" and "Hidden sections" set to "Hidden sections are completely invisible". I've also tried "Weekly format", "OneTopic format", and "Flexible sections format". What is it that I am missing?

Syxton commented 8 years ago

here are the two tests.

  1. Go to weekly or topics format, setting course layout to 1 section per page. Click on the 1st week/topic to show only that week/topic. Check the drop down lists of the mass action block. Now go to the 2nd week/topic. Check the drop down lists of the mass action block.
  2. Go to weekly or topics format, setting course layout to all sections on a page. In a course with 10 sections, add content to the 10th section and make sure the 9th section is empty. Check the drop down lists. Then go to Course settings and set the section count to 8. Check the drop down lists.
Syxton commented 8 years ago

@cdsmith-umn if you do these tests on unpatched vs patched you should see the issue.

cdsmith-umn commented 8 years ago

@Syxton I see that unpatched only lets you select from or move/duplicate to the General section, while patched lets you select from or move/duplicate to the General section and the section you are currently on/in/have active. This seems sub-optimal to me, still, but I think the problem here is the same as the problem with OneTopic: the content in other sections is technically not in the HTML DOM and so cannot be interacted with by Mass Actions.

Syxton commented 8 years ago

@cdsmith-umn I agree, it would be great if we could select and move content whether they are in the dom or not. This patch just makes the selection work the way it should (assuming current limitations of searching only the DOM)

cdsmith-umn commented 8 years ago

@Syxton This has been added and credit given to you in README.txt for this change. Thank you for the bugfix!