浏览代码

Disables feedback functionality if callstats isn't available.

j8
yanas 9 年前
父节点
当前提交
7ea675159e
共有 4 个文件被更改,包括 49 次插入11 次删除
  1. 1
    0
      css/main.css
  2. 27
    3
      modules/UI/Feedback.js
  3. 1
    4
      modules/UI/UI.js
  4. 20
    4
      modules/UI/toolbars/Toolbar.js

+ 1
- 0
css/main.css 查看文件

@@ -248,6 +248,7 @@ form {
248 248
 }
249 249
 
250 250
 div.feedbackButton {
251
+    display: none;
251 252
     position: absolute;
252 253
     background-color: rgba(0,0,0,.50);
253 254
     border-radius: 50%;

+ 27
- 3
modules/UI/Feedback.js 查看文件

@@ -1,4 +1,4 @@
1
-/* global $, interfaceConfig */
1
+/* global $, config, interfaceConfig */
2 2
 
3 3
 /*
4 4
  * Created by Yana Stamcheva on 2/10/15.
@@ -73,6 +73,30 @@ var Feedback = {
73 73
      * The feedback score. -1 indicates no score has been given for now.
74 74
      */
75 75
     feedbackScore: -1,
76
+    /**
77
+     * Initialise the Feedback functionality.
78
+     */
79
+    init: function () {
80
+        // CallStats is the way we send feedback, so we don't have to initialise
81
+        // if callstats isn't enabled.
82
+        if (!config.callStatsID || !config.callStatsSecret)
83
+            return;
84
+
85
+        $("div.feedbackButton").css("display", "block");
86
+        $("#feedbackButton").click(function (event) {
87
+            Feedback.openFeedbackWindow();
88
+        });
89
+    },
90
+    /**
91
+     * Indicates if the feedback functionality is enabled.
92
+     *
93
+     * @return true if the feedback functionality is enabled, false otherwise.
94
+     */
95
+    isEnabled: function() {
96
+        var isCallStatsEnabled = (config.callStatsID && config.callStatsSecret);
97
+
98
+        return isCallStatsEnabled;
99
+    },
76 100
     /**
77 101
      * Opens the feedback window.
78 102
      */
@@ -120,7 +144,7 @@ var Feedback = {
120 144
         var states = {
121 145
             overall_feedback: {
122 146
                 html: constructOverallFeedbackHtml(),
123
-                persistent: true,
147
+                persistent: false,
124 148
                 buttons: {},
125 149
                 closeText: '',
126 150
                 focus: "div[id='stars']",
@@ -161,7 +185,7 @@ var Feedback = {
161 185
         var feedbackDialog
162 186
             = APP.UI.messageHandler.openDialogWithStates(
163 187
                 states,
164
-                {   persistent: true,
188
+                {   persistent: false,
165 189
                     buttons: {},
166 190
                     closeText: '',
167 191
                     loaded: onLoadFunction,

+ 1
- 4
modules/UI/UI.js 查看文件

@@ -429,15 +429,12 @@ UI.start = function (init) {
429 429
         $("#downloadlog").click(function (event) {
430 430
             dump(event.target);
431 431
         });
432
-        $("#feedbackButton").click(function (event) {
433
-            Feedback.openFeedbackWindow();
434
-        });
432
+        Feedback.init();
435 433
     }
436 434
     else
437 435
     {
438 436
         $("#header").css("display", "none");
439 437
         $("#bottomToolbar").css("display", "none");
440
-        $("#feedbackButton").css("display", "none");
441 438
         $("#downloadlog").css("display", "none");
442 439
         $("#remoteVideos").css("padding", "0px 0px 18px 0px");
443 440
         $("#remoteVideos").css("right", "0px");

+ 20
- 4
modules/UI/toolbars/Toolbar.js 查看文件

@@ -151,12 +151,28 @@ function hangup() {
151 151
         }
152 152
     };
153 153
 
154
-    if (Feedback.feedbackScore > 0) {
155
-        Feedback.openFeedbackWindow();
154
+    if (Feedback.isEnabled())
155
+    {
156
+        // If the user has already entered feedback, we'll show the window and
157
+        // immidiately start the conference dispose timeout.
158
+        if (Feedback.feedbackScore > 0) {
159
+            Feedback.openFeedbackWindow();
160
+            conferenceDispose();
161
+
162
+        }
163
+        // Otherwise we'll wait for user's feedback.
164
+        else
165
+            Feedback.openFeedbackWindow(conferenceDispose);
166
+    }
167
+    else {
156 168
         conferenceDispose();
169
+
170
+        // If the feedback functionality isn't enabled we show a thank you
171
+        // dialog.
172
+        APP.UI.messageHandler.openMessageDialog(null, null, null,
173
+            APP.translation.translateString("dialog.thankYou",
174
+                {appName:interfaceConfig.APP_NAME}));
157 175
     }
158
-    else
159
-        Feedback.openFeedbackWindow(conferenceDispose);
160 176
 }
161 177
 
162 178
 /**

正在加载...
取消
保存