PluginProbe
Smart Forms – when you need more than just a contact form / 0.6
Smart Forms – when you need more than just a contact form v0.6
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.6, at js/formBuilder/formanalytics.js

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