Commit f26a4af7 by Lyla Fischer Committed by Calen Pennington

thinks work, they just don't display prettily, and it is hard to actually use…

thinks work, they just don't display prettily, and it is hard to actually use the assets due to links
parent 7791a7c4
......@@ -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
})
......@@ -23,20 +23,22 @@
</tr>
</thead>
<tbody>
% for asset in assets:
<tr>
<td class="thumb-col">
<div class="thumb"><img src="http://dribbble.s3.amazonaws.com/users/3185/screenshots/149571/picture_39.png"></div>
<div class="thumb"><img src="${asset['url']}"></div>
</td>
<td class="name-col">
<a href="#" class="filename">raygun-1.jpg</a>
<a href="${asset['url']}" class="filename">${asset['displayname']}</a>
</td>
<td class="date-col">
10/2/2012
${asset['uploadDate']}
</td>
<td class="embed-col">
<a href="#">copy</a>
<a href="${asset['url']}">copy</a>
</td>
</tr>
% endfor
<tr>
<td class="thumb-col">
<div class="thumb"><img src="http://dribbble.s3.amazonaws.com/users/4573/screenshots/157708/final.png"></div>
......@@ -51,118 +53,6 @@
<a href="#">copy</a>
</td>
</tr>
<tr>
<td class="thumb-col">
<div class="thumb"><img src="http://dribbble.s3.amazonaws.com/users/15101/screenshots/228625/star_wars_lightsbaer_2.jpg"></div>
</td>
<td class="name-col">
<a href="#" class="filename">raygun-2.jpg</a>
</td>
<td class="date-col">
10/2/2012
</td>
<td class="embed-col">
<a href="#">copy</a>
</td>
</tr>
<tr>
<td class="thumb-col">
<div class="thumb"><img src="http://dribbble.s3.amazonaws.com/users/3185/screenshots/149571/picture_39.png"></div>
</td>
<td class="name-col">
<a href="#" class="filename">raygun-1.jpg</a>
</td>
<td class="date-col">
10/2/2012
</td>
<td class="embed-col">
<a href="#">copy</a>
</td>
</tr>
<tr>
<td class="thumb-col">
<div class="thumb"><img src="http://dribbble.s3.amazonaws.com/users/4573/screenshots/157708/final.png"></div>
</td>
<td class="name-col">
<a href="#" class="filename">raygun-2.jpg</a>
</td>
<td class="date-col">
10/2/2012
</td>
<td class="embed-col">
<a href="#">copy</a>
</td>
</tr>
<tr>
<td class="thumb-col">
<div class="thumb"><img src="http://dribbble.s3.amazonaws.com/users/15101/screenshots/228625/star_wars_lightsbaer_2.jpg"></div>
</td>
<td class="name-col">
<a href="#" class="filename">raygun-2.jpg</a>
</td>
<td class="date-col">
10/2/2012
</td>
<td class="embed-col">
<a href="#">copy</a>
</td>
</tr>
<tr>
<td class="thumb-col">
<div class="thumb"><img src="http://dribbble.s3.amazonaws.com/users/3185/screenshots/149571/picture_39.png"></div>
</td>
<td class="name-col">
<a href="#" class="filename">raygun-1.jpg</a>
</td>
<td class="date-col">
10/2/2012
</td>
<td class="embed-col">
<a href="#">copy</a>
</td>
</tr>
<tr>
<td class="thumb-col">
<div class="thumb"><img src="http://dribbble.s3.amazonaws.com/users/4573/screenshots/157708/final.png"></div>
</td>
<td class="name-col">
<a href="#" class="filename">raygun-2.jpg</a>
</td>
<td class="date-col">
10/2/2012
</td>
<td class="embed-col">
<a href="#">copy</a>
</td>
</tr>
<tr>
<td class="thumb-col">
<div class="thumb"><img src="http://dribbble.s3.amazonaws.com/users/15101/screenshots/228625/star_wars_lightsbaer_2.jpg"></div>
</td>
<td class="name-col">
<a href="#" class="filename">raygun-2.jpg</a>
</td>
<td class="date-col">
10/2/2012
</td>
<td class="embed-col">
<a href="#">copy</a>
</td>
</tr>
<tr>
<td class="thumb-col">
<div class="thumb"><img src="http://dribbble.s3.amazonaws.com/users/3185/screenshots/149571/picture_39.png"></div>
</td>
<td class="name-col">
<a href="#" class="filename">raygun-1.jpg</a>
</td>
<td class="date-col">
10/2/2012
</td>
<td class="embed-col">
<a href="#">copy</a>
</td>
</tr>
</tbody>
</table>
<nav class="pagination">
......
......@@ -65,4 +65,23 @@ class ContentStore(object):
raise NotImplementedError
def get_all_content_for_course(self, location):
'''
Returns a list of all static assets for a course. The return format is a list of dictionary elements. Example:
[
{u'displayname': u'profile.jpg', u'chunkSize': 262144, u'length': 85374,
u'uploadDate': datetime.datetime(2012, 10, 3, 5, 41, 54, 183000), u'contentType': u'image/jpeg',
u'_id': {u'category': u'asset', u'name': u'profile.jpg', u'course': u'6.002x', u'tag': u'c4x',
u'org': u'MITx', u'revision': None}, u'md5': u'36dc53519d4b735eb6beba51cd686a0e'},
{u'displayname': u'profile.thumbnail.jpg', u'chunkSize': 262144, u'length': 4073,
u'uploadDate': datetime.datetime(2012, 10, 3, 5, 41, 54, 196000), u'contentType': u'image/jpeg',
u'_id': {u'category': u'asset', u'name': u'profile.thumbnail.jpg', u'course': u'6.002x', u'tag': u'c4x',
u'org': u'MITx', u'revision': None}, u'md5': u'ff1532598830e3feac91c2449eaa60d6'},
....
]
'''
raise NotImplementedError
......@@ -42,7 +42,7 @@ class MongoContentStore(ContentStore):
except NoFile:
raise NotFoundError()
def get_all_content_info_for_course(self, location):
def get_all_content_for_course(self, location):
'''
Returns a list of all static assets for a course. The return format is a list of dictionary elements. Example:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment