Commit Graph

37 Commits

Author SHA1 Message Date
Bracken Mosbacker 9d5e9f4770 correctly replace modules and files on content migrations
Files weren't being replaced if they had a filename different
from their display_name.

The content_tags for modules are cleared before they are
imported so that only the items aren't duplicated.

Test Plan:
  * Import a package twice
	* The modules should be correct and not have 2 items for each item
	* The files should also not be duplicated

closes #10405

Change-Id: I3cb15c2530734185675a2b8bb9017bdf6ac35202
Reviewed-on: https://gerrit.instructure.com/13695
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-09-14 12:42:52 -06:00
Simon Williams 5fb8875e30 minor context module code cleanup
Change-Id: Ifda3d31f5742d850dac1b37bf652613848275c11
Reviewed-on: https://gerrit.instructure.com/13483
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-09-06 14:16:42 -06:00
Cody Cutrer 29cf0db046 remove WikiNamespace fixes #9121
no user visible behavior change

test plan:
 * make sure existing wiki contents haven't disappeared
 * make sure a new course gets a wiki that functions correctly
 * make sure wiki rss feeds are still functional
 * try to access the wiki from a new course from multiple requests
   simultaneously; it should get a single wiki that's not conflated

Change-Id: I339b56c39d7868dbdec3df4007291a429272b1cf
Reviewed-on: https://gerrit.instructure.com/12432
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-07-30 09:15:04 -06:00
Brian Palmer 73380d2bc8 allow using an item in modules more than once
closes #8769

An item can be added to multiple modules, or even the same module more
than once. This is especially useful for attachment items, but is also
useful for allowing multiple paths through a course, with say an
assignment in two different modules and the user only has to complete
one of the two modules.

test plan:

For an item in only one module, verify that the module navigation still
appears if you go straight to that item's page, without going through
the modules page.

Add an item to more than one module. If you visit that item from the
modules page, you'll see the right nav depending on which instance of
the item you clicked on. If you visit the item directly without going
through the modules page, you'll see no nav.

Lock one instance of the item by adding a prerequisite, but leave the
other unlocked. You can still see the item as a student.

Lock all instances of the item with prerequisites. The item will now be
locked and you can't see it as a student.

Add completion requirements to the item, such as a minimum score on a
quiz. Make the requirements different -- 3 points in one instance and 5
in the other, for instance. Verify that if you get 3 points on the quiz,
one item is marked as completed but the other isn't, as expected.

Rename the item. Verify that all instances of it in modules get renamed.

Change-Id: I4f1b2f6f033062ec47ac34fe5eb973a950c17b0c
Reviewed-on: https://gerrit.instructure.com/11671
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-06-21 10:12:22 -06:00
Zach Pendleton 16c3919328 copy new_tab setting for external tool links during course copy.
fixes #8648

test plan:
  * create a course with an external tool link in a module
    that is set to open in a new tab;
  * create a second course, and copy the first course's content
    into it;
  * verify that the link is copied and that it is properly set
    to open in a new tab.

Change-Id: Ib12cf67405393dfbeea416cbe056152daec805de
Reviewed-on: https://gerrit.instructure.com/10778
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-05-17 10:37:43 -06:00
Bracken Mosbacker ce12af199d undelete course objects on course copy
If you copied content into your course, then deleted an item
and copied it again it wouldn't be active. It is now.

Test Plan:
 * Create an assignment
 * Copy the course and delete the assignment in the new course
 * Copy the original course into the new one again
 * The assignment should be active

closes #8298

Change-Id: Ief8476d2befff999ed85a35039604d34253bfa1f
Reviewed-on: https://gerrit.instructure.com/10487
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-05-07 09:24:14 -06:00
Bracken Mosbacker 961aad6d3b properly handle selective external migration imports
The selective imports mostly worked before, but if a
given section was completely unchecked the previous
code would import it anyway. This fixes that and makes all
the decision code in one place and easy to test.

Test Plan:
 * Import a content package and only choose certain items
 * Only the items you chose should be imported

closes #5528

