comparison forms.js @ 57:addbf6bbfaa8

Various fixes for the migration to ltx.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 12 Sep 2011 23:45:00 +0200
parents 99bd1d1ac071
children b98e545a94f7
comparison
equal deleted inserted replaced
56:99bd1d1ac071 57:addbf6bbfaa8
60 if (desc[i].type) 60 if (desc[i].type)
61 fieldAttr.type = desc[i].type; 61 fieldAttr.type = desc[i].type;
62 if (desc[i].label) 62 if (desc[i].label)
63 fieldAttr.label = desc[i].label; 63 fieldAttr.label = desc[i].label;
64 } 64 }
65 x.c('field', fieldAttr); 65
66 var field = new Element('field', fieldAttr);
67 x.cnode(field);
66 68
67 if (labels && 69 if (labels &&
68 (desc[i].type == 'list-multi' || 70 (desc[i].type == 'list-multi' ||
69 desc[i].type == 'list-single')) { 71 desc[i].type == 'list-single')) {
70 for (var j in desc[i].options) { 72 for (var j in desc[i].options) {
71 var optAttr = {}; 73 var optAttr = {};
72 if (desc[i].options[j].label) 74 if (desc[i].options[j].label)
73 optAttr.label = desc[i].options[j].label; 75 optAttr.label = desc[i].options[j].label;
74 x.c('option', optAttr).c('value').t(j).up().up(); 76 field.c('option', optAttr).c('value').t(j).up().up();
75 } 77 }
76 } 78 }
77 79
78 if (i == 'FORM_TYPE') 80 if (i == 'FORM_TYPE')
79 x.c('value').t(desc[i].value).up(); 81 field.c('value').t(desc[i].value).up();
80 else if (typeof content[i] != 'undefined') { 82 else if (typeof content[i] != 'undefined') {
81 var md = content[i]; 83 var md = content[i];
82 if (desc[i].type == 'jid-multi' || 84 if (desc[i].type == 'jid-multi' ||
83 desc[i].type == 'list-multi' || 85 desc[i].type == 'list-multi' ||
84 desc[i].type == 'text-multi') { 86 desc[i].type == 'text-multi') {
85 for (var j=0; j<md.length; j++) 87 for (var j=0; j<md.length; j++)
86 x.c('value') 88 field.c('value')
87 .t(md[j].toString()).up(); 89 .t(md[j].toString()).up();
88 } else 90 } else
89 x.c('value').t(md.toString()).up(); 91 field.c('value').t(md.toString()).up();
90 } 92 }
91 93
92 x.up(); 94 x.up();
93 } 95 }
94 return x; 96 return x;