Exemple #1
0
def change_state(id):
    task = Task.get_task_list(scheduler)[id]
    # print(task.id)
    if task.enabled:
        task.disable(scheduler)
    else:
        task.enable(scheduler)
    return redirect(url_for('meetings'))
Exemple #2
0
def new_meeting():
    if request.method == "POST":
        data = json.loads(request.form['data'])
        name = request.form['meeting_name']
        link = request.form['meeting_link']
        triggers = []
        for day in data['triggers']:
            for trigger in day[2]:
                hour, minute = trigger[2].split(":")
                triggers.append(
                    Trigger(day_of_week=weeknums[day[0]],
                            hour=int(hour),
                            minute=int(minute)))
        newtask = Task.task_from_browser(name, True, link, triggers)
        newtask.configure(scheduler)
    return redirect(url_for('meetings'))
Exemple #3
0
def edit_task(id):
    task = Task.get_task_list(scheduler)[id]
    changes = dict.fromkeys(('name', 'link', 'triggers', 'enabled'))
    if not task:
        flash("That task doesn't exist", "info")
    elif request.method == "POST":
        #tree_print(request.form['data'], 0)
        data = json.loads(request.form['data'])
        #print(data)
        changes['name'] = request.form['meeting_name']
        changes['link'] = request.form['meeting_link']
        changes['triggers'] = []
        for day in data['triggers']:
            for trigger in day[2]:
                hour, minute = trigger[2].split(":")
                changes['triggers'].append(
                    Trigger(day_of_week=weeknums[day[0]],
                            hour=int(hour),
                            minute=int(minute)))
        task.configure(scheduler, **changes)
        #flash("Meeting Updated", "success")
        #tree_print(changes, 0)
    return redirect(url_for('meetings'))
Exemple #4
0
def shift_task(id, direction):
    # print(id, direction)
    tasklist = Task.get_task_list(scheduler)
    tasklist.shift_task(id, int(direction))
    return redirect(url_for('meetings'))
Exemple #5
0
def disable_task(id):
    task = Task.get_task_list(scheduler)[id]
    task.disable(scheduler)
    flash(f"Disabled {task.name}", "success")
    return redirect(url_for('meetings'))
Exemple #6
0
def delete_task(id):
    task = Task.get_task_list(scheduler)[id]
    task.delete(scheduler)
    # flash(f"Deleted {task.name}", "success")
    return redirect(url_for('meetings'))
Exemple #7
0
def run_task(id):
    task = Task.get_task_list(scheduler)[id]
    scheduler.run_job(task.id, 'default')
    #task.get_task_list(scheduler).print_tasks()
    flash("Running Task", "info")
    return redirect(url_for('meetings'))
Exemple #8
0
def meetings():
    return render_template('Meetings.html',
                           meetings=Task.get_task_list(scheduler),
                           linkre=Task.browser_re)