From: Art Cancro Date: Fri, 10 Dec 2010 17:26:25 +0000 (-0500) Subject: Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel X-Git-Tag: v8.01~527 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=909a9b946eccd5b3adf2b8e081f2c1d40bd41f00;hp=56fd96456afdb450b681b4358c7a7fd143379318;p=citadel.git Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel --- diff --git a/libcitadel/tests/Makefile.in b/libcitadel/tests/Makefile.in index 32c7f1f48..53732c7e0 100644 --- a/libcitadel/tests/Makefile.in +++ b/libcitadel/tests/Makefile.in @@ -14,7 +14,7 @@ top_builddir=`pwd` # End of configuration section -TARGETS=stringbuf_test stringbuf_IO_test stringbuf_conversion_test hashlist_test mimeparser_test mime_xdg_lookup_test wildfire_test +TARGETS=stringbuf_test stringbuf_IO_test stringbuf_conversion_test hashlist_test mimeparser_test mime_xdg_lookup_test wildfire_test stripallbut_test all: $(TARGETS) @@ -73,6 +73,13 @@ wildfire_test: $(LIBOBJS) wildfire_test.o -o wildfire_test +stripallbut_test: $(LIBOBJS) stripallbut_test.o + $(CC) $(LDFLAGS) $(LIBOBJS) $(LIBS) \ + stripallbut_test.o \ + ../.libs/libcitadel.a \ + -o stripallbut_test + + .c.o: $(CC) $(CFLAGS) $(DEFS) -c $< diff --git a/libcitadel/tests/dolcov.sh b/libcitadel/tests/dolcov.sh old mode 100755 new mode 100644 diff --git a/libcitadel/tests/stripallbut_test.c b/libcitadel/tests/stripallbut_test.c new file mode 100644 index 000000000..2e1d0cff0 --- /dev/null +++ b/libcitadel/tests/stripallbut_test.c @@ -0,0 +1,71 @@ +#include +#include +#include +#include +#include +#include + +#include "../lib/libcitadel.h" + +main() { + int i; + long l; + + char *teststrings[] = { + "Nmm tyutyu", + "Sdd <> ghhjjkk", + "<>", + "", + "Sdd <", + "Df Ghjkl>", + ">< bggt", + "FSDFSDFSDFSDF<><><>bggt", + "FSDFSDFSDF<><>bggt", + "Abc", + "><", + "Zxcv>>" + }; + + char *strippedstrings[] = { + "fghjk", + "", + "", + "", + "Sdd <", + "Df Ghjkl>", + ">< bggt", + "FSDFSDFSDFSDF<><><>bggt", + "FSDFSDFSDF<><>bggt", + "QWER", + "><", + "lkj" + }; + + long strippedlens[] = { + 5, + 0, + 0, + 0, + 5, + 9, + 7, + 23, + 24, + 4, + 2, + 3 + }; + + char foo[128]; + + for (i=0; i<(sizeof(teststrings) / sizeof (char *)); ++i) { + printf("Testing stripallbut()\n"); + strcpy(foo, teststrings[i]); + l = stripallbut(foo, '<', '>'); + + assert(!strcmp(foo, strippedstrings[i])); + assert(strlen(foo) == strippedlens[i]); + } + + exit(0); +} diff --git a/webcit/messages.c b/webcit/messages.c index 9286d3992..88faa7b2e 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -1072,47 +1072,17 @@ void post_message(void) att->Data = WCC->upload; WCC->upload = NULL; WCC->upload_length = 0; - display_enter(); - return; + + /* and keep going, because we don't do attachments in two posts anymore */ } if (!strcasecmp(bstr("submit_action"), "cancel")) { sprintf(WCC->ImportantMessage, _("Cancelled. Message was not posted.")); - } else if (havebstr("attach_button")) { - display_enter(); - return; } else if (lbstr("postseq") == dont_post) { sprintf(WCC->ImportantMessage, _("Automatically cancelled because you have already " "saved this message.")); - } else if (havebstr("remove_attach_button")) { - /* now thats st00pit. need to find it by name. */ - void *vAtt; - StrBuf *WhichAttachment; - HashPos *at; - long len; - const char *key; - - WhichAttachment = NewStrBufDup(sbstr("which_attachment")); - StrBufUnescape(WhichAttachment, 0); - at = GetNewHashPos(WCC->attachments, 0); - do { - GetHashPos(WCC->attachments, at, &len, &key, &vAtt); - - att = (wc_mime_attachment*) vAtt; - if ((att != NULL) && - (strcmp(ChrPtr(WhichAttachment), - ChrPtr(att->FileName) ) == 0)) - { - DeleteEntryFromHash(WCC->attachments, at); - break; - } - } - while (NextHashPos(WCC->attachments, at)); - FreeStrBuf(&WhichAttachment); - display_enter(); - return; } else { const char CMD[] = "ENT0 1|%s|%d|4|%s|%s||%s|%s|%s|%s|%s"; StrBuf *Recp = NULL; @@ -1681,8 +1651,6 @@ void MimeLoadData(wc_mime_attachment *Mime) } - - void view_mimepart(void) { mimepart(0); } @@ -1717,6 +1685,7 @@ void download_postpart(void) { FreeStrBuf(&partnum); } + void h_readnew(void) { readloop(readnew, eUseDefault);} void h_readold(void) { readloop(readold, eUseDefault);} void h_readfwd(void) { readloop(readfwd, eUseDefault);} diff --git a/webcit/paramhandling.c b/webcit/paramhandling.c index 86d9d1aa4..8b36c277e 100644 --- a/webcit/paramhandling.c +++ b/webcit/paramhandling.c @@ -308,7 +308,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp, long keylen; #ifdef DEBUG_URLSTRINGS - lprintf(9, "upload_handler() name=%s, type=%s, len=%d\n", name, cbtype, length); + lprintf(9, "\033[31mupload_handler() name=%s, type=%s, len=%d\033[0m\n", name, cbtype, length); #endif if (WCC->Hdr->urlstrings == NULL) WCC->Hdr->urlstrings = NewHash(1, NULL); @@ -340,13 +340,15 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp, #endif } - /** Uploaded files */ + /* Uploaded files */ if ( (length > 0) && (!IsEmptyStr(cbtype)) ) { WCC->upload = NewStrBufPlain(content, length); WCC->upload_length = length; WCC->upload_filename = NewStrBufPlain(filename, -1); - safestrncpy(WCC->upload_content_type, cbtype, - sizeof(WC->upload_content_type)); + safestrncpy(WCC->upload_content_type, cbtype, sizeof(WC->upload_content_type)); +#ifdef DEBUG_URLSTRINGS + lprintf(9, "File: <%s> len: [%ld]\n", filename, length); +#endif } diff --git a/webcit/static/styles/webcit.css b/webcit/static/styles/webcit.css index 358a77179..792f8a3a9 100644 --- a/webcit/static/styles/webcit.css +++ b/webcit/static/styles/webcit.css @@ -1262,3 +1262,29 @@ a.event_title:hover span.bttbottom, a.event_unread:hover span.bttbottom, a.event font-size: 100%; font-style: italic; } + +#attachments_form { + display:none; + position:absolute; + top:5%; + bottom:5%; + right:5%; + left:5%; + z-index: 10; + padding: 5px; + border-width: 1px; + border-style: solid; + border-color: #022750; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + background: #FFFFFF; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFFFF), to(#DDDDEE)); + background: -moz-linear-gradient(#FFFFFF, #DDDDEE); + background: linear-gradient(#FFFFFF, #DDDDEE); + -pie-background: linear-gradient(#FFFFFF, #DDDDEE); + -webkit-box-shadow: #666 0px 2px 3px; + -moz-box-shadow: #666 0px 2px 3px; + box-shadow: #666 0px 2px 3px; + behavior: url(/static/styles/PIE.htc); +} diff --git a/webcit/static/t/attachments_pane.html b/webcit/static/t/attachments_pane.html new file mode 100644 index 000000000..bb3863483 --- /dev/null +++ b/webcit/static/t/attachments_pane.html @@ -0,0 +1,16 @@ + + +

 

