Permalink
Browse files

Implemented a setting to enable messaging.

  • Loading branch information...
1 parent 29e6c47 commit 891ebd5edf99c904b1ec65954f406b40d1e8f142 @robatron robatron committed May 6, 2010
Showing with 30 additions and 14 deletions.
  1. +15 −2 core/plugin_manager.py
  2. +15 −12 core/templates/display.html
View
17 core/plugin_manager.py
@@ -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',
@@ -85,4 +98,4 @@ class ScreenAnimationManager(PlugableManager):
"""
Manager that registers screens
"""
- description = 'Manager that registers screen animations'
+ description = 'Manager that registers screen animations'
View
27 core/templates/display.html
@@ -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() {

0 comments on commit 891ebd5

Please sign in to comment.