Exemple #1
0
def delEvent(request):
    """delete event from calendar"""
    user = request.user
    default = dict(month=1, year=1, day=1, rowid=1, name="", desc="", when="")
    p = getParams(request, default)
    year, month, day = p['year'], p['month'], p['day']

    # create calendar obj
    cal = CalendarController(user, day)
    cal.load(year, month)

    # delete Event
    cal.delEvent(day, p['rowid'])

    # show view with new result
    return redirect2view(request.path, year, month, day)
Exemple #2
0
def view(request,header):
    """Calendar view"""
    user = request.user
    date = datetime.datetime.now()
    default = dict(month=date.month, year=date.year, day=1, rowid=1,
            name="", desc="", when="")
    url = request.path

    p = getParams(request, default)
    year, month, day = p['year'], p['month'], p['day']

    # create calendar obj
    cal = CalendarController(user, day)
    cal.load(year, month)
    
    return render_to_response('calendar.html',dict(username=user.get_full_name(), cal=cal, url=url,header=header),context_instance=RequestContext(request))
Exemple #3
0
def view(request):
    """Calendar view"""
    #user = request.user
    user = '******'
    date = datetime.datetime.now()
    default = dict(month=date.month, year=date.year, day=1, rowid=1,
            name="", desc="", when="")
    url = request.path

    p = getParams(request, default)
    year, month, day = p['year'], p['month'], p['day']

    # create calendar obj
    cal = CalendarController(user, day)
    cal.load(year, month)

    # template
    #t = get_template('cal/calendar.html')
    return Context(dict(username=user, cal=cal, url=url))
Exemple #4
0
def updEvent(request):
    """update selected event to calendar"""
    user = request.user
    default = dict(month=1, year=1, day=1, rowid=1, name="", desc="", when="")
    p = getParams(request, default)
    year, month, day = p['year'], p['month'], p['day']

    # create calendar obj
    cal = CalendarController(user, day)
    cal.load(year, month)

    # parpare data for adding Event
    whenDate = datetime.date(year, month, day)
    whenTime = datetime.time(*map(int, p['when'].strip().split(':')))
    when = datetime.datetime.combine(whenDate, whenTime)

    # update Event
    cal.updEvent(day, p['rowid'], p['name'], when, p['desc'])

    # show view with new result
    return redirect2view(request.path, year, month, day)
Exemple #5
0
def view(request):
    """Calendar view"""
    user = request.user
    date = datetime.datetime.now()
    default = dict(month=date.month, year=date.year, day=1, rowid=1,
            name="", desc="", when="")
    url = request.path

    p = getParams(request, default)
    year, month, day = p['year'], p['month'], p['day']

    # create calendar obj
    cal = CalendarController(user, day)
    cal.load(year, month)

    # template
    t = get_template('cal/calendar.html')
    c = Context(dict(username=user, cal=cal, url=url))
    html = t.render(c)

    return HttpResponse(html)
Exemple #6
0
def delEvent(request):
    """delete event from calendar"""
    user = request.user
    default = dict(month=1, year=1, day=1, rowid=1, name="", desc="", when="")
    p = getParams(request, default)
    year, month, day = p['year'], p['month'], p['day']

    # create calendar obj
    cal = CalendarController(user, day)
    cal.load(year, month)

    # delete Event
    cal.delEvent(day, p['rowid'])

    # show view with new result
    return redirect2view(request.path, year, month, day)
Exemple #7
0
def updEvent(request):
    """update selected event to calendar"""
    user = request.user
    default = dict(month=1, year=1, day=1, rowid=1, name="", desc="", when="")
    p = getParams(request, default)
    year, month, day = p['year'], p['month'], p['day']

    # create calendar obj
    cal = CalendarController(user, day)
    cal.load(year, month)

    # parpare data for adding Event
    whenDate = datetime.date(year, month, day)
    whenTime = datetime.time(*map(int, p['when'].strip().split(':')))
    when = datetime.datetime.combine(whenDate, whenTime)

    # update Event
    cal.updEvent(day, p['rowid'], p['name'], when, p['desc'])

    # show view with new result
    return redirect2view(request.path, year, month, day)