Bulk CRUD operations (Building Block)

After moving to a hosted package some years ago we lost direct access to the Blackboard database, when asked to update / create or remove content in bulk I found reference in our Wiki to SQL scripts which was no longer useful. There were several building blocks written by our team to update or remove specific items but nothing generic.

I created a building block that would allow an admin of the VLE to add, update or remove content items (items or folders) in bulk, also it is possible to add or update table of content items (main menu items). This allows our content admins the ability to add a new content items to all modules or organisations at once.

The tool is most useful after the module roll over period, if one item is missed from the template or a menu item needs to be moved etc.

Main Menu

Here you can see all of the features of the building block.

Tool to display a course TOC and all contents

The first feature I added was the ability to display the full TOC and contents of a course, this was useful in testing the recursive search feature and also checking the positions of content.

Updating the positions of content is not a simple task as updating one item to be position 5 for example will not update any of the other items in that TOC, so I had to loop through all of the relevant content items and re-position and save each individually.

Find & Replace

This is the update content form, you first fill out the details of the courses you are looking for, this can be limited by ID or year. Our modules exist with the ID format CODE_YEAR_VERSION, searching by year will just look for that as part of the ID, it is also possible to pass an array of IDs to process.

Next you select the type of content, the folder it exists within and its title. The search is recursive, when a TOC item is searched any folders that are found are also searched, this continues for all folders within the TOC no matter how many folders deep.

The title, content, availability or position can be updated, empty values are ignored so it is possible to update 1 or all values. Before processing you select a batch size, as this can be a timely process I found it better to loop through a certain number or courses then check the output before submitting and processing the next batch. All courses found are output and details of the item being found and updated are shown.

ConclusionsThis tool has been useful for dealing with requests for changes after the module roll over period (when the default templates are determined). This is not a tool that is used frequently but saves creating one off tools for specific updates.

I found it odd that updating positions of content items using the API does not affect other items in the same TOC or folder, this added a lot of extra API calls to the tool.

The tool would need a lot of tweaking and interface changes to be user friendly to others, it was easy to develop though and was a great way to learn the features of the API relevant to content.