Disables feedback functionality if callstats isn't available.

This commit is contained in:
yanas 2015-11-16 18:06:28 -06:00
parent 0ae702922c
commit 7ea675159e
4 changed files with 50 additions and 12 deletions

View File

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

View File

@ -1,4 +1,4 @@
/* global $, interfaceConfig */ /* global $, config, interfaceConfig */
/* /*
* Created by Yana Stamcheva on 2/10/15. * Created by Yana Stamcheva on 2/10/15.
@ -73,6 +73,30 @@ var Feedback = {
* The feedback score. -1 indicates no score has been given for now. * The feedback score. -1 indicates no score has been given for now.
*/ */
feedbackScore: -1, feedbackScore: -1,
/**
* Initialise the Feedback functionality.
*/
init: function () {
// CallStats is the way we send feedback, so we don't have to initialise
// if callstats isn't enabled.
if (!config.callStatsID || !config.callStatsSecret)
return;
$("div.feedbackButton").css("display", "block");
$("#feedbackButton").click(function (event) {
Feedback.openFeedbackWindow();
});
},
/**
* Indicates if the feedback functionality is enabled.
*
* @return true if the feedback functionality is enabled, false otherwise.
*/
isEnabled: function() {
var isCallStatsEnabled = (config.callStatsID && config.callStatsSecret);
return isCallStatsEnabled;
},
/** /**
* Opens the feedback window. * Opens the feedback window.
*/ */
@ -120,7 +144,7 @@ var Feedback = {
var states = { var states = {
overall_feedback: { overall_feedback: {
html: constructOverallFeedbackHtml(), html: constructOverallFeedbackHtml(),
persistent: true, persistent: false,
buttons: {}, buttons: {},
closeText: '', closeText: '',
focus: "div[id='stars']", focus: "div[id='stars']",
@ -161,7 +185,7 @@ var Feedback = {
var feedbackDialog var feedbackDialog
= APP.UI.messageHandler.openDialogWithStates( = APP.UI.messageHandler.openDialogWithStates(
states, states,
{ persistent: true, { persistent: false,
buttons: {}, buttons: {},
closeText: '', closeText: '',
loaded: onLoadFunction, loaded: onLoadFunction,

View File

@ -429,15 +429,12 @@ UI.start = function (init) {
$("#downloadlog").click(function (event) { $("#downloadlog").click(function (event) {
dump(event.target); dump(event.target);
}); });
$("#feedbackButton").click(function (event) { Feedback.init();
Feedback.openFeedbackWindow();
});
} }
else else
{ {
$("#header").css("display", "none"); $("#header").css("display", "none");
$("#bottomToolbar").css("display", "none"); $("#bottomToolbar").css("display", "none");
$("#feedbackButton").css("display", "none");
$("#downloadlog").css("display", "none"); $("#downloadlog").css("display", "none");
$("#remoteVideos").css("padding", "0px 0px 18px 0px"); $("#remoteVideos").css("padding", "0px 0px 18px 0px");
$("#remoteVideos").css("right", "0px"); $("#remoteVideos").css("right", "0px");

View File

@ -151,13 +151,29 @@ function hangup() {
} }
}; };
if (Feedback.isEnabled())
{
// If the user has already entered feedback, we'll show the window and
// immidiately start the conference dispose timeout.
if (Feedback.feedbackScore > 0) { if (Feedback.feedbackScore > 0) {
Feedback.openFeedbackWindow(); Feedback.openFeedbackWindow();
conferenceDispose(); conferenceDispose();
} }
// Otherwise we'll wait for user's feedback.
else else
Feedback.openFeedbackWindow(conferenceDispose); Feedback.openFeedbackWindow(conferenceDispose);
} }
else {
conferenceDispose();
// If the feedback functionality isn't enabled we show a thank you
// dialog.
APP.UI.messageHandler.openMessageDialog(null, null, null,
APP.translation.translateString("dialog.thankYou",
{appName:interfaceConfig.APP_NAME}));
}
}
/** /**
* Starts or stops the recording for the conference. * Starts or stops the recording for the conference.