Beispiel #1
0
    def get(self):
        if not main.is_valid_user():
            self.redirect('/restricted')
            return

        
        member = main.club_member()
        ### Page Start ###
        main.html_start(self)
        
        ## Head Start ##
        main.head_start(self)
        main.title_set(self, 'Mu Alpha Theta – Tutoring Log – Student')
        
        main.style_print(self, 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css')
        main.style_print(self, 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css')
        main.style_print(self, 'datepicker')
        
        main.head(self) #Common
         
        main.script_print(self, 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js')
        main.script_print(self, 'jquery.numeric.min')
        main.script_print(self, 'jquery.simplemodal.min')
        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)
Beispiel #2
0
    def get(self):
        if not main.is_valid_user():
            self.redirect("/restricted")
            return

        if not users.is_current_user_admin():
            self.redirect("/student")
            return

        ### Page Start ###
        main.html_start(self)

        ## Head Start ##
        main.head_start(self)
        main.title_set(self, "Mu Alpha Theta – Tutoring Log – Administrator")

        main.style_print(self, "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css")
        main.style_print(self, "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css")
        main.style_print(self, "admin")

        main.head(self)  # Common

        main.script_print(self, "jquery.simplemodal.min")
        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)
Beispiel #3
0
 def get(self):
     user = users.get_current_user()
     if user:
         #Automatically redirect to the appropriate page if already logged in.
         q = db.GqlQuery("SELECT * FROM Tutor WHERE email = '" + user.email() + "'")
         
         if q.count() > 0:
             self.redirect('/member')
         else:
             self.redirect('/student')
     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)
Beispiel #4
0
 def get(self):
     if not main.is_valid_user():
         self.redirect('/restricted')
         return
         
     member = main.club_member()
     
     #Automatically redirect to the student page if they are not a club member
     if not member and not users.is_current_user_admin():
         self.redirect('/student')
         return;
     if not member and users.is_current_user_admin():
         self.redirect('/admin')
         return;
     
     ### Page Start ###
     main.html_start(self)
     
     ## Head Start ##
     main.head_start(self)
     main.title_set(self, 'Mu Alpha Theta – Tutoring Log – Member')
     
     main.style_print(self, 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css')
     main.style_print(self, 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css')
     main.style_print(self, 'member')
     
     main.head(self) #Common
     
     main.script_print(self, 'jquery.simplemodal.min')
     main.script_print(self, 'http://cdnjs.cloudflare.com/ajax/libs/list.js/1.1.1/list.min.js')
     main.script_print(self, 'member') #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, False, users.is_current_user_admin()), main.logout_html());
     
     ## Content ##
     
     #Retrieve data
     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)