/** * Rendering of an xmpp form as an html form * See http://xmpp.org/extensions/xep-0004.html */ (function( $ ){ var methods = { render: function(){ var result = $('
'); if ( this.find('title').length !== 0 ){ result.append('' + this.find('title') + '
'); } if ( this.find('instructions').length !== 0 ){ result.append('' + this.find('instructions') + '
'); } this.find('field').each(function(index){ var type = $(this).attr("type"); var name = $(this).attr("var"); var required = $(this).find('required').length !== 0; if ( $(this).find('desc').length !== 0 ){ result.append('' + $(this).find('desc').text() + '
'); } if ( $(this).attr('label') !== undefined ){ result.append(''); } switch(type){ case("text-single"): var input = $(''); input.attr('type', 'text'); input.attr('name', name); input.attr('id', 'form-' + name); if ( $(this).find('value').length !== 0 ){ input.attr('value', $(this).find('value').text()); } result.append(input); result.append('