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
5b7a59bc
Commit
5b7a59bc
authored
Jan 13, 2012
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Staging page works
parent
832a8556
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
50 deletions
+61
-50
auth/views.py
+9
-9
courseware/views.py
+1
-1
settings.py
+34
-26
urls.py
+16
-13
util/views.py
+1
-1
No files found.
auth/views.py
View file @
5b7a59bc
...
@@ -18,7 +18,7 @@ def csrf_token(context):
...
@@ -18,7 +18,7 @@ def csrf_token(context):
def
index
(
request
):
def
index
(
request
):
if
request
.
user
.
is_authenticated
():
if
settings
.
COURSEWARE_ENABLED
and
request
.
user
.
is_authenticated
():
return
redirect
(
'/courseware'
)
return
redirect
(
'/courseware'
)
else
:
else
:
csrf_token
=
csrf
(
request
)[
'csrf_token'
]
csrf_token
=
csrf
(
request
)[
'csrf_token'
]
...
@@ -26,14 +26,14 @@ def index(request):
...
@@ -26,14 +26,14 @@ def index(request):
return
render_to_response
(
'index.html'
,
{
'error'
:
''
,
return
render_to_response
(
'index.html'
,
{
'error'
:
''
,
'csrf'
:
csrf_token
})
'csrf'
:
csrf_token
})
def
courseinfo
(
request
):
#
def courseinfo(request):
if
request
.
user
.
is_authenticated
():
#
if request.user.is_authenticated():
return
redirect
(
'/courseware'
)
#
return redirect('/courseware')
else
:
#
else:
csrf_token
=
csrf
(
request
)[
'csrf_token'
]
#
csrf_token = csrf(request)['csrf_token']
# TODO: Clean up how 'error' is done.
#
# TODO: Clean up how 'error' is done.
return
render_to_response
(
'courseinfo.html'
,
{
'error'
:
''
,
#
return render_to_response('courseinfo.html', {'error' : '',
'csrf'
:
csrf_token
})
#
'csrf': csrf_token })
def
login_user
(
request
,
error
=
""
):
def
login_user
(
request
,
error
=
""
):
print
request
.
POST
print
request
.
POST
...
...
courseware/views.py
View file @
5b7a59bc
...
@@ -104,7 +104,7 @@ def render_accordion(request,course,chapter,section):
...
@@ -104,7 +104,7 @@ def render_accordion(request,course,chapter,section):
def
index
(
request
,
course
=
"6.002 Spring 2012"
,
chapter
=
"Using the System"
,
section
=
"Hints"
):
def
index
(
request
,
course
=
"6.002 Spring 2012"
,
chapter
=
"Using the System"
,
section
=
"Hints"
):
''' Displays courseware accordion, and any associated content.
''' Displays courseware accordion, and any associated content.
'''
'''
if
not
request
.
user
.
is_authenticated
():
if
not
settings
.
COURSEWARE_ENABLED
or
not
request
.
user
.
is_authenticated
():
return
redirect
(
'/'
)
return
redirect
(
'/'
)
# Fixes URLs -- we don't get funny encoding characters from spaces
# Fixes URLs -- we don't get funny encoding characters from spaces
...
...
settings.py
View file @
5b7a59bc
COURSEWARE_ENABLED
=
True
ASKBOT_ENABLED
=
True
ASKBOT_ENABLED
=
True
if
not
COURSEWARE_ENABLED
:
ASKBOT_ENABLED
=
False
EMAIL_BACKEND
=
'django.core.mail.backends.console.EmailBackend'
DEFAULT_FROM_EMAIL
=
'pmitros@csail.mit.edu'
DEFAULT_FROM_EMAIL
=
'pmitros@csail.mit.edu'
DEFAULT_FEEDBACK_EMAIL
=
'pmitros@csail.mit.edu'
DEFAULT_FEEDBACK_EMAIL
=
'pmitros@csail.mit.edu'
...
@@ -12,18 +17,12 @@ DEBUG = True
...
@@ -12,18 +17,12 @@ DEBUG = True
TEMPLATE_DEBUG
=
DEBUG
TEMPLATE_DEBUG
=
DEBUG
ADMINS
=
(
ADMINS
=
(
#
('Piotr Mitros', 'pmitros@csail.mit.edu'),
(
'Piotr Mitros'
,
'pmitros@csail.mit.edu'
),
)
)
MANAGERS
=
ADMINS
MANAGERS
=
ADMINS
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE
=
'America/Chicago'
TIME_ZONE
=
'America/Chicago'
# Language code for this installation. All choices can be found here:
# Language code for this installation. All choices can be found here:
...
@@ -40,17 +39,9 @@ USE_I18N = True
...
@@ -40,17 +39,9 @@ USE_I18N = True
# calendars according to the current locale
# calendars according to the current locale
USE_L10N
=
True
USE_L10N
=
True
# Absolute filesystem path to the directory that will hold user-uploaded files.
#MEDIA_ROOT = ''
# Example: "/home/media/media.lawrence.com/media/"
#MEDIA_URL = ''
MEDIA_ROOT
=
''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL
=
''
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL
=
'/static/'
STATIC_URL
=
'/static/'
# URL prefix for admin static files -- CSS, JavaScript and images.
# URL prefix for admin static files -- CSS, JavaScript and images.
...
@@ -58,12 +49,6 @@ STATIC_URL = '/static/'
...
@@ -58,12 +49,6 @@ STATIC_URL = '/static/'
# Examples: "http://foo.com/static/admin/", "/static/admin/".
# Examples: "http://foo.com/static/admin/", "/static/admin/".
ADMIN_MEDIA_PREFIX
=
'/static/admin/'
ADMIN_MEDIA_PREFIX
=
'/static/admin/'
# Additional locations of static files
STATICFILES_DIRS
=
(
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
# List of finder classes that know how to find static files in
# List of finder classes that know how to find static files in
# various locations.
# various locations.
...
@@ -115,8 +100,6 @@ INSTALLED_APPS = (
...
@@ -115,8 +100,6 @@ INSTALLED_APPS = (
# 'django.contrib.admindocs',
# 'django.contrib.admindocs',
)
)
#EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# A sample logging configuration. The only tangible logging
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# the site admins on every HTTP 500 error.
...
@@ -142,9 +125,34 @@ LOGGING = {
...
@@ -142,9 +125,34 @@ LOGGING = {
TRACK_DIR
=
None
TRACK_DIR
=
None
# Django settings for mitx project.
execfile
(
"../settings.py"
)
execfile
(
"../settings.py"
)
if
'TRACK_DIR'
not
in
locals
():
TRACK_DIR
=
BASE_DIR
+
'/track_dir/'
if
'ASKBOT_EXTRA_SKINS_DIR'
not
in
locals
():
ASKBOT_EXTRA_SKINS_DIR
=
BASE_DIR
+
'/askbot/skins'
if
'ASKBOT_DIR'
not
in
locals
():
ASKBOT_DIR
=
BASE_DIR
if
'STATIC_ROOT'
not
in
locals
():
STATIC_ROOT
=
BASE_DIR
+
'/staticroot/'
if
'DATA_DIR'
not
in
locals
():
DATA_DIR
=
BASE_DIR
+
'/data/'
if
'TEXTBOOK_DIR'
not
in
locals
():
TEXTBOOK_DIR
=
BASE_DIR
+
'/textbook/'
if
'TEMPLATE_DIRS'
not
in
locals
():
TEMPLATE_DIRS
=
(
BASE_DIR
+
'/templates/'
,
DATA_DIR
+
'/templates'
,
TEXTBOOK_DIR
,
)
if
'STATICFILES_DIRS'
not
in
locals
():
STATICFILES_DIRS
=
(
BASE_DIR
+
'/3rdParty/static'
,
BASE_DIR
+
'/static'
)
if
ASKBOT_ENABLED
:
if
ASKBOT_ENABLED
:
import
sys
import
sys
sys
.
path
.
append
(
ASKBOT_DIR
)
sys
.
path
.
append
(
ASKBOT_DIR
)
...
...
urls.py
View file @
5b7a59bc
...
@@ -9,25 +9,13 @@ from django.contrib import admin
...
@@ -9,25 +9,13 @@ from django.contrib import admin
urlpatterns
=
(
''
,
urlpatterns
=
(
''
,
url
(
r'^event$'
,
'track.views.user_track'
),
url
(
r'^event$'
,
'track.views.user_track'
),
(
r'^wiki/'
,
include
(
'simplewiki.urls'
)),
url
(
r'^courseware/(?P<course>[^/]*)/(?P<chapter>[^/]*)/(?P<section>[^/]*)/$'
,
'courseware.views.index'
),
url
(
r'^courseware/(?P<course>[^/]*)/(?P<chapter>[^/]*)/$'
,
'courseware.views.index'
),
url
(
r'^courseware/(?P<course>[^/]*)/$'
,
'courseware.views.index'
),
url
(
r'^modx/(?P<module>[^/]*)/(?P<id>[^/]*)/(?P<dispatch>[^/]*)$'
,
'courseware.views.modx_dispatch'
),
#reset_problem'),
url
(
r'^courseware/$'
,
'courseware.views.index'
),
url
(
r'^profile$'
,
'courseware.views.profile'
),
url
(
r'^change_setting$'
,
'auth.views.change_setting'
),
url
(
r'^t/(?P<template>[^/]*)$'
,
'static_template_view.views.index'
),
url
(
r'^t/(?P<template>[^/]*)$'
,
'static_template_view.views.index'
),
url
(
r'^s/(?P<template>[^/]*)$'
,
'static_template_view.views.auth_index'
),
url
(
r'^book/(?P<page>[^/]*)$'
,
'staticbook.views.index'
),
url
(
r'^book*$'
,
'staticbook.views.index'
),
url
(
r'^logout$'
,
'auth.views.logout_user'
),
url
(
r'^logout$'
,
'auth.views.logout_user'
),
url
(
r'^login$'
,
'auth.views.login_user'
),
url
(
r'^login$'
,
'auth.views.login_user'
),
url
(
r'^login/(?P<error>[^/]*)$'
,
'auth.views.login_user'
),
url
(
r'^login/(?P<error>[^/]*)$'
,
'auth.views.login_user'
),
url
(
r'^create_account$'
,
'auth.views.create_account'
),
url
(
r'^create_account$'
,
'auth.views.create_account'
),
url
(
r'^activate/(?P<key>[^/]*)$'
,
'auth.views.activate_account'
),
url
(
r'^activate/(?P<key>[^/]*)$'
,
'auth.views.activate_account'
),
url
(
r'^$'
,
'auth.views.index'
),
url
(
r'^$'
,
'auth.views.index'
),
url
(
r'^course_info/$'
,
'auth.views.courseinfo'
),
url
(
r'^password_reset/$'
,
'django.contrib.auth.views.password_reset'
,
url
(
r'^password_reset/$'
,
'django.contrib.auth.views.password_reset'
,
dict
(
from_email
=
'6002-admin@mit.edu'
),
name
=
'auth_password_reset'
),
dict
(
from_email
=
'6002-admin@mit.edu'
),
name
=
'auth_password_reset'
),
url
(
r'^password_change/$'
,
django
.
contrib
.
auth
.
views
.
password_change
,
name
=
'auth_password_change'
),
url
(
r'^password_change/$'
,
django
.
contrib
.
auth
.
views
.
password_change
,
name
=
'auth_password_change'
),
...
@@ -38,11 +26,26 @@ urlpatterns = ('',
...
@@ -38,11 +26,26 @@ urlpatterns = ('',
name
=
'auth_password_reset_complete'
),
name
=
'auth_password_reset_complete'
),
url
(
r'^password_reset_done/$'
,
django
.
contrib
.
auth
.
views
.
password_reset_done
,
url
(
r'^password_reset_done/$'
,
django
.
contrib
.
auth
.
views
.
password_reset_done
,
name
=
'auth_password_reset_done'
),
name
=
'auth_password_reset_done'
),
url
(
r'^send_feedback$'
,
'util.views.send_feedback'
),
url
(
r'^courseware/$'
,
'courseware.views.index'
),
)
if
settings
.
COURSEWARE_ENABLED
:
urlpatterns
=
urlpatterns
+
(
url
(
r'^wiki/'
,
include
(
'simplewiki.urls'
)),
url
(
r'^courseware/(?P<course>[^/]*)/(?P<chapter>[^/]*)/(?P<section>[^/]*)/$'
,
'courseware.views.index'
),
url
(
r'^courseware/(?P<course>[^/]*)/(?P<chapter>[^/]*)/$'
,
'courseware.views.index'
),
url
(
r'^courseware/(?P<course>[^/]*)/$'
,
'courseware.views.index'
),
url
(
r'^modx/(?P<module>[^/]*)/(?P<id>[^/]*)/(?P<dispatch>[^/]*)$'
,
'courseware.views.modx_dispatch'
),
#reset_problem'),
url
(
r'^profile$'
,
'courseware.views.profile'
),
url
(
r'^change_setting$'
,
'auth.views.change_setting'
),
url
(
r'^s/(?P<template>[^/]*)$'
,
'static_template_view.views.auth_index'
),
url
(
r'^book/(?P<page>[^/]*)$'
,
'staticbook.views.index'
),
url
(
r'^book*$'
,
'staticbook.views.index'
),
# url(r'^course_info/$', 'auth.views.courseinfo'),
# url(r'^show_circuit/(?P<circuit>[^/]*)$', 'circuit.views.show_circuit'),
# url(r'^show_circuit/(?P<circuit>[^/]*)$', 'circuit.views.show_circuit'),
url
(
r'^edit_circuit/(?P<circuit>[^/]*)$'
,
'circuit.views.edit_circuit'
),
url
(
r'^edit_circuit/(?P<circuit>[^/]*)$'
,
'circuit.views.edit_circuit'
),
url
(
r'^save_circuit/(?P<circuit>[^/]*)$'
,
'circuit.views.save_circuit'
),
url
(
r'^save_circuit/(?P<circuit>[^/]*)$'
,
'circuit.views.save_circuit'
),
url
(
r'^calculate$'
,
'util.views.calculate'
),
url
(
r'^calculate$'
,
'util.views.calculate'
),
url
(
r'^send_feedback$'
,
'util.views.send_feedback'
),
)
)
if
settings
.
ASKBOT_ENABLED
:
if
settings
.
ASKBOT_ENABLED
:
...
...
util/views.py
View file @
5b7a59bc
...
@@ -16,7 +16,7 @@ def calculate(request):
...
@@ -16,7 +16,7 @@ def calculate(request):
raise
Http404
raise
Http404
equation
=
request
.
GET
[
'equation'
]
equation
=
request
.
GET
[
'equation'
]
try
:
try
:
result
=
courseware
.
calc
.
evaluator
({},
{},
equation
)
result
=
courseware
.
ca
pa
.
ca
lc
.
evaluator
({},
{},
equation
)
except
:
except
:
return
HttpResponse
(
json
.
dumps
({
'result'
:
'Invalid syntax'
}))
return
HttpResponse
(
json
.
dumps
({
'result'
:
'Invalid syntax'
}))
return
HttpResponse
(
json
.
dumps
({
'result'
:
result
}))
return
HttpResponse
(
json
.
dumps
({
'result'
:
result
}))
...
...
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