* add conditional to check room-types
authorWilfried Göesgens <willi@citadel.org>
Mon, 16 Mar 2009 19:50:49 +0000 (19:50 +0000)
committerWilfried Göesgens <willi@citadel.org>
Mon, 16 Mar 2009 19:50:49 +0000 (19:50 +0000)
* 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
webcit/roomops.c
webcit/static/mobile.js
webcit/static/summaryview.js
webcit/static/t/view_message.html
webcit/static/wclib.js

index 9b54b6dfc35851b48e25364506234e3d1eed6f18..9f7bdfc2b4dbb9c59c17d7ac791fd61b0f2afe07 100644 (file)
@@ -225,22 +225,30 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
 
        wprintf("</TD></TR>\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("<TR><TD><B>");
        wprintf(_("End"));
        wprintf("</B></TD><TD id=\"dtendcell\">\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 */
index 10beb732d400f4b162dc848e369674cae5afc446..99527f1314ba779dfad03cd49509b6e851705a6e 100644 (file)
@@ -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);
index dd8f104b9db2763ca4c9fa05fbcdf2dd3726e99c..275481a8f1a9d091f97b8036945cee2bf2970294 100644 (file)
@@ -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";
index b3ea8ba75084301c2bf37aa45ac103a4420074be..1077932787e28d30899c0450cfa10ed9ec6260b7 100644 (file)
@@ -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',
index 125b06e8a11038dc9327090fa92e080183079b77..e1106d70e5858e7041e648cd4621d58ac15051d6 100644 (file)
@@ -15,19 +15,21 @@ onMouseOut=document.getElementById("msg<?MAIL:SUMM:N>").style.visibility="hidden
 <?!("COND:MAIL:SUBJ", 7)><p class="message_subject"><?_("Subject:")> <?MAIL:SUMM:SUBJECT></p><??("X", 7)>
  <p style="visibility: hidden;" id="msg<?MAIL:SUMM:N>" class="msgbuttons">
 
-   <?!("COND:BSTR", 8, "Mail")>
+   <??("COND:ROOM:TYPE_IS", 8, "VIEW_BBS")>
    <a href="display_enter?recp=%22<?MAIL:SUMM:FROM("U")>%22%3C<?MAIL:SUMM:RFCA("U")>%3E&references=<?MAIL:SUMM:INREPLYTO("U")>%3C<?MAIL:SUMM:RFCA("U")>%3E&subject=<?MAIL:SUMM:SUBJECT("U", 0, "Re:%20", "Re:")>"><span>[</span><?_("Reply")><span>]</span></a> 
    <a href="display_enter?recp=%22<?MAIL:SUMM:FROM("U")>%22%3C<?MAIL:SUMM:RFCA("U")>%3E%2C<?MAIL:SUMM:ALLRCPT("U")>&references=<?MAIL:SUMM:INREPLYTO("U")>%3C<?MAIL:SUMM:RFCA("U")>%3E&subject=<?MAIL:SUMM:SUBJECT("U", 0, "Re:%20", "Re:")>"><span>[</span><?_("ReplyAll")><span>]</span></a> 
    <a href="display_enter?fwdquote=<?MAIL:SUMM:N>&subject=<?MAIL:SUMM:SUBJECT("U", 0, "Fwd:%%20", "Fwd:")>"><span>[</span><?_("Forward")><span>]</span></a> 
    <??("X", 8)>
 
-   <??("COND:BSTR", 9, "Mail")>
+   <?!("COND:ROOM:TYPE_IS", 9, "VIEW_BBS")>
    <a href="display_enter?recp=%22<?MAIL:SUMM:FROM("U")>%22%3C<?MAIL:SUMM:RFCA("U")>%3E&references=<?MAIL:SUMM:INREPLYTO("U")>%3C<?MAIL:SUMM:RFCA("U")>%3E&subject=<?MAIL:SUMM:SUBJECT("U", 0, "Re:%20", "Re:")>"><span>[</span><?_("Reply")><span>]</span></a> 
    <a href="display_enter?replyquote=<?MAIL:SUMM:N>&recp=%22<?MAIL:SUMM:FROM("U")>%22%3C<?MAIL:SUMM:RFCA("U")>%3E&references=<?MAIL:SUMM:INREPLYTO("U")>%3C<?MAIL:SUMM:RFCA("U")>%3E&subject=<?MAIL:SUMM:SUBJECT("U", 0, "Re:%%20", "Re:")>"><span>[</span><?_("ReplyQuoted")><span>]</span></a> 
    <?!("X", 9)>
 
    <a href="confirm_move_msg?msgid=<?MAIL:SUMM:N>"><span>[</span><?_("Move")><span>]</span></a> 
+<?!("COND:ROOM:EDITACCESS", 10)>
    <a href="delete_msg?msgid=<?MAIL:SUMM:N>" onclick="return confirm('<?_("Delete this message?")>');"><span>[</span><?_("Delete")><span>]</span> </a> 
+<??("X", 10)>
    <a href="#" onclick="window.open('msgheaders/<?MAIL:SUMM:N>', 'headers<?MAIL:SUMM:N>', 'toolbar=no,location=no,directories=no,copyhistory=no,status=yes,scrollbars=yes,resizable=yes,width=600,height=400'); "><span>[</span><?_("Headers")><span>]</span></a>
    <a href="#" onclick="window.open('printmsg/<?MAIL:SUMM:N>', 'print<?MAIL:SUMM:N>', 'toolbar=no,location=no,directories=no,copyhistory=no,status=yes,scrollbars=yes,resizable=yes,width=600,height=400'); "><span>[</span><?_("Print")><span>]</span></a>
  </p>
index 70977af7710271938e93c79a4d60605431ef6104..7cc4d2239f16f04a0eac67effd6b7c3f4579f0ad 100644 (file)
@@ -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";
        }
 }