From 87676a5cee826c39fe20591616c0e1f0fcd2c2d8 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Wed, 8 Feb 2012 13:18:12 +0000 Subject: [PATCH] Cleaned up code related to departments' descriptions --- src/messenger/webim/js/164/survey.js | 3 ++- src/messenger/webim/js/source/survey.js | 7 +++++++ .../webim/styles/dialogs/default/templates/survey.tpl | 2 +- .../webim/styles/dialogs/original/templates/survey.tpl | 2 +- .../webim/styles/dialogs/silver/templates/survey.tpl | 2 +- .../webim/styles/dialogs/simplicity/templates/survey.tpl | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/messenger/webim/js/164/survey.js b/src/messenger/webim/js/164/survey.js index da2cdd8c..1cd54f73 100644 --- a/src/messenger/webim/js/164/survey.js +++ b/src/messenger/webim/js/164/survey.js @@ -5,4 +5,5 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -var Survey={checkFields:function(){var a=document.surveyForm.email,b=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return null!=a&&-1==a.value.search(b)?this.localizedStrings.wrongEmail:null},submit:function(){var a=this.checkFields();null==a?document.surveyForm.submit():alert(a)}};EventHelper.register(window,"onload",function(){Survey.localizedStrings=localizedStrings}); \ No newline at end of file +var Survey={checkFields:function(){var a=document.surveyForm.email,b=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return null!=a&&-1==a.value.search(b)?this.localizedStrings.wrongEmail:null},changeGroup:function(){document.getElementById("departmentDescription").childNodes.item(0).data=this.groupDescriptions[document.surveyForm.group.selectedIndex]},submit:function(){var a=this.checkFields(); +null==a?document.surveyForm.submit():alert(a)}};EventHelper.register(window,"onload",function(){Survey.localizedStrings=localizedStrings;"undefined"!=typeof groupDescriptions&&(Survey.groupDescriptions=groupDescriptions)}); \ No newline at end of file diff --git a/src/messenger/webim/js/source/survey.js b/src/messenger/webim/js/source/survey.js index 4f75c80f..368aad3e 100644 --- a/src/messenger/webim/js/source/survey.js +++ b/src/messenger/webim/js/source/survey.js @@ -16,6 +16,10 @@ var Survey = { return null; }, + changeGroup: function(){ + document.getElementById('departmentDescription').childNodes.item(0).data = this.groupDescriptions[document.surveyForm.group.selectedIndex]; + }, + submit: function(){ var error = this.checkFields(); if(error == null){ @@ -28,4 +32,7 @@ var Survey = { EventHelper.register(window, 'onload', function(){ Survey.localizedStrings = localizedStrings; + if( typeof groupDescriptions != 'undefined' ){ + Survey.groupDescriptions = groupDescriptions; + } }); \ No newline at end of file diff --git a/src/messenger/webim/styles/dialogs/default/templates/survey.tpl b/src/messenger/webim/styles/dialogs/default/templates/survey.tpl index 61b88386..a7bb4390 100644 --- a/src/messenger/webim/styles/dialogs/default/templates/survey.tpl +++ b/src/messenger/webim/styles/dialogs/default/templates/survey.tpl @@ -125,7 +125,7 @@ ${if:groups} ${msg:presurvey.department} - + diff --git a/src/messenger/webim/styles/dialogs/original/templates/survey.tpl b/src/messenger/webim/styles/dialogs/original/templates/survey.tpl index 5821538f..627b298e 100644 --- a/src/messenger/webim/styles/dialogs/original/templates/survey.tpl +++ b/src/messenger/webim/styles/dialogs/original/templates/survey.tpl @@ -87,7 +87,7 @@ ${if:groups} ${msg:presurvey.department} - + diff --git a/src/messenger/webim/styles/dialogs/silver/templates/survey.tpl b/src/messenger/webim/styles/dialogs/silver/templates/survey.tpl index e6eeaab8..c68e79dd 100644 --- a/src/messenger/webim/styles/dialogs/silver/templates/survey.tpl +++ b/src/messenger/webim/styles/dialogs/silver/templates/survey.tpl @@ -65,7 +65,7 @@ ${if:groups} ${msg:presurvey.department} - + ${msg:presurvey.department.description} diff --git a/src/messenger/webim/styles/dialogs/simplicity/templates/survey.tpl b/src/messenger/webim/styles/dialogs/simplicity/templates/survey.tpl index e31b1026..784aeb94 100644 --- a/src/messenger/webim/styles/dialogs/simplicity/templates/survey.tpl +++ b/src/messenger/webim/styles/dialogs/simplicity/templates/survey.tpl @@ -56,7 +56,7 @@ ${endif:showemail} ${if:groups} ${msg:presurvey.department} - + ${msg:presurvey.department.description}