Change-Id: Ia6c0c1f5f9a44497053733101140cc74d6239129
Reviewed-on: https://gerrit.instructure.com/9799
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-04-04 12:25:29 -06:00
Brian Whitmer 2fdbb3795d Allow launch preference when external tools have matching precedence
It's possible to have two external tools with all the
same configuration except for custom fields. In this case,
inserting two links, one to each tool configuration, would
have resulted in two launches of the same tool because
Canvas was only searching for the first match. This
commit adds an additional "preference" for the specified
tool, so Canvas doesn't just pick the first one, it tries
to pick the preferred one if there's nothing else
trumping that tool in precedence.

This does not fix the problem with having a tool's custom fields
overridden by a different tool that has higher precedence.

fixes #6797

test plan:
- add two external tools to a course with the same configuration
  but different custom fields
- add a link to each tool in the course modules
- make sure the two links send over the correct custom fields,
  those matching the tool that was picked when inserting the link

Change-Id: I8b037f169cfcfbfd9f9082a9dbec6fcee442edaa
Reviewed-on: https://gerrit.instructure.com/9025
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-02-28 11:54:25 -07:00
Bracken Mosbacker ef74b58051 handle discussion assignments correcly when unlocking modules
Test Plan:
 * Create a discussion assignment worth 10 points
 * Make a module item that is locked until that item has at least 5 points
 * As a student make a comment on the discussion
 * As the teacher give the student > 5 points.
 * When reloading the modules page for the student the module item should be completed

closes #7170

Change-Id: Ie1eed0dc80cae85427f1a02fc833e33d7864ed49
Reviewed-on: https://gerrit.instructure.com/9040
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-28 08:13:46 -07:00
Bracken Mosbacker a30a1b8d9f don't fail when copying/import invalid urls
the urls for content tags didn't use to be validated so there
can be invalid urls in olds data. If you try to copy one of
those courses it fails. It also failed for importing content
packages.

This commit makes it so that importing will skip those items
and add an item about it to the migration warning. For course
copy it attempts to escape the url and continue copying.

