Exemplo n.º 1
0
def page_additions():
	import scripts.functions as f

	if not f.user_logged_in():
		g.g_notification_title = 'Permission denied'
		g.g_notification_msg = 'You have no permission to access this page. ' \
							   'Please <a href="' +g.g_root_path + '/index.py' + '">sign in</a> first.'

		f.redirect(g.g_root_path + '/index.py?page=notification')
		return

	# Styles and Scripts additions here

	# Location additions here

	#### head_title Location addition
	#prof_name = g.g_user.getFirstName() + " " + g.g_user.getLastName()
	#g.g_locations.addToLocation('head_title', p.Printable(prof_name))
	
	g.g_locations.addToLocation('head_title', p.Printable(get_title()))

	#Default changes here
	content_list = g.g_locations.getContentsAtLocation('main_nav')
	if not content_list is None and len(content_list) is 1:
		main_nav = content_list[0]
		main_nav.setAsActive('home')

	g.g_header.getStyleAdder().add('profile')

	profdetails = 'USER NAME: ' + g.g_user.getFirstName() + ' ' + g.g_user.getLastName()

	g.g_locations.addToLocation('right_content', p.Printable(profdetails))
Exemplo n.º 2
0
def index(req):
    import os, sys
    import scripts.third_party_modules.simplejson.simplejson as json

    main_path = os.path.dirname(__file__)
    sys.path.append(main_path)

    import scripts.global_variables as g
    import scripts.functions as functions
    import scripts.ajax_functions as ajax_functions

    g.g_root_path = 'http://localhost/spam'
    g.g_main_path = main_path

    function_name = req.form.getfirst('action')

    g.g_req = req
    g.g_user = functions.create_user()

    try:
        if function_name is None:
            raise Exception
        try:
            if functions.user_logged_in():
                return getattr(ajax_functions, 'spam_in_' + function_name)()
            raise AttributeError
        except AttributeError:
            return getattr(ajax_functions, 'spam_out_' + function_name)()
    except Exception:
        return json.dumps({'status': 'FAILED', 'msg': 'Invalid action.'})
Exemplo n.º 3
0
def index(req):
	import os,sys
	import scripts.third_party_modules.simplejson.simplejson as json

	main_path = os.path.dirname(__file__)
	sys.path.append(main_path)

	import scripts.global_variables as g
	import scripts.functions as functions
	import scripts.ajax_functions as ajax_functions

	g.g_root_path = 'http://localhost/spam'
	g.g_main_path = main_path

	function_name = req.form.getfirst('action')

	g.g_req = req
	g.g_user = functions.create_user()

	try:
		if function_name is None:
			raise Exception
		try:
			if functions.user_logged_in():
				return getattr(ajax_functions, 'spam_in_' + function_name)()
			raise AttributeError
		except AttributeError:
				return getattr(ajax_functions, 'spam_out_' + function_name)()
	except Exception:
		return json.dumps({'status': 'FAILED', 'msg': 'Invalid action.'})
def page_additions():
	if not f.user_logged_in() or g.g_user.getType() != 'Professor':
		if g.g_ajax_req:
			return

		g.g_notification_title = 'Permission denied'
		g.g_notification_msg = 'You have no permission to access this page. ' \
							   'Please <a href="' +g.g_root_path + '/index.py' + '">sign in</a> first.'

		f.redirect(g.g_root_path + '/index.py?page=notification')
		return

	# Styles and Scripts additions here
	g.g_header.getStyleAdder().add('profmanagesched')
	g.g_header.getScriptAdder().add('sprintf')
	g.g_header.getScriptAdder().add('profmanagesched')

	# Location additions here

	#### head_title Location addition
	#prof_name = g.g_user.getFirstName() + " " + g.g_user.getLastName()
	#g.g_locations.addToLocation('head_title', p.Printable(prof_name))

	g.g_locations.addToLocation('head_title', p.Printable(g.g_content.getTitle()))

	# Default changes here
	content_list = g.g_locations.getContentsAtLocation('main_nav')
	if not content_list is None and len(content_list) is 1:
		main_nav = content_list[0]
		main_nav.addMenuItem('profmanagesched', 'Manage Schedules', g.g_root_path + '/index.py?page=profmanagesched')
		main_nav.setAsActive('profmanagesched')

	## right_content location additions
	g.g_locations.addToLocation('right_content', p.Printable('<div id="schedule-adder"><h4 class="sub-title">Schedule Adder</h4>'), 1)
	g.g_locations.addToLocation('right_content', form.get_form(), 2)
	g.g_locations.addToLocation('right_content', p.Printable('</div>'), 3)

	schedule_div = """<div style="margin-left:8px; margin-top:20px;" id="schedules" class="panel panel-default">
							<div class="panel-heading"><b>Schedules</b></div>
							<div class="panel-body">
					"""

	schedule_div += """<table class="table table-hover">
								<thead>
									<tr>
										<th class="day">Day</th>
										<th class="from-time">From Time</th>
										<th class="to-time">To Time</th>
										<th>Action</th>
									</tr>
								</thead>
							<tbody id="sched-list" data-link="row" class="rowlink">
					"""


	schedule_div += '</tbody></table>'

	schedule_div += '</div></div>'
	g.g_locations.addToLocation('right_content', p.Printable(schedule_div))