+ +
    + +
+ + + +  "> +  "> + + diff --git a/webcit/static/t/edit_message.html b/webcit/static/t/edit_message.html index 3e9b26671..2a07b04dd 100644 --- a/webcit/static/t/edit_message.html +++ b/webcit/static/t/edit_message.html @@ -2,6 +2,14 @@
+ +
+
+

+

+
+
+
"> @@ -66,19 +74,8 @@ " size=45 maxlength=70> - - - -
- - -    - -  "> -  "> -
+ + @@ -122,6 +119,14 @@ +
  • + + + + + + +
  • @@ -139,8 +144,8 @@
  • - + function hide_attachments_form() { + $('attachments_form').style.display = 'none'; + } + + function show_attachments_form() { + $('attachments_form').style.display = 'block'; + + p = 'template=attachments_pane&r=' + CtdlRandomString(); + new Ajax.Updater( + 'attachments_form', + 'do_template', + { + method: 'get', + parameters: p, + evalScripts: true + } + ); + } + +
    diff --git a/webcit/static/t/edit_message/section_attach_select.html b/webcit/static/t/edit_message/section_attach_select.html index 4fb8906d6..81c8787a1 100644 --- a/webcit/static/t/edit_message/section_attach_select.html +++ b/webcit/static/t/edit_message/section_attach_select.html @@ -1,2 +1,6 @@ - +
  • +   + (%, Bytes) +   "> +