예제 #1
0
        else:
            #### HTML Start ####
            main.html_start(self)
            
            ### Head Start ###
            main.head_start(self)
            main.style_print(self, 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css')
            main.title_set(self, 'Mu Alpha Theta – Tutoring Log – Student')
            
            main.head(self) #Common
            main.script_print(self, 'index') #Specific
            
            main.head_end(self)
            ### Head End ###
            
            ### Body Start ###
            main.body_start(self)
            
            ## Header ##
            main.html_print(self, 'header', Configuration.get_instance().title, "", "");
            ## Content ##
            main.html_print(self, 'index', Configuration.get_instance().text_student, users.create_login_url("/student"), Configuration.get_instance().text_member, users.create_login_url("/member"))
            
            main.body_end(self)
            ### Body End ###
            
            main.html_end(self)
            #### HTML End ####

app = webapp2.WSGIApplication([('/', Index)], debug=main.is_debug())
예제 #2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import webapp2
from framework import main
from data.tutee import Tutee  # @UnusedImport for GqlQuery to detect Tutee dataclass.
from data.tutor import Tutor  # @UnusedImport for GqlQuery to detect Tutee dataclass.
from google.appengine.api import users

class Student(webapp2.RequestHandler):
    def get(self):
        self.response.out.write('Sorry, only ' + main.restricted_domain() + ' accounts are allowed. <a href = "' + users.create_logout_url("/") + '">Log out</a>')

app = webapp2.WSGIApplication([('/restricted', Student)], debug=main.is_debug())
예제 #3
0
        main.script_print(self, "http://cdnjs.cloudflare.com/ajax/libs/list.js/1.1.1/list.min.js")
        main.script_print(self, "admin")  # Specific

        main.head_end(self)
        ## Head End ##

        ## Body Start ##
        main.body_start(self)

        ## Header ##
        main.html_print(
            self,
            "header",
            Configuration.get_instance().title,
            main.other_pages_html(True, True, False),
            main.logout_html(),
        )

        ## Content ##

        main.html_print(self, "admin")

        main.body_end(self)
        ## Body End ##

        main.html_end(self)
        ### Page End ###


app = webapp2.WSGIApplication([("/admin", Admin)], debug=is_debug())
예제 #4
0
            
        session.put()
#         self.response.out.write("Session object: " + str(vars(session)))
        self.response.out.write("Your session has been logged. Your tutor will receive a confirmation email.")


        message = mail.EmailMessage()
        if not mail.is_email_valid(session.tutor_email):
            self.response.out.write('<br/>Note, an automatic email to your tutor could not be sent. Please report this error.')
            return;

        message.sender = 'Math Tutor <*****@*****.**>'
        message.to = session.tutor_first + ' ' + session.tutor_last +' <' + session.tutor_email + '>'
        message.subject = 'Tutoring Session Logged'
        message.body = """
Hi %s,

%s has just logged your tutoring session.

Details:
Date: %s
Minutes: %d
Subject: %s

To view your complete log, visit tutoringlog.com
        """ % (session.tutor_first, session.tutee_name, session.date_tutored.strftime('%m/%d/%Y'), session.minutes, session.subject)

        message.send()

app = webapp2.WSGIApplication([('/submit', Submit)], debug=is_debug())
예제 #5
0
            q.order("date_tutored")
            compiled = {}
            for p in q.run(limit=2000):
                session_dict = p.to_dict()
                for k in session_dict.keys():
                    if not k in compiled:
                        compiled[k] = []
                    compiled[k].append(session_dict[k])
            data = json.dumps(compiled)
            memcache.add(key=key, value=data, time=300)  #5 minutes per student
        return data

    @staticmethod
    def sessionDataJSON(which, email, should_reload=False):
        key = which + '_data_' + email
        data = memcache.get(key)
        if data is None or should_reload:
            print 'Reloading "' + key + '"'
            query = TutoringSession.all()
            query.filter(which + '_email', email)
            query.order("date_tutored")
            sessions = []
            for session in query.run(batch_size=2000):
                sessions.append(session.to_list())
            data = json.dumps(sessions)
            memcache.add(key=key, value=data, time=300)  #5 minutes per student
        return data


app = webapp2.WSGIApplication([('/request', Request)], debug=is_debug())
예제 #6
0
        main.script_print(self, 'datepicker')
        
        main.script_print(self, 'student') #Specific
        
        main.head_end(self)
        ## Head End ##
        
        ## Body Start ##
        main.body_start(self)
        
        ## Header ##
        main.html_print(self, 'header', Configuration.get_instance().title, main.other_pages_html(False, member, users.is_current_user_admin()), main.logout_html());
        
        ## Content ##
        
        #See if name is stored in database
        q = db.GqlQuery("SELECT * FROM Tutee WHERE email = '" + users.get_current_user().email() + "'")
        result = q.get()
        if result == None:
            main.html_print(self, 'student', "")
        else:
            main.html_print(self, 'student', result.name)
        
        main.body_end(self)
        ## Body End ##
        
        main.html_end(self)
        ### Page End ###

app = webapp2.WSGIApplication([('/student', Student)], debug=main.is_debug())
예제 #7
0
            q.order("date_tutored")
            compiled = {}
            for p in q.run(limit=2000):
                session_dict = p.to_dict()
                for k in session_dict.keys():
                    if not k in compiled:
                        compiled[k] = []
                    compiled[k].append(session_dict[k])
            data = json.dumps(compiled)
            memcache.add(key=key, value=data, time=300) #5 minutes per student
        return data
    
    @staticmethod
    def sessionDataJSON(which, email, should_reload=False):
        key = which + '_data_' + email
        data = memcache.get(key)
        if data is None or should_reload:
            print 'Reloading "' + key + '"'
            query = TutoringSession.all()
            query.filter(which + '_email', email)
            query.order("date_tutored")
            sessions = []
            for session in query.run(batch_size=2000):
                sessions.append(session.to_list())
            data = json.dumps(sessions)
            memcache.add(key=key, value=data, time=300) #5 minutes per student
        return data
    
    
app = webapp2.WSGIApplication([('/request', Request)], debug=is_debug())
예제 #8
0
        datastring = ''
        qdata = db.GqlQuery("SELECT * FROM TutoringSession WHERE tutor_email = '" + users.get_current_user().email() + "' ORDER BY date_tutored DESC")
        for session in qdata.run(limit=2000):
            datastring += """
            <tr>
                <td class="name">%s</td>
                <td class="email"><a class = "mailto-link" href = "mailto:%s">%s</a></td>
                <td class="date" title = "Logged %s">%s</td>
                <td class="subject">%s</td>
                <td class="minutes">%d</td>
            </tr>
            """ % (session.tutee_name, session.tutee_email, session.tutee_email, session.date_logged.strftime("%Y-%m-%d %H:%M:%S"), session.date_tutored.strftime("%m/%d/%Y"), session.subject, session.minutes)
            
        message = ''
        if not member and not users.is_current_user_admin():
            message = 'Error... could not locate club member data for your email "' + users.get_current_user().email() + '"'
        elif member:
            message = 'Welcome. Displaying log data for <i>' + member.first + ' ' + member.last + '</i> (' + users.get_current_user().email() + ')'
        else:
            message = 'Welcome. You are not a club member but are an administrator, there is nothing to see on this page. See the <a href = "/admin">administrator page</a>. For information.'
        
        main.html_print(self, 'member', message, datastring)
        
        main.body_end(self)
        ## Body End ##
        
        main.html_end(self)
        ### Page End ###

app = webapp2.WSGIApplication([('/member', Member)], debug=is_debug())