]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Added XHR for direct messages.
authorSarven Capadisli <csarven@status.net>
Sat, 31 Oct 2009 15:14:38 +0000 (16:14 +0100)
committerSarven Capadisli <csarven@status.net>
Sat, 31 Oct 2009 15:14:38 +0000 (16:14 +0100)
actions/newmessage.php
js/util.js
theme/base/css/display.css

index eac4ab210444404a372530792b2203a81046ea47..37fca1ca2b8b34ff9a06ece73ef3394fb463cda4 100644 (file)
@@ -223,7 +223,22 @@ class NewmessageAction extends Action
         }
 
         $this->msg = $msg;
-        $this->showPage();
+        if ($this->trimmed('ajax')) {
+            $this->startHTML('text/xml;charset=UTF-8');
+            $this->elementStart('head');
+            $this->element('title', null, _('New message'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
+            if (common_logged_in()) {
+                $this->showNoticeForm();
+            }
+            $this->elementEnd('div');
+            $this->elementEnd('body');
+            $this->endHTML();
+        }
+        else {
+            $this->showPage();
+        }
     }
 
     function showPageNotice()
index 11b06298d1e48646f0a9f4c9157e500963861d7a..c7a3e8f8895928357aca0748cc0303d7746f8264 100644 (file)
@@ -57,6 +57,8 @@ $(document).ready(function(){
         SN.U.NoticeReply();
 
         SN.U.NoticeDataAttach();
+
+        SN.U.NewDirectMessage();
     }
 
     SN.U.NoticeAttachments();
@@ -350,6 +352,32 @@ var SN = { // StatusNet
                     NDA.val('');
                 });
             });
+        },
+
+        NewDirectMessage: function() {
+            NDM = $('.entity_send-a-message a');
+            NDM.attr({'href':NDM.attr('href')+'&ajax=1'});
+            NDM.click(function() {
+                var NDMF = $('.entity_send-a-message form');
+                if (NDMF.length == 0) {
+                    $.get(NDM.attr('href'), null, function(data) {
+                        $('.entity_send-a-message').append(document._importNode($('form', data).get(0), true));
+                        $('.entity_send-a-message textarea').focus();
+
+                        NDMF = $('.entity_send-a-message form');
+                        NDMF.append('<button>&#215;</button>');
+                        $('.entity_send-a-message button').click(function(){
+                            NDMF.hide();
+                            return false;
+                        });
+                    });
+                }
+                else {
+                    NDMF.show();
+                    $('.entity_send-a-message textarea').focus();
+                }
+                return false;
+            });
         }
     }
 }
index c8aafe48935abc69bb8e1be73c01b59ff9536ab6..db6b08e63299ff1dff804940b7fe2bbf501a2ca5 100644 (file)
@@ -670,6 +670,40 @@ border-radius:4px;
 margin-bottom:18px;
 }
 
+
+.entity_send-a-message button {
+position:absolute;
+top:0;
+right:0;
+}
+
+.entity_send-a-message #form_notice {
+position:absolute;
+top:34px;
+right:-1px;
+padding:1.795%;
+width:65%;
+z-index:1;
+
+background-color:#FFFFFF;
+border:1px solid #CCCCCC;
+-moz-box-shadow:3px 7px 5px rgba(194, 194, 194, 0.7);
+-moz-border-radius:7px;
+}
+.entity_send-a-message #form_notice legend {
+display:block;
+margin-bottom:11px;
+}
+
+.entity_send-a-message #form_notice label,
+.entity_send-a-message #form_notice select {
+display:none;
+}
+.entity_send-a-message input.submit {
+text-align:center;
+}
+
+
 .entity_tags ul {
 list-style-type:none;
 display:inline;