From 07cc9c5eeaa807713483fb176baacb13f2282a59 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 26 Feb 2009 18:44:41 +0000 Subject: [PATCH] plugged in some i18n git-svn-id: svn://svn.open-ils.org/ILS/trunk@12310 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/openils/conify/nls/conify.js | 12 ++++- .../ui/default/conify/global/action/survey/edit.js | 60 +++++++++++----------- 2 files changed, 39 insertions(+), 33 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/conify/nls/conify.js b/Open-ILS/web/js/dojo/openils/conify/nls/conify.js index 2be5574517..f5351f7450 100644 --- a/Open-ILS/web/js/dojo/openils/conify/nls/conify.js +++ b/Open-ILS/web/js/dojo/openils/conify/nls/conify.js @@ -73,6 +73,14 @@ "SUCCESS_SAVING_HOO": "Hours of Operation updated for ${0}", "SUCCESS_SAVING_ILL": "Saved changes to the ILL Address of ${0}", "SUCCESS_SAVING_MAILING": "Saved changes to the Mailing Address of ${0}", - "SUCCESS_SAVING_PHYSICAL": "Saved changes to the Physical Address of ${0}", - "TRANSLATION": "Translation" + "SUCCESS_SAVING_PHYSICAL": "Saved changes to the Physical Address of ${0}", + "TRANSLATION": "Translation", + "END_SURVEY": "End Survey Now", + "SAVE_ADD": "Save Question & Add Answer", + "DELETE_QUESTION": "Delete Question & Answers", + "DELETE_ANSWER": "Delete Answer", + "SAVE_CHANGES": "Save Changes", + "ADD_ANSWER": "Add Answer", + "ANSWER": "Answer:", + "QUESTION": "Question:" } diff --git a/Open-ILS/web/js/ui/default/conify/global/action/survey/edit.js b/Open-ILS/web/js/ui/default/conify/global/action/survey/edit.js index b94cf6cc39..74d1ef3466 100644 --- a/Open-ILS/web/js/ui/default/conify/global/action/survey/edit.js +++ b/Open-ILS/web/js/ui/default/conify/global/action/survey/edit.js @@ -12,15 +12,18 @@ dojo.require('openils.PermaCrud'); dojo.require('openils.DojoPatch'); dojo.require('openils.widget.GridColumnPicker'); dojo.require('openils.widget.EditPane'); +dojo.requireLocalization('openils.conify', 'conify'); var surveyId; var startDate; var endDate; var today; +var localeStrings = dojo.i18n.getLocalization('openils.conify', 'conify'); + function drawSurvey(svyId) { today = new Date(); var surveyTable = dojo.byId('edit-pane'); - var surveyHead = dojo.create('thead', {style: "background-color: #99CCFF", innerHTML: "Survey ID #" +svyId}, surveyTable); + var surveyHead = dojo.create('thead', {style: "background-color: #99CCFF"}, surveyTable); var pcrud = new openils.PermaCrud(); var survey = pcrud.retrieve('asv', svyId); startDate = dojo.date.stamp.fromISOString(survey.start_date()); @@ -28,7 +31,7 @@ function drawSurvey(svyId) { var pane = new openils.widget.EditPane({fmObject : survey, hideActionButtons:false}, dojo.byId('edit-pane')); if ( endDate > today) { var buttonBody = dojo.create( 'tbody', {innerHTML: "End Survey Now"}, surveyTable); - var endButton = new dijit.form.Button({onClick:function() {endSurvey(survey.id())} }, buttonBody); + var endButton = new dijit.form.Button({label: localeStrings.END_SURVEY, onClick:function() {endSurvey(survey.id())} }, buttonBody); } pane.fieldOrder = ['id', 'name', 'description', 'owner', 'start_date', 'end_date']; pane.onCancel = cancelEdit; @@ -74,11 +77,11 @@ function newQuestionBody(svyId) { var surveyTable = dojo.byId("survey_table"); var surveyBody = dojo.create('tbody', {style: "background-color: #d9e8f9"}, surveyTable); var questionRow = dojo.create('tr', null, surveyBody); - var questionLabel = dojo.create('td',{ innerHTML: "Question"}, questionRow, "first"); + var questionLabel = dojo.create('td',{ innerHTML: localeStrings.QUESTION}, questionRow, "first"); var questionTextbox = dojo.create('td', null, questionRow, "second"); var qInput = new dijit.form.TextBox(null, questionTextbox); - var questionButton = dojo.create('td', { innerHTML: "Save & Add Answers" }, questionRow); - var qButton = new dijit.form.Button({onClick:function() {newQuestion(svyId, qInput.getValue(), questionRow)} }, questionButton); + var questionButton = dojo.create('td', null , questionRow); + var qButton = new dijit.form.Button({ label: localeStrings.SAVE_ADD, onClick:function() {newQuestion(svyId, qInput.getValue(), questionRow)} }, questionButton); } @@ -87,15 +90,15 @@ function drawQuestionBody(question, answers, survey){ var surveyTable = dojo.byId('survey_table'); var surveyBody = dojo.create( 'tbody', {quid:question.id(), id:("q" + question.id()), style: "background-color: #d9e8f9"}, surveyTable); var questionRow = dojo.create('tr', {quid:question.id()}, surveyBody); - var questionLabel = dojo.create('td', {quid:question.id(), innerHTML: "Question"}, questionRow, "first"); + var questionLabel = dojo.create('td', {quid:question.id(), innerHTML: localeStrings.QUESTION}, questionRow, "first"); var questionTextbox = dojo.create('td', {quid: question.id() }, questionRow, "second"); var qInput = new dijit.form.TextBox(null, questionTextbox); qInput.attr('value', question.question()); if (startDate > today){ - var questionButton = dojo.create('td', {quid: question.id(), innerHTML: "Delete Question & Answers" }, questionRow); - var qButton = new dijit.form.Button({onClick:function() {deleteQuestion(question.id(), surveyBody) }}, questionButton); - var qChangesButton = dojo.create('td', {quid: question.id(), innerHTML: "Save Changes" }, questionRow); - var qcButton = new dijit.form.Button({onClick:function() {changeQuestion(question.id(), qInput.attr('value')) }}, qChangesButton); + var questionButton = dojo.create('td', {quid: question.id()}, questionRow); + var qButton = new dijit.form.Button({label: localeStrings.DELETE_QUESTION, onClick:function() {deleteQuestion(question.id(), surveyBody) }}, questionButton); + var qChangesButton = dojo.create('td', {quid: question.id()}, questionRow); + var qcButton = new dijit.form.Button({label: localeStrings.SAVE_CHANGES, onClick:function() {changeQuestion(question.id(), qInput.attr('value')) }}, qChangesButton); } for (var i in answers) { @@ -112,14 +115,14 @@ function newQuestion(svyId, questionText, questionRow) { question.question(questionText); question.isnew(true); pcrud.create(question, - {oncomplete: function(r) - { var q = openils.Util.readResponse(r); - questionRow.parentNode.removeChild(questionRow); - drawQuestionBody(q, null); - newQuestionBody(svyId); - } - } - ); + {oncomplete: function(r) + { var q = openils.Util.readResponse(r); + questionRow.parentNode.removeChild(questionRow); + drawQuestionBody(q, null); + newQuestionBody(svyId); + } + } + ); } function changeQuestion(quesId, questionText) { @@ -151,28 +154,28 @@ function drawAnswer(answer, qid, surveyBody, survey) { var surveyBody = dojo.byId(("q" + qid)); var answerRow = dojo.create('tr', {anid: answer.id(), style: "background-color: #FFF"}, surveyBody); var answerSpacer = dojo.create('td', {anid: answer.id()}, answerRow, "first"); - var answerLabel = dojo.create('td', {anid: answer.id(), style: "float: right", innerHTML: "Answer" }, answerRow, "second"); + var answerLabel = dojo.create('td', {anid: answer.id(), style: "float: right", innerHTML: localeStrings.ANSWER }, answerRow, "second"); var answerTextbox = dojo.create('td', {anid: answer.id() }, answerRow, "third"); var input = new dijit.form.TextBox(null, answerTextbox); input.attr('value', answer.answer()); if (startDate > today){ var answerSpacer = dojo.create('td', {anid: answer.id()}, answerRow); - var delanswerButton = dojo.create('td', {anid: answer.id(), innerHTML: "Delete Answer" }, answerRow); + var delanswerButton = dojo.create('td', {anid: answer.id()}, answerRow); var aid = answer.id(); - var aButton = new dijit.form.Button({onClick:function(){deleteAnswer(aid);answerRow.parentNode.removeChild(answerRow)} }, delanswerButton); - var aChangesButton = dojo.create('td', {anid: qid, innerHTML: "Save Changes" }, answerRow); - var acButton = new dijit.form.Button({onClick:function() {changeAnswer(answer.id(), input.attr('value')) }}, aChangesButton); + var aButton = new dijit.form.Button({label: localeStrings.DELETE_ANSWER, onClick:function(){deleteAnswer(aid);answerRow.parentNode.removeChild(answerRow)} }, delanswerButton); + var aChangesButton = dojo.create('td', {anid: qid}, answerRow); + var acButton = new dijit.form.Button({label: localeStrings.SAVE_CHANGES, onClick:function() {changeAnswer(answer.id(), input.attr('value')) }}, aChangesButton); } } function drawNewAnswerRow(qid, surveyBody) { var answerRow = dojo.create('tr', {quid: qid, style: "background-color: #FFF"}, surveyBody); var answerSpacer = dojo.create('td', {quid: qid}, answerRow, "first"); - var answerLabel = dojo.create('td', {quid: qid, innerHTML: "Answer", style: "float:right" }, answerRow, "second"); + var answerLabel = dojo.create('td', {quid: qid, innerHTML: localeStrings.ANSWER, style: "float:right" }, answerRow, "second"); var answerTextbox = dojo.create('td', {quid: qid }, answerRow, "third"); var input = new dijit.form.TextBox(null, answerTextbox); - var answerButton = dojo.create('td', {anid: qid, innerHTML: "Add Answer" }, answerRow); - var aButton = new dijit.form.Button({onClick:function() {newAnswer(qid, input.attr('value'), answerRow, surveyBody)} }, answerButton); + var answerButton = dojo.create('td', {anid: qid}, answerRow); + var aButton = new dijit.form.Button({label: localeStrings.ADD_ANSWER, onClick:function() {newAnswer(qid, input.attr('value'), answerRow, surveyBody)} }, answerButton); } @@ -206,8 +209,3 @@ function changeAnswer(ansId, answerText) { return pcrud.update(answer); } - - - - - -- 2.11.0