diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index e36bcf4b96..15d50d3ee4 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -35,9 +35,10 @@ from xmodule.modulestore.exceptions import ItemNotFoundError from models import Registration, UserProfile, PendingNameChange, PendingEmailChange, CourseEnrollment from datetime import date +from collections import namedtuple log = logging.getLogger("mitx.student") - +Article = namedtuple('Article', 'title url author image deck publication publish_date') def csrf_token(context): ''' A csrf token that can be included in a form. @@ -84,6 +85,19 @@ def course_from_id(id): course_loc = CourseDescriptor.id_to_location(id) return modulestore().get_item(course_loc) +def press(request): + json_articles = cache.get("student_press_json_articles") + if json_articles == None: + if hasattr(settings, 'RSS_URL'): + content = urllib.urlopen(settings.PRESS_URL).read() + json_articles = json.loads(content) + else: + content = open(settings.PROJECT_ROOT / "templates" / "press.json").read() + json_articles = json.loads(content) + cache.set("student_press_json_articles", json_articles) + articles = [Article(**article) for article in json_articles] + return render_to_response('static_templates/press.html', {'articles': articles}) + @login_required @ensure_csrf_cookie def dashboard(request): diff --git a/lms/envs/common.py b/lms/envs/common.py index 3b005c5dbe..8475cfa9a9 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -105,6 +105,7 @@ LIB_URL = '/static/js/' # BOOK_URL = '/static/book/' BOOK_URL = 'https://mitxstatic.s3.amazonaws.com/book_images/' # For AWS deploys # RSS_URL = r'lms/templates/feed.rss' +# PRESS_URL = r'' RSS_TIMEOUT = 600 # Configuration option for when we want to grab server error pages diff --git a/lms/templates/press.json b/lms/templates/press.json new file mode 100644 index 0000000000..2dc971489b --- /dev/null +++ b/lms/templates/press.json @@ -0,0 +1,146 @@ +[ + { + "title": "Review: MITx's Online Circuit Design and Analysis Course", + "url": "http://spectrum.ieee.org/at-work/education/review-mitxs-online-circuit-design-and-analysis-course", + "author": "Steven J. Frank", + "image": "ieee_logo_178x138.jpeg", + "deck": "This latest experiment in remote learning is not for a casual audience.", + "publication": "IEEE Spectrum", + "publish_date": "July 2012" + }, + { + "title": "More universities sign on to free online course initiative", + "url": "http://www.universityworldnews.com/article.php?story=20120719082235228", + "author": "Alison Moodie", + "image": "univworldnews_logo_178x138.jpeg", + "deck": null, + "publication": "University World News", + "publish_date": "July 19, 2012 Issue No:231" + }, + { + "title": "One Course, 150,000 Students", + "url": "http://nyti.ms/LtlQ5k", + "author": "Tamar Lewin", + "image": "nyt_logo_178x138.jpeg", + "deck": null, + "publication": "The New York Times", + "publish_date": "July 18, 2012" + }, + { + "title": "Lessons learned from MITx's prototype course", + "url": "http://mitne.ws/Mdabcp", + "author": "Larry Hardesty, MIT News Office", + "image": "mit_logo_178x138.jpeg", + "deck": "As the team behind MIT's ambitious online learning program gears up to introduce new courses in the fall, it takes stock of its initial experiences.", + "publication": "MIT News", + "publish_date": "7/16/2012" + }, + { + "title": "Software \"coding\": not just for programmers anymore", + "url": "http://gigaom.com/cloud/everybody-codes/", + "author": "Barb Darrow", + "image": "gigaom_logo_178x138.jpeg", + "deck": null, + "publication": "GigaOM", + "publish_date": "July 16, 2012" + }, + { + "title": "Anant Agarwal believes an online education from MIT and Harvard should be available to all", + "url": "http://b.globe.com/P6XKlB", + "author": "Jon Marcus", + "image": "bostonglobe_logo_178x138.jpeg", + "deck": null, + "publication": "The Boston Globe", + "publish_date": "July 15, 2012" + }, + { + "title": "Online Classes Cut Costs, But Do They Dilute Brands?", + "url": "http://n.pr/Lt5ydM", + "author": "Tovia Smith", + "image": "npr_logo_178x138.jpeg", + "deck": null, + "publication": "NPR", + "publish_date": "July 02, 2012" + }, + { + "title": "Coming Your Way: Free Virtual Courses From Top U.S. Universities", + "url": "http://www.openequalfree.org/coming-your-way-free-virtual-courses-from-top-u-s-universities/13993", + "author": null, + "image": "oef_logo_178x138.jpeg", + "deck": null, + "publication": "Open Equal Free", + "publish_date": "June 29, 2012" + }, + { + "title": "Open Online Courses Are No Substitute for Classroom Learning", + "url": "http://bit.ly/MMEdEX", + "author": "Joshua Kim", + "image": "usnews_logo_178x138.jpeg", + "deck": null, + "publication": "US News", + "publish_date": "June 29, 2012" + }, + { + "title": "Harvard and MIT create edX to offer free video online courses to the world", + "url": "http://huff.to/LBucd3", + "author": "Lucy Sheriff", + "image": "huffpost_logo_178x138.jpeg", + "deck": null, + "publication": "The Huffington Post", + "publish_date": "June 20, 2012" + }, + { + "title": "Top universities put their reputations online", + "url": "http://bbc.in/M5avea", + "author": "Irina Khokhlova", + "image": "bbc_logo_178x138.jpeg", + "deck": null, + "publication": "BBC News", + "publish_date": "June 20, 2012" + }, + { + "title": "MIT receives $1 million to support edX partnership", + "url": "http://mitne.ws/Md5Aaa", + "author": null, + "image": "mit_logo_178x138.jpeg", + "deck": "Institute receives award as part of Gates Foundation efforts to boost postsecondary graduation rates.", + "publication": "MIT News", + "publish_date": "June 19, 2012" + }, + { + "title": "Column: Ivy League education? Online is the new option", + "url": "http://usat.ly/J73NW7", + "author": "Katrina Trinko", + "image": "usa_logo_178x138.jpeg", + "deck": null, + "publication": "USA Today", + "publish_date": "May 15, 2012" + }, + { + "title": "What is edX?", + "url": "http://mitne.ws/PgYhya", + "author": null, + "image": "mit_logo_178x138.jpeg", + "deck": "Answering common questions about MIT and Harvard's new partnership in online education.", + "publication": "MIT News", + "publish_date": "May 02, 2012" + }, + { + "title": "MIT and Harvard announce edX", + "url": "http://mitne.ws/Md5yit", + "author": null, + "image": "mit_logo_178x138.jpeg", + "deck": "Joint partnership builds on MITx and Harvard distance learning; aims to benefit campus-based education and beyond.", + "publication": "MIT News", + "publish_date": "May 02, 2012" + }, + { + "title": "MIT and Harvard launch a 'revolution in education'", + "url": "http://mitne.ws/PgZQvY", + "author": null, + "image": "mit_logo_178x138.jpeg", + "deck": "Online edX courses will open both universities' classrooms to the world while enhancing on-campus learning.", + "publication": "MIT News", + "publish_date": "May 02, 2012" + } +] diff --git a/lms/templates/static_templates/press.html b/lms/templates/static_templates/press.html index 33b9fe045f..6294b346a9 100644 --- a/lms/templates/static_templates/press.html +++ b/lms/templates/static_templates/press.html @@ -5,129 +5,6 @@ <%block name="title">