Fix inability to upload files without Flash

When Flash is unavailable, the fallback Add File link is not clickable,
because the invisible div#swfupload_holder is blocking it. Hide to fix.

Test plan:
* Use a browser with no Flash installed (or Flash disabled)
* Go to the Files page in any course
* Click on the Add File link
* Confirm that the basic HTML file uploader appears below
Merge pull request #366 from sfu/fix-noflash_upload

Fix inability to upload files without Flash
Revert "temporarily raise default_per_page on list courses"

This reverts commit 7dd4e4855dd37b05b86164ae0b01d5e0e36175fe.

Change-Id: I6a44be89838f539b032a18c239ee0d01b89874ac
Reviewed-on: https://gerrit.instructure.com/31210
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
conversations: remove broken "discussion replies" link

fixes CNVS-11987

test plan:
  * open old conversations
  * open the view dropdown
  * verify that it does not include the "discussion replies" link

Change-Id: Iaeeaa94a62a978a4d30af251c06b51d7855ed246
Reviewed-on: https://gerrit.instructure.com/32278
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
add serializable hash of CustomData for User models

fixes CNVS-11424

test plan:
- rake db:migrate
- if you don't already have one, set yourself up with a developer token.
  (you can do so from <canvas>/developer_keys)

- $ curl -H "Authorization: Bearer <ACCESS-TOKEN>" \
         -X GET -F 'ns=test' \
         <canvas>/api/v1/users/self/custom_data
  #=> {"message":"no data for scope"}

- $ curl -H "Authorization: Bearer <ACCESS-TOKEN>" \
         -X PUT -F 'ns=test' \
         -F 'data[apple]=so tasty' \
         -F 'data[kiwi]=a bit sour' \
         <canvas>/api/v1/users/self/custom_data/fruit
  #=> {"data":{"apple":"so tasty","kiwi":"a bit sour"}}

- $ curl -H "Authorization: Bearer <ACCESS-TOKEN>" \
         -X GET -F 'ns=test' \
         <canvas>/api/v1/users/self/custom_data
  #=> {"data":{"fruit":{"apple":"so tasty","kiwi":"a bit sour"}}}

- $ curl -H "Authorization: Bearer <ACCESS-TOKEN>" \
         -X DELETE -F 'ns=test' \
         <canvas>/api/v1/users/self/custom_data/fruit/kiwi
  #=> {"data":"a bit sour"}

- $ curl -H "Authorization: Bearer <ACCESS-TOKEN>" \
         -X GET -F 'ns=test' \
         <canvas>/api/v1/users/self/custom_data
  #=> {"data":{"fruit":{"apple":"so tasty"}}}

- see new API doc for more info about how it should work, but
  basically, you should be able to GET, PUT, and DELETE at will
  for any given scope, and PUTting JSON hashes creates referenceable
  scopes. (e.g. the DELETE above has 'kiwi' in its scope)

Change-Id: If027ae4aeec14edf44275ba0372a68aef7e5600e
Reviewed-on: https://gerrit.instructure.com/31173
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
only delete scribd_docs from self

don't delete scribd_docs when attachments are destroyed

fixes CNVS-11923

test plan
 - have attachment with scribd_doc  that has
   root_attachment with scribd_doc
 - call delete_scribd_doc on child
 - parent scribd_doc should be un-touched

Change-Id: I1cbac580e40c6b8f5c2a8612f5390dfae681d9c4
Reviewed-on: https://gerrit.instructure.com/32123
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
fix namespace issue with attachment relationship on quiz submissions

fixes CNVS-11986, CNVS-11672

test plan:

the problem on this one comes up when we are trying to view an attachment that
was created before the namespace change. So we have to massage the data in the
console to reproduce what's going on here, or test it with data that was created
before the namespace changes.

- as a teacher
  - create a quiz with a file upload question type

- as a student
  - take the quiz and upload the file

- in the console
  Attachment.update_all("context_type='QuizSubmission'", "context_type='Quizzes::QuizSubmission'")

- as a teacher
  - visit the moderate page for this student's quiz, and the attachment link
    should be visible to download the file.

Change-Id: I329bb422770e0d22fa33be189c0229298c12f759
Reviewed-on: https://gerrit.instructure.com/32319
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Clare Strong <clare@instructure.com>
Updated tr translation
fix CanvasCassandra::Database parameter handling

CassandraCQL::Database will take, for example :retries => nil as if
specified and use it to override it's default of 0. but then it will get
sad when trying to treat it as a number.

also, make sure to send the values from the config into this method.

Change-Id: I9df099635283e8455de045e6bbe736ed431f5093
Reviewed-on: https://gerrit.instructure.com/31214
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
simplify time_ago_date processing

there was a one-off unfudge calculation. meticulous manipulation of the
code gives almost the exact same implementation as
unfudgeDateForProfileTimezone, and whose only deviations appear to be
bugs.

however, doing that unfudge (whether adhoc or using
unfudgeDateForProfileTimezone) was only necessary and appropriate when
the date to parse didn't have TZ info embedded (which it sometimes, but
only sometimes, did).