def page_additions():
	import scripts.functions as f
	#user_type = g.g_user.getType()

	if not f.user_logged_in():
		g.g_notification_title = 'Permission denied'
		g.g_notification_msg = 'You have no permission to access this page. ' \
							   'Please <a href="' +g.g_root_path + '/index.py' + '">sign in</a> first.'

		f.redirect(g.g_root_path + '/index.py?page=notification')
		return

	if g.g_user.getType() == 'Professor':
		name_head = 'Student Name'
	else:
		name_head = 'Professor Name'

	rc_statement = '<span style="font-weight:bold;">&nbsp;&nbsp;&nbsp;Manage your appointments here!<br></br></span>'
	rc_content = """<div id = "btn-gen" "style="margin-left:15px; margin-top:10px;">
						<button id="btn-pending" type="button" class='button'>Pending</button>
						<button id="btn-approved" type="button" class='button'>Approved</button>
					</div>
					<div style="margin-left:8px; margin-top:20px;" class="panel panel-default">
						<div class="panel-heading" id = "appt-stat" style = "font-weight: bold;"></div>
						<div class="panel-body">
							<table id = "appt-table" class="table table-hover">
								<thead>
									<tr>
										<th>""" + name_head + """</th>
										<th>Requested Time</th>
										<th>Requested Date</th>
										<th>Details</th>
									</tr>
					  		    </thead>
					  		    <tbody id="apptlist" data-link="row" class="rowlink"></tbody>
							</table>
						</div>
					</div>
					<div id = "btn-page" style="margin-left:15px; margin-top:10px;">
						<button id="btn-prev" type="button" class="btn btn-primary btn-large">Previous</button>
						<button id="btn-next" type="button" class="btn btn-primary btn-large">Next</button>
						<span id="page" style="color:black; font-weight:bold;">Page 1</span>
					</div>
					"""

	g.g_header.getScriptAdder().add('profstudmanageappt')
	g.g_header.getStyleAdder().add('profile')
	g.g_header.getStyleAdder().add('button')
	g.g_locations.addToLocation('head_title', p.Printable("Appointments - " + g.g_user.getFirstName()))
	g.g_locations.addToLocation('right_content', p.Printable(rc_statement))
	g.g_locations.addToLocation('right_content', p.Printable(rc_content))

	content_list = g.g_locations.getContentsAtLocation('main_nav')
	if content_list and len(content_list) is 1:
		main_nav = content_list[0]
		main_nav.setAsActive('appointments')
