Skip to content

Commit

Permalink
Implemented a setting to enable messaging.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob McGuire-dale committed May 6, 2010
1 parent 29e6c47 commit 891ebd5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
17 changes: 15 additions & 2 deletions core/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,20 @@ class GeneralSettingsForm(forms.Form):
help_text='Duration of time without activity before the slide show restarts',
initial=10000
)


MSG_SERVER_ENABLED = forms.BooleanField(
label='Enable the Message Server?',
help_text='Control if Touchscreen bothers to communicate with the messaging server. (I.e. if you have no controller, just turn this off.)',
initial=True
)

MSG_SERVER_ENABLED = forms.ChoiceField(
label='Enable Messaging?',
help_text='Control if Touchscreen bothers to communicate with the messaging server. (I.e. if you have no controller, just turn this off.)',
choices=[ ( True, 'Yes' ), ( False, 'No' ) ],
initial='Yes'
)

MSG_SERVER_URL = forms.CharField(
label='Message Server',
help_text='The url of the message server',
Expand Down Expand Up @@ -85,4 +98,4 @@ class ScreenAnimationManager(PlugableManager):
"""
Manager that registers screens
"""
description = 'Manager that registers screen animations'
description = 'Manager that registers screen animations'
27 changes: 15 additions & 12 deletions core/templates/display.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,18 +239,21 @@

function get_message()
{
safelog("core messaging: eagerly awaiting next command.");
$.ajax({
url:'{{settings.general.MSG_SERVER_URL|safe}}',
data:{
c:0,
q:'{{settings.general.MSG_SERVER_QUEUE}}',
u:user
},
success:message_received,
error:message_error,
dataType:'json'
});
// only start messaging if messaging is enabled
if( "{{settings.general.MSG_SERVER_ENABLED}}" == "True" ){
safelog("core messaging: eagerly awaiting next command.");
$.ajax({
url:'{{settings.general.MSG_SERVER_URL|safe}}',
data:{
c:0,
q:'{{settings.general.MSG_SERVER_QUEUE}}',
u:user
},
success:message_received,
error:message_error,
dataType:'json'
});
}
}

function message_error() {
Expand Down

0 comments on commit 891ebd5

Please sign in to comment.