From f26a4af75c8cd64b316d1f2ab62d412afdc61c7b Mon Sep 17 00:00:00 2001 From: Lyla Fischer Date: Fri, 5 Oct 2012 09:43:16 -0400 Subject: [PATCH] thinks work, they just don't display prettily, and it is hard to actually use the assets due to links --- cms/djangoapps/contentstore/views.py | 21 ++- cms/templates/asset_index.html | 122 +----------------- .../xmodule/xmodule/contentstore/content.py | 19 +++ .../lib/xmodule/xmodule/contentstore/mongo.py | 2 +- 4 files changed, 42 insertions(+), 122 deletions(-) diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index cbc487dc37..d4a59be4d6 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -618,7 +618,7 @@ def upload_asset(request, org, course, coursename): if not has_access(request.user, location): return HttpResponseForbidden() - # Does the course actually exist?!? + # Does the course actually exist?!? Get anything from it to prove its existance try: item = modulestore().get_item(location) @@ -813,11 +813,22 @@ def asset_index(request, org, course, name): 'course' : course, 'coursename' : name }) + + course_reference = StaticContent.compute_location(org, course, name) + assets = contentstore().get_all_content_for_course(course_reference) + asset_display = [] + for asset in assets: + id = asset['_id'] + display_info = {} + display_info['displayname'] = asset['displayname'] + display_info['uploadDate'] = asset['uploadDate'] + contentstore_reference = StaticContent.compute_location(id['course'], id['org'], id['name']) + display_info['url'] = StaticContent.get_url_path_from_location(contentstore_reference) + + asset_display.append(display_info) - course = modulestore().get_item(location) - sections = course.get_children() - + print assets[0] return render_to_response('asset_index.html', { - 'sections': sections, + 'assets': asset_display, 'upload_asset_callback_url': upload_asset_callback_url }) diff --git a/cms/templates/asset_index.html b/cms/templates/asset_index.html index 769ba65c7f..c27de25bf0 100644 --- a/cms/templates/asset_index.html +++ b/cms/templates/asset_index.html @@ -23,20 +23,22 @@ + % for asset in assets: -
+
- raygun-1.jpg + ${asset['displayname']} - 10/2/2012 + ${asset['uploadDate']} - copy + copy + % endfor
@@ -51,118 +53,6 @@ copy - - -
- - - raygun-2.jpg - - - 10/2/2012 - - - copy - - - - -
- - - raygun-1.jpg - - - 10/2/2012 - - - copy - - - - -
- - - raygun-2.jpg - - - 10/2/2012 - - - copy - - - - -
- - - raygun-2.jpg - - - 10/2/2012 - - - copy - - - - -
- - - raygun-1.jpg - - - 10/2/2012 - - - copy - - - - -
- - - raygun-2.jpg - - - 10/2/2012 - - - copy - - - - -
- - - raygun-2.jpg - - - 10/2/2012 - - - copy - - - - -
- - - raygun-1.jpg - - - 10/2/2012 - - - copy - -