Attachments count is now updated in navbar
authorArt Cancro <ajc@citadel.org>
Sun, 12 Dec 2010 03:15:35 +0000 (22:15 -0500)
committerArt Cancro <ajc@citadel.org>
Sun, 12 Dec 2010 03:15:35 +0000 (22:15 -0500)
webcit/messages.c
webcit/static/t/edit_message.html
webcit/static/t/edit_message/attachments_pane.html

index eefc48039ee729b497df35c97ad4cf905bbce752..2cda9c6b008f0bf715491bc8c424b043452cfdfd 100644 (file)
@@ -1697,6 +1697,12 @@ void download_postpart(void) {
 }
 
 
+
+void show_num_attachments(void) {
+       wc_printf("%d", GetCount(WC->attachments));
+}
+
+
 void h_readnew(void) { readloop(readnew, eUseDefault);}
 void h_readold(void) { readloop(readold, eUseDefault);}
 void h_readfwd(void) { readloop(readfwd, eUseDefault);}
@@ -1799,6 +1805,7 @@ InitModule_MSG
        WebcitAddUrlHandler(HKEY("postpart"), "", 0, view_postpart, NEED_URL|PROHIBIT_STARTPAGE);
        WebcitAddUrlHandler(HKEY("postpart_download"), "", 0, download_postpart, NEED_URL|PROHIBIT_STARTPAGE);
        WebcitAddUrlHandler(HKEY("upload_attachment"), "", 0, upload_attachment, AJAX);
+       WebcitAddUrlHandler(HKEY("show_num_attachments"), "", 0, show_num_attachments, AJAX);
 
        /* json */
        WebcitAddUrlHandler(HKEY("roommsgs"), "", 0, jsonMessageList,0);
index 256b14e3db69a97caad648ff7b1dcdabd4b75486..2e432d38920c66bdc27b5f5a7dda267ee92c8546 100644 (file)
 
        function hide_attachments_form() {
                $('attachments_form').style.display = 'none';
+               update_attachment_count();
        }
 
        function show_attachments_form() {
                );
        }
 
+       function update_attachment_count() {
+               p = 'r=' + CtdlRandomString();
+               new Ajax.Updater(
+                       'num_attachments',
+                       'show_num_attachments',
+                       {
+                               method: 'get',
+                               parameters: p
+                       }
+               );
+       }
+
 </script>
 </div>
 </div>
index 6f610d280d8575a72406ce6ec2f9c1cf3c9742bd..95408230c4e83063f9a01fd1cb4ddf7b02aa50a2 100644 (file)
@@ -18,7 +18,7 @@
 <div id="gonna_upload_this">
 <input type="hidden" name="submit_action" value="">
 <?_("Attach file:")>
-<input name="attachfile" id="attachfile" class="attachfile" size=40 type="file" onChange="$('gonna_upload_this').style.display='none'; $('upload_throbber').style.display='block'; document.upload_attachment_form.submit(); $('attachfile').value=''; show_attachments_form();">
+<input name="attachfile" id="attachfile" class="attachfile" size=40 type="file" onChange="$('gonna_upload_this').style.display='none'; $('upload_throbber').style.display='block'; document.upload_attachment_form.submit(); $('attachfile').value=''; show_attachments_form(); update_attachment_count();">
 </div>
 
 <div id="upload_throbber" style="display:none">