Exemplo n.º 6
0
def page_additions():
	if not f.user_logged_in() or g.g_user.getType() != 'Student':
		g.g_notification_title = 'Permission denied'
		g.g_notification_msg = 'You have no permission to access this page. ' \
		'Please <a href="' + g.g_root_path + '/index.py' + '">sign in</a> first.'

		f.redirect(g.g_root_path + '/index.py?page=notification')
		return

	rc_statement = '<span style="font-weight:bold;">&nbsp;&nbsp;&nbsp;Find your professor and make an appointment!</span>'
	rc_content = """
					<div style="width:50%; margin-left:8px; margin-top:30px;" class="input-group">
						<input id="input-search" style="font-weight:bold;" type="text" class="" placeholder="Professor Name">
    						<button id="btn-search" type="button" class='button'>Search</button>
					</div>
					<div style="margin-left:8px; margin-top:20px;" class="panel panel-default">
						<div class="panel-heading"><b>Professors</b></div>
						<div class="panel-body">
							<table class="table table-hover">
								<thead>
									<tr>
										<th>Name</th>
										<th>Department</th>
										<th>College</th>
									</tr>
						  		</thead>
						  		<tbody id="proflist" data-link="row" class="rowlink"></tbody>
							</table>
						</div>
					</div>
					<div style="margin-left:15px; margin-top:10px;">
						<button id="btn-prev" type="button" class='button'>Previous</button>
						<button id="btn-next" type="button" class='button'>Next</button>
						<span id="page" style="color:black; font-weight:bold;">Page 1</span>
					</div>
				"""
	content_list = g.g_locations.getContentsAtLocation('main_nav')

	if not content_list is None and len(content_list) is 1:
		main_nav = content_list[0]
		main_nav.addMenuItem('studhome', 'Home', g.g_root_path + '/index.py?page=studhome')
		main_nav.setAsActive('studhome')

	g.g_header.getScriptAdder().add('proflist')
	g.g_header.getScriptAdder().add('zabuto_calendar.min')

	g.g_header.getStyleAdder().add('profile')
	g.g_header.getStyleAdder().add('button')
	g.g_header.getStyleAdder().add('zabuto_calendar.min')

	g.g_locations.addToLocation('head_title', p.Printable("Home - " + g.g_user.getFirstName()))
	g.g_locations.addToLocation('right_content', p.Printable(rc_statement))
	g.g_locations.addToLocation('right_content', p.Printable(rc_content))
Exemplo n.º 7
0
def page_additions():
    if not f.user_logged_in():

        g.g_notification_title = 'Permission denied'
        g.g_notification_msg = 'You have no permission to access this page. ' \
        'Please <a href="' + g.g_root_path + '/index.py' + '">sign in</a> first.'

        f.redirect(g.g_root_path + '/index.py?page=notification')
        return

    rc_statement = '<span style="font-weight:bold;">&nbsp;&nbsp;&nbsp;Find your professor and make an appointment!</span>'
    rc_content = """
					<div style="width:50%; margin-left:8px; margin-top:30px;" class="input-group">
						<input id="input-search" style="font-weight:bold;" type="text" class="form-control" placeholder="Professor Name">
  						<div class="input-group-btn">
    						<button id="btn-search" type="button" class="btn btn-primary btn-large">Search</button>
  						</div>
					</div>
					<div style="margin-left:8px; margin-top:20px;" class="panel panel-default">
						<div class="panel-heading"><b>Professors</b></div>
						<div class="panel-body">
							<table class="table table-hover">
								<thead>
									<tr>
										<th>Name</th>
										<th>Department</th>
										<th>College</th>
									</tr>
						  		</thead>
						  		<tbody id="proflist" data-link="row" class="rowlink"></tbody>
							</table>
						</div>
					</div>
					<div style="margin-left:15px; margin-top:10px;">
						<button id="btn-prev" type="button" class="btn btn-primary btn-large">Previous</button>
						<button id="btn-next" type="button" class="btn btn-primary btn-large">Next</button>
						<span id="page" style="color:black; font-weight:bold;">Page 1</span>
					</div>
				"""
    content_list = g.g_locations.getContentsAtLocation('main_nav')

    if not content_list is None and len(content_list) is 1:
        main_nav = content_list[0]
        main_nav.addMenuItem('studhome', 'Home',
                             g.g_root_path + '/index.py?page=studhome')
        main_nav.setAsActive('studhome')

    g.g_header.getScriptAdder().add('proflist')
    g.g_header.getStyleAdder().add('profile')
    g.g_locations.addToLocation('head_title',
                                p.Printable("Home-" + g.g_user.getFirstName()))
    g.g_locations.addToLocation('right_content', p.Printable(rc_statement))
    g.g_locations.addToLocation('right_content', p.Printable(rc_content))
