def helpsettings():
    global reminderlist
    if request.method == "GET":
        if session.has_key("user") and session["user"] != "":
            tmp = util.getCurrentTime(session["user"])
            time = tmp.split(":")
            if "am" in time[1]:
                amorpm = "am"
            else:
                amorpm = "pm"
            hour = time[0]
            minute = time[1][:-2]
            tmpone = util.getStatus(session["user"])
            return render_template(
                "helpsettings.html",
                minutes=minutelist,
                hourselected=int(hour),
                minuteselected=minute,
                ampm=amorpm,
                enabled=tmpone,
            )
    else:
        if request.form.has_key("Back"):
            return redirect(url_for("calendar", year=int(util.thisYear()), month=util.thisMonth()))
        if request.form.has_key("Submit"):
            hour = request.form["hourselector"]
            minute = request.form["minuteselector"]
            amorpm = request.form["ampmselect"]
            reminders = request.form["enabledselect"]
            hour = str(hour)
            if int(hour) < 10:
                hour = "0" + hour
            newtime = hour + ":" + minute + amorpm
            util.setTime(util.getUserNumber(session["user"]), newtime)
            currentEnabled = util.getStatus(session["user"])
            if currentEnabled == True and reminders == "dis":
                util.changeStatus(util.getUserNumber(session["user"]))
            if currentEnabled == False and reminders == "en":
                util.changeStatus(util.getUserNumber(session["user"]))
            reminderlist = util.getReminderTimes()
            if threading.activeCount() > 1:
                threading.enumerate()[1].cancel()
            remindersHandler(True, 0)
            return redirect(url_for("helpsettings"))
Example #2
0
def helpsettings():
    global reminderlist
    if request.method =='GET':
        if session.has_key('user') and session['user'] != '':
            tmp = util.getCurrentTime(session['user'])
            time = tmp.split(':')
            if 'am' in time[1]:
                amorpm = 'am'
            else:
                amorpm = 'pm'
            hour = time[0]
            minute = time[1][:-2]
            tmpone = util.getStatus(session['user'])
            return render_template('helpsettings.html',minutes=minutelist,hourselected=int(hour),minuteselected=minute,ampm=amorpm,enabled=tmpone)
    else:
        if request.form.has_key('Back'):
            return redirect(url_for('calendar',year=int(util.thisYear()),month=util.thisMonth()))
        if request.form.has_key('Submit'):
            hour = request.form['hourselector']
            minute = request.form['minuteselector']
            amorpm = request.form['ampmselect']
            reminders = request.form['enabledselect']
            hour = str(hour)
            if int(hour) < 10:
                hour = "0" + hour
            newtime = hour+":"+minute+amorpm
            util.setTime(util.getUserNumber(session['user']),newtime)
            currentEnabled = util.getStatus(session['user'])
            if currentEnabled == True and reminders == 'dis':
                util.changeStatus(util.getUserNumber(session['user']))
            if currentEnabled == False and reminders == 'en':
                util.changeStatus(util.getUserNumber(session['user']))
            reminderlist = util.getReminderTimes()
            if threading.activeCount() > 1:
                threading.enumerate()[1].cancel()
            remindersHandler(True,0)
            return redirect(url_for('helpsettings'))
Example #3
0
def login():
    if request.method=='GET':
        return render_template('login1.html')
    else:
        if request.form.has_key('login'):
            user = str(request.form['user'])
            password = str(request.form['pass'])
            if user in util.getUsernames():
                if password == util.checkPassword(user):
                    session['user'] = user
                    return redirect(url_for('calendar',year=int(util.thisYear()),month=util.thisMonth()))
            return render_template('login2.html')
        if request.form.has_key('newuser'):
            return redirect(url_for('newuser'))
def login():
    if request.method == "GET":
        return render_template("login1.html")
    else:
        if request.form.has_key("login"):
            user = str(request.form["user"])
            password = str(request.form["pass"])
            if user in util.getUsernames():
                if password == util.checkPassword(user):
                    session["user"] = user
                    return redirect(url_for("calendar", year=int(util.thisYear()), month=util.thisMonth()))
            return render_template("login2.html")
        if request.form.has_key("newuser"):
            return redirect(url_for("newuser"))