Example #1
0
    def GET(self):
        if not isAdmin(session.user):
            raise web.seeother('/admin')

        data = web.input()
        if 'page' in data and 'title' in data and 'code' in data:
            make_new_page(data)
            raise web.seeother('/course_control')

        new_page = new_page_form()
        return render.new_page(new_page, data['page'])
Example #2
0
    def GET(self):
        if not isAdmin(session.user):
            raise web.seeother('/admin_login')

        data = web.input()
        if 'page' in data and 'title' in data and 'code' in data:
            process_edit_page(data)
            raise web.seeother('/course_control')

        edit_page = edit_page_form(data['page'])
        return render.edit_page(edit_page, data['page'])
Example #3
0
    def POST(self): 
        my_signin = admin_signin_form() 

        if not my_signin.validates():
            return render.admin_login(session.user, my_signin)
        else:
            session.user = my_signin['username'].value
            raise web.seeother('/admin')
Example #4
0
    def POST(self): 
        my_signin = signin_form() 

        if not my_signin.validates():
            return render.main(session.user, my_signin)
        else:
            session.user = my_signin['username'].value
            raise web.seeother('/summary')
Example #5
0
    def GET(self):
        data = web.input()

        if 'session' in data:
            session_id = data['session']
            session_file = join('..', 'login', 'SSL', 'sessions', session_id)
            if exists(session_file):
                f = open(session_file, 'r')
                text = f.read().split('\n')
                username = text[0]
                t = int(text[1])

                print "trying to make session with username: "******" time: ", t

                print "current time: ", int(time() * 1000)

                if abs(time() * 1000 - t + (60 * 1000)) < 600000:
                    session.user = username

        raise web.seeother('/magic?page=/summary')
Example #6
0
    def GET(self):
        if not isAdmin(session.user):
            raise web.seeother('/admin_login')
        
        script = """function showHideToggle(id) {
  var obj = document.getElementById("div"+id);
  var obj1 = document.getElementById("sh"+id);
  if (obj.style.display == 'none') {
     obj1.innerHTML = '&#9660;';
    obj.style.display = '';
  } else {
     obj1.innerHTML = '&#9654;';
     obj.style.display = 'none';
  }
}
"""
        js_obj = js(script=script)
        html = (sidebar_css(), js_obj, 
                lesson_layout(content=lesson_content(
                    title="Course Control page",
                    content=getCourseTree(),
                    path=None)))

        return render.course_control(html)
Example #7
0
 def GET(self):
     raise web.seeother('https://inst.eecs.berkeley.edu/~cs61as/fa11/lib')
Example #8
0
 def GET(self):
     raise web.seeother('https://inst.eecs.berkeley.edu/~cs61as/complain')
Example #9
0
 def GET(self):
     raise web.seeother('http://inst.eecs.berkeley.edu/~cs61as/reader/vol2.html')
Example #10
0
 def GET(self):
     raise web.seeother('http://mitpress.mit.edu/sicp/full-text/book/book.html')
Example #11
0
 def GET(self):
     web.debug('[USER] %s logged out' % (session.user))
     session.kill()
     raise web.seeother(main_page)
Example #12
0
 def GET(self):
     raise web.seeother('/magic?page=/summary')
Example #13
0
 def GET(self):
     if not isAdmin(session.user):
         raise web.seeother('not_accessible')
     return render.admin(getAdminPage())
Example #14
0
 def GET(self):
     if not isAdmin(session.user):
         raise web.seeother('/admin_login')
     return render.course_control(getCourseTree())
Example #15
0
 def GET(self):
     if not isAdmin(session.user):
         raise web.seeother('/admin_login')
     return render.admin(getAdminPage())
Example #16
0
 def GET(self):
     my_signin = signin_form()
     session = web.config.get('_session')
     if (isStudent(session.user) or isAdmin(session.user)):
         raise web.seeother('/summary')
     return render.main(session.user, my_signin)