PluginProbe
Smart Forms – when you need more than just a contact form / 0.7
Smart Forms – when you need more than just a contact form v0.7
trunk 0.5 0.5.5 0.6 0.7 0.8 0.8.5 0.9.1
smart-forms / js / formBuilder / formanalytics.js

formanalytics.js in Smart Forms – when you need more than just a contact form 0.7, at js/formBuilder/formanalytics.js

201 lines 5.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 function RedNaoCreateColumn(options)
2 {
3 var elementName=options.ClassName;
4
5 if(elementName=='rednaotextinput')
6 return RedNaoTextInputColumn(options);
7 if(elementName=='rednaoprependedtext')
8 return RedNaoTextInputColumn(options);
9 if(elementName=='rednaoappendedtext')
10 return RedNaoTextInputColumn(options);
11 if(elementName=='rednaoemail')
12 return RedNaoTextInputColumn(options);
13
14
15 if(elementName=='rednaoprependedcheckbox')
16 return RedNaoCheckboxInputColumn(options);
17 if(elementName=='rednaoappendedcheckbox')
18 return RedNaoCheckboxInputColumn(options);
19
20
21
22 if(elementName=='rednaomultiplecheckboxes')
23 return RedNaoMultipleCheckBoxesColumn(options);
24 if(elementName=='rednaoselectbasic')
25 return RedNaoTextInputColumn(options);
26
27 if(elementName=='rednaotextarea')
28 return RedNaoTextInputColumn(options);
29 if(elementName=='rednaomultipleradios')
30 return RedNaoTextInputColumn(options);
31 if(elementName=='rednaodatepicker')
32 return RedNaoDatePicker(options);
33 if(elementName=='rednaoname')
34 return RedNaoName(options);
35
36 if(elementName=='rednaoaddress')
37 return RedNaoAddress(options);
38 if(elementName=='rednaophone')
39 return RedNaoPhone(options);
40 if(elementName=="rednaonumber")
41 return RedNaoTextInputColumn(options);
42
43 }
44
45 function GetObjectOrNull(rowObject,options)
46 {
47 var object=rowObject[options.colModel.index];
48 if(typeof object=='undefined')
49 return null;
50
51 return object;
52
53 }
54
55
56 function RedNaoTextInputColumn(options)
57 {
58 return {"name":options.Label,"index":options.Id,formatter: function (cellvalue, cellOptions, rowObject)
59 {
60 try{
61 var data=GetObjectOrNull(rowObject,cellOptions);
62 if(data==null)
63 return '';
64 return data.value;
65 }catch(exception)
66 {
67 return '';
68 }
69 }};
70 }
71
72
73 function RedNaoCheckboxInputColumn(options)
74 {
75 return {"name":options.Label,"index":options.Id,formatter: function (cellvalue, cellOptions, rowObject)
76 {
77 try{
78 var data=GetObjectOrNull(rowObject,cellOptions);
79 if(data==null)
80 return '';
81 return data.checked+". "+data.value;
82 }catch(exception)
83 {
84 return '';
85 }
86 }};
87 }
88
89 function RedNaoMultipleCheckBoxesColumn(options)
90 {
91 return {"name":options.Label,"index":options.Id,formatter: function (cellvalue, cellOptions, rowObject)
92 {
93 try{
94 var data=GetObjectOrNull(rowObject,cellOptions);
95 if(data==null)
96 return '';
97 var values="";
98
99 for(var i=0;i<data.selectedValues.length;i++)
100 values+=data.selectedValues[i].value.trim()+";";
101 return values;
102 }catch(exception)
103 {
104 return '';
105 }
106 }};
107 }
108
109 function RedNaoDatePicker(options)
110 {
111 return {"name":options.Label,"index":options.Id,formatter: function (cellvalue, cellOptions, rowObject)
112 {
113 try{
114 var data=GetObjectOrNull(rowObject,cellOptions);
115 if(data==null||data.value=="")
116 return '';
117 var dateParts=data.value.split("-");
118 if(dateParts.length!=3)
119 return '';
120
121 var date=new Date(dateParts[0],parseInt(dateParts[1])-1,dateParts[2]);
122
123 return rnJQuery.datepicker.formatDate( options.DateFormat, date );
124 }catch(exception)
125 {
126 return '';
127 }
128 }};
129 }
130
131 function RedNaoName(options)
132 {
133 return {"name":options.Label,"index":options.Id,formatter: function (cellvalue, cellOptions, rowObject)
134 {
135 try{
136 var data=GetObjectOrNull(rowObject,cellOptions);
137 if(data==null)
138 return '';
139 return data.firstName+' '+data.lastName;
140 }catch(exception)
141 {
142 return '';
143 }
144 }};
145 }
146
147
148 function RedNaoPhone(options)
149 {
150 return {"name":options.Label,"index":options.Id,formatter: function (cellvalue, cellOptions, rowObject)
151 {
152 try{
153 var data=GetObjectOrNull(rowObject,cellOptions);
154 if(data==null)
155 return '';
156 return data.area+'-'+data.phone;
157 }catch(exception)
158 {
159 return '';
160 }
161 }};
162 }
163
164
165 function RedNaoAddress(options)
166 {
167 return {"name":options.Label,"index":options.Id,formatter: function (cellvalue, cellOptions, rowObject)
168 {
169 try{
170 var data=GetObjectOrNull(rowObject,cellOptions);
171 if(data==null)
172 return '';
173
174 var appendAddressElement=function(address,element){
175 if(element==""||typeof element=='undefined')
176 return address;
177
178 if(address=="")
179 address=element;
180 else
181 address+=", "+element;
182
183 return address;
184
185 }
186
187 var address="";
188 address=appendAddressElement(address,data.streetAddress1);
189 address=appendAddressElement(address,data.streetAddress2);
190 address=appendAddressElement(address,data.city);
191 address=appendAddressElement(address,data.state);
192 address=appendAddressElement(address,data.zip);
193 address=appendAddressElement(address,data.country);
194
195 return address;
196 }catch(exception)
197 {
198 return '';
199 }
200 }};
201 }