fix file reordering

Fixes a regression from the files API

Test Plan:
 * Reorder some files in the files UI
 * It should work
 * Be sad that the files aren't in alphabetical order
 * Be sad that there aren't other filtering options in the files UI

closes #9576

Change-Id: I97f2d6b771e3bf94612c450aced265968bb4a509
Reviewed-on: https://gerrit.instructure.com/12429
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
use dropdowns for birthdate in registration form

change to dropdowns since the datepicker control is not very friendly for
selecting the year

test plan:
1. go to sign up as a student (w/ course code)
2. it should not let you sign up without putting in a birthdate
3. it should save the birthdate correctly
4. go to sign up as a higher-ed student
5. it should not let you sign up without putting in a birthdate, or if you
   are under 13
6. it should save the birthdate correctly

Change-Id: I68fb35afa179ab57aaff22624282f218791b10e0
Reviewed-on: https://gerrit.instructure.com/12437
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
sanitize user content in calendar api, fixes #9479

sanitize by way of api_user_content/convertApiUserContent

also fix these methods so that link content gets passed through. it's
normally replaced via enhanceUserContent, but this makes in consistent
with non-API user content (and makes it available to API users who want
it)

test plan:
1. create a course calendar event
2. add a media comment to the description
3. it should render/play correctly when you view the event detail
   in the calendar
4. the api JSON should have a <video /> tag rather than a
   <a class="instructure_inline_media_comment" /> tag

Change-Id: Icfd9e9a41145fb7c6ed0faf36b9706899da84bcc
Reviewed-on: https://gerrit.instructure.com/12389
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
user_profile_links table and model

The new profile page has a section for users to add links to anything
they want.  Nothing to test in this commit.

Change-Id: Ia25c6df89d29a2df498ee9c9b75af7e56e782450
Reviewed-on: https://gerrit.instructure.com/12335
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
add collaborations to group nav; fixes #5475

collaborations were set up to work with groups, but not to be shown in the
group sidebar, this closes that loop so that they can be fully used.

test plan:
- enable a collaboration plugin, eg google docs
- collaborations should show up in the left sidebar for groups
- you should be able to use collaborations in a group just like with a course

Change-Id: I31cf134151fc7e68b9aa7688ed02e37f09a6161b
Reviewed-on: https://gerrit.instructure.com/12372
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Add moodle 1.9 migration plugin

This plugin allows canvas to import course backups from
moodle 1.9. The backup file is first converted to a
canvas-flavored common cartridge file then imported

Test Plan:
 * Import some moodle backup files
 * The should look awesome

Change-Id: Ibc9478bbd9bbf91ac2a6c9fa1c2ce1ce6a3cdda7
Reviewed-on: https://gerrit.instructure.com/12411
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
restore sidebar link styles, fixes #9570

test plan:
1. go to the dashboard
2. you should see checkbox/calendar/etc. icons next to any "To Do" or
   "Coming Up" items

Change-Id: Id6ecc40ffb108a741a54f6cba24c12ec2c4fc27c
Reviewed-on: https://gerrit.instructure.com/12445
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
fix another case of infinite root_attachment_id in course copying

A bug in the spec (b was never saved) was hiding another case where an
root_attachment_id loop could be created.

fixes #9252

test plan: Set up a course A with at least one file. Clone course A to
make course B. Then copy course B back into course A. Also try copying a
course into itself. None of these actions should cause loading
/courses/A/files or /courses/B/files to break. You can also check the db
directly to verify that root_attachment_id doesn't equal id for any of
the rows.

Change-Id: I114bc888067bf0308cc9c8a6a926438734f1e06f
Reviewed-on: https://gerrit.instructure.com/12450
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Rewrite of the Notification Preferences page. Closes #8066, Closes #9400

Implementing the re-designed Notification Preferences page.

Testing plan:
=========
* Verify that expected preferences can be set.
* Verify that it supports accessibility (screen readers) for blind users
* Verify that mobile users (iPad at least) can smoothly interact.

Change-Id: I2b98f2477932d800d2ec3de580e47a95f827616b
Reviewed-on: https://gerrit.instructure.com/12356
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
fix sis import error styles, fixes #9517

test plan:
1. go to the sis imports page
2. do an import that generates an error (e.g. don't select a file for
   upload)
