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
8e5fc291
Commit
8e5fc291
authored
Dec 27, 2012
by
Chris Dodge
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/btalbot/cms-export' into feature/cdodge/export
parents
3fa425c5
c9e5c47b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
235 additions
and
0 deletions
+235
-0
cms/djangoapps/contentstore/views.py
+14
-0
cms/static/sass/_export.scss
+124
-0
cms/static/sass/base-style.scss
+1
-0
cms/templates/export.html
+92
-0
cms/templates/widgets/header.html
+1
-0
cms/urls.py
+3
-0
No files found.
cms/djangoapps/contentstore/views.py
View file @
8e5fc291
...
...
@@ -1302,3 +1302,17 @@ def import_course(request, org, course, name):
course_module
.
location
.
course
,
course_module
.
location
.
name
])
})
def
export_course
(
request
,
org
,
course
,
name
):
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
course_module
=
modulestore
()
.
get_item
(
location
)
# check that logged in user has permissions to this item
if
not
has_access
(
request
.
user
,
location
):
raise
PermissionDenied
()
return
render_to_response
(
'export.html'
,
{
'context_course'
:
course_module
,
'active_tab'
:
'export'
,
'successful_import_redirect_url'
:
''
})
cms/static/sass/_export.scss
0 → 100644
View file @
8e5fc291
.export
{
.export-overview
{
@extend
.window
;
@include
clearfix
;
padding
:
30px
40px
;
}
.description
{
float
:
left
;
width
:
62%
;
margin-right
:
3%
;
font-size
:
14px
;
h2
{
font-weight
:
700
;
font-size
:
19px
;
margin-bottom
:
20px
;
}
strong
{
font-weight
:
700
;
}
p
+
p
{
margin-top
:
20px
;
}
ul
{
margin
:
20px
0
;
list-style
:
disc
inside
;
li
{
margin
:
0
0
5px
0
;
}
}
}
.export-form-wrapper
{
.export-form
{
float
:
left
;
width
:
35%
;
padding
:
25px
30px
35px
;
@include
box-sizing
(
border-box
);
border
:
1px
solid
$mediumGrey
;
border-radius
:
3px
;
background
:
$lightGrey
;
text-align
:
center
;
h2
{
margin-bottom
:
30px
;
font-size
:
26px
;
font-weight
:
300
;
}
.error-block
{
display
:
none
;
margin-bottom
:
15px
;
font-size
:
13px
;
}
.error-block
{
color
:
$error-red
;
}
.button-export
{
@include
green-button
;
padding
:
10px
50px
11px
;
font-size
:
17px
;
}
.message-status
{
margin-top
:
10px
;
font-size
:
12px
;
}
.progress-bar
{
display
:
none
;
width
:
350px
;
height
:
30px
;
margin
:
30px
auto
10px
;
border
:
1px
solid
$blue
;
&
.loaded
{
border-color
:
#66b93d
;
.progress-fill
{
background
:
#66b93d
;
}
}
}
.progress-fill
{
width
:
0%
;
height
:
30px
;
background
:
$blue
;
color
:
#fff
;
line-height
:
48px
;
}
}
// downloading state
&
.is-downloading
{
.progress-bar
{
display
:
block
;
}
.button-export
{
padding
:
10px
50px
11px
;
font-size
:
17px
;
&
.disabled
{
pointer-events
:
none
;
cursor
:
default
;
}
}
}
}
}
\ No newline at end of file
cms/static/sass/base-style.scss
View file @
8e5fc291
...
...
@@ -18,6 +18,7 @@
@import
"static-pages"
;
@import
"users"
;
@import
"import"
;
@import
"export"
;
@import
"settings"
;
@import
"course-info"
;
@import
"landing"
;
...
...
cms/templates/export.html
0 → 100644
View file @
8e5fc291
<
%
inherit
file=
"base.html"
/>
<
%
namespace
name=
'static'
file=
'static_content.html'
/>
<
%!
from
django
.
core
.
urlresolvers
import
reverse
%
>
<
%
block
name=
"title"
>
Export
</
%
block>
<
%
block
name=
"bodyclass"
>
export
</
%
block>
<
%
block
name=
"content"
>
<div
class=
"main-wrapper"
>
<div
class=
"inner-wrapper"
>
<article
class=
"export-overview"
>
<div
class=
"description"
>
<h2>
About Exporting Courses
</h2>
<p>
When exporting your course, you will receive a .tar.gz formatted file that contains the following course data:
</p>
<ul>
<li>
Course Structure (Sections and sub-section ordering)
</li>
<li>
Individual Units
</li>
<li>
Individual Problems
</li>
<li>
Static Pages
</li>
<li>
Course Assets
</li>
</ul>
<p>
Your course export
<strong>
will not include
</strong>
: student data, forum/discussion data, course settings, certificates, grading information, or user data.
</p>
</div>
<!-- default state -->
<div
class=
"export-form-wrapper"
>
<form
action=
"${reverse('export_course', kwargs=dict(org=context_course.location.org, course=context_course.location.course, name=context_course.location.name))}"
method=
"post"
enctype=
"multipart/form-data"
class=
"export-form"
>
<h2>
Export Course:
</h2>
<p
class=
"error-block"
></p>
<a
href=
"#"
class=
"button-export"
>
Download Files
</a>
</form>
</div>
<!-- download state: after user clicks download buttons -->
<div
class=
"export-form-wrapper is-downloading"
>
<form
action=
"${reverse('export_course', kwargs=dict(org=context_course.location.org, course=context_course.location.course, name=context_course.location.name))}"
method=
"post"
enctype=
"multipart/form-data"
class=
"export-form"
>
<h2>
Export Course:
</h2>
<p
class=
"error-block"
></p>
<a
href=
"#"
class=
"button-export disabled"
>
Files Downloading
</a>
<p
class=
"message-status"
>
Download not start?
<a
href=
"#"
class=
"text-export"
>
Try again
</a></p>
</form>
</div>
</article>
</div>
</div>
</
%
block>
<
%
block
name=
"jsextra"
>
<script>
(
function
()
{
var
bar
=
$
(
'.progress-bar'
);
var
fill
=
$
(
'.progress-fill'
);
var
percent
=
$
(
'.percent'
);
var
status
=
$
(
'#status'
);
var
submitBtn
=
$
(
'.submit-button'
);
$
(
'form'
).
ajaxForm
({
beforeSend
:
function
()
{
status
.
empty
();
var
percentVal
=
'0%'
;
bar
.
show
();
fill
.
width
(
percentVal
);
percent
.
html
(
percentVal
);
submitBtn
.
hide
();
},
uploadProgress
:
function
(
event
,
position
,
total
,
percentComplete
)
{
var
percentVal
=
percentComplete
+
'%'
;
fill
.
width
(
percentVal
);
percent
.
html
(
percentVal
);
},
complete
:
function
(
xhr
)
{
if
(
xhr
.
status
==
200
)
{
alert
(
'Your import was successful.'
);
window
.
location
=
'${successful_import_redirect_url}'
;
}
else
alert
(
'Your import has failed.
\
n
\
n'
+
xhr
.
responseText
);
submitBtn
.
show
();
bar
.
hide
();
}
});
})();
</script>
</
%
block>
\ No newline at end of file
cms/templates/widgets/header.html
View file @
8e5fc291
...
...
@@ -33,6 +33,7 @@
<li><a
href=
"${reverse('asset_index', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}"
id=
'assets-tab'
>
Assets
</a></li>
<li><a
href=
"${reverse('course_settings', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}"
id=
'settings-tab'
>
Settings
</a></li>
<li><a
href=
"${reverse('import_course', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}"
id=
'import-tab'
>
Import
</a></li>
<li><a
href=
"${reverse('export_course', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}"
id=
'export-tab'
>
Export
</a></li>
</ul>
% endif
</nav>
...
...
cms/urls.py
View file @
8e5fc291
...
...
@@ -23,6 +23,9 @@ urlpatterns = ('',
url
(
r'^(?P<org>[^/]+)/(?P<course>[^/]+)/import/(?P<name>[^/]+)$'
,
'contentstore.views.import_course'
,
name
=
'import_course'
),
url
(
r'^(?P<org>[^/]+)/(?P<course>[^/]+)/export/(?P<name>[^/]+)$'
,
'contentstore.views.export_course'
,
name
=
'export_course'
),
url
(
r'^preview/modx/(?P<preview_id>[^/]*)/(?P<location>.*?)/(?P<dispatch>[^/]*)$'
,
'contentstore.views.preview_dispatch'
,
name
=
'preview_dispatch'
),
url
(
r'^(?P<org>[^/]+)/(?P<course>[^/]+)/course/(?P<coursename>[^/]+)/upload_asset$'
,
...
...
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