Example #1
0
def ftournaments():
    with dbapi2.connect(app.config['dsn']) as connection:
        _tourList = dbmanager.getTournaments(connection)
        _sponsorList = dbmanager.getSponsor(connection)
        _channelList = dbmanager.getChannels(connection)
        _info = layoutInfo('Snooker is about having the best offensive play possible.','RONNIE O-SULLIVAN','static/img/players.jpg')
        return render_template('ftournament.html', tournamentList = _tourList, info = _info, sponsorList = _sponsorList, channelList = _channelList)
Example #2
0
def fmatches():
    with dbapi2.connect(app.config['dsn']) as connection:
        _matchList = dbmanager.getMathes(connection)
        _sponsorList = dbmanager.getSponsor(connection)
        _channelList = dbmanager.getChannels(connection)
        _info = layoutInfo('Looking for perfection is the only way.','RONNIE O-SULLIVAN','static/img/players.jpg')
        return render_template('fmatches.html', matchList = _matchList, info = _info, sponsorList = _sponsorList, channelList = _channelList)
Example #3
0
def frecords():
    with dbapi2.connect(app.config['dsn']) as connection:
        _recordList = dbmanager.getRecords(connection)
        _sponsorList = dbmanager.getSponsor(connection)
        _channelList = dbmanager.getChannels(connection)
        _info = layoutInfo('Never mind what others do; do better than yourself.','RONNIE O-SULLIVAN','static/img/players.jpg')
        return render_template('frecords.html', recordList = _recordList, info = _info, sponsorList = _sponsorList, channelList = _channelList)
Example #4
0
def ftickets():
    with dbapi2.connect(app.config['dsn']) as connection:
        _ticketList = dbmanager.getTickets(connection)
        _sponsorList = dbmanager.getSponsor(connection)
        _channelList = dbmanager.getChannels(connection)
        _info = layoutInfo('If you go step by step, with confidence, you can go far.','RONNIE O-SULLIVAN','static/img/players.jpg')
        return render_template('ftickets.html', ticketList = _ticketList, info = _info, sponsorList = _sponsorList, channelList = _channelList)
Example #5
0
def news():
    with dbapi2.connect(app.config['dsn']) as connection:
        _newsList = dbmanager.getNews(connection)
        _sponsorList = dbmanager.getSponsor(connection)
        _channelList = dbmanager.getChannels(connection)
        _info = layoutInfo('All about Snooker','Daily News for Snooker','static/img/home-bg.jpg')
        return render_template('fnews.html', newsList = _newsList, info = _info, sponsorList = _sponsorList, channelList = _channelList)
Example #6
0
def fplayers():
    with dbapi2.connect(app.config['dsn']) as connection:
        _playerList = dbmanager.getPlayers(connection)
        _sponsorList = dbmanager.getSponsor(connection)
        _channelList = dbmanager.getChannels(connection)
        _info = layoutInfo('The game of snooker has been everything to me.','RONNIE O-SULLIVAN','static/img/players.jpg')
        return render_template('fplayers.html', playerList = _playerList, info = _info, sponsorList = _sponsorList, channelList = _channelList)
Example #7
0
def newsDetail(newsid):
    with dbapi2.connect(app.config['dsn']) as connection:
        _news = dbmanager.getNewsWithID(newsid,connection)
        _sponsorList = dbmanager.getSponsor(connection)
        _channelList = dbmanager.getChannels(connection)
        _info = layoutInfo(_news.getTitle(),'',_news.getImageUrl())
        _comments = dbmanager.getComments(newsid,connection)
        return render_template('/fnews_detail.html',news = _news, info = _info, commentList = _comments, sponsorList = _sponsorList, channelList = _channelList)
Example #8
0
def login():
    with dbapi2.connect(app.config['dsn']) as connection:
        if(request.method == 'GET'):
            _info = layoutInfo('All about Snooker','Daily News for Snooker','static/img/home-bg.jpg')
            _advertiseList = dbmanager.getAdvertises(connection)
            if(session.get('loginStatus') == 'WrongPass'):
                _info = layoutInfo('All about Snooker','But you Enter Wrong Username or Password!!','static/img/home-bg.jpg')
            if(session.get('loginStatus') == 'SameUsername'):
                _info = layoutInfo('All about Snooker','But Username is used by Another User!!','static/img/home-bg.jpg')

            return render_template('login.html', info = _info,advertiseList=_advertiseList)

        if(request.form["action"] == "Log In"):
            user = dbmanager.checkUserLogin(request.form['username'], request.form['password'], connection)
            if user is not None:
                session['loggedUser'] = user.Username
                session['loggedUserID'] = user.getID()
                session['loginStatus'] = 'OK'
                if(user.getAccountType() == 'King'):
                    session['loginStatus'] = 'King'
                    return redirect(url_for('adminPage'))
                else:
                    session['loginStatus'] = 'Normal'
                    return redirect(url_for('home'))
            else:
                session['loggedUser'] = '******'
                session['loggedUserID'] = ' '
                session['loginStatus'] = 'WrongPass'
                return redirect(url_for('login'))

        if(request.form["action"] == "Register"):
            result = dbmanager.addUser(request.form['firstname'],request.form['lastname'], request.form['age'],request.form['gender'],request.form['email'],request.form['username'],request.form['password'],connection)
            session['loggedUser'] = '******'
            session['loggedUserID'] = ' '
            session['loginStatus'] = result
            if(result != 'OK'):
                return redirect(url_for('login'))
            return redirect(url_for('home'))