Changeset ccf4df in indico


Ignore:
Timestamp:
05/13/11 11:30:23 (2 years ago)
Author:
Jose Benito <jose.benito.gonzalez@…>
Branches:
master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b2, v0.99, b8c30da8ebdbdcbd675a873997cc3e95f567de49, 4287315ec967a3da168d83963c14001db8487d53
Children:
208058
Parents:
8ae4b3
git-author:
Alexis Castilla Hernandez <alexis.castilla.hernandez@…> (03/24/11 17:42:28)
git-committer:
Jose Benito <jose.benito.gonzalez@…> (05/13/11 11:30:23)
Message:

[IMP] Unify JS in .tpls of AR propTo..

  • Removed all the JS from .tpl files and implemented new class in AbstractReviewing?.js
  • Removed "_GID" group names, also in checkParams functions
  • Moved the code to assign titles to the radio buttons to the RadioButtonSimpleField? class
  • Unified the code of creating radio buttons and deleted the especific class for the widget (preview of question) in settings page
  • Ticket #687
  • Added new parameter "name" to RadioButtonSimpleField? class.
  • Fixed a bug in IE7 in the popups with the rating info
Location:
indico
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/webinterface/rh/abstractModif.py

    rfe1e0a rccf4df  
    429429            for question in conf.getConfAbstractReview().getReviewingQuestions(): 
    430430                c += 1 
    431                 if not params.has_key("_GID"+str(c)): 
     431                if not params.has_key("RB_"+str(c)): 
    432432                    raise FormValuesError(_("Please, reply to all the reviewing questions. Question \"%s\" is missing the answer.")%question.getText()) 
    433                 rbValue = int(params.get("_GID"+str(c),scaleLower)) 
     433                rbValue = int(params.get("RB_"+str(c),scaleLower)) 
    434434                newId = conf.getConfAbstractReview().getNewAnswerId() 
    435435                newAnswer = Answer(newId, rbValue, numberOfAnswers, question) 
  • indico/MaKaC/webinterface/rh/trackModif.py

    r5ce34c rccf4df  
    3131from MaKaC.webinterface.rh.conferenceBase import RHTrackBase 
    3232from MaKaC.webinterface.rh.base import RHModificationBaseProtected 
    33 from MaKaC.errors import MaKaCError 
     33from MaKaC.errors import MaKaCError, FormValuesError 
    3434from MaKaC.PDFinterface.conference import TrackManagerAbstractToPDF, TrackManagerAbstractsToPDF 
    3535from MaKaC.common import Config 
     
    428428            for question in self._target.getConference().getConfAbstractReview().getReviewingQuestions(): 
    429429                c += 1 
    430                 rbValue = int(params.get("_GID"+str(c),scaleLower)) 
     430                if not params.has_key("RB_"+str(c)): 
     431                    raise FormValuesError(_("Please, reply to all the reviewing questions. Question \"%s\" is missing the answer.")%question.getText()) 
     432                rbValue = int(params.get("RB_"+str(c),scaleLower)) 
    431433                newId = self._target.getConference().getConfAbstractReview().getNewAnswerId() 
    432434                newAnswer = Answer(newId, rbValue, numberOfAnswers, question) 
  • indico/MaKaC/webinterface/tpls/AbstractReviewingSetup.tpl

    rc0de5a rccf4df  
    5454// Component for example question 
    5555var previewQuestion =  new ExampleQuestionWidget('abstractReviewing.questions.updateExampleQuestion', 
    56         {conference: '${ abstractReview.getConference().getId() }'}); 
     56        {conference: '${ abstractReview.getConference().getId() }'}, 'inPlaceShowExample'); 
    5757previewQuestion.draw(); 
    5858 
  • indico/MaKaC/webinterface/tpls/AbstractTrackManagment.tpl

    rc0de5a rccf4df  
    2727    var table = Html.table({className:'infoQuestionsTable', cellspacing:'0'}); 
    2828    content.append(table); 
     29    var tbody = Html.tbody(); 
     30    table.append(tbody); 
    2931    var trHeaders = Html.tr(); 
    30     table.append(trHeaders); 
     32    tbody.append(trHeaders); 
    3133    var tdQuestion = Html.td({className:'dataHeader'},'Question'); 
    3234    var tdValues = Html.td({className:'dataHeader'},'Value'); 
     
    4244        tdQ = Html.td({className: 'content'}, questions[i]); 
    4345        tdA = Html.td({className: 'content'}, answers[i]); 
    44         table.append(tr); 
     46        tbody.append(tr); 
    4547        tr.append(tdQ); 
    4648        tr.append(tdA); 
     
    5355    tdTotal = Html.td({className:'dataFooter'}, 'Total'); 
    5456    tdTotalValue = Html.td({className:'dataFooter'}, total); 
    55     table.append(trTotal); 
     57    tbody.append(trTotal); 
    5658    trTotal.append(tdTotal); 
    5759    trTotal.append(tdTotalValue); 
     
    6365    tdAverage = Html.td({className:'dataBold'}, 'Average'); 
    6466    tdValue = Html.td({className:'dataBold'}, average); 
    65     table.append(trFooter); 
     67    tbody.append(trFooter); 
    6668    trFooter.append(tdAverage); 
    6769    trFooter.append(tdValue); 
  • indico/MaKaC/webinterface/tpls/Abstracts.tpl

    rc0de5a rccf4df  
    368368    var table = Html.table({className:'infoQuestionsTable', cellspacing:'0'}); 
    369369    content.append(table); 
     370    var tbody = Html.tbody(); 
     371    table.append(tbody); 
    370372    var trHeaders = Html.tr(); 
    371     table.append(trHeaders); 
     373    tbody.append(trHeaders); 
    372374    var tdQuestion = Html.td({className:'dataHeader'},'Question'); 
    373375    var tdValues = Html.td({className:'dataHeader'},'Average'); 
     
    383385        tdQ = Html.td({className: 'content'}, questions[i]); 
    384386        tdA = Html.td({className: 'content'}, answers[i]); 
    385         table.append(tr); 
     387        tbody.append(tr); 
    386388        tr.append(tdQ); 
    387389        tr.append(tdA); 
    388390    } 
    389391 
    390     // Create the last row with the average 
    391     //var trFooter = Html.tr(); 
    392     //var tdAverage = Html.td(); 
    393     //var tdValue = Html.td(); 
    394     //tdAverage = Html.td({className:'dataFooter'}, 'Total abstract'); 
    395     //tdValue = Html.td({className:'dataFooter'}, average); 
    396     //table.append(trFooter); 
    397     //trFooter.append(tdAverage); 
    398     //trFooter.append(tdValue); 
    399  
    400  
    401392    popup = new AlertPopup('Average per question',content); 
    402393    popup.open(); 
  • indico/MaKaC/webinterface/tpls/ConfModAbstractPropToAcc.tpl

    rc0de5a rccf4df  
    11<% from MaKaC.common.fossilize import fossilize %> 
    22 
    3 <form action=${ postURL } method="POST" onsubmit="return checkQuestionsAnswered();"> 
     3<form action=${ postURL } method="POST" onsubmit="return questionsManager.checkQuestionsAnswered();"> 
    44    <table width="60%" align="left" border="0" cellspacing="6" cellpadding="2" style="padding-top:15px; padding-left:15px;"> 
    55        <tr> 
     
    5757% if len(abstractReview.getReviewingQuestions()) > 0: 
    5858<script type="text/javascript"> 
     59// JS vars needed from the server. 
     60var numQuestions = ${ len(abstractReview.getReviewingQuestions()) }; 
     61var reviewingQuestions = ${ fossilize(abstractReview.getReviewingQuestions()) }; 
     62var range = ${ str(range(abstractReview.getNumberOfAnswers())) }; 
     63var labels = ${ str(abstractReview.getRBLabels()) }; 
     64var numAnswers = ${ abstractReview.getNumberOfAnswers() }; 
     65var rbValues = ${ str(abstractReview.getRBTitles()) }; 
    5966 
    60 var questionPM = new IndicoUtil.parameterManager(); 
     67var divId = 'questionListDisplay'; 
    6168 
    62 var showQuestions = function() { 
    63  
    64     var numQuestions = ${ len(abstractReview.getReviewingQuestions()) }; 
    65     var newDiv; 
    66     var reviewingQuestions = ${ fossilize(abstractReview.getReviewingQuestions()) }; 
    67     var range = ${ str(range(abstractReview.getNumberOfAnswers())) }; 
    68     var labels = ${ str(abstractReview.getRBLabels()) }; 
    69  
    70     $E("questionListDisplay").set(''); 
    71     for (var i=0; i<numQuestions; i++) { 
    72         newDiv = Html.div({style:{marginLeft:'10px'}}); 
    73         newDiv.append(Html.span(null, reviewingQuestions[i].text)); 
    74         newDiv.append(Html.br()); 
    75  
    76         var rbsf = new RadioButtonSimpleField(null, range, labels); 
    77         rbsf.plugParameterManager(questionPM); 
    78         newDiv.append(rbsf.draw()); 
    79  
    80         $E("questionListDisplay").append(newDiv); 
    81         $E("questionListDisplay").append(Html.br()); 
    82     } 
    83  
    84     var numAnswers = ${ abstractReview.getNumberOfAnswers() }; 
    85     var rbValues = ${ str(abstractReview.getRBTitles()) }; 
    86     var groupName = "_GID" // The common name for all the radio buttons 
    87  
    88     for (var i=1; i<numQuestions+1; i++) { 
    89         for (var j=0; j<numAnswers; j++) { 
    90             $E(groupName+i + "_" + j).dom.onmouseover = function(event) { 
    91                 var value = rbValues[this.defaultValue]; 
    92                 IndicoUI.Widgets.Generic.tooltip(this, event, "<span style='padding:3px'>"+value+"</span>"); 
    93             }; 
    94         } 
    95     } 
    96 }; 
    97  
    98 var checkQuestionsAnswered = function() { 
    99     if(questionPM.check()) { 
    100         return true; 
    101     } 
    102  
    103     alert($T('Please answer all questions.')); 
    104     return false; 
    105 }; 
    106  
    107 showQuestions(); 
     69var questionsManager = new QuestionsManager(divId, numQuestions, reviewingQuestions, range, labels, numAnswers, rbValues); 
     70questionsManager.showQuestions(); 
    10871 
    10972</script> 
  • indico/MaKaC/webinterface/tpls/ConfModAbstractPropToRej.tpl

    rc0de5a rccf4df  
    11<% from MaKaC.common.fossilize import fossilize %> 
    22 
    3 <form action=${ postURL } method="POST" onsubmit="return checkQuestionsAnswered();"> 
     3<form action=${ postURL } method="POST" onsubmit="return questionsManager.checkQuestionsAnswered();"> 
    44    <table width="60%" align="left" border="0" cellspacing="6" cellpadding="2" style="padding-top:15px; padding-left:15px;"> 
    55        <tr> 
     
    4949% if len(abstractReview.getReviewingQuestions()) > 0: 
    5050<script type="text/javascript"> 
     51// JS vars needed from the server. 
     52var numQuestions = ${ len(abstractReview.getReviewingQuestions()) }; 
     53var reviewingQuestions = ${ fossilize(abstractReview.getReviewingQuestions()) }; 
     54var range = ${ str(range(abstractReview.getNumberOfAnswers())) }; 
     55var labels = ${ str(abstractReview.getRBLabels()) }; 
     56var numAnswers = ${ abstractReview.getNumberOfAnswers() }; 
     57var rbValues = ${ str(abstractReview.getRBTitles()) }; 
    5158 
    52 var questionPM = new IndicoUtil.parameterManager(); 
     59var divId = 'questionListDisplay'; 
    5360 
    54 var showQuestions = function() { 
    55  
    56     var numQuestions = ${ len(abstractReview.getReviewingQuestions()) }; 
    57     var newDiv; 
    58     var reviewingQuestions = ${ fossilize(abstractReview.getReviewingQuestions()) }; 
    59     var range = ${ str(range(abstractReview.getNumberOfAnswers())) }; 
    60     var labels = ${ str(abstractReview.getRBLabels()) }; 
    61  
    62     $E("questionListDisplay").set(''); 
    63     for (var i=0; i<numQuestions; i++) { 
    64         newDiv = Html.div({style:{marginLeft:'10px'}}); 
    65         newDiv.append(Html.span(null, reviewingQuestions[i].text)); 
    66         newDiv.append(Html.br()); 
    67  
    68         var rbsf = new RadioButtonSimpleField(null, range, labels); 
    69         rbsf.plugParameterManager(questionPM); 
    70         newDiv.append(rbsf.draw()); 
    71  
    72         $E("questionListDisplay").append(newDiv); 
    73         $E("questionListDisplay").append(Html.br()); 
    74     } 
    75  
    76     var numAnswers = ${ abstractReview.getNumberOfAnswers() }; 
    77     var rbValues = ${ str(abstractReview.getRBTitles()) }; 
    78     var groupName = "_GID" // The common name for all the radio buttons 
    79  
    80     for (var i=1; i<numQuestions+1; i++) { 
    81         for (var j=0; j<numAnswers; j++) { 
    82             $E(groupName+i + "_" + j).dom.onmouseover = function(event) { 
    83                 var value = rbValues[this.defaultValue]; 
    84                 IndicoUI.Widgets.Generic.tooltip(this, event, "<span style='padding:3px'>"+value+"</span>"); 
    85             }; 
    86         } 
    87     } 
    88  
    89 }; 
    90  
    91 var checkQuestionsAnswered = function() { 
    92     if(questionPM.check()) { 
    93         return true; 
    94     } 
    95  
    96     alert($T('Please answer all questions.')); 
    97     return false; 
    98 }; 
    99  
    100 showQuestions(); 
     61var questionsManager = new QuestionsManager(divId, numQuestions, reviewingQuestions, range, labels, numAnswers, rbValues); 
     62questionsManager.showQuestions(); 
    10163 
    10264</script> 
  • indico/MaKaC/webinterface/tpls/TrackAbstractPropToAcc.tpl

    rc0de5a rccf4df  
    11<% from MaKaC.common.fossilize import fossilize %> 
    22 
    3 <form action="${ postURL }" method="POST" onsubmit="return checkQuestionsAnswered();"> 
     3<form action="${ postURL }" method="POST" onsubmit="return questionsManager.checkQuestionsAnswered();"> 
    44    <table align="left" width="50%" border="0" cellspacing="6" cellpadding="2" style="padding-left:15px;"> 
    55        <tr> 
     
    4545% if len(abstractReview.getReviewingQuestions()) > 0: 
    4646<script type="text/javascript"> 
     47// JS vars needed from the server. 
     48var numQuestions = ${ len(abstractReview.getReviewingQuestions()) }; 
     49var reviewingQuestions = ${ fossilize(abstractReview.getReviewingQuestions()) }; 
     50var range = ${ str(range(abstractReview.getNumberOfAnswers())) }; 
     51var labels = ${ str(abstractReview.getRBLabels()) }; 
     52var numAnswers = ${ abstractReview.getNumberOfAnswers() }; 
     53var rbValues = ${ str(abstractReview.getRBTitles()) }; 
    4754 
    48 var questionPM = new IndicoUtil.parameterManager(); 
     55var divId = 'questionListDisplay'; 
    4956 
    50 var showQuestions = function() { 
    51  
    52     var numQuestions = ${ len(abstractReview.getReviewingQuestions()) }; 
    53     var newDiv; 
    54     var reviewingQuestions = ${ fossilize(abstractReview.getReviewingQuestions()) }; 
    55     var range = ${ str(range(abstractReview.getNumberOfAnswers())) }; 
    56     var labels = ${ str(abstractReview.getRBLabels()) }; 
    57  
    58     $E("questionListDisplay").set(''); 
    59     for (var i=0; i<numQuestions; i++) { 
    60         newDiv = Html.div({style:{marginLeft:'10px'}}); 
    61         newDiv.append(Html.span(null, reviewingQuestions[i].text)); 
    62         newDiv.append(Html.br()); 
    63  
    64         var rbsf = new RadioButtonSimpleField(null, range, labels); 
    65         rbsf.plugParameterManager(questionPM); 
    66         newDiv.append(rbsf.draw()); 
    67  
    68         $E("questionListDisplay").append(newDiv); 
    69         $E("questionListDisplay").append(Html.br()); 
    70     } 
    71  
    72     var numAnswers = ${ abstractReview.getNumberOfAnswers() }; 
    73     var rbValues = ${ str(abstractReview.getRBTitles()) }; 
    74     var groupName = "_GID" // The common name for all the radio buttons 
    75  
    76     for (var i=1; i<numQuestions+1; i++) { 
    77         for (var j=0; j<numAnswers; j++) { 
    78             $E(groupName+i + "_" + j).dom.onmouseover = function(event) { 
    79                 var value = rbValues[this.defaultValue]; 
    80                 IndicoUI.Widgets.Generic.tooltip(this, event, "<span style='padding:3px'>"+value+"</span>"); 
    81             }; 
    82         } 
    83     } 
    84 }; 
    85  
    86 var checkQuestionsAnswered = function() { 
    87     if(questionPM.check()) { 
    88         return true; 
    89     } 
    90  
    91     alert($T('Please answer all questions.')); 
    92     return false; 
    93 }; 
    94  
    95 showQuestions(); 
    96  
     57var questionsManager = new QuestionsManager(divId, numQuestions, reviewingQuestions, range, labels, numAnswers, rbValues); 
     58questionsManager.showQuestions(); 
    9759 
    9860</script> 
  • indico/MaKaC/webinterface/tpls/TrackAbstractPropToRej.tpl

    rc0de5a rccf4df  
    11<% from MaKaC.common.fossilize import fossilize %> 
    22 
    3 <form action="${ postURL }" method="POST" onsubmit="return checkQuestionsAnswered();"> 
     3<form action="${ postURL }" method="POST" onsubmit="return questionsManager.checkQuestionsAnswered();"> 
    44    <table align="left" width="50%" border="0" cellspacing="6" cellpadding="2" style="padding-left:15px;"> 
    55        <tr> 
     
    4444% if len(abstractReview.getReviewingQuestions()) > 0: 
    4545<script type="text/javascript"> 
     46// JS vars needed from the server. 
     47var numQuestions = ${ len(abstractReview.getReviewingQuestions()) }; 
     48var reviewingQuestions = ${ fossilize(abstractReview.getReviewingQuestions()) }; 
     49var range = ${ str(range(abstractReview.getNumberOfAnswers())) }; 
     50var labels = ${ str(abstractReview.getRBLabels()) }; 
     51var numAnswers = ${ abstractReview.getNumberOfAnswers() }; 
     52var rbValues = ${ str(abstractReview.getRBTitles()) }; 
    4653 
    47 var questionPM = new IndicoUtil.parameterManager(); 
     54var divId = 'questionListDisplay'; 
    4855 
    49 var showQuestions = function() { 
    50  
    51     var numQuestions = ${ len(abstractReview.getReviewingQuestions()) }; 
    52     var newDiv; 
    53     var reviewingQuestions = ${ fossilize(abstractReview.getReviewingQuestions()) }; 
    54     var range = ${ str(range(abstractReview.getNumberOfAnswers())) }; 
    55     var labels = ${ str(abstractReview.getRBLabels()) }; 
    56  
    57     $E("questionListDisplay").set(''); 
    58     for (var i=0; i<numQuestions; i++) { 
    59         newDiv = Html.div({style:{marginLeft:'10px'}}); 
    60         newDiv.append(Html.span(null, reviewingQuestions[i].text)); 
    61         newDiv.append(Html.br()); 
    62  
    63         var rbsf = new RadioButtonSimpleField(null, range, labels); 
    64         rbsf.plugParameterManager(questionPM); 
    65         newDiv.append(rbsf.draw()); 
    66  
    67         $E("questionListDisplay").append(newDiv); 
    68         $E("questionListDisplay").append(Html.br()); 
    69     } 
    70  
    71     var numAnswers = ${ abstractReview.getNumberOfAnswers() }; 
    72     var rbValues = ${ str(abstractReview.getRBTitles()) }; 
    73     var groupName = "_GID" // The common name for all the radio buttons 
    74  
    75     for (var i=1; i<numQuestions+1; i++) { 
    76         for (var j=0; j<numAnswers; j++) { 
    77             $E(groupName+i + "_" + j).dom.onmouseover = function(event) { 
    78                 var value = rbValues[this.defaultValue]; 
    79                 IndicoUI.Widgets.Generic.tooltip(this, event, "<span style='padding:3px'>"+value+"</span>"); 
    80             }; 
    81         } 
    82     } 
    83 }; 
    84  
    85 var checkQuestionsAnswered = function() { 
    86     if(questionPM.check()) { 
    87         return true; 
    88     } 
    89  
    90     alert($T('Please answer all questions.')); 
    91     return false; 
    92 }; 
    93  
    94 showQuestions(); 
     56var questionsManager = new QuestionsManager(divId, numQuestions, reviewingQuestions, range, labels, numAnswers, rbValues); 
     57questionsManager.showQuestions(); 
    9558 
    9659</script> 
  • indico/htdocs/js/indico/Management/AbstractReviewing.js

    re91f7d rccf4df  
    136136        { 
    137137            draw: function() { 
    138                 this.numReq += 1; 
     138 
    139139                var self = this; 
    140140                // Request to get the new values of number of answers and labels 
     
    148148                                content.append(Html.span(null,question)); 
    149149                                content.append(Html.br()); 
    150                                 content.append(new RadioButtonPreviewQuestion( 
    151                                         numberAnswers, 
    152                                         labels, 
    153                                         self.numReq).draw()); 
    154                                 $E('inPlaceShowExample').set(content); 
    155                                 for (var j=0; j<numberAnswers.length; j++) { 
    156                                     $E("_GID"+self.numReq+"_" + j).dom.onmouseover = function(event) { 
    157                                         var value = rbValues[this.defaultValue]; 
    158                                         IndicoUI.Widgets.Generic.tooltip(this, event, "<span style='padding:3px'>"+value+"</span>"); 
    159                                     }; 
    160                                 } 
     150                                var rbuttons = new RadioButtonSimpleField(null, numberAnswers, labels, rbValues); 
     151                                content.append(rbuttons.draw()); 
     152 
     153                                $E(self.divId).set(content); 
     154 
     155                                rbuttons.addRBTitles(); 
    161156                            } else { 
    162157                                IndicoUtil.errorReport(error); 
     
    166161        }, 
    167162 
    168         function(method, attributes) { 
     163        function(method, attributes, divId) { 
    169164            this.method = method; 
    170165            this.attributes = attributes; 
    171             this.numReq = 0; 
    172166            this.InlineWidget(); 
     167            this.divId = divId; 
    173168        }); 
    174169 
     
    212207            draw: function() { 
    213208 
    214                 var groupName = Html.generateId(); // The common name for all the radio buttons 
     209                this.groupName = Html.generateId(); // The common name for all the radio buttons 
    215210 
    216211                var radioButtons = []; // List of radio buttons 
     
    219214                    // For every option we create a radio button 
    220215                    var rb = Html.radio({ 
    221                         name: groupName, 
    222                         id: groupName + "_" + i, 
     216                        name: this.name, 
     217                        id: this.groupName + "_" + i, 
    223218                        className: "radioButtonAnswer" 
    224219                    }); 
     
    251246                    cell1.dom.align = 'center'; 
    252247                    cell1.append(Html.label({ 
    253                         htmlFor: groupName + "_" + l 
     248                        htmlFor: this.groupName + "_" + l 
    254249                    }, this.labels[l])); 
    255250                    row1.append(cell1); 
     
    272267 
    273268                this.radioButtons = radioButtons; 
     269 
    274270                return table; 
     271            }, 
     272 
     273            addRBTitles: function() { 
     274                var self = this; 
     275                // Add the titles for the radio buttons 
     276                for (var i=0; i<this.radioButtons.length; i++) { 
     277                    $E(this.radioButtons[i].dom.id).dom.onmouseover = function(event) { 
     278                        var value = self.rbValues[this.defaultValue]; 
     279                        IndicoUI.Widgets.Generic.tooltip(this, event, "<span style='padding:3px'>"+value+"</span>"); 
     280                    }; 
     281                } 
    275282            } 
    276283        }, 
    277284 
    278         function(element, options, labels, initialValue, handler) { 
     285        function(element, options, labels, rbValues, name, initialValue, handler) { 
    279286            this.element = element; 
    280287            this.options = options; 
     
    282289            this.initialValue = initialValue; 
    283290            this.handler = handler; 
    284         }); 
    285  
    286  
    287 type("RadioButtonPreviewQuestion", [], 
    288         { 
    289             draw: function() { 
    290  
    291                 var groupName = "_GID"+this.numId; // The common name for all the radio buttons 
    292  
    293                 var radioButtons = []; // List of radio buttons 
    294  
    295                 for (var i=0; i<this.options.length; i++) { 
    296                     // For every option we create a radio button 
    297                     var rb = Html.radio({ 
    298                         name: groupName, 
    299                         id: groupName + "_" + i, 
    300                         className: "radioButtonAnswer" 
    301                     }); 
    302                     rb.dom.value = this.options[i]; //For some reason we have to set the value like this and not in the constructor for it to work in IE 
    303                     radioButtons.push(rb); 
    304                 } 
    305  
    306                 Logic.onlyOne(radioButtons, false); //Ensures that only 1 radio button will be selected at a given time 
    307  
    308                 var table = Html.table(); 
    309                 table.dom.style.display = 'inline'; 
    310                 var tbody = Html.tbody(); 
    311                 table.set(tbody); 
    312  
    313                 var row1 = Html.tr(); 
    314                 var row2 = Html.tr(); 
    315  
    316                 for (var l = 0; l < radioButtons.length; l++) { 
    317                     var cell1 = Html.td(); 
    318                     cell1.dom.vAlign = 'bottom'; 
    319                     cell1.dom.align = 'center'; 
    320                     cell1.append(Html.label({ 
    321                         htmlFor: groupName + "_" + l 
    322                     }, this.labels[l])); 
    323                     row1.append(cell1); 
    324  
    325                     var cell2 = Html.td(); 
    326                     cell2.append(radioButtons[l]); 
    327                     row2.append(cell2); 
    328                 } 
    329  
    330                 cellMessage = Html.td(); 
    331                 cellMessage.dom.style.verticalAlign = "middle"; 
    332                 cellMessage.dom.rowSpan = 2; 
    333  
    334                 tbody.append(row1); 
    335                 tbody.append(row2); 
    336  
    337                 return table; 
    338             } 
    339         }, 
    340  
    341         function(options, labels, numId) { 
    342             this.options = options; 
    343             this.labels = labels; 
    344             this.numId = numId; 
     291            this.rbValues = rbValues; 
     292            this.name = name; 
    345293        }); 
    346294 
     
    548496            this.specialRemove = specialRemove; 
    549497        }); 
     498 
     499 
     500 
     501/* Class manager to show questions in the abstract reviewing 
     502@param divId: Identifier of the div destination 
     503@param numQuestions: number of questions 
     504@param reviewingQuestions: questions dictionary 
     505@param range: range for the number of radio buttons 
     506@param labels: labels shown over between the question and the radio buttons to inform the user of the first and last possible values 
     507@param numAnswers: number of radio buttons (possible answers) 
     508@param rbValues: titles for each radio button 
     509@return none. the div is built inside the showQuestions method 
     510*/ 
     511type("QuestionsManager", [], 
     512        { 
     513            showQuestions: function() { 
     514 
     515                var newDiv; 
     516 
     517                $E(divId).set(''); 
     518                for (var i=0; i<this.numQuestions; i++) { 
     519                    newDiv = Html.div({style:{marginLeft:'10px'}}); 
     520                    newDiv.append(Html.span(null, this.reviewingQuestions[i].text)); 
     521                    newDiv.append(Html.br()); 
     522 
     523                    var name = 'RB_' + (i+1); // Name of the rb component 
     524 
     525                    var rbsf = new RadioButtonSimpleField(null, this.range, this.labels, this.rbValues, name); 
     526                    rbsf.plugParameterManager(this.questionPM); 
     527                    newDiv.append(rbsf.draw()); 
     528 
     529                    $E(divId).append(newDiv); 
     530                    $E(divId).append(Html.br()); 
     531                    rbsf.addRBTitles(); 
     532                } 
     533            }, 
     534 
     535            checkQuestionsAnswered: function() { 
     536                if(this.questionPM.check()) { 
     537                    return true; 
     538                } 
     539                alert($T('Please answer all questions.')); 
     540                return false; 
     541            } 
     542        }, 
     543 
     544        function(divId, numQuestions, reviewingQuestions, range, labels, numAnswers, rbValues) { 
     545            this.divId = divId; 
     546            this.numQuestions = numQuestions; 
     547            this.reviewingQuestions = reviewingQuestions; 
     548            this.range = range; 
     549            this.labels = labels; 
     550            this.numAnswers = numAnswers; 
     551            this.rbValues = rbValues; 
     552            this.questionPM = new IndicoUtil.parameterManager(); 
     553        }); 
Note: See TracChangeset for help on using the changeset viewer.