Exemplo n.º 1
0
def org_display_event(eid):
  event = database.find_event(eid)[0]
  category = database.get_categories_of_event(eid)
  if request.method=='GET':
    return render_template("event.html",
      name=event[0],
      filepath=event[5],
      description=event[4],
      date=event[1],
      start_time=event[2],
      end_time=event[3],
      location=event[7]+" "+event[8],
      category=str(category),
      organizer=event[6],
      event=True,
      incorrect=False,
      success=False,
      eid=eid,
      dash_redir='/orgdash')
  if request.method=='POST':
    username=request.form["name"]
    if database.create_invitation(username, session["user"], eid):
      return render_template("event.html",
      name=event[0],
      filepath=event[5],
      description=event[4],
      date=event[1],
      start_time=event[2],
      end_time=event[3],
      location=event[7]+" "+event[8],
      category=str(category),
      organizer=event[6],
      event=True,
      incorrect=False,
      success=True,
      eid=eid,
      dash_redir='/orgdash')
    else:
      return render_template("event.html",
      name=event[0],
      filepath=event[5],
      description=event[4],
      date=event[1],
      start_time=event[2],
      end_time=event[3],
      location=event[7]+" "+event[8],
      category=str(category),
      organizer=event[6],
      event=True,
      incorrect=True,
      success=False,
      eid=eid,
      dash_redir='/orgdash')
Exemplo n.º 2
0
def user_display_event(eid):
  event = database.find_event(eid)[0]
  category = database.get_categories_of_event(eid)
  if request.method=='GET':
    return render_template("event.html",
      name=event[0],
      filepath=event[5],
      description=event[4],
      date=event[1],
      start_time=event[2],
      end_time=event[3],
      location=event[7]+" "+event[8],
      category=str(category),
      organizer=event[6],
      event=False,
      incorrect=False,
      success=False,
      eid=eid,
      dash_redir='/userdash',
      user_decide=True)
  if request.method=='POST':
    value = request.form["invite"]
    status_id = 3
    if value == "Accept":
      status_id = 1
    elif value == "Decline":
      status_id = 2
    if status_id == 1 or status_id == 2:
      database.update_invite(session["user"], event[6], eid, status_id)
      return redirect(url_for("user_dashboard"))
    if value == "Participate":
      org_username = request.form["name"]
      success = database.participates_in_org(session["user"], org_username)
      print success
      return render_template("event.html",
        name=event[0],
        filepath=event[5],
        description=event[4],
        date=event[1],
        start_time=event[2],
        end_time=event[3],
        location=event[7]+" "+event[8],
        category=str(category),
        organizer=event[6],
        event=False,
        incorrect=(not success),
        success=success,
        eid=eid,
        dash_redir='/userdash',
        user_decide=True)
Exemplo n.º 3
0
def user_display_event_read(eid):
  event = database.find_event(eid)[0]
  category = database.get_categories_of_event(eid)
  if request.method=='GET':
    return render_template("event.html",
      name=event[0],
      filepath=event[5],
      description=event[4],
      date=event[1],
      start_time=event[2],
      end_time=event[3],
      location=event[7]+" "+event[8],
      category=str(category),
      organizer=event[6],
      event=False,
      incorrect=False,
      success=False,
      eid=eid,
      dash_redir='/userdash',
      user_decide=False)