예제 #1
0
파일: about.py 프로젝트: bhesh/SecretSanta
            sshttp.build_redirect_uri('/getacc.py',
                                      '/groupctl.py?creategroup=1'))
    else:
        DATA += """<p align="center"><br/><button><a href="/register.py">Register Now</a></button></p>
			<p class="footnote">Website designed by Brian Hession</p>"""
    ASIDE = """ <h2>What is it?</h2>
	<p>Secret santa registration and group planner.</p>
	<h2 style="margin-top: 15px;">How does it work?</h2>
	<p>Register now and invite your friends!</p> """
    MOBILE = '<p align="center"><br/><button><a href="/register.py">Register Now</a></button></p>'
    if loggedin:
        ASIDE = """<h2>What is it?</h2>
			<p>Secret santa registration and group planner.</p>
			<h2 style="margin-top: 15px;">How does it work?</h2>
			<p>Create a group now and invite your friends!</p>"""
        MOBILE = '<p align="center"><br/><button><a href="{}">Create a Group Now</a></button></p>'.format(
            sshttp.build_redirect_uri('/getacc.py',
                                      '/groupctl.py?creategroup=1'))

    replace = {
        'desktopNavLinks': sshtml.buildDesktopNavLinks('About'),
        'navLinks': sshtml.buildNavLinks('About'),
        'accountLinks': sshtml.buildAccountLinks(loggedin),
        'body': sshtml.buildBody(data=DATA, aside=ASIDE, mobile=MOBILE)
    }
    sshttp.send200(sshtml.buildContainerPage(replace))
except:
    sshttp.senderror(500)
    import sys, traceback
    traceback.print_exc(file=sys.stderr)
예제 #2
0
파일: ssctl.py 프로젝트: bhesh/SecretSanta
	if sessions.session_is_valid():
		if 'gid' in args:

			# Make resources
			gid = args.getvalue('gid')
			uid = userstable.USERS_SCHEMA.get(sessions.get_user(), 'id')
			usersdb = userstable.SSUsers(DATABASE)
			groupsdb = groupstable.SSGroups(DATABASE)

			# Build html
			if sshttp.is_get():

				# Verify permissions
				level = groupsdb.get_membership_level(gid, uid)
				if level == None or level < groupstable.MOD:
					sshttp.senderror(403)

				# All good
				else:
					DATA = """<div class="secretsanta">
							<h1>Secret Santa</h1>
							<p>Please assign any rules you may need.</p>
							{error}
							<form id="ruleList" action="/ssctl.py" method="post" class="rulelist">
								<input type="hidden" name="gid" value="{gid}"/>
							</form>
							<form id="ruleMaker">
								<select id="userList1">
									{userlist}
								</select>
								<select id="matchType">