Form Maker by WD – user-friendly drag & drop Form Builder plugin - Version 1.11.6

Version Description

  • Fixed: Shortcode editor pop-up styles.
  • Fixed: Scripts enqueue in Manage Forms page.
  • Fixed: MySQL Mapping fields list scrolling.
Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 Form Maker by WD – user-friendly drag & drop Form Builder plugin
Version 1.11.6
Comparing to
See all releases

Code changes from version 1.11.5 to 1.11.6

admin/views/FMViewFormMakerSQLMapping.php CHANGED
@@ -1,1467 +1,1471 @@
1
- <?php
2
-
3
- class FMViewFormMakerSQLMapping {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
-
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model) {
20
- $this->model = $model;
21
- }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
-
26
- public function edit_query($id, $form_id) {
27
- wp_print_scripts('jquery');
28
- wp_print_scripts('jquery-ui-tooltip');
29
- ?>
30
- <link media="all" type="text/css" href="<?php echo WD_FM_URL . '/css/style.css'; ?>" rel="stylesheet">
31
- <link rel="stylesheet" href="<?php echo WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css'; ?>">
32
- <?php
33
- $label = $this->model->get_labels($form_id);
34
- $query_obj = $this->model->get_query($id);
35
-
36
- $temp = explode('***wdfcon_typewdf***',$query_obj->details);
37
- $con_type = $temp[0];
38
- $temp = explode('***wdfcon_methodwdf***',$temp[1]);
39
- $con_method = $temp[0];
40
- $temp = explode('***wdftablewdf***',$temp[1]);
41
- $table_cur = $temp[0];
42
- $temp = explode('***wdfhostwdf***',$temp[1]);
43
- $host = $temp[0];
44
- $temp = explode('***wdfportwdf***',$temp[1]);
45
- $port = $temp[0];
46
- $temp = explode('***wdfusernamewdf***',$temp[1]);
47
- $username = $temp[0];
48
- $temp = explode('***wdfpasswordwdf***',$temp[1]);
49
- $password = $temp[0];
50
- $temp = explode('***wdfdatabasewdf***',$temp[1]);
51
- $database = $temp[0];
52
- $details = $temp[1];
53
-
54
- $tables = $this->model->get_tables_saved($con_type, $username, $password, $database, $host);
55
- $table_struct = $this->model->get_table_struct_saved($con_type, $username, $password, $database, $host, $table_cur, $con_method);
56
-
57
- $filter_types=array("type_submit_reset", "type_map", "type_editor", "type_captcha", "type_recaptcha", "type_button", "type_paypal_total", "type_send_copy");
58
- $label_id= array();
59
- $label_order= array();
60
- $label_order_original= array();
61
- $label_type= array();
62
-
63
- $label_all = explode('#****#',$label);
64
- $label_all = array_slice($label_all,0, count($label_all)-1);
65
-
66
- foreach($label_all as $key => $label_each) {
67
- $label_id_each=explode('#**id**#',$label_each);
68
- $label_oder_each=explode('#**label**#', $label_id_each[1]);
69
-
70
- if(in_array($label_oder_each[1],$filter_types))
71
- continue;
72
-
73
- array_push($label_id, $label_id_each[0]);
74
- array_push($label_order_original, $label_oder_each[0]);
75
- $ptn = "/[^a-zA-Z0-9_]/";
76
- $rpltxt = "";
77
- $label_temp=preg_replace($ptn, $rpltxt, $label_oder_each[0]);
78
- array_push($label_order, $label_temp);
79
- array_push($label_type, $label_oder_each[1]);
80
- }
81
-
82
- $form_fields='';
83
- foreach($label_id as $key => $lid) {
84
- $form_fields.='<a onclick="insert_field('.$lid.'); jQuery(\'#fieldlist\').hide();" style="display:block; text-decoration:none;">'.$label_order_original[$key].'</a>';
85
- }
86
- $user_fields = array("subid"=>"Submission ID", "ip"=>"Submitter's IP", "userid"=>"User ID", "username"=>"Username", "useremail"=>"User Email");
87
- foreach($user_fields as $user_key=>$user_field) {
88
- $form_fields.='<a onclick="insert_field(\''.$user_key.'\'); jQuery(\'#fieldlist\').hide();" style="display:block; text-decoration:none;">'.$user_field.'</a>';
89
- }
90
-
91
- $cond='<div id="condid"><select id="sel_condid" style="width: 160px">';
92
- foreach($table_struct as $col) {
93
- $cond.='<option>'.str_replace("'", "SingleQuot", $col->Field).'</option>';
94
- }
95
- $cond.='</select>';
96
- $cond.='<select id="op_condid"><option value="=" selected="selected">=</option><option value="!=">!=</option><option value=">">&gt;</option><option value="<">&lt;</option><option value=">=">&gt;=</option><option value="<=">&lt;=</option><option value="%..%">Like</option><option value="%..">Starts with</option><option value="..%">Ends with</option></select><input id="val_condid" style="width:170px" type="text" /><select id="andor_condid" style="visibility: hidden;"><option value="AND">AND</option><option value="OR">OR</option></select><img src="' . WD_FM_URL . '/images/delete.png?ver='. WD_FM_VERSION.'" onclick="delete_cond(&quot;condid&quot;)" style="vertical-align: middle;"></div>';
97
- ?>
98
- <script>
99
- function connect() {
100
- jQuery("input[type='radio']").attr('disabled','');
101
- jQuery('#struct').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
102
- jQuery("#struct").load('index.php?option=com_formmaker&task=db_tables&con_type='+jQuery('input[name=con_type]:checked').val()+'&con_method='+jQuery('input[name=con_method]:checked').val()+'&format=row');
103
- }
104
- jQuery(document).ready(function() {
105
- jQuery("#tables").change(function (){
106
- jQuery("#struct").removeClass("fm_loading");
107
- jQuery("#table_struct").load('index.php?option=com_formmaker&task=db_table_struct&name='+jQuery(this).val()+'&con_type='+jQuery('input[name=con_type]:checked').val()+'&con_method='+jQuery('input[name=con_method]:checked').val()+'&host='+jQuery('#host_rem').val()+'&port='+jQuery('#port_rem').val()+'&username='+jQuery('#username_rem').val()+'&password='+jQuery('#password_rem').val()+'&database='+jQuery('#database_rem').val()+'&format=row&id='+jQuery("#form_id").val());
108
- });
109
- jQuery('html').click(function() {
110
- if(jQuery("#fieldlist").css('display')=="block") {
111
- jQuery("#fieldlist").hide();
112
- }
113
- });
114
- jQuery('.cols input[type="text"]').on('click', function(event) {
115
- event.stopPropagation();
116
- jQuery("#fieldlist").css("top",jQuery(this).offset().top+jQuery(this).height()+2);
117
- jQuery("#fieldlist").css("left",jQuery(this).offset().left);
118
- jQuery("#fieldlist").slideDown('fast');
119
- selected_field=this.id;
120
- });
121
- jQuery('#query_txt').click(function(event) {
122
- event.stopPropagation();
123
- jQuery("#fieldlist").css("top",jQuery(this).offset().top+jQuery(this).height()+2);
124
- jQuery("#fieldlist").css("left",jQuery(this).offset().left);
125
- jQuery("#fieldlist").slideDown('fast');
126
- selected_field=this.id;
127
- });
128
- jQuery('#fieldlist').click(function(event){
129
- event.stopPropagation();
130
- });
131
- jQuery('.add_cond').click( function() {
132
- jQuery('.cols').append(conds.replace(/condid/g, cond_id++).replace('SingleQuot', "'"));
133
- update_vis();
134
- });
135
- });
136
- var selected_field ='';
137
- var isvisible = 1;
138
- var cond_id = 1;
139
- conds='<?php echo $cond ?>';
140
- fields=new Array(<?php
141
- $fields = "";
142
- if($table_struct) {
143
- foreach($table_struct as $col) {
144
- $fields.=' "'.$col->Field.'",';
145
- }
146
- echo substr($fields, 0, -1);
147
- }
148
- ?>);
149
-
150
- function dis(id, x) {
151
- if(x)
152
- jQuery('#'+id).removeAttr('disabled');
153
- else
154
- jQuery('#'+id).attr('disabled','disabled');
155
- }
156
- function update_vis() {
157
- previous=0;
158
- for(i=1; i<cond_id; i++) {
159
- if(jQuery('#'+i).html()) {
160
- jQuery('#andor_'+i).css('visibility', 'hidden');
161
- if(previous)
162
- jQuery('#andor_'+previous).css('visibility', 'visible');
163
- previous=i;
164
- }
165
- }
166
- }
167
- function delete_cond(id) {
168
- jQuery('#'+id).remove();
169
- update_vis();
170
- }
171
- function save_query() {
172
- con_type =jQuery('input[name=con_type]:checked').val();
173
- con_method =jQuery('input[name=con_method]:checked').val();
174
- table =jQuery('#tables').val();
175
- host =jQuery('#host_rem').val();
176
- port =jQuery('#port_rem').val();
177
- username =jQuery('#username_rem').val();
178
- password =jQuery('#password_rem').val();
179
- database =jQuery('#database_rem').val();
180
-
181
- str=con_type+"***wdfcon_typewdf***"+con_method+"***wdfcon_methodwdf***"+table+"***wdftablewdf***"+host+"***wdfhostwdf***"+port+"***wdfportwdf***"+username+"***wdfusernamewdf***"+password+"***wdfpasswordwdf***"+database+"***wdfdatabasewdf***";
182
-
183
- if(fields.length) {
184
- for(i=0; i<fields.length; i++) {
185
- str+=fields[i]+'***wdfnamewdf***'+jQuery('#'+fields[i]).val()+'***wdfvaluewdf***'+jQuery('#ch_'+fields[i]+":checked" ).length+'***wdffieldwdf***';
186
- }
187
- }
188
-
189
- for(i=1; i<cond_id; i++) {
190
- if(jQuery('#'+i).html()) {
191
- str+=jQuery('#sel_'+i).val()+'***sel***'+jQuery('#op_'+i).val()+'***op***'+jQuery('#val_'+i).val()+'***val***'+jQuery('#andor_'+i).val()+'***where***';
192
- }
193
- }
194
- if(!jQuery('#query_txt').val()) {
195
- gen_query();
196
- }
197
- jQuery('#details').val(str);
198
- var datatxt = jQuery("#query_form").serialize()+'&form_id='+jQuery("#form_id").val();
199
-
200
- if(jQuery('#query_txt').val()) {
201
- jQuery('.c1').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
202
-
203
- jQuery.ajax({
204
- type: "POST",
205
- url: "<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => $id, 'form_id' => $form_id, 'task' => 'update_query', 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>",
206
- data: datatxt,
207
- success: function(data) {
208
- window.parent.wd_fm_apply_options('apply_options');
209
- window.parent.tb_remove();
210
- }
211
- });
212
- }
213
- else {
214
- alert('The query is empty.');
215
- }
216
- return false;
217
- }
218
-
219
- function gen_query() {
220
- if(jQuery('#query_txt').val())
221
- if(!confirm('Are you sure you want to replace the Query? All the modifications to the Query will be lost.'))
222
- return;
223
- query="";
224
- fields=new Array(<?php
225
- $fields = "";
226
- if($table_struct) {
227
- foreach($table_struct as $col) {
228
- $fields.=' "'.str_replace("'", "SingleQuot", $col->Field).'",';
229
- }
230
- echo substr($fields, 0, -1);
231
- }
232
- ?>);
233
-
234
- con_type =jQuery('input[name=con_type]:checked').val();
235
- con_method =jQuery('input[name=con_method]:checked').val();
236
- table =jQuery('#tables').val();
237
- fls='';
238
- vals='';
239
- valsA=new Array();
240
- flsA=new Array();
241
-
242
- if(fields.length) {
243
- for(i=0; i<fields.length; i++) {
244
- if(jQuery('#ch_'+fields[i]+":checked" ).length) {
245
- flsA.push(fields[i]);
246
- valsA.push(jQuery('#'+fields[i]).val());
247
- }
248
- }
249
- }
250
- if(con_method=="insert") {
251
- if(flsA.length) {
252
- for(i=0; i<flsA.length-1; i++) {
253
- fls+= '`'+flsA[i]+'`, ';
254
- vals+= '"'+valsA[i]+'", ';
255
- }
256
- fls+= '`'+flsA[i]+'`';
257
- vals+= '"'+valsA[i]+'"';
258
- }
259
- if(fls)
260
- query="INSERT INTO "+jQuery('#tables').val()+" (" +fls+") VALUES ("+vals+")";
261
- }
262
-
263
- if(con_method=="update") {
264
- if(flsA.length) {
265
- for(i=0; i<flsA.length-1; i++) {
266
- vals+= '`'+flsA[i]+'`="'+valsA[i]+'", ';
267
- }
268
- vals+= '`'+flsA[i]+'`="'+valsA[i]+'"';
269
- }
270
- where="";
271
- previous='';
272
-
273
- for(i=1; i<cond_id; i++) {
274
- if(jQuery('#'+i).html()) {
275
- if(jQuery('#op_'+i).val()=="%..%")
276
- op_val=' LIKE "%'+jQuery('#val_'+i).val()+'%"';
277
- else if(jQuery('#op_'+i).val()=="%..")
278
- op_val=' LIKE "%'+jQuery('#val_'+i).val()+'"';
279
- else if(jQuery('#op_'+i).val()=="..%")
280
- op_val=' LIKE "'+jQuery('#val_'+i).val()+'%"';
281
- else
282
- op_val=' '+jQuery('#op_'+i).val()+' "'+jQuery('#val_'+i).val()+'"';
283
- where+=previous+' `'+jQuery('#sel_'+i).val()+'`'+op_val;
284
- previous=' '+ jQuery('#andor_'+i).val();
285
- }
286
- }
287
- if(vals)
288
- query="UPDATE "+jQuery('#tables').val()+" SET " + vals+(where? ' WHERE'+where: '') ;
289
- }
290
- if(con_method=="delete") {
291
- where="";
292
- previous='';
293
- for(i=1; i<cond_id; i++) {
294
- if(jQuery('#'+i).html()) {
295
- if(jQuery('#op_'+i).val()=="%..%")
296
- op_val=' LIKE "%'+jQuery('#val_'+i).val()+'%"';
297
- else if(jQuery('#op_'+i).val()=="%..")
298
- op_val=' LIKE "%'+jQuery('#val_'+i).val()+'"';
299
- else if(jQuery('#op_'+i).val()=="..%")
300
- op_val=' LIKE "'+jQuery('#val_'+i).val()+'%"';
301
- else
302
- op_val=' '+jQuery('#op_'+i).val()+' "'+jQuery('#val_'+i).val()+'"';
303
- where+=previous+' '+jQuery('#sel_'+i).val()+op_val;
304
- previous=' '+ jQuery('#andor_'+i).val();
305
- }
306
- }
307
- if(where)
308
- query="DELETE FROM "+jQuery('#tables').val()+ ' WHERE'+where ;
309
- }
310
- jQuery('#query_txt').val(query.replace("SingleQuot", "'"));
311
- }
312
-
313
- jQuery(document).ready(function () {
314
- jQuery(".hasTip").tooltip({
315
- track: true,
316
- content: function () {
317
- return jQuery(this).prop('title');
318
- }
319
- });
320
- });
321
-
322
- function insert_field(myValue) {
323
- if(!selected_field)
324
- return;
325
- myField=document.getElementById(selected_field);
326
- if (document.selection) {
327
- myField.focus();
328
- sel = document.selection.createRange();
329
- sel.text = myValue;
330
- }
331
- else {
332
- if (myField.selectionStart || myField.selectionStart == '0') {
333
- var startPos = myField.selectionStart;
334
- var endPos = myField.selectionEnd;
335
- myField.value = myField.value.substring(0, startPos)
336
- + "{"+myValue+"}"
337
- + myField.value.substring(endPos, myField.value.length);
338
- }
339
- else {
340
- myField.value += "{"+myValue+"}";
341
- }
342
- }
343
- }
344
- </script>
345
- <style>
346
- .c1 {
347
- padding: 0 10px;
348
- }
349
-
350
- .main_func{
351
- font-family: Segoe UI;
352
- display: inline-block;
353
- width: 550px;
354
- }
355
-
356
- .main_func .admintable {
357
- width: 100%;
358
- padding: 10px 0;
359
- margin-bottom: 15px;
360
- }
361
-
362
- .main_func .admintable .key{
363
- width: 36%;
364
- }
365
-
366
- .main_func .admintable input[type='text'],
367
- .main_func .admintable input[type='password']{
368
- padding: 4px 6px;
369
- width:244px;
370
- }
371
-
372
- .btn.connect {
373
- background:#4EC0D9;
374
- width:78px;
375
- height:32px;
376
- border:1px solid #4EC0D9;
377
- border-radius:0px;
378
- color:#fff;
379
- cursor:pointer;
380
- }
381
-
382
- .desc {
383
- font-size: 13px;
384
- display: inline-block;
385
- width: 265px;
386
- position: fixed;
387
- margin: 15px;
388
- margin-left: 45px;
389
- }
390
-
391
- .desc > div {
392
- margin-top:3px;
393
- }
394
-
395
- .desc div span {
396
- width: 62px;
397
- display: inline-block;
398
- }
399
-
400
- .desc button {
401
- max-width: 190px;
402
- overflow: hidden;
403
- white-space: nowrap;
404
- text-overflow: ellipsis;
405
- padding: 4px;
406
- background: #eee;
407
- border: 1px solid #ccc;
408
- border-radius:0px;
409
- height:27px;
410
- }
411
-
412
- .key label {
413
- display:inline-block;
414
- width:150px;
415
- }
416
-
417
- .select-db-label {
418
- display: inline-block;
419
- font-size: 16px;
420
- width: 201px;
421
-
422
- }
423
-
424
- .select-db-select {
425
- width:325px;
426
- padding:6px;
427
- }
428
-
429
- .struct {
430
- border: 3px solid red;
431
- padding: 4px 6px;
432
- display: inline-block;
433
- margin-top:10px;
434
- }
435
-
436
- .cols div:nth-child(even) {background: #FFF}
437
- .cols div:nth-child(odd) {background: #F5F5F5}
438
- .cols div {
439
- height: 28px;
440
- padding: 5px
441
- }
442
-
443
- .cols label {
444
- display: inline-block;
445
- width: 175px;
446
- font-size: 15px;
447
- overflow: hidden;
448
- white-space: nowrap;
449
- text-overflow: ellipsis;
450
- vertical-align: middle;
451
- }
452
-
453
- .cols input[type="text"] {
454
- width: 295px;
455
- line-height: 18px;
456
- height: 28px;
457
- border: 1px solid #ccc;
458
- padding: 0 3px;
459
- margin-right: 2px;
460
- }
461
-
462
- .cols input[type="text"]:disabled {
463
- cursor: not-allowed;
464
- background-color: #eee;
465
- }
466
-
467
- .cols input[type="checkbox"] {
468
- width: 20px;
469
- line-height: 18px;
470
- height: 20px;
471
- vertical-align: middle;
472
- }
473
-
474
- .cols select {
475
- line-height: 18px;
476
- height: 28px;
477
- margin-right: 2px;
478
- }
479
-
480
- #fieldlist {
481
- position: absolute;
482
- width:225px;
483
- background: #fff;
484
- border: solid 1px #c7c7c7;
485
- top: 0;
486
- left: 0;
487
- z-index: 1000;
488
- }
489
-
490
- #fieldlist a {
491
- padding: 5px;
492
- cursor:pointer;
493
- overflow: hidden;
494
- white-space: nowrap;
495
- text-overflow: ellipsis;
496
- }
497
-
498
- #fieldlist a:hover {
499
- background: #ccc;
500
- }
501
-
502
- .gen_query, .gen_query:focus {
503
- width: 148px;
504
- height: 38px;
505
- background: #4EC0D9;
506
- color: white;
507
- cursor: pointer;
508
- border: 0px;
509
- font-size: 14px;
510
- font-weight: bold;
511
- margin: 20px 0;
512
- border-radius: 0px;
513
- }
514
-
515
- .gen_query:active {
516
- background: #ccc;
517
- }
518
-
519
- .fm-query-save {
520
- float: right;
521
- font-size: 13px;
522
- margin: 0 20px;
523
- background: #4EC0D9;
524
- width: 83px;
525
- height: 34px;
526
- border: 1px solid #4EC0D9;
527
- border-radius: 0px;
528
- color: #fff;
529
- cursor: pointer;
530
- }
531
-
532
- .select-db-op {
533
- display: inline-block;
534
- text-align: right;
535
- font-weight: bold;
536
- font-size: 18px;
537
- padding: 5px 0;
538
- margin: 5px 0;
539
- background:none !important;
540
- }
541
-
542
- .select-db-op.where{
543
- width: 272px;
544
- }
545
-
546
- .select-db-op img{
547
- float:left;
548
- }
549
-
550
- .select-db-label {
551
- display: inline-block;
552
- font-size: 16px;
553
- width: 201px;
554
-
555
- }
556
- .select-db-select {
557
- width:325px;
558
- padding:6px;
559
- }
560
-
561
- .fm-query-save {
562
- float: right;
563
- font-size: 13px;
564
- margin: 0 20px;
565
- background: #4EC0D9;
566
- width: 83px;
567
- height: 34px;
568
- border: 1px solid #4EC0D9;
569
- border-radius: 0px;
570
- color: #fff;
571
- cursor: pointer;
572
- }
573
- </style>
574
- <div class="c1">
575
- <div class="main_func">
576
- <table class="admintable">
577
- <tr valign="top">
578
- <td class="key">
579
- <label style="font-size:20px;">Connection type: </label>
580
- </td>
581
- <td>
582
- <input type="radio" name="con_type" id="local" value="local" <?php if($con_type=='local') echo 'checked="checked"'?> disabled>
583
- <label for="local">Local</label>
584
- <input type="radio" name="con_type" id="remote" value="remote" <?php if($con_type=='remote') echo 'checked="checked"'?> disabled>
585
- <label for="remote">Remote</label>
586
- </td>
587
- <td rowspan="2">
588
- <input type="button" value="Connect" onclick="connect()" class="btn connect" disabled>
589
- </td>
590
- </tr>
591
- <tr class="remote_info" <?php if($con_type=='local') echo 'style="display:none"'?>>
592
- <td class="key">Host</td>
593
- <td>
594
- <input type="text" name="host" id="host_rem" style="width:150px" value="<?php echo $host; ?>" disabled>
595
- Port : <input type="text" name="port" id="port_rem" value="<?php echo $port; ?>" style="width:48px" disabled>
596
- </td>
597
- </tr>
598
- <tr class="remote_info" <?php if($con_type=='local') echo 'style="display:none"'?>>
599
- <td class="key">Username</td>
600
- <td>
601
- <input type="text" name="username" id="username_rem" value="<?php echo $username; ?>" disabled>
602
- </td>
603
- </tr>
604
- <tr class="remote_info" <?php if($con_type=='local') echo 'style="display:none"'?>>
605
- <td class="key">Password</td>
606
- <td>
607
- <input type="password" name="password" id="password_rem" value="<?php echo $password; ?>" disabled>
608
- </td>
609
- </tr>
610
- <tr class="remote_info" <?php if($con_type=='local') echo 'style="display:none"'?>>
611
- <td class="key">Database</td>
612
- <td>
613
- <input type="text"name="database" id="database_rem" value="<?php echo $database; ?>" disabled>
614
- </td>
615
- </tr>
616
- <tr valign="top">
617
- <td class="key">
618
- <label style="font-size:20px;">Type: </label>
619
- </td>
620
- <td>
621
- <input type="radio" name="con_method" id="insert" value="insert" <?php if($con_method=='insert') echo 'checked="checked"'?> disabled>
622
- <label for="insert">Insert</label>
623
- <input type="radio" name="con_method" id="update" value="update" <?php if($con_method=='update') echo 'checked="checked"'?> disabled>
624
- <label for="update">Update</label>
625
- <input type="radio" name="con_method" id="delete" value="delete" <?php if($con_method=='delete') echo 'checked="checked"'?> disabled>
626
- <label for="delete">Delete</label>
627
- </td>
628
- </tr>
629
- </table>
630
- <div id="struct">
631
- <label for="tables" class="select-db-label">Select a table</label>
632
- <select name="tables" id="tables" class="select-db-select" disabled>
633
- <option value="" ></option>
634
- <?php
635
- foreach($tables as $table) {
636
- echo '<option value="'.$table.'" '.($table_cur==$table ? 'selected' : '').' >'.$table.'</option>';
637
- }
638
- ?>
639
- </select>
640
- <br/>
641
- <div id="table_struct">
642
- <?php
643
- if($table_struct) {
644
- ?>
645
- <div class="struct">
646
- <div class="cols">
647
- <?php
648
- $temps=explode('***wdffieldwdf***',$details);
649
- $wheres = $temps[count($temps)-1];
650
- $temps = array_slice($temps,0, count($temps)-1);
651
- $col_names= array();
652
- $col_vals= array();
653
- $col_checks= array();
654
-
655
- foreach($temps as $temp) {
656
- $temp=explode('***wdfnamewdf***',$temp);
657
- array_push($col_names, $temp[0]);
658
- $temp=explode('***wdfvaluewdf***',$temp[1]);
659
- array_push($col_vals, $temp[0]);
660
- array_push($col_checks, $temp[1]);
661
- }
662
- if($con_method=='insert' or $con_method=='update') {
663
- echo '<div style="background: none;text-align: center;font-size: 20px;color: #000;font-weight: bold;"> SET </div>';
664
-
665
- foreach($table_struct as $key =>$col) {
666
- $title=' '.$col->Field;
667
- $title.="<ul style='padding-left: 17px;'>";
668
- $title.="<li>Type - ".$col->Type."</li>";
669
- $title.="<li>Null - ".$col->Null."</li>";
670
- $title.="<li>Key - ".$col->Key."</li>";
671
- $title.="<li>Default - ".$col->Default."</li>";
672
- $title.="<li>Extra - ".$col->Extra."</li>";
673
- $title.="</ul>";
674
- ?>
675
- <div><label title="<?php echo $title; ?>" class="hasTip"><b><?php echo $col->Field; ?></b><img src="<?php echo WD_FM_URL . '/images/info.png?ver='. WD_FM_VERSION.''; ?>" style="width:20px; vertical-align:middle;padding-left: 10px;" /></label><input type="text" id="<?php echo str_replace("'", "SingleQuot", $col->Field); ?>" <?php if(!$col_checks[$key]) echo 'disabled="disabled"'?> value="<?php echo $col_vals[$key]; ?>" /><input id="ch_<?php echo str_replace("'", "SingleQuot", $col->Field); ?>" type="checkbox" onClick="dis('<?php echo str_replace("'", "SingleQuot", $col->Field); ?>', this.checked)" <?php if($col_checks[$key]) echo 'checked="checked"'?> /></div>
676
- <?php
677
- }
678
- }
679
-
680
- if($con_method=='delete' or $con_method=='update') {
681
- echo '<div class="select-db-op where"><img src="'.WD_FM_URL . '/images/add_condition.png?ver='. WD_FM_VERSION.'" title="ADD" class="add_cond"/>WHERE</div>';
682
- if($wheres) {
683
- echo '<script>';
684
-
685
- $wheres = explode('***where***',$wheres);
686
- $wheres = array_slice($wheres,0, count($wheres)-1);
687
- foreach($wheres as $where) {
688
- $temp=explode('***sel***',$where);
689
- $sel = $temp[0];
690
- $temp=explode('***op***',$temp[1]);
691
- $op = $temp[0];
692
- $temp=explode('***val***',$temp[1]);
693
- $val = $temp[0];
694
- $andor = $temp[1];
695
- echo 'jQuery(".cols").append(conds.replace(/condid/g, cond_id++).replace(\'SingleQuot\', "\'")); update_vis();
696
- jQuery("#sel_"+(cond_id-1)).val("'.html_entity_decode($sel, ENT_QUOTES).'");
697
- jQuery("#op_"+(cond_id-1)).val("'.$op.'");
698
- jQuery("#val_"+(cond_id-1)).val("'.$val.'");
699
- jQuery("#andor_"+(cond_id-1)).val("'.$andor.'");';
700
- }
701
- echo '</script>';
702
- }
703
- }
704
- ?>
705
- </div>
706
- <div style="color:red; background: none">The changes above will not affect the query until you click "Generate query".</div>
707
- </div>
708
- <br/>
709
- <input type="button" value="Generate Query" class="gen_query" onclick="gen_query()">
710
- <br/>
711
- <form name="query_form" id="query_form" >
712
- <label style="vertical-align: top; width: 102px; display: inline-block;" for="query_txt" > Query: </label><textarea id="query_txt" name="query" rows=5 style="width:428px" ><?php echo $query_obj->query; ?></textarea>
713
- <input type="hidden" name="details" id="details">
714
- <input type="hidden" name="id" value="<?php echo $query_obj->id; ?>">
715
- </form>
716
- <input type="button" value="Save" class="fm-query-save" onclick="save_query()">
717
- <div id="fieldlist" style="display: none;">
718
- <?php echo $form_fields; ?>
719
- </div>
720
- <?php
721
- }
722
- ?>
723
- </div>
724
- </div>
725
- <input type="hidden" value="<?php echo $form_id ?>" id="form_id">
726
- </div>
727
- <div class="desc">
728
- <?php
729
- foreach($label_id as $key => $lid) {
730
- echo '<div>{'.$lid.'} - <button onclick="insert_field('.$lid.');">'.$label_order_original[$key].'</button></div>';
731
- }
732
- $user_fields = array("subid"=>"Submission ID", "ip"=>"Submitter's IP", "userid"=>"User ID", "username"=>"Username", "useremail"=>"User Email");
733
- foreach($user_fields as $user_key=>$user_field) {
734
- echo '<div>{'.$user_key.'} - <button onclick="insert_field(\''.$user_key.'\');">'.$user_field.'</button></div>';
735
- }
736
- ?>
737
- </div>
738
- </div>
739
- <?php
740
- die();
741
- }
742
-
743
- public function add_query($form_id){
744
- wp_print_scripts('jquery');
745
- wp_print_scripts('jquery-ui-tooltip');
746
- ?>
747
- <link media="all" type="text/css" href="<?php echo WD_FM_URL . '/css/style.css'; ?>" rel="stylesheet">
748
- <link rel="stylesheet" href="<?php echo WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css'; ?>">
749
- <?php
750
- $label = $this->model->get_labels($form_id);
751
-
752
- $filter_types=array("type_submit_reset", "type_map", "type_editor", "type_captcha", "type_recaptcha", "type_button", "type_paypal_total", "type_send_copy");
753
- $label_id= array();
754
- $label_order= array();
755
- $label_order_original= array();
756
- $label_type= array();
757
-
758
- $label_all = explode('#****#',$label);
759
- $label_all = array_slice($label_all,0, count($label_all)-1);
760
- foreach($label_all as $key => $label_each) {
761
- $label_id_each=explode('#**id**#',$label_each);
762
- $label_oder_each=explode('#**label**#', $label_id_each[1]);
763
-
764
- if(in_array($label_oder_each[1],$filter_types))
765
- continue;
766
- array_push($label_id, $label_id_each[0]);
767
- array_push($label_order_original, $label_oder_each[0]);
768
- $ptn = "/[^a-zA-Z0-9_]/";
769
- $rpltxt = "";
770
- $label_temp=preg_replace($ptn, $rpltxt, $label_oder_each[0]);
771
- array_push($label_order, $label_temp);
772
- array_push($label_type, $label_oder_each[1]);
773
- }
774
- ?>
775
- <script>
776
- function insert_field(){}
777
-
778
- function connect() {
779
- jQuery("input[type='radio']").attr('disabled','');
780
- jQuery(".connect").attr('disabled','');
781
- jQuery('#struct').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
782
- jQuery.ajax({
783
- type: "POST",
784
- url: "<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $form_id, 'task' => 'db_tables', 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>",
785
- data: 'con_type='+jQuery('input[name=con_type]:checked').val()+'&con_method='+jQuery('input[name=con_method]:checked').val()+'&host='+jQuery('#host_rem').val()+'&port='+jQuery('#port_rem').val()+'&username='+jQuery('#username_rem').val()+'&password='+jQuery('#password_rem').val()+'&database='+jQuery('#database_rem').val()+'&format=row',
786
- success: function(data) {
787
- jQuery("#struct").removeClass("fm_loading");
788
- if(data==1) {
789
- jQuery("#struct").html('<div style="font-size: 22px; text-align: center; padding-top: 15px;">Could not connect to MySQL.</div>')
790
- jQuery(".connect").removeAttr('disabled');
791
- jQuery("input[type='radio']").removeAttr('disabled','');
792
- }
793
- else {
794
- jQuery("#struct").html(data);
795
- }
796
-
797
- }
798
- });
799
- }
800
-
801
- function shh(x) {
802
- if(x)
803
- jQuery(".remote_info").show();
804
- else
805
- jQuery(".remote_info").hide();
806
- }
807
- </script>
808
- <style>
809
- .c1 {
810
- padding: 0 10px;
811
- }
812
-
813
- .main_func{
814
- font-family: Segoe UI;
815
- display: inline-block;
816
- width: 550px;
817
- }
818
-
819
- .main_func .admintable {
820
- width: 100%;
821
- padding: 10px 0;
822
- margin-bottom: 15px;
823
- }
824
-
825
- .main_func .admintable .key{
826
- width: 36%;
827
- }
828
-
829
- .main_func .admintable input[type='text'],
830
- .main_func .admintable input[type='password']{
831
- padding: 4px 6px;
832
- width:244px;
833
- }
834
-
835
- .btn.connect {
836
- background:#4EC0D9;
837
- width:78px;
838
- height:32px;
839
- border:1px solid #4EC0D9;
840
- border-radius:0px;
841
- color:#fff;
842
- cursor:pointer;
843
- }
844
-
845
- .desc {
846
- font-size: 13px;
847
- display: inline-block;
848
- width: 265px;
849
- position: fixed;
850
- margin: 15px;
851
- margin-left: 45px;
852
- }
853
-
854
- .desc > div {
855
- margin-top:3px;
856
- }
857
-
858
- .desc div span {
859
- width: 62px;
860
- display: inline-block;
861
- }
862
-
863
- .desc button {
864
- max-width: 190px;
865
- overflow: hidden;
866
- white-space: nowrap;
867
- text-overflow: ellipsis;
868
- padding: 4px;
869
- background: #eee;
870
- border: 1px solid #ccc;
871
- border-radius:0px;
872
- height:27px;
873
- }
874
-
875
- .key label {
876
- display:inline-block;
877
- width:150px;
878
- }
879
-
880
- .select-db-label {
881
- display: inline-block;
882
- font-size: 16px;
883
- width: 201px;
884
-
885
- }
886
-
887
- .select-db-select {
888
- width:325px;
889
- padding:6px;
890
- }
891
- </style>
892
- <div class="c1">
893
- <div class="main_func">
894
- <table class="admintable">
895
- <tr valign="top">
896
- <td class="key">
897
- <label style="font-size:20px;">Connection type: </label>
898
- </td>
899
- <td>
900
- <input type="radio" name="con_type" id="local" value="local" checked="checked" onclick="shh(false)">
901
- <label for="local">Local</label>
902
- <input type="radio" name="con_type" id="remote" value="remote" onclick="shh(true)">
903
- <label for="remote">Remote</label>
904
- </td>
905
- <td rowspan="2">
906
- <input type="button" value="Connect" onclick="connect()" class="btn connect">
907
- </td>
908
- </tr>
909
- <tr class="remote_info" style="display:none">
910
- <td class="key">Host</td>
911
- <td>
912
- <input type="text" name="host" id="host_rem" style="width:150px">
913
- Port : <input type="text" name="port" id="port_rem" value="3306" style="width:48px">
914
- </td>
915
- </tr>
916
- <tr class="remote_info" style="display:none">
917
- <td class="key">Username</td>
918
- <td>
919
- <input type="text" name="username" id="username_rem">
920
- </td>
921
- </tr>
922
- <tr class="remote_info" style="display:none">
923
- <td class="key">Password</td>
924
- <td>
925
- <input type="password" name="password" id="password_rem">
926
- </td>
927
- </tr>
928
- <tr class="remote_info" style="display:none">
929
- <td class="key">Database</td>
930
- <td>
931
- <input type="text"name="database" id="database_rem">
932
- </td>
933
- </tr>
934
- <tr valign="top">
935
- <td class="key">
936
- <label style="font-size:20px;">Type: </label>
937
- </td>
938
- <td >
939
- <input type="radio" name="con_method" id="insert" value="insert" checked="checked">
940
- <label for="insert">Insert</label>
941
- <input type="radio" name="con_method" id="update" value="update">
942
- <label for="update">Update</label>
943
- <input type="radio" name="con_method" id="delete" value="delete">
944
- <label for="delete">Delete</label>
945
- </td>
946
- </tr>
947
- </table>
948
- <div id="struct">
949
- </div>
950
- <input type="hidden" value="<?php echo $form_id ?>" id="form_id">
951
- </div>
952
- <div class="desc">
953
- <?php
954
- foreach($label_id as $key => $lid) {
955
- echo '<div><span>{'.$lid.'}</span> - <button onclick="insert_field('.$lid.');">'.$label_order_original[$key].'</button></div>';
956
- }
957
-
958
- $user_fields = array("subid"=>"Submission ID", "ip"=>"Submitter's IP", "userid"=>"User ID", "username"=>"Username", "useremail"=>"User Email");
959
- foreach($user_fields as $user_key=>$user_field) {
960
- echo '<div><span>{'.$user_key.'}</span> - <button onclick="insert_field(\''.$user_key.'\');">'.$user_field.'</button></div>';
961
- }
962
- ?>
963
- </div>
964
- </div>
965
- <?php
966
- die();
967
- }
968
-
969
- public function db_tables($form_id){
970
- $tables = $this->model->get_tables();
971
- ?>
972
- <label for="tables" class="select-db-label">Select a table</label>
973
- <select name="tables" id="tables" class="select-db-select">
974
- <option value="" ></option>
975
- <?php
976
- foreach($tables as $table) {
977
- echo '<option value="' . $table . '" >' . $table . '</option>';
978
- }
979
- ?>
980
- </select>
981
- <br/>
982
- <div id="table_struct">
983
- </div>
984
- <script>
985
- jQuery("#tables").change(function (){
986
- jQuery('#table_struct').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
987
- jQuery.ajax({
988
- type: "POST",
989
- url: "<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $form_id, 'task' => 'db_table_struct', 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>",
990
- data: 'name='+jQuery(this).val()+'&con_type='+jQuery('input[name=con_type]:checked').val()+'&con_method='+jQuery('input[name=con_method]:checked').val()+'&host='+jQuery('#host_rem').val()+'&port='+jQuery('#port_rem').val()+'&username='+jQuery('#username_rem').val()+'&password='+jQuery('#password_rem').val()+'&database='+jQuery('#database_rem').val()+'&format=row',
991
- success: function(data) {
992
- jQuery("#table_struct").removeClass("fm_loading");
993
- jQuery("#table_struct").html(data);
994
- }
995
- });
996
- })
997
- </script>
998
- <?php
999
- die();
1000
- }
1001
-
1002
- public function db_table_struct ($form_id) {
1003
- $table_struct = $this->model->get_table_struct();
1004
- $label = $this->model->get_labels($form_id);
1005
- $con_method = isset($_POST['con_method']) ? $_POST['con_method'] : '';
1006
- $filter_types=array("type_submit_reset", "type_map", "type_editor", "type_captcha", "type_recaptcha", "type_button", "type_paypal_total", "type_send_copy");
1007
- $label_id= array();
1008
- $label_order= array();
1009
- $label_order_original= array();
1010
- $label_type= array();
1011
-
1012
- ///stexic
1013
- $label_all = explode('#****#',$label);
1014
- $label_all = array_slice($label_all,0, count($label_all)-1);
1015
-
1016
- foreach($label_all as $key => $label_each) {
1017
- $label_id_each=explode('#**id**#',$label_each);
1018
- $label_oder_each=explode('#**label**#', $label_id_each[1]);
1019
-
1020
- if(in_array($label_oder_each[1],$filter_types)) {
1021
- continue;
1022
- }
1023
- array_push($label_id, $label_id_each[0]);
1024
- array_push($label_order_original, $label_oder_each[0]);
1025
- $ptn = "/[^a-zA-Z0-9_]/";
1026
- $rpltxt = "";
1027
- $label_temp=preg_replace($ptn, $rpltxt, $label_oder_each[0]);
1028
- array_push($label_order, $label_temp);
1029
- array_push($label_type, $label_oder_each[1]);
1030
- }
1031
- $form_fields='';
1032
- foreach($label_id as $key => $id) {
1033
- $form_fields.='<a onclick="insert_field('.$id.'); jQuery(\'#fieldlist\').hide();" style="display:block; text-decoration:none;">'.$label_order_original[$key].'</a>';
1034
- }
1035
- $user_fields = array("subid"=>"Submission ID", "ip"=>"Submitter's IP", "userid"=>"User ID", "username"=>"Username", "useremail"=>"User Email");
1036
- foreach($user_fields as $user_key=>$user_field) {
1037
- $form_fields.='<a onclick="insert_field(\''.$user_key.'\'); jQuery(\'#fieldlist\').hide();" style="display:block; text-decoration:none;">'.$user_field.'</a>';
1038
- }
1039
- $cond='<div id="condid"><select id="sel_condid" style="width: 160px">';
1040
- foreach($table_struct as $col) {
1041
- $cond.='<option>'.str_replace("'", "SingleQuot", $col->Field).'</option>';
1042
- }
1043
- $cond.='</select>';
1044
-
1045
- $cond.='<select id="op_condid"><option value="=" selected="selected">=</option><option value="!=">!=</option><option value=">">&gt;</option><option value="<">&lt;</option><option value=">=">&gt;=</option><option value="<=">&lt;=</option><option value="%..%">Like</option><option value="%..">Starts with</option><option value="..%">Ends with</option></select><input id="val_condid" style="width:170px" type="text" /><select id="andor_condid" style="visibility: hidden;"><option value="AND">AND</option><option value="OR">OR</option></select><img src="' . WD_FM_URL . '/images/delete.png?ver='. WD_FM_VERSION.'" onclick="delete_cond(&quot;condid&quot;)" style="vertical-align: middle;"></div>';
1046
- ?>
1047
- <script>
1048
- var selected_field ='';
1049
- var isvisible = 1;
1050
- var cond_id = 1;
1051
-
1052
- conds='<?php echo $cond ?>';
1053
- fields=new Array(<?php
1054
- $fields = "";
1055
- if($table_struct) {
1056
- foreach($table_struct as $col) {
1057
- $fields.=' "'.$col->Field.'",';
1058
- }
1059
- echo substr($fields, 0, -1);
1060
- }
1061
- ?>);
1062
- function dis(id, x) {
1063
- if(x)
1064
- jQuery('#'+id).removeAttr('disabled');
1065
- else
1066
- jQuery('#'+id).attr('disabled','disabled');
1067
- }
1068
-
1069
- function update_vis() {
1070
- previous=0;
1071
- for(i=1; i<cond_id; i++) {
1072
- if(jQuery('#'+i).html()) {
1073
- jQuery('#andor_'+i).css('visibility', 'hidden');
1074
- if(previous) {
1075
- jQuery('#andor_'+previous).css('visibility', 'visible');
1076
- }
1077
- previous=i;
1078
- }
1079
- }
1080
- }
1081
-
1082
- function delete_cond(id) {
1083
- jQuery('#'+id).remove();
1084
- update_vis();
1085
- }
1086
-
1087
- jQuery('.add_cond').click( function() {
1088
- jQuery('.cols').append(conds.replace(/condid/g, cond_id++).replace('SingleQuot', "'"));
1089
- update_vis();
1090
- });
1091
-
1092
- jQuery('html').click(function() {
1093
- if(jQuery("#fieldlist").css('display')=="block") {
1094
- jQuery("#fieldlist").hide();
1095
- }
1096
- });
1097
-
1098
- jQuery('.cols input[type="text"]').on('click', function(event) {
1099
- event.stopPropagation();
1100
- jQuery("#fieldlist").css("top",jQuery(this).offset().top+jQuery(this).height()+2);
1101
- jQuery("#fieldlist").css("left",jQuery(this).offset().left);
1102
- jQuery("#fieldlist").slideDown('fast');
1103
- selected_field=this.id;
1104
- });
1105
-
1106
- jQuery('#query_txt').click(function(event) {
1107
- event.stopPropagation();
1108
- jQuery("#fieldlist").css("top",jQuery(this).offset().top+jQuery(this).height()+2);
1109
- jQuery("#fieldlist").css("left",jQuery(this).offset().left);
1110
- jQuery("#fieldlist").slideDown('fast');
1111
- selected_field=this.id;
1112
- });
1113
-
1114
- jQuery('#fieldlist').click(function(event){
1115
- event.stopPropagation();
1116
- });
1117
-
1118
- function save_query() {
1119
- con_type =jQuery('input[name=con_type]:checked').val();
1120
- con_method =jQuery('input[name=con_method]:checked').val();
1121
- table =jQuery('#tables').val();
1122
- table =jQuery('#tables').val();
1123
- host =jQuery('#host_rem').val();
1124
- port =jQuery('#port_rem').val();
1125
- username =jQuery('#username_rem').val();
1126
- password =jQuery('#password_rem').val();
1127
- database =jQuery('#database_rem').val();
1128
-
1129
- str=con_type+"***wdfcon_typewdf***"+con_method+"***wdfcon_methodwdf***"+table+"***wdftablewdf***"+host+"***wdfhostwdf***"+port+"***wdfportwdf***"+username+"***wdfusernamewdf***"+password+"***wdfpasswordwdf***"+database+"***wdfdatabasewdf***";
1130
-
1131
- if(fields.length) {
1132
- for(i=0; i<fields.length; i++) {
1133
- str+=fields[i]+'***wdfnamewdf***'+jQuery('#'+fields[i]).val()+'***wdfvaluewdf***'+jQuery('#ch_'+fields[i]+":checked" ).length+'***wdffieldwdf***';
1134
- }
1135
- }
1136
-
1137
- for(i=1; i<cond_id; i++) {
1138
- if(jQuery('#'+i).html()) {
1139
- str+=jQuery('#sel_'+i).val()+'***sel***'+jQuery('#op_'+i).val()+'***op***'+jQuery('#val_'+i).val()+'***val***'+jQuery('#andor_'+i).val()+'***where***';
1140
- }
1141
- }
1142
-
1143
- if(!jQuery('#query_txt').val()) {
1144
- gen_query();
1145
- }
1146
-
1147
- jQuery('#details').val(str);
1148
-
1149
- var datatxt = jQuery("#query_form").serialize()+'&form_id='+jQuery("#form_id").val();
1150
- if(jQuery('#query_txt').val()) {
1151
- jQuery('.c1').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
1152
- jQuery.ajax({
1153
- type: "POST",
1154
- url: "<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $form_id, 'task' => 'save_query', 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>",
1155
- data: datatxt,
1156
- success: function(data) {
1157
- window.parent.wd_fm_apply_options('apply_options');
1158
- window.parent.tb_remove();
1159
- }
1160
- });
1161
- }
1162
- else {
1163
- alert('The query is empty.');
1164
- }
1165
- return false;
1166
- }
1167
-
1168
- function gen_query() {
1169
- if(jQuery('#query_txt').val()) {
1170
- if(!confirm('Are you sure you want to replace the Query? All the modifications to the Query will be lost.')) {
1171
- return;
1172
- }
1173
- }
1174
- query="";
1175
- fields=new Array(<?php
1176
- $fields = "";
1177
- if($table_struct) {
1178
- foreach($table_struct as $col) {
1179
- $fields.=' "'.str_replace("'", "SingleQuot", $col->Field).'",';
1180
- }
1181
- echo substr($fields, 0, -1);
1182
- }
1183
- ?>);
1184
-
1185
- con_type =jQuery('input[name=con_type]:checked').val();
1186
- con_method =jQuery('input[name=con_method]:checked').val();
1187
- table =jQuery('#tables').val();
1188
- fls='';
1189
- vals='';
1190
- valsA=new Array();
1191
- flsA=new Array();
1192
-
1193
- if(fields.length) {
1194
- for(i=0; i<fields.length; i++) {
1195
- if(jQuery('#ch_'+fields[i]+":checked" ).length) {
1196
- flsA.push(fields[i]);
1197
- valsA.push(jQuery('#'+fields[i]).val());
1198
- }
1199
- }
1200
- }
1201
-
1202
- if(con_method=="insert") {
1203
- if(flsA.length) {
1204
- for(i=0; i<flsA.length-1; i++) {
1205
- fls+= '`'+flsA[i]+'`, ';
1206
- vals+= '"'+valsA[i]+'", ';
1207
- }
1208
- fls+= '`'+flsA[i]+'`';
1209
- vals+= '"'+valsA[i]+'"';
1210
- }
1211
- if(fls) {
1212
- query="INSERT INTO "+jQuery('#tables').val()+" (" +fls+") VALUES ("+vals+")";
1213
- }
1214
- }
1215
-
1216
- if(con_method=="update") {
1217
- if(flsA.length) {
1218
- for(i=0; i<flsA.length-1; i++) {
1219
- vals+= '`'+flsA[i]+'`="'+valsA[i]+'", ';
1220
- }
1221
- vals+= '`'+flsA[i]+'`="'+valsA[i]+'"';
1222
- }
1223
- where="";
1224
- previous='';
1225
- for(i=1; i<cond_id; i++) {
1226
- if(jQuery('#'+i).html()) {
1227
- if(jQuery('#op_'+i).val()=="%..%")
1228
- op_val=' LIKE "%'+jQuery('#val_'+i).val()+'%"';
1229
- else if(jQuery('#op_'+i).val()=="%..")
1230
- op_val=' LIKE "%'+jQuery('#val_'+i).val()+'"';
1231
- else if(jQuery('#op_'+i).val()=="..%")
1232
- op_val=' LIKE "'+jQuery('#val_'+i).val()+'%"';
1233
- else
1234
- op_val=' '+jQuery('#op_'+i).val()+' "'+jQuery('#val_'+i).val()+'"';
1235
- where+=previous+' `'+jQuery('#sel_'+i).val()+'`'+op_val;
1236
- previous=' '+ jQuery('#andor_'+i).val();
1237
- }
1238
- }
1239
- if(vals) {
1240
- query="UPDATE "+jQuery('#tables').val()+" SET " + vals+(where? ' WHERE'+where: '') ;
1241
- }
1242
- }
1243
-
1244
- if(con_method=="delete") {
1245
- where="";
1246
- previous='';
1247
- for(i=1; i<cond_id; i++) {
1248
- if(jQuery('#'+i).html()) {
1249
- if(jQuery('#op_'+i).val()=="%..%")
1250
- op_val=' LIKE "%'+jQuery('#val_'+i).val()+'%"';
1251
- else if(jQuery('#op_'+i).val()=="%..")
1252
- op_val=' LIKE "%'+jQuery('#val_'+i).val()+'"';
1253
- else if(jQuery('#op_'+i).val()=="..%")
1254
- op_val=' LIKE "'+jQuery('#val_'+i).val()+'%"';
1255
- else
1256
- op_val=' '+jQuery('#op_'+i).val()+' "'+jQuery('#val_'+i).val()+'"';
1257
- where+=previous+' '+jQuery('#sel_'+i).val()+op_val;
1258
- previous=' '+ jQuery('#andor_'+i).val();
1259
- }
1260
- }
1261
- if(where) {
1262
- query="DELETE FROM "+jQuery('#tables').val()+ ' WHERE'+where ;
1263
- }
1264
- }
1265
- jQuery('#query_txt').val(query.replace("SingleQuot", "'"));
1266
- }
1267
-
1268
- jQuery(document).ready(function () {
1269
- jQuery(".hasTip").tooltip({
1270
- track: true,
1271
- content: function () {
1272
- return jQuery(this).prop('title');
1273
- }
1274
- });
1275
- });
1276
-
1277
- function insert_field(myValue) {
1278
- if(!selected_field)
1279
- return;
1280
- myField=document.getElementById(selected_field);
1281
- if (document.selection) {
1282
- myField.focus();
1283
- sel = document.selection.createRange();
1284
- sel.text = myValue;
1285
- }
1286
- else {
1287
- if (myField.selectionStart || myField.selectionStart == '0') {
1288
- var startPos = myField.selectionStart;
1289
- var endPos = myField.selectionEnd;
1290
- myField.value = myField.value.substring(0, startPos)
1291
- + "{"+myValue+"}"
1292
- + myField.value.substring(endPos, myField.value.length);
1293
- }
1294
- else {
1295
- myField.value += "{"+myValue+"}";
1296
- }
1297
- }
1298
- }
1299
- </script>
1300
- <style>
1301
- .cols div:nth-child(even) {background: #FFF;}
1302
- .cols div:nth-child(odd) {background: #F5F5F5;}
1303
- .cols div {
1304
- height: 28px;
1305
- padding: 5px;
1306
- }
1307
-
1308
- .cols {
1309
- display: inline-block;
1310
- }
1311
-
1312
- .cols label {
1313
- display: inline-block;
1314
- width: 200px;
1315
- font-size: 15px;
1316
- overflow: hidden;
1317
- white-space: nowrap;
1318
- text-overflow: ellipsis;
1319
- vertical-align: middle;
1320
- }
1321
-
1322
- .cols input[type="text"] {
1323
- width: 295px;
1324
- line-height: 18px;
1325
- height: 28px;
1326
- border: 1px solid #ccc;
1327
- padding: 0 3px;
1328
- margin-right: 2px;
1329
- }
1330
-
1331
- .cols input[type="text"]:disabled {
1332
- cursor: not-allowed;
1333
- background-color: #eee;
1334
- }
1335
-
1336
- .cols input[type="checkbox"] {
1337
- width: 20px;
1338
- line-height: 18px;
1339
- height: 20px;
1340
- vertical-align: middle;
1341
- }
1342
-
1343
- .cols select {
1344
- line-height: 18px;
1345
- height: 28px;
1346
- margin-right: 2px;
1347
- }
1348
-
1349
- #fieldlist {
1350
- position: absolute;
1351
- width:225px;
1352
- background: #fff;
1353
- border: solid 1px #c7c7c7;
1354
- top: 0;
1355
- left: 0;
1356
- z-index: 1000;
1357
- }
1358
-
1359
- #fieldlist a {
1360
- padding: 5px;
1361
- cursor:pointer;
1362
- overflow: hidden;
1363
- white-space: nowrap;
1364
- text-overflow: ellipsis;
1365
- }
1366
-
1367
- #fieldlist a:hover {
1368
- background: #ccc;
1369
- }
1370
- .gen_query, .gen_query:focus {
1371
- width: 148px;
1372
- height: 38px;
1373
- background: #4EC0D9;
1374
- color: white;
1375
- cursor: pointer;
1376
- border: 0px;
1377
- font-size: 14px;
1378
- font-weight: bold;
1379
- margin: 20px 0;
1380
- border-radius: 0px;
1381
- }
1382
- .gen_query:active {
1383
- background: #ccc;
1384
- }
1385
-
1386
- .fm-query-save {
1387
- float: right;
1388
- font-size: 13px;
1389
- margin: 0 20px;
1390
- background: #4EC0D9;
1391
- width: 83px;
1392
- height: 34px;
1393
- border: 1px solid #4EC0D9;
1394
- border-radius: 0px;
1395
- color: #fff;
1396
- cursor: pointer;
1397
- }
1398
-
1399
- .select-db-op {
1400
- display: inline-block;
1401
- text-align: right;
1402
- font-weight: bold;
1403
- font-size: 18px;
1404
- padding: 5px 0;
1405
- margin: 5px 0;
1406
- background:none !important;
1407
- }
1408
-
1409
- .select-db-op.where{
1410
- width: 272px;
1411
- }
1412
-
1413
- .select-db-op img{
1414
- float:left;
1415
- }
1416
- </style>
1417
- <?php
1418
- if($table_struct) { ?>
1419
- <div class="cols">
1420
- <?php
1421
- if($con_method=='insert' or $con_method=='update') {
1422
- echo '<div style="background: none;text-align: center;font-size: 20px;color: #000;font-weight: bold;"> SET </div>';
1423
- foreach($table_struct as $col) {
1424
- $title=' '.$col->Field;
1425
- $title.="<ul style='padding-left: 17px;'>";
1426
- $title.="<li>Type - ".$col->Type."</li>";
1427
- $title.="<li>Null - ".$col->Null."</li>";
1428
- $title.="<li>Key - ".$col->Key."</li>";
1429
- $title.="<li>Default - ".$col->Default."</li>";
1430
- $title.="<li>Extra - ".$col->Extra."</li>";
1431
- $title.="</ul>";
1432
- ?>
1433
- <div><label title="<?php echo $title; ?>" class="hasTip"><b><?php echo $col->Field; ?></b><img src="<?php echo WD_FM_URL . '/images/info.png?ver='. WD_FM_VERSION.''; ?>" style="width:20px; vertical-align:middle;padding-left: 10px;" /></label><input type="text" id="<?php echo str_replace("'", "SingleQuot", $col->Field); ?>" disabled="disabled"/><input id="ch_<?php echo str_replace("'", "SingleQuot", $col->Field); ?>" type="checkbox" onClick="dis('<?php echo str_replace("'", "SingleQuot", $col->Field); ?>', this.checked)"/></div>
1434
- <?php
1435
- }
1436
- }
1437
- if($con_method=='delete' or $con_method=='update') {
1438
- echo '<div class="select-db-op where"><img src="'.WD_FM_URL . '/images/add_condition.png?ver='. WD_FM_VERSION.'" title="ADD" class="add_cond"/>WHERE</div>';
1439
- }
1440
- ?>
1441
- </div>
1442
- <br/>
1443
- <input type="button" value="Generate Query" class="gen_query" onclick="gen_query()">
1444
- <br/>
1445
- <form name="query_form" id="query_form" >
1446
- <label style="vertical-align: top; width: 102px; display: inline-block;" for="query_txt" > Query: </label><textarea id="query_txt" name="query" rows=5 style="width:428px"></textarea>
1447
- <input type="hidden" name="details" id="details">
1448
- </form>
1449
- <input type="button" value="Save" class="fm-query-save" onclick="save_query()">
1450
- <div id="fieldlist" style="display: none;">
1451
- <?php echo $form_fields ?>
1452
- </div>
1453
- <?php
1454
- }
1455
- die();
1456
- }
1457
-
1458
- ////////////////////////////////////////////////////////////////////////////////////////
1459
- // Getters & Setters //
1460
- ////////////////////////////////////////////////////////////////////////////////////////
1461
- ////////////////////////////////////////////////////////////////////////////////////////
1462
- // Private Methods //
1463
- ////////////////////////////////////////////////////////////////////////////////////////
1464
- ////////////////////////////////////////////////////////////////////////////////////////
1465
- // Listeners //
1466
- ////////////////////////////////////////////////////////////////////////////////////////
 
 
 
 
1467
  }
1
+ <?php
2
+
3
+ class FMViewFormMakerSQLMapping {
4
+ ////////////////////////////////////////////////////////////////////////////////////////
5
+ // Events //
6
+ ////////////////////////////////////////////////////////////////////////////////////////
7
+ ////////////////////////////////////////////////////////////////////////////////////////
8
+ // Constants //
9
+ ////////////////////////////////////////////////////////////////////////////////////////
10
+ ////////////////////////////////////////////////////////////////////////////////////////
11
+ // Variables //
12
+ ////////////////////////////////////////////////////////////////////////////////////////
13
+ private $model;
14
+
15
+
16
+ ////////////////////////////////////////////////////////////////////////////////////////
17
+ // Constructor & Destructor //
18
+ ////////////////////////////////////////////////////////////////////////////////////////
19
+ public function __construct($model) {
20
+ $this->model = $model;
21
+ }
22
+ ////////////////////////////////////////////////////////////////////////////////////////
23
+ // Public Methods //
24
+ ////////////////////////////////////////////////////////////////////////////////////////
25
+
26
+ public function edit_query($id, $form_id) {
27
+ wp_print_scripts('jquery');
28
+ wp_print_scripts('jquery-ui-tooltip');
29
+ ?>
30
+ <link media="all" type="text/css" href="<?php echo WD_FM_URL . '/css/style.css'; ?>" rel="stylesheet">
31
+ <link rel="stylesheet" href="<?php echo WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css'; ?>">
32
+ <?php
33
+ $label = $this->model->get_labels($form_id);
34
+ $query_obj = $this->model->get_query($id);
35
+
36
+ $temp = explode('***wdfcon_typewdf***',$query_obj->details);
37
+ $con_type = $temp[0];
38
+ $temp = explode('***wdfcon_methodwdf***',$temp[1]);
39
+ $con_method = $temp[0];
40
+ $temp = explode('***wdftablewdf***',$temp[1]);
41
+ $table_cur = $temp[0];
42
+ $temp = explode('***wdfhostwdf***',$temp[1]);
43
+ $host = $temp[0];
44
+ $temp = explode('***wdfportwdf***',$temp[1]);
45
+ $port = $temp[0];
46
+ $temp = explode('***wdfusernamewdf***',$temp[1]);
47
+ $username = $temp[0];
48
+ $temp = explode('***wdfpasswordwdf***',$temp[1]);
49
+ $password = $temp[0];
50
+ $temp = explode('***wdfdatabasewdf***',$temp[1]);
51
+ $database = $temp[0];
52
+ $details = $temp[1];
53
+
54
+ $tables = $this->model->get_tables_saved($con_type, $username, $password, $database, $host);
55
+ $table_struct = $this->model->get_table_struct_saved($con_type, $username, $password, $database, $host, $table_cur, $con_method);
56
+
57
+ $filter_types=array("type_submit_reset", "type_map", "type_editor", "type_captcha", "type_recaptcha", "type_button", "type_paypal_total", "type_send_copy");
58
+ $label_id= array();
59
+ $label_order= array();
60
+ $label_order_original= array();
61
+ $label_type= array();
62
+
63
+ $label_all = explode('#****#',$label);
64
+ $label_all = array_slice($label_all,0, count($label_all)-1);
65
+
66
+ foreach($label_all as $key => $label_each) {
67
+ $label_id_each=explode('#**id**#',$label_each);
68
+ $label_oder_each=explode('#**label**#', $label_id_each[1]);
69
+
70
+ if(in_array($label_oder_each[1],$filter_types))
71
+ continue;
72
+
73
+ array_push($label_id, $label_id_each[0]);
74
+ array_push($label_order_original, $label_oder_each[0]);
75
+ $ptn = "/[^a-zA-Z0-9_]/";
76
+ $rpltxt = "";
77
+ $label_temp=preg_replace($ptn, $rpltxt, $label_oder_each[0]);
78
+ array_push($label_order, $label_temp);
79
+ array_push($label_type, $label_oder_each[1]);
80
+ }
81
+
82
+ $form_fields='';
83
+ foreach($label_id as $key => $lid) {
84
+ $form_fields.='<a onclick="insert_field('.$lid.'); jQuery(\'#fieldlist\').hide();" style="display:block; text-decoration:none;">'.$label_order_original[$key].'</a>';
85
+ }
86
+ $user_fields = array("subid"=>"Submission ID", "ip"=>"Submitter's IP", "userid"=>"User ID", "username"=>"Username", "useremail"=>"User Email");
87
+ foreach($user_fields as $user_key=>$user_field) {
88
+ $form_fields.='<a onclick="insert_field(\''.$user_key.'\'); jQuery(\'#fieldlist\').hide();" style="display:block; text-decoration:none;">'.$user_field.'</a>';
89
+ }
90
+
91
+ $cond='<div id="condid"><select id="sel_condid" style="width: 160px">';
92
+ foreach($table_struct as $col) {
93
+ $cond.='<option>'.str_replace("'", "SingleQuot", $col->Field).'</option>';
94
+ }
95
+ $cond.='</select>';
96
+ $cond.='<select id="op_condid"><option value="=" selected="selected">=</option><option value="!=">!=</option><option value=">">&gt;</option><option value="<">&lt;</option><option value=">=">&gt;=</option><option value="<=">&lt;=</option><option value="%..%">Like</option><option value="%..">Starts with</option><option value="..%">Ends with</option></select><input id="val_condid" style="width:170px" type="text" /><select id="andor_condid" style="visibility: hidden;"><option value="AND">AND</option><option value="OR">OR</option></select><img src="' . WD_FM_URL . '/images/delete.png?ver='. WD_FM_VERSION.'" onclick="delete_cond(&quot;condid&quot;)" style="vertical-align: middle;"></div>';
97
+ ?>
98
+ <script>
99
+ function connect() {
100
+ jQuery("input[type='radio']").attr('disabled','');
101
+ jQuery('#struct').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
102
+ jQuery("#struct").load('index.php?option=com_formmaker&task=db_tables&con_type='+jQuery('input[name=con_type]:checked').val()+'&con_method='+jQuery('input[name=con_method]:checked').val()+'&format=row');
103
+ }
104
+ jQuery(document).ready(function() {
105
+ jQuery("#tables").change(function (){
106
+ jQuery("#struct").removeClass("fm_loading");
107
+ jQuery("#table_struct").load('index.php?option=com_formmaker&task=db_table_struct&name='+jQuery(this).val()+'&con_type='+jQuery('input[name=con_type]:checked').val()+'&con_method='+jQuery('input[name=con_method]:checked').val()+'&host='+jQuery('#host_rem').val()+'&port='+jQuery('#port_rem').val()+'&username='+jQuery('#username_rem').val()+'&password='+jQuery('#password_rem').val()+'&database='+jQuery('#database_rem').val()+'&format=row&id='+jQuery("#form_id").val());
108
+ });
109
+ jQuery('html').click(function() {
110
+ if(jQuery("#fieldlist").css('display')=="block") {
111
+ jQuery("#fieldlist").hide();
112
+ }
113
+ });
114
+ jQuery('.cols input[type="text"]').on('click', function(event) {
115
+ event.stopPropagation();
116
+ jQuery("#fieldlist").css("top",jQuery(this).offset().top+jQuery(this).height()+2);
117
+ jQuery("#fieldlist").css("left",jQuery(this).offset().left);
118
+ jQuery("#fieldlist").slideDown('fast');
119
+ selected_field=this.id;
120
+ });
121
+ jQuery('#query_txt').click(function(event) {
122
+ event.stopPropagation();
123
+ jQuery("#fieldlist").css("top",jQuery(this).offset().top+jQuery(this).height()+2);
124
+ jQuery("#fieldlist").css("left",jQuery(this).offset().left);
125
+ jQuery("#fieldlist").slideDown('fast');
126
+ selected_field=this.id;
127
+ });
128
+ jQuery('#fieldlist').click(function(event){
129
+ event.stopPropagation();
130
+ });
131
+ jQuery('.add_cond').click( function() {
132
+ jQuery('.cols').append(conds.replace(/condid/g, cond_id++).replace('SingleQuot', "'"));
133
+ update_vis();
134
+ });
135
+ });
136
+ var selected_field ='';
137
+ var isvisible = 1;
138
+ var cond_id = 1;
139
+ conds='<?php echo $cond ?>';
140
+ fields=new Array(<?php
141
+ $fields = "";
142
+ if($table_struct) {
143
+ foreach($table_struct as $col) {
144
+ $fields.=' "'.$col->Field.'",';
145
+ }
146
+ echo substr($fields, 0, -1);
147
+ }
148
+ ?>);
149
+
150
+ function dis(id, x) {
151
+ if(x)
152
+ jQuery('#'+id).removeAttr('disabled');
153
+ else
154
+ jQuery('#'+id).attr('disabled','disabled');
155
+ }
156
+ function update_vis() {
157
+ previous=0;
158
+ for(i=1; i<cond_id; i++) {
159
+ if(jQuery('#'+i).html()) {
160
+ jQuery('#andor_'+i).css('visibility', 'hidden');
161
+ if(previous)
162
+ jQuery('#andor_'+previous).css('visibility', 'visible');
163
+ previous=i;
164
+ }
165
+ }
166
+ }
167
+ function delete_cond(id) {
168
+ jQuery('#'+id).remove();
169
+ update_vis();
170
+ }
171
+ function save_query() {
172
+ con_type =jQuery('input[name=con_type]:checked').val();
173
+ con_method =jQuery('input[name=con_method]:checked').val();
174
+ table =jQuery('#tables').val();
175
+ host =jQuery('#host_rem').val();
176
+ port =jQuery('#port_rem').val();
177
+ username =jQuery('#username_rem').val();
178
+ password =jQuery('#password_rem').val();
179
+ database =jQuery('#database_rem').val();
180
+
181
+ str=con_type+"***wdfcon_typewdf***"+con_method+"***wdfcon_methodwdf***"+table+"***wdftablewdf***"+host+"***wdfhostwdf***"+port+"***wdfportwdf***"+username+"***wdfusernamewdf***"+password+"***wdfpasswordwdf***"+database+"***wdfdatabasewdf***";
182
+
183
+ if(fields.length) {
184
+ for(i=0; i<fields.length; i++) {
185
+ str+=fields[i]+'***wdfnamewdf***'+jQuery('#'+fields[i]).val()+'***wdfvaluewdf***'+jQuery('#ch_'+fields[i]+":checked" ).length+'***wdffieldwdf***';
186
+ }
187
+ }
188
+
189
+ for(i=1; i<cond_id; i++) {
190
+ if(jQuery('#'+i).html()) {
191
+ str+=jQuery('#sel_'+i).val()+'***sel***'+jQuery('#op_'+i).val()+'***op***'+jQuery('#val_'+i).val()+'***val***'+jQuery('#andor_'+i).val()+'***where***';
192
+ }
193
+ }
194
+ if(!jQuery('#query_txt').val()) {
195
+ gen_query();
196
+ }
197
+ jQuery('#details').val(str);
198
+ var datatxt = jQuery("#query_form").serialize()+'&form_id='+jQuery("#form_id").val();
199
+
200
+ if(jQuery('#query_txt').val()) {
201
+ jQuery('.c1').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
202
+
203
+ jQuery.ajax({
204
+ type: "POST",
205
+ url: "<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => $id, 'form_id' => $form_id, 'task' => 'update_query', 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>",
206
+ data: datatxt,
207
+ success: function(data) {
208
+ window.parent.wd_fm_apply_options('apply_options');
209
+ window.parent.tb_remove();
210
+ }
211
+ });
212
+ }
213
+ else {
214
+ alert('The query is empty.');
215
+ }
216
+ return false;
217
+ }
218
+
219
+ function gen_query() {
220
+ if(jQuery('#query_txt').val())
221
+ if(!confirm('Are you sure you want to replace the Query? All the modifications to the Query will be lost.'))
222
+ return;
223
+ query="";
224
+ fields=new Array(<?php
225
+ $fields = "";
226
+ if($table_struct) {
227
+ foreach($table_struct as $col) {
228
+ $fields.=' "'.str_replace("'", "SingleQuot", $col->Field).'",';
229
+ }
230
+ echo substr($fields, 0, -1);
231
+ }
232
+ ?>);
233
+
234
+ con_type =jQuery('input[name=con_type]:checked').val();
235
+ con_method =jQuery('input[name=con_method]:checked').val();
236
+ table =jQuery('#tables').val();
237
+ fls='';
238
+ vals='';
239
+ valsA=new Array();
240
+ flsA=new Array();
241
+
242
+ if(fields.length) {
243
+ for(i=0; i<fields.length; i++) {
244
+ if(jQuery('#ch_'+fields[i]+":checked" ).length) {
245
+ flsA.push(fields[i]);
246
+ valsA.push(jQuery('#'+fields[i]).val());
247
+ }
248
+ }
249
+ }
250
+ if(con_method=="insert") {
251
+ if(flsA.length) {
252
+ for(i=0; i<flsA.length-1; i++) {
253
+ fls+= '`'+flsA[i]+'`, ';
254
+ vals+= '"'+valsA[i]+'", ';
255
+ }
256
+ fls+= '`'+flsA[i]+'`';
257
+ vals+= '"'+valsA[i]+'"';
258
+ }
259
+ if(fls)
260
+ query="INSERT INTO "+jQuery('#tables').val()+" (" +fls+") VALUES ("+vals+")";
261
+ }
262
+
263
+ if(con_method=="update") {
264
+ if(flsA.length) {
265
+ for(i=0; i<flsA.length-1; i++) {
266
+ vals+= '`'+flsA[i]+'`="'+valsA[i]+'", ';
267
+ }
268
+ vals+= '`'+flsA[i]+'`="'+valsA[i]+'"';
269
+ }
270
+ where="";
271
+ previous='';
272
+
273
+ for(i=1; i<cond_id; i++) {
274
+ if(jQuery('#'+i).html()) {
275
+ if(jQuery('#op_'+i).val()=="%..%")
276
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'%"';
277
+ else if(jQuery('#op_'+i).val()=="%..")
278
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'"';
279
+ else if(jQuery('#op_'+i).val()=="..%")
280
+ op_val=' LIKE "'+jQuery('#val_'+i).val()+'%"';
281
+ else
282
+ op_val=' '+jQuery('#op_'+i).val()+' "'+jQuery('#val_'+i).val()+'"';
283
+ where+=previous+' `'+jQuery('#sel_'+i).val()+'`'+op_val;
284
+ previous=' '+ jQuery('#andor_'+i).val();
285
+ }
286
+ }
287
+ if(vals)
288
+ query="UPDATE "+jQuery('#tables').val()+" SET " + vals+(where? ' WHERE'+where: '') ;
289
+ }
290
+ if(con_method=="delete") {
291
+ where="";
292
+ previous='';
293
+ for(i=1; i<cond_id; i++) {
294
+ if(jQuery('#'+i).html()) {
295
+ if(jQuery('#op_'+i).val()=="%..%")
296
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'%"';
297
+ else if(jQuery('#op_'+i).val()=="%..")
298
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'"';
299
+ else if(jQuery('#op_'+i).val()=="..%")
300
+ op_val=' LIKE "'+jQuery('#val_'+i).val()+'%"';
301
+ else
302
+ op_val=' '+jQuery('#op_'+i).val()+' "'+jQuery('#val_'+i).val()+'"';
303
+ where+=previous+' '+jQuery('#sel_'+i).val()+op_val;
304
+ previous=' '+ jQuery('#andor_'+i).val();
305
+ }
306
+ }
307
+ if(where)
308
+ query="DELETE FROM "+jQuery('#tables').val()+ ' WHERE'+where ;
309
+ }
310
+ jQuery('#query_txt').val(query.replace("SingleQuot", "'"));
311
+ }
312
+
313
+ jQuery(document).ready(function () {
314
+ jQuery(".hasTip").tooltip({
315
+ track: true,
316
+ content: function () {
317
+ return jQuery(this).prop('title');
318
+ }
319
+ });
320
+ });
321
+
322
+ function insert_field(myValue) {
323
+ if(!selected_field)
324
+ return;
325
+ myField=document.getElementById(selected_field);
326
+ if (document.selection) {
327
+ myField.focus();
328
+ sel = document.selection.createRange();
329
+ sel.text = myValue;
330
+ }
331
+ else {
332
+ if (myField.selectionStart || myField.selectionStart == '0') {
333
+ var startPos = myField.selectionStart;
334
+ var endPos = myField.selectionEnd;
335
+ myField.value = myField.value.substring(0, startPos)
336
+ + "{"+myValue+"}"
337
+ + myField.value.substring(endPos, myField.value.length);
338
+ }
339
+ else {
340
+ myField.value += "{"+myValue+"}";
341
+ }
342
+ }
343
+ }
344
+ </script>
345
+ <style>
346
+ .c1 {
347
+ padding: 0 10px;
348
+ }
349
+
350
+ .main_func{
351
+ font-family: Segoe UI;
352
+ display: inline-block;
353
+ width: 550px;
354
+ }
355
+
356
+ .main_func .admintable {
357
+ width: 100%;
358
+ padding: 10px 0;
359
+ margin-bottom: 15px;
360
+ }
361
+
362
+ .main_func .admintable .key{
363
+ width: 36%;
364
+ }
365
+
366
+ .main_func .admintable input[type='text'],
367
+ .main_func .admintable input[type='password']{
368
+ padding: 4px 6px;
369
+ width:244px;
370
+ }
371
+
372
+ .btn.connect {
373
+ background:#4EC0D9;
374
+ width:78px;
375
+ height:32px;
376
+ border:1px solid #4EC0D9;
377
+ border-radius:0px;
378
+ color:#fff;
379
+ cursor:pointer;
380
+ }
381
+
382
+ .desc {
383
+ font-size: 13px;
384
+ display: inline-block;
385
+ width: 100%;
386
+ height: 100%;
387
+ position: fixed;
388
+ margin: 15px;
389
+ margin-left: 45px;
390
+ overflow: scroll;
391
+ }
392
+
393
+ .desc > div {
394
+ margin-top:3px;
395
+ }
396
+
397
+ .desc div span {
398
+ width: 62px;
399
+ display: inline-block;
400
+ }
401
+
402
+ .desc button {
403
+ max-width: 190px;
404
+ overflow: hidden;
405
+ white-space: nowrap;
406
+ text-overflow: ellipsis;
407
+ padding: 4px;
408
+ background: #eee;
409
+ border: 1px solid #ccc;
410
+ border-radius:0px;
411
+ height:27px;
412
+ }
413
+
414
+ .key label {
415
+ display:inline-block;
416
+ width:150px;
417
+ }
418
+
419
+ .select-db-label {
420
+ display: inline-block;
421
+ font-size: 16px;
422
+ width: 201px;
423
+
424
+ }
425
+
426
+ .select-db-select {
427
+ width:325px;
428
+ padding:6px;
429
+ }
430
+
431
+ .struct {
432
+ border: 3px solid red;
433
+ padding: 4px 6px;
434
+ display: inline-block;
435
+ margin-top:10px;
436
+ }
437
+
438
+ .cols div:nth-child(even) {background: #FFF}
439
+ .cols div:nth-child(odd) {background: #F5F5F5}
440
+ .cols div {
441
+ height: 28px;
442
+ padding: 5px
443
+ }
444
+
445
+ .cols label {
446
+ display: inline-block;
447
+ width: 175px;
448
+ font-size: 15px;
449
+ overflow: hidden;
450
+ white-space: nowrap;
451
+ text-overflow: ellipsis;
452
+ vertical-align: middle;
453
+ }
454
+
455
+ .cols input[type="text"] {
456
+ width: 295px;
457
+ line-height: 18px;
458
+ height: 28px;
459
+ border: 1px solid #ccc;
460
+ padding: 0 3px;
461
+ margin-right: 2px;
462
+ }
463
+
464
+ .cols input[type="text"]:disabled {
465
+ cursor: not-allowed;
466
+ background-color: #eee;
467
+ }
468
+
469
+ .cols input[type="checkbox"] {
470
+ width: 20px;
471
+ line-height: 18px;
472
+ height: 20px;
473
+ vertical-align: middle;
474
+ }
475
+
476
+ .cols select {
477
+ line-height: 18px;
478
+ height: 28px;
479
+ margin-right: 2px;
480
+ }
481
+
482
+ #fieldlist {
483
+ position: absolute;
484
+ width:225px;
485
+ background: #fff;
486
+ border: solid 1px #c7c7c7;
487
+ top: 0;
488
+ left: 0;
489
+ z-index: 1000;
490
+ }
491
+
492
+ #fieldlist a {
493
+ padding: 5px;
494
+ cursor:pointer;
495
+ overflow: hidden;
496
+ white-space: nowrap;
497
+ text-overflow: ellipsis;
498
+ }
499
+
500
+ #fieldlist a:hover {
501
+ background: #ccc;
502
+ }
503
+
504
+ .gen_query, .gen_query:focus {
505
+ width: 148px;
506
+ height: 38px;
507
+ background: #4EC0D9;
508
+ color: white;
509
+ cursor: pointer;
510
+ border: 0px;
511
+ font-size: 14px;
512
+ font-weight: bold;
513
+ margin: 20px 0;
514
+ border-radius: 0px;
515
+ }
516
+
517
+ .gen_query:active {
518
+ background: #ccc;
519
+ }
520
+
521
+ .fm-query-save {
522
+ float: right;
523
+ font-size: 13px;
524
+ margin: 0 20px;
525
+ background: #4EC0D9;
526
+ width: 83px;
527
+ height: 34px;
528
+ border: 1px solid #4EC0D9;
529
+ border-radius: 0px;
530
+ color: #fff;
531
+ cursor: pointer;
532
+ }
533
+
534
+ .select-db-op {
535
+ display: inline-block;
536
+ text-align: right;
537
+ font-weight: bold;
538
+ font-size: 18px;
539
+ padding: 5px 0;
540
+ margin: 5px 0;
541
+ background:none !important;
542
+ }
543
+
544
+ .select-db-op.where{
545
+ width: 272px;
546
+ }
547
+
548
+ .select-db-op img{
549
+ float:left;
550
+ }
551
+
552
+ .select-db-label {
553
+ display: inline-block;
554
+ font-size: 16px;
555
+ width: 201px;
556
+
557
+ }
558
+ .select-db-select {
559
+ width:325px;
560
+ padding:6px;
561
+ }
562
+
563
+ .fm-query-save {
564
+ float: right;
565
+ font-size: 13px;
566
+ margin: 0 20px;
567
+ background: #4EC0D9;
568
+ width: 83px;
569
+ height: 34px;
570
+ border: 1px solid #4EC0D9;
571
+ border-radius: 0px;
572
+ color: #fff;
573
+ cursor: pointer;
574
+ }
575
+ </style>
576
+ <div class="c1">
577
+ <div class="main_func">
578
+ <table class="admintable">
579
+ <tr valign="top">
580
+ <td class="key">
581
+ <label style="font-size:20px;">Connection type: </label>
582
+ </td>
583
+ <td>
584
+ <input type="radio" name="con_type" id="local" value="local" <?php if($con_type=='local') echo 'checked="checked"'?> disabled>
585
+ <label for="local">Local</label>
586
+ <input type="radio" name="con_type" id="remote" value="remote" <?php if($con_type=='remote') echo 'checked="checked"'?> disabled>
587
+ <label for="remote">Remote</label>
588
+ </td>
589
+ <td rowspan="2">
590
+ <input type="button" value="Connect" onclick="connect()" class="btn connect" disabled>
591
+ </td>
592
+ </tr>
593
+ <tr class="remote_info" <?php if($con_type=='local') echo 'style="display:none"'?>>
594
+ <td class="key">Host</td>
595
+ <td>
596
+ <input type="text" name="host" id="host_rem" style="width:150px" value="<?php echo $host; ?>" disabled>
597
+ Port : <input type="text" name="port" id="port_rem" value="<?php echo $port; ?>" style="width:48px" disabled>
598
+ </td>
599
+ </tr>
600
+ <tr class="remote_info" <?php if($con_type=='local') echo 'style="display:none"'?>>
601
+ <td class="key">Username</td>
602
+ <td>
603
+ <input type="text" name="username" id="username_rem" value="<?php echo $username; ?>" disabled>
604
+ </td>
605
+ </tr>
606
+ <tr class="remote_info" <?php if($con_type=='local') echo 'style="display:none"'?>>
607
+ <td class="key">Password</td>
608
+ <td>
609
+ <input type="password" name="password" id="password_rem" value="<?php echo $password; ?>" disabled>
610
+ </td>
611
+ </tr>
612
+ <tr class="remote_info" <?php if($con_type=='local') echo 'style="display:none"'?>>
613
+ <td class="key">Database</td>
614
+ <td>
615
+ <input type="text"name="database" id="database_rem" value="<?php echo $database; ?>" disabled>
616
+ </td>
617
+ </tr>
618
+ <tr valign="top">
619
+ <td class="key">
620
+ <label style="font-size:20px;">Type: </label>
621
+ </td>
622
+ <td>
623
+ <input type="radio" name="con_method" id="insert" value="insert" <?php if($con_method=='insert') echo 'checked="checked"'?> disabled>
624
+ <label for="insert">Insert</label>
625
+ <input type="radio" name="con_method" id="update" value="update" <?php if($con_method=='update') echo 'checked="checked"'?> disabled>
626
+ <label for="update">Update</label>
627
+ <input type="radio" name="con_method" id="delete" value="delete" <?php if($con_method=='delete') echo 'checked="checked"'?> disabled>
628
+ <label for="delete">Delete</label>
629
+ </td>
630
+ </tr>
631
+ </table>
632
+ <div id="struct">
633
+ <label for="tables" class="select-db-label">Select a table</label>
634
+ <select name="tables" id="tables" class="select-db-select" disabled>
635
+ <option value="" ></option>
636
+ <?php
637
+ foreach($tables as $table) {
638
+ echo '<option value="'.$table.'" '.($table_cur==$table ? 'selected' : '').' >'.$table.'</option>';
639
+ }
640
+ ?>
641
+ </select>
642
+ <br/>
643
+ <div id="table_struct">
644
+ <?php
645
+ if($table_struct) {
646
+ ?>
647
+ <div class="struct">
648
+ <div class="cols">
649
+ <?php
650
+ $temps=explode('***wdffieldwdf***',$details);
651
+ $wheres = $temps[count($temps)-1];
652
+ $temps = array_slice($temps,0, count($temps)-1);
653
+ $col_names= array();
654
+ $col_vals= array();
655
+ $col_checks= array();
656
+
657
+ foreach($temps as $temp) {
658
+ $temp=explode('***wdfnamewdf***',$temp);
659
+ array_push($col_names, $temp[0]);
660
+ $temp=explode('***wdfvaluewdf***',$temp[1]);
661
+ array_push($col_vals, $temp[0]);
662
+ array_push($col_checks, $temp[1]);
663
+ }
664
+ if($con_method=='insert' or $con_method=='update') {
665
+ echo '<div style="background: none;text-align: center;font-size: 20px;color: #000;font-weight: bold;"> SET </div>';
666
+
667
+ foreach($table_struct as $key =>$col) {
668
+ $title=' '.$col->Field;
669
+ $title.="<ul style='padding-left: 17px;'>";
670
+ $title.="<li>Type - ".$col->Type."</li>";
671
+ $title.="<li>Null - ".$col->Null."</li>";
672
+ $title.="<li>Key - ".$col->Key."</li>";
673
+ $title.="<li>Default - ".$col->Default."</li>";
674
+ $title.="<li>Extra - ".$col->Extra."</li>";
675
+ $title.="</ul>";
676
+ ?>
677
+ <div><label title="<?php echo $title; ?>" class="hasTip"><b><?php echo $col->Field; ?></b><img src="<?php echo WD_FM_URL . '/images/info.png?ver='. WD_FM_VERSION.''; ?>" style="width:20px; vertical-align:middle;padding-left: 10px;" /></label><input type="text" id="<?php echo str_replace("'", "SingleQuot", $col->Field); ?>" <?php if(!$col_checks[$key]) echo 'disabled="disabled"'?> value="<?php echo $col_vals[$key]; ?>" /><input id="ch_<?php echo str_replace("'", "SingleQuot", $col->Field); ?>" type="checkbox" onClick="dis('<?php echo str_replace("'", "SingleQuot", $col->Field); ?>', this.checked)" <?php if($col_checks[$key]) echo 'checked="checked"'?> /></div>
678
+ <?php
679
+ }
680
+ }
681
+
682
+ if($con_method=='delete' or $con_method=='update') {
683
+ echo '<div class="select-db-op where"><img src="'.WD_FM_URL . '/images/add_condition.png?ver='. WD_FM_VERSION.'" title="ADD" class="add_cond"/>WHERE</div>';
684
+ if($wheres) {
685
+ echo '<script>';
686
+
687
+ $wheres = explode('***where***',$wheres);
688
+ $wheres = array_slice($wheres,0, count($wheres)-1);
689
+ foreach($wheres as $where) {
690
+ $temp=explode('***sel***',$where);
691
+ $sel = $temp[0];
692
+ $temp=explode('***op***',$temp[1]);
693
+ $op = $temp[0];
694
+ $temp=explode('***val***',$temp[1]);
695
+ $val = $temp[0];
696
+ $andor = $temp[1];
697
+ echo 'jQuery(".cols").append(conds.replace(/condid/g, cond_id++).replace(\'SingleQuot\', "\'")); update_vis();
698
+ jQuery("#sel_"+(cond_id-1)).val("'.html_entity_decode($sel, ENT_QUOTES).'");
699
+ jQuery("#op_"+(cond_id-1)).val("'.$op.'");
700
+ jQuery("#val_"+(cond_id-1)).val("'.$val.'");
701
+ jQuery("#andor_"+(cond_id-1)).val("'.$andor.'");';
702
+ }
703
+ echo '</script>';
704
+ }
705
+ }
706
+ ?>
707
+ </div>
708
+ <div style="color:red; background: none">The changes above will not affect the query until you click "Generate query".</div>
709
+ </div>
710
+ <br/>
711
+ <input type="button" value="Generate Query" class="gen_query" onclick="gen_query()">
712
+ <br/>
713
+ <form name="query_form" id="query_form" >
714
+ <label style="vertical-align: top; width: 102px; display: inline-block;" for="query_txt" > Query: </label><textarea id="query_txt" name="query" rows=5 style="width:428px" ><?php echo $query_obj->query; ?></textarea>
715
+ <input type="hidden" name="details" id="details">
716
+ <input type="hidden" name="id" value="<?php echo $query_obj->id; ?>">
717
+ </form>
718
+ <input type="button" value="Save" class="fm-query-save" onclick="save_query()">
719
+ <div id="fieldlist" style="display: none;">
720
+ <?php echo $form_fields; ?>
721
+ </div>
722
+ <?php
723
+ }
724
+ ?>
725
+ </div>
726
+ </div>
727
+ <input type="hidden" value="<?php echo $form_id ?>" id="form_id">
728
+ </div>
729
+ <div class="desc">
730
+ <?php
731
+ foreach($label_id as $key => $lid) {
732
+ echo '<div>{'.$lid.'} - <button onclick="insert_field('.$lid.');">'.$label_order_original[$key].'</button></div>';
733
+ }
734
+ $user_fields = array("subid"=>"Submission ID", "ip"=>"Submitter's IP", "userid"=>"User ID", "username"=>"Username", "useremail"=>"User Email");
735
+ foreach($user_fields as $user_key=>$user_field) {
736
+ echo '<div>{'.$user_key.'} - <button onclick="insert_field(\''.$user_key.'\');">'.$user_field.'</button></div>';
737
+ }
738
+ ?>
739
+ </div>
740
+ </div>
741
+ <?php
742
+ die();
743
+ }
744
+
745
+ public function add_query($form_id){
746
+ wp_print_scripts('jquery');
747
+ wp_print_scripts('jquery-ui-tooltip');
748
+ ?>
749
+ <link media="all" type="text/css" href="<?php echo WD_FM_URL . '/css/style.css'; ?>" rel="stylesheet">
750
+ <link rel="stylesheet" href="<?php echo WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css'; ?>">
751
+ <?php
752
+ $label = $this->model->get_labels($form_id);
753
+
754
+ $filter_types=array("type_submit_reset", "type_map", "type_editor", "type_captcha", "type_recaptcha", "type_button", "type_paypal_total", "type_send_copy");
755
+ $label_id= array();
756
+ $label_order= array();
757
+ $label_order_original= array();
758
+ $label_type= array();
759
+
760
+ $label_all = explode('#****#',$label);
761
+ $label_all = array_slice($label_all,0, count($label_all)-1);
762
+ foreach($label_all as $key => $label_each) {
763
+ $label_id_each=explode('#**id**#',$label_each);
764
+ $label_oder_each=explode('#**label**#', $label_id_each[1]);
765
+
766
+ if(in_array($label_oder_each[1],$filter_types))
767
+ continue;
768
+ array_push($label_id, $label_id_each[0]);
769
+ array_push($label_order_original, $label_oder_each[0]);
770
+ $ptn = "/[^a-zA-Z0-9_]/";
771
+ $rpltxt = "";
772
+ $label_temp=preg_replace($ptn, $rpltxt, $label_oder_each[0]);
773
+ array_push($label_order, $label_temp);
774
+ array_push($label_type, $label_oder_each[1]);
775
+ }
776
+ ?>
777
+ <script>
778
+ function insert_field(){}
779
+
780
+ function connect() {
781
+ jQuery("input[type='radio']").attr('disabled','');
782
+ jQuery(".connect").attr('disabled','');
783
+ jQuery('#struct').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
784
+ jQuery.ajax({
785
+ type: "POST",
786
+ url: "<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $form_id, 'task' => 'db_tables', 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>",
787
+ data: 'con_type='+jQuery('input[name=con_type]:checked').val()+'&con_method='+jQuery('input[name=con_method]:checked').val()+'&host='+jQuery('#host_rem').val()+'&port='+jQuery('#port_rem').val()+'&username='+jQuery('#username_rem').val()+'&password='+jQuery('#password_rem').val()+'&database='+jQuery('#database_rem').val()+'&format=row',
788
+ success: function(data) {
789
+ jQuery("#struct").removeClass("fm_loading");
790
+ if(data==1) {
791
+ jQuery("#struct").html('<div style="font-size: 22px; text-align: center; padding-top: 15px;">Could not connect to MySQL.</div>')
792
+ jQuery(".connect").removeAttr('disabled');
793
+ jQuery("input[type='radio']").removeAttr('disabled','');
794
+ }
795
+ else {
796
+ jQuery("#struct").html(data);
797
+ }
798
+
799
+ }
800
+ });
801
+ }
802
+
803
+ function shh(x) {
804
+ if(x)
805
+ jQuery(".remote_info").show();
806
+ else
807
+ jQuery(".remote_info").hide();
808
+ }
809
+ </script>
810
+ <style>
811
+ .c1 {
812
+ padding: 0 10px;
813
+ }
814
+
815
+ .main_func{
816
+ font-family: Segoe UI;
817
+ display: inline-block;
818
+ width: 550px;
819
+ }
820
+
821
+ .main_func .admintable {
822
+ width: 100%;
823
+ padding: 10px 0;
824
+ margin-bottom: 15px;
825
+ }
826
+
827
+ .main_func .admintable .key{
828
+ width: 36%;
829
+ }
830
+
831
+ .main_func .admintable input[type='text'],
832
+ .main_func .admintable input[type='password']{
833
+ padding: 4px 6px;
834
+ width:244px;
835
+ }
836
+
837
+ .btn.connect {
838
+ background:#4EC0D9;
839
+ width:78px;
840
+ height:32px;
841
+ border:1px solid #4EC0D9;
842
+ border-radius:0px;
843
+ color:#fff;
844
+ cursor:pointer;
845
+ }
846
+
847
+ .desc {
848
+ font-size: 13px;
849
+ display: inline-block;
850
+ width: 100%;
851
+ height: 100%;
852
+ position: fixed;
853
+ margin: 15px;
854
+ margin-left: 45px;
855
+ overflow: scroll;
856
+ }
857
+
858
+ .desc > div {
859
+ margin-top:3px;
860
+ }
861
+
862
+ .desc div span {
863
+ width: 62px;
864
+ display: inline-block;
865
+ }
866
+
867
+ .desc button {
868
+ max-width: 190px;
869
+ overflow: hidden;
870
+ white-space: nowrap;
871
+ text-overflow: ellipsis;
872
+ padding: 4px;
873
+ background: #eee;
874
+ border: 1px solid #ccc;
875
+ border-radius:0px;
876
+ height:27px;
877
+ }
878
+
879
+ .key label {
880
+ display:inline-block;
881
+ width:150px;
882
+ }
883
+
884
+ .select-db-label {
885
+ display: inline-block;
886
+ font-size: 16px;
887
+ width: 201px;
888
+
889
+ }
890
+
891
+ .select-db-select {
892
+ width:325px;
893
+ padding:6px;
894
+ }
895
+ </style>
896
+ <div class="c1">
897
+ <div class="main_func">
898
+ <table class="admintable">
899
+ <tr valign="top">
900
+ <td class="key">
901
+ <label style="font-size:20px;">Connection type: </label>
902
+ </td>
903
+ <td>
904
+ <input type="radio" name="con_type" id="local" value="local" checked="checked" onclick="shh(false)">
905
+ <label for="local">Local</label>
906
+ <input type="radio" name="con_type" id="remote" value="remote" onclick="shh(true)">
907
+ <label for="remote">Remote</label>
908
+ </td>
909
+ <td rowspan="2">
910
+ <input type="button" value="Connect" onclick="connect()" class="btn connect">
911
+ </td>
912
+ </tr>
913
+ <tr class="remote_info" style="display:none">
914
+ <td class="key">Host</td>
915
+ <td>
916
+ <input type="text" name="host" id="host_rem" style="width:150px">
917
+ Port : <input type="text" name="port" id="port_rem" value="3306" style="width:48px">
918
+ </td>
919
+ </tr>
920
+ <tr class="remote_info" style="display:none">
921
+ <td class="key">Username</td>
922
+ <td>
923
+ <input type="text" name="username" id="username_rem">
924
+ </td>
925
+ </tr>
926
+ <tr class="remote_info" style="display:none">
927
+ <td class="key">Password</td>
928
+ <td>
929
+ <input type="password" name="password" id="password_rem">
930
+ </td>
931
+ </tr>
932
+ <tr class="remote_info" style="display:none">
933
+ <td class="key">Database</td>
934
+ <td>
935
+ <input type="text"name="database" id="database_rem">
936
+ </td>
937
+ </tr>
938
+ <tr valign="top">
939
+ <td class="key">
940
+ <label style="font-size:20px;">Type: </label>
941
+ </td>
942
+ <td >
943
+ <input type="radio" name="con_method" id="insert" value="insert" checked="checked">
944
+ <label for="insert">Insert</label>
945
+ <input type="radio" name="con_method" id="update" value="update">
946
+ <label for="update">Update</label>
947
+ <input type="radio" name="con_method" id="delete" value="delete">
948
+ <label for="delete">Delete</label>
949
+ </td>
950
+ </tr>
951
+ </table>
952
+ <div id="struct">
953
+ </div>
954
+ <input type="hidden" value="<?php echo $form_id ?>" id="form_id">
955
+ </div>
956
+ <div class="desc">
957
+ <?php
958
+ foreach($label_id as $key => $lid) {
959
+ echo '<div><span>{'.$lid.'}</span> - <button onclick="insert_field('.$lid.');">'.$label_order_original[$key].'</button></div>';
960
+ }
961
+
962
+ $user_fields = array("subid"=>"Submission ID", "ip"=>"Submitter's IP", "userid"=>"User ID", "username"=>"Username", "useremail"=>"User Email");
963
+ foreach($user_fields as $user_key=>$user_field) {
964
+ echo '<div><span>{'.$user_key.'}</span> - <button onclick="insert_field(\''.$user_key.'\');">'.$user_field.'</button></div>';
965
+ }
966
+ ?>
967
+ </div>
968
+ </div>
969
+ <?php
970
+ die();
971
+ }
972
+
973
+ public function db_tables($form_id){
974
+ $tables = $this->model->get_tables();
975
+ ?>
976
+ <label for="tables" class="select-db-label">Select a table</label>
977
+ <select name="tables" id="tables" class="select-db-select">
978
+ <option value="" ></option>
979
+ <?php
980
+ foreach($tables as $table) {
981
+ echo '<option value="' . $table . '" >' . $table . '</option>';
982
+ }
983
+ ?>
984
+ </select>
985
+ <br/>
986
+ <div id="table_struct">
987
+ </div>
988
+ <script>
989
+ jQuery("#tables").change(function (){
990
+ jQuery('#table_struct').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
991
+ jQuery.ajax({
992
+ type: "POST",
993
+ url: "<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $form_id, 'task' => 'db_table_struct', 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>",
994
+ data: 'name='+jQuery(this).val()+'&con_type='+jQuery('input[name=con_type]:checked').val()+'&con_method='+jQuery('input[name=con_method]:checked').val()+'&host='+jQuery('#host_rem').val()+'&port='+jQuery('#port_rem').val()+'&username='+jQuery('#username_rem').val()+'&password='+jQuery('#password_rem').val()+'&database='+jQuery('#database_rem').val()+'&format=row',
995
+ success: function(data) {
996
+ jQuery("#table_struct").removeClass("fm_loading");
997
+ jQuery("#table_struct").html(data);
998
+ }
999
+ });
1000
+ })
1001
+ </script>
1002
+ <?php
1003
+ die();
1004
+ }
1005
+
1006
+ public function db_table_struct ($form_id) {
1007
+ $table_struct = $this->model->get_table_struct();
1008
+ $label = $this->model->get_labels($form_id);
1009
+ $con_method = isset($_POST['con_method']) ? $_POST['con_method'] : '';
1010
+ $filter_types=array("type_submit_reset", "type_map", "type_editor", "type_captcha", "type_recaptcha", "type_button", "type_paypal_total", "type_send_copy");
1011
+ $label_id= array();
1012
+ $label_order= array();
1013
+ $label_order_original= array();
1014
+ $label_type= array();
1015
+
1016
+ ///stexic
1017
+ $label_all = explode('#****#',$label);
1018
+ $label_all = array_slice($label_all,0, count($label_all)-1);
1019
+
1020
+ foreach($label_all as $key => $label_each) {
1021
+ $label_id_each=explode('#**id**#',$label_each);
1022
+ $label_oder_each=explode('#**label**#', $label_id_each[1]);
1023
+
1024
+ if(in_array($label_oder_each[1],$filter_types)) {
1025
+ continue;
1026
+ }
1027
+ array_push($label_id, $label_id_each[0]);
1028
+ array_push($label_order_original, $label_oder_each[0]);
1029
+ $ptn = "/[^a-zA-Z0-9_]/";
1030
+ $rpltxt = "";
1031
+ $label_temp=preg_replace($ptn, $rpltxt, $label_oder_each[0]);
1032
+ array_push($label_order, $label_temp);
1033
+ array_push($label_type, $label_oder_each[1]);
1034
+ }
1035
+ $form_fields='';
1036
+ foreach($label_id as $key => $id) {
1037
+ $form_fields.='<a onclick="insert_field('.$id.'); jQuery(\'#fieldlist\').hide();" style="display:block; text-decoration:none;">'.$label_order_original[$key].'</a>';
1038
+ }
1039
+ $user_fields = array("subid"=>"Submission ID", "ip"=>"Submitter's IP", "userid"=>"User ID", "username"=>"Username", "useremail"=>"User Email");
1040
+ foreach($user_fields as $user_key=>$user_field) {
1041
+ $form_fields.='<a onclick="insert_field(\''.$user_key.'\'); jQuery(\'#fieldlist\').hide();" style="display:block; text-decoration:none;">'.$user_field.'</a>';
1042
+ }
1043
+ $cond='<div id="condid"><select id="sel_condid" style="width: 160px">';
1044
+ foreach($table_struct as $col) {
1045
+ $cond.='<option>'.str_replace("'", "SingleQuot", $col->Field).'</option>';
1046
+ }
1047
+ $cond.='</select>';
1048
+
1049
+ $cond.='<select id="op_condid"><option value="=" selected="selected">=</option><option value="!=">!=</option><option value=">">&gt;</option><option value="<">&lt;</option><option value=">=">&gt;=</option><option value="<=">&lt;=</option><option value="%..%">Like</option><option value="%..">Starts with</option><option value="..%">Ends with</option></select><input id="val_condid" style="width:170px" type="text" /><select id="andor_condid" style="visibility: hidden;"><option value="AND">AND</option><option value="OR">OR</option></select><img src="' . WD_FM_URL . '/images/delete.png?ver='. WD_FM_VERSION.'" onclick="delete_cond(&quot;condid&quot;)" style="vertical-align: middle;"></div>';
1050
+ ?>
1051
+ <script>
1052
+ var selected_field ='';
1053
+ var isvisible = 1;
1054
+ var cond_id = 1;
1055
+
1056
+ conds='<?php echo $cond ?>';
1057
+ fields=new Array(<?php
1058
+ $fields = "";
1059
+ if($table_struct) {
1060
+ foreach($table_struct as $col) {
1061
+ $fields.=' "'.$col->Field.'",';
1062
+ }
1063
+ echo substr($fields, 0, -1);
1064
+ }
1065
+ ?>);
1066
+ function dis(id, x) {
1067
+ if(x)
1068
+ jQuery('#'+id).removeAttr('disabled');
1069
+ else
1070
+ jQuery('#'+id).attr('disabled','disabled');
1071
+ }
1072
+
1073
+ function update_vis() {
1074
+ previous=0;
1075
+ for(i=1; i<cond_id; i++) {
1076
+ if(jQuery('#'+i).html()) {
1077
+ jQuery('#andor_'+i).css('visibility', 'hidden');
1078
+ if(previous) {
1079
+ jQuery('#andor_'+previous).css('visibility', 'visible');
1080
+ }
1081
+ previous=i;
1082
+ }
1083
+ }
1084
+ }
1085
+
1086
+ function delete_cond(id) {
1087
+ jQuery('#'+id).remove();
1088
+ update_vis();
1089
+ }
1090
+
1091
+ jQuery('.add_cond').click( function() {
1092
+ jQuery('.cols').append(conds.replace(/condid/g, cond_id++).replace('SingleQuot', "'"));
1093
+ update_vis();
1094
+ });
1095
+
1096
+ jQuery('html').click(function() {
1097
+ if(jQuery("#fieldlist").css('display')=="block") {
1098
+ jQuery("#fieldlist").hide();
1099
+ }
1100
+ });
1101
+
1102
+ jQuery('.cols input[type="text"]').on('click', function(event) {
1103
+ event.stopPropagation();
1104
+ jQuery("#fieldlist").css("top",jQuery(this).offset().top+jQuery(this).height()+2);
1105
+ jQuery("#fieldlist").css("left",jQuery(this).offset().left);
1106
+ jQuery("#fieldlist").slideDown('fast');
1107
+ selected_field=this.id;
1108
+ });
1109
+
1110
+ jQuery('#query_txt').click(function(event) {
1111
+ event.stopPropagation();
1112
+ jQuery("#fieldlist").css("top",jQuery(this).offset().top+jQuery(this).height()+2);
1113
+ jQuery("#fieldlist").css("left",jQuery(this).offset().left);
1114
+ jQuery("#fieldlist").slideDown('fast');
1115
+ selected_field=this.id;
1116
+ });
1117
+
1118
+ jQuery('#fieldlist').click(function(event){
1119
+ event.stopPropagation();
1120
+ });
1121
+
1122
+ function save_query() {
1123
+ con_type =jQuery('input[name=con_type]:checked').val();
1124
+ con_method =jQuery('input[name=con_method]:checked').val();
1125
+ table =jQuery('#tables').val();
1126
+ table =jQuery('#tables').val();
1127
+ host =jQuery('#host_rem').val();
1128
+ port =jQuery('#port_rem').val();
1129
+ username =jQuery('#username_rem').val();
1130
+ password =jQuery('#password_rem').val();
1131
+ database =jQuery('#database_rem').val();
1132
+
1133
+ str=con_type+"***wdfcon_typewdf***"+con_method+"***wdfcon_methodwdf***"+table+"***wdftablewdf***"+host+"***wdfhostwdf***"+port+"***wdfportwdf***"+username+"***wdfusernamewdf***"+password+"***wdfpasswordwdf***"+database+"***wdfdatabasewdf***";
1134
+
1135
+ if(fields.length) {
1136
+ for(i=0; i<fields.length; i++) {
1137
+ str+=fields[i]+'***wdfnamewdf***'+jQuery('#'+fields[i]).val()+'***wdfvaluewdf***'+jQuery('#ch_'+fields[i]+":checked" ).length+'***wdffieldwdf***';
1138
+ }
1139
+ }
1140
+
1141
+ for(i=1; i<cond_id; i++) {
1142
+ if(jQuery('#'+i).html()) {
1143
+ str+=jQuery('#sel_'+i).val()+'***sel***'+jQuery('#op_'+i).val()+'***op***'+jQuery('#val_'+i).val()+'***val***'+jQuery('#andor_'+i).val()+'***where***';
1144
+ }
1145
+ }
1146
+
1147
+ if(!jQuery('#query_txt').val()) {
1148
+ gen_query();
1149
+ }
1150
+
1151
+ jQuery('#details').val(str);
1152
+
1153
+ var datatxt = jQuery("#query_form").serialize()+'&form_id='+jQuery("#form_id").val();
1154
+ if(jQuery('#query_txt').val()) {
1155
+ jQuery('.c1').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
1156
+ jQuery.ajax({
1157
+ type: "POST",
1158
+ url: "<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $form_id, 'task' => 'save_query', 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>",
1159
+ data: datatxt,
1160
+ success: function(data) {
1161
+ window.parent.wd_fm_apply_options('apply_options');
1162
+ window.parent.tb_remove();
1163
+ }
1164
+ });
1165
+ }
1166
+ else {
1167
+ alert('The query is empty.');
1168
+ }
1169
+ return false;
1170
+ }
1171
+
1172
+ function gen_query() {
1173
+ if(jQuery('#query_txt').val()) {
1174
+ if(!confirm('Are you sure you want to replace the Query? All the modifications to the Query will be lost.')) {
1175
+ return;
1176
+ }
1177
+ }
1178
+ query="";
1179
+ fields=new Array(<?php
1180
+ $fields = "";
1181
+ if($table_struct) {
1182
+ foreach($table_struct as $col) {
1183
+ $fields.=' "'.str_replace("'", "SingleQuot", $col->Field).'",';
1184
+ }
1185
+ echo substr($fields, 0, -1);
1186
+ }
1187
+ ?>);
1188
+
1189
+ con_type =jQuery('input[name=con_type]:checked').val();
1190
+ con_method =jQuery('input[name=con_method]:checked').val();
1191
+ table =jQuery('#tables').val();
1192
+ fls='';
1193
+ vals='';
1194
+ valsA=new Array();
1195
+ flsA=new Array();
1196
+
1197
+ if(fields.length) {
1198
+ for(i=0; i<fields.length; i++) {
1199
+ if(jQuery('#ch_'+fields[i]+":checked" ).length) {
1200
+ flsA.push(fields[i]);
1201
+ valsA.push(jQuery('#'+fields[i]).val());
1202
+ }
1203
+ }
1204
+ }
1205
+
1206
+ if(con_method=="insert") {
1207
+ if(flsA.length) {
1208
+ for(i=0; i<flsA.length-1; i++) {
1209
+ fls+= '`'+flsA[i]+'`, ';
1210
+ vals+= '"'+valsA[i]+'", ';
1211
+ }
1212
+ fls+= '`'+flsA[i]+'`';
1213
+ vals+= '"'+valsA[i]+'"';
1214
+ }
1215
+ if(fls) {
1216
+ query="INSERT INTO "+jQuery('#tables').val()+" (" +fls+") VALUES ("+vals+")";
1217
+ }
1218
+ }
1219
+
1220
+ if(con_method=="update") {
1221
+ if(flsA.length) {
1222
+ for(i=0; i<flsA.length-1; i++) {
1223
+ vals+= '`'+flsA[i]+'`="'+valsA[i]+'", ';
1224
+ }
1225
+ vals+= '`'+flsA[i]+'`="'+valsA[i]+'"';
1226
+ }
1227
+ where="";
1228
+ previous='';
1229
+ for(i=1; i<cond_id; i++) {
1230
+ if(jQuery('#'+i).html()) {
1231
+ if(jQuery('#op_'+i).val()=="%..%")
1232
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'%"';
1233
+ else if(jQuery('#op_'+i).val()=="%..")
1234
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'"';
1235
+ else if(jQuery('#op_'+i).val()=="..%")
1236
+ op_val=' LIKE "'+jQuery('#val_'+i).val()+'%"';
1237
+ else
1238
+ op_val=' '+jQuery('#op_'+i).val()+' "'+jQuery('#val_'+i).val()+'"';
1239
+ where+=previous+' `'+jQuery('#sel_'+i).val()+'`'+op_val;
1240
+ previous=' '+ jQuery('#andor_'+i).val();
1241
+ }
1242
+ }
1243
+ if(vals) {
1244
+ query="UPDATE "+jQuery('#tables').val()+" SET " + vals+(where? ' WHERE'+where: '') ;
1245
+ }
1246
+ }
1247
+
1248
+ if(con_method=="delete") {
1249
+ where="";
1250
+ previous='';
1251
+ for(i=1; i<cond_id; i++) {
1252
+ if(jQuery('#'+i).html()) {
1253
+ if(jQuery('#op_'+i).val()=="%..%")
1254
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'%"';
1255
+ else if(jQuery('#op_'+i).val()=="%..")
1256
+ op_val=' LIKE "%'+jQuery('#val_'+i).val()+'"';
1257
+ else if(jQuery('#op_'+i).val()=="..%")
1258
+ op_val=' LIKE "'+jQuery('#val_'+i).val()+'%"';
1259
+ else
1260
+ op_val=' '+jQuery('#op_'+i).val()+' "'+jQuery('#val_'+i).val()+'"';
1261
+ where+=previous+' '+jQuery('#sel_'+i).val()+op_val;
1262
+ previous=' '+ jQuery('#andor_'+i).val();
1263
+ }
1264
+ }
1265
+ if(where) {
1266
+ query="DELETE FROM "+jQuery('#tables').val()+ ' WHERE'+where ;
1267
+ }
1268
+ }
1269
+ jQuery('#query_txt').val(query.replace("SingleQuot", "'"));
1270
+ }
1271
+
1272
+ jQuery(document).ready(function () {
1273
+ jQuery(".hasTip").tooltip({
1274
+ track: true,
1275
+ content: function () {
1276
+ return jQuery(this).prop('title');
1277
+ }
1278
+ });
1279
+ });
1280
+
1281
+ function insert_field(myValue) {
1282
+ if(!selected_field)
1283
+ return;
1284
+ myField=document.getElementById(selected_field);
1285
+ if (document.selection) {
1286
+ myField.focus();
1287
+ sel = document.selection.createRange();
1288
+ sel.text = myValue;
1289
+ }
1290
+ else {
1291
+ if (myField.selectionStart || myField.selectionStart == '0') {
1292
+ var startPos = myField.selectionStart;
1293
+ var endPos = myField.selectionEnd;
1294
+ myField.value = myField.value.substring(0, startPos)
1295
+ + "{"+myValue+"}"
1296
+ + myField.value.substring(endPos, myField.value.length);
1297
+ }
1298
+ else {
1299
+ myField.value += "{"+myValue+"}";
1300
+ }
1301
+ }
1302
+ }
1303
+ </script>
1304
+ <style>
1305
+ .cols div:nth-child(even) {background: #FFF;}
1306
+ .cols div:nth-child(odd) {background: #F5F5F5;}
1307
+ .cols div {
1308
+ height: 28px;
1309
+ padding: 5px;
1310
+ }
1311
+
1312
+ .cols {
1313
+ display: inline-block;
1314
+ }
1315
+
1316
+ .cols label {
1317
+ display: inline-block;
1318
+ width: 200px;
1319
+ font-size: 15px;
1320
+ overflow: hidden;
1321
+ white-space: nowrap;
1322
+ text-overflow: ellipsis;
1323
+ vertical-align: middle;
1324
+ }
1325
+
1326
+ .cols input[type="text"] {
1327
+ width: 295px;
1328
+ line-height: 18px;
1329
+ height: 28px;
1330
+ border: 1px solid #ccc;
1331
+ padding: 0 3px;
1332
+ margin-right: 2px;
1333
+ }
1334
+
1335
+ .cols input[type="text"]:disabled {
1336
+ cursor: not-allowed;
1337
+ background-color: #eee;
1338
+ }
1339
+
1340
+ .cols input[type="checkbox"] {
1341
+ width: 20px;
1342
+ line-height: 18px;
1343
+ height: 20px;
1344
+ vertical-align: middle;
1345
+ }
1346
+
1347
+ .cols select {
1348
+ line-height: 18px;
1349
+ height: 28px;
1350
+ margin-right: 2px;
1351
+ }
1352
+
1353
+ #fieldlist {
1354
+ position: absolute;
1355
+ width:225px;
1356
+ background: #fff;
1357
+ border: solid 1px #c7c7c7;
1358
+ top: 0;
1359
+ left: 0;
1360
+ z-index: 1000;
1361
+ }
1362
+
1363
+ #fieldlist a {
1364
+ padding: 5px;
1365
+ cursor:pointer;
1366
+ overflow: hidden;
1367
+ white-space: nowrap;
1368
+ text-overflow: ellipsis;
1369
+ }
1370
+
1371
+ #fieldlist a:hover {
1372
+ background: #ccc;
1373
+ }
1374
+ .gen_query, .gen_query:focus {
1375
+ width: 148px;
1376
+ height: 38px;
1377
+ background: #4EC0D9;
1378
+ color: white;
1379
+ cursor: pointer;
1380
+ border: 0px;
1381
+ font-size: 14px;
1382
+ font-weight: bold;
1383
+ margin: 20px 0;
1384
+ border-radius: 0px;
1385
+ }
1386
+ .gen_query:active {
1387
+ background: #ccc;
1388
+ }
1389
+
1390
+ .fm-query-save {
1391
+ float: right;
1392
+ font-size: 13px;
1393
+ margin: 0 20px;
1394
+ background: #4EC0D9;
1395
+ width: 83px;
1396
+ height: 34px;
1397
+ border: 1px solid #4EC0D9;
1398
+ border-radius: 0px;
1399
+ color: #fff;
1400
+ cursor: pointer;
1401
+ }
1402
+
1403
+ .select-db-op {
1404
+ display: inline-block;
1405
+ text-align: right;
1406
+ font-weight: bold;
1407
+ font-size: 18px;
1408
+ padding: 5px 0;
1409
+ margin: 5px 0;
1410
+ background:none !important;
1411
+ }
1412
+
1413
+ .select-db-op.where{
1414
+ width: 272px;
1415
+ }
1416
+
1417
+ .select-db-op img{
1418
+ float:left;
1419
+ }
1420
+ </style>
1421
+ <?php
1422
+ if($table_struct) { ?>
1423
+ <div class="cols">
1424
+ <?php
1425
+ if($con_method=='insert' or $con_method=='update') {
1426
+ echo '<div style="background: none;text-align: center;font-size: 20px;color: #000;font-weight: bold;"> SET </div>';
1427
+ foreach($table_struct as $col) {
1428
+ $title=' '.$col->Field;
1429
+ $title.="<ul style='padding-left: 17px;'>";
1430
+ $title.="<li>Type - ".$col->Type."</li>";
1431
+ $title.="<li>Null - ".$col->Null."</li>";
1432
+ $title.="<li>Key - ".$col->Key."</li>";
1433
+ $title.="<li>Default - ".$col->Default."</li>";
1434
+ $title.="<li>Extra - ".$col->Extra."</li>";
1435
+ $title.="</ul>";
1436
+ ?>
1437
+ <div><label title="<?php echo $title; ?>" class="hasTip"><b><?php echo $col->Field; ?></b><img src="<?php echo WD_FM_URL . '/images/info.png?ver='. WD_FM_VERSION.''; ?>" style="width:20px; vertical-align:middle;padding-left: 10px;" /></label><input type="text" id="<?php echo str_replace("'", "SingleQuot", $col->Field); ?>" disabled="disabled"/><input id="ch_<?php echo str_replace("'", "SingleQuot", $col->Field); ?>" type="checkbox" onClick="dis('<?php echo str_replace("'", "SingleQuot", $col->Field); ?>', this.checked)"/></div>
1438
+ <?php
1439
+ }
1440
+ }
1441
+ if($con_method=='delete' or $con_method=='update') {
1442
+ echo '<div class="select-db-op where"><img src="'.WD_FM_URL . '/images/add_condition.png?ver='. WD_FM_VERSION.'" title="ADD" class="add_cond"/>WHERE</div>';
1443
+ }
1444
+ ?>
1445
+ </div>
1446
+ <br/>
1447
+ <input type="button" value="Generate Query" class="gen_query" onclick="gen_query()">
1448
+ <br/>
1449
+ <form name="query_form" id="query_form" >
1450
+ <label style="vertical-align: top; width: 102px; display: inline-block;" for="query_txt" > Query: </label><textarea id="query_txt" name="query" rows=5 style="width:428px"></textarea>
1451
+ <input type="hidden" name="details" id="details">
1452
+ </form>
1453
+ <input type="button" value="Save" class="fm-query-save" onclick="save_query()">
1454
+ <div id="fieldlist" style="display: none;">
1455
+ <?php echo $form_fields ?>
1456
+ </div>
1457
+ <?php
1458
+ }
1459
+ die();
1460
+ }
1461
+
1462
+ ////////////////////////////////////////////////////////////////////////////////////////
1463
+ // Getters & Setters //
1464
+ ////////////////////////////////////////////////////////////////////////////////////////
1465
+ ////////////////////////////////////////////////////////////////////////////////////////
1466
+ // Private Methods //
1467
+ ////////////////////////////////////////////////////////////////////////////////////////
1468
+ ////////////////////////////////////////////////////////////////////////////////////////
1469
+ // Listeners //
1470
+ ////////////////////////////////////////////////////////////////////////////////////////
1471
  }
admin/views/FMViewFormmakerwindow.php CHANGED
@@ -1,292 +1,353 @@
1
- <?php
2
-
3
- class FMViewFormmakerwindow {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
-
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model) {
20
- $this->model = $model;
21
- }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- public function display() {
26
- $rows = $this->model->get_form_data();
27
- ?>
28
- <html xmlns="http://www.w3.org/1999/xhtml">
29
- <head>
30
- <title>Form Maker</title>
31
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
32
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
33
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
34
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
35
- <?php
36
- wp_print_scripts('jquery');
37
- ?>
38
- <base target="_self">
39
- </head>
40
- <body id="link" onLoad="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" dir="ltr" class="forceColors">
41
- <div class="tabs" role="tablist" tabindex="-1">
42
- <ul>
43
- <li id="display_tab" class="current" role="tab" tabindex="0">
44
- <span>
45
- <a href="javascript:mcTabs.displayTab('display_tab','display_panel');" onMouseDown="return false;" tabindex="-1">Form Maker</a>
46
- </span>
47
- </li>
48
- <li id="submissions_tab" class="" role="tab" tabindex="0">
49
- <span>
50
- <a href="javascript:mcTabs.displayTab('submissions_tab','submissions_panel');" onMouseDown="return false;" tabindex="-1">Submissions</a>
51
- </span>
52
- </li>
53
- </ul>
54
- </div>
55
- <style>
56
- .panel_wrapper {
57
- height: 220px !important;
58
- }
59
- .smaller_font {
60
- font-size: 12px !important;
61
- vertical-align: middle;
62
- text-align: left;
63
- }
64
- .smaller_font ul li {
65
- display: flex !important;
66
- }
67
- .smaller_font ul {
68
- margin: 0 !important;
69
- }
70
- </style>
71
- <div class="panel_wrapper" style="overflow: hidden;">
72
- <div id="display_panel" class="panel current">
73
- <table>
74
- <tr>
75
- <td style="vertical-align: middle; text-align: left;">Select a Form</td>
76
- <td style="vertical-align: middle; text-align: left;">
77
- <select name="form_maker_id" id="form_maker_id" style="width: 230px; text-align: left;">
78
- <option value="- Select Form -" selected="selected">- Select a Form -</option>
79
- <?php
80
- foreach ($rows as $row) {
81
- ?>
82
- <option value="<?php echo $row->id; ?>"><?php echo $row->title; ?></option>
83
- <?php
84
- }
85
- ?>
86
- </select>
87
- </td>
88
- </tr>
89
- </table>
90
- </div>
91
- <div id="submissions_panel" class="panel">
92
- <div class="error" style="position: relative; padding: 5px; font-size: 20px; color: red; opacity: 1; font-weight: bolder;">Front end submissions are disabled in free version.</div>
93
- <div style="position: absolute; background: gray; width: 92%; height: 65%; opacity: 0.3;"></div>
94
- <table>
95
- <tr>
96
- <td class="smaller_font">Select a Form:</td>
97
- <td class="smaller_font">
98
- <select name="submissions_id" id="submissions_id" style="width: 230px; text-align: left;">
99
- <option value="- Select Form -" selected="selected">- Select a Form -</option>
100
- <?php
101
- foreach ($rows as $row) {
102
- ?>
103
- <option value="<?php echo $row->id; ?>"><?php echo $row->title; ?></option>
104
- <?php
105
- }
106
- ?>
107
- </select>
108
- </td>
109
- </tr>
110
- <tr>
111
- <td class="smaller_font">Select Date Range:</td>
112
- <td class="smaller_font">
113
- <!--<label style="min-width:30px !important;">From:</label>-->
114
- <input class="inputbox" type="text" name="startdate" id="startdate" size="10" maxlength="10" value="" />
115
- <input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('startdate','%Y-%m-%d');" />
116
- <label style="min-width:30px !important;">To:</label>
117
- <input class="inputbox" type="text" name="enddate" id="enddate" size="10" maxlength="10" value="" />
118
- <input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('enddate','%Y-%m-%d');" />
119
- </td>
120
- </tr>
121
- <tr>
122
- <td colspan="2">
123
- <table>
124
- <tr>
125
- <td style="border-right: 1px solid black;">
126
- <table>
127
- <tr>
128
- <td class="smaller_font" style="vertical-align: top;">Select fields:</td>
129
- <td class="smaller_font">
130
- <ul>
131
- <li>
132
- <input type="checkbox" checked="checked" id="submit_date" name="submit_date" value="submit_date">
133
- <label for="submit_date">Submit Date</label>
134
- </li>
135
- <li>
136
- <input type="checkbox" checked="checked" id="submitter_ip" name="submitter_ip" value="submitter_ip">
137
- <label for="submitter_ip">Submitter's IP Address</label>
138
- </li>
139
- <li>
140
- <input type="checkbox" checked="checked" id="username" name="username" value="username">
141
- <label for="username">Submitter's Username</label>
142
- </li>
143
- <li>
144
- <input type="checkbox" checked="checked" id="useremail" name="useremail" value="useremail">
145
- <label for="useremail">Submitter's Email Address</label>
146
- </li>
147
- <li>
148
- <input type="checkbox" checked="checked" id="form_fields" name="form_fields" value="form_fields">
149
- <label for="form_fields">Form Fields</label>
150
- </li>
151
- <li><label style="font-size: 10px; width: 160px;">You can hide specific form fields from Form General Options.</label></li>
152
- </ul>
153
- </td>
154
- </tr>
155
- <tr>
156
- <td class="smaller_font" style="vertical-align: top;">Export to:</td>
157
- <td class="smaller_font">
158
- <ul>
159
- <li>
160
- <input type="checkbox" checked="checked" id="csv" name="csv" value="csv">
161
- <label for="csv">CSV</label>
162
- </li>
163
- <li>
164
- <input type="checkbox" checked="checked" id="xml" name="xml" value="xml">
165
- <label for="xml">XML</label>
166
- </li>
167
- </ul>
168
- </td>
169
- </tr>
170
- </table>
171
- </td>
172
- <td style="vertical-align: top;">
173
- <table>
174
- <tr>
175
- <td class="smaller_font" style="vertical-align: top;">Show:</td>
176
- <td class="smaller_font">
177
- <ul>
178
- <li>
179
- <input type="checkbox" checked="checked" id="title" name="title" value="title">
180
- <label for="title">Title</label>
181
- </li>
182
- <li>
183
- <input type="checkbox" checked="checked" id="search" name="search" value="search">
184
- <label for="search">Search</label>
185
- </li>
186
- <li>
187
- <input type="checkbox" checked="checked" id="ordering" name="ordering" value="ordering">
188
- <label for="ordering">Ordering</label>
189
- </li>
190
- <li>
191
- <input type="checkbox" checked="checked" id="entries" name="entries" value="entries">
192
- <label for="entries">Entries</label>
193
- </li>
194
- <li>
195
- <input type="checkbox" checked="checked" id="views" name="views" value="views">
196
- <label for="views">Views</label>
197
- </li>
198
- <li>
199
- <input type="checkbox" checked="checked" id="conversion_rate" name="conversion_rate" value="conversion_rate">
200
- <label for="conversion_rate">Conversion Rate</label>
201
- </li>
202
- <li>
203
- <input type="checkbox" checked="checked" id="pagination" name="pagination" value="pagination">
204
- <label for="pagination">Pagination</label>
205
- </li>
206
- <li>
207
- <input type="checkbox" checked="checked" id="stats" name="stats" value="stats">
208
- <label for="stats">Statistics</label>
209
- </li>
210
- </ul>
211
- </td>
212
- </tr>
213
- </table>
214
- </td>
215
- </tr>
216
- </table>
217
- </td>
218
- </tr>
219
- </table>
220
- </div>
221
- </div>
222
- <div class="mceActionPanel">
223
- <div style="float: left;">
224
- <input type="button" id="cancel" name="cancel" value="Cancel" onClick="tinyMCEPopup.close();"/>
225
- </div>
226
- <div style="float: right;">
227
- <input type="submit" id="insert" name="insert" value="Insert" onClick="form_maker_insert_shortcode();"/>
228
- </div>
229
- </div>
230
- <script type="text/javascript">
231
- var short_code = get_params("Form");
232
- if (short_code) {
233
- if (!short_code['type']) {
234
- document.getElementById("form_maker_id").value = short_code['id'];
235
- }
236
- }
237
- // Get shortcodes attributes.
238
- function get_params(module_name) {
239
- var selected_text = tinyMCE.activeEditor.selection.getContent();
240
- var module_start_index = selected_text.indexOf("[" + module_name);
241
- var module_end_index = selected_text.indexOf("]", module_start_index);
242
- var module_str = "";
243
- if ((module_start_index == 0) && (module_end_index > 0)) {
244
- module_str = selected_text.substring(module_start_index + 1, module_end_index);
245
- }
246
- else {
247
- return false;
248
- }
249
- var params_str = module_str.substring(module_str.indexOf(" ") + 1);
250
- var key_values = params_str.split(" ");
251
- var short_code_attr = new Array();
252
- for (var key in key_values) {
253
- var short_code_index = key_values[key].split('=')[0];
254
- var short_code_value = key_values[key].split('=')[1];
255
- short_code_value = short_code_value.substring(1, short_code_value.length - 1);
256
- short_code_attr[short_code_index] = short_code_value;
257
- }
258
- return short_code_attr;
259
- }
260
- function form_maker_insert_shortcode() {
261
- if (document.getElementById('display_panel').className !== 'panel') {
262
- if (document.getElementById('form_maker_id').value == '- Select Form -') {
263
- tinyMCEPopup.close();
264
- }
265
- else {
266
- var tagtext;
267
- tagtext = '[Form id="' + document.getElementById('form_maker_id').value + '"]';
268
- window.tinyMCE.execCommand('mceInsertContent', false, tagtext);
269
- tinyMCEPopup.close();
270
- }
271
- }
272
- else {
273
- alert("Front end submissions are disabled in free version.");
274
- }
275
- }
276
- </script>
277
- </body>
278
- </html>
279
- <?php
280
- die();
281
- }
282
-
283
- ////////////////////////////////////////////////////////////////////////////////////////
284
- // Getters & Setters //
285
- ////////////////////////////////////////////////////////////////////////////////////////
286
- ////////////////////////////////////////////////////////////////////////////////////////
287
- // Private Methods //
288
- ////////////////////////////////////////////////////////////////////////////////////////
289
- ////////////////////////////////////////////////////////////////////////////////////////
290
- // Listeners //
291
- ////////////////////////////////////////////////////////////////////////////////////////
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  }
1
+ <?php
2
+
3
+ class FMViewFormmakerwindow {
4
+ ////////////////////////////////////////////////////////////////////////////////////////
5
+ // Events //
6
+ ////////////////////////////////////////////////////////////////////////////////////////
7
+ ////////////////////////////////////////////////////////////////////////////////////////
8
+ // Constants //
9
+ ////////////////////////////////////////////////////////////////////////////////////////
10
+ ////////////////////////////////////////////////////////////////////////////////////////
11
+ // Variables //
12
+ ////////////////////////////////////////////////////////////////////////////////////////
13
+ private $model;
14
+
15
+
16
+ ////////////////////////////////////////////////////////////////////////////////////////
17
+ // Constructor & Destructor //
18
+ ////////////////////////////////////////////////////////////////////////////////////////
19
+ public function __construct($model) {
20
+ $this->model = $model;
21
+ }
22
+ ////////////////////////////////////////////////////////////////////////////////////////
23
+ // Public Methods //
24
+ ////////////////////////////////////////////////////////////////////////////////////////
25
+ public function display() {
26
+ $rows = $this->model->get_form_data();
27
+ ?>
28
+ <html xmlns="http://www.w3.org/1999/xhtml">
29
+ <head>
30
+ <title>Form Maker</title>
31
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
32
+ <?php
33
+ wp_print_scripts('jquery');
34
+ wp_print_scripts('jquery-ui-tabs');
35
+ ?>
36
+ <link rel="stylesheet" href="<?php echo WD_FM_URL; ?>/css/jquery-ui-1.12.1.css">
37
+ <style>
38
+ #WD-FormMaker {
39
+ margin-top: 0;
40
+ outline:none;
41
+ }
42
+ #WD-FormMaker #tabs {
43
+ display:none;
44
+ min-height: 335px;
45
+ }
46
+ #WD-FormMaker #tab-Submissions ul {
47
+ list-style-type: none;
48
+ }
49
+ #WD-FormMaker .ui-widget-header {
50
+ border-bottom: 1px solid #dddddd;
51
+ background: transparent;
52
+ font-size: 12px;
53
+ }
54
+ #WD-FormMaker .ui-tabs .ui-tabs-panel {
55
+ font-size: 12px;
56
+ border: 1px solid #c5c5c5;
57
+ border-top:none;
58
+ margin-left: 3px;
59
+ margin-right: 2px;
60
+ height: 280px;
61
+ }
62
+ #WD-FormMaker .ui-widget-header {
63
+ border-style: none;
64
+ border-bottom: 1px solid #dddddd;
65
+ background: transparent;
66
+ }
67
+
68
+ #WD-FormMaker .ui-widget.ui-widget-content {
69
+ border-style: none;
70
+ }
71
+
72
+ #WD-FormMaker .ui-state-active,
73
+ #WD-FormMaker .ui-widget-content
74
+ #WD-FormMaker .ui-state-active,
75
+ #WD-FormMaker .ui-widget-header
76
+ #WD-FormMaker .ui-state-active{
77
+ border: 1px solid #c5c5c5;
78
+ border-bottom: none;
79
+ background: #f6f6f6;
80
+ outline:none
81
+ }
82
+
83
+ #WD-FormMaker .mceActionPanel #insert {
84
+ float: right;
85
+ outline:none;
86
+ display: inline-block;
87
+ text-decoration: none;
88
+ font-size: 13px;
89
+ line-height: 26px;
90
+ height: 28px;
91
+ margin: 5px 5px 0 0;
92
+ padding: 0 10px 1px;
93
+ cursor: pointer;
94
+ border-width: 1px;
95
+ border-style: solid;
96
+ -webkit-appearance: none;
97
+ -webkit-border-radius: 3px;
98
+ -webkit-box-sizing: border-box;
99
+ -webkit-box-shadow: 0 1px 0 #ccc;
100
+ box-shadow: 0 1px 0 #ccc;
101
+ border-radius: 3px;
102
+ white-space: nowrap;
103
+ -moz-box-sizing: border-box;
104
+ box-sizing: border-box;
105
+ background: #0085ba;
106
+ border-color: #0073aa #006799 #006799;
107
+ -webkit-box-shadow: 0 1px 0 #006799;
108
+ box-shadow: 0 1px 0 #006799;
109
+ color: #fff;
110
+ text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
111
+ }
112
+ #WD-FormMaker .ui-state-active a,
113
+ #WD-FormMaker .ui-state-active a:link,
114
+ #WD-FormMaker .ui-state-active a:visited {
115
+ background: #ffffff;
116
+ color: #000000;
117
+ outline:none
118
+ }
119
+ #WD-FormMaker table {
120
+ font-size:12px;
121
+ }
122
+ </style>
123
+ <base target="_self">
124
+ </head>
125
+ <body id="WD-FormMaker">
126
+ <div id="tabs">
127
+ <ul>
128
+ <li><a href="#tab-FormMaker">Form Maker</a></li>
129
+ <li><a href="#tab-Submissions">Submissions</a></li>
130
+ </ul>
131
+ <div id="tab-FormMaker" class="panel">
132
+ <table>
133
+ <tr>
134
+ <td style="vertical-align: middle; text-align: left;">Select a Form</td>
135
+ <td style="vertical-align: middle; text-align: left;">
136
+ <select name="form_maker_id" id="form_maker_id" style="width: 230px; text-align: left;">
137
+ <option value="0" selected="selected">- Select a Form -</option>
138
+ <?php
139
+ foreach ($rows as $row) {
140
+ ?>
141
+ <option value="<?php echo $row->id; ?>"><?php echo $row->title; ?></option>
142
+ <?php
143
+ }
144
+ ?>
145
+ </select>
146
+ </td>
147
+ </tr>
148
+ </table>
149
+ </div>
150
+ <div id="tab-Submissions">
151
+ <div class="error" style="position: relative; padding:0 5px 10px 5px; font-size: 15px; color: red; opacity: 1; font-weight: bolder;">Front end submissions are disabled in free version.</div>
152
+ <div style="position: absolute; background: gray; width: 93%; height: 75%; opacity: 0.3;"></div>
153
+ <table>
154
+ <tr>
155
+ <td class="smaller_font">Select a Form:</td>
156
+ <td class="smaller_font">
157
+ <select name="submissions_id" id="submissions_id" style="width: 230px; text-align: left;">
158
+ <option value="- Select Form -" selected="selected">- Select a Form -</option>
159
+ <?php
160
+ foreach ($rows as $row) {
161
+ ?>
162
+ <option value="<?php echo $row->id; ?>"><?php echo $row->title; ?></option>
163
+ <?php
164
+ }
165
+ ?>
166
+ </select>
167
+ </td>
168
+ </tr>
169
+ <tr>
170
+ <td class="smaller_font">Select Date Range:</td>
171
+ <td class="smaller_font">
172
+ <!--<label style="min-width:30px !important;">From:</label>-->
173
+ <input class="inputbox" type="text" name="startdate" id="startdate" size="10" maxlength="10" value="" />
174
+ <input type="reset" style="width: 22px;" class="button" value="..." onclick="return showCalendar('startdate','%Y-%m-%d');" />
175
+ <label style="min-width:30px !important;">To:</label>
176
+ <input class="inputbox" type="text" name="enddate" id="enddate" size="10" maxlength="10" value="" />
177
+ <input type="reset" style="width: 22px;" class="button" value="..." onclick="return showCalendar('enddate','%Y-%m-%d');" />
178
+ </td>
179
+ </tr>
180
+ <tr>
181
+ <td colspan="2">
182
+ <table width="100%">
183
+ <tr>
184
+ <td style="border-right: 1px solid black;">
185
+ <table>
186
+ <tr>
187
+ <td class="smaller_font" style="vertical-align: top;">Select fields:</td>
188
+ <td class="smaller_font">
189
+ <ul>
190
+ <li>
191
+ <input type="checkbox" checked="checked" id="submit_date" name="submit_date" value="submit_date">
192
+ <label for="submit_date">Submit Date</label>
193
+ </li>
194
+ <li>
195
+ <input type="checkbox" checked="checked" id="submitter_ip" name="submitter_ip" value="submitter_ip">
196
+ <label for="submitter_ip">Submitter's IP Address</label>
197
+ </li>
198
+ <li>
199
+ <input type="checkbox" checked="checked" id="username" name="username" value="username">
200
+ <label for="username">Submitter's Username</label>
201
+ </li>
202
+ <li>
203
+ <input type="checkbox" checked="checked" id="useremail" name="useremail" value="useremail">
204
+ <label for="useremail">Submitter's Email Address</label>
205
+ </li>
206
+ <li>
207
+ <input type="checkbox" checked="checked" id="form_fields" name="form_fields" value="form_fields">
208
+ <label for="form_fields">Form Fields</label>
209
+ </li>
210
+ <li><label style="font-size: 10px; width: 160px;">You can hide specific form fields from Form General Options.</label></li>
211
+ </ul>
212
+ </td>
213
+ </tr>
214
+ <tr>
215
+ <td class="smaller_font" style="vertical-align: top;">Export to:</td>
216
+ <td class="smaller_font">
217
+ <ul>
218
+ <li>
219
+ <input type="checkbox" checked="checked" id="csv" name="csv" value="csv">
220
+ <label for="csv">CSV</label>
221
+ </li>
222
+ <li>
223
+ <input type="checkbox" checked="checked" id="xml" name="xml" value="xml">
224
+ <label for="xml">XML</label>
225
+ </li>
226
+ </ul>
227
+ </td>
228
+ </tr>
229
+ </table>
230
+ </td>
231
+ <td style="vertical-align: top;">
232
+ <table>
233
+ <tr>
234
+ <td class="smaller_font" style="vertical-align: top;">Show:</td>
235
+ <td class="smaller_font" style="width:240px;">
236
+ <ul>
237
+ <li>
238
+ <input type="checkbox" checked="checked" id="title" name="title" value="title">
239
+ <label for="title">Title</label>
240
+ </li>
241
+ <li>
242
+ <input type="checkbox" checked="checked" id="search" name="search" value="search">
243
+ <label for="search">Search</label>
244
+ </li>
245
+ <li>
246
+ <input type="checkbox" checked="checked" id="ordering" name="ordering" value="ordering">
247
+ <label for="ordering">Ordering</label>
248
+ </li>
249
+ <li>
250
+ <input type="checkbox" checked="checked" id="entries" name="entries" value="entries">
251
+ <label for="entries">Entries</label>
252
+ </li>
253
+ <li>
254
+ <input type="checkbox" checked="checked" id="views" name="views" value="views">
255
+ <label for="views">Views</label>
256
+ </li>
257
+ <li>
258
+ <input type="checkbox" checked="checked" id="conversion_rate" name="conversion_rate" value="conversion_rate">
259
+ <label for="conversion_rate">Conversion Rate</label>
260
+ </li>
261
+ <li>
262
+ <input type="checkbox" checked="checked" id="pagination" name="pagination" value="pagination">
263
+ <label for="pagination">Pagination</label>
264
+ </li>
265
+ <li>
266
+ <input type="checkbox" checked="checked" id="stats" name="stats" value="stats">
267
+ <label for="stats">Statistics</label>
268
+ </li>
269
+ </ul>
270
+ </td>
271
+ </tr>
272
+ </table>
273
+ </td>
274
+ </tr>
275
+ </table>
276
+ </td>
277
+ </tr>
278
+ </table>
279
+ </div>
280
+ </div>
281
+ <div class="mceActionPanel">
282
+ <input type="submit" id="insert" name="insert" value="Insert" onClick="form_maker_insert_shortcode();"/>
283
+ </div>
284
+ <script type="text/javascript">
285
+ jQuery.noConflict();
286
+ jQuery(document).ready(function() {
287
+ jQuery("#tabs").tabs();
288
+ jQuery('#WD-FormMaker #tabs').show();
289
+ });
290
+
291
+ var short_code = get_params("Form");
292
+ if (short_code) {
293
+ if (!short_code['type']) {
294
+ document.getElementById("form_maker_id").value = short_code['id'];
295
+ }
296
+ }
297
+ // Get shortcodes attributes.
298
+ function get_params(module_name) {
299
+ var selected_text = top.tinyMCE.activeEditor.selection.getContent();
300
+ var module_start_index = selected_text.indexOf("[" + module_name);
301
+ var module_end_index = selected_text.indexOf("]", module_start_index);
302
+ var module_str = "";
303
+ if ((module_start_index == 0) && (module_end_index > 0)) {
304
+ module_str = selected_text.substring(module_start_index + 1, module_end_index);
305
+ }
306
+ else {
307
+ return false;
308
+ }
309
+ var params_str = module_str.substring(module_str.indexOf(" ") + 1);
310
+ var key_values = params_str.split(" ");
311
+ var short_code_attr = new Array();
312
+ for (var key in key_values) {
313
+ var short_code_index = key_values[key].split('=')[0];
314
+ var short_code_value = key_values[key].split('=')[1];
315
+ short_code_value = short_code_value.substring(1, short_code_value.length - 1);
316
+ short_code_attr[short_code_index] = short_code_value;
317
+ }
318
+ return short_code_attr;
319
+ }
320
+
321
+ function form_maker_insert_shortcode() {
322
+ if (jQuery('#tabs .ui-tabs-panel[aria-hidden=false]').attr('id') == 'tab-FormMaker') {
323
+ if (document.getElementById('form_maker_id').value == '0') {
324
+ top.tinyMCE.activeEditor.windowManager.close(window);
325
+ }
326
+ else {
327
+ var tagtext;
328
+ tagtext = '[Form id="' + document.getElementById('form_maker_id').value + '"]';
329
+ top.tinyMCE.execCommand('mceInsertContent', false, tagtext);
330
+ top.tinyMCE.activeEditor.windowManager.close(window);
331
+ }
332
+ }
333
+ else {
334
+ alert("Front end submissions are disabled in free version.");
335
+ }
336
+ }
337
+ </script>
338
+ </body>
339
+ </html>
340
+ <?php
341
+ die();
342
+ }
343
+
344
+ ////////////////////////////////////////////////////////////////////////////////////////
345
+ // Getters & Setters //
346
+ ////////////////////////////////////////////////////////////////////////////////////////
347
+ ////////////////////////////////////////////////////////////////////////////////////////
348
+ // Private Methods //
349
+ ////////////////////////////////////////////////////////////////////////////////////////
350
+ ////////////////////////////////////////////////////////////////////////////////////////
351
+ // Listeners //
352
+ ////////////////////////////////////////////////////////////////////////////////////////
353
  }
admin/views/FMViewManage_fm.php CHANGED
@@ -1,3508 +1,3507 @@
1
- <?php
2
-
3
- class FMViewManage_fm {
4
-
5
- private $model;
6
-
7
- public function __construct($model) {
8
- $this->model = $model;
9
- }
10
-
11
- public function display() {
12
- $rows_data = $this->model->get_rows_data();
13
- $page_nav = $this->model->page_nav();
14
- $search_value = ((isset($_POST['search_value'])) ? esc_html($_POST['search_value']) : '');
15
- $search_select_value = ((isset($_POST['search_select_value'])) ? (int) $_POST['search_select_value'] : 0);
16
- $asc_or_desc = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'desc') ? 'desc' : 'asc');
17
- $order_by_array = array('id', 'title', 'mail');
18
- $order_by = isset($_POST['order_by']) && in_array(esc_html(stripslashes($_POST['order_by'])), $order_by_array) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
19
- $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
20
- $ids_string = '';
21
- ?>
22
- <form onkeypress="fm_doNothing(event)" class="wrap" id="manage_form" method="post" action="admin.php?page=manage_fm">
23
- <?php wp_nonce_field('nonce_fm', 'nonce_fm'); ?>
24
- <div class="fm-page-banner">
25
- <div class="fm-logo">
26
- </div>
27
- <div class="fm-logo-title">Form</br>Maker</div>
28
- <button class="fm-button add-button medium" onclick="fm_set_input_value('task', 'add'); fm_form_submit(event, 'manage_form')">
29
- <span></span>
30
- Add New
31
- </button>
32
- <div class="fm-page-actions">
33
- <button class="fm-button delete-button medium" onclick="if (confirm('Do you want to delete selected items?')) { fm_set_input_value('task', 'delete_all'); fm_form_submit(event, 'manage_form'); } else { return false; }">
34
- <span></span>
35
- Delete
36
- </button>
37
- </div>
38
- </div>
39
- <div class="tablenav top">
40
- <?php
41
- WDW_FM_Library::search('Title', $search_value, 'manage_form');
42
- WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'manage_form');
43
- ?>
44
- </div>
45
- <table class="wp-list-table widefat fixed pages">
46
- <thead>
47
- <th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin:0;"/></th>
48
- <th class="table_small_col <?php if ($order_by == 'id') { echo $order_class; } ?>">
49
- <a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'id'); fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'id' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>'); fm_form_submit(event, 'manage_form')" href="">
50
- <span>ID</span><span class="sorting-indicator"></span></a>
51
- </th>
52
- <th class="<?php if ($order_by == 'title') { echo $order_class; } ?>">
53
- <a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'title'); fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'title' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>'); fm_form_submit(event, 'manage_form')" href="">
54
- <span>Title</span><span class="sorting-indicator"></span></a>
55
- </th>
56
- <th class="<?php if ($order_by == 'type') { echo $order_class; } ?>">
57
- <a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'type'); fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'type' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>'); fm_form_submit(event, 'manage_form')" href="">
58
- <span>Type</span><span class="sorting-indicator"></span></a>
59
- </th>
60
- <th class="<?php if ($order_by == 'mail') { echo $order_class; } ?>">
61
- <a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'mail'); fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'mail' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>'); fm_form_submit(event, 'manage_form')" href="">
62
- <span>Email to send submissions to</span><span class="sorting-indicator"></span></a>
63
- </th>
64
- <th class="table_large_col">Shortcode</th>
65
- <th class="table_large_col">PHP function</th>
66
- <th class="table_small_col">Edit</th>
67
- <th class="table_small_col">Delete</th>
68
- </thead>
69
- <tbody id="tbody_arr">
70
- <?php
71
- if ($rows_data) {
72
- foreach ($rows_data as $row_data) {
73
- $alternate = (!isset($alternate) || $alternate == '') ? 'class="alternate"' : '';
74
- $old = isset($row_data->form) && ($row_data->form != '');
75
- ?>
76
- <tr id="tr_<?php echo $row_data->id; ?>" <?php echo $alternate; ?>>
77
- <td class="table_small_col check-column">
78
- <input id="check_<?php echo $row_data->id; ?>" name="check_<?php echo $row_data->id; ?>" type="checkbox"/>
79
- </td>
80
- <td class="table_small_col"><?php echo $row_data->id; ?></td>
81
- <td>
82
- <?php
83
- if (!$old) {
84
- ?>
85
- <a onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id', '<?php echo $row_data->id; ?>'); fm_form_submit(event, 'manage_form')" href="" title="Edit"><?php echo $row_data->title; ?></a>
86
- <?php
87
- }
88
- else {
89
- echo $row_data->title;
90
- }
91
- ?>
92
- </td>
93
- <td>
94
- <?php echo $row_data->type; ?>
95
- </td>
96
- <td><?php echo $row_data->mail; ?></td>
97
- <td class="table_big_col" style="padding-left: 0; padding-right: 0;">
98
- <?php if($row_data->type == 'embedded'){ ?>
99
- <input type="text" value='[Form id="<?php echo $row_data->id; ?>"]' onclick="fm_select_value(this)" size="12" readonly="readonly" style="padding-left: 1px; padding-right: 1px;"/>
100
- <?php } else { ?>
101
- <a href="<?php echo add_query_arg(array('current_id' => $row_data->id, 'nonce_fm' => wp_create_nonce('nonce_fm')), admin_url('admin.php?page=manage_fm&task=display_options')); ?>">Set Display Options</a>
102
- <?php } ?>
103
- </td>
104
- <td class="table_large_col" style="padding-left: 0; padding-right: 0;">
105
- <input type="text" value='&#60;?php wd_form_maker(<?php echo $row_data->id; ?>, "<?php echo $row_data->type; ?>"); ?&#62;' onclick="fm_select_value(this)" readonly="readonly" style="padding-left: 1px; padding-right: 1px;"/>
106
- </td>
107
- <td class="table_small_col">
108
- <?php
109
- if (!$old) {
110
- ?>
111
- <button class="fm-icon edit-icon" onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id', '<?php echo $row_data->id; ?>'); fm_form_submit(event, 'manage_form')">
112
- <span></span>
113
- </button>
114
- <?php
115
- }
116
- ?>
117
- </td>
118
- <td class="table_small_col">
119
- <button class="fm-icon delete-icon" onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete'); fm_set_input_value('current_id', '<?php echo $row_data->id; ?>'); fm_form_submit(event, 'manage_form'); } else { return false; }">
120
- <span></span>
121
- </button>
122
- </td>
123
- </tr>
124
- <?php
125
- $ids_string .= $row_data->id . ',';
126
- }
127
- }
128
- ?>
129
- </tbody>
130
- </table>
131
- <input id="task" name="task" type="hidden" value=""/>
132
- <input id="current_id" name="current_id" type="hidden" value=""/>
133
- <input id="ids_string" name="ids_string" type="hidden" value="<?php echo $ids_string; ?>"/>
134
- <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="asc"/>
135
- <input id="order_by" name="order_by" type="hidden" value="<?php echo $order_by; ?>"/>
136
- </form>
137
- <?php
138
- }
139
-
140
- public function edit($id) {
141
- ?>
142
- <img src="<?php echo WD_FM_URL . '/images/icons.png'; ?>" style="display:none;"/>
143
- <?php
144
- $row = $this->model->get_row_data_new($id);
145
- $themes = $this->model->get_theme_rows_data();
146
- global $wpdb;
147
- $default_theme = $wpdb->get_var('SELECT id FROM ' . $wpdb->prefix . 'formmaker_themes where `default`=1');
148
- $labels = array();
149
- $label_id = array();
150
- $label_order_original = array();
151
- $label_type = array();
152
- $label_all = explode('#****#', $row->label_order);
153
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
154
- foreach ($label_all as $key => $label_each) {
155
- $label_id_each = explode('#**id**#', $label_each);
156
- array_push($label_id, $label_id_each[0]);
157
- $label_oder_each = explode('#**label**#', $label_id_each[1]);
158
- array_push($label_order_original, addslashes($label_oder_each[0]));
159
- array_push($label_type, $label_oder_each[1]);
160
- }
161
- $labels['id'] = '"' . implode('","', $label_id) . '"';
162
- $labels['label'] = '"' . implode('","', $label_order_original) . '"';
163
- $labels['type'] = '"' . implode('","', $label_type) . '"';
164
- $page_title = (($id != 0) ? 'Edit form ' . $row->title : 'Create new form');
165
- $is_addon_stripe_active = (defined('WD_FM_STRIPE') && is_plugin_active(constant('WD_FM_STRIPE')));
166
- if ($is_addon_stripe_active) {
167
- require_once (WD_FM_STRIPE_DIR . '/controller.php');
168
- }
169
- ?>
170
- <script type="text/javascript">
171
- var plugin_url = "<?php echo WD_FM_URL; ?>";
172
- </script>
173
- <script src="<?php echo WD_FM_URL . '/js/formmaker_div.js'; ?>?ver=<?php echo WD_FM_VERSION; ?>" type="text/javascript"></script>
174
- <script type="text/javascript">
175
- is_addon_calculator_active = <?php echo (defined('WD_FM_CALCULATOR') && is_plugin_active(constant('WD_FM_CALCULATOR'))) ? 1 : 0; ?>;
176
- is_addon_stripe_active = <?php echo $is_addon_stripe_active ? 1 : 0; ?>;
177
- is_stripe_enabled = <?php echo ($is_addon_stripe_active && (int) WD_FM_STRIPE_controller::stripe_enable($row->id) ? 1 : 0); ?>;
178
- form_view = 1;
179
- form_view_count = 1;
180
- form_view_max = 1;
181
- function submitbutton() {
182
- <?php if ($id) { ?>
183
- if (!document.getElementById('araqel') || (document.getElementById('araqel').value == '0')) {
184
- alert('Please wait while page loading.');
185
- return false;
186
- }
187
- <?php } ?>
188
- tox = '';
189
- form_fields = '';
190
- document.getElementById('take').style.display = "none";
191
- document.getElementById('page_bar').style.display = "none";
192
- jQuery('#saving').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
193
- jQuery('.wdform_section').each(function() {
194
- var this2 = this;
195
- jQuery(this2).find('.wdform_column').each(function() {
196
- if(!jQuery(this).html() && jQuery(this2).children().length>1)
197
- jQuery(this).remove();
198
- });
199
- });
200
- remove_whitespace(document.getElementById('take'));
201
- l_id_array = [<?php echo $labels['id']?>];
202
- l_label_array = [<?php echo $labels['label']?>];
203
- l_type_array = [<?php echo $labels['type']?>];
204
- l_id_removed = [];
205
- for (x = 0; x < l_id_array.length; x++) {
206
- l_id_removed[l_id_array[x]] = true;
207
- }
208
- for (t = 1; t <= form_view_max; t++) {
209
- if (document.getElementById('form_id_tempform_view' + t)) {
210
- wdform_page = document.getElementById('form_id_tempform_view' + t);
211
- remove_whitespace(wdform_page);
212
- n = wdform_page.childNodes.length - 2;
213
- for (q = 0; q <= n; q++) {
214
- if (!wdform_page.childNodes[q].getAttribute("wdid")) {
215
- wdform_section = wdform_page.childNodes[q];
216
- for (x = 0; x < wdform_section.childNodes.length; x++) {
217
- wdform_column = wdform_section.childNodes[x];
218
- if (wdform_column.firstChild) {
219
- for (y=0; y < wdform_column.childNodes.length; y++) {
220
- is_in_old = false;
221
- wdform_row = wdform_column.childNodes[y];
222
- if (wdform_row.nodeType == 3) {
223
- continue;
224
- }
225
- wdid = wdform_row.getAttribute("wdid");
226
- if (!wdid) {
227
- continue;
228
- }
229
- l_id = wdid;
230
- l_label = document.getElementById(wdid + '_element_labelform_id_temp').innerHTML;
231
- l_label = l_label.replace(/(\r\n|\n|\r)/gm," ");
232
- wdtype = wdform_row.firstChild.getAttribute('type');
233
-
234
- for (var z = 0; z < l_id_array.length; z++) {
235
- if (l_type_array[z] == "type_address") {
236
- if (document.getElementById(l_id + "_mini_label_street1") || document.getElementById(l_id + "_mini_label_street2") || document.getElementById(l_id + "_mini_label_city") || document.getElementById(l_id + "_mini_label_state") || document.getElementById(l_id+"_mini_label_postal") || document.getElementById(l_id+"_mini_label_country")) {
237
- l_id_removed[l_id_array[z]] = false;
238
- }
239
- }
240
- else {
241
- if (l_id_array[z] == wdid) {
242
- l_id_removed[l_id] = false;
243
- }
244
- }
245
-
246
- }
247
-
248
- if (wdtype == "type_address") {
249
- addr_id = parseInt(wdid);
250
- id_for_country = addr_id;
251
- if (document.getElementById(id_for_country + "_mini_label_street1"))
252
- tox = tox + addr_id + '#**id**#' + document.getElementById(id_for_country + "_mini_label_street1").innerHTML + '#**label**#type_address#****#';
253
- addr_id++;
254
- if (document.getElementById(id_for_country + "_mini_label_street2"))
255
- tox = tox + addr_id + '#**id**#' + document.getElementById(id_for_country + "_mini_label_street2").innerHTML + '#**label**#type_address#****#';
256
- addr_id++;
257
- if (document.getElementById(id_for_country+"_mini_label_city"))
258
- tox = tox + addr_id + '#**id**#' + document.getElementById(id_for_country + "_mini_label_city").innerHTML + '#**label**#type_address#****#';
259
- addr_id++;
260
- if (document.getElementById(id_for_country + "_mini_label_state"))
261
- tox = tox + addr_id + '#**id**#' + document.getElementById(id_for_country + "_mini_label_state").innerHTML + '#**label**#type_address#****#';
262
- addr_id++;
263
- if (document.getElementById(id_for_country + "_mini_label_postal"))
264
- tox = tox + addr_id + '#**id**#' + document.getElementById(id_for_country + "_mini_label_postal").innerHTML + '#**label**#type_address#****#';
265
- addr_id++;
266
- if (document.getElementById(id_for_country+"_mini_label_country")) {
267
- tox=tox + addr_id + '#**id**#' + document.getElementById(id_for_country + "_mini_label_country").innerHTML + '#**label**#type_address#****#';
268
- }
269
-
270
- }
271
- else {
272
- tox = tox + wdid + '#**id**#' + l_label + '#**label**#' + wdtype + '#****#';
273
- }
274
-
275
- id = wdid;
276
- form_fields += wdid + "*:*id*:*";
277
- form_fields += wdtype + "*:*type*:*";
278
- w_choices = new Array();
279
- w_choices_value=new Array();
280
- w_choices_checked = new Array();
281
- w_choices_disabled = new Array();
282
- w_choices_params =new Array();
283
- w_allow_other_num = 0;
284
- w_property = new Array();
285
- w_property_type = new Array();
286
- w_property_values = new Array();
287
- w_choices_price = new Array();
288
- if (document.getElementById(id+'_element_labelform_id_temp').innerHTML) {
289
- w_field_label = document.getElementById(id + '_element_labelform_id_temp').innerHTML.replace(/(\r\n|\n|\r)/gm," ");
290
- }
291
- else {
292
- w_field_label = " ";
293
- }
294
- if (document.getElementById(id + '_label_sectionform_id_temp')) {
295
- if (document.getElementById(id + '_label_sectionform_id_temp').style.display == "block") {
296
- w_field_label_pos = "top";
297
- }
298
- else {
299
- w_field_label_pos = "left";
300
- }
301
- }
302
- if (document.getElementById(id + "_elementform_id_temp")) {
303
- s = document.getElementById(id + "_elementform_id_temp").style.width;
304
- w_size=s.substring(0,s.length - 2);
305
- }
306
- if (document.getElementById(id + "_label_sectionform_id_temp")) {
307
- s = document.getElementById(id + "_label_sectionform_id_temp").style.width;
308
- w_field_label_size = s.substring(0, s.length - 2);
309
- }
310
- if (document.getElementById(id + "_requiredform_id_temp")) {
311
- w_required = document.getElementById(id + "_requiredform_id_temp").value;
312
- }
313
- if (document.getElementById(id + "_uniqueform_id_temp")) {
314
- w_unique = document.getElementById(id + "_uniqueform_id_temp").value;
315
- }
316
- if (document.getElementById(id + '_label_sectionform_id_temp')) {
317
- w_class = document.getElementById(id + '_label_sectionform_id_temp').getAttribute("class");
318
- if (!w_class) {
319
- w_class = "";
320
- }
321
- }
322
- gen_form_fields();
323
- wdform_row.innerHTML = "%" + id + " - " + l_label + "%";
324
- }
325
- }
326
- }
327
- }
328
- else {
329
- id = wdform_page.childNodes[q].getAttribute("wdid");
330
- w_editor = document.getElementById(id + "_element_sectionform_id_temp").innerHTML;
331
- form_fields += id + "*:*id*:*";
332
- form_fields += "type_section_break" + "*:*type*:*";
333
- form_fields += "custom_" + id + "*:*w_field_label*:*";
334
- form_fields += w_editor + "*:*w_editor*:*";
335
- form_fields += "*:*new_field*:*";
336
- wdform_page.childNodes[q].innerHTML = "%" + id + " - " + "custom_" + id + "%";
337
- }
338
- }
339
- }
340
- }
341
- document.getElementById('label_order_current').value = tox;
342
-
343
- for (x = 0; x < l_id_array.length; x++) {
344
- if (l_id_removed[l_id_array[x]]) {
345
- tox = tox + l_id_array[x] + '#**id**#' + l_label_array[x] + '#**label**#' + l_type_array[x] + '#****#';
346
- }
347
- }
348
-
349
- document.getElementById('label_order').value = tox;
350
- document.getElementById('form_fields').value = form_fields;
351
- refresh_();
352
- document.getElementById('pagination').value=document.getElementById('pages').getAttribute("type");
353
- document.getElementById('show_title').value=document.getElementById('pages').getAttribute("show_title");
354
- document.getElementById('show_numbers').value=document.getElementById('pages').getAttribute("show_numbers");
355
- return true;
356
- }
357
-
358
- gen = <?php echo (($id != 0) ? $row->counter : 1); ?>;
359
-
360
- function enable() {
361
- alltypes = Array('customHTML', 'text', 'checkbox', 'radio', 'time_and_date', 'select', 'file_upload', 'captcha', 'map', 'button', 'page_break', 'section_break', 'paypal', 'survey');
362
- for (x = 0; x < 14; x++) {
363
- document.getElementById('img_' + alltypes[x]).src = "<?php echo WD_FM_URL . '/images/'; ?>" + alltypes[x] + ".png?ver=<?php echo WD_FM_VERSION; ?>";
364
- }
365
- if (document.getElementById('formMakerDiv').style.display == 'block') {
366
- jQuery('#formMakerDiv').slideToggle(200);
367
- }
368
- else {
369
- jQuery('#formMakerDiv').slideToggle(400);
370
- }
371
-
372
- if (document.getElementById('formMakerDiv1').style.display == 'block') {
373
- jQuery('#formMakerDiv1').slideToggle(200);
374
- }
375
- else {
376
- jQuery('#formMakerDiv1').slideToggle(400);
377
- }
378
- document.getElementById('when_edit').style.display = 'none';
379
- }
380
-
381
- function enable2() {
382
- alltypes = Array('customHTML', 'text', 'checkbox', 'radio', 'time_and_date', 'select', 'file_upload', 'captcha', 'map', 'button', 'page_break', 'section_break', 'paypal', 'survey');
383
- for (x = 0; x < 14; x++) {
384
- document.getElementById('img_' + alltypes[x]).src = "<?php echo WD_FM_URL . '/images/'; ?>" + alltypes[x] + ".png?ver=<?php echo WD_FM_VERSION; ?>";
385
- }
386
- if (document.getElementById('formMakerDiv').style.display == 'block') {
387
- jQuery('#formMakerDiv').slideToggle(200);
388
- }
389
- else {
390
- jQuery('#formMakerDiv').slideToggle(400);
391
- }
392
-
393
- if (document.getElementById('formMakerDiv1').style.display == 'block') {
394
- jQuery('#formMakerDiv1').slideToggle(200);
395
- }
396
- else {
397
- jQuery('#formMakerDiv1').slideToggle(400);
398
- }
399
- document.getElementById('when_edit').style.display = 'block';
400
- if (document.getElementById('field_types').offsetWidth) {
401
- document.getElementById('when_edit').style.width = 'inherit';
402
- }
403
- if (document.getElementById('field_types').offsetHeight) {
404
- document.getElementById('when_edit').style.height = 'inherit';
405
- }
406
- }
407
- </script>
408
- <form class="wrap" id="manage_form" method="post" action="admin.php?page=manage_fm">
409
- <?php wp_nonce_field('nonce_fm', 'nonce_fm'); ?>
410
- <h2 class="fm-h2-message"></h2>
411
- <div class="fm-page-header">
412
- <!-- <div class="fm-page-title">
413
- <?php echo $page_title; ?>
414
- </div> -->
415
- <div style="float:left;">
416
- <div class="fm-logo-edit-page"></div>
417
- <div class="fm-title-edit-page">Form</br>Maker</div>
418
- </div>
419
- <div class="fm-page-actions">
420
- <?php
421
- if(isset($row->backup_id) )
422
- if($row->backup_id!="") {
423
- $query = "SELECT backup_id FROM " . $wpdb->prefix . "formmaker_backup WHERE backup_id > ".$row->backup_id." AND id = ".$row->id." ORDER BY backup_id ASC LIMIT 0 , 1 ";
424
- $backup_id = $wpdb->get_var($query);
425
- if($backup_id) { ?>
426
- <button class="fm-button redo-button medium" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; jQuery('#saving_text').html('Redo');fm_set_input_value('task', 'redo');">
427
- <span></span>
428
- Redo
429
- </button>
430
- <?php
431
- }
432
- $query = "SELECT backup_id FROM " . $wpdb->prefix . "formmaker_backup WHERE backup_id < ".$row->backup_id." AND id = ".$row->id." ORDER BY backup_id DESC LIMIT 0 , 1 ";
433
- $backup_id = $wpdb->get_var($query);
434
-
435
- if($backup_id) { ?>
436
- <button class="fm-button undo-button medium" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; jQuery('#saving_text').html('Undo');fm_set_input_value('task', 'undo');">
437
- <span></span>
438
- Undo
439
- </button>
440
- <?php
441
- }
442
- }
443
- ?>
444
-
445
- <?php if ($id) { ?>
446
- <button class="fm-button save-as-copy-button medium" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; fm_set_input_value('task', 'save_as_copy');">
447
- <span></span>
448
- Save as Copy
449
- </button>
450
- <?php } ?>
451
- <button class="fm-button save-button medium" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; fm_set_input_value('task', 'save');">
452
- <span></span>
453
- Save
454
- </button>
455
- <button class="fm-button apply-button medium" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; fm_set_input_value('task', 'apply');">
456
- <span></span>
457
- Apply
458
- </button>
459
- <button class="fm-button cancel-button medium" onclick="fm_set_input_value('task', 'cancel');">
460
- <span></span>
461
- Cancel
462
- </button>
463
- </div>
464
- <div class="fm-clear"></div>
465
- </div>
466
-
467
- <div class="fm-theme-banner">
468
- <div class="fm-title">
469
- <span style="">Title:&nbsp;</span>
470
- <input id="title" name="title" value="<?php echo $row->title; ?>"/>
471
- </div>
472
- <div class="fm-page-actions">
473
- <button class="fm-button display-options-button large" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; fm_set_input_value('task', 'view_display_options');">
474
- <span></span>
475
- Display Options
476
- </button>
477
- <button class="fm-button form-options-button medium" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; fm_set_input_value('task', 'view_options');">
478
- <span></span>
479
- Form Options
480
- </button>
481
- <?php
482
- $fm_settings = get_option('fm_settings');
483
- $fm_advanced_layout = isset($fm_settings['fm_advanced_layout']) ? $fm_settings['fm_advanced_layout'] : '';
484
- if ($row->id) {
485
- $autogen_layout = $wpdb->get_var($wpdb->prepare('SELECT autogen_layout FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $row->id));
486
- }
487
- else {
488
- $autogen_layout = 1;
489
- }
490
- if ($fm_advanced_layout || $autogen_layout == 0) {
491
- ?>
492
- <button class="fm-button form-layout-button large" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; fm_set_input_value('task', 'form_layout');">
493
- <span></span>
494
- Advanced Layout
495
- </button>
496
- <?php
497
- }
498
- ?>
499
- </div>
500
- </div>
501
- <div class="fm-clear"></div>
502
- <div class="fm-theme-banner">
503
- <div class="fm-theme" style="float:left;">
504
- <span style="">Theme:&nbsp;</span>
505
- <select id="theme" name="theme" onChange="set_preview()">
506
- <optgroup label="New Themes">
507
- <option value="0" <?php echo $row->theme && $row->theme == 0 ? 'selected' : '' ?> data-version="2">Inherit From Website Theme</option>
508
- <?php
509
- $optiongroup = true;
510
- foreach ($themes as $theme) {
511
- if ($optiongroup && $theme->version == 1) {
512
- $optiongroup = false;
513
- ?>
514
- </optgroup>
515
- <optgroup label="Outdated Themes">
516
- <?php
517
- }
518
- ?>
519
- <option value="<?php echo $theme->id; ?>" <?php echo (($theme->id == $row->theme) ? 'selected' : ''); ?> data-version="<?php echo $theme->version; ?>"><?php echo $theme->title; ?></option>
520
- <?php
521
- }
522
- ?>
523
- </optgroup>
524
- </select>
525
- <button id="preview_form" class="fm-button preview-button medium"<?php if (!$id) echo ' disabled="disabled"' ?> onclick="tb_show('', '<?php echo add_query_arg(array('action' => 'FormMakerPreview', 'form_id' => $row->id, 'test_theme' => $row->theme, 'form_preview' => 1, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>'); return false;">
526
- <span></span>
527
- Preview
528
- </button>
529
- <button id="edit_css" class="fm-button options-edit-button medium" onclick="window.open('<?php echo add_query_arg(array('current_id' => ($row->theme ? $row->theme : $default_theme), 'nonce_fm' => wp_create_nonce('nonce_fm')), admin_url('admin.php?page=themes_fm&task=edit')); ?>'); return false;">
530
- <span></span>
531
- Edit
532
- </button>
533
- <div id="old_theme_notice" class="wd_error" style="display: none;">The theme you have selected is outdated. Please choose one from New Themes section.</div>
534
- </div>
535
- <div style="float:right;">
536
- <button class="fm-button add-new-button large" onclick="enable(); Enable(); return false;">
537
- Add a New Field
538
- <span></span>
539
- </button>
540
- </div>
541
- </div>
542
- <div class="fm-clear"></div>
543
- <div id="formMakerDiv" onclick="close_window()"></div>
544
- <div id="formMakerDiv1">
545
- <table class="formMakerDiv1_table" border="0" width="100%" cellpadding="0" cellspacing="0" height="100%">
546
- <tr>
547
- <td style="padding:0px">
548
- <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" >
549
- <tr valign="top">
550
- <td width="20%" height="100%" id="field_types">
551
- <div id="when_edit" style="display: none;"></div>
552
- <table border="0" cellpadding="0" cellspacing="3" width="100%" style="border-collapse: separate; border-spacing: 3px;">
553
- <tbody>
554
- <tr>
555
- <td align="center" onclick="addRow('customHTML')" class="field_buttons" id="table_editor">
556
- <img src="<?php echo WD_FM_URL; ?>/images/customHTML.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_customHTML">
557
- <div>Custom HTML</div>
558
- </td>
559
- <td align="center" onclick="addRow('text')" class="field_buttons" id="table_text">
560
- <img src="<?php echo WD_FM_URL; ?>/images/text.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_text">
561
- <div>Text input</div>
562
- </td>
563
- </tr>
564
- <tr>
565
- <td align="center" onclick="addRow('checkbox')" class="field_buttons" id="table_checkbox">
566
- <img src="<?php echo WD_FM_URL; ?>/images/checkbox.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_checkbox">
567
- <div>Multiple Choice</div>
568
- </td>
569
- <td align="center" onclick="addRow('radio')" class="field_buttons" id="table_radio">
570
- <img src="<?php echo WD_FM_URL; ?>/images/radio.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_radio">
571
- <div>Single Choice</div>
572
- </td>
573
- </tr>
574
- <tr>
575
- <td align="center" onclick="addRow('survey')" class="field_buttons" id="table_survey">
576
- <img src="<?php echo WD_FM_URL; ?>/images/survey.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_survey">
577
- <div>Survey Tools</div>
578
- </td>
579
- <td align="center" onclick="addRow('time_and_date')" class="field_buttons" id="table_time_and_date">
580
- <img src="<?php echo WD_FM_URL; ?>/images/time_and_date.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_time_and_date">
581
- <div>Time and Date</div>
582
- </td>
583
- </tr>
584
- <tr>
585
- <td align="center" onclick="addRow('select')" class="field_buttons" id="table_select">
586
- <img src="<?php echo WD_FM_URL; ?>/images/select.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_select">
587
- <div>Select Box</div>
588
- </td>
589
- <td align="center" onclick="alert('This field type is disabled in free version. If you need this functionality, you need to buy the commercial version.')" class="field_buttons field_disabled" id="table_file_upload">
590
- <img src="<?php echo WD_FM_URL; ?>/images/file_upload.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_file_upload">
591
- <div>File Upload</div>
592
- </td>
593
- </tr>
594
- <tr>
595
- <td align="center" onclick="addRow('section_break')" class="field_buttons" id="table_section_break">
596
- <img src="<?php echo WD_FM_URL; ?>/images/section_break.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_section_break">
597
- <div>Section Break</div>
598
- </td>
599
- <td align="center" onclick="addRow('page_break')" class="field_buttons" id="table_page_break">
600
- <img src="<?php echo WD_FM_URL; ?>/images/page_break.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_page_break">
601
- <div>Page Break</div>
602
- </td>
603
- </tr>
604
- <tr>
605
- <td align="center" onclick="alert('This field type is disabled in free version. If you need this functionality, you need to buy the commercial version.')" class="field_buttons field_disabled" id="table_map">
606
- <img src="<?php echo WD_FM_URL; ?>/images/map.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_map">
607
- <div>Map</div>
608
- </td>
609
- <td align="center" onclick="alert('This field type is disabled in free version. If you need this functionality, you need to buy the commercial version.')" id="table_paypal" class="field_buttons field_disabled">
610
- <img src="<?php echo WD_FM_URL; ?>/images/paypal.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_paypal">
611
- <div>Payment</div>
612
- </td>
613
- </tr>
614
- <tr>
615
- <td align="center" onclick="addRow('captcha')" class="field_buttons" id="table_captcha">
616
- <img src="<?php echo WD_FM_URL; ?>/images/captcha.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_captcha">
617
- <div>Captcha</div>
618
- </td>
619
- <td align="center" onclick="addRow('button')" id="table_button" class="field_buttons">
620
- <img src="<?php echo WD_FM_URL; ?>/images/button.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_button">
621
- <div>Button</div>
622
- </td>
623
- </tr>
624
- </tbody>
625
- </table>
626
- </td>
627
- <td width="40%" height="100%" align="left">
628
- <div id="edit_table"></div>
629
- </td>
630
- <td align="center" valign="top" style="background: url("<?php echo WD_FM_URL . '/images/border2.png'; ?>") repeat-y;">&nbsp;</td>
631
- <td style="padding:15px;">
632
- <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" >
633
- <tr>
634
- <td align="right">
635
- <input type="radio" value="end" name="el_pos" checked="checked" id="pos_end" onclick="Disable()"/>
636
- At The End
637
- <input type="radio" value="begin" name="el_pos" id="pos_begin" onclick="Disable()"/>
638
- At The Beginning
639
- <input type="radio" value="before" name="el_pos" id="pos_before" onclick="Enable()"/>
640
- Before
641
- <select style="width: 100px; margin-left: 5px;" id="sel_el_pos" onclick="change_before()" disabled="disabled"></select>
642
- <br>
643
- <button class="fm-button field-save-button medium" onclick="add(0, false); return false;">
644
- Save
645
- <span></span>
646
- </button>
647
- <button class="fm-button cancel-button medium" onclick="close_window(); return false;">
648
- Cancel
649
- <span></span>
650
- </button>
651
- <hr style="margin-bottom:10px" />
652
- </td>
653
- </tr>
654
- <tr height="100%" valign="top">
655
- <td id="show_table"></td>
656
- </tr>
657
- </table>
658
- </td>
659
- </tr>
660
- </table>
661
- </td>
662
- </tr>
663
- </table>
664
- <input type="hidden" id="old" />
665
- <input type="hidden" id="old_selected" />
666
- <input type="hidden" id="element_type" />
667
- <input type="hidden" id="editing_id" />
668
- <input type="hidden" value="<?php echo WD_FM_URL; ?>" id="form_plugins_url" />
669
- <div id="main_editor" style="position: fixed; display: none; z-index: 140;">
670
- <?php if (user_can_richedit()) {
671
- wp_editor('', 'form_maker_editor', array('teeny' => FALSE, 'textarea_name' => 'form_maker_editor', 'media_buttons' => FALSE, 'textarea_rows' => 5));
672
- }
673
- else { ?>
674
- <textarea name="form_maker_editor" id="form_maker_editor" cols="40" rows="5" style="width: 440px; height: 350px;" class="mce_editable" aria-hidden="true"></textarea>
675
- <?php
676
- }
677
- ?>
678
- </div>
679
- </div>
680
- <?php if (!function_exists('the_editor')) { ?>
681
- <iframe id="tinymce" style="display: none;"></iframe>
682
- <?php } ?>
683
-
684
- <?php
685
- $animation_effects = array(
686
- 'none' => 'None',
687
- 'bounce' => 'Bounce',
688
- 'tada' => 'Tada',
689
- 'bounceInDown' => 'BounceInDown',
690
- 'fadeInLeft' => 'FadeInLeft',
691
- 'flash' => 'Flash',
692
- 'pulse' => 'Pulse',
693
- 'rubberBand' => 'RubberBand',
694
- 'shake' => 'Shake',
695
- 'swing' => 'Swing',
696
- 'wobble' => 'Wobble',
697
- 'hinge' => 'Hinge',
698
- 'lightSpeedIn' => 'LightSpeedIn',
699
- 'rollIn' => 'RollIn',
700
- 'bounceIn' => 'BounceIn',
701
- 'bounceInLeft' => 'BounceInLeft',
702
- 'bounceInRight' => 'BounceInRight',
703
- 'bounceInUp' => 'BounceInUp',
704
- 'fadeIn' => 'FadeIn',
705
- 'fadeInDown' => 'FadeInDown',
706
- 'fadeInDownBig' => 'FadeInDownBig',
707
- 'fadeInLeftBig' => 'FadeInLeftBig',
708
- 'fadeInRight' => 'FadeInRight',
709
- 'fadeInRightBig' => 'FadeInRightBig',
710
- 'fadeInUp' => 'FadeInUp',
711
- 'fadeInUpBig' => 'FadeInUpBig',
712
- 'flip' => 'Flip',
713
- 'flipInX' => 'FlipInX',
714
- 'flipInY' => 'FlipInY',
715
- 'rotateIn' => 'RotateIn',
716
- 'rotateInDownLeft' => 'RotateInDownLeft',
717
- 'rotateInDownRight' => 'RotateInDownRight',
718
- 'rotateInUpLeft' => 'RotateInUpLeft',
719
- 'rotateInUpRight' => 'RotateInUpRight',
720
- 'zoomIn' => 'ZoomIn',
721
- 'zoomInDown' => 'ZoomInDown',
722
- 'zoomInLeft' => 'ZoomInLeft',
723
- 'zoomInRight' => 'ZoomInRight',
724
- 'zoomInUp' => 'ZoomInUp',
725
- );
726
- ?>
727
- <div class="fm-edit-content panel form-header">
728
- <div class="panel-heading">
729
- <span class="fm-header-bg"></span>
730
- Header
731
- <span class="fm-expcol pull-right" onclick="jQuery(this).toggleClass('fm-expanded'); jQuery('#fm-header-content').toggleClass('fm-hide');"></span>
732
- </div>
733
- <div id="fm-header-content" class="panel-content fm-hide">
734
- <div class="col-md-6 col-xs-12">
735
- <div class="fm-row">
736
- <label>Title: </label>
737
- <input type="text" id="header_title" name="header_title" value="<?php echo $row->header_title; ?>"/>
738
- </div>
739
- <div class="fm-row">
740
- <label>Description: </label>
741
- <div id="description_editor" style="width:470px; display: inline-block; vertical-align: middle;">
742
- <?php if (user_can_richedit()) {
743
- wp_editor($row->header_description, 'header_description', array('teeny' => FALSE, 'textarea_name' => 'header_description', 'media_buttons' => FALSE, 'textarea_rows' => 5));
744
- }
745
- else { ?>
746
- <textarea name="header_description" id="header_description" cols="40" rows="5" style="width: 440px; height: 350px;" class="mce_editable" aria-hidden="true"></textarea>
747
- <?php
748
- }
749
- ?>
750
- </div>
751
- </div>
752
- </div>
753
- <div class="col-md-6 col-xs-12">
754
- <div class="fm-row">
755
- <label>Image: </label>
756
- <input type="text" id="header_image_url" name="header_image_url" value="<?php echo $row->header_image_url; ?>"/>
757
- <button class="fm-button add-button medium" onclick="fmOpenMediaUploader(event); return false;">Add Image</button>
758
- <?php $header_bg = $row->header_image_url ? 'background-image: url('.$row->header_image_url.'); background-position: center;' : ''; ?>
759
- <div id="header_image" class="header_img<?php if (!$row->header_image_url) echo ' fm-hide'; ?>" style="<?php echo $header_bg; ?>">
760
- <button type="button" id="remove_header_img" onclick="fmRemoveHeaderImage(event); return false;">
761
- <i class="mce-ico mce-i-dashicon dashicons-no"></i>
762
- </button>
763
- </div>
764
- </div>
765
- <div class="fm-row">
766
- <label>Image Animation: </label>
767
- <select name="header_image_animation">
768
- <?php
769
- foreach($animation_effects as $anim_key => $animation_effect){
770
- $selected = $row->header_image_animation == $anim_key ? 'selected="selected"' : '';
771
- echo '<option value="'.$anim_key.'" '.$selected.'>'.$animation_effect.'</option>';
772
- }
773
- ?>
774
- </select>
775
- </div>
776
- <div class="fm-row">
777
- <label for="header_hide_image">Hide Image on Mobile: </label>
778
- <input type="checkbox" id="header_hide_image" name="header_hide_image" value="1" <?php echo $row->header_hide_image == '1' ? 'checked="checked"' : '' ?> />
779
- </div>
780
- </div>
781
- <div class="fm-clear"></div>
782
- </div>
783
- </div>
784
-
785
- <div class="fm-edit-content">
786
- <div class="fm-drag-and-drop">
787
- <div>
788
- <label for="enable_sortable">Enable Drag & Drop</label>
789
- <button name="sortable" id="enable_sortable" class="fm-checkbox-radio-button <?php echo $row->sortable == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="enable_drag(this); return false;" value="<?php echo $row->sortable; ?>">
790
- <span></span>
791
- </button>
792
- <input type="hidden" name="sortable" id="sortable_hidden" value="<?php echo $row->sortable; ?>"/>
793
- </div>
794
- <div>
795
- You can use drag and drop to move the fields up/down for the change of the order and left/right for creating columns within the form.
796
- </div>
797
- </div>
798
- <fieldset>
799
- <legend></legend>
800
- <?php if ($id) { ?>
801
- <div style="margin: 8px; display: table; width: 100%;" id="page_bar">
802
- <div id="page_navigation" style="display: table-row;">
803
- <div align="center" id="pages" show_title="<?php echo $row->show_title; ?>" show_numbers="<?php echo $row->show_numbers; ?>" type="<?php echo $row->pagination; ?>" style="display: table-cell; width:90%;"></div>
804
- <div align="left" id="edit_page_navigation" style="display: table-cell; vertical-align: middle;"></div>
805
- </div>
806
- </div>
807
- <div id="take" class="main">
808
- <?php echo $row->form_front; ?>
809
- </div>
810
- <?php } else { ?>
811
- <div style="margin:8px; display:table; width:100%" id="page_bar">
812
- <div id="page_navigation" style="display:table-row">
813
- <div align="center" id="pages" show_title="false" show_numbers="true" type="none" style="display:table-cell; width:90%"></div>
814
- <div align="left" id="edit_page_navigation" style="display:table-cell; vertical-align: middle;"></div>
815
- </div>
816
- </div>
817
- <div id="take" class="main">
818
- <div class="wdform-page-and-images" style="display:table; border-top:0px solid black;">
819
- <div id="form_id_tempform_view1" class="wdform_page" page_title="Untitled page" next_title="Next" next_type="text" next_class="wdform-page-button" next_checkable="false" previous_title="Previous" previous_type="text" previous_class="wdform-page-button" previous_checkable="false">
820
- <div class="wdform_section">
821
- <div class="wdform_column"></div>
822
- </div>
823
- <div valign="top" class="wdform_footer" style="width: 100%;">
824
- <div style="width: 100%;">
825
- <div style="width: 100%; display: table; padding-top:10px;">
826
- <div style="display: table-row-group;">
827
- <div id="form_id_temppage_nav1" style="display: table-row;"></div>
828
- </div>
829
- </div>
830
- </div>
831
- </div>
832
- </div>
833
- <div id="form_id_tempform_view_img1" style="float: right;">
834
- <div>
835
- <img src="<?php echo WD_FM_URL . '/images/minus.png?ver='. WD_FM_VERSION; ?>" title="Show or hide the page" class="page_toolbar" onClick="show_or_hide('1')" onMouseOver="chnage_icons_src(this,'minus')" onmouseout="chnage_icons_src(this,'minus')" id="show_page_img_1"/>
836
- <img src="<?php echo WD_FM_URL . '/images/page_delete.png?ver='. WD_FM_VERSION; ?>" title="Delete the page" class="page_toolbar" onClick="remove_page('1')" onMouseOver="chnage_icons_src(this,'page_delete')" onmouseout="chnage_icons_src(this,'page_delete')"/>
837
- <img src="<?php echo WD_FM_URL . '/images/page_delete_all.png?ver='. WD_FM_VERSION; ?>" title="Delete the page with fields" class="page_toolbar" onClick="remove_page_all('1')" onMouseOver="chnage_icons_src(this,'page_delete_all')" onmouseout="chnage_icons_src(this,'page_delete_all')"/>
838
- <img src="<?php echo WD_FM_URL . '/images/page_edit.png?ver='. WD_FM_VERSION; ?>" title="Edit the page" class="page_toolbar" onClick="edit_page_break('1')" onMouseOver="chnage_icons_src(this,'page_edit')" onmouseout="chnage_icons_src(this,'page_edit')"/>
839
- </div>
840
- </div>
841
- </div>
842
- </div>
843
- <?php } ?>
844
- </fieldset>
845
- </div>
846
- <input type="hidden" name="form_front" id="form_front" />
847
- <input type="hidden" name="form_fields" id="form_fields" />
848
- <input type="hidden" name="pagination" id="pagination" />
849
- <input type="hidden" name="show_title" id="show_title" />
850
- <input type="hidden" name="show_numbers" id="show_numbers" />
851
- <input type="hidden" name="public_key" id="public_key" />
852
- <input type="hidden" name="private_key" id="private_key" />
853
- <input type="hidden" name="recaptcha_theme" id="recaptcha_theme" />
854
- <input type="hidden" id="label_order" name="label_order" value="<?php echo $row->label_order; ?>" />
855
- <input type="hidden" id="label_order_current" name="label_order_current" value="<?php echo $row->label_order_current; ?>" />
856
- <input type="hidden" name="counter" id="counter" value="<?php echo $row->counter; ?>" />
857
- <input type="hidden" id="araqel" value="0" />
858
- <input type="hidden" name="backup_id" id="backup_id" value="<?php echo $row->backup_id;?>">
859
-
860
- <script type="text/javascript">
861
- default_theme = "<?php echo $default_theme; ?>";
862
- function set_preview() {
863
- theme_id = jQuery('#theme').val() == '0' ? default_theme : jQuery('#theme').val();
864
- jQuery("#preview_form").attr("onclick", "tb_show('', '<?php echo add_query_arg(array('action' => 'FormMakerPreview', 'form_id' => $row->id, 'form_preview' => 1), admin_url('admin-ajax.php')); ?>&test_theme=" + theme_id + "&width=1000&height=500&TB_iframe=1'); return false;");
865
- jQuery("#edit_css").attr("onclick", "window.open('<?php echo add_query_arg(array('nonce_fm' => wp_create_nonce('nonce_fm')), admin_url('admin.php?page=themes_fm&task=edit')); ?>&current_id=" + theme_id + "'); return false;");
866
- if (jQuery('#theme option:selected').attr('data-version') == 1) {
867
- jQuery("#old_theme_notice").show();
868
- }
869
- else {
870
- jQuery("#old_theme_notice").hide();
871
- }
872
- }
873
- jQuery(document).ready(function () {
874
- set_preview();
875
- });
876
- <?php if ($id) { ?>
877
- function formOnload() {
878
- for (t = 0; t < <?php echo $row->counter; ?>; t++) {
879
- if (document.getElementById(t + "_typeform_id_temp")) {
880
- if (document.getElementById(t + "_typeform_id_temp").value == "type_map" || document.getElementById(t + "_typeform_id_temp").value == "type_mark_map") {
881
- if_gmap_init(t);
882
- for (q = 0; q < 20; q++) {
883
- if (document.getElementById(t + "_elementform_id_temp").getAttribute("long" + q)) {
884
- w_long = parseFloat(document.getElementById(t + "_elementform_id_temp").getAttribute("long" + q));
885
- w_lat = parseFloat(document.getElementById(t + "_elementform_id_temp").getAttribute("lat" + q));
886
- w_info = parseFloat(document.getElementById(t + "_elementform_id_temp").getAttribute("info" + q));
887
- add_marker_on_map(t, q, w_long, w_lat, w_info, false);
888
- }
889
- }
890
- }
891
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_date") {
892
- // Calendar.setup({
893
- // inputField:t + "_elementform_id_temp",
894
- // ifFormat:document.getElementById(t + "_buttonform_id_temp").getAttribute('format'),
895
- // button:t + "_buttonform_id_temp",
896
- // align:"Tl",
897
- // singleClick:true,
898
- // firstDay:0
899
- // });
900
- }
901
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_name") {
902
- var myu = t;
903
- jQuery(document).ready(function () {
904
- jQuery("#" + myu + "_mini_label_first").click(function () {
905
- if (jQuery(this).children('input').length == 0) {
906
- var first = "<input type='text' id='first' class='first' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
907
- jQuery(this).html(first);
908
- jQuery("input.first").focus();
909
- jQuery("input.first").blur(function () {
910
- var id_for_blur = document.getElementById('first').parentNode.id.split('_');
911
- var value = jQuery(this).val();
912
- jQuery("#" + id_for_blur[0] + "_mini_label_first").text(value);
913
- });
914
- }
915
- });
916
- jQuery("label#" + myu + "_mini_label_last").click(function () {
917
- if (jQuery(this).children('input').length == 0) {
918
- var last = "<input type='text' id='last' class='last' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
919
- jQuery(this).html(last);
920
- jQuery("input.last").focus();
921
- jQuery("input.last").blur(function () {
922
- var id_for_blur = document.getElementById('last').parentNode.id.split('_');
923
- var value = jQuery(this).val();
924
- jQuery("#" + id_for_blur[0] + "_mini_label_last").text(value);
925
- });
926
- }
927
- });
928
- jQuery("label#" + myu + "_mini_label_title").click(function () {
929
- if (jQuery(this).children('input').length == 0) {
930
- var title_ = "<input type='text' id='title_' class='title_' style='outline:none; border:none; background:none; width:50px;' value=\"" + jQuery(this).text() + "\">";
931
- jQuery(this).html(title_);
932
- jQuery("input.title_").focus();
933
- jQuery("input.title_").blur(function () {
934
- var id_for_blur = document.getElementById('title_').parentNode.id.split('_');
935
- var value = jQuery(this).val();
936
- jQuery("#" + id_for_blur[0] + "_mini_label_title").text(value);
937
- });
938
- }
939
- });
940
- jQuery("label#" + myu + "_mini_label_middle").click(function () {
941
- if (jQuery(this).children('input').length == 0) {
942
- var middle = "<input type='text' id='middle' class='middle' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
943
- jQuery(this).html(middle);
944
- jQuery("input.middle").focus();
945
- jQuery("input.middle").blur(function () {
946
- var id_for_blur = document.getElementById('middle').parentNode.id.split('_');
947
- var value = jQuery(this).val();
948
- jQuery("#" + id_for_blur[0] + "_mini_label_middle").text(value);
949
- });
950
- }
951
- });
952
- });
953
- }
954
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_phone") {
955
- var myu = t;
956
- jQuery(document).ready(function () {
957
- jQuery("label#" + myu + "_mini_label_area_code").click(function () {
958
- if (jQuery(this).children('input').length == 0) {
959
- var area_code = "<input type='text' id='area_code' class='area_code' size='10' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
960
- jQuery(this).html(area_code);
961
- jQuery("input.area_code").focus();
962
- jQuery("input.area_code").blur(function () {
963
- var id_for_blur = document.getElementById('area_code').parentNode.id.split('_');
964
- var value = jQuery(this).val();
965
- jQuery("#" + id_for_blur[0] + "_mini_label_area_code").text(value);
966
- });
967
- }
968
- });
969
- jQuery("label#" + myu + "_mini_label_phone_number").click(function () {
970
- if (jQuery(this).children('input').length == 0) {
971
- var phone_number = "<input type='text' id='phone_number' class='phone_number' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
972
- jQuery(this).html(phone_number);
973
- jQuery("input.phone_number").focus();
974
- jQuery("input.phone_number").blur(function () {
975
- var id_for_blur = document.getElementById('phone_number').parentNode.id.split('_');
976
- var value = jQuery(this).val();
977
- jQuery("#" + id_for_blur[0] + "_mini_label_phone_number").text(value);
978
- });
979
- }
980
- });
981
- });
982
- }
983
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_date_fields") {
984
- var myu = t;
985
- jQuery(document).ready(function () {
986
- jQuery("label#" + myu + "_day_label").click(function () {
987
- if (jQuery(this).children('input').length == 0) {
988
- var day = "<input type='text' id='day' class='day' size='8' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
989
- jQuery(this).html(day);
990
- jQuery("input.day").focus();
991
- jQuery("input.day").blur(function () {
992
- var id_for_blur = document.getElementById('day').parentNode.id.split('_');
993
- var value = jQuery(this).val();
994
- jQuery("#" + id_for_blur[0] + "_day_label").text(value);
995
- });
996
- }
997
- });
998
- jQuery("label#" + myu + "_month_label").click(function () {
999
- if (jQuery(this).children('input').length == 0) {
1000
- var month = "<input type='text' id='month' class='month' size='8' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1001
- jQuery(this).html(month);
1002
- jQuery("input.month").focus();
1003
- jQuery("input.month").blur(function () {
1004
- var id_for_blur = document.getElementById('month').parentNode.id.split('_');
1005
- var value = jQuery(this).val();
1006
- jQuery("#" + id_for_blur[0] + "_month_label").text(value);
1007
- });
1008
- }
1009
- });
1010
- jQuery("label#" + myu + "_year_label").click(function () {
1011
- if (jQuery(this).children('input').length == 0) {
1012
- var year = "<input type='text' id='year' class='year' size='8' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1013
- jQuery(this).html(year);
1014
- jQuery("input.year").focus();
1015
- jQuery("input.year").blur(function () {
1016
- var id_for_blur = document.getElementById('year').parentNode.id.split('_');
1017
- var value = jQuery(this).val();
1018
- jQuery("#" + id_for_blur[0] + "_year_label").text(value);
1019
- });
1020
- }
1021
- });
1022
- });
1023
- }
1024
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_time") {
1025
- var myu = t;
1026
- jQuery(document).ready(function () {
1027
- jQuery("label#" + myu + "_mini_label_hh").click(function () {
1028
- if (jQuery(this).children('input').length == 0) {
1029
- var hh = "<input type='text' id='hh' class='hh' size='4' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1030
- jQuery(this).html(hh);
1031
- jQuery("input.hh").focus();
1032
- jQuery("input.hh").blur(function () {
1033
- var id_for_blur = document.getElementById('hh').parentNode.id.split('_');
1034
- var value = jQuery(this).val();
1035
- jQuery("#" + id_for_blur[0] + "_mini_label_hh").text(value);
1036
- });
1037
- }
1038
- });
1039
- jQuery("label#" + myu + "_mini_label_mm").click(function () {
1040
- if (jQuery(this).children('input').length == 0) {
1041
- var mm = "<input type='text' id='mm' class='mm' size='4' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1042
- jQuery(this).html(mm);
1043
- jQuery("input.mm").focus();
1044
- jQuery("input.mm").blur(function () {
1045
- var id_for_blur = document.getElementById('mm').parentNode.id.split('_');
1046
- var value = jQuery(this).val();
1047
- jQuery("#" + id_for_blur[0] + "_mini_label_mm").text(value);
1048
- });
1049
- }
1050
- });
1051
- jQuery("label#" + myu + "_mini_label_ss").click(function () {
1052
- if (jQuery(this).children('input').length == 0) {
1053
- var ss = "<input type='text' id='ss' class='ss' size='4' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1054
- jQuery(this).html(ss);
1055
- jQuery("input.ss").focus();
1056
- jQuery("input.ss").blur(function () {
1057
- var id_for_blur = document.getElementById('ss').parentNode.id.split('_');
1058
- var value = jQuery(this).val();
1059
- jQuery("#" + id_for_blur[0] + "_mini_label_ss").text(value);
1060
- });
1061
- }
1062
- });
1063
- jQuery("label#" + myu + "_mini_label_am_pm").click(function () {
1064
- if (jQuery(this).children('input').length == 0) {
1065
- var am_pm = "<input type='text' id='am_pm' class='am_pm' size='4' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1066
- jQuery(this).html(am_pm);
1067
- jQuery("input.am_pm").focus();
1068
- jQuery("input.am_pm").blur(function () {
1069
- var id_for_blur = document.getElementById('am_pm').parentNode.id.split('_');
1070
- var value = jQuery(this).val();
1071
- jQuery("#" + id_for_blur[0] + "_mini_label_am_pm").text(value);
1072
- });
1073
- }
1074
- });
1075
- });
1076
- }
1077
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_paypal_price") {
1078
- var myu = t;
1079
- jQuery(document).ready(function () {
1080
- jQuery("#" + myu + "_mini_label_dollars").click(function () {
1081
- if (jQuery(this).children('input').length == 0) {
1082
- var dollars = "<input type='text' id='dollars' class='dollars' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1083
- jQuery(this).html(dollars);
1084
- jQuery("input.dollars").focus();
1085
- jQuery("input.dollars").blur(function () {
1086
- var id_for_blur = document.getElementById('dollars').parentNode.id.split('_');
1087
- var value = jQuery(this).val();
1088
- jQuery("#" + id_for_blur[0] + "_mini_label_dollars").text(value);
1089
- });
1090
- }
1091
- });
1092
- jQuery("label#" + myu + "_mini_label_cents").click(function () {
1093
- if (jQuery(this).children('input').length == 0) {
1094
- var cents = "<input type='text' id='cents' class='cents' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1095
- jQuery(this).html(cents);
1096
- jQuery("input.cents").focus();
1097
- jQuery("input.cents").blur(function () {
1098
- var id_for_blur = document.getElementById('cents').parentNode.id.split('_');
1099
- var value = jQuery(this).val();
1100
- jQuery("#" + id_for_blur[0] + "_mini_label_cents").text(value);
1101
- });
1102
- }
1103
- });
1104
- });
1105
- }
1106
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_address") {
1107
- var myu = t;
1108
- jQuery(document).ready(function () {
1109
- jQuery("label#" + myu + "_mini_label_street1").click(function () {
1110
- if (jQuery(this).children('input').length == 0) {
1111
- var street1 = "<input type='text' id='street1' class='street1' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1112
- jQuery(this).html(street1);
1113
- jQuery("input.street1").focus();
1114
- jQuery("input.street1").blur(function () {
1115
- var id_for_blur = document.getElementById('street1').parentNode.id.split('_');
1116
- var value = jQuery(this).val();
1117
- jQuery("#" + id_for_blur[0] + "_mini_label_street1").text(value);
1118
- });
1119
- }
1120
- });
1121
- jQuery("label#" + myu + "_mini_label_street2").click(function () {
1122
- if (jQuery(this).children('input').length == 0) {
1123
- var street2 = "<input type='text' id='street2' class='street2' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1124
- jQuery(this).html(street2);
1125
- jQuery("input.street2").focus();
1126
- jQuery("input.street2").blur(function () {
1127
- var id_for_blur = document.getElementById('street2').parentNode.id.split('_');
1128
- var value = jQuery(this).val();
1129
- jQuery("#" + id_for_blur[0] + "_mini_label_street2").text(value);
1130
- });
1131
- }
1132
- });
1133
- jQuery("label#" + myu + "_mini_label_city").click(function () {
1134
- if (jQuery(this).children('input').length == 0) {
1135
- var city = "<input type='text' id='city' class='city' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1136
- jQuery(this).html(city);
1137
- jQuery("input.city").focus();
1138
- jQuery("input.city").blur(function () {
1139
- var id_for_blur = document.getElementById('city').parentNode.id.split('_');
1140
- var value = jQuery(this).val();
1141
- jQuery("#" + id_for_blur[0] + "_mini_label_city").text(value);
1142
- });
1143
- }
1144
- });
1145
- jQuery("label#" + myu + "_mini_label_state").click(function () {
1146
- if (jQuery(this).children('input').length == 0) {
1147
- var state = "<input type='text' id='state' class='state' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1148
- jQuery(this).html(state);
1149
- jQuery("input.state").focus();
1150
- jQuery("input.state").blur(function () {
1151
- var id_for_blur = document.getElementById('state').parentNode.id.split('_');
1152
- var value = jQuery(this).val();
1153
- jQuery("#" + id_for_blur[0] + "_mini_label_state").text(value);
1154
- });
1155
- }
1156
- });
1157
- jQuery("label#" + myu + "_mini_label_postal").click(function () {
1158
- if (jQuery(this).children('input').length == 0) {
1159
- var postal = "<input type='text' id='postal' class='postal' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1160
- jQuery(this).html(postal);
1161
- jQuery("input.postal").focus();
1162
- jQuery("input.postal").blur(function () {
1163
- var id_for_blur = document.getElementById('postal').parentNode.id.split('_');
1164
- var value = jQuery(this).val();
1165
- jQuery("#" + id_for_blur[0] + "_mini_label_postal").text(value);
1166
- });
1167
- }
1168
- });
1169
- jQuery("label#" + myu + "_mini_label_country").click(function () {
1170
- if (jQuery(this).children('input').length == 0) {
1171
- var country = "<input type='country' id='country' class='country' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1172
- jQuery(this).html(country);
1173
- jQuery("input.country").focus();
1174
- jQuery("input.country").blur(function () {
1175
- var id_for_blur = document.getElementById('country').parentNode.id.split('_');
1176
- var value = jQuery(this).val();
1177
- jQuery("#" + id_for_blur[0] + "_mini_label_country").text(value);
1178
- });
1179
- }
1180
- });
1181
- });
1182
- }
1183
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_scale_rating") {
1184
- var myu = t;
1185
- jQuery(document).ready(function () {
1186
- jQuery("#" + myu + "_mini_label_worst").click(function () {
1187
- if (jQuery(this).children('input').length == 0) {
1188
- var worst = "<input type='text' id='worst' class='worst' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\"" + jQuery(this).text() + "\">";
1189
- jQuery(this).html(worst);
1190
- jQuery("input.worst").focus();
1191
- jQuery("input.worst").blur(function () {
1192
- var id_for_blur = document.getElementById('worst').parentNode.id.split('_');
1193
- var value = jQuery(this).val();
1194
- jQuery("#" + id_for_blur[0] + "_mini_label_worst").text(value);
1195
- });
1196
- }
1197
- });
1198
- jQuery("label#" + myu + "_mini_label_best").click(function () {
1199
- if (jQuery(this).children('input').length == 0) {
1200
- var best = "<input type='text' id='best' class='best' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\"" + jQuery(this).text() + "\">";
1201
- jQuery(this).html(best);
1202
- jQuery("input.best").focus();
1203
- jQuery("input.best").blur(function () {
1204
- var id_for_blur = document.getElementById('best').parentNode.id.split('_');
1205
- var value = jQuery(this).val();
1206
- jQuery("#" + id_for_blur[0] + "_mini_label_best").text(value);
1207
- });
1208
- }
1209
- });
1210
- });
1211
- }
1212
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_spinner") {
1213
- var spinner_value = document.getElementById(t + "_elementform_id_temp").value;
1214
- var spinner_min_value = document.getElementById(t + "_min_valueform_id_temp").value;
1215
- var spinner_max_value = document.getElementById(t + "_max_valueform_id_temp").value;
1216
- var spinner_step = document.getElementById(t + "_stepform_id_temp").value;
1217
- jQuery("#" + t + "_elementform_id_temp")[0].spin = null;
1218
- spinner = jQuery("#" + t + "_elementform_id_temp").spinner();
1219
- spinner.spinner("value", spinner_value);
1220
- jQuery("#" + t + "_elementform_id_temp").spinner({ min:spinner_min_value});
1221
- jQuery("#" + t + "_elementform_id_temp").spinner({ max:spinner_max_value});
1222
- jQuery("#" + t + "_elementform_id_temp").spinner({ step:spinner_step});
1223
- }
1224
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_slider") {
1225
- var slider_value = document.getElementById(t + "_slider_valueform_id_temp").value;
1226
- var slider_min_value = document.getElementById(t + "_slider_min_valueform_id_temp").value;
1227
- var slider_max_value = document.getElementById(t + "_slider_max_valueform_id_temp").value;
1228
- var slider_element_value = document.getElementById(t + "_element_valueform_id_temp");
1229
- var slider_value_save = document.getElementById(t + "_slider_valueform_id_temp");
1230
- jQuery("#" + t + "_elementform_id_temp")[0].slide = null;
1231
- jQuery(function () {
1232
- jQuery("#" + t + "_elementform_id_temp").slider({
1233
- range:"min",
1234
- value:eval(slider_value),
1235
- min:eval(slider_min_value),
1236
- max:eval(slider_max_value),
1237
- slide:function (event, ui) {
1238
- slider_element_value.innerHTML = "" + ui.value;
1239
- slider_value_save.value = "" + ui.value;
1240
- }
1241
- });
1242
- });
1243
- }
1244
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_range") {
1245
- var spinner_value0 = document.getElementById(t + "_elementform_id_temp0").value;
1246
- var spinner_step = document.getElementById(t + "_range_stepform_id_temp").value;
1247
- jQuery("#" + t + "_elementform_id_temp0")[0].spin = null;
1248
- jQuery("#" + t + "_elementform_id_temp1")[0].spin = null;
1249
- spinner0 = jQuery("#" + t + "_elementform_id_temp0").spinner();
1250
- spinner0.spinner("value", spinner_value0);
1251
- jQuery("#" + t + "_elementform_id_temp0").spinner({ step:spinner_step});
1252
- var spinner_value1 = document.getElementById(t + "_elementform_id_temp1").value;
1253
- spinner1 = jQuery("#" + t + "_elementform_id_temp1").spinner();
1254
- spinner1.spinner("value", spinner_value1);
1255
- jQuery("#" + t + "_elementform_id_temp1").spinner({ step:spinner_step});
1256
- var myu = t;
1257
- jQuery(document).ready(function () {
1258
- jQuery("#" + myu + "_mini_label_from").click(function () {
1259
- if (jQuery(this).children('input').length == 0) {
1260
- var from = "<input type='text' id='from' class='from' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\"" + jQuery(this).text() + "\">";
1261
- jQuery(this).html(from);
1262
- jQuery("input.from").focus();
1263
- jQuery("input.from").blur(function () {
1264
- var id_for_blur = document.getElementById('from').parentNode.id.split('_');
1265
- var value = jQuery(this).val();
1266
- jQuery("#" + id_for_blur[0] + "_mini_label_from").text(value);
1267
- });
1268
- }
1269
- });
1270
- jQuery("label#" + myu + "_mini_label_to").click(function () {
1271
- if (jQuery(this).children('input').length == 0) {
1272
- var to = "<input type='text' id='to' class='to' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\"" + jQuery(this).text() + "\">";
1273
- jQuery(this).html(to);
1274
- jQuery("input.to").focus();
1275
- jQuery("input.to").blur(function () {
1276
- var id_for_blur = document.getElementById('to').parentNode.id.split('_');
1277
- var value = jQuery(this).val();
1278
- jQuery("#" + id_for_blur[0] + "_mini_label_to").text(value);
1279
- });
1280
- }
1281
- });
1282
- });
1283
- }
1284
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_date_range") {
1285
- var default_date_start = jQuery("#"+t+"_default_date_id_temp_start").val();
1286
- var default_date_end = jQuery("#"+t+"_default_date_id_temp_end").val();
1287
- var date_format = jQuery("#"+t+"_buttonform_id_temp").attr('format');
1288
-
1289
-
1290
-
1291
- jQuery("#"+t+"_elementform_id_temp0").datepicker();
1292
- jQuery("#"+t+"_elementform_id_temp1").datepicker();
1293
- jQuery("#"+t+"_elementform_id_temp0").datepicker("option", "dateFormat", date_format);
1294
- jQuery("#"+t+"_elementform_id_temp1").datepicker("option", "dateFormat", date_format);
1295
-
1296
-
1297
- if(default_date_start =="today")
1298
- jQuery("#"+t+"_elementform_id_temp0").datepicker("setDate", new Date());
1299
- else if(default_date_start.indexOf("d") == -1 && default_date_start.indexOf("m") == -1 && default_date_start.indexOf("y") == -1 && default_date_start.indexOf("w") == -1){
1300
- if(default_date_start !== "")
1301
- default_date_start = jQuery.datepicker.formatDate(date_format, new Date(default_date_start));
1302
- jQuery("#"+t+"_elementform_id_temp0").datepicker("setDate", default_date_start);
1303
- }
1304
- else
1305
- jQuery("#"+t+"_elementform_id_temp0").datepicker("setDate", default_date_start);
1306
-
1307
-
1308
- if(default_date_end =="today")
1309
- jQuery("#"+t+"_elementform_id_temp1").datepicker("setDate", new Date());
1310
- else if(default_date_end.indexOf("d") == -1 && default_date_end.indexOf("m") == -1 && default_date_end.indexOf("y") == -1 && default_date_end.indexOf("w") == -1){
1311
- if(default_date_end !== "")
1312
- default_date_end = jQuery.datepicker.formatDate(date_format, new Date(default_date_end));
1313
- jQuery("#"+t+"_elementform_id_temp1").datepicker("setDate", default_date_end);
1314
- }
1315
- else
1316
- jQuery("#"+t+"_elementform_id_temp1").datepicker("setDate", default_date_end);
1317
- }
1318
-
1319
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_date_new") {
1320
- var default_date = jQuery("#"+t+"_default_date_id_temp").val();
1321
- var date_format = jQuery("#"+t+"_buttonform_id_temp").attr('format');
1322
- jQuery("#"+t+"_elementform_id_temp").datepicker();
1323
- jQuery("#"+t+"_elementform_id_temp").datepicker("option", "dateFormat", date_format);
1324
-
1325
-
1326
- if(default_date =="today")
1327
- jQuery("#"+t+"_elementform_id_temp").datepicker("setDate", new Date());
1328
- else if(default_date.indexOf("d") == -1 && default_date.indexOf("m") == -1 && default_date.indexOf("y") == -1 && default_date.indexOf("w") == -1){
1329
- if(default_date !== "")
1330
- default_date = jQuery.datepicker.formatDate(date_format, new Date(default_date));
1331
- jQuery("#"+t+"_elementform_id_temp").datepicker("setDate", default_date);
1332
- }
1333
- else
1334
- jQuery("#"+t+"_elementform_id_temp").datepicker("setDate", default_date);
1335
-
1336
-
1337
-
1338
- }
1339
- else if (document.getElementById(t + "_typeform_id_temp").value == "type_phone_new") {
1340
-
1341
-
1342
- jQuery("#"+t+"_elementform_id_temp").intlTelInput({
1343
- nationalMode: false,
1344
- preferredCountries: [ jQuery("#"+t+"_elementform_id_temp").attr("top-country") ],
1345
- });
1346
- jQuery("#"+t+"_elementform_id_temp").intlTelInput("setNumber", jQuery("#"+t+"_elementform_id_temp").val());
1347
-
1348
- }
1349
- }
1350
- }
1351
-
1352
- remove_whitespace(document.getElementById('take'));
1353
- form_view = 1;
1354
- form_view_count = 0;
1355
-
1356
- for (i = 1; i <= 30; i++) {
1357
- if (document.getElementById('form_id_tempform_view' + i)) {
1358
- form_view_count++;
1359
- form_view_max = i;
1360
- tbody_img = document.createElement('div');
1361
- tbody_img.setAttribute('id', 'form_id_tempform_view_img' + i);
1362
- tbody_img.style.cssText = "float:right";
1363
- tr_img = document.createElement('div');
1364
- var img = document.createElement('img');
1365
- img.setAttribute('src', '<?php echo WD_FM_URL; ?>/images/minus.png?ver=<?php echo WD_FM_VERSION; ?>');
1366
- img.setAttribute('title', 'Show or hide the page');
1367
- img.setAttribute("class", "page_toolbar");
1368
- img.setAttribute('id', 'show_page_img_' + i);
1369
- img.setAttribute('onClick', 'show_or_hide("' + i + '")');
1370
- img.setAttribute("onmouseover", 'chnage_icons_src(this,"minus")');
1371
- img.setAttribute("onmouseout", 'chnage_icons_src(this,"minus")');
1372
- var img_X = document.createElement("img");
1373
- img_X.setAttribute("src", "<?php echo WD_FM_URL; ?>/images/page_delete.png?ver=<?php echo WD_FM_VERSION; ?>");
1374
- img_X.setAttribute('title', 'Delete the page');
1375
- img_X.setAttribute("class", "page_toolbar");
1376
- img_X.setAttribute("onclick", 'remove_page("' + i + '")');
1377
- img_X.setAttribute("onmouseover", 'chnage_icons_src(this,"page_delete")');
1378
- img_X.setAttribute("onmouseout", 'chnage_icons_src(this,"page_delete")');
1379
- var img_X_all = document.createElement("img");
1380
- img_X_all.setAttribute("src", "<?php echo WD_FM_URL; ?>/images/page_delete_all.png?ver=<?php echo WD_FM_VERSION; ?>");
1381
- img_X_all.setAttribute('title', 'Delete the page with fields');
1382
- img_X_all.setAttribute("class", "page_toolbar");
1383
- img_X_all.setAttribute("onclick", 'remove_page_all("' + i + '")');
1384
- img_X_all.setAttribute("onmouseover", 'chnage_icons_src(this,"page_delete_all")');
1385
- img_X_all.setAttribute("onmouseout", 'chnage_icons_src(this,"page_delete_all")');
1386
- var img_EDIT = document.createElement("img");
1387
- img_EDIT.setAttribute("src", "<?php echo WD_FM_URL; ?>/images/page_edit.png?ver=<?php echo WD_FM_VERSION; ?>");
1388
- img_EDIT.setAttribute('title', 'Edit the page');
1389
- img_EDIT.setAttribute("class", "page_toolbar");
1390
- img_EDIT.setAttribute("onclick", 'edit_page_break("' + i + '")');
1391
- img_EDIT.setAttribute("onmouseover", 'chnage_icons_src(this,"page_edit")');
1392
- img_EDIT.setAttribute("onmouseout", 'chnage_icons_src(this,"page_edit")');
1393
- tr_img.appendChild(img);
1394
- tr_img.appendChild(img_X);
1395
- tr_img.appendChild(img_X_all);
1396
- tr_img.appendChild(img_EDIT);
1397
- tbody_img.appendChild(tr_img);
1398
- document.getElementById('form_id_tempform_view' + i).parentNode.appendChild(tbody_img);
1399
- }
1400
- }
1401
-
1402
- if (form_view_count > 1) {
1403
- for (i = 1; i <= form_view_max; i++) {
1404
- if (document.getElementById('form_id_tempform_view' + i)) {
1405
- first_form_view = i;
1406
- break;
1407
- }
1408
- }
1409
- form_view = form_view_max;
1410
- need_enable = false;
1411
- generate_page_nav(first_form_view);
1412
- var img_EDIT = document.createElement("img");
1413
- img_EDIT.setAttribute("src", "<?php echo WD_FM_URL . '/images/edit.png?ver='.WD_FM_VERSION; ?>");
1414
- img_EDIT.style.cssText = "margin-left:40px; cursor:pointer";
1415
- img_EDIT.setAttribute("onclick", 'el_page_navigation()');
1416
- var td_EDIT = document.getElementById("edit_page_navigation");
1417
- td_EDIT.appendChild(img_EDIT);
1418
- document.getElementById('page_navigation').appendChild(td_EDIT);
1419
- }
1420
- document.getElementById('araqel').value = 1;
1421
- }
1422
- jQuery(window).load(function () {
1423
- formOnload();
1424
- });
1425
- jQuery(function() {
1426
- jQuery('.wdform_section .wdform_column:last-child').each(function() {
1427
- jQuery(this).parent().append(jQuery('<div></div>').addClass("wdform_column"));
1428
- });
1429
-
1430
- sortable_columns();
1431
- if(<?php echo $row->sortable ?>==1) {
1432
- jQuery( ".wdform_arrows" ).hide();
1433
- all_sortable_events();
1434
- }
1435
- else
1436
- jQuery('.wdform_column').sortable( "disable" );
1437
-
1438
- });
1439
- <?php
1440
- } else { ?>
1441
- jQuery(function() {
1442
- jQuery('.wdform_section .wdform_column:last-child').each(function() {
1443
- jQuery(this).parent().append(jQuery('<div></div>').addClass("wdform_column"));
1444
- });
1445
- sortable_columns();
1446
- all_sortable_events();
1447
- });
1448
- <?php } ?>
1449
- </script>
1450
- <input type="hidden" name="option" value="com_formmaker" />
1451
- <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
1452
- <input type="hidden" name="cid[]" value="<?php echo $row->id; ?>" />
1453
- <input type="hidden" id="task" name="task" value=""/>
1454
- <input type="hidden" id="current_id" name="current_id" value="<?php echo $row->id; ?>" />
1455
- </form>
1456
- <?php
1457
- }
1458
-
1459
- public function form_options($id) {
1460
- $addons = array('WD_FM_MAILCHIMP' => 'MailChimp', 'WD_FM_REG' => 'Registration', 'WD_FM_POST_GEN' => 'Post Generation', 'WD_FM_EMAIL_COND' => 'Conditional Emails', 'WD_FM_DBOX_INT' => 'Dropbox Integration', 'WD_FM_GDRIVE_INT' => 'Google Drive Integration','WD_FM_PDF' => 'PDF Integration', 'WD_FM_PUSHOVER' => 'Pushover', 'WD_FM_SAVE_PROG' => 'Save Form Progress', 'WD_FM_CALCULATOR' => 'Calculator');
1461
-
1462
- $row = $this->model->get_row_data($id);
1463
- $themes = $this->model->get_theme_rows_data();
1464
- global $wpdb;
1465
- $default_theme = $wpdb->get_var('SELECT id FROM ' . $wpdb->prefix . 'formmaker_themes where `default`=1');
1466
- $queries = $this->model->get_queries_rows_data($id);
1467
- $userGroups = get_editable_roles();
1468
- $page_title = $row->title . ' form options';
1469
- $label_id = array();
1470
- $label_label = array();
1471
- $label_type = array();
1472
- $label_all = explode('#****#', $row->label_order_current);
1473
- $label_all = array_slice($label_all, 0, count($label_all) - 1);
1474
- foreach ($label_all as $key => $label_each) {
1475
- $label_id_each = explode('#**id**#', $label_each);
1476
- array_push($label_id, $label_id_each[0]);
1477
- $label_order_each = explode('#**label**#', $label_id_each[1]);
1478
- array_push($label_label, $label_order_each[0]);
1479
- array_push($label_type, $label_order_each[1]);
1480
- }
1481
- $fields = explode('*:*id*:*type_submitter_mail*:*type*:*', $row->form_fields);
1482
- $fields_count = count($fields);
1483
- $is_addon_stripe_active = (defined('WD_FM_STRIPE') && is_plugin_active(constant('WD_FM_STRIPE')));
1484
- $payment_method = $row->paypal_mode ? 'paypal' : 'none';
1485
- if ($is_addon_stripe_active) {
1486
- require_once (WD_FM_STRIPE_DIR . '/controller.php');
1487
- $stripe_enable = (int) WD_FM_STRIPE_controller::stripe_enable($id);
1488
- $payment_method = $stripe_enable ? 'stripe' : $payment_method;
1489
- }
1490
- ?>
1491
- <script>
1492
- gen = "<?php echo $row->counter; ?>";
1493
- default_theme = "<?php echo $default_theme; ?>";
1494
- form_view_max = 20;
1495
- function set_preview() {
1496
- theme_id = jQuery('#theme').val() == '0' ? default_theme : jQuery('#theme').val();
1497
- jQuery("#preview_form").attr("onclick", "tb_show('', '<?php echo add_query_arg(array('action' => 'FormMakerPreview', 'form_id' => $row->id, 'form_preview' => 1), admin_url('admin-ajax.php')); ?>&test_theme=" + theme_id + "&width=1000&height=500&TB_iframe=1'); return false;");
1498
- jQuery("#edit_css").attr("onclick", "window.open('<?php echo add_query_arg(array('nonce_fm' => wp_create_nonce('nonce_fm')), admin_url('admin.php?page=themes_fm&task=edit')); ?>&current_id=" + theme_id + "'); return false;");
1499
- if (jQuery('#theme option:selected').attr('data-version') == 1) {
1500
- jQuery("#old_theme_notice").show();
1501
- }
1502
- else {
1503
- jQuery("#old_theme_notice").hide();
1504
- }
1505
- }
1506
-
1507
- function set_condition() {
1508
- field_condition = '';
1509
- for(i=0;i<500;i++) {
1510
- conditions = '';
1511
- if(document.getElementById("condition"+i)) {
1512
- field_condition+=document.getElementById("show_hide"+i).value+"*:*show_hide*:*";
1513
- field_condition+=document.getElementById("fields"+i).value+"*:*field_label*:*";
1514
- field_condition+=document.getElementById("all_any"+i).value+"*:*all_any*:*";
1515
- for(k=0;k<500;k++) {
1516
- if(document.getElementById("condition_div"+i+"_"+k)) {
1517
- conditions+=document.getElementById("field_labels"+i+"_"+k).value+"***";
1518
- conditions+=document.getElementById("is_select"+i+"_"+k).value+"***";
1519
- if(document.getElementById("field_value"+i+"_"+k).tagName=="SELECT" ) {
1520
- if(document.getElementById("field_value"+i+"_"+k).getAttribute('multiple')) {
1521
- var sel = document.getElementById("field_value"+i+"_"+k);
1522
- var selValues = '';
1523
- for(m=0; m < sel.length; m++) {
1524
- if(sel.options[m].selected)
1525
-
1526
- selValues += sel.options[m].value+"@@@";
1527
- }
1528
- conditions+=selValues;
1529
- } else {
1530
- conditions+=document.getElementById("field_value"+i+"_"+k).value;
1531
- }
1532
- }
1533
- else
1534
- conditions+=document.getElementById("field_value"+i+"_"+k).value;
1535
- conditions+="*:*next_condition*:*";
1536
- }
1537
- }
1538
- field_condition+=conditions;
1539
- field_condition+="*:*new_condition*:*";
1540
- }
1541
- }
1542
- document.getElementById('condition').value = field_condition;
1543
- }
1544
-
1545
- function show_verify_options(s){
1546
- if(s){
1547
- jQuery(".verification_div").removeAttr( "style" );
1548
- jQuery(".expire_link").removeAttr( "style" );
1549
-
1550
- } else{
1551
- jQuery(".verification_div").css( 'display', 'none' );
1552
- jQuery(".expire_link").css( 'display', 'none' );
1553
- }
1554
- }
1555
- </script>
1556
- <style>
1557
- .CodeMirror {
1558
- border: 1px solid #ccc;
1559
- font-size: 12px;
1560
- margin-bottom: 6px;
1561
- background: white;
1562
- }
1563
- </style>
1564
- <form class="wrap" method="post" action="admin.php?page=manage_fm" name="adminForm" id="adminForm">
1565
- <?php wp_nonce_field('nonce_fm', 'nonce_fm'); ?>
1566
- <div class="fm-page-header">
1567
- <div class="fm-page-title" style="width: inherit;">
1568
- <?php echo $page_title; ?>
1569
- </div>
1570
- <div class="fm-page-actions">
1571
- <button class="fm-button save-button medium" onclick="if (fm_check_email('mailToAdd') ||fm_check_email('from_mail') || fm_check_email('reply_to') || fm_check_email('mail_from_user') || fm_check_email('reply_to_user') || fm_check_email('mail_from_other') || fm_check_email('reply_to_other') || fm_check_email('paypal_email') || check_stripe_required_fields() || check_calculator_required_fields()) {return false;}; wd_fm_apply_options('save_options');">
1572
- <span></span>
1573
- Save
1574
- </button>
1575
- <button class="fm-button apply-button medium" onclick="if (fm_check_email('mailToAdd') || fm_check_email('from_mail') || fm_check_email('reply_to') || fm_check_email('mail_from_user') || fm_check_email('reply_to_user') || fm_check_email('mail_from_other') || fm_check_email('reply_to_other') || fm_check_email('paypal_email') || check_stripe_required_fields() || check_calculator_required_fields()) {return false;}; wd_fm_apply_options('apply_options');">
1576
- <span></span>
1577
- Apply
1578
- </button>
1579
- <button class="fm-button cancel-button medium" onclick="fm_set_input_value('task', 'cancel_options');">
1580
- <span></span>
1581
- Cancel
1582
- </button>
1583
- </div>
1584
- <div class="fm-clear"></div>
1585
- </div>
1586
- <div class="fm-form-options">
1587
- <div class="submenu-box">
1588
- <div class="submenu-pad">
1589
- <ul id="submenu" class="configuration">
1590
- <li>
1591
- <a id="general" class="fm_fieldset_tab" onclick="form_maker_options_tabs('general')" href="#">General Options</a>
1592
- </li>
1593
- <li>
1594
- <a id="email" class="fm_fieldset_tab" onclick="form_maker_options_tabs('email')" href="#">Email Options</a>
1595
- </li>
1596
- <li>
1597
- <a id="actions" class="fm_fieldset_tab" onclick="form_maker_options_tabs('actions')" href="#">Actions after Submission</a>
1598
- </li>
1599
- <li>
1600
- <a id="payment" class="fm_fieldset_tab" onclick="form_maker_options_tabs('payment')" href="#">Payment Options</a>
1601
- </li>
1602
- <li>
1603
- <a id="javascript" class="fm_fieldset_tab" onclick="form_maker_options_tabs('javascript'); codemirror_for_javascript();" href="#">JavaScript</a>
1604
- </li>
1605
- <li>
1606
- <a id="conditions" class="fm_fieldset_tab" onclick="form_maker_options_tabs('conditions')" href="#">Conditional Fields</a>
1607
- </li>
1608
- <li>
1609
- <a id="mapping" class="fm_fieldset_tab" onclick="form_maker_options_tabs('mapping')" href="#" >MySQL Mapping</a>
1610
- </li>
1611
- <?php
1612
- foreach($addons as $addon => $addon_name) {
1613
- if (defined($addon) && is_plugin_active(constant($addon))) {
1614
- ?>
1615
- <li>
1616
- <a id="<?php echo $addon;?>" class="fm_fieldset_tab" onclick="form_maker_options_tabs('<?php echo $addon;?>')" href="#" ><?php echo $addon_name;?></a>
1617
- </li>
1618
- <?php
1619
- }
1620
- }
1621
- ?>
1622
- </ul>
1623
- </div>
1624
- </div>
1625
- <fieldset id="general_fieldset" class="adminform fm_fieldset_deactive">
1626
- <legend>General Options</legend>
1627
- <table class="admintable" style="float: left;">
1628
- <tr valign="top">
1629
- <td class="fm_options_label">
1630
- <label>Published</label>
1631
- </td>
1632
- <td class="fm_options_value">
1633
- <button class="fm-checkbox-radio-button <?php echo $row->published == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->published; ?>">
1634
- <span></span>
1635
- </button>
1636
- <input type="hidden" name="published" value="<?php echo $row->published; ?>"/>
1637
- </td>
1638
- </tr>
1639
- <tr valign="top">
1640
- <td class="fm_options_label">
1641
- <label>Save data(to database)</label>
1642
- </td>
1643
- <td class="fm_options_value">
1644
- <button class="fm-checkbox-radio-button <?php echo $row->savedb == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->savedb; ?>">
1645
- <span></span>
1646
- </button>
1647
- <input type="hidden" name="savedb" value="<?php echo $row->savedb; ?>"/>
1648
- </td>
1649
- </tr>
1650
- <tr valign="top">
1651
- <td class="fm_options_label">
1652
- <label for="theme">Theme</label>
1653
- </td>
1654
- <td class="fm_options_value">
1655
- <select id="theme" name="theme" onChange="set_preview()">
1656
- <optgroup label="New Themes">
1657
- <option value="0" <?php echo $row->theme && $row->theme == 0 ? 'selected' : '' ?> data-version="2">Inherit From Website Theme</option>
1658
- <?php
1659
- $optiongroup = true;
1660
- foreach ($themes as $theme) {
1661
- if ($optiongroup && $theme->version == 1) {
1662
- $optiongroup = false;
1663
- ?>
1664
- </optgroup>
1665
- <optgroup label="Outdated Themes">
1666
- <?php
1667
- }
1668
- ?>
1669
- <option value="<?php echo $theme->id; ?>" <?php echo (($theme->id == $row->theme) ? 'selected' : ''); ?> data-version="<?php echo $theme->version; ?>"><?php echo $theme->title; ?></option>
1670
- <?php
1671
- }
1672
- ?>
1673
- </optgroup>
1674
- </select>
1675
- <button id="preview_form" class="fm-button preview-button medium" onclick="tb_show('', '<?php echo add_query_arg(array('action' => 'FormMakerPreview', 'form_id' => $row->id, 'test_theme' => $row->theme, 'form_preview' => 1, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>'); return false;">
1676
- <span></span>
1677
- Preview
1678
- </button>
1679
- <button id="edit_css" class="fm-button options-edit-button medium" onclick="window.open('<?php echo add_query_arg(array('current_id' => ($row->theme && $row->theme != '0' ? $row->theme : $default_theme), 'nonce_fm' => wp_create_nonce('nonce_fm')), admin_url('admin.php?page=themes_fm&task=edit')); ?>'); return false;">
1680
- <span></span>
1681
- Edit
1682
- </button>
1683
- <div id="old_theme_notice" class="wd_error" style="display: none;">The theme you have selected is outdated. Please choose one from New Themes section.</div>
1684
- </td>
1685
- </tr>
1686
- <tr valign="top">
1687
- <td class="fm_options_label">
1688
- <label for="requiredmark">Required fields mark</label>
1689
- </td>
1690
- <td class="fm_options_value">
1691
- <input type="text" id="requiredmark" name="requiredmark" value="<?php echo $row->requiredmark; ?>" style="width:250px;" />
1692
- </td>
1693
- </tr>
1694
- <tr valign="top">
1695
- <td class="fm_options_label">
1696
- <label>Save Uploads</label>
1697
- </td>
1698
- <td class="fm_options_value">
1699
- <button class="fm-checkbox-radio-button <?php echo $row->save_uploads == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->save_uploads; ?>">
1700
- <span></span>
1701
- </button>
1702
- <input type="hidden" name="save_uploads" value="<?php echo $row->save_uploads; ?>"/>
1703
- </td>
1704
- </tr>
1705
- </table>
1706
- <br/>
1707
- <div class="error_fm" style="padding: 5px; font-size: 14px;">Front end submissions are disabled in free version.</div>
1708
- <fieldset class="adminform">
1709
- <legend>Front end submissions access level</legend>
1710
- <table>
1711
- <tr>
1712
- <td class="key">
1713
- <label for="name">Allow User to see submissions:</label>
1714
- </td>
1715
- <td>
1716
- <?php
1717
- $checked_UserGroup=explode(',',$row->user_id_wd);
1718
- $i = 0;
1719
- foreach($userGroups as $val => $uG) {
1720
- echo '<input type="checkbox" value="'.$val .'" id="user_'.$i.'"';
1721
- if(in_array($val ,$checked_UserGroup))
1722
- echo 'checked="checked"';
1723
- echo 'onchange="acces_level('.count($userGroups).')" disabled/><label for="user_'.$i.'">'.$uG["name"].'</label><br>';
1724
- $i++;
1725
- }
1726
- ?>
1727
- <input type="checkbox" value="guest" id="user_<?php echo $i; ?>" onchange="acces_level(<?php echo count($userGroups); ?>)"<?php echo (in_array('guest', $checked_UserGroup) ? 'checked="checked"' : '') ?> disabled/><label for="user_<?php echo $i; ?>">Guest</label>
1728
- <input type="hidden" name="user_id_wd" value="<?php echo $row->user_id_wd ?>" id="user_id_wd" />
1729
- </td>
1730
- </tr>
1731
- </table>
1732
- </fieldset>
1733
- <?php
1734
- $labels_for_submissions = $this->model->get_labels($id);
1735
- $payment_info = $this->model->is_paypal($id);
1736
- $labels_id_for_submissions= array();
1737
- $label_titles_for_submissions=array();
1738
- $labels_type_for_submissions= array();
1739
- if($labels_for_submissions) {
1740
- $label_id_for_submissions= array();
1741
- $label_order_original_for_submissions= array();
1742
- $label_type_for_submissions= array();
1743
-
1744
- if(strpos($row->label_order, 'type_paypal_')) {
1745
- $row->label_order=$row->label_order."item_total#**id**#Item Total#**label**#type_paypal_payment_total#****#total#**id**#Total#**label**#type_paypal_payment_total#****#0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
1746
- }
1747
-
1748
- $label_all_for_submissions = explode('#****#',$row->label_order);
1749
- $label_all_for_submissions = array_slice($label_all_for_submissions,0, count($label_all_for_submissions)-1);
1750
- foreach($label_all_for_submissions as $key => $label_each) {
1751
- $label_id_each=explode('#**id**#',$label_each);
1752
- array_push($label_id_for_submissions, $label_id_each[0]);
1753
- $label_order_each=explode('#**label**#', $label_id_each[1]);
1754
- array_push($label_order_original_for_submissions, $label_order_each[0]);
1755
- array_push($label_type_for_submissions, $label_order_each[1]);
1756
- }
1757
-
1758
- foreach($label_id_for_submissions as $key => $label) {
1759
- if(in_array($label, $labels_for_submissions)) {
1760
- array_push($labels_type_for_submissions, $label_type_for_submissions[$key]);
1761
- array_push($labels_id_for_submissions, $label);
1762
- array_push($label_titles_for_submissions, $label_order_original_for_submissions[$key]);
1763
- }
1764
- }
1765
- }
1766
-
1767
- $stats_labels = array();
1768
- $stats_labels_ids = array();
1769
- foreach($labels_type_for_submissions as $key => $label_type_cur) {
1770
- if($label_type_cur=="type_checkbox" || $label_type_cur=="type_radio" || $label_type_cur=="type_own_select" || $label_type_cur=="type_country" || $label_type_cur=="type_paypal_select" || $label_type_cur=="type_paypal_radio" || $label_type_cur=="type_paypal_checkbox" || $label_type_cur=="type_paypal_shipping") {
1771
- $stats_labels_ids[] = $labels_id_for_submissions[$key];
1772
- $stats_labels[] = $label_titles_for_submissions[$key];
1773
- }
1774
- }
1775
- ?>
1776
- <script type="text/javascript">
1777
- function inArray(needle, myarray) {
1778
- var length = myarray.length;
1779
- for(var i = 0; i < length; i++) {
1780
- if(myarray[i] == needle) return true;
1781
- }
1782
- return false;
1783
- }
1784
-
1785
- function checked_labels(class_name) {
1786
- var checked_ids ='';
1787
- jQuery('.'+class_name).each(function() {
1788
- if(this.checked) {
1789
- checked_ids += this.value+',';
1790
- }
1791
- });
1792
-
1793
- if(class_name == 'filed_label') {
1794
- document.getElementById("frontend_submit_fields").value = checked_ids ;
1795
- if(checked_ids == document.getElementById("all_fields").value)
1796
- document.getElementById("all_fields").checked = true;
1797
- else
1798
- document.getElementById("all_fields").checked = false;
1799
- }
1800
- else {
1801
- document.getElementById("frontend_submit_stat_fields").value = checked_ids ;
1802
- if(checked_ids == document.getElementById("all_stats_fields").value)
1803
- document.getElementById("all_stats_fields").checked = true;
1804
- else
1805
- document.getElementById("all_stats_fields").checked = false;
1806
- }
1807
- }
1808
-
1809
- jQuery(document).ready(function () {
1810
- jQuery('.filed_label').each(function() {
1811
- if(document.getElementById("frontend_submit_fields").value == document.getElementById("all_fields").value)
1812
- document.getElementById("all_fields").checked = true;
1813
- if(inArray(this.value, document.getElementById("frontend_submit_fields").value.split(","))) {
1814
- this.checked = true;
1815
- }
1816
- });
1817
-
1818
- jQuery('.stats_filed_label').each(function() {
1819
- if(document.getElementById("frontend_submit_stat_fields").value == document.getElementById("all_stats_fields").value)
1820
- document.getElementById("all_stats_fields").checked = true;
1821
- if(inArray(this.value, document.getElementById("frontend_submit_stat_fields").value.split(","))) {
1822
- this.checked = true;
1823
- }
1824
- });
1825
-
1826
- jQuery(document).on('change','input[name="all_fields"]',function() {
1827
- jQuery('.filed_label').prop("checked" , this.checked);
1828
- });
1829
-
1830
- jQuery(document).on('change','input[name="all_stats_fields"]',function() {
1831
- jQuery('.stats_filed_label').prop("checked" , this.checked);
1832
- });
1833
- set_preview();
1834
- });
1835
- </script>
1836
- <style>
1837
- li{
1838
- list-style-type: none;
1839
- }
1840
-
1841
- .simple_table {
1842
- padding-left: 0px !important;
1843
- }
1844
-
1845
- .simple_table input, .simple_table label, .simple_table img {
1846
- display:inline-block !important;
1847
- float:none !important;
1848
- }
1849
- </style>
1850
- <fieldset class="adminform">
1851
- <legend>Fields to hide in frontend submissions</legend>
1852
- <?php if(count($label_titles_for_submissions)): ?>
1853
- <table style="margin-left:-3px;">
1854
- <tr>
1855
- <td>
1856
- <label>Select fields:</label>
1857
- </td>
1858
- <td class="simple_table">
1859
- <ul id="form_fields">
1860
- <li>
1861
- <input type="checkbox" name="all_fields" id="all_fields" value="submit_id,<?php echo implode(',',$labels_id_for_submissions)."," . ($payment_info ? "payment_info" : ""); ?>" onclick="checked_labels('filed_label')"/>
1862
- <label for="all_fields">Select All</label>
1863
- </li>
1864
- <?php
1865
- echo "<li><input type=\"checkbox\" id=\"submit_id\" name=\"submit_id\" value=\"submit_id\" class=\"filed_label\" onclick=\"checked_labels('filed_label')\"><label for=\"submit_id\">ID</label></li>";
1866
-
1867
- for($i=0, $n=count($label_titles_for_submissions); $i < $n ; $i++)
1868
- {
1869
- $field_label = $label_titles_for_submissions[$i];
1870
-
1871
- echo "<li><input type=\"checkbox\" id=\"filed_label".$i."\" name=\"filed_label".$i."\" value=\"".$labels_id_for_submissions[$i]."\" class=\"filed_label\" onclick=\"checked_labels('filed_label')\"><label for=\"filed_label".$i."\">".(strlen($field_label) > 80 ? substr ($field_label ,0, 80).'...' : $field_label)."</label></li>";
1872
-
1873
- }
1874
- if($payment_info)
1875
- echo "<li><input type=\"checkbox\" id=\"payment_info\" name=\"payment_info\" value=\"payment_info\" class=\"filed_label\" onclick=\"checked_labels('filed_label')\"><label for=\"payment_info\">Payment Info</label></li>";
1876
- ?>
1877
- </ul>
1878
- <input type="hidden" name="frontend_submit_fields" value="<?php echo $row->frontend_submit_fields ?>" id="frontend_submit_fields" />
1879
- </td>
1880
- </tr>
1881
- <?php if($stats_labels): ?>
1882
- <tr id="stats">
1883
- <td>
1884
- <label>Stats fields:</label>
1885
- </td>
1886
- <td class="simple_table">
1887
- <ul id="stats_fields">
1888
- <li>
1889
- <input type="checkbox" name="all_stats_fields" id="all_stats_fields" value="<?php echo implode(',',$stats_labels_ids).","; ?>" onclick="checked_labels('stats_filed_label')">
1890
- <label for="all_stats_fields">Select All</label>
1891
- </li>
1892
- <?php
1893
- for($i=0, $n=count($stats_labels); $i < $n ; $i++)
1894
- {
1895
- $field_label = $stats_labels[$i];
1896
- echo "<li><input type=\"checkbox\" id=\"stats_filed_label".$i."\" name=\"stats_filed_label".$i."\" value=\"".$stats_labels_ids[$i]."\" class=\"stats_filed_label\" onclick=\"checked_labels('stats_filed_label')\" ><label for=\"stats_filed_label".$i."\">".(strlen($field_label) > 80 ? substr ($field_label ,0, 80).'...' : $field_label)."</label></li>";
1897
- }
1898
- ?>
1899
- </ul>
1900
- <input type="hidden" name="frontend_submit_stat_fields" value="<?php echo $row->frontend_submit_stat_fields ?>" id="frontend_submit_stat_fields" />
1901
- </td>
1902
- </tr>
1903
- <?php endif; ?>
1904
- </table>
1905
- <?php endif; ?>
1906
- </fieldset>
1907
- </fieldset>
1908
- <fieldset id="email_fieldset" class="adminform fm_fieldset_deactive">
1909
- <legend>Email Options</legend>
1910
- <table class="admintable">
1911
- <tr valign="top">
1912
- <td style="width: 75px; vertical-align: middle;">
1913
- <label>Send E-mail</label>
1914
- </td>
1915
- <td style="padding: 15px;">
1916
- <button class="fm-checkbox-radio-button <?php echo $row->sendemail == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->sendemail; ?>">
1917
- <span></span>
1918
- </button>
1919
- <input type="hidden" name="sendemail" value="<?php echo $row->sendemail; ?>"/>
1920
- </td>
1921
- </tr>
1922
- </table>
1923
- <fieldset class="adminform fm_mail_options">
1924
- <legend>Email to Administrator</legend>
1925
- <table class="admintable">
1926
- <tr valign="top">
1927
- <td class="fm_options_label">
1928
- <label for="mailToAdd">Email to send submissions to</label>
1929
- </td>
1930
- <td class="fm_options_value">
1931
- <input type="text" id="mailToAdd" name="mailToAdd" style="width: 250px;" />
1932
- <input type="hidden" id="mail" name="mail" value="<?php echo $row->mail . ($row->mail && (substr($row->mail, -1) != ',') ? ',' : ''); ?>" />
1933
- <img src="<?php echo WD_FM_URL . '/images/add.png?ver='. WD_FM_VERSION; ?>" style="vertical-align: middle; cursor: pointer;" title="Add more emails" onclick="if (fm_check_email('mailToAdd')) {return false;};cfm_create_input('mail', 'mailToAdd', 'cfm_mail_div', '<?php echo WD_FM_URL; ?>')" />
1934
- <div id="cfm_mail_div">
1935
- <?php
1936
- $mail_array = explode(',', $row->mail);
1937
- foreach ($mail_array as $mail) {
1938
- if ($mail && $mail != ',') {
1939
- ?>
1940
- <div class="fm_mail_input">
1941
- <?php echo $mail; ?>
1942
- <img src="<?php echo WD_FM_URL; ?>/images/delete.png?ver=<?php echo WD_FM_VERSION; ?>" class="fm_delete_img" onclick="fm_delete_mail(this, '<?php echo $mail; ?>')" title="Delete Email" />
1943
- </div>
1944
- <?php
1945
- }
1946
- }
1947
- ?>
1948
- </div>
1949
- </td>
1950
- </tr>
1951
- <tr valign="top">
1952
- <td class="fm_options_label">
1953
- <label for="from_mail">Email From</label>
1954
- </td>
1955
- <td class="fm_options_value">
1956
- <?php
1957
- $is_other = TRUE;
1958
- for ($i = 0; $i < $fields_count - 1; $i++) {
1959
- ?>
1960
- <div>
1961
- <input type="radio" name="from_mail" id="from_mail<?php echo $i; ?>" value="<?php echo (!is_numeric($fields[$i]) ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*')+15, strlen($fields[$i])) : $fields[$i]); ?>" <?php echo ((!is_numeric($fields[$i]) ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*')+15, strlen($fields[$i])) : $fields[$i]) == $row->from_mail ? 'checked="checked"' : '' ); ?> onclick="wdhide('mail_from_other')" />
1962
- <label for="from_mail<?php echo $i; ?>"><?php echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*')); ?></label>
1963
- </div>
1964
- <?php
1965
- if(!is_numeric($fields[$i])) {
1966
- if (substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) == $row->from_mail) {
1967
- $is_other = FALSE;
1968
- }
1969
- }
1970
- else {
1971
- if($fields[$i] == $row->from_mail)
1972
- $is_other=false;
1973
- }
1974
- }
1975
- ?>
1976
- <div style="<?php echo ($fields_count == 1) ? 'display:none;' : ''; ?>">
1977
- <input type="radio" id="other" name="from_mail" value="other" <?php echo ($is_other) ? 'checked="checked"' : ''; ?> onclick="wdshow('mail_from_other')" />
1978
- <label for="other">Other</label>
1979
- </div>
1980
- <input type="text" style="width: <?php echo ($fields_count == 1) ? '250px' : '235px; margin-left: 15px' ?>; display: <?php echo ($is_other) ? 'block;' : 'none;'; ?>" id="mail_from_other" name="mail_from_other" value="<?php echo ($is_other) ? $row->from_mail : ''; ?>" />
1981
- </td>
1982
- </tr>
1983
- <tr valign="top">
1984
- <td class="fm_options_label">
1985
- <label for="from_name">From Name</label>
1986
- </td>
1987
- <td class="fm_options_value">
1988
- <input type="text" id="from_name" name="from_name" value="<?php echo $row->from_name; ?>" style="width: 250px;" />
1989
- <img src="<?php echo WD_FM_URL . '/images/add.png?ver='. WD_FM_VERSION.''; ?>" onclick="document.getElementById('mail_from_labels').style.display='block';" style="vertical-align: middle; cursor: pointer;display:inline-block; margin:0px; float:none;">
1990
- <?php
1991
- $choise = "document.getElementById('from_name')";
1992
- echo '<div style="position:relative; top:-3px;"><div id="mail_from_labels" class="email_labels" style="display:none;">';
1993
- echo "<a onClick=\"insertAtCursor(".$choise.",'username'); document.getElementById('mail_from_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
1994
- for($i=0; $i<count($label_label); $i++) {
1995
- if($label_type[$i]=="type_submit_reset" || $label_type[$i]=="type_editor" || $label_type[$i]=="type_map" || $label_type[$i]=="type_mark_map" || $label_type[$i]=="type_captcha"|| $label_type[$i]=="type_recaptcha" || $label_type[$i]=="type_button" || $label_type[$i]=="type_file_upload" || $label_type[$i]=="type_send_copy" || $label_type[$i]=="type_matrix")
1996
- continue;
1997
-
1998
- $param = htmlspecialchars(addslashes($label_label[$i]));
1999
- $fld_label = $param;
2000
- if(strlen($fld_label)>30) {
2001
- $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2002
- $fld_label = explode("\n", $fld_label);
2003
- $fld_label = $fld_label[0] . ' ...';
2004
- }
2005
-
2006
- echo "<a onClick=\"insertAtCursor(".$choise.",'".$param."'); document.getElementById('mail_from_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">".$fld_label."</a>";
2007
- }
2008
- echo "<a onClick=\"insertAtCursor(".$choise.",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
2009
-
2010
- echo "<a onClick=\"insertAtCursor(".$choise.",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
2011
- echo '</div></div>';
2012
- ?>
2013
- </td>
2014
- </tr>
2015
- <tr valign="top">
2016
- <td class="fm_options_label">
2017
- <label for="reply_to">Reply to<br/>(if different from "Email From") </label>
2018
- </td>
2019
- <td class="fm_options_value">
2020
- <?php
2021
- $is_other = TRUE;
2022
- for ($i = 0; $i < $fields_count - 1; $i++) {
2023
- ?>
2024
- <div>
2025
- <input type="radio" name="reply_to" id="reply_to<?php echo $i; ?>" value="<?php echo (!is_numeric($fields[$i]) ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*')+15, strlen($fields[$i])) : $fields[$i]); ?>" <?php echo ((!is_numeric($fields[$i]) ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*')+15, strlen($fields[$i])) : $fields[$i]) == $row->reply_to ? 'checked="checked"' : '' ); ?> onclick="wdhide('reply_to_other')" />
2026
- <label for="reply_to<?php echo $i; ?>"><?php echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*')); ?></label>
2027
- </div>
2028
- <?php
2029
- if(!is_numeric($fields[$i])) {
2030
- if (substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) == $row->reply_to) {
2031
- $is_other = FALSE;
2032
- }
2033
- }
2034
- else {
2035
- if($fields[$i] == $row->reply_to)
2036
- $is_other=false;
2037
- }
2038
- }
2039
- ?>
2040
- <div style="<?php echo ($fields_count == 1) ? 'display: none;' : ''; ?>">
2041
- <input type="radio" id="other1" name="reply_to" value="other" <?php echo ($is_other) ? 'checked="checked"' : ''; ?> onclick="wdshow('reply_to_other')" />
2042
- <label for="other1">Other</label>
2043
- </div>
2044
- <input type="text" style="width: <?php echo ($fields_count == 1) ? '250px' : '235px; margin-left: 15px'; ?>; display: <?php echo ($is_other) ? 'block;' : 'none;'; ?>" id="reply_to_other" name="reply_to_other" value="<?php echo ($is_other && $row->reply_to) ? $row->reply_to : ''; ?>" />
2045
- </td>
2046
- </tr>
2047
- <tr valign="top">
2048
- <td class="fm_options_label">
2049
- <label> CC: </label>
2050
- </td>
2051
- <td class="fm_options_value">
2052
- <input type="text" id="mail_cc" name="mail_cc" value="<?php echo $row->mail_cc ?>" style="width:250px;" />
2053
- </td>
2054
- </tr>
2055
- <tr valign="top">
2056
- <td class="fm_options_label">
2057
- <label> BCC: </label>
2058
- </td>
2059
- <td class="fm_options_value">
2060
- <input type="text" id="mail_bcc" name="mail_bcc" value="<?php echo $row->mail_bcc ?>" style="width:250px;" />
2061
- </td>
2062
- </tr>
2063
- <tr valign="top">
2064
- <td class="fm_options_label">
2065
- <label> Subject: </label>
2066
- </td>
2067
- <td class="fm_options_value">
2068
- <input type="text" id="mail_subject" name="mail_subject" value="<?php echo $row->mail_subject ?>" style="width:250px;" />
2069
- <img src="<?php echo WD_FM_URL . '/images/add.png?ver='. WD_FM_VERSION.''; ?>" onclick="document.getElementById('mail_subject_labels').style.display='block';" style="vertical-align: middle;cursor: pointer; display:inline-block; margin:0px; float:none;">
2070
- <?php
2071
- $choise = "document.getElementById('mail_subject')";
2072
- echo '<div style="position:relative; top:-3px;"><div id="mail_subject_labels" class="email_labels" style="display:none;">';
2073
- for($i=0; $i<count($label_label); $i++) {
2074
- if($label_type[$i]=="type_submit_reset" || $label_type[$i]=="type_editor" || $label_type[$i]=="type_map" || $label_type[$i]=="type_mark_map" || $label_type[$i]=="type_captcha"|| $label_type[$i]=="type_recaptcha" || $label_type[$i]=="type_button" || $label_type[$i]=="type_file_upload" || $label_type[$i]=="type_send_copy" || $label_type[$i]=="type_matrix")
2075
- continue;
2076
-
2077
- $param = htmlspecialchars(addslashes($label_label[$i]));
2078
-
2079
- $fld_label = $param;
2080
- if(strlen($fld_label)>30)
2081
- {
2082
- $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2083
- $fld_label = explode("\n", $fld_label);
2084
- $fld_label = $fld_label[0] . ' ...';
2085
- }
2086
-
2087
- echo "<a onClick=\"insertAtCursor(".$choise.",'".$param."'); document.getElementById('mail_subject_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">".$fld_label."</a>";
2088
-
2089
- }
2090
- echo "<a onClick=\"insertAtCursor(".$choise.",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
2091
-
2092
- echo "<a onClick=\"insertAtCursor(".$choise.",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
2093
- echo '</div></div>';
2094
- ?>
2095
- </td>
2096
- </tr>
2097
- <tr valign="top">
2098
- <td class="fm_options_label" style="vertical-align: middle;">
2099
- <label> Mode: </label>
2100
- </td>
2101
- <td class="fm_options_value">
2102
- <button name="mail_mode"class="fm-checkbox-radio-button <?php echo $row->mail_mode == 1 ? 'fm-text-yes' : 'fm-text-no' ?> medium" onclick="fm_change_radio_checkbox_text(this); return false;" value="<?php echo $row->mail_mode ?>">
2103
- <label><?php echo $row->mail_mode == 1 ? 'HTML' : 'Text' ?></label>
2104
- <span></span>
2105
- </button>
2106
- <input type="hidden" name="mail_mode" value="<?php echo $row->mail_mode; ?>"/>
2107
- </td>
2108
- </tr>
2109
- <tr valign="top">
2110
- <td class="fm_options_label" style="vertical-align: middle;">
2111
- <label> Attach File: </label>
2112
- </td>
2113
- <td class="fm_options_value">
2114
- <div class="error_fm" style="padding: 5px; font-size: 14px;">File attach is disabled in free version.</div>
2115
- <input type="hidden" name="mail_attachment" value="<?php echo $row->mail_attachment; ?>"/>
2116
- </td>
2117
- </tr>
2118
- <tr valign="top">
2119
- <td class="fm_options_label" style="vertical-align: middle;">
2120
- <label> Email empty fields: </label>
2121
- </td>
2122
- <td class="fm_options_value">
2123
- <button class="fm-checkbox-radio-button <?php echo $row->mail_emptyfields == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->mail_emptyfields; ?>">
2124
- <span></span>
2125
- </button>
2126
- <input type="hidden" name="mail_emptyfields" value="<?php echo $row->mail_emptyfields; ?>"/>
2127
- </td>
2128
- </tr>
2129
- <tr>
2130
- <td class="fm_options_label" valign="top">
2131
- <label>Custom Text in Email For Administrator</label>
2132
- </td>
2133
- <td class="fm_options_value">
2134
- <div style="margin-bottom:5px">
2135
- <?php
2136
- $choise = "document.getElementById('script_mail')";
2137
- for ($i = 0; $i < count($label_label); $i++) {
2138
- if ($label_type[$i]=="type_submit_reset" || $label_type[$i]=="type_editor" || $label_type[$i]=="type_map" || $label_type[$i]=="type_mark_map" || $label_type[$i]=="type_captcha"|| $label_type[$i]=="type_recaptcha" || $label_type[$i]=="type_button" || $label_type[$i]=="type_send_copy")
2139
- continue;
2140
-
2141
- $param = htmlspecialchars(addslashes($label_label[$i]));
2142
- $fld_label = $param;
2143
- if(strlen($fld_label)>30) {
2144
- $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2145
- $fld_label = explode("\n", $fld_label);
2146
- $fld_label = $fld_label[0] . ' ...';
2147
- }
2148
-
2149
- if($label_type[$i]=="type_file_upload") {
2150
- ?>
2151
- <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label.'(as image)'; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param; ?>')" />
2152
- <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label.'(as link)'; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param.'(link)'; ?>')" />
2153
- <?php
2154
- }
2155
- else{
2156
- ?>
2157
- <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param; ?>')" />
2158
- <?php
2159
- }
2160
- }
2161
- ?>
2162
- <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php echo $choise; ?>,'subid')" />
2163
- <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php echo $choise; ?>,'ip')" />
2164
- <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php echo $choise; ?>,'username')" />
2165
- <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php echo $choise; ?>,'useremail')" />
2166
- <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="All fields list" onClick="insertAtCursor(<?php echo $choise; ?>, 'all')" />
2167
- </div>
2168
- <?php
2169
- if (user_can_richedit()) {
2170
- wp_editor($row->script_mail, 'script_mail', array('teeny' => FALSE, 'textarea_name' => 'script_mail', 'media_buttons' => FALSE, 'textarea_rows' => 5));
2171
- }
2172
- else {
2173
- ?>
2174
- <textarea name="script_mail" id="script_mail" cols="20" rows="10" style="width:300px; height:450px;"><?php echo $row->script_mail; ?></textarea>
2175
- <?php
2176
- }
2177
- ?>
2178
- </td>
2179
- </tr>
2180
- </table>
2181
- </fieldset>
2182
- <fieldset class="fm_mail_options">
2183
- <legend>Email to User</legend>
2184
- <table class="admintable">
2185
- <tr valign="top">
2186
- <td class="fm_options_label">
2187
- <label for="mail">Send to</label>
2188
- </td>
2189
- <td class="fm_options_value">
2190
- <?php
2191
-
2192
- $fields = explode('*:*id*:*type_submitter_mail*:*type*:*', $row->form_fields);
2193
- $fields_count = count($fields);
2194
- if ($fields_count == 1) { ?>
2195
- There is no email field
2196
- <?php
2197
- }
2198
- else {
2199
- for ($i = 0; $i < $fields_count - 1; $i++) {
2200
- ?>
2201
- <div>
2202
- <input type="checkbox" name="send_to<?php echo $i; ?>" id="send_to<?php echo $i; ?>" value="<?php echo (!is_numeric($fields[$i]) ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*')+15, strlen($fields[$i])) : $fields[$i]); ?>" <?php echo (is_numeric(strpos($row->send_to, '*'.(!is_numeric($fields[$i]) ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*')+15, strlen($fields[$i])) : $fields[$i]).'*')) ? 'checked="checked"' : '' ); ?> style="margin: 0px 5px 0px 0px;" />
2203
- <label for="send_to<?php echo $i; ?>"><?php echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*')); ?></label>
2204
- </div>
2205
- <?php
2206
- }
2207
- }
2208
- ?>
2209
- </td>
2210
- </tr>
2211
- <tr valign="top">
2212
- <td class="fm_options_label">
2213
- <label for="mail_from_user">Email From</label>
2214
- </td>
2215
- <td class="fm_options_value">
2216
- <input type="text" id="mail_from_user" name="mail_from_user" value="<?php echo $row->mail_from_user; ?>" style="width: 250px;" />
2217
- </td>
2218
- </tr>
2219
- <tr valign="top">
2220
- <td class="fm_options_label">
2221
- <label for="mail_from_name_user">From Name</label>
2222
- </td>
2223
- <td class="fm_options_value">
2224
- <input type="text" id="mail_from_name_user" name="mail_from_name_user" value="<?php echo $row->mail_from_name_user; ?>" style="width: 250px;"/>
2225
- <img src="<?php echo WD_FM_URL . '/images/add.png?ver='. WD_FM_VERSION.''; ?>" onclick="document.getElementById('mail_from_name_user_labels').style.display='block';" style="vertical-align: middle;cursor: pointer; display:inline-block; margin:0px; float:none;">
2226
- <?php
2227
- $choise = "document.getElementById('mail_from_name_user')";
2228
- echo '<div style="position:relative; top:-3px;"><div id="mail_from_name_user_labels" class="email_labels" style="display:none;">';
2229
- for($i=0; $i<count($label_label); $i++) {
2230
- if($label_type[$i]=="type_submit_reset" || $label_type[$i]=="type_editor" || $label_type[$i]=="type_map" || $label_type[$i]=="type_mark_map" || $label_type[$i]=="type_captcha"|| $label_type[$i]=="type_recaptcha" || $label_type[$i]=="type_button" || $label_type[$i]=="type_file_upload" || $label_type[$i]=="type_send_copy")
2231
- continue;
2232
-
2233
- $param = htmlspecialchars(addslashes($label_label[$i]));
2234
- $fld_label = $param;
2235
- if(strlen($fld_label)>30) {
2236
- $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2237
- $fld_label = explode("\n", $fld_label);
2238
- $fld_label = $fld_label[0] . ' ...';
2239
- }
2240
-
2241
- echo "<a onClick=\"insertAtCursor(".$choise.",'".$param."'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">".$fld_label."</a>";
2242
- }
2243
- echo "<a onClick=\"insertAtCursor(".$choise.",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
2244
- echo "<a onClick=\"insertAtCursor(".$choise.",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
2245
- echo '</div></div>';
2246
- ?>
2247
- </td>
2248
- </tr>
2249
- <tr valign="top">
2250
- <td class="fm_options_label">
2251
- <label for="reply_to_user">Reply to<br />(if different from "Email Form")</label>
2252
- </td>
2253
- <td class="fm_options_value">
2254
- <input type="text" id="reply_to_user" name="reply_to_user" value="<?php echo $row->reply_to_user; ?>" style="width:250px;"/>
2255
- </td>
2256
- </tr>
2257
- <tr valign="top">
2258
- <td class="fm_options_label">
2259
- <label> CC: </label>
2260
- </td>
2261
- <td class="fm_options_value">
2262
- <input type="text" id="mail_cc_user" name="mail_cc_user" value="<?php echo $row->mail_cc_user ?>" style="width:250px;" />
2263
- </td>
2264
- </tr>
2265
- <tr valign="top">
2266
- <td class="fm_options_label">
2267
- <label> BCC: </label>
2268
- </td>
2269
- <td class="fm_options_value">
2270
- <input type="text" id="mail_bcc_user" name="mail_bcc_user" value="<?php echo $row->mail_bcc_user ?>" style="width:250px;" />
2271
- </td>
2272
- </tr>
2273
- <tr valign="top">
2274
- <td class="fm_options_label">
2275
- <label> Subject: </label>
2276
- </td>
2277
- <td class="fm_options_value">
2278
- <input type="text" id="mail_subject_user" name="mail_subject_user" value="<?php echo $row->mail_subject_user ?>" style="width:250px;" />
2279
- <img src="<?php echo WD_FM_URL . '/images/add.png?ver='. WD_FM_VERSION.''; ?>" onclick="document.getElementById('mail_subject_user_labels').style.display='block';" style="vertical-align: middle; cursor: pointer; display:inline-block; margin:0px; float:none;">
2280
- <?php
2281
- $choise = "document.getElementById('mail_subject_user')";
2282
- echo '<div style="position:relative; top:-3px;"><div id="mail_subject_user_labels" class="email_labels" style="display:none;">';
2283
- for($i=0; $i<count($label_label); $i++)
2284
- {
2285
- if($label_type[$i]=="type_submit_reset" || $label_type[$i]=="type_editor" || $label_type[$i]=="type_map" || $label_type[$i]=="type_mark_map" || $label_type[$i]=="type_captcha"|| $label_type[$i]=="type_recaptcha" || $label_type[$i]=="type_button" || $label_type[$i]=="type_file_upload" || $label_type[$i]=="type_send_copy")
2286
- continue;
2287
-
2288
- $param = htmlspecialchars(addslashes($label_label[$i]));
2289
-
2290
- $fld_label = $param;
2291
- if(strlen($fld_label)>30)
2292
- {
2293
- $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2294
- $fld_label = explode("\n", $fld_label);
2295
- $fld_label = $fld_label[0] . ' ...';
2296
- }
2297
-
2298
- echo "<a onClick=\"insertAtCursor(".$choise.",'".$param."'); document.getElementById('mail_subject_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">".$fld_label."</a>";
2299
-
2300
- }
2301
- echo "<a onClick=\"insertAtCursor(".$choise.",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
2302
-
2303
- echo "<a onClick=\"insertAtCursor(".$choise.",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
2304
- echo '</div></div>';
2305
- ?>
2306
- </td>
2307
- </tr>
2308
- <tr valign="top">
2309
- <td class="fm_options_label" style="vertical-align: middle;">
2310
- <label> Mode: </label>
2311
- </td>
2312
- <td class="fm_options_value">
2313
- <button name="mail_mode_user"class="fm-checkbox-radio-button <?php echo $row->mail_mode_user == 1 ? 'fm-text-yes' : 'fm-text-no' ?> medium" onclick="fm_change_radio_checkbox_text(this); return false;" value="<?php echo $row->mail_mode_user ?>">
2314
- <label><?php echo $row->mail_mode_user == 1 ? 'HTML' : 'Text' ?></label>
2315
- <span></span>
2316
- </button>
2317
- <input type="hidden" name="mail_mode_user" value="<?php echo $row->mail_mode_user; ?>"/>
2318
- </td>
2319
- </tr>
2320
- <tr valign="top">
2321
- <td class="fm_options_label" style="vertical-align: middle;">
2322
- <label> Attach File: </label>
2323
- </td>
2324
- <td class="fm_options_value">
2325
- <div class="error_fm" style="padding: 5px; font-size: 14px;">File attach is disabled in free version.</div>
2326
- <input type="hidden" name="mail_attachment_user" value="<?php echo $row->mail_attachment_user; ?>"/>
2327
- </td>
2328
- </tr>
2329
- <tr valign="top">
2330
- <td class="fm_options_label" style="vertical-align: middle;">
2331
- <label> Email verification: </label>
2332
- </td>
2333
- <td class="fm_options_value">
2334
- <button name="mail_verify" class="fm-checkbox-radio-button <?php echo $row->mail_verify == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->mail_verify; ?>">
2335
- <span></span>
2336
- </button>
2337
- <input type="hidden" name="mail_verify" value="<?php echo $row->mail_verify; ?>"/>
2338
- </td>
2339
- </tr>
2340
- <tr valign="top" class="expire_link" <?php echo ($row->mail_verify==0 ? 'style="display:none;"' : '')?>>
2341
- <td class="fm_options_label" valign="top">
2342
- <label> Verification link expires in: </label>
2343
- </td>
2344
- <td class="fm_options_value">
2345
- <input class="inputbox" type="text" name="mail_verify_expiretime" maxlength="10" value = "<?php echo ($row->mail_verify_expiretime ? $row->mail_verify_expiretime : 0); ?>" style="width:95px;" onkeypress="return check_isnum_point(event)"/><small> -- hours (0 - never expires).</small>
2346
- </td>
2347
- </tr>
2348
- <tr>
2349
- <td class="fm_options_label" valign="top">
2350
- <label>Custom Text in Email For User</label>
2351
- </td>
2352
- <td class="fm_options_value">
2353
- <div style="margin-bottom:5px">
2354
- <?php
2355
- $choise = "document.getElementById('script_mail_user')";
2356
- for ($i = 0; $i < count($label_label); $i++) {
2357
- if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_send_copy")
2358
- continue;
2359
-
2360
- $param = htmlspecialchars(addslashes($label_label[$i]));
2361
- $fld_label = $param;
2362
- if(strlen($fld_label)>30) {
2363
- $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2364
- $fld_label = explode("\n", $fld_label);
2365
- $fld_label = $fld_label[0] . ' ...';
2366
- }
2367
- if($label_type[$i]=="type_file_upload") {
2368
- ?>
2369
- <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label.'(as image)'; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param; ?>')" />
2370
- <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label.'(as link)'; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param.'(link)'; ?>')" />
2371
- <?php
2372
- }
2373
- else{
2374
- ?>
2375
- <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param; ?>')" />
2376
- <?php
2377
- }
2378
- }
2379
- ?>
2380
- <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php echo $choise; ?>,'subid')" />
2381
- <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php echo $choise; ?>,'ip')" />
2382
- <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php echo $choise; ?>,'username')" />
2383
- <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php echo $choise; ?>,'useremail')" />
2384
- <input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="All fields list" onClick="insertAtCursor(<?php echo $choise; ?>, 'all')" />
2385
- <div class="verification_div" <?php echo ($row->mail_verify==0 ? 'style="display:none;"' : '')?>><input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="Verification link" onClick="insertAtCursor(<?php echo $choise; ?>,'Verification link')" /> </div>
2386
- </div>
2387
- <?php
2388
- if (user_can_richedit()) {
2389
- wp_editor($row->script_mail_user, 'script_mail_user', array('teeny' => FALSE, 'textarea_name' => 'script_mail_user', 'media_buttons' => FALSE, 'textarea_rows' => 5));
2390
- }
2391
- else {
2392
- ?>
2393
- <textarea name="script_mail_user" id="script_mail_user" cols="20" rows="10" style="width:300px; height:450px;"><?php echo $row->script_mail_user; ?></textarea>
2394
- <?php
2395
- }
2396
- ?>
2397
- </td>
2398
- </tr>
2399
- </table>
2400
- </fieldset>
2401
- </fieldset>
2402
- <fieldset id="actions_fieldset" class="adminform fm_fieldset_deactive">
2403
- <legend>Actions after submission</legend>
2404
- <table class="admintable">
2405
- <tr valign="top">
2406
- <td class="fm_options_label">
2407
- <label>Action type</label>
2408
- </td>
2409
- <td class="fm_options_value">
2410
- <div>
2411
- <input type="radio" name="submit_text_type" id="text_type_none" onclick="set_type('none')" value="1" <?php echo ($row->submit_text_type != 2 && $row->submit_text_type != 3 && $row->submit_text_type != 4 && $row->submit_text_type != 5) ? "checked" : ""; ?> />
2412
- <label for="text_type_none">Stay on Form</label>
2413
- </div>
2414
- <div>
2415
- <input type="radio" name="submit_text_type" id="text_type_post" onclick="set_type('post')" value="2" <?php echo ($row->submit_text_type == 2) ? "checked" : ""; ?> />
2416
- <label for="text_type_post">Post</label>
2417
- </div>
2418
- <div>
2419
- <input type="radio" name="submit_text_type" id="text_type_page" onclick="set_type('page')" value="5" <?php echo ($row->submit_text_type == 5) ? "checked" : ""; ?> />
2420
- <label for="text_type_page">Page</label>
2421
- </div>
2422
- <div>
2423
- <input type="radio" name="submit_text_type" id="text_type_custom_text" onclick="set_type('custom_text')" value="3" <?php echo ($row->submit_text_type == 3 ) ? "checked" : ""; ?> />
2424
- <label for="text_type_custom_text">Custom Text</label>
2425
- </div>
2426
- <div>
2427
- <input type="radio" name="submit_text_type" id="text_type_url" onclick="set_type('url')" value="4" <?php echo ($row->submit_text_type == 4) ? "checked" : ""; ?> />
2428
- <label for="text_type_url">URL</label>
2429
- </div>
2430
- </td>
2431
- </tr>
2432
- <tr id="none" <?php echo (($row->submit_text_type == 2 || $row->submit_text_type == 3 || $row->submit_text_type == 4 || $row->submit_text_type == 5) ? 'style="display:none"' : ''); ?>>
2433
- <td class="fm_options_label">
2434
- <label>Stay on Form</label>
2435
- </td>
2436
- <td class="fm_options_value">
2437
- <img src="<?php echo WD_FM_URL . '/images/verified.png'; ?>" border="0">
2438
- </td>
2439
- </tr>
2440
- <tr id="post" <?php echo (($row->submit_text_type != 2) ? 'style="display:none"' : ''); ?>>
2441
- <td class="fm_options_label">
2442
- <label for="post_name">Post</label>
2443
- </td>
2444
- <td class="fm_options_value">
2445
- <select id="post_name" name="post_name">
2446
- <option value="0">- Select Post -</option>
2447
- <?php
2448
- $args = array('posts_per_page' => 10000);
2449
- query_posts($args);
2450
- while (have_posts()) : the_post(); ?>
2451
- <option value="<?php $x = get_permalink(get_the_ID()); echo $x; ?>" <?php echo (($row->article_id == $x) ? 'selected="selected"' : ''); ?>><?php the_title(); ?></option>
2452
- <?php
2453
- endwhile;
2454
- wp_reset_query();
2455
- ?>
2456
- </select>
2457
- </td>
2458
- </tr>
2459
- <tr id="page" <?php echo (($row->submit_text_type != 5) ? 'style="display:none"' : ''); ?>>
2460
- <td class="fm_options_label">
2461
- <label for="page_name">Page</label>
2462
- </td>
2463
- <td class="fm_options_value">
2464
- <select id="page_name" name="page_name">
2465
- <option value="0">- Select Page -</option>
2466
- <?php
2467
- $pages = get_pages();
2468
- foreach ($pages as $page) {
2469
- $page_id = get_page_link($page->ID);
2470
- ?>
2471
- <option value="<?php echo $page_id; ?>" <?php echo (($row->article_id == $page_id) ? 'selected="selected"' : ''); ?>><?php echo $page->post_title; ?></option>
2472
- <?php
2473
- }
2474
- wp_reset_query();
2475
- ?>
2476
- </select>
2477
- </td>
2478
- </tr>
2479
- <tr id="custom_text" <?php echo (($row->submit_text_type != 3) ? 'style="display: none;"' : ''); ?>>
2480
- <td class="fm_options_label">
2481
- <label for="submit_text">Text</label>
2482
- </td>
2483
- <td class="fm_options_value">
2484
- <?php $choise = "document.getElementById('submit_text')";
2485
- for ($i = 0; $i < count($label_label); $i++) {
2486
- if ($label_type[$i]=="type_submit_reset" || $label_type[$i]=="type_editor" || $label_type[$i]=="type_map" || $label_type[$i]=="type_mark_map" || $label_type[$i]=="type_captcha"|| $label_type[$i]=="type_recaptcha" || $label_type[$i]=="type_button" || $label_type[$i]=="type_send_copy" || $label_type[$i]=="type_file_upload")
2487
- continue;
2488
-
2489
- $param = htmlspecialchars(addslashes($label_label[$i]));
2490
- $fld_label = $param;
2491
- if(strlen($fld_label)>30) {
2492
- $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2493
- $fld_label = explode("\n", $fld_label);
2494
- $fld_label = $fld_label[0] . ' ...';
2495
- }
2496
-
2497
- ?>
2498
- <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param; ?>')" />
2499
- <?php
2500
- }
2501
- ?>
2502
- <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php echo $choise; ?>,'subid')" />
2503
- <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php echo $choise; ?>,'ip')" />
2504
- <input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="User Id" onClick="insertAtCursor(<?php echo $choise; ?>, 'userid')" />
2505
- <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php echo $choise; ?>,'username')" />
2506
- <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php echo $choise; ?>,'useremail')" />
2507
- <?php
2508
- if (user_can_richedit()) {
2509
- wp_editor($row->submit_text, 'submit_text', array('teeny' => FALSE, 'textarea_name' => 'submit_text', 'media_buttons' => FALSE, 'textarea_rows' => 5));
2510
- }
2511
- else {
2512
- ?>
2513
- <textarea cols="36" rows="5" id="submit_text" name="submit_text" style="resize: vertical;">
2514
- <?php echo $row->submit_text; ?>
2515
- </textarea>
2516
- <?php
2517
- }
2518
- ?>
2519
- </td>
2520
- </tr>
2521
- <tr id="url" <?php echo (($row->submit_text_type != 4 ) ? 'style="display:none"' : ''); ?>>
2522
- <td class="fm_options_label">
2523
- <label for="url">URL</label>
2524
- </td>
2525
- <td class="fm_options_value">
2526
- <input type="text" id="url" name="url" style="width:300px" value="<?php echo $row->url; ?>" />
2527
- </td>
2528
- </tr>
2529
- </table>
2530
- </fieldset>
2531
- <fieldset id="payment_fieldset" class="adminform fm_fieldset_deactive">
2532
- <legend>Payment Options</legend>
2533
- <table class="admintable">
2534
- <tr>
2535
- <td colspan="2">
2536
- <div class="error_fm" style="padding: 5px; font-size: 14px;">Paypal Options are disabled in free version.</div>
2537
- </td>
2538
- </tr>
2539
- <tr valign="top">
2540
- <td class="fm_options_label">
2541
- <label>Payment Method</label>
2542
- </td>
2543
- <td class="fm_options_value">
2544
- <div><input type="radio" name="paypal_mode" id="paypal_mode0" value="none" checked="checked" onchange="fm_change_payment_method('none');" disabled="disabled" /><label for="paypal_mode0">None</label></div>
2545
- <div><input type="radio" name="paypal_mode" id="paypal_mode1" value="paypal" onchange="fm_change_payment_method('paypal');" disabled="disabled" /><label for="paypal_mode1">Paypal</label></div>
2546
- </td>
2547
- </tr>
2548
- </table>
2549
- </fieldset>
2550
- <fieldset id="javascript_fieldset" class="adminform fm_fieldset_deactive">
2551
- <legend>JavaScript</legend>
2552
- <table class="admintable">
2553
- <tr valign="top">
2554
- <td class="fm_options_label">
2555
- <label for="javascript">Javascript</label>
2556
- </td>
2557
- <td class="fm_options_value" style="width:650px;">
2558
- <textarea style="margin: 0px; height: 400px; width: 600px;" cols="60" rows="30" name="javascript" id="form_javascript"><?php echo $row->javascript; ?></textarea>
2559
- </td>
2560
- </tr>
2561
- </table>
2562
- </fieldset>
2563
- <fieldset id="conditions_fieldset" class="adminform fm_fieldset_deactive">
2564
- <?php
2565
- $ids = array();
2566
- $types = array();
2567
- $labels = array();
2568
- $paramss = array();
2569
- $all_ids = array();
2570
- $all_labels = array();
2571
-
2572
- $select_and_input = array("type_text", "type_password", "type_textarea", "type_name", "type_number", "type_phone", "type_phone_new", "type_submitter_mail", "type_address", "type_spinner", "type_checkbox", "type_radio", "type_own_select", "type_paypal_price", "type_paypal_price_new", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping", "type_date_new");
2573
-
2574
- $select_type_fields = array("type_address", "type_checkbox", "type_radio", "type_own_select", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping");
2575
-
2576
-
2577
- $fields=explode('*:*new_field*:*',$row->form_fields);
2578
- $fields = array_slice($fields,0, count($fields)-1);
2579
-
2580
- foreach($fields as $field) {
2581
- $temp=explode('*:*id*:*',$field);
2582
- array_push($ids, $temp[0]);
2583
- array_push($all_ids, $temp[0]);
2584
- $temp=explode('*:*type*:*',$temp[1]);
2585
- array_push($types, $temp[0]);
2586
- $temp=explode('*:*w_field_label*:*',$temp[1]);
2587
- array_push($labels, $temp[0]);
2588
- array_push($all_labels, $temp[0]);
2589
- array_push($paramss, $temp[1]);
2590
-
2591
- }
2592
-
2593
- foreach($types as $key=>$value){
2594
- if(!in_array($types[$key],$select_and_input)){
2595
- unset($ids[$key]);
2596
- unset($labels[$key]);
2597
- unset($types[$key]);
2598
- unset($paramss[$key]);
2599
- }
2600
- }
2601
-
2602
- $ids = array_values($ids);
2603
- $labels = array_values($labels);
2604
- $types = array_values($types);
2605
- $paramss = array_values($paramss);
2606
-
2607
- $chose_ids = implode('@@**@@',$ids);
2608
- $chose_labels = implode('@@**@@',$labels);
2609
- $chose_types = implode('@@**@@',$types);
2610
- $chose_paramss = implode('@@**@@',$paramss);
2611
-
2612
- $all_ids_cond = implode('@@**@@',$all_ids);
2613
- $all_labels_cond = implode('@@**@@',$all_labels);
2614
-
2615
- $show_hide = array();
2616
- $field_label = array();
2617
- $all_any = array();
2618
- $condition_params = array();
2619
-
2620
-
2621
- $count_of_conditions=0;
2622
- if($row->condition!="") {
2623
- $conditions=explode('*:*new_condition*:*',$row->condition);
2624
- $conditions = array_slice($conditions,0, count($conditions)-1);
2625
- $count_of_conditions = count($conditions);
2626
-
2627
- foreach($conditions as $condition) {
2628
- $temp=explode('*:*show_hide*:*',$condition);
2629
- array_push($show_hide, $temp[0]);
2630
- $temp=explode('*:*field_label*:*',$temp[1]);
2631
- array_push($field_label, $temp[0]);
2632
- $temp=explode('*:*all_any*:*',$temp[1]);
2633
- array_push($all_any, $temp[0]);
2634
- array_push($condition_params, $temp[1]);
2635
- }
2636
- }
2637
- else {
2638
- $show_hide[0]=1;
2639
- $all_any[0]='and';
2640
- $condition_params[0]='';
2641
- if($all_ids)
2642
- $field_label[0] = $all_ids[0];
2643
- }
2644
- ?>
2645
- <div>
2646
- <button class="fm-button add-button large" onclick="add_condition('<?php echo $chose_ids; ?>', '<?php echo htmlspecialchars(addslashes($chose_labels)); ?>', '<?php echo $chose_types; ?>', '<?php echo htmlspecialchars(addslashes($chose_paramss)); ?>', '<?php echo $all_ids_cond; ?>', '<?php echo htmlspecialchars(addslashes($all_labels_cond)); ?>'); return false;">
2647
- Add Condition
2648
- <span></span>
2649
- </button>
2650
- </div>
2651
- <?php
2652
- for($k=0; $k<$count_of_conditions; $k++) {
2653
- if(in_array($field_label[$k],$all_ids)) : ?>
2654
- <div id="condition<?php echo $k; ?>" class="fm-condition">
2655
- <div id="conditional_fileds<?php echo $k; ?>">
2656
- <select id="show_hide<?php echo $k; ?>" name="show_hide<?php echo $k; ?>" style="width:80px; ">
2657
- <option value="1" <?php if($show_hide[$k]==1) echo 'selected="selected"'; ?>>show</option>
2658
- <option value="0" <?php if($show_hide[$k]==0) echo 'selected="selected"'; ?>>hide</option>
2659
- </select>
2660
- <select id="fields<?php echo $k; ?>" name="fields<?php echo $k; ?>" style="width:300px; " onChange="" >
2661
- <?php
2662
- foreach($all_labels as $key => $value) {
2663
- if($field_label[$k]==$all_ids[$key])
2664
- $selected = 'selected="selected"';
2665
- else
2666
- $selected ='';
2667
- echo '<option value="'.$all_ids[$key].'" '.$selected.'>'.$value.'</option>';
2668
- }
2669
- ?>
2670
- </select>
2671
- <span>if</span>
2672
- <select id="all_any<?php echo $k; ?>" name="all_any<?php echo $k; ?>" style="width:60px; ">
2673
- <option value="and" <?php if($all_any[$k]=="and") echo 'selected="selected"'; ?>>all</option>
2674
- <option value="or" <?php if($all_any[$k]=="or") echo 'selected="selected"'; ?>>any</option>
2675
- </select>
2676
- <span>of the following match:</span>
2677
- <img src="<?php echo WD_FM_URL . '/images/add.png?ver='. WD_FM_VERSION.''; ?>" title="add" onclick="add_condition_fields(<?php echo $k; ?>,'<?php echo $chose_ids; ?>', '<?php echo htmlspecialchars(addslashes($chose_labels)); ?>', '<?php echo $chose_types; ?>', '<?php echo htmlspecialchars(addslashes($chose_paramss)); ?>')" style="cursor: pointer; vertical-align: middle;">
2678
- <img src="<?php echo WD_FM_URL . '/images/page_delete.png?ver='. WD_FM_VERSION.''; ?>" onclick="delete_condition('<?php echo $k; ?>')" style="cursor: pointer; vertical-align: middle;">
2679
- </div>
2680
- <?php
2681
- if($condition_params[$k]) {
2682
- $_params = explode('*:*next_condition*:*',$condition_params[$k]);
2683
- $_params = array_slice($_params,0, count($_params)-1);
2684
-
2685
- foreach($_params as $key=>$_param) {
2686
- $key_select_or_input ='';
2687
- $param_values = explode('***',$_param);
2688
- $multiselect = explode('@@@',$param_values[2]);
2689
-
2690
- if(in_array($param_values[0],$ids)): ?>
2691
- <div id="condition_div<?php echo $k; ?>_<?php echo $key; ?>">
2692
- <select id="field_labels<?php echo $k; ?>_<?php echo $key; ?>" onchange="change_choices(this.options[this.selectedIndex].id+'_<?php echo $key; ?>','<?php echo $chose_ids; ?>', '<?php echo $chose_types; ?>', '<?php echo htmlspecialchars(addslashes($chose_paramss)); ?>')" style="width:300px;"/>
2693
- <?php
2694
- foreach($labels as $key1 => $value)
2695
- {
2696
- if($param_values[0]==$ids[$key1])
2697
- {
2698
- $selected = 'selected="selected"';
2699
- if ($types[$key1]=="type_checkbox" || $types[$key1]=="type_paypal_checkbox")
2700
- $multiple = 'multiple="multiple" class="multiple_select"';
2701
- else
2702
- $multiple ='';
2703
-
2704
- $key_select_or_input = $key1;
2705
- }
2706
- else
2707
- $selected ='';
2708
- if($field_label[$k]!=$ids[$key1])
2709
- echo '<option id="'.$k.'_'.$key1.'" value="'.$ids[$key1].'" '.$selected.'>'.$value.'</option>';
2710
-
2711
- }
2712
-
2713
- ?>
2714
- </select>
2715
-
2716
- <select id="is_select<?php echo $k; ?>_<?php echo $key; ?>" style="vertical-align: top; width:94px;">
2717
- <option value="==" <?php if($param_values[1]=="==") echo 'selected="selected"'; ?>>is</option>
2718
- <option value="!=" <?php if($param_values[1]=="!=") echo 'selected="selected"'; ?>>is not</option>
2719
- <option value="%" <?php if($param_values[1]=="%") echo 'selected="selected"'; ?>>like</option>
2720
-
2721
- <option value="!%" <?php if($param_values[1]=="!%") echo 'selected="selected"'; ?>>not like</option>
2722
-
2723
- <option value="=" <?php if($param_values[1]=="=") echo 'selected="selected"'; ?>>empty</option>
2724
-
2725
- <option value="!" <?php if($param_values[1]=="!") echo 'selected="selected"'; ?>>not empty</option>
2726
-
2727
- </select>
2728
-
2729
- <?php if ($key_select_or_input !== '' && in_array($types[$key_select_or_input],$select_type_fields)) : ?>
2730
- <select id="field_value<?php echo $k; ?>_<?php echo $key; ?>" <?php echo $multiple; ?> style="width: 200px;">
2731
- <?php
2732
- switch($types[$key_select_or_input])
2733
- {
2734
- case "type_own_select":
2735
- case "type_paypal_select":
2736
- $w_size = explode('*:*w_size*:*',$paramss[$key_select_or_input]);
2737
- break;
2738
-
2739
- case "type_radio":
2740
- case "type_checkbox":
2741
- case "type_paypal_radio":
2742
- case "type_paypal_checkbox":
2743
- case "type_paypal_shipping":
2744
- $w_size = explode('*:*w_flow*:*',$paramss[$key_select_or_input]);
2745
- break;
2746
- }
2747
-
2748
- $w_choices = explode('*:*w_choices*:*',$w_size[1]);
2749
- $w_choices_array = explode('***',$w_choices[0]);
2750
-
2751
- if($types[$key_select_or_input] == 'type_radio' || $types[$key_select_or_input] == 'type_checkbox' || $types[$key_select_or_input] == 'type_own_select')
2752
- {
2753
-
2754
- if(strpos($w_choices[1], 'w_value_disabled') > -1)
2755
- {
2756
- $w_value_disabled= explode('*:*w_value_disabled*:*',$w_choices[1]);
2757
- $w_choices_value = explode('*:*w_choices_value*:*',$w_value_disabled[1]);
2758
- $w_choices_value = $w_choices_value[0];
2759
- }
2760
-
2761
- if(isset($w_choices_value))
2762
- $w_choices_value_array = explode('***',$w_choices_value);
2763
- else
2764
- $w_choices_value_array = $w_choices_array;
2765
- }
2766
- else
2767
- {
2768
- $w_choices_price= explode('*:*w_choices_price*:*',$w_choices[1]);
2769
- $w_choices_value = $w_choices_price[0];
2770
- $w_choices_value_array = explode('***', $w_choices_value);
2771
- }
2772
-
2773
-
2774
- for($m=0; $m<count($w_choices_array); $m++)
2775
- {
2776
- if($types[$key_select_or_input]=="type_paypal_checkbox" || $types[$key_select_or_input]=="type_paypal_radio" || $types[$key_select_or_input]=="type_paypal_shipping" || $types[$key_select_or_input]=="type_paypal_select")
2777
- $w_choice = $w_choices_array[$m].'*:*value*:*'.$w_choices_value_array[$m];
2778
- else
2779
- $w_choice = $w_choices_value_array[$m];
2780
-
2781
- if(in_array(esc_html($w_choice),$multiselect))
2782
- {
2783
- $selected = 'selected="selected"';
2784
- }
2785
- else
2786
- $selected ='';
2787
-
2788
- if(strpos($w_choices_array[$m], '[') === false && strpos($w_choices_array[$m], ']') === false ) {
2789
- echo '<option id="choise_'.$k.'_'.$m.'" value="'.$w_choice.'" '.$selected.'>'.$w_choices_array[$m].'</option>';
2790
- }
2791
- }
2792
-
2793
- if($types[$key_select_or_input]=="type_address")
2794
- {
2795
- $w_countries = array("","Afghanistan","Albania","Algeria","Andorra","Angola","Antigua and Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Central African Republic","Chad","Chile","China","Colombia","Comoros","Congo (Brazzaville)","Congo","Costa Rica","Cote d'Ivoire","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","East Timor (Timor Timur)","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Fiji","Finland","France","Gabon","Gambia, The","Georgia","Germany","Ghana","Greece","Grenada","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Jamaica","Japan","Jordan","Kazakhstan","Kenya","Kiribati","Korea, North","Korea, South","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","New Zealand","Nicaragua","Niger","Nigeria","Norway","Oman","Pakistan","Palau","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Qatar","Romania","Russia","Rwanda","Saint Kitts and Nevis","Saint Lucia","Saint Vincent","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia and Montenegro","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","Spain","Sri Lanka","Sudan","Suriname","Swaziland","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Togo","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Yemen","Zambia","Zimbabwe");
2796
- $w_options = '';
2797
- foreach($w_countries as $w_country)
2798
- {
2799
- if(in_array($w_country,$multiselect))
2800
- {
2801
- $selected = 'selected="selected"';
2802
- }
2803
- else
2804
- $selected ='';
2805
-
2806
- echo '<option value="'.$w_country.'" '.$selected.'>'.$w_country.'</option>';
2807
- }
2808
- }
2809
-
2810
- ?>
2811
- </select>
2812
- <?php else :
2813
- if($key_select_or_input != '' && ($types[$key_select_or_input]=="type_number" || $types[$key_select_or_input]=="type_phone"))
2814
- $onkeypress_function = "onkeypress='return check_isnum_space(event)'";
2815
- else
2816
- if($key_select_or_input != '' && ($types[$key_select_or_input]=="type_paypal_price" || $types[$key_select_or_input]=="type_paypal_price_new"))
2817
- $onkeypress_function = "onkeypress='return check_isnum_point(event)'";
2818
- else
2819
- $onkeypress_function = "";
2820
- ?>
2821
- <input id="field_value<?php echo $k; ?>_<?php echo $key; ?>" type="text" value="<?php echo $param_values[2];?>" <?php echo $onkeypress_function; ?> style=" width: 200px;"><?php endif; ?>
2822
-
2823
- <img src="<?php echo WD_FM_URL . '/images/delete.png?ver='. WD_FM_VERSION.''; ?>" id="delete_condition<?php echo $k; ?>_<?php echo $key; ?>" onclick="delete_field_condition('<?php echo $k; ?>_<?php echo $key; ?>')" style="vertical-align: middle;">
2824
- </div>
2825
- <?php endif;
2826
- }
2827
- }
2828
-
2829
- ?>
2830
- </div>
2831
- <?php endif;
2832
- }
2833
- ?>
2834
- <input type="hidden" id="condition" name="condition" value="<?php echo $row->condition; ?>" />
2835
- </fieldset>
2836
- <fieldset id="mapping_fieldset" class="adminform fm_fieldset_deactive">
2837
- <div style="padding-bottom:15px;">
2838
- <button id="add_query" class="fm-button add-button medium" onclick="tb_show('', '<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>'); return false;">
2839
- <span></span>
2840
- Add Query
2841
- </button>
2842
- <button class="fm-button delete-button medium" onclick="if (fm_check_email('mailToAdd') || fm_check_email('from_mail') || fm_check_email('reply_to') || fm_check_email('mail_from_other') || fm_check_email('reply_to_other') || fm_check_email('paypal_email')) {return false;}; wd_fm_apply_options('remove_query'); return false;">
2843
- <span></span>
2844
- Delete
2845
- </button>
2846
- </div>
2847
- <?php
2848
- if ($queries) {
2849
- ?>
2850
- <table class="wp-list-table widefat fixed posts table_content">
2851
- <thead>
2852
- <tr>
2853
- <th style="width:4%;" class="table_small_col count_col sub-align">#</th>
2854
- <th style="width:4%;" class="table_small_col count_col sub-align">ID</th>
2855
- <th style="width:6%;" class="manage-column column-cb check-column table_small_col sub-align form_check">
2856
- <input id="check_all" type="checkbox" style="margin:0;">
2857
- </th>
2858
- <th style="width:86%;" class="table_large_col">Query</th>
2859
- </tr>
2860
- </thead>
2861
- <?php
2862
- $k = 0;
2863
- for($i=0, $n=count($queries); $i < $n ; $i++) {
2864
- $query = $queries[$i];
2865
- $checked = '<input type="checkbox" id="' . $i . '" name="cid[]" value="' . $query->id . '" />';
2866
- $link = add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => $query->id, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
2867
- ?>
2868
- <tr <?php if (!$k) echo "class=\"alternate\""; ?>>
2869
- <td align="center" class="table_small_col"><?php echo $i+1; ?></td>
2870
- <td align="center" class="table_small_col"><?php echo $query->id; ?></td>
2871
- <td align="center" class="table_small_col check-column"><?php echo $checked; ?></td>
2872
- <td align="center">
2873
- <a rel="{handler: 'iframe', size: {x: 530, y: 370}}" onclick="tb_show('', '<?php echo $link; ?>'); return false;" style="cursor:pointer;">
2874
- <?php echo $query->query; ?>
2875
- </a>
2876
- </td>
2877
- </tr>
2878
- <?php
2879
- $k = 1 - $k;
2880
- }
2881
- ?>
2882
- </table>
2883
- <?php
2884
- }
2885
- ?>
2886
- </fieldset>
2887
- <?php
2888
- foreach($addons as $addon => $addon_name) {
2889
- if (defined($addon) && is_plugin_active(constant($addon))) {
2890
- $_GET['addon_view']='admin';
2891
- $_GET['form_id']=$row->id;
2892
- do_action($addon.'_init');
2893
- }
2894
- }
2895
- ?>
2896
- </div>
2897
- <input type="hidden" name="boxchecked" value="0">
2898
- <input type="hidden" name="fieldset_id" id="fieldset_id" value="<?php echo WDW_FM_Library::get('fieldset_id', 'general'); ?>" />
2899
- <input type="hidden" id="task" name="task" value=""/>
2900
- <input type="hidden" id="current_id" name="current_id" value="<?php echo $row->id; ?>" />
2901
- </form>
2902
- <script>
2903
- jQuery(window).load(function () {
2904
- form_maker_options_tabs(jQuery("#fieldset_id").val());
2905
- fm_popup();
2906
- function hide_email_labels(event) {
2907
- var e = event.toElement || event.relatedTarget;
2908
- if (e.parentNode == this || e == this) {
2909
- return;
2910
- }
2911
- this.style.display="none";
2912
- }
2913
- if(document.getElementById('mail_from_labels')) {
2914
- document.getElementById('mail_from_labels').addEventListener('mouseout',hide_email_labels,true);
2915
- }
2916
- if(document.getElementById('mail_subject_labels')) {
2917
- document.getElementById('mail_subject_labels').addEventListener('mouseout',hide_email_labels,true);
2918
- }
2919
- if(document.getElementById('mail_from_name_user_labels')) {
2920
- document.getElementById('mail_from_name_user_labels').addEventListener('mouseout',hide_email_labels,true);
2921
- }
2922
- if(document.getElementById('mail_subject_user_labels')) {
2923
- document.getElementById('mail_subject_user_labels').addEventListener('mouseout',hide_email_labels,true);
2924
- }
2925
- if(document.getElementById('post_title_labels')) {
2926
- document.getElementById('post_title_labels').addEventListener('mouseout',hide_email_labels,true);
2927
- }
2928
- if(document.getElementById('post_tags_labels')) {
2929
- document.getElementById('post_tags_labels').addEventListener('mouseout',hide_email_labels,true);
2930
- }
2931
- if(document.getElementById('post_featured_image_labels')) {
2932
- document.getElementById('post_featured_image_labels').addEventListener('mouseout',hide_email_labels,true);
2933
- }
2934
- if(document.getElementById('dbox_upload_dir_labels')) {
2935
- document.getElementById('dbox_upload_dir_labels').addEventListener('mouseout',hide_email_labels,true);
2936
- }
2937
- });
2938
- function wd_fm_apply_options(task) {
2939
- set_condition();
2940
- fm_set_input_value('task', task);
2941
- document.getElementById('adminForm').submit();
2942
-
2943
- }
2944
- </script>
2945
- <?php
2946
- }
2947
-
2948
- public function form_layout($id) {
2949
- $row = $this->model->get_row_data($id);
2950
- $ids = array();
2951
- $types = array();
2952
- $labels = array();
2953
- $fields = explode('*:*new_field*:*', $row->form_fields);
2954
- $fields = array_slice($fields, 0, count($fields) - 1);
2955
- foreach ($fields as $field) {
2956
- $temp = explode('*:*id*:*', $field);
2957
- array_push($ids, $temp[0]);
2958
- $temp = explode('*:*type*:*', $temp[1]);
2959
- array_push($types, $temp[0]);
2960
- $temp = explode('*:*w_field_label*:*', $temp[1]);
2961
- array_push($labels, $temp[0]);
2962
- }
2963
- ?>
2964
- <script>
2965
- var form_front = '<?php echo addslashes($row->form_front);?>';
2966
- var custom_front = '<?php echo addslashes($row->custom_front);?>';
2967
- if (custom_front == '') {
2968
- custom_front = form_front;
2969
- }
2970
- function submitbutton() {
2971
- if (jQuery('#autogen_layout').is(':checked')) {
2972
- jQuery('#custom_front').val(custom_front.replace(/\s+/g, ' ').replace(/> </g, '><'));
2973
- }
2974
- else {
2975
- jQuery('#custom_front').val(editor.getValue().replace(/\s+/g, ' ').replace(/> </g, '><'));
2976
- }
2977
- }
2978
- function insertAtCursor_form(myId, myLabel) {
2979
- if (jQuery('#autogen_layout').is(':checked')) {
2980
- alert("Uncheck the Auto-Generate Layout box.");
2981
- return;
2982
- }
2983
- myValue = '<div wdid="' + myId + '" class="wdform_row">%' + myId + ' - ' + myLabel + '%</div>';
2984
- line = editor.getCursor().line;
2985
- ch = editor.getCursor().ch;
2986
- text = editor.getLine(line);
2987
- text1 = text.substr(0, ch);
2988
- text2 = text.substr(ch);
2989
- text = text1 + myValue + text2;
2990
- editor.setLine(line, text);
2991
- editor.focus();
2992
- }
2993
- function autogen(status) {
2994
- if (status) {
2995
- custom_front = editor.getValue();
2996
- editor.setValue(form_front);
2997
- editor.setOption('readOnly', true);
2998
- autoFormat();
2999
- }
3000
- else {
3001
- editor.setValue(custom_front);
3002
- editor.setOption('readOnly', false);
3003
- autoFormat();
3004
- }
3005
- }
3006
- function autoFormat() {
3007
- CodeMirror.commands["selectAll"](editor);
3008
- editor.autoFormatRange(editor.getCursor(true), editor.getCursor(false));
3009
- editor.scrollTo(0,0);
3010
- }
3011
- </script>
3012
-
3013
- <div class="fm_layout">
3014
- <form action="admin.php?page=manage_fm" method="post" name="adminForm" enctype="multipart/form-data">
3015
- <?php wp_nonce_field('nonce_fm', 'nonce_fm'); ?>
3016
- <div class="fm-layout-actions">
3017
- <div class="fm-page-actions">
3018
- <button class="fm-button save-button medium" onclick="submitbutton(); fm_set_input_value('task', 'save_layout');">
3019
- Save
3020
- <span></span>
3021
- </button>
3022
- <button class="fm-button apply-button medium" onclick="submitbutton(); fm_set_input_value('task', 'apply_layout');">
3023
- Apply
3024
- <span></span>
3025
- </button>
3026
- <button class="fm-button cancel-button medium" onclick="fm_set_input_value('task', 'cancel_options');">
3027
- Cancel
3028
- <span></span>
3029
- </button>
3030
- </div>
3031
- </div>
3032
- <div class="fm-layout-content">
3033
- <h2 style="clear: both;">Description</h2>
3034
- <p>To customize the layout of the form fields uncheck the Auto-Generate Layout box and edit the HTML.</p>
3035
- <p>You can change positioning, add in-line styles and etc. Click on the provided buttons to add the corresponding field.<br /> This will add the following line:
3036
- <b><span class="cm-tag">&lt;div</span> <span class="cm-attribute">wdid</span>=<span class="cm-string">"example_id"</span> <span class="cm-attribute">class</span>=<span class="cm-string">"wdform_row"</span><span class="cm-tag">&gt;</span>%example_id - Example%<span class="cm-tag">&lt;/div&gt;</span></b>
3037
- , where <b><span class="cm-tag">&lt;div&gt;</span></b> is used to set a row.</p>
3038
- <p>To return to the default settings you should check Auto-Generate Layout box.</p>
3039
- <h3 style="color:red">Notice</h3>
3040
- <p>Make sure not to publish the same field twice. This will cause malfunctioning of the form.</p>
3041
- <hr/>
3042
- <label for="autogen_layout" style="font-size: 20px; line-height: 45px; margin-left: 10px;">Auto Generate Layout? </label>
3043
- <input type="checkbox" value="1" name="autogen_layout" id="autogen_layout" <?php echo (($row->autogen_layout) ? 'checked="checked"' : ''); ?> />
3044
- <input type="hidden" name="custom_front" id="custom_front" value="" />
3045
- <input type="hidden" id="task" name="task" value=""/>
3046
- <input type="hidden" id="current_id" name="current_id" value="<?php echo $row->id; ?>" />
3047
- <br/>
3048
- <?php
3049
- foreach($ids as $key => $id) {
3050
- if ($types[$key] != "type_section_break") {
3051
- ?>
3052
- <button type="button" onClick="insertAtCursor_form('<?php echo $ids[$key]; ?>','<?php echo $labels[$key]; ?>')" class="fm_label_buttons" title="<?php echo $labels[$key]; ?>"><?php echo $labels[$key]; ?></button>
3053
- <?php
3054
- }
3055
- }
3056
- ?>
3057
- </form>
3058
- </div>
3059
- <br /><br />
3060
- <button class="fm_submit_layout button button-secondary button-hero" onclick="autoFormat()"><strong>Apply Source Formatting</strong> <em>(ctrl-enter)</em></button>
3061
- <textarea id="source" name="source" style="display: none;"></textarea>
3062
- </div>
3063
- <script>
3064
- var editor = CodeMirror.fromTextArea(document.getElementById("source"), {
3065
- lineNumbers: true,
3066
- lineWrapping: true,
3067
- mode: "htmlmixed",
3068
- value: form_front
3069
- });
3070
- if (jQuery('#autogen_layout').is(':checked')) {
3071
- editor.setOption('readOnly', true);
3072
- editor.setValue(form_front);
3073
- }
3074
- else {
3075
- editor.setOption('readOnly', false);
3076
- editor.setValue(custom_front);
3077
- }
3078
- jQuery('#autogen_layout').click(function() {
3079
- autogen(jQuery(this).is(':checked'));
3080
- });
3081
- autoFormat();
3082
- </script>
3083
- <?php
3084
- }
3085
-
3086
- public function display_options($id) {
3087
- $row_form = $this->model->get_row_data($id);
3088
- $row = $this->model->get_display_options($id);
3089
- $page_title = 'Display Options: '.$row_form->title;
3090
- $animation_effects = array(
3091
- 'none' => 'None',
3092
- 'bounce' => 'Bounce',
3093
- 'tada' => 'Tada',
3094
- 'bounceInDown' => 'BounceInDown',
3095
- 'fadeInLeft' => 'FadeInLeft',
3096
- 'flash' => 'Flash',
3097
- 'pulse' => 'Pulse',
3098
- 'rubberBand' => 'RubberBand',
3099
- 'shake' => 'Shake',
3100
- 'swing' => 'Swing',
3101
- 'wobble' => 'Wobble',
3102
- 'hinge' => 'Hinge',
3103
- 'lightSpeedIn' => 'LightSpeedIn',
3104
- 'rollIn' => 'RollIn',
3105
- 'bounceIn' => 'BounceIn',
3106
- 'bounceInLeft' => 'BounceInLeft',
3107
- 'bounceInRight' => 'BounceInRight',
3108
- 'bounceInUp' => 'BounceInUp',
3109
- 'fadeIn' => 'FadeIn',
3110
- 'fadeInDown' => 'FadeInDown',
3111
- 'fadeInDownBig' => 'FadeInDownBig',
3112
- 'fadeInLeftBig' => 'FadeInLeftBig',
3113
- 'fadeInRight' => 'FadeInRight',
3114
- 'fadeInRightBig' => 'FadeInRightBig',
3115
- 'fadeInUp' => 'FadeInUp',
3116
- 'fadeInUpBig' => 'FadeInUpBig',
3117
- 'flip' => 'Flip',
3118
- 'flipInX' => 'FlipInX',
3119
- 'flipInY' => 'FlipInY',
3120
- 'rotateIn' => 'RotateIn',
3121
- 'rotateInDownLeft' => 'RotateInDownLeft',
3122
- 'rotateInDownRight' => 'RotateInDownRight',
3123
- 'rotateInUpLeft' => 'RotateInUpLeft',
3124
- 'rotateInUpRight' => 'RotateInUpRight',
3125
- 'zoomIn' => 'ZoomIn',
3126
- 'zoomInDown' => 'ZoomInDown',
3127
- 'zoomInLeft' => 'ZoomInLeft',
3128
- 'zoomInRight' => 'ZoomInRight',
3129
- 'zoomInUp' => 'ZoomInUp',
3130
- );
3131
-
3132
- ?>
3133
- <form class="wrap" method="post" action="admin.php?page=manage_fm" name="adminForm" id="adminForm">
3134
- <?php wp_nonce_field('nonce_fm', 'nonce_fm'); ?>
3135
- <input type="hidden" id="task" name="task" value=""/>
3136
- <input type="hidden" id="current_id" name="current_id" value="<?php echo $row->form_id; ?>" />
3137
- <div class="fm-page-header">
3138
- <div class="fm-logo">
3139
- </div>
3140
- <div class="fm-page-title"><?php echo $page_title; ?></div>
3141
- <div class="fm-page-actions">
3142
- <button class="fm-button save-button medium" onclick="fm_apply_options('save_display_options');">
3143
- <span></span>
3144
- Save
3145
- </button>
3146
- <button class="fm-button apply-button medium" onclick="fm_apply_options('apply_display_options');">
3147
- <span></span>
3148
- Apply
3149
- </button>
3150
- <button class="fm-button cancel-button medium" onclick="fm_set_input_value('task', 'cancel_options');">
3151
- <span></span>
3152
- Cancel
3153
- </button>
3154
- </div>
3155
- <div class="fm-clear"></div>
3156
- </div>
3157
- <div class="fm-form-options">
3158
- <fieldset id="type_settings_fieldset" class="adminform">
3159
- <div class="fm-row fm-form-types">
3160
- <label style="font-size:18px; width: 170px !important; ">Form Type</label>
3161
- <label>
3162
- <input type="radio" name="form_type" value="embedded" onclick="change_form_type('embedded'); change_hide_show('fm-embedded');"
3163
- <?php echo $row->type == 'embedded' ? 'checked="checked"' : '' ?>>
3164
- <span class="fm-embedded <?php echo $row->type == 'embedded' ? ' active' : '' ?>"></span>
3165
- <p>Embedded</p>
3166
- </label>
3167
- <label>
3168
- <input type="radio" name="form_type" value="popover" onclick="change_form_type('popover'); change_hide_show('fm-popover');"
3169
- <?php echo $row->type == 'popover' ? 'checked="checked"' : '' ?>>
3170
- <span class="fm-popover <?php echo $row->type == 'popover' ? ' active' : '' ?>"></span>
3171
- <p>Popup</p>
3172
- </label>
3173
- <label>
3174
- <input type="radio" name="form_type" value="topbar" onclick="change_form_type('topbar'); change_hide_show('fm-topbar');"
3175
- <?php echo $row->type == 'topbar' ? 'checked="checked"' : '' ?>>
3176
- <span class="fm-topbar <?php echo $row->type == 'topbar' ? ' active' : '' ?>"></span>
3177
- <p>Topbar</p>
3178
- </label>
3179
- <label>
3180
- <input type="radio" name="form_type" value="scrollbox" onclick="change_form_type('scrollbox'); change_hide_show('fm-scrollbox');"<?php echo $row->type == 'scrollbox' ? 'checked="checked"' : '' ?>>
3181
- <span class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? ' active' : '' ?>"></span>
3182
- <p>Scrollbox</p>
3183
- </label>
3184
- </div>
3185
- <br /><br />
3186
- <table class="admintable">
3187
- <tr class="fm-embedded <?php echo $row->type == 'embedded' ? 'fm-show' : 'fm-hide' ?>">
3188
- <td class="fm_options_label">
3189
- <label>Form Placement</label>
3190
- </td>
3191
- <td class="fm_options_value">
3192
- Use <input type="text" value='[Form id="<?php echo $row->form_id; ?>"]' onclick="fm_select_value(this)" readonly="readonly" style="width:155px !important;"/> shortcode to display the form.
3193
- </td>
3194
- </tr>
3195
- <tr class="fm-popover <?php echo $row->type == 'popover' ? 'fm-show' : 'fm-hide' ?>">
3196
- <td class="fm_options_label">
3197
- <label>Animation Effect</label>
3198
- </td>
3199
- <td class="fm_options_value">
3200
- <select id="popover_animate_effect" name="popover_animate_effect">
3201
- <?php
3202
- foreach($animation_effects as $anim_key => $animation_effect){
3203
- $selected = $row->popover_animate_effect == $anim_key ? 'selected="selected"' : '';
3204
- echo '<option value="'.$anim_key.'" '.$selected.'>'.$animation_effect.'</option>';
3205
- }
3206
- ?>
3207
- </select>
3208
- </td>
3209
- </tr>
3210
-
3211
- <tr class="fm-popover <?php echo $row->type != 'popover' ? 'fm-hide' : 'fm-show'; ?>">
3212
- <td class="fm_options_label">
3213
- <label>Loading Delay</label>
3214
- </td>
3215
- <td class="fm_options_value">
3216
- <input type="number" name="popover_loading_delay" value="<?php echo $row->popover_loading_delay; ?>" /> seconds
3217
- <div>Define the amount of time before the form popup appears after the page loads. Set 0 for no delay.
3218
- </div>
3219
- </td>
3220
- </tr>
3221
- <tr class="fm-popover <?php echo $row->type == 'popover' ? 'fm-show' : 'fm-hide' ?>">
3222
- <td class="fm_options_label">
3223
- <label>Frequency</label>
3224
- </td>
3225
- <td class="fm_options_value">
3226
- <input type="number" name="popover_frequency" value="<?php echo $row->popover_frequency; ?>" /> days
3227
- <div>Display the popup to the same visitor (who has closed the popup/submitted the form) after this period. Set the value to 0 to always show.
3228
- </div>
3229
- </td>
3230
- </tr>
3231
- <tr class="fm-topbar <?php echo $row->type == 'topbar' ? 'fm-show' : 'fm-hide' ?>">
3232
- <td class="fm_options_label">
3233
- <label>Position</label>
3234
- </td>
3235
- <td class="fm_options_value">
3236
- <button name="topbar_position" class="fm-checkbox-radio-button <?php echo $row->topbar_position == 1 ? 'fm-text-yes' : 'fm-text-no' ?> medium" onclick="fm_change_radio_checkbox_text(this); fm_show_hide('topbar_remain_top'); return false;" value="<?php echo $row->topbar_position == 1 ? '1' : '0' ?>">
3237
- <label><?php echo $row->topbar_position == 1 ? 'Top' : 'Bottom' ?></label>
3238
- <span></span>
3239
- </button>
3240
- <input type="hidden" name="topbar_position" value="<?php echo $row->topbar_position; ?>"/>
3241
- </td>
3242
- </tr>
3243
- <tr class="fm-topbar topbar_remain_top <?php echo $row->type != 'topbar' ? 'fm-hide' : ($row->topbar_position == 1 ? 'fm-show' : 'fm-hide') ?>">
3244
- <td class="fm_options_label">
3245
- <label>Remain at top when scrolling</label>
3246
- </td>
3247
- <td class="fm_options_value">
3248
- <button class="fm-checkbox-radio-button <?php echo $row->topbar_remain_top == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->topbar_remain_top; ?>">
3249
- <span></span>
3250
- </button>
3251
- <input type="hidden" name="topbar_remain_top" value="<?php echo $row->topbar_remain_top; ?>"/>
3252
- </td>
3253
- </tr>
3254
- <tr class="fm-topbar <?php echo $row->type == 'topbar' ? 'fm-show' : 'fm-hide' ?>">
3255
- <td class="fm_options_label">
3256
- <label>Allow Closing the bar</label>
3257
- </td>
3258
- <td class="fm_options_value">
3259
- <button class="fm-checkbox-radio-button <?php echo $row->topbar_closing == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->topbar_closing; ?>">
3260
- <span></span>
3261
- </button>
3262
- <input type="hidden" name="topbar_closing" value="<?php echo $row->topbar_closing; ?>"/>
3263
- </td>
3264
- </tr>
3265
- <tr class="fm-topbar topbar_hide_duration <?php echo $row->type != 'topbar' ? 'fm-hide' : 'fm-show' ?>">
3266
- <td class="fm_options_label">
3267
- <label>Frequency</label>
3268
- </td>
3269
- <td class="fm_options_value">
3270
- <input type="number" name="topbar_hide_duration" value="<?php echo $row->topbar_hide_duration; ?>"/>days
3271
- <div>Display the topbar to the same visitor (who has closed the popup/submitted the form) after this period. Set the value to 0 to always show.
3272
- </div>
3273
- </td>
3274
- </tr>
3275
-
3276
- <tr class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? 'fm-show' : 'fm-hide' ?>">
3277
- <td class="fm_options_label">
3278
- <label>Position</label>
3279
- </td>
3280
- <td class="fm_options_value">
3281
- <button name="scrollbox_position" class="fm-checkbox-radio-button <?php echo $row->scrollbox_position == 1 ? 'fm-text-yes' : 'fm-text-no' ?> medium" onclick="fm_change_radio_checkbox_text(this); return false;" value="<?php echo $row->scrollbox_position == 1 ? '1' : '0' ?>">
3282
- <label><?php echo $row->scrollbox_position == 1 ? 'Right' : 'Left' ?></label>
3283
- <span></span>
3284
- </button>
3285
- <input type="hidden" name="scrollbox_position" value="<?php echo $row->scrollbox_position; ?>"/>
3286
- </td>
3287
- </tr>
3288
- <tr class="fm-scrollbox <?php echo $row->type != 'scrollbox' ? 'fm-hide' : 'fm-show'; ?>">
3289
- <td class="fm_options_label">
3290
- <label>Loading Delay</label>
3291
- </td>
3292
- <td class="fm_options_value">
3293
- <input type="number" name="scrollbox_loading_delay" value="<?php echo $row->scrollbox_loading_delay; ?>" /> seconds
3294
- <div>Define the amount of time before the form scrollbox appears after the page loads. Set 0 for no delay.
3295
- </div>
3296
- </td>
3297
- </tr>
3298
- <tr class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? 'fm-show' : 'fm-hide' ?>">
3299
- <td class="fm_options_label">
3300
- <label>Frequency</label>
3301
- </td>
3302
- <td class="fm_options_value">
3303
- <input type="number" name="scrollbox_hide_duration" value="<?php echo $row->scrollbox_hide_duration; ?>"/>days
3304
- <div>Display the scrollbox to the same visitor (who has closed the popup/submitted the form) after this period. Set the value to 0 to always show.
3305
- </div>
3306
- </td>
3307
- </tr>
3308
-
3309
- <tr class="fm-popover fm-topbar fm-scrollbox <?php echo $row->type != 'embedded' ? 'fm-show' : 'fm-hide' ?>">
3310
- <td class="fm_options_label">
3311
- <label>Always show for administrator</label>
3312
- </td>
3313
- <td class="fm_options_value">
3314
- <button class="fm-checkbox-radio-button <?php echo $row->show_for_admin == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->show_for_admin; ?>">
3315
- <span></span>
3316
- </button>
3317
- <input type="hidden" name="show_for_admin" value="<?php echo $row->show_for_admin; ?>"/>
3318
- <div>If this option is enabled, website admins will always see the form.</div>
3319
- </td>
3320
- </tr>
3321
-
3322
- <tr class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? 'fm-show' : 'fm-hide' ?>">
3323
- <td class="fm_options_label">
3324
- <label>Trigger Point</label>
3325
- </td>
3326
- <td class="fm_options_value">
3327
- <input type="number" name="scrollbox_trigger_point" value="<?php echo $row->scrollbox_trigger_point; ?>"/>%
3328
- <div>Set the percentage of the page height, where the scrollbox form will appear after scrolling down.</div>
3329
- </td>
3330
- </tr>
3331
- <tr class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? 'fm-show' : 'fm-hide' ?>">
3332
- <td class="fm_options_label">
3333
- <label>Allow Closing the bar</label>
3334
- </td>
3335
- <td class="fm_options_value">
3336
- <button class="fm-checkbox-radio-button <?php echo $row->scrollbox_closing == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->scrollbox_closing; ?>">
3337
- <span></span>
3338
- </button>
3339
- <input type="hidden" name="scrollbox_closing" value="<?php echo $row->scrollbox_closing; ?>"/>
3340
- </td>
3341
- </tr>
3342
- <tr class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? 'fm-show' : 'fm-hide' ?>">
3343
- <td class="fm_options_label">
3344
- <label>Allow Minimize</label>
3345
- </td>
3346
- <td class="fm_options_value">
3347
- <button class="fm-checkbox-radio-button <?php echo $row->scrollbox_minimize == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); fm_show_hide('minimize_text'); return false;" value="<?php echo $row->scrollbox_minimize; ?>">
3348
- <span></span>
3349
- </button>
3350
- <input type="hidden" name="scrollbox_minimize" value="<?php echo $row->scrollbox_minimize; ?>"/>
3351
- </td>
3352
- </tr>
3353
- <tr class="fm-scrollbox minimize_text <?php echo $row->type == 'scrollbox' && $row->scrollbox_minimize == 1 ? 'fm-show' : 'fm-hide' ?>">
3354
- <td class="fm_options_label">
3355
- <label>Minimize Text</label>
3356
- </td>
3357
- <td class="fm_options_value">
3358
- <input type="text" name="scrollbox_minimize_text" value="<?php echo $row->scrollbox_minimize_text; ?>"/>
3359
- </td>
3360
- </tr>
3361
-
3362
- <tr class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? 'fm-show' : 'fm-hide' ?>">
3363
- <td class="fm_options_label">
3364
- <label>Auto Hide</label>
3365
- </td>
3366
- <td class="fm_options_value">
3367
- <button class="fm-checkbox-radio-button <?php echo $row->scrollbox_auto_hide == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->scrollbox_auto_hide; ?>">
3368
- <span></span>
3369
- </button>
3370
- <input type="hidden" name="scrollbox_auto_hide" value="<?php echo $row->scrollbox_auto_hide; ?>"/>
3371
- <div>Hide the scrollbox form again when visitor scrolls back up.</div>
3372
- </td>
3373
- </tr>
3374
- <tr class="fm-popover fm-topbar fm-scrollbox <?php echo $row->type != 'embedded' ? 'fm-show' : 'fm-hide' ?>">
3375
- <td class="fm_options_label">
3376
- <label>Display on</label>
3377
- </td>
3378
- <td class="fm_options_value">
3379
- <ul class="pp_display pp_display_on"><?php
3380
- $posts_and_pages = $this->model->fm_posts_query();
3381
- $stat_types = array('everything' => 'All', 'home' => 'Homepage', 'archive' => 'Archives');
3382
-
3383
- $def_post_types = array('post' => 'Post', 'page' => 'Page');
3384
- $custom_post_types = get_post_types( array(
3385
- 'public' => true,
3386
- '_builtin' => false,
3387
- ) );
3388
-
3389
- $post_types = array_merge($def_post_types, $custom_post_types);
3390
- $all_types = $stat_types + $post_types;
3391
- $selected_types = explode(',', $row->display_on);
3392
- $show_cats = in_array('post', $selected_types);
3393
- $m = 0;
3394
- foreach($all_types as $post_key => $post_type){
3395
- $checked = in_array('everything', $selected_types) || in_array($post_key, $selected_types) ? 'checked="checked"' : '';
3396
- $postclass = $post_key != 'page' && in_array($post_key, array_keys($def_post_types)) ? 'class="catpost"' : '';
3397
- echo '<li><input id="pt'.$m.'" type="checkbox" name="display_on[]" value="'.$post_key.'" '.$checked.' '.$postclass.'/><label for="pt'.$m.'">'.$post_type.'</label></li>';
3398
- $m++;
3399
- }
3400
- ?>
3401
- </ul>
3402
- </td>
3403
- </tr>
3404
- <tr class="fm-popover fm-topbar fm-scrollbox fm-cat-show <?php echo $row->type != 'embedded' && $show_cats ? 'fm-show' : 'fm-hide' ?>">
3405
- <td class="fm_options_label">
3406
- <label>Display on these category's posts</label>
3407
- </td>
3408
- <td class="fm_options_value">
3409
- <ul class="pp_display pp_display_on_categories"><?php
3410
- $categories = $this->model->fm_categories_query();
3411
- $selected_categories = explode(',', $row->display_on_categories);
3412
- $current_categories_array = explode(',', $row->current_categories);
3413
- $m = 0;
3414
- foreach($categories as $cat_key => $category){
3415
- $checked = ((!$row->current_categories && !$row->display_on_categories) || in_array($cat_key, $selected_categories) || (in_array('auto_check_new', $selected_categories) && !in_array($cat_key, $current_categories_array))) ? 'checked="checked"' : '';
3416
-
3417
- echo '<li><input id="cat'.$m.'" type="checkbox" name="display_on_categories[]" value="'.$cat_key.'" '.$checked.'/><label for="cat'.$m.'">'.$category.'</label></li>';
3418
- $m++;
3419
- }
3420
- $auto_check = (!$row->current_categories && !$row->display_on_categories) || in_array('auto_check_new', $selected_categories) ? 'checked="checked"' : '';
3421
- echo '<li><br/><input id="cat'.$m.'" type="checkbox" name="display_on_categories[]" value="auto_check_new" '.$auto_check.'/><label for="cat'.$m.'">Automatically check new categories</label></li>';
3422
- $current_categories = !$row->current_categories && !$row->display_on_categories ? implode(',', array_keys($categories)) : $row->current_categories;
3423
- ?>
3424
- </ul>
3425
- <input type="hidden" name="current_categories" value="<?php echo $current_categories; ?>"/>
3426
- </td>
3427
- </tr>
3428
- <tr class="fm-popover fm-topbar fm-scrollbox fm-posts-show <?php echo (in_array('everything', $selected_types) || in_array('post', $selected_types)) && $row->type != 'embedded' ? 'fm-show' : 'fm-hide' ?>">
3429
- <td class="fm_options_label">
3430
- <label>Display on these posts</label>
3431
- </td>
3432
- <td class="fm_options_value">
3433
- <div class="fm-mini-heading">Click on input area to view the list of posts. If left empty the form will appear on all posts.</div>
3434
- <p>Posts defined below will override all settings above.</p>
3435
- <ul class="fm-pp">
3436
- <li class="pp_selected"><?php if($row->posts_include){
3437
- $posts_include = explode(',', $row->posts_include);
3438
- foreach($posts_include as $post_exclude){
3439
- if(isset($posts_and_pages[$post_exclude])){
3440
- $ptitle = $posts_and_pages[$post_exclude]['title'];
3441
- $ptype = $posts_and_pages[$post_exclude]['post_type'];
3442
- echo '<span data-post_id="'.$post_exclude.'">['.$ptype.'] - '.$ptitle.'<span class="pp_selected_remove">x</span></span>';
3443
- }
3444
- }
3445
- } ?></li>
3446
- <li>
3447
- <input type="text" class="pp_search_posts" value="" data-post_type="only_posts" style="width: 100% !important;" />
3448
- <input type="hidden" class="pp_exclude" name="posts_include" value="<?php echo $row->posts_include; ?>" />
3449
- <span class="fm-loading"></span>
3450
- </li>
3451
- <li class="pp_live_search fm-hide">
3452
- <ul class="pp_search_results">
3453
-
3454
- </ul>
3455
- </li>
3456
- </ul>
3457
- </td>
3458
- </tr>
3459
- <tr class="fm-popover fm-topbar fm-scrollbox fm-pages-show <?php echo (in_array('everything', $selected_types) || in_array('page', $selected_types)) && $row->type != 'embedded' ? 'fm-show' : 'fm-hide' ?>">
3460
- <td class="fm_options_label">
3461
- <label>Display on these pages</label>
3462
- </td>
3463
- <td class="fm_options_value">
3464
- <div class="fm-mini-heading">Click on input area to view the list of pages. If left empty the form will appear on all pages.</div>
3465
- <p>Pages defined below will override all settings above.</p>
3466
- <ul class="fm-pp">
3467
- <li class="pp_selected"><?php if($row->pages_include){
3468
- $pages_include = explode(',', $row->pages_include);
3469
- foreach($pages_include as $page_exclude){
3470
- if(isset($posts_and_pages[$page_exclude])){
3471
- $ptitle = $posts_and_pages[$page_exclude]['title'];
3472
- $ptype = $posts_and_pages[$page_exclude]['post_type'];
3473
- echo '<span data-post_id="'.$page_exclude.'">['.$ptype.'] - '.$ptitle.'<span class="pp_selected_remove">x</span></span>';
3474
- }
3475
- }
3476
- } ?></li>
3477
- <li>
3478
- <input type="text" class="pp_search_posts" value="" data-post_type="only_pages" style="width: 100% !important;" />
3479
- <input type="hidden" class="pp_exclude" name="pages_include" value="<?php echo $row->pages_include; ?>" />
3480
- <span class="fm-loading"></span>
3481
- </li>
3482
- <li class="pp_live_search fm-hide">
3483
- <ul class="pp_search_results">
3484
- </ul>
3485
- </li>
3486
- </ul>
3487
- </td>
3488
- </tr>
3489
- <tr class="fm-popover fm-topbar fm-scrollbox <?php echo $row->type != 'embedded' ? 'fm-show' : 'fm-hide' ?>">
3490
- <td class="fm_options_label">
3491
- <label>Hide on Mobile</label>
3492
- </td>
3493
- <td class="fm_options_value">
3494
- <button class="fm-checkbox-radio-button <?php echo $row->hide_mobile == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->hide_mobile; ?>">
3495
- <span></span>
3496
- </button>
3497
- <input type="hidden" name="hide_mobile" value="<?php echo $row->hide_mobile; ?>"/>
3498
- </td>
3499
- </tr>
3500
-
3501
- </table>
3502
- </fieldset>
3503
- </div>
3504
- </form>
3505
- <?php
3506
- }
3507
-
3508
- }
1
+ <?php
2
+
3
+ class FMViewManage_fm {
4
+
5
+ private $model;
6
+
7
+ public function __construct($model) {
8
+ $this->model = $model;
9
+ }
10
+
11
+ public function display() {
12
+ $rows_data = $this->model->get_rows_data();
13
+ $page_nav = $this->model->page_nav();
14
+ $search_value = ((isset($_POST['search_value'])) ? esc_html($_POST['search_value']) : '');
15
+ $search_select_value = ((isset($_POST['search_select_value'])) ? (int) $_POST['search_select_value'] : 0);
16
+ $asc_or_desc = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'desc') ? 'desc' : 'asc');
17
+ $order_by_array = array('id', 'title', 'mail');
18
+ $order_by = isset($_POST['order_by']) && in_array(esc_html(stripslashes($_POST['order_by'])), $order_by_array) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
19
+ $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
20
+ $ids_string = '';
21
+ ?>
22
+ <form onkeypress="fm_doNothing(event)" class="wrap" id="manage_form" method="post" action="admin.php?page=manage_fm">
23
+ <?php wp_nonce_field('nonce_fm', 'nonce_fm'); ?>
24
+ <div class="fm-page-banner">
25
+ <div class="fm-logo">
26
+ </div>
27
+ <div class="fm-logo-title">Form</br>Maker</div>
28
+ <button class="fm-button add-button medium" onclick="fm_set_input_value('task', 'add'); fm_form_submit(event, 'manage_form')">
29
+ <span></span>
30
+ Add New
31
+ </button>
32
+ <div class="fm-page-actions">
33
+ <button class="fm-button delete-button medium" onclick="if (confirm('Do you want to delete selected items?')) { fm_set_input_value('task', 'delete_all'); fm_form_submit(event, 'manage_form'); } else { return false; }">
34
+ <span></span>
35
+ Delete
36
+ </button>
37
+ </div>
38
+ </div>
39
+ <div class="tablenav top">
40
+ <?php
41
+ WDW_FM_Library::search('Title', $search_value, 'manage_form');
42
+ WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'manage_form');
43
+ ?>
44
+ </div>
45
+ <table class="wp-list-table widefat fixed pages">
46
+ <thead>
47
+ <th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin:0;"/></th>
48
+ <th class="table_small_col <?php if ($order_by == 'id') { echo $order_class; } ?>">
49
+ <a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'id'); fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'id' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>'); fm_form_submit(event, 'manage_form')" href="">
50
+ <span>ID</span><span class="sorting-indicator"></span></a>
51
+ </th>
52
+ <th class="<?php if ($order_by == 'title') { echo $order_class; } ?>">
53
+ <a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'title'); fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'title' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>'); fm_form_submit(event, 'manage_form')" href="">
54
+ <span>Title</span><span class="sorting-indicator"></span></a>
55
+ </th>
56
+ <th class="<?php if ($order_by == 'type') { echo $order_class; } ?>">
57
+ <a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'type'); fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'type' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>'); fm_form_submit(event, 'manage_form')" href="">
58
+ <span>Type</span><span class="sorting-indicator"></span></a>
59
+ </th>
60
+ <th class="<?php if ($order_by == 'mail') { echo $order_class; } ?>">
61
+ <a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'mail'); fm_set_input_value('asc_or_desc', '<?php echo (($order_by == 'mail' && $asc_or_desc == 'asc') ? 'desc' : 'asc'); ?>'); fm_form_submit(event, 'manage_form')" href="">
62
+ <span>Email to send submissions to</span><span class="sorting-indicator"></span></a>
63
+ </th>
64
+ <th class="table_large_col">Shortcode</th>
65
+ <th class="table_large_col">PHP function</th>
66
+ <th class="table_small_col">Edit</th>
67
+ <th class="table_small_col">Delete</th>
68
+ </thead>
69
+ <tbody id="tbody_arr">
70
+ <?php
71
+ if ($rows_data) {
72
+ foreach ($rows_data as $row_data) {
73
+ $alternate = (!isset($alternate) || $alternate == '') ? 'class="alternate"' : '';
74
+ $old = isset($row_data->form) && ($row_data->form != '');
75
+ ?>
76
+ <tr id="tr_<?php echo $row_data->id; ?>" <?php echo $alternate; ?>>
77
+ <td class="table_small_col check-column">
78
+ <input id="check_<?php echo $row_data->id; ?>" name="check_<?php echo $row_data->id; ?>" type="checkbox"/>
79
+ </td>
80
+ <td class="table_small_col"><?php echo $row_data->id; ?></td>
81
+ <td>
82
+ <?php
83
+ if (!$old) {
84
+ ?>
85
+ <a onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id', '<?php echo $row_data->id; ?>'); fm_form_submit(event, 'manage_form')" href="" title="Edit"><?php echo $row_data->title; ?></a>
86
+ <?php
87
+ }
88
+ else {
89
+ echo $row_data->title;
90
+ }
91
+ ?>
92
+ </td>
93
+ <td>
94
+ <?php echo $row_data->type; ?>
95
+ </td>
96
+ <td><?php echo $row_data->mail; ?></td>
97
+ <td class="table_big_col" style="padding-left: 0; padding-right: 0;">
98
+ <?php if($row_data->type == 'embedded'){ ?>
99
+ <input type="text" value='[Form id="<?php echo $row_data->id; ?>"]' onclick="fm_select_value(this)" size="12" readonly="readonly" style="padding-left: 1px; padding-right: 1px;"/>
100
+ <?php } else { ?>
101
+ <a href="<?php echo add_query_arg(array('current_id' => $row_data->id, 'nonce_fm' => wp_create_nonce('nonce_fm')), admin_url('admin.php?page=manage_fm&task=display_options')); ?>">Set Display Options</a>
102
+ <?php } ?>
103
+ </td>
104
+ <td class="table_large_col" style="padding-left: 0; padding-right: 0;">
105
+ <input type="text" value='&#60;?php wd_form_maker(<?php echo $row_data->id; ?>, "<?php echo $row_data->type; ?>"); ?&#62;' onclick="fm_select_value(this)" readonly="readonly" style="padding-left: 1px; padding-right: 1px;"/>
106
+ </td>
107
+ <td class="table_small_col">
108
+ <?php
109
+ if (!$old) {
110
+ ?>
111
+ <button class="fm-icon edit-icon" onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id', '<?php echo $row_data->id; ?>'); fm_form_submit(event, 'manage_form')">
112
+ <span></span>
113
+ </button>
114
+ <?php
115
+ }
116
+ ?>
117
+ </td>
118
+ <td class="table_small_col">
119
+ <button class="fm-icon delete-icon" onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete'); fm_set_input_value('current_id', '<?php echo $row_data->id; ?>'); fm_form_submit(event, 'manage_form'); } else { return false; }">
120
+ <span></span>
121
+ </button>
122
+ </td>
123
+ </tr>
124
+ <?php
125
+ $ids_string .= $row_data->id . ',';
126
+ }
127
+ }
128
+ ?>
129
+ </tbody>
130
+ </table>
131
+ <input id="task" name="task" type="hidden" value=""/>
132
+ <input id="current_id" name="current_id" type="hidden" value=""/>
133
+ <input id="ids_string" name="ids_string" type="hidden" value="<?php echo $ids_string; ?>"/>
134
+ <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="asc"/>
135
+ <input id="order_by" name="order_by" type="hidden" value="<?php echo $order_by; ?>"/>
136
+ </form>
137
+ <?php
138
+ }
139
+
140
+ public function edit($id) {
141
+ ?>
142
+ <img src="<?php echo WD_FM_URL . '/images/icons.png'; ?>" style="display:none;"/>
143
+ <?php
144
+ $row = $this->model->get_row_data_new($id);
145
+ $themes = $this->model->get_theme_rows_data();
146
+ global $wpdb;
147
+ $default_theme = $wpdb->get_var('SELECT id FROM ' . $wpdb->prefix . 'formmaker_themes where `default`=1');
148
+ $labels = array();
149
+ $label_id = array();
150
+ $label_order_original = array();
151
+ $label_type = array();
152
+ $label_all = explode('#****#', $row->label_order);
153
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
154
+ foreach ($label_all as $key => $label_each) {
155
+ $label_id_each = explode('#**id**#', $label_each);
156
+ array_push($label_id, $label_id_each[0]);
157
+ $label_oder_each = explode('#**label**#', $label_id_each[1]);
158
+ array_push($label_order_original, addslashes($label_oder_each[0]));
159
+ array_push($label_type, $label_oder_each[1]);
160
+ }
161
+ $labels['id'] = '"' . implode('","', $label_id) . '"';
162
+ $labels['label'] = '"' . implode('","', $label_order_original) . '"';
163
+ $labels['type'] = '"' . implode('","', $label_type) . '"';
164
+ $page_title = (($id != 0) ? 'Edit form ' . $row->title : 'Create new form');
165
+ $is_addon_stripe_active = (defined('WD_FM_STRIPE') && is_plugin_active(constant('WD_FM_STRIPE')));
166
+ if ($is_addon_stripe_active) {
167
+ require_once (WD_FM_STRIPE_DIR . '/controller.php');
168
+ }
169
+ ?>
170
+ <script type="text/javascript">
171
+ var plugin_url = "<?php echo WD_FM_URL; ?>";
172
+ </script>
173
+ <script type="text/javascript">
174
+ is_addon_calculator_active = <?php echo (defined('WD_FM_CALCULATOR') && is_plugin_active(constant('WD_FM_CALCULATOR'))) ? 1 : 0; ?>;
175
+ is_addon_stripe_active = <?php echo $is_addon_stripe_active ? 1 : 0; ?>;
176
+ is_stripe_enabled = <?php echo ($is_addon_stripe_active && (int) WD_FM_STRIPE_controller::stripe_enable($row->id) ? 1 : 0); ?>;
177
+ form_view = 1;
178
+ form_view_count = 1;
179
+ form_view_max = 1;
180
+ function submitbutton() {
181
+ <?php if ($id) { ?>
182
+ if (!document.getElementById('araqel') || (document.getElementById('araqel').value == '0')) {
183
+ alert('Please wait while page loading.');
184
+ return false;
185
+ }
186
+ <?php } ?>
187
+ tox = '';
188
+ form_fields = '';
189
+ document.getElementById('take').style.display = "none";
190
+ document.getElementById('page_bar').style.display = "none";
191
+ jQuery('#saving').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
192
+ jQuery('.wdform_section').each(function() {
193
+ var this2 = this;
194
+ jQuery(this2).find('.wdform_column').each(function() {
195
+ if(!jQuery(this).html() && jQuery(this2).children().length>1)
196
+ jQuery(this).remove();
197
+ });
198
+ });
199
+ remove_whitespace(document.getElementById('take'));
200
+ l_id_array = [<?php echo $labels['id']?>];
201
+ l_label_array = [<?php echo $labels['label']?>];
202
+ l_type_array = [<?php echo $labels['type']?>];
203
+ l_id_removed = [];
204
+ for (x = 0; x < l_id_array.length; x++) {
205
+ l_id_removed[l_id_array[x]] = true;
206
+ }
207
+ for (t = 1; t <= form_view_max; t++) {
208
+ if (document.getElementById('form_id_tempform_view' + t)) {
209
+ wdform_page = document.getElementById('form_id_tempform_view' + t);
210
+ remove_whitespace(wdform_page);
211
+ n = wdform_page.childNodes.length - 2;
212
+ for (q = 0; q <= n; q++) {
213
+ if (!wdform_page.childNodes[q].getAttribute("wdid")) {
214
+ wdform_section = wdform_page.childNodes[q];
215
+ for (x = 0; x < wdform_section.childNodes.length; x++) {
216
+ wdform_column = wdform_section.childNodes[x];
217
+ if (wdform_column.firstChild) {
218
+ for (y=0; y < wdform_column.childNodes.length; y++) {
219
+ is_in_old = false;
220
+ wdform_row = wdform_column.childNodes[y];
221
+ if (wdform_row.nodeType == 3) {
222
+ continue;
223
+ }
224
+ wdid = wdform_row.getAttribute("wdid");
225
+ if (!wdid) {
226
+ continue;
227
+ }
228
+ l_id = wdid;
229
+ l_label = document.getElementById(wdid + '_element_labelform_id_temp').innerHTML;
230
+ l_label = l_label.replace(/(\r\n|\n|\r)/gm," ");
231
+ wdtype = wdform_row.firstChild.getAttribute('type');
232
+
233
+ for (var z = 0; z < l_id_array.length; z++) {
234
+ if (l_type_array[z] == "type_address") {
235
+ if (document.getElementById(l_id + "_mini_label_street1") || document.getElementById(l_id + "_mini_label_street2") || document.getElementById(l_id + "_mini_label_city") || document.getElementById(l_id + "_mini_label_state") || document.getElementById(l_id+"_mini_label_postal") || document.getElementById(l_id+"_mini_label_country")) {
236
+ l_id_removed[l_id_array[z]] = false;
237
+ }
238
+ }
239
+ else {
240
+ if (l_id_array[z] == wdid) {
241
+ l_id_removed[l_id] = false;
242
+ }
243
+ }
244
+
245
+ }
246
+
247
+ if (wdtype == "type_address") {
248
+ addr_id = parseInt(wdid);
249
+ id_for_country = addr_id;
250
+ if (document.getElementById(id_for_country + "_mini_label_street1"))
251
+ tox = tox + addr_id + '#**id**#' + document.getElementById(id_for_country + "_mini_label_street1").innerHTML + '#**label**#type_address#****#';
252
+ addr_id++;
253
+ if (document.getElementById(id_for_country + "_mini_label_street2"))
254
+ tox = tox + addr_id + '#**id**#' + document.getElementById(id_for_country + "_mini_label_street2").innerHTML + '#**label**#type_address#****#';
255
+ addr_id++;
256
+ if (document.getElementById(id_for_country+"_mini_label_city"))
257
+ tox = tox + addr_id + '#**id**#' + document.getElementById(id_for_country + "_mini_label_city").innerHTML + '#**label**#type_address#****#';
258
+ addr_id++;
259
+ if (document.getElementById(id_for_country + "_mini_label_state"))
260
+ tox = tox + addr_id + '#**id**#' + document.getElementById(id_for_country + "_mini_label_state").innerHTML + '#**label**#type_address#****#';
261
+ addr_id++;
262
+ if (document.getElementById(id_for_country + "_mini_label_postal"))
263
+ tox = tox + addr_id + '#**id**#' + document.getElementById(id_for_country + "_mini_label_postal").innerHTML + '#**label**#type_address#****#';
264
+ addr_id++;
265
+ if (document.getElementById(id_for_country+"_mini_label_country")) {
266
+ tox=tox + addr_id + '#**id**#' + document.getElementById(id_for_country + "_mini_label_country").innerHTML + '#**label**#type_address#****#';
267
+ }
268
+
269
+ }
270
+ else {
271
+ tox = tox + wdid + '#**id**#' + l_label + '#**label**#' + wdtype + '#****#';
272
+ }
273
+
274
+ id = wdid;
275
+ form_fields += wdid + "*:*id*:*";
276
+ form_fields += wdtype + "*:*type*:*";
277
+ w_choices = new Array();
278
+ w_choices_value=new Array();
279
+ w_choices_checked = new Array();
280
+ w_choices_disabled = new Array();
281
+ w_choices_params =new Array();
282
+ w_allow_other_num = 0;
283
+ w_property = new Array();
284
+ w_property_type = new Array();
285
+ w_property_values = new Array();
286
+ w_choices_price = new Array();
287
+ if (document.getElementById(id+'_element_labelform_id_temp').innerHTML) {
288
+ w_field_label = document.getElementById(id + '_element_labelform_id_temp').innerHTML.replace(/(\r\n|\n|\r)/gm," ");
289
+ }
290
+ else {
291
+ w_field_label = " ";
292
+ }
293
+ if (document.getElementById(id + '_label_sectionform_id_temp')) {
294
+ if (document.getElementById(id + '_label_sectionform_id_temp').style.display == "block") {
295
+ w_field_label_pos = "top";
296
+ }
297
+ else {
298
+ w_field_label_pos = "left";
299
+ }
300
+ }
301
+ if (document.getElementById(id + "_elementform_id_temp")) {
302
+ s = document.getElementById(id + "_elementform_id_temp").style.width;
303
+ w_size=s.substring(0,s.length - 2);
304
+ }
305
+ if (document.getElementById(id + "_label_sectionform_id_temp")) {
306
+ s = document.getElementById(id + "_label_sectionform_id_temp").style.width;
307
+ w_field_label_size = s.substring(0, s.length - 2);
308
+ }
309
+ if (document.getElementById(id + "_requiredform_id_temp")) {
310
+ w_required = document.getElementById(id + "_requiredform_id_temp").value;
311
+ }
312
+ if (document.getElementById(id + "_uniqueform_id_temp")) {
313
+ w_unique = document.getElementById(id + "_uniqueform_id_temp").value;
314
+ }
315
+ if (document.getElementById(id + '_label_sectionform_id_temp')) {
316
+ w_class = document.getElementById(id + '_label_sectionform_id_temp').getAttribute("class");
317
+ if (!w_class) {
318
+ w_class = "";
319
+ }
320
+ }
321
+ gen_form_fields();
322
+ wdform_row.innerHTML = "%" + id + " - " + l_label + "%";
323
+ }
324
+ }
325
+ }
326
+ }
327
+ else {
328
+ id = wdform_page.childNodes[q].getAttribute("wdid");
329
+ w_editor = document.getElementById(id + "_element_sectionform_id_temp").innerHTML;
330
+ form_fields += id + "*:*id*:*";
331
+ form_fields += "type_section_break" + "*:*type*:*";
332
+ form_fields += "custom_" + id + "*:*w_field_label*:*";
333
+ form_fields += w_editor + "*:*w_editor*:*";
334
+ form_fields += "*:*new_field*:*";
335
+ wdform_page.childNodes[q].innerHTML = "%" + id + " - " + "custom_" + id + "%";
336
+ }
337
+ }
338
+ }
339
+ }
340
+ document.getElementById('label_order_current').value = tox;
341
+
342
+ for (x = 0; x < l_id_array.length; x++) {
343
+ if (l_id_removed[l_id_array[x]]) {
344
+ tox = tox + l_id_array[x] + '#**id**#' + l_label_array[x] + '#**label**#' + l_type_array[x] + '#****#';
345
+ }
346
+ }
347
+
348
+ document.getElementById('label_order').value = tox;
349
+ document.getElementById('form_fields').value = form_fields;
350
+ refresh_();
351
+ document.getElementById('pagination').value=document.getElementById('pages').getAttribute("type");
352
+ document.getElementById('show_title').value=document.getElementById('pages').getAttribute("show_title");
353
+ document.getElementById('show_numbers').value=document.getElementById('pages').getAttribute("show_numbers");
354
+ return true;
355
+ }
356
+
357
+ gen = <?php echo (($id != 0) ? $row->counter : 1); ?>;
358
+
359
+ function enable() {
360
+ alltypes = Array('customHTML', 'text', 'checkbox', 'radio', 'time_and_date', 'select', 'file_upload', 'captcha', 'map', 'button', 'page_break', 'section_break', 'paypal', 'survey');
361
+ for (x = 0; x < 14; x++) {
362
+ document.getElementById('img_' + alltypes[x]).src = "<?php echo WD_FM_URL . '/images/'; ?>" + alltypes[x] + ".png?ver=<?php echo WD_FM_VERSION; ?>";
363
+ }
364
+ if (document.getElementById('formMakerDiv').style.display == 'block') {
365
+ jQuery('#formMakerDiv').slideToggle(200);
366
+ }
367
+ else {
368
+ jQuery('#formMakerDiv').slideToggle(400);
369
+ }
370
+
371
+ if (document.getElementById('formMakerDiv1').style.display == 'block') {
372
+ jQuery('#formMakerDiv1').slideToggle(200);
373
+ }
374
+ else {
375
+ jQuery('#formMakerDiv1').slideToggle(400);
376
+ }
377
+ document.getElementById('when_edit').style.display = 'none';
378
+ }
379
+
380
+ function enable2() {
381
+ alltypes = Array('customHTML', 'text', 'checkbox', 'radio', 'time_and_date', 'select', 'file_upload', 'captcha', 'map', 'button', 'page_break', 'section_break', 'paypal', 'survey');
382
+ for (x = 0; x < 14; x++) {
383
+ document.getElementById('img_' + alltypes[x]).src = "<?php echo WD_FM_URL . '/images/'; ?>" + alltypes[x] + ".png?ver=<?php echo WD_FM_VERSION; ?>";
384
+ }
385
+ if (document.getElementById('formMakerDiv').style.display == 'block') {
386
+ jQuery('#formMakerDiv').slideToggle(200);
387
+ }
388
+ else {
389
+ jQuery('#formMakerDiv').slideToggle(400);
390
+ }
391
+
392
+ if (document.getElementById('formMakerDiv1').style.display == 'block') {
393
+ jQuery('#formMakerDiv1').slideToggle(200);
394
+ }
395
+ else {
396
+ jQuery('#formMakerDiv1').slideToggle(400);
397
+ }
398
+ document.getElementById('when_edit').style.display = 'block';
399
+ if (document.getElementById('field_types').offsetWidth) {
400
+ document.getElementById('when_edit').style.width = 'inherit';
401
+ }
402
+ if (document.getElementById('field_types').offsetHeight) {
403
+ document.getElementById('when_edit').style.height = 'inherit';
404
+ }
405
+ }
406
+ </script>
407
+ <form class="wrap" id="manage_form" method="post" action="admin.php?page=manage_fm">
408
+ <?php wp_nonce_field('nonce_fm', 'nonce_fm'); ?>
409
+ <h2 class="fm-h2-message"></h2>
410
+ <div class="fm-page-header">
411
+ <!-- <div class="fm-page-title">
412
+ <?php echo $page_title; ?>
413
+ </div> -->
414
+ <div style="float:left;">
415
+ <div class="fm-logo-edit-page"></div>
416
+ <div class="fm-title-edit-page">Form</br>Maker</div>
417
+ </div>
418
+ <div class="fm-page-actions">
419
+ <?php
420
+ if(isset($row->backup_id) )
421
+ if($row->backup_id!="") {
422
+ $query = "SELECT backup_id FROM " . $wpdb->prefix . "formmaker_backup WHERE backup_id > ".$row->backup_id." AND id = ".$row->id." ORDER BY backup_id ASC LIMIT 0 , 1 ";
423
+ $backup_id = $wpdb->get_var($query);
424
+ if($backup_id) { ?>
425
+ <button class="fm-button redo-button medium" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; jQuery('#saving_text').html('Redo');fm_set_input_value('task', 'redo');">
426
+ <span></span>
427
+ Redo
428
+ </button>
429
+ <?php
430
+ }
431
+ $query = "SELECT backup_id FROM " . $wpdb->prefix . "formmaker_backup WHERE backup_id < ".$row->backup_id." AND id = ".$row->id." ORDER BY backup_id DESC LIMIT 0 , 1 ";
432
+ $backup_id = $wpdb->get_var($query);
433
+
434
+ if($backup_id) { ?>
435
+ <button class="fm-button undo-button medium" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; jQuery('#saving_text').html('Undo');fm_set_input_value('task', 'undo');">
436
+ <span></span>
437
+ Undo
438
+ </button>
439
+ <?php
440
+ }
441
+ }
442
+ ?>
443
+
444
+ <?php if ($id) { ?>
445
+ <button class="fm-button save-as-copy-button medium" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; fm_set_input_value('task', 'save_as_copy');">
446
+ <span></span>
447
+ Save as Copy
448
+ </button>
449
+ <?php } ?>
450
+ <button class="fm-button save-button medium" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; fm_set_input_value('task', 'save');">
451
+ <span></span>
452
+ Save
453
+ </button>
454
+ <button class="fm-button apply-button medium" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; fm_set_input_value('task', 'apply');">
455
+ <span></span>
456
+ Apply
457
+ </button>
458
+ <button class="fm-button cancel-button medium" onclick="fm_set_input_value('task', 'cancel');">
459
+ <span></span>
460
+ Cancel
461
+ </button>
462
+ </div>
463
+ <div class="fm-clear"></div>
464
+ </div>
465
+
466
+ <div class="fm-theme-banner">
467
+ <div class="fm-title">
468
+ <span style="">Title:&nbsp;</span>
469
+ <input id="title" name="title" value="<?php echo $row->title; ?>"/>
470
+ </div>
471
+ <div class="fm-page-actions">
472
+ <button class="fm-button display-options-button large" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; fm_set_input_value('task', 'view_display_options');">
473
+ <span></span>
474
+ Display Options
475
+ </button>
476
+ <button class="fm-button form-options-button medium" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; fm_set_input_value('task', 'view_options');">
477
+ <span></span>
478
+ Form Options
479
+ </button>
480
+ <?php
481
+ $fm_settings = get_option('fm_settings');
482
+ $fm_advanced_layout = isset($fm_settings['fm_advanced_layout']) ? $fm_settings['fm_advanced_layout'] : '';
483
+ if ($row->id) {
484
+ $autogen_layout = $wpdb->get_var($wpdb->prepare('SELECT autogen_layout FROM ' . $wpdb->prefix . 'formmaker WHERE id="%d"', $row->id));
485
+ }
486
+ else {
487
+ $autogen_layout = 1;
488
+ }
489
+ if ($fm_advanced_layout || $autogen_layout == 0) {
490
+ ?>
491
+ <button class="fm-button form-layout-button large" onclick="if (fm_check_required('title', 'Form title') || !submitbutton()) {return false;}; fm_set_input_value('task', 'form_layout');">
492
+ <span></span>
493
+ Advanced Layout
494
+ </button>
495
+ <?php
496
+ }
497
+ ?>
498
+ </div>
499
+ </div>
500
+ <div class="fm-clear"></div>
501
+ <div class="fm-theme-banner">
502
+ <div class="fm-theme" style="float:left;">
503
+ <span style="">Theme:&nbsp;</span>
504
+ <select id="theme" name="theme" onChange="set_preview()">
505
+ <optgroup label="New Themes">
506
+ <option value="0" <?php echo $row->theme && $row->theme == 0 ? 'selected' : '' ?> data-version="2">Inherit From Website Theme</option>
507
+ <?php
508
+ $optiongroup = true;
509
+ foreach ($themes as $theme) {
510
+ if ($optiongroup && $theme->version == 1) {
511
+ $optiongroup = false;
512
+ ?>
513
+ </optgroup>
514
+ <optgroup label="Outdated Themes">
515
+ <?php
516
+ }
517
+ ?>
518
+ <option value="<?php echo $theme->id; ?>" <?php echo (($theme->id == $row->theme) ? 'selected' : ''); ?> data-version="<?php echo $theme->version; ?>"><?php echo $theme->title; ?></option>
519
+ <?php
520
+ }
521
+ ?>
522
+ </optgroup>
523
+ </select>
524
+ <button id="preview_form" class="fm-button preview-button medium"<?php if (!$id) echo ' disabled="disabled"' ?> onclick="tb_show('', '<?php echo add_query_arg(array('action' => 'FormMakerPreview', 'form_id' => $row->id, 'test_theme' => $row->theme, 'form_preview' => 1, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>'); return false;">
525
+ <span></span>
526
+ Preview
527
+ </button>
528
+ <button id="edit_css" class="fm-button options-edit-button medium" onclick="window.open('<?php echo add_query_arg(array('current_id' => ($row->theme ? $row->theme : $default_theme), 'nonce_fm' => wp_create_nonce('nonce_fm')), admin_url('admin.php?page=themes_fm&task=edit')); ?>'); return false;">
529
+ <span></span>
530
+ Edit
531
+ </button>
532
+ <div id="old_theme_notice" class="wd_error" style="display: none;">The theme you have selected is outdated. Please choose one from New Themes section.</div>
533
+ </div>
534
+ <div style="float:right;">
535
+ <button class="fm-button add-new-button large" onclick="enable(); Enable(); return false;">
536
+ Add a New Field
537
+ <span></span>
538
+ </button>
539
+ </div>
540
+ </div>
541
+ <div class="fm-clear"></div>
542
+ <div id="formMakerDiv" onclick="close_window()"></div>
543
+ <div id="formMakerDiv1">
544
+ <table class="formMakerDiv1_table" border="0" width="100%" cellpadding="0" cellspacing="0" height="100%">
545
+ <tr>
546
+ <td style="padding:0px">
547
+ <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" >
548
+ <tr valign="top">
549
+ <td width="20%" height="100%" id="field_types">
550
+ <div id="when_edit" style="display: none;"></div>
551
+ <table border="0" cellpadding="0" cellspacing="3" width="100%" style="border-collapse: separate; border-spacing: 3px;">
552
+ <tbody>
553
+ <tr>
554
+ <td align="center" onclick="addRow('customHTML')" class="field_buttons" id="table_editor">
555
+ <img src="<?php echo WD_FM_URL; ?>/images/customHTML.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_customHTML">
556
+ <div>Custom HTML</div>
557
+ </td>
558
+ <td align="center" onclick="addRow('text')" class="field_buttons" id="table_text">
559
+ <img src="<?php echo WD_FM_URL; ?>/images/text.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_text">
560
+ <div>Text input</div>
561
+ </td>
562
+ </tr>
563
+ <tr>
564
+ <td align="center" onclick="addRow('checkbox')" class="field_buttons" id="table_checkbox">
565
+ <img src="<?php echo WD_FM_URL; ?>/images/checkbox.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_checkbox">
566
+ <div>Multiple Choice</div>
567
+ </td>
568
+ <td align="center" onclick="addRow('radio')" class="field_buttons" id="table_radio">
569
+ <img src="<?php echo WD_FM_URL; ?>/images/radio.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_radio">
570
+ <div>Single Choice</div>
571
+ </td>
572
+ </tr>
573
+ <tr>
574
+ <td align="center" onclick="addRow('survey')" class="field_buttons" id="table_survey">
575
+ <img src="<?php echo WD_FM_URL; ?>/images/survey.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_survey">
576
+ <div>Survey Tools</div>
577
+ </td>
578
+ <td align="center" onclick="addRow('time_and_date')" class="field_buttons" id="table_time_and_date">
579
+ <img src="<?php echo WD_FM_URL; ?>/images/time_and_date.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_time_and_date">
580
+ <div>Time and Date</div>
581
+ </td>
582
+ </tr>
583
+ <tr>
584
+ <td align="center" onclick="addRow('select')" class="field_buttons" id="table_select">
585
+ <img src="<?php echo WD_FM_URL; ?>/images/select.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_select">
586
+ <div>Select Box</div>
587
+ </td>
588
+ <td align="center" onclick="alert('This field type is disabled in free version. If you need this functionality, you need to buy the commercial version.')" class="field_buttons field_disabled" id="table_file_upload">
589
+ <img src="<?php echo WD_FM_URL; ?>/images/file_upload.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_file_upload">
590
+ <div>File Upload</div>
591
+ </td>
592
+ </tr>
593
+ <tr>
594
+ <td align="center" onclick="addRow('section_break')" class="field_buttons" id="table_section_break">
595
+ <img src="<?php echo WD_FM_URL; ?>/images/section_break.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_section_break">
596
+ <div>Section Break</div>
597
+ </td>
598
+ <td align="center" onclick="addRow('page_break')" class="field_buttons" id="table_page_break">
599
+ <img src="<?php echo WD_FM_URL; ?>/images/page_break.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_page_break">
600
+ <div>Page Break</div>
601
+ </td>
602
+ </tr>
603
+ <tr>
604
+ <td align="center" onclick="alert('This field type is disabled in free version. If you need this functionality, you need to buy the commercial version.')" class="field_buttons field_disabled" id="table_map">
605
+ <img src="<?php echo WD_FM_URL; ?>/images/map.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_map">
606
+ <div>Map</div>
607
+ </td>
608
+ <td align="center" onclick="alert('This field type is disabled in free version. If you need this functionality, you need to buy the commercial version.')" id="table_paypal" class="field_buttons field_disabled">
609
+ <img src="<?php echo WD_FM_URL; ?>/images/paypal.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_paypal">
610
+ <div>Payment</div>
611
+ </td>
612
+ </tr>
613
+ <tr>
614
+ <td align="center" onclick="addRow('captcha')" class="field_buttons" id="table_captcha">
615
+ <img src="<?php echo WD_FM_URL; ?>/images/captcha.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_captcha">
616
+ <div>Captcha</div>
617
+ </td>
618
+ <td align="center" onclick="addRow('button')" id="table_button" class="field_buttons">
619
+ <img src="<?php echo WD_FM_URL; ?>/images/button.png?ver=<?php echo WD_FM_VERSION; ?>" style="margin:5px" id="img_button">
620
+ <div>Button</div>
621
+ </td>
622
+ </tr>
623
+ </tbody>
624
+ </table>
625
+ </td>
626
+ <td width="40%" height="100%" align="left">
627
+ <div id="edit_table"></div>
628
+ </td>
629
+ <td align="center" valign="top" style="background: url("<?php echo WD_FM_URL . '/images/border2.png'; ?>") repeat-y;">&nbsp;</td>
630
+ <td style="padding:15px;">
631
+ <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" >
632
+ <tr>
633
+ <td align="right">
634
+ <input type="radio" value="end" name="el_pos" checked="checked" id="pos_end" onclick="Disable()"/>
635
+ At The End
636
+ <input type="radio" value="begin" name="el_pos" id="pos_begin" onclick="Disable()"/>
637
+ At The Beginning
638
+ <input type="radio" value="before" name="el_pos" id="pos_before" onclick="Enable()"/>
639
+ Before
640
+ <select style="width: 100px; margin-left: 5px;" id="sel_el_pos" onclick="change_before()" disabled="disabled"></select>
641
+ <br>
642
+ <button class="fm-button field-save-button medium" onclick="add(0, false); return false;">
643
+ Save
644
+ <span></span>
645
+ </button>
646
+ <button class="fm-button cancel-button medium" onclick="close_window(); return false;">
647
+ Cancel
648
+ <span></span>
649
+ </button>
650
+ <hr style="margin-bottom:10px" />
651
+ </td>
652
+ </tr>
653
+ <tr height="100%" valign="top">
654
+ <td id="show_table"></td>
655
+ </tr>
656
+ </table>
657
+ </td>
658
+ </tr>
659
+ </table>
660
+ </td>
661
+ </tr>
662
+ </table>
663
+ <input type="hidden" id="old" />
664
+ <input type="hidden" id="old_selected" />
665
+ <input type="hidden" id="element_type" />
666
+ <input type="hidden" id="editing_id" />
667
+ <input type="hidden" value="<?php echo WD_FM_URL; ?>" id="form_plugins_url" />
668
+ <div id="main_editor" style="position: fixed; display: none; z-index: 140;">
669
+ <?php if (user_can_richedit()) {
670
+ wp_editor('', 'form_maker_editor', array('teeny' => FALSE, 'textarea_name' => 'form_maker_editor', 'media_buttons' => FALSE, 'textarea_rows' => 5));
671
+ }
672
+ else { ?>
673
+ <textarea name="form_maker_editor" id="form_maker_editor" cols="40" rows="5" style="width: 440px; height: 350px;" class="mce_editable" aria-hidden="true"></textarea>
674
+ <?php
675
+ }
676
+ ?>
677
+ </div>
678
+ </div>
679
+ <?php if (!function_exists('the_editor')) { ?>
680
+ <iframe id="tinymce" style="display: none;"></iframe>
681
+ <?php } ?>
682
+
683
+ <?php
684
+ $animation_effects = array(
685
+ 'none' => 'None',
686
+ 'bounce' => 'Bounce',
687
+ 'tada' => 'Tada',
688
+ 'bounceInDown' => 'BounceInDown',
689
+ 'fadeInLeft' => 'FadeInLeft',
690
+ 'flash' => 'Flash',
691
+ 'pulse' => 'Pulse',
692
+ 'rubberBand' => 'RubberBand',
693
+ 'shake' => 'Shake',
694
+ 'swing' => 'Swing',
695
+ 'wobble' => 'Wobble',
696
+ 'hinge' => 'Hinge',
697
+ 'lightSpeedIn' => 'LightSpeedIn',
698
+ 'rollIn' => 'RollIn',
699
+ 'bounceIn' => 'BounceIn',
700
+ 'bounceInLeft' => 'BounceInLeft',
701
+ 'bounceInRight' => 'BounceInRight',
702
+ 'bounceInUp' => 'BounceInUp',
703
+ 'fadeIn' => 'FadeIn',
704
+ 'fadeInDown' => 'FadeInDown',
705
+ 'fadeInDownBig' => 'FadeInDownBig',
706
+ 'fadeInLeftBig' => 'FadeInLeftBig',
707
+ 'fadeInRight' => 'FadeInRight',
708
+ 'fadeInRightBig' => 'FadeInRightBig',
709
+ 'fadeInUp' => 'FadeInUp',
710
+ 'fadeInUpBig' => 'FadeInUpBig',
711
+ 'flip' => 'Flip',
712
+ 'flipInX' => 'FlipInX',
713
+ 'flipInY' => 'FlipInY',
714
+ 'rotateIn' => 'RotateIn',
715
+ 'rotateInDownLeft' => 'RotateInDownLeft',
716
+ 'rotateInDownRight' => 'RotateInDownRight',
717
+ 'rotateInUpLeft' => 'RotateInUpLeft',
718
+ 'rotateInUpRight' => 'RotateInUpRight',
719
+ 'zoomIn' => 'ZoomIn',
720
+ 'zoomInDown' => 'ZoomInDown',
721
+ 'zoomInLeft' => 'ZoomInLeft',
722
+ 'zoomInRight' => 'ZoomInRight',
723
+ 'zoomInUp' => 'ZoomInUp',
724
+ );
725
+ ?>
726
+ <div class="fm-edit-content panel form-header">
727
+ <div class="panel-heading">
728
+ <span class="fm-header-bg"></span>
729
+ Header
730
+ <span class="fm-expcol pull-right" onclick="jQuery(this).toggleClass('fm-expanded'); jQuery('#fm-header-content').toggleClass('fm-hide');"></span>
731
+ </div>
732
+ <div id="fm-header-content" class="panel-content fm-hide">
733
+ <div class="col-md-6 col-xs-12">
734
+ <div class="fm-row">
735
+ <label>Title: </label>
736
+ <input type="text" id="header_title" name="header_title" value="<?php echo $row->header_title; ?>"/>
737
+ </div>
738
+ <div class="fm-row">
739
+ <label>Description: </label>
740
+ <div id="description_editor" style="width:470px; display: inline-block; vertical-align: middle;">
741
+ <?php if (user_can_richedit()) {
742
+ wp_editor($row->header_description, 'header_description', array('teeny' => FALSE, 'textarea_name' => 'header_description', 'media_buttons' => FALSE, 'textarea_rows' => 5));
743
+ }
744
+ else { ?>
745
+ <textarea name="header_description" id="header_description" cols="40" rows="5" style="width: 440px; height: 350px;" class="mce_editable" aria-hidden="true"></textarea>
746
+ <?php
747
+ }
748
+ ?>
749
+ </div>
750
+ </div>
751
+ </div>
752
+ <div class="col-md-6 col-xs-12">
753
+ <div class="fm-row">
754
+ <label>Image: </label>
755
+ <input type="text" id="header_image_url" name="header_image_url" value="<?php echo $row->header_image_url; ?>"/>
756
+ <button class="fm-button add-button medium" onclick="fmOpenMediaUploader(event); return false;">Add Image</button>
757
+ <?php $header_bg = $row->header_image_url ? 'background-image: url('.$row->header_image_url.'); background-position: center;' : ''; ?>
758
+ <div id="header_image" class="header_img<?php if (!$row->header_image_url) echo ' fm-hide'; ?>" style="<?php echo $header_bg; ?>">
759
+ <button type="button" id="remove_header_img" onclick="fmRemoveHeaderImage(event); return false;">
760
+ <i class="mce-ico mce-i-dashicon dashicons-no"></i>
761
+ </button>
762
+ </div>
763
+ </div>
764
+ <div class="fm-row">
765
+ <label>Image Animation: </label>
766
+ <select name="header_image_animation">
767
+ <?php
768
+ foreach($animation_effects as $anim_key => $animation_effect){
769
+ $selected = $row->header_image_animation == $anim_key ? 'selected="selected"' : '';
770
+ echo '<option value="'.$anim_key.'" '.$selected.'>'.$animation_effect.'</option>';
771
+ }
772
+ ?>
773
+ </select>
774
+ </div>
775
+ <div class="fm-row">
776
+ <label for="header_hide_image">Hide Image on Mobile: </label>
777
+ <input type="checkbox" id="header_hide_image" name="header_hide_image" value="1" <?php echo $row->header_hide_image == '1' ? 'checked="checked"' : '' ?> />
778
+ </div>
779
+ </div>
780
+ <div class="fm-clear"></div>
781
+ </div>
782
+ </div>
783
+
784
+ <div class="fm-edit-content">
785
+ <div class="fm-drag-and-drop">
786
+ <div>
787
+ <label for="enable_sortable">Enable Drag & Drop</label>
788
+ <button name="sortable" id="enable_sortable" class="fm-checkbox-radio-button <?php echo $row->sortable == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="enable_drag(this); return false;" value="<?php echo $row->sortable; ?>">
789
+ <span></span>
790
+ </button>
791
+ <input type="hidden" name="sortable" id="sortable_hidden" value="<?php echo $row->sortable; ?>"/>
792
+ </div>
793
+ <div>
794
+ You can use drag and drop to move the fields up/down for the change of the order and left/right for creating columns within the form.
795
+ </div>
796
+ </div>
797
+ <fieldset>
798
+ <legend></legend>
799
+ <?php if ($id) { ?>
800
+ <div style="margin: 8px; display: table; width: 100%;" id="page_bar">
801
+ <div id="page_navigation" style="display: table-row;">
802
+ <div align="center" id="pages" show_title="<?php echo $row->show_title; ?>" show_numbers="<?php echo $row->show_numbers; ?>" type="<?php echo $row->pagination; ?>" style="display: table-cell; width:90%;"></div>
803
+ <div align="left" id="edit_page_navigation" style="display: table-cell; vertical-align: middle;"></div>
804
+ </div>
805
+ </div>
806
+ <div id="take" class="main">
807
+ <?php echo $row->form_front; ?>
808
+ </div>
809
+ <?php } else { ?>
810
+ <div style="margin:8px; display:table; width:100%" id="page_bar">
811
+ <div id="page_navigation" style="display:table-row">
812
+ <div align="center" id="pages" show_title="false" show_numbers="true" type="none" style="display:table-cell; width:90%"></div>
813
+ <div align="left" id="edit_page_navigation" style="display:table-cell; vertical-align: middle;"></div>
814
+ </div>
815
+ </div>
816
+ <div id="take" class="main">
817
+ <div class="wdform-page-and-images" style="display:table; border-top:0px solid black;">
818
+ <div id="form_id_tempform_view1" class="wdform_page" page_title="Untitled page" next_title="Next" next_type="text" next_class="wdform-page-button" next_checkable="false" previous_title="Previous" previous_type="text" previous_class="wdform-page-button" previous_checkable="false">
819
+ <div class="wdform_section">
820
+ <div class="wdform_column"></div>
821
+ </div>
822
+ <div valign="top" class="wdform_footer" style="width: 100%;">
823
+ <div style="width: 100%;">
824
+ <div style="width: 100%; display: table; padding-top:10px;">
825
+ <div style="display: table-row-group;">
826
+ <div id="form_id_temppage_nav1" style="display: table-row;"></div>
827
+ </div>
828
+ </div>
829
+ </div>
830
+ </div>
831
+ </div>
832
+ <div id="form_id_tempform_view_img1" style="float: right;">
833
+ <div>
834
+ <img src="<?php echo WD_FM_URL . '/images/minus.png?ver='. WD_FM_VERSION; ?>" title="Show or hide the page" class="page_toolbar" onClick="show_or_hide('1')" onMouseOver="chnage_icons_src(this,'minus')" onmouseout="chnage_icons_src(this,'minus')" id="show_page_img_1"/>
835
+ <img src="<?php echo WD_FM_URL . '/images/page_delete.png?ver='. WD_FM_VERSION; ?>" title="Delete the page" class="page_toolbar" onClick="remove_page('1')" onMouseOver="chnage_icons_src(this,'page_delete')" onmouseout="chnage_icons_src(this,'page_delete')"/>
836
+ <img src="<?php echo WD_FM_URL . '/images/page_delete_all.png?ver='. WD_FM_VERSION; ?>" title="Delete the page with fields" class="page_toolbar" onClick="remove_page_all('1')" onMouseOver="chnage_icons_src(this,'page_delete_all')" onmouseout="chnage_icons_src(this,'page_delete_all')"/>
837
+ <img src="<?php echo WD_FM_URL . '/images/page_edit.png?ver='. WD_FM_VERSION; ?>" title="Edit the page" class="page_toolbar" onClick="edit_page_break('1')" onMouseOver="chnage_icons_src(this,'page_edit')" onmouseout="chnage_icons_src(this,'page_edit')"/>
838
+ </div>
839
+ </div>
840
+ </div>
841
+ </div>
842
+ <?php } ?>
843
+ </fieldset>
844
+ </div>
845
+ <input type="hidden" name="form_front" id="form_front" />
846
+ <input type="hidden" name="form_fields" id="form_fields" />
847
+ <input type="hidden" name="pagination" id="pagination" />
848
+ <input type="hidden" name="show_title" id="show_title" />
849
+ <input type="hidden" name="show_numbers" id="show_numbers" />
850
+ <input type="hidden" name="public_key" id="public_key" />
851
+ <input type="hidden" name="private_key" id="private_key" />
852
+ <input type="hidden" name="recaptcha_theme" id="recaptcha_theme" />
853
+ <input type="hidden" id="label_order" name="label_order" value="<?php echo $row->label_order; ?>" />
854
+ <input type="hidden" id="label_order_current" name="label_order_current" value="<?php echo $row->label_order_current; ?>" />
855
+ <input type="hidden" name="counter" id="counter" value="<?php echo $row->counter; ?>" />
856
+ <input type="hidden" id="araqel" value="0" />
857
+ <input type="hidden" name="backup_id" id="backup_id" value="<?php echo $row->backup_id;?>">
858
+
859
+ <script type="text/javascript">
860
+ default_theme = "<?php echo $default_theme; ?>";
861
+ function set_preview() {
862
+ theme_id = jQuery('#theme').val() == '0' ? default_theme : jQuery('#theme').val();
863
+ jQuery("#preview_form").attr("onclick", "tb_show('', '<?php echo add_query_arg(array('action' => 'FormMakerPreview', 'form_id' => $row->id, 'form_preview' => 1), admin_url('admin-ajax.php')); ?>&test_theme=" + theme_id + "&width=1000&height=500&TB_iframe=1'); return false;");
864
+ jQuery("#edit_css").attr("onclick", "window.open('<?php echo add_query_arg(array('nonce_fm' => wp_create_nonce('nonce_fm')), admin_url('admin.php?page=themes_fm&task=edit')); ?>&current_id=" + theme_id + "'); return false;");
865
+ if (jQuery('#theme option:selected').attr('data-version') == 1) {
866
+ jQuery("#old_theme_notice").show();
867
+ }
868
+ else {
869
+ jQuery("#old_theme_notice").hide();
870
+ }
871
+ }
872
+ jQuery(document).ready(function () {
873
+ set_preview();
874
+ });
875
+ <?php if ($id) { ?>
876
+ function formOnload() {
877
+ for (t = 0; t < <?php echo $row->counter; ?>; t++) {
878
+ if (document.getElementById(t + "_typeform_id_temp")) {
879
+ if (document.getElementById(t + "_typeform_id_temp").value == "type_map" || document.getElementById(t + "_typeform_id_temp").value == "type_mark_map") {
880
+ if_gmap_init(t);
881
+ for (q = 0; q < 20; q++) {
882
+ if (document.getElementById(t + "_elementform_id_temp").getAttribute("long" + q)) {
883
+ w_long = parseFloat(document.getElementById(t + "_elementform_id_temp").getAttribute("long" + q));
884
+ w_lat = parseFloat(document.getElementById(t + "_elementform_id_temp").getAttribute("lat" + q));
885
+ w_info = parseFloat(document.getElementById(t + "_elementform_id_temp").getAttribute("info" + q));
886
+ add_marker_on_map(t, q, w_long, w_lat, w_info, false);
887
+ }
888
+ }
889
+ }
890
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_date") {
891
+ // Calendar.setup({
892
+ // inputField:t + "_elementform_id_temp",
893
+ // ifFormat:document.getElementById(t + "_buttonform_id_temp").getAttribute('format'),
894
+ // button:t + "_buttonform_id_temp",
895
+ // align:"Tl",
896
+ // singleClick:true,
897
+ // firstDay:0
898
+ // });
899
+ }
900
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_name") {
901
+ var myu = t;
902
+ jQuery(document).ready(function () {
903
+ jQuery("#" + myu + "_mini_label_first").click(function () {
904
+ if (jQuery(this).children('input').length == 0) {
905
+ var first = "<input type='text' id='first' class='first' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
906
+ jQuery(this).html(first);
907
+ jQuery("input.first").focus();
908
+ jQuery("input.first").blur(function () {
909
+ var id_for_blur = document.getElementById('first').parentNode.id.split('_');
910
+ var value = jQuery(this).val();
911
+ jQuery("#" + id_for_blur[0] + "_mini_label_first").text(value);
912
+ });
913
+ }
914
+ });
915
+ jQuery("label#" + myu + "_mini_label_last").click(function () {
916
+ if (jQuery(this).children('input').length == 0) {
917
+ var last = "<input type='text' id='last' class='last' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
918
+ jQuery(this).html(last);
919
+ jQuery("input.last").focus();
920
+ jQuery("input.last").blur(function () {
921
+ var id_for_blur = document.getElementById('last').parentNode.id.split('_');
922
+ var value = jQuery(this).val();
923
+ jQuery("#" + id_for_blur[0] + "_mini_label_last").text(value);
924
+ });
925
+ }
926
+ });
927
+ jQuery("label#" + myu + "_mini_label_title").click(function () {
928
+ if (jQuery(this).children('input').length == 0) {
929
+ var title_ = "<input type='text' id='title_' class='title_' style='outline:none; border:none; background:none; width:50px;' value=\"" + jQuery(this).text() + "\">";
930
+ jQuery(this).html(title_);
931
+ jQuery("input.title_").focus();
932
+ jQuery("input.title_").blur(function () {
933
+ var id_for_blur = document.getElementById('title_').parentNode.id.split('_');
934
+ var value = jQuery(this).val();
935
+ jQuery("#" + id_for_blur[0] + "_mini_label_title").text(value);
936
+ });
937
+ }
938
+ });
939
+ jQuery("label#" + myu + "_mini_label_middle").click(function () {
940
+ if (jQuery(this).children('input').length == 0) {
941
+ var middle = "<input type='text' id='middle' class='middle' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
942
+ jQuery(this).html(middle);
943
+ jQuery("input.middle").focus();
944
+ jQuery("input.middle").blur(function () {
945
+ var id_for_blur = document.getElementById('middle').parentNode.id.split('_');
946
+ var value = jQuery(this).val();
947
+ jQuery("#" + id_for_blur[0] + "_mini_label_middle").text(value);
948
+ });
949
+ }
950
+ });
951
+ });
952
+ }
953
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_phone") {
954
+ var myu = t;
955
+ jQuery(document).ready(function () {
956
+ jQuery("label#" + myu + "_mini_label_area_code").click(function () {
957
+ if (jQuery(this).children('input').length == 0) {
958
+ var area_code = "<input type='text' id='area_code' class='area_code' size='10' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
959
+ jQuery(this).html(area_code);
960
+ jQuery("input.area_code").focus();
961
+ jQuery("input.area_code").blur(function () {
962
+ var id_for_blur = document.getElementById('area_code').parentNode.id.split('_');
963
+ var value = jQuery(this).val();
964
+ jQuery("#" + id_for_blur[0] + "_mini_label_area_code").text(value);
965
+ });
966
+ }
967
+ });
968
+ jQuery("label#" + myu + "_mini_label_phone_number").click(function () {
969
+ if (jQuery(this).children('input').length == 0) {
970
+ var phone_number = "<input type='text' id='phone_number' class='phone_number' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
971
+ jQuery(this).html(phone_number);
972
+ jQuery("input.phone_number").focus();
973
+ jQuery("input.phone_number").blur(function () {
974
+ var id_for_blur = document.getElementById('phone_number').parentNode.id.split('_');
975
+ var value = jQuery(this).val();
976
+ jQuery("#" + id_for_blur[0] + "_mini_label_phone_number").text(value);
977
+ });
978
+ }
979
+ });
980
+ });
981
+ }
982
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_date_fields") {
983
+ var myu = t;
984
+ jQuery(document).ready(function () {
985
+ jQuery("label#" + myu + "_day_label").click(function () {
986
+ if (jQuery(this).children('input').length == 0) {
987
+ var day = "<input type='text' id='day' class='day' size='8' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
988
+ jQuery(this).html(day);
989
+ jQuery("input.day").focus();
990
+ jQuery("input.day").blur(function () {
991
+ var id_for_blur = document.getElementById('day').parentNode.id.split('_');
992
+ var value = jQuery(this).val();
993
+ jQuery("#" + id_for_blur[0] + "_day_label").text(value);
994
+ });
995
+ }
996
+ });
997
+ jQuery("label#" + myu + "_month_label").click(function () {
998
+ if (jQuery(this).children('input').length == 0) {
999
+ var month = "<input type='text' id='month' class='month' size='8' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1000
+ jQuery(this).html(month);
1001
+ jQuery("input.month").focus();
1002
+ jQuery("input.month").blur(function () {
1003
+ var id_for_blur = document.getElementById('month').parentNode.id.split('_');
1004
+ var value = jQuery(this).val();
1005
+ jQuery("#" + id_for_blur[0] + "_month_label").text(value);
1006
+ });
1007
+ }
1008
+ });
1009
+ jQuery("label#" + myu + "_year_label").click(function () {
1010
+ if (jQuery(this).children('input').length == 0) {
1011
+ var year = "<input type='text' id='year' class='year' size='8' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1012
+ jQuery(this).html(year);
1013
+ jQuery("input.year").focus();
1014
+ jQuery("input.year").blur(function () {
1015
+ var id_for_blur = document.getElementById('year').parentNode.id.split('_');
1016
+ var value = jQuery(this).val();
1017
+ jQuery("#" + id_for_blur[0] + "_year_label").text(value);
1018
+ });
1019
+ }
1020
+ });
1021
+ });
1022
+ }
1023
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_time") {
1024
+ var myu = t;
1025
+ jQuery(document).ready(function () {
1026
+ jQuery("label#" + myu + "_mini_label_hh").click(function () {
1027
+ if (jQuery(this).children('input').length == 0) {
1028
+ var hh = "<input type='text' id='hh' class='hh' size='4' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1029
+ jQuery(this).html(hh);
1030
+ jQuery("input.hh").focus();
1031
+ jQuery("input.hh").blur(function () {
1032
+ var id_for_blur = document.getElementById('hh').parentNode.id.split('_');
1033
+ var value = jQuery(this).val();
1034
+ jQuery("#" + id_for_blur[0] + "_mini_label_hh").text(value);
1035
+ });
1036
+ }
1037
+ });
1038
+ jQuery("label#" + myu + "_mini_label_mm").click(function () {
1039
+ if (jQuery(this).children('input').length == 0) {
1040
+ var mm = "<input type='text' id='mm' class='mm' size='4' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1041
+ jQuery(this).html(mm);
1042
+ jQuery("input.mm").focus();
1043
+ jQuery("input.mm").blur(function () {
1044
+ var id_for_blur = document.getElementById('mm').parentNode.id.split('_');
1045
+ var value = jQuery(this).val();
1046
+ jQuery("#" + id_for_blur[0] + "_mini_label_mm").text(value);
1047
+ });
1048
+ }
1049
+ });
1050
+ jQuery("label#" + myu + "_mini_label_ss").click(function () {
1051
+ if (jQuery(this).children('input').length == 0) {
1052
+ var ss = "<input type='text' id='ss' class='ss' size='4' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1053
+ jQuery(this).html(ss);
1054
+ jQuery("input.ss").focus();
1055
+ jQuery("input.ss").blur(function () {
1056
+ var id_for_blur = document.getElementById('ss').parentNode.id.split('_');
1057
+ var value = jQuery(this).val();
1058
+ jQuery("#" + id_for_blur[0] + "_mini_label_ss").text(value);
1059
+ });
1060
+ }
1061
+ });
1062
+ jQuery("label#" + myu + "_mini_label_am_pm").click(function () {
1063
+ if (jQuery(this).children('input').length == 0) {
1064
+ var am_pm = "<input type='text' id='am_pm' class='am_pm' size='4' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1065
+ jQuery(this).html(am_pm);
1066
+ jQuery("input.am_pm").focus();
1067
+ jQuery("input.am_pm").blur(function () {
1068
+ var id_for_blur = document.getElementById('am_pm').parentNode.id.split('_');
1069
+ var value = jQuery(this).val();
1070
+ jQuery("#" + id_for_blur[0] + "_mini_label_am_pm").text(value);
1071
+ });
1072
+ }
1073
+ });
1074
+ });
1075
+ }
1076
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_paypal_price") {
1077
+ var myu = t;
1078
+ jQuery(document).ready(function () {
1079
+ jQuery("#" + myu + "_mini_label_dollars").click(function () {
1080
+ if (jQuery(this).children('input').length == 0) {
1081
+ var dollars = "<input type='text' id='dollars' class='dollars' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1082
+ jQuery(this).html(dollars);
1083
+ jQuery("input.dollars").focus();
1084
+ jQuery("input.dollars").blur(function () {
1085
+ var id_for_blur = document.getElementById('dollars').parentNode.id.split('_');
1086
+ var value = jQuery(this).val();
1087
+ jQuery("#" + id_for_blur[0] + "_mini_label_dollars").text(value);
1088
+ });
1089
+ }
1090
+ });
1091
+ jQuery("label#" + myu + "_mini_label_cents").click(function () {
1092
+ if (jQuery(this).children('input').length == 0) {
1093
+ var cents = "<input type='text' id='cents' class='cents' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1094
+ jQuery(this).html(cents);
1095
+ jQuery("input.cents").focus();
1096
+ jQuery("input.cents").blur(function () {
1097
+ var id_for_blur = document.getElementById('cents').parentNode.id.split('_');
1098
+ var value = jQuery(this).val();
1099
+ jQuery("#" + id_for_blur[0] + "_mini_label_cents").text(value);
1100
+ });
1101
+ }
1102
+ });
1103
+ });
1104
+ }
1105
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_address") {
1106
+ var myu = t;
1107
+ jQuery(document).ready(function () {
1108
+ jQuery("label#" + myu + "_mini_label_street1").click(function () {
1109
+ if (jQuery(this).children('input').length == 0) {
1110
+ var street1 = "<input type='text' id='street1' class='street1' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1111
+ jQuery(this).html(street1);
1112
+ jQuery("input.street1").focus();
1113
+ jQuery("input.street1").blur(function () {
1114
+ var id_for_blur = document.getElementById('street1').parentNode.id.split('_');
1115
+ var value = jQuery(this).val();
1116
+ jQuery("#" + id_for_blur[0] + "_mini_label_street1").text(value);
1117
+ });
1118
+ }
1119
+ });
1120
+ jQuery("label#" + myu + "_mini_label_street2").click(function () {
1121
+ if (jQuery(this).children('input').length == 0) {
1122
+ var street2 = "<input type='text' id='street2' class='street2' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1123
+ jQuery(this).html(street2);
1124
+ jQuery("input.street2").focus();
1125
+ jQuery("input.street2").blur(function () {
1126
+ var id_for_blur = document.getElementById('street2').parentNode.id.split('_');
1127
+ var value = jQuery(this).val();
1128
+ jQuery("#" + id_for_blur[0] + "_mini_label_street2").text(value);
1129
+ });
1130
+ }
1131
+ });
1132
+ jQuery("label#" + myu + "_mini_label_city").click(function () {
1133
+ if (jQuery(this).children('input').length == 0) {
1134
+ var city = "<input type='text' id='city' class='city' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1135
+ jQuery(this).html(city);
1136
+ jQuery("input.city").focus();
1137
+ jQuery("input.city").blur(function () {
1138
+ var id_for_blur = document.getElementById('city').parentNode.id.split('_');
1139
+ var value = jQuery(this).val();
1140
+ jQuery("#" + id_for_blur[0] + "_mini_label_city").text(value);
1141
+ });
1142
+ }
1143
+ });
1144
+ jQuery("label#" + myu + "_mini_label_state").click(function () {
1145
+ if (jQuery(this).children('input').length == 0) {
1146
+ var state = "<input type='text' id='state' class='state' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1147
+ jQuery(this).html(state);
1148
+ jQuery("input.state").focus();
1149
+ jQuery("input.state").blur(function () {
1150
+ var id_for_blur = document.getElementById('state').parentNode.id.split('_');
1151
+ var value = jQuery(this).val();
1152
+ jQuery("#" + id_for_blur[0] + "_mini_label_state").text(value);
1153
+ });
1154
+ }
1155
+ });
1156
+ jQuery("label#" + myu + "_mini_label_postal").click(function () {
1157
+ if (jQuery(this).children('input').length == 0) {
1158
+ var postal = "<input type='text' id='postal' class='postal' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1159
+ jQuery(this).html(postal);
1160
+ jQuery("input.postal").focus();
1161
+ jQuery("input.postal").blur(function () {
1162
+ var id_for_blur = document.getElementById('postal').parentNode.id.split('_');
1163
+ var value = jQuery(this).val();
1164
+ jQuery("#" + id_for_blur[0] + "_mini_label_postal").text(value);
1165
+ });
1166
+ }
1167
+ });
1168
+ jQuery("label#" + myu + "_mini_label_country").click(function () {
1169
+ if (jQuery(this).children('input').length == 0) {
1170
+ var country = "<input type='country' id='country' class='country' style='outline:none; border:none; background:none;' value=\"" + jQuery(this).text() + "\">";
1171
+ jQuery(this).html(country);
1172
+ jQuery("input.country").focus();
1173
+ jQuery("input.country").blur(function () {
1174
+ var id_for_blur = document.getElementById('country').parentNode.id.split('_');
1175
+ var value = jQuery(this).val();
1176
+ jQuery("#" + id_for_blur[0] + "_mini_label_country").text(value);
1177
+ });
1178
+ }
1179
+ });
1180
+ });
1181
+ }
1182
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_scale_rating") {
1183
+ var myu = t;
1184
+ jQuery(document).ready(function () {
1185
+ jQuery("#" + myu + "_mini_label_worst").click(function () {
1186
+ if (jQuery(this).children('input').length == 0) {
1187
+ var worst = "<input type='text' id='worst' class='worst' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\"" + jQuery(this).text() + "\">";
1188
+ jQuery(this).html(worst);
1189
+ jQuery("input.worst").focus();
1190
+ jQuery("input.worst").blur(function () {
1191
+ var id_for_blur = document.getElementById('worst').parentNode.id.split('_');
1192
+ var value = jQuery(this).val();
1193
+ jQuery("#" + id_for_blur[0] + "_mini_label_worst").text(value);
1194
+ });
1195
+ }
1196
+ });
1197
+ jQuery("label#" + myu + "_mini_label_best").click(function () {
1198
+ if (jQuery(this).children('input').length == 0) {
1199
+ var best = "<input type='text' id='best' class='best' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\"" + jQuery(this).text() + "\">";
1200
+ jQuery(this).html(best);
1201
+ jQuery("input.best").focus();
1202
+ jQuery("input.best").blur(function () {
1203
+ var id_for_blur = document.getElementById('best').parentNode.id.split('_');
1204
+ var value = jQuery(this).val();
1205
+ jQuery("#" + id_for_blur[0] + "_mini_label_best").text(value);
1206
+ });
1207
+ }
1208
+ });
1209
+ });
1210
+ }
1211
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_spinner") {
1212
+ var spinner_value = document.getElementById(t + "_elementform_id_temp").value;
1213
+ var spinner_min_value = document.getElementById(t + "_min_valueform_id_temp").value;
1214
+ var spinner_max_value = document.getElementById(t + "_max_valueform_id_temp").value;
1215
+ var spinner_step = document.getElementById(t + "_stepform_id_temp").value;
1216
+ jQuery("#" + t + "_elementform_id_temp")[0].spin = null;
1217
+ spinner = jQuery("#" + t + "_elementform_id_temp").spinner();
1218
+ spinner.spinner("value", spinner_value);
1219
+ jQuery("#" + t + "_elementform_id_temp").spinner({ min:spinner_min_value});
1220
+ jQuery("#" + t + "_elementform_id_temp").spinner({ max:spinner_max_value});
1221
+ jQuery("#" + t + "_elementform_id_temp").spinner({ step:spinner_step});
1222
+ }
1223
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_slider") {
1224
+ var slider_value = document.getElementById(t + "_slider_valueform_id_temp").value;
1225
+ var slider_min_value = document.getElementById(t + "_slider_min_valueform_id_temp").value;
1226
+ var slider_max_value = document.getElementById(t + "_slider_max_valueform_id_temp").value;
1227
+ var slider_element_value = document.getElementById(t + "_element_valueform_id_temp");
1228
+ var slider_value_save = document.getElementById(t + "_slider_valueform_id_temp");
1229
+ jQuery("#" + t + "_elementform_id_temp")[0].slide = null;
1230
+ jQuery(function () {
1231
+ jQuery("#" + t + "_elementform_id_temp").slider({
1232
+ range:"min",
1233
+ value:eval(slider_value),
1234
+ min:eval(slider_min_value),
1235
+ max:eval(slider_max_value),
1236
+ slide:function (event, ui) {
1237
+ slider_element_value.innerHTML = "" + ui.value;
1238
+ slider_value_save.value = "" + ui.value;
1239
+ }
1240
+ });
1241
+ });
1242
+ }
1243
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_range") {
1244
+ var spinner_value0 = document.getElementById(t + "_elementform_id_temp0").value;
1245
+ var spinner_step = document.getElementById(t + "_range_stepform_id_temp").value;
1246
+ jQuery("#" + t + "_elementform_id_temp0")[0].spin = null;
1247
+ jQuery("#" + t + "_elementform_id_temp1")[0].spin = null;
1248
+ spinner0 = jQuery("#" + t + "_elementform_id_temp0").spinner();
1249
+ spinner0.spinner("value", spinner_value0);
1250
+ jQuery("#" + t + "_elementform_id_temp0").spinner({ step:spinner_step});
1251
+ var spinner_value1 = document.getElementById(t + "_elementform_id_temp1").value;
1252
+ spinner1 = jQuery("#" + t + "_elementform_id_temp1").spinner();
1253
+ spinner1.spinner("value", spinner_value1);
1254
+ jQuery("#" + t + "_elementform_id_temp1").spinner({ step:spinner_step});
1255
+ var myu = t;
1256
+ jQuery(document).ready(function () {
1257
+ jQuery("#" + myu + "_mini_label_from").click(function () {
1258
+ if (jQuery(this).children('input').length == 0) {
1259
+ var from = "<input type='text' id='from' class='from' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\"" + jQuery(this).text() + "\">";
1260
+ jQuery(this).html(from);
1261
+ jQuery("input.from").focus();
1262
+ jQuery("input.from").blur(function () {
1263
+ var id_for_blur = document.getElementById('from').parentNode.id.split('_');
1264
+ var value = jQuery(this).val();
1265
+ jQuery("#" + id_for_blur[0] + "_mini_label_from").text(value);
1266
+ });
1267
+ }
1268
+ });
1269
+ jQuery("label#" + myu + "_mini_label_to").click(function () {
1270
+ if (jQuery(this).children('input').length == 0) {
1271
+ var to = "<input type='text' id='to' class='to' size='6' style='outline:none; border:none; background:none; font-size:11px;' value=\"" + jQuery(this).text() + "\">";
1272
+ jQuery(this).html(to);
1273
+ jQuery("input.to").focus();
1274
+ jQuery("input.to").blur(function () {
1275
+ var id_for_blur = document.getElementById('to').parentNode.id.split('_');
1276
+ var value = jQuery(this).val();
1277
+ jQuery("#" + id_for_blur[0] + "_mini_label_to").text(value);
1278
+ });
1279
+ }
1280
+ });
1281
+ });
1282
+ }
1283
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_date_range") {
1284
+ var default_date_start = jQuery("#"+t+"_default_date_id_temp_start").val();
1285
+ var default_date_end = jQuery("#"+t+"_default_date_id_temp_end").val();
1286
+ var date_format = jQuery("#"+t+"_buttonform_id_temp").attr('format');
1287
+
1288
+
1289
+
1290
+ jQuery("#"+t+"_elementform_id_temp0").datepicker();
1291
+ jQuery("#"+t+"_elementform_id_temp1").datepicker();
1292
+ jQuery("#"+t+"_elementform_id_temp0").datepicker("option", "dateFormat", date_format);
1293
+ jQuery("#"+t+"_elementform_id_temp1").datepicker("option", "dateFormat", date_format);
1294
+
1295
+
1296
+ if(default_date_start =="today")
1297
+ jQuery("#"+t+"_elementform_id_temp0").datepicker("setDate", new Date());
1298
+ else if(default_date_start.indexOf("d") == -1 && default_date_start.indexOf("m") == -1 && default_date_start.indexOf("y") == -1 && default_date_start.indexOf("w") == -1){
1299
+ if(default_date_start !== "")
1300
+ default_date_start = jQuery.datepicker.formatDate(date_format, new Date(default_date_start));
1301
+ jQuery("#"+t+"_elementform_id_temp0").datepicker("setDate", default_date_start);
1302
+ }
1303
+ else
1304
+ jQuery("#"+t+"_elementform_id_temp0").datepicker("setDate", default_date_start);
1305
+
1306
+
1307
+ if(default_date_end =="today")
1308
+ jQuery("#"+t+"_elementform_id_temp1").datepicker("setDate", new Date());
1309
+ else if(default_date_end.indexOf("d") == -1 && default_date_end.indexOf("m") == -1 && default_date_end.indexOf("y") == -1 && default_date_end.indexOf("w") == -1){
1310
+ if(default_date_end !== "")
1311
+ default_date_end = jQuery.datepicker.formatDate(date_format, new Date(default_date_end));
1312
+ jQuery("#"+t+"_elementform_id_temp1").datepicker("setDate", default_date_end);
1313
+ }
1314
+ else
1315
+ jQuery("#"+t+"_elementform_id_temp1").datepicker("setDate", default_date_end);
1316
+ }
1317
+
1318
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_date_new") {
1319
+ var default_date = jQuery("#"+t+"_default_date_id_temp").val();
1320
+ var date_format = jQuery("#"+t+"_buttonform_id_temp").attr('format');
1321
+ jQuery("#"+t+"_elementform_id_temp").datepicker();
1322
+ jQuery("#"+t+"_elementform_id_temp").datepicker("option", "dateFormat", date_format);
1323
+
1324
+
1325
+ if(default_date =="today")
1326
+ jQuery("#"+t+"_elementform_id_temp").datepicker("setDate", new Date());
1327
+ else if(default_date.indexOf("d") == -1 && default_date.indexOf("m") == -1 && default_date.indexOf("y") == -1 && default_date.indexOf("w") == -1){
1328
+ if(default_date !== "")
1329
+ default_date = jQuery.datepicker.formatDate(date_format, new Date(default_date));
1330
+ jQuery("#"+t+"_elementform_id_temp").datepicker("setDate", default_date);
1331
+ }
1332
+ else
1333
+ jQuery("#"+t+"_elementform_id_temp").datepicker("setDate", default_date);
1334
+
1335
+
1336
+
1337
+ }
1338
+ else if (document.getElementById(t + "_typeform_id_temp").value == "type_phone_new") {
1339
+
1340
+
1341
+ jQuery("#"+t+"_elementform_id_temp").intlTelInput({
1342
+ nationalMode: false,
1343
+ preferredCountries: [ jQuery("#"+t+"_elementform_id_temp").attr("top-country") ],
1344
+ });
1345
+ jQuery("#"+t+"_elementform_id_temp").intlTelInput("setNumber", jQuery("#"+t+"_elementform_id_temp").val());
1346
+
1347
+ }
1348
+ }
1349
+ }
1350
+
1351
+ remove_whitespace(document.getElementById('take'));
1352
+ form_view = 1;
1353
+ form_view_count = 0;
1354
+
1355
+ for (i = 1; i <= 30; i++) {
1356
+ if (document.getElementById('form_id_tempform_view' + i)) {
1357
+ form_view_count++;
1358
+ form_view_max = i;
1359
+ tbody_img = document.createElement('div');
1360
+ tbody_img.setAttribute('id', 'form_id_tempform_view_img' + i);
1361
+ tbody_img.style.cssText = "float:right";
1362
+ tr_img = document.createElement('div');
1363
+ var img = document.createElement('img');
1364
+ img.setAttribute('src', '<?php echo WD_FM_URL; ?>/images/minus.png?ver=<?php echo WD_FM_VERSION; ?>');
1365
+ img.setAttribute('title', 'Show or hide the page');
1366
+ img.setAttribute("class", "page_toolbar");
1367
+ img.setAttribute('id', 'show_page_img_' + i);
1368
+ img.setAttribute('onClick', 'show_or_hide("' + i + '")');
1369
+ img.setAttribute("onmouseover", 'chnage_icons_src(this,"minus")');
1370
+ img.setAttribute("onmouseout", 'chnage_icons_src(this,"minus")');
1371
+ var img_X = document.createElement("img");
1372
+ img_X.setAttribute("src", "<?php echo WD_FM_URL; ?>/images/page_delete.png?ver=<?php echo WD_FM_VERSION; ?>");
1373
+ img_X.setAttribute('title', 'Delete the page');
1374
+ img_X.setAttribute("class", "page_toolbar");
1375
+ img_X.setAttribute("onclick", 'remove_page("' + i + '")');
1376
+ img_X.setAttribute("onmouseover", 'chnage_icons_src(this,"page_delete")');
1377
+ img_X.setAttribute("onmouseout", 'chnage_icons_src(this,"page_delete")');
1378
+ var img_X_all = document.createElement("img");
1379
+ img_X_all.setAttribute("src", "<?php echo WD_FM_URL; ?>/images/page_delete_all.png?ver=<?php echo WD_FM_VERSION; ?>");
1380
+ img_X_all.setAttribute('title', 'Delete the page with fields');
1381
+ img_X_all.setAttribute("class", "page_toolbar");
1382
+ img_X_all.setAttribute("onclick", 'remove_page_all("' + i + '")');
1383
+ img_X_all.setAttribute("onmouseover", 'chnage_icons_src(this,"page_delete_all")');
1384
+ img_X_all.setAttribute("onmouseout", 'chnage_icons_src(this,"page_delete_all")');
1385
+ var img_EDIT = document.createElement("img");
1386
+ img_EDIT.setAttribute("src", "<?php echo WD_FM_URL; ?>/images/page_edit.png?ver=<?php echo WD_FM_VERSION; ?>");
1387
+ img_EDIT.setAttribute('title', 'Edit the page');
1388
+ img_EDIT.setAttribute("class", "page_toolbar");
1389
+ img_EDIT.setAttribute("onclick", 'edit_page_break("' + i + '")');
1390
+ img_EDIT.setAttribute("onmouseover", 'chnage_icons_src(this,"page_edit")');
1391
+ img_EDIT.setAttribute("onmouseout", 'chnage_icons_src(this,"page_edit")');
1392
+ tr_img.appendChild(img);
1393
+ tr_img.appendChild(img_X);
1394
+ tr_img.appendChild(img_X_all);
1395
+ tr_img.appendChild(img_EDIT);
1396
+ tbody_img.appendChild(tr_img);
1397
+ document.getElementById('form_id_tempform_view' + i).parentNode.appendChild(tbody_img);
1398
+ }
1399
+ }
1400
+
1401
+ if (form_view_count > 1) {
1402
+ for (i = 1; i <= form_view_max; i++) {
1403
+ if (document.getElementById('form_id_tempform_view' + i)) {
1404
+ first_form_view = i;
1405
+ break;
1406
+ }
1407
+ }
1408
+ form_view = form_view_max;
1409
+ need_enable = false;
1410
+ generate_page_nav(first_form_view);
1411
+ var img_EDIT = document.createElement("img");
1412
+ img_EDIT.setAttribute("src", "<?php echo WD_FM_URL . '/images/edit.png?ver='.WD_FM_VERSION; ?>");
1413
+ img_EDIT.style.cssText = "margin-left:40px; cursor:pointer";
1414
+ img_EDIT.setAttribute("onclick", 'el_page_navigation()');
1415
+ var td_EDIT = document.getElementById("edit_page_navigation");
1416
+ td_EDIT.appendChild(img_EDIT);
1417
+ document.getElementById('page_navigation').appendChild(td_EDIT);
1418
+ }
1419
+ document.getElementById('araqel').value = 1;
1420
+ }
1421
+ jQuery(window).load(function () {
1422
+ formOnload();
1423
+ });
1424
+ jQuery(function() {
1425
+ jQuery('.wdform_section .wdform_column:last-child').each(function() {
1426
+ jQuery(this).parent().append(jQuery('<div></div>').addClass("wdform_column"));
1427
+ });
1428
+
1429
+ sortable_columns();
1430
+ if(<?php echo $row->sortable ?>==1) {
1431
+ jQuery( ".wdform_arrows" ).hide();
1432
+ all_sortable_events();
1433
+ }
1434
+ else
1435
+ jQuery('.wdform_column').sortable( "disable" );
1436
+
1437
+ });
1438
+ <?php
1439
+ } else { ?>
1440
+ jQuery(function() {
1441
+ jQuery('.wdform_section .wdform_column:last-child').each(function() {
1442
+ jQuery(this).parent().append(jQuery('<div></div>').addClass("wdform_column"));
1443
+ });
1444
+ sortable_columns();
1445
+ all_sortable_events();
1446
+ });
1447
+ <?php } ?>
1448
+ </script>
1449
+ <input type="hidden" name="option" value="com_formmaker" />
1450
+ <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
1451
+ <input type="hidden" name="cid[]" value="<?php echo $row->id; ?>" />
1452
+ <input type="hidden" id="task" name="task" value=""/>
1453
+ <input type="hidden" id="current_id" name="current_id" value="<?php echo $row->id; ?>" />
1454
+ </form>
1455
+ <?php
1456
+ }
1457
+
1458
+ public function form_options($id) {
1459
+ $addons = array('WD_FM_MAILCHIMP' => 'MailChimp', 'WD_FM_REG' => 'Registration', 'WD_FM_POST_GEN' => 'Post Generation', 'WD_FM_EMAIL_COND' => 'Conditional Emails', 'WD_FM_DBOX_INT' => 'Dropbox Integration', 'WD_FM_GDRIVE_INT' => 'Google Drive Integration','WD_FM_PDF' => 'PDF Integration', 'WD_FM_PUSHOVER' => 'Pushover', 'WD_FM_SAVE_PROG' => 'Save Form Progress', 'WD_FM_CALCULATOR' => 'Calculator');
1460
+
1461
+ $row = $this->model->get_row_data($id);
1462
+ $themes = $this->model->get_theme_rows_data();
1463
+ global $wpdb;
1464
+ $default_theme = $wpdb->get_var('SELECT id FROM ' . $wpdb->prefix . 'formmaker_themes where `default`=1');
1465
+ $queries = $this->model->get_queries_rows_data($id);
1466
+ $userGroups = get_editable_roles();
1467
+ $page_title = $row->title . ' form options';
1468
+ $label_id = array();
1469
+ $label_label = array();
1470
+ $label_type = array();
1471
+ $label_all = explode('#****#', $row->label_order_current);
1472
+ $label_all = array_slice($label_all, 0, count($label_all) - 1);
1473
+ foreach ($label_all as $key => $label_each) {
1474
+ $label_id_each = explode('#**id**#', $label_each);
1475
+ array_push($label_id, $label_id_each[0]);
1476
+ $label_order_each = explode('#**label**#', $label_id_each[1]);
1477
+ array_push($label_label, $label_order_each[0]);
1478
+ array_push($label_type, $label_order_each[1]);
1479
+ }
1480
+ $fields = explode('*:*id*:*type_submitter_mail*:*type*:*', $row->form_fields);
1481
+ $fields_count = count($fields);
1482
+ $is_addon_stripe_active = (defined('WD_FM_STRIPE') && is_plugin_active(constant('WD_FM_STRIPE')));
1483
+ $payment_method = $row->paypal_mode ? 'paypal' : 'none';
1484
+ if ($is_addon_stripe_active) {
1485
+ require_once (WD_FM_STRIPE_DIR . '/controller.php');
1486
+ $stripe_enable = (int) WD_FM_STRIPE_controller::stripe_enable($id);
1487
+ $payment_method = $stripe_enable ? 'stripe' : $payment_method;
1488
+ }
1489
+ ?>
1490
+ <script>
1491
+ gen = "<?php echo $row->counter; ?>";
1492
+ default_theme = "<?php echo $default_theme; ?>";
1493
+ form_view_max = 20;
1494
+ function set_preview() {
1495
+ theme_id = jQuery('#theme').val() == '0' ? default_theme : jQuery('#theme').val();
1496
+ jQuery("#preview_form").attr("onclick", "tb_show('', '<?php echo add_query_arg(array('action' => 'FormMakerPreview', 'form_id' => $row->id, 'form_preview' => 1), admin_url('admin-ajax.php')); ?>&test_theme=" + theme_id + "&width=1000&height=500&TB_iframe=1'); return false;");
1497
+ jQuery("#edit_css").attr("onclick", "window.open('<?php echo add_query_arg(array('nonce_fm' => wp_create_nonce('nonce_fm')), admin_url('admin.php?page=themes_fm&task=edit')); ?>&current_id=" + theme_id + "'); return false;");
1498
+ if (jQuery('#theme option:selected').attr('data-version') == 1) {
1499
+ jQuery("#old_theme_notice").show();
1500
+ }
1501
+ else {
1502
+ jQuery("#old_theme_notice").hide();
1503
+ }
1504
+ }
1505
+
1506
+ function set_condition() {
1507
+ field_condition = '';
1508
+ for(i=0;i<500;i++) {
1509
+ conditions = '';
1510
+ if(document.getElementById("condition"+i)) {
1511
+ field_condition+=document.getElementById("show_hide"+i).value+"*:*show_hide*:*";
1512
+ field_condition+=document.getElementById("fields"+i).value+"*:*field_label*:*";
1513
+ field_condition+=document.getElementById("all_any"+i).value+"*:*all_any*:*";
1514
+ for(k=0;k<500;k++) {
1515
+ if(document.getElementById("condition_div"+i+"_"+k)) {
1516
+ conditions+=document.getElementById("field_labels"+i+"_"+k).value+"***";
1517
+ conditions+=document.getElementById("is_select"+i+"_"+k).value+"***";
1518
+ if(document.getElementById("field_value"+i+"_"+k).tagName=="SELECT" ) {
1519
+ if(document.getElementById("field_value"+i+"_"+k).getAttribute('multiple')) {
1520
+ var sel = document.getElementById("field_value"+i+"_"+k);
1521
+ var selValues = '';
1522
+ for(m=0; m < sel.length; m++) {
1523
+ if(sel.options[m].selected)
1524
+
1525
+ selValues += sel.options[m].value+"@@@";
1526
+ }
1527
+ conditions+=selValues;
1528
+ } else {
1529
+ conditions+=document.getElementById("field_value"+i+"_"+k).value;
1530
+ }
1531
+ }
1532
+ else
1533
+ conditions+=document.getElementById("field_value"+i+"_"+k).value;
1534
+ conditions+="*:*next_condition*:*";
1535
+ }
1536
+ }
1537
+ field_condition+=conditions;
1538
+ field_condition+="*:*new_condition*:*";
1539
+ }
1540
+ }
1541
+ document.getElementById('condition').value = field_condition;
1542
+ }
1543
+
1544
+ function show_verify_options(s){
1545
+ if(s){
1546
+ jQuery(".verification_div").removeAttr( "style" );
1547
+ jQuery(".expire_link").removeAttr( "style" );
1548
+
1549
+ } else{
1550
+ jQuery(".verification_div").css( 'display', 'none' );
1551
+ jQuery(".expire_link").css( 'display', 'none' );
1552
+ }
1553
+ }
1554
+ </script>
1555
+ <style>
1556
+ .CodeMirror {
1557
+ border: 1px solid #ccc;
1558
+ font-size: 12px;
1559
+ margin-bottom: 6px;
1560
+ background: white;
1561
+ }
1562
+ </style>
1563
+ <form class="wrap" method="post" action="admin.php?page=manage_fm" name="adminForm" id="adminForm">
1564
+ <?php wp_nonce_field('nonce_fm', 'nonce_fm'); ?>
1565
+ <div class="fm-page-header">
1566
+ <div class="fm-page-title" style="width: inherit;">
1567
+ <?php echo $page_title; ?>
1568
+ </div>
1569
+ <div class="fm-page-actions">
1570
+ <button class="fm-button save-button medium" onclick="if (fm_check_email('mailToAdd') ||fm_check_email('from_mail') || fm_check_email('reply_to') || fm_check_email('mail_from_user') || fm_check_email('reply_to_user') || fm_check_email('mail_from_other') || fm_check_email('reply_to_other') || fm_check_email('paypal_email') || check_stripe_required_fields() || check_calculator_required_fields()) {return false;}; wd_fm_apply_options('save_options');">
1571
+ <span></span>
1572
+ Save
1573
+ </button>
1574
+ <button class="fm-button apply-button medium" onclick="if (fm_check_email('mailToAdd') || fm_check_email('from_mail') || fm_check_email('reply_to') || fm_check_email('mail_from_user') || fm_check_email('reply_to_user') || fm_check_email('mail_from_other') || fm_check_email('reply_to_other') || fm_check_email('paypal_email') || check_stripe_required_fields() || check_calculator_required_fields()) {return false;}; wd_fm_apply_options('apply_options');">
1575
+ <span></span>
1576
+ Apply
1577
+ </button>
1578
+ <button class="fm-button cancel-button medium" onclick="fm_set_input_value('task', 'cancel_options');">
1579
+ <span></span>
1580
+ Cancel
1581
+ </button>
1582
+ </div>
1583
+ <div class="fm-clear"></div>
1584
+ </div>
1585
+ <div class="fm-form-options">
1586
+ <div class="submenu-box">
1587
+ <div class="submenu-pad">
1588
+ <ul id="submenu" class="configuration">
1589
+ <li>
1590
+ <a id="general" class="fm_fieldset_tab" onclick="form_maker_options_tabs('general')" href="#">General Options</a>
1591
+ </li>
1592
+ <li>
1593
+ <a id="email" class="fm_fieldset_tab" onclick="form_maker_options_tabs('email')" href="#">Email Options</a>
1594
+ </li>
1595
+ <li>
1596
+ <a id="actions" class="fm_fieldset_tab" onclick="form_maker_options_tabs('actions')" href="#">Actions after Submission</a>
1597
+ </li>
1598
+ <li>
1599
+ <a id="payment" class="fm_fieldset_tab" onclick="form_maker_options_tabs('payment')" href="#">Payment Options</a>
1600
+ </li>
1601
+ <li>
1602
+ <a id="javascript" class="fm_fieldset_tab" onclick="form_maker_options_tabs('javascript'); codemirror_for_javascript();" href="#">JavaScript</a>
1603
+ </li>
1604
+ <li>
1605
+ <a id="conditions" class="fm_fieldset_tab" onclick="form_maker_options_tabs('conditions')" href="#">Conditional Fields</a>
1606
+ </li>
1607
+ <li>
1608
+ <a id="mapping" class="fm_fieldset_tab" onclick="form_maker_options_tabs('mapping')" href="#" >MySQL Mapping</a>
1609
+ </li>
1610
+ <?php
1611
+ foreach($addons as $addon => $addon_name) {
1612
+ if (defined($addon) && is_plugin_active(constant($addon))) {
1613
+ ?>
1614
+ <li>
1615
+ <a id="<?php echo $addon;?>" class="fm_fieldset_tab" onclick="form_maker_options_tabs('<?php echo $addon;?>')" href="#" ><?php echo $addon_name;?></a>
1616
+ </li>
1617
+ <?php
1618
+ }
1619
+ }
1620
+ ?>
1621
+ </ul>
1622
+ </div>
1623
+ </div>
1624
+ <fieldset id="general_fieldset" class="adminform fm_fieldset_deactive">
1625
+ <legend>General Options</legend>
1626
+ <table class="admintable" style="float: left;">
1627
+ <tr valign="top">
1628
+ <td class="fm_options_label">
1629
+ <label>Published</label>
1630
+ </td>
1631
+ <td class="fm_options_value">
1632
+ <button class="fm-checkbox-radio-button <?php echo $row->published == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->published; ?>">
1633
+ <span></span>
1634
+ </button>
1635
+ <input type="hidden" name="published" value="<?php echo $row->published; ?>"/>
1636
+ </td>
1637
+ </tr>
1638
+ <tr valign="top">
1639
+ <td class="fm_options_label">
1640
+ <label>Save data(to database)</label>
1641
+ </td>
1642
+ <td class="fm_options_value">
1643
+ <button class="fm-checkbox-radio-button <?php echo $row->savedb == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->savedb; ?>">
1644
+ <span></span>
1645
+ </button>
1646
+ <input type="hidden" name="savedb" value="<?php echo $row->savedb; ?>"/>
1647
+ </td>
1648
+ </tr>
1649
+ <tr valign="top">
1650
+ <td class="fm_options_label">
1651
+ <label for="theme">Theme</label>
1652
+ </td>
1653
+ <td class="fm_options_value">
1654
+ <select id="theme" name="theme" onChange="set_preview()">
1655
+ <optgroup label="New Themes">
1656
+ <option value="0" <?php echo $row->theme && $row->theme == 0 ? 'selected' : '' ?> data-version="2">Inherit From Website Theme</option>
1657
+ <?php
1658
+ $optiongroup = true;
1659
+ foreach ($themes as $theme) {
1660
+ if ($optiongroup && $theme->version == 1) {
1661
+ $optiongroup = false;
1662
+ ?>
1663
+ </optgroup>
1664
+ <optgroup label="Outdated Themes">
1665
+ <?php
1666
+ }
1667
+ ?>
1668
+ <option value="<?php echo $theme->id; ?>" <?php echo (($theme->id == $row->theme) ? 'selected' : ''); ?> data-version="<?php echo $theme->version; ?>"><?php echo $theme->title; ?></option>
1669
+ <?php
1670
+ }
1671
+ ?>
1672
+ </optgroup>
1673
+ </select>
1674
+ <button id="preview_form" class="fm-button preview-button medium" onclick="tb_show('', '<?php echo add_query_arg(array('action' => 'FormMakerPreview', 'form_id' => $row->id, 'test_theme' => $row->theme, 'form_preview' => 1, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>'); return false;">
1675
+ <span></span>
1676
+ Preview
1677
+ </button>
1678
+ <button id="edit_css" class="fm-button options-edit-button medium" onclick="window.open('<?php echo add_query_arg(array('current_id' => ($row->theme && $row->theme != '0' ? $row->theme : $default_theme), 'nonce_fm' => wp_create_nonce('nonce_fm')), admin_url('admin.php?page=themes_fm&task=edit')); ?>'); return false;">
1679
+ <span></span>
1680
+ Edit
1681
+ </button>
1682
+ <div id="old_theme_notice" class="wd_error" style="display: none;">The theme you have selected is outdated. Please choose one from New Themes section.</div>
1683
+ </td>
1684
+ </tr>
1685
+ <tr valign="top">
1686
+ <td class="fm_options_label">
1687
+ <label for="requiredmark">Required fields mark</label>
1688
+ </td>
1689
+ <td class="fm_options_value">
1690
+ <input type="text" id="requiredmark" name="requiredmark" value="<?php echo $row->requiredmark; ?>" style="width:250px;" />
1691
+ </td>
1692
+ </tr>
1693
+ <tr valign="top">
1694
+ <td class="fm_options_label">
1695
+ <label>Save Uploads</label>
1696
+ </td>
1697
+ <td class="fm_options_value">
1698
+ <button class="fm-checkbox-radio-button <?php echo $row->save_uploads == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->save_uploads; ?>">
1699
+ <span></span>
1700
+ </button>
1701
+ <input type="hidden" name="save_uploads" value="<?php echo $row->save_uploads; ?>"/>
1702
+ </td>
1703
+ </tr>
1704
+ </table>
1705
+ <br/>
1706
+ <div class="error_fm" style="padding: 5px; font-size: 14px;">Front end submissions are disabled in free version.</div>
1707
+ <fieldset class="adminform">
1708
+ <legend>Front end submissions access level</legend>
1709
+ <table>
1710
+ <tr>
1711
+ <td class="key">
1712
+ <label for="name">Allow User to see submissions:</label>
1713
+ </td>
1714
+ <td>
1715
+ <?php
1716
+ $checked_UserGroup=explode(',',$row->user_id_wd);
1717
+ $i = 0;
1718
+ foreach($userGroups as $val => $uG) {
1719
+ echo '<input type="checkbox" value="'.$val .'" id="user_'.$i.'"';
1720
+ if(in_array($val ,$checked_UserGroup))
1721
+ echo 'checked="checked"';
1722
+ echo 'onchange="acces_level('.count($userGroups).')" disabled/><label for="user_'.$i.'">'.$uG["name"].'</label><br>';
1723
+ $i++;
1724
+ }
1725
+ ?>
1726
+ <input type="checkbox" value="guest" id="user_<?php echo $i; ?>" onchange="acces_level(<?php echo count($userGroups); ?>)"<?php echo (in_array('guest', $checked_UserGroup) ? 'checked="checked"' : '') ?> disabled/><label for="user_<?php echo $i; ?>">Guest</label>
1727
+ <input type="hidden" name="user_id_wd" value="<?php echo $row->user_id_wd ?>" id="user_id_wd" />
1728
+ </td>
1729
+ </tr>
1730
+ </table>
1731
+ </fieldset>
1732
+ <?php
1733
+ $labels_for_submissions = $this->model->get_labels($id);
1734
+ $payment_info = $this->model->is_paypal($id);
1735
+ $labels_id_for_submissions= array();
1736
+ $label_titles_for_submissions=array();
1737
+ $labels_type_for_submissions= array();
1738
+ if($labels_for_submissions) {
1739
+ $label_id_for_submissions= array();
1740
+ $label_order_original_for_submissions= array();
1741
+ $label_type_for_submissions= array();
1742
+
1743
+ if(strpos($row->label_order, 'type_paypal_')) {
1744
+ $row->label_order=$row->label_order."item_total#**id**#Item Total#**label**#type_paypal_payment_total#****#total#**id**#Total#**label**#type_paypal_payment_total#****#0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
1745
+ }
1746
+
1747
+ $label_all_for_submissions = explode('#****#',$row->label_order);
1748
+ $label_all_for_submissions = array_slice($label_all_for_submissions,0, count($label_all_for_submissions)-1);
1749
+ foreach($label_all_for_submissions as $key => $label_each) {
1750
+ $label_id_each=explode('#**id**#',$label_each);
1751
+ array_push($label_id_for_submissions, $label_id_each[0]);
1752
+ $label_order_each=explode('#**label**#', $label_id_each[1]);
1753
+ array_push($label_order_original_for_submissions, $label_order_each[0]);
1754
+ array_push($label_type_for_submissions, $label_order_each[1]);
1755
+ }
1756
+
1757
+ foreach($label_id_for_submissions as $key => $label) {
1758
+ if(in_array($label, $labels_for_submissions)) {
1759
+ array_push($labels_type_for_submissions, $label_type_for_submissions[$key]);
1760
+ array_push($labels_id_for_submissions, $label);
1761
+ array_push($label_titles_for_submissions, $label_order_original_for_submissions[$key]);
1762
+ }
1763
+ }
1764
+ }
1765
+
1766
+ $stats_labels = array();
1767
+ $stats_labels_ids = array();
1768
+ foreach($labels_type_for_submissions as $key => $label_type_cur) {
1769
+ if($label_type_cur=="type_checkbox" || $label_type_cur=="type_radio" || $label_type_cur=="type_own_select" || $label_type_cur=="type_country" || $label_type_cur=="type_paypal_select" || $label_type_cur=="type_paypal_radio" || $label_type_cur=="type_paypal_checkbox" || $label_type_cur=="type_paypal_shipping") {
1770
+ $stats_labels_ids[] = $labels_id_for_submissions[$key];
1771
+ $stats_labels[] = $label_titles_for_submissions[$key];
1772
+ }
1773
+ }
1774
+ ?>
1775
+ <script type="text/javascript">
1776
+ function inArray(needle, myarray) {
1777
+ var length = myarray.length;
1778
+ for(var i = 0; i < length; i++) {
1779
+ if(myarray[i] == needle) return true;
1780
+ }
1781
+ return false;
1782
+ }
1783
+
1784
+ function checked_labels(class_name) {
1785
+ var checked_ids ='';
1786
+ jQuery('.'+class_name).each(function() {
1787
+ if(this.checked) {
1788
+ checked_ids += this.value+',';
1789
+ }
1790
+ });
1791
+
1792
+ if(class_name == 'filed_label') {
1793
+ document.getElementById("frontend_submit_fields").value = checked_ids ;
1794
+ if(checked_ids == document.getElementById("all_fields").value)
1795
+ document.getElementById("all_fields").checked = true;
1796
+ else
1797
+ document.getElementById("all_fields").checked = false;
1798
+ }
1799
+ else {
1800
+ document.getElementById("frontend_submit_stat_fields").value = checked_ids ;
1801
+ if(checked_ids == document.getElementById("all_stats_fields").value)
1802
+ document.getElementById("all_stats_fields").checked = true;
1803
+ else
1804
+ document.getElementById("all_stats_fields").checked = false;
1805
+ }
1806
+ }
1807
+
1808
+ jQuery(document).ready(function () {
1809
+ jQuery('.filed_label').each(function() {
1810
+ if(document.getElementById("frontend_submit_fields").value == document.getElementById("all_fields").value)
1811
+ document.getElementById("all_fields").checked = true;
1812
+ if(inArray(this.value, document.getElementById("frontend_submit_fields").value.split(","))) {
1813
+ this.checked = true;
1814
+ }
1815
+ });
1816
+
1817
+ jQuery('.stats_filed_label').each(function() {
1818
+ if(document.getElementById("frontend_submit_stat_fields").value == document.getElementById("all_stats_fields").value)
1819
+ document.getElementById("all_stats_fields").checked = true;
1820
+ if(inArray(this.value, document.getElementById("frontend_submit_stat_fields").value.split(","))) {
1821
+ this.checked = true;
1822
+ }
1823
+ });
1824
+
1825
+ jQuery(document).on('change','input[name="all_fields"]',function() {
1826
+ jQuery('.filed_label').prop("checked" , this.checked);
1827
+ });
1828
+
1829
+ jQuery(document).on('change','input[name="all_stats_fields"]',function() {
1830
+ jQuery('.stats_filed_label').prop("checked" , this.checked);
1831
+ });
1832
+ set_preview();
1833
+ });
1834
+ </script>
1835
+ <style>
1836
+ li{
1837
+ list-style-type: none;
1838
+ }
1839
+
1840
+ .simple_table {
1841
+ padding-left: 0px !important;
1842
+ }
1843
+
1844
+ .simple_table input, .simple_table label, .simple_table img {
1845
+ display:inline-block !important;
1846
+ float:none !important;
1847
+ }
1848
+ </style>
1849
+ <fieldset class="adminform">
1850
+ <legend>Fields to hide in frontend submissions</legend>
1851
+ <?php if(count($label_titles_for_submissions)): ?>
1852
+ <table style="margin-left:-3px;">
1853
+ <tr>
1854
+ <td>
1855
+ <label>Select fields:</label>
1856
+ </td>
1857
+ <td class="simple_table">
1858
+ <ul id="form_fields">
1859
+ <li>
1860
+ <input type="checkbox" name="all_fields" id="all_fields" value="submit_id,<?php echo implode(',',$labels_id_for_submissions)."," . ($payment_info ? "payment_info" : ""); ?>" onclick="checked_labels('filed_label')"/>
1861
+ <label for="all_fields">Select All</label>
1862
+ </li>
1863
+ <?php
1864
+ echo "<li><input type=\"checkbox\" id=\"submit_id\" name=\"submit_id\" value=\"submit_id\" class=\"filed_label\" onclick=\"checked_labels('filed_label')\"><label for=\"submit_id\">ID</label></li>";
1865
+
1866
+ for($i=0, $n=count($label_titles_for_submissions); $i < $n ; $i++)
1867
+ {
1868
+ $field_label = $label_titles_for_submissions[$i];
1869
+
1870
+ echo "<li><input type=\"checkbox\" id=\"filed_label".$i."\" name=\"filed_label".$i."\" value=\"".$labels_id_for_submissions[$i]."\" class=\"filed_label\" onclick=\"checked_labels('filed_label')\"><label for=\"filed_label".$i."\">".(strlen($field_label) > 80 ? substr ($field_label ,0, 80).'...' : $field_label)."</label></li>";
1871
+
1872
+ }
1873
+ if($payment_info)
1874
+ echo "<li><input type=\"checkbox\" id=\"payment_info\" name=\"payment_info\" value=\"payment_info\" class=\"filed_label\" onclick=\"checked_labels('filed_label')\"><label for=\"payment_info\">Payment Info</label></li>";
1875
+ ?>
1876
+ </ul>
1877
+ <input type="hidden" name="frontend_submit_fields" value="<?php echo $row->frontend_submit_fields ?>" id="frontend_submit_fields" />
1878
+ </td>
1879
+ </tr>
1880
+ <?php if($stats_labels): ?>
1881
+ <tr id="stats">
1882
+ <td>
1883
+ <label>Stats fields:</label>
1884
+ </td>
1885
+ <td class="simple_table">
1886
+ <ul id="stats_fields">
1887
+ <li>
1888
+ <input type="checkbox" name="all_stats_fields" id="all_stats_fields" value="<?php echo implode(',',$stats_labels_ids).","; ?>" onclick="checked_labels('stats_filed_label')">
1889
+ <label for="all_stats_fields">Select All</label>
1890
+ </li>
1891
+ <?php
1892
+ for($i=0, $n=count($stats_labels); $i < $n ; $i++)
1893
+ {
1894
+ $field_label = $stats_labels[$i];
1895
+ echo "<li><input type=\"checkbox\" id=\"stats_filed_label".$i."\" name=\"stats_filed_label".$i."\" value=\"".$stats_labels_ids[$i]."\" class=\"stats_filed_label\" onclick=\"checked_labels('stats_filed_label')\" ><label for=\"stats_filed_label".$i."\">".(strlen($field_label) > 80 ? substr ($field_label ,0, 80).'...' : $field_label)."</label></li>";
1896
+ }
1897
+ ?>
1898
+ </ul>
1899
+ <input type="hidden" name="frontend_submit_stat_fields" value="<?php echo $row->frontend_submit_stat_fields ?>" id="frontend_submit_stat_fields" />
1900
+ </td>
1901
+ </tr>
1902
+ <?php endif; ?>
1903
+ </table>
1904
+ <?php endif; ?>
1905
+ </fieldset>
1906
+ </fieldset>
1907
+ <fieldset id="email_fieldset" class="adminform fm_fieldset_deactive">
1908
+ <legend>Email Options</legend>
1909
+ <table class="admintable">
1910
+ <tr valign="top">
1911
+ <td style="width: 75px; vertical-align: middle;">
1912
+ <label>Send E-mail</label>
1913
+ </td>
1914
+ <td style="padding: 15px;">
1915
+ <button class="fm-checkbox-radio-button <?php echo $row->sendemail == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->sendemail; ?>">
1916
+ <span></span>
1917
+ </button>
1918
+ <input type="hidden" name="sendemail" value="<?php echo $row->sendemail; ?>"/>
1919
+ </td>
1920
+ </tr>
1921
+ </table>
1922
+ <fieldset class="adminform fm_mail_options">
1923
+ <legend>Email to Administrator</legend>
1924
+ <table class="admintable">
1925
+ <tr valign="top">
1926
+ <td class="fm_options_label">
1927
+ <label for="mailToAdd">Email to send submissions to</label>
1928
+ </td>
1929
+ <td class="fm_options_value">
1930
+ <input type="text" id="mailToAdd" name="mailToAdd" style="width: 250px;" />
1931
+ <input type="hidden" id="mail" name="mail" value="<?php echo $row->mail . ($row->mail && (substr($row->mail, -1) != ',') ? ',' : ''); ?>" />
1932
+ <img src="<?php echo WD_FM_URL . '/images/add.png?ver='. WD_FM_VERSION; ?>" style="vertical-align: middle; cursor: pointer;" title="Add more emails" onclick="if (fm_check_email('mailToAdd')) {return false;};cfm_create_input('mail', 'mailToAdd', 'cfm_mail_div', '<?php echo WD_FM_URL; ?>')" />
1933
+ <div id="cfm_mail_div">
1934
+ <?php
1935
+ $mail_array = explode(',', $row->mail);
1936
+ foreach ($mail_array as $mail) {
1937
+ if ($mail && $mail != ',') {
1938
+ ?>
1939
+ <div class="fm_mail_input">
1940
+ <?php echo $mail; ?>
1941
+ <img src="<?php echo WD_FM_URL; ?>/images/delete.png?ver=<?php echo WD_FM_VERSION; ?>" class="fm_delete_img" onclick="fm_delete_mail(this, '<?php echo $mail; ?>')" title="Delete Email" />
1942
+ </div>
1943
+ <?php
1944
+ }
1945
+ }
1946
+ ?>
1947
+ </div>
1948
+ </td>
1949
+ </tr>
1950
+ <tr valign="top">
1951
+ <td class="fm_options_label">
1952
+ <label for="from_mail">Email From</label>
1953
+ </td>
1954
+ <td class="fm_options_value">
1955
+ <?php
1956
+ $is_other = TRUE;
1957
+ for ($i = 0; $i < $fields_count - 1; $i++) {
1958
+ ?>
1959
+ <div>
1960
+ <input type="radio" name="from_mail" id="from_mail<?php echo $i; ?>" value="<?php echo (!is_numeric($fields[$i]) ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*')+15, strlen($fields[$i])) : $fields[$i]); ?>" <?php echo ((!is_numeric($fields[$i]) ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*')+15, strlen($fields[$i])) : $fields[$i]) == $row->from_mail ? 'checked="checked"' : '' ); ?> onclick="wdhide('mail_from_other')" />
1961
+ <label for="from_mail<?php echo $i; ?>"><?php echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*')); ?></label>
1962
+ </div>
1963
+ <?php
1964
+ if(!is_numeric($fields[$i])) {
1965
+ if (substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) == $row->from_mail) {
1966
+ $is_other = FALSE;
1967
+ }
1968
+ }
1969
+ else {
1970
+ if($fields[$i] == $row->from_mail)
1971
+ $is_other=false;
1972
+ }
1973
+ }
1974
+ ?>
1975
+ <div style="<?php echo ($fields_count == 1) ? 'display:none;' : ''; ?>">
1976
+ <input type="radio" id="other" name="from_mail" value="other" <?php echo ($is_other) ? 'checked="checked"' : ''; ?> onclick="wdshow('mail_from_other')" />
1977
+ <label for="other">Other</label>
1978
+ </div>
1979
+ <input type="text" style="width: <?php echo ($fields_count == 1) ? '250px' : '235px; margin-left: 15px' ?>; display: <?php echo ($is_other) ? 'block;' : 'none;'; ?>" id="mail_from_other" name="mail_from_other" value="<?php echo ($is_other) ? $row->from_mail : ''; ?>" />
1980
+ </td>
1981
+ </tr>
1982
+ <tr valign="top">
1983
+ <td class="fm_options_label">
1984
+ <label for="from_name">From Name</label>
1985
+ </td>
1986
+ <td class="fm_options_value">
1987
+ <input type="text" id="from_name" name="from_name" value="<?php echo $row->from_name; ?>" style="width: 250px;" />
1988
+ <img src="<?php echo WD_FM_URL . '/images/add.png?ver='. WD_FM_VERSION.''; ?>" onclick="document.getElementById('mail_from_labels').style.display='block';" style="vertical-align: middle; cursor: pointer;display:inline-block; margin:0px; float:none;">
1989
+ <?php
1990
+ $choise = "document.getElementById('from_name')";
1991
+ echo '<div style="position:relative; top:-3px;"><div id="mail_from_labels" class="email_labels" style="display:none;">';
1992
+ echo "<a onClick=\"insertAtCursor(".$choise.",'username'); document.getElementById('mail_from_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
1993
+ for($i=0; $i<count($label_label); $i++) {
1994
+ if($label_type[$i]=="type_submit_reset" || $label_type[$i]=="type_editor" || $label_type[$i]=="type_map" || $label_type[$i]=="type_mark_map" || $label_type[$i]=="type_captcha"|| $label_type[$i]=="type_recaptcha" || $label_type[$i]=="type_button" || $label_type[$i]=="type_file_upload" || $label_type[$i]=="type_send_copy" || $label_type[$i]=="type_matrix")
1995
+ continue;
1996
+
1997
+ $param = htmlspecialchars(addslashes($label_label[$i]));
1998
+ $fld_label = $param;
1999
+ if(strlen($fld_label)>30) {
2000
+ $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2001
+ $fld_label = explode("\n", $fld_label);
2002
+ $fld_label = $fld_label[0] . ' ...';
2003
+ }
2004
+
2005
+ echo "<a onClick=\"insertAtCursor(".$choise.",'".$param."'); document.getElementById('mail_from_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">".$fld_label."</a>";
2006
+ }
2007
+ echo "<a onClick=\"insertAtCursor(".$choise.",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
2008
+
2009
+ echo "<a onClick=\"insertAtCursor(".$choise.",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
2010
+ echo '</div></div>';
2011
+ ?>
2012
+ </td>
2013
+ </tr>
2014
+ <tr valign="top">
2015
+ <td class="fm_options_label">
2016
+ <label for="reply_to">Reply to<br/>(if different from "Email From") </label>
2017
+ </td>
2018
+ <td class="fm_options_value">
2019
+ <?php
2020
+ $is_other = TRUE;
2021
+ for ($i = 0; $i < $fields_count - 1; $i++) {
2022
+ ?>
2023
+ <div>
2024
+ <input type="radio" name="reply_to" id="reply_to<?php echo $i; ?>" value="<?php echo (!is_numeric($fields[$i]) ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*')+15, strlen($fields[$i])) : $fields[$i]); ?>" <?php echo ((!is_numeric($fields[$i]) ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*')+15, strlen($fields[$i])) : $fields[$i]) == $row->reply_to ? 'checked="checked"' : '' ); ?> onclick="wdhide('reply_to_other')" />
2025
+ <label for="reply_to<?php echo $i; ?>"><?php echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*')); ?></label>
2026
+ </div>
2027
+ <?php
2028
+ if(!is_numeric($fields[$i])) {
2029
+ if (substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*') + 15, strlen($fields[$i])) == $row->reply_to) {
2030
+ $is_other = FALSE;
2031
+ }
2032
+ }
2033
+ else {
2034
+ if($fields[$i] == $row->reply_to)
2035
+ $is_other=false;
2036
+ }
2037
+ }
2038
+ ?>
2039
+ <div style="<?php echo ($fields_count == 1) ? 'display: none;' : ''; ?>">
2040
+ <input type="radio" id="other1" name="reply_to" value="other" <?php echo ($is_other) ? 'checked="checked"' : ''; ?> onclick="wdshow('reply_to_other')" />
2041
+ <label for="other1">Other</label>
2042
+ </div>
2043
+ <input type="text" style="width: <?php echo ($fields_count == 1) ? '250px' : '235px; margin-left: 15px'; ?>; display: <?php echo ($is_other) ? 'block;' : 'none;'; ?>" id="reply_to_other" name="reply_to_other" value="<?php echo ($is_other && $row->reply_to) ? $row->reply_to : ''; ?>" />
2044
+ </td>
2045
+ </tr>
2046
+ <tr valign="top">
2047
+ <td class="fm_options_label">
2048
+ <label> CC: </label>
2049
+ </td>
2050
+ <td class="fm_options_value">
2051
+ <input type="text" id="mail_cc" name="mail_cc" value="<?php echo $row->mail_cc ?>" style="width:250px;" />
2052
+ </td>
2053
+ </tr>
2054
+ <tr valign="top">
2055
+ <td class="fm_options_label">
2056
+ <label> BCC: </label>
2057
+ </td>
2058
+ <td class="fm_options_value">
2059
+ <input type="text" id="mail_bcc" name="mail_bcc" value="<?php echo $row->mail_bcc ?>" style="width:250px;" />
2060
+ </td>
2061
+ </tr>
2062
+ <tr valign="top">
2063
+ <td class="fm_options_label">
2064
+ <label> Subject: </label>
2065
+ </td>
2066
+ <td class="fm_options_value">
2067
+ <input type="text" id="mail_subject" name="mail_subject" value="<?php echo $row->mail_subject ?>" style="width:250px;" />
2068
+ <img src="<?php echo WD_FM_URL . '/images/add.png?ver='. WD_FM_VERSION.''; ?>" onclick="document.getElementById('mail_subject_labels').style.display='block';" style="vertical-align: middle;cursor: pointer; display:inline-block; margin:0px; float:none;">
2069
+ <?php
2070
+ $choise = "document.getElementById('mail_subject')";
2071
+ echo '<div style="position:relative; top:-3px;"><div id="mail_subject_labels" class="email_labels" style="display:none;">';
2072
+ for($i=0; $i<count($label_label); $i++) {
2073
+ if($label_type[$i]=="type_submit_reset" || $label_type[$i]=="type_editor" || $label_type[$i]=="type_map" || $label_type[$i]=="type_mark_map" || $label_type[$i]=="type_captcha"|| $label_type[$i]=="type_recaptcha" || $label_type[$i]=="type_button" || $label_type[$i]=="type_file_upload" || $label_type[$i]=="type_send_copy" || $label_type[$i]=="type_matrix")
2074
+ continue;
2075
+
2076
+ $param = htmlspecialchars(addslashes($label_label[$i]));
2077
+
2078
+ $fld_label = $param;
2079
+ if(strlen($fld_label)>30)
2080
+ {
2081
+ $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2082
+ $fld_label = explode("\n", $fld_label);
2083
+ $fld_label = $fld_label[0] . ' ...';
2084
+ }
2085
+
2086
+ echo "<a onClick=\"insertAtCursor(".$choise.",'".$param."'); document.getElementById('mail_subject_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">".$fld_label."</a>";
2087
+
2088
+ }
2089
+ echo "<a onClick=\"insertAtCursor(".$choise.",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
2090
+
2091
+ echo "<a onClick=\"insertAtCursor(".$choise.",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
2092
+ echo '</div></div>';
2093
+ ?>
2094
+ </td>
2095
+ </tr>
2096
+ <tr valign="top">
2097
+ <td class="fm_options_label" style="vertical-align: middle;">
2098
+ <label> Mode: </label>
2099
+ </td>
2100
+ <td class="fm_options_value">
2101
+ <button name="mail_mode"class="fm-checkbox-radio-button <?php echo $row->mail_mode == 1 ? 'fm-text-yes' : 'fm-text-no' ?> medium" onclick="fm_change_radio_checkbox_text(this); return false;" value="<?php echo $row->mail_mode ?>">
2102
+ <label><?php echo $row->mail_mode == 1 ? 'HTML' : 'Text' ?></label>
2103
+ <span></span>
2104
+ </button>
2105
+ <input type="hidden" name="mail_mode" value="<?php echo $row->mail_mode; ?>"/>
2106
+ </td>
2107
+ </tr>
2108
+ <tr valign="top">
2109
+ <td class="fm_options_label" style="vertical-align: middle;">
2110
+ <label> Attach File: </label>
2111
+ </td>
2112
+ <td class="fm_options_value">
2113
+ <div class="error_fm" style="padding: 5px; font-size: 14px;">File attach is disabled in free version.</div>
2114
+ <input type="hidden" name="mail_attachment" value="<?php echo $row->mail_attachment; ?>"/>
2115
+ </td>
2116
+ </tr>
2117
+ <tr valign="top">
2118
+ <td class="fm_options_label" style="vertical-align: middle;">
2119
+ <label> Email empty fields: </label>
2120
+ </td>
2121
+ <td class="fm_options_value">
2122
+ <button class="fm-checkbox-radio-button <?php echo $row->mail_emptyfields == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->mail_emptyfields; ?>">
2123
+ <span></span>
2124
+ </button>
2125
+ <input type="hidden" name="mail_emptyfields" value="<?php echo $row->mail_emptyfields; ?>"/>
2126
+ </td>
2127
+ </tr>
2128
+ <tr>
2129
+ <td class="fm_options_label" valign="top">
2130
+ <label>Custom Text in Email For Administrator</label>
2131
+ </td>
2132
+ <td class="fm_options_value">
2133
+ <div style="margin-bottom:5px">
2134
+ <?php
2135
+ $choise = "document.getElementById('script_mail')";
2136
+ for ($i = 0; $i < count($label_label); $i++) {
2137
+ if ($label_type[$i]=="type_submit_reset" || $label_type[$i]=="type_editor" || $label_type[$i]=="type_map" || $label_type[$i]=="type_mark_map" || $label_type[$i]=="type_captcha"|| $label_type[$i]=="type_recaptcha" || $label_type[$i]=="type_button" || $label_type[$i]=="type_send_copy")
2138
+ continue;
2139
+
2140
+ $param = htmlspecialchars(addslashes($label_label[$i]));
2141
+ $fld_label = $param;
2142
+ if(strlen($fld_label)>30) {
2143
+ $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2144
+ $fld_label = explode("\n", $fld_label);
2145
+ $fld_label = $fld_label[0] . ' ...';
2146
+ }
2147
+
2148
+ if($label_type[$i]=="type_file_upload") {
2149
+ ?>
2150
+ <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label.'(as image)'; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param; ?>')" />
2151
+ <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label.'(as link)'; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param.'(link)'; ?>')" />
2152
+ <?php
2153
+ }
2154
+ else{
2155
+ ?>
2156
+ <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param; ?>')" />
2157
+ <?php
2158
+ }
2159
+ }
2160
+ ?>
2161
+ <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php echo $choise; ?>,'subid')" />
2162
+ <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php echo $choise; ?>,'ip')" />
2163
+ <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php echo $choise; ?>,'username')" />
2164
+ <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php echo $choise; ?>,'useremail')" />
2165
+ <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="All fields list" onClick="insertAtCursor(<?php echo $choise; ?>, 'all')" />
2166
+ </div>
2167
+ <?php
2168
+ if (user_can_richedit()) {
2169
+ wp_editor($row->script_mail, 'script_mail', array('teeny' => FALSE, 'textarea_name' => 'script_mail', 'media_buttons' => FALSE, 'textarea_rows' => 5));
2170
+ }
2171
+ else {
2172
+ ?>
2173
+ <textarea name="script_mail" id="script_mail" cols="20" rows="10" style="width:300px; height:450px;"><?php echo $row->script_mail; ?></textarea>
2174
+ <?php
2175
+ }
2176
+ ?>
2177
+ </td>
2178
+ </tr>
2179
+ </table>
2180
+ </fieldset>
2181
+ <fieldset class="fm_mail_options">
2182
+ <legend>Email to User</legend>
2183
+ <table class="admintable">
2184
+ <tr valign="top">
2185
+ <td class="fm_options_label">
2186
+ <label for="mail">Send to</label>
2187
+ </td>
2188
+ <td class="fm_options_value">
2189
+ <?php
2190
+
2191
+ $fields = explode('*:*id*:*type_submitter_mail*:*type*:*', $row->form_fields);
2192
+ $fields_count = count($fields);
2193
+ if ($fields_count == 1) { ?>
2194
+ There is no email field
2195
+ <?php
2196
+ }
2197
+ else {
2198
+ for ($i = 0; $i < $fields_count - 1; $i++) {
2199
+ ?>
2200
+ <div>
2201
+ <input type="checkbox" name="send_to<?php echo $i; ?>" id="send_to<?php echo $i; ?>" value="<?php echo (!is_numeric($fields[$i]) ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*')+15, strlen($fields[$i])) : $fields[$i]); ?>" <?php echo (is_numeric(strpos($row->send_to, '*'.(!is_numeric($fields[$i]) ? substr($fields[$i], strrpos($fields[$i], '*:*new_field*:*')+15, strlen($fields[$i])) : $fields[$i]).'*')) ? 'checked="checked"' : '' ); ?> style="margin: 0px 5px 0px 0px;" />
2202
+ <label for="send_to<?php echo $i; ?>"><?php echo substr($fields[$i + 1], 0, strpos($fields[$i + 1], '*:*w_field_label*:*')); ?></label>
2203
+ </div>
2204
+ <?php
2205
+ }
2206
+ }
2207
+ ?>
2208
+ </td>
2209
+ </tr>
2210
+ <tr valign="top">
2211
+ <td class="fm_options_label">
2212
+ <label for="mail_from_user">Email From</label>
2213
+ </td>
2214
+ <td class="fm_options_value">
2215
+ <input type="text" id="mail_from_user" name="mail_from_user" value="<?php echo $row->mail_from_user; ?>" style="width: 250px;" />
2216
+ </td>
2217
+ </tr>
2218
+ <tr valign="top">
2219
+ <td class="fm_options_label">
2220
+ <label for="mail_from_name_user">From Name</label>
2221
+ </td>
2222
+ <td class="fm_options_value">
2223
+ <input type="text" id="mail_from_name_user" name="mail_from_name_user" value="<?php echo $row->mail_from_name_user; ?>" style="width: 250px;"/>
2224
+ <img src="<?php echo WD_FM_URL . '/images/add.png?ver='. WD_FM_VERSION.''; ?>" onclick="document.getElementById('mail_from_name_user_labels').style.display='block';" style="vertical-align: middle;cursor: pointer; display:inline-block; margin:0px; float:none;">
2225
+ <?php
2226
+ $choise = "document.getElementById('mail_from_name_user')";
2227
+ echo '<div style="position:relative; top:-3px;"><div id="mail_from_name_user_labels" class="email_labels" style="display:none;">';
2228
+ for($i=0; $i<count($label_label); $i++) {
2229
+ if($label_type[$i]=="type_submit_reset" || $label_type[$i]=="type_editor" || $label_type[$i]=="type_map" || $label_type[$i]=="type_mark_map" || $label_type[$i]=="type_captcha"|| $label_type[$i]=="type_recaptcha" || $label_type[$i]=="type_button" || $label_type[$i]=="type_file_upload" || $label_type[$i]=="type_send_copy")
2230
+ continue;
2231
+
2232
+ $param = htmlspecialchars(addslashes($label_label[$i]));
2233
+ $fld_label = $param;
2234
+ if(strlen($fld_label)>30) {
2235
+ $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2236
+ $fld_label = explode("\n", $fld_label);
2237
+ $fld_label = $fld_label[0] . ' ...';
2238
+ }
2239
+
2240
+ echo "<a onClick=\"insertAtCursor(".$choise.",'".$param."'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">".$fld_label."</a>";
2241
+ }
2242
+ echo "<a onClick=\"insertAtCursor(".$choise.",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
2243
+ echo "<a onClick=\"insertAtCursor(".$choise.",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
2244
+ echo '</div></div>';
2245
+ ?>
2246
+ </td>
2247
+ </tr>
2248
+ <tr valign="top">
2249
+ <td class="fm_options_label">
2250
+ <label for="reply_to_user">Reply to<br />(if different from "Email Form")</label>
2251
+ </td>
2252
+ <td class="fm_options_value">
2253
+ <input type="text" id="reply_to_user" name="reply_to_user" value="<?php echo $row->reply_to_user; ?>" style="width:250px;"/>
2254
+ </td>
2255
+ </tr>
2256
+ <tr valign="top">
2257
+ <td class="fm_options_label">
2258
+ <label> CC: </label>
2259
+ </td>
2260
+ <td class="fm_options_value">
2261
+ <input type="text" id="mail_cc_user" name="mail_cc_user" value="<?php echo $row->mail_cc_user ?>" style="width:250px;" />
2262
+ </td>
2263
+ </tr>
2264
+ <tr valign="top">
2265
+ <td class="fm_options_label">
2266
+ <label> BCC: </label>
2267
+ </td>
2268
+ <td class="fm_options_value">
2269
+ <input type="text" id="mail_bcc_user" name="mail_bcc_user" value="<?php echo $row->mail_bcc_user ?>" style="width:250px;" />
2270
+ </td>
2271
+ </tr>
2272
+ <tr valign="top">
2273
+ <td class="fm_options_label">
2274
+ <label> Subject: </label>
2275
+ </td>
2276
+ <td class="fm_options_value">
2277
+ <input type="text" id="mail_subject_user" name="mail_subject_user" value="<?php echo $row->mail_subject_user ?>" style="width:250px;" />
2278
+ <img src="<?php echo WD_FM_URL . '/images/add.png?ver='. WD_FM_VERSION.''; ?>" onclick="document.getElementById('mail_subject_user_labels').style.display='block';" style="vertical-align: middle; cursor: pointer; display:inline-block; margin:0px; float:none;">
2279
+ <?php
2280
+ $choise = "document.getElementById('mail_subject_user')";
2281
+ echo '<div style="position:relative; top:-3px;"><div id="mail_subject_user_labels" class="email_labels" style="display:none;">';
2282
+ for($i=0; $i<count($label_label); $i++)
2283
+ {
2284
+ if($label_type[$i]=="type_submit_reset" || $label_type[$i]=="type_editor" || $label_type[$i]=="type_map" || $label_type[$i]=="type_mark_map" || $label_type[$i]=="type_captcha"|| $label_type[$i]=="type_recaptcha" || $label_type[$i]=="type_button" || $label_type[$i]=="type_file_upload" || $label_type[$i]=="type_send_copy")
2285
+ continue;
2286
+
2287
+ $param = htmlspecialchars(addslashes($label_label[$i]));
2288
+
2289
+ $fld_label = $param;
2290
+ if(strlen($fld_label)>30)
2291
+ {
2292
+ $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2293
+ $fld_label = explode("\n", $fld_label);
2294
+ $fld_label = $fld_label[0] . ' ...';
2295
+ }
2296
+
2297
+ echo "<a onClick=\"insertAtCursor(".$choise.",'".$param."'); document.getElementById('mail_subject_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">".$fld_label."</a>";
2298
+
2299
+ }
2300
+ echo "<a onClick=\"insertAtCursor(".$choise.",'subid'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Submission ID</a>";
2301
+
2302
+ echo "<a onClick=\"insertAtCursor(".$choise.",'username'); document.getElementById('mail_from_name_user_labels').style.display='none';\" style=\"display:block; text-decoration:none;\">Username</a>";
2303
+ echo '</div></div>';
2304
+ ?>
2305
+ </td>
2306
+ </tr>
2307
+ <tr valign="top">
2308
+ <td class="fm_options_label" style="vertical-align: middle;">
2309
+ <label> Mode: </label>
2310
+ </td>
2311
+ <td class="fm_options_value">
2312
+ <button name="mail_mode_user"class="fm-checkbox-radio-button <?php echo $row->mail_mode_user == 1 ? 'fm-text-yes' : 'fm-text-no' ?> medium" onclick="fm_change_radio_checkbox_text(this); return false;" value="<?php echo $row->mail_mode_user ?>">
2313
+ <label><?php echo $row->mail_mode_user == 1 ? 'HTML' : 'Text' ?></label>
2314
+ <span></span>
2315
+ </button>
2316
+ <input type="hidden" name="mail_mode_user" value="<?php echo $row->mail_mode_user; ?>"/>
2317
+ </td>
2318
+ </tr>
2319
+ <tr valign="top">
2320
+ <td class="fm_options_label" style="vertical-align: middle;">
2321
+ <label> Attach File: </label>
2322
+ </td>
2323
+ <td class="fm_options_value">
2324
+ <div class="error_fm" style="padding: 5px; font-size: 14px;">File attach is disabled in free version.</div>
2325
+ <input type="hidden" name="mail_attachment_user" value="<?php echo $row->mail_attachment_user; ?>"/>
2326
+ </td>
2327
+ </tr>
2328
+ <tr valign="top">
2329
+ <td class="fm_options_label" style="vertical-align: middle;">
2330
+ <label> Email verification: </label>
2331
+ </td>
2332
+ <td class="fm_options_value">
2333
+ <button name="mail_verify" class="fm-checkbox-radio-button <?php echo $row->mail_verify == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->mail_verify; ?>">
2334
+ <span></span>
2335
+ </button>
2336
+ <input type="hidden" name="mail_verify" value="<?php echo $row->mail_verify; ?>"/>
2337
+ </td>
2338
+ </tr>
2339
+ <tr valign="top" class="expire_link" <?php echo ($row->mail_verify==0 ? 'style="display:none;"' : '')?>>
2340
+ <td class="fm_options_label" valign="top">
2341
+ <label> Verification link expires in: </label>
2342
+ </td>
2343
+ <td class="fm_options_value">
2344
+ <input class="inputbox" type="text" name="mail_verify_expiretime" maxlength="10" value = "<?php echo ($row->mail_verify_expiretime ? $row->mail_verify_expiretime : 0); ?>" style="width:95px;" onkeypress="return check_isnum_point(event)"/><small> -- hours (0 - never expires).</small>
2345
+ </td>
2346
+ </tr>
2347
+ <tr>
2348
+ <td class="fm_options_label" valign="top">
2349
+ <label>Custom Text in Email For User</label>
2350
+ </td>
2351
+ <td class="fm_options_value">
2352
+ <div style="margin-bottom:5px">
2353
+ <?php
2354
+ $choise = "document.getElementById('script_mail_user')";
2355
+ for ($i = 0; $i < count($label_label); $i++) {
2356
+ if ($label_type[$i] == "type_submit_reset" || $label_type[$i] == "type_editor" || $label_type[$i] == "type_map" || $label_type[$i] == "type_mark_map" || $label_type[$i] == "type_captcha" || $label_type[$i] == "type_recaptcha" || $label_type[$i] == "type_button" || $label_type[$i] == "type_send_copy")
2357
+ continue;
2358
+
2359
+ $param = htmlspecialchars(addslashes($label_label[$i]));
2360
+ $fld_label = $param;
2361
+ if(strlen($fld_label)>30) {
2362
+ $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2363
+ $fld_label = explode("\n", $fld_label);
2364
+ $fld_label = $fld_label[0] . ' ...';
2365
+ }
2366
+ if($label_type[$i]=="type_file_upload") {
2367
+ ?>
2368
+ <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label.'(as image)'; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param; ?>')" />
2369
+ <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label.'(as link)'; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param.'(link)'; ?>')" />
2370
+ <?php
2371
+ }
2372
+ else{
2373
+ ?>
2374
+ <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param; ?>')" />
2375
+ <?php
2376
+ }
2377
+ }
2378
+ ?>
2379
+ <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php echo $choise; ?>,'subid')" />
2380
+ <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php echo $choise; ?>,'ip')" />
2381
+ <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php echo $choise; ?>,'username')" />
2382
+ <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php echo $choise; ?>,'useremail')" />
2383
+ <input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="All fields list" onClick="insertAtCursor(<?php echo $choise; ?>, 'all')" />
2384
+ <div class="verification_div" <?php echo ($row->mail_verify==0 ? 'style="display:none;"' : '')?>><input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="Verification link" onClick="insertAtCursor(<?php echo $choise; ?>,'Verification link')" /> </div>
2385
+ </div>
2386
+ <?php
2387
+ if (user_can_richedit()) {
2388
+ wp_editor($row->script_mail_user, 'script_mail_user', array('teeny' => FALSE, 'textarea_name' => 'script_mail_user', 'media_buttons' => FALSE, 'textarea_rows' => 5));
2389
+ }
2390
+ else {
2391
+ ?>
2392
+ <textarea name="script_mail_user" id="script_mail_user" cols="20" rows="10" style="width:300px; height:450px;"><?php echo $row->script_mail_user; ?></textarea>
2393
+ <?php
2394
+ }
2395
+ ?>
2396
+ </td>
2397
+ </tr>
2398
+ </table>
2399
+ </fieldset>
2400
+ </fieldset>
2401
+ <fieldset id="actions_fieldset" class="adminform fm_fieldset_deactive">
2402
+ <legend>Actions after submission</legend>
2403
+ <table class="admintable">
2404
+ <tr valign="top">
2405
+ <td class="fm_options_label">
2406
+ <label>Action type</label>
2407
+ </td>
2408
+ <td class="fm_options_value">
2409
+ <div>
2410
+ <input type="radio" name="submit_text_type" id="text_type_none" onclick="set_type('none')" value="1" <?php echo ($row->submit_text_type != 2 && $row->submit_text_type != 3 && $row->submit_text_type != 4 && $row->submit_text_type != 5) ? "checked" : ""; ?> />
2411
+ <label for="text_type_none">Stay on Form</label>
2412
+ </div>
2413
+ <div>
2414
+ <input type="radio" name="submit_text_type" id="text_type_post" onclick="set_type('post')" value="2" <?php echo ($row->submit_text_type == 2) ? "checked" : ""; ?> />
2415
+ <label for="text_type_post">Post</label>
2416
+ </div>
2417
+ <div>
2418
+ <input type="radio" name="submit_text_type" id="text_type_page" onclick="set_type('page')" value="5" <?php echo ($row->submit_text_type == 5) ? "checked" : ""; ?> />
2419
+ <label for="text_type_page">Page</label>
2420
+ </div>
2421
+ <div>
2422
+ <input type="radio" name="submit_text_type" id="text_type_custom_text" onclick="set_type('custom_text')" value="3" <?php echo ($row->submit_text_type == 3 ) ? "checked" : ""; ?> />
2423
+ <label for="text_type_custom_text">Custom Text</label>
2424
+ </div>
2425
+ <div>
2426
+ <input type="radio" name="submit_text_type" id="text_type_url" onclick="set_type('url')" value="4" <?php echo ($row->submit_text_type == 4) ? "checked" : ""; ?> />
2427
+ <label for="text_type_url">URL</label>
2428
+ </div>
2429
+ </td>
2430
+ </tr>
2431
+ <tr id="none" <?php echo (($row->submit_text_type == 2 || $row->submit_text_type == 3 || $row->submit_text_type == 4 || $row->submit_text_type == 5) ? 'style="display:none"' : ''); ?>>
2432
+ <td class="fm_options_label">
2433
+ <label>Stay on Form</label>
2434
+ </td>
2435
+ <td class="fm_options_value">
2436
+ <img src="<?php echo WD_FM_URL . '/images/verified.png'; ?>" border="0">
2437
+ </td>
2438
+ </tr>
2439
+ <tr id="post" <?php echo (($row->submit_text_type != 2) ? 'style="display:none"' : ''); ?>>
2440
+ <td class="fm_options_label">
2441
+ <label for="post_name">Post</label>
2442
+ </td>
2443
+ <td class="fm_options_value">
2444
+ <select id="post_name" name="post_name">
2445
+ <option value="0">- Select Post -</option>
2446
+ <?php
2447
+ $args = array('posts_per_page' => 10000);
2448
+ query_posts($args);
2449
+ while (have_posts()) : the_post(); ?>
2450
+ <option value="<?php $x = get_permalink(get_the_ID()); echo $x; ?>" <?php echo (($row->article_id == $x) ? 'selected="selected"' : ''); ?>><?php the_title(); ?></option>
2451
+ <?php
2452
+ endwhile;
2453
+ wp_reset_query();
2454
+ ?>
2455
+ </select>
2456
+ </td>
2457
+ </tr>
2458
+ <tr id="page" <?php echo (($row->submit_text_type != 5) ? 'style="display:none"' : ''); ?>>
2459
+ <td class="fm_options_label">
2460
+ <label for="page_name">Page</label>
2461
+ </td>
2462
+ <td class="fm_options_value">
2463
+ <select id="page_name" name="page_name">
2464
+ <option value="0">- Select Page -</option>
2465
+ <?php
2466
+ $pages = get_pages();
2467
+ foreach ($pages as $page) {
2468
+ $page_id = get_page_link($page->ID);
2469
+ ?>
2470
+ <option value="<?php echo $page_id; ?>" <?php echo (($row->article_id == $page_id) ? 'selected="selected"' : ''); ?>><?php echo $page->post_title; ?></option>
2471
+ <?php
2472
+ }
2473
+ wp_reset_query();
2474
+ ?>
2475
+ </select>
2476
+ </td>
2477
+ </tr>
2478
+ <tr id="custom_text" <?php echo (($row->submit_text_type != 3) ? 'style="display: none;"' : ''); ?>>
2479
+ <td class="fm_options_label">
2480
+ <label for="submit_text">Text</label>
2481
+ </td>
2482
+ <td class="fm_options_value">
2483
+ <?php $choise = "document.getElementById('submit_text')";
2484
+ for ($i = 0; $i < count($label_label); $i++) {
2485
+ if ($label_type[$i]=="type_submit_reset" || $label_type[$i]=="type_editor" || $label_type[$i]=="type_map" || $label_type[$i]=="type_mark_map" || $label_type[$i]=="type_captcha"|| $label_type[$i]=="type_recaptcha" || $label_type[$i]=="type_button" || $label_type[$i]=="type_send_copy" || $label_type[$i]=="type_file_upload")
2486
+ continue;
2487
+
2488
+ $param = htmlspecialchars(addslashes($label_label[$i]));
2489
+ $fld_label = $param;
2490
+ if(strlen($fld_label)>30) {
2491
+ $fld_label = wordwrap(htmlspecialchars(addslashes($label_label[$i])), 30);
2492
+ $fld_label = explode("\n", $fld_label);
2493
+ $fld_label = $fld_label[0] . ' ...';
2494
+ }
2495
+
2496
+ ?>
2497
+ <input style="border: 1px solid silver; font-size: 10px;" type="button" value="<?php echo $fld_label; ?>" onClick="insertAtCursor(<?php echo $choise; ?>, '<?php echo $param; ?>')" />
2498
+ <?php
2499
+ }
2500
+ ?>
2501
+ <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Submission ID" onClick="insertAtCursor(<?php echo $choise; ?>,'subid')" />
2502
+ <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Ip" onClick="insertAtCursor(<?php echo $choise; ?>,'ip')" />
2503
+ <input style="border: 1px solid silver; font-size: 10px; margin:3px;" type="button" value="User Id" onClick="insertAtCursor(<?php echo $choise; ?>, 'userid')" />
2504
+ <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="Username" onClick="insertAtCursor(<?php echo $choise; ?>,'username')" />
2505
+ <input style="border: 1px solid silver; font-size: 10px; margin: 3px;" type="button" value="User Email" onClick="insertAtCursor(<?php echo $choise; ?>,'useremail')" />
2506
+ <?php
2507
+ if (user_can_richedit()) {
2508
+ wp_editor($row->submit_text, 'submit_text', array('teeny' => FALSE, 'textarea_name' => 'submit_text', 'media_buttons' => FALSE, 'textarea_rows' => 5));
2509
+ }
2510
+ else {
2511
+ ?>
2512
+ <textarea cols="36" rows="5" id="submit_text" name="submit_text" style="resize: vertical;">
2513
+ <?php echo $row->submit_text; ?>
2514
+ </textarea>
2515
+ <?php
2516
+ }
2517
+ ?>
2518
+ </td>
2519
+ </tr>
2520
+ <tr id="url" <?php echo (($row->submit_text_type != 4 ) ? 'style="display:none"' : ''); ?>>
2521
+ <td class="fm_options_label">
2522
+ <label for="url">URL</label>
2523
+ </td>
2524
+ <td class="fm_options_value">
2525
+ <input type="text" id="url" name="url" style="width:300px" value="<?php echo $row->url; ?>" />
2526
+ </td>
2527
+ </tr>
2528
+ </table>
2529
+ </fieldset>
2530
+ <fieldset id="payment_fieldset" class="adminform fm_fieldset_deactive">
2531
+ <legend>Payment Options</legend>
2532
+ <table class="admintable">
2533
+ <tr>
2534
+ <td colspan="2">
2535
+ <div class="error_fm" style="padding: 5px; font-size: 14px;">Paypal Options are disabled in free version.</div>
2536
+ </td>
2537
+ </tr>
2538
+ <tr valign="top">
2539
+ <td class="fm_options_label">
2540
+ <label>Payment Method</label>
2541
+ </td>
2542
+ <td class="fm_options_value">
2543
+ <div><input type="radio" name="paypal_mode" id="paypal_mode0" value="none" checked="checked" onchange="fm_change_payment_method('none');" disabled="disabled" /><label for="paypal_mode0">None</label></div>
2544
+ <div><input type="radio" name="paypal_mode" id="paypal_mode1" value="paypal" onchange="fm_change_payment_method('paypal');" disabled="disabled" /><label for="paypal_mode1">Paypal</label></div>
2545
+ </td>
2546
+ </tr>
2547
+ </table>
2548
+ </fieldset>
2549
+ <fieldset id="javascript_fieldset" class="adminform fm_fieldset_deactive">
2550
+ <legend>JavaScript</legend>
2551
+ <table class="admintable">
2552
+ <tr valign="top">
2553
+ <td class="fm_options_label">
2554
+ <label for="javascript">Javascript</label>
2555
+ </td>
2556
+ <td class="fm_options_value" style="width:650px;">
2557
+ <textarea style="margin: 0px; height: 400px; width: 600px;" cols="60" rows="30" name="javascript" id="form_javascript"><?php echo $row->javascript; ?></textarea>
2558
+ </td>
2559
+ </tr>
2560
+ </table>
2561
+ </fieldset>
2562
+ <fieldset id="conditions_fieldset" class="adminform fm_fieldset_deactive">
2563
+ <?php
2564
+ $ids = array();
2565
+ $types = array();
2566
+ $labels = array();
2567
+ $paramss = array();
2568
+ $all_ids = array();
2569
+ $all_labels = array();
2570
+
2571
+ $select_and_input = array("type_text", "type_password", "type_textarea", "type_name", "type_number", "type_phone", "type_phone_new", "type_submitter_mail", "type_address", "type_spinner", "type_checkbox", "type_radio", "type_own_select", "type_paypal_price", "type_paypal_price_new", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping", "type_date_new");
2572
+
2573
+ $select_type_fields = array("type_address", "type_checkbox", "type_radio", "type_own_select", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping");
2574
+
2575
+
2576
+ $fields=explode('*:*new_field*:*',$row->form_fields);
2577
+ $fields = array_slice($fields,0, count($fields)-1);
2578
+
2579
+ foreach($fields as $field) {
2580
+ $temp=explode('*:*id*:*',$field);
2581
+ array_push($ids, $temp[0]);
2582
+ array_push($all_ids, $temp[0]);
2583
+ $temp=explode('*:*type*:*',$temp[1]);
2584
+ array_push($types, $temp[0]);
2585
+ $temp=explode('*:*w_field_label*:*',$temp[1]);
2586
+ array_push($labels, $temp[0]);
2587
+ array_push($all_labels, $temp[0]);
2588
+ array_push($paramss, $temp[1]);
2589
+
2590
+ }
2591
+
2592
+ foreach($types as $key=>$value){
2593
+ if(!in_array($types[$key],$select_and_input)){
2594
+ unset($ids[$key]);
2595
+ unset($labels[$key]);
2596
+ unset($types[$key]);
2597
+ unset($paramss[$key]);
2598
+ }
2599
+ }
2600
+
2601
+ $ids = array_values($ids);
2602
+ $labels = array_values($labels);
2603
+ $types = array_values($types);
2604
+ $paramss = array_values($paramss);
2605
+
2606
+ $chose_ids = implode('@@**@@',$ids);
2607
+ $chose_labels = implode('@@**@@',$labels);
2608
+ $chose_types = implode('@@**@@',$types);
2609
+ $chose_paramss = implode('@@**@@',$paramss);
2610
+
2611
+ $all_ids_cond = implode('@@**@@',$all_ids);
2612
+ $all_labels_cond = implode('@@**@@',$all_labels);
2613
+
2614
+ $show_hide = array();
2615
+ $field_label = array();
2616
+ $all_any = array();
2617
+ $condition_params = array();
2618
+
2619
+
2620
+ $count_of_conditions=0;
2621
+ if($row->condition!="") {
2622
+ $conditions=explode('*:*new_condition*:*',$row->condition);
2623
+ $conditions = array_slice($conditions,0, count($conditions)-1);
2624
+ $count_of_conditions = count($conditions);
2625
+
2626
+ foreach($conditions as $condition) {
2627
+ $temp=explode('*:*show_hide*:*',$condition);
2628
+ array_push($show_hide, $temp[0]);
2629
+ $temp=explode('*:*field_label*:*',$temp[1]);
2630
+ array_push($field_label, $temp[0]);
2631
+ $temp=explode('*:*all_any*:*',$temp[1]);
2632
+ array_push($all_any, $temp[0]);
2633
+ array_push($condition_params, $temp[1]);
2634
+ }
2635
+ }
2636
+ else {
2637
+ $show_hide[0]=1;
2638
+ $all_any[0]='and';
2639
+ $condition_params[0]='';
2640
+ if($all_ids)
2641
+ $field_label[0] = $all_ids[0];
2642
+ }
2643
+ ?>
2644
+ <div>
2645
+ <button class="fm-button add-button large" onclick="add_condition('<?php echo $chose_ids; ?>', '<?php echo htmlspecialchars(addslashes($chose_labels)); ?>', '<?php echo $chose_types; ?>', '<?php echo htmlspecialchars(addslashes($chose_paramss)); ?>', '<?php echo $all_ids_cond; ?>', '<?php echo htmlspecialchars(addslashes($all_labels_cond)); ?>'); return false;">
2646
+ Add Condition
2647
+ <span></span>
2648
+ </button>
2649
+ </div>
2650
+ <?php
2651
+ for($k=0; $k<$count_of_conditions; $k++) {
2652
+ if(in_array($field_label[$k],$all_ids)) : ?>
2653
+ <div id="condition<?php echo $k; ?>" class="fm-condition">
2654
+ <div id="conditional_fileds<?php echo $k; ?>">
2655
+ <select id="show_hide<?php echo $k; ?>" name="show_hide<?php echo $k; ?>" style="width:80px; ">
2656
+ <option value="1" <?php if($show_hide[$k]==1) echo 'selected="selected"'; ?>>show</option>
2657
+ <option value="0" <?php if($show_hide[$k]==0) echo 'selected="selected"'; ?>>hide</option>
2658
+ </select>
2659
+ <select id="fields<?php echo $k; ?>" name="fields<?php echo $k; ?>" style="width:300px; " onChange="" >
2660
+ <?php
2661
+ foreach($all_labels as $key => $value) {
2662
+ if($field_label[$k]==$all_ids[$key])
2663
+ $selected = 'selected="selected"';
2664
+ else
2665
+ $selected ='';
2666
+ echo '<option value="'.$all_ids[$key].'" '.$selected.'>'.$value.'</option>';
2667
+ }
2668
+ ?>
2669
+ </select>
2670
+ <span>if</span>
2671
+ <select id="all_any<?php echo $k; ?>" name="all_any<?php echo $k; ?>" style="width:60px; ">
2672
+ <option value="and" <?php if($all_any[$k]=="and") echo 'selected="selected"'; ?>>all</option>
2673
+ <option value="or" <?php if($all_any[$k]=="or") echo 'selected="selected"'; ?>>any</option>
2674
+ </select>
2675
+ <span>of the following match:</span>
2676
+ <img src="<?php echo WD_FM_URL . '/images/add.png?ver='. WD_FM_VERSION.''; ?>" title="add" onclick="add_condition_fields(<?php echo $k; ?>,'<?php echo $chose_ids; ?>', '<?php echo htmlspecialchars(addslashes($chose_labels)); ?>', '<?php echo $chose_types; ?>', '<?php echo htmlspecialchars(addslashes($chose_paramss)); ?>')" style="cursor: pointer; vertical-align: middle;">
2677
+ <img src="<?php echo WD_FM_URL . '/images/page_delete.png?ver='. WD_FM_VERSION.''; ?>" onclick="delete_condition('<?php echo $k; ?>')" style="cursor: pointer; vertical-align: middle;">
2678
+ </div>
2679
+ <?php
2680
+ if($condition_params[$k]) {
2681
+ $_params = explode('*:*next_condition*:*',$condition_params[$k]);
2682
+ $_params = array_slice($_params,0, count($_params)-1);
2683
+
2684
+ foreach($_params as $key=>$_param) {
2685
+ $key_select_or_input ='';
2686
+ $param_values = explode('***',$_param);
2687
+ $multiselect = explode('@@@',$param_values[2]);
2688
+
2689
+ if(in_array($param_values[0],$ids)): ?>
2690
+ <div id="condition_div<?php echo $k; ?>_<?php echo $key; ?>">
2691
+ <select id="field_labels<?php echo $k; ?>_<?php echo $key; ?>" onchange="change_choices(this.options[this.selectedIndex].id+'_<?php echo $key; ?>','<?php echo $chose_ids; ?>', '<?php echo $chose_types; ?>', '<?php echo htmlspecialchars(addslashes($chose_paramss)); ?>')" style="width:300px;"/>
2692
+ <?php
2693
+ foreach($labels as $key1 => $value)
2694
+ {
2695
+ if($param_values[0]==$ids[$key1])
2696
+ {
2697
+ $selected = 'selected="selected"';
2698
+ if ($types[$key1]=="type_checkbox" || $types[$key1]=="type_paypal_checkbox")
2699
+ $multiple = 'multiple="multiple" class="multiple_select"';
2700
+ else
2701
+ $multiple ='';
2702
+
2703
+ $key_select_or_input = $key1;
2704
+ }
2705
+ else
2706
+ $selected ='';
2707
+ if($field_label[$k]!=$ids[$key1])
2708
+ echo '<option id="'.$k.'_'.$key1.'" value="'.$ids[$key1].'" '.$selected.'>'.$value.'</option>';
2709
+
2710
+ }
2711
+
2712
+ ?>
2713
+ </select>
2714
+
2715
+ <select id="is_select<?php echo $k; ?>_<?php echo $key; ?>" style="vertical-align: top; width:94px;">
2716
+ <option value="==" <?php if($param_values[1]=="==") echo 'selected="selected"'; ?>>is</option>
2717
+ <option value="!=" <?php if($param_values[1]=="!=") echo 'selected="selected"'; ?>>is not</option>
2718
+ <option value="%" <?php if($param_values[1]=="%") echo 'selected="selected"'; ?>>like</option>
2719
+
2720
+ <option value="!%" <?php if($param_values[1]=="!%") echo 'selected="selected"'; ?>>not like</option>
2721
+
2722
+ <option value="=" <?php if($param_values[1]=="=") echo 'selected="selected"'; ?>>empty</option>
2723
+
2724
+ <option value="!" <?php if($param_values[1]=="!") echo 'selected="selected"'; ?>>not empty</option>
2725
+
2726
+ </select>
2727
+
2728
+ <?php if ($key_select_or_input !== '' && in_array($types[$key_select_or_input],$select_type_fields)) : ?>
2729
+ <select id="field_value<?php echo $k; ?>_<?php echo $key; ?>" <?php echo $multiple; ?> style="width: 200px;">
2730
+ <?php
2731
+ switch($types[$key_select_or_input])
2732
+ {
2733
+ case "type_own_select":
2734
+ case "type_paypal_select":
2735
+ $w_size = explode('*:*w_size*:*',$paramss[$key_select_or_input]);
2736
+ break;
2737
+
2738
+ case "type_radio":
2739
+ case "type_checkbox":
2740
+ case "type_paypal_radio":
2741
+ case "type_paypal_checkbox":
2742
+ case "type_paypal_shipping":
2743
+ $w_size = explode('*:*w_flow*:*',$paramss[$key_select_or_input]);
2744
+ break;
2745
+ }
2746
+
2747
+ $w_choices = explode('*:*w_choices*:*',$w_size[1]);
2748
+ $w_choices_array = explode('***',$w_choices[0]);
2749
+
2750
+ if($types[$key_select_or_input] == 'type_radio' || $types[$key_select_or_input] == 'type_checkbox' || $types[$key_select_or_input] == 'type_own_select')
2751
+ {
2752
+
2753
+ if(strpos($w_choices[1], 'w_value_disabled') > -1)
2754
+ {
2755
+ $w_value_disabled= explode('*:*w_value_disabled*:*',$w_choices[1]);
2756
+ $w_choices_value = explode('*:*w_choices_value*:*',$w_value_disabled[1]);
2757
+ $w_choices_value = $w_choices_value[0];
2758
+ }
2759
+
2760
+ if(isset($w_choices_value))
2761
+ $w_choices_value_array = explode('***',$w_choices_value);
2762
+ else
2763
+ $w_choices_value_array = $w_choices_array;
2764
+ }
2765
+ else
2766
+ {
2767
+ $w_choices_price= explode('*:*w_choices_price*:*',$w_choices[1]);
2768
+ $w_choices_value = $w_choices_price[0];
2769
+ $w_choices_value_array = explode('***', $w_choices_value);
2770
+ }
2771
+
2772
+
2773
+ for($m=0; $m<count($w_choices_array); $m++)
2774
+ {
2775
+ if($types[$key_select_or_input]=="type_paypal_checkbox" || $types[$key_select_or_input]=="type_paypal_radio" || $types[$key_select_or_input]=="type_paypal_shipping" || $types[$key_select_or_input]=="type_paypal_select")
2776
+ $w_choice = $w_choices_array[$m].'*:*value*:*'.$w_choices_value_array[$m];
2777
+ else
2778
+ $w_choice = $w_choices_value_array[$m];
2779
+
2780
+ if(in_array(esc_html($w_choice),$multiselect))
2781
+ {
2782
+ $selected = 'selected="selected"';
2783
+ }
2784
+ else
2785
+ $selected ='';
2786
+
2787
+ if(strpos($w_choices_array[$m], '[') === false && strpos($w_choices_array[$m], ']') === false ) {
2788
+ echo '<option id="choise_'.$k.'_'.$m.'" value="'.$w_choice.'" '.$selected.'>'.$w_choices_array[$m].'</option>';
2789
+ }
2790
+ }
2791
+
2792
+ if($types[$key_select_or_input]=="type_address")
2793
+ {
2794
+ $w_countries = array("","Afghanistan","Albania","Algeria","Andorra","Angola","Antigua and Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Central African Republic","Chad","Chile","China","Colombia","Comoros","Congo (Brazzaville)","Congo","Costa Rica","Cote d'Ivoire","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","East Timor (Timor Timur)","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Fiji","Finland","France","Gabon","Gambia, The","Georgia","Germany","Ghana","Greece","Grenada","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Jamaica","Japan","Jordan","Kazakhstan","Kenya","Kiribati","Korea, North","Korea, South","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","New Zealand","Nicaragua","Niger","Nigeria","Norway","Oman","Pakistan","Palau","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Qatar","Romania","Russia","Rwanda","Saint Kitts and Nevis","Saint Lucia","Saint Vincent","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia and Montenegro","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","Spain","Sri Lanka","Sudan","Suriname","Swaziland","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Togo","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Yemen","Zambia","Zimbabwe");
2795
+ $w_options = '';
2796
+ foreach($w_countries as $w_country)
2797
+ {
2798
+ if(in_array($w_country,$multiselect))
2799
+ {
2800
+ $selected = 'selected="selected"';
2801
+ }
2802
+ else
2803
+ $selected ='';
2804
+
2805
+ echo '<option value="'.$w_country.'" '.$selected.'>'.$w_country.'</option>';
2806
+ }
2807
+ }
2808
+
2809
+ ?>
2810
+ </select>
2811
+ <?php else :
2812
+ if($key_select_or_input != '' && ($types[$key_select_or_input]=="type_number" || $types[$key_select_or_input]=="type_phone"))
2813
+ $onkeypress_function = "onkeypress='return check_isnum_space(event)'";
2814
+ else
2815
+ if($key_select_or_input != '' && ($types[$key_select_or_input]=="type_paypal_price" || $types[$key_select_or_input]=="type_paypal_price_new"))
2816
+ $onkeypress_function = "onkeypress='return check_isnum_point(event)'";
2817
+ else
2818
+ $onkeypress_function = "";
2819
+ ?>
2820
+ <input id="field_value<?php echo $k; ?>_<?php echo $key; ?>" type="text" value="<?php echo $param_values[2];?>" <?php echo $onkeypress_function; ?> style=" width: 200px;"><?php endif; ?>
2821
+
2822
+ <img src="<?php echo WD_FM_URL . '/images/delete.png?ver='. WD_FM_VERSION.''; ?>" id="delete_condition<?php echo $k; ?>_<?php echo $key; ?>" onclick="delete_field_condition('<?php echo $k; ?>_<?php echo $key; ?>')" style="vertical-align: middle;">
2823
+ </div>
2824
+ <?php endif;
2825
+ }
2826
+ }
2827
+
2828
+ ?>
2829
+ </div>
2830
+ <?php endif;
2831
+ }
2832
+ ?>
2833
+ <input type="hidden" id="condition" name="condition" value="<?php echo $row->condition; ?>" />
2834
+ </fieldset>
2835
+ <fieldset id="mapping_fieldset" class="adminform fm_fieldset_deactive">
2836
+ <div style="padding-bottom:15px;">
2837
+ <button id="add_query" class="fm-button add-button medium" onclick="tb_show('', '<?php echo add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => 0, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?>'); return false;">
2838
+ <span></span>
2839
+ Add Query
2840
+ </button>
2841
+ <button class="fm-button delete-button medium" onclick="if (fm_check_email('mailToAdd') || fm_check_email('from_mail') || fm_check_email('reply_to') || fm_check_email('mail_from_other') || fm_check_email('reply_to_other') || fm_check_email('paypal_email')) {return false;}; wd_fm_apply_options('remove_query'); return false;">
2842
+ <span></span>
2843
+ Delete
2844
+ </button>
2845
+ </div>
2846
+ <?php
2847
+ if ($queries) {
2848
+ ?>
2849
+ <table class="wp-list-table widefat fixed posts table_content">
2850
+ <thead>
2851
+ <tr>
2852
+ <th style="width:4%;" class="table_small_col count_col sub-align">#</th>
2853
+ <th style="width:4%;" class="table_small_col count_col sub-align">ID</th>
2854
+ <th style="width:6%;" class="manage-column column-cb check-column table_small_col sub-align form_check">
2855
+ <input id="check_all" type="checkbox" style="margin:0;">
2856
+ </th>
2857
+ <th style="width:86%;" class="table_large_col">Query</th>
2858
+ </tr>
2859
+ </thead>
2860
+ <?php
2861
+ $k = 0;
2862
+ for($i=0, $n=count($queries); $i < $n ; $i++) {
2863
+ $query = $queries[$i];
2864
+ $checked = '<input type="checkbox" id="' . $i . '" name="cid[]" value="' . $query->id . '" />';
2865
+ $link = add_query_arg(array('action' => 'FormMakerSQLMapping', 'id' => $query->id, 'form_id' => $row->id, 'width' => '1000', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
2866
+ ?>
2867
+ <tr <?php if (!$k) echo "class=\"alternate\""; ?>>
2868
+ <td align="center" class="table_small_col"><?php echo $i+1; ?></td>
2869
+ <td align="center" class="table_small_col"><?php echo $query->id; ?></td>
2870
+ <td align="center" class="table_small_col check-column"><?php echo $checked; ?></td>
2871
+ <td align="center">
2872
+ <a rel="{handler: 'iframe', size: {x: 530, y: 370}}" onclick="tb_show('', '<?php echo $link; ?>'); return false;" style="cursor:pointer;">
2873
+ <?php echo $query->query; ?>
2874
+ </a>
2875
+ </td>
2876
+ </tr>
2877
+ <?php
2878
+ $k = 1 - $k;
2879
+ }
2880
+ ?>
2881
+ </table>
2882
+ <?php
2883
+ }
2884
+ ?>
2885
+ </fieldset>
2886
+ <?php
2887
+ foreach($addons as $addon => $addon_name) {
2888
+ if (defined($addon) && is_plugin_active(constant($addon))) {
2889
+ $_GET['addon_view']='admin';
2890
+ $_GET['form_id']=$row->id;
2891
+ do_action($addon.'_init');
2892
+ }
2893
+ }
2894
+ ?>
2895
+ </div>
2896
+ <input type="hidden" name="boxchecked" value="0">
2897
+ <input type="hidden" name="fieldset_id" id="fieldset_id" value="<?php echo WDW_FM_Library::get('fieldset_id', 'general'); ?>" />
2898
+ <input type="hidden" id="task" name="task" value=""/>
2899
+ <input type="hidden" id="current_id" name="current_id" value="<?php echo $row->id; ?>" />
2900
+ </form>
2901
+ <script>
2902
+ jQuery(window).load(function () {
2903
+ form_maker_options_tabs(jQuery("#fieldset_id").val());
2904
+ fm_popup();
2905
+ function hide_email_labels(event) {
2906
+ var e = event.toElement || event.relatedTarget;
2907
+ if (e.parentNode == this || e == this) {
2908
+ return;
2909
+ }
2910
+ this.style.display="none";
2911
+ }
2912
+ if(document.getElementById('mail_from_labels')) {
2913
+ document.getElementById('mail_from_labels').addEventListener('mouseout',hide_email_labels,true);
2914
+ }
2915
+ if(document.getElementById('mail_subject_labels')) {
2916
+ document.getElementById('mail_subject_labels').addEventListener('mouseout',hide_email_labels,true);
2917
+ }
2918
+ if(document.getElementById('mail_from_name_user_labels')) {
2919
+ document.getElementById('mail_from_name_user_labels').addEventListener('mouseout',hide_email_labels,true);
2920
+ }
2921
+ if(document.getElementById('mail_subject_user_labels')) {
2922
+ document.getElementById('mail_subject_user_labels').addEventListener('mouseout',hide_email_labels,true);
2923
+ }
2924
+ if(document.getElementById('post_title_labels')) {
2925
+ document.getElementById('post_title_labels').addEventListener('mouseout',hide_email_labels,true);
2926
+ }
2927
+ if(document.getElementById('post_tags_labels')) {
2928
+ document.getElementById('post_tags_labels').addEventListener('mouseout',hide_email_labels,true);
2929
+ }
2930
+ if(document.getElementById('post_featured_image_labels')) {
2931
+ document.getElementById('post_featured_image_labels').addEventListener('mouseout',hide_email_labels,true);
2932
+ }
2933
+ if(document.getElementById('dbox_upload_dir_labels')) {
2934
+ document.getElementById('dbox_upload_dir_labels').addEventListener('mouseout',hide_email_labels,true);
2935
+ }
2936
+ });
2937
+ function wd_fm_apply_options(task) {
2938
+ set_condition();
2939
+ fm_set_input_value('task', task);
2940
+ document.getElementById('adminForm').submit();
2941
+
2942
+ }
2943
+ </script>
2944
+ <?php
2945
+ }
2946
+
2947
+ public function form_layout($id) {
2948
+ $row = $this->model->get_row_data($id);
2949
+ $ids = array();
2950
+ $types = array();
2951
+ $labels = array();
2952
+ $fields = explode('*:*new_field*:*', $row->form_fields);
2953
+ $fields = array_slice($fields, 0, count($fields) - 1);
2954
+ foreach ($fields as $field) {
2955
+ $temp = explode('*:*id*:*', $field);
2956
+ array_push($ids, $temp[0]);
2957
+ $temp = explode('*:*type*:*', $temp[1]);
2958
+ array_push($types, $temp[0]);
2959
+ $temp = explode('*:*w_field_label*:*', $temp[1]);
2960
+ array_push($labels, $temp[0]);
2961
+ }
2962
+ ?>
2963
+ <script>
2964
+ var form_front = '<?php echo addslashes($row->form_front);?>';
2965
+ var custom_front = '<?php echo addslashes($row->custom_front);?>';
2966
+ if (custom_front == '') {
2967
+ custom_front = form_front;
2968
+ }
2969
+ function submitbutton() {
2970
+ if (jQuery('#autogen_layout').is(':checked')) {
2971
+ jQuery('#custom_front').val(custom_front.replace(/\s+/g, ' ').replace(/> </g, '><'));
2972
+ }
2973
+ else {
2974
+ jQuery('#custom_front').val(editor.getValue().replace(/\s+/g, ' ').replace(/> </g, '><'));
2975
+ }
2976
+ }
2977
+ function insertAtCursor_form(myId, myLabel) {
2978
+ if (jQuery('#autogen_layout').is(':checked')) {
2979
+ alert("Uncheck the Auto-Generate Layout box.");
2980
+ return;
2981
+ }
2982
+ myValue = '<div wdid="' + myId + '" class="wdform_row">%' + myId + ' - ' + myLabel + '%</div>';
2983
+ line = editor.getCursor().line;
2984
+ ch = editor.getCursor().ch;
2985
+ text = editor.getLine(line);
2986
+ text1 = text.substr(0, ch);
2987
+ text2 = text.substr(ch);
2988
+ text = text1 + myValue + text2;
2989
+ editor.setLine(line, text);
2990
+ editor.focus();
2991
+ }
2992
+ function autogen(status) {
2993
+ if (status) {
2994
+ custom_front = editor.getValue();
2995
+ editor.setValue(form_front);
2996
+ editor.setOption('readOnly', true);
2997
+ autoFormat();
2998
+ }
2999
+ else {
3000
+ editor.setValue(custom_front);
3001
+ editor.setOption('readOnly', false);
3002
+ autoFormat();
3003
+ }
3004
+ }
3005
+ function autoFormat() {
3006
+ CodeMirror.commands["selectAll"](editor);
3007
+ editor.autoFormatRange(editor.getCursor(true), editor.getCursor(false));
3008
+ editor.scrollTo(0,0);
3009
+ }
3010
+ </script>
3011
+
3012
+ <div class="fm_layout">
3013
+ <form action="admin.php?page=manage_fm" method="post" name="adminForm" enctype="multipart/form-data">
3014
+ <?php wp_nonce_field('nonce_fm', 'nonce_fm'); ?>
3015
+ <div class="fm-layout-actions">
3016
+ <div class="fm-page-actions">
3017
+ <button class="fm-button save-button medium" onclick="submitbutton(); fm_set_input_value('task', 'save_layout');">
3018
+ Save
3019
+ <span></span>
3020
+ </button>
3021
+ <button class="fm-button apply-button medium" onclick="submitbutton(); fm_set_input_value('task', 'apply_layout');">
3022
+ Apply
3023
+ <span></span>
3024
+ </button>
3025
+ <button class="fm-button cancel-button medium" onclick="fm_set_input_value('task', 'cancel_options');">
3026
+ Cancel
3027
+ <span></span>
3028
+ </button>
3029
+ </div>
3030
+ </div>
3031
+ <div class="fm-layout-content">
3032
+ <h2 style="clear: both;">Description</h2>
3033
+ <p>To customize the layout of the form fields uncheck the Auto-Generate Layout box and edit the HTML.</p>
3034
+ <p>You can change positioning, add in-line styles and etc. Click on the provided buttons to add the corresponding field.<br /> This will add the following line:
3035
+ <b><span class="cm-tag">&lt;div</span> <span class="cm-attribute">wdid</span>=<span class="cm-string">"example_id"</span> <span class="cm-attribute">class</span>=<span class="cm-string">"wdform_row"</span><span class="cm-tag">&gt;</span>%example_id - Example%<span class="cm-tag">&lt;/div&gt;</span></b>
3036
+ , where <b><span class="cm-tag">&lt;div&gt;</span></b> is used to set a row.</p>
3037
+ <p>To return to the default settings you should check Auto-Generate Layout box.</p>
3038
+ <h3 style="color:red">Notice</h3>
3039
+ <p>Make sure not to publish the same field twice. This will cause malfunctioning of the form.</p>
3040
+ <hr/>
3041
+ <label for="autogen_layout" style="font-size: 20px; line-height: 45px; margin-left: 10px;">Auto Generate Layout? </label>
3042
+ <input type="checkbox" value="1" name="autogen_layout" id="autogen_layout" <?php echo (($row->autogen_layout) ? 'checked="checked"' : ''); ?> />
3043
+ <input type="hidden" name="custom_front" id="custom_front" value="" />
3044
+ <input type="hidden" id="task" name="task" value=""/>
3045
+ <input type="hidden" id="current_id" name="current_id" value="<?php echo $row->id; ?>" />
3046
+ <br/>
3047
+ <?php
3048
+ foreach($ids as $key => $id) {
3049
+ if ($types[$key] != "type_section_break") {
3050
+ ?>
3051
+ <button type="button" onClick="insertAtCursor_form('<?php echo $ids[$key]; ?>','<?php echo $labels[$key]; ?>')" class="fm_label_buttons" title="<?php echo $labels[$key]; ?>"><?php echo $labels[$key]; ?></button>
3052
+ <?php
3053
+ }
3054
+ }
3055
+ ?>
3056
+ </form>
3057
+ </div>
3058
+ <br /><br />
3059
+ <button class="fm_submit_layout button button-secondary button-hero" onclick="autoFormat()"><strong>Apply Source Formatting</strong> <em>(ctrl-enter)</em></button>
3060
+ <textarea id="source" name="source" style="display: none;"></textarea>
3061
+ </div>
3062
+ <script>
3063
+ var editor = CodeMirror.fromTextArea(document.getElementById("source"), {
3064
+ lineNumbers: true,
3065
+ lineWrapping: true,
3066
+ mode: "htmlmixed",
3067
+ value: form_front
3068
+ });
3069
+ if (jQuery('#autogen_layout').is(':checked')) {
3070
+ editor.setOption('readOnly', true);
3071
+ editor.setValue(form_front);
3072
+ }
3073
+ else {
3074
+ editor.setOption('readOnly', false);
3075
+ editor.setValue(custom_front);
3076
+ }
3077
+ jQuery('#autogen_layout').click(function() {
3078
+ autogen(jQuery(this).is(':checked'));
3079
+ });
3080
+ autoFormat();
3081
+ </script>
3082
+ <?php
3083
+ }
3084
+
3085
+ public function display_options($id) {
3086
+ $row_form = $this->model->get_row_data($id);
3087
+ $row = $this->model->get_display_options($id);
3088
+ $page_title = 'Display Options: '.$row_form->title;
3089
+ $animation_effects = array(
3090
+ 'none' => 'None',
3091
+ 'bounce' => 'Bounce',
3092
+ 'tada' => 'Tada',
3093
+ 'bounceInDown' => 'BounceInDown',
3094
+ 'fadeInLeft' => 'FadeInLeft',
3095
+ 'flash' => 'Flash',
3096
+ 'pulse' => 'Pulse',
3097
+ 'rubberBand' => 'RubberBand',
3098
+ 'shake' => 'Shake',
3099
+ 'swing' => 'Swing',
3100
+ 'wobble' => 'Wobble',
3101
+ 'hinge' => 'Hinge',
3102
+ 'lightSpeedIn' => 'LightSpeedIn',
3103
+ 'rollIn' => 'RollIn',
3104
+ 'bounceIn' => 'BounceIn',
3105
+ 'bounceInLeft' => 'BounceInLeft',
3106
+ 'bounceInRight' => 'BounceInRight',
3107
+ 'bounceInUp' => 'BounceInUp',
3108
+ 'fadeIn' => 'FadeIn',
3109
+ 'fadeInDown' => 'FadeInDown',
3110
+ 'fadeInDownBig' => 'FadeInDownBig',
3111
+ 'fadeInLeftBig' => 'FadeInLeftBig',
3112
+ 'fadeInRight' => 'FadeInRight',
3113
+ 'fadeInRightBig' => 'FadeInRightBig',
3114
+ 'fadeInUp' => 'FadeInUp',
3115
+ 'fadeInUpBig' => 'FadeInUpBig',
3116
+ 'flip' => 'Flip',
3117
+ 'flipInX' => 'FlipInX',
3118
+ 'flipInY' => 'FlipInY',
3119
+ 'rotateIn' => 'RotateIn',
3120
+ 'rotateInDownLeft' => 'RotateInDownLeft',
3121
+ 'rotateInDownRight' => 'RotateInDownRight',
3122
+ 'rotateInUpLeft' => 'RotateInUpLeft',
3123
+ 'rotateInUpRight' => 'RotateInUpRight',
3124
+ 'zoomIn' => 'ZoomIn',
3125
+ 'zoomInDown' => 'ZoomInDown',
3126
+ 'zoomInLeft' => 'ZoomInLeft',
3127
+ 'zoomInRight' => 'ZoomInRight',
3128
+ 'zoomInUp' => 'ZoomInUp',
3129
+ );
3130
+
3131
+ ?>
3132
+ <form class="wrap" method="post" action="admin.php?page=manage_fm" name="adminForm" id="adminForm">
3133
+ <?php wp_nonce_field('nonce_fm', 'nonce_fm'); ?>
3134
+ <input type="hidden" id="task" name="task" value=""/>
3135
+ <input type="hidden" id="current_id" name="current_id" value="<?php echo $row->form_id; ?>" />
3136
+ <div class="fm-page-header">
3137
+ <div class="fm-logo">
3138
+ </div>
3139
+ <div class="fm-page-title"><?php echo $page_title; ?></div>
3140
+ <div class="fm-page-actions">
3141
+ <button class="fm-button save-button medium" onclick="fm_apply_options('save_display_options');">
3142
+ <span></span>
3143
+ Save
3144
+ </button>
3145
+ <button class="fm-button apply-button medium" onclick="fm_apply_options('apply_display_options');">
3146
+ <span></span>
3147
+ Apply
3148
+ </button>
3149
+ <button class="fm-button cancel-button medium" onclick="fm_set_input_value('task', 'cancel_options');">
3150
+ <span></span>
3151
+ Cancel
3152
+ </button>
3153
+ </div>
3154
+ <div class="fm-clear"></div>
3155
+ </div>
3156
+ <div class="fm-form-options">
3157
+ <fieldset id="type_settings_fieldset" class="adminform">
3158
+ <div class="fm-row fm-form-types">
3159
+ <label style="font-size:18px; width: 170px !important; ">Form Type</label>
3160
+ <label>
3161
+ <input type="radio" name="form_type" value="embedded" onclick="change_form_type('embedded'); change_hide_show('fm-embedded');"
3162
+ <?php echo $row->type == 'embedded' ? 'checked="checked"' : '' ?>>
3163
+ <span class="fm-embedded <?php echo $row->type == 'embedded' ? ' active' : '' ?>"></span>
3164
+ <p>Embedded</p>
3165
+ </label>
3166
+ <label>
3167
+ <input type="radio" name="form_type" value="popover" onclick="change_form_type('popover'); change_hide_show('fm-popover');"
3168
+ <?php echo $row->type == 'popover' ? 'checked="checked"' : '' ?>>
3169
+ <span class="fm-popover <?php echo $row->type == 'popover' ? ' active' : '' ?>"></span>
3170
+ <p>Popup</p>
3171
+ </label>
3172
+ <label>
3173
+ <input type="radio" name="form_type" value="topbar" onclick="change_form_type('topbar'); change_hide_show('fm-topbar');"
3174
+ <?php echo $row->type == 'topbar' ? 'checked="checked"' : '' ?>>
3175
+ <span class="fm-topbar <?php echo $row->type == 'topbar' ? ' active' : '' ?>"></span>
3176
+ <p>Topbar</p>
3177
+ </label>
3178
+ <label>
3179
+ <input type="radio" name="form_type" value="scrollbox" onclick="change_form_type('scrollbox'); change_hide_show('fm-scrollbox');"<?php echo $row->type == 'scrollbox' ? 'checked="checked"' : '' ?>>
3180
+ <span class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? ' active' : '' ?>"></span>
3181
+ <p>Scrollbox</p>
3182
+ </label>
3183
+ </div>
3184
+ <br /><br />
3185
+ <table class="admintable">
3186
+ <tr class="fm-embedded <?php echo $row->type == 'embedded' ? 'fm-show' : 'fm-hide' ?>">
3187
+ <td class="fm_options_label">
3188
+ <label>Form Placement</label>
3189
+ </td>
3190
+ <td class="fm_options_value">
3191
+ Use <input type="text" value='[Form id="<?php echo $row->form_id; ?>"]' onclick="fm_select_value(this)" readonly="readonly" style="width:155px !important;"/> shortcode to display the form.
3192
+ </td>
3193
+ </tr>
3194
+ <tr class="fm-popover <?php echo $row->type == 'popover' ? 'fm-show' : 'fm-hide' ?>">
3195
+ <td class="fm_options_label">
3196
+ <label>Animation Effect</label>
3197
+ </td>
3198
+ <td class="fm_options_value">
3199
+ <select id="popover_animate_effect" name="popover_animate_effect">
3200
+ <?php
3201
+ foreach($animation_effects as $anim_key => $animation_effect){
3202
+ $selected = $row->popover_animate_effect == $anim_key ? 'selected="selected"' : '';
3203
+ echo '<option value="'.$anim_key.'" '.$selected.'>'.$animation_effect.'</option>';
3204
+ }
3205
+ ?>
3206
+ </select>
3207
+ </td>
3208
+ </tr>
3209
+
3210
+ <tr class="fm-popover <?php echo $row->type != 'popover' ? 'fm-hide' : 'fm-show'; ?>">
3211
+ <td class="fm_options_label">
3212
+ <label>Loading Delay</label>
3213
+ </td>
3214
+ <td class="fm_options_value">
3215
+ <input type="number" name="popover_loading_delay" value="<?php echo $row->popover_loading_delay; ?>" /> seconds
3216
+ <div>Define the amount of time before the form popup appears after the page loads. Set 0 for no delay.
3217
+ </div>
3218
+ </td>
3219
+ </tr>
3220
+ <tr class="fm-popover <?php echo $row->type == 'popover' ? 'fm-show' : 'fm-hide' ?>">
3221
+ <td class="fm_options_label">
3222
+ <label>Frequency</label>
3223
+ </td>
3224
+ <td class="fm_options_value">
3225
+ <input type="number" name="popover_frequency" value="<?php echo $row->popover_frequency; ?>" /> days
3226
+ <div>Display the popup to the same visitor (who has closed the popup/submitted the form) after this period. Set the value to 0 to always show.
3227
+ </div>
3228
+ </td>
3229
+ </tr>
3230
+ <tr class="fm-topbar <?php echo $row->type == 'topbar' ? 'fm-show' : 'fm-hide' ?>">
3231
+ <td class="fm_options_label">
3232
+ <label>Position</label>
3233
+ </td>
3234
+ <td class="fm_options_value">
3235
+ <button name="topbar_position" class="fm-checkbox-radio-button <?php echo $row->topbar_position == 1 ? 'fm-text-yes' : 'fm-text-no' ?> medium" onclick="fm_change_radio_checkbox_text(this); fm_show_hide('topbar_remain_top'); return false;" value="<?php echo $row->topbar_position == 1 ? '1' : '0' ?>">
3236
+ <label><?php echo $row->topbar_position == 1 ? 'Top' : 'Bottom' ?></label>
3237
+ <span></span>
3238
+ </button>
3239
+ <input type="hidden" name="topbar_position" value="<?php echo $row->topbar_position; ?>"/>
3240
+ </td>
3241
+ </tr>
3242
+ <tr class="fm-topbar topbar_remain_top <?php echo $row->type != 'topbar' ? 'fm-hide' : ($row->topbar_position == 1 ? 'fm-show' : 'fm-hide') ?>">
3243
+ <td class="fm_options_label">
3244
+ <label>Remain at top when scrolling</label>
3245
+ </td>
3246
+ <td class="fm_options_value">
3247
+ <button class="fm-checkbox-radio-button <?php echo $row->topbar_remain_top == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->topbar_remain_top; ?>">
3248
+ <span></span>
3249
+ </button>
3250
+ <input type="hidden" name="topbar_remain_top" value="<?php echo $row->topbar_remain_top; ?>"/>
3251
+ </td>
3252
+ </tr>
3253
+ <tr class="fm-topbar <?php echo $row->type == 'topbar' ? 'fm-show' : 'fm-hide' ?>">
3254
+ <td class="fm_options_label">
3255
+ <label>Allow Closing the bar</label>
3256
+ </td>
3257
+ <td class="fm_options_value">
3258
+ <button class="fm-checkbox-radio-button <?php echo $row->topbar_closing == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->topbar_closing; ?>">
3259
+ <span></span>
3260
+ </button>
3261
+ <input type="hidden" name="topbar_closing" value="<?php echo $row->topbar_closing; ?>"/>
3262
+ </td>
3263
+ </tr>
3264
+ <tr class="fm-topbar topbar_hide_duration <?php echo $row->type != 'topbar' ? 'fm-hide' : 'fm-show' ?>">
3265
+ <td class="fm_options_label">
3266
+ <label>Frequency</label>
3267
+ </td>
3268
+ <td class="fm_options_value">
3269
+ <input type="number" name="topbar_hide_duration" value="<?php echo $row->topbar_hide_duration; ?>"/>days
3270
+ <div>Display the topbar to the same visitor (who has closed the popup/submitted the form) after this period. Set the value to 0 to always show.
3271
+ </div>
3272
+ </td>
3273
+ </tr>
3274
+
3275
+ <tr class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? 'fm-show' : 'fm-hide' ?>">
3276
+ <td class="fm_options_label">
3277
+ <label>Position</label>
3278
+ </td>
3279
+ <td class="fm_options_value">
3280
+ <button name="scrollbox_position" class="fm-checkbox-radio-button <?php echo $row->scrollbox_position == 1 ? 'fm-text-yes' : 'fm-text-no' ?> medium" onclick="fm_change_radio_checkbox_text(this); return false;" value="<?php echo $row->scrollbox_position == 1 ? '1' : '0' ?>">
3281
+ <label><?php echo $row->scrollbox_position == 1 ? 'Right' : 'Left' ?></label>
3282
+ <span></span>
3283
+ </button>
3284
+ <input type="hidden" name="scrollbox_position" value="<?php echo $row->scrollbox_position; ?>"/>
3285
+ </td>
3286
+ </tr>
3287
+ <tr class="fm-scrollbox <?php echo $row->type != 'scrollbox' ? 'fm-hide' : 'fm-show'; ?>">
3288
+ <td class="fm_options_label">
3289
+ <label>Loading Delay</label>
3290
+ </td>
3291
+ <td class="fm_options_value">
3292
+ <input type="number" name="scrollbox_loading_delay" value="<?php echo $row->scrollbox_loading_delay; ?>" /> seconds
3293
+ <div>Define the amount of time before the form scrollbox appears after the page loads. Set 0 for no delay.
3294
+ </div>
3295
+ </td>
3296
+ </tr>
3297
+ <tr class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? 'fm-show' : 'fm-hide' ?>">
3298
+ <td class="fm_options_label">
3299
+ <label>Frequency</label>
3300
+ </td>
3301
+ <td class="fm_options_value">
3302
+ <input type="number" name="scrollbox_hide_duration" value="<?php echo $row->scrollbox_hide_duration; ?>"/>days
3303
+ <div>Display the scrollbox to the same visitor (who has closed the popup/submitted the form) after this period. Set the value to 0 to always show.
3304
+ </div>
3305
+ </td>
3306
+ </tr>
3307
+
3308
+ <tr class="fm-popover fm-topbar fm-scrollbox <?php echo $row->type != 'embedded' ? 'fm-show' : 'fm-hide' ?>">
3309
+ <td class="fm_options_label">
3310
+ <label>Always show for administrator</label>
3311
+ </td>
3312
+ <td class="fm_options_value">
3313
+ <button class="fm-checkbox-radio-button <?php echo $row->show_for_admin == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->show_for_admin; ?>">
3314
+ <span></span>
3315
+ </button>
3316
+ <input type="hidden" name="show_for_admin" value="<?php echo $row->show_for_admin; ?>"/>
3317
+ <div>If this option is enabled, website admins will always see the form.</div>
3318
+ </td>
3319
+ </tr>
3320
+
3321
+ <tr class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? 'fm-show' : 'fm-hide' ?>">
3322
+ <td class="fm_options_label">
3323
+ <label>Trigger Point</label>
3324
+ </td>
3325
+ <td class="fm_options_value">
3326
+ <input type="number" name="scrollbox_trigger_point" value="<?php echo $row->scrollbox_trigger_point; ?>"/>%
3327
+ <div>Set the percentage of the page height, where the scrollbox form will appear after scrolling down.</div>
3328
+ </td>
3329
+ </tr>
3330
+ <tr class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? 'fm-show' : 'fm-hide' ?>">
3331
+ <td class="fm_options_label">
3332
+ <label>Allow Closing the bar</label>
3333
+ </td>
3334
+ <td class="fm_options_value">
3335
+ <button class="fm-checkbox-radio-button <?php echo $row->scrollbox_closing == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->scrollbox_closing; ?>">
3336
+ <span></span>
3337
+ </button>
3338
+ <input type="hidden" name="scrollbox_closing" value="<?php echo $row->scrollbox_closing; ?>"/>
3339
+ </td>
3340
+ </tr>
3341
+ <tr class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? 'fm-show' : 'fm-hide' ?>">
3342
+ <td class="fm_options_label">
3343
+ <label>Allow Minimize</label>
3344
+ </td>
3345
+ <td class="fm_options_value">
3346
+ <button class="fm-checkbox-radio-button <?php echo $row->scrollbox_minimize == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); fm_show_hide('minimize_text'); return false;" value="<?php echo $row->scrollbox_minimize; ?>">
3347
+ <span></span>
3348
+ </button>
3349
+ <input type="hidden" name="scrollbox_minimize" value="<?php echo $row->scrollbox_minimize; ?>"/>
3350
+ </td>
3351
+ </tr>
3352
+ <tr class="fm-scrollbox minimize_text <?php echo $row->type == 'scrollbox' && $row->scrollbox_minimize == 1 ? 'fm-show' : 'fm-hide' ?>">
3353
+ <td class="fm_options_label">
3354
+ <label>Minimize Text</label>
3355
+ </td>
3356
+ <td class="fm_options_value">
3357
+ <input type="text" name="scrollbox_minimize_text" value="<?php echo $row->scrollbox_minimize_text; ?>"/>
3358
+ </td>
3359
+ </tr>
3360
+
3361
+ <tr class="fm-scrollbox <?php echo $row->type == 'scrollbox' ? 'fm-show' : 'fm-hide' ?>">
3362
+ <td class="fm_options_label">
3363
+ <label>Auto Hide</label>
3364
+ </td>
3365
+ <td class="fm_options_value">
3366
+ <button class="fm-checkbox-radio-button <?php echo $row->scrollbox_auto_hide == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->scrollbox_auto_hide; ?>">
3367
+ <span></span>
3368
+ </button>
3369
+ <input type="hidden" name="scrollbox_auto_hide" value="<?php echo $row->scrollbox_auto_hide; ?>"/>
3370
+ <div>Hide the scrollbox form again when visitor scrolls back up.</div>
3371
+ </td>
3372
+ </tr>
3373
+ <tr class="fm-popover fm-topbar fm-scrollbox <?php echo $row->type != 'embedded' ? 'fm-show' : 'fm-hide' ?>">
3374
+ <td class="fm_options_label">
3375
+ <label>Display on</label>
3376
+ </td>
3377
+ <td class="fm_options_value">
3378
+ <ul class="pp_display pp_display_on"><?php
3379
+ $posts_and_pages = $this->model->fm_posts_query();
3380
+ $stat_types = array('everything' => 'All', 'home' => 'Homepage', 'archive' => 'Archives');
3381
+
3382
+ $def_post_types = array('post' => 'Post', 'page' => 'Page');
3383
+ $custom_post_types = get_post_types( array(
3384
+ 'public' => true,
3385
+ '_builtin' => false,
3386
+ ) );
3387
+
3388
+ $post_types = array_merge($def_post_types, $custom_post_types);
3389
+ $all_types = $stat_types + $post_types;
3390
+ $selected_types = explode(',', $row->display_on);
3391
+ $show_cats = in_array('post', $selected_types);
3392
+ $m = 0;
3393
+ foreach($all_types as $post_key => $post_type){
3394
+ $checked = in_array('everything', $selected_types) || in_array($post_key, $selected_types) ? 'checked="checked"' : '';
3395
+ $postclass = $post_key != 'page' && in_array($post_key, array_keys($def_post_types)) ? 'class="catpost"' : '';
3396
+ echo '<li><input id="pt'.$m.'" type="checkbox" name="display_on[]" value="'.$post_key.'" '.$checked.' '.$postclass.'/><label for="pt'.$m.'">'.$post_type.'</label></li>';
3397
+ $m++;
3398
+ }
3399
+ ?>
3400
+ </ul>
3401
+ </td>
3402
+ </tr>
3403
+ <tr class="fm-popover fm-topbar fm-scrollbox fm-cat-show <?php echo $row->type != 'embedded' && $show_cats ? 'fm-show' : 'fm-hide' ?>">
3404
+ <td class="fm_options_label">
3405
+ <label>Display on these category's posts</label>
3406
+ </td>
3407
+ <td class="fm_options_value">
3408
+ <ul class="pp_display pp_display_on_categories"><?php
3409
+ $categories = $this->model->fm_categories_query();
3410
+ $selected_categories = explode(',', $row->display_on_categories);
3411
+ $current_categories_array = explode(',', $row->current_categories);
3412
+ $m = 0;
3413
+ foreach($categories as $cat_key => $category){
3414
+ $checked = ((!$row->current_categories && !$row->display_on_categories) || in_array($cat_key, $selected_categories) || (in_array('auto_check_new', $selected_categories) && !in_array($cat_key, $current_categories_array))) ? 'checked="checked"' : '';
3415
+
3416
+ echo '<li><input id="cat'.$m.'" type="checkbox" name="display_on_categories[]" value="'.$cat_key.'" '.$checked.'/><label for="cat'.$m.'">'.$category.'</label></li>';
3417
+ $m++;
3418
+ }
3419
+ $auto_check = (!$row->current_categories && !$row->display_on_categories) || in_array('auto_check_new', $selected_categories) ? 'checked="checked"' : '';
3420
+ echo '<li><br/><input id="cat'.$m.'" type="checkbox" name="display_on_categories[]" value="auto_check_new" '.$auto_check.'/><label for="cat'.$m.'">Automatically check new categories</label></li>';
3421
+ $current_categories = !$row->current_categories && !$row->display_on_categories ? implode(',', array_keys($categories)) : $row->current_categories;
3422
+ ?>
3423
+ </ul>
3424
+ <input type="hidden" name="current_categories" value="<?php echo $current_categories; ?>"/>
3425
+ </td>
3426
+ </tr>
3427
+ <tr class="fm-popover fm-topbar fm-scrollbox fm-posts-show <?php echo (in_array('everything', $selected_types) || in_array('post', $selected_types)) && $row->type != 'embedded' ? 'fm-show' : 'fm-hide' ?>">
3428
+ <td class="fm_options_label">
3429
+ <label>Display on these posts</label>
3430
+ </td>
3431
+ <td class="fm_options_value">
3432
+ <div class="fm-mini-heading">Click on input area to view the list of posts. If left empty the form will appear on all posts.</div>
3433
+ <p>Posts defined below will override all settings above.</p>
3434
+ <ul class="fm-pp">
3435
+ <li class="pp_selected"><?php if($row->posts_include){
3436
+ $posts_include = explode(',', $row->posts_include);
3437
+ foreach($posts_include as $post_exclude){
3438
+ if(isset($posts_and_pages[$post_exclude])){
3439
+ $ptitle = $posts_and_pages[$post_exclude]['title'];
3440
+ $ptype = $posts_and_pages[$post_exclude]['post_type'];
3441
+ echo '<span data-post_id="'.$post_exclude.'">['.$ptype.'] - '.$ptitle.'<span class="pp_selected_remove">x</span></span>';
3442
+ }
3443
+ }
3444
+ } ?></li>
3445
+ <li>
3446
+ <input type="text" class="pp_search_posts" value="" data-post_type="only_posts" style="width: 100% !important;" />
3447
+ <input type="hidden" class="pp_exclude" name="posts_include" value="<?php echo $row->posts_include; ?>" />
3448
+ <span class="fm-loading"></span>
3449
+ </li>
3450
+ <li class="pp_live_search fm-hide">
3451
+ <ul class="pp_search_results">
3452
+
3453
+ </ul>
3454
+ </li>
3455
+ </ul>
3456
+ </td>
3457
+ </tr>
3458
+ <tr class="fm-popover fm-topbar fm-scrollbox fm-pages-show <?php echo (in_array('everything', $selected_types) || in_array('page', $selected_types)) && $row->type != 'embedded' ? 'fm-show' : 'fm-hide' ?>">
3459
+ <td class="fm_options_label">
3460
+ <label>Display on these pages</label>
3461
+ </td>
3462
+ <td class="fm_options_value">
3463
+ <div class="fm-mini-heading">Click on input area to view the list of pages. If left empty the form will appear on all pages.</div>
3464
+ <p>Pages defined below will override all settings above.</p>
3465
+ <ul class="fm-pp">
3466
+ <li class="pp_selected"><?php if($row->pages_include){
3467
+ $pages_include = explode(',', $row->pages_include);
3468
+ foreach($pages_include as $page_exclude){
3469
+ if(isset($posts_and_pages[$page_exclude])){
3470
+ $ptitle = $posts_and_pages[$page_exclude]['title'];
3471
+ $ptype = $posts_and_pages[$page_exclude]['post_type'];
3472
+ echo '<span data-post_id="'.$page_exclude.'">['.$ptype.'] - '.$ptitle.'<span class="pp_selected_remove">x</span></span>';
3473
+ }
3474
+ }
3475
+ } ?></li>
3476
+ <li>
3477
+ <input type="text" class="pp_search_posts" value="" data-post_type="only_pages" style="width: 100% !important;" />
3478
+ <input type="hidden" class="pp_exclude" name="pages_include" value="<?php echo $row->pages_include; ?>" />
3479
+ <span class="fm-loading"></span>
3480
+ </li>
3481
+ <li class="pp_live_search fm-hide">
3482
+ <ul class="pp_search_results">
3483
+ </ul>
3484
+ </li>
3485
+ </ul>
3486
+ </td>
3487
+ </tr>
3488
+ <tr class="fm-popover fm-topbar fm-scrollbox <?php echo $row->type != 'embedded' ? 'fm-show' : 'fm-hide' ?>">
3489
+ <td class="fm_options_label">
3490
+ <label>Hide on Mobile</label>
3491
+ </td>
3492
+ <td class="fm_options_value">
3493
+ <button class="fm-checkbox-radio-button <?php echo $row->hide_mobile == 1 ? 'fm-yes' : 'fm-no' ?>" onclick="fm_change_radio(this); return false;" value="<?php echo $row->hide_mobile; ?>">
3494
+ <span></span>
3495
+ </button>
3496
+ <input type="hidden" name="hide_mobile" value="<?php echo $row->hide_mobile; ?>"/>
3497
+ </td>
3498
+ </tr>
3499
+
3500
+ </table>
3501
+ </fieldset>
3502
+ </div>
3503
+ </form>
3504
+ <?php
3505
+ }
3506
+
3507
+ }
 
css/jquery-ui-1.12.1.css ADDED
@@ -0,0 +1,1311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.12.1 - 2016-09-14
2
+ * http://jqueryui.com
3
+ * Includes: core.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, dialog.css, draggable.css, resizable.css, progressbar.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
4
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Arial%2CHelvetica%2Csans-serif&fsDefault=1em&fwDefault=normal&cornerRadius=3px&bgColorHeader=e9e9e9&bgTextureHeader=flat&borderColorHeader=dddddd&fcHeader=333333&iconColorHeader=444444&bgColorContent=ffffff&bgTextureContent=flat&borderColorContent=dddddd&fcContent=333333&iconColorContent=444444&bgColorDefault=f6f6f6&bgTextureDefault=flat&borderColorDefault=c5c5c5&fcDefault=454545&iconColorDefault=777777&bgColorHover=ededed&bgTextureHover=flat&borderColorHover=cccccc&fcHover=2b2b2b&iconColorHover=555555&bgColorActive=007fff&bgTextureActive=flat&borderColorActive=003eff&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=fffa90&bgTextureHighlight=flat&borderColorHighlight=dad55e&fcHighlight=777620&iconColorHighlight=777620&bgColorError=fddfdf&bgTextureError=flat&borderColorError=f1a899&fcError=5f3f3f&iconColorError=cc0000&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=666666&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=5px&offsetTopShadow=0px&offsetLeftShadow=0px&cornerRadiusShadow=8px
5
+ * Copyright jQuery Foundation and other contributors; Licensed MIT */
6
+
7
+ /* Layout helpers
8
+ ----------------------------------*/
9
+ .ui-helper-hidden {
10
+ display: none;
11
+ }
12
+ .ui-helper-hidden-accessible {
13
+ border: 0;
14
+ clip: rect(0 0 0 0);
15
+ height: 1px;
16
+ margin: -1px;
17
+ overflow: hidden;
18
+ padding: 0;
19
+ position: absolute;
20
+ width: 1px;
21
+ }
22
+ .ui-helper-reset {
23
+ margin: 0;
24
+ padding: 0;
25
+ border: 0;
26
+ outline: 0;
27
+ line-height: 1.3;
28
+ text-decoration: none;
29
+ font-size: 100%;
30
+ list-style: none;
31
+ }
32
+ .ui-helper-clearfix:before,
33
+ .ui-helper-clearfix:after {
34
+ content: "";
35
+ display: table;
36
+ border-collapse: collapse;
37
+ }
38
+ .ui-helper-clearfix:after {
39
+ clear: both;
40
+ }
41
+ .ui-helper-zfix {
42
+ width: 100%;
43
+ height: 100%;
44
+ top: 0;
45
+ left: 0;
46
+ position: absolute;
47
+ opacity: 0;
48
+ filter:Alpha(Opacity=0); /* support: IE8 */
49
+ }
50
+
51
+ .ui-front {
52
+ z-index: 100;
53
+ }
54
+
55
+
56
+ /* Interaction Cues
57
+ ----------------------------------*/
58
+ .ui-state-disabled {
59
+ cursor: default !important;
60
+ pointer-events: none;
61
+ }
62
+
63
+
64
+ /* Icons
65
+ ----------------------------------*/
66
+ .ui-icon {
67
+ display: inline-block;
68
+ vertical-align: middle;
69
+ margin-top: -.25em;
70
+ position: relative;
71
+ text-indent: -99999px;
72
+ overflow: hidden;
73
+ background-repeat: no-repeat;
74
+ }
75
+
76
+ .ui-widget-icon-block {
77
+ left: 50%;
78
+ margin-left: -8px;
79
+ display: block;
80
+ }
81
+
82
+ /* Misc visuals
83
+ ----------------------------------*/
84
+
85
+ /* Overlays */
86
+ .ui-widget-overlay {
87
+ position: fixed;
88
+ top: 0;
89
+ left: 0;
90
+ width: 100%;
91
+ height: 100%;
92
+ }
93
+ .ui-accordion .ui-accordion-header {
94
+ display: block;
95
+ cursor: pointer;
96
+ position: relative;
97
+ margin: 2px 0 0 0;
98
+ padding: .5em .5em .5em .7em;
99
+ font-size: 100%;
100
+ }
101
+ .ui-accordion .ui-accordion-content {
102
+ padding: 1em 2.2em;
103
+ border-top: 0;
104
+ overflow: auto;
105
+ }
106
+ .ui-autocomplete {
107
+ position: absolute;
108
+ top: 0;
109
+ left: 0;
110
+ cursor: default;
111
+ }
112
+ .ui-menu {
113
+ list-style: none;
114
+ padding: 0;
115
+ margin: 0;
116
+ display: block;
117
+ outline: 0;
118
+ }
119
+ .ui-menu .ui-menu {
120
+ position: absolute;
121
+ }
122
+ .ui-menu .ui-menu-item {
123
+ margin: 0;
124
+ cursor: pointer;
125
+ /* support: IE10, see #8844 */
126
+ list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");
127
+ }
128
+ .ui-menu .ui-menu-item-wrapper {
129
+ position: relative;
130
+ padding: 3px 1em 3px .4em;
131
+ }
132
+ .ui-menu .ui-menu-divider {
133
+ margin: 5px 0;
134
+ height: 0;
135
+ font-size: 0;
136
+ line-height: 0;
137
+ border-width: 1px 0 0 0;
138
+ }
139
+ .ui-menu .ui-state-focus,
140
+ .ui-menu .ui-state-active {
141
+ margin: -1px;
142
+ }
143
+
144
+ /* icon support */
145
+ .ui-menu-icons {
146
+ position: relative;
147
+ }
148
+ .ui-menu-icons .ui-menu-item-wrapper {
149
+ padding-left: 2em;
150
+ }
151
+
152
+ /* left-aligned */
153
+ .ui-menu .ui-icon {
154
+ position: absolute;
155
+ top: 0;
156
+ bottom: 0;
157
+ left: .2em;
158
+ margin: auto 0;
159
+ }
160
+
161
+ /* right-aligned */
162
+ .ui-menu .ui-menu-icon {
163
+ left: auto;
164
+ right: 0;
165
+ }
166
+ .ui-button {
167
+ padding: .4em 1em;
168
+ display: inline-block;
169
+ position: relative;
170
+ line-height: normal;
171
+ margin-right: .1em;
172
+ cursor: pointer;
173
+ vertical-align: middle;
174
+ text-align: center;
175
+ -webkit-user-select: none;
176
+ -moz-user-select: none;
177
+ -ms-user-select: none;
178
+ user-select: none;
179
+
180
+ /* Support: IE <= 11 */
181
+ overflow: visible;
182
+ }
183
+
184
+ .ui-button,
185
+ .ui-button:link,
186
+ .ui-button:visited,
187
+ .ui-button:hover,
188
+ .ui-button:active {
189
+ text-decoration: none;
190
+ }
191
+
192
+ /* to make room for the icon, a width needs to be set here */
193
+ .ui-button-icon-only {
194
+ width: 2em;
195
+ box-sizing: border-box;
196
+ text-indent: -9999px;
197
+ white-space: nowrap;
198
+ }
199
+
200
+ /* no icon support for input elements */
201
+ input.ui-button.ui-button-icon-only {
202
+ text-indent: 0;
203
+ }
204
+
205
+ /* button icon element(s) */
206
+ .ui-button-icon-only .ui-icon {
207
+ position: absolute;
208
+ top: 50%;
209
+ left: 50%;
210
+ margin-top: -8px;
211
+ margin-left: -8px;
212
+ }
213
+
214
+ .ui-button.ui-icon-notext .ui-icon {
215
+ padding: 0;
216
+ width: 2.1em;
217
+ height: 2.1em;
218
+ text-indent: -9999px;
219
+ white-space: nowrap;
220
+
221
+ }
222
+
223
+ input.ui-button.ui-icon-notext .ui-icon {
224
+ width: auto;
225
+ height: auto;
226
+ text-indent: 0;
227
+ white-space: normal;
228
+ padding: .4em 1em;
229
+ }
230
+
231
+ /* workarounds */
232
+ /* Support: Firefox 5 - 40 */
233
+ input.ui-button::-moz-focus-inner,
234
+ button.ui-button::-moz-focus-inner {
235
+ border: 0;
236
+ padding: 0;
237
+ }
238
+ .ui-controlgroup {
239
+ vertical-align: middle;
240
+ display: inline-block;
241
+ }
242
+ .ui-controlgroup > .ui-controlgroup-item {
243
+ float: left;
244
+ margin-left: 0;
245
+ margin-right: 0;
246
+ }
247
+ .ui-controlgroup > .ui-controlgroup-item:focus,
248
+ .ui-controlgroup > .ui-controlgroup-item.ui-visual-focus {
249
+ z-index: 9999;
250
+ }
251
+ .ui-controlgroup-vertical > .ui-controlgroup-item {
252
+ display: block;
253
+ float: none;
254
+ width: 100%;
255
+ margin-top: 0;
256
+ margin-bottom: 0;
257
+ text-align: left;
258
+ }
259
+ .ui-controlgroup-vertical .ui-controlgroup-item {
260
+ box-sizing: border-box;
261
+ }
262
+ .ui-controlgroup .ui-controlgroup-label {
263
+ padding: .4em 1em;
264
+ }
265
+ .ui-controlgroup .ui-controlgroup-label span {
266
+ font-size: 80%;
267
+ }
268
+ .ui-controlgroup-horizontal .ui-controlgroup-label + .ui-controlgroup-item {
269
+ border-left: none;
270
+ }
271
+ .ui-controlgroup-vertical .ui-controlgroup-label + .ui-controlgroup-item {
272
+ border-top: none;
273
+ }
274
+ .ui-controlgroup-horizontal .ui-controlgroup-label.ui-widget-content {
275
+ border-right: none;
276
+ }
277
+ .ui-controlgroup-vertical .ui-controlgroup-label.ui-widget-content {
278
+ border-bottom: none;
279
+ }
280
+
281
+ /* Spinner specific style fixes */
282
+ .ui-controlgroup-vertical .ui-spinner-input {
283
+
284
+ /* Support: IE8 only, Android < 4.4 only */
285
+ width: 75%;
286
+ width: calc( 100% - 2.4em );
287
+ }
288
+ .ui-controlgroup-vertical .ui-spinner .ui-spinner-up {
289
+ border-top-style: solid;
290
+ }
291
+
292
+ .ui-checkboxradio-label .ui-icon-background {
293
+ box-shadow: inset 1px 1px 1px #ccc;
294
+ border-radius: .12em;
295
+ border: none;
296
+ }
297
+ .ui-checkboxradio-radio-label .ui-icon-background {
298
+ width: 16px;
299
+ height: 16px;
300
+ border-radius: 1em;
301
+ overflow: visible;
302
+ border: none;
303
+ }
304
+ .ui-checkboxradio-radio-label.ui-checkboxradio-checked .ui-icon,
305
+ .ui-checkboxradio-radio-label.ui-checkboxradio-checked:hover .ui-icon {
306
+ background-image: none;
307
+ width: 8px;
308
+ height: 8px;
309
+ border-width: 4px;
310
+ border-style: solid;
311
+ }
312
+ .ui-checkboxradio-disabled {
313
+ pointer-events: none;
314
+ }
315
+ .ui-datepicker {
316
+ width: 17em;
317
+ padding: .2em .2em 0;
318
+ display: none;
319
+ }
320
+ .ui-datepicker .ui-datepicker-header {
321
+ position: relative;
322
+ padding: .2em 0;
323
+ }
324
+ .ui-datepicker .ui-datepicker-prev,
325
+ .ui-datepicker .ui-datepicker-next {
326
+ position: absolute;
327
+ top: 2px;
328
+ width: 1.8em;
329
+ height: 1.8em;
330
+ }
331
+ .ui-datepicker .ui-datepicker-prev-hover,
332
+ .ui-datepicker .ui-datepicker-next-hover {
333
+ top: 1px;
334
+ }
335
+ .ui-datepicker .ui-datepicker-prev {
336
+ left: 2px;
337
+ }
338
+ .ui-datepicker .ui-datepicker-next {
339
+ right: 2px;
340
+ }
341
+ .ui-datepicker .ui-datepicker-prev-hover {
342
+ left: 1px;
343
+ }
344
+ .ui-datepicker .ui-datepicker-next-hover {
345
+ right: 1px;
346
+ }
347
+ .ui-datepicker .ui-datepicker-prev span,
348
+ .ui-datepicker .ui-datepicker-next span {
349
+ display: block;
350
+ position: absolute;
351
+ left: 50%;
352
+ margin-left: -8px;
353
+ top: 50%;
354
+ margin-top: -8px;
355
+ }
356
+ .ui-datepicker .ui-datepicker-title {
357
+ margin: 0 2.3em;
358
+ line-height: 1.8em;
359
+ text-align: center;
360
+ }
361
+ .ui-datepicker .ui-datepicker-title select {
362
+ font-size: 1em;
363
+ margin: 1px 0;
364
+ }
365
+ .ui-datepicker select.ui-datepicker-month,
366
+ .ui-datepicker select.ui-datepicker-year {
367
+ width: 45%;
368
+ }
369
+ .ui-datepicker table {
370
+ width: 100%;
371
+ font-size: .9em;
372
+ border-collapse: collapse;
373
+ margin: 0 0 .4em;
374
+ }
375
+ .ui-datepicker th {
376
+ padding: .7em .3em;
377
+ text-align: center;
378
+ font-weight: bold;
379
+ border: 0;
380
+ }
381
+ .ui-datepicker td {
382
+ border: 0;
383
+ padding: 1px;
384
+ }
385
+ .ui-datepicker td span,
386
+ .ui-datepicker td a {
387
+ display: block;
388
+ padding: .2em;
389
+ text-align: right;
390
+ text-decoration: none;
391
+ }
392
+ .ui-datepicker .ui-datepicker-buttonpane {
393
+ background-image: none;
394
+ margin: .7em 0 0 0;
395
+ padding: 0 .2em;
396
+ border-left: 0;
397
+ border-right: 0;
398
+ border-bottom: 0;
399
+ }
400
+ .ui-datepicker .ui-datepicker-buttonpane button {
401
+ float: right;
402
+ margin: .5em .2em .4em;
403
+ cursor: pointer;
404
+ padding: .2em .6em .3em .6em;
405
+ width: auto;
406
+ overflow: visible;
407
+ }
408
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
409
+ float: left;
410
+ }
411
+
412
+ /* with multiple calendars */
413
+ .ui-datepicker.ui-datepicker-multi {
414
+ width: auto;
415
+ }
416
+ .ui-datepicker-multi .ui-datepicker-group {
417
+ float: left;
418
+ }
419
+ .ui-datepicker-multi .ui-datepicker-group table {
420
+ width: 95%;
421
+ margin: 0 auto .4em;
422
+ }
423
+ .ui-datepicker-multi-2 .ui-datepicker-group {
424
+ width: 50%;
425
+ }
426
+ .ui-datepicker-multi-3 .ui-datepicker-group {
427
+ width: 33.3%;
428
+ }
429
+ .ui-datepicker-multi-4 .ui-datepicker-group {
430
+ width: 25%;
431
+ }
432
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
433
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
434
+ border-left-width: 0;
435
+ }
436
+ .ui-datepicker-multi .ui-datepicker-buttonpane {
437
+ clear: left;
438
+ }
439
+ .ui-datepicker-row-break {
440
+ clear: both;
441
+ width: 100%;
442
+ font-size: 0;
443
+ }
444
+
445
+ /* RTL support */
446
+ .ui-datepicker-rtl {
447
+ direction: rtl;
448
+ }
449
+ .ui-datepicker-rtl .ui-datepicker-prev {
450
+ right: 2px;
451
+ left: auto;
452
+ }
453
+ .ui-datepicker-rtl .ui-datepicker-next {
454
+ left: 2px;
455
+ right: auto;
456
+ }
457
+ .ui-datepicker-rtl .ui-datepicker-prev:hover {
458
+ right: 1px;
459
+ left: auto;
460
+ }
461
+ .ui-datepicker-rtl .ui-datepicker-next:hover {
462
+ left: 1px;
463
+ right: auto;
464
+ }
465
+ .ui-datepicker-rtl .ui-datepicker-buttonpane {
466
+ clear: right;
467
+ }
468
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button {
469
+ float: left;
470
+ }
471
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
472
+ .ui-datepicker-rtl .ui-datepicker-group {
473
+ float: right;
474
+ }
475
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
476
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
477
+ border-right-width: 0;
478
+ border-left-width: 1px;
479
+ }
480
+
481
+ /* Icons */
482
+ .ui-datepicker .ui-icon {
483
+ display: block;
484
+ text-indent: -99999px;
485
+ overflow: hidden;
486
+ background-repeat: no-repeat;
487
+ left: .5em;
488
+ top: .3em;
489
+ }
490
+ .ui-dialog {
491
+ position: absolute;
492
+ top: 0;
493
+ left: 0;
494
+ padding: .2em;
495
+ outline: 0;
496
+ }
497
+ .ui-dialog .ui-dialog-titlebar {
498
+ padding: .4em 1em;
499
+ position: relative;
500
+ }
501
+ .ui-dialog .ui-dialog-title {
502
+ float: left;
503
+ margin: .1em 0;
504
+ white-space: nowrap;
505
+ width: 90%;
506
+ overflow: hidden;
507
+ text-overflow: ellipsis;
508
+ }
509
+ .ui-dialog .ui-dialog-titlebar-close {
510
+ position: absolute;
511
+ right: .3em;
512
+ top: 50%;
513
+ width: 20px;
514
+ margin: -10px 0 0 0;
515
+ padding: 1px;
516
+ height: 20px;
517
+ }
518
+ .ui-dialog .ui-dialog-content {
519
+ position: relative;
520
+ border: 0;
521
+ padding: .5em 1em;
522
+ background: none;
523
+ overflow: auto;
524
+ }
525
+ .ui-dialog .ui-dialog-buttonpane {
526
+ text-align: left;
527
+ border-width: 1px 0 0 0;
528
+ background-image: none;
529
+ margin-top: .5em;
530
+ padding: .3em 1em .5em .4em;
531
+ }
532
+ .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
533
+ float: right;
534
+ }
535
+ .ui-dialog .ui-dialog-buttonpane button {
536
+ margin: .5em .4em .5em 0;
537
+ cursor: pointer;
538
+ }
539
+ .ui-dialog .ui-resizable-n {
540
+ height: 2px;
541
+ top: 0;
542
+ }
543
+ .ui-dialog .ui-resizable-e {
544
+ width: 2px;
545
+ right: 0;
546
+ }
547
+ .ui-dialog .ui-resizable-s {
548
+ height: 2px;
549
+ bottom: 0;
550
+ }
551
+ .ui-dialog .ui-resizable-w {
552
+ width: 2px;
553
+ left: 0;
554
+ }
555
+ .ui-dialog .ui-resizable-se,
556
+ .ui-dialog .ui-resizable-sw,
557
+ .ui-dialog .ui-resizable-ne,
558
+ .ui-dialog .ui-resizable-nw {
559
+ width: 7px;
560
+ height: 7px;
561
+ }
562
+ .ui-dialog .ui-resizable-se {
563
+ right: 0;
564
+ bottom: 0;
565
+ }
566
+ .ui-dialog .ui-resizable-sw {
567
+ left: 0;
568
+ bottom: 0;
569
+ }
570
+ .ui-dialog .ui-resizable-ne {
571
+ right: 0;
572
+ top: 0;
573
+ }
574
+ .ui-dialog .ui-resizable-nw {
575
+ left: 0;
576
+ top: 0;
577
+ }
578
+ .ui-draggable .ui-dialog-titlebar {
579
+ cursor: move;
580
+ }
581
+ .ui-draggable-handle {
582
+ -ms-touch-action: none;
583
+ touch-action: none;
584
+ }
585
+ .ui-resizable {
586
+ position: relative;
587
+ }
588
+ .ui-resizable-handle {
589
+ position: absolute;
590
+ font-size: 0.1px;
591
+ display: block;
592
+ -ms-touch-action: none;
593
+ touch-action: none;
594
+ }
595
+ .ui-resizable-disabled .ui-resizable-handle,
596
+ .ui-resizable-autohide .ui-resizable-handle {
597
+ display: none;
598
+ }
599
+ .ui-resizable-n {
600
+ cursor: n-resize;
601
+ height: 7px;
602
+ width: 100%;
603
+ top: -5px;
604
+ left: 0;
605
+ }
606
+ .ui-resizable-s {
607
+ cursor: s-resize;
608
+ height: 7px;
609
+ width: 100%;
610
+ bottom: -5px;
611
+ left: 0;
612
+ }
613
+ .ui-resizable-e {
614
+ cursor: e-resize;
615
+ width: 7px;
616
+ right: -5px;
617
+ top: 0;
618
+ height: 100%;
619
+ }
620
+ .ui-resizable-w {
621
+ cursor: w-resize;
622
+ width: 7px;
623
+ left: -5px;
624
+ top: 0;
625
+ height: 100%;
626
+ }
627
+ .ui-resizable-se {
628
+ cursor: se-resize;
629
+ width: 12px;
630
+ height: 12px;
631
+ right: 1px;
632
+ bottom: 1px;
633
+ }
634
+ .ui-resizable-sw {
635
+ cursor: sw-resize;
636
+ width: 9px;
637
+ height: 9px;
638
+ left: -5px;
639
+ bottom: -5px;
640
+ }
641
+ .ui-resizable-nw {
642
+ cursor: nw-resize;
643
+ width: 9px;
644
+ height: 9px;
645
+ left: -5px;
646
+ top: -5px;
647
+ }
648
+ .ui-resizable-ne {
649
+ cursor: ne-resize;
650
+ width: 9px;
651
+ height: 9px;
652
+ right: -5px;
653
+ top: -5px;
654
+ }
655
+ .ui-progressbar {
656
+ height: 2em;
657
+ text-align: left;
658
+ overflow: hidden;
659
+ }
660
+ .ui-progressbar .ui-progressbar-value {
661
+ margin: -1px;
662
+ height: 100%;
663
+ }
664
+ .ui-progressbar .ui-progressbar-overlay {
665
+ background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");
666
+ height: 100%;
667
+ filter: alpha(opacity=25); /* support: IE8 */
668
+ opacity: 0.25;
669
+ }
670
+ .ui-progressbar-indeterminate .ui-progressbar-value {
671
+ background-image: none;
672
+ }
673
+ .ui-selectable {
674
+ -ms-touch-action: none;
675
+ touch-action: none;
676
+ }
677
+ .ui-selectable-helper {
678
+ position: absolute;
679
+ z-index: 100;
680
+ border: 1px dotted black;
681
+ }
682
+ .ui-selectmenu-menu {
683
+ padding: 0;
684
+ margin: 0;
685
+ position: absolute;
686
+ top: 0;
687
+ left: 0;
688
+ display: none;
689
+ }
690
+ .ui-selectmenu-menu .ui-menu {
691
+ overflow: auto;
692
+ overflow-x: hidden;
693
+ padding-bottom: 1px;
694
+ }
695
+ .ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup {
696
+ font-size: 1em;
697
+ font-weight: bold;
698
+ line-height: 1.5;
699
+ padding: 2px 0.4em;
700
+ margin: 0.5em 0 0 0;
701
+ height: auto;
702
+ border: 0;
703
+ }
704
+ .ui-selectmenu-open {
705
+ display: block;
706
+ }
707
+ .ui-selectmenu-text {
708
+ display: block;
709
+ margin-right: 20px;
710
+ overflow: hidden;
711
+ text-overflow: ellipsis;
712
+ }
713
+ .ui-selectmenu-button.ui-button {
714
+ text-align: left;
715
+ white-space: nowrap;
716
+ width: 14em;
717
+ }
718
+ .ui-selectmenu-icon.ui-icon {
719
+ float: right;
720
+ margin-top: 0;
721
+ }
722
+ .ui-slider {
723
+ position: relative;
724
+ text-align: left;
725
+ }
726
+ .ui-slider .ui-slider-handle {
727
+ position: absolute;
728
+ z-index: 2;
729
+ width: 1.2em;
730
+ height: 1.2em;
731
+ cursor: default;
732
+ -ms-touch-action: none;
733
+ touch-action: none;
734
+ }
735
+ .ui-slider .ui-slider-range {
736
+ position: absolute;
737
+ z-index: 1;
738
+ font-size: .7em;
739
+ display: block;
740
+ border: 0;
741
+ background-position: 0 0;
742
+ }
743
+
744
+ /* support: IE8 - See #6727 */
745
+ .ui-slider.ui-state-disabled .ui-slider-handle,
746
+ .ui-slider.ui-state-disabled .ui-slider-range {
747
+ filter: inherit;
748
+ }
749
+
750
+ .ui-slider-horizontal {
751
+ height: .8em;
752
+ }
753
+ .ui-slider-horizontal .ui-slider-handle {
754
+ top: -.3em;
755
+ margin-left: -.6em;
756
+ }
757
+ .ui-slider-horizontal .ui-slider-range {
758
+ top: 0;
759
+ height: 100%;
760
+ }
761
+ .ui-slider-horizontal .ui-slider-range-min {
762
+ left: 0;
763
+ }
764
+ .ui-slider-horizontal .ui-slider-range-max {
765
+ right: 0;
766
+ }
767
+
768
+ .ui-slider-vertical {
769
+ width: .8em;
770
+ height: 100px;
771
+ }
772
+ .ui-slider-vertical .ui-slider-handle {
773
+ left: -.3em;
774
+ margin-left: 0;
775
+ margin-bottom: -.6em;
776
+ }
777
+ .ui-slider-vertical .ui-slider-range {
778
+ left: 0;
779
+ width: 100%;
780
+ }
781
+ .ui-slider-vertical .ui-slider-range-min {
782
+ bottom: 0;
783
+ }
784
+ .ui-slider-vertical .ui-slider-range-max {
785
+ top: 0;
786
+ }
787
+ .ui-sortable-handle {
788
+ -ms-touch-action: none;
789
+ touch-action: none;
790
+ }
791
+ .ui-spinner {
792
+ position: relative;
793
+ display: inline-block;
794
+ overflow: hidden;
795
+ padding: 0;
796
+ vertical-align: middle;
797
+ }
798
+ .ui-spinner-input {
799
+ border: none;
800
+ background: none;
801
+ color: inherit;
802
+ padding: .222em 0;
803
+ margin: .2em 0;
804
+ vertical-align: middle;
805
+ margin-left: .4em;
806
+ margin-right: 2em;
807
+ }
808
+ .ui-spinner-button {
809
+ width: 1.6em;
810
+ height: 50%;
811
+ font-size: .5em;
812
+ padding: 0;
813
+ margin: 0;
814
+ text-align: center;
815
+ position: absolute;
816
+ cursor: default;
817
+ display: block;
818
+ overflow: hidden;
819
+ right: 0;
820
+ }
821
+ /* more specificity required here to override default borders */
822
+ .ui-spinner a.ui-spinner-button {
823
+ border-top-style: none;
824
+ border-bottom-style: none;
825
+ border-right-style: none;
826
+ }
827
+ .ui-spinner-up {
828
+ top: 0;
829
+ }
830
+ .ui-spinner-down {
831
+ bottom: 0;
832
+ }
833
+ .ui-tabs {
834
+ position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
835
+ padding: .2em;
836
+ }
837
+ .ui-tabs .ui-tabs-nav {
838
+ margin: 0;
839
+ padding: .2em .2em 0;
840
+ }
841
+ .ui-tabs .ui-tabs-nav li {
842
+ list-style: none;
843
+ float: left;
844
+ position: relative;
845
+ top: 0;
846
+ margin: 1px .2em 0 0;
847
+ border-bottom-width: 0;
848
+ padding: 0;
849
+ white-space: nowrap;
850
+ }
851
+ .ui-tabs .ui-tabs-nav .ui-tabs-anchor {
852
+ float: left;
853
+ padding: .5em 1em;
854
+ text-decoration: none;
855
+ }
856
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active {
857
+ margin-bottom: -1px;
858
+ padding-bottom: 1px;
859
+ }
860
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,
861
+ .ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,
862
+ .ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor {
863
+ cursor: text;
864
+ }
865
+ .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor {
866
+ cursor: pointer;
867
+ }
868
+ .ui-tabs .ui-tabs-panel {
869
+ display: block;
870
+ border-width: 0;
871
+ padding: 1em 1.4em;
872
+ background: none;
873
+ }
874
+ .ui-tooltip {
875
+ padding: 8px;
876
+ position: absolute;
877
+ z-index: 9999;
878
+ max-width: 300px;
879
+ }
880
+ body .ui-tooltip {
881
+ border-width: 2px;
882
+ }
883
+ /* Component containers
884
+ ----------------------------------*/
885
+ .ui-widget {
886
+ font-family: Arial,Helvetica,sans-serif;
887
+ font-size: 1em;
888
+ }
889
+ .ui-widget .ui-widget {
890
+ font-size: 1em;
891
+ }
892
+ .ui-widget input,
893
+ .ui-widget select,
894
+ .ui-widget textarea,
895
+ .ui-widget button {
896
+ font-family: Arial,Helvetica,sans-serif;
897
+ font-size: 1em;
898
+ }
899
+ .ui-widget.ui-widget-content {
900
+ border: 1px solid #c5c5c5;
901
+ }
902
+ .ui-widget-content {
903
+ border: 1px solid #dddddd;
904
+ background: #ffffff;
905
+ color: #333333;
906
+ }
907
+ .ui-widget-content a {
908
+ color: #333333;
909
+ }
910
+ .ui-widget-header {
911
+ border: 1px solid #dddddd;
912
+ background: #e9e9e9;
913
+ color: #333333;
914
+ font-weight: bold;
915
+ }
916
+ .ui-widget-header a {
917
+ color: #333333;
918
+ }
919
+
920
+ /* Interaction states
921
+ ----------------------------------*/
922
+ .ui-state-default,
923
+ .ui-widget-content .ui-state-default,
924
+ .ui-widget-header .ui-state-default,
925
+ .ui-button,
926
+
927
+ /* We use html here because we need a greater specificity to make sure disabled
928
+ works properly when clicked or hovered */
929
+ html .ui-button.ui-state-disabled:hover,
930
+ html .ui-button.ui-state-disabled:active {
931
+ border: 1px solid #c5c5c5;
932
+ background: #f6f6f6;
933
+ font-weight: normal;
934
+ color: #454545;
935
+ }
936
+ .ui-state-default a,
937
+ .ui-state-default a:link,
938
+ .ui-state-default a:visited,
939
+ a.ui-button,
940
+ a:link.ui-button,
941
+ a:visited.ui-button,
942
+ .ui-button {
943
+ color: #454545;
944
+ text-decoration: none;
945
+ }
946
+ .ui-state-hover,
947
+ .ui-widget-content .ui-state-hover,
948
+ .ui-widget-header .ui-state-hover,
949
+ .ui-state-focus,
950
+ .ui-widget-content .ui-state-focus,
951
+ .ui-widget-header .ui-state-focus,
952
+ .ui-button:hover,
953
+ .ui-button:focus {
954
+ border: 1px solid #cccccc;
955
+ background: #ededed;
956
+ font-weight: normal;
957
+ color: #2b2b2b;
958
+ }
959
+ .ui-state-hover a,
960
+ .ui-state-hover a:hover,
961
+ .ui-state-hover a:link,
962
+ .ui-state-hover a:visited,
963
+ .ui-state-focus a,
964
+ .ui-state-focus a:hover,
965
+ .ui-state-focus a:link,
966
+ .ui-state-focus a:visited,
967
+ a.ui-button:hover,
968
+ a.ui-button:focus {
969
+ color: #2b2b2b;
970
+ text-decoration: none;
971
+ }
972
+
973
+ .ui-visual-focus {
974
+ box-shadow: 0 0 3px 1px rgb(94, 158, 214);
975
+ }
976
+ .ui-state-active,
977
+ .ui-widget-content .ui-state-active,
978
+ .ui-widget-header .ui-state-active,
979
+ a.ui-button:active,
980
+ .ui-button:active,
981
+ .ui-button.ui-state-active:hover {
982
+ border: 1px solid #003eff;
983
+ background: #007fff;
984
+ font-weight: normal;
985
+ color: #ffffff;
986
+ }
987
+ .ui-icon-background,
988
+ .ui-state-active .ui-icon-background {
989
+ border: #003eff;
990
+ background-color: #ffffff;
991
+ }
992
+ .ui-state-active a,
993
+ .ui-state-active a:link,
994
+ .ui-state-active a:visited {
995
+ color: #ffffff;
996
+ text-decoration: none;
997
+ }
998
+
999
+ /* Interaction Cues
1000
+ ----------------------------------*/
1001
+ .ui-state-highlight,
1002
+ .ui-widget-content .ui-state-highlight,
1003
+ .ui-widget-header .ui-state-highlight {
1004
+ border: 1px solid #dad55e;
1005
+ background: #fffa90;
1006
+ color: #777620;
1007
+ }
1008
+ .ui-state-checked {
1009
+ border: 1px solid #dad55e;
1010
+ background: #fffa90;
1011
+ }
1012
+ .ui-state-highlight a,
1013
+ .ui-widget-content .ui-state-highlight a,
1014
+ .ui-widget-header .ui-state-highlight a {
1015
+ color: #777620;
1016
+ }
1017
+ .ui-state-error,
1018
+ .ui-widget-content .ui-state-error,
1019
+ .ui-widget-header .ui-state-error {
1020
+ border: 1px solid #f1a899;
1021
+ background: #fddfdf;
1022
+ color: #5f3f3f;
1023
+ }
1024
+ .ui-state-error a,
1025
+ .ui-widget-content .ui-state-error a,
1026
+ .ui-widget-header .ui-state-error a {
1027
+ color: #5f3f3f;
1028
+ }
1029
+ .ui-state-error-text,
1030
+ .ui-widget-content .ui-state-error-text,
1031
+ .ui-widget-header .ui-state-error-text {
1032
+ color: #5f3f3f;
1033
+ }
1034
+ .ui-priority-primary,
1035
+ .ui-widget-content .ui-priority-primary,
1036
+ .ui-widget-header .ui-priority-primary {
1037
+ font-weight: bold;
1038
+ }
1039
+ .ui-priority-secondary,
1040
+ .ui-widget-content .ui-priority-secondary,
1041
+ .ui-widget-header .ui-priority-secondary {
1042
+ opacity: .7;
1043
+ filter:Alpha(Opacity=70); /* support: IE8 */
1044
+ font-weight: normal;
1045
+ }
1046
+ .ui-state-disabled,
1047
+ .ui-widget-content .ui-state-disabled,
1048
+ .ui-widget-header .ui-state-disabled {
1049
+ opacity: .35;
1050
+ filter:Alpha(Opacity=35); /* support: IE8 */
1051
+ background-image: none;
1052
+ }
1053
+ .ui-state-disabled .ui-icon {
1054
+ filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
1055
+ }
1056
+
1057
+ /* Icons
1058
+ ----------------------------------*/
1059
+
1060
+ /* states and images */
1061
+ .ui-icon {
1062
+ width: 16px;
1063
+ height: 16px;
1064
+ }
1065
+ .ui-icon,
1066
+ .ui-widget-content .ui-icon {
1067
+ background-image: url("images/ui-icons_444444_256x240.png");
1068
+ }
1069
+ .ui-widget-header .ui-icon {
1070
+ background-image: url("images/ui-icons_444444_256x240.png");
1071
+ }
1072
+ .ui-state-hover .ui-icon,
1073
+ .ui-state-focus .ui-icon,
1074
+ .ui-button:hover .ui-icon,
1075
+ .ui-button:focus .ui-icon {
1076
+ background-image: url("images/ui-icons_555555_256x240.png");
1077
+ }
1078
+ .ui-state-active .ui-icon,
1079
+ .ui-button:active .ui-icon {
1080
+ background-image: url("images/ui-icons_ffffff_256x240.png");
1081
+ }
1082
+ .ui-state-highlight .ui-icon,
1083
+ .ui-button .ui-state-highlight.ui-icon {
1084
+ background-image: url("images/ui-icons_777620_256x240.png");
1085
+ }
1086
+ .ui-state-error .ui-icon,
1087
+ .ui-state-error-text .ui-icon {
1088
+ background-image: url("images/ui-icons_cc0000_256x240.png");
1089
+ }
1090
+ .ui-button .ui-icon {
1091
+ background-image: url("images/ui-icons_777777_256x240.png");
1092
+ }
1093
+
1094
+ /* positioning */
1095
+ .ui-icon-blank { background-position: 16px 16px; }
1096
+ .ui-icon-caret-1-n { background-position: 0 0; }
1097
+ .ui-icon-caret-1-ne { background-position: -16px 0; }
1098
+ .ui-icon-caret-1-e { background-position: -32px 0; }
1099
+ .ui-icon-caret-1-se { background-position: -48px 0; }
1100
+ .ui-icon-caret-1-s { background-position: -65px 0; }
1101
+ .ui-icon-caret-1-sw { background-position: -80px 0; }
1102
+ .ui-icon-caret-1-w { background-position: -96px 0; }
1103
+ .ui-icon-caret-1-nw { background-position: -112px 0; }
1104
+ .ui-icon-caret-2-n-s { background-position: -128px 0; }
1105
+ .ui-icon-caret-2-e-w { background-position: -144px 0; }
1106
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
1107
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
1108
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
1109
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
1110
+ .ui-icon-triangle-1-s { background-position: -65px -16px; }
1111
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
1112
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
1113
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
1114
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
1115
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
1116
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
1117
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
1118
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
1119
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
1120
+ .ui-icon-arrow-1-s { background-position: -65px -32px; }
1121
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
1122
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
1123
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
1124
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
1125
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
1126
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
1127
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
1128
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
1129
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
1130
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
1131
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
1132
+ .ui-icon-arrowthick-1-n { background-position: 1px -48px; }
1133
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
1134
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
1135
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
1136
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
1137
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
1138
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
1139
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
1140
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
1141
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
1142
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
1143
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
1144
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
1145
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
1146
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
1147
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
1148
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
1149
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
1150
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
1151
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
1152
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
1153
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
1154
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
1155
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
1156
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
1157
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
1158
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
1159
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
1160
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
1161
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
1162
+ .ui-icon-extlink { background-position: -32px -80px; }
1163
+ .ui-icon-newwin { background-position: -48px -80px; }
1164
+ .ui-icon-refresh { background-position: -64px -80px; }
1165
+ .ui-icon-shuffle { background-position: -80px -80px; }
1166
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
1167
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
1168
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
1169
+ .ui-icon-folder-open { background-position: -16px -96px; }
1170
+ .ui-icon-document { background-position: -32px -96px; }
1171
+ .ui-icon-document-b { background-position: -48px -96px; }
1172
+ .ui-icon-note { background-position: -64px -96px; }
1173
+ .ui-icon-mail-closed { background-position: -80px -96px; }
1174
+ .ui-icon-mail-open { background-position: -96px -96px; }
1175
+ .ui-icon-suitcase { background-position: -112px -96px; }
1176
+ .ui-icon-comment { background-position: -128px -96px; }
1177
+ .ui-icon-person { background-position: -144px -96px; }
1178
+ .ui-icon-print { background-position: -160px -96px; }
1179
+ .ui-icon-trash { background-position: -176px -96px; }
1180
+ .ui-icon-locked { background-position: -192px -96px; }
1181
+ .ui-icon-unlocked { background-position: -208px -96px; }
1182
+ .ui-icon-bookmark { background-position: -224px -96px; }
1183
+ .ui-icon-tag { background-position: -240px -96px; }
1184
+ .ui-icon-home { background-position: 0 -112px; }
1185
+ .ui-icon-flag { background-position: -16px -112px; }
1186
+ .ui-icon-calendar { background-position: -32px -112px; }
1187
+ .ui-icon-cart { background-position: -48px -112px; }
1188
+ .ui-icon-pencil { background-position: -64px -112px; }
1189
+ .ui-icon-clock { background-position: -80px -112px; }
1190
+ .ui-icon-disk { background-position: -96px -112px; }
1191
+ .ui-icon-calculator { background-position: -112px -112px; }
1192
+ .ui-icon-zoomin { background-position: -128px -112px; }
1193
+ .ui-icon-zoomout { background-position: -144px -112px; }
1194
+ .ui-icon-search { background-position: -160px -112px; }
1195
+ .ui-icon-wrench { background-position: -176px -112px; }
1196
+ .ui-icon-gear { background-position: -192px -112px; }
1197
+ .ui-icon-heart { background-position: -208px -112px; }
1198
+ .ui-icon-star { background-position: -224px -112px; }
1199
+ .ui-icon-link { background-position: -240px -112px; }
1200
+ .ui-icon-cancel { background-position: 0 -128px; }
1201
+ .ui-icon-plus { background-position: -16px -128px; }
1202
+ .ui-icon-plusthick { background-position: -32px -128px; }
1203
+ .ui-icon-minus { background-position: -48px -128px; }
1204
+ .ui-icon-minusthick { background-position: -64px -128px; }
1205
+ .ui-icon-close { background-position: -80px -128px; }
1206
+ .ui-icon-closethick { background-position: -96px -128px; }
1207
+ .ui-icon-key { background-position: -112px -128px; }
1208
+ .ui-icon-lightbulb { background-position: -128px -128px; }
1209
+ .ui-icon-scissors { background-position: -144px -128px; }
1210
+ .ui-icon-clipboard { background-position: -160px -128px; }
1211
+ .ui-icon-copy { background-position: -176px -128px; }
1212
+ .ui-icon-contact { background-position: -192px -128px; }
1213
+ .ui-icon-image { background-position: -208px -128px; }
1214
+ .ui-icon-video { background-position: -224px -128px; }
1215
+ .ui-icon-script { background-position: -240px -128px; }
1216
+ .ui-icon-alert { background-position: 0 -144px; }
1217
+ .ui-icon-info { background-position: -16px -144px; }
1218
+ .ui-icon-notice { background-position: -32px -144px; }
1219
+ .ui-icon-help { background-position: -48px -144px; }
1220
+ .ui-icon-check { background-position: -64px -144px; }
1221
+ .ui-icon-bullet { background-position: -80px -144px; }
1222
+ .ui-icon-radio-on { background-position: -96px -144px; }
1223
+ .ui-icon-radio-off { background-position: -112px -144px; }
1224
+ .ui-icon-pin-w { background-position: -128px -144px; }
1225
+ .ui-icon-pin-s { background-position: -144px -144px; }
1226
+ .ui-icon-play { background-position: 0 -160px; }
1227
+ .ui-icon-pause { background-position: -16px -160px; }
1228
+ .ui-icon-seek-next { background-position: -32px -160px; }
1229
+ .ui-icon-seek-prev { background-position: -48px -160px; }
1230
+ .ui-icon-seek-end { background-position: -64px -160px; }
1231
+ .ui-icon-seek-start { background-position: -80px -160px; }
1232
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
1233
+ .ui-icon-seek-first { background-position: -80px -160px; }
1234
+ .ui-icon-stop { background-position: -96px -160px; }
1235
+ .ui-icon-eject { background-position: -112px -160px; }
1236
+ .ui-icon-volume-off { background-position: -128px -160px; }
1237
+ .ui-icon-volume-on { background-position: -144px -160px; }
1238
+ .ui-icon-power { background-position: 0 -176px; }
1239
+ .ui-icon-signal-diag { background-position: -16px -176px; }
1240
+ .ui-icon-signal { background-position: -32px -176px; }
1241
+ .ui-icon-battery-0 { background-position: -48px -176px; }
1242
+ .ui-icon-battery-1 { background-position: -64px -176px; }
1243
+ .ui-icon-battery-2 { background-position: -80px -176px; }
1244
+ .ui-icon-battery-3 { background-position: -96px -176px; }
1245
+ .ui-icon-circle-plus { background-position: 0 -192px; }
1246
+ .ui-icon-circle-minus { background-position: -16px -192px; }
1247
+ .ui-icon-circle-close { background-position: -32px -192px; }
1248
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
1249
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
1250
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
1251
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
1252
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
1253
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
1254
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
1255
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
1256
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
1257
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
1258
+ .ui-icon-circle-check { background-position: -208px -192px; }
1259
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
1260
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
1261
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
1262
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
1263
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
1264
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
1265
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
1266
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
1267
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
1268
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
1269
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
1270
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
1271
+
1272
+
1273
+ /* Misc visuals
1274
+ ----------------------------------*/
1275
+
1276
+ /* Corner radius */
1277
+ .ui-corner-all,
1278
+ .ui-corner-top,
1279
+ .ui-corner-left,
1280
+ .ui-corner-tl {
1281
+ border-top-left-radius: 3px;
1282
+ }
1283
+ .ui-corner-all,
1284
+ .ui-corner-top,
1285
+ .ui-corner-right,
1286
+ .ui-corner-tr {
1287
+ border-top-right-radius: 3px;
1288
+ }
1289
+ .ui-corner-all,
1290
+ .ui-corner-bottom,
1291
+ .ui-corner-left,
1292
+ .ui-corner-bl {
1293
+ border-bottom-left-radius: 3px;
1294
+ }
1295
+ .ui-corner-all,
1296
+ .ui-corner-bottom,
1297
+ .ui-corner-right,
1298
+ .ui-corner-br {
1299
+ border-bottom-right-radius: 3px;
1300
+ }
1301
+
1302
+ /* Overlays */
1303
+ .ui-widget-overlay {
1304
+ background: #aaaaaa;
1305
+ opacity: .3;
1306
+ filter: Alpha(Opacity=30); /* support: IE8 */
1307
+ }
1308
+ .ui-widget-shadow {
1309
+ -webkit-box-shadow: 0px 0px 5px #666666;
1310
+ box-shadow: 0px 0px 5px #666666;
1311
+ }
form-maker.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Form Maker
4
  * Plugin URI: https://web-dorado.com/products/form-maker-wordpress.html
5
  * Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
6
- * Version: 1.11.5
7
  * Author: WebDorado Form Builder Team
8
  * Author URI: https://web-dorado.com/
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -11,7 +11,7 @@
11
  define('WD_FM_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
12
  define('WD_FM_URL', plugins_url(plugin_basename(dirname(__FILE__))));
13
  define('WD_MAIN_FILE', plugin_basename(__FILE__));
14
- define('WD_FM_VERSION', '1.11.5');
15
  // Plugin menu.
16
  function form_maker_options_panel() {
17
  $parent_slug = null;
@@ -373,6 +373,7 @@ function form_maker_manage_scripts() {
373
 
374
  wp_enqueue_script('form_maker_admin', WD_FM_URL . '/js/form_maker_admin.js', array(), WD_FM_VERSION);
375
  wp_enqueue_script('form_maker_manage', WD_FM_URL . '/js/form_maker_manage.js', array(), WD_FM_VERSION);
 
376
 
377
  wp_enqueue_script('form_maker_codemirror', WD_FM_URL . '/js/layout/codemirror.js', array(), '2.3');
378
  wp_enqueue_script('form_maker_clike', WD_FM_URL . '/js/layout/clike.js', array(), '1.0.0');
3
  * Plugin Name: Form Maker
4
  * Plugin URI: https://web-dorado.com/products/form-maker-wordpress.html
5
  * Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
6
+ * Version: 1.11.6
7
  * Author: WebDorado Form Builder Team
8
  * Author URI: https://web-dorado.com/
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
11
  define('WD_FM_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
12
  define('WD_FM_URL', plugins_url(plugin_basename(dirname(__FILE__))));
13
  define('WD_MAIN_FILE', plugin_basename(__FILE__));
14
+ define('WD_FM_VERSION', '1.11.6');
15
  // Plugin menu.
16
  function form_maker_options_panel() {
17
  $parent_slug = null;
373
 
374
  wp_enqueue_script('form_maker_admin', WD_FM_URL . '/js/form_maker_admin.js', array(), WD_FM_VERSION);
375
  wp_enqueue_script('form_maker_manage', WD_FM_URL . '/js/form_maker_manage.js', array(), WD_FM_VERSION);
376
+ wp_enqueue_script('formmaker_div', WD_FM_URL . '/js/formmaker_div.js', array(), WD_FM_VERSION);
377
 
378
  wp_enqueue_script('form_maker_codemirror', WD_FM_URL . '/js/layout/codemirror.js', array(), '2.3');
379
  wp_enqueue_script('form_maker_clike', WD_FM_URL . '/js/layout/clike.js', array(), '1.0.0');
js/form_maker_editor_button.js CHANGED
@@ -1,22 +1,23 @@
1
- (function() {
2
- tinymce.create('tinymce.plugins.Form_Maker_mce', {
3
- init : function(ed, url) {
4
- ed.addCommand('mceForm_Maker_mce', function() {
5
- ed.windowManager.open({
6
- file : form_maker_admin_ajax,
7
- width : 550 + ed.getLang('Form_Maker_mce.delta_width', 0),
8
- height : 300 + ed.getLang('Form_Maker_mce.delta_height', 0),
9
- inline : 1
10
- }, {
11
- plugin_url : url // Plugin absolute URL
12
- });
13
- });
14
- ed.addButton('Form_Maker_mce', {
15
- title : 'Insert Form Maker',
16
- cmd : 'mceForm_Maker_mce',
17
- image: url + '/images/form_maker_edit_but.png'
18
- });
19
- }
20
- });
21
- tinymce.PluginManager.add('Form_Maker_mce', tinymce.plugins.Form_Maker_mce);
 
22
  })();
1
+ (function() {
2
+ tinymce.create('tinymce.plugins.Form_Maker_mce', {
3
+ init : function(ed, url) {
4
+ ed.addCommand('mceForm_Maker_mce', function() {
5
+ ed.windowManager.open({
6
+ file : form_maker_admin_ajax,
7
+ width : 640 + ed.getLang('Form_Maker_mce.delta_width', 0),
8
+ height : 385 + ed.getLang('Form_Maker_mce.delta_height', 0),
9
+ inline : 1,
10
+ title : 'Form'
11
+ }, {
12
+ plugin_url : url // Plugin absolute URL
13
+ });
14
+ });
15
+ ed.addButton('Form_Maker_mce', {
16
+ title : 'Insert Form Maker',
17
+ cmd : 'mceForm_Maker_mce',
18
+ image: url + '/images/form_maker_edit_but.png'
19
+ });
20
+ }
21
+ });
22
+ tinymce.PluginManager.add('Form_Maker_mce', tinymce.plugins.Form_Maker_mce);
23
  })();
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-form.html
4
  Tags: form, form builder, contact form, custom form, feedback, contact, contact forms, captcha, email, form manager, forms, survey
5
  Requires at least: 3.4
6
  Tested up to: 4.8
7
- Stable tag: 1.11.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -290,6 +290,11 @@ MailChimp form add-on of Form Maker lets you build up a customer database on you
290
 
291
  == Changelog ==
292
 
 
 
 
 
 
293
  = 1.11.5 =
294
  * Fixed: Bug on CSV/XML export.
295
  * Fixed: Google maps api conflict with other plugins.
4
  Tags: form, form builder, contact form, custom form, feedback, contact, contact forms, captcha, email, form manager, forms, survey
5
  Requires at least: 3.4
6
  Tested up to: 4.8
7
+ Stable tag: 1.11.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
290
 
291
  == Changelog ==
292
 
293
+ = 1.11.6 =
294
+ * Fixed: Shortcode editor pop-up styles.
295
+ * Fixed: Scripts enqueue in Manage Forms page.
296
+ * Fixed: MySQL Mapping fields list scrolling.
297
+
298
  = 1.11.5 =
299
  * Fixed: Bug on CSV/XML export.
300
  * Fixed: Google maps api conflict with other plugins.