[open-ils-commits] r12196 - in trunk/Open-ILS/web: js/ui/default/actor/user templates/default/actor/user (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Feb 16 23:10:08 EST 2009
Author: erickson
Date: 2009-02-16 23:10:06 -0500 (Mon, 16 Feb 2009)
New Revision: 12196
Modified:
trunk/Open-ILS/web/js/ui/default/actor/user/register.js
trunk/Open-ILS/web/templates/default/actor/user/register.tt2
Log:
plugged in surveys
Modified: trunk/Open-ILS/web/js/ui/default/actor/user/register.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2009-02-17 03:34:13 UTC (rev 12195)
+++ trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2009-02-17 04:10:06 UTC (rev 12196)
@@ -44,6 +44,7 @@
function loadTable() {
var tbody = dojo.byId('uedit-tbody');
+
for(var idx = 0; tbody.childNodes[idx]; idx++) {
var row = tbody.childNodes[idx];
if(row.nodeType != row.ELEMENT_NODE) continue;
@@ -52,13 +53,15 @@
fleshFMRow(row, fmcls);
}
- statCatTemplate = tbody.removeChild(dojo.byId('stat-cat-row-0'));
+ statCatTemplate = tbody.removeChild(dojo.byId('stat-cat-row-template'));
+ surveyTemplate = tbody.removeChild(dojo.byId('survey-row-template'));
+ surveyQuestionTemplate = tbody.removeChild(dojo.byId('survey-question-row-template'));
for(var idx in statCats) {
var stat = statCats[idx];
var row = statCatTemplate.cloneNode(true);
row.id = 'stat-cat-row-' + idx;
- tbody.insertBefore(row, dojo.byId('survey-cat-divider'));
+ tbody.appendChild(row);
dojo.query('[name=name]', row)[0].innerHTML = stat.name();
var valtd = dojo.query('[name=widget]', row)[0];
var span = valtd.appendChild(document.createElement('span'));
@@ -68,6 +71,27 @@
comboBox.labelAttr = 'value';
comboBox.searchAttr = 'value';
}
+
+ for(var idx in surveys) {
+ var survey = surveys[idx];
+ var srow = surveyTemplate.cloneNode(true);
+ tbody.appendChild(srow);
+ dojo.query('[name=name]', srow)[0].innerHTML = survey.name();
+
+ for(var q in survey.questions()) {
+ var quest = survey.questions()[q];
+ var qrow = surveyQuestionTemplate.cloneNode(true);
+ tbody.appendChild(qrow);
+ dojo.query('[name=question]', qrow)[0].innerHTML = quest.question();
+
+ var span = dojo.query('[name=answers]', qrow)[0].appendChild(document.createElement('span'));
+ var store = new dojo.data.ItemFileReadStore(
+ {data:fieldmapper.asva.toStoreData(quest.answers())});
+ var select = new dijit.form.FilteringSelect({store:store}, span);
+ select.labelAttr = 'answer';
+ select.searchAttr = 'answer';
+ }
+ }
}
Modified: trunk/Open-ILS/web/templates/default/actor/user/register.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/actor/user/register.tt2 2009-02-17 03:34:13 UTC (rev 12195)
+++ trunk/Open-ILS/web/templates/default/actor/user/register.tt2 2009-02-17 04:10:06 UTC (rev 12196)
@@ -79,15 +79,19 @@
<tr fmclass='aua' fmfield='country'/>
<tr fmclass='aua' fmfield='valid'/>
<tr fmclass='aua' fmfield='within_city_limits'/>
+
<tr><td class='uedit-help'><td>Billing Address</td>
<td><div dojoType='dijit.form.CheckBox' name='billing-addr-widget'></div></td>
</tr>
<tr><td class='uedit-help'><td>Mailing Address</td>
<td><div dojoType='dijit.form.CheckBox' name='billing-addr-widget'></div></td>
</tr>
+
<tr class='divider' id='stat-cat-divider'><td colspan='10'>Statistical Categories</td></tr>
- <tr id='stat-cat-row-0'><td class='uedit-help'/><td name='name'/><td name='widget'/></tr>
- <tr class='divider' id='survey-cat-divider'><td colspan='10'>Surveys</td></tr>
+ <tr id='stat-cat-row-template'><td class='uedit-help'/><td name='name'/><td name='widget'/></tr>
+
+ <tr id='survey-row-template' class='divider'><td colspan='10' name='name'/></tr>
+ <tr id='survey-question-row-template'><td class='uedit-help'/><td name='question'/><td name='answers'/></tr>
</tbody>
</table>
[% END %]
More information about the open-ils-commits
mailing list