From a01ee562094720e6f45f284e1536897bbd0f3b03 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Mon, 16 Mar 2009 19:50:49 +0000 Subject: [PATCH] * add conditional to check room-types * use hide 'delete' button if we're not allowed to * check for room type BBS whether we show the one or the other button group --- webcit/event.c | 47 ++++++++++++++++++++----------- webcit/roomops.c | 42 +++++++++++++++++++++++++++ webcit/static/mobile.js | 2 +- webcit/static/summaryview.js | 2 +- webcit/static/t/view_message.html | 6 ++-- webcit/static/wclib.js | 6 ++-- 6 files changed, 82 insertions(+), 23 deletions(-) diff --git a/webcit/event.c b/webcit/event.c index 9b54b6dfc..9f7bdfc2b 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -225,22 +225,30 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, wprintf("\n"); - /* - * If this is an all-day-event, set the end time to be identical to - * the start time (the hour/minute/second will be set to midnight). - * Otherwise extract or create it. - */ wprintf(""); wprintf(_("End")); wprintf("\n"); - if (t_start.is_date) { - t_end = t_start; + p = icalcomponent_get_first_property(vevent, + ICAL_DTEND_PROPERTY); + if (p != NULL) { + t_end = icalproperty_get_dtend(p); + + /* + * If this is an all-day-event, the end time is set to real end + * day + 1, so we have to adjust accordingly. + */ + if (t_start.is_date) { + icaltime_adjust(&t_end, -1, 0, 0, 0); + } } else { - p = icalcomponent_get_first_property(vevent, - ICAL_DTEND_PROPERTY); - if (p != NULL) { - t_end = icalproperty_get_dtend(p); + /* + * If this is an all-day-event, set the end time to be identical to + * the start time (the hour/minute/second will be set to midnight). + * Otherwise extract or create it. + */ + if (t_start.is_date) { + t_end = t_start; } else { /* @@ -871,14 +879,21 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *fr icalproperty_free(prop); } - if (all_day_event == 0) { + if (all_day_event) { + icaltime_from_webform_dateonly(&t, "dtend"); + + /* with this field supposed to be non-inclusive we have to add one day */ + icaltime_adjust(&t, 1, 0, 0, 0); + } + else { icaltime_from_webform(&t, "dtend"); - icalcomponent_add_property(vevent, - icalproperty_new_dtend(icaltime_normalize(t) - ) - ); } + icalcomponent_add_property(vevent, + icalproperty_new_dtend(icaltime_normalize(t) + ) + ); + /* recurrence rules -- begin */ /* remove any existing rule */ diff --git a/webcit/roomops.c b/webcit/roomops.c index 10beb732d..99527f131 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -4008,6 +4008,47 @@ int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP) (WCC->is_mailbox) )); } +int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP) +{ + wcsession *WCC = WC; + + if ((WCC == NULL) || + (TP->Tokens->nParameters < 3) || + (TP->Tokens->Params[2]->Type != TYPE_STR)|| + (TP->Tokens->Params[2]->len < 7)) + return 0; + + switch(WCC->wc_view) { + case VIEW_BBS: + return TP->Tokens->Params[2]->Start[7]=='B'; + case VIEW_MAILBOX: + return TP->Tokens->Params[2]->Start[7]=='M'; + case VIEW_ADDRESSBOOK: + return TP->Tokens->Params[2]->Start[7]=='A'; + case VIEW_TASKS: + return TP->Tokens->Params[2]->Start[7]=='T'; + case VIEW_NOTES: + return TP->Tokens->Params[2]->Start[7]=='N'; + case VIEW_WIKI: + return TP->Tokens->Params[2]->Start[7]=='W'; + case VIEW_JOURNAL: + return TP->Tokens->Params[2]->Start[7]=='J'; + + case VIEW_CALENDAR: + if (TP->Tokens->Params[2]->len < 13) + return 0; + return TP->Tokens->Params[2]->Start[10]=='E'; + + case VIEW_CALBRIEF: + if (TP->Tokens->Params[3]->len < 13) + return 0; + return TP->Tokens->Params[2]->Start[10]=='B'; + + default: + return 0; + } +} + void InitModule_ROOMOPS (void) @@ -4046,6 +4087,7 @@ InitModule_ROOMOPS WebcitAddUrlHandler(HKEY("json_roomflr"), jsonRoomFlr, 0); RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, 0); + RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE); RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE); RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_INUSE"), 0, ConditionalRoomHas_QR_INUSE, CTX_NONE); RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PRIVATE"), 0, ConditionalRoomHas_QR_PRIVATE, CTX_NONE); diff --git a/webcit/static/mobile.js b/webcit/static/mobile.js index dd8f104b9..275481a8f 100644 --- a/webcit/static/mobile.js +++ b/webcit/static/mobile.js @@ -24,7 +24,7 @@ req.onreadystatechange = function (aEvt) { } }; req.send(null); */ - window.location = "/mobilemsg/"+msgnum+"?Mail=1"; + window.location = "/mobilemsg/"+msgnum; } function CtdlHideMsg() { currentMsgDisplay.style.display = "none"; diff --git a/webcit/static/summaryview.js b/webcit/static/summaryview.js index b3ea8ba75..107793278 100644 --- a/webcit/static/summaryview.js +++ b/webcit/static/summaryview.js @@ -266,7 +266,7 @@ function CtdlMessageListClick(evt) { unmarkAllRows(); markedRowId = parent.ctdlRowId; document.getElementById("preview_pane").innerHTML = ""; - new Ajax.Updater('preview_pane', 'msg/'+msgId+'?Mail=1', {method: 'get'}); + new Ajax.Updater('preview_pane', 'msg/'+msgId, {method: 'get'}); markRow(parent); new Ajax.Request('ajax_servcmd', { method: 'post', diff --git a/webcit/static/t/view_message.html b/webcit/static/t/view_message.html index 125b06e8a..e1106d70e 100644 --- a/webcit/static/t/view_message.html +++ b/webcit/static/t/view_message.html @@ -15,19 +15,21 @@ onMouseOut=document.getElementById("msg").style.visibility="hidden

diff --git a/webcit/static/wclib.js b/webcit/static/wclib.js index 70977af77..7cc4d2239 100644 --- a/webcit/static/wclib.js +++ b/webcit/static/wclib.js @@ -714,14 +714,14 @@ function attachDatePicker(relative) { } function eventEditAllDay() { var allDayCheck = document.getElementById("alldayevent"); - var dtend = document.getElementById("dtendcell"); + var dtend_time = document.getElementById("dtend_time"); var dtstart_time = document.getElementById("dtstart_time"); if(allDayCheck.checked) { dtstart_time.style.visibility = "hidden"; - dtend.style.visibility = "hidden"; + dtend_time.style.visibility = "hidden"; } else { dtstart_time.style.visibility = "visible"; - dtend.style.visibility = "visible"; + dtend_time.style.visibility = "visible"; } } -- 2.30.2