3. confirm that the error box has the ui-state-error styles and the text
   is legible (white on red)

Change-Id: I76e4a450cec9d463e2b890cde9251e7edccad048
Reviewed-on: https://gerrit.instructure.com/12447
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
don't leak student names on anonymous surveys

fixes #9559

The quiz statistics page was attaching the submitter's name to essay
question responses for graded quizzes.

Test plan:
  * make a graded survey quiz with an essay question
  * submit the quiz as a user
  * go to the the quiz statistics page as the teacher
  * clicking on the student's essay answer should not reveal their
    username

Change-Id: I6f08ce3132479fb86495165f8eff4cecd3cc6ab9
Reviewed-on: https://gerrit.instructure.com/12462
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
fix performance of file notification query; closes #9012

the index condition and the query condition didn't quite line up,
forcing it to do table scans

test plan:
 * notifications should work
 * delayed job query that finds files to notify for should not
   do a full table scan

Change-Id: I86930ef6b4ec450bdd325bb96651fc0f88967836
Reviewed-on: https://gerrit.instructure.com/12451
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
fix undated event drag in calendar2. fixes #9580

test plan:
  * visit calendar2 page;
  * drag an undated event to a day on the calendar;
  * verify that it correctly displays on the day.

Change-Id: I463a157c343b3615cc816fc7e285a448aa44435b
Reviewed-on: https://gerrit.instructure.com/12422
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
fix sis batch creation race condition

fixes #9610

test plan: since this is a race condition manual testing is difficult,
when uploading a lot of large sis batches none should fail to process
because of a nil attachment (and stickiness/batch mode settings should
always apply).

Change-Id: Iee9d1f48d8f9ab147409361ac19ccbca9df4fe97
Reviewed-on: https://gerrit.instructure.com/12478
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
expand error box to contain text, fixes #9607

ensure error (or success) flash notice contents do not overflow

test plan:
1. trigger an action that causes an alert with a lot of text (or in the
   js console do something like $.flashError('long message here...') )
2. ensure that the text doesn't overflow the box

Change-Id: I6e241086b7ce860ff5ce5eb6f66a808327c73078
Reviewed-on: https://gerrit.instructure.com/12483
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
default database.yml.example to postgres

Change-Id: I052ec7e00da170ade4e3b6ea281072bc3972560f
Reviewed-on: https://gerrit.instructure.com/12482
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
updated user_profile API endpoints

Adds 'title' and 'bio' information to the profile api endpoint.  Also
optionally includes user_service and user_profile_link information.

Also includes a new update_profile API endpoint for updating profile
information (short_name, bio, title) , user_profile_links, and
user_service visibility.

The update_profile endpoint should replace the ProfileController#update
action as soon as we move that (when the User settings page is re-done).

Test plan:
  * make API calls to update/query the profile information OR
    wait for the new profile page which will exercise the new
    {user_profile,user_service,user_profile_link}_json methods

Change-Id: Ia4d902bf190ca51085216b71c5c9215d0dbf2f98
Reviewed-on: https://gerrit.instructure.com/12323
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
put name back on 'add course users' boxes

fixes #9601

Test plan:
* fill out the 'Add Course Users' section in course settings.
* try to add existing users and new users.
* make sure everything looks OK.

Change-Id: I688d3a583fda663c737e78dfa33973e1b3a7497d
Reviewed-on: https://gerrit.instructure.com/12471
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
spec: fix intermittent scheduler failure

Change-Id: I393b34ffb70c35ab9cb05acb3e8452ff120ee1b1
Reviewed-on: https://gerrit.instructure.com/12485
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
correctly find quiz file references in webct data

This fixes two cases that were missed before. Sometimes the
webct relative resource id starts with a '/' and sometimes
not, this accounts for that.

Also, finding a file by a relative path was trying to find it
by the URI escaped version instead of the unescaped one. And
sometimes webct data has differently-cased file paths in the
QTI, so this tries finding files in all lower case.

Test Plan:
 * Import a webct course that has files in quizzes
 * All the images should import correctly into canvas. (meaning the url should be like /courses/:id/files/:id/preview)

closes #9520

Change-Id: I110c7f1968ae5a050fbd6b4e21332e8168481a15
Reviewed-on: https://gerrit.instructure.com/12474
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>