def page_additions():
    import scripts.functions as f

    if not f.user_logged_in():
        g.g_notification_title = 'Permission denied'
        g.g_notification_msg = 'You have no permission to access this page. ' \
                'Please <a href="' +g.g_root_path + '/index.py' + '">sign in</a> first.'

        f.redirect(g.g_root_path + '/index.py?page=notification')
        return

    rc_statement = '<span style="font-weight:bold;">&nbsp;&nbsp;&nbsp;Manage your appointments here!<br></br></span>'
    rc_content = """<div style="margin-left:15px; margin-top:10px;">
						<button id="btn-approved" type="button" class="btn btn-primary btn-large">Approved</button>
						<button id="btn-pending" type="button" class="btn btn-primary btn-large">Pending</button>
						<button id="btn-declined" type="button" class="btn btn-primary btn-large">Declined</button>
					</div>
					<div style="margin-left:8px; margin-top:20px;" class="panel panel-default">
						<div class="panel-heading" id = "appt-stat" style = "font-weight: bold;"></div>
						<div class="panel-body">
							<table id = "appt-table" class="table table-hover">
								<thead>
									<tr>
										<th>Professor</th>
										<th>Schedule ID</th>
										<th>Appointment Date</th>
										<th>Concern</th>
										<th>Options</th>
									</tr>
					  		    </thead>
					  		    <tbody id="apptlist" data-link="row" class="rowlink"></tbody>
							</table>
						</div>
					</div>
					<div style="margin-left:15px; margin-top:10px;">
						<button id="btn-prev" type="button" class="btn btn-primary btn-large">Previous</button>
						<button id="btn-next" type="button" class="btn btn-primary btn-large">Next</button>
						<span id="page" style="color:black; font-weight:bold;">Page 1</span>
					</div>
					"""

    g.g_header.getScriptAdder().add('studmanageappt')
    g.g_header.getStyleAdder().add('profile')
    g.g_locations.addToLocation(
        'head_title', p.Printable("Appointments - " + g.g_user.getFirstName()))
    g.g_locations.addToLocation('right_content', p.Printable(rc_statement))
    g.g_locations.addToLocation('right_content', p.Printable(rc_content))

    content_list = g.g_locations.getContentsAtLocation('main_nav')
    if len(content_list) is 1:
        main_nav = content_list[0]
        main_nav.setAsActive('appointments')
def page_additions():
	import scripts.functions as f

	if f.user_logged_in():
		if g.g_user.getType() == 'Student':
			f.redirect(g.g_root_path + '/index.py?page=studhome')
		else:
			f.redirect(g.g_root_path + '/index.py?page=profmanagesched')

	#===== Styles and Javascripts
	g.g_header.getStyleAdder().add('signin')
	g.g_header.getScriptAdder().add('login')

	#===== Contents Additions
	g.g_locations.addToLocation('main_content', login_form.get_form())
	g.g_locations.addToLocation('title', p.Printable('Welcome to S.P.A.M'))
	g.g_locations.addToLocation('sub_title', p.Printable('Where Teachers and Students Collaborate Appointments'))

	#===== Defaults location addition
	g.g_locations.addToLocation('head_title', p.Printable(get_title()))
Exemplo n.º 10
0
def page_additions():
    import scripts.functions as f

    if f.user_logged_in():
        if g.g_user.getType() == 'student':
            f.redirect(g.g_root_path + '/index.py?page=studhome')
        else:
            f.redirect(g.g_root_path + '/index.py?page=profhome')

    #===== Styles and Javascripts
    g.g_header.getStyleAdder().add('signin')
    g.g_header.getScriptAdder().add('login')

    #===== Contents Additions
    g.g_locations.addToLocation('main_content', login_form.get_form())
    g.g_locations.addToLocation('title', p.Printable('Welcome to S.P.A.M'))
    g.g_locations.addToLocation(
        'sub_title',
        p.Printable('Where Teachers and Students Collaborate Appointments'))

    #===== Defaults location addition
    g.g_locations.addToLocation('head_title', p.Printable(get_title()))
def page_additions():
	import scripts.functions as f

	if not f.user_logged_in():
		g.g_notification_title = 'Permission denied'
		g.g_notification_msg = 'You have no permission to access this page. ' \
							   'Please <a href="' +g.g_root_path + '/index.py' + '">sign in</a> first.'

		f.redirect(g.g_root_path + '/index.py?page=notification')
		return

	g.g_header.getScriptAdder().add('zabuto_calendar.min')
	g.g_header.getScriptAdder().add('profstudcalendar')

	g.g_header.getStyleAdder().add('zabuto_calendar.min')
	g.g_header.getStyleAdder().add('profstudcalendar')

	content_list = g.g_locations.getContentsAtLocation('main_nav')
	if content_list and len(content_list) is 1:
		main_nav = content_list[0]
		main_nav.setAsActive('appointments')

	g.g_locations.addToLocation('right_content', p.Printable('<div id="prof-stud-cal"></div>'))