to simplify, just embed a known ISO formatted timestamp in all
time_ago_date elements. then we can parse that and use if for
calculations without any unfudging.

but don't forget to fudge that date before formatting for display (title
attribute and displayed string when > 1 day old).

test-plan:
 - have a student in a course that's posted on a discussion in that
   course
 - as a teacher in that course whose profile timezone does not match the
   system timezone, view the student's course roster page
   (/course/x/users/y)
 - under "Recent Messages", confirm that the friendly timestamps on the
   right for the discussion entry is displayed according to the correct
   (profile) timezone
 - confirm the title attribute (hover) of the friendly timestamp is
   formatted in the profile timezone

Change-Id: Id3385d58a9da02e9ed991ebd59152ca3f5fbd280
Reviewed-on: https://gerrit.instructure.com/31591
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
don't include user_offset in timestamp

result.timestamp should be the true timestamp of the parsed date, not
adjusted in any way. only include user_offset (the profile timezone,
counter to tz_offset which is the browser timezone) in the calculation
of `time', which is a fudged value

this wasn't a bigger issue before, because the timestamp value was only
used for sorting. even being off by user_offset, all timestamps were off
by the same amount, so they still sorted consistently.

test-plan:
 - load a page while logged in, open the javascript console
 - set "d = new Date()"
 - compare "$.parseFromISO(d.toISOString()).timestamp * 1000) == d"
 - should be true (before this code, was off by the profile timezone's
   offset)
 - go to the assignments page for a course with 2 or more assignments
   with distinct due dates
 - add a third assignment with a due date between the others
 - the added assignment should sort into the others appropriately

Change-Id: I30c45ea57d64da5dd82c535987fa728f2f69d147
Reviewed-on: https://gerrit.instructure.com/31597
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Merge branch 'master' into dev/timezunami

Change-Id: Iaa0d7f3a33d2f368bb8e1ac417055504483f74f3
new conversations: fix admin menu styling

fixes CNVS-9295

test plan:
  * open new conversations
  * select a conversation
  * open the cog menu in the header
  * mark the conversation as unread
  * reopen the cog menu
  * verify that the "Mark as Read" entry is correctly styled

Change-Id: Ib363f2dcdc67bd08ee1c29d83ea7901d4cf53d1d
Reviewed-on: https://gerrit.instructure.com/32239
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
fix text file preview in rails3

test plan:
 - upload a text file to a course
 - add it to a module
 - click the module item
 - you should see the file content,
   not "<#Proc ...>"

fixes CNVS-11934

Change-Id: Ieb3817365306080ddbb98664c62e61eea9882f72
Reviewed-on: https://gerrit.instructure.com/32162
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
fix Content-type for turnitin post requests

fixes CNVS-12011

test plan:
- submit a document to turnitin
- it should successfully receive a turnitin score

Change-Id: I4b4459e134ae8897896ed4a6200917d7fed1d45f
Reviewed-on: https://gerrit.instructure.com/32344
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
fix tinymce + javascript templating problems

we need to escape content going into the textarea from which tinymce is
initialized, because it is unescaped during that initialization process.

fixes CNVS-11928
fixes CNVS-10690

test plan:
- with assignment, discussion topic, and wiki page editing: (it's probably safe
  to do a deep regression with just one of these pages and a more surface level
  regression with the other two)
- before checking out this commit, create some interesting content (videos,
  math embeds, and other rich content with a mixture of markup and content)
- also create some very long content
- finally, create some content that explicitly has the text "<HELLO>" (or
  really anything directly between two angle brackets)
- check out the commit
- go back to edit these pages
- the content that is populated into tinymce should be exactly the content that
  you originally wrote. it should not be truncated, and it should not strip out
  content that looks like <HELLO>

Change-Id: Icc93f4b7c6493037e0dc192d304208eaff8b9852
Reviewed-on: https://gerrit.instructure.com/32237
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
don't use AR objects as hash keys

Change-Id: If81761036a28ab16a37bbc287dbf6363b5fbd483
Reviewed-on: https://gerrit.instructure.com/32329
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
collapse date_timestamp and time_timestamp

into just timestamp. guess what -- the derivation of timestamp from iso
MAKES SENSE now. weird

(moar baby steps)

Change-Id: Ifec487e616b903afdd8ca1a8806c5eecca1f0c88
Reviewed-on: https://gerrit.instructure.com/31974
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
replace one-off fudge calculation with fudge call

now the use of user_offset and tz_offset is apparent -- it's just
fudging the parsed "true" timestamp into a date object that will format
as if in the profile timezone. this is what fudgeDateForProfileTimezone
is for; use it.

Change-Id: I82a82dc3f1946cd733e399331fe9d9950fa3b2f9
Reviewed-on: https://gerrit.instructure.com/31975
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
replace offset-fudging with tz() fudging

tz-format/browser-parse and browser-format/tz-parse are still not an
ideal pattern (we'll get rid of fudge/unfudge soon), and they're more
expensive, but they're a lot more accurate than trying to shift the date
around by offsets

Change-Id: Idda8ad375b7014c1aa0ebc38e756384a0f9d2c08
Reviewed-on: https://gerrit.instructure.com/31976
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>