Finish Event cleanup for compose screen.
authorMichael M Slusarz <slusarz@curecanti.org>
Sun, 18 Jan 2009 03:04:19 +0000 (20:04 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Sun, 18 Jan 2009 08:55:36 +0000 (01:55 -0700)
Also, improved the compose attachment view code.

imp/js/src/compose-dimp.js
imp/themes/screen-dimp.css

index 9b643dc..d10c7c2 100644 (file)
@@ -499,6 +499,10 @@ var DimpCompose = {
         div.insert(input);
         $('attach_list').insert(div);
 
+        if (type != 'application/octet-stream') {
+            span.addClassName('attachName');
+        }
+
         this.resizeMsgArea();
     },
 
@@ -635,7 +639,7 @@ var DimpCompose = {
             return;
         }
 
-        var elt = e.element(), id, tmp;
+        var elt = orig = e.element(), atc_num, id;
 
         while (Object.isElement(elt)) {
             id = elt.readAttribute('id');
@@ -659,20 +663,24 @@ var DimpCompose = {
             case 'htmlcheckbox':
                 this.toggleHtmlCheckbox();
                 break;
-            }
 
-            /*
-            if (DIMP.conf_compose.abook_url) {
-                $('sendto', 'sendcc', 'sendbcc').each(function(a) {
-                    C({ d: a.down('TD.label SPAN').addClassName('composeAddrbook'), f: DC.openAddressbook.bind(DC) });
-                });
-            }
+            case 'sendcc':
+            case 'sendbcc':
+            case 'sendto':
+                if (orig.match('TD.label SPAN')) {
+                    this.openAddressbook();
+                }
+                break;
 
-        C({ d: input, f: this.removeAttach.bind(this, [ input.up() ]) });
-        if (type != 'application/octet-stream') {
-            C({ d: span.addClassName('attachName'), f: function() { view(DimpCore.addURLParam(DIMP.conf.URI_VIEW, { composeCache: $F('composeCache'), actionID: 'compose_attach_preview', id: atc_num }), $F('composeCache') + '|' + atc_num) } });
-        }
-            */
+            case 'attach_list':
+                if (orig.match('INPUT')) {
+                    this.removeAttach([ orig.up() ]);
+                } else if (orig.match('SPAN.attachName')) {
+                    atc_num = orig.next().readAttribute('atc_id');
+                    DimpCore.popupWindow(DimpCore.addURLParam(DIMP.conf.URI_VIEW, { composeCache: $F('composeCache'), actionID: 'compose_attach_preview', id: atc_num }), $F('composeCache') + '|' + atc_num);
+                }
+                break;
+            }
 
             elt = elt.up();
         }
@@ -741,6 +749,13 @@ document.observe('dom:loaded', function() {
         $('submit_frame').writeAttribute({ position: 'absolute', width: '1px', height: '1px' }).setStyle({ left: '-999px' }).show();
     }
 
+    /* Add addressbook link formatting. */
+    if (DIMP.conf_compose.abook_url) {
+        $('sendto', 'sendcc', 'sendbcc').each(function(a) {
+            a.down('TD.label SPAN').addClassName('composeAddrbook');
+        });
+    }
+
     /* Mouse click handler. */
     document.observe('click', DC._clickHandler.bindAsEventListener(DC));
 
index 7acdd36..7e099dc 100644 (file)
@@ -867,9 +867,8 @@ div.spellcheck {
 }
 #attach_list input {
     background: none;
-    border: none;
+    border: 1px solid #ccc;
     font-weight: bold;
-    text-decoration: underline;
 }
 #attach_list div {
     background: transparent url("graphics/attachment.png") left 2px no-repeat;
@@ -877,12 +876,12 @@ div.spellcheck {
     padding-left: 20px;
 }
 
-#attachName span {
+span.attachName {
     text-decoration: underline;
     cursor: pointer;
 }
-#attachName span:hover {
-    font-weight: bold;
+span.attachName:hover {
+    color: red;
 }
 
 /* Context Menus */