Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
65e3982f
Commit
65e3982f
authored
Oct 04, 2012
by
Lyla Fischer
Committed by
Calen Pennington
Oct 11, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
things now upload
parent
6a7fb1d5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
15 deletions
+65
-15
cms/djangoapps/contentstore/views.py
+34
-6
cms/static/js/base.js
+20
-4
cms/templates/asset_index.html
+8
-4
cms/templates/base.html
+1
-0
cms/urls.py
+2
-1
No files found.
cms/djangoapps/contentstore/views.py
View file @
65e3982f
...
...
@@ -772,23 +772,52 @@ def remove_user(request, location):
return
create_json_response
()
@login_required
@ensure_csrf_cookie
def
asset_index
(
request
,
location
):
return
render_to_response
(
'asset_index.html'
,{})
# points to the temporary course landing page with log in and sign up
def
landing
(
request
,
org
,
course
,
coursename
):
return
render_to_response
(
'temp-course-landing.html'
,
{})
def
static_pages
(
request
,
org
,
course
,
coursename
):
return
render_to_response
(
'static-pages.html'
,
{})
def
edit_static
(
request
,
org
,
course
,
coursename
):
return
render_to_response
(
'edit-static-page.html'
,
{})
def
not_found
(
request
):
return
render_to_response
(
'error.html'
,
{
'error'
:
'404'
})
def
server_error
(
request
):
return
render_to_response
(
'error.html'
,
{
'error'
:
'500'
})
\ No newline at end of file
return
render_to_response
(
'error.html'
,
{
'error'
:
'500'
})
@login_required
@ensure_csrf_cookie
def
asset_index
(
request
,
org
,
course
,
name
):
"""
Display an editable asset library
org, course, name: Attributes of the Location for the item to edit
"""
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
# check that logged in user has permissions to this item
if
not
has_access
(
request
.
user
,
location
):
raise
PermissionDenied
()
upload_asset_callback_url
=
reverse
(
'upload_asset'
,
kwargs
=
{
'org'
:
org
,
'course'
:
course
,
'coursename'
:
name
})
course
=
modulestore
()
.
get_item
(
location
)
sections
=
course
.
get_children
()
return
render_to_response
(
'asset_index.html'
,
{
'sections'
:
sections
,
'upload_asset_callback_url'
:
upload_asset_callback_url
})
cms/static/js/base.js
View file @
65e3982f
...
...
@@ -233,12 +233,28 @@ function showFileSelectionMenu(e) {
function
startUpload
(
e
)
{
$
(
'.upload-modal h1'
).
html
(
'Uploading…'
);
$
(
'.upload-modal .file-name'
).
html
(
$
(
'.file-input'
).
val
());
var
bar
=
$
(
'.progress-fill'
);
var
percent
=
$
(
'.percent'
);
$
(
'.upload-modal .file-chooser'
).
ajaxSubmit
({
beforeSend
:
function
()
{
var
percentVal
=
'0%'
;
bar
.
width
(
percentVal
)
percent
.
html
(
percentVal
);
},
uploadProgress
:
function
(
event
,
position
,
total
,
percentComplete
)
{
var
percentVal
=
percentComplete
+
'%'
;
bar
.
width
(
percentVal
)
percent
.
html
(
percentVal
);
},
complete
:
function
(
xhr
)
{
markAsLoaded
();
}
});
$
(
'.upload-modal .choose-file-button'
).
hide
();
$
(
'.upload-modal .progress-bar'
).
removeClass
(
'loaded'
).
show
();
$
(
'.upload-modal .progress-fill'
).
html
(
''
).
css
(
'width'
,
'0'
).
animate
({
'width'
:
'100%'
},
1500
);
setTimeout
(
markAsLoaded
,
1500
);
}
function
markAsLoaded
()
{
...
...
cms/templates/asset_index.html
View file @
65e3982f
...
...
@@ -9,7 +9,8 @@
<div
class=
"inner-wrapper"
>
<h1>
Asset Library
</h1>
<div
class=
"page-actions"
>
<a
href=
"#"
class=
"upload-button"
>
Upload New File
</a><input
type=
"text"
class=
"asset-search-input search wip-box"
placeholder=
"search assets"
/>
<a
href=
"#"
class=
"upload-button"
>
Upload New File
</a>
<input
type=
"text"
class=
"asset-search-input search wip-box"
placeholder=
"search assets"
/>
</div>
<article
class=
"asset-library"
>
<table>
...
...
@@ -187,14 +188,17 @@
<div
class=
"progress-bar"
>
<div
class=
"progress-fill"
></div>
</div>
<div
class=
"percent"
>
0%
</div>
<div
class=
"status"
></div>
<a
href=
"#"
class=
"copy-button"
>
Copy Embed Link
</a>
<
div
class=
"file-chooser
"
>
<
form
class=
"file-chooser"
action=
"${upload_asset_callback_url}"
method=
"post"
enctype=
"multipart/form-data
"
>
<a
href=
"#"
class=
"choose-file-button"
>
Choose File
</a>
<input
type=
"file"
class=
"file-input"
>
</
div
>
<input
type=
"file"
class=
"file-input"
name=
"file"
>
</
form
>
</div>
</div>
<div
class=
"modal-cover"
></div>
</
%
block>
cms/templates/base.html
View file @
65e3982f
...
...
@@ -33,6 +33,7 @@
<script
src=
"${static.url('js/vendor/jquery.cookie.js')}"
></script>
<script
src=
"${static.url('js/vendor/jquery.leanModal.min.js')}"
></script>
<script
src=
"${static.url('js/vendor/jquery.tablednd.js')}"
></script>
<script
src=
"http://malsup.github.com/jquery.form.js"
></script>
<script
type=
"text/javascript"
>
document
.
write
(
'
\
x3Cscript type="text/javascript" src="'
+
document
.
location
.
protocol
+
'//www.youtube.com/player_api">
\
x3C/script>'
);
...
...
cms/urls.py
View file @
65e3982f
...
...
@@ -38,8 +38,9 @@ urlpatterns = ('',
url
(
r'^landing/(?P<org>[^/]+)/(?P<course>[^/]+)/course/(?P<coursename>[^/]+)$'
,
'contentstore.views.landing'
,
name
=
'landing'
),
url
(
r'^not_found$'
,
'contentstore.views.not_found'
,
name
=
'not_found'
),
url
(
r'^server_error$'
,
'contentstore.views.server_error'
,
name
=
'server_error'
)
url
(
r'^server_error$'
,
'contentstore.views.server_error'
,
name
=
'server_error'
)
,
url
(
r'^(?P<org>[^/]+)/(?P<course>[^/]+)/assets/(?P<name>[^/]+)$'
,
'contentstore.views.asset_index'
,
name
=
'asset_index'
),
)
# User creation and updating views
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment