edx/edx-platform — pull request #4796 by lduarte1991 (2014-08-12 15:25:25+00:00)
Title: Annotation Tools: Fixing implicit typecasting and reordering plugins

**Background:** During the last set of PRs there was a set of fixes asked by @sarina that required me to change from a system of implicit typecasting set by my predecessor to one of explicit typecasting. A bug was also introduced that removed the tagging feature from the annotation tool. This PR deals with both of those fixes.

**Studio Update:** None

**LMS Update:** In ```catch.js```, I've now explicitly typecasted several items that were strings being treated as integers. This fixes the issues introduced in the last set of PRs which include: 1) the inability for people to edit via the table below, 2) the inability for people to hit the "quote" on text annotations in the table and get scrolled back to the line with the original piece of text, 3) the inability for people to hit the time signature on the video tool table and get scrolled back to the video to the correct time range, 4) the inability for people to hit the thumbnail image on the image annotation tool table and get panned and zoomed to the correct area of the image, 5) the inability for people to delete via the table below, and 6) the inability for people to reply to the annotation via the table below.

The other issue dealt with was in ```ova.js```. It seems like Annotator has a specific way to traverse through plugins and plugins that deal with the body of an annotation *have* to happen before the ones dealing with the auxiliary values, such as tags. Otherwise risking something being overwritten. The changes in #4675 added a new "submit" function that deals with the body of the annotation. Originally, my predecessor had just added plugins in alphabetical order having not known about such an edge case. Moving the HighlightTags plugin to the end has now fixed the issue with our tagging system not working properly.

**Testing:**
1. Load up a course with the annotation tools installed (here's a dandy [tarball](https://www.dropbox.com/s/r684ber7z4ddqtc/2014_T4.DPRfFs.tar.gz)).
2. Create a text annotation, an image annotation, and a video annotation.
3. Under each of the above go to the table below and try to edit and reply.
4. Hit the quoted text in the text annotation table and you should be scrolled to the line with the quoted text (the viewer doesn't pop up unfortunately...it never has, but it's something I want to add later).
5. Hit the time signature in the video annotation table and it should scroll you to the video and it will automatically play and stop given the range of the annotation.
6. Hit the thumbnail in the image annotation table and it should scroll you to the image viewer. It will pan and zoom to the thumbnail location (note that the image tool "saves" where the user was zoomed in and panned when it made the original annotation, i.e. if you make a tiny square when it's all zoomed out clicking on the thumbnail will zoom you out that far).
7. Add a tag to the text annotation. If it's one of the predetermined tags (i.e. there should be a menu that appears as you type) then it should change color (even in Safari). Otherwise it should remain yellow.
8. Try deleting each of the annotations made in step 2 using the table below each of the annotation sources.