Reworking the enter message and attach dialogs
authorArt Cancro <ajc@citadel.org>
Fri, 10 Dec 2010 17:26:22 +0000 (12:26 -0500)
committerArt Cancro <ajc@citadel.org>
Fri, 10 Dec 2010 17:26:22 +0000 (12:26 -0500)
libcitadel/tests/dolcov.sh [changed mode: 0755->0644]
webcit/messages.c
webcit/paramhandling.c
webcit/static/styles/webcit.css
webcit/static/t/attachments_pane.html [new file with mode: 0644]
webcit/static/t/edit_message.html
webcit/static/t/edit_message/section_attach_select.html

old mode 100755 (executable)
new mode 100644 (file)
index 9286d3992bc90eac6a3cb8db29786c891ac1cfaf..88faa7b2e323783abc36a34c4c847449ce13f80c 100644 (file)
@@ -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);}
index 86d9d1aa438489787d022471e29987cfa5f1a375..8b36c277e39d2463049a6ddb35a276e19a7da85f 100644 (file)
@@ -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
                
        }
 
index 358a771799d3215e6c02bf5fd1fd5ef4ce6f8b31..792f8a3a9d062512537d7f81cfbbaa3db7045ea2 100644 (file)
@@ -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 (file)
index 0000000..bb38634
--- /dev/null
@@ -0,0 +1,16 @@
+<div align="right">
+<a href="javascript:hide_attachments_form();">
+<?_("Close window")>&nbsp;<img src="static/closewindow.gif"></div>
+</a>
+<h2><img src="static/diskette_24x.gif">&nbsp;<?_("Attachments:")></h2>
+
+<ul>
+<?ITERATE("MSG:ATTACHNAMES", ="edit_message_section_attach_select")>
+</ul>
+
+<?_("Attach file:")>
+<input name="attachfile" class="attachfile" size=16 type="file">
+&nbsp;&nbsp;<input type="submit" name="attach_button" value="<?_("Add")>">
+&nbsp;&nbsp;<input type="submit" name="remove_attach_button" value="<?_("Remove")>">
+
+
index 3e9b2667115487bbaed71637afbdd559e3320ff0..2a07b04ddcf994f62334623ab2abd1268f7386d7 100644 (file)
@@ -2,6 +2,14 @@
 <?=("important_msg")><?%("COND:LOGGEDIN", 1, 1, 1, "", ="paging")>
 <?ROOMBANNER>
 <div id="content">
+
+<div id="attachments_form">
+    <div id="loading">
+      <p><img src="static/throbber.gif" alt=""></p>
+      <p><?_("Loading")></p>
+    </div>
+</div>
+
 <div class="entmsg" id="entmsg"><form name="enterform" accept-charset="UTF-8" enctype="multipart/form-data" method="POST" action="post">
 <input type="hidden" name="postseq" value="<?DATE:NOW:NO>">
 <input type="hidden" name="return_to" value="<?BSTR("return_to")>">
     <input type="text" name="subject" id="subject_id" value="<?BSTR("subject", "H")>" size=45 maxlength=70>
   </td>
 </tr>
-
-</td></tr></table>
-
-<div class="attachment buttons">
-<img src="static/diskette_24x.gif" class="imgedit" ><?_("Attachments:")>
-<select name="which_attachment" size=1>
-<?ITERATE("MSG:ATTACHNAMES", ="edit_message_section_attach_select")>
-</select>
-&nbsp;&nbsp;&nbsp;<?_("Attach file:")>
-<input name="attachfile" class="attachfile" size=16 type="file">
-&nbsp;&nbsp;<input type="submit" name="attach_button" value="<?_("Add")>">
-&nbsp;&nbsp;<input type="submit" name="remove_attach_button" value="<?_("Remove")>">
-</div>
+</td></tr>
+</table>
 
 <input type="hidden" name="sig_inserted" value="yes">
 
                </span>
        </a>
 </li>
+<li>
+       <a href="javascript:show_attachments_form();">
+               <img src="static/diskette_24x.gif" alt="" width="24" height="24">
+               <span class="navbar_link">
+               <?_("Attach")>
+               </span>
+       </a>
+</li>
 <li>
        <a href="javascript:submit_post('cancel');">
                <img src="static/closewindow.gif" alt="">
        </a>
 </li><?!("X", 1)>
 </div>
-
 <script type="text/javascript">        
+
        $("navbar").innerHTML = $("submit-o-matic").innerHTML;
        <?!("COND:BSTR", 1, "__RCPTREQUIRED")>
                activate_entmsg_autocompleters();
                document.enterform.submit_action.value = which_action;
                document.enterform.submit();
        }
-</script>
 
+       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
+                       }
+               );
+       }
+
+</script>
 </div>
 </div>
 </div>
index 4fb8906d618bdbb46c96a43447d19b369771fe71..81c8787a1efe40e409b645eeb4d8205b3ae8e599 100644 (file)
@@ -1,2 +1,6 @@
-<option value="<?MAIL:MIME:FILENAME("U")>"><?MAIL:MIME:FILENAME("X")> (%<?MAIL:MIME:CONTENTTYPE>, <?MAIL:MIME:LENGTH>Bytes)</option>
+<li>
+       <?MAIL:MIME:FILENAME("U")>&nbsp;
+       <?MAIL:MIME:FILENAME("X")> (%<?MAIL:MIME:CONTENTTYPE>, <?MAIL:MIME:LENGTH>Bytes)
+       &nbsp;&nbsp;<input type="submit" name="remove_attach_button" value="<?_("Remove")>">
+</li>