Test Plan:
 * try to import a course from a package that has an invalid url
 * try to copy a course that has an invalid url. (You'll have to manually set the invalid url on the ContentTag)

closes #7262

Change-Id: I008b786919bb2b66e0ff546667e7c0832b52e192
Reviewed-on: https://gerrit.instructure.com/8710
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-16 13:48:33 -07:00
Bracken Mosbacker 27f4d24c75 allow importing of multiple module links to same external tool
The importer was incorrectly using the external tool's
migration id as the content tags migration id. This made
it so that links to the same tool just updated the first
tag instead of creating a new one.

Test Plan:
 * Create an external tool
 * Link two module items to it on the modules page
 * Export that course and import it into a different course
 * The imported module should have both items and not just the second one

refs #7017

Change-Id: Iba377b9085607e3503f7f0113a4b9720bf8f0305
Reviewed-on: https://gerrit.instructure.com/8290
Reviewed-by: Brian Whitmer <brian@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-01-31 10:19:48 -07:00
Bracken Mosbacker ee219b2b4a don't sync file names and content tag names
Renaming a content tag would also rename the file display name.
This was usually unexpected but it also caused relative linking
problems for html files

Test Plan:
 * Add an attachment
 * Add a link to that attachment in a module and give it a different title
 * Check that the display name of the attachment didn't change
 * Export that course as a canvas export
 * Import it into a different course and make sure titles are still okay

closes #6408

Change-Id: I5735089ef9e2b7942b10689ca1beb1c57c073508
Reviewed-on: https://gerrit.instructure.com/7231
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2011-12-01 10:51:53 -07:00
Brian Whitmer 522abc26d4 option to open BLTI links in a new tab
We are getting requests from some vendors to have some way to
load tools in a new tab. The preferred behavior is still to load
tools in the current window, but if a new tab is absolutely
necessary then there is the option now.

We can't reliably open links in a new tab without user intervention,
so we provide a button that users can click to load the tool
themselves in a new tab. That means we also need to add some
timeout functionality in case they take more than a few minutes
to load the tool, since BLTI links expire over time.

fixes #5814

Change-Id: I126f1aaa9cdcfe49b8f2b8ef8b7fbbaf8c56fe67
Reviewed-on: https://gerrit.instructure.com/5957
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-10-07 13:44:52 -06:00
Bracken Mosbacker 58dcf16c92 add links and discussions to cc importer
This also fixed some problems with the web content
part of the importer and made the spec run the full
migration from a cc package

refs #4153

Change-Id: I1700043b578fe79586104cf13b260c78c3166194
Reviewed-on: https://gerrit.instructure.com/5702
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-09-23 13:27:47 -06:00
Bracken Mosbacker 81a10db574 moved migration classes into a proper namespace
refs #4153

Change-Id: I08035c5e6439d46c8ca61fb9409b1c2972567933
Reviewed-on: https://gerrit.instructure.com/5700
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-09-23 13:27:16 -06:00
Jacob Fugal 1a761c2d1f explicit utc db times in update_all
update_all's update hash doesn't have any magic performed on bare Time
objects; it assumes any Time object it's given is already in UTC. using
a TimeWithZone object (regardless of timezone), which Fixnum#ago and
friends happen to return, is still fine.

Change-Id: I297b2a3211b896b5225ebcfaaee3c1eb56e55fb6
Reviewed-on: https://gerrit.instructure.com/5351
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-08-30 16:46:25 -06:00
Cody Cutrer b365936781 use kept_score for quizzes when evaluating module requirements
fixes #5216

Change-Id: Ibaa5c56dbe71401d65d38892a9f3917fb1448531
Reviewed-on: https://gerrit.instructure.com/5037
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-08-11 10:01:39 -06:00
Brian Palmer 92feb2bcdb replace ActiveRecord::Base calls with subclass calls where it makes sense
This was already a small issue if the job queue was on a different
database driver than the main database, and it'll become more important
as more AR connections are introduced.

Change-Id: I204becadd32bb935df096e8c937a04bb6962f0b2
Reviewed-on: https://gerrit.instructure.com/4601
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-07-18 13:56:08 -06:00
Bracken Mosbacker 09eef3bb44 don't force second look up for module items during import
refs #4903

Change-Id: I396707f04bfffb636c665391a883ec4297677d2c
Reviewed-on: https://gerrit.instructure.com/4709
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-07-18 10:55:03 -06:00
Cody Cutrer 7f5cc0693b optimize AdheresToPolicy
Basically, don't call a bazillion procs everytime you check_policy;
just the "given" statement.  Everything else is evaluated just once,
and cached on the class.  This does lose functionality (the ability
to access the instance inside of set_policy, and set methods), but
none of it was currently in use.

Change-Id: I736879d98beb4115a2e8c492931c755076291d08
Reviewed-on: https://gerrit.instructure.com/4665
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-07-14 13:25:28 -06:00
Cody Cutrer 340792c468 optimize modules page
for a course with > 500 module items, this brings initial render time
down from > 14 seconds to 3 seconds

 * preload associations (appropriately)
 * make sure to use those preloaded associations
 * capture is slow when called a lot
 * remove dead code

Change-Id: I8147c144db14329aa6e30e7922e8769b5b1a1b84
Reviewed-on: https://gerrit.instructure.com/4598
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-07-08 08:58:22 -06:00
Brian Palmer a55b3dfb60 don't bypass previous module requirements if sequential progress is enabled
if sequential progress was enabled for a module, we were ignoring the
progression.locked? response and just looking at the current position in
the progression -- bypassing all previous module requirements.

fixes #4990

Change-Id: Ibe56e0a960f27e34db6f73c3e3fc791d9f51355c
Reviewed-on: https://gerrit.instructure.com/4542
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-07-05 12:32:48 -06:00
Bracken Mosbacker a03dd41895 don't allow single item failures to stop a whole import
Before if any single item had an error the whole import
errored out. This lets items fail and the rest continue to
import. The single item failures are logged as warnings in
the ContentMigration and this allows the user to know what
failed.

All the warnings/failures are also shown on the migration
list page to help admins diagnose problems.

refs #4903

Change-Id: I66b81ce1c243258dfc8c1d7d1381b2ea8daa3e72
Reviewed-on: https://gerrit.instructure.com/4268
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-06-17 12:21:59 -06:00
Brian Palmer 858e281322 i18n context_module
Change-Id: I061822cba6216ddd401118a21f636492e57411a6
Reviewed-on: https://gerrit.instructure.com/4199
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-06-16 09:09:01 -06:00
JT Olds ab1e3ffa73 mark assignments locked on the assignment model itself if its module is locked
refs #4589

Change-Id: I1e3ca7361ba53d1efb5671ee0fd2a87622651548
Reviewed-on: https://gerrit.instructure.com/3913
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-31 17:23:14 -06:00
Cody Cutrer bdbebfaec8 check all models for protecting attributes refs #3847
Change-Id: I7cba6e26ad98e91723e2ccf0a28b8db79bb37b5c
Reviewed-on: https://gerrit.instructure.com/3631
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-05-25 17:38:50 -06:00
Jon Jensen 6d226272df cast columns in dynamic finders, warn on all-nil argument lists
in production mode we now cast to the appropriate type and issue a warning
if it can't be cleanly cast (e.g. '' -> 0). if all arguments are nil (or
empty arrays, e.g. find_by_id([])) and we aren't in a scope, issue a
warning (sometimes we really do want nil when we're in a scope, e.g. line
216 of app/models/folder/rb).

