Version Description
Added Section Form Item, ability to nest fields under Fieldsets and Sections. Improve adding/deleting fields.
Download this release
Release Info
Developer | mmuro |
Plugin | Visual Form Builder |
Version | 1.9 |
Comparing to | |
See all releases |
Code changes from version 1.8 to 1.9
- class-entries-detail.php +73 -9
- class-entries-list.php +56 -24
- css/nav-menu.css +1 -739
- css/visual-form-builder-admin.css +1 -61
- css/visual-form-builder.css +8 -1
- js/jquery.ui.nestedSortable.js +1 -0
- js/js_quicktags.js +1 -544
- js/visual-form-builder-validate.js +1 -33
- js/visual-form-builder.js +1 -336
- readme.txt +30 -3
- visual-form-builder.php +532 -348
class-entries-detail.php
CHANGED
@@ -27,13 +27,15 @@ class VisualFormBuilder_Entries_Detail{
|
|
27 |
|
28 |
echo '<p>' . sprintf( '<a href="?page=%s&view=%s" class="view-entry">« Back to Entries</a>', $_REQUEST['page'], $_REQUEST['view'] ) . '</p>';
|
29 |
|
30 |
-
|
|
|
|
|
31 |
|
32 |
/* Loop trough the entries and setup the data to be displayed for each row */
|
33 |
foreach ( $entries as $entry ) {
|
34 |
$data = unserialize( $entry->data );
|
35 |
|
36 |
-
echo '<div id="poststuff" class="metabox-holder has-right-sidebar">
|
37 |
<div id="side-info-column" class="inner-sidebar">
|
38 |
<div id="side-sortables">
|
39 |
<div id="submitdiv" class="postbox">
|
@@ -46,7 +48,7 @@ class VisualFormBuilder_Entries_Detail{
|
|
46 |
<span><strong>' . __( 'Form Title' , 'visual-form-builder') . ': </strong>' . stripslashes( $entry->form_title ) . '</span>
|
47 |
</div>
|
48 |
<div class="misc-pub-section">
|
49 |
-
<span><strong>' . __( 'Date Submitted' , 'visual-form-builder') . ': </strong>' . $entry->date_submitted . '</span>
|
50 |
</div>
|
51 |
<div class="misc-pub-section">
|
52 |
<span><strong>' . __( 'IP Address' , 'visual-form-builder') . ': </strong>' . $entry->ip_address . '</span>
|
@@ -69,7 +71,7 @@ class VisualFormBuilder_Entries_Detail{
|
|
69 |
|
70 |
<div id="major-publishing-actions">
|
71 |
<div id="delete-action">'
|
72 |
-
. sprintf( '<a class="submitdelete deletion" href="?page=%s&view=%s&action=%s&entry=%s">Delete</a>', $_REQUEST['page'], $_REQUEST['view'], 'delete', $entry_id ) .
|
73 |
'</div>
|
74 |
<div class="clear"></div>
|
75 |
</div>
|
@@ -79,16 +81,78 @@ class VisualFormBuilder_Entries_Detail{
|
|
79 |
</div>
|
80 |
</div>';
|
81 |
echo '<div>
|
82 |
-
<div id="post-body-content">
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
<h3><span>' . $entry->form_title . ' : ' . __( 'Entry' , 'visual-form-builder') .' #' . $entry->entries_id . '</span></h3>
|
85 |
<div class="inside">';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
|
|
|
|
|
|
|
92 |
echo '</div></div></div></div>';
|
93 |
}
|
94 |
|
27 |
|
28 |
echo '<p>' . sprintf( '<a href="?page=%s&view=%s" class="view-entry">« Back to Entries</a>', $_REQUEST['page'], $_REQUEST['view'] ) . '</p>';
|
29 |
|
30 |
+
/* Get the date/time format that is saved in the options table */
|
31 |
+
$date_format = get_option('date_format');
|
32 |
+
$time_format = get_option('time_format');
|
33 |
|
34 |
/* Loop trough the entries and setup the data to be displayed for each row */
|
35 |
foreach ( $entries as $entry ) {
|
36 |
$data = unserialize( $entry->data );
|
37 |
|
38 |
+
echo '<h3><span>' . $entry->form_title . ' : ' . __( 'Entry' , 'visual-form-builder') .' #' . $entry->entries_id . '</span></h3><div id="poststuff" class="metabox-holder has-right-sidebar">
|
39 |
<div id="side-info-column" class="inner-sidebar">
|
40 |
<div id="side-sortables">
|
41 |
<div id="submitdiv" class="postbox">
|
48 |
<span><strong>' . __( 'Form Title' , 'visual-form-builder') . ': </strong>' . stripslashes( $entry->form_title ) . '</span>
|
49 |
</div>
|
50 |
<div class="misc-pub-section">
|
51 |
+
<span><strong>' . __( 'Date Submitted' , 'visual-form-builder') . ': </strong>' . date( "$date_format $time_format", strtotime( $entry->date_submitted ) ) . '</span>
|
52 |
</div>
|
53 |
<div class="misc-pub-section">
|
54 |
<span><strong>' . __( 'IP Address' , 'visual-form-builder') . ': </strong>' . $entry->ip_address . '</span>
|
71 |
|
72 |
<div id="major-publishing-actions">
|
73 |
<div id="delete-action">'
|
74 |
+
. sprintf( '<a class="submitdelete deletion entry-delete" href="?page=%s&view=%s&action=%s&entry=%s">Delete</a>', $_REQUEST['page'], $_REQUEST['view'], 'delete', $entry_id ) .
|
75 |
'</div>
|
76 |
<div class="clear"></div>
|
77 |
</div>
|
81 |
</div>
|
82 |
</div>';
|
83 |
echo '<div>
|
84 |
+
<div id="post-body-content">';
|
85 |
+
|
86 |
+
$count = 0;
|
87 |
+
$open_fieldset = $open_section = false;
|
88 |
+
|
89 |
+
foreach ( $data as $k => $v ) {
|
90 |
+
if ( !is_array( $v ) ) {
|
91 |
+
if ( $count == 0 ) {
|
92 |
+
echo '<div class="postbox">
|
93 |
<h3><span>' . $entry->form_title . ' : ' . __( 'Entry' , 'visual-form-builder') .' #' . $entry->entries_id . '</span></h3>
|
94 |
<div class="inside">';
|
95 |
+
}
|
96 |
+
|
97 |
+
echo '<h4>' . ucwords( $k ) . '</h4>';
|
98 |
+
echo $v;
|
99 |
+
//echo '</div></div>';
|
100 |
+
$count++;
|
101 |
+
}
|
102 |
+
else {
|
103 |
+
/* Cast each array as an object */
|
104 |
+
$obj = (object) $v;
|
105 |
|
106 |
+
/* Close each section */
|
107 |
+
if ( $open_section == true ) {
|
108 |
+
/* If this field's parent does NOT equal our section ID */
|
109 |
+
if ( $sec_id && $sec_id !== $obj->parent_id ) {
|
110 |
+
echo '</div>';
|
111 |
+
$open_section = false;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
if ( $obj->type == 'fieldset' ) {
|
116 |
+
/* Close each fieldset */
|
117 |
+
if ( $open_fieldset == true )
|
118 |
+
echo '</div>';
|
119 |
+
|
120 |
+
echo '<div class="vfb-details"><h2>' . $obj->name . '</h2>';
|
121 |
+
|
122 |
+
$open_fieldset = true;
|
123 |
+
}
|
124 |
+
elseif ( $obj->type == 'section' ) {
|
125 |
+
/* Close each fieldset */
|
126 |
+
if ( $open_section == true )
|
127 |
+
echo '</div>';
|
128 |
+
|
129 |
+
echo '<div class="vfb-details section"><h3 class="section-heading">' . $obj->name . '</h3>';
|
130 |
+
|
131 |
+
/* Save section ID for future comparison */
|
132 |
+
$sec_id = $obj->id;
|
133 |
+
$open_section = true;
|
134 |
+
}
|
135 |
+
|
136 |
+
switch ( $obj->type ) {
|
137 |
+
case 'fieldset' :
|
138 |
+
case 'section' :
|
139 |
+
case 'submit' :
|
140 |
+
break;
|
141 |
+
|
142 |
+
default :
|
143 |
+
echo '<div class="postbox">
|
144 |
+
<h3><span>' . $obj->name . '</span></h3>
|
145 |
+
<div class="inside">' .
|
146 |
+
$obj->value .
|
147 |
+
'</div></div>';
|
148 |
+
break;
|
149 |
+
}
|
150 |
+
}
|
151 |
}
|
152 |
|
153 |
+
if ( $count > 0 )
|
154 |
+
echo '</div></div>';
|
155 |
+
|
156 |
echo '</div></div></div></div>';
|
157 |
}
|
158 |
|
class-entries-list.php
CHANGED
@@ -11,7 +11,7 @@ if( !class_exists( 'WP_List_Table' ) ) {
|
|
11 |
* @since 1.2
|
12 |
*/
|
13 |
class VisualFormBuilder_Entries_List extends WP_List_Table {
|
14 |
-
|
15 |
function __construct(){
|
16 |
global $status, $page, $wpdb;
|
17 |
|
@@ -25,7 +25,7 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
25 |
'singular' => 'entry',
|
26 |
'plural' => 'entries',
|
27 |
'ajax' => false
|
28 |
-
) );
|
29 |
}
|
30 |
|
31 |
/**
|
@@ -126,7 +126,7 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
126 |
}
|
127 |
|
128 |
$where = '';
|
129 |
-
|
130 |
/* If the form filter dropdown is used */
|
131 |
if ( $this->current_filter_action() )
|
132 |
$where = 'WHERE forms.form_id = ' . $this->current_filter_action();
|
@@ -260,11 +260,11 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
260 |
case 'subject':
|
261 |
case 'sender_name':
|
262 |
case 'sender_email':
|
263 |
-
$cols[$key]['data'][$row] = $value;
|
264 |
break;
|
265 |
|
266 |
case 'emails_to':
|
267 |
-
$cols[$key]['data'][$row] = implode( ',', maybe_unserialize( $value ) );
|
268 |
break;
|
269 |
|
270 |
case 'data':
|
@@ -273,26 +273,58 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
273 |
|
274 |
/* Loop through our submitted data */
|
275 |
foreach ( $fields as $field_key => $field_value ) {
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
}
|
290 |
-
|
291 |
-
/* Get rid of single quote entity */
|
292 |
-
$field_value = str_replace( ''', "'", $field_value );
|
293 |
-
|
294 |
-
/* Load data, row by row */
|
295 |
-
$cols[$field_key]['data'][$row] = str_replace( '"', '""', stripslashes( html_entity_decode( $field_value ) ) );
|
296 |
}
|
297 |
break;
|
298 |
}
|
11 |
* @since 1.2
|
12 |
*/
|
13 |
class VisualFormBuilder_Entries_List extends WP_List_Table {
|
14 |
+
|
15 |
function __construct(){
|
16 |
global $status, $page, $wpdb;
|
17 |
|
25 |
'singular' => 'entry',
|
26 |
'plural' => 'entries',
|
27 |
'ajax' => false
|
28 |
+
) );
|
29 |
}
|
30 |
|
31 |
/**
|
126 |
}
|
127 |
|
128 |
$where = '';
|
129 |
+
|
130 |
/* If the form filter dropdown is used */
|
131 |
if ( $this->current_filter_action() )
|
132 |
$where = 'WHERE forms.form_id = ' . $this->current_filter_action();
|
260 |
case 'subject':
|
261 |
case 'sender_name':
|
262 |
case 'sender_email':
|
263 |
+
$cols[ $key ][ 'data' ][ $row ] = $value;
|
264 |
break;
|
265 |
|
266 |
case 'emails_to':
|
267 |
+
$cols[ $key ][ 'data' ][ $row ] = implode( ',', maybe_unserialize( $value ) );
|
268 |
break;
|
269 |
|
270 |
case 'data':
|
273 |
|
274 |
/* Loop through our submitted data */
|
275 |
foreach ( $fields as $field_key => $field_value ) {
|
276 |
+
if ( !is_array( $field_value ) ) {
|
277 |
+
/* Replace quotes for the header */
|
278 |
+
$header = str_replace( '"', '""', ucwords( $field_key ) );
|
279 |
+
|
280 |
+
/* Replace all spaces for each form field name */
|
281 |
+
$field_key = preg_replace( '/(\s)/i', '', $field_key );
|
282 |
+
|
283 |
+
/* Find new field names and make a new column with a header */
|
284 |
+
if ( !array_key_exists( $field_key, $cols ) ) {
|
285 |
+
$cols[$field_key] = array(
|
286 |
+
'header' => $header,
|
287 |
+
'data' => array()
|
288 |
+
);
|
289 |
+
}
|
290 |
+
|
291 |
+
/* Get rid of single quote entity */
|
292 |
+
$field_value = str_replace( ''', "'", $field_value );
|
293 |
+
|
294 |
+
/* Load data, row by row */
|
295 |
+
$cols[ $field_key ][ 'data' ][ $row ] = str_replace( '"', '""', stripslashes( html_entity_decode( $field_value ) ) );
|
296 |
+
}
|
297 |
+
else {
|
298 |
+
/* Cast each array as an object */
|
299 |
+
$obj = (object) $field_value;
|
300 |
+
|
301 |
+
switch ( $obj->type ) {
|
302 |
+
case 'fieldset' :
|
303 |
+
case 'section' :
|
304 |
+
case 'submit' :
|
305 |
+
break;
|
306 |
+
|
307 |
+
default :
|
308 |
+
/* Replace quotes for the header */
|
309 |
+
$header = str_replace( '"', '""', $obj->name );
|
310 |
+
|
311 |
+
/* Find new field names and make a new column with a header */
|
312 |
+
if ( !array_key_exists( $obj->name, $cols ) ) {
|
313 |
+
$cols[$field_key] = array(
|
314 |
+
'header' => $header,
|
315 |
+
'data' => array()
|
316 |
+
);
|
317 |
+
}
|
318 |
+
|
319 |
+
/* Get rid of single quote entity */
|
320 |
+
$obj->value = str_replace( ''', "'", $obj->value );
|
321 |
+
|
322 |
+
/* Load data, row by row */
|
323 |
+
$cols[ $obj->name ][ 'data' ][ $row ] = str_replace( '"', '""', stripslashes( html_entity_decode( $obj->value ) ) );
|
324 |
+
|
325 |
+
break;
|
326 |
+
}
|
327 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
}
|
329 |
break;
|
330 |
}
|
css/nav-menu.css
CHANGED
@@ -1,739 +1 @@
|
|
1 |
-
/**
|
2 |
-
* WordPress Administration Custom Navigation
|
3 |
-
* Interface CSS
|
4 |
-
*
|
5 |
-
* @version 2.0.0
|
6 |
-
*
|
7 |
-
* @package WordPress
|
8 |
-
* @subpackage Administration
|
9 |
-
*/
|
10 |
-
|
11 |
-
html,
|
12 |
-
body {
|
13 |
-
min-width: 950px;
|
14 |
-
}
|
15 |
-
|
16 |
-
#nav-menus-frame {
|
17 |
-
margin-left: 300px;
|
18 |
-
}
|
19 |
-
|
20 |
-
#wpbody-content #menu-settings-column {
|
21 |
-
display:inline;
|
22 |
-
width:281px;
|
23 |
-
margin-left: -300px;
|
24 |
-
clear: both;
|
25 |
-
float: left;
|
26 |
-
padding-top: 24px;
|
27 |
-
}
|
28 |
-
.no-js #wpbody-content #menu-settings-column {
|
29 |
-
padding-top: 31px;
|
30 |
-
}
|
31 |
-
|
32 |
-
#menu-settings-column .inside {
|
33 |
-
clear: both;
|
34 |
-
}
|
35 |
-
|
36 |
-
.metabox-holder-disabled .postbox {
|
37 |
-
opacity: 0.5;
|
38 |
-
filter: alpha(opacity=50);
|
39 |
-
}
|
40 |
-
|
41 |
-
.metabox-holder-disabled .button-controls .select-all {
|
42 |
-
display: none;
|
43 |
-
}
|
44 |
-
#wpbody {
|
45 |
-
position: relative;
|
46 |
-
}
|
47 |
-
|
48 |
-
/* Menu Container */
|
49 |
-
#menu-management-liquid {
|
50 |
-
float: left;
|
51 |
-
min-width: 100%;
|
52 |
-
}
|
53 |
-
|
54 |
-
#menu-management {
|
55 |
-
position: relative;
|
56 |
-
margin-right: 20px;
|
57 |
-
margin-top: -3px;
|
58 |
-
width: 100%;
|
59 |
-
}
|
60 |
-
|
61 |
-
#menu-management .menu-edit {
|
62 |
-
border: 1px solid;
|
63 |
-
-moz-border-radius: 3px;
|
64 |
-
-webkit-border-radius: 3px;
|
65 |
-
-khtml-border-radius: 3px;
|
66 |
-
border-radius: 3px;
|
67 |
-
margin-bottom: 20px;
|
68 |
-
}
|
69 |
-
|
70 |
-
#post-body {
|
71 |
-
padding: 10px;
|
72 |
-
border-width: 1px 0;
|
73 |
-
border-style: solid;
|
74 |
-
}
|
75 |
-
|
76 |
-
#nav-menu-header,
|
77 |
-
#nav-menu-footer {
|
78 |
-
padding: 0 10px;
|
79 |
-
}
|
80 |
-
|
81 |
-
#nav-menu-header {
|
82 |
-
border-bottom: 1px solid;
|
83 |
-
}
|
84 |
-
|
85 |
-
#nav-menu-footer {
|
86 |
-
border-top: 1px solid;
|
87 |
-
}
|
88 |
-
|
89 |
-
#post-body div.updated, #post-body div.error {
|
90 |
-
margin: 0;
|
91 |
-
}
|
92 |
-
|
93 |
-
#post-body-content {
|
94 |
-
position: relative;
|
95 |
-
}
|
96 |
-
|
97 |
-
#menu-management .menu-add-new abbr {
|
98 |
-
font-weight:bold;
|
99 |
-
}
|
100 |
-
|
101 |
-
/* Menu Tabs */
|
102 |
-
|
103 |
-
#menu-management .nav-tabs-nav {
|
104 |
-
margin: 0 20px;
|
105 |
-
}
|
106 |
-
|
107 |
-
#menu-management .nav-tabs-arrow {
|
108 |
-
width: 10px;
|
109 |
-
padding: 0 5px 4px;
|
110 |
-
cursor: pointer;
|
111 |
-
position: absolute;
|
112 |
-
top: 0;
|
113 |
-
line-height: 22px;
|
114 |
-
font-size: 18px;
|
115 |
-
text-shadow: 0 1px 0 #fff;
|
116 |
-
}
|
117 |
-
|
118 |
-
#menu-management .nav-tabs-arrow a:hover{
|
119 |
-
}
|
120 |
-
|
121 |
-
#menu-management .nav-tabs-arrow a:active {
|
122 |
-
}
|
123 |
-
|
124 |
-
#menu-management .nav-tabs-arrow-left {
|
125 |
-
left: 0;
|
126 |
-
}
|
127 |
-
|
128 |
-
#menu-management .nav-tabs-arrow-right {
|
129 |
-
right: 0;
|
130 |
-
text-align: right;
|
131 |
-
}
|
132 |
-
|
133 |
-
#menu-management .nav-tabs-wrapper {
|
134 |
-
width: 100%;
|
135 |
-
height: 28px;
|
136 |
-
margin-bottom: -1px;
|
137 |
-
overflow: hidden;
|
138 |
-
}
|
139 |
-
|
140 |
-
#menu-management .nav-tabs {
|
141 |
-
padding-left: 20px;
|
142 |
-
padding-right: 10px;
|
143 |
-
}
|
144 |
-
|
145 |
-
.js #menu-management .nav-tabs {
|
146 |
-
float: left;
|
147 |
-
margin-left: 0px;
|
148 |
-
margin-right: -400px;
|
149 |
-
}
|
150 |
-
|
151 |
-
#menu-management .nav-tab {
|
152 |
-
margin-bottom: 0;
|
153 |
-
font-size: 14px;
|
154 |
-
font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
|
155 |
-
}
|
156 |
-
|
157 |
-
|
158 |
-
#select-nav-menu-container {
|
159 |
-
text-align: right;
|
160 |
-
padding: 0 10px 3px 10px;
|
161 |
-
margin-bottom: 5px;
|
162 |
-
}
|
163 |
-
|
164 |
-
#select-nav-menu {
|
165 |
-
width: 100px;
|
166 |
-
display: inline;
|
167 |
-
}
|
168 |
-
|
169 |
-
#menu-name-label {
|
170 |
-
margin-top: -2px;
|
171 |
-
}
|
172 |
-
|
173 |
-
#wpbody .open-label {
|
174 |
-
display: block;
|
175 |
-
float:left;
|
176 |
-
}
|
177 |
-
|
178 |
-
#wpbody .open-label span {
|
179 |
-
padding-right: 10px;
|
180 |
-
}
|
181 |
-
|
182 |
-
.js .input-with-default-title {
|
183 |
-
font-style: italic;
|
184 |
-
}
|
185 |
-
|
186 |
-
#menu-management .inside {
|
187 |
-
padding: 0 10px;
|
188 |
-
}
|
189 |
-
|
190 |
-
/* Add Menu Item Boxes */
|
191 |
-
.postbox .howto input {
|
192 |
-
width: 180px;
|
193 |
-
float: right;
|
194 |
-
}
|
195 |
-
|
196 |
-
.customlinkdiv .howto input {
|
197 |
-
width: 200px;
|
198 |
-
}
|
199 |
-
|
200 |
-
#nav-menu-theme-locations .howto select {
|
201 |
-
width: 100%;
|
202 |
-
}
|
203 |
-
|
204 |
-
#nav-menu-theme-locations .button-controls {
|
205 |
-
text-align: right;
|
206 |
-
}
|
207 |
-
|
208 |
-
.add-menu-item-view-all {
|
209 |
-
height: 400px;
|
210 |
-
}
|
211 |
-
|
212 |
-
/* Button Primary Actions */
|
213 |
-
#menu-container .submit {
|
214 |
-
margin: 0px 0px 10px;
|
215 |
-
padding: 0px;
|
216 |
-
}
|
217 |
-
|
218 |
-
.meta-sep,
|
219 |
-
.submitdelete,
|
220 |
-
.submitcancel {
|
221 |
-
display:block;
|
222 |
-
float:left;
|
223 |
-
font-size: 12px;
|
224 |
-
margin: 4px 0;
|
225 |
-
line-height: 15px;
|
226 |
-
}
|
227 |
-
|
228 |
-
.meta-sep {
|
229 |
-
padding: 0 2px;
|
230 |
-
}
|
231 |
-
|
232 |
-
#cancel-save {
|
233 |
-
text-decoration: underline;
|
234 |
-
font-size: 12px;
|
235 |
-
margin-left: 20px;
|
236 |
-
margin-top: 5px;
|
237 |
-
}
|
238 |
-
|
239 |
-
/* Button Secondary Actions */
|
240 |
-
.list-controls {
|
241 |
-
float: left;
|
242 |
-
margin-top: 5px;
|
243 |
-
}
|
244 |
-
|
245 |
-
.add-to-menu {
|
246 |
-
float: right;
|
247 |
-
}
|
248 |
-
|
249 |
-
.postbox img.waiting {
|
250 |
-
display: none;
|
251 |
-
vertical-align: middle;
|
252 |
-
}
|
253 |
-
|
254 |
-
.button-controls {
|
255 |
-
clear:both;
|
256 |
-
margin: 10px 0;
|
257 |
-
}
|
258 |
-
|
259 |
-
.show-all, .hide-all {
|
260 |
-
cursor: pointer;
|
261 |
-
}
|
262 |
-
|
263 |
-
.hide-all {
|
264 |
-
display: none;
|
265 |
-
}
|
266 |
-
|
267 |
-
/* Create Menu */
|
268 |
-
#menu-name {
|
269 |
-
width: 270px;
|
270 |
-
}
|
271 |
-
|
272 |
-
#manage-menu .inside {
|
273 |
-
padding: 0px 0px;
|
274 |
-
}
|
275 |
-
|
276 |
-
/* Custom Links */
|
277 |
-
#available-links dt {
|
278 |
-
display: block;
|
279 |
-
}
|
280 |
-
|
281 |
-
#add-custom-link .howto {
|
282 |
-
font-size: 12px;
|
283 |
-
}
|
284 |
-
|
285 |
-
#add-custom-link label span {
|
286 |
-
display: block;
|
287 |
-
float: left;
|
288 |
-
margin-top: 5px;
|
289 |
-
padding-right: 5px;
|
290 |
-
}
|
291 |
-
|
292 |
-
.menu-item-textbox {
|
293 |
-
width: 180px;
|
294 |
-
}
|
295 |
-
|
296 |
-
.howto span {
|
297 |
-
margin-top: 4px;
|
298 |
-
display: block;
|
299 |
-
float: left;
|
300 |
-
}
|
301 |
-
|
302 |
-
/* Menu item types */
|
303 |
-
.quick-search {
|
304 |
-
width: 190px;
|
305 |
-
}
|
306 |
-
|
307 |
-
.list-wrap {
|
308 |
-
display: none;
|
309 |
-
clear: both;
|
310 |
-
margin-bottom: 10px;
|
311 |
-
}
|
312 |
-
|
313 |
-
.list-container {
|
314 |
-
max-height: 200px;
|
315 |
-
overflow-y: auto;
|
316 |
-
padding: 10px 10px 5px;
|
317 |
-
border: 1px solid;
|
318 |
-
-moz-border-radius: 3px;
|
319 |
-
}
|
320 |
-
|
321 |
-
.postbox p.submit {
|
322 |
-
margin-bottom: 0;
|
323 |
-
}
|
324 |
-
|
325 |
-
/* Listings */
|
326 |
-
.list li {
|
327 |
-
display: none;
|
328 |
-
margin: 0;
|
329 |
-
margin-bottom: 5px;
|
330 |
-
}
|
331 |
-
|
332 |
-
.list li .menu-item-title {
|
333 |
-
cursor: pointer;
|
334 |
-
display: block;
|
335 |
-
}
|
336 |
-
|
337 |
-
.list li .menu-item-title input {
|
338 |
-
margin-right: 3px;
|
339 |
-
margin-top: -3px;
|
340 |
-
}
|
341 |
-
|
342 |
-
/* Nav Menu */
|
343 |
-
#menu-container .inside {
|
344 |
-
padding-bottom: 10px;
|
345 |
-
}
|
346 |
-
|
347 |
-
.menu {
|
348 |
-
padding-top:1em;
|
349 |
-
}
|
350 |
-
|
351 |
-
#menu-to-edit {
|
352 |
-
padding: 1em 0;
|
353 |
-
}
|
354 |
-
|
355 |
-
.menu ul {
|
356 |
-
width: 100%;
|
357 |
-
}
|
358 |
-
|
359 |
-
.menu ul.sub-menu {
|
360 |
-
}
|
361 |
-
|
362 |
-
.menu li {
|
363 |
-
margin-bottom: 0;
|
364 |
-
position:relative;
|
365 |
-
}
|
366 |
-
|
367 |
-
.menu-item-bar {
|
368 |
-
clear:both;
|
369 |
-
line-height:1.5em;
|
370 |
-
position:relative;
|
371 |
-
margin-top: 13px;
|
372 |
-
}
|
373 |
-
|
374 |
-
.menu-item-handle {
|
375 |
-
border: 1px solid #dfdfdf;
|
376 |
-
position: relative;
|
377 |
-
padding-left: 10px;
|
378 |
-
height: auto;
|
379 |
-
width: 400px;
|
380 |
-
line-height: 35px;
|
381 |
-
text-shadow: 0 1px 0 #FFFFFF;
|
382 |
-
overflow: hidden;
|
383 |
-
word-wrap: break-word;
|
384 |
-
border-radius: 3px;
|
385 |
-
-webkit-border-radius: 3px;
|
386 |
-
-moz-border-radius: 3px;
|
387 |
-
-khtml-border-radius: 3px;
|
388 |
-
}
|
389 |
-
|
390 |
-
#menu-to-edit .menu-item-invalid .menu-item-handle {
|
391 |
-
background-color: #f6c9cc; /* Fallback */
|
392 |
-
background-image: -ms-linear-gradient(bottom, #f6c9cc, #fdf8ff); /* IE10 */
|
393 |
-
background-image: -moz-linear-gradient(bottom, #f6c9cc, #fdf8ff); /* Firefox */
|
394 |
-
background-image: -o-linear-gradient(bottom, #f6c9cc, #fdf8ff); /* Opera */
|
395 |
-
background-image: -webkit-gradient(linear, left bottom, left top, from(#f6c9cc), to(#fdf8ff)); /* old Webkit */
|
396 |
-
background-image: -webkit-linear-gradient(bottom, #f6c9cc, #fdf8ff); /* new Webkit */
|
397 |
-
background-image: linear-gradient(bottom, #f6c9cc, #fdf8ff); /* proposed W3C Markup */
|
398 |
-
}
|
399 |
-
|
400 |
-
.menu-item-edit-active .menu-item-handle {
|
401 |
-
-moz-border-radius: 3px 3px 0 0;
|
402 |
-
-webkit-border-bottom-right-radius: 0;
|
403 |
-
-webkit-border-bottom-left-radius: 0;
|
404 |
-
-khtml-border-bottom-right-radius: 0;
|
405 |
-
-khtml-border-bottom-left-radius: 0;
|
406 |
-
border-bottom-right-radius: 0;
|
407 |
-
border-bottom-left-radius: 0;
|
408 |
-
}
|
409 |
-
|
410 |
-
.no-js .menu-item-edit-active .item-edit {
|
411 |
-
display: none;
|
412 |
-
}
|
413 |
-
|
414 |
-
.js .menu-item-handle {
|
415 |
-
cursor: move;
|
416 |
-
}
|
417 |
-
|
418 |
-
.menu li.deleting .menu-item-handle {
|
419 |
-
background-image: none;
|
420 |
-
text-shadow: 0 0 0;
|
421 |
-
}
|
422 |
-
|
423 |
-
.menu-item-handle .item-title {
|
424 |
-
font-size: 12px;
|
425 |
-
font-weight: bold;
|
426 |
-
padding: 7px 0;
|
427 |
-
line-height: 20px;
|
428 |
-
display:block;
|
429 |
-
margin-right:13em;
|
430 |
-
}
|
431 |
-
|
432 |
-
/* Sortables */
|
433 |
-
li.menu-item.ui-sortable-helper dl {
|
434 |
-
margin-top: 0;
|
435 |
-
}
|
436 |
-
|
437 |
-
li.menu-item.ui-sortable-helper .menu-item-transport dl {
|
438 |
-
margin-top: 13px;
|
439 |
-
}
|
440 |
-
|
441 |
-
.menu .sortable-placeholder {
|
442 |
-
height: 35px;
|
443 |
-
width: 410px;
|
444 |
-
margin-top: 13px;
|
445 |
-
}
|
446 |
-
|
447 |
-
/* WARNING: The factor of 30px is hardcoded into the nav-menus javascript. */
|
448 |
-
.menu-item-depth-0 { margin-left: 0px; }
|
449 |
-
.menu-item-depth-1 { margin-left: 30px; }
|
450 |
-
.menu-item-depth-2 { margin-left: 60px; }
|
451 |
-
.menu-item-depth-3 { margin-left: 90px; }
|
452 |
-
.menu-item-depth-4 { margin-left: 120px; }
|
453 |
-
.menu-item-depth-5 { margin-left: 150px; }
|
454 |
-
.menu-item-depth-6 { margin-left: 180px; }
|
455 |
-
.menu-item-depth-7 { margin-left: 210px; }
|
456 |
-
.menu-item-depth-8 { margin-left: 240px; }
|
457 |
-
.menu-item-depth-9 { margin-left: 270px; }
|
458 |
-
.menu-item-depth-10 { margin-left: 300px; }
|
459 |
-
.menu-item-depth-11 { margin-left: 330px; }
|
460 |
-
|
461 |
-
.menu-item-depth-0 .menu-item-transport { margin-left: 0px; }
|
462 |
-
.menu-item-depth-1 .menu-item-transport { margin-left: -30px; }
|
463 |
-
.menu-item-depth-2 .menu-item-transport { margin-left: -60px; }
|
464 |
-
.menu-item-depth-3 .menu-item-transport { margin-left: -90px; }
|
465 |
-
.menu-item-depth-4 .menu-item-transport { margin-left: -120px; }
|
466 |
-
.menu-item-depth-5 .menu-item-transport { margin-left: -150px; }
|
467 |
-
.menu-item-depth-6 .menu-item-transport { margin-left: -180px; }
|
468 |
-
.menu-item-depth-7 .menu-item-transport { margin-left: -210px; }
|
469 |
-
.menu-item-depth-8 .menu-item-transport { margin-left: -240px; }
|
470 |
-
.menu-item-depth-9 .menu-item-transport { margin-left: -270px; }
|
471 |
-
.menu-item-depth-10 .menu-item-transport { margin-left: -300px; }
|
472 |
-
.menu-item-depth-11 .menu-item-transport { margin-left: -330px; }
|
473 |
-
|
474 |
-
body.menu-max-depth-0 { min-width: 950px !important; }
|
475 |
-
body.menu-max-depth-1 { min-width: 980px !important; }
|
476 |
-
body.menu-max-depth-2 { min-width: 1010px !important; }
|
477 |
-
body.menu-max-depth-3 { min-width: 1040px !important; }
|
478 |
-
body.menu-max-depth-4 { min-width: 1070px !important; }
|
479 |
-
body.menu-max-depth-5 { min-width: 1100px !important; }
|
480 |
-
body.menu-max-depth-6 { min-width: 1130px !important; }
|
481 |
-
body.menu-max-depth-7 { min-width: 1160px !important; }
|
482 |
-
body.menu-max-depth-8 { min-width: 1190px !important; }
|
483 |
-
body.menu-max-depth-9 { min-width: 1220px !important; }
|
484 |
-
body.menu-max-depth-10 { min-width: 1250px !important; }
|
485 |
-
body.menu-max-depth-11 { min-width: 1280px !important; }
|
486 |
-
|
487 |
-
/* Menu item controls */
|
488 |
-
.item-type {
|
489 |
-
font-size: 12px;
|
490 |
-
padding-right: 10px;
|
491 |
-
}
|
492 |
-
|
493 |
-
.item-controls {
|
494 |
-
font-size: 12px;
|
495 |
-
position: absolute;
|
496 |
-
right: 20px;
|
497 |
-
top: -1px;
|
498 |
-
}
|
499 |
-
|
500 |
-
.item-controls a {
|
501 |
-
text-decoration: none;
|
502 |
-
}
|
503 |
-
|
504 |
-
.item-controls a:hover {
|
505 |
-
cursor: pointer;
|
506 |
-
}
|
507 |
-
|
508 |
-
.item-controls .item-order {
|
509 |
-
padding-right: 10px;
|
510 |
-
}
|
511 |
-
|
512 |
-
.item-controls .item-order a {
|
513 |
-
font-weight:bold;
|
514 |
-
}
|
515 |
-
|
516 |
-
body.js .item-order {
|
517 |
-
display:none;
|
518 |
-
}
|
519 |
-
|
520 |
-
.item-controls .menu-item-delete:hover {
|
521 |
-
}
|
522 |
-
|
523 |
-
.item-edit {
|
524 |
-
position: absolute;
|
525 |
-
right: -20px;
|
526 |
-
top: 0;
|
527 |
-
display: block;
|
528 |
-
width:30px;
|
529 |
-
height: 36px;
|
530 |
-
overflow: hidden;
|
531 |
-
text-indent:-999em;
|
532 |
-
border-bottom: 1px solid;
|
533 |
-
-moz-border-radius-bottomleft: 3px;
|
534 |
-
-webkit-border-bottom-left-radius: 3px;
|
535 |
-
-khtml-border-bottom-left-radius: 3px;
|
536 |
-
border-bottom-left-radius: 3px;
|
537 |
-
background:url("arrows.png") no-repeat scroll 8px 10px transparent;
|
538 |
-
}
|
539 |
-
|
540 |
-
.item-edit:hover {
|
541 |
-
background:url("arrows.png") no-repeat scroll 8px 10px transparent;
|
542 |
-
}
|
543 |
-
|
544 |
-
.item-edit.opened{
|
545 |
-
background:url("arrows.png") no-repeat scroll 8px -25px transparent;
|
546 |
-
}
|
547 |
-
.item-edit.opened:hover{
|
548 |
-
background:url("arrows.png") no-repeat scroll 8px -149px transparent;
|
549 |
-
}
|
550 |
-
|
551 |
-
/* Menu editing */
|
552 |
-
.menu-instructions-inactive {
|
553 |
-
display: none;
|
554 |
-
}
|
555 |
-
|
556 |
-
.menu-item-settings {
|
557 |
-
display:block;
|
558 |
-
width: 400px;
|
559 |
-
padding: 10px 0 10px 10px;
|
560 |
-
border: solid;
|
561 |
-
border-width: 0 1px 1px 1px;
|
562 |
-
-moz-border-radius: 0 0 3px 3px;
|
563 |
-
-webkit-border-bottom-right-radius: 3px;
|
564 |
-
-webkit-border-bottom-left-radius: 3px;
|
565 |
-
-khtml-border-bottom-right-radius: 3px;
|
566 |
-
-khtml-border-bottom-left-radius: 3px;
|
567 |
-
}
|
568 |
-
|
569 |
-
.menu-item-edit-active .menu-item-settings {
|
570 |
-
display:block;
|
571 |
-
}
|
572 |
-
|
573 |
-
.menu-item-edit-inactive .menu-item-settings {
|
574 |
-
display:none;
|
575 |
-
}
|
576 |
-
|
577 |
-
.add-menu-item-pagelinks {
|
578 |
-
margin:.5em auto;
|
579 |
-
text-align:center;
|
580 |
-
}
|
581 |
-
|
582 |
-
.link-to-original {
|
583 |
-
display: block;
|
584 |
-
margin: 0 0 10px;
|
585 |
-
padding: 3px 5px 5px;
|
586 |
-
font-size: 12px;
|
587 |
-
font-style: italic;
|
588 |
-
border: 1px solid;
|
589 |
-
border-radius: 3px;
|
590 |
-
-webkit-border-radius: 3px;
|
591 |
-
-moz-border-radius: 3px;
|
592 |
-
-khtml-border-radius: 3px;
|
593 |
-
}
|
594 |
-
|
595 |
-
.link-to-original a {
|
596 |
-
padding-left: 4px;
|
597 |
-
font-style: normal;
|
598 |
-
}
|
599 |
-
|
600 |
-
.hidden-field {
|
601 |
-
display: none;
|
602 |
-
}
|
603 |
-
|
604 |
-
.menu-item-settings .description-thin,
|
605 |
-
.menu-item-settings .description-wide {
|
606 |
-
margin-right: 10px;
|
607 |
-
float: left;
|
608 |
-
}
|
609 |
-
|
610 |
-
.description-thin {
|
611 |
-
width: 190px;
|
612 |
-
height: 40px;
|
613 |
-
}
|
614 |
-
|
615 |
-
.description-wide {
|
616 |
-
width: 390px;
|
617 |
-
}
|
618 |
-
|
619 |
-
.menu-item-actions {
|
620 |
-
padding-top: 15px;
|
621 |
-
}
|
622 |
-
|
623 |
-
#cancel-save {
|
624 |
-
cursor: pointer;
|
625 |
-
}
|
626 |
-
|
627 |
-
#cancel-save:hover {
|
628 |
-
}
|
629 |
-
|
630 |
-
#update-menu-item {
|
631 |
-
}
|
632 |
-
|
633 |
-
#update-menu-item:hover,
|
634 |
-
#update-menu-item:active,
|
635 |
-
#update-menu-item:focus {
|
636 |
-
}
|
637 |
-
|
638 |
-
/* Major/minor publishing actions (classes) */
|
639 |
-
.major-publishing-actions {
|
640 |
-
clear:both;
|
641 |
-
padding: 3px 0 5px;
|
642 |
-
}
|
643 |
-
|
644 |
-
.major-publishing-actions .publishing-action {
|
645 |
-
text-align: right;
|
646 |
-
float: right;
|
647 |
-
line-height: 23px;
|
648 |
-
margin: 5px 0 1px;
|
649 |
-
}
|
650 |
-
|
651 |
-
.major-publishing-actions .delete-action {
|
652 |
-
vertical-align: middle;
|
653 |
-
text-align: left;
|
654 |
-
float: left;
|
655 |
-
padding-right: 15px;
|
656 |
-
margin-top: 5px;
|
657 |
-
}
|
658 |
-
|
659 |
-
.menu-name-label span, .auto-add-pages label {
|
660 |
-
font-size: 12px;
|
661 |
-
font-style: normal;
|
662 |
-
}
|
663 |
-
|
664 |
-
.menu-name-label {
|
665 |
-
margin-right: 15px;
|
666 |
-
}
|
667 |
-
|
668 |
-
.auto-add-pages input {
|
669 |
-
margin-top: 0;
|
670 |
-
}
|
671 |
-
|
672 |
-
.auto-add-pages {
|
673 |
-
margin-top: 4px;
|
674 |
-
float: left;
|
675 |
-
}
|
676 |
-
|
677 |
-
.submitbox .submitcancel {
|
678 |
-
border-bottom: 1px solid;
|
679 |
-
padding: 1px 2px;
|
680 |
-
text-decoration: none;
|
681 |
-
}
|
682 |
-
|
683 |
-
.submitbox .submitcancel:hover {
|
684 |
-
}
|
685 |
-
|
686 |
-
.major-publishing-actions .form-invalid {
|
687 |
-
padding-left: 4px;
|
688 |
-
margin-left: -4px;
|
689 |
-
border-radius: 3px;
|
690 |
-
-webkit-border-radius: 3px;
|
691 |
-
-moz-border-radius: 3px;
|
692 |
-
-khtml-border-radius: 3px;
|
693 |
-
}
|
694 |
-
|
695 |
-
/* Clearfix */
|
696 |
-
#menu-item-name-wrap:after,
|
697 |
-
#menu-item-url-wrap:after,
|
698 |
-
#menu-name-label:after,
|
699 |
-
#menu-settings-column .inside:after,
|
700 |
-
#nav-menus-frame:after,
|
701 |
-
#post-body-content:after,
|
702 |
-
.button-controls:after,
|
703 |
-
.major-publishing-actions:after,
|
704 |
-
.menu-item-settings:after {
|
705 |
-
clear: both;
|
706 |
-
content: ".";
|
707 |
-
display: block;
|
708 |
-
height: 0;
|
709 |
-
visibility: hidden;
|
710 |
-
}
|
711 |
-
|
712 |
-
#nav-menus-frame, .button-controls, #menu-item-url-wrap, #menu-item-name-wrap {
|
713 |
-
display: block;
|
714 |
-
}
|
715 |
-
|
716 |
-
.option .widefat{
|
717 |
-
width:345px;
|
718 |
-
margin:0 6px 7px 0;
|
719 |
-
}
|
720 |
-
|
721 |
-
.addOption, .deleteOption, .addEmail, .deleteEmail{
|
722 |
-
background:url('sprite.png') -12px -650px no-repeat transparent;
|
723 |
-
text-indent:-9999px;
|
724 |
-
width:16px;
|
725 |
-
height:16px;
|
726 |
-
display:inline-block;
|
727 |
-
}
|
728 |
-
.deleteOption, .deleteEmail{
|
729 |
-
background-position:-12px -677px;
|
730 |
-
}
|
731 |
-
.addEmail, .deleteEmail{margin-top:5px;}
|
732 |
-
|
733 |
-
.ui-state-disabled .menu-item-handle{cursor:default;}
|
734 |
-
.ui-state-disabled .menu-item-handle{
|
735 |
-
background-image: -moz-linear-gradient(top, #fff 0%, #bbb 100%);
|
736 |
-
background-image: -o-linear-gradient(top, #fff 0%, #bbb 100%);
|
737 |
-
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(1, #bbb));
|
738 |
-
background-image: linear-gradient(top, #fff 0%, #bbb 100%);
|
739 |
-
}
|
1 |
+
html,body{min-width:950px}#nav-menus-frame{margin-left:300px}#wpbody-content #menu-settings-column{display:inline;width:281px;margin-left:-300px;clear:both;float:left;padding-top:24px}.no-js #wpbody-content #menu-settings-column{padding-top:31px}#menu-settings-column .inside{clear:both}.metabox-holder-disabled .postbox{opacity:.5;filter:alpha(opacity=50)}.metabox-holder-disabled .button-controls .select-all{display:none}#wpbody{position:relative}#menu-management-liquid{float:left;min-width:100%}#menu-management{position:relative;margin-right:20px;margin-top:-3px;width:100%}#menu-management .menu-edit{border:1px solid;-moz-border-radius:3px;-webkit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;margin-bottom:20px}#post-body{padding:10px;border-width:1px 0;border-style:solid}#nav-menu-header,#nav-menu-footer{padding:0 10px}#nav-menu-header{border-bottom:1px solid}#nav-menu-footer{border-top:1px solid}#post-body div.updated,#post-body div.error{margin:0}#post-body-content{position:relative}#menu-management .menu-add-new abbr{font-weight:bold}#menu-management .nav-tabs-nav{margin:0 20px}#menu-management .nav-tabs-arrow{width:10px;padding:0 5px 4px;cursor:pointer;position:absolute;top:0;line-height:22px;font-size:18px;text-shadow:0 1px 0 #fff}#menu-management .nav-tabs-arrow-left{left:0}#menu-management .nav-tabs-arrow-right{right:0;text-align:right}#menu-management .nav-tabs-wrapper{width:100%;height:28px;margin-bottom:-1px;overflow:hidden}#menu-management .nav-tabs{padding-left:20px;padding-right:10px}.js #menu-management .nav-tabs{float:left;margin-left:0;margin-right:-400px}#menu-management .nav-tab{margin-bottom:0;font-size:14px;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif}#select-nav-menu-container{text-align:right;padding:0 10px 3px 10px;margin-bottom:5px}#select-nav-menu{width:100px;display:inline}#menu-name-label{margin-top:-2px}#wpbody .open-label{display:block;float:left}#wpbody .open-label span{padding-right:10px}.js .input-with-default-title{font-style:italic}#menu-management .inside{padding:0 10px}.postbox .howto input{width:180px;float:right}.customlinkdiv .howto input{width:200px}#nav-menu-theme-locations .howto select{width:100%}#nav-menu-theme-locations .button-controls{text-align:right}.add-menu-item-view-all{height:400px}#menu-container .submit{margin:0 0 10px;padding:0}.meta-sep,.submitdelete,.submitcancel{display:block;float:left;font-size:12px;margin:4px 0;line-height:15px}.meta-sep{padding:0 2px}#cancel-save{text-decoration:underline;font-size:12px;margin-left:20px;margin-top:5px}.list-controls{float:left;margin-top:5px}.add-to-menu{float:right}.postbox img.waiting{display:none;vertical-align:middle}.button-controls{clear:both;margin:10px 0}.show-all,.hide-all{cursor:pointer}.hide-all{display:none}#menu-name{width:270px}#manage-menu .inside{padding:0}#available-links dt{display:block}#add-custom-link .howto{font-size:12px}#add-custom-link label span{display:block;float:left;margin-top:5px;padding-right:5px}.menu-item-textbox{width:180px}.howto span{margin-top:4px;display:block;float:left}.quick-search{width:190px}.list-wrap{display:none;clear:both;margin-bottom:10px}.list-container{max-height:200px;overflow-y:auto;padding:10px 10px 5px;border:1px solid;-moz-border-radius:3px}.postbox p.submit{margin-bottom:0}.list li{display:none;margin:0;margin-bottom:5px}.list li .menu-item-title{cursor:pointer;display:block}.list li .menu-item-title input{margin-right:3px;margin-top:-3px}#menu-container .inside{padding-bottom:10px}.menu{padding-top:1em}#menu-to-edit{padding:1em 0}.menu ul{width:100%}.menu li{margin-bottom:0;position:relative}.menu-item-bar{clear:both;line-height:1.5em;position:relative;margin-top:13px}.menu-item-handle{border:1px solid #dfdfdf;position:relative;padding-left:10px;height:auto;width:400px;line-height:35px;text-shadow:0 1px 0 #fff;overflow:hidden;word-wrap:break-word;border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px}#menu-to-edit .menu-item-invalid .menu-item-handle{background-color:#f6c9cc;background-image:-ms-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:-moz-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:-o-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:-webkit-gradient(linear,left bottom,left top,from(#f6c9cc),to(#fdf8ff));background-image:-webkit-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:linear-gradient(bottom,#f6c9cc,#fdf8ff)}.menu-item-edit-active .menu-item-handle{-moz-border-radius:3px 3px 0 0;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:0;-khtml-border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.no-js .menu-item-edit-active .item-edit{display:none}.js .menu-item-handle{cursor:move}.menu li.deleting .menu-item-handle{background-image:none;text-shadow:0}.menu-item-handle .item-title{font-size:12px;font-weight:bold;padding:7px 0;line-height:20px;display:block;margin-right:13em}li.menu-item.ui-sortable-helper dl{margin-top:0}li.menu-item.ui-sortable-helper .menu-item-transport dl{margin-top:13px}.menu .sortable-placeholder{height:35px;width:410px;margin-top:13px}.menu-item-depth-0{margin-left:0}.menu-item-depth-1{margin-left:30px}.menu-item-depth-2{margin-left:60px}.menu-item-depth-3{margin-left:90px}.menu-item-depth-4{margin-left:120px}.menu-item-depth-5{margin-left:150px}.menu-item-depth-6{margin-left:180px}.menu-item-depth-7{margin-left:210px}.menu-item-depth-8{margin-left:240px}.menu-item-depth-9{margin-left:270px}.menu-item-depth-10{margin-left:300px}.menu-item-depth-11{margin-left:330px}.menu-item-depth-0 .menu-item-transport{margin-left:0}.menu-item-depth-1 .menu-item-transport{margin-left:-30px}.menu-item-depth-2 .menu-item-transport{margin-left:-60px}.menu-item-depth-3 .menu-item-transport{margin-left:-90px}.menu-item-depth-4 .menu-item-transport{margin-left:-120px}.menu-item-depth-5 .menu-item-transport{margin-left:-150px}.menu-item-depth-6 .menu-item-transport{margin-left:-180px}.menu-item-depth-7 .menu-item-transport{margin-left:-210px}.menu-item-depth-8 .menu-item-transport{margin-left:-240px}.menu-item-depth-9 .menu-item-transport{margin-left:-270px}.menu-item-depth-10 .menu-item-transport{margin-left:-300px}.menu-item-depth-11 .menu-item-transport{margin-left:-330px}body.menu-max-depth-0{min-width:950px!important}body.menu-max-depth-1{min-width:980px!important}body.menu-max-depth-2{min-width:1010px!important}body.menu-max-depth-3{min-width:1040px!important}body.menu-max-depth-4{min-width:1070px!important}body.menu-max-depth-5{min-width:1100px!important}body.menu-max-depth-6{min-width:1130px!important}body.menu-max-depth-7{min-width:1160px!important}body.menu-max-depth-8{min-width:1190px!important}body.menu-max-depth-9{min-width:1220px!important}body.menu-max-depth-10{min-width:1250px!important}body.menu-max-depth-11{min-width:1280px!important}.item-type{font-size:12px;padding-right:10px}.item-controls{font-size:12px;position:absolute;right:20px;top:0}.item-controls a{text-decoration:none}.item-controls a:hover{cursor:pointer}.item-controls .item-order{padding-right:10px}.item-controls .item-order a{font-weight:bold}body.js .item-order{display:none}.item-edit{position:absolute;right:-20px;top:0;display:block;width:30px;height:36px;overflow:hidden;text-indent:-999em;border-bottom:1px solid;-moz-border-radius-bottomleft:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-left-radius:3px;background:url("arrows.png") no-repeat scroll 8px 10px transparent}.item-edit:hover{background:url("arrows.png") no-repeat scroll 8px 10px transparent}.item-edit.opened{background:url("arrows.png") no-repeat scroll 8px -25px transparent}.item-edit.opened:hover{background:url("arrows.png") no-repeat scroll 8px -149px transparent}.menu-instructions-inactive{display:none}.menu-item-settings{display:block;width:400px;padding:10px 0 10px 10px;border:solid;border-width:0 1px 1px 1px;-moz-border-radius:0 0 3px 3px;-webkit-border-bottom-right-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-right-radius:3px;-khtml-border-bottom-left-radius:3px}.menu-item-edit-active .menu-item-settings{display:block}.menu-item-edit-inactive .menu-item-settings{display:none}.add-menu-item-pagelinks{margin:.5em auto;text-align:center}.link-to-original{display:block;margin:0 0 10px;padding:3px 5px 5px;font-size:12px;font-style:italic;border:1px solid;border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px}.link-to-original a{padding-left:4px;font-style:normal}.hidden-field{display:none}.menu-item-settings .description-thin,.menu-item-settings .description-wide{margin-right:10px;float:left}.description-thin{width:190px;height:40px}.description-wide{width:390px}.menu-item-actions{padding-top:15px}#cancel-save{cursor:pointer}.major-publishing-actions{clear:both;padding:3px 0 5px}.major-publishing-actions .publishing-action{text-align:right;float:right;line-height:23px;margin:5px 0 1px}.major-publishing-actions .delete-action{vertical-align:middle;text-align:left;float:left;padding-right:15px;margin-top:5px}.menu-name-label span,.auto-add-pages label{font-size:12px;font-style:normal}.menu-name-label{margin-right:15px}.auto-add-pages input{margin-top:0}.auto-add-pages{margin-top:4px;float:left}.submitbox .submitcancel{border-bottom:1px solid;padding:1px 2px;text-decoration:none}.major-publishing-actions .form-invalid{padding-left:4px;margin-left:-4px;border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px}#menu-item-name-wrap:after,#menu-item-url-wrap:after,#menu-name-label:after,#menu-settings-column .inside:after,#nav-menus-frame:after,#post-body-content:after,.button-controls:after,.major-publishing-actions:after,.menu-item-settings:after{clear:both;content:".";display:block;height:0;visibility:hidden}#nav-menus-frame,.button-controls,#menu-item-url-wrap,#menu-item-name-wrap{display:block}.option .widefat{width:345px;margin:0 6px 7px 0}.addOption,.deleteOption,.addEmail,.deleteEmail{background:url('sprite.png') -12px -650px no-repeat transparent;text-indent:-9999px;width:16px;height:16px;display:inline-block}.deleteOption,.deleteEmail{background-position:-12px -677px}.addEmail,.deleteEmail{margin-top:5px}.ui-state-disabled .menu-item-handle{cursor:default}.ui-state-disabled .menu-item-handle{background-image:-moz-linear-gradient(top,#fff 0,#bbb 100%);background-image:-o-linear-gradient(top,#fff 0,#bbb 100%);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fff),color-stop(1,#bbb));background-image:linear-gradient(top,#fff 0,#bbb 100%)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/visual-form-builder-admin.css
CHANGED
@@ -1,61 +1 @@
|
|
1 |
-
label.error{color:red;display:block;}
|
2 |
-
#visual-form-builder-update input.error, #visual-form-builder-update textarea.error, #visual-form-builder-update select.error{border:1px solid red;}
|
3 |
-
.menu-item-handle.fieldset, #form-element-fieldset{
|
4 |
-
background-image: -moz-linear-gradient(top, #E3E3E3 0%, #CCCCCC 100%);
|
5 |
-
background-image: -o-linear-gradient(top, #E3E3E3 0%, #CCCCCC 100%);
|
6 |
-
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #E3E3E3), color-stop(1, #CCCCCC));
|
7 |
-
background-image: linear-gradient(top, #E3E3E3 0%, #CCCCCC 100%);
|
8 |
-
box-shadow:0 1px 0 #e3e3e3 inset;
|
9 |
-
}
|
10 |
-
.sender-labels{width:80px;}
|
11 |
-
.is-field-required{color:#BC1212; vertical-align:middle;}
|
12 |
-
.visual-form-builder-inline-edit{width:100%;}
|
13 |
-
.visual-form-builder-inline-edit-col{padding:0 0.5em;}
|
14 |
-
.visual-form-builder-inline-edit label{display:block;margin:0.2em 0;}
|
15 |
-
.visual-form-builder-inline-edit .title{display:block;float:left;width:5em;font-style:italic;}
|
16 |
-
.visual-form-builder-inline-edit .input-text-wrap{display:block;margin-left:5em;}
|
17 |
-
.visual-form-builder-inline-edit .input-text-wrap input[type="text"]{width:100%;border:#DDD solid 1px;border-radius:3px;}
|
18 |
-
.subsubsub{float:none;}
|
19 |
-
.nav-tabs-arrow-left{display:none;}
|
20 |
-
#form-items input{width:104px;float:left;margin:0 5px 10px 0;}
|
21 |
-
#form-element-text{background:url(sprite.png) 0 -89px no-repeat transparent;}
|
22 |
-
#form-element-textarea{background:url(sprite.png) 0 -173px no-repeat transparent;}
|
23 |
-
#form-element-checkbox{background:url(sprite.png) 0 -259px no-repeat transparent;}
|
24 |
-
#form-element-radio{background:url(sprite.png) 0 -51px no-repeat transparent;}
|
25 |
-
#form-element-select{background:url(sprite.png) 0 -7px no-repeat transparent;}
|
26 |
-
#form-element-address{background:url(sprite.png) 0 -129px no-repeat transparent;}
|
27 |
-
#form-element-datepicker{background:url(sprite.png) 0 -215px no-repeat transparent;}
|
28 |
-
#form-element-email{background:url(sprite.png) 0 -304px no-repeat transparent;}
|
29 |
-
#form-element-url{background:url(sprite.png) 0 -356px no-repeat transparent;}
|
30 |
-
#form-element-currency{background:url(sprite.png) 0 -405px no-repeat transparent;}
|
31 |
-
#form-element-digits{background:url(sprite.png) 0 -452px no-repeat transparent;}
|
32 |
-
#form-element-time{background:url(sprite.png) 0 -489px no-repeat transparent;}
|
33 |
-
#form-element-phone{background:url(sprite.png) 0 -529px no-repeat transparent;}
|
34 |
-
#form-element-html{background:url(sprite.png) 0 -559px no-repeat transparent;}
|
35 |
-
#form-element-file{background:url(sprite.png) 0 -587px no-repeat transparent;}
|
36 |
-
#form-element-instructions{background:url(sprite.png) 0 -621px no-repeat transparent;}
|
37 |
-
#form-details-nav{font-size:1.0em;font-weight:bold;padding-top:10px;}
|
38 |
-
#form-details-nav a{padding:5px 10px;text-decoration:none;}
|
39 |
-
#form-details-nav a.current{
|
40 |
-
background-color:#777;
|
41 |
-
background-image: -ms-linear-gradient(bottom, #6d6d6d, #808080); /* IE10 */
|
42 |
-
background-image: -moz-linear-gradient(bottom, #6d6d6d, #808080); /* Firefox */
|
43 |
-
background-image: -o-linear-gradient(bottom, #6d6d6d, #808080); /* Opera */
|
44 |
-
background-image: -webkit-gradient(linear, left bottom, left top, from(#6d6d6d), to(#808080)); /* old Webkit */
|
45 |
-
background-image: -webkit-linear-gradient(bottom, #6d6d6d, #808080); /* new Webkit */
|
46 |
-
background-image: linear-gradient(bottom, #6d6d6d, #808080); /* proposed W3C Markup */
|
47 |
-
color:white;
|
48 |
-
border-radius:5px;
|
49 |
-
height:40px;
|
50 |
-
text-shadow:0 -1px 0 #333333;
|
51 |
-
border-color: #dfdfdf;
|
52 |
-
}
|
53 |
-
.form-details, #form-success-message-text, #form-success-message-page, #form-success-message-redirect{display:none;}
|
54 |
-
.form-details-current, .active{display:block;}
|
55 |
-
#confirmation-message textarea, #notification textarea{font-family:Consolas,Monaco,monospace;width:75%;height:10em;margin-top:10px;}
|
56 |
-
#form-success-message-page, #form-success-message-redirect{margin-top:10px;}
|
57 |
-
.post-body-plain ol li{list-style:decimal;}
|
58 |
-
#promote-vfb li{padding-left:20px;}
|
59 |
-
#promote-vfb #twitter{background:url(sprite.png) -10px -746px no-repeat transparent;}
|
60 |
-
#promote-vfb #star{background:url(sprite.png) -10px -710px no-repeat transparent;}
|
61 |
-
#promote-vfb #paypal{background:url(sprite.png) -10px -773px no-repeat transparent;}
|
1 |
+
label.error{color:red;display:block}#visual-form-builder-update input.error,#visual-form-builder-update textarea.error,#visual-form-builder-update select.error{border:1px solid red}.menu-item-handle.fieldset,#form-element-fieldset{background-image:-moz-linear-gradient(top,#e3e3e3 0,#ccc 100%);background-image:-o-linear-gradient(top,#e3e3e3 0,#ccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#e3e3e3),color-stop(1,#ccc));background-image:linear-gradient(top,#e3e3e3 0,#ccc 100%);box-shadow:0 1px 0 #e3e3e3 inset}.sender-labels{width:80px}.is-field-required{color:#bc1212;vertical-align:middle}.visual-form-builder-inline-edit{width:100%}.visual-form-builder-inline-edit-col{padding:0 .5em}.visual-form-builder-inline-edit label{display:block;margin:.2em 0}.visual-form-builder-inline-edit .title{display:block;float:left;width:5em;font-style:italic}.visual-form-builder-inline-edit .input-text-wrap{display:block;margin-left:5em}.visual-form-builder-inline-edit .input-text-wrap input[type="text"]{width:100%;border:#DDD solid 1px;border-radius:3px}.subsubsub{float:none}.nav-tabs-arrow-left{display:none}#form-items input{width:104px;float:left;margin:0 5px 10px 0}#form-element-text{background:url(sprite.png) 0 -89px no-repeat transparent}#form-element-textarea{background:url(sprite.png) 0 -173px no-repeat transparent}#form-element-checkbox{background:url(sprite.png) 0 -259px no-repeat transparent}#form-element-radio{background:url(sprite.png) 0 -51px no-repeat transparent}#form-element-select{background:url(sprite.png) 0 -7px no-repeat transparent}#form-element-address{background:url(sprite.png) 0 -129px no-repeat transparent}#form-element-datepicker{background:url(sprite.png) 0 -215px no-repeat transparent}#form-element-email{background:url(sprite.png) 0 -304px no-repeat transparent}#form-element-url{background:url(sprite.png) 0 -356px no-repeat transparent}#form-element-currency{background:url(sprite.png) 0 -405px no-repeat transparent}#form-element-digits{background:url(sprite.png) 0 -452px no-repeat transparent}#form-element-time{background:url(sprite.png) 0 -489px no-repeat transparent}#form-element-phone{background:url(sprite.png) 0 -529px no-repeat transparent}#form-element-html{background:url(sprite.png) 0 -559px no-repeat transparent}#form-element-file{background:url(sprite.png) 0 -587px no-repeat transparent}#form-element-instructions{background:url(sprite.png) 0 -621px no-repeat transparent}#form-element-section{background:url(sprite.png) 0 -809px no-repeat transparent}#form-details-nav{font-size:1.0em;font-weight:bold;padding-top:10px}#form-details-nav a{padding:5px 10px;text-decoration:none}#form-details-nav a.current{background-color:#777;background-image:-ms-linear-gradient(bottom,#6d6d6d,#808080);background-image:-moz-linear-gradient(bottom,#6d6d6d,#808080);background-image:-o-linear-gradient(bottom,#6d6d6d,#808080);background-image:-webkit-gradient(linear,left bottom,left top,from(#6d6d6d),to(#808080));background-image:-webkit-linear-gradient(bottom,#6d6d6d,#808080);background-image:linear-gradient(bottom,#6d6d6d,#808080);color:white;border-radius:5px;height:40px;text-shadow:0 -1px 0 #333;border-color:#dfdfdf}.form-details,#form-success-message-text,#form-success-message-page,#form-success-message-redirect{display:none}.form-details-current,.active{display:block}#confirmation-message textarea,#notification textarea{font-family:Consolas,Monaco,monospace;width:75%;height:10em;margin-top:10px}#form-success-message-page,#form-success-message-redirect{margin-top:10px}.post-body-plain ol li{list-style:decimal}#promote-vfb li{padding-left:20px}#promote-vfb #twitter{background:url(sprite.png) -10px -746px no-repeat transparent}#promote-vfb #star{background:url(sprite.png) -10px -710px no-repeat transparent}#promote-vfb #paypal{background:url(sprite.png) -10px -777px no-repeat transparent}.menu .ui-nestedSortable-error{background-color:#fbe3e4;border-color:red;color:#8a1f11}ul#menu-to-edit ul{margin:0 0 0 25px;padding:0;list-style-type:none;width:98%}.vfb-details{padding:0 10px;border:1px solid #ccc;margin-bottom:10px;border-radius:3px;width:95%}.vfb-details.section{background-color:#efefef;width:97.55%}.vfb-details .postbox{min-height:60px}#poststuff .vfb-details h2{margin-top:0}#poststuff h3.section-heading{padding-left:0}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/visual-form-builder.css
CHANGED
@@ -117,4 +117,11 @@ p#form_success{
|
|
117 |
.ed_button.ed_italic{font-style:italic;}
|
118 |
.ed_button.ed_link{color:#0000FF;text-decoration:underline;}
|
119 |
.ed_button.ed_del{text-decoration:line-through;}
|
120 |
-
.item-instructions{background-color:#e3e3e3;border-radius:3px;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
.ed_button.ed_italic{font-style:italic;}
|
118 |
.ed_button.ed_link{color:#0000FF;text-decoration:underline;}
|
119 |
.ed_button.ed_del{text-decoration:line-through;}
|
120 |
+
.item-instructions{background-color:#e3e3e3;border-radius:3px;}
|
121 |
+
.section-div{
|
122 |
+
background-color:#D4D4D4;
|
123 |
+
border-radius:3px;
|
124 |
+
padding:10px;
|
125 |
+
margin:10px 0;
|
126 |
+
}
|
127 |
+
.section-div h4{font-size:16px;border-bottom:1px solid #BABABA;}
|
js/jquery.ui.nestedSortable.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
(function(a){a.widget("ui.nestedSortable",a.extend({},a.ui.sortable.prototype,{options:{tabSize:20,disableNesting:"ui-nestedSortable-no-nesting",errorClass:"ui-nestedSortable-error",listType:"ol",maxLevels:0,revertOnError:1},_create:function(){this.element.data("sortable",this.element.data("nestedSortable"));return a.ui.sortable.prototype._create.apply(this,arguments)},destroy:function(){this.element.removeData("nestedSortable").unbind(".nestedSortable");return a.ui.sortable.prototype.destroy.apply(this,arguments)},_mouseDrag:function(b){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var c=this.options,d=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY<c.scrollSensitivity)this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop+c.scrollSpeed;else if(b.pageY-this.overflowOffset.top<c.scrollSensitivity)this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop-c.scrollSpeed;if(this.overflowOffset.left+this.scrollParent[0].offsetWidth-b.pageX<c.scrollSensitivity)this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft+c.scrollSpeed;else if(b.pageX-this.overflowOffset.left<c.scrollSensitivity)this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(b.pageY-a(document).scrollTop()<c.scrollSensitivity)d=a(document).scrollTop(a(document).scrollTop()-c.scrollSpeed);else if(a(window).height()-(b.pageY-a(document).scrollTop())<c.scrollSensitivity)d=a(document).scrollTop(a(document).scrollTop()+c.scrollSpeed);if(b.pageX-a(document).scrollLeft()<c.scrollSensitivity)d=a(document).scrollLeft(a(document).scrollLeft()-c.scrollSpeed);else if(a(window).width()-(b.pageX-a(document).scrollLeft())<c.scrollSensitivity)d=a(document).scrollLeft(a(document).scrollLeft()+c.scrollSpeed)}if(d!==false&&a.ui.ddmanager&&!c.dropBehaviour)a.ui.ddmanager.prepareOffsets(this,b)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(var e=this.items.length-1;e>=0;e--){var f=this.items[e],g=f.item[0],h=this._intersectsWithPointer(f);if(!h)continue;if(g!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=g&&!a.contains(this.placeholder[0],g)&&(this.options.type=="semi-dynamic"?!a.contains(this.element[0],g):true)){a(g).mouseenter();this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(f)){a(g).mouseleave();this._rearrange(b,f)}else{break}this._clearEmpty(g);this._trigger("change",b,this._uiHash());break}}var i=this.placeholder[0].parentNode.parentNode&&a(this.placeholder[0].parentNode.parentNode).closest(".ui-sortable").length?a(this.placeholder[0].parentNode.parentNode):null,j=this._getLevel(this.placeholder),k=this._getChildLevels(this.helper),l=this.placeholder[0].previousSibling?a(this.placeholder[0].previousSibling):null;if(l!=null){while(l[0].nodeName.toLowerCase()!="li"||l[0]==this.currentItem[0]){if(l[0].previousSibling){l=a(l[0].previousSibling)}else{l=null;break}}}newList=document.createElement(c.listType);this.beyondMaxLevels=0;if(i!=null&&this.positionAbs.left<i.offset().left){i.after(this.placeholder[0]);this._clearEmpty(i[0]);this._trigger("change",b,this._uiHash())}else if(l!=null&&this.positionAbs.left>l.offset().left+c.tabSize){this._isAllowed(l,j+k+1);if(!l.children(c.listType).length){l[0].appendChild(newList)}l.children(c.listType)[0].appendChild(this.placeholder[0]);this._trigger("change",b,this._uiHash())}else{this._isAllowed(i,j+k)}this._contactContainers(b);if(a.ui.ddmanager)a.ui.ddmanager.drag(this,b);this._trigger("sort",b,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(b,c){if(this.beyondMaxLevels){this.placeholder.removeClass(this.options.errorClass);if(this.options.revertOnError){if(this.domPosition.prev){a(this.domPosition.prev).after(this.placeholder)}else{a(this.domPosition.parent).prepend(this.placeholder)}this._trigger("revert",b,this._uiHash())}else{var d=this.placeholder.parent().closest(this.options.items);for(var e=this.beyondMaxLevels-1;e>0;e--){d=d.parent().closest(this.options.items)}d.after(this.placeholder);this._trigger("change",b,this._uiHash())}}for(var e=this.items.length-1;e>=0;e--){var f=this.items[e].item[0];this._clearEmpty(f)}a.ui.sortable.prototype._mouseStop.apply(this,arguments)},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];b=b||{};a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/),e=(a(b.item||this).parent(b.listType).parent("li").attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);if(c){d.push((b.key||c[1]+"["+(b.key&&b.expression?c[1]:c[2])+"]")+"="+(e?b.key&&b.expression?e[1]:e[2]:"root"))}});if(!d.length&&b.key){d.push(b.key+"=")}return d.join("&")},toHierarchy:function(b){function e(c){var d=(a(c).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);if(d){var f={id:d[2]};if(a(c).children(b.listType).children("li").length>0){f.children=[];a(c).children(b.listType).children("li").each(function(){var b=e(a(this));f.children.push(b)})}return f}}b=b||{};var c=b.startDepthCount||0,d=[];a(this.element).children("li").each(function(){var b=e(a(this));d.push(b)});return d},toArray:function(b){function f(e,g,h){var i=h+1,j,k;if(a(e).children(b.listType).children("li").length>0){g++;a(e).children(b.listType).children("li").each(function(){i=f(a(this),g,i)});g--}j=a(e).attr(b.attribute||"id").match(b.expression||/(.+)[-=_](.+)/);if(g===c+1){k="root"}else{var l=a(e).parent(b.listType).parent("li").attr(b.attribute||"id").match(b.expression||/(.+)[-=_](.+)/);k=l[2]}if(j){d.push({item_id:j[2],parent_id:k,depth:g,left:h,right:i})}h=i+1;return h}b=b||{};var c=b.startDepthCount||0,d=[],e=2;d.push({item_id:"root",parent_id:"none",depth:c,left:"1",right:(a("li",this.element).length+1)*2});a(this.element).children("li").each(function(){e=f(this,c+1,e)});d=d.sort(function(a,b){return a.left-b.left});return d},_clearEmpty:function(b){var c=a(b).children(this.options.listType);if(c.length&&!c.children().length){c.remove()}},_getLevel:function(a){var b=1;if(this.options.listType){var c=a.closest(this.options.listType);while(!c.is(".ui-sortable")){b++;c=c.parent().closest(this.options.listType)}}return b},_getChildLevels:function(b,c){var d=this,e=this.options,f=0;c=c||0;a(b).children(e.listType).children(e.items).each(function(a,b){f=Math.max(d._getChildLevels(b,c+1),f)});return c?f+1:f},_isAllowed:function(a,b){var c=this.options;if(a==null||!a.hasClass(c.disableNesting)){if(c.maxLevels<b&&c.maxLevels!=0){this.placeholder.addClass(c.errorClass);this.beyondMaxLevels=b-c.maxLevels}else{this.placeholder.removeClass(c.errorClass);this.beyondMaxLevels=0}}else{this.placeholder.addClass(c.errorClass);if(c.maxLevels<b&&c.maxLevels!=0){this.beyondMaxLevels=b-c.maxLevels}else{this.beyondMaxLevels=1}}}}));a.ui.nestedSortable.prototype.options=a.extend({},a.ui.sortable.prototype.options,a.ui.nestedSortable.prototype.options)})(jQuery)
|
js/js_quicktags.js
CHANGED
@@ -1,544 +1 @@
|
|
1 |
-
|
2 |
-
//
|
3 |
-
// Copyright (c) 2002-2008 Alex King
|
4 |
-
// http://alexking.org/projects/js-quicktags
|
5 |
-
//
|
6 |
-
// Thanks to Greg Heo <greg@node79.com> for his changes
|
7 |
-
// to support multiple toolbars per page.
|
8 |
-
//
|
9 |
-
// Licensed under the LGPL license
|
10 |
-
// http://www.gnu.org/copyleft/lesser.html
|
11 |
-
//
|
12 |
-
// **********************************************************************
|
13 |
-
// This program is distributed in the hope that it will be useful, but
|
14 |
-
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
16 |
-
// **********************************************************************
|
17 |
-
//
|
18 |
-
// This JavaScript will insert the tags below at the cursor position in IE and
|
19 |
-
// Gecko-based browsers (Mozilla, Camino, Firefox, Netscape). For browsers that
|
20 |
-
// do not support inserting at the cursor position (older versions of Safari,
|
21 |
-
// OmniWeb) it appends the tags to the end of the content.
|
22 |
-
//
|
23 |
-
// Pass the ID of the <textarea> element to the edToolbar and function.
|
24 |
-
//
|
25 |
-
// Example:
|
26 |
-
//
|
27 |
-
// <script type="text/javascript">edToolbar('canvas');</script>
|
28 |
-
// <textarea id="canvas" rows="20" cols="50"></textarea>
|
29 |
-
//
|
30 |
-
|
31 |
-
var dictionaryUrl = 'http://www.ninjawords.com/';
|
32 |
-
|
33 |
-
// other options include:
|
34 |
-
//
|
35 |
-
// var dictionaryUrl = 'http://www.answers.com/';
|
36 |
-
// var dictionaryUrl = 'http://www.dictionary.com/';
|
37 |
-
|
38 |
-
var edButtons = new Array();
|
39 |
-
var edLinks = new Array();
|
40 |
-
var edOpenTags = new Array();
|
41 |
-
|
42 |
-
function edButton(id, display, tagStart, tagEnd, access, open) {
|
43 |
-
this.id = id; // used to name the toolbar button
|
44 |
-
this.display = display; // label on button
|
45 |
-
this.tagStart = tagStart; // open tag
|
46 |
-
this.tagEnd = tagEnd; // close tag
|
47 |
-
this.access = access; // set to -1 if tag does not need to be closed
|
48 |
-
this.open = open; // set to -1 if tag does not need to be closed
|
49 |
-
}
|
50 |
-
|
51 |
-
edButtons.push(
|
52 |
-
new edButton(
|
53 |
-
'ed_bold'
|
54 |
-
,'B'
|
55 |
-
,'<strong>'
|
56 |
-
,'</strong>'
|
57 |
-
,'b'
|
58 |
-
)
|
59 |
-
);
|
60 |
-
|
61 |
-
edButtons.push(
|
62 |
-
new edButton(
|
63 |
-
'ed_italic'
|
64 |
-
,'I'
|
65 |
-
,'<em>'
|
66 |
-
,'</em>'
|
67 |
-
,'i'
|
68 |
-
)
|
69 |
-
);
|
70 |
-
|
71 |
-
edButtons.push(
|
72 |
-
new edButton(
|
73 |
-
'ed_link'
|
74 |
-
,'Link'
|
75 |
-
,''
|
76 |
-
,'</a>'
|
77 |
-
,'a'
|
78 |
-
)
|
79 |
-
); // special case
|
80 |
-
|
81 |
-
edButtons.push(
|
82 |
-
new edButton(
|
83 |
-
'ed_block'
|
84 |
-
,'B-QUOTE'
|
85 |
-
,'<blockquote>'
|
86 |
-
,'</blockquote>'
|
87 |
-
,'q'
|
88 |
-
)
|
89 |
-
);
|
90 |
-
|
91 |
-
edButtons.push(
|
92 |
-
new edButton(
|
93 |
-
'ed_img'
|
94 |
-
,'IMG'
|
95 |
-
,''
|
96 |
-
,''
|
97 |
-
,'m'
|
98 |
-
,-1
|
99 |
-
)
|
100 |
-
); // special case
|
101 |
-
|
102 |
-
edButtons.push(
|
103 |
-
new edButton(
|
104 |
-
'ed_ul'
|
105 |
-
,'UL'
|
106 |
-
,'<ul>\n'
|
107 |
-
,'</ul>\n\n'
|
108 |
-
,'u'
|
109 |
-
)
|
110 |
-
);
|
111 |
-
|
112 |
-
edButtons.push(
|
113 |
-
new edButton(
|
114 |
-
'ed_ol'
|
115 |
-
,'OL'
|
116 |
-
,'<ol>\n'
|
117 |
-
,'</ol>\n\n'
|
118 |
-
,'o'
|
119 |
-
)
|
120 |
-
);
|
121 |
-
|
122 |
-
edButtons.push(
|
123 |
-
new edButton(
|
124 |
-
'ed_li'
|
125 |
-
,'LI'
|
126 |
-
,'\t<li>'
|
127 |
-
,'</li>\n'
|
128 |
-
,'l'
|
129 |
-
)
|
130 |
-
);
|
131 |
-
|
132 |
-
edButtons.push(
|
133 |
-
new edButton(
|
134 |
-
'ed_code'
|
135 |
-
,'CODE'
|
136 |
-
,'<code>'
|
137 |
-
,'</code>'
|
138 |
-
,'c'
|
139 |
-
)
|
140 |
-
);
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
var extendedStart = edButtons.length;
|
147 |
-
|
148 |
-
function edLink(display, URL, newWin) {
|
149 |
-
this.display = display;
|
150 |
-
this.URL = URL;
|
151 |
-
if (!newWin) {
|
152 |
-
newWin = 0;
|
153 |
-
}
|
154 |
-
this.newWin = newWin;
|
155 |
-
}
|
156 |
-
|
157 |
-
|
158 |
-
edLinks[edLinks.length] = new edLink('alexking.org'
|
159 |
-
,'http://www.alexking.org/'
|
160 |
-
);
|
161 |
-
|
162 |
-
function edShowButton(which, button, i) {
|
163 |
-
if (button.access) {
|
164 |
-
var accesskey = ' accesskey = "' + button.access + '"'
|
165 |
-
}
|
166 |
-
else {
|
167 |
-
var accesskey = '';
|
168 |
-
}
|
169 |
-
switch (button.id) {
|
170 |
-
case 'ed_img':
|
171 |
-
document.write('<input type="button" id="' + button.id + '_' + which + '" ' + accesskey + ' class="ed_button ' + button.id + '" onclick="edInsertImage(\'' + which + '\');" value="' + button.display + '" />');
|
172 |
-
break;
|
173 |
-
case 'ed_link':
|
174 |
-
document.write('<input type="button" id="' + button.id + '_' + which + '" ' + accesskey + ' class="ed_button ' + button.id + '" onclick="edInsertLink(\'' + which + '\', ' + i + ');" value="' + button.display + '" />');
|
175 |
-
break;
|
176 |
-
case 'ed_ext_link':
|
177 |
-
document.write('<input type="button" id="' + button.id + '_' + which + '" ' + accesskey + ' class="ed_button ' + button.id + '" onclick="edInsertExtLink(\'' + which + '\', ' + i + ');" value="' + button.display + '" />');
|
178 |
-
break;
|
179 |
-
case 'ed_footnote':
|
180 |
-
document.write('<input type="button" id="' + button.id + '_' + which + '" ' + accesskey + ' class="ed_button ' + button.id + '" onclick="edInsertFootnote(\'' + which + '\');" value="' + button.display + '" />');
|
181 |
-
break;
|
182 |
-
case 'ed_via':
|
183 |
-
document.write('<input type="button" id="' + button.id + '_' + which + '" ' + accesskey + ' class="ed_button ' + button.id + '" onclick="edInsertVia(\'' + which + '\');" value="' + button.display + '" />');
|
184 |
-
break;
|
185 |
-
default:
|
186 |
-
document.write('<input type="button" id="' + button.id + '_' + which + '" ' + accesskey + ' class="ed_button ' + button.id + '" onclick="edInsertTag(\'' + which + '\', ' + i + ');" value="' + button.display + '" />');
|
187 |
-
break;
|
188 |
-
}
|
189 |
-
}
|
190 |
-
|
191 |
-
function edShowLinks() {
|
192 |
-
var tempStr = '<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>(Quick Links)</option>';
|
193 |
-
for (i = 0; i < edLinks.length; i++) {
|
194 |
-
tempStr += '<option value="' + i + '">' + edLinks[i].display + '</option>';
|
195 |
-
}
|
196 |
-
tempStr += '</select>';
|
197 |
-
document.write(tempStr);
|
198 |
-
}
|
199 |
-
|
200 |
-
function edAddTag(which, button) {
|
201 |
-
if (edButtons[button].tagEnd != '') {
|
202 |
-
edOpenTags[which][edOpenTags[which].length] = button;
|
203 |
-
document.getElementById(edButtons[button].id + '_' + which).value = '/' + document.getElementById(edButtons[button].id + '_' + which).value;
|
204 |
-
}
|
205 |
-
}
|
206 |
-
|
207 |
-
function edRemoveTag(which, button) {
|
208 |
-
for (i = 0; i < edOpenTags[which].length; i++) {
|
209 |
-
if (edOpenTags[which][i] == button) {
|
210 |
-
edOpenTags[which].splice(i, 1);
|
211 |
-
document.getElementById(edButtons[button].id + '_' + which).value = document.getElementById(edButtons[button].id + '_' + which).value.replace('/', '');
|
212 |
-
}
|
213 |
-
}
|
214 |
-
}
|
215 |
-
|
216 |
-
function edCheckOpenTags(which, button) {
|
217 |
-
var tag = 0;
|
218 |
-
for (i = 0; i < edOpenTags[which].length; i++) {
|
219 |
-
if (edOpenTags[which][i] == button) {
|
220 |
-
tag++;
|
221 |
-
}
|
222 |
-
}
|
223 |
-
if (tag > 0) {
|
224 |
-
return true; // tag found
|
225 |
-
}
|
226 |
-
else {
|
227 |
-
return false; // tag not found
|
228 |
-
}
|
229 |
-
}
|
230 |
-
|
231 |
-
function edCloseAllTags(which) {
|
232 |
-
var count = edOpenTags[which].length;
|
233 |
-
for (o = 0; o < count; o++) {
|
234 |
-
edInsertTag(which, edOpenTags[which][edOpenTags[which].length - 1]);
|
235 |
-
}
|
236 |
-
}
|
237 |
-
|
238 |
-
function edQuickLink(i, thisSelect) {
|
239 |
-
if (i > -1) {
|
240 |
-
var newWin = '';
|
241 |
-
if (edLinks[i].newWin == 1) {
|
242 |
-
newWin = ' target="_blank"';
|
243 |
-
}
|
244 |
-
var tempStr = '<a href="' + edLinks[i].URL + '"' + newWin + '>'
|
245 |
-
+ edLinks[i].display
|
246 |
-
+ '</a>';
|
247 |
-
thisSelect.selectedIndex = 0;
|
248 |
-
edInsertContent(edCanvas, tempStr);
|
249 |
-
}
|
250 |
-
else {
|
251 |
-
thisSelect.selectedIndex = 0;
|
252 |
-
}
|
253 |
-
}
|
254 |
-
|
255 |
-
function edSpell(which) {
|
256 |
-
myField = document.getElementById(which);
|
257 |
-
var word = '';
|
258 |
-
if (document.selection) {
|
259 |
-
myField.focus();
|
260 |
-
var sel = document.selection.createRange();
|
261 |
-
if (sel.text.length > 0) {
|
262 |
-
word = sel.text;
|
263 |
-
}
|
264 |
-
}
|
265 |
-
else if (myField.selectionStart || myField.selectionStart == '0') {
|
266 |
-
var startPos = myField.selectionStart;
|
267 |
-
var endPos = myField.selectionEnd;
|
268 |
-
if (startPos != endPos) {
|
269 |
-
word = myField.value.substring(startPos, endPos);
|
270 |
-
}
|
271 |
-
}
|
272 |
-
if (word == '') {
|
273 |
-
word = prompt('Enter a word to look up:', '');
|
274 |
-
}
|
275 |
-
if (word != '') {
|
276 |
-
window.open(dictionaryUrl + escape(word));
|
277 |
-
}
|
278 |
-
}
|
279 |
-
|
280 |
-
function edToolbar(which) {
|
281 |
-
document.write('<div id="ed_toolbar_' + which + '"><span>');
|
282 |
-
for (i = 0; i < extendedStart; i++) {
|
283 |
-
edShowButton(which, edButtons[i], i);
|
284 |
-
}
|
285 |
-
if (edShowExtraCookie()) {
|
286 |
-
document.write(
|
287 |
-
'<input type="button" id="ed_close_' + which + '" class="ed_button ed_closetags" onclick="edCloseAllTags(\'' + which + '\');" value="Close Tags" />'
|
288 |
-
+ '<input type="button" id="ed_spell_' + which + '" class="ed_button ed_spell" onclick="edSpell(\'' + which + '\');" value="Lookup" />'
|
289 |
-
);
|
290 |
-
}
|
291 |
-
else {
|
292 |
-
document.write(
|
293 |
-
'<input type="button" id="ed_close_' + which + '" class="ed_button ed_closetags" onclick="edCloseAllTags(\'' + which + '\');" value="Close Tags" />'
|
294 |
-
+ '<input type="button" id="ed_spell_' + which + '" class="ed_button ed_spell" onclick="edSpell(\'' + which + '\');" value="Lookup" />'
|
295 |
-
);
|
296 |
-
}
|
297 |
-
for (i = extendedStart; i < edButtons.length; i++) {
|
298 |
-
//edShowButton(which, edButtons[i], i);
|
299 |
-
}
|
300 |
-
document.write('</span>');
|
301 |
-
// edShowLinks();
|
302 |
-
document.write('</div>');
|
303 |
-
edOpenTags[which] = new Array();
|
304 |
-
}
|
305 |
-
|
306 |
-
function edShowExtra(which) {
|
307 |
-
document.getElementById('ed_extra_show_' + which).style.visibility = 'hidden';
|
308 |
-
document.getElementById('ed_extra_buttons_' + which).style.display = 'block';
|
309 |
-
edSetCookie(
|
310 |
-
'js_quicktags_extra'
|
311 |
-
, 'show'
|
312 |
-
, new Date("December 31, 2100")
|
313 |
-
);
|
314 |
-
}
|
315 |
-
|
316 |
-
function edHideExtra(which) {
|
317 |
-
document.getElementById('ed_extra_buttons_' + which).style.display = 'none';
|
318 |
-
document.getElementById('ed_extra_show_' + which).style.visibility = 'visible';
|
319 |
-
edSetCookie(
|
320 |
-
'js_quicktags_extra'
|
321 |
-
, 'hide'
|
322 |
-
, new Date("December 31, 2100")
|
323 |
-
);
|
324 |
-
}
|
325 |
-
|
326 |
-
// insertion code
|
327 |
-
|
328 |
-
function edInsertTag(which, i) {
|
329 |
-
myField = document.getElementById(which);
|
330 |
-
//IE support
|
331 |
-
if (document.selection) {
|
332 |
-
myField.focus();
|
333 |
-
sel = document.selection.createRange();
|
334 |
-
if (sel.text.length > 0) {
|
335 |
-
sel.text = edButtons[i].tagStart + sel.text + edButtons[i].tagEnd;
|
336 |
-
}
|
337 |
-
else {
|
338 |
-
if (!edCheckOpenTags(which, i) || edButtons[i].tagEnd == '') {
|
339 |
-
sel.text = edButtons[i].tagStart;
|
340 |
-
edAddTag(which, i);
|
341 |
-
}
|
342 |
-
else {
|
343 |
-
sel.text = edButtons[i].tagEnd;
|
344 |
-
edRemoveTag(which, i);
|
345 |
-
}
|
346 |
-
}
|
347 |
-
myField.focus();
|
348 |
-
}
|
349 |
-
//MOZILLA/NETSCAPE support
|
350 |
-
else if (myField.selectionStart || myField.selectionStart == '0') {
|
351 |
-
var startPos = myField.selectionStart;
|
352 |
-
var endPos = myField.selectionEnd;
|
353 |
-
var cursorPos = endPos;
|
354 |
-
var scrollTop = myField.scrollTop;
|
355 |
-
if (startPos != endPos) {
|
356 |
-
myField.value = myField.value.substring(0, startPos)
|
357 |
-
+ edButtons[i].tagStart
|
358 |
-
+ myField.value.substring(startPos, endPos)
|
359 |
-
+ edButtons[i].tagEnd
|
360 |
-
+ myField.value.substring(endPos, myField.value.length);
|
361 |
-
cursorPos += edButtons[i].tagStart.length + edButtons[i].tagEnd.length;
|
362 |
-
}
|
363 |
-
else {
|
364 |
-
if (!edCheckOpenTags(which, i) || edButtons[i].tagEnd == '') {
|
365 |
-
myField.value = myField.value.substring(0, startPos)
|
366 |
-
+ edButtons[i].tagStart
|
367 |
-
+ myField.value.substring(endPos, myField.value.length);
|
368 |
-
edAddTag(which, i);
|
369 |
-
cursorPos = startPos + edButtons[i].tagStart.length;
|
370 |
-
}
|
371 |
-
else {
|
372 |
-
myField.value = myField.value.substring(0, startPos)
|
373 |
-
+ edButtons[i].tagEnd
|
374 |
-
+ myField.value.substring(endPos, myField.value.length);
|
375 |
-
edRemoveTag(which, i);
|
376 |
-
cursorPos = startPos + edButtons[i].tagEnd.length;
|
377 |
-
}
|
378 |
-
}
|
379 |
-
myField.focus();
|
380 |
-
myField.selectionStart = cursorPos;
|
381 |
-
myField.selectionEnd = cursorPos;
|
382 |
-
myField.scrollTop = scrollTop;
|
383 |
-
}
|
384 |
-
else {
|
385 |
-
if (!edCheckOpenTags(which, i) || edButtons[i].tagEnd == '') {
|
386 |
-
myField.value += edButtons[i].tagStart;
|
387 |
-
edAddTag(which, i);
|
388 |
-
}
|
389 |
-
else {
|
390 |
-
myField.value += edButtons[i].tagEnd;
|
391 |
-
edRemoveTag(which, i);
|
392 |
-
}
|
393 |
-
myField.focus();
|
394 |
-
}
|
395 |
-
}
|
396 |
-
|
397 |
-
function edInsertContent(which, myValue) {
|
398 |
-
myField = document.getElementById(which);
|
399 |
-
//IE support
|
400 |
-
if (document.selection) {
|
401 |
-
myField.focus();
|
402 |
-
sel = document.selection.createRange();
|
403 |
-
sel.text = myValue;
|
404 |
-
myField.focus();
|
405 |
-
}
|
406 |
-
//MOZILLA/NETSCAPE support
|
407 |
-
else if (myField.selectionStart || myField.selectionStart == '0') {
|
408 |
-
var startPos = myField.selectionStart;
|
409 |
-
var endPos = myField.selectionEnd;
|
410 |
-
var scrollTop = myField.scrollTop;
|
411 |
-
myField.value = myField.value.substring(0, startPos)
|
412 |
-
+ myValue
|
413 |
-
+ myField.value.substring(endPos, myField.value.length);
|
414 |
-
myField.focus();
|
415 |
-
myField.selectionStart = startPos + myValue.length;
|
416 |
-
myField.selectionEnd = startPos + myValue.length;
|
417 |
-
myField.scrollTop = scrollTop;
|
418 |
-
} else {
|
419 |
-
myField.value += myValue;
|
420 |
-
myField.focus();
|
421 |
-
}
|
422 |
-
}
|
423 |
-
|
424 |
-
function edInsertLink(which, i, defaultValue) {
|
425 |
-
myField = document.getElementById(which);
|
426 |
-
if (!defaultValue) {
|
427 |
-
defaultValue = 'http://';
|
428 |
-
}
|
429 |
-
if (!edCheckOpenTags(which, i)) {
|
430 |
-
var URL = prompt('Enter the URL' ,defaultValue);
|
431 |
-
if (URL) {
|
432 |
-
edButtons[i].tagStart = '<a href="' + URL + '">';
|
433 |
-
edInsertTag(which, i);
|
434 |
-
}
|
435 |
-
}
|
436 |
-
else {
|
437 |
-
edInsertTag(which, i);
|
438 |
-
}
|
439 |
-
}
|
440 |
-
|
441 |
-
function edInsertExtLink(which, i, defaultValue) {
|
442 |
-
myField = document.getElementById(which);
|
443 |
-
if (!defaultValue) {
|
444 |
-
defaultValue = 'http://';
|
445 |
-
}
|
446 |
-
if (!edCheckOpenTags(which, i)) {
|
447 |
-
var URL = prompt('Enter the URL' ,defaultValue);
|
448 |
-
if (URL) {
|
449 |
-
edButtons[i].tagStart = '<a href="' + URL + '" rel="external">';
|
450 |
-
edInsertTag(which, i);
|
451 |
-
}
|
452 |
-
}
|
453 |
-
else {
|
454 |
-
edInsertTag(which, i);
|
455 |
-
}
|
456 |
-
}
|
457 |
-
|
458 |
-
function edInsertImage(which) {
|
459 |
-
myField = document.getElementById(which);
|
460 |
-
var myValue = prompt('Enter the URL of the image', 'http://');
|
461 |
-
if (myValue) {
|
462 |
-
myValue = '<img src="'
|
463 |
-
+ myValue
|
464 |
-
+ '" alt="' + prompt('Enter a description of the image', '')
|
465 |
-
+ '" />';
|
466 |
-
edInsertContent(which, myValue);
|
467 |
-
}
|
468 |
-
}
|
469 |
-
|
470 |
-
function edInsertFootnote(which) {
|
471 |
-
myField = document.getElementById(which);
|
472 |
-
var note = prompt('Enter the footnote:', '');
|
473 |
-
if (!note || note == '') {
|
474 |
-
return false;
|
475 |
-
}
|
476 |
-
var now = new Date;
|
477 |
-
var fnId = 'fn' + now.getTime();
|
478 |
-
var fnStart = myField.value.indexOf('<ol class="footnotes">');
|
479 |
-
if (fnStart != -1) {
|
480 |
-
var fnStr1 = myField.value.substring(0, fnStart)
|
481 |
-
var fnStr2 = myField.value.substring(fnStart, myField.value.length)
|
482 |
-
var count = countInstances(fnStr2, '<li id="') + 1;
|
483 |
-
}
|
484 |
-
else {
|
485 |
-
var count = 1;
|
486 |
-
}
|
487 |
-
var count = '<sup><a href="#' + fnId + 'n" id="' + fnId + '" class="footnote">' + count + '</a></sup>';
|
488 |
-
edInsertContent(which, count);
|
489 |
-
if (fnStart != -1) {
|
490 |
-
fnStr1 = myField.value.substring(0, fnStart + count.length)
|
491 |
-
fnStr2 = myField.value.substring(fnStart + count.length, myField.value.length)
|
492 |
-
}
|
493 |
-
else {
|
494 |
-
var fnStr1 = myField.value;
|
495 |
-
var fnStr2 = "\n\n" + '<ol class="footnotes">' + "\n"
|
496 |
-
+ '</ol>' + "\n";
|
497 |
-
}
|
498 |
-
var footnote = ' <li id="' + fnId + 'n">' + note + ' [<a href="#' + fnId + '">back</a>]</li>' + "\n"
|
499 |
-
+ '</ol>';
|
500 |
-
myField.value = fnStr1 + fnStr2.replace('</ol>', footnote);
|
501 |
-
}
|
502 |
-
|
503 |
-
function countInstances(string, substr) {
|
504 |
-
var count = string.split(substr);
|
505 |
-
return count.length - 1;
|
506 |
-
}
|
507 |
-
|
508 |
-
function edInsertVia(which) {
|
509 |
-
myField = document.getElementById(which);
|
510 |
-
var myValue = prompt('Enter the URL of the source link', 'http://');
|
511 |
-
if (myValue) {
|
512 |
-
myValue = '(Thanks <a href="' + myValue + '" rel="external">'
|
513 |
-
+ prompt('Enter the name of the source', '')
|
514 |
-
+ '</a>)';
|
515 |
-
edInsertContent(which, myValue);
|
516 |
-
}
|
517 |
-
}
|
518 |
-
|
519 |
-
|
520 |
-
function edSetCookie(name, value, expires, path, domain) {
|
521 |
-
document.cookie= name + "=" + escape(value) +
|
522 |
-
((expires) ? "; expires=" + expires.toGMTString() : "") +
|
523 |
-
((path) ? "; path=" + path : "") +
|
524 |
-
((domain) ? "; domain=" + domain : "");
|
525 |
-
}
|
526 |
-
|
527 |
-
function edShowExtraCookie() {
|
528 |
-
var cookies = document.cookie.split(';');
|
529 |
-
for (var i=0;i < cookies.length; i++) {
|
530 |
-
var cookieData = cookies[i];
|
531 |
-
while (cookieData.charAt(0) ==' ') {
|
532 |
-
cookieData = cookieData.substring(1, cookieData.length);
|
533 |
-
}
|
534 |
-
if (cookieData.indexOf('js_quicktags_extra') == 0) {
|
535 |
-
if (cookieData.substring(19, cookieData.length) == 'show') {
|
536 |
-
return true;
|
537 |
-
}
|
538 |
-
else {
|
539 |
-
return false;
|
540 |
-
}
|
541 |
-
}
|
542 |
-
}
|
543 |
-
return false;
|
544 |
-
}
|
1 |
+
function edShowExtraCookie(){var a=document.cookie.split(";");for(var b=0;b<a.length;b++){var c=a[b];while(c.charAt(0)==" "){c=c.substring(1,c.length)}if(c.indexOf("js_quicktags_extra")==0){if(c.substring(19,c.length)=="show"){return true}else{return false}}}return false}function edSetCookie(a,b,c,d,e){document.cookie=a+"="+escape(b)+(c?"; expires="+c.toGMTString():"")+(d?"; path="+d:"")+(e?"; domain="+e:"")}function edInsertVia(a){myField=document.getElementById(a);var b=prompt("Enter the URL of the source link","http://");if(b){b='(Thanks <a href="'+b+'" rel="external">'+prompt("Enter the name of the source","")+"</a>)";edInsertContent(a,b)}}function countInstances(a,b){var c=a.split(b);return c.length-1}function edInsertFootnote(a){myField=document.getElementById(a);var b=prompt("Enter the footnote:","");if(!b||b==""){return false}var c=new Date;var d="fn"+c.getTime();var e=myField.value.indexOf('<ol class="footnotes">');if(e!=-1){var f=myField.value.substring(0,e);var g=myField.value.substring(e,myField.value.length);var h=countInstances(g,'<li id="')+1}else{var h=1}var h='<sup><a href="#'+d+'n" id="'+d+'" class="footnote">'+h+"</a></sup>";edInsertContent(a,h);if(e!=-1){f=myField.value.substring(0,e+h.length);g=myField.value.substring(e+h.length,myField.value.length)}else{var f=myField.value;var g="\n\n"+'<ol class="footnotes">'+"\n"+"</ol>"+"\n"}var i='\t<li id="'+d+'n">'+b+' [<a href="#'+d+'">back</a>]</li>'+"\n"+"</ol>";myField.value=f+g.replace("</ol>",i)}function edInsertImage(a){myField=document.getElementById(a);var b=prompt("Enter the URL of the image","http://");if(b){b='<img src="'+b+'" alt="'+prompt("Enter a description of the image","")+'" />';edInsertContent(a,b)}}function edInsertExtLink(a,b,c){myField=document.getElementById(a);if(!c){c="http://"}if(!edCheckOpenTags(a,b)){var d=prompt("Enter the URL",c);if(d){edButtons[b].tagStart='<a href="'+d+'" rel="external">';edInsertTag(a,b)}}else{edInsertTag(a,b)}}function edInsertLink(a,b,c){myField=document.getElementById(a);if(!c){c="http://"}if(!edCheckOpenTags(a,b)){var d=prompt("Enter the URL",c);if(d){edButtons[b].tagStart='<a href="'+d+'">';edInsertTag(a,b)}}else{edInsertTag(a,b)}}function edInsertContent(a,b){myField=document.getElementById(a);if(document.selection){myField.focus();sel=document.selection.createRange();sel.text=b;myField.focus()}else if(myField.selectionStart||myField.selectionStart=="0"){var c=myField.selectionStart;var d=myField.selectionEnd;var e=myField.scrollTop;myField.value=myField.value.substring(0,c)+b+myField.value.substring(d,myField.value.length);myField.focus();myField.selectionStart=c+b.length;myField.selectionEnd=c+b.length;myField.scrollTop=e}else{myField.value+=b;myField.focus()}}function edInsertTag(a,b){myField=document.getElementById(a);if(document.selection){myField.focus();sel=document.selection.createRange();if(sel.text.length>0){sel.text=edButtons[b].tagStart+sel.text+edButtons[b].tagEnd}else{if(!edCheckOpenTags(a,b)||edButtons[b].tagEnd==""){sel.text=edButtons[b].tagStart;edAddTag(a,b)}else{sel.text=edButtons[b].tagEnd;edRemoveTag(a,b)}}myField.focus()}else if(myField.selectionStart||myField.selectionStart=="0"){var c=myField.selectionStart;var d=myField.selectionEnd;var e=d;var f=myField.scrollTop;if(c!=d){myField.value=myField.value.substring(0,c)+edButtons[b].tagStart+myField.value.substring(c,d)+edButtons[b].tagEnd+myField.value.substring(d,myField.value.length);e+=edButtons[b].tagStart.length+edButtons[b].tagEnd.length}else{if(!edCheckOpenTags(a,b)||edButtons[b].tagEnd==""){myField.value=myField.value.substring(0,c)+edButtons[b].tagStart+myField.value.substring(d,myField.value.length);edAddTag(a,b);e=c+edButtons[b].tagStart.length}else{myField.value=myField.value.substring(0,c)+edButtons[b].tagEnd+myField.value.substring(d,myField.value.length);edRemoveTag(a,b);e=c+edButtons[b].tagEnd.length}}myField.focus();myField.selectionStart=e;myField.selectionEnd=e;myField.scrollTop=f}else{if(!edCheckOpenTags(a,b)||edButtons[b].tagEnd==""){myField.value+=edButtons[b].tagStart;edAddTag(a,b)}else{myField.value+=edButtons[b].tagEnd;edRemoveTag(a,b)}myField.focus()}}function edHideExtra(a){document.getElementById("ed_extra_buttons_"+a).style.display="none";document.getElementById("ed_extra_show_"+a).style.visibility="visible";edSetCookie("js_quicktags_extra","hide",new Date("December 31, 2100"))}function edShowExtra(a){document.getElementById("ed_extra_show_"+a).style.visibility="hidden";document.getElementById("ed_extra_buttons_"+a).style.display="block";edSetCookie("js_quicktags_extra","show",new Date("December 31, 2100"))}function edToolbar(a){document.write('<div id="ed_toolbar_'+a+'"><span>');for(i=0;i<extendedStart;i++){edShowButton(a,edButtons[i],i)}if(edShowExtraCookie()){document.write('<input type="button" id="ed_close_'+a+'" class="ed_button ed_closetags" onclick="edCloseAllTags(\''+a+'\');" value="Close Tags" />'+'<input type="button" id="ed_spell_'+a+'" class="ed_button ed_spell" onclick="edSpell(\''+a+'\');" value="Lookup" />')}else{document.write('<input type="button" id="ed_close_'+a+'" class="ed_button ed_closetags" onclick="edCloseAllTags(\''+a+'\');" value="Close Tags" />'+'<input type="button" id="ed_spell_'+a+'" class="ed_button ed_spell" onclick="edSpell(\''+a+'\');" value="Lookup" />')}for(i=extendedStart;i<edButtons.length;i++){}document.write("</span>");document.write("</div>");edOpenTags[a]=new Array}function edSpell(a){myField=document.getElementById(a);var b="";if(document.selection){myField.focus();var c=document.selection.createRange();if(c.text.length>0){b=c.text}}else if(myField.selectionStart||myField.selectionStart=="0"){var d=myField.selectionStart;var e=myField.selectionEnd;if(d!=e){b=myField.value.substring(d,e)}}if(b==""){b=prompt("Enter a word to look up:","")}if(b!=""){window.open(dictionaryUrl+escape(b))}}function edQuickLink(a,b){if(a>-1){var c="";if(edLinks[a].newWin==1){c=' target="_blank"'}var d='<a href="'+edLinks[a].URL+'"'+c+">"+edLinks[a].display+"</a>";b.selectedIndex=0;edInsertContent(edCanvas,d)}else{b.selectedIndex=0}}function edCloseAllTags(a){var b=edOpenTags[a].length;for(o=0;o<b;o++){edInsertTag(a,edOpenTags[a][edOpenTags[a].length-1])}}function edCheckOpenTags(a,b){var c=0;for(i=0;i<edOpenTags[a].length;i++){if(edOpenTags[a][i]==b){c++}}if(c>0){return true}else{return false}}function edRemoveTag(a,b){for(i=0;i<edOpenTags[a].length;i++){if(edOpenTags[a][i]==b){edOpenTags[a].splice(i,1);document.getElementById(edButtons[b].id+"_"+a).value=document.getElementById(edButtons[b].id+"_"+a).value.replace("/","")}}}function edAddTag(a,b){if(edButtons[b].tagEnd!=""){edOpenTags[a][edOpenTags[a].length]=b;document.getElementById(edButtons[b].id+"_"+a).value="/"+document.getElementById(edButtons[b].id+"_"+a).value}}function edShowLinks(){var a='<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>(Quick Links)</option>';for(i=0;i<edLinks.length;i++){a+='<option value="'+i+'">'+edLinks[i].display+"</option>"}a+="</select>";document.write(a)}function edShowButton(a,b,c){if(b.access){var d=' accesskey = "'+b.access+'"'}else{var d=""}switch(b.id){case"ed_img":document.write('<input type="button" id="'+b.id+"_"+a+'" '+d+' class="ed_button '+b.id+'" onclick="edInsertImage(\''+a+'\');" value="'+b.display+'" />');break;case"ed_link":document.write('<input type="button" id="'+b.id+"_"+a+'" '+d+' class="ed_button '+b.id+'" onclick="edInsertLink(\''+a+"', "+c+');" value="'+b.display+'" />');break;case"ed_ext_link":document.write('<input type="button" id="'+b.id+"_"+a+'" '+d+' class="ed_button '+b.id+'" onclick="edInsertExtLink(\''+a+"', "+c+');" value="'+b.display+'" />');break;case"ed_footnote":document.write('<input type="button" id="'+b.id+"_"+a+'" '+d+' class="ed_button '+b.id+'" onclick="edInsertFootnote(\''+a+'\');" value="'+b.display+'" />');break;case"ed_via":document.write('<input type="button" id="'+b.id+"_"+a+'" '+d+' class="ed_button '+b.id+'" onclick="edInsertVia(\''+a+'\');" value="'+b.display+'" />');break;default:document.write('<input type="button" id="'+b.id+"_"+a+'" '+d+' class="ed_button '+b.id+'" onclick="edInsertTag(\''+a+"', "+c+');" value="'+b.display+'" />');break}}function edLink(a,b,c){this.display=a;this.URL=b;if(!c){c=0}this.newWin=c}function edButton(a,b,c,d,e,f){this.id=a;this.display=b;this.tagStart=c;this.tagEnd=d;this.access=e;this.open=f}var dictionaryUrl="http://www.ninjawords.com/";var edButtons=new Array;var edLinks=new Array;var edOpenTags=new Array;edButtons.push(new edButton("ed_bold","B","<strong>","</strong>","b"));edButtons.push(new edButton("ed_italic","I","<em>","</em>","i"));edButtons.push(new edButton("ed_link","Link","","</a>","a"));edButtons.push(new edButton("ed_block","B-QUOTE","<blockquote>","</blockquote>","q"));edButtons.push(new edButton("ed_img","IMG","","","m",-1));edButtons.push(new edButton("ed_ul","UL","<ul>\n","</ul>\n\n","u"));edButtons.push(new edButton("ed_ol","OL","<ol>\n","</ol>\n\n","o"));edButtons.push(new edButton("ed_li","LI","\t<li>","</li>\n","l"));edButtons.push(new edButton("ed_code","CODE","<code>","</code>","c"));var extendedStart=edButtons.length;edLinks[edLinks.length]=new edLink("alexking.org","http://www.alexking.org/")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/visual-form-builder-validate.js
CHANGED
@@ -1,33 +1 @@
|
|
1 |
-
jQuery(document).ready(function(
|
2 |
-
$( '.visual-form-builder' ).each( function() {
|
3 |
-
$( this ).validate({
|
4 |
-
rules: {
|
5 |
-
"vfb-secret":{
|
6 |
-
maxlength:2
|
7 |
-
}
|
8 |
-
},
|
9 |
-
errorPlacement: function(error, element) {
|
10 |
-
if ( element.is( ':radio' ) || element.is( ':checkbox' ) ) {
|
11 |
-
error.appendTo( element.parent().parent() );
|
12 |
-
}
|
13 |
-
else {
|
14 |
-
error.insertAfter( element );
|
15 |
-
}
|
16 |
-
}
|
17 |
-
})
|
18 |
-
});
|
19 |
-
|
20 |
-
/* Custom validation method to check multiple emails */
|
21 |
-
$.validator.addMethod( 'phone', function( value, element ) {
|
22 |
-
/* Strip out all spaces, periods, dashes, parentheses, and plus signs */
|
23 |
-
value = value.replace(/[\+\s\(\)\.\-\ ]/g, '');
|
24 |
-
|
25 |
-
return this.optional(element) || value.length > 9 &&
|
26 |
-
value.match( /^((\+)?[1-9]{1,2})?([-\s\.])?((\(\d{1,4}\))|\d{1,4})(([-\s\.])?[0-9]{1,12}){1,2}$/ );
|
27 |
-
|
28 |
-
}, 'Please enter a valid phone number. Most US/Canada and International formats accepted.'
|
29 |
-
);
|
30 |
-
|
31 |
-
/* Display jQuery UI date picker */
|
32 |
-
$( '.vfb-date-picker' ).datepicker();
|
33 |
-
});
|
1 |
+
jQuery(document).ready(function(a){a(".visual-form-builder").each(function(){a(this).validate({rules:{"vfb-secret":{required:true,digits:true,maxlength:2}},errorPlacement:function(a,b){if(b.is(":radio")||b.is(":checkbox")){a.appendTo(b.parent().parent())}else{a.insertAfter(b)}}})});a.validator.addMethod("phone",function(a,b){a=a.replace(/[\+\s\(\)\.\-\ ]/g,"");return this.optional(b)||a.length>9&&a.match(/^((\+)?[1-9]{1,2})?([-\s\.])?((\(\d{1,4}\))|\d{1,4})(([-\s\.])?[0-9]{1,12}){1,2}$/)},"Please enter a valid phone number. Most US/Canada and International formats accepted.");a(".vfb-date-picker").datepicker()})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/visual-form-builder.js
CHANGED
@@ -1,336 +1 @@
|
|
1 |
-
jQuery(document).ready(function(
|
2 |
-
/* Dynamically add options for Select, Radio, and Checkbox */
|
3 |
-
$( '.addOption' ).live( 'click', function( e ) {
|
4 |
-
/* Get how many options we already have */
|
5 |
-
var num = $( this ).parent().parent().find( '.clonedOption').length;
|
6 |
-
|
7 |
-
/* Add one to how many options */
|
8 |
-
var newNum = num + 1;
|
9 |
-
|
10 |
-
/* Get this div's ID */
|
11 |
-
var id = $( this ).closest( 'div' ).attr( 'id' );
|
12 |
-
|
13 |
-
/* Get this div's for attribute, which matches the input's ID */
|
14 |
-
var label_for = $( this ).closest( 'div' ).children( 'label' ).attr( 'for' );
|
15 |
-
|
16 |
-
/* Strip out the last number (i.e. count) from the for to make a new ID */
|
17 |
-
var new_id = label_for.replace( new RegExp( /(\d+)$/g ), '' );
|
18 |
-
var div_id = id.replace( new RegExp( /(\d+)$/g ), '' );
|
19 |
-
|
20 |
-
/* Clone this div and change the ID */
|
21 |
-
var newElem = $( '#' + id ).clone().attr( 'id', div_id + newNum);
|
22 |
-
|
23 |
-
/* Change the IDs of the for and input to match */
|
24 |
-
newElem.children( 'label' ).attr( 'for', new_id + newNum );
|
25 |
-
newElem.find( 'input' ).attr( 'id', new_id + newNum );
|
26 |
-
|
27 |
-
/* Insert our cloned option after the last one */
|
28 |
-
$( '#' + div_id + num ).after( newElem );
|
29 |
-
|
30 |
-
return false;
|
31 |
-
});
|
32 |
-
|
33 |
-
/* Dynamically delete options for Select, Radio, and Checkbox */
|
34 |
-
$( '.deleteOption' ).live( 'click', function() {
|
35 |
-
/* Get how many options we already have */
|
36 |
-
var num = $( this ).parent().parent().find( '.clonedOption').length;
|
37 |
-
|
38 |
-
/* If there's only one option left, don't let someone delete it */
|
39 |
-
if ( num - 1 == 0 ) {
|
40 |
-
alert( 'You must have at least one option.' );
|
41 |
-
}
|
42 |
-
else {
|
43 |
-
$( this ).closest( 'div' ).remove();
|
44 |
-
}
|
45 |
-
|
46 |
-
return false;
|
47 |
-
});
|
48 |
-
|
49 |
-
/* Dynamically add values for the E-mail(s) To field */
|
50 |
-
$( '.addEmail' ).live( 'click', function( e ) {
|
51 |
-
/* Get how many options we already have */
|
52 |
-
var num = $( this ).parent().parent().find( '.clonedOption').length;
|
53 |
-
|
54 |
-
/* Add one to how many options */
|
55 |
-
var newNum = num + 1;
|
56 |
-
|
57 |
-
/* Get this div's ID */
|
58 |
-
var id = $( this ).closest( 'div' ).attr( 'id' );
|
59 |
-
|
60 |
-
/* Get this div's for attribute, which matches the input's ID */
|
61 |
-
var label_for = $( this ).closest( 'div' ).children( 'label' ).attr( 'for' );
|
62 |
-
|
63 |
-
/* Strip out the last number (i.e. count) from the for to make a new ID */
|
64 |
-
var new_id = label_for.replace( new RegExp( /(\d+)$/g ), '' );
|
65 |
-
var div_id = id.replace( new RegExp( /(\d+)$/g ), '' );
|
66 |
-
|
67 |
-
/* Clone this div and change the ID */
|
68 |
-
var newElem = $( '#' + id ).clone().attr( 'id', div_id + newNum);
|
69 |
-
|
70 |
-
/* Change the IDs of the for and input to match */
|
71 |
-
newElem.children( 'label' ).attr( 'for', new_id + newNum );
|
72 |
-
newElem.find( 'input' ).attr( 'id', new_id + newNum );
|
73 |
-
|
74 |
-
/* Insert our cloned option after the last one */
|
75 |
-
$( '#' + div_id + num ).after( newElem );
|
76 |
-
|
77 |
-
return false;
|
78 |
-
});
|
79 |
-
|
80 |
-
/* Dynamically delete values for the E-mail(s) To field */
|
81 |
-
$( '.deleteEmail' ).live( 'click', function() {
|
82 |
-
/* Get how many options we already have */
|
83 |
-
var num = $( this ).parent().parent().find( '.clonedOption').length;
|
84 |
-
|
85 |
-
/* If there's only one option left, don't let someone delete it */
|
86 |
-
if ( num - 1 == 0 ) {
|
87 |
-
alert( 'You must have at least one option.' );
|
88 |
-
}
|
89 |
-
else {
|
90 |
-
$( this ).closest( 'div' ).remove();
|
91 |
-
}
|
92 |
-
|
93 |
-
return false;
|
94 |
-
});
|
95 |
-
|
96 |
-
/* Field item details box toggle */
|
97 |
-
$( '.item-edit' ).click( function( e ){
|
98 |
-
$( e.target ).closest( 'li' ).children( '.menu-item-settings' ).slideToggle( 'fast' );
|
99 |
-
|
100 |
-
$( this ).toggleClass( 'opened' );
|
101 |
-
|
102 |
-
return false;
|
103 |
-
});
|
104 |
-
|
105 |
-
/* Highlight the shortcode to make easier copying */
|
106 |
-
$( '#form-copy-to-clipboard' ).focus( function(){
|
107 |
-
this.select();
|
108 |
-
});
|
109 |
-
|
110 |
-
|
111 |
-
/* Setup the tabs array */
|
112 |
-
var tabsWidth = new Array();
|
113 |
-
|
114 |
-
/* Set the width of each tab and add extra margins */
|
115 |
-
$( '.nav-tab' ).each(function(i){
|
116 |
-
if ( i == 0 )
|
117 |
-
tabsWidth[i] = Math.abs( $(this).outerWidth() ) + 26;
|
118 |
-
else
|
119 |
-
tabsWidth[i] = Math.abs( $(this).outerWidth() ) + 6;
|
120 |
-
});
|
121 |
-
|
122 |
-
var count = 0;
|
123 |
-
|
124 |
-
/* Move tabs to the right */
|
125 |
-
$( '.nav-tabs-arrow-right' ).click( function(){
|
126 |
-
|
127 |
-
/* First time we click on the right arrow, show the left one */
|
128 |
-
if ( count == 0 )
|
129 |
-
$( '.nav-tabs-arrow-left' ).show();
|
130 |
-
|
131 |
-
/* Slide div over one tab at a time */
|
132 |
-
$( '.nav-tabs' ).animate({ marginLeft: '-=' + tabsWidth[count] });
|
133 |
-
|
134 |
-
/* Make sure we always show the + tab */
|
135 |
-
if ( count == tabsWidth.length - 2 ) {
|
136 |
-
$( this ).hide();
|
137 |
-
}
|
138 |
-
|
139 |
-
count += 1;
|
140 |
-
});
|
141 |
-
|
142 |
-
/* Move tabs to the left */
|
143 |
-
$( '.nav-tabs-arrow-left' ).click( function(){
|
144 |
-
|
145 |
-
count -= 1;
|
146 |
-
|
147 |
-
/* If we click on the left arrow, show the right one */
|
148 |
-
$( '.nav-tabs-arrow-right' ).show();
|
149 |
-
|
150 |
-
/* If at the beginning (left side), hide the left arrow */
|
151 |
-
if ( count == 0 )
|
152 |
-
$( this ).hide();
|
153 |
-
|
154 |
-
/* Slide div back to the left, one tab at a time */
|
155 |
-
$( '.nav-tabs' ).animate({ marginLeft: '+=' + tabsWidth[count] });
|
156 |
-
});
|
157 |
-
|
158 |
-
/* Handle sorting the field items */
|
159 |
-
$( '#menu-to-edit' ).sortable({
|
160 |
-
handle: '.menu-item-handle',
|
161 |
-
placeholder: 'sortable-placeholder',
|
162 |
-
items: 'li:not(.ui-state-disabled)',
|
163 |
-
stop: function( event, ui ){
|
164 |
-
opts = {
|
165 |
-
url: ajaxurl,
|
166 |
-
type: 'POST',
|
167 |
-
async: true,
|
168 |
-
cache: false,
|
169 |
-
dataType: 'json',
|
170 |
-
data: {
|
171 |
-
action: 'visual_form_builder_process_sort',
|
172 |
-
order: $( this ).sortable( 'toArray' ).toString()
|
173 |
-
},
|
174 |
-
success: function( response ) {
|
175 |
-
$( '#loading-animation' ).hide(); // Hide the loading animation
|
176 |
-
return;
|
177 |
-
},
|
178 |
-
error: function( xhr,textStatus,e ) { // This can be expanded to provide more information
|
179 |
-
alert('There was an error saving the updates');
|
180 |
-
$('#loading-animation').hide(); // Hide the loading animation
|
181 |
-
return;
|
182 |
-
}
|
183 |
-
};
|
184 |
-
|
185 |
-
$.ajax(opts);
|
186 |
-
}
|
187 |
-
});
|
188 |
-
|
189 |
-
/* Show/hide the spinner image when creating a field */
|
190 |
-
$( '#form-items' ).submit( function(e){
|
191 |
-
$.ajax({
|
192 |
-
url: ajaxurl,
|
193 |
-
async: false,
|
194 |
-
success: function( response ) {
|
195 |
-
$( 'img.waiting' ).show();
|
196 |
-
return;
|
197 |
-
}
|
198 |
-
});
|
199 |
-
});
|
200 |
-
|
201 |
-
/* Display the selected confirmation type on load */
|
202 |
-
var confirmation = $( '.form-success-type:checked' ).val();
|
203 |
-
$( '#form-success-message-' + confirmation ).show();
|
204 |
-
|
205 |
-
/* Control the Confirmation Message tabs */
|
206 |
-
$( '.form-success-type' ).change(function(){
|
207 |
-
var type = $( this ).val();
|
208 |
-
|
209 |
-
if ( 'text' == type ) {
|
210 |
-
$( '#form-success-message-text' ).show();
|
211 |
-
$( '#form-success-message-page, #form-success-message-redirect' ).hide();
|
212 |
-
}
|
213 |
-
else if ( 'page' == type ) {
|
214 |
-
$( '#form-success-message-page' ).show();
|
215 |
-
$( '#form-success-message-text, #form-success-message-redirect' ).hide();
|
216 |
-
}
|
217 |
-
else if ( 'redirect' == type ) {
|
218 |
-
$( '#form-success-message-redirect' ).show();
|
219 |
-
$( '#form-success-message-text, #form-success-message-page' ).hide();
|
220 |
-
}
|
221 |
-
});
|
222 |
-
|
223 |
-
/* Validate the sender details section */
|
224 |
-
$( '#visual-form-builder-update' ).validate({
|
225 |
-
rules: {
|
226 |
-
form_email_subject: {
|
227 |
-
required: true
|
228 |
-
},
|
229 |
-
form_email_from_name: {
|
230 |
-
required : function( element ){
|
231 |
-
return $( '#form_email_from_name_override option:selected' ).val() == ''
|
232 |
-
}
|
233 |
-
},
|
234 |
-
'form_email_to[]': {
|
235 |
-
required: true,
|
236 |
-
email: true
|
237 |
-
},
|
238 |
-
form_email_from: {
|
239 |
-
required: function( element ){
|
240 |
-
return $( '#form_email_from_override option:selected' ).val() == ''
|
241 |
-
},
|
242 |
-
email: true
|
243 |
-
},
|
244 |
-
form_success_message_redirect: {
|
245 |
-
url: true
|
246 |
-
},
|
247 |
-
form_notification_email_name: {
|
248 |
-
required: function( element ){
|
249 |
-
return $( '#form-notification-setting' ).is( ':checked' )
|
250 |
-
}
|
251 |
-
},
|
252 |
-
form_notification_email_from: {
|
253 |
-
required: function( element ){
|
254 |
-
return $( '#form-notification-setting' ).is( ':checked' )
|
255 |
-
},
|
256 |
-
email: true
|
257 |
-
},
|
258 |
-
form_notification_email: {
|
259 |
-
required: function( element ){
|
260 |
-
return $( '#form-notification-setting' ).is( ':checked' )
|
261 |
-
}
|
262 |
-
}
|
263 |
-
},
|
264 |
-
errorPlacement: function( error, element ) {
|
265 |
-
error.insertAfter( element.parent() );
|
266 |
-
}
|
267 |
-
});
|
268 |
-
|
269 |
-
/* Make Sender Name field readonly if the override is active */
|
270 |
-
$( '#form_email_from_name_override' ).change( function(){
|
271 |
-
if ( $( '#form_email_from_name_override' ).val() == '' ) {
|
272 |
-
$( '#form-email-sender-name' ).attr( 'readonly', false );
|
273 |
-
}
|
274 |
-
else{
|
275 |
-
$( '#form-email-sender-name' ).attr( 'readonly', 'readonly' );
|
276 |
-
}
|
277 |
-
});
|
278 |
-
|
279 |
-
/* Make Sender Email field readonly if the override is active */
|
280 |
-
$( '#form_email_from_override' ).change( function(){
|
281 |
-
if ( $( '#form_email_from_override' ).val() == '' ) {
|
282 |
-
$( '#form-email-sender' ).attr( 'readonly', false );
|
283 |
-
}
|
284 |
-
else{
|
285 |
-
$( '#form-email-sender' ).attr( 'readonly', 'readonly' );
|
286 |
-
}
|
287 |
-
});
|
288 |
-
|
289 |
-
|
290 |
-
/* Show/Hide display of Notification fields */
|
291 |
-
if ( $( '#form-notification-setting' ).is( ':checked' ) ) {
|
292 |
-
$( '#notification-email' ).show();
|
293 |
-
}
|
294 |
-
else {
|
295 |
-
$( '#notification-email' ).hide();
|
296 |
-
}
|
297 |
-
|
298 |
-
/* Enable/Disable Notification fields */
|
299 |
-
$( '#form-notification-setting' ).change( function(){
|
300 |
-
var checked = $(this).is(':checked');
|
301 |
-
|
302 |
-
if ( checked ) {
|
303 |
-
$( '#notification-email' ).show();
|
304 |
-
$( '#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry' ).attr( 'disabled', false );
|
305 |
-
}
|
306 |
-
else{
|
307 |
-
$( '#notification-email' ).hide();
|
308 |
-
$( '#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry' ).attr( 'disabled', 'disabled' );
|
309 |
-
}
|
310 |
-
});
|
311 |
-
|
312 |
-
/* Custom validation method to check multiple emails */
|
313 |
-
$.validator.addMethod( 'multiemail', function( value, element ) {
|
314 |
-
|
315 |
-
/* Return true on an optional element */
|
316 |
-
if ( this.optional( element ) )
|
317 |
-
return true;
|
318 |
-
|
319 |
-
/* RegEx for emails - delimiters are commas or semicolons */
|
320 |
-
var emails = value.split( new RegExp( '\\s*[,|;]\\s*', 'gi' ) );
|
321 |
-
|
322 |
-
/* It's valid unless the loop below proves otherwise */
|
323 |
-
valid = true;
|
324 |
-
|
325 |
-
/* Loop through each email and validate as email */
|
326 |
-
for ( var i in emails ) {
|
327 |
-
value = emails[i];
|
328 |
-
valid = valid && jQuery.validator.methods.email.call( this, value, element );
|
329 |
-
}
|
330 |
-
|
331 |
-
return valid;
|
332 |
-
|
333 |
-
}, 'One or more email addresses are invalid'
|
334 |
-
);
|
335 |
-
|
336 |
-
});
|
1 |
+
jQuery(document).ready(function(a){function n(){if(b.length){var i=b.width(),j=0,l={};h=b.offset().left;g=h+i;d.makeTabVisible(h,g,c,k,m);if(e.last().isTabVisible(h,g)){j=b.width()-f;j=j>0?0:j;l[k]=j+"px";c.animate(l,100,"linear")}if(i>f)a(".nav-tabs-arrow-right, .nav-tabs-arrow-left").hide();else a(".nav-tabs-arrow-right, .nav-tabs-arrow-left").show()}}a(".addOption").live("click",function(b){var c=a(this).parent().parent().find(".clonedOption").length;var d=c+1;var e=a(this).closest("div").attr("id");var f=a(this).closest("div").children("label").attr("for");var g=f.replace(new RegExp(/(\d+)$/g),"");var h=e.replace(new RegExp(/(\d+)$/g),"");var i=a("#"+e).clone().attr("id",h+d);i.children("label").attr("for",g+d);i.find("input").attr("id",g+d);a("#"+h+c).after(i);return false});a(".deleteOption").live("click",function(){var b=a(this).parent().parent().find(".clonedOption").length;if(b-1==0){alert("You must have at least one option.")}else{a(this).closest("div").remove()}return false});a(".addEmail").live("click",function(b){var c=a(this).parent().parent().find(".clonedOption").length;var d=c+1;var e=a(this).closest("div").attr("id");var f=a(this).closest("div").children("label").attr("for");var g=f.replace(new RegExp(/(\d+)$/g),"");var h=e.replace(new RegExp(/(\d+)$/g),"");var i=a("#"+e).clone().attr("id",h+d);i.children("label").attr("for",g+d);i.find("input").attr("id",g+d);a("#"+h+c).after(i);return false});a(".deleteEmail").live("click",function(){var b=a(this).parent().parent().find(".clonedOption").length;if(b-1==0){alert("You must have at least one option.")}else{a(this).closest("div").remove()}return false});a(".menu-delete, .entry-delete").click(function(){var b=a(this).hasClass("entry-delete")?"entry":"form";var c=confirm("You are about to permanently delete this "+b+" and all of its data.\n'Cancel' to stop, 'OK' to delete.");if(c)return;return false});a(".item-edit").live("click",function(b){a(b.target).closest("li").children(".menu-item-settings").slideToggle("fast");a(this).toggleClass("opened");return false});a("#form-copy-to-clipboard").focus(function(){this.select()});var b=a(".nav-tabs-wrapper"),c=b.children(".nav-tabs"),d=c.children(".nav-tab-active"),e=c.children(".nav-tab"),f=0,g,h,i={},j,k="margin-left",l="margin-right",m=2;e.each(function(){f+=a(this).outerWidth(true)});i["padding"]=0;i[l]=-1*f+"px";c.css(i);n();a(window).resize(function(){if(j)clearTimeout(j);j=setTimeout(n,200)});a(".nav-tabs-arrow-right").mousedown(function(){var a=Math.abs(parseInt(c.css(k))),d=a,e={};d=Math.abs(f-b.width())-a;if(!d)return;e[k]="-="+d+"px";c.animate(e,d*m,"linear")}).mouseup(function(){c.stop(true)});a(".nav-tabs-arrow-left").mousedown(function(){var a=Math.abs(parseInt(c.css(k))),b=a,d={};if(!b)return;d[k]="+="+b+"px";c.animate(d,b*m,"linear")}).mouseup(function(){c.stop(true)});a("#menu-to-edit").nestedSortable({listType:"ul",maxLevels:3,handle:".menu-item-handle",placeholder:"sortable-placeholder",tolerance:"pointer",toleranceElement:"> dl",items:"li:not(.ui-state-disabled)",create:function(b,c){a(this).css("min-height",a(this).height())},start:function(a,b){b.placeholder.height(b.item.height())},stop:function(b,c){opts={url:ajaxurl,type:"POST",async:true,cache:false,dataType:"json",data:{action:"visual_form_builder_process_sort",order:a(this).nestedSortable("toArray")},success:function(b){a("#loading-animation").hide();return}};a.ajax(opts)}});a('#form-items input[type="submit"]').click(function(){a(this).closest("form").data("submit_value",a(this))});a("#form-items").live("submit",function(b){b.preventDefault();var c=a(this).serializeArray(),d=a(this).data("submit_value").attr("value");a("img.waiting").show();a.ajax({url:ajaxurl,type:"GET",async:true,cache:false,dataType:"html",data:{action:"visual_form_builder_create_field",data:c,field_type:d,page:pagenow,nonce:a("#_wpnonce").val()},success:function(b){a("img.waiting").hide();a(b).hide().insertBefore("#menu-to-edit li.ui-state-disabled").fadeIn();return},error:function(a,b,c){alert("There was an error loading the content");return}})});a(".item-delete").live("click",function(b){b.preventDefault();var c=childs=new Array,d=0,e=a(this).attr("href"),f=e.split("&");for(var g=0;g<f.length;g++){var h=f[g].indexOf("=");var i=f[g].substring(0,h);var j=f[g].substring(h+1);c[i]=j}var k=a(this).closest(".form-item").find("ul").children();var l=k.parent().html();k.each(function(b){childs[b]=a(this).attr("id").match(new RegExp(/(\d+)$/g))[0]});var m=a(this).closest("li.form-item").parents("li.form-item");if(m.length)d=m.attr("id").match(new RegExp(/(\d+)$/g))[0];console.log(d);a.ajax({url:ajaxurl,type:"GET",async:true,cache:false,dataType:"html",data:{action:"visual_form_builder_delete_field",form:c["form"],field:c["field"],child_ids:childs,parent_id:d,page:pagenow,nonce:c["_wpnonce"]},success:function(b){a("#form_item_"+c["field"]).addClass("deleting").animate({opacity:0,height:0},350,function(){a(this).before(l).remove()});return},error:function(a,b,c){alert("There was an error loading the content");return}})});var o=a(".form-success-type:checked").val();a("#form-success-message-"+o).show();a(".form-success-type").change(function(){var b=a(this).val();if("text"==b){a("#form-success-message-text").show();a("#form-success-message-page, #form-success-message-redirect").hide()}else if("page"==b){a("#form-success-message-page").show();a("#form-success-message-text, #form-success-message-redirect").hide()}else if("redirect"==b){a("#form-success-message-redirect").show();a("#form-success-message-text, #form-success-message-page").hide()}});a("#visual-form-builder-update").validate({rules:{"form_email_to[]":{email:true},form_email_from:{email:true},form_success_message_redirect:{url:true},form_notification_email_name:{required:function(b){return a("#form-notification-setting").is(":checked")}},form_notification_email_from:{required:function(b){return a("#form-notification-setting").is(":checked")},email:true},form_notification_email:{required:function(b){return a("#form-notification-setting").is(":checked")}}},errorPlacement:function(a,b){a.insertAfter(b.parent())}});a("#form_email_from_name_override").change(function(){if(a("#form_email_from_name_override").val()==""){a("#form-email-sender-name").attr("readonly",false)}else{a("#form-email-sender-name").attr("readonly","readonly")}});a("#form_email_from_override").change(function(){if(a("#form_email_from_override").val()==""){a("#form-email-sender").attr("readonly",false)}else{a("#form-email-sender").attr("readonly","readonly")}});if(a("#form-notification-setting").is(":checked")){a("#notification-email").show()}else{a("#notification-email").hide()}a("#form-notification-setting").change(function(){var b=a(this).is(":checked");if(b){a("#notification-email").show();a("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").attr("disabled",false)}else{a("#notification-email").hide();a("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").attr("disabled","disabled")}});a.validator.addMethod("multiemail",function(a,b){if(this.optional(b))return true;var c=a.split(new RegExp("\\s*[,|;]\\s*","gi"));valid=true;for(var d in c){a=c[d];valid=valid&&jQuery.validator.methods.email.call(this,a,b)}return valid},"One or more email addresses are invalid")});jQuery.fn.extend({makeTabVisible:function(a,b,c,d,e){var f=this.eq(0),g,h,i={},j=0;if(!f.length)return this;g=f.offset().left;h=g+f.outerWidth();if(h>b)j=b-h;else if(g<a)j=a-g;if(!j)return this;i[d]="+="+1*j+"px";c.animate(i,Math.abs(j)*e,"linear");return this},isTabVisible:function(a,b){var c=this.eq(0),d=c.offset().left,e=d+c.outerWidth();return e<=b&&d>=a?true:false}})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: mmuro
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=G87A9UN9CLPH4&lc=US&item_name=Visual%20Form%20Builder¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
|
4 |
Tags: form, forms, contact form, form to email, email form, email, input, validation, jquery, shortcode
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
|
10 |
|
@@ -35,6 +35,7 @@ Dynamically build forms using a simple interface. Forms include jQuery validatio
|
|
35 |
= Field Types =
|
36 |
|
37 |
* Fieldset
|
|
|
38 |
* Text input (single line)
|
39 |
* Textarea (multiple lines)
|
40 |
* Checkbox
|
@@ -107,6 +108,12 @@ Fieldsets, a way to group form fields, are an essential piece of this plugin's H
|
|
107 |
|
108 |
At this time, there is no alternative to the built-in anti-spam system.
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
= How do I customize the CSS? =
|
111 |
|
112 |
If you want to customize the appearance of the forms using your own CSS, here's how to do it:
|
@@ -133,6 +140,14 @@ To use the more complex features of the Date Picker plugin, you will need to:
|
|
133 |
1. Using the above example ID, paste the following into your javascript file: `$( '#start-date' ).datepicker();`
|
134 |
1. Add and customize the [jQuery UI Date Picker configuration options](http://jqueryui.com/demos/datepicker)
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
= How do I export my entries to a CSV? =
|
137 |
|
138 |
There are two ways to export your entries to a CSV: Export All or Export Selected.
|
@@ -148,7 +163,7 @@ To Export Selected:
|
|
148 |
1. Go to the Entries screen
|
149 |
1. Check boxes next to the entries you wish to export
|
150 |
1. Select the `Export Selected` option under the `Bulk Actions` dropdown
|
151 |
-
1.
|
152 |
|
153 |
== Screenshots ==
|
154 |
|
@@ -158,6 +173,15 @@ To Export Selected:
|
|
158 |
|
159 |
== Changelog ==
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
**Version 1.8**
|
162 |
|
163 |
* Add Dynamic Add/Delete for Options for Radio, Select, and Checkbox fields
|
@@ -237,6 +261,9 @@ To Export Selected:
|
|
237 |
|
238 |
== Upgrade Notice ==
|
239 |
|
|
|
|
|
|
|
240 |
= 1.8 =
|
241 |
Submit button text now customizable (click Save Form to access). Added dynamic add/delete for Radio, Select, Checkboxes, and Email(s) To fields.
|
242 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=G87A9UN9CLPH4&lc=US&item_name=Visual%20Form%20Builder¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
|
4 |
Tags: form, forms, contact form, form to email, email form, email, input, validation, jquery, shortcode
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 3.3
|
7 |
+
Stable tag: 1.9
|
8 |
|
9 |
Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
|
10 |
|
35 |
= Field Types =
|
36 |
|
37 |
* Fieldset
|
38 |
+
* Section (group fields within a fieldset)
|
39 |
* Text input (single line)
|
40 |
* Textarea (multiple lines)
|
41 |
* Checkbox
|
108 |
|
109 |
At this time, there is no alternative to the built-in anti-spam system.
|
110 |
|
111 |
+
= I'm not getting any emails! What's wrong? =
|
112 |
+
|
113 |
+
Some people have reported that after the form is submitted, no email is received. If this is the case for you, it typically means that your server or web host has not properly configured their SMTP settings.
|
114 |
+
|
115 |
+
Try using a plugin such as [WP Mail SMTP](http://wordpress.org/extend/plugins/wp-mail-smtp/) to correct the issue.
|
116 |
+
|
117 |
= How do I customize the CSS? =
|
118 |
|
119 |
If you want to customize the appearance of the forms using your own CSS, here's how to do it:
|
140 |
1. Using the above example ID, paste the following into your javascript file: `$( '#start-date' ).datepicker();`
|
141 |
1. Add and customize the [jQuery UI Date Picker configuration options](http://jqueryui.com/demos/datepicker)
|
142 |
|
143 |
+
= How do I translate the field validation text to my language? =
|
144 |
+
|
145 |
+
The validation messages (ex: 'This field is required' or 'Please enter a valid email address') are generated by the jQuery Form Validation plugin.
|
146 |
+
|
147 |
+
By default, these messages are in English. To translate them, you must create a JavaScript file that contains your translations and insert it into your theme.
|
148 |
+
|
149 |
+
For instructions, [please go here](http://wordpress.org/support/topic/visual-form-builder-localization-problem?replies=8#post-2296212).
|
150 |
+
|
151 |
= How do I export my entries to a CSV? =
|
152 |
|
153 |
There are two ways to export your entries to a CSV: Export All or Export Selected.
|
163 |
1. Go to the Entries screen
|
164 |
1. Check boxes next to the entries you wish to export
|
165 |
1. Select the `Export Selected` option under the `Bulk Actions` dropdown
|
166 |
+
1. Click Apply and save the file
|
167 |
|
168 |
== Screenshots ==
|
169 |
|
173 |
|
174 |
== Changelog ==
|
175 |
|
176 |
+
**Version 1.9**
|
177 |
+
|
178 |
+
* Add ability for fields to be nested underneath Fieldsets and Sections
|
179 |
+
* Add Section Form Item
|
180 |
+
* Update adding/deleting fields to use AJAX
|
181 |
+
* Update and improve admin tabs functionality
|
182 |
+
* Update new form building to no longer force require email details
|
183 |
+
* Update Delete Form link to require confirmation before deleting
|
184 |
+
|
185 |
**Version 1.8**
|
186 |
|
187 |
* Add Dynamic Add/Delete for Options for Radio, Select, and Checkbox fields
|
261 |
|
262 |
== Upgrade Notice ==
|
263 |
|
264 |
+
= 1.9 =
|
265 |
+
Added Section Form Item, ability to nest fields under Fieldsets and Sections. Improve adding/deleting fields.
|
266 |
+
|
267 |
= 1.8 =
|
268 |
Submit button text now customizable (click Save Form to access). Added dynamic add/delete for Radio, Select, Checkboxes, and Email(s) To fields.
|
269 |
|
visual-form-builder.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Visual Form Builder
|
4 |
Description: Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
|
5 |
Author: Matthew Muro
|
6 |
-
Version: 1.
|
7 |
*/
|
8 |
|
9 |
/*
|
@@ -27,7 +27,7 @@ $visual_form_builder = new Visual_Form_Builder();
|
|
27 |
/* Restrict Categories class */
|
28 |
class Visual_Form_Builder{
|
29 |
|
30 |
-
public $vfb_db_version = '1.
|
31 |
|
32 |
public function __construct(){
|
33 |
global $wpdb;
|
@@ -42,7 +42,11 @@ class Visual_Form_Builder{
|
|
42 |
/* Build options and settings pages. */
|
43 |
add_action( 'admin_menu', array( &$this, 'add_admin' ) );
|
44 |
add_action( 'admin_menu', array( &$this, 'save' ) );
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
add_action( 'admin_init', array( &$this, 'add_visual_form_builder_contextual_help' ) );
|
47 |
add_action( 'admin_init', array( &$this, 'export_entries' ) );
|
48 |
|
@@ -118,10 +122,11 @@ class Visual_Form_Builder{
|
|
118 |
<li><em>Description</em> will be displayed below the associated input.</li>
|
119 |
<li><em>Validation</em> allows you to select from several of jQuery's Form Validation methods for text inputs. For more about the types of validation, read the <em>Validation</em> section below.</li>
|
120 |
<li><em>Required</em> is either Yes or No. Selecting 'Yes' will make the associated input a required field and the form will not submit until the user fills this field out correctly.</li>
|
121 |
-
<li><em>Options</em> will only be active for Radio and Checkboxes. This field contols how many options are available for the associated input
|
122 |
<li><em>Size</em> controls the width of Text, Textarea, Select, and Date Picker input fields. The default is set to Medium but if you need a longer text input, select Large.</li>
|
|
|
123 |
</ul>
|
124 |
-
<p><strong>Validation</strong
|
125 |
<ul>
|
126 |
<li>Visual Form Builder uses the <a href='http://docs.jquery.com/Plugins/Validation/Validator'>jQuery Form Validation plugin</a> to perform clientside form validation.</li>
|
127 |
<li><em>Email</em>: makes the element require a valid email.</li>
|
@@ -132,14 +137,14 @@ class Visual_Form_Builder{
|
|
132 |
<li><em>Phone</em>: makes the element require a US or International phone number. Most formats are accepted.</li>
|
133 |
<li><em>Time</em>: choose either 12- or 24-hour time format (NOTE: only available with the Time field).</li>
|
134 |
</ul>
|
135 |
-
<p><strong>Confirmation</strong
|
136 |
<ul>
|
137 |
<li>Each form allows you to customize the confirmation by selecing either a Text Message, a WordPress Page, or to Redirect to a URL.</li>
|
138 |
<li><em>Text</em> allows you to enter a custom formatted message that will be displayed on the page after your form is submitted. HTML is allowed here.</li>
|
139 |
<li><em>Page</em> displays a dropdown of all WordPress Pages you have created. Select one to redirect the user to that page after your form is submitted.</li>
|
140 |
<li><em>Redirect</em> will only accept URLs and can be used to send the user to a different site completely, if you choose.</li>
|
141 |
</ul>
|
142 |
-
<p><strong>Notification</strong
|
143 |
<ul>
|
144 |
<li>Send a customized notification email to the user when the form has been successfully submitted.</li>
|
145 |
<li><em>Sender Name</em>: the name that will be displayed on the email.</li>
|
@@ -154,6 +159,7 @@ class Visual_Form_Builder{
|
|
154 |
<li>Fieldsets, a way to group form fields, are an essential piece of this plugin's HTML. As such, at least one fieldset is required and must be first in the order. Subsequent fieldsets may be placed wherever you would like to start your next grouping of fields.</li>
|
155 |
<li>Security verification is automatically included on very form. It's a simple logic question and should keep out most, if not all, spam bots.</li>
|
156 |
<li>There is a hidden spam field, known as a honey pot, that should also help deter potential abusers of your form.</li>
|
|
|
157 |
</ul>";
|
158 |
|
159 |
add_contextual_help( 'settings_page_visual-form-builder', $text );
|
@@ -250,10 +256,11 @@ class Visual_Form_Builder{
|
|
250 |
field_options TEXT,
|
251 |
field_description TEXT,
|
252 |
field_name VARCHAR(255) NOT NULL,
|
253 |
-
field_sequence
|
|
|
254 |
field_validation VARCHAR(25),
|
255 |
field_required VARCHAR(25),
|
256 |
-
field_size VARCHAR(25),
|
257 |
field_css VARCHAR(255),
|
258 |
UNIQUE KEY (field_id)
|
259 |
) DEFAULT CHARACTER SET $charset COLLATE $collate;";
|
@@ -288,7 +295,7 @@ class Visual_Form_Builder{
|
|
288 |
sender_name VARCHAR(255),
|
289 |
sender_email VARCHAR(25),
|
290 |
emails_to VARCHAR(255),
|
291 |
-
date_submitted
|
292 |
ip_address VARCHAR(25),
|
293 |
UNIQUE KEY (entries_id)
|
294 |
) DEFAULT CHARACTER SET $charset COLLATE $collate;";
|
@@ -320,6 +327,7 @@ class Visual_Form_Builder{
|
|
320 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
321 |
wp_enqueue_script( 'jquery-form-validation', 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js', array( 'jquery' ), '', true );
|
322 |
wp_enqueue_script( 'form-elements-add', plugins_url( 'visual-form-builder' ) . '/js/visual-form-builder.js' , array( 'jquery', 'jquery-form-validation' ), '', true );
|
|
|
323 |
}
|
324 |
|
325 |
/**
|
@@ -415,13 +423,13 @@ class Visual_Form_Builder{
|
|
415 |
/* Add the first fieldset to get things started */
|
416 |
$wpdb->insert( $this->field_table_name, $initial_fieldset );
|
417 |
|
418 |
-
/* Make the submit last in the sequence
|
419 |
$submit = array(
|
420 |
'form_id' => $new_form_selected,
|
421 |
'field_key' => 'submit',
|
422 |
'field_type' => 'submit',
|
423 |
'field_name' => 'Submit',
|
424 |
-
'field_sequence' =>
|
425 |
);
|
426 |
|
427 |
/* Insert the submit field */
|
@@ -495,6 +503,9 @@ class Visual_Form_Builder{
|
|
495 |
/* Update form details */
|
496 |
$wpdb->update( $this->form_table_name, $newdata, $where );
|
497 |
|
|
|
|
|
|
|
498 |
/* Loop through each field and update all at once */
|
499 |
if ( !empty( $_REQUEST['field_id'] ) ) {
|
500 |
foreach ( $_REQUEST['field_id'] as $id ) {
|
@@ -515,7 +526,8 @@ class Visual_Form_Builder{
|
|
515 |
'field_validation' => $field_validation,
|
516 |
'field_required' => $field_required,
|
517 |
'field_size' => $field_size,
|
518 |
-
'field_css' => $field_css
|
|
|
519 |
);
|
520 |
|
521 |
$where = array(
|
@@ -525,25 +537,43 @@ class Visual_Form_Builder{
|
|
525 |
|
526 |
/* Update all fields */
|
527 |
$wpdb->update( $this->field_table_name, $field_data, $where );
|
|
|
|
|
528 |
}
|
529 |
|
530 |
/* Check if a submit field type exists for backwards compatibility upgrades */
|
531 |
-
$is_submit = $wpdb->get_var( "SELECT
|
|
|
|
|
|
|
532 |
|
533 |
/* If this form doesn't have a submit field, add one */
|
534 |
if ( $is_submit == NULL ) {
|
535 |
-
/* Make the submit last in the sequence
|
536 |
$submit = array(
|
537 |
'form_id' => $form_id,
|
538 |
'field_key' => 'submit',
|
539 |
'field_type' => 'submit',
|
540 |
'field_name' => 'Submit',
|
541 |
-
'field_sequence' =>
|
542 |
);
|
543 |
|
544 |
/* Insert the submit field */
|
545 |
$wpdb->insert( $this->field_table_name, $submit );
|
546 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
547 |
}
|
548 |
|
549 |
/* Set message to display */
|
@@ -625,7 +655,8 @@ class Visual_Form_Builder{
|
|
625 |
'field_validation' => $field->field_validation,
|
626 |
'field_required' => $field->field_required,
|
627 |
'field_size' => $field->field_size,
|
628 |
-
'field_css' => $field->field_css
|
|
|
629 |
);
|
630 |
|
631 |
$wpdb->insert( $this->field_table_name, $data );
|
@@ -646,70 +677,6 @@ class Visual_Form_Builder{
|
|
646 |
exit();
|
647 |
|
648 |
break;
|
649 |
-
|
650 |
-
case 'delete_field' :
|
651 |
-
$form_id = absint( $_REQUEST['form'] );
|
652 |
-
$field_id = absint( $_REQUEST['field'] );
|
653 |
-
|
654 |
-
check_admin_referer( 'delete-field-' . $form_id );
|
655 |
-
|
656 |
-
/* Delete the field */
|
657 |
-
$wpdb->query( $wpdb->prepare( "DELETE FROM $this->field_table_name WHERE field_id = %d", $field_id ) );
|
658 |
-
|
659 |
-
/* Set message to display */
|
660 |
-
$this->message = '<div id="message" class="updated"><p>The field has been deleted.</p></div>';
|
661 |
-
|
662 |
-
/* Redirect to keep the URL clean (use AJAX in the future?) */
|
663 |
-
wp_redirect( 'options-general.php?page=visual-form-builder&form=' . $form_id );
|
664 |
-
exit();
|
665 |
-
|
666 |
-
break;
|
667 |
-
|
668 |
-
case 'create_field' :
|
669 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
670 |
-
$field_key = sanitize_title( $_REQUEST['field_type'] );
|
671 |
-
$field_name = esc_html( $_REQUEST['field_type'] );
|
672 |
-
$field_type = strtolower( sanitize_title( $_REQUEST['field_type'] ) );
|
673 |
-
|
674 |
-
/* Set defaults for validation */
|
675 |
-
switch ( $field_type ) {
|
676 |
-
case 'email' :
|
677 |
-
case 'url' :
|
678 |
-
case 'phone' :
|
679 |
-
$field_validation = $field_type;
|
680 |
-
break;
|
681 |
-
case 'currency' :
|
682 |
-
$field_validation = 'number';
|
683 |
-
break;
|
684 |
-
case 'number' :
|
685 |
-
$field_validation = 'digits';
|
686 |
-
break;
|
687 |
-
case 'time' :
|
688 |
-
$field_validation = 'time-12';
|
689 |
-
break;
|
690 |
-
}
|
691 |
-
|
692 |
-
check_admin_referer( 'create-field-' . $form_id );
|
693 |
-
|
694 |
-
/* Get the last row's sequence that isn't a Submit */
|
695 |
-
$sequence_last_row = $wpdb->get_row( "SELECT field_sequence FROM $this->field_table_name WHERE form_id = $form_id AND field_type != 'submit' ORDER BY field_sequence DESC LIMIT 1" );
|
696 |
-
|
697 |
-
/* If it's not the first for this form, add 1 */
|
698 |
-
$field_sequence = ( !empty( $sequence_last_row ) ) ? $sequence_last_row->field_sequence + 1 : 0;
|
699 |
-
|
700 |
-
$newdata = array(
|
701 |
-
'form_id' => absint( $_REQUEST['form_id'] ),
|
702 |
-
'field_key' => $field_key,
|
703 |
-
'field_name' => $field_name,
|
704 |
-
'field_type' => $field_type,
|
705 |
-
'field_sequence' => $field_sequence,
|
706 |
-
'field_validation' => $field_validation
|
707 |
-
);
|
708 |
-
|
709 |
-
/* Create the field */
|
710 |
-
$wpdb->insert( $this->field_table_name, $newdata );
|
711 |
-
|
712 |
-
break;
|
713 |
}
|
714 |
}
|
715 |
}
|
@@ -719,22 +686,360 @@ class Visual_Form_Builder{
|
|
719 |
*
|
720 |
* @since 1.0
|
721 |
*/
|
722 |
-
public function
|
723 |
global $wpdb;
|
724 |
|
725 |
-
|
726 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
727 |
|
728 |
-
|
729 |
-
|
730 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
731 |
|
732 |
-
/*
|
733 |
-
$wpdb->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
735 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
736 |
die(1);
|
737 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
738 |
|
739 |
/**
|
740 |
* Builds the options settings page
|
@@ -817,6 +1122,7 @@ class Visual_Form_Builder{
|
|
817 |
<p><strong><?php _e( 'Click' , 'visual-form-builder'); ?></strong> <?php _e( 'to Add a Field' , 'visual-form-builder'); ?> <img id="add-to-form" alt="" src="<?php echo admin_url( '/images/wpspin_light.gif' ); ?>" class="waiting" /></p>
|
818 |
<ul>
|
819 |
<li><input type="submit" id="form-element-fieldset" class="button-secondary" name="field_type" value="Fieldset"<?php echo $disabled; ?> /></li>
|
|
|
820 |
<li><input type="submit" id="form-element-text" class="button-secondary" name="field_type" value="Text"<?php echo $disabled; ?> /></li>
|
821 |
<li><input type="submit" id="form-element-textarea" class="button-secondary" name="field_type" value="Textarea"<?php echo $disabled; ?> /></li>
|
822 |
<li><input type="submit" id="form-element-checkbox" class="button-secondary" name="field_type" value="Checkbox"<?php echo $disabled; ?> /></li>
|
@@ -1130,7 +1436,7 @@ class Visual_Form_Builder{
|
|
1130 |
<li id="twitter"><?php _e( 'Follow me on Twitter' , 'visual-form-builder'); ?>: <a href="http://twitter.com/#!/matthewmuro">@matthewmuro</a></li>
|
1131 |
<li id="star"><a href="http://wordpress.org/extend/plugins/visual-form-builder/"><?php _e( 'Rate Visual Form Builder on WordPress.org' , 'visual-form-builder'); ?></a></li>
|
1132 |
<li id="paypal">
|
1133 |
-
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=G87A9UN9CLPH4&lc=US&item_name=Visual%20Form%20Builder¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted"><img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" width="74" height="21"
|
1134 |
</li>
|
1135 |
</ul>
|
1136 |
</div>
|
@@ -1139,179 +1445,11 @@ class Visual_Form_Builder{
|
|
1139 |
if ( !empty( $form_nav_selected_id ) && $form_nav_selected_id !== '0' ) :
|
1140 |
/* Display help text for adding fields */
|
1141 |
printf( '<div class="post-body-plain" id="menu-instructions"><p>%s</p></div>', __( 'Select form inputs from the box at left to begin building your custom form. An initial fieldset has been automatically added to get you started.' , 'visual-form-builder') );
|
1142 |
-
|
1143 |
-
/*
|
1144 |
-
$query_fields = "SELECT * FROM $this->field_table_name WHERE form_id = $form_nav_selected_id ORDER BY field_sequence ASC";
|
1145 |
-
$fields = $wpdb->get_results( $query_fields );
|
1146 |
-
|
1147 |
echo '<ul id="menu-to-edit" class="menu ui-sortable droppable">';
|
1148 |
|
1149 |
-
|
1150 |
-
foreach ( $fields as $field ) :
|
1151 |
-
?>
|
1152 |
-
<li id="form_item_<?php echo $field->field_id; ?>" class="form-item<?php echo ( $field->field_type == 'submit' ) ? ' ui-state-disabled' : ''; ?>">
|
1153 |
-
<dl class="menu-item-bar">
|
1154 |
-
<dt class="menu-item-handle<?php echo ( $field->field_type == 'fieldset' ) ? ' fieldset' : ''; ?>">
|
1155 |
-
<span class="item-title"><?php echo stripslashes( htmlspecialchars( $field->field_name ) ); ?><?php echo ( $field->field_required == 'yes' ) ? ' <span class="is-field-required">*</span>' : ''; ?></span> <span class="item-controls">
|
1156 |
-
<span class="item-type"><?php echo strtoupper( str_replace( '-', ' ', $field->field_type ) ); ?></span>
|
1157 |
-
<a href="#" title="<?php _e( 'Edit Field Item' , 'visual-form-builder'); ?>" id="edit-<?php echo $field->field_id; ?>" class="item-edit"><?php _e( 'Edit Field Item' , 'visual-form-builder'); ?></a>
|
1158 |
-
</span>
|
1159 |
-
</dt>
|
1160 |
-
</dl>
|
1161 |
-
|
1162 |
-
<div id="form-item-settings-<?php echo $field->field_id; ?>" class="menu-item-settings" style="display: none;">
|
1163 |
-
<?php if ( $field->field_type == 'fieldset' ) : ?>
|
1164 |
-
|
1165 |
-
<p class="description description-wide">
|
1166 |
-
<label for="edit-form-item-name-<?php echo $field->field_id; ?>">Legend<br />
|
1167 |
-
<input type="text" value="<?php echo stripslashes( $field->field_name ); ?>" name="field_name-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-name-<?php echo $field->field_id; ?>" />
|
1168 |
-
</label>
|
1169 |
-
</p>
|
1170 |
-
|
1171 |
-
<?php elseif( $field->field_type == 'instructions' ) : ?>
|
1172 |
-
|
1173 |
-
<p class="description description-wide">
|
1174 |
-
<label for="edit-form-item-name-<?php echo $field->field_id; ?>">
|
1175 |
-
<?php _e( 'Name' , 'visual-form-builder'); ?><br />
|
1176 |
-
<input type="text" value="<?php echo stripslashes( htmlspecialchars( $field->field_name ) ); ?>" name="field_name-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-name-<?php echo $field->field_id; ?>" />
|
1177 |
-
</label>
|
1178 |
-
</p>
|
1179 |
-
<p class="description description-wide">
|
1180 |
-
<label for="edit-form-item-description-<?php echo $field->field_id; ?>">Description (HTML tags allowed)<br />
|
1181 |
-
<textarea name="field_description-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-description-<?php echo $field->field_id; ?>" /><?php echo stripslashes( $field->field_description ); ?></textarea>
|
1182 |
-
</label>
|
1183 |
-
</p>
|
1184 |
-
<p class="description description-wide">
|
1185 |
-
<label for="edit-form-item-css-<?php echo $field->field_id; ?>">
|
1186 |
-
<?php _e( 'CSS CLasses' , 'visual-form-builder'); ?><br />
|
1187 |
-
<input type="text" value="<?php echo stripslashes( htmlspecialchars( $field->field_css ) ); ?>" name="field_css-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-css-<?php echo $field->field_id; ?>" />
|
1188 |
-
</label>
|
1189 |
-
</p>
|
1190 |
-
|
1191 |
-
<?php else: ?>
|
1192 |
-
|
1193 |
-
<!-- Name -->
|
1194 |
-
<p class="description description-wide">
|
1195 |
-
<label for="edit-form-item-name-<?php echo $field->field_id; ?>">
|
1196 |
-
<?php _e( 'Name' , 'visual-form-builder'); ?><br />
|
1197 |
-
<input type="text" value="<?php echo stripslashes( htmlspecialchars( $field->field_name ) ); ?>" name="field_name-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-name-<?php echo $field->field_id; ?>" />
|
1198 |
-
</label>
|
1199 |
-
</p>
|
1200 |
-
<?php if ( $field->field_type !== 'submit' ) : ?>
|
1201 |
-
<!-- Description -->
|
1202 |
-
<p class="description description-wide">
|
1203 |
-
<label for="edit-form-item-description-<?php echo $field->field_id; ?>">
|
1204 |
-
<?php _e( 'Description' , 'visual-form-builder'); ?><br />
|
1205 |
-
<input type="text" value="<?php echo stripslashes( $field->field_description ); ?>" name="field_description-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-description-<?php echo $field->field_id; ?>" />
|
1206 |
-
</label>
|
1207 |
-
</p>
|
1208 |
-
|
1209 |
-
<?php
|
1210 |
-
/* Display the Options input only for radio, checkbox, and select fields */
|
1211 |
-
if ( in_array( $field->field_type, array( 'radio', 'checkbox', 'select' ) ) ) : ?>
|
1212 |
-
<!-- Options -->
|
1213 |
-
<p class="description description-wide">
|
1214 |
-
<?php _e( 'Options' , 'visual-form-builder'); ?>
|
1215 |
-
<?php
|
1216 |
-
/* If the options field isn't empty, unserialize and build array */
|
1217 |
-
if ( !empty( $field->field_options ) ) {
|
1218 |
-
if ( is_serialized( $field->field_options ) )
|
1219 |
-
$opts_vals = ( is_array( unserialize( $field->field_options ) ) ) ? unserialize( $field->field_options ) : explode( ',', unserialize( $field->field_options ) );
|
1220 |
-
}
|
1221 |
-
/* Otherwise, present some default options */
|
1222 |
-
else
|
1223 |
-
$opts_vals = array( 'Option 1', 'Option 2', 'Option 3' );
|
1224 |
-
|
1225 |
-
/* Basic count to keep track of multiple options */
|
1226 |
-
$count = 1;
|
1227 |
-
|
1228 |
-
/* Loop through the options */
|
1229 |
-
foreach ( $opts_vals as $options ) {
|
1230 |
-
?>
|
1231 |
-
<div id="clone-<?php echo $field->field_id . '-' . $count; ?>" class="option">
|
1232 |
-
<label for="edit-form-item-options-<?php echo $field->field_id . "-$count"; ?>" class="clonedOption">
|
1233 |
-
<input type="text" value="<?php echo stripslashes( $options ); ?>" name="field_options-<?php echo $field->field_id; ?>[]" class="widefat" id="edit-form-item-options-<?php echo $field->field_id . "-$count"; ?>" />
|
1234 |
-
</label>
|
1235 |
-
|
1236 |
-
<a href="#" class="addOption" title="Add an Option">Add</a> <a href="#" class="deleteOption" title="Delete Option">Delete</a>
|
1237 |
-
</div>
|
1238 |
-
<?php
|
1239 |
-
$count++;
|
1240 |
-
}
|
1241 |
-
?>
|
1242 |
-
</p>
|
1243 |
-
<?php
|
1244 |
-
/* Unset the options for any following radio, checkboxes, or selects */
|
1245 |
-
unset( $opts_vals );
|
1246 |
-
endif;
|
1247 |
-
?>
|
1248 |
-
|
1249 |
-
<!-- Validation -->
|
1250 |
-
<p class="description description-thin">
|
1251 |
-
<label for="edit-form-item-validation">
|
1252 |
-
Validation<br />
|
1253 |
-
<select name="field_validation-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-validation-<?php echo $field->field_id; ?>"<?php echo ( in_array( $field->field_type, array( 'radio', 'select', 'checkbox', 'address', 'date', 'textarea', 'html', 'file-upload' ) ) ) ? ' disabled="disabled"' : ''; ?>>
|
1254 |
-
<?php if ( $field->field_type == 'time' ) : ?>
|
1255 |
-
<option value="time-12" <?php selected( $field->field_validation, 'time-12' ); ?>><?php _e( '12 Hour Format' , 'visual-form-builder'); ?></option>
|
1256 |
-
<option value="time-24" <?php selected( $field->field_validation, 'time-24' ); ?>><?php _e( '24 Hour Format' , 'visual-form-builder'); ?></option>
|
1257 |
-
<?php else : ?>
|
1258 |
-
<option value="" <?php selected( $field->field_validation, '' ); ?>><?php _e( 'None' , 'visual-form-builder'); ?></option>
|
1259 |
-
<option value="email" <?php selected( $field->field_validation, 'email' ); ?>><?php _e( 'Email' , 'visual-form-builder'); ?></option>
|
1260 |
-
<option value="url" <?php selected( $field->field_validation, 'url' ); ?>><?php _e( 'URL' , 'visual-form-builder'); ?></option>
|
1261 |
-
<option value="date" <?php selected( $field->field_validation, 'date' ); ?>><?php _e( 'Date' , 'visual-form-builder'); ?></option>
|
1262 |
-
<option value="number" <?php selected( $field->field_validation, 'number' ); ?>><?php _e( 'Number' , 'visual-form-builder'); ?></option>
|
1263 |
-
<option value="digits" <?php selected( $field->field_validation, 'digits' ); ?>><?php _e( 'Digits' , 'visual-form-builder'); ?></option>
|
1264 |
-
<option value="phone" <?php selected( $field->field_validation, 'phone' ); ?>><?php _e( 'Phone' , 'visual-form-builder'); ?></option>
|
1265 |
-
<?php endif; ?>
|
1266 |
-
</select>
|
1267 |
-
</label>
|
1268 |
-
</p>
|
1269 |
-
|
1270 |
-
<!-- Required -->
|
1271 |
-
<p class="field-link-target description description-thin">
|
1272 |
-
<label for="edit-form-item-required">
|
1273 |
-
<?php _e( 'Required' , 'visual-form-builder'); ?><br />
|
1274 |
-
<select name="field_required-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-required-<?php echo $field->field_id; ?>">
|
1275 |
-
<option value="no" <?php selected( $field->field_required, 'no' ); ?>><?php _e( 'No' , 'visual-form-builder'); ?></option>
|
1276 |
-
<option value="yes" <?php selected( $field->field_required, 'yes' ); ?>><?php _e( 'Yes' , 'visual-form-builder'); ?></option>
|
1277 |
-
</select>
|
1278 |
-
</label>
|
1279 |
-
</p>
|
1280 |
-
|
1281 |
-
<?php if ( !in_array( $field->field_type, array( 'radio', 'checkbox', 'time' ) ) ) : ?>
|
1282 |
-
<!-- Size -->
|
1283 |
-
<p class="description description-wide">
|
1284 |
-
<label for="edit-form-item-size">
|
1285 |
-
<?php _e( 'Size' , 'visual-form-builder'); ?><br />
|
1286 |
-
<select name="field_size-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-size-<?php echo $field->field_id; ?>">
|
1287 |
-
<option value="medium" <?php selected( $field->field_size, 'medium' ); ?>><?php _e( 'Medium' , 'visual-form-builder'); ?></option>
|
1288 |
-
<option value="large" <?php selected( $field->field_size, 'large' ); ?>><?php _e( 'Large' , 'visual-form-builder'); ?></option>
|
1289 |
-
</select>
|
1290 |
-
</label>
|
1291 |
-
</p>
|
1292 |
-
<?php endif; ?>
|
1293 |
-
|
1294 |
-
<p class="description description-wide">
|
1295 |
-
<label for="edit-form-item-css-<?php echo $field->field_id; ?>">
|
1296 |
-
<?php _e( 'CSS Classes' , 'visual-form-builder'); ?><br />
|
1297 |
-
<input type="text" value="<?php echo stripslashes( htmlspecialchars( $field->field_css ) ); ?>" name="field_css-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-css-<?php echo $field->field_id; ?>" />
|
1298 |
-
</label>
|
1299 |
-
</p>
|
1300 |
-
|
1301 |
-
<?php endif; ?>
|
1302 |
-
<?php endif; ?>
|
1303 |
-
|
1304 |
-
<?php if ( $field->field_type !== 'submit' ) : ?>
|
1305 |
-
<div class="menu-item-actions description-wide submitbox">
|
1306 |
-
<a href="<?php echo esc_url( wp_nonce_url( admin_url('options-general.php?page=visual-form-builder&action=delete_field&form=' . $form_nav_selected_id . '&field=' . $field->field_id ), 'delete-field-' . $form_nav_selected_id ) ); ?>" class="item-delete submitdelete deletion"><?php _e( 'Remove' , 'visual-form-builder'); ?></a>
|
1307 |
-
</div>
|
1308 |
-
<?php endif; ?>
|
1309 |
-
|
1310 |
-
<input type="hidden" name="field_id[<?php echo $field->field_id; ?>]" value="<?php echo $field->field_id; ?>" />
|
1311 |
-
</div>
|
1312 |
-
</li>
|
1313 |
-
<?php
|
1314 |
-
endforeach;
|
1315 |
|
1316 |
echo '</ul>';
|
1317 |
|
@@ -1391,7 +1529,7 @@ class Visual_Form_Builder{
|
|
1391 |
/* Get form id. Allows use of [vfb id=1] or [vfb 1] */
|
1392 |
$form_id = ( isset( $id ) && !empty( $id ) ) ? $id : $atts[0];
|
1393 |
|
1394 |
-
$open_fieldset = false;
|
1395 |
|
1396 |
/* Default the submit value */
|
1397 |
$submit = 'Submit';
|
@@ -1412,17 +1550,27 @@ class Visual_Form_Builder{
|
|
1412 |
$query_fields = "SELECT * FROM $this->field_table_name WHERE form_id = $form_id ORDER BY $order_fields";
|
1413 |
|
1414 |
$fields = $wpdb->get_results( $query_fields );
|
1415 |
-
|
1416 |
/* Setup count for fieldset and ul/section class names */
|
1417 |
$count = 1;
|
1418 |
-
|
1419 |
foreach ( $forms as $form ) :
|
1420 |
|
1421 |
$output = '<form id="' . $form->form_key . '" class="visual-form-builder" method="post" enctype="multipart/form-data">
|
1422 |
<input type="hidden" name="form_id" value="' . $form->form_id . '" />';
|
1423 |
$output .= wp_nonce_field( 'visual-form-builder-nonce', '_wpnonce', false, false );
|
1424 |
-
|
1425 |
foreach ( $fields as $field ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1426 |
if ( $field->field_type == 'fieldset' ) {
|
1427 |
/* Close each fieldset */
|
1428 |
if ( $open_fieldset == true )
|
@@ -1432,16 +1580,24 @@ class Visual_Form_Builder{
|
|
1432 |
$open_fieldset = true;
|
1433 |
$count++;
|
1434 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1435 |
elseif ( $field->field_type !== 'submit' ) {
|
1436 |
/* If field is required, build the span and add setup the 'required' class */
|
1437 |
$required_span = ( !empty( $field->field_required ) && $field->field_required === 'yes' ) ? ' <span>*</span>' : '';
|
1438 |
$required = ( !empty( $field->field_required ) && $field->field_required === 'yes' ) ? ' required' : '';
|
1439 |
$validation = ( !empty( $field->field_validation ) ) ? " $field->field_validation" : '';
|
1440 |
$css = ( !empty( $field->field_css ) ) ? " $field->field_css" : '';
|
1441 |
-
|
1442 |
-
$output .= '<li class="item item-' . $field->field_type . '"><label for="vfb-' . $field->field_key . '" class="desc">'. stripslashes( $field->field_name ) . $required_span . '</label>';
|
1443 |
}
|
1444 |
|
|
|
|
|
1445 |
switch ( $field->field_type ) {
|
1446 |
case 'text' :
|
1447 |
case 'email' :
|
@@ -1451,10 +1607,10 @@ class Visual_Form_Builder{
|
|
1451 |
case 'phone' :
|
1452 |
|
1453 |
if ( !empty( $field->field_description ) )
|
1454 |
-
$output .= '<span><input type="text" name="vfb-' . esc_html( $field->field_key ) . '" id="vfb-' . esc_html( $field->field_key ) . '" value="" class="text ' . $field->field_size . $required . $validation . $css . '" /><label>' . $field->field_description . '</label></span>';
|
1455 |
else
|
1456 |
-
$output .= '<input type="text" name="vfb-' . esc_html( $field->field_key ) . '" id="vfb-' . esc_html( $field->field_key ) . '" value="" class="text ' . $field->field_size . $required . $validation . $css . '" />';
|
1457 |
-
|
1458 |
break;
|
1459 |
|
1460 |
case 'textarea' :
|
@@ -1462,7 +1618,7 @@ class Visual_Form_Builder{
|
|
1462 |
if ( !empty( $field->field_description ) )
|
1463 |
$output .= '<span><label>' . stripslashes( $field->field_description ) . '</label></span>';
|
1464 |
|
1465 |
-
$output .= '<textarea name="vfb-'. $field->field_key . '" id="vfb-'. $field->field_key . '" class="textarea ' . $field->field_size . $required . $css . '"></textarea>';
|
1466 |
|
1467 |
break;
|
1468 |
|
@@ -1470,7 +1626,7 @@ class Visual_Form_Builder{
|
|
1470 |
if ( !empty( $field->field_description ) )
|
1471 |
$output .= '<span><label>' . stripslashes( $field->field_description ) . '</label></span>';
|
1472 |
|
1473 |
-
$output .= '<select name="vfb-'. $field->field_key . '" id="vfb-'. $field->field_key . '" class="select ' . $field->field_size . $required . $css . '">';
|
1474 |
|
1475 |
$options = ( is_array( unserialize( $field->field_options ) ) ) ? unserialize( $field->field_options ) : explode( ',', unserialize( $field->field_options ) );
|
1476 |
|
@@ -1495,8 +1651,8 @@ class Visual_Form_Builder{
|
|
1495 |
/* Loop through each option and output */
|
1496 |
foreach ( $options as $option => $value ) {
|
1497 |
$output .= '<span>
|
1498 |
-
<input type="radio" name="vfb-'. $field->field_key . '" id="vfb-'. $field->field_key . '-' . $option . '" value="'. stripslashes( $value ) . '" class="radio' . $required . $css . '" />'.
|
1499 |
-
' <label for="vfb-' . $field->field_key . '-' . $option . '" class="choice">' . stripslashes( $value ) . '</label>' .
|
1500 |
'</span>';
|
1501 |
}
|
1502 |
|
@@ -1516,8 +1672,8 @@ class Visual_Form_Builder{
|
|
1516 |
/* Loop through each option and output */
|
1517 |
foreach ( $options as $option => $value ) {
|
1518 |
|
1519 |
-
$output .= '<span><input type="checkbox" name="vfb-'. $field->field_key . '[]" id="vfb-'. $field->field_key . '-' . $option . '" value="'. trim( stripslashes( $value ) ) . '" class="checkbox' . $required . $css . '" />'.
|
1520 |
-
' <label for="vfb-' . $field->field_key . '-' . $option . '" class="choice">' . trim( stripslashes( $value ) ) . '</label></span>';
|
1521 |
}
|
1522 |
|
1523 |
$output .= '<div style="clear:both"></div></div>';
|
@@ -1533,29 +1689,29 @@ class Visual_Form_Builder{
|
|
1533 |
$output .= '<div>
|
1534 |
<span class="full">
|
1535 |
|
1536 |
-
<input type="text" name="vfb-' . esc_html( $field->field_key ) . '" id="vfb-' . esc_html( $field->field_key ) . '" maxlength="150" class="text medium' . $required . $css . '" />
|
1537 |
-
<label>Address</label>
|
1538 |
</span>
|
1539 |
<span class="full">
|
1540 |
-
<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-2" id="vfb-' . esc_html( $field->field_key ) . '-2" maxlength="150" class="text medium' . $css . '" />
|
1541 |
-
<label>Address Line 2</label>
|
1542 |
</span>
|
1543 |
<span class="left">
|
1544 |
|
1545 |
-
<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-city" id="vfb-' . esc_html( $field->field_key ) . '-city" maxlength="150" class="text medium' . $required . $css . '" />
|
1546 |
-
<label>City</label>
|
1547 |
</span>
|
1548 |
<span class="right">
|
1549 |
-
<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-state" id="vfb-' . esc_html( $field->field_key ) . '-state" maxlength="150" class="text medium' . $required . $css . '" />
|
1550 |
-
<label>State / Province / Region</label>
|
1551 |
</span>
|
1552 |
<span class="left">
|
1553 |
|
1554 |
-
<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-zip" id="vfb-' . esc_html( $field->field_key ) . '-zip" maxlength="150" class="text medium' . $required . $css . '" />
|
1555 |
-
<label>Postal / Zip Code</label>
|
1556 |
</span>
|
1557 |
<span class="right">
|
1558 |
-
<select class="select' . $required . $css . '" name="vfb-' . esc_html( $field->field_key ) . '-country" id="vfb-' . esc_html( $field->field_key ) . '-country">
|
1559 |
<option selected="selected" value=""></option>';
|
1560 |
|
1561 |
foreach ( $countries as $country ) {
|
@@ -1563,19 +1719,18 @@ class Visual_Form_Builder{
|
|
1563 |
}
|
1564 |
|
1565 |
$output .= '</select>
|
1566 |
-
<label>Country</label>
|
1567 |
</span>
|
1568 |
</div>';
|
1569 |
-
|
1570 |
-
|
1571 |
break;
|
1572 |
|
1573 |
case 'date':
|
1574 |
|
1575 |
if ( !empty( $field->field_description ) )
|
1576 |
-
$output .= '<span><input type="text" name="vfb-' . esc_html( $field->field_key ) . '" id="vfb-' . esc_html( $field->field_key ) . '" value="" class="text vfb-date-picker ' . $field->field_size . $required . $css . '" /><label>' . stripslashes( $field->field_description ) . '</label></span>';
|
1577 |
else
|
1578 |
-
$output .= '<input type="text" name="vfb-' . esc_html( $field->field_key ) . '" id="vfb-' . esc_html( $field->field_key ) . '" value="" class="text vfb-date-picker ' . $field->field_size . $required . $css . '" />';
|
1579 |
|
1580 |
break;
|
1581 |
|
@@ -1590,26 +1745,27 @@ class Visual_Form_Builder{
|
|
1590 |
$hour_total = ( $time_format == '12' ) ? 12 : 23;
|
1591 |
|
1592 |
/* Hour */
|
1593 |
-
$output .= '<span class="time"><select name="vfb-'. $field->field_key . '[hour]" id="vfb-'. $field->field_key . '" class="select' . $required . $css . '">';
|
1594 |
for ( $i = $hour_start; $i <= $hour_total; $i++ ) {
|
1595 |
/* Add the leading zero */
|
1596 |
$hour = ( $i < 10 ) ? "0$i" : $i;
|
1597 |
$output .= "<option value='$hour'>$hour</option>";
|
1598 |
}
|
1599 |
-
$output .= '</select><label>HH</label></span>';
|
1600 |
|
1601 |
/* Minute */
|
1602 |
-
$output .= '<span class="time"><select name="vfb-'. $field->field_key . '[min]" id="vfb-'. $field->field_key . '" class="select' . $required . $css . '">';
|
1603 |
for ( $i = 0; $i <= 55; $i+=5 ) {
|
1604 |
/* Add the leading zero */
|
1605 |
$min = ( $i < 10 ) ? "0$i" : $i;
|
1606 |
$output .= "<option value='$min'>$min</option>";
|
1607 |
}
|
1608 |
-
$output .= '</select><label>MM</label></span>';
|
1609 |
|
1610 |
/* AM/PM */
|
1611 |
if ( $time_format == '12' )
|
1612 |
-
$output .= '<span class="time"><select name="vfb-'. $field->field_key . '[ampm]" id="vfb-'. $field->field_key . '" class="select' . $required . $css . '"><option value="AM">AM</option><option value="PM">PM</option></select><label>AM/PM</label></span>';
|
|
|
1613 |
break;
|
1614 |
|
1615 |
case 'html' :
|
@@ -1617,17 +1773,17 @@ class Visual_Form_Builder{
|
|
1617 |
if ( !empty( $field->field_description ) )
|
1618 |
$output .= '<span><label>' . stripslashes( $field->field_description ) . '</label></span>';
|
1619 |
|
1620 |
-
$output .= '<script type="text/javascript">edToolbar("vfb-' . $field->field_key . '");</script>';
|
1621 |
-
$output .= '<textarea name="vfb-'. $field->field_key . '" id="vfb-'. $field->field_key . '" class="textarea vfbEditor ' . $field->field_size . $required . $css . '"></textarea>';
|
1622 |
|
1623 |
break;
|
1624 |
|
1625 |
case 'file-upload' :
|
1626 |
|
1627 |
if ( !empty( $field->field_description ) )
|
1628 |
-
$output .= '<span><input type="file" size="35" name="vfb-' . esc_html( $field->field_key ) . '" id="vfb-' . esc_html( $field->field_key ) . '" value="" class="text ' . $field->field_size . $required . $validation . $css . '" /><label>' . $field->field_description . '</label></span>';
|
1629 |
else
|
1630 |
-
$output .= '<input type="file" size="35" name="vfb-' . esc_html( $field->field_key ) . '" id="vfb-' . esc_html( $field->field_key ) . '" value="" class="text ' . $field->field_size . $required . $validation . $css . '" />';
|
1631 |
|
1632 |
|
1633 |
break;
|
@@ -1647,8 +1803,9 @@ class Visual_Form_Builder{
|
|
1647 |
default:
|
1648 |
echo '';
|
1649 |
}
|
1650 |
-
|
1651 |
-
|
|
|
1652 |
}
|
1653 |
|
1654 |
/* Close user-added fields */
|
@@ -1661,9 +1818,9 @@ class Visual_Form_Builder{
|
|
1661 |
</div>
|
1662 |
<ul class="section section-' . $count . '">
|
1663 |
<li>
|
1664 |
-
<label class="desc">' . __( 'Please enter any two digits with' , 'visual-form-builder') . ' <strong>' . __( 'no' , 'visual-form-builder') . '</strong> ' . __( 'spaces (Example: 12)' , 'visual-form-builder') . '<span>*</span></label>
|
1665 |
<div>
|
1666 |
-
<input type="text" name="vfb-secret" id="vfb-secret" class="text medium
|
1667 |
</div>
|
1668 |
</li>
|
1669 |
<div style="display:none;">
|
@@ -1734,95 +1891,122 @@ class Visual_Form_Builder{
|
|
1734 |
}
|
1735 |
|
1736 |
/* Sender name override query */
|
1737 |
-
$sender_query = "SELECT fields.field_key FROM $this->form_table_name AS forms LEFT JOIN $this->field_table_name AS fields ON forms.form_email_from_name_override = fields.field_id WHERE forms.form_id = $form_id";
|
1738 |
$senders = $wpdb->get_results( $sender_query );
|
1739 |
|
1740 |
/* Sender email override query */
|
1741 |
-
$email_query = "SELECT fields.field_key FROM $this->form_table_name AS forms LEFT JOIN $this->field_table_name AS fields ON forms.form_email_from_override = fields.field_id WHERE forms.form_id = $form_id";
|
1742 |
$emails = $wpdb->get_results( $email_query );
|
1743 |
|
1744 |
/* Notification send to email override query */
|
1745 |
-
$notification_query = "SELECT fields.field_key FROM $this->form_table_name AS forms LEFT JOIN $this->field_table_name AS fields ON forms.form_notification_email = fields.field_id WHERE forms.form_id = $form_id";
|
1746 |
$notification = $wpdb->get_results( $notification_query );
|
1747 |
|
1748 |
/* Loop through name results and assign sender name to override, if needed */
|
1749 |
foreach( $senders as $sender ) {
|
1750 |
if ( !empty( $sender->field_key ) )
|
1751 |
-
$form_from_name = $_POST[ 'vfb-' . $sender->field_key ];
|
1752 |
}
|
1753 |
|
1754 |
/* Loop through email results and assign sender email to override, if needed */
|
1755 |
foreach ( $emails as $email ) {
|
1756 |
if ( !empty( $email->field_key ) )
|
1757 |
-
$form_from = $_POST[ 'vfb-' . $email->field_key ];
|
1758 |
}
|
1759 |
|
1760 |
/* Loop through email results and assign as blind carbon copy, if needed */
|
1761 |
foreach ( $notification as $notify ) {
|
1762 |
if ( !empty( $notify->field_key ) )
|
1763 |
-
$copy_email = $_POST[ 'vfb-' . $notify->field_key ];
|
1764 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1765 |
|
1766 |
|
1767 |
-
|
1768 |
/* Prepare the beginning of the content */
|
1769 |
$message = '<html><body><table rules="all" style="border-color: #666;" cellpadding="10">';
|
1770 |
|
1771 |
/* Loop through each form field and build the body of the message */
|
1772 |
-
foreach ( $
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
if ( is_array( $value ) && array_key_exists( 'hour', $value ) && array_key_exists( 'min', $value ) )
|
1780 |
-
$value = ( array_key_exists( 'ampm', $value ) ) ? substr_replace( implode( ':', $value ), ' ', 5, 1 ) : implode( ':', $value );
|
1781 |
-
/* If multiple values, build the list */
|
1782 |
-
elseif ( is_array( $value ) )
|
1783 |
-
$value = implode( ', ', $value );
|
1784 |
-
/* Lastly, handle single values */
|
1785 |
-
else
|
1786 |
-
$value = esc_html( $value );
|
1787 |
-
|
1788 |
-
/* Hide fields that aren't necessary to the body of the message */
|
1789 |
-
if ( !in_array( $key, array( 'spam', 'secret', 'visual form builder submit', '_wpnonce', 'form_id' ) ) ) {
|
1790 |
-
$message .= '<tr><td><strong>' . ucwords( $key ) . ': </strong></td><td>' . $value . '</td></tr>';
|
1791 |
-
$fields[ $key ] = $value;
|
1792 |
-
}
|
1793 |
-
}
|
1794 |
-
|
1795 |
-
/* Prepare the attachments */
|
1796 |
-
if ( isset( $_FILES ) ) {
|
1797 |
-
foreach ( $_FILES as $k => $v ) {
|
1798 |
-
if ( $v['size'] > 0 ) {
|
1799 |
-
/* Options array for the wp_handle_upload function. 'test_upload' => false */
|
1800 |
$upload_overrides = array( 'test_form' => false );
|
1801 |
|
1802 |
/* We need to include the file that runs the wp_handle_upload function */
|
1803 |
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
1804 |
|
1805 |
/* Handle the upload using WP's wp_handle_upload function. Takes the posted file and an options array */
|
1806 |
-
$uploaded_file = wp_handle_upload( $
|
1807 |
|
1808 |
/* If the wp_handle_upload call returned a local path for the image */
|
1809 |
if ( isset( $uploaded_file['file'] ) ) {
|
1810 |
-
$attachments[$
|
1811 |
-
|
1812 |
-
$
|
1813 |
-
|
1814 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1815 |
|
1816 |
-
$message .= '<tr><td><strong>' .
|
1817 |
}
|
1818 |
}
|
1819 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1820 |
}
|
1821 |
|
1822 |
/* Setup our entries data */
|
1823 |
$entry = array(
|
1824 |
'form_id' => $form_id,
|
1825 |
-
'data' => serialize( $
|
1826 |
'subject' => $form_subject,
|
1827 |
'sender_name' => $form_from_name,
|
1828 |
'sender_email' => $form_from,
|
3 |
Plugin Name: Visual Form Builder
|
4 |
Description: Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
|
5 |
Author: Matthew Muro
|
6 |
+
Version: 1.9
|
7 |
*/
|
8 |
|
9 |
/*
|
27 |
/* Restrict Categories class */
|
28 |
class Visual_Form_Builder{
|
29 |
|
30 |
+
public $vfb_db_version = '1.9';
|
31 |
|
32 |
public function __construct(){
|
33 |
global $wpdb;
|
42 |
/* Build options and settings pages. */
|
43 |
add_action( 'admin_menu', array( &$this, 'add_admin' ) );
|
44 |
add_action( 'admin_menu', array( &$this, 'save' ) );
|
45 |
+
|
46 |
+
add_action( 'wp_ajax_visual_form_builder_process_sort', array( &$this, 'process_sort_callback' ) );
|
47 |
+
add_action( 'wp_ajax_visual_form_builder_create_field', array( &$this, 'create_field_callback' ) );
|
48 |
+
add_action( 'wp_ajax_visual_form_builder_delete_field', array( &$this, 'delete_field_callback' ) );
|
49 |
+
|
50 |
add_action( 'admin_init', array( &$this, 'add_visual_form_builder_contextual_help' ) );
|
51 |
add_action( 'admin_init', array( &$this, 'export_entries' ) );
|
52 |
|
122 |
<li><em>Description</em> will be displayed below the associated input.</li>
|
123 |
<li><em>Validation</em> allows you to select from several of jQuery's Form Validation methods for text inputs. For more about the types of validation, read the <em>Validation</em> section below.</li>
|
124 |
<li><em>Required</em> is either Yes or No. Selecting 'Yes' will make the associated input a required field and the form will not submit until the user fills this field out correctly.</li>
|
125 |
+
<li><em>Options</em> will only be active for Radio and Checkboxes. This field contols how many options are available for the associated input.</li>
|
126 |
<li><em>Size</em> controls the width of Text, Textarea, Select, and Date Picker input fields. The default is set to Medium but if you need a longer text input, select Large.</li>
|
127 |
+
<li><em>CSS Classes</em> allow you to add custom CSS to a field. This option allows you to fine tune the look of the form.</li>
|
128 |
</ul>
|
129 |
+
<p><strong>Validation</strong></p>
|
130 |
<ul>
|
131 |
<li>Visual Form Builder uses the <a href='http://docs.jquery.com/Plugins/Validation/Validator'>jQuery Form Validation plugin</a> to perform clientside form validation.</li>
|
132 |
<li><em>Email</em>: makes the element require a valid email.</li>
|
137 |
<li><em>Phone</em>: makes the element require a US or International phone number. Most formats are accepted.</li>
|
138 |
<li><em>Time</em>: choose either 12- or 24-hour time format (NOTE: only available with the Time field).</li>
|
139 |
</ul>
|
140 |
+
<p><strong>Confirmation</strong></p>
|
141 |
<ul>
|
142 |
<li>Each form allows you to customize the confirmation by selecing either a Text Message, a WordPress Page, or to Redirect to a URL.</li>
|
143 |
<li><em>Text</em> allows you to enter a custom formatted message that will be displayed on the page after your form is submitted. HTML is allowed here.</li>
|
144 |
<li><em>Page</em> displays a dropdown of all WordPress Pages you have created. Select one to redirect the user to that page after your form is submitted.</li>
|
145 |
<li><em>Redirect</em> will only accept URLs and can be used to send the user to a different site completely, if you choose.</li>
|
146 |
</ul>
|
147 |
+
<p><strong>Notification</strong></p>
|
148 |
<ul>
|
149 |
<li>Send a customized notification email to the user when the form has been successfully submitted.</li>
|
150 |
<li><em>Sender Name</em>: the name that will be displayed on the email.</li>
|
159 |
<li>Fieldsets, a way to group form fields, are an essential piece of this plugin's HTML. As such, at least one fieldset is required and must be first in the order. Subsequent fieldsets may be placed wherever you would like to start your next grouping of fields.</li>
|
160 |
<li>Security verification is automatically included on very form. It's a simple logic question and should keep out most, if not all, spam bots.</li>
|
161 |
<li>There is a hidden spam field, known as a honey pot, that should also help deter potential abusers of your form.</li>
|
162 |
+
<li>Nesting is allowed underneath fieldsets and sections. Sections can be nested underneath fieldsets. Nesting is not required, however, it does make reorganizing easier.</li>
|
163 |
</ul>";
|
164 |
|
165 |
add_contextual_help( 'settings_page_visual-form-builder', $text );
|
256 |
field_options TEXT,
|
257 |
field_description TEXT,
|
258 |
field_name VARCHAR(255) NOT NULL,
|
259 |
+
field_sequence BIGINT(20) DEFAULT '0',
|
260 |
+
field_parent BIGINT(20) DEFAULT '0',
|
261 |
field_validation VARCHAR(25),
|
262 |
field_required VARCHAR(25),
|
263 |
+
field_size VARCHAR(25) DEFAULT 'medium',
|
264 |
field_css VARCHAR(255),
|
265 |
UNIQUE KEY (field_id)
|
266 |
) DEFAULT CHARACTER SET $charset COLLATE $collate;";
|
295 |
sender_name VARCHAR(255),
|
296 |
sender_email VARCHAR(25),
|
297 |
emails_to VARCHAR(255),
|
298 |
+
date_submitted DATETIME,
|
299 |
ip_address VARCHAR(25),
|
300 |
UNIQUE KEY (entries_id)
|
301 |
) DEFAULT CHARACTER SET $charset COLLATE $collate;";
|
327 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
328 |
wp_enqueue_script( 'jquery-form-validation', 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js', array( 'jquery' ), '', true );
|
329 |
wp_enqueue_script( 'form-elements-add', plugins_url( 'visual-form-builder' ) . '/js/visual-form-builder.js' , array( 'jquery', 'jquery-form-validation' ), '', true );
|
330 |
+
wp_enqueue_script( 'nested-sortable', plugins_url( 'visual-form-builder' ) . '/js/jquery.ui.nestedSortable.js' , array( 'jquery', 'jquery-ui-sortable' ), '', true );
|
331 |
}
|
332 |
|
333 |
/**
|
423 |
/* Add the first fieldset to get things started */
|
424 |
$wpdb->insert( $this->field_table_name, $initial_fieldset );
|
425 |
|
426 |
+
/* Make the submit last in the sequence */
|
427 |
$submit = array(
|
428 |
'form_id' => $new_form_selected,
|
429 |
'field_key' => 'submit',
|
430 |
'field_type' => 'submit',
|
431 |
'field_name' => 'Submit',
|
432 |
+
'field_sequence' => 1
|
433 |
);
|
434 |
|
435 |
/* Insert the submit field */
|
503 |
/* Update form details */
|
504 |
$wpdb->update( $this->form_table_name, $newdata, $where );
|
505 |
|
506 |
+
/* Initialize field sequence */
|
507 |
+
$field_sequence = 0;
|
508 |
+
|
509 |
/* Loop through each field and update all at once */
|
510 |
if ( !empty( $_REQUEST['field_id'] ) ) {
|
511 |
foreach ( $_REQUEST['field_id'] as $id ) {
|
526 |
'field_validation' => $field_validation,
|
527 |
'field_required' => $field_required,
|
528 |
'field_size' => $field_size,
|
529 |
+
'field_css' => $field_css,
|
530 |
+
'field_sequence' => $field_sequence
|
531 |
);
|
532 |
|
533 |
$where = array(
|
537 |
|
538 |
/* Update all fields */
|
539 |
$wpdb->update( $this->field_table_name, $field_data, $where );
|
540 |
+
|
541 |
+
$field_sequence++;
|
542 |
}
|
543 |
|
544 |
/* Check if a submit field type exists for backwards compatibility upgrades */
|
545 |
+
$is_submit = $wpdb->get_var( "SELECT field_type FROM $this->field_table_name WHERE field_type = 'submit' AND form_id = $form_id" );
|
546 |
+
|
547 |
+
/* Force the submit sequence to be the last one */
|
548 |
+
$field_sequence--;
|
549 |
|
550 |
/* If this form doesn't have a submit field, add one */
|
551 |
if ( $is_submit == NULL ) {
|
552 |
+
/* Make the submit last in the sequence */
|
553 |
$submit = array(
|
554 |
'form_id' => $form_id,
|
555 |
'field_key' => 'submit',
|
556 |
'field_type' => 'submit',
|
557 |
'field_name' => 'Submit',
|
558 |
+
'field_sequence' => $field_sequence
|
559 |
);
|
560 |
|
561 |
/* Insert the submit field */
|
562 |
$wpdb->insert( $this->field_table_name, $submit );
|
563 |
}
|
564 |
+
else {
|
565 |
+
$data = array(
|
566 |
+
'field_sequence' => $field_sequence
|
567 |
+
);
|
568 |
+
|
569 |
+
$where = array(
|
570 |
+
'form_id' => $_REQUEST['form_id'],
|
571 |
+
'field_id' => $is_submit
|
572 |
+
);
|
573 |
+
|
574 |
+
/* Update the submit field */
|
575 |
+
$wpdb->update( $this->field_table_name, $data, $where );
|
576 |
+
}
|
577 |
}
|
578 |
|
579 |
/* Set message to display */
|
655 |
'field_validation' => $field->field_validation,
|
656 |
'field_required' => $field->field_required,
|
657 |
'field_size' => $field->field_size,
|
658 |
+
'field_css' => $field->field_css,
|
659 |
+
'field_parent' => $field->field_parent
|
660 |
);
|
661 |
|
662 |
$wpdb->insert( $this->field_table_name, $data );
|
677 |
exit();
|
678 |
|
679 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
680 |
}
|
681 |
}
|
682 |
}
|
686 |
*
|
687 |
* @since 1.0
|
688 |
*/
|
689 |
+
public function process_sort_callback() {
|
690 |
global $wpdb;
|
691 |
|
692 |
+
$data = array();
|
693 |
+
|
694 |
+
foreach ( $_REQUEST['order'] as $k ) {
|
695 |
+
if ( 'root' !== $k['item_id'] ) {
|
696 |
+
$data[] = array(
|
697 |
+
'field_id' => $k['item_id'],
|
698 |
+
'parent' => $k['parent_id']
|
699 |
+
);
|
700 |
+
}
|
701 |
+
}
|
702 |
+
|
703 |
+
foreach ( $data as $k => $v ) {
|
704 |
+
/* Update each field with it's new sequence and parent ID */
|
705 |
+
$wpdb->update( $this->field_table_name, array( 'field_sequence' => $k, 'field_parent' => $v['parent'] ), array( 'field_id' => $v['field_id'] ) );
|
706 |
+
}
|
707 |
+
|
708 |
+
die(1);
|
709 |
+
}
|
710 |
+
|
711 |
+
/**
|
712 |
+
* The jQuery create field callback
|
713 |
+
*
|
714 |
+
* @since 1.9
|
715 |
+
*/
|
716 |
+
public function create_field_callback() {
|
717 |
+
global $wpdb;
|
718 |
+
|
719 |
+
$data = array();
|
720 |
+
|
721 |
+
foreach ( $_REQUEST['data'] as $k ) {
|
722 |
+
$data[ $k['name'] ] = $k['value'];
|
723 |
+
}
|
724 |
|
725 |
+
if ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'settings_page_visual-form-builder' && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'visual_form_builder_create_field' ) {
|
726 |
+
$form_id = absint( $data['form_id'] );
|
727 |
+
$field_key = sanitize_title( $_REQUEST['field_type'] );
|
728 |
+
$field_name = esc_html( $_REQUEST['field_type'] );
|
729 |
+
$field_type = strtolower( sanitize_title( $_REQUEST['field_type'] ) );
|
730 |
+
|
731 |
+
/* Set defaults for validation */
|
732 |
+
switch ( $field_type ) {
|
733 |
+
case 'email' :
|
734 |
+
case 'url' :
|
735 |
+
case 'phone' :
|
736 |
+
$field_validation = $field_type;
|
737 |
+
break;
|
738 |
+
case 'currency' :
|
739 |
+
$field_validation = 'number';
|
740 |
+
break;
|
741 |
+
case 'number' :
|
742 |
+
$field_validation = 'digits';
|
743 |
+
break;
|
744 |
+
case 'time' :
|
745 |
+
$field_validation = 'time-12';
|
746 |
+
break;
|
747 |
+
}
|
748 |
+
|
749 |
+
check_ajax_referer( 'create-field-' . $data['form_id'], 'nonce' );
|
750 |
+
|
751 |
+
/* Get the last row's sequence that isn't a Submit */
|
752 |
+
$sequence_last_row = $wpdb->get_row( "SELECT field_sequence FROM $this->field_table_name WHERE form_id = $form_id AND field_type != 'submit' ORDER BY field_sequence DESC LIMIT 1" );
|
753 |
+
|
754 |
+
/* If it's not the first for this form, add 1 */
|
755 |
+
$field_sequence = ( !empty( $sequence_last_row ) ) ? $sequence_last_row->field_sequence + 1 : 0;
|
756 |
+
|
757 |
+
$newdata = array(
|
758 |
+
'form_id' => absint( $data['form_id'] ),
|
759 |
+
'field_key' => $field_key,
|
760 |
+
'field_name' => $field_name,
|
761 |
+
'field_type' => $field_type,
|
762 |
+
'field_sequence' => $field_sequence,
|
763 |
+
'field_validation' => $field_validation
|
764 |
+
);
|
765 |
|
766 |
+
/* Create the field */
|
767 |
+
$wpdb->insert( $this->field_table_name, $newdata );
|
768 |
+
|
769 |
+
/* Move submit to the end */
|
770 |
+
$submit_data = array(
|
771 |
+
'field_sequence' => $field_sequence + 1
|
772 |
+
);
|
773 |
+
|
774 |
+
$submit_where = array(
|
775 |
+
'form_id' => $newdata[ 'form_id' ],
|
776 |
+
'field_type' => 'submit'
|
777 |
+
);
|
778 |
+
|
779 |
+
$wpdb->update( $this->field_table_name, $submit_data, $submit_where );
|
780 |
+
|
781 |
+
echo $this->field_output( $data['form_id'], $wpdb->insert_id );
|
782 |
}
|
783 |
+
|
784 |
+
die(1);
|
785 |
+
}
|
786 |
+
|
787 |
+
/**
|
788 |
+
* The jQuery delete field callback
|
789 |
+
*
|
790 |
+
* @since 1.9
|
791 |
+
*/
|
792 |
+
public function delete_field_callback() {
|
793 |
+
global $wpdb;
|
794 |
|
795 |
+
if ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'settings_page_visual-form-builder' && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'visual_form_builder_delete_field' ) {
|
796 |
+
$form_id = absint( $_REQUEST['form'] );
|
797 |
+
$field_id = absint( $_REQUEST['field'] );
|
798 |
+
|
799 |
+
check_ajax_referer( 'delete-field-' . $form_id, 'nonce' );
|
800 |
+
|
801 |
+
if ( isset( $_REQUEST['child_ids'] ) ) {
|
802 |
+
foreach ( $_REQUEST['child_ids'] as $children ) {
|
803 |
+
$parent = absint( $_REQUEST['parent_id'] );
|
804 |
+
|
805 |
+
/* Update each child item with the new parent ID */
|
806 |
+
$wpdb->update( $this->field_table_name, array( 'field_parent' => $parent ), array( 'field_id' => $children ) );
|
807 |
+
}
|
808 |
+
}
|
809 |
+
|
810 |
+
/* Delete the field */
|
811 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $this->field_table_name WHERE field_id = %d", $field_id ) );
|
812 |
+
}
|
813 |
+
|
814 |
die(1);
|
815 |
}
|
816 |
+
|
817 |
+
/**
|
818 |
+
* Build field output in admin
|
819 |
+
*
|
820 |
+
* @since 1.9
|
821 |
+
*/
|
822 |
+
public function field_output( $form_nav_selected_id, $field_id = NULL ) {
|
823 |
+
global $wpdb;
|
824 |
+
|
825 |
+
$field_where = ( isset( $field_id ) && !is_null( $field_id ) ) ? "AND field_id = $field_id" : '';
|
826 |
+
/* Display all fields for the selected form */
|
827 |
+
$query_fields = "SELECT * FROM $this->field_table_name WHERE form_id = $form_nav_selected_id $field_where ORDER BY field_sequence ASC";
|
828 |
+
$fields = $wpdb->get_results( $query_fields );
|
829 |
+
|
830 |
+
$depth = 1;
|
831 |
+
$parent = $last = 0;
|
832 |
+
|
833 |
+
/* Loop through each field and display */
|
834 |
+
foreach ( $fields as $field ) :
|
835 |
+
/* If we are at the root level */
|
836 |
+
if ( !$field->field_parent && $depth > 1 ) {
|
837 |
+
/* If we've been down a level, close out the list */
|
838 |
+
while ( $depth > 1 ) {
|
839 |
+
echo '</li>
|
840 |
+
</ul>';
|
841 |
+
$depth--;
|
842 |
+
}
|
843 |
+
|
844 |
+
/* Close out the root item */
|
845 |
+
echo '</li>';
|
846 |
+
}
|
847 |
+
/* first item of <ul>, so move down a level */
|
848 |
+
elseif ( $field->field_parent && $field->field_parent == $last ) {
|
849 |
+
echo '<ul class="parent">';
|
850 |
+
$depth++;
|
851 |
+
}
|
852 |
+
/* Close up a <ul> and move up a level */
|
853 |
+
elseif ( $field->field_parent && $field->field_parent != $parent ) {
|
854 |
+
echo '</li>
|
855 |
+
</ul>
|
856 |
+
</li>';
|
857 |
+
$depth--;
|
858 |
+
}
|
859 |
+
/* Same level so close list item */
|
860 |
+
elseif ( $field->field_parent && $field->field_parent == $parent )
|
861 |
+
echo '</li>';
|
862 |
+
|
863 |
+
/* Store item ID and parent ID to test for nesting */
|
864 |
+
$last = $field->field_id;
|
865 |
+
$parent = $field->field_parent;
|
866 |
+
?>
|
867 |
+
<li id="form_item_<?php echo $field->field_id; ?>" class="form-item<?php echo ( $field->field_type == 'submit' ) ? ' ui-state-disabled' : ''; ?><?php echo ( !in_array( $field->field_type, array( 'fieldset', 'section' ) ) ) ? ' ui-nestedSortable-no-nesting' : ''; ?>">
|
868 |
+
<dl class="menu-item-bar">
|
869 |
+
<dt class="menu-item-handle<?php echo ( $field->field_type == 'fieldset' ) ? ' fieldset' : ''; ?>">
|
870 |
+
<span class="item-title"><?php echo stripslashes( htmlspecialchars( $field->field_name ) ); ?><?php echo ( $field->field_required == 'yes' ) ? ' <span class="is-field-required">*</span>' : ''; ?></span>
|
871 |
+
<span class="item-controls">
|
872 |
+
<span class="item-type"><?php echo strtoupper( str_replace( '-', ' ', $field->field_type ) ); ?></span>
|
873 |
+
<a href="#" title="<?php _e( 'Edit Field Item' , 'visual-form-builder'); ?>" id="edit-<?php echo $field->field_id; ?>" class="item-edit"><?php _e( 'Edit Field Item' , 'visual-form-builder'); ?></a>
|
874 |
+
</span>
|
875 |
+
</dt>
|
876 |
+
</dl>
|
877 |
+
|
878 |
+
<div id="form-item-settings-<?php echo $field->field_id; ?>" class="menu-item-settings field-type-<?php echo $field->field_type; ?>" style="display: none;">
|
879 |
+
<?php if ( $field->field_type == 'fieldset' || $field->field_type == 'section' ) : ?>
|
880 |
+
|
881 |
+
<p class="description description-wide">
|
882 |
+
<label for="edit-form-item-name-<?php echo $field->field_id; ?>"><?php echo ( $field->field_type == 'fieldset' ) ? 'Legend' : 'Name'; ?><br />
|
883 |
+
<input type="text" value="<?php echo stripslashes( $field->field_name ); ?>" name="field_name-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-name-<?php echo $field->field_id; ?>" />
|
884 |
+
</label>
|
885 |
+
</p>
|
886 |
+
|
887 |
+
<?php elseif( $field->field_type == 'instructions' ) : ?>
|
888 |
+
|
889 |
+
<p class="description description-wide">
|
890 |
+
<label for="edit-form-item-name-<?php echo $field->field_id; ?>">
|
891 |
+
<?php _e( 'Name' , 'visual-form-builder'); ?><br />
|
892 |
+
<input type="text" value="<?php echo stripslashes( htmlspecialchars( $field->field_name ) ); ?>" name="field_name-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-name-<?php echo $field->field_id; ?>" />
|
893 |
+
</label>
|
894 |
+
</p>
|
895 |
+
<p class="description description-wide">
|
896 |
+
<label for="edit-form-item-description-<?php echo $field->field_id; ?>">Description (HTML tags allowed)<br />
|
897 |
+
<textarea name="field_description-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-description-<?php echo $field->field_id; ?>" /><?php echo stripslashes( $field->field_description ); ?></textarea>
|
898 |
+
</label>
|
899 |
+
</p>
|
900 |
+
<p class="description description-wide">
|
901 |
+
<label for="edit-form-item-css-<?php echo $field->field_id; ?>">
|
902 |
+
<?php _e( 'CSS Classes' , 'visual-form-builder'); ?><br />
|
903 |
+
<input type="text" value="<?php echo stripslashes( htmlspecialchars( $field->field_css ) ); ?>" name="field_css-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-css-<?php echo $field->field_id; ?>" />
|
904 |
+
</label>
|
905 |
+
</p>
|
906 |
+
|
907 |
+
<?php else: ?>
|
908 |
+
|
909 |
+
<!-- Name -->
|
910 |
+
<p class="description description-wide">
|
911 |
+
<label for="edit-form-item-name-<?php echo $field->field_id; ?>">
|
912 |
+
<?php _e( 'Name' , 'visual-form-builder'); ?><br />
|
913 |
+
<input type="text" value="<?php echo stripslashes( htmlspecialchars( $field->field_name ) ); ?>" name="field_name-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-name-<?php echo $field->field_id; ?>" />
|
914 |
+
</label>
|
915 |
+
</p>
|
916 |
+
<?php if ( $field->field_type !== 'submit' ) : ?>
|
917 |
+
<!-- Description -->
|
918 |
+
<p class="description description-wide">
|
919 |
+
<label for="edit-form-item-description-<?php echo $field->field_id; ?>">
|
920 |
+
<?php _e( 'Description' , 'visual-form-builder'); ?><br />
|
921 |
+
<input type="text" value="<?php echo stripslashes( $field->field_description ); ?>" name="field_description-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-description-<?php echo $field->field_id; ?>" />
|
922 |
+
</label>
|
923 |
+
</p>
|
924 |
+
|
925 |
+
<?php
|
926 |
+
/* Display the Options input only for radio, checkbox, and select fields */
|
927 |
+
if ( in_array( $field->field_type, array( 'radio', 'checkbox', 'select' ) ) ) : ?>
|
928 |
+
<!-- Options -->
|
929 |
+
<p class="description description-wide">
|
930 |
+
<?php _e( 'Options' , 'visual-form-builder'); ?>
|
931 |
+
<?php
|
932 |
+
/* If the options field isn't empty, unserialize and build array */
|
933 |
+
if ( !empty( $field->field_options ) ) {
|
934 |
+
if ( is_serialized( $field->field_options ) )
|
935 |
+
$opts_vals = ( is_array( unserialize( $field->field_options ) ) ) ? unserialize( $field->field_options ) : explode( ',', unserialize( $field->field_options ) );
|
936 |
+
}
|
937 |
+
/* Otherwise, present some default options */
|
938 |
+
else
|
939 |
+
$opts_vals = array( 'Option 1', 'Option 2', 'Option 3' );
|
940 |
+
|
941 |
+
/* Basic count to keep track of multiple options */
|
942 |
+
$count = 1;
|
943 |
+
|
944 |
+
/* Loop through the options */
|
945 |
+
foreach ( $opts_vals as $options ) {
|
946 |
+
?>
|
947 |
+
<div id="clone-<?php echo $field->field_id . '-' . $count; ?>" class="option">
|
948 |
+
<label for="edit-form-item-options-<?php echo $field->field_id . "-$count"; ?>" class="clonedOption">
|
949 |
+
<input type="text" value="<?php echo stripslashes( $options ); ?>" name="field_options-<?php echo $field->field_id; ?>[]" class="widefat" id="edit-form-item-options-<?php echo $field->field_id . "-$count"; ?>" />
|
950 |
+
</label>
|
951 |
+
|
952 |
+
<a href="#" class="addOption" title="Add an Option">Add</a> <a href="#" class="deleteOption" title="Delete Option">Delete</a>
|
953 |
+
</div>
|
954 |
+
<?php
|
955 |
+
$count++;
|
956 |
+
}
|
957 |
+
?>
|
958 |
+
</p>
|
959 |
+
<?php
|
960 |
+
/* Unset the options for any following radio, checkboxes, or selects */
|
961 |
+
unset( $opts_vals );
|
962 |
+
endif;
|
963 |
+
?>
|
964 |
+
|
965 |
+
<!-- Validation -->
|
966 |
+
<p class="description description-thin">
|
967 |
+
<label for="edit-form-item-validation">
|
968 |
+
Validation<br />
|
969 |
+
<select name="field_validation-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-validation-<?php echo $field->field_id; ?>"<?php echo ( in_array( $field->field_type, array( 'radio', 'select', 'checkbox', 'address', 'date', 'textarea', 'html', 'file-upload' ) ) ) ? ' disabled="disabled"' : ''; ?>>
|
970 |
+
<?php if ( $field->field_type == 'time' ) : ?>
|
971 |
+
<option value="time-12" <?php selected( $field->field_validation, 'time-12' ); ?>><?php _e( '12 Hour Format' , 'visual-form-builder'); ?></option>
|
972 |
+
<option value="time-24" <?php selected( $field->field_validation, 'time-24' ); ?>><?php _e( '24 Hour Format' , 'visual-form-builder'); ?></option>
|
973 |
+
<?php else : ?>
|
974 |
+
<option value="" <?php selected( $field->field_validation, '' ); ?>><?php _e( 'None' , 'visual-form-builder'); ?></option>
|
975 |
+
<option value="email" <?php selected( $field->field_validation, 'email' ); ?>><?php _e( 'Email' , 'visual-form-builder'); ?></option>
|
976 |
+
<option value="url" <?php selected( $field->field_validation, 'url' ); ?>><?php _e( 'URL' , 'visual-form-builder'); ?></option>
|
977 |
+
<option value="date" <?php selected( $field->field_validation, 'date' ); ?>><?php _e( 'Date' , 'visual-form-builder'); ?></option>
|
978 |
+
<option value="number" <?php selected( $field->field_validation, 'number' ); ?>><?php _e( 'Number' , 'visual-form-builder'); ?></option>
|
979 |
+
<option value="digits" <?php selected( $field->field_validation, 'digits' ); ?>><?php _e( 'Digits' , 'visual-form-builder'); ?></option>
|
980 |
+
<option value="phone" <?php selected( $field->field_validation, 'phone' ); ?>><?php _e( 'Phone' , 'visual-form-builder'); ?></option>
|
981 |
+
<?php endif; ?>
|
982 |
+
</select>
|
983 |
+
</label>
|
984 |
+
</p>
|
985 |
+
|
986 |
+
<!-- Required -->
|
987 |
+
<p class="field-link-target description description-thin">
|
988 |
+
<label for="edit-form-item-required">
|
989 |
+
<?php _e( 'Required' , 'visual-form-builder'); ?><br />
|
990 |
+
<select name="field_required-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-required-<?php echo $field->field_id; ?>">
|
991 |
+
<option value="no" <?php selected( $field->field_required, 'no' ); ?>><?php _e( 'No' , 'visual-form-builder'); ?></option>
|
992 |
+
<option value="yes" <?php selected( $field->field_required, 'yes' ); ?>><?php _e( 'Yes' , 'visual-form-builder'); ?></option>
|
993 |
+
</select>
|
994 |
+
</label>
|
995 |
+
</p>
|
996 |
+
|
997 |
+
<?php if ( !in_array( $field->field_type, array( 'radio', 'checkbox', 'time' ) ) ) : ?>
|
998 |
+
<!-- Size -->
|
999 |
+
<p class="description description-wide">
|
1000 |
+
<label for="edit-form-item-size">
|
1001 |
+
<?php _e( 'Size' , 'visual-form-builder'); ?><br />
|
1002 |
+
<select name="field_size-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-size-<?php echo $field->field_id; ?>">
|
1003 |
+
<option value="medium" <?php selected( $field->field_size, 'medium' ); ?>><?php _e( 'Medium' , 'visual-form-builder'); ?></option>
|
1004 |
+
<option value="large" <?php selected( $field->field_size, 'large' ); ?>><?php _e( 'Large' , 'visual-form-builder'); ?></option>
|
1005 |
+
</select>
|
1006 |
+
</label>
|
1007 |
+
</p>
|
1008 |
+
<?php endif; ?>
|
1009 |
+
|
1010 |
+
<p class="description description-wide">
|
1011 |
+
<label for="edit-form-item-css-<?php echo $field->field_id; ?>">
|
1012 |
+
<?php _e( 'CSS Classes' , 'visual-form-builder'); ?><br />
|
1013 |
+
<input type="text" value="<?php echo stripslashes( htmlspecialchars( $field->field_css ) ); ?>" name="field_css-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-css-<?php echo $field->field_id; ?>" />
|
1014 |
+
</label>
|
1015 |
+
</p>
|
1016 |
+
|
1017 |
+
<?php endif; ?>
|
1018 |
+
<?php endif; ?>
|
1019 |
+
|
1020 |
+
<?php if ( $field->field_type !== 'submit' ) : ?>
|
1021 |
+
<div class="menu-item-actions description-wide submitbox">
|
1022 |
+
<a href="<?php echo esc_url( wp_nonce_url( admin_url('options-general.php?page=visual-form-builder&action=delete_field&form=' . $form_nav_selected_id . '&field=' . $field->field_id ), 'delete-field-' . $form_nav_selected_id ) ); ?>" class="item-delete submitdelete deletion"><?php _e( 'Remove' , 'visual-form-builder'); ?></a>
|
1023 |
+
</div>
|
1024 |
+
<?php endif; ?>
|
1025 |
+
|
1026 |
+
<input type="hidden" name="field_id[<?php echo $field->field_id; ?>]" value="<?php echo $field->field_id; ?>" />
|
1027 |
+
</div>
|
1028 |
+
<?php
|
1029 |
+
endforeach;
|
1030 |
+
|
1031 |
+
/* This assures all of the <ul> and <li> are closed */
|
1032 |
+
if ( $depth > 1 ) {
|
1033 |
+
while( $depth > 1 ) {
|
1034 |
+
echo '</li>
|
1035 |
+
</ul>';
|
1036 |
+
$depth--;
|
1037 |
+
}
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
/* Close out last item */
|
1041 |
+
echo '</li>';
|
1042 |
+
}
|
1043 |
|
1044 |
/**
|
1045 |
* Builds the options settings page
|
1122 |
<p><strong><?php _e( 'Click' , 'visual-form-builder'); ?></strong> <?php _e( 'to Add a Field' , 'visual-form-builder'); ?> <img id="add-to-form" alt="" src="<?php echo admin_url( '/images/wpspin_light.gif' ); ?>" class="waiting" /></p>
|
1123 |
<ul>
|
1124 |
<li><input type="submit" id="form-element-fieldset" class="button-secondary" name="field_type" value="Fieldset"<?php echo $disabled; ?> /></li>
|
1125 |
+
<li><input type="submit" id="form-element-section" class="button-secondary" name="field_type" value="Section"<?php echo $disabled; ?> /></li>
|
1126 |
<li><input type="submit" id="form-element-text" class="button-secondary" name="field_type" value="Text"<?php echo $disabled; ?> /></li>
|
1127 |
<li><input type="submit" id="form-element-textarea" class="button-secondary" name="field_type" value="Textarea"<?php echo $disabled; ?> /></li>
|
1128 |
<li><input type="submit" id="form-element-checkbox" class="button-secondary" name="field_type" value="Checkbox"<?php echo $disabled; ?> /></li>
|
1436 |
<li id="twitter"><?php _e( 'Follow me on Twitter' , 'visual-form-builder'); ?>: <a href="http://twitter.com/#!/matthewmuro">@matthewmuro</a></li>
|
1437 |
<li id="star"><a href="http://wordpress.org/extend/plugins/visual-form-builder/"><?php _e( 'Rate Visual Form Builder on WordPress.org' , 'visual-form-builder'); ?></a></li>
|
1438 |
<li id="paypal">
|
1439 |
+
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=G87A9UN9CLPH4&lc=US&item_name=Visual%20Form%20Builder¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted"><img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" width="74" height="21"></a>
|
1440 |
</li>
|
1441 |
</ul>
|
1442 |
</div>
|
1445 |
if ( !empty( $form_nav_selected_id ) && $form_nav_selected_id !== '0' ) :
|
1446 |
/* Display help text for adding fields */
|
1447 |
printf( '<div class="post-body-plain" id="menu-instructions"><p>%s</p></div>', __( 'Select form inputs from the box at left to begin building your custom form. An initial fieldset has been automatically added to get you started.' , 'visual-form-builder') );
|
1448 |
+
|
1449 |
+
/* Output the fields for each form */
|
|
|
|
|
|
|
1450 |
echo '<ul id="menu-to-edit" class="menu ui-sortable droppable">';
|
1451 |
|
1452 |
+
echo $this->field_output( $form_nav_selected_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1453 |
|
1454 |
echo '</ul>';
|
1455 |
|
1529 |
/* Get form id. Allows use of [vfb id=1] or [vfb 1] */
|
1530 |
$form_id = ( isset( $id ) && !empty( $id ) ) ? $id : $atts[0];
|
1531 |
|
1532 |
+
$open_fieldset = $open_section = false;
|
1533 |
|
1534 |
/* Default the submit value */
|
1535 |
$submit = 'Submit';
|
1550 |
$query_fields = "SELECT * FROM $this->field_table_name WHERE form_id = $form_id ORDER BY $order_fields";
|
1551 |
|
1552 |
$fields = $wpdb->get_results( $query_fields );
|
1553 |
+
|
1554 |
/* Setup count for fieldset and ul/section class names */
|
1555 |
$count = 1;
|
1556 |
+
|
1557 |
foreach ( $forms as $form ) :
|
1558 |
|
1559 |
$output = '<form id="' . $form->form_key . '" class="visual-form-builder" method="post" enctype="multipart/form-data">
|
1560 |
<input type="hidden" name="form_id" value="' . $form->form_id . '" />';
|
1561 |
$output .= wp_nonce_field( 'visual-form-builder-nonce', '_wpnonce', false, false );
|
1562 |
+
|
1563 |
foreach ( $fields as $field ) {
|
1564 |
+
|
1565 |
+
/* Close each section */
|
1566 |
+
if ( $open_section == true ) {
|
1567 |
+
/* If this field's parent does NOT equal our section ID */
|
1568 |
+
if ( $sec_id && $sec_id !== $field->field_parent ) {
|
1569 |
+
$output .= '</div>';
|
1570 |
+
$open_section = false;
|
1571 |
+
}
|
1572 |
+
}
|
1573 |
+
|
1574 |
if ( $field->field_type == 'fieldset' ) {
|
1575 |
/* Close each fieldset */
|
1576 |
if ( $open_fieldset == true )
|
1580 |
$open_fieldset = true;
|
1581 |
$count++;
|
1582 |
}
|
1583 |
+
elseif ( $field->field_type == 'section' ) {
|
1584 |
+
$output .= '<div class="section-div vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '"><h4>' . stripslashes( $field->field_name ) . '</h4>';
|
1585 |
+
|
1586 |
+
/* Save section ID for future comparison */
|
1587 |
+
$sec_id = $field->field_id;
|
1588 |
+
$open_section = true;
|
1589 |
+
}
|
1590 |
elseif ( $field->field_type !== 'submit' ) {
|
1591 |
/* If field is required, build the span and add setup the 'required' class */
|
1592 |
$required_span = ( !empty( $field->field_required ) && $field->field_required === 'yes' ) ? ' <span>*</span>' : '';
|
1593 |
$required = ( !empty( $field->field_required ) && $field->field_required === 'yes' ) ? ' required' : '';
|
1594 |
$validation = ( !empty( $field->field_validation ) ) ? " $field->field_validation" : '';
|
1595 |
$css = ( !empty( $field->field_css ) ) ? " $field->field_css" : '';
|
1596 |
+
$output .= '<li class="item item-' . $field->field_type . '"><label for="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" class="desc">'. stripslashes( $field->field_name ) . $required_span . '</label>';
|
|
|
1597 |
}
|
1598 |
|
1599 |
+
|
1600 |
+
|
1601 |
switch ( $field->field_type ) {
|
1602 |
case 'text' :
|
1603 |
case 'email' :
|
1607 |
case 'phone' :
|
1608 |
|
1609 |
if ( !empty( $field->field_description ) )
|
1610 |
+
$output .= '<span><input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="" class="text ' . $field->field_size . $required . $validation . $css . '" /><label>' . stripslashes( $field->field_description ) . '</label></span>';
|
1611 |
else
|
1612 |
+
$output .= '<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="" class="text ' . $field->field_size . $required . $validation . $css . '" />';
|
1613 |
+
|
1614 |
break;
|
1615 |
|
1616 |
case 'textarea' :
|
1618 |
if ( !empty( $field->field_description ) )
|
1619 |
$output .= '<span><label>' . stripslashes( $field->field_description ) . '</label></span>';
|
1620 |
|
1621 |
+
$output .= '<textarea name="vfb-'. esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-'. esc_html( $field->field_key ) . '-' . $field->field_id . '" class="textarea ' . $field->field_size . $required . $css . '"></textarea>';
|
1622 |
|
1623 |
break;
|
1624 |
|
1626 |
if ( !empty( $field->field_description ) )
|
1627 |
$output .= '<span><label>' . stripslashes( $field->field_description ) . '</label></span>';
|
1628 |
|
1629 |
+
$output .= '<select name="vfb-'. esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-'. esc_html( $field->field_key ) . '-' . $field->field_id . '" class="select ' . $field->field_size . $required . $css . '">';
|
1630 |
|
1631 |
$options = ( is_array( unserialize( $field->field_options ) ) ) ? unserialize( $field->field_options ) : explode( ',', unserialize( $field->field_options ) );
|
1632 |
|
1651 |
/* Loop through each option and output */
|
1652 |
foreach ( $options as $option => $value ) {
|
1653 |
$output .= '<span>
|
1654 |
+
<input type="radio" name="vfb-'. $field->field_key . '-' . $field->field_id . '" id="vfb-'. $field->field_key . '-' . $field->field_id . '-' . $option . '" value="'. stripslashes( $value ) . '" class="radio' . $required . $css . '" />'.
|
1655 |
+
' <label for="vfb-' . $field->field_key . '-' . $field->field_id . '-' . $option . '" class="choice">' . stripslashes( $value ) . '</label>' .
|
1656 |
'</span>';
|
1657 |
}
|
1658 |
|
1672 |
/* Loop through each option and output */
|
1673 |
foreach ( $options as $option => $value ) {
|
1674 |
|
1675 |
+
$output .= '<span><input type="checkbox" name="vfb-'. $field->field_key . '-' . $field->field_id . '[]" id="vfb-'. $field->field_key . '-' . $field->field_id . '-' . $option . '" value="'. trim( stripslashes( $value ) ) . '" class="checkbox' . $required . $css . '" />'.
|
1676 |
+
' <label for="vfb-' . $field->field_key . '-' . $field->field_id . '-' . $option . '" class="choice">' . trim( stripslashes( $value ) ) . '</label></span>';
|
1677 |
}
|
1678 |
|
1679 |
$output .= '<div style="clear:both"></div></div>';
|
1689 |
$output .= '<div>
|
1690 |
<span class="full">
|
1691 |
|
1692 |
+
<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '[address]" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-address" maxlength="150" class="text medium' . $required . $css . '" />
|
1693 |
+
<label for="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-address">Address</label>
|
1694 |
</span>
|
1695 |
<span class="full">
|
1696 |
+
<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '[address-2]" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . 'address-2" maxlength="150" class="text medium' . $css . '" />
|
1697 |
+
<label for="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-address-2">Address Line 2</label>
|
1698 |
</span>
|
1699 |
<span class="left">
|
1700 |
|
1701 |
+
<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '[city]" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-city" maxlength="150" class="text medium' . $required . $css . '" />
|
1702 |
+
<label for="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-city">City</label>
|
1703 |
</span>
|
1704 |
<span class="right">
|
1705 |
+
<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '[state]" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-state" maxlength="150" class="text medium' . $required . $css . '" />
|
1706 |
+
<label for="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-state">State / Province / Region</label>
|
1707 |
</span>
|
1708 |
<span class="left">
|
1709 |
|
1710 |
+
<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '[zip]" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-zip" maxlength="150" class="text medium' . $required . $css . '" />
|
1711 |
+
<label for="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-zip">Postal / Zip Code</label>
|
1712 |
</span>
|
1713 |
<span class="right">
|
1714 |
+
<select class="select' . $required . $css . '" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '[country]" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-country">
|
1715 |
<option selected="selected" value=""></option>';
|
1716 |
|
1717 |
foreach ( $countries as $country ) {
|
1719 |
}
|
1720 |
|
1721 |
$output .= '</select>
|
1722 |
+
<label for="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-country">Country</label>
|
1723 |
</span>
|
1724 |
</div>';
|
1725 |
+
|
|
|
1726 |
break;
|
1727 |
|
1728 |
case 'date':
|
1729 |
|
1730 |
if ( !empty( $field->field_description ) )
|
1731 |
+
$output .= '<span><input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="" class="text vfb-date-picker ' . $field->field_size . $required . $css . '" /><label>' . stripslashes( $field->field_description ) . '</label></span>';
|
1732 |
else
|
1733 |
+
$output .= '<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="" class="text vfb-date-picker ' . $field->field_size . $required . $css . '" />';
|
1734 |
|
1735 |
break;
|
1736 |
|
1745 |
$hour_total = ( $time_format == '12' ) ? 12 : 23;
|
1746 |
|
1747 |
/* Hour */
|
1748 |
+
$output .= '<span class="time"><select name="vfb-'. $field->field_key . '-' . $field->field_id . '[hour]" id="vfb-'. $field->field_key . '-' . $field->field_id . '-hour" class="select' . $required . $css . '">';
|
1749 |
for ( $i = $hour_start; $i <= $hour_total; $i++ ) {
|
1750 |
/* Add the leading zero */
|
1751 |
$hour = ( $i < 10 ) ? "0$i" : $i;
|
1752 |
$output .= "<option value='$hour'>$hour</option>";
|
1753 |
}
|
1754 |
+
$output .= '</select><label for="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-hour">HH</label></span>';
|
1755 |
|
1756 |
/* Minute */
|
1757 |
+
$output .= '<span class="time"><select name="vfb-'. $field->field_key . '-' . $field->field_id . '[min]" id="vfb-'. $field->field_key . '-' . $field->field_id . '-min" class="select' . $required . $css . '">';
|
1758 |
for ( $i = 0; $i <= 55; $i+=5 ) {
|
1759 |
/* Add the leading zero */
|
1760 |
$min = ( $i < 10 ) ? "0$i" : $i;
|
1761 |
$output .= "<option value='$min'>$min</option>";
|
1762 |
}
|
1763 |
+
$output .= '</select><label for="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-min">MM</label></span>';
|
1764 |
|
1765 |
/* AM/PM */
|
1766 |
if ( $time_format == '12' )
|
1767 |
+
$output .= '<span class="time"><select name="vfb-'. $field->field_key . '-' . $field->field_id . '[ampm]" id="vfb-'. $field->field_key . '-' . $field->field_id . '-ampm" class="select' . $required . $css . '"><option value="AM">AM</option><option value="PM">PM</option></select><label for="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-ampm">AM/PM</label></span>';
|
1768 |
+
$output .= '<div class="clear"></div>';
|
1769 |
break;
|
1770 |
|
1771 |
case 'html' :
|
1773 |
if ( !empty( $field->field_description ) )
|
1774 |
$output .= '<span><label>' . stripslashes( $field->field_description ) . '</label></span>';
|
1775 |
|
1776 |
+
$output .= '<script type="text/javascript">edToolbar("vfb-' . $field->field_key . '-' . $field->field_id . '");</script>';
|
1777 |
+
$output .= '<textarea name="vfb-'. $field->field_key . '-' . $field->field_id . '" id="vfb-'. $field->field_key . '-' . $field->field_id . '" class="textarea vfbEditor ' . $field->field_size . $required . $css . '"></textarea>';
|
1778 |
|
1779 |
break;
|
1780 |
|
1781 |
case 'file-upload' :
|
1782 |
|
1783 |
if ( !empty( $field->field_description ) )
|
1784 |
+
$output .= '<span><input type="file" size="35" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="" class="text ' . $field->field_size . $required . $validation . $css . '" /><label>' . stripslashes( $field->field_description ) . '</label></span>';
|
1785 |
else
|
1786 |
+
$output .= '<input type="file" size="35" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="" class="text ' . $field->field_size . $required . $validation . $css . '" />';
|
1787 |
|
1788 |
|
1789 |
break;
|
1803 |
default:
|
1804 |
echo '';
|
1805 |
}
|
1806 |
+
|
1807 |
+
/* Closing </li> */
|
1808 |
+
$output .= ( !in_array( $field->field_type , array( 'submit', 'fieldset', 'section' ) ) ) ? '</li>' : '';
|
1809 |
}
|
1810 |
|
1811 |
/* Close user-added fields */
|
1818 |
</div>
|
1819 |
<ul class="section section-' . $count . '">
|
1820 |
<li>
|
1821 |
+
<label for="vfb-secret" class="desc">' . __( 'Please enter any two digits with' , 'visual-form-builder') . ' <strong>' . __( 'no' , 'visual-form-builder') . '</strong> ' . __( 'spaces (Example: 12)' , 'visual-form-builder') . '<span>*</span></label>
|
1822 |
<div>
|
1823 |
+
<input type="text" name="vfb-secret" id="vfb-secret" class="text medium" />
|
1824 |
</div>
|
1825 |
</li>
|
1826 |
<div style="display:none;">
|
1891 |
}
|
1892 |
|
1893 |
/* Sender name override query */
|
1894 |
+
$sender_query = "SELECT fields.field_id, fields.field_key FROM $this->form_table_name AS forms LEFT JOIN $this->field_table_name AS fields ON forms.form_email_from_name_override = fields.field_id WHERE forms.form_id = $form_id";
|
1895 |
$senders = $wpdb->get_results( $sender_query );
|
1896 |
|
1897 |
/* Sender email override query */
|
1898 |
+
$email_query = "SELECT fields.field_id, fields.field_key FROM $this->form_table_name AS forms LEFT JOIN $this->field_table_name AS fields ON forms.form_email_from_override = fields.field_id WHERE forms.form_id = $form_id";
|
1899 |
$emails = $wpdb->get_results( $email_query );
|
1900 |
|
1901 |
/* Notification send to email override query */
|
1902 |
+
$notification_query = "SELECT fields.field_id, fields.field_key FROM $this->form_table_name AS forms LEFT JOIN $this->field_table_name AS fields ON forms.form_notification_email = fields.field_id WHERE forms.form_id = $form_id";
|
1903 |
$notification = $wpdb->get_results( $notification_query );
|
1904 |
|
1905 |
/* Loop through name results and assign sender name to override, if needed */
|
1906 |
foreach( $senders as $sender ) {
|
1907 |
if ( !empty( $sender->field_key ) )
|
1908 |
+
$form_from_name = $_POST[ 'vfb-' . $sender->field_key . '-' . $sender->field_id ];
|
1909 |
}
|
1910 |
|
1911 |
/* Loop through email results and assign sender email to override, if needed */
|
1912 |
foreach ( $emails as $email ) {
|
1913 |
if ( !empty( $email->field_key ) )
|
1914 |
+
$form_from = $_POST[ 'vfb-' . $email->field_key . '-' . $sender->field_id ];
|
1915 |
}
|
1916 |
|
1917 |
/* Loop through email results and assign as blind carbon copy, if needed */
|
1918 |
foreach ( $notification as $notify ) {
|
1919 |
if ( !empty( $notify->field_key ) )
|
1920 |
+
$copy_email = $_POST[ 'vfb-' . $notify->field_key . '-' . $sender->field_id ];
|
1921 |
}
|
1922 |
+
|
1923 |
+
/* Query to get all forms */
|
1924 |
+
$order = sanitize_sql_orderby( 'field_sequence ASC' );
|
1925 |
+
$query = "SELECT field_id, field_key, field_name, field_type, field_options, field_parent FROM $this->field_table_name WHERE form_id = $form_id ORDER BY $order";
|
1926 |
+
|
1927 |
+
/* Build our forms as an object */
|
1928 |
+
$fields = $wpdb->get_results( $query );
|
1929 |
|
1930 |
|
|
|
1931 |
/* Prepare the beginning of the content */
|
1932 |
$message = '<html><body><table rules="all" style="border-color: #666;" cellpadding="10">';
|
1933 |
|
1934 |
/* Loop through each form field and build the body of the message */
|
1935 |
+
foreach ( $fields as $field ) {
|
1936 |
+
/* Handle attachments */
|
1937 |
+
if ( $field->field_type == 'file-upload' ) {
|
1938 |
+
$value = $_FILES[ 'vfb-' . $field->field_key . '-' . $field->field_id ];
|
1939 |
+
|
1940 |
+
if ( $value['size'] > 0 ) {
|
1941 |
+
/* Options array for the wp_handle_upload function. 'test_form' => false */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1942 |
$upload_overrides = array( 'test_form' => false );
|
1943 |
|
1944 |
/* We need to include the file that runs the wp_handle_upload function */
|
1945 |
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
1946 |
|
1947 |
/* Handle the upload using WP's wp_handle_upload function. Takes the posted file and an options array */
|
1948 |
+
$uploaded_file = wp_handle_upload( $value, $upload_overrides );
|
1949 |
|
1950 |
/* If the wp_handle_upload call returned a local path for the image */
|
1951 |
if ( isset( $uploaded_file['file'] ) ) {
|
1952 |
+
$attachments[ 'vfb-' . $field->field_key . '-' . $field->field_id ] = $uploaded_file['file'];
|
1953 |
+
|
1954 |
+
$data[] = array(
|
1955 |
+
'id' => $field->field_id,
|
1956 |
+
'slug' => $field->field_key,
|
1957 |
+
'name' => $field->field_name,
|
1958 |
+
'type' => $field->field_type,
|
1959 |
+
'options' => $field->field_options,
|
1960 |
+
'parent_id' => $field->field_parent,
|
1961 |
+
'value' => $uploaded_file['url']
|
1962 |
+
);
|
1963 |
|
1964 |
+
$message .= '<tr><td><strong>' . $field->field_name . ': </strong></td><td><a href="' . $uploaded_file['url'] . '">' . $uploaded_file['url'] . '</a></td></tr>';
|
1965 |
}
|
1966 |
}
|
1967 |
}
|
1968 |
+
/* Everything else */
|
1969 |
+
else {
|
1970 |
+
$value = $_POST[ 'vfb-' . $field->field_key . '-' . $field->field_id ];
|
1971 |
+
|
1972 |
+
/* If time field, build proper output */
|
1973 |
+
if ( is_array( $value ) && array_key_exists( 'hour', $value ) && array_key_exists( 'min', $value ) )
|
1974 |
+
$value = ( array_key_exists( 'ampm', $value ) ) ? substr_replace( implode( ':', $value ), ' ', 5, 1 ) : implode( ':', $value );
|
1975 |
+
/* If address field, build proper output */
|
1976 |
+
elseif ( is_array( $value ) && array_key_exists( 'address', $value ) && array_key_exists( 'address-2', $value ) )
|
1977 |
+
$value = $value['address'] . '<br>' . $value['address-2'] . '<br>' . $value['city'] . ', ' . $value['state'] . '. ' . $value['zip'] . '<br>' . $value['country'];
|
1978 |
+
/* If multiple values, build the list */
|
1979 |
+
elseif ( is_array( $value ) )
|
1980 |
+
$value = implode( ', ', $value );
|
1981 |
+
/* Lastly, handle single values */
|
1982 |
+
else
|
1983 |
+
$value = esc_html( $value );
|
1984 |
+
|
1985 |
+
if ( $field->field_type !== 'submit' ) {
|
1986 |
+
if ( $field->field_type == 'fieldset' )
|
1987 |
+
$message .= '<tr style="background-color:#393E40;color:white;font-size:14px;"><td colspan="2">' . $field->field_name . '</td></tr>';
|
1988 |
+
elseif ( $field->field_type == 'section' )
|
1989 |
+
$message .= '<tr style="background-color:#6E7273;color:white;font-size:14px;"><td colspan="2">' . $field->field_name . '</td></tr>';
|
1990 |
+
else
|
1991 |
+
$message .= '<tr><td><strong>' . $field->field_name . ': </strong></td><td>' . $value . '</td></tr>';
|
1992 |
+
}
|
1993 |
+
|
1994 |
+
$data[] = array(
|
1995 |
+
'id' => $field->field_id,
|
1996 |
+
'slug' => $field->field_key,
|
1997 |
+
'name' => $field->field_name,
|
1998 |
+
'type' => $field->field_type,
|
1999 |
+
'options' => $field->field_options,
|
2000 |
+
'parent_id' => $field->field_parent,
|
2001 |
+
'value' => $value
|
2002 |
+
);
|
2003 |
+
}
|
2004 |
}
|
2005 |
|
2006 |
/* Setup our entries data */
|
2007 |
$entry = array(
|
2008 |
'form_id' => $form_id,
|
2009 |
+
'data' => serialize( $data ),
|
2010 |
'subject' => $form_subject,
|
2011 |
'sender_name' => $form_from_name,
|
2012 |
'sender_email' => $form_from,
|