소스 검색

Fixes issue with unable to open second dialog on wrong room key entered. Still tests to come. Handle dialog action after the dialog is closed, otherwise the event for wrong key can come before the dialog is closed and will not be open again.

j8
Damian Minkov 10 년 전
부모
커밋
a55e3f5d9d
2개의 변경된 파일9개의 추가작업 그리고 5개의 파일을 삭제
  1. 4
    3
      app.js
  2. 5
    2
      message_handler.js

+ 4
- 3
app.js 파일 보기

@@ -855,6 +855,10 @@ $(document).bind('passwordrequired.muc', function (event, jid) {
855 855
         '<input id="lockKey" type="text" placeholder="password" autofocus>',
856 856
         true,
857 857
         "Ok",
858
+        function (e, v, m, f) {},
859
+        function (event) {
860
+            document.getElementById('lockKey').focus();
861
+        },
858 862
         function (e, v, m, f) {
859 863
             if (v) {
860 864
                 var lockKey = document.getElementById('lockKey');
@@ -863,9 +867,6 @@ $(document).bind('passwordrequired.muc', function (event, jid) {
863 867
                     connection.emuc.doJoin(jid, lockKey.value);
864 868
                 }
865 869
             }
866
-        },
867
-        function (event) {
868
-            document.getElementById('lockKey').focus();
869 870
         }
870 871
     );
871 872
 });

+ 5
- 2
message_handler.js 파일 보기

@@ -24,8 +24,10 @@ var messageHandler = (function(my) {
24 24
      * @param leftButton the fist button's text
25 25
      * @param submitFunction function to be called on submit
26 26
      * @param loadedFunction function to be called after the prompt is fully loaded
27
+     * @param closeFunction function to be called after the prompt is closed
27 28
      */
28
-    my.openTwoButtonDialog = function(titleString, msgString, persistent, leftButton, submitFunction, loadedFunction) {
29
+    my.openTwoButtonDialog = function(titleString, msgString, persistent, leftButton,
30
+                                      submitFunction, loadedFunction, closeFunction) {
29 31
         var buttons = {};
30 32
         buttons[leftButton] = true;
31 33
         buttons.Cancel = false;
@@ -35,7 +37,8 @@ var messageHandler = (function(my) {
35 37
             buttons: buttons,
36 38
             defaultButton: 1,
37 39
             loaded: loadedFunction,
38
-            submit: submitFunction
40
+            submit: submitFunction,
41
+            close: closeFunction
39 42
         });
40 43
     };
41 44
 

Loading…
취소
저장