~ubuntu-branches/ubuntu/trusty/jwchat/trusty

« back to all changes in this revision

Viewing changes to jabber_x_data.js.it

  • Committer: Bazaar Package Importer
  • Author(s): Lincoln de Sousa, Lincoln de Sousa, Marcelo Jorge Vieira
  • Date: 2010-09-16 11:42:28 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100916114228-5s5ne28n1w6wrfbl
Tags: 1.0+dfsg-1
[Lincoln de Sousa]

* Switch to dpkg-source 3.0 (quilt) format
* Migrating package from cdbs to debhelper 7.0.50~
* Changing the rule get-orig-source to generate a dfsg compatible
  package striping swf files from the orig (Closes: #591962)
* Updated Standards-Version to 3.9.1
* Removing po-debconf from the Build-Depends-Indep list.

[Marcelo Jorge Vieira]

* Fixing the default backend
* Fixing Debugger dependency
* Changing information about packaging from old maintainers to
  Debian XMPP Team.
* Removing sound support.
* Setting a port for apache VirtualHost.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
function genJabberXDataTable(x) {
2
 
        var html = '<input type=hidden name="jwchat_form_type" value="jabber:x:data">';
3
 
 
4
 
        if (x.getElementsByTagName('title').item(0))
5
 
                html += "<h1>"+x.getElementsByTagName('title').item(0).firstChild.nodeValue.replace(/\n/g,"<br>")+"</h1>";
6
 
        if (x.getElementsByTagName('instructions').item(0))
7
 
                html += x.getElementsByTagName('instructions').item(0).firstChild.nodeValue.replace(/\n/g,"<br>");
8
 
 
9
 
        if (!x.getElementsByTagName('field').length)
10
 
                return html;
11
 
 
12
 
        html += '<table width="100%">';
13
 
        for (var i=0; i<x.getElementsByTagName('field').length; i++) {
14
 
                var aField = x.getElementsByTagName('field').item(i);
15
 
                html += "<tr>";
16
 
                switch (aField.getAttribute('type')) {
17
 
                case 'hidden':
18
 
                        if (aField.firstChild && aField.firstChild.firstChild)
19
 
                                html += "<td colspan=2><input type=hidden name='"+aField.getAttribute('var')+"' value='"+aField.firstChild.firstChild.nodeValue+"'></td>";
20
 
                        break;
21
 
                case 'fixed':
22
 
                        html += "<td colspan=2><b>"+aField.firstChild.firstChild.nodeValue+"</b></td>";
23
 
                        break;
24
 
                case 'jid-single':
25
 
                case 'text-single':
26
 
                        html += "<th>" + aField.getAttribute('label') + "</th>";
27
 
                        html += "<td>";
28
 
                        html += "<input type=text size='24' name='" + aField.getAttribute('var') + "'";
29
 
                        if (aField.firstChild && aField.firstChild.firstChild)
30
 
                                html += " value='" + aField.firstChild.firstChild.nodeValue + "'";
31
 
                        html += ">";
32
 
                        html += "</td>";
33
 
                        break;
34
 
                case 'text-private':
35
 
                        html += "<th>" + aField.getAttribute('label') + "</th>";
36
 
                        html += "<td>";
37
 
                        html += "<input type=password size='24' name='" + aField.getAttribute('var') + "'";
38
 
                        if (aField.firstChild && aField.firstChild.firstChild)
39
 
                                html += " value='" + aField.firstChild.firstChild.nodeValue + "'";
40
 
                        html += ">";
41
 
                        html += "</td>";
42
 
                        break;
43
 
                case 'jid-multi':
44
 
                case 'text-multi':
45
 
                        html += "<th valign=top>" + aField.getAttribute('label') + "</th>";
46
 
                        html += "<td>";
47
 
                        html += "<textarea cols=24 rows=4 name='" + aField.getAttribute('var') + "'>";
48
 
                        if (aField.firstChild && aField.firstChild.firstChild)
49
 
                                html += aField.firstChild.firstChild.nodeValue;
50
 
                        html += "</textarea>";
51
 
                        html += "</td>";
52
 
                        break;
53
 
                case 'list-single':
54
 
                        html += "<th>" + aField.getAttribute('label') + "</th>";
55
 
                        html += "<td>";
56
 
                        html += "<select name='" + aField.getAttribute('var') + "'>";
57
 
                        if (aField.childNodes.length) {
58
 
                                var val;
59
 
                                for (var j=0; j<aField.childNodes.length; j++) 
60
 
                                        if (aField.childNodes.item(j).nodeName == 'value') 
61
 
                                                val = aField.childNodes.item(j).firstChild.nodeValue;
62
 
                                for (var j=0; j<aField.childNodes.length; j++) {
63
 
                                        if (aField.childNodes.item(j).nodeName == 'option') {
64
 
                                                html += "<option value='" + aField.childNodes.item(j).firstChild.firstChild.nodeValue + "'";
65
 
                                                if (val && val == aField.childNodes.item(j).firstChild.firstChild.nodeValue)
66
 
                                                        html += " selected";
67
 
                                                html += ">"+aField.childNodes.item(j).getAttribute('label')+"</option>";
68
 
                                        }
69
 
                                }
70
 
                        }
71
 
                        html += "</select>";
72
 
                        html += "</td>";
73
 
                        break;
74
 
                case 'list-multi':
75
 
                        html += "<th>" + aField.getAttribute('label') + "</th>";
76
 
                        html += "<td>";
77
 
                        html += "<select name='" + aField.getAttribute('var') + "' "
78
 
                                + "multiple='true'>";
79
 
                        if (aField.childNodes.length) {
80
 
                                for (var j=0; j<aField.childNodes.length; j++) {
81
 
                                        if (aField.childNodes.item(j).nodeName == 'option') {
82
 
                                                html += "<option value='" + aField.childNodes.item(j).firstChild.firstChild.nodeValue + "'";
83
 
//                                              if (x.o[i].value == x.o[i].o[j].value)
84
 
//                                                      html += " selected";
85
 
                                                html += ">"+aField.childNodes.item(j).getAttribute('label')+"</option>";
86
 
                                        }
87
 
                                }
88
 
                        }
89
 
                        html += "</select>";
90
 
                        html += "</td>";
91
 
                        break;
92
 
                case 'boolean':
93
 
                        html += "<th>" + aField.getAttribute('label') + "</th>";
94
 
                        html += "<td>";
95
 
                        html += "<input type=checkbox name='" +aField.getAttribute('var') + "'";
96
 
                        if (aField.firstChild && aField.firstChild.firstChild && aField.firstChild.firstChild.nodeValue == '1')
97
 
                                html += " checked";
98
 
                        html += ">";
99
 
                        html += "</td>";
100
 
                        break;
101
 
                default:
102
 
                        srcW.Debug.log("unknown type: " + aField.getAttribute('type'),1);
103
 
                        break;
104
 
                }
105
 
                html += "</tr>";
106
 
        }
107
 
        html += "</table>";
108
 
 
109
 
        return html;
110
 
}
111
 
 
112
 
function genJabberXDataReply(form) {
113
 
        var xml = "<x xmlns='jabber:x:data' type='submit'>";
114
 
 
115
 
        var els = form.elements;
116
 
        for (var i=0; i<els.length; i++) {
117
 
                if (els[i].name == '' || els[i].value == '' || els[i].name == 'jwchat_form_type')
118
 
                        continue;
119
 
                xml += "<field var='" +els[i].name + "'><value>";
120
 
                if (els[i].type == 'checkbox')
121
 
                        xml += (els[i].checked) ? '1':'0';
122
 
                else
123
 
                        xml += els[i].value;
124
 
                xml += "</value></field>";
125
 
        }
126
 
 
127
 
        xml += "</x>";
128
 
 
129
 
        return xml;
130
 
}