in development/test mode, we now raise errors in the two warning scenarios
above (though that is configurable).

fixed several places in the code where specs failed due to the change, or
where inputs to dynamic finders looked problematic

Change-Id: Ifea851cb14d3e89b6df08ade8e83934579678f8b
Reviewed-on: https://gerrit.instructure.com/3434
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-03 11:06:04 -06:00
Zach Wily 20092fb2c9 fix more find_by_id cases where we could pass in an empty string
Change-Id: I6bd72dd78f739edac6377f863f298fa14283be38
Reviewed-on: https://gerrit.instructure.com/3299
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-04-27 10:45:09 -06:00
Zach Wily e10c1cc2f5 fix indenting of imported modules; fixes #4375
Change-Id: Ibbf3466424e58e41e47691fcbd6e548450d47e15
Reviewed-on: https://gerrit.instructure.com/3264
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-04-25 23:47:53 -06:00
Bracken Mosbacker 40eba041a9 export all files with filename instead of display name
module content tags will rename a file if there is a
title set

closes #4343

Change-Id: I4e90921b8dab62b452f599135d683515bd342ba1
Reviewed-on: https://gerrit.instructure.com/3260
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-04-25 21:02:03 -06:00
Bracken Mosbacker 090eaf6d96 fix sub-item importing for some content imports
closes #4354

Change-Id: I01057f3fe853f3738a23b62ad230985f96195d68
Reviewed-on: https://gerrit.instructure.com/3237
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-04-25 07:28:16 -06:00
Bracken Mosbacker c06affd551 fix regex typo and hide the course export option
refs #3396

Change-Id: I08ef2324757c302a6d807a065e9acb13b3380dac
Reviewed-on: https://gerrit.instructure.com/3086
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-04-18 08:09:44 -06:00
Bracken Mosbacker 61771933bb importing more canvas export objects
This imports the syllabus, rubrics, and modules

refs #3396

Change-Id: Ie7802aa5a064f8cee471af9bfe0a23bf224831a6
Reviewed-on: https://gerrit.instructure.com/3064
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-04-18 08:09:28 -06:00
Brian Whitmer 9d131ea836 basic lti support
- external tools can be added on the course/account
  settings page
- external tools can be linked to from within modules
- clicking a tool in a module will load a new page
  with the tool embedded in an iframe
- see context_external_tools for standard procedures
  on retrieving settings for a specific link

fixes #4013

Change-Id: I8aa1934f8deac9af26d74036162b34fd1c4242e1
Reviewed-on: https://gerrit.instructure.com/2601
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-03-23 16:58:11 -06:00
Bracken Mosbacker 5f38766dd6 fix some module import problems
closes #4076

Change-Id: Ieb82b17fe0c3fe816ca3813b0fdb33ee598de86a
Reviewed-on: https://gerrit.instructure.com/2716
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
2011-03-21 11:59:57 -06:00
Bracken Mosbacker b866a18699 fix wiki_page reference for module importing
closes #3843

Change-Id: I7cc3270f3a5766b8ad8fe7f1e2991396f2fff85c
Reviewed-on: https://gerrit.instructure.com/2313
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-02-17 10:40:18 -07:00
Brian Whitmer 8b8173dcc9 Initial commit.
closes #6988138
2011-01-31 18:57:29 -07:00