Formidable Forms – Form Builder for WordPress - Version 1.0

Version Description

Download this release

Release Info

Developer sswells
Plugin Icon 128x128 Formidable Forms – Form Builder for WordPress
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (85) hide show
  1. classes/controllers/FrmApiController.php +88 -0
  2. classes/controllers/FrmAppController.php +308 -0
  3. classes/controllers/FrmEntriesController.php +113 -0
  4. classes/controllers/FrmFieldsController.php +149 -0
  5. classes/controllers/FrmFormsController.php +313 -0
  6. classes/controllers/FrmSettingsController.php +104 -0
  7. classes/controllers/FrmStatisticsController.php +21 -0
  8. classes/helpers/FrmAppHelper.php +142 -0
  9. classes/helpers/FrmEntriesHelper.php +50 -0
  10. classes/helpers/FrmFieldsHelper.php +60 -0
  11. classes/helpers/FrmFormsHelper.php +59 -0
  12. classes/helpers/FrmSettingsHelper.php +19 -0
  13. classes/models/FrmEntry.php +200 -0
  14. classes/models/FrmEntryMeta.php +171 -0
  15. classes/models/FrmField.php +147 -0
  16. classes/models/FrmForm.php +211 -0
  17. classes/models/FrmNotification.php +88 -0
  18. classes/models/FrmSettings.php +43 -0
  19. classes/models/FrmUtils.php +64 -0
  20. classes/views/frm-entries/direct.php +9 -0
  21. classes/views/frm-entries/form.php +31 -0
  22. classes/views/frm-entries/frm-entry.php +37 -0
  23. classes/views/frm-entries/list.php +11 -0
  24. classes/views/frm-entries/new.php +17 -0
  25. classes/views/frm-fields/radio.php +8 -0
  26. classes/views/frm-fields/show.php +40 -0
  27. classes/views/frm-fields/single-option.php +9 -0
  28. classes/views/frm-forms/add_field.php +116 -0
  29. classes/views/frm-forms/add_field_links.php +60 -0
  30. classes/views/frm-forms/default-templates.php +40 -0
  31. classes/views/frm-forms/edit.php +26 -0
  32. classes/views/frm-forms/footer.php +37 -0
  33. classes/views/frm-forms/form.php +36 -0
  34. classes/views/frm-forms/list.php +101 -0
  35. classes/views/frm-forms/new-field-js.php +109 -0
  36. classes/views/frm-forms/new-option-js.php +40 -0
  37. classes/views/frm-forms/new-selection.php +14 -0
  38. classes/views/frm-forms/new.php +27 -0
  39. classes/views/frm-settings/form.php +28 -0
  40. classes/views/frm-settings/pro-settings.php +51 -0
  41. classes/views/frm-statistics/list.php +11 -0
  42. classes/views/shared/errors.php +11 -0
  43. classes/views/shared/head.php +13 -0
  44. classes/views/shared/item-table-nav.php +83 -0
  45. classes/views/shared/nav.php +8 -0
  46. css/frm_admin.css +81 -0
  47. css/frm_display.css +6 -0
  48. css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  49. css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  50. css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  51. css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  52. css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  53. css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  54. css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  55. css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  56. css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  57. css/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  58. css/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  59. css/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  60. css/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  61. css/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  62. css/ui-lightness/jquery-ui-1.7.2.custom.css +406 -0
  63. formidable.php +166 -0
  64. images/arrow_down.png +0 -0
  65. images/arrow_up.png +0 -0
  66. images/blackglass-captcha.png +0 -0
  67. images/clean-captcha.png +0 -0
  68. images/error.png +0 -0
  69. images/icon.png +0 -0
  70. images/icon_128.png +0 -0
  71. images/icon_16.png +0 -0
  72. images/icon_32.png +0 -0
  73. images/icon_48.png +0 -0
  74. images/red-captcha.png +0 -0
  75. images/white-captcha.png +0 -0
  76. js/jquery/jquery-ui-1.7.1.custom.min.js +273 -0
  77. js/jquery/jquery-ui-datepicker.js +12 -0
  78. js/jquery/jquery.editinplace.js +281 -0
  79. js/jquery/jquery.editinplace.packed.js +24 -0
  80. js/list-items.js +66 -0
  81. readme.txt +30 -0
  82. screenshot-1.png +0 -0
  83. screenshot-2.png +0 -0
  84. screenshot-3.png +0 -0
  85. todo.txt +60 -0
classes/controllers/FrmApiController.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmApiController{
4
+ function FrmApiController(){
5
+ }
6
+
7
+ /********* DISPLAY DATA *************/
8
+ function frm_filter_content($args){
9
+ global $frm_entry;
10
+ $args = explode(",",$args[1]);
11
+
12
+ $form_key = sanitize_title($args[0]);
13
+
14
+ $where = '';//" gr.form_key = '$form_key'";
15
+ $items = $frm_entry->getAll($where);
16
+
17
+ $list = $form_key;
18
+ foreach ($items as $item){
19
+ $list .= $item->name;
20
+ }
21
+
22
+ return $list;
23
+ }
24
+
25
+ function get_frm_items($args = null){
26
+ global $frm_entry, $frm_form, $frm_entry_meta;
27
+
28
+ $defaults = array(
29
+ 'form_key' => '', 'parent_id' => '',
30
+ 'order' => '', 'limit' => '',
31
+ 'search' =>'', 'search_type' => '',
32
+ 'search_field' => '', 'search_operator' => 'LIKE'
33
+ );
34
+
35
+ $r = wp_parse_args( $args, $defaults );
36
+
37
+ $form = $frm_form->getOneByKey($r['form_key']);
38
+
39
+ $where = " (it.form_id='". $form->id ."' or gr.form_id='". $form->id ."')";
40
+ if (!($r['parent_id'] == ''))
41
+ $where .= " and it.parent_item_id='". $r['parent_id'] ."'";
42
+
43
+ if (!($r['order'] == ''))
44
+ $r['order'] = " ORDER BY {$r['order']}";
45
+
46
+ if (!($r['limit'] == ''))
47
+ $r['limit'] = " LIMIT {$r['limit']}";
48
+
49
+ if (!($r['search'] == '') and $r['search_type'] == '')
50
+ $where .= " and (it.item_key LIKE '%{$r['search']}%' or it.description LIKE '%{$r['search']}%' or it.name LIKE '%{$r['search']}%')";
51
+
52
+ $items = $frm_entry->getAll($where, $r['order'], $r['limit']);
53
+
54
+ if (!($r['search'] == '') and $r['search_type'] == 'meta'){ //search meta values
55
+ $item_ids = $frm_entry_meta->search_entry_metas($r['search'], $r['search_field'], $r['search_operator']);
56
+ $item_list = array();
57
+ foreach ($items as $item){
58
+ if (in_array($item->id, $item_ids))
59
+ $item_list[] = $item;
60
+ }
61
+ return $item_list;
62
+ }else
63
+ return $items;
64
+ }
65
+
66
+ function get_frm_item($item_key){
67
+ global $frm_entry;
68
+ return $frm_entry->getOneByKey( $item_key );
69
+ }
70
+
71
+ function get_frm_item_by_id($id){
72
+ global $frm_entry;
73
+ return $frm_entry->getOne( $id );
74
+ }
75
+
76
+ function get_frm_edit_link($id){
77
+ global $current_user, $frm_siteurl;
78
+
79
+ $output = '';
80
+ if($current_user->wp_capabilities['administrator'] == 1) {
81
+ $output = "<span class='frm_edit'>[<a href='{$frm_siteurl}/wp-admin/admin.php?page=". FRM_PLUGIN_NAME ."-entries&action=edit&id={$id}'>Edit</a>]</span>";
82
+ }
83
+ return $output;
84
+ }
85
+
86
+ }
87
+
88
+ ?>
classes/controllers/FrmAppController.php ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmAppController{
4
+ function FrmAppController(){
5
+ add_action('admin_menu', array( $this, 'menu' ));
6
+ add_filter('the_content', array( $this, 'page_route' ), 1);
7
+ add_action('init', array($this, 'front_head'));
8
+ add_action('admin_init', array( $this, 'admin_js'));
9
+ register_activation_hook(FRM_PATH."/formidable.php", array( $this, 'install' ));
10
+
11
+ // Used to process standalone requests
12
+ add_action('init', array($this,'parse_standalone_request'));
13
+
14
+ //Shortcodes
15
+ add_shortcode('formidable', array($this,'get_form_shortcode'));
16
+ add_filter( 'widget_text', array($this,'widget_text_filter'), 9 );
17
+ }
18
+
19
+ function menu(){
20
+ global $frmpro_is_installed, $frm_forms_controller;
21
+
22
+ add_menu_page(FRM_PLUGIN_TITLE, FRM_PLUGIN_TITLE, 8, FRM_PLUGIN_NAME, array($frm_forms_controller,'route'), FRM_URL . '/images/icon_16.png');
23
+
24
+ if(!$frmpro_is_installed){
25
+ add_submenu_page(FRM_PLUGIN_TITLE, FRM_PLUGIN_TITLE .' | Pro Statistics', 'Pro Statistics', 8, FRM_PLUGIN_TITLE.'-statistics',array($this,''));
26
+ }
27
+ }
28
+
29
+ function head(){
30
+ $css_file = 'frm_admin.css';
31
+ $js_file = 'list-items.js';
32
+ require_once(FRM_VIEWS_PATH . '/shared/head.php');
33
+ }
34
+
35
+ function admin_js(){
36
+ wp_enqueue_script('jQuery');
37
+ wp_enqueue_script('jQuery-custom', FRM_URL.'/js/jquery/jquery-ui-1.7.1.custom.min.js');
38
+ wp_enqueue_script('jQuery-in-place-edit-patched', FRM_URL.'/js/jquery/jquery.editinplace.packed.js');
39
+
40
+ add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
41
+ if ( user_can_richedit() )
42
+ wp_enqueue_script('editor');
43
+ add_thickbox();
44
+ }
45
+
46
+ function front_head(){
47
+ wp_enqueue_style('frm-forms', FRM_URL.'/css/frm_display.css');
48
+ }
49
+
50
+ function install(){
51
+ global $wpdb, $frm_utils, $frm_form, $frm_field;
52
+ $db_version = 1.0; // this is the version of the database we're moving to
53
+ $old_db_version = get_option('frm_db_version');
54
+
55
+ $fields_table = $wpdb->prefix . "frm_fields";
56
+ $forms_table = $wpdb->prefix . "frm_forms";
57
+ $items_table = $wpdb->prefix . "frm_items";
58
+ $item_metas_table = $wpdb->prefix . "frm_item_metas";
59
+
60
+ $charset_collate = '';
61
+ if( $wpdb->has_cap( 'collation' ) ){
62
+ if( !empty($wpdb->charset) )
63
+ $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
64
+ if( !empty($wpdb->collate) )
65
+ $charset_collate .= " COLLATE $wpdb->collate";
66
+ }
67
+
68
+ if ($db_version != $old_db_version){
69
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
70
+
71
+ /* Create/Upgrade Fields Table */
72
+ $sql = "CREATE TABLE {$fields_table} (
73
+ id int(11) NOT NULL auto_increment,
74
+ field_key varchar(255) default NULL,
75
+ name varchar(255) default NULL,
76
+ description text default NULL,
77
+ type text default NULL,
78
+ default_value longtext default NULL,
79
+ options longtext default NULL,
80
+ field_order int(11) default 0,
81
+ required int(1) default NULL,
82
+ field_options longtext default NULL,
83
+ form_id int(11) default NULL,
84
+ created_at datetime NOT NULL,
85
+ PRIMARY KEY (id),
86
+ KEY form_id (form_id)
87
+ );";
88
+
89
+ dbDelta($sql);
90
+
91
+ /* Create/Upgrade Forms Table */
92
+ $sql = "CREATE TABLE {$forms_table} (
93
+ id int(11) NOT NULL auto_increment,
94
+ form_key varchar(255) default NULL,
95
+ name varchar(255) default NULL,
96
+ description text default NULL,
97
+ logged_in boolean default NULL,
98
+ editable boolean default NULL,
99
+ is_template boolean default 0,
100
+ default_template boolean default 0,
101
+ status varchar(255) default NULL,
102
+ prli_link_id int(11) default NULL,
103
+ options longtext default NULL,
104
+ created_at datetime NOT NULL,
105
+ PRIMARY KEY (id)
106
+ );";
107
+
108
+ dbDelta($sql);
109
+
110
+ /* Create/Upgrade Items Table */
111
+ $sql = "CREATE TABLE {$items_table} (
112
+ id int(11) NOT NULL auto_increment,
113
+ item_key varchar(255) default NULL,
114
+ name varchar(255) default NULL,
115
+ description text default NULL,
116
+ form_id int(11) default NULL,
117
+ parent_item_id int(11) default NULL,
118
+ created_at datetime NOT NULL,
119
+ PRIMARY KEY (id),
120
+ KEY form_id (form_id),
121
+ KEY parent_item_id (parent_item_id)
122
+ );";
123
+
124
+ dbDelta($sql);
125
+
126
+ /* Create/Upgrade Meta Table */
127
+ $sql = "CREATE TABLE {$item_metas_table} (
128
+ id int(11) NOT NULL auto_increment,
129
+ meta_key varchar(255) default NULL,
130
+ meta_value longtext default NULL,
131
+ field_id int(11) NOT NULL,
132
+ item_id int(11) NOT NULL,
133
+ created_at datetime NOT NULL,
134
+ PRIMARY KEY (id),
135
+ KEY field_id (field_id),
136
+ KEY item_id (item_id)
137
+ );";
138
+
139
+ dbDelta($sql);
140
+
141
+ /**** ADD DEFAULT FORMS ****/
142
+ if ($frm_form->getRecordCount("form_key='contact' and is_template='1'") <= 0){
143
+ $values = FrmFormsHelper::setup_new_vars();
144
+ $values['name'] = 'Contact Us';
145
+ $values['form_key'] = 'contact';
146
+ $values['description'] = 'We would like to hear from you. Please send us a message by filling out the form below and we will get back with you shortly.';
147
+ $values['is_template'] = 1;
148
+ $values['default_template'] = 1;
149
+ $form_id = $frm_form->create( $values );
150
+
151
+ $field_options = array();
152
+ $field_options['label'] = 'top';
153
+ $field_options['size'] = '75';
154
+ $field_options['max'] = '';
155
+ $field_options['required_indicator'] = '*';
156
+
157
+
158
+ $field_options['blank'] = 'Name cannot be blank';
159
+ $field_options['invalid'] = '';
160
+ $frm_field->create( array(
161
+ 'field_key' => 'name',
162
+ 'name' => 'Name',
163
+ 'description' => '',
164
+ 'type' => 'text',
165
+ 'default_value' => '',
166
+ 'options' => '',
167
+ 'form_id' => $form_id,
168
+ 'field_order' => 1,
169
+ 'required' => true,
170
+ 'field_options' => $field_options ));
171
+
172
+ $field_options['blank'] = 'Email cannot be blank';
173
+ $field_options['invalid'] = 'Please enter a valid email address';
174
+ $frm_field->create( array(
175
+ 'field_key' => 'email',
176
+ 'name' => 'Email',
177
+ 'description' => '',
178
+ 'type' => 'email',
179
+ 'default_value' => '',
180
+ 'options' => '',
181
+ 'form_id' => $form_id,
182
+ 'field_order' => 2,
183
+ 'required' => true,
184
+ 'field_options' => $field_options ));
185
+
186
+ $field_options['blank'] = 'Website cannot be blank';
187
+ $field_options['invalid'] = 'Website is an invalid format';
188
+ $frm_field->create( array(
189
+ 'field_key' => 'website',
190
+ 'name' => 'Website',
191
+ 'description' => '',
192
+ 'type' => 'website',
193
+ 'default_value' => '',
194
+ 'options' => '',
195
+ 'form_id' => $form_id,
196
+ 'field_order' => 3,
197
+ 'required' => false,
198
+ 'field_options' => $field_options ));
199
+
200
+ $field_options['blank'] = 'Subject cannot be blank';
201
+ $field_options['invalid'] = '';
202
+ $frm_field->create( array(
203
+ 'field_key' => 'subject',
204
+ 'name' => 'Subject',
205
+ 'description' => '',
206
+ 'type' => 'text',
207
+ 'default_value' => '',
208
+ 'options' => '',
209
+ 'form_id' => $form_id,
210
+ 'field_order' => 4,
211
+ 'required' => true,
212
+ 'field_options' => $field_options ));
213
+
214
+ $field_options['size'] = '65';
215
+ $field_options['max'] = '5';
216
+ $field_options['blank'] = 'Message cannot be blank';
217
+ $frm_field->create( array(
218
+ 'field_key' => 'message',
219
+ 'name' => 'Message',
220
+ 'description' => '',
221
+ 'type' => 'textarea',
222
+ 'default_value' => '',
223
+ 'options' => '',
224
+ 'form_id' => $form_id,
225
+ 'field_order' => 5,
226
+ 'required' => true,
227
+ 'field_options' => $field_options ));
228
+
229
+ $field_options['label'] = 'none';
230
+ $field_options['size'] = '';
231
+ $field_options['max'] = '';
232
+ $frm_field->create( array(
233
+ 'field_key' => 'captcha',
234
+ 'name' => 'Captcha',
235
+ 'description' => '',
236
+ 'type' => 'captcha',
237
+ 'default_value' => '',
238
+ 'options' => '',
239
+ 'form_id' => $form_id,
240
+ 'field_order' => 6,
241
+ 'required' => false,
242
+ 'field_options' => $field_options ));
243
+ }
244
+
245
+ /***** SAVE DB VERSION *****/
246
+ update_option('frm_db_version',$db_version);
247
+ }
248
+ }
249
+
250
+
251
+ // Routes for wordpress pages -- we're just replacing content here folks.
252
+ function page_route($content){
253
+ global $post, $frm_settings, $frm_forms_controller;
254
+
255
+ if( $post->ID == $frm_settings->preview_page_id){
256
+ $frm_forms_controller->page_preview();
257
+ return '';
258
+ }
259
+
260
+ return $content;
261
+ }
262
+
263
+ // The tight way to process standalone requests dogg...
264
+ function parse_standalone_request(){
265
+ $plugin = $this->get_param('plugin');
266
+ $action = $this->get_param('action');
267
+ $controller = $this->get_param('controller');
268
+
269
+ if( !empty($plugin) and $plugin == FRM_PLUGIN_NAME and !empty($controller) and !empty($action) ){
270
+ $this->standalone_route($controller, $action);
271
+ exit;
272
+ }
273
+ }
274
+
275
+ // Routes for standalone / ajax requests
276
+ function standalone_route($controller, $action){
277
+ global $frm_forms_controller;
278
+
279
+ if($controller=='forms'){
280
+ if($action=='preview')
281
+ $frm_forms_controller->preview($this->get_param('form'));
282
+ }
283
+ }
284
+
285
+ // Utility function to grab the parameter whether it's a get or post
286
+ function get_param($param, $default=''){
287
+ return (isset($_POST[$param])?$_POST[$param]:(isset($_GET[$param])?$_GET[$param]:$default));
288
+ }
289
+
290
+
291
+ function get_form_shortcode($atts){
292
+ global $frm_entries_controller;
293
+ extract(shortcode_atts(array('id' => '', 'key' => '', 'title' => false, 'description' => false), $atts));
294
+ return $frm_entries_controller->show_form($id, $key, $title, $description);
295
+ }
296
+
297
+
298
+ function widget_text_filter( $content ){
299
+ $regex = '/\[\s*formidable\s+.*\]/';
300
+ return preg_replace_callback( $regex, 'widget_text_filter_callback', $content );
301
+ }
302
+
303
+
304
+ function widget_text_filter_callback( $matches ) {
305
+ return do_shortcode( $matches[0] );
306
+ }
307
+ }
308
+ ?>
classes/controllers/FrmEntriesController.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmEntriesController{
4
+ function FrmEntriesController(){
5
+ add_action('admin_menu', array( $this, 'menu' ));
6
+ $this->views = FRM_VIEWS_PATH.'/frm-entries/';
7
+ }
8
+
9
+ function menu(){
10
+ global $frmpro_is_installed;
11
+ if(!$frmpro_is_installed)
12
+ add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | Pro Entries', 'Pro Entries', 8, FRM_PLUGIN_NAME.'-entries',array($this,'list'));
13
+ }
14
+
15
+ function list_entries(){
16
+ require_once($this->views .'list.php');
17
+ }
18
+
19
+ function show_form($id, $key, $title, $description){
20
+ global $frm_form, $user_ID;
21
+ if ($id) $form = $frm_form->getOne($id);
22
+ else if ($key) $form = $frm_form->getOneByKey($key);
23
+ if (!$form or $form->is_template or $form->status == 'draft')
24
+ return 'Please select a valid form';
25
+ else if ($form->logged_in and !$user_ID)
26
+ return 'You must log in';
27
+ else
28
+ return $this->get_form($this->views.'frm-entry.php', $form, $title, $description);
29
+ }
30
+
31
+ function new_entry($form){
32
+ global $frm_form, $frm_field, $frm_entry, $frm_entry_meta, $frm_recaptcha_enabled, $user_ID;
33
+ $fields = $frm_field->getAll("fi.form_id='$form->id'", ' ORDER BY field_order');
34
+ $values = FrmEntriesHelper::setup_new_vars($fields);
35
+ $form_name = $form->name;
36
+
37
+ $params = $this->get_params($form);
38
+ $message = '';
39
+ $errors = '';
40
+
41
+ do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
42
+ if (apply_filters('frm_continue_to_new', true)){
43
+ $values = FrmEntriesHelper::setup_new_vars($fields);
44
+ require_once($this->views .'new.php');
45
+ }
46
+ }
47
+
48
+ function create($form){
49
+ global $frm_form, $frm_field, $frm_entry, $frm_entry_meta, $frm_recaptcha_enabled, $user_ID;
50
+ $fields = $frm_field->getAll("fi.form_id='$form->id'", ' ORDER BY field_order');
51
+ $values = FrmEntriesHelper::setup_new_vars($fields);
52
+ $form_name = $form->name;
53
+
54
+ $failed_message = "We're sorry. There was an error processing your responses.";
55
+ $saved_message = "Your responses were successfully submitted. Thank you!";
56
+
57
+ $params = $this->get_params($form);
58
+ $message = '';
59
+
60
+ $errors = $frm_entry->validate($_POST);
61
+
62
+ if( count($errors) > 0 ){
63
+ $values = FrmEntriesHelper::setup_new_vars($fields);
64
+ require_once($this->views.'new.php');
65
+ }else{
66
+ do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
67
+ if (apply_filters('frm_continue_to_create', true)){
68
+ if ($frm_entry->create( $_POST ))
69
+ echo $saved_message;
70
+ else
71
+ echo $failed_message;
72
+ }
73
+ }
74
+ }
75
+
76
+ function get_form($filename, $form, $title, $description) {
77
+ if (is_file($filename)) {
78
+ ob_start();
79
+ include $filename;
80
+ $contents = ob_get_contents();
81
+ ob_end_clean();
82
+ return $contents;
83
+ }
84
+ return false;
85
+ }
86
+
87
+ function get_params($form=null){
88
+ global $frm_app_controller, $frm_form;
89
+
90
+ if(!$form)
91
+ $form = $frm_form->getAll('',' ORDER BY name',' LIMIT 1');
92
+ $action = apply_filters('frm_show_new_entry_page','new',$form);
93
+ $values = array();
94
+ foreach (array('id' => '','form_name' => '', 'paged' => 1,'form' => $form->id,'field_id' => '', 'search' => '','sort' => '','sdir' => '', 'form' => $form->id, 'action' => $action) as $var => $default)
95
+ $values[$var] = $frm_app_controller->get_param($var, $default);
96
+
97
+ return $values;
98
+ }
99
+
100
+ function route($form=false){
101
+ global $frm_app_controller;
102
+ $action = $frm_app_controller->get_param('action');
103
+ if (!$form)
104
+ $form = $frm_app_controller->get_param('form');
105
+ $action = apply_filters('frm_show_new_entry_page', $action, $form);
106
+ if($action=='create')
107
+ return $this->create($form);
108
+ else
109
+ return $this->new_entry($form);
110
+ }
111
+
112
+ }
113
+ ?>
classes/controllers/FrmFieldsController.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmFieldsController{
4
+ function FrmFieldsController(){
5
+ add_filter('frm_field_type',array( $this, 'change_type'));
6
+ add_action('wp_ajax_frm_insert_field', array($this, 'create') );
7
+ add_action('wp_ajax_frm_field_name_in_place_edit', array($this, 'edit_name') );
8
+ add_action('wp_ajax_frm_field_desc_in_place_edit', array($this, 'edit_description') );
9
+ add_action('wp_ajax_frm_mark_required', array($this, 'mark_required') );
10
+ add_action('wp_ajax_frm_unmark_required', array($this, 'unmark_required') );
11
+ add_action('wp_ajax_frm_delete_field', array($this, 'destroy') );
12
+ add_action('wp_ajax_frm_add_field_option',array($this, 'add_option'));
13
+ add_action('wp_ajax_frm_field_option_ipe', array($this, 'edit_option') );
14
+ add_action('wp_ajax_frm_delete_field_option',array($this, 'delete_option'));
15
+ add_action('wp_ajax_frm_update_field_order', array($this, 'update_order') );
16
+ }
17
+
18
+ function create(){
19
+ global $frm_field, $frm_recaptcha_enabled;
20
+ $field_data = $_POST['field'];
21
+ $form_id = $_POST['form_id'];
22
+
23
+ $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars($field_data, $form_id));
24
+ if (isset($_POST['position']))
25
+ $field_values['field_order'] = $_POST['position'];
26
+
27
+ $field_id = $frm_field->create( $field_values );
28
+
29
+ if ($field_id){
30
+ $field = FrmFieldsHelper::setup_edit_vars($frm_field->getOne($field_id));
31
+ $field_name = "item_meta[$field_id]";
32
+ $id = $form_id;
33
+ require(FRM_VIEWS_PATH.'/frm-forms/add_field.php');
34
+ require(FRM_VIEWS_PATH.'/frm-forms/new-field-js.php');
35
+ }
36
+ die();
37
+ }
38
+
39
+ function edit_name(){
40
+ global $frm_field;
41
+ $id = str_replace('field_', '', $_POST['element_id']);
42
+ $values = array('name' => $_POST['update_value']);
43
+ if ($_POST['original_html'] == 'Untitled')
44
+ $values['field_key'] = $_POST['update_value'];
45
+ $form = $frm_field->update($id, $values);
46
+ echo stripslashes($_POST['update_value']);
47
+ die();
48
+ }
49
+
50
+
51
+ function edit_description(){
52
+ global $frm_field;
53
+ $id = str_replace('field_', '', $_POST['element_id']);
54
+ $frm_field->update($id, array('description' => $_POST['update_value']));
55
+ echo stripslashes($_POST['update_value']);
56
+ die();
57
+ }
58
+
59
+ function mark_required(){
60
+ global $frm_field;
61
+ $id = str_replace('req_field_', '', $_POST['field']);
62
+ $frm_field->update($id, array('required' => '1'));
63
+ die();
64
+ }
65
+
66
+ function unmark_required(){
67
+ global $frm_field;
68
+ $id = str_replace('req_field_', '', $_POST['field']);
69
+ $frm_field->update($id, array('required' => '0'));
70
+ die();
71
+ }
72
+
73
+ function destroy(){
74
+ global $frm_field;
75
+ $field_id = $frm_field->destroy($_POST['field_id']);
76
+ die();
77
+ }
78
+
79
+ /* Field Options */
80
+ function add_option(){
81
+ global $frm_field;
82
+
83
+ $id = str_replace('field_', '', $_POST['field']);
84
+ $field = $frm_field->getOne($id);
85
+ $options = unserialize($field->options);
86
+ $last = max(array_keys($options));
87
+ $opt_key = $last + 1;
88
+ $opt = 'Option '.(count($options)+1);
89
+ $options[$opt_key] = $opt;
90
+ $frm_field->update($id, array('options' => serialize($options)));
91
+ $checked = '';
92
+
93
+ $field_data = $frm_field->getOne($id);
94
+ $field = array();
95
+ $field['type'] = $field_data->type;
96
+ $field['id'] = $id;
97
+ $field_name = "item_meta[$id]";
98
+
99
+ require(FRM_VIEWS_PATH.'/frm-fields/single-option.php');
100
+ require(FRM_VIEWS_PATH.'/frm-forms/new-option-js.php');
101
+ die();
102
+ }
103
+
104
+ function edit_option(){
105
+ global $frm_field;
106
+ $ids = explode('-',$_POST['element_id']);
107
+ $id = str_replace('field_', '', $ids[0]);
108
+ $field = $frm_field->getOne($id);
109
+ $options = unserialize($field->options);
110
+ $options[$ids[1]] = $_POST['update_value'];
111
+ $frm_field->update($id, array('options' => maybe_serialize($options)));
112
+ echo stripslashes($_POST['update_value']);
113
+ die();
114
+ }
115
+
116
+ function delete_option(){
117
+ global $frm_field;
118
+ $ids = explode('-',$_POST['field']);
119
+ $id = str_replace('frm_delete_field_', '', $ids[0]);
120
+ $field = $frm_field->getOne($id);
121
+ $options = unserialize($field->options);
122
+ unset($options[$ids[1]]);
123
+ $frm_field->update($id, array('options' => serialize($options)));
124
+ die();
125
+ }
126
+
127
+
128
+ function update_order(){
129
+ global $frm_field;
130
+ foreach ($_POST['frm_field_id'] as $position => $item)
131
+ $frm_field->update($item, array('field_order' => $position));
132
+ die();
133
+ }
134
+
135
+
136
+ function change_type($type){
137
+ global $frm_field_selection, $frmpro_is_installed;
138
+
139
+ if($frmpro_is_installed)
140
+ return $type;
141
+
142
+ $types = array_keys($frm_field_selection);
143
+ if (!in_array($type, $types))
144
+ $type = 'text';
145
+
146
+ return $type;
147
+ }
148
+ }
149
+ ?>
classes/controllers/FrmFormsController.php ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmFormsController{
4
+ function FrmFormsController(){
5
+ add_action('admin_menu', array( $this, 'menu' ));
6
+ add_action('admin_head-toplevel_page_'.FRM_PLUGIN_NAME, array($this,'head'));
7
+ add_action('admin_head-'.FRM_PLUGIN_NAME.'_page_'.FRM_PLUGIN_NAME.'-new', array($this,'head'));
8
+ add_action('admin_head-'.FRM_PLUGIN_NAME.'_page_'.FRM_PLUGIN_NAME.'-templates', array($this,'head'));
9
+ add_action('wp_ajax_frm_form_name_in_place_edit', array($this, 'edit_name') );
10
+ add_action('wp_ajax_frm_form_desc_in_place_edit', array($this, 'edit_description') );
11
+ add_action('wp_ajax_frm_delete_form_wo_fields',array($this, 'destroy_wo_fields'));
12
+ $this->views = FRM_VIEWS_PATH.'/frm-forms/';
13
+ }
14
+
15
+ function menu(){
16
+ add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | Forms', 'Forms', 8, FRM_PLUGIN_NAME, array($this,'route'));
17
+ add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | Create a Form', 'Create a Form', 8, FRM_PLUGIN_NAME.'-new', array($this,'new_form'));
18
+ add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | Templates', 'Templates', 8, FRM_PLUGIN_NAME.'-templates', array($this, 'template_list'));
19
+ }
20
+
21
+ function head(){
22
+ $css_file = 'frm_admin.css';
23
+ $js_file = 'list-items.js';
24
+ require_once(FRM_VIEWS_PATH . '/shared/head.php');
25
+ }
26
+
27
+ function list_form(){
28
+ $params = $this->get_params();
29
+ $errors = apply_filters('frm_admin_list_form_action', $errors);
30
+ return $this->display_forms_list($params, '', false, false, $errors);
31
+ }
32
+
33
+ function template_list(){
34
+ $_POST['template'] = 1;
35
+ return $this->display_forms_list();
36
+ }
37
+
38
+ function new_form(){
39
+ global $frm_app_controller, $frm_form, $frm_field_selection, $frm_recaptcha_enabled, $frm_pro_field_selection, $frmpro_is_installed;
40
+
41
+ $action = $frm_app_controller->get_param('action');
42
+ if ($action == 'create')
43
+ return $this->create();
44
+ else if ($action == 'new'){
45
+ $values = FrmFormsHelper::setup_new_vars();
46
+ $id = $frm_form->create( $values );
47
+ require_once($this->views . 'new.php');
48
+ }else{
49
+ $all_templates = $frm_form->getAll('is_template=1',' ORDER BY name');
50
+ require_once($this->views . 'new-selection.php');
51
+ }
52
+ }
53
+
54
+ function create(){
55
+ global $frm_app_controller, $frm_app_helper, $frm_field_selection, $frm_entry, $frm_form, $frm_field, $frm_recaptcha_enabled, $frm_pro_field_selection, $frm_utils, $frmpro_is_installed;
56
+ $errors = $frm_form->validate($_POST);
57
+ $id = $frm_app_controller->get_param('id');
58
+
59
+ if( count($errors) > 0 ){
60
+ $record = $frm_form->getOne( $id );
61
+ $fields = $frm_field->getAll("fi.form_id=$id", ' ORDER BY field_order');
62
+ $values = $frm_app_helper->setup_edit_vars($record,'forms',$fields,true);
63
+ require_once($this->views . 'new.php');
64
+ }else{
65
+ $items = $frm_entry->getAll('',' ORDER BY it.name');
66
+ $record = $frm_form->update( $id, $_POST, true );
67
+ $message = "Form was Successfully Created";
68
+ $params = $this->get_params();
69
+ return $this->display_forms_list($params, $message);
70
+ }
71
+
72
+ }
73
+
74
+ function edit(){
75
+ global $frm_app_controller;
76
+ $id = $frm_app_controller->get_param('id');
77
+ return $this->get_edit_vars($id);
78
+ }
79
+
80
+ function edit_name(){
81
+ global $frm_form;
82
+ $values = array('name' => $_POST['update_value']);
83
+ $form = $frm_form->update($_POST['form_id'], $values);
84
+ echo stripslashes($_POST['update_value']);
85
+ die();
86
+ }
87
+
88
+ function edit_description(){
89
+ global $frm_form;
90
+ $form = $frm_form->update($_POST['form_id'], array('description' => $_POST['update_value']));
91
+ echo wpautop(stripslashes($_POST['update_value']));
92
+ die();
93
+ }
94
+
95
+ function update(){
96
+ global $frm_form, $frm_app_controller;
97
+ $errors = $frm_form->validate($_POST);
98
+ $id = $frm_app_controller->get_param('id');
99
+ if( count($errors) > 0 ){
100
+ return $this->get_edit_vars($id, $errors);
101
+ }else{
102
+ $record = $frm_form->update( $_POST['id'], $_POST );
103
+ $message = "Form was Successfully Updated";
104
+ return $this->get_edit_vars($id, '', $message);
105
+ }
106
+ }
107
+
108
+ function duplicate(){
109
+ global $frm_form;
110
+
111
+ $params = $this->get_params();
112
+ $record = $frm_form->duplicate( $params['id'], $params['template'] );
113
+ $message = ($params['template'])?('Form template was Successfully Created'):('Form was Successfully Copied');
114
+ if ($record)
115
+ return $this->get_edit_vars($record, '', $message, true);
116
+ else
117
+ return $this->display_forms_list($params, 'There was a problem creating new template.');
118
+ }
119
+
120
+ function page_preview(){
121
+ global $frm_form;
122
+ $description = true;
123
+ $title = true;
124
+ $params = $this->get_params();
125
+ if (!$params['form']) return;
126
+ $form = $frm_form->getOne($params['form']);
127
+ require_once(FRM_VIEWS_PATH.'/frm-entries/frm-entry.php');
128
+ }
129
+
130
+ function preview(){
131
+ global $frm_form;
132
+ if ( !defined( 'ABSPATH' ) && !defined( 'XMLRPC_REQUEST' )) {
133
+ $root = dirname(dirname(dirname(dirname(__FILE__))));
134
+ include_once( $root.'/wp-config.php' );
135
+ $wp->init();
136
+ $wp->register_globals();
137
+ }
138
+
139
+ header("Content-Type: text/html; charset=utf-8");
140
+
141
+ $key = (isset($_GET['form'])?$_GET['form']:(isset($_POST['form'])?$_POST['form']:''));
142
+ $form = $frm_form->getAll("form_key='$key'",'',' LIMIT 1');
143
+ if (!$form) $form = $frm_form->getAll('','',' LIMIT 1');
144
+ $description = true;
145
+ $title = true;
146
+
147
+ require_once(FRM_VIEWS_PATH.'/frm-entries/direct.php');
148
+ }
149
+
150
+ function destroy(){
151
+ global $frm_form;
152
+ $params = $this->get_params();
153
+ if ($frm_form->destroy( $params['id'] ))
154
+ $message = "Form was Successfully Deleted";
155
+ $this->display_forms_list($params, $message, '', 1);
156
+ }
157
+
158
+ function destroy_wo_fields(){
159
+ global $frm_field, $frm_form;
160
+ $id = $_POST['form_id'];
161
+ if ($frm_field->getRecordCount('fi.form_id='.$id) <= 0)
162
+ $frm_form->destroy($id);
163
+ die();
164
+ }
165
+
166
+ function display_forms_list($params=false, $message='', $page_params_ov = false, $current_page_ov = false, $errors = array()){
167
+ global $wpdb, $frm_utils, $frm_form, $frm_entry, $frm_page_size, $frmpro_is_installed;
168
+
169
+ if(!$params)
170
+ $params = $this->get_params();
171
+
172
+ if($message=='')
173
+ $message = FrmAppHelper::frm_get_main_message();
174
+
175
+ $controller_file = FRM_PLUGIN_NAME;
176
+ $page_params = '';
177
+ $where_clause = " (status is NULL OR status = '' OR status = 'published') AND default_template=0 AND is_template = ".$params['template'];
178
+
179
+ if ($params['template']){
180
+ $default_templates = $frm_form->getAll('default_template=1');
181
+ $all_templates = $frm_form->getAll('is_template=1',' ORDER BY name');
182
+ }
183
+
184
+ $form_vars = $this->get_form_sort_vars($params, $where_clause);
185
+
186
+ if($current_page_ov)
187
+ $current_page = $current_page_ov;
188
+ else
189
+ $current_page = $params['paged'];
190
+
191
+ if($page_params_ov)
192
+ $page_params = $page_params_ov;
193
+ else
194
+ $page_params = $form_vars['page_params'];
195
+
196
+ $sort_str = $form_vars['sort_str'];
197
+ $sdir_str = $form_vars['sdir_str'];
198
+ $search_str = $form_vars['search_str'];
199
+
200
+ $record_count = $frm_form->getRecordCount($form_vars['where_clause']);
201
+ $page_count = $frm_form->getPageCount($frm_page_size,$form_vars['where_clause']);
202
+ $forms = $frm_form->getPage($current_page,$frm_page_size,$form_vars['where_clause'],$form_vars['order_by']);
203
+ $page_last_record = $frm_utils->getLastRecordNum($record_count,$current_page,$frm_page_size);
204
+ $page_first_record = $frm_utils->getFirstRecordNum($record_count,$current_page,$frm_page_size);
205
+ require_once($this->views . 'list.php');
206
+ }
207
+
208
+ function get_form_sort_vars($params,$where_clause = ''){
209
+ $order_by = '';
210
+ $page_params = '';
211
+
212
+ // These will have to work with both get and post
213
+ $sort_str = $params['sort'];
214
+ $sdir_str = $params['sdir'];
215
+ $search_str = $params['search'];
216
+
217
+ // Insert search string
218
+ if(!empty($search_str)){
219
+ $search_params = explode(" ", $search_str);
220
+
221
+ foreach($search_params as $search_param){
222
+ if(!empty($where_clause))
223
+ $where_clause .= " AND";
224
+
225
+ $where_clause .= " (name like '%$search_param%' OR description like '%$search_param%' OR created_at like '%$search_param%')";
226
+ }
227
+
228
+ $page_params .="&search=$search_str";
229
+ }
230
+
231
+ // make sure page params stay correct
232
+ if(!empty($sort_str))
233
+ $page_params .="&sort=$sort_str";
234
+
235
+ if(!empty($sdir_str))
236
+ $page_params .= "&sdir=$sdir_str";
237
+
238
+ // Add order by clause
239
+ switch($sort_str){
240
+ case "id":
241
+ case "name":
242
+ case "description":
243
+ case "form_key":
244
+ $order_by .= " ORDER BY $sort_str";
245
+ break;
246
+ default:
247
+ $order_by .= " ORDER BY name";
248
+ }
249
+
250
+ // Toggle ascending / descending
251
+ if((empty($sort_str) and empty($sdir_str)) or $sdir_str == 'asc'){
252
+ $order_by .= ' ASC';
253
+ $sdir_str = 'asc';
254
+ }else{
255
+ $order_by .= ' DESC';
256
+ $sdir_str = 'desc';
257
+ }
258
+
259
+ return array('order_by' => $order_by,
260
+ 'sort_str' => $sort_str,
261
+ 'sdir_str' => $sdir_str,
262
+ 'search_str' => $search_str,
263
+ 'where_clause' => $where_clause,
264
+ 'page_params' => $page_params);
265
+ }
266
+
267
+ function get_edit_vars($id, $errors = '', $message='', $create_link=false){
268
+ global $frm_app_helper, $frm_field_selection, $frm_entry, $frm_form, $frm_field, $frm_recaptcha_enabled, $frm_pro_field_selection, $frm_utils, $frmpro_is_installed;
269
+ $record = $frm_form->getOne( $id );
270
+ $items = $frm_entry->getAll('',' ORDER BY it.name');
271
+
272
+ $fields = $frm_field->getAll("fi.form_id=$id", ' ORDER BY field_order');
273
+ $values = $frm_app_helper->setup_edit_vars($record,'forms',$fields,true);
274
+ if ($values['default_template'])
275
+ wp_die('That template cannot be edited');
276
+ else if($create_link)
277
+ require_once($this->views . 'new.php');
278
+ else
279
+ require_once($this->views . 'edit.php');
280
+ }
281
+
282
+ function get_params(){
283
+ global $frm_app_controller;
284
+ $values = array();
285
+ foreach (array('template' => 0,'id' => '','paged' => 1,'form' => '','search' => '','sort' => '','sdir' => '') as $var => $default)
286
+ $values[$var] = $frm_app_controller->get_param($var, $default);
287
+
288
+ return $values;
289
+ }
290
+
291
+ function route(){
292
+ global $frm_app_controller;
293
+ $action = $frm_app_controller->get_param('action');
294
+ if($action=='new')
295
+ return $this->new_form();
296
+ else if($action=='create')
297
+ return $this->create();
298
+ else if($action=='edit')
299
+ return $this->edit();
300
+ else if($action=='update')
301
+ return $this->update();
302
+ else if($action=='duplicate')
303
+ return $this->duplicate();
304
+ else if($action == 'destroy')
305
+ return $this->destroy();
306
+ else if($action == 'list-form')
307
+ return $this->list_form();
308
+ else
309
+ return $this->display_forms_list();
310
+ }
311
+
312
+ }
313
+ ?>
classes/controllers/FrmSettingsController.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmSettingsController{
4
+ function FrmSettingsController(){
5
+ add_action('admin_menu', array( $this, 'menu' ), 25);
6
+ add_action('admin_head-'.FRM_PLUGIN_NAME.'-settings', array($this,'head'));
7
+ $this->views = FRM_VIEWS_PATH.'/frm-settings/';
8
+ }
9
+
10
+ function menu(){
11
+ add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | Settings', 'Settings', 8, FRM_PLUGIN_NAME.'-settings', array($this,'route'));
12
+ //add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | '. FRM_PLUGIN_TITLE . ' Pro', FRM_PLUGIN_TITLE . ' Pro', 8, FRM_PLUGIN_NAME.'-pro-settings', array($this,'pro_settings'));
13
+ }
14
+
15
+ function head(){
16
+ $css_file = 'frm_admin.css';
17
+ $js_file = 'list-items.js';
18
+ require_once(FRM_VIEWS_PATH . '/shared/admin_head.php');
19
+ }
20
+
21
+ function display_form(){
22
+ global $frm_settings;
23
+
24
+ require_once($this->views . 'form.php');
25
+ }
26
+
27
+ function process_form(){
28
+ global $frm_settings;
29
+
30
+ $errors = $frm_settings->validate($_POST,$errors);
31
+
32
+ $frm_settings->update($_POST);
33
+
34
+ if( empty($errors) ){
35
+ $frm_settings->store();
36
+ $message = 'Settings Saved';
37
+ }
38
+
39
+ require_once($this->views . 'form.php');
40
+ }
41
+
42
+ function pro_settings(){
43
+ global $frm_utils, $frmpro_is_installed, $frm_app_controller;
44
+
45
+ $action = $frm_app_controller->get_param('action');
46
+ $errors = array();
47
+
48
+ // variables for the field and option names
49
+ $frmpro_username = 'frmpro_username';
50
+ $frmpro_password = 'frmpro_password';
51
+ $hidden_field_name = 'frm_update_options';
52
+
53
+ // Read in existing option value from database
54
+ $frmpro_username_val = get_option( $frmpro_username );
55
+ $frmpro_password_val = get_option( $frmpro_password );
56
+
57
+ if($action == 'force-pro-reinstall'){
58
+ $frm_utils->download_and_install_pro($frmpro_username_val, $frmpro_password_val, true);
59
+ $message = _e(FRM_PLUGIN_TITLE .' Pro Successfully Reinstalled.', FRM_PLUGIN_NAME );
60
+ }else if($action == 'pro-uninstall'){
61
+ $frm_utils->uninstall_pro();
62
+ $message = _e(FRM_PLUGIN_TITLE .' Pro Successfully Uninstalled.', FRM_PLUGIN_NAME );
63
+ }else{
64
+ // See if the user has posted us some information
65
+ // If they did, this hidden field will be set to 'Y'
66
+ if( $frm_app_controller->get_param('$hidden_field_name') == 'Y' ){
67
+ // Validate This
68
+ // This is where the remote username / password will be validated
69
+
70
+ // Read their posted value
71
+ $prlipro_username_val = stripslashes($_POST[ $prlipro_username ]);
72
+ $prlipro_password_val = stripslashes($_POST[ $prlipro_password ]);
73
+
74
+ $user_type = $prli_utils->get_pro_user_type($prlipro_username_val, $prlipro_password_val);
75
+ if(empty($user_type))
76
+ $errors[] = "Your user account couldn't be validated...";
77
+
78
+ if( count($errors) > 0 ){
79
+ require(FRM_VIEWS_PATH.'/shared/errors.php');
80
+ }else{
81
+ // Save the posted value in the database
82
+ update_option( $frmpro_username, $frmpro_username_val );
83
+ update_option( $frmpro_password, $frmpro_password_val );
84
+
85
+ // Put an options updated message on the screen
86
+ $message = $prli_utils->download_and_install_pro($prlipro_username_val, $prlipro_password_val);
87
+
88
+ $message = (($message == 'SUCCESS')?FRM_PLUGIN_TITLE. 'has been installed':$message);
89
+ }
90
+ }
91
+ }
92
+ require_once($this->views . 'pro-settings.php');
93
+ }
94
+
95
+ function route(){
96
+ global $frm_app_controller;
97
+ $action = $frm_app_controller->get_param('action');
98
+ if($action=='process-form')
99
+ return $this->process_form();
100
+ else
101
+ return $this->display_form();
102
+ }
103
+ }
104
+ ?>
classes/controllers/FrmStatisticsController.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmStatisticsController{
4
+ function FrmStatisticsController(){
5
+ add_action('admin_menu', array( $this, 'menu' ), 30);
6
+ $this->views = FRM_VIEWS_PATH.'/frm-statistics/';
7
+ }
8
+
9
+ function menu(){
10
+ global $frmpro_is_installed;
11
+ if(!$frmpro_is_installed)
12
+ add_submenu_page(FRM_PLUGIN_TITLE, FRM_PLUGIN_TITLE .' | Pro Statistics', 'Pro Statistics', 8, FRM_PLUGIN_TITLE.'-statistics',array($this,''));
13
+ }
14
+
15
+ function list_entries(){
16
+ require_once($this->views .'list.php');
17
+ }
18
+
19
+ }
20
+
21
+ ?>
classes/helpers/FrmAppHelper.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmAppHelper{
4
+ function FrmAppHelper(){}
5
+
6
+ function get_pages(){
7
+ return get_posts( array('post_type' => 'page', 'post_status' => 'published', 'numberposts' => 99, 'order_by' => 'post_title', 'order' => 'ASC'));
8
+ }
9
+
10
+ function value_is_selected($field_name, $field_value, $selected_value){
11
+ if( (isset($_POST[$field_name]) and $_POST[$field_name] == $selected_value) or (!isset($_POST[$field_name]) and $field_value == $selected_value) )
12
+ echo ' selected="selected"';
13
+ }
14
+
15
+ function value_is_checked($field_name, $field_value){
16
+ if( (isset($_POST) and $_POST[$field_name] == '1') or (!isset($_POST) and $field_value == '1') )
17
+ echo ' checked="checked"';
18
+ }
19
+
20
+ function value_is_checked_with_array($field_name, $index, $field_value){
21
+ if( ( $_POST['action'] == 'process_form' and isset( $_POST[ $field_name ][ $index ] ) ) or ( $_POST['action'] != 'process_form' and isset($field_value) ) )
22
+ echo ' checked="checked"';
23
+ }
24
+
25
+ function get_unique_key($name='', $table_name, $column, $id = 0,$num_chars = 6){
26
+ global $wpdb;
27
+
28
+ if ($name == ''){
29
+ $max_slug_value = pow(36,$num_chars);
30
+ $min_slug_value = 37; // we want to have at least 2 characters in the slug
31
+ $key = base_convert( rand($min_slug_value,$max_slug_value), 10, 36 );
32
+ }else
33
+ $key = sanitize_title_with_dashes($name);
34
+
35
+ $query = "SELECT $column FROM $table_name WHERE $column = %s AND ID != %d LIMIT 1";
36
+ $key_check = $wpdb->get_var($wpdb->prepare($query, $key, $id));
37
+ if ($key_check){
38
+ $suffix = 2;
39
+ do {
40
+ $alt_post_name = substr($key, 0, 200-(strlen($suffix)+1)). "$suffix";
41
+ $key_check = $wpdb->get_var($wpdb->prepare($query, $alt_post_name, $id));
42
+ $suffix++;
43
+ } while ($key_check);
44
+ $key = $alt_post_name;
45
+ }
46
+ return $key;
47
+ }
48
+
49
+ function setup_edit_vars($record, $table, $fields='', $default=false){
50
+ if(!$record) return false;
51
+ global $frm_entry_meta, $frm_form, $frm_app_controller;
52
+ $values = array();
53
+
54
+ $values['id'] = $record->id;
55
+
56
+ foreach (array('name' => $record->name, 'description' => $record->description) as $var => $default_val)
57
+ $values[$var] = stripslashes($frm_app_controller->get_param($var, $default_val));
58
+
59
+ $values['form_name'] = ($record->form_id)?($frm_form->getName( $record->form_id )):('');
60
+
61
+ $values['fields'] = array();
62
+ if ($fields){
63
+ foreach($fields as $field){
64
+
65
+ if ($default)
66
+ $meta_value = $field->default_value;
67
+ else
68
+ $meta_value = $frm_entry_meta->get_entry_meta_by_field($record->id, $field->id, true);
69
+
70
+ $field_options = stripslashes_deep(unserialize($field->field_options));
71
+
72
+ $new_value = (isset($_POST['item_meta'][$field->id])) ? $_POST['item_meta'][$field->id] : $meta_value;
73
+ if ($field->type != 'checkbox')
74
+ $new_value = stripslashes($new_value);
75
+
76
+ $field_array = array('id' => $field->id,
77
+ 'value' => $new_value,
78
+ 'default_value' => stripslashes($field->default_value),
79
+ 'name' => stripslashes($field->name),
80
+ 'description' => stripslashes($field->description),
81
+ 'type' => apply_filters('frm_field_type',$field->type),
82
+ 'options' => stripslashes_deep(unserialize($field->options)),
83
+ 'required' => $field->required,
84
+ 'field_key' => $field->field_key,
85
+ 'field_order' => $field->field_order,
86
+ 'form_id' => $field->form_id);
87
+
88
+ foreach (array('size' => 75,'max' => '','label' => 'top','invalid' => '','required_indicator' => '*','blank' => '') as $opt => $default_opt)
89
+ $field_array[$opt] = ($_POST and isset($_POST['field_options'][$opt.'_'.$field->id]) ) ? $_POST['field_options'][$opt.'_'.$field->id] : (isset($field_options[$opt]) ? $field_options[$opt]: $default_opt);
90
+
91
+ $values['fields'][] = apply_filters('frm_setup_edit_fields_vars', $field_array, $field);
92
+ }
93
+ }
94
+
95
+ if ($table == 'entries')
96
+ $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
97
+ else if ($table == 'forms')
98
+ $values = FrmFormsHelper::setup_edit_vars( $values, $record );
99
+
100
+ return $values;
101
+ }
102
+
103
+ function frm_get_main_message( $message = ''){
104
+ /*
105
+ global $frmpro_is_installed;
106
+ include_once(ABSPATH."/wp-includes/class-IXR.php");
107
+
108
+ if($frmpro_is_installed){
109
+ $client = new IXR_Client('http://prettylinkpro.com/xmlrpc.php');
110
+ if ($client->query('prlipro.get_main_message'))
111
+ $message = $client->getResponse();
112
+ }else{
113
+ $client = new IXR_Client('http://blairwilliams.com/xmlrpc.php');
114
+ if ($client->query('prli.get_main_message'))
115
+ $message = $client->getResponse();
116
+ } */
117
+ return $message;
118
+ }
119
+
120
+ function display_recaptcha($errors) {
121
+ global $recaptcha_opt;
122
+
123
+ $format = <<<END
124
+ <script type='text/javascript'>var RecaptchaOptions={theme:'{$recaptcha_opt['re_theme_reg']}',lang:'{$recaptcha_opt['re_lang']}',tabindex:30};</script>
125
+ END;
126
+
127
+ $comment_string = <<<COMMENT_FORM
128
+ <script type='text/javascript'>document.getElementById('recaptcha_table').style.direction='ltr';</script>
129
+ COMMENT_FORM;
130
+
131
+ $use_ssl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? true : false;
132
+
133
+ if (IS_WPMU){
134
+ $error = $errors->get_error_message('captcha');
135
+ echo($error ? '<p class="error">'.$error.'</p>' : '');
136
+ }
137
+ echo $format . recaptcha_wp_get_html(isset($_GET['rerror'])?$_GET['rerror']:'', $use_ssl);
138
+ }
139
+
140
+ }
141
+
142
+ ?>
classes/helpers/FrmEntriesHelper.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmEntriesHelper{
4
+
5
+ function setup_new_vars($fields){
6
+ global $frm_app_controller, $frm_form;
7
+ $values = array();
8
+ foreach (array('name' => '', 'description' => '', 'item_key' => '') as $var => $default)
9
+ $values[$var] = stripslashes($frm_app_controller->get_param($var, $default));
10
+
11
+ $values['fields'] = array();
12
+ if ($fields){
13
+ foreach($fields as $field){
14
+ $default = $field->default_value;
15
+
16
+ $field_options = unserialize($field->field_options);
17
+ $new_value = ($_POST and isset($_POST['item_meta'][$field->id])) ? $_POST['item_meta'][$field->id] : $default;
18
+ if ($field->type != 'checkbox')
19
+ $new_value = stripslashes($new_value);
20
+
21
+ $field_array = array('id' => $field->id,
22
+ 'value' => $new_value,
23
+ 'default_value' => $new_value,
24
+ 'name' => stripslashes($field->name),
25
+ 'description' => stripslashes($field->description),
26
+ 'type' => apply_filters('frm_field_type',$field->type),
27
+ 'options' => unserialize($field->options),
28
+ 'required' => $field->required,
29
+ 'field_key' => $field->field_key,
30
+ 'field_order' => $field->field_order,
31
+ 'form_id' => $field->form_id);
32
+
33
+ foreach (array('size' => 75,'max' => '','label' => 'top','invalid' => '','required_indicator' => '*','blank' => '') as $opt => $default_opt)
34
+ $field_array[$opt] = (isset($field_options[$opt]) && $field_options[$opt] != '') ? $field_options[$opt] : $default_opt;
35
+
36
+ $values['fields'][] = apply_filters('frm_setup_new_fields_vars', $field_array, $field);
37
+ }
38
+ }
39
+ return $values;
40
+ }
41
+
42
+ function setup_edit_vars($values, $record){
43
+ //$values['description'] = unserialize( $record->description );
44
+ $values['item_key'] = (($_POST and isset($_POST['item_key']) and $record == null)?$_POST['item_key']:$record->item_key);
45
+ return $values;
46
+ }
47
+
48
+ }
49
+
50
+ ?>
classes/helpers/FrmFieldsHelper.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmFieldsHelper{
4
+
5
+ function setup_new_vars($type='',$form_id=''){
6
+ global $frm_field;
7
+
8
+ $field_count = $frm_field->getRecordCount("form_id=$form_id");
9
+ $key = FrmAppHelper::get_unique_key('', $frm_field->table_name, 'field_key');
10
+
11
+ $values = array();
12
+ foreach (array('name' => 'Untitled', 'description' => '', 'field_key' => $key, 'type' => $type, 'options'=>'', 'default_value'=>'', 'field_order' => $field_count+1, 'required' => false, 'blank' => 'Untitled can\'t be blank', 'invalid' => 'Untitled is an invalid format', 'form_id' => $form_id) as $var => $default)
13
+ $values[$var] = $default;
14
+
15
+ $values['field_options'] = array();
16
+ foreach (array('size' => '50', 'max' => '', 'label' => 'top', 'required_indicator' => '*') as $var => $default)
17
+ $values['field_options'][$var] = $default;
18
+
19
+ if ($type == 'radio' || ($type == 'checkbox'))
20
+ $values['options'] = serialize(array(1 => 'Option 1', 2 => 'Option 2'));
21
+ else if ( $type == 'select')
22
+ $values['options'] = serialize(array(1 => '', 2 => 'Option 1', 3 => 'Option 2'));
23
+ else if ($type == 'textarea'){
24
+ $values['field_options']['size'] = '45';
25
+ $values['field_options']['max'] = '5';
26
+ }
27
+
28
+ return $values;
29
+ }
30
+
31
+ function setup_edit_vars($record){
32
+ global $frm_entry_meta, $frm_form, $frm_app_controller;
33
+
34
+ $values = array();
35
+ $values['id'] = $record->id;
36
+
37
+ foreach (array('name' => $record->name, 'description' => $record->description) as $var => $default)
38
+ $values[$var] = htmlspecialchars(stripslashes($frm_app_controller->get_param($var, $default)));
39
+
40
+ $values['form_name'] = ($record->form_id)?($frm_form->getName( $record->form_id )):('');
41
+
42
+ foreach (array('field_key' => $record->field_key, 'type' => $record->type, 'default_value'=> $record->default_value, 'field_order' => $record->field_order, 'required' => $record->required) as $var => $default)
43
+ $values[$var] = $frm_app_controller->get_param($var, $default);
44
+
45
+ $values['options'] = unserialize($record->options);
46
+ $field_options = unserialize($record->field_options);
47
+ $values['field_options'] = $field_options;
48
+ $values['size'] = (isset($field_options['size']))?($field_options['size']):('75');
49
+ $values['max'] = (isset($field_options['max']))?($field_options['max']):('');
50
+ $values['label'] = (isset($field_options['label']))?($field_options['label']):('top');
51
+ $values['blank'] = (isset($field_options['blank']))?($field_options['blank']):('');
52
+ $values['required_indicator'] = (isset($field_options['required_indicator']))?($field_options['required_indicator']):('*');
53
+ $values['invalid'] = (isset($field_options['invalid']))?($field_options['invalid']):('');
54
+
55
+ return $values;
56
+ }
57
+
58
+ }
59
+
60
+ ?>
classes/helpers/FrmFormsHelper.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmFormsHelper{
4
+ function get_direct_link($key, $prli_link_id=false){
5
+ global $frm_siteurl;
6
+ $target_url = $frm_siteurl . '/index.php?plugin='. FRM_PLUGIN_NAME. '&controller=forms&action=preview&form='.$key;
7
+ if ($prli_link_id && class_exists('PrliLink')){
8
+ $prli = prli_get_pretty_link_url($prli_link_id);
9
+ if ($prli) $target_url = $prli;
10
+ }
11
+ return $target_url;
12
+ }
13
+
14
+ function get_template_dropdown($templates){ ?>
15
+ <select id="select_form" name="select_form" onChange='createFromFrmTemplate(this.value)'>
16
+ <option value="">Create Form from Template: </option>
17
+ <?php foreach ($templates as $temp){ ?>
18
+ <option value="<?php echo $temp->id ?>"><?php echo $temp->name ?></option>
19
+ <?php }?>
20
+ </select>
21
+ <script type="text/javascript">
22
+ function createFromFrmTemplate(form){window.location='<?php $_SERVER["REQUEST_URI"] ?>?page=<?php echo FRM_PLUGIN_NAME; ?>&action=duplicate&id='+form}
23
+ </script>
24
+ <?
25
+ }
26
+
27
+ function setup_new_vars(){
28
+ global $frm_app_controller, $frm_form;
29
+ $values = array();
30
+ foreach (array('name' => 'Untitled Form', 'description' => '') as $var => $default)
31
+ $values[$var] = stripslashes($frm_app_controller->get_param($var, $default));
32
+
33
+ foreach (array('form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0) as $var => $default)
34
+ $values[$var] = stripslashes($frm_app_controller->get_param($var, $default));
35
+
36
+ $values['form_key'] = ($_POST and isset($_POST['form_key']))?$_POST['form_key']:(FrmAppHelper::get_unique_key('', $frm_form->table_name, 'form_key'));
37
+ $values['email_to'] = ($_POST and isset($_POST['options']['email_to'])) ? $_POST['options']['email_to'] : '';
38
+
39
+ return apply_filters('frm_setup_new_form_vars', $values);
40
+ }
41
+
42
+ function setup_edit_vars($values, $record){
43
+ global $frm_form, $frm_app_controller;
44
+
45
+ $values['form_key'] = $frm_app_controller->get_param('form_key', $record->form_key);
46
+ $values['default_template'] = $frm_app_controller->get_param('default_template', $record->default_template);
47
+ $values['is_template'] = $frm_app_controller->get_param('is_template', $record->is_template);
48
+ $options = stripslashes_deep(unserialize($record->options));
49
+
50
+ if (is_array($options)){
51
+ foreach ($options as $opt => $value)
52
+ $values[$opt] = $frm_app_controller->get_param($opt, $value);
53
+ }
54
+
55
+ return apply_filters('frm_setup_edit_form_vars', $values);
56
+ }
57
+
58
+ }
59
+ ?>
classes/helpers/FrmSettingsHelper.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmSettingsHelper{
4
+ function wp_pages_dropdown($field_name, $page_id){
5
+ global $frm_app_controller;
6
+
7
+ $field_value = $frm_app_controller->get_param($field_name);
8
+ $pages = get_posts( array('post_type' => 'page', 'post_status' => 'published', 'numberposts' => 99, 'order_by' => 'post_title', 'order' => 'ASC'));
9
+ ?>
10
+ <select name="<?php echo $field_name; ?>" id="<?php echo $field_name; ?>" class="frm-dropdown frm-pages-dropdown">
11
+ <option value=""></option>
12
+ <?php foreach($pages as $page){ ?>
13
+ <option value="<?php echo $page->ID; ?>" <?php echo (((isset($_POST[$field_name]) and $_POST[$field_name] == $page->ID) or (!isset($_POST[$field_name]) and $page_id == $page->ID))?' selected="selected"':''); ?>><?php echo $page->post_title; ?> </option>
14
+ <?php } ?>
15
+ </select>
16
+ <?php
17
+ }
18
+ }
19
+ ?>
classes/models/FrmEntry.php ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class FrmEntry{
3
+ var $table_name;
4
+
5
+ function FrmEntry(){
6
+ global $wpdb;
7
+ $this->table_name = "{$wpdb->prefix}frm_items";
8
+ }
9
+
10
+ function create( $values ){
11
+ global $wpdb, $frm_entry_meta;
12
+
13
+ $new_values = array();
14
+ $new_values['item_key'] = FrmAppHelper::get_unique_key($values['item_key'], $this->table_name, 'item_key');
15
+ $new_values['name'] = isset($values['name']) ? $values['name'] : $values['item_key'];
16
+ $new_values['description'] = serialize(array('ip' => $_SERVER['REMOTE_ADDR'],
17
+ 'browser' => $_SERVER['HTTP_USER_AGENT'],
18
+ 'referrer' => $_SERVER['HTTP_REFERER']));
19
+ $new_values['form_id'] = isset($values['form_id']) ? (int)$values['form_id']: null;
20
+ //$new_values['parent_item_id'] = isset($values['parent_item_id'])?(int)$values['parent_item_id']: null;
21
+ $new_values['created_at'] = current_time('mysql', 1);
22
+
23
+ $query_results = $wpdb->insert( $this->table_name, $new_values );
24
+
25
+ if($query_results){ //TODO: save checkbox values in serialized array
26
+ $entry_id = $wpdb->insert_id;
27
+ if (isset($values['item_meta']))
28
+ $frm_entry_meta->update_entry_metas($entry_id, $values['item_meta']);
29
+ $entry = $this->getOne($entry_id);
30
+ do_action('frm_after_create_entry', $entry);
31
+ return $entry_id;
32
+ }else
33
+ return false;
34
+ }
35
+
36
+ function duplicate( $id ){
37
+ global $wpdb, $frm_entry, $frm_entry_meta;
38
+
39
+ $values = $frm_entry->getOne( $id );
40
+
41
+ $new_values = array();
42
+ $new_values['item_key'] = FrmAppHelper::get_unique_key('', $this->table_name, 'item_key');
43
+ $new_values['name'] = $values->name;
44
+ $new_values['form_id'] = ($values->form_id)?(int)$values->form_id: null;
45
+ //$new_values['parent_item_id'] = ($values->parent_item_id)?(int)$values->parent_item_id: null;
46
+ $new_values['created_at'] = current_time('mysql', 1);
47
+
48
+ $query_results = $wpdb->insert( $this->table_name, $new_values );
49
+
50
+ if($query_results){
51
+ $frm_entry_meta->duplicate_entry_metas($id);
52
+ return $wpdb->insert_id;
53
+ }else
54
+ return false;
55
+ }
56
+
57
+ function update( $id, $values ){
58
+ global $wpdb, $frm_entry_meta, $frm_field;
59
+
60
+ $new_values = array();
61
+ $new_values['name'] = isset($values['name'])?$values['name']:'';
62
+ $new_values['form_id'] = isset($values['form_id'])?(int)$values['form_id']: null;
63
+ //$new_values['parent_item_id'] = isset($values['parent_item_id'])?(int)$values['parent_item_id']: null;
64
+
65
+ $query_results = $wpdb->update( $this->table_name, $new_values, array( 'id' => $id ) );
66
+
67
+ if (isset($values['item_meta']))
68
+ $frm_entry_meta->update_entry_metas($id, $values['item_meta']);
69
+
70
+ return $query_results;
71
+ }
72
+
73
+ function destroy( $id ){
74
+ global $wpdb, $frm_entry_meta;
75
+
76
+ // Disconnect the child items from this parent item
77
+ $query_results = $wpdb->update( $this->table_name, array('parent_item_id' => null), array( 'parent_item_id' => $id ) );
78
+
79
+ $reset = 'DELETE FROM ' . $frm_entry_meta->table_name . ' WHERE item_id=' . $id;
80
+ $destroy = 'DELETE FROM ' . $this->table_name . ' WHERE id=' . $id;
81
+
82
+ $wpdb->query($reset);
83
+ return $wpdb->query($destroy);
84
+ }
85
+
86
+ function update_form( $id, $value, $form_id ){
87
+ global $wpdb;
88
+ $form_id = isset($value) ? $form_id : NULL;
89
+ return $wpdb->update( $this->table_name, array('form_id' => $form_id), array( 'id' => $id ) );
90
+ }
91
+
92
+ function getOneByKey( $key ){
93
+ global $wpdb, $frm_entry_meta;
94
+ $query = "SELECT it.*".//", meta.* " .
95
+ "FROM {$this->table_name} it ".
96
+ //"LEFT OUTER JOIN {$frm_entry_meta->table_name} meta ON meta.item_id=it.id " .
97
+ "WHERE it.item_key='" . $key . "'";
98
+ return $wpdb->get_row($query);
99
+ }
100
+
101
+ function getOne( $id ){
102
+ global $wpdb, $frm_form;
103
+ $query = 'SELECT it.*, ' .
104
+ 'gr.name as form_name, ' .
105
+ 'gr.form_key as form_key ' .
106
+ 'FROM '. $this->table_name . ' it ' .
107
+ 'LEFT OUTER JOIN ' . $frm_form->table_name . ' gr ON it.form_id=gr.id' .
108
+ ' WHERE it.id=' . $id;
109
+ return $wpdb->get_row($query);
110
+ }
111
+
112
+ function getAll($where = '', $order_by = '', $limit = ''){
113
+ global $wpdb, $frm_form, $frm_utils;
114
+ $query = 'SELECT it.*, ' .
115
+ 'gr.name as form_name, ' .
116
+ 'gr.form_key as form_key ' .
117
+ 'FROM '. $this->table_name . ' it ' .
118
+ 'LEFT OUTER JOIN ' . $frm_form->table_name . ' gr ON it.form_id=gr.id' .
119
+ $frm_utils->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
120
+ return $wpdb->get_results($query);
121
+ }
122
+
123
+ // Pagination Methods
124
+ function getRecordCount($where=""){
125
+ global $wpdb, $frm_utils, $frm_form;
126
+ $query = 'SELECT COUNT(*) FROM ' . $this->table_name . ' it ' .
127
+ 'LEFT OUTER JOIN ' . $frm_form->table_name . ' gr ON it.form_id=gr.id' .
128
+ $frm_utils->prepend_and_or_where(' WHERE ', $where);
129
+ return $wpdb->get_var($query);
130
+ }
131
+
132
+ function getPageCount($p_size, $where=""){
133
+ return ceil((int)$this->getRecordCount($where) / (int)$p_size);
134
+ }
135
+
136
+ function getPage($current_p,$p_size, $where = "", $order_by = ''){
137
+ global $wpdb, $frm_utils, $frm_form;
138
+ $end_index = $current_p * $p_size;
139
+ $start_index = $end_index - $p_size;
140
+ $query = 'SELECT it.*, ' .
141
+ 'gr.name as form_name ' .
142
+ 'FROM ' . $this->table_name . ' it ' .
143
+ 'LEFT OUTER JOIN ' . $frm_form->table_name . ' gr ON it.form_id=gr.id' .
144
+ $frm_utils->prepend_and_or_where(' WHERE', $where) . $order_by . ' ' .
145
+ 'LIMIT ' . $start_index . ',' . $p_size . ';';
146
+ $results = $wpdb->get_results($query);
147
+ return $results;
148
+ }
149
+
150
+ function validate( $values ){
151
+ global $wpdb, $frm_utils, $frm_field, $frm_entry_meta;
152
+
153
+ $errors = array();
154
+
155
+ if (!isset($values['name']) and isset($values['item_meta'])){
156
+ foreach($values['item_meta'] as $key => $value){
157
+ $field = $frm_field->getOne($key);
158
+ if ($field->required == '1' and $field->type == 'text' and !isset($_POST['name']))
159
+ $_POST['name'] = $value;
160
+ }
161
+ }
162
+
163
+ if( !isset($values['item_key']) or $values['item_key'] == '' )
164
+ $_POST['item_key'] = FrmAppHelper::get_unique_key('', $this->table_name, 'item_key');;
165
+
166
+ //if( $values['name'] == null or $values['name'] == '' )
167
+ // $errors[] = "Name can't be blank";
168
+
169
+ if (isset($values['item_meta'])){
170
+ foreach($values['item_meta'] as $key => $value){
171
+ $field = $frm_field->getOne($key);
172
+ if ($field->required == '1' and ($values['item_meta'][$key] == null or $values['item_meta'][$key] == '') and ($field->form_id == $values['form_id'])){
173
+ $field_options = unserialize($field->field_options);
174
+ $errors['field'.$field->id] = ($field_options['blank'] == 'Untitled cannot be blank' || $field_options['blank'] == '')?($field->name." can't be blank"):$field_options['blank'];
175
+ }
176
+ $errors = apply_filters('frm_validate_field_entry', $errors, $key, $value);
177
+ }
178
+
179
+ }
180
+
181
+ if (isset($_POST['recaptcha_challenge_field']) and $_POST['action'] == 'create'){
182
+ global $recaptcha_opt;
183
+
184
+ if (empty($_POST['recaptcha_response_field']) || $_POST['recaptcha_response_field'] == '') {
185
+ $errors['field_captcha'] = $recaptcha_opt['error_blank'];
186
+ }else{
187
+ $response = recaptcha_check_answer($recaptcha_opt['privkey'], $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
188
+
189
+ if (!$response->is_valid)
190
+ if ($response->error == 'incorrect-captcha-sol')
191
+ $errors['field_captcha'] = $recaptcha_opt['error_incorrect'];
192
+
193
+ }
194
+ }
195
+
196
+ return $errors;
197
+ }
198
+
199
+ }
200
+ ?>
classes/models/FrmEntryMeta.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class FrmEntryMeta{
3
+ var $table_name;
4
+
5
+ function FrmEntryMeta(){
6
+ global $wpdb;
7
+ $this->table_name = "{$wpdb->prefix}frm_item_metas";
8
+ }
9
+
10
+ function add_entry_meta($item_id, $field_id, $meta_key, $meta_value){
11
+ global $wpdb;
12
+
13
+ $new_values = array();
14
+ $new_values['meta_key'] = $meta_key;
15
+ $new_values['meta_value'] = $meta_value;
16
+ $new_values['item_id'] = $item_id;
17
+ $new_values['field_id'] = $field_id;
18
+ $new_values['created_at'] = current_time('mysql', 1);
19
+
20
+ return $wpdb->insert( $this->table_name, $new_values );
21
+ }
22
+
23
+ function update_entry_meta($item_id, $field_id, $meta_key, $meta_value){
24
+ global $wpdb;
25
+ //$this->delete_entry_meta($item_id, $field_id);
26
+ if ($meta_value)
27
+ $this->add_entry_meta($item_id, $field_id, $meta_key, $meta_value);
28
+ }
29
+
30
+ function update_entry_metas($item_id, $values){
31
+ global $frm_field;
32
+ $this->delete_entry_metas($item_id);
33
+ foreach($values as $field_id => $meta_value){
34
+ $meta_key = $frm_field->getOne( $field_id )->field_key;
35
+ $meta_value = maybe_serialize($values[$field_id]);
36
+ $this->update_entry_meta($item_id, $field_id, $meta_key, $meta_value);
37
+ }
38
+ }
39
+
40
+ function duplicate_entry_metas($item_id){
41
+ foreach ($this->get_entry_meta_info($item_id) as $meta)
42
+ $this->update_entry_meta($item_id, $meta->field_id, $meta->meta_key, $meta->meta_value);
43
+ }
44
+
45
+ function delete_entry_meta($item_id, $field_id){
46
+ global $wpdb;
47
+
48
+ $query_str = "DELETE FROM {$this->table_name} WHERE field_id=%d AND item_id=%d";
49
+ $query = $wpdb->prepare($query_str, $field_id, $item_id);
50
+ return $wpdb->query($query);
51
+ }
52
+
53
+ function delete_entry_metas($item_id){
54
+ global $wpdb;
55
+
56
+ $query_str = "DELETE FROM {$this->table_name} WHERE item_id=%d";
57
+ $query = $wpdb->prepare($query_str, $item_id);
58
+ return $wpdb->query($query);
59
+ }
60
+
61
+ function get_entry_meta_by_field($item_id, $field_id, $return_var=false){
62
+ global $wpdb;
63
+ $query = "SELECT meta_value FROM {$this->table_name} WHERE field_id='{$field_id}' and item_id='{$item_id}'";
64
+ if($return_var)
65
+ return $wpdb->get_var("{$query} LIMIT 1");
66
+ else
67
+ return $wpdb->get_col($query, 0);
68
+ }
69
+
70
+ function get_entry_meta($item_id,$meta_key,$return_var=true){
71
+ global $wpdb;
72
+ $query_str = "SELECT meta_value FROM {$this->table_name} WHERE meta_key=%s and item_id=%d";
73
+ $query = $wpdb->prepare($query_str,$meta_key,$item_id);
74
+
75
+ if($return_var)
76
+ return stripslashes($wpdb->get_var("{$query} LIMIT 1"));
77
+ else
78
+ return $wpdb->get_col($query, 0);
79
+ }
80
+
81
+ function get_entry_metas($item_id){
82
+ global $wpdb;
83
+ $query_str = "SELECT meta_value FROM {$this->table_name} WHERE item_id=%d";
84
+ $query = $wpdb->prepare($query_str,$item_id);
85
+
86
+ return $wpdb->get_col($query, 0);
87
+ }
88
+
89
+ function get_entry_meta_info($item_id){
90
+ global $wpdb;
91
+ $query_str = "SELECT * FROM {$this->table_name} WHERE item_id=%d";
92
+ $query = $wpdb->prepare($query_str,$item_id);
93
+
94
+ return $wpdb->get_results($query, 0);
95
+ }
96
+
97
+ function get_entry_meta_info_by_key($item_id, $meta_key){
98
+ global $wpdb;
99
+ $query_str = "SELECT * FROM {$this->table_name} WHERE meta_key=%s and item_id=%d";
100
+ $query = $wpdb->prepare($query_str,$meta_key,$item_id);
101
+
102
+ return $wpdb->get_results($query, 0);
103
+ }
104
+
105
+ function getAll($where = '', $order_by = '', $limit = ''){
106
+ global $wpdb, $frm_field, $frm_utils;
107
+ $query = 'SELECT it.*, ' .
108
+ 'fi.type as field_type, ' .
109
+ 'fi.required as required, ' .
110
+ 'fi.form_id as field_form_id, ' .
111
+ 'fi.name as field_name ' .
112
+ 'FROM '. $this->table_name . ' it ' .
113
+ 'LEFT OUTER JOIN ' . $frm_field->table_name . ' fi ON it.field_id=fi.id' .
114
+ $frm_utils->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
115
+ if ($limit == ' LIMIT 1')
116
+ $results = $wpdb->get_row($query);
117
+ else
118
+ $results = $wpdb->get_results($query);
119
+ return $results;
120
+ }
121
+
122
+ function getEntryIds($where = '', $order_by = '', $limit = ''){
123
+ global $wpdb, $frm_field, $frm_utils;
124
+ $query = "SELECT DISTINCT it.item_id FROM $this->table_name it LEFT OUTER JOIN $frm_field->table_name fi ON it.field_id=fi.id". $frm_utils->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
125
+ if ($limit == ' LIMIT 1')
126
+ $results = $wpdb->get_var($query);
127
+ else
128
+ $results = $wpdb->get_col($query);
129
+
130
+ return $results;
131
+ }
132
+
133
+ function getRecordCount($where=""){
134
+ global $wpdb, $frm_utils, $frm_field;
135
+ $query = 'SELECT COUNT(*) FROM ' . $this->table_name . ' it ' .
136
+ 'LEFT OUTER JOIN ' . $frm_field->table_name . ' fi ON it.field_id=fi.id' .
137
+ $frm_utils->prepend_and_or_where(' WHERE ', $where);
138
+ return $wpdb->get_var($query);
139
+ }
140
+
141
+ function search_entry_metas($search, $meta_key='', $operator){
142
+ global $wpdb, $frm_utils;
143
+ if (is_array($search)){
144
+ $where = '';
145
+ foreach ($search as $field => $value){
146
+ if ($field == 'year' and $value > 0)
147
+ $where .= " meta_value {$operator} '%{$value}' and";
148
+ if ($field == 'month' and $value > 0)
149
+ $where .= " meta_value {$operator} '{$value}%' and";
150
+ if ($field == 'day' and $value > 0)
151
+ $where .= " meta_value {$operator} '%/{$value}/%' and";
152
+ }
153
+ $where .= " meta_key='{$meta_key}'";
154
+ $query = "SELECT DISTINCT item_id FROM {$this->table_name}". $frm_utils->prepend_and_or_where(' WHERE ', $where);
155
+ }else{
156
+ if ($operator == 'LIKE')
157
+ $search = "%{$search}%";
158
+ $query = $wpdb->prepare("SELECT DISTINCT item_id FROM {$this->table_name} WHERE meta_value {$operator} '{$search}' and meta_key='{$meta_key}'");
159
+ }
160
+ return $wpdb->get_col($query, 0);
161
+ }
162
+
163
+ function validate( $errors, $field, $key, $value, $values ){
164
+ global $wpdb, $frm_utils, $frm_field;
165
+
166
+ $field_options = unserialize($field->field_options);
167
+
168
+ return $errors;
169
+ }
170
+ }
171
+ ?>
classes/models/FrmField.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class FrmField{
3
+ var $table_name;
4
+
5
+ function FrmField(){
6
+ global $wpdb;
7
+ $this->table_name = "{$wpdb->prefix}frm_fields";
8
+ }
9
+
10
+ function create( $values, $return=true ){
11
+ global $wpdb;
12
+
13
+ $new_values = array();
14
+ $key = isset($values['field_key']) ? $values['field_key'] : $values['name'];
15
+ $new_values['field_key'] = FrmAppHelper::get_unique_key($key, $this->table_name, 'field_key');
16
+
17
+ foreach (array('name','description','type','default_value','options') as $col)
18
+ $new_values[$col] = stripslashes($values[$col]);
19
+
20
+ $new_values['field_order'] = isset($values['field_order'])?(int)$values['field_order']:NULL;
21
+ $new_values['required'] = isset($values['required'])?(int)$values['required']:NULL;
22
+ $new_values['form_id'] = isset($values['form_id'])?(int)$values['form_id']:NULL;
23
+ $new_values['field_options'] = serialize($values['field_options']);
24
+ $new_values['created_at'] = current_time('mysql', 1);
25
+
26
+ $query_results = $wpdb->insert( $this->table_name, $new_values );
27
+ if($return){
28
+ if($query_results)
29
+ return $wpdb->insert_id;
30
+ else
31
+ return false;
32
+ }
33
+ }
34
+
35
+ function duplicate($old_form_id,$form_id){
36
+ foreach ($this->getAll("fi.form_id = $old_form_id") as $field){
37
+ $values = array();
38
+ $values['field_key'] = $field->field_key;
39
+ $values['field_options'] = unserialize($field->field_options);
40
+ $values['form_id'] = $form_id;
41
+ foreach (array('name','description','type','default_value','options','field_order','required') as $col)
42
+ $values[$col] = $field->$col;
43
+ $this->create($values, false);
44
+ }
45
+ }
46
+
47
+ function update( $id, $values ){
48
+ global $wpdb;
49
+
50
+ if (isset($values['field_key']))
51
+ $values['field_key'] = FrmAppHelper::get_unique_key($values['field_key'], $this->table_name, 'field_key', $id);
52
+
53
+ if (isset($values['field_options']))
54
+ $values['field_options'] = serialize(stripslashes_deep($values['field_options']));
55
+
56
+ $query_results = $wpdb->update( $this->table_name, $values, array( 'id' => $id ) );
57
+
58
+ return $query_results;
59
+ }
60
+
61
+ function destroy( $id ){
62
+ global $wpdb, $frm_entry_meta;
63
+
64
+ $reset = 'DELETE FROM ' . $frm_entry_meta->table_name . ' WHERE field_id=' . $id;
65
+ $destroy = 'DELETE FROM ' . $this->table_name . ' WHERE id=' . $id;
66
+
67
+ $wpdb->query($reset);
68
+ return $wpdb->query($destroy);
69
+ }
70
+
71
+ function getOneByKey( $key ){
72
+ global $wpdb, $frm_entry_meta;
73
+ $query = "SELECT * FROM {$this->table_name} WHERE field_key='{$key}'";
74
+ return $wpdb->get_row($query);
75
+ }
76
+
77
+ function getOne( $id ){
78
+ global $wpdb;
79
+ $query = "SELECT * FROM {$this->table_name} WHERE id=" . $id;
80
+ return $wpdb->get_row($query);
81
+ }
82
+
83
+ function getAll($where = '', $order_by = '', $limit = ''){
84
+ global $wpdb, $frm_form, $frm_utils;
85
+ $query = 'SELECT fi.*, ' .
86
+ 'gr.name as form_name ' .
87
+ 'FROM '. $this->table_name . ' fi ' .
88
+ 'LEFT OUTER JOIN ' . $frm_form->table_name . ' gr ON fi.form_id=gr.id' .
89
+ $frm_utils->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
90
+ if ($limit == ' LIMIT 1')
91
+ $results = $wpdb->get_row($query);
92
+ else
93
+ $results = $wpdb->get_results($query);
94
+ return $results;
95
+ }
96
+
97
+ // Pagination Methods
98
+ function getRecordCount($where=""){
99
+ global $wpdb, $frm_utils;
100
+ $query = 'SELECT COUNT(*) FROM ' . $this->table_name . ' fi' . $frm_utils->prepend_and_or_where(' WHERE ', $where);
101
+ return $wpdb->get_var($query);
102
+ }
103
+
104
+ function getPageCount($p_size, $where=""){
105
+ return ceil((int)$this->getRecordCount($where) / (int)$p_size);
106
+ }
107
+
108
+ function getPage($current_p,$p_size, $where = "", $order_by = ''){
109
+ global $wpdb, $frm_utils, $frm_form;
110
+ $end_index = $current_p * $p_size;
111
+ $start_index = $end_index - $p_size;
112
+ $query = 'SELECT fi.*, ' .
113
+ 'gr.name as form_name ' .
114
+ 'FROM ' . $this->table_name . ' fi ' .
115
+ 'LEFT OUTER JOIN ' . $frm_form->table_name . ' gr ON fi.form_id=gr.id' .
116
+ $frm_utils->prepend_and_or_where(' WHERE', $where) . $order_by . ' ' .
117
+ 'LIMIT ' . $start_index . ',' . $p_size . ';';
118
+ $results = $wpdb->get_results($query);
119
+ return $results;
120
+ }
121
+
122
+ function validate( $values ){
123
+ global $wpdb, $frm_utils, $frm_blogurl;
124
+
125
+ $errors = array();
126
+
127
+ if( $values['field_key'] == null or $values['field_key'] == '' ){
128
+ if( $values['name'] == null or $values['name'] == '' )
129
+ $errors[] = "Key can't be blank";
130
+ else
131
+ $_POST['field_key'] = $values['name'];
132
+ }
133
+
134
+ if( $values['name'] == null or $values['name'] == '' )
135
+ $errors[] = "Label can't be blank";
136
+
137
+ if( $values['type'] == null or $values['type'] == '' ){
138
+ $errors[] = "Type can't be blank";
139
+ }else{
140
+ if(($values['type'] == 'select' or $values['type'] == 'radio') and ($values['options'] == null or $values['options'] == ''))
141
+ $errors[] = "Options cannot be blank for that field type";
142
+ }
143
+
144
+ return $errors;
145
+ }
146
+ }
147
+ ?>
classes/models/FrmForm.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class FrmForm{
3
+ var $table_name;
4
+
5
+ function FrmForm(){
6
+ global $wpdb;
7
+ $this->table_name = "{$wpdb->prefix}frm_forms";
8
+ }
9
+
10
+ function create( $values ){
11
+ global $wpdb;
12
+
13
+ $new_values = array();
14
+ $new_values['form_key'] = FrmAppHelper::get_unique_key($values['form_key'], $this->table_name, 'form_key');
15
+ $new_values['name'] = $values['name'];
16
+ $new_values['description'] = $values['description'];
17
+ $new_values['status'] = isset($values['status'])?$values['status']:'draft';
18
+ $new_values['is_template'] = isset($values['is_template'])?(int)$values['is_template']:0;
19
+ $new_values['default_template'] = isset($values['default_template'])?(int)$values['default_template']:0;
20
+ $new_values['prli_link_id'] = isset($link_id)?(int)$link_id:0;
21
+ $new_values['created_at'] = current_time('mysql', 1);
22
+
23
+ $query_results = $wpdb->insert( $this->table_name, $new_values );
24
+
25
+ return $wpdb->insert_id;
26
+ }
27
+
28
+ function duplicate( $id, $template=false ){
29
+ global $wpdb, $frm_utils, $frm_form, $frm_field;
30
+
31
+ $values = $frm_form->getOne( $id );
32
+
33
+ $new_values = array();
34
+ $new_values['form_key'] = FrmAppHelper::get_unique_key('', $this->table_name, 'form_key');
35
+ $new_values['name'] = $values->name;
36
+ $new_values['description'] = $values->description;
37
+ $new_values['status'] = (!$template)?'draft':'';
38
+ $new_values['options'] = $values->options;
39
+ $new_values['logged_in'] = $values->logged_in ? $values->logged_in : 0;
40
+ $new_values['editable'] = $values->editable ? $values->editable : 0;
41
+ $new_values['created_at'] = current_time('mysql', 1);
42
+ $new_values['is_template'] = ($template) ? 1 : 0;
43
+
44
+ $query_results = $wpdb->insert( $this->table_name, $new_values );
45
+
46
+ if($query_results){
47
+ $form_id = $wpdb->insert_id;
48
+ $frm_field->duplicate($id, $form_id);
49
+
50
+ return $form_id;
51
+ }else
52
+ return false;
53
+ }
54
+
55
+ function update( $id, $values, $create_link = false ){
56
+ global $wpdb, $frm_field;
57
+
58
+ if ($create_link)
59
+ $values['status'] = 'published';
60
+
61
+ if (isset($values['form_key']))
62
+ $values['form_key'] = FrmAppHelper::get_unique_key($values['form_key'], $this->table_name, 'form_key', $id);
63
+
64
+ $form_fields = array('form_key','name','description','status','prli_link_id');
65
+
66
+ $options = array();
67
+ $options['email_to'] = isset($values['options']['email_to']) ? $values['options']['email_to'] : '';
68
+ $options = apply_filters('frm_form_options_before_update', $options, $values);
69
+
70
+ $new_values = array();
71
+ foreach ($values as $value_key => $value){
72
+ if (in_array($value_key, $form_fields))
73
+ $new_values[$value_key] = $value;
74
+ }
75
+ $new_values['options'] = serialize($options);
76
+
77
+ $query_results = $wpdb->update( $this->table_name, $new_values, array( 'id' => $id ) );
78
+
79
+ if (isset($values['item_meta'])){
80
+ foreach ($values['item_meta'] as $field_id => $default_value){
81
+ $field_options = array();
82
+ foreach (array('size','max','label','invalid','required_indicator','blank') as $opt)
83
+ $field_options[$opt] = isset($values['field_options'][$opt.'_'.$field_id]) ? $values['field_options'][$opt.'_'.$field_id] : '';
84
+ $field_values = apply_filters('frm_update_field_options', array('default_value' => '', 'field_options' => $field_options), $field_id, $values);
85
+ $frm_field->update($field_id, $field_values);
86
+ }
87
+ }
88
+
89
+ if (isset($values['form_key']) && class_exists('PrliLink')){
90
+ $form = $this->getOne($id);
91
+ global $prli_link;
92
+ $prlink = $prli_link->getOne($form->prli_link_id);
93
+ if ($prlink){
94
+ $prli = array();
95
+ $prli['url'] = FrmFormsHelper::get_direct_link($values['form_key']);
96
+ $prli['slug'] = $prlink->slug;
97
+ $prli['name'] = $prlink->name;
98
+ $prli['param_forwarding'] = $prlink->param_forwarding;
99
+ $prli['param_struct'] = $prlink->param_struct;
100
+ $prli['redirect_type'] = $prlink->redirect_type;
101
+ $prli['description'] = $prlink->description;
102
+ $prli['track_me'] = $prlink->track_me;
103
+ $prli['nofollow'] = $prlink->nofollow;
104
+ $prli['group_id'] = $prlink->group_id;
105
+ $prli_link->update($form->prli_link_id, $prli); //update target url
106
+ }else if($create_link && $form->is_template != 1){
107
+ $link_id = prli_create_pretty_link(FrmFormsHelper::get_direct_link($values['form_key']), $values['form_key'], $form->name, $form->description, $group_id = '' );
108
+ $wpdb->update( $this->table_name, array('prli_link_id' => $link_id), array( 'id' => $id ) );
109
+ }
110
+ do_action('frm_update_form', $id, $values);
111
+ }
112
+
113
+ return $query_results;
114
+ }
115
+
116
+ function destroy( $id ){
117
+ global $wpdb, $frm_entry, $frm_field, $wp_rewrite;
118
+
119
+ $form = $this->getOne($id);
120
+ if (!$form or $form->default_template)
121
+ return false;
122
+
123
+ // Disconnect the items from this form
124
+ foreach ($frm_entry->getAll('it.form_id='.$id) as $item)
125
+ $frm_entry->destroy($item->id);
126
+
127
+ // Disconnect the fields from this form
128
+ $query = 'DELETE FROM ' . $frm_field->table_name . ' WHERE form_id='.$id;
129
+ $query_results = $wpdb->query($query);
130
+
131
+ $destroy = 'DELETE FROM ' . $this->table_name . ' WHERE id=' . $id;
132
+ return $wpdb->query($destroy);
133
+ }
134
+
135
+ function getName( $id ){
136
+ global $wpdb;
137
+ $query = 'SELECT name FROM ' . $this->table_name . ' WHERE id=' . $id . ';';
138
+ return $wpdb->get_var($query);
139
+ }
140
+
141
+ function getOneByKey( $key ){
142
+ global $wpdb;
143
+ $query = 'SELECT * FROM ' . $this->table_name . ' WHERE form_key="' . $key . '";';
144
+ return $wpdb->get_row($query);
145
+ }
146
+
147
+ function getIdByName( $name ){
148
+ global $wpdb;
149
+ $query = 'SELECT id FROM ' . $this->table_name . ' WHERE name="' . $name . '";';
150
+ return $wpdb->get_var($query);
151
+ }
152
+
153
+ function getOne( $id ){
154
+ global $wpdb;
155
+ if (is_numeric($id))
156
+ $query = 'SELECT * FROM ' . $this->table_name . ' WHERE id=' . $id . ';';
157
+ else
158
+ $query = 'SELECT * FROM ' . $this->table_name . ' WHERE form_key="' . $id . '";';
159
+ return $wpdb->get_row($query);
160
+ }
161
+
162
+ function getAll( $where = '', $order_by = '', $limit = '' ){
163
+ global $wpdb, $frm_utils;
164
+ $query = 'SELECT * FROM ' . $this->table_name . $frm_utils->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
165
+ if ($limit == ' LIMIT 1')
166
+ $results = $wpdb->get_row($query);
167
+ else
168
+ $results = $wpdb->get_results($query);
169
+ return $results;
170
+ }
171
+
172
+ // Pagination Methods
173
+ function getRecordCount($where=""){
174
+ global $wpdb, $frm_utils;
175
+ $query = 'SELECT COUNT(*) FROM ' . $this->table_name . $frm_utils->prepend_and_or_where(' WHERE ', $where);
176
+ return $wpdb->get_var($query);
177
+ }
178
+
179
+ function getPageCount($p_size, $where=""){
180
+ return ceil((int)$this->getRecordCount($where) / (int)$p_size);
181
+ }
182
+
183
+ function getPage($current_p,$p_size, $where = "", $order_by = ''){
184
+ global $wpdb, $frm_utils;
185
+ $end_index = $current_p * $p_size;
186
+ $start_index = $end_index - $p_size;
187
+ $query = 'SELECT * FROM ' . $this->table_name . $frm_utils->prepend_and_or_where(' WHERE', $where) . $order_by .' LIMIT ' . $start_index . ',' . $p_size;
188
+ $results = $wpdb->get_results($query);
189
+ return $results;
190
+ }
191
+
192
+ function validate( $values ){
193
+ global $frm_utils, $frm_field, $frm_entry_meta;
194
+ $errors = array();
195
+
196
+ /*if( $values['form_key'] == null or $values['form_key'] == '' ){
197
+ if( $values['name'] == null or $values['name'] == '' )
198
+ $errors[] = "Key can't be blank";
199
+ else
200
+ $_POST['form_key'] = $values['name'];
201
+ }
202
+
203
+ if( $values['name'] == null or $values['name'] == '' )
204
+ $errors[] = "Form must have a name.";
205
+
206
+ */
207
+
208
+ return apply_filters('frm_validate_form', $errors, $values);
209
+ }
210
+ }
211
+ ?>
classes/models/FrmNotification.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class FrmNotification{
3
+ function FrmNotification(){
4
+ add_action('frm_after_create_entry', array($this, 'entry_created'));
5
+ }
6
+
7
+ function entry_created($entry){
8
+ global $frm_blogname, $frm_blogurl, $frm_form, $frm_entry_meta;
9
+
10
+ $form = $frm_form->getOne($entry->form_id);
11
+ $values = $frm_entry_meta->getAll("it.item_id = $entry->id", " ORDER BY fi.field_order");
12
+
13
+ $form_options = unserialize($form->options);
14
+ $to_email = $form_options['email_to'];
15
+ if ($to_email == '')
16
+ return;
17
+
18
+ $opener = sprintf(__('%1$s form has been submitted on %2$s.', FRM_PLUGIN_NAME), $form->name, $frm_blogname);
19
+
20
+ $entry_data = '';
21
+ foreach ($values as $value){
22
+ $val = maybe_unserialize($value->meta_value);
23
+ if (is_array($val))
24
+ $val = implode(', ', $val);
25
+ $entry_data .= $value->field_name . ': ' . $val . "\n";
26
+ }
27
+
28
+ $data = unserialize($entry->description);
29
+ $user_data = "User Information\n";
30
+ $user_data .= "IP Address: ". $data['ip'] ."\n";
31
+ $user_data .= "User-Agent (Browser/OS): ". $data['browser']."\n";
32
+ $user_data .= "Referrer: ". $data['referrer']."\n";
33
+
34
+ $mail_body =<<<MAIL_BODY
35
+ {$opener}
36
+
37
+ {$entry_data}
38
+
39
+ {$user_data}
40
+ MAIL_BODY;
41
+ $subject = sprintf(__('%1$s Form submitted on %2$s', FRM_PLUGIN_NAME), $form->name, $frm_blogname); //subject
42
+
43
+ $this->send_notification_email($to_email, $subject, $mail_body, 'friend_request');
44
+ }
45
+
46
+ function send_notification_email($to_email, $subject, $message, $message_type){
47
+ global $frm_blogname;
48
+
49
+ if(isset($user->hide_notifications[$message_type]))
50
+ return;
51
+
52
+ $from_name = $frm_blogname; //senders name
53
+ $from_email = get_option('admin_email'); //senders e-mail address
54
+ $recipient = "<{$to_email}>"; //recipient
55
+ $header = "From: {$from_name} <{$from_email}>\r\n"; //optional headerfields
56
+ $subject = html_entity_decode(strip_tags(stripslashes($subject)));
57
+ $message = html_entity_decode(strip_tags(stripslashes($message)));
58
+ $signature = $this->get_mail_signature();
59
+
60
+ //$to_email = $user->email;
61
+ //$to_name = $user->full_name;
62
+ //$full_to_email = "{$to_name} <{$to_email}>";
63
+
64
+ wp_mail($to_email, $subject, $message.$signature, $header);
65
+
66
+ do_action('frm_notification', $to_email, $subject, $message.$signature);
67
+ }
68
+
69
+ function get_mail_signature(){
70
+ global $frm_blogname;
71
+
72
+ $thanks = __('Thanks!', FRM_PLUGIN_NAME);
73
+ $team = sprintf(__('%s Team', FRM_PLUGIN_NAME), $frm_blogname);
74
+ //$manage_subscription = sprintf(__('If you want to stop future emails like this from coming to you, please modify your form settings.', FRM_PLUGIN_NAME));
75
+
76
+ $signature =<<<MAIL_SIGNATURE
77
+
78
+
79
+ {$thanks}
80
+
81
+ {$team}
82
+
83
+ MAIL_SIGNATURE;
84
+
85
+ return $signature;
86
+ }
87
+ }
88
+ ?>
classes/models/FrmSettings.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class FrmSettings{
3
+ // Page Setup Variables
4
+ var $preview_page_id;
5
+ var $preview_page_id_str;
6
+
7
+ // Is the setup sufficiently completed?
8
+ var $setup_complete;
9
+
10
+ function FrmSettings(){
11
+ $this->set_default_options();
12
+ }
13
+
14
+ function set_default_options(){
15
+ if(!isset($this->preview_page_id))
16
+ $this->preview_page_id = 0;
17
+
18
+ $this->preview_page_id_str = 'frm-preview-page-id';
19
+
20
+ if( $this->preview_page_id == 0 )
21
+ $this->setup_complete = 0;
22
+ else
23
+ $this->setup_complete = 1;
24
+ }
25
+
26
+ function validate($params,$errors){
27
+ if($params[ $this->preview_page_id_str ] == 0)
28
+ $errors[] = "The Preview Page Must Not Be Blank.";
29
+
30
+ return $errors;
31
+ }
32
+
33
+ function update($params){
34
+ $this->preview_page_id = (int)$params[ $this->preview_page_id_str ];
35
+ }
36
+
37
+ function store(){
38
+ // Save the posted value in the database
39
+ update_option( 'frm_options', $this);
40
+ }
41
+
42
+ }
43
+ ?>
classes/models/FrmUtils.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmUtils{
4
+
5
+ function prepend_and_or_where( $starts_with = ' WHERE', $where = '' ){
6
+ return (( $where == '' )?'':$starts_with . $where);
7
+ }
8
+
9
+ // For Pagination
10
+ function getLastRecordNum($r_count,$current_p,$p_size){
11
+ return (($r_count < ($current_p * $p_size))?$r_count:($current_p * $p_size));
12
+ }
13
+
14
+ // For Pagination
15
+ function getFirstRecordNum($r_count,$current_p,$p_size){
16
+ if($current_p == 1)
17
+ return 1;
18
+ else
19
+ return ($this->getLastRecordNum($r_count,($current_p - 1),$p_size) + 1);
20
+ }
21
+
22
+
23
+ // Determines whether or not Formidable Pro is installed and activated
24
+ function pro_is_installed(){
25
+ $activated = get_option('frmpro_activated');
26
+
27
+ if(!$activated){
28
+ $username = get_option( 'frmpro_username' );
29
+ $password = get_option( 'frmpro_password' );
30
+
31
+ if($username and $password){
32
+ $user_type = $this->get_pro_user_type($username, $password);
33
+
34
+ if(!empty($user_type)){
35
+ // Tells us that Pro has been activated
36
+ update_option('frmpro_activated', 1);
37
+
38
+ $activated = true;
39
+ }
40
+ }
41
+ }
42
+
43
+ return ( $activated and $this->pro_files_installed() );
44
+ }
45
+
46
+ function pro_is_available(){return true;}
47
+
48
+ function pro_files_installed(){
49
+ return file_exists(FRM_PATH . "/pro/formidable-pro.php");
50
+ }
51
+
52
+ function get_pro_version(){
53
+ global $frmpro_is_installed;
54
+ if($frmpro_is_installed){
55
+ require_once(FRM_PATH . "/pro/frmpro-config.php");
56
+ global $frmpro_version;
57
+
58
+ return $frmpro_version;
59
+ }else
60
+ return 0;
61
+ }
62
+
63
+ }
64
+ ?>
classes/views/frm-entries/direct.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
3
+ <head>
4
+ <link type="text/css" href="<?php echo FRM_URL; ?>/css/frm_display.css" rel="Stylesheet" />
5
+ </head>
6
+ <body>
7
+ <?php require_once('frm-entry.php'); ?>
8
+ </body>
9
+ </html>
classes/views/frm-entries/form.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="poststuff">
2
+ <?php if ($title == true || $title == 'true'){ ?>
3
+ <h3><?php echo $form->name ?></h3>
4
+ <? } ?>
5
+
6
+ <?php if ($description == true || $description == 'true'){ ?>
7
+ <p class="frm_description"><?php echo $form->description ?></p>
8
+ <? } ?>
9
+
10
+ <input type="hidden" name="form_id" value="<?php echo $form->id ?>">
11
+ <div id="frm_form_fields">
12
+ <?php
13
+ global $frm_in_section;
14
+ $frm_in_section = false;
15
+
16
+ if (is_array($errors))
17
+ $error_keys = array_keys($errors);
18
+ foreach($values['fields'] as $field){
19
+ $field_name = "item_meta[". $field['id'] ."]";
20
+ if (apply_filters('frm_show_normal_field_type', true, $field))
21
+ require(FRM_VIEWS_PATH.'/frm-fields/show.php');
22
+ else
23
+ do_action('frm_show_other_field_type', $field);
24
+ }
25
+ global $frm_in_section;
26
+ if($frm_in_section)
27
+ echo "</div>\n";
28
+ ?>
29
+ </div>
30
+ </div>
31
+ <?php do_action('frm_entries_footer_scripts',$values['fields']); ?>
classes/views/frm-entries/frm-entry.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ global $frm_form, $frm_field, $frm_entry, $frm_entry_meta, $frm_recaptcha_enabled, $user_ID;
3
+ $fields = $frm_field->getAll("fi.form_id='$form->id'", ' ORDER BY field_order');
4
+ $values = FrmEntriesHelper::setup_new_vars($fields);
5
+ $form_name = $form->name;
6
+
7
+ $failed_message = "We're sorry. There was an error processing your responses.";
8
+ $saved_message = "Your responses were successfully submitted. Thank you!";
9
+
10
+ $params = FrmEntriesController::get_params($form);
11
+ $message = '';
12
+ $errors = '';
13
+
14
+ if($params['action'] == 'create'){
15
+ $errors = $frm_entry->validate($_POST);
16
+
17
+ if( count($errors) > 0 ){
18
+ $values = FrmEntriesHelper::setup_new_vars($fields);
19
+ require_once('new.php');
20
+ }else{
21
+ do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
22
+ if (apply_filters('frm_continue_to_create', true)){
23
+ if ($frm_entry->create( $_POST ))
24
+ echo $saved_message;
25
+ else
26
+ echo $failed_message;
27
+ }
28
+ }
29
+ }else{
30
+ do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
31
+ if (apply_filters('frm_continue_to_new', true)){
32
+ $values = FrmEntriesHelper::setup_new_vars($fields);
33
+ require_once('new.php');
34
+ }
35
+ }
36
+
37
+ ?>
classes/views/frm-entries/list.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div class="frmicon"><br></div>
3
+ <h2><?php echo FRM_PLUGIN_TITLE ?>: Pro Entries</h2>
4
+
5
+ <?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
6
+
7
+ <?php require(FRM_VIEWS_PATH.'/shared/nav.php'); ?>
8
+
9
+ Please upgrade to Formidable Pro to see your saved entries
10
+
11
+ </div>
classes/views/frm-entries/new.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="frm_forms">
2
+ <?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
3
+
4
+ <form name="form1" method="post" action="">
5
+ <input type="hidden" name="action" value="create">
6
+ <?php wp_nonce_field('update-options'); ?>
7
+
8
+ <?php require(FRM_VIEWS_PATH.'/frm-entries/form.php'); ?>
9
+
10
+ <?php if (!$form->is_template){ ?>
11
+ <p class="submit">
12
+ <input type="submit" name="Submit" value="Submit" />
13
+ </p>
14
+ <?php } ?>
15
+
16
+ </form>
17
+ </div>
classes/views/frm-fields/radio.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (is_array($field['options'])){
3
+ foreach($field['options'] as $opt_key => $opt){
4
+ $checked = ((!is_array($field['value']) && $field['value'] == $opt ) || (is_array($field['value']) && in_array($opt, $field['value'])))?' checked="true"':'';
5
+ require('single-option.php');
6
+ }
7
+ }
8
+ ?>
classes/views/frm-fields/show.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="form-field<?php echo ($field['required'] == '0')?(''):(' form-required'); if (isset($error_keys) && is_array($error_keys)) echo in_array('field'.$field['id'], $error_keys)? ' frm_blank_field':''; ?>">
2
+ <label class="frm_pos_<?php echo $field['label'] ?>"><?php echo $field['name'] ?>
3
+ <span class="frm_required"><?php echo ($field['required'] == '0')?(''):($field['required_indicator']); ?></span>
4
+ </label>
5
+
6
+ <?php if ($field['type'] == 'text'){ ?>
7
+ <input type="text" id="<?php echo $field['field_key'] ?>" name="<?php echo $field_name ?>" value="<?php echo $field['value'] ?>" size="<?php echo $field['size'] ?>" maxlength="<?php echo $field['max'] ?>" />
8
+
9
+ <?php }else if ($field['type'] == 'textarea'){ ?>
10
+ <textarea name="<?php echo $field_name ?>" cols="<?php echo $field['size'] ?>" rows="<?php echo $field['max'] ?>"><?php echo $field['value'] ?></textarea>
11
+
12
+ <?php }else if ($field['type'] == 'radio'){
13
+ if (is_array($field['options'])){
14
+ foreach($field['options'] as $opt){
15
+ $checked = ($field['value'] == $opt ) ?' checked="true"':''; ?>
16
+ <input type='radio' name='<?php echo $field_name ?>' value='<?php echo $opt ?>'<?php echo $checked ?>/>
17
+ <?php echo $opt ?><br/>
18
+ <?php }
19
+ } ?>
20
+ <?php
21
+ }else if ($field['type'] == 'select'){?>
22
+ <select name='<?php echo $field_name ?>'>
23
+ <?php foreach ($field['options'] as $opt){ ?>
24
+ <option value='<?php echo $opt ?>'<?php echo ($field['value'] == $opt)?(' selected="true"'):(''); ?>><?php echo $opt ?></option>
25
+ <?php } ?>
26
+ </select>
27
+ <?php
28
+ }else if ($field['type'] == 'captcha'){
29
+ if ($frm_recaptcha_enabled)
30
+ FrmAppHelper::display_recaptcha($errors);
31
+ }else if ($field['type'] == 'checkbox'){
32
+ $checked_values = stripslashes_deep(maybe_unserialize($field['value']));
33
+ foreach ($field['options'] as $opt){
34
+ $checked = ((!is_array($checked_values) && $checked_values == $opt ) || (is_array($checked_values) && in_array($opt, $checked_values)))?' checked="true"':'';
35
+ echo "<input type='checkbox' name='". $field_name ."[]' value='".$opt."'". $checked ."'/> ".$opt."<br/>";
36
+ }
37
+ }else do_action('frm_form_fields',$field, $field_name);
38
+ ?>
39
+ <p class="description"><?php echo $field['description']; ?></p>
40
+ </div>
classes/views/frm-fields/single-option.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <span id="frm_delete_field_<?php echo $field['id']; ?>-<?php echo $opt_key ?>_container" class="frm_single_option">
2
+ <? if ($field['type'] != 'select'){ ?>
3
+ <input type='<?php echo $field['type'] ?>' name='<?php echo $field_name ?><?php echo ($field['type'] == 'checkbox')?'[]':''; ?>' value='<?php echo $opt ?>'<?php echo isset($checked)? $checked : ''; ?>/>
4
+ <?php } ?>
5
+ <span class="frm_ipe_field_option" id="field_<?php echo $field['id']?>-<?php echo $opt_key ?>"><?php echo $opt ?></span>
6
+ <span class="frm_spacer"></span>
7
+ <a href="javascript:void(0);" class="ui-icon ui-icon-trash alignleft frm_delete_field_option" id="frm_delete_field_<?php echo $field['id']; ?>-<?php echo $opt_key ?>"></a>
8
+ </span>
9
+ <div class="clear"></div>
classes/views/frm-forms/add_field.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $display = apply_filters('frm_display_field_options', array('type' => $field['type'], 'required' => true, 'description' => true, 'options' => true, 'label_position' => true, 'invalid' => false, 'size' => false)); ?>
2
+ <li id="frm_field_id_<?php echo $field['id']; ?>" class="edit_form_item frm_field_box ui-state-default frm_hide_options<?php echo $display['options'] ?>">
3
+ <span class="ui-icon ui-icon-arrowthick-2-n-s alignright"></span>
4
+ <a href="javascript:void(0);" class="ui-icon ui-icon-trash alignright" id="frm_delete_field<?php echo $field['id']; ?>"></a>
5
+ <?php if ($display['required']){ ?>
6
+ <span id="require_field_<?php echo $field['id']; ?>">
7
+ <a href="javascript:void(0);" class="ui-icon ui-icon-star alignleft" id="req_field_<?php echo $field['id']; ?>"></a>
8
+ </span>
9
+ <?php } ?>
10
+ <div class="frm_ipe_field_label frm_pos_<?php echo $field['label']; ?>" id="field_<?php echo $field['id']; ?>"><?php echo $field['name'] ?></div>
11
+
12
+ <?php if ($display['type'] == 'text'){ ?>
13
+ <input type="text" name="<?php echo $field_name ?>" value="<?php echo $field['default_value']; ?>" size="<?php echo $field['size']; ?>"/>
14
+
15
+ <?php }else if ($field['type'] == 'textarea'){ ?>
16
+ <textarea name="<?php echo $field_name ?>" cols="<?php echo $field['size']; ?>" rows="<?php echo $field['max']; ?>"><?php echo $field['default_value']; ?></textarea>
17
+
18
+ <?php }else if ($field['type'] == 'radio' || $field['type'] == 'checkbox'){
19
+ $field['value'] = maybe_unserialize($field['default_value']);
20
+ require(FRM_VIEWS_PATH.'/frm-fields/radio.php'); ?>
21
+ <div id="frm_add_field_<?php echo $field['id']; ?>">
22
+ <a href="javascipt:void(0)" class="frm_add_field_option" id="field_<?php echo $field['id']; ?>"><span class="ui-icon ui-icon-plusthick alignleft"></span> Add an Option</a>
23
+ </div>
24
+
25
+ <?php }else if ($field['type'] == 'select'){ ?>
26
+ <select name='<?php echo $field_name ?>' id='<?php echo $field_name ?>'>
27
+ <?php foreach ($field['options'] as $opt){
28
+ $selected = ($field['default_value'] == $opt)?(' selected="selected"'):(''); ?>
29
+ <option value="<?php echo $opt ?>"<?php echo $selected ?>><?php echo $opt ?></option>
30
+ <?php } ?>
31
+ </select><br/>
32
+ <?php foreach ($field['options'] as $opt_key => $opt)
33
+ require(FRM_VIEWS_PATH.'/frm-fields/single-option.php');
34
+ ?>
35
+ <div id="frm_add_field_<?php echo $field['id']; ?>">
36
+ <a href="javascipt:void(0)" class="frm_add_field_option" id="field_<?php echo $field['id']; ?>"><span class="ui-icon ui-icon-plusthick alignleft"></span> Add an Option</a>
37
+ </div>
38
+
39
+ <?php }else if ($field['type'] == 'captcha'){
40
+ if ($frm_recaptcha_enabled){
41
+ global $recaptcha_opt, $frm_siteurl; ?>
42
+ <img src="<?php echo FRM_URL ?>/images/<?php echo $recaptcha_opt['re_theme'];?>-captcha.png">
43
+ <span class="howto">Hint: Change colors in the "Registration Options" <a href="<?php echo $frm_siteurl ?>/wp-admin/options-general.php?page=wp-recaptcha/wp-recaptcha.php">reCAPTCHA settings</a></span>
44
+ <input type="hidden" name="<?php echo $field_name ?>" value="1"/>
45
+ <?php }else
46
+ echo 'Please download, install, and activate the WP reCAPTCHA plugin to enable this feature.';
47
+
48
+ }else
49
+ do_action('frm_display_added_fields',$field);
50
+
51
+ if ($display['description']){ ?>
52
+ <div class="frm_ipe_field_desc description" id="field_<?php echo $field['id']; ?>"><?php echo $field['description']; ?></div>
53
+ <?php
54
+ }
55
+
56
+ if ($display['options']){ ?>
57
+ <div class="postbox">
58
+ <h3 class="trigger">Field Options</h3>
59
+ <div class="toggle_container inside">
60
+ <? if ($field['type'] == 'text' || $field['type'] == 'textarea' || $display['size']){ ?>
61
+ <p><label><?php echo ($field['type'] == 'textarea' || $field['type'] == 'rte')?'Columns':'Field Size' ?></label>
62
+ <input type="text" name="field_options[size_<?php echo $field['id'] ?>]" value="<?php echo $field['size']; ?>" size="5">
63
+ </p>
64
+ <p><label><?php echo ($field['type'] == 'textarea' || $field['type'] == 'rte')?'Rows':'Max length of input' ?></label>
65
+ <input type="text" name="field_options[max_<?php echo $field['id'] ?>]" value="<?php echo $field['max']; ?>" size="5">
66
+ </p>
67
+ <? } ?>
68
+ <?php if ($display['label_position']){ ?>
69
+ <p><label>Label Position</label>
70
+ <select name="field_options[label_<?php echo $field['id'] ?>]">
71
+ <option value="top"<?php echo ($field['label'] == 'top')?(' selected="true"'):(''); ?>>Top</option>
72
+ <option value="left"<?php echo ($field['label'] == 'left')?(' selected="true"'):(''); ?>>Left</option>
73
+ <option value="none"<?php echo ($field['label'] == 'none')?(' selected="true"'):(''); ?>>Hidden</option>
74
+ </select>
75
+ </p>
76
+ <?php } ?>
77
+ <?php if ($display['required']){ ?>
78
+ <p><label>Required label</label>
79
+ <input type="text" name="field_options[required_indicator_<?php echo $field['id'] ?>]" value="<?php echo $field['required_indicator']; ?>">
80
+ </p>
81
+ <p><label class="frm_pos_top">Validation phrase for blank required field</label>
82
+ <input type="text" name="field_options[blank_<?php echo $field['id'] ?>]" value="<?php echo $field['blank']; ?>" size="75">
83
+ </p>
84
+ <?php } ?>
85
+ <? if ($display['invalid']){ ?>
86
+ <p><label class="frm_pos_top">Validation phrase for wrong format</label>
87
+ <input type="text" name="field_options[invalid_<?php echo $field['id'] ?>]" value="<?php echo $field['invalid']; ?>" size="75">
88
+ </p>
89
+ <?php } ?>
90
+ <?php do_action('frm_field_options_form', $field, $display); ?>
91
+ </div>
92
+ </div>
93
+ <?php } ?>
94
+ </li>
95
+ <?php $frm_required_class = ($field['required'] == '0')?('frm_mark_required'):('frm_unmark_required'); ?>
96
+ <script type="text/javascript">
97
+ jQuery(document).ready(function() {
98
+ jQuery("#frm_delete_field<?php echo $field['id']; ?>").click(function(){
99
+ jQuery.ajax({
100
+ type:"POST",
101
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
102
+ data:"action=frm_delete_field&field_id=<?php echo $field['id']; ?>",
103
+ success:function(msg){
104
+ jQuery('#new_fields').append(msg);
105
+ jQuery("#frm_field_id_<?php echo $field['id']; ?>").hide('highlight',{},500,callback);
106
+ }
107
+ });
108
+ return false;
109
+ });
110
+
111
+ function callback(){setTimeout(function(){jQuery("#frm_delete_field<?php echo $field['id']; ?>:hidden").removeAttr('style').hide().fadeIn();}, 1000);};
112
+
113
+
114
+ jQuery('#req_field_<?php echo $field['id']; ?>').addClass('<?php echo $frm_required_class ?>');
115
+ });
116
+ </script>
classes/views/frm-forms/add_field_links.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="frm_form_options" class="alignright">
2
+ <?php if (!$values['is_template']){ ?>
3
+ <div>Copy this code and paste it into your post, page or text widget:
4
+ <h4 class="frmcenter">[formidable id=<?php echo $id ?>]</h4>
5
+ </div>
6
+ <?php } ?>
7
+
8
+ <ul class="frmbutton nodrag">
9
+ <li><a href="<?php echo FrmFormsHelper::get_direct_link($values['form_key']); ?>" target="blank" >Preview Form</a></li>
10
+ <?php global $frm_settings; if ($frm_settings->preview_page_id > 0){ ?>
11
+ <li><a href="<?php echo add_query_arg('form', $values['form_key'], get_permalink($frm_settings->preview_page_id)) ?>" target="blank" class="frmbutton">Preview Form in Current Theme</a></li>
12
+ <?php } ?>
13
+ </ul>
14
+
15
+ <h4>Basic Fields</h4>
16
+ <ul class="field_type_list">
17
+ <?php foreach ($frm_field_selection as $field_key => $field_type){ ?>
18
+ <li class="frmbutton" id="<?php echo $field_key ?>"><a href="javascript:void(0);" class="add_frm_field_link" id="<?php echo $field_key ?>"><?php echo $field_type ?></a></li>
19
+ <?php } ?>
20
+ <?php if (!$frm_recaptcha_enabled){
21
+ global $frm_siteurl;
22
+ echo '<p class="howto">Hint: Download and activate <a href="'.$frm_siteurl.'/wp-admin/plugin-install.php?tab=plugin-information&amp;plugin=wp-recaptcha&amp;TB_iframe=true&amp;width=640&amp;height=593" class="thickbox onclick" title="WP-reCAPTCHA 2.9.6">WP-reCAPTCHA</a> to add a captcha to your form.</p>';
23
+ } ?>
24
+ </ul>
25
+
26
+ <h4>Pro Fields</h4>
27
+ <ul class="field_type_list">
28
+ <?php
29
+ if($frmpro_is_installed){
30
+ foreach ($frm_pro_field_selection as $field_key => $field_type){ ?>
31
+ <li class="frmbutton" id="<?php echo $field_key ?>"><a href="javascript:void(0);" class="add_frm_field_link" id="<?php echo $field_key ?>"><?php echo $field_type ?></a></li>
32
+ <?php }
33
+ }else
34
+ foreach ($frm_pro_field_selection as $field_key => $field_type)
35
+ echo '<li class="frmbutton">'.$field_type.'</li>';
36
+ ?>
37
+ </ul>
38
+
39
+ <br/>
40
+ <h3>KEY</h3>
41
+ <ul class="ui-state-default" style="border:none; font-weight:normal">
42
+ <li><span class="ui-icon ui-icon-star alignleft"></span> = required field</li>
43
+ <li><span class="frm_inactive_icon ui-icon ui-icon-star alignleft"></span> = not required</li>
44
+ <li><span class="ui-icon ui-icon-trash alignleft"></span> = delete field and all inputed data</li>
45
+ </ul>
46
+ <p class="howto">Enter or select default values into fields on this form.</p>
47
+ </div>
48
+
49
+ <script>
50
+ jQuery(document).ready(function(){
51
+ jQuery(".add_frm_field_link").click(function(){
52
+ jQuery.ajax({
53
+ type:"POST",
54
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
55
+ data:"action=frm_insert_field&form_id=<?php echo $id; ?>&field="+this.getAttribute('id'),
56
+ success:function(msg){jQuery('#new_fields').append(msg);}
57
+ });
58
+ });
59
+ })
60
+ </script>
classes/views/frm-forms/default-templates.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php FrmFormsHelper::get_template_dropdown($all_templates); ?>
2
+
3
+ <h3>Default Templates</h3>
4
+ <table class="widefat post fixed" cellspacing="0">
5
+ <thead>
6
+ <tr>
7
+ <th class="manage-column" width="30%">Name</th>
8
+ <th class="manage-column">Description</th>
9
+ </tr>
10
+ </thead>
11
+ <?php if(empty($default_templates)){ ?>
12
+ <tr><td colspan="2">No Templates Found</td></tr>
13
+ <?php
14
+ }else{
15
+ foreach($default_templates as $form){
16
+ ?>
17
+ <tr style="min-height: 60px; height: 60px;">
18
+ <td class="edit_item">
19
+ <a class="item_name" href="<?php echo $url = FrmFormsHelper::get_direct_link($form->form_key); ?>" title="Preview <?php echo stripslashes($form->name); ?>" target="blank"><?php echo stripslashes($form->name); ?></a>
20
+ <br/>
21
+ <div class="item_actions">
22
+ <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&action=duplicate&id=<?php echo $form->id; ?>" title="Copy <?php echo $form->name; ?>">Create Form from Template</a> |
23
+ <a href="<?php echo $url ?>" title="View <?php echo stripslashes($form->name); ?>" target="blank">View</a>
24
+ </div>
25
+ </td>
26
+ <td><?php echo $form->description ?></td>
27
+ </tr>
28
+ <?php
29
+ }
30
+ }
31
+ ?>
32
+ <tfoot>
33
+ <tr>
34
+ <th class="manage-column">Name</th>
35
+ <th class="manage-column">Description</th>
36
+ </tr>
37
+ </tfoot>
38
+ </table>
39
+
40
+ <br/><br/><h3>Custom Templates</h3>
classes/views/frm-forms/edit.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div class="frmicon"><br></div>
3
+ <h2><?php echo FRM_PLUGIN_TITLE ?>: Edit Form</h2>
4
+
5
+ <?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
6
+
7
+ <?php require(FRM_VIEWS_PATH.'/shared/nav.php'); ?>
8
+
9
+ <div class="frm_form_builder alignleft" id="poststuff">
10
+ <form name="form1" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
11
+ <input type="hidden" name="action" value="update">
12
+ <input type="hidden" name="id" value="<?php echo $id; ?>">
13
+ <?php wp_nonce_field('update-options'); ?>
14
+
15
+ <?php require(FRM_VIEWS_PATH.'/frm-forms/form.php'); ?>
16
+
17
+ <p class="submit">
18
+ <input type="submit" name="Submit" value="Update" class="button-primary" /> or
19
+ <a href="?page=<?php echo FRM_PLUGIN_NAME ?>">Cancel</a>
20
+ </p>
21
+ </form>
22
+ </div>
23
+
24
+ <?php require('add_field_links.php'); ?>
25
+ </div>
26
+ <?php require('footer.php'); ?>
classes/views/frm-forms/footer.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ jQuery(document).ready(function(){
3
+ jQuery(".frm_ipe_field_option").editInPlace({url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",params:"action=frm_field_option_ipe",show_buttons:true,default_text:'(Blank)'});
4
+
5
+ jQuery(".frm_ipe_field_option_select").editInPlace({url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",params:"action=frm_field_option_ipe",show_buttons:true,default_text:'(Blank)',
6
+ callback: function(original_element, html, original){jQuery("#"+original_element+'_select').html("The updated text is: "+html);return(html);}
7
+ });
8
+
9
+ jQuery(".frm_delete_field_option").click(function(){var thisid=this.getAttribute('id');jQuery.ajax({type:"POST",url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",data:"action=frm_delete_field_option&field="+thisid,success:function(msg){jQuery('#'+thisid+'_container').hide('highlight');}});return false;});
10
+
11
+ jQuery(".frm_ipe_form_name").editInPlace({url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",params:"action=frm_form_name_in_place_edit&form_id=<?php echo $id; ?>",value_required:"true",show_buttons:true});
12
+ jQuery(".frm_ipe_form_desc").editInPlace({url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",params:"action=frm_form_desc_in_place_edit&form_id=<?php echo $id; ?>",field_type:"textarea",show_buttons:true,textarea_rows:3,textarea_cols:60,default_text:"(Click here to add form description or instructions)",});
13
+ jQuery(".frm_ipe_field_label").editInPlace({url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",params:"action=frm_field_name_in_place_edit",value_required:"true",show_buttons:true});
14
+
15
+ jQuery(".frm_ipe_field_desc").editInPlace({url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",params:"action=frm_field_desc_in_place_edit",default_text:"(Click here to add optional description or instructions)",show_buttons:true,field_type:'textarea',textarea_rows:1});
16
+
17
+ jQuery(".frm_mark_required").click(function(){var thisid=this.getAttribute('id');jQuery.ajax({type:"POST",url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",data:"action=frm_mark_required&field="+thisid,success:function(msg){jQuery('#'+thisid).switchClass('frm_mark_required','frm_unmark_required');}});});
18
+
19
+ jQuery(".frm_unmark_required").click(function(){var thisid=this.getAttribute('id');jQuery.ajax({type:"POST",url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",data:"action=frm_unmark_required&field="+thisid,success:function(msg){jQuery('#'+thisid).switchClass('frm_unmark_required','frm_mark_required');}});});
20
+
21
+ jQuery(".frm_add_field_option").click(function(){var thisid=this.getAttribute('id');jQuery.ajax({type:"POST",url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",data:"action=frm_add_field_option&field="+thisid,success:function(msg){jQuery('#frm_add_'+thisid).before(msg);}});return false;});
22
+
23
+ jQuery("#new_fields").sortable({cursor:'move',accepts:'field_type_list',revert:true,
24
+ receive:function(event,ui){
25
+ var new_id = (ui.item).attr('id');
26
+ jQuery.ajax({type:"POST",url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
27
+ data:"action=frm_insert_field&form_id=<?php echo $id; ?>&position="+ui.position+"&field="+new_id,
28
+ success:function(msg){jQuery('#new_fields .frmbutton#'+new_id).replaceWith(msg);}
29
+ });
30
+ },
31
+ update:function(){var order=jQuery('#new_fields').sortable('serialize');jQuery.ajax({type:"POST",url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",data:"action=frm_update_field_order&"+order});}});
32
+ });
33
+ jQuery('.field_type_list > li').draggable({connectToSortable:'#new_fields',cursor:'move',helper:'clone',revert:'invalid',delay:10});
34
+ jQuery("ul.field_type_list, .field_type_list li").disableSelection();
35
+
36
+ window.onunload = function(){jQuery.ajax({type:"POST",url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",data:"action=frm_delete_form_wo_fields&form_id=<?php echo $id; ?>"});return false;};
37
+ </script>
classes/views/frm-forms/form.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ <div id="form_desc" class="edit_form_item frm_field_box frm_head_box">
4
+ <h2 class="frm_ipe_form_name" id="frmform_<?php echo $id; ?>"><?php echo $values['name']; ?></h2>
5
+ <div class="frm_ipe_form_desc"><?php echo wpautop($values['description']); ?></div>
6
+ </div>
7
+
8
+ <ul id="new_fields">
9
+ <?php
10
+ if (isset($values['fields'])){
11
+ foreach($values['fields'] as $field){
12
+ $field_name = "item_meta[". $field['id'] ."]";
13
+ require('add_field.php');
14
+ }
15
+ } ?>
16
+ </ul>
17
+
18
+ <?php if (!$values['is_template']){ ?>
19
+ <div class="postbox">
20
+ <h3 class="trigger">Advanced Form Options</h3>
21
+ <div class="toggle_container inside">
22
+ <p><label>Form ShortCodes:</label>
23
+ [formidable id=<?php echo $id; ?> title=true description=true] [formidable key=<?php echo $values['form_key']; ?>]
24
+ </p>
25
+
26
+ <p><label>Form Key</label>
27
+ <input type="text" name="form_key" value="<?php echo $values['form_key']; ?>" />
28
+ </p>
29
+
30
+ <p><label>Email Form Responses to</label>
31
+ <input type="text" name="options[email_to]" value="<?php echo $values['email_to']; ?>" />
32
+ </p>
33
+ <?php do_action('frm_additional_form_options', $values); ?>
34
+ </div>
35
+ </div>
36
+ <?php } ?>
classes/views/frm-forms/list.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div class="frmicon"><br></div>
3
+ <h2><?php echo FRM_PLUGIN_TITLE ?>: <?php echo ($params['template'])? 'Templates' : 'Forms'; ?></h2>
4
+
5
+ <?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
6
+
7
+ <?php do_action('frm_before_item_nav',$sort_str, $sdir_str, $search_str); ?>
8
+ <?php require(FRM_VIEWS_PATH.'/shared/nav.php'); ?>
9
+
10
+ <?php if ($params['template']) require('default-templates.php'); ?>
11
+
12
+ <form class="form-fields item-list-form" name="item_list_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
13
+ <input type="hidden" name="action" value="list-form"/>
14
+ <input type="hidden" name="template" value="<?php echo $params['template'] ?>" />
15
+ <?php $footer = false; require(FRM_VIEWS_PATH.'/shared/item-table-nav.php'); ?>
16
+ <table class="widefat post fixed" cellspacing="0">
17
+ <thead>
18
+ <tr>
19
+ <?php if ($params['template']){ ?>
20
+ <th class="manage-column" width="30%">
21
+ <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>-templates&sort=name<?php echo (($sort_str == 'name' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">Name<?php echo (($sort_str == 'name')?' &nbsp; <img src="'.FRM_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a></th>
22
+ <th class="manage-column"><a href="?page=<?php echo FRM_PLUGIN_NAME; ?>-templates&sort=description<?php echo (($sort_str == 'description' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">Description<?php echo (($sort_str == 'description')?' &nbsp; <img src="'.FRM_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a></th>
23
+ <?php }else{?>
24
+ <th class="manage-column" width="50px">
25
+ <?php do_action('frm_column_header'); ?> <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&sort=id<?php echo (($sort_str == 'id' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">ID<?php echo (($sort_str == 'id')?' &nbsp; <img src="'.FRM_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a></th>
26
+ <th class="manage-column" width="">
27
+ <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&sort=name<?php echo (($sort_str == 'name' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">Name<?php echo (($sort_str == 'name')?' &nbsp; <img src="'.FRM_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a></th>
28
+ <th class="manage-column"><a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&sort=description<?php echo (($sort_str == 'description' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">Description<?php echo (($sort_str == 'description')?' &nbsp; <img src="'.FRM_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a></th>
29
+ <th class="manage-column" width="70px"><a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&sort=form_key<?php echo (($sort_str == 'form_key' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">Key<?php echo (($sort_str == 'form_key')?' &nbsp; <img src="'.FRM_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a></th>
30
+ <th class="manage-column" width="70px">Entries</th>
31
+ <th class="manage-column">Direct Link</th>
32
+ <?php } ?>
33
+ </tr>
34
+ </thead>
35
+ <?php if($record_count <= 0){ ?>
36
+ <tr>
37
+ <td colspan="<?php echo ($params['template'])? '2':'6'; ?>">No Forms Found</td>
38
+ </tr>
39
+ <?php
40
+ }else{
41
+ foreach($forms as $form){
42
+ ?>
43
+ <tr style="min-height: 75px; height: 75px;">
44
+ <?php if ($params['template']){ ?>
45
+ <td class="edit_item">
46
+ <a class="item_name" href="?page=<?php echo FRM_PLUGIN_NAME; ?>&action=edit&id=<?php echo $form->id; ?>" title="Edit <?php echo stripslashes($form->name); ?>"><?php echo stripslashes($form->name); ?></a>
47
+ <br/>
48
+ <div class="item_actions">
49
+ <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&action=duplicate&id=<?php echo $form->id; ?>" title="Copy <?php echo $form->name; ?>">Create Form from Template</a>
50
+ | <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&action=edit&id=<?php echo $form->id; ?>" title="Edit <?php echo $form->name; ?>">Edit</a>
51
+ | <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&action=destroy&id=<?php echo $form->id; ?>" onclick="return confirm('Are you sure you want to delete your <?php echo $form->name; ?> Form?');" title="Delete <?php echo $form->form_key; ?>">Delete</a>
52
+ </div>
53
+ </td>
54
+ <td><?php echo $form->description ?></td>
55
+ <? }else{ ?>
56
+ <td><?php do_action('frm_first_col', $form->id); ?> <?php echo $form->id ?></td>
57
+ <td class="edit_item">
58
+ <a class="item_name" href="?page=<?php echo FRM_PLUGIN_NAME; ?>&action=edit&id=<?php echo $form->id; ?>" title="Edit <?php echo stripslashes($form->name); ?>"><?php echo stripslashes($form->name); ?></a>
59
+ <br/>
60
+ <div class="item_actions">
61
+ <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&action=edit&id=<?php echo $form->id; ?>" title="Edit <?php echo $form->name; ?>">Edit</a> |
62
+ <?php if($frmpro_is_installed){ ?>
63
+ <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>-entries&action=new&form=<?php echo $form->id; ?>" title="New <?php echo $form->name; ?> Entry">New Entry</a> |
64
+ <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>-entries&form=<?php echo $form->id; ?>" title="<?php echo $form->name; ?> Entries">View Entries</a> |
65
+ <?php } ?>
66
+ <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&action=duplicate&id=<?php echo $form->id; ?>" title="Copy <?php echo $form->name; ?>">Duplicate</a> |
67
+ <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&action=duplicate&id=<?php echo $form->id; ?>&template=1" title="Create <?php echo $form->name; ?> Template">Create Template</a> |
68
+ <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&action=destroy&id=<?php echo $form->id; ?>" onclick="return confirm('Are you sure you want to delete your <?php echo $form->name; ?> Form?');" title="Delete <?php echo $form->form_key; ?>">Delete</a>
69
+ </div>
70
+ </td>
71
+ <td><?php echo $form->description ?></td>
72
+ <td><?php echo $form->form_key ?></td>
73
+ <td><?php echo apply_filters('frm_view_entries_link', $frm_entry->getRecordCount("it.form_id=$form->id") . ' Entries', $form->id); ?></td>
74
+ <td>
75
+ <input type='text' style="font-size: 10px; width: 100%;" readonly="true" onclick='this.select();' onfocus='this.select();' value='<?php echo $target_url = FrmFormsHelper::get_direct_link($form->form_key, $form->prli_link_id); ?>' /><br/><a href="<?php echo $target_url; ?>" target="blank">View Form</td>
76
+ <?php } ?>
77
+ </tr>
78
+ <?php
79
+ }
80
+ }
81
+ ?>
82
+ <tfoot>
83
+ <tr>
84
+ <?php if ($params['template']){ ?>
85
+ <th class="manage-column">Name</th>
86
+ <th class="manage-column">Description</th>
87
+ <?php }else{ ?>
88
+ <th class="manage-column"><?php do_action('frm_column_header'); ?> ID</th>
89
+ <th class="manage-column">Name</th>
90
+ <th class="manage-column">Description</th>
91
+ <th class="manage-column">Key</th>
92
+ <th class="manage-column">Entries</th>
93
+ <th class="manage-column">Direct Link</th>
94
+ <?php } ?>
95
+ </tr>
96
+ </tfoot>
97
+ </table>
98
+ <?php $footer = true; require(FRM_VIEWS_PATH.'/shared/item-table-nav.php'); ?>
99
+ </form>
100
+
101
+ </div>
classes/views/frm-forms/new-field-js.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script>
2
+ jQuery(document).ready(function(){
3
+ jQuery('#frm_field_id_<?php echo $field['id']; ?> .ui-icon-trash').hide();
4
+ jQuery('#frm_field_id_<?php echo $field['id']; ?> .ui-icon-arrowthick-2-n-s').hide();
5
+ jQuery('#frm_field_id_<?php echo $field['id']; ?> .postbox').hide();
6
+ jQuery('#frm_field_id_<?php echo $field['id']; ?>.ui-state-default').hover(
7
+ function(){jQuery(this).children(".ui-icon-trash").show();jQuery(this).children(".ui-icon-arrowthick-2-n-s").show(); jQuery(this).children(".postbox").show();},
8
+ function(){jQuery(this).children(".ui-icon-trash").hide();jQuery(this).children(".ui-icon-arrowthick-2-n-s").hide(); jQuery(this).children(".postbox").hide();}
9
+ );
10
+
11
+
12
+ jQuery('#frm_field_id_<?php echo $field['id']; ?> .toggle_container').hide();
13
+ jQuery('#frm_field_id_<?php echo $field['id']; ?> .trigger').toggle(
14
+ function(){jQuery(this).addClass("active");},
15
+ function(){jQuery(this).removeClass("active");}
16
+ );
17
+ jQuery('#frm_field_id_<?php echo $field['id']; ?> .trigger').click(function(){jQuery(this).next(".toggle_container").slideToggle("slow");});
18
+
19
+ jQuery('#frm_field_id_<?php echo $field['id']; ?> .ui-icon-trash.frm_delete_field_option').hide();
20
+ jQuery('#frm_field_id_<?php echo $field['id']; ?> .frm_single_option').hover(
21
+ function(){jQuery(this).children(".ui-icon-trash.frm_delete_field_option").show(); jQuery(this).children(".frm_spacer").hide();},
22
+ function(){jQuery(this).children(".ui-icon-trash.frm_delete_field_option").hide(); jQuery(this).children(".frm_spacer").show();}
23
+ );
24
+
25
+ jQuery("#frm_field_id_<?php echo $field['id']; ?> .frm_ipe_field_option").editInPlace({
26
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
27
+ params:"action=frm_field_option_ipe",
28
+ show_buttons:true,
29
+ default_text:'(Blank)'
30
+ });
31
+
32
+ jQuery("#frm_field_id_<?php echo $field['id']; ?> .frm_ipe_field_option_select").editInPlace({
33
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
34
+ params:"action=frm_field_option_ipe",
35
+ show_buttons:true,
36
+ default_text:'(Blank)',
37
+ callback: function(original_element, html, original){
38
+ jQuery("#"+original_element+'_select').html("The updated text is: " + html);
39
+ return(html);
40
+ }
41
+ });
42
+
43
+ jQuery("#frm_field_id_<?php echo $field['id']; ?> .frm_delete_field_option").click( function(){
44
+ var thisid=this.getAttribute('id');
45
+ jQuery.ajax({
46
+ type:"POST",
47
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
48
+ data:"action=frm_delete_field_option&field="+thisid,
49
+ success:function(msg){
50
+ jQuery('#'+thisid+'_container').hide('highlight');
51
+ }
52
+ });
53
+ return false;
54
+ });
55
+
56
+ jQuery("#frm_field_id_<?php echo $field['id']; ?> .frm_ipe_field_label").editInPlace({
57
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
58
+ params:"action=frm_field_name_in_place_edit",
59
+ value_required:"true",
60
+ show_buttons:true
61
+ });
62
+
63
+ jQuery("#frm_field_id_<?php echo $field['id']; ?> .frm_ipe_field_desc").editInPlace({
64
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
65
+ params:"action=frm_field_desc_in_place_edit",
66
+ default_text:"(Click here to add optional field description or instructions)",
67
+ show_buttons:true,
68
+ field_type:'textarea',
69
+ textarea_rows:1
70
+ });
71
+
72
+ jQuery("#frm_field_id_<?php echo $field['id']; ?> .frm_mark_required").click( function(){
73
+ var thisid=this.getAttribute('id');
74
+ jQuery.ajax({
75
+ type:"POST",
76
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
77
+ data:"action=frm_mark_required&field="+thisid,
78
+ success:function(msg){
79
+ jQuery('#'+thisid).switchClass('frm_mark_required','frm_unmark_required');
80
+ }
81
+ });
82
+ });
83
+
84
+ jQuery("#frm_field_id_<?php echo $field['id']; ?> .frm_unmark_required").click( function(){
85
+ var thisid=this.getAttribute('id');
86
+ jQuery.ajax({
87
+ type:"POST",
88
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
89
+ data:"action=frm_unmark_required&field="+thisid,
90
+ success:function(msg){
91
+ jQuery('#'+thisid).switchClass('frm_unmark_required','frm_mark_required');
92
+ }
93
+ });
94
+ });
95
+
96
+ jQuery("#frm_field_id_<?php echo $field['id']; ?> .frm_add_field_option").click( function(){
97
+ var thisid=this.getAttribute('id');
98
+ jQuery.ajax({
99
+ type:"POST",
100
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
101
+ data:"action=frm_add_field_option&field="+thisid,
102
+ success:function(msg){
103
+ jQuery('#frm_add_'+thisid).before(msg);
104
+ }
105
+ });
106
+ return false;
107
+ });
108
+ });
109
+ </script>
classes/views/frm-forms/new-option-js.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script>
2
+ jQuery(document).ready(function(){
3
+ jQuery('#frm_delete_field_<?php echo $field['id']; ?>-<?php echo $opt_key ?>_container .ui-icon-trash.frm_delete_field_option').hide();
4
+ jQuery('#frm_delete_field_<?php echo $field['id']; ?>-<?php echo $opt_key ?>_container.frm_single_option').hover(
5
+ function(){jQuery(this).children(".ui-icon-trash.frm_delete_field_option").show(); jQuery(this).children(".frm_spacer").hide();},
6
+ function(){jQuery(this).children(".ui-icon-trash.frm_delete_field_option").hide(); jQuery(this).children(".frm_spacer").show();}
7
+ );
8
+
9
+ jQuery("#frm_delete_field_<?php echo $field['id']; ?>-<?php echo $opt_key ?>_container .frm_ipe_field_option").editInPlace({
10
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
11
+ params:"action=frm_field_option_ipe",
12
+ show_buttons:true,
13
+ default_text:'(Blank)'
14
+ });
15
+
16
+ jQuery("#frm_delete_field_<?php echo $field['id']; ?>-<?php echo $opt_key ?>_container .frm_ipe_field_option_select").editInPlace({
17
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
18
+ params:"action=frm_field_option_ipe",
19
+ show_buttons:true,
20
+ default_text:'(Blank)',
21
+ callback: function(original_element, html, original){
22
+ jQuery("#"+original_element+'_select').html("The updated text is: " + html);
23
+ return(html);
24
+ }
25
+ });
26
+
27
+ jQuery("#frm_delete_field_<?php echo $field['id']; ?>-<?php echo $opt_key ?>_container .frm_delete_field_option").click( function(){
28
+ var thisid=this.getAttribute('id');
29
+ jQuery.ajax({
30
+ type:"POST",
31
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
32
+ data:"action=frm_delete_field_option&field="+thisid,
33
+ success:function(msg){
34
+ jQuery('#'+thisid+'_container').hide('highlight');
35
+ }
36
+ });
37
+ return false;
38
+ });
39
+ });
40
+ </script>
classes/views/frm-forms/new-selection.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div class="frmicon"><br></div>
3
+
4
+ <h2><?php echo FRM_PLUGIN_TITLE ?>: Create Form</h2>
5
+
6
+ <?php require(FRM_VIEWS_PATH.'/shared/nav.php'); ?>
7
+ <br/>
8
+ <p>
9
+ <?php FrmFormsHelper::get_template_dropdown($all_templates); ?>
10
+ or
11
+ <a href="<?php echo add_query_arg('action','new',str_replace( '%7E', '~', $_SERVER['REQUEST_URI'])) ?>">Create Custom Form</a>
12
+ </p>
13
+
14
+ </div>
classes/views/frm-forms/new.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div class="frmicon"><br></div>
3
+
4
+ <h2><?php echo FRM_PLUGIN_TITLE ?>: Create Form</h2>
5
+
6
+ <?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
7
+
8
+ <?php require(FRM_VIEWS_PATH.'/shared/nav.php'); ?>
9
+
10
+ <div class="frm_form_builder alignleft" id="poststuff">
11
+ <form name="form1" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
12
+ <input type="hidden" name="action" value="create">
13
+ <input type="hidden" name="id" value="<?php echo $id; ?>">
14
+ <?php wp_nonce_field('update-options'); ?>
15
+
16
+ <?php require(FRM_VIEWS_PATH.'/frm-forms/form.php'); ?>
17
+
18
+ <p class="submit">
19
+ <input type="submit" name="Submit" value="Create" class="button-primary" /> or
20
+ <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&action=destroy&id=<?php echo $id; ?>">Cancel</a>
21
+ </p>
22
+ </form>
23
+ </div>
24
+
25
+ <?php require('add_field_links.php'); ?>
26
+ </div>
27
+ <?php require('footer.php'); ?>
classes/views/frm-settings/form.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div class="frmicon"><br></div>
3
+ <h2><?php echo FRM_PLUGIN_TITLE ?>: Settings</h2>
4
+
5
+ <?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
6
+
7
+ <?php require(FRM_VIEWS_PATH.'/shared/nav.php'); ?>
8
+
9
+
10
+ <form name="frm_settings_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
11
+ <input type="hidden" name="action" value="process-form">
12
+ <?php wp_nonce_field('update-options'); ?>
13
+
14
+ <table class="form-table">
15
+ <tr class="form-field">
16
+ <td valign="top" width="10%"><?php _e('Preview Page', FRM_PLUGIN_NAME); ?>*: </td>
17
+ <td>
18
+ <?php FrmSettingsHelper::wp_pages_dropdown( $frm_settings->preview_page_id_str, $frm_settings->preview_page_id )?>
19
+ </td>
20
+ </tr>
21
+ </table>
22
+
23
+ <p class="submit">
24
+ <input type="submit" name="Submit" value="<?php _e('Update Options', FRM_PLUGIN_NAME) ?>" />
25
+ </p>
26
+
27
+ </form>
28
+ </div>
classes/views/frm-settings/pro-settings.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div id="icon-options-general" class="icon32"><br /></div>
3
+ <h2><?php echo FRM_PLUGIN_TITLE ?>: Pro Account Information</h2>
4
+ <?php $this_uri = preg_replace('#&.*?$#', '', str_replace( '%7E', '~', $_SERVER['REQUEST_URI'])); ?>
5
+ <form name="proaccount_form" method="post" action="<?php echo $this_uri; ?>">
6
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
7
+ <input type="hidden" name="action" value="pro-settings">
8
+ <?php wp_nonce_field('update-options'); ?>
9
+
10
+ <h3><?php echo FRM_PLUGIN_TITLE ?> Pro Account Information</h3>
11
+
12
+ <table class="form-table">
13
+ <tr class="form-field">
14
+ <td valign="top" width="15%"><?php _e(FRM_PLUGIN_TITLE." Pro Username*:", $frmpro_username ); ?> </td>
15
+ <td width="85%">
16
+ <input type="text" name="<?php echo $frmpro_username; ?>" value="<?php echo $frmpro_username_val; ?>"/>
17
+ <br/><span class="description">Your <?php echo FRM_PLUGIN_TITLE ?> Pro Username.</span>
18
+ </td>
19
+ </tr>
20
+ <tr class="form-field">
21
+ <td valign="top" width="15%"><?php _e(FRM_PLUGIN_TITLE." Pro Password:", $frmpro_password ); ?> </td>
22
+ <td width="85%">
23
+ <input type="password" name="<?php echo $frmpro_password; ?>" value="<?php echo $frmpro_password_val; ?>"/>
24
+ <br/><span class="description">Your <?php echo FRM_PLUGIN_TITLE ?> Pro Password.</span>
25
+ </td>
26
+ </tr>
27
+ </table>
28
+
29
+ <p class="submit">
30
+ <input type="submit" name="Submit" value="<?php _e('Save', FRM_PLUGIN_NAME ) ?>" />
31
+ </p>
32
+
33
+ <?php if($frmpro_is_installed) { ?>
34
+ <div>
35
+ <p><strong>The <?php echo $frm_utils->get_pro_version(); ?> Version of <?php echo FRM_PLUGIN_TITLE ?> Pro is Installed</strong></p>
36
+ <p>
37
+ <a href="<?php echo $this_uri; ?>&action=force-pro-reinstall" title="Re-Install">Re-Install</a> |
38
+ <a href="<?php echo $this_uri; ?>&action=pro-uninstall" onclick="return confirm('Are you sure you want to Un-Install {FRM_PLUGIN_TITLE} Pro? This will delete your pro username & password from your local database, remove all the pro software but will leave all your data intact in case you want to reinstall sometime :) ...');" title="Un-Install" >Un-Install</a>
39
+ </p><br/>
40
+ <!--
41
+ <p><strong>Edit/Update Your Profile:</strong><br/><span class="description">Use your account username and password to log in to your Account and Affiliate Control Panel</span></p>
42
+ <p><a href="http://prettylinkpro.com/amember/member.php">Account</a> | <a href="http://prettylinkpro.com/amember/aff_member.php">Affiliate Control Panel</a></p> -->
43
+ </div>
44
+
45
+ <?php //} else { ?>
46
+ <!--<p><strong>Ready to take your marketing efforts to the next level?</strong><br/>
47
+ <a href="http://prettylinkpro.com">Pretty Link Pro</a> will help you automate, share, test and get more clicks &amp; conversions from your Pretty Links!<br/><br/><a href="http://prettylinkpro.com">Learn More &raquo;</a></p>-->
48
+ <?php } ?>
49
+
50
+ </form>
51
+ </div>
classes/views/frm-statistics/list.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div class="frmicon"><br></div>
3
+ <h2><?php echo FRM_PLUGIN_TITLE ?>: Pro Statistics</h2>
4
+
5
+ <?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
6
+
7
+ <?php require(FRM_VIEWS_PATH.'/shared/nav.php'); ?>
8
+
9
+ Please upgrade to Formidable Pro to see your saved entries
10
+
11
+ </div>
classes/views/shared/errors.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (isset($message) && $message != ''){?><div id="message" class="updated fade" style="padding:5px;"><?php echo $message; ?></div><?php } ?>
2
+
3
+ <?php if( isset($errors) && $errors && count($errors) > 0 ){ ?>
4
+ <div class="error">
5
+ <ul id="frm_errors">
6
+ <?php foreach( $errors as $error )
7
+ echo '<li>' . $error . '</li>';
8
+ ?>
9
+ </ul>
10
+ </div>
11
+ <?php } ?>
classes/views/shared/head.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <link type="text/css" href="<?php echo FRM_URL; ?>/css/ui-lightness/jquery-ui-1.7.2.custom.css" rel="Stylesheet" />
2
+ <link rel="stylesheet" href="<?php echo FRM_URL; ?>/css/<?php echo $css_file; ?>" type="text/css" media="screen,projection" />
3
+ <?php
4
+ if (isset($js_file)){
5
+ if (is_array($js_file)){
6
+ foreach ($js_file as $file)
7
+ echo '<script type="text/javascript" src="'.FRM_URL.'/js/'. $file .'"></script>';
8
+ }else{?>
9
+ <script type="text/javascript" src="<?php echo FRM_URL; ?>/js/<?php echo $js_file; ?>"></script>
10
+ <?php
11
+ }
12
+ }
13
+ ?>
classes/views/shared/item-table-nav.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="tablenav"<?php echo (isset($navstyle)?" style=\"$navstyle\"":''); ?>>
2
+ <?php
3
+ // Only show the pager bar if there is more than 1 page
4
+ if($page_count > 1){ ?>
5
+ <?php do_action('frm-item-list-actions', $footer); ?>
6
+ <div class='tablenav-pages'><span class="displaying-num">Displaying <?php print "$page_first_record&#8211;$page_last_record of $record_count"; ?></span>
7
+
8
+ <?php // Only show the prev page button if the current page is not the first page
9
+ if($current_page > 1){ ?>
10
+ <a class='prev page-numbers' href='?page=<?php print $controller_file . $page_params; ?>&paged=<?php print($current_page-1); ?>'>&laquo;</a>
11
+ <?php
12
+ }
13
+
14
+ // First page is always displayed
15
+ if($current_page==1){ ?>
16
+ <span class='page-numbers current'>1</span>
17
+ <?php }else{ ?>
18
+ <a class='page-numbers' href='?page=<?php print $controller_file . $page_params; ?>&paged=1'>1</a>
19
+ <?php
20
+ }
21
+
22
+ // If the current page is more than 2 spaces away from the first page then we put some dots in here
23
+ if($current_page >= 5){
24
+ ?>
25
+ <span class='page-numbers dots'>...</span>
26
+ <?php
27
+ }
28
+
29
+ // display the current page icon and the 2 pages beneath and above it
30
+ $low_page = (($current_page >= 5)?($current_page-2):2);
31
+ $high_page = ((($current_page + 2) < ($page_count-1))?($current_page+2):($page_count-1));
32
+ for($i = $low_page; $i <= $high_page; $i++){
33
+ if($current_page==$i){ ?>
34
+ <span class='page-numbers current'><?php print $i; ?></span>
35
+ <?php }else{ ?>
36
+ <a class='page-numbers' href='?page=<?php print $controller_file . $page_params; ?>&paged=<?php print $i; ?>'><?php print $i; ?></a>
37
+ <?php
38
+ }
39
+ }
40
+
41
+ // If the current page is more than 2 away from the last page then show ellipsis
42
+ if($current_page < ($page_count - 3)){ ?>
43
+ <span class='page-numbers dots'>...</span>
44
+ <?php
45
+ }
46
+
47
+ // Display the last page icon
48
+ if($current_page == $page_count){ ?>
49
+ <span class='page-numbers current'><?php print $page_count; ?></span>
50
+ <?php }else{ ?>
51
+ <a class='page-numbers' href='?page=<?php print $controller_file . $page_params; ?>&paged=<?php print $page_count; ?>'><?php print $page_count; ?></a>
52
+ <?php
53
+ }
54
+
55
+ // Display the next page icon if there is a next page
56
+ if($current_page < $page_count){ ?>
57
+ <a class='next page-numbers' href='?page=<?php print $controller_file . $page_params; ?>&paged=<?php print($current_page + 1); ?>'>&raquo;</a>
58
+ <?php
59
+ }
60
+ ?>
61
+ </div>
62
+ <?php }
63
+
64
+ do_action('frm_before_table', $footer); ?>
65
+
66
+ <? if(isset($select_forms)){?>
67
+ Entries from:
68
+ <select id="select_form" name="select_form" onChange='getFrmEntries(this.value)'>
69
+ <?php foreach ($form_select as $g){
70
+ $selected = ($g->id == $params['form'])? ' selected="selected"' : ''; ?>
71
+ <option value="<?php echo $g->id ?>"<?php echo $selected ?>><?php echo $g->name ?></option>
72
+ <?php } ?>
73
+ </select>
74
+ <?php if ($params['form'])
75
+ echo "<small><a href='?page=".FRM_PLUGIN_NAME."&action=edit&id=".$params['form']."'>Edit Form</a></small>";
76
+ ?>
77
+
78
+ <script type="text/javascript">
79
+ function getFrmEntries(form){window.location='<?php $_SERVER["REQUEST_URI"] ?>?page=<?php echo FRM_PLUGIN_NAME; ?>-entries&form='+form}
80
+ </script>
81
+ <? } ?>
82
+ </div>
83
+ <div style="clear:both;"></div>
classes/views/shared/nav.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <div id="button_bar">
2
+ <ul class="subsubsub">
3
+ <li><a href="?page=<?php echo FRM_PLUGIN_NAME; ?>">Forms</a> | </li>
4
+ <li><a href="?page=<?php echo FRM_PLUGIN_NAME; ?>-new">Create a Form</a> | </li>
5
+ <li><a href="?page=<?php echo FRM_PLUGIN_NAME; ?>-templates">Templates</a></li>
6
+ </ul>
7
+ </div>
8
+ <div style="clear:both;"></div>
css/frm_admin.css ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .options-table {
2
+ width: 67%;
3
+ margin-top: 10px;
4
+ }
5
+
6
+ .options-table td {
7
+ padding: 10px;
8
+ background-color: #f4f0db;
9
+ }
10
+
11
+ .options-table h3 {
12
+ padding: 0px;
13
+ margin: 0px;
14
+ padding-left: 10px;
15
+ }
16
+
17
+ .pane {
18
+ background-color: #f4f0db;
19
+ padding-left: 10px;
20
+ }
21
+
22
+ ul.pane li {padding: 0px; margin: 0px;}
23
+
24
+ .edit_item {height: 50px;}
25
+
26
+ .item_name {font-size: 12px; font-weight: bold;}
27
+ .item_actions {padding-top: 5px; display:none;}
28
+
29
+ .frmcenter{text-align:center;}
30
+ .frmicon {
31
+ float: left;
32
+ height: 36px;
33
+ margin: 14px 6px 0 0;
34
+ width: 36px;
35
+ background: url(../images/icon_32.png) no-repeat top center;
36
+ }
37
+ .frmbutton.nodrag a{cursor:pointer;}
38
+ .frmbutton a{
39
+ cursor:move;
40
+ text-align:center;
41
+ background:#efefef url(../../../../wp-admin/images/gray-grad.png) top repeat-x;
42
+ color:#555; display:block;
43
+ width:240px;
44
+ text-decoration:none; padding:3px;
45
+ border:1px solid #dfdfdf; margin:5px 0;
46
+ }
47
+ .frmbutton a{background:#eaf3fa url(../../../../wp-admin/images/blue-grad.png) top repeat-x; color:#000;}
48
+ .frmbutton a:hover{background-position:bottom;}
49
+
50
+ .form-field input{width:auto;}
51
+ .frm_ipe_field_desc textarea{width:100%;}
52
+
53
+ .frm_form_builder{width:60%;}
54
+ #frm_form_options{width:250px;}
55
+
56
+ .frm_field_box{padding:5px;}
57
+
58
+ .frm_pos_top{display:block;}
59
+ .frm_pos_left{float:left;}
60
+ .frm_spacer{float:left; width:16px; height:16px;}
61
+
62
+ .postbox{margin-bottom:5px;}
63
+ .postbox h3{cursor:pointer;}
64
+ .edit_form_item .postbox, .edit_form_item .ui-icon-arrowthick-2-n-s, .edit_form_item .ui-icon-trash{display:none;}
65
+
66
+ #new_fields span.ui-icon{width:16px;}
67
+
68
+ .ui-icon-arrowthick-2-n-s{cursor:move;}
69
+
70
+ .frm_inactive_icon, .frm_mark_required{
71
+ opacity:.2;
72
+ filter:alpha(opacity=20);
73
+ }
74
+
75
+ .howto{font-weight:normal;}
76
+
77
+ .frm_10radio{margin-right:10px; text-align:center; float:left;}
78
+
79
+ .ui-state-default{border:none; padding:6px 6px 39px 6px; font-weight:normal; background-image:none; background-color:transparent;}
80
+ .ui-state-default.frm_hide_options{padding-bottom:6px;}
81
+ .ui-state-default:hover{border:1px solid #ccc; padding:5px;}
css/frm_display.css ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ .frm_pos_top{display:block;}
2
+ .frm_pos_left{float:left; padding-right:10px;}
3
+ .frm_pos_none{display:none;}
4
+ .frm_10radio{margin-right:10px; text-align:center; float:left;}
5
+ .frm_blank_field input[type='text'], .frm_blank_field textarea, .frm_blank_field select{border:1px solid red;}
6
+ ul#frm_errors{list-style: square inside url(../images/error.png);}
css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png ADDED
Binary file
css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png ADDED
Binary file
css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png ADDED
Binary file
css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png ADDED
Binary file
css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png ADDED
Binary file
css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png ADDED
Binary file
css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png ADDED
Binary file
css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png ADDED
Binary file
css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png ADDED
Binary file
css/ui-lightness/images/ui-icons_222222_256x240.png ADDED
Binary file
css/ui-lightness/images/ui-icons_228ef1_256x240.png ADDED
Binary file
css/ui-lightness/images/ui-icons_ef8c08_256x240.png ADDED
Binary file
css/ui-lightness/images/ui-icons_ffd27a_256x240.png ADDED
Binary file
css/ui-lightness/images/ui-icons_ffffff_256x240.png ADDED
Binary file
css/ui-lightness/jquery-ui-1.7.2.custom.css ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI CSS Framework
3
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
4
+ * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
5
+ */
6
+
7
+ /* Layout helpers
8
+ ----------------------------------*/
9
+ .ui-helper-hidden { display: none; }
10
+ .ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
11
+ .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
12
+ .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
13
+ .ui-helper-clearfix { display: inline-block; }
14
+ /* required comment for clearfix to work in Opera \*/
15
+ * html .ui-helper-clearfix { height:1%; }
16
+ .ui-helper-clearfix { display:block; }
17
+ /* end clearfix */
18
+ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
19
+
20
+
21
+ /* Interaction Cues
22
+ ----------------------------------*/
23
+ .ui-state-disabled { cursor: default !important; }
24
+
25
+
26
+ /* Icons
27
+ ----------------------------------*/
28
+
29
+ /* states and images */
30
+ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
31
+
32
+
33
+ /* Misc visuals
34
+ ----------------------------------*/
35
+
36
+ /* Overlays */
37
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
38
+
39
+
40
+
41
+ /*
42
+ * jQuery UI CSS Framework
43
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
44
+ * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
45
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
46
+ */
47
+
48
+
49
+ /* Component containers
50
+ ----------------------------------*/
51
+ .ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
52
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
53
+ .ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
54
+ .ui-widget-content a { color: #333333; }
55
+ .ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
56
+ .ui-widget-header a { color: #ffffff; }
57
+
58
+ /* Interaction states
59
+ ----------------------------------*/
60
+ .ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; outline: none; }
61
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; outline: none; }
62
+ .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; outline: none; }
63
+ .ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; outline: none; }
64
+ .ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; outline: none; }
65
+ .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; outline: none; text-decoration: none; }
66
+
67
+ /* Interaction Cues
68
+ ----------------------------------*/
69
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
70
+ .ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; }
71
+ .ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
72
+ .ui-state-error a, .ui-widget-content .ui-state-error a { color: #ffffff; }
73
+ .ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #ffffff; }
74
+ .ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
75
+ .ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; }
76
+ .ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
77
+
78
+ /* Icons
79
+ ----------------------------------*/
80
+
81
+ /* states and images */
82
+ .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
83
+ .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
84
+ .ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
85
+ .ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
86
+ .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
87
+ .ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
88
+ .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
89
+ .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
90
+
91
+ /* positioning */
92
+ .ui-icon-carat-1-n { background-position: 0 0; }
93
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
94
+ .ui-icon-carat-1-e { background-position: -32px 0; }
95
+ .ui-icon-carat-1-se { background-position: -48px 0; }
96
+ .ui-icon-carat-1-s { background-position: -64px 0; }
97
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
98
+ .ui-icon-carat-1-w { background-position: -96px 0; }
99
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
100
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
101
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
102
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
103
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
104
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
105
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
106
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
107
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
108
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
109
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
110
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
111
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
112
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
113
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
114
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
115
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
116
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
117
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
118
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
119
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
120
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
121
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
122
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
123
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
124
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
125
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
126
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
127
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
128
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
129
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
130
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
131
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
132
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
133
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
134
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
135
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
136
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
137
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
138
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
139
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
140
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
141
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
142
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
143
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
144
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
145
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
146
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
147
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
148
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
149
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
150
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
151
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
152
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
153
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
154
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
155
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
156
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
157
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
158
+ .ui-icon-extlink { background-position: -32px -80px; }
159
+ .ui-icon-newwin { background-position: -48px -80px; }
160
+ .ui-icon-refresh { background-position: -64px -80px; }
161
+ .ui-icon-shuffle { background-position: -80px -80px; }
162
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
163
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
164
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
165
+ .ui-icon-folder-open { background-position: -16px -96px; }
166
+ .ui-icon-document { background-position: -32px -96px; }
167
+ .ui-icon-document-b { background-position: -48px -96px; }
168
+ .ui-icon-note { background-position: -64px -96px; }
169
+ .ui-icon-mail-closed { background-position: -80px -96px; }
170
+ .ui-icon-mail-open { background-position: -96px -96px; }
171
+ .ui-icon-suitcase { background-position: -112px -96px; }
172
+ .ui-icon-comment { background-position: -128px -96px; }
173
+ .ui-icon-person { background-position: -144px -96px; }
174
+ .ui-icon-print { background-position: -160px -96px; }
175
+ .ui-icon-trash { background-position: -176px -96px; }
176
+ .ui-icon-locked { background-position: -192px -96px; }
177
+ .ui-icon-unlocked { background-position: -208px -96px; }
178
+ .ui-icon-bookmark { background-position: -224px -96px; }
179
+ .ui-icon-tag { background-position: -240px -96px; }
180
+ .ui-icon-home { background-position: 0 -112px; }
181
+ .ui-icon-flag { background-position: -16px -112px; }
182
+ .ui-icon-calendar { background-position: -32px -112px; }
183
+ .ui-icon-cart { background-position: -48px -112px; }
184
+ .ui-icon-pencil { background-position: -64px -112px; }
185
+ .ui-icon-clock { background-position: -80px -112px; }
186
+ .ui-icon-disk { background-position: -96px -112px; }
187
+ .ui-icon-calculator { background-position: -112px -112px; }
188
+ .ui-icon-zoomin { background-position: -128px -112px; }
189
+ .ui-icon-zoomout { background-position: -144px -112px; }
190
+ .ui-icon-search { background-position: -160px -112px; }
191
+ .ui-icon-wrench { background-position: -176px -112px; }
192
+ .ui-icon-gear { background-position: -192px -112px; }
193
+ .ui-icon-heart { background-position: -208px -112px; }
194
+ .ui-icon-star { background-position: -224px -112px; }
195
+ .ui-icon-link { background-position: -240px -112px; }
196
+ .ui-icon-cancel { background-position: 0 -128px; }
197
+ .ui-icon-plus { background-position: -16px -128px; }
198
+ .ui-icon-plusthick { background-position: -32px -128px; }
199
+ .ui-icon-minus { background-position: -48px -128px; }
200
+ .ui-icon-minusthick { background-position: -64px -128px; }
201
+ .ui-icon-close { background-position: -80px -128px; }
202
+ .ui-icon-closethick { background-position: -96px -128px; }
203
+ .ui-icon-key { background-position: -112px -128px; }
204
+ .ui-icon-lightbulb { background-position: -128px -128px; }
205
+ .ui-icon-scissors { background-position: -144px -128px; }
206
+ .ui-icon-clipboard { background-position: -160px -128px; }
207
+ .ui-icon-copy { background-position: -176px -128px; }
208
+ .ui-icon-contact { background-position: -192px -128px; }
209
+ .ui-icon-image { background-position: -208px -128px; }
210
+ .ui-icon-video { background-position: -224px -128px; }
211
+ .ui-icon-script { background-position: -240px -128px; }
212
+ .ui-icon-alert { background-position: 0 -144px; }
213
+ .ui-icon-info { background-position: -16px -144px; }
214
+ .ui-icon-notice { background-position: -32px -144px; }
215
+ .ui-icon-help { background-position: -48px -144px; }
216
+ .ui-icon-check { background-position: -64px -144px; }
217
+ .ui-icon-bullet { background-position: -80px -144px; }
218
+ .ui-icon-radio-off { background-position: -96px -144px; }
219
+ .ui-icon-radio-on { background-position: -112px -144px; }
220
+ .ui-icon-pin-w { background-position: -128px -144px; }
221
+ .ui-icon-pin-s { background-position: -144px -144px; }
222
+ .ui-icon-play { background-position: 0 -160px; }
223
+ .ui-icon-pause { background-position: -16px -160px; }
224
+ .ui-icon-seek-next { background-position: -32px -160px; }
225
+ .ui-icon-seek-prev { background-position: -48px -160px; }
226
+ .ui-icon-seek-end { background-position: -64px -160px; }
227
+ .ui-icon-seek-first { background-position: -80px -160px; }
228
+ .ui-icon-stop { background-position: -96px -160px; }
229
+ .ui-icon-eject { background-position: -112px -160px; }
230
+ .ui-icon-volume-off { background-position: -128px -160px; }
231
+ .ui-icon-volume-on { background-position: -144px -160px; }
232
+ .ui-icon-power { background-position: 0 -176px; }
233
+ .ui-icon-signal-diag { background-position: -16px -176px; }
234
+ .ui-icon-signal { background-position: -32px -176px; }
235
+ .ui-icon-battery-0 { background-position: -48px -176px; }
236
+ .ui-icon-battery-1 { background-position: -64px -176px; }
237
+ .ui-icon-battery-2 { background-position: -80px -176px; }
238
+ .ui-icon-battery-3 { background-position: -96px -176px; }
239
+ .ui-icon-circle-plus { background-position: 0 -192px; }
240
+ .ui-icon-circle-minus { background-position: -16px -192px; }
241
+ .ui-icon-circle-close { background-position: -32px -192px; }
242
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
243
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
244
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
245
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
246
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
247
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
248
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
249
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
250
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
251
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
252
+ .ui-icon-circle-check { background-position: -208px -192px; }
253
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
254
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
255
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
256
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
257
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
258
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
259
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
260
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
261
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
262
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
263
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
264
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
265
+
266
+
267
+ /* Misc visuals
268
+ ----------------------------------*/
269
+
270
+ /* Corner radius */
271
+ .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; }
272
+ .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
273
+ .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
274
+ .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
275
+ .ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
276
+ .ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
277
+ .ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
278
+ .ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
279
+ .ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; }
280
+
281
+ /* Overlays */
282
+ .ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
283
+ .ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; }/* Accordion
284
+ ----------------------------------*/
285
+ .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
286
+ .ui-accordion .ui-accordion-li-fix { display: inline; }
287
+ .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
288
+ .ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; }
289
+ .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
290
+ .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; }
291
+ .ui-accordion .ui-accordion-content-active { display: block; }/* Datepicker
292
+ ----------------------------------*/
293
+ .ui-datepicker { width: 17em; padding: .2em .2em 0; }
294
+ .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
295
+ .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
296
+ .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
297
+ .ui-datepicker .ui-datepicker-prev { left:2px; }
298
+ .ui-datepicker .ui-datepicker-next { right:2px; }
299
+ .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
300
+ .ui-datepicker .ui-datepicker-next-hover { right:1px; }
301
+ .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
302
+ .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
303
+ .ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
304
+ .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
305
+ .ui-datepicker select.ui-datepicker-month,
306
+ .ui-datepicker select.ui-datepicker-year { width: 49%;}
307
+ .ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
308
+ .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
309
+ .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
310
+ .ui-datepicker td { border: 0; padding: 1px; }
311
+ .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
312
+ .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
313
+ .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
314
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
315
+
316
+ /* with multiple calendars */
317
+ .ui-datepicker.ui-datepicker-multi { width:auto; }
318
+ .ui-datepicker-multi .ui-datepicker-group { float:left; }
319
+ .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
320
+ .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
321
+ .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
322
+ .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
323
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
324
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
325
+ .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
326
+ .ui-datepicker-row-break { clear:both; width:100%; }
327
+
328
+ /* RTL support */
329
+ .ui-datepicker-rtl { direction: rtl; }
330
+ .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
331
+ .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
332
+ .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
333
+ .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
334
+ .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
335
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
336
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
337
+ .ui-datepicker-rtl .ui-datepicker-group { float:right; }
338
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
339
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
340
+
341
+ /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
342
+ .ui-datepicker-cover {
343
+ display: none; /*sorry for IE5*/
344
+ display/**/: block; /*sorry for IE5*/
345
+ position: absolute; /*must have*/
346
+ z-index: -1; /*must have*/
347
+ filter: mask(); /*must have*/
348
+ top: -4px; /*must have*/
349
+ left: -4px; /*must have*/
350
+ width: 200px; /*must have*/
351
+ height: 200px; /*must have*/
352
+ }/* Dialog
353
+ ----------------------------------*/
354
+ .ui-dialog { position: relative; padding: .2em; width: 300px; }
355
+ .ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; }
356
+ .ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; }
357
+ .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
358
+ .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
359
+ .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
360
+ .ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
361
+ .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
362
+ .ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
363
+ .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
364
+ .ui-draggable .ui-dialog-titlebar { cursor: move; }
365
+ /* Progressbar
366
+ ----------------------------------*/
367
+ .ui-progressbar { height:2em; text-align: left; }
368
+ .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable
369
+ ----------------------------------*/
370
+ .ui-resizable { position: relative;}
371
+ .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
372
+ .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
373
+ .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; }
374
+ .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; }
375
+ .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; }
376
+ .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; }
377
+ .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
378
+ .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
379
+ .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
380
+ .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Slider
381
+ ----------------------------------*/
382
+ .ui-slider { position: relative; text-align: left; }
383
+ .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
384
+ .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; }
385
+
386
+ .ui-slider-horizontal { height: .8em; }
387
+ .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
388
+ .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
389
+ .ui-slider-horizontal .ui-slider-range-min { left: 0; }
390
+ .ui-slider-horizontal .ui-slider-range-max { right: 0; }
391
+
392
+ .ui-slider-vertical { width: .8em; height: 100px; }
393
+ .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
394
+ .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
395
+ .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
396
+ .ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs
397
+ ----------------------------------*/
398
+ .ui-tabs { padding: .2em; zoom: 1; }
399
+ .ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; }
400
+ .ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; }
401
+ .ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; }
402
+ .ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; }
403
+ .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
404
+ .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
405
+ .ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; }
406
+ .ui-tabs .ui-tabs-hide { display: none !important; }
formidable.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Formidable
4
+ Description: Easily create drag-and-drop forms
5
+ Version: 1.0
6
+ Plugin URI: http://blog.strategy11.com/formidable-wordpress-plugin
7
+ Author URI: http://blog.strategy11.com
8
+ Author: Stephanie Wells
9
+ */
10
+
11
+ require_once(ABSPATH . WPINC . '/pluggable.php');
12
+ define('FRM_PLUGIN_TITLE','Formidable');
13
+ define('FRM_PLUGIN_NAME','formidable');
14
+ define('FRM_PATH',WP_PLUGIN_DIR.'/'.FRM_PLUGIN_NAME);
15
+ define('FRM_MODELS_PATH',FRM_PATH.'/classes/models');
16
+ define('FRM_VIEWS_PATH',FRM_PATH.'/classes/views');
17
+ define('FRM_HELPERS_PATH',FRM_PATH.'/classes/helpers');
18
+ define('FRM_CONTROLLERS_PATH',FRM_PATH.'/classes/controllers');
19
+ define('FRM_URL',WP_PLUGIN_URL.'/'.FRM_PLUGIN_NAME);
20
+ define('FRM_SCRIPT_URL', get_option('home') . '/index.php?plugin=' . FRM_PLUGIN_NAME);
21
+
22
+ require_once(FRM_MODELS_PATH.'/FrmSettings.php');
23
+
24
+ global $frmpro_is_installed;
25
+ $frmpro_is_installed = false; //$frm_utils->pro_is_installed();
26
+
27
+ if($frmpro_is_installed)
28
+ require_once(FRM_PATH.'/pro/formidable-pro.php');
29
+
30
+ global $frm_version;
31
+ $frm_version = '1.0';
32
+
33
+
34
+ // Check for WPMU installation
35
+ if (!defined ('IS_WPMU')){
36
+ global $wpmu_version;
37
+ define('IS_WPMU', ($wpmu_version) ? 1 : 0);
38
+ }
39
+
40
+ global $frm_blogurl;
41
+ global $frm_siteurl;
42
+ global $frm_blogname;
43
+ global $frm_blogdescription;
44
+
45
+ $frm_blogurl = ((get_option('home'))?get_option('home'):get_option('siteurl'));
46
+ $frm_siteurl = get_option('siteurl');
47
+ $frm_blogname = get_option('blogname');
48
+ $frm_blogdescription = get_option('blogdescription');
49
+
50
+ /***** SETUP SETTINGS OBJECT *****/
51
+ global $frm_settings;
52
+
53
+ $frm_settings = get_option('frm_options');
54
+
55
+ // If unserializing didn't work
56
+ if(!$frm_settings){
57
+ $frm_settings = new FrmSettings();
58
+ update_option('frm_settings',$frm_settings);
59
+ }else
60
+ $frm_settings->set_default_options(); // Sets defaults for unset options
61
+
62
+ require_once(FRM_MODELS_PATH.'/FrmField.php');
63
+ require_once(FRM_MODELS_PATH.'/FrmForm.php');
64
+ require_once(FRM_MODELS_PATH.'/FrmEntry.php');
65
+ require_once(FRM_MODELS_PATH.'/FrmEntryMeta.php');
66
+ require_once(FRM_MODELS_PATH.'/FrmNotification.php');
67
+ require_once(FRM_MODELS_PATH.'/FrmUtils.php');
68
+
69
+ global $frm_field;
70
+ global $frm_form;
71
+ global $frm_entry;
72
+ global $frm_entry_meta;
73
+ global $frm_notification;
74
+ global $frm_utils;
75
+
76
+ $frm_field = new FrmField();
77
+ $frm_form = new FrmForm();
78
+ $frm_entry = new FrmEntry();
79
+ $frm_entry_meta = new FrmEntryMeta();
80
+ $frm_notification = new FrmNotification();
81
+ $frm_utils = new FrmUtils();
82
+
83
+
84
+ // Instansiate Controllers
85
+ require_once(FRM_CONTROLLERS_PATH . "/FrmAppController.php");
86
+ require_once(FRM_CONTROLLERS_PATH . "/FrmFieldsController.php");
87
+ require_once(FRM_CONTROLLERS_PATH . "/FrmFormsController.php");
88
+ require_once(FRM_CONTROLLERS_PATH . "/FrmEntriesController.php");
89
+ require_once(FRM_CONTROLLERS_PATH . "/FrmSettingsController.php");
90
+ require_once(FRM_CONTROLLERS_PATH . "/FrmStatisticsController.php");
91
+
92
+ global $frm_app_controller;
93
+ global $frm_entries_controller;
94
+ global $frm_fields_controller;
95
+ global $frm_forms_controller;
96
+ global $frm_settings_controller;
97
+
98
+ $frm_app_controller = new FrmAppController();
99
+ $frm_entries_controller = new FrmEntriesController();
100
+ $frm_fields_controller = new FrmFieldsController();
101
+ $frm_forms_controller = new FrmFormsController();
102
+ $frm_settings_controller = new FrmSettingsController();
103
+
104
+ // Instansiate Helpers
105
+ require_once(FRM_HELPERS_PATH. "/FrmAppHelper.php");
106
+ require_once(FRM_HELPERS_PATH. "/FrmEntriesHelper.php");
107
+ require_once(FRM_HELPERS_PATH. "/FrmFieldsHelper.php");
108
+ require_once(FRM_HELPERS_PATH. "/FrmFormsHelper.php");
109
+ require_once(FRM_HELPERS_PATH. "/FrmSettingsHelper.php");
110
+
111
+ global $frm_app_helper;
112
+ global $frm_fields_helper;
113
+ global $frm_settings_helper;
114
+
115
+ $frm_app_helper = new FrmAppHelper();
116
+ $frm_fields_helper = new FrmFieldsHelper();
117
+ $frm_settings_helper = new FrmSettingsHelper();
118
+
119
+
120
+ // The number of items per page on a table
121
+ global $frm_page_size;
122
+ $frm_page_size = 10;
123
+
124
+ global $frm_field_selection;
125
+
126
+ $frm_field_selection = array(
127
+ 'text' => 'Text Input (One Line)',
128
+ 'textarea' => 'Paragraph Input (Multiple Lines)',
129
+ 'checkbox' => 'Multiple Selection (Check Boxes)',
130
+ 'radio' => 'Select One (Radio)',
131
+ 'select' => 'Drop-Down (Select)'
132
+ );
133
+
134
+ global $frm_recaptcha_enabled;
135
+
136
+ $frm_recaptcha_enabled = ( in_array('wp-recaptcha/wp-recaptcha.php', get_option('active_plugins')) )?(true):(false);
137
+ if ($frm_recaptcha_enabled)
138
+ $frm_field_selection['captcha'] = 'reCAPTCHA Field';
139
+
140
+ global $frm_pro_field_selection;
141
+
142
+ $frm_pro_field_selection = array(
143
+ 'divider' => 'Section Divider',
144
+ 'image' => 'Image URL',
145
+ //'upload' => 'File Upload',
146
+ //'rte' => 'Rich Text Editor',
147
+ 'phone' => 'Phone',
148
+ 'email' => 'Email',
149
+ 'date' => 'Date',
150
+ //'time' => 'Time',
151
+ 'hidden' => 'Hidden Field',
152
+ 'user_id' => 'Hidden User Id',
153
+ 'website' => 'Website',
154
+ '10radio' => '1-10 radio'
155
+ //'multiple' => 'Multiple Select Box', //http://code.google.com/p/jquery-asmselect/
156
+ //'title' => 'Entry Title',
157
+ //'key' => 'Entry Key',// (for calling entry from template)
158
+ //'address' => 'Address', //Address line 1, Address line 2, City, State/Providence, Postal Code, Select Country
159
+ //'city_selector' => 'US State/County/City selector',
160
+ //'full_name' => 'First and Last Name',
161
+ //'terms' => 'Terms of Use',// checkbox or show terms (use with Terms of use plugin)
162
+ //'quiz' => 'Question and Answer',// for captcha alternative
163
+ //'parent' => 'Parent Entry', //link entries -- event to course, testimonial to item
164
+ );
165
+
166
+ ?>
images/arrow_down.png ADDED
Binary file
images/arrow_up.png ADDED
Binary file
images/blackglass-captcha.png ADDED
Binary file
images/clean-captcha.png ADDED
Binary file
images/error.png ADDED
Binary file
images/icon.png ADDED
Binary file
images/icon_128.png ADDED
Binary file
images/icon_16.png ADDED
Binary file
images/icon_32.png ADDED
Binary file
images/icon_48.png ADDED
Binary file
images/red-captcha.png ADDED
Binary file
images/white-captcha.png ADDED
Binary file
js/jquery/jquery-ui-1.7.1.custom.min.js ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI 1.7.1
3
+ *
4
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI
9
+ */
10
+ * jQuery UI Draggable 1.7.1
11
+ *
12
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
13
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
14
+ * and GPL (GPL-LICENSE.txt) licenses.
15
+ *
16
+ * http://docs.jquery.com/UI/Draggables
17
+ *
18
+ * Depends:
19
+ * ui.core.js
20
+ */
21
+ * jQuery UI Droppable 1.7.1
22
+ *
23
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
24
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
25
+ * and GPL (GPL-LICENSE.txt) licenses.
26
+ *
27
+ * http://docs.jquery.com/UI/Droppables
28
+ *
29
+ * Depends:
30
+ * ui.core.js
31
+ * ui.draggable.js
32
+ */
33
+ * jQuery UI Resizable 1.7.1
34
+ *
35
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
36
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
37
+ * and GPL (GPL-LICENSE.txt) licenses.
38
+ *
39
+ * http://docs.jquery.com/UI/Resizables
40
+ *
41
+ * Depends:
42
+ * ui.core.js
43
+ */
44
+ * jQuery UI Selectable 1.7.1
45
+ *
46
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
47
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
48
+ * and GPL (GPL-LICENSE.txt) licenses.
49
+ *
50
+ * http://docs.jquery.com/UI/Selectables
51
+ *
52
+ * Depends:
53
+ * ui.core.js
54
+ */
55
+ * jQuery UI Sortable 1.7.1
56
+ *
57
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
58
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
59
+ * and GPL (GPL-LICENSE.txt) licenses.
60
+ *
61
+ * http://docs.jquery.com/UI/Sortables
62
+ *
63
+ * Depends:
64
+ * ui.core.js
65
+ */
66
+ * jQuery UI Accordion 1.7.1
67
+ *
68
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
69
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
70
+ * and GPL (GPL-LICENSE.txt) licenses.
71
+ *
72
+ * http://docs.jquery.com/UI/Accordion
73
+ *
74
+ * Depends:
75
+ * ui.core.js
76
+ */
77
+ * jQuery UI Dialog 1.7.1
78
+ *
79
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
80
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
81
+ * and GPL (GPL-LICENSE.txt) licenses.
82
+ *
83
+ * http://docs.jquery.com/UI/Dialog
84
+ *
85
+ * Depends:
86
+ * ui.core.js
87
+ * ui.draggable.js
88
+ * ui.resizable.js
89
+ */
90
+ * jQuery UI Slider 1.7.1
91
+ *
92
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
93
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
94
+ * and GPL (GPL-LICENSE.txt) licenses.
95
+ *
96
+ * http://docs.jquery.com/UI/Slider
97
+ *
98
+ * Depends:
99
+ * ui.core.js
100
+ */
101
+ * jQuery UI Tabs 1.7.1
102
+ *
103
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
104
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
105
+ * and GPL (GPL-LICENSE.txt) licenses.
106
+ *
107
+ * http://docs.jquery.com/UI/Tabs
108
+ *
109
+ * Depends:
110
+ * ui.core.js
111
+ */
112
+ * jQuery UI Datepicker 1.7.1
113
+ *
114
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
115
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
116
+ * and GPL (GPL-LICENSE.txt) licenses.
117
+ *
118
+ * http://docs.jquery.com/UI/Datepicker
119
+ *
120
+ * Depends:
121
+ * ui.core.js
122
+ */
123
+ * jQuery UI Progressbar 1.7.1
124
+ *
125
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
126
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
127
+ * and GPL (GPL-LICENSE.txt) licenses.
128
+ *
129
+ * http://docs.jquery.com/UI/Progressbar
130
+ *
131
+ * Depends:
132
+ * ui.core.js
133
+ */
134
+ * jQuery UI Effects 1.7.1
135
+ *
136
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
137
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
138
+ * and GPL (GPL-LICENSE.txt) licenses.
139
+ *
140
+ * http://docs.jquery.com/UI/Effects/
141
+ */
142
+ * jQuery UI Effects Blind 1.7.1
143
+ *
144
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
145
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
146
+ * and GPL (GPL-LICENSE.txt) licenses.
147
+ *
148
+ * http://docs.jquery.com/UI/Effects/Blind
149
+ *
150
+ * Depends:
151
+ * effects.core.js
152
+ */
153
+ * jQuery UI Effects Bounce 1.7.1
154
+ *
155
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
156
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
157
+ * and GPL (GPL-LICENSE.txt) licenses.
158
+ *
159
+ * http://docs.jquery.com/UI/Effects/Bounce
160
+ *
161
+ * Depends:
162
+ * effects.core.js
163
+ */
164
+ * jQuery UI Effects Clip 1.7.1
165
+ *
166
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
167
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
168
+ * and GPL (GPL-LICENSE.txt) licenses.
169
+ *
170
+ * http://docs.jquery.com/UI/Effects/Clip
171
+ *
172
+ * Depends:
173
+ * effects.core.js
174
+ */
175
+ * jQuery UI Effects Drop 1.7.1
176
+ *
177
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
178
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
179
+ * and GPL (GPL-LICENSE.txt) licenses.
180
+ *
181
+ * http://docs.jquery.com/UI/Effects/Drop
182
+ *
183
+ * Depends:
184
+ * effects.core.js
185
+ */
186
+ * jQuery UI Effects Explode 1.7.1
187
+ *
188
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
189
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
190
+ * and GPL (GPL-LICENSE.txt) licenses.
191
+ *
192
+ * http://docs.jquery.com/UI/Effects/Explode
193
+ *
194
+ * Depends:
195
+ * effects.core.js
196
+ */
197
+ * jQuery UI Effects Fold 1.7.1
198
+ *
199
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
200
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
201
+ * and GPL (GPL-LICENSE.txt) licenses.
202
+ *
203
+ * http://docs.jquery.com/UI/Effects/Fold
204
+ *
205
+ * Depends:
206
+ * effects.core.js
207
+ */
208
+ * jQuery UI Effects Highlight 1.7.1
209
+ *
210
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
211
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
212
+ * and GPL (GPL-LICENSE.txt) licenses.
213
+ *
214
+ * http://docs.jquery.com/UI/Effects/Highlight
215
+ *
216
+ * Depends:
217
+ * effects.core.js
218
+ */
219
+ * jQuery UI Effects Pulsate 1.7.1
220
+ *
221
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
222
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
223
+ * and GPL (GPL-LICENSE.txt) licenses.
224
+ *
225
+ * http://docs.jquery.com/UI/Effects/Pulsate
226
+ *
227
+ * Depends:
228
+ * effects.core.js
229
+ */
230
+ * jQuery UI Effects Scale 1.7.1
231
+ *
232
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
233
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
234
+ * and GPL (GPL-LICENSE.txt) licenses.
235
+ *
236
+ * http://docs.jquery.com/UI/Effects/Scale
237
+ *
238
+ * Depends:
239
+ * effects.core.js
240
+ */
241
+ * jQuery UI Effects Shake 1.7.1
242
+ *
243
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
244
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
245
+ * and GPL (GPL-LICENSE.txt) licenses.
246
+ *
247
+ * http://docs.jquery.com/UI/Effects/Shake
248
+ *
249
+ * Depends:
250
+ * effects.core.js
251
+ */
252
+ * jQuery UI Effects Slide 1.7.1
253
+ *
254
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
255
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
256
+ * and GPL (GPL-LICENSE.txt) licenses.
257
+ *
258
+ * http://docs.jquery.com/UI/Effects/Slide
259
+ *
260
+ * Depends:
261
+ * effects.core.js
262
+ */
263
+ * jQuery UI Effects Transfer 1.7.1
264
+ *
265
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
266
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
267
+ * and GPL (GPL-LICENSE.txt) licenses.
268
+ *
269
+ * http://docs.jquery.com/UI/Effects/Transfer
270
+ *
271
+ * Depends:
272
+ * effects.core.js
273
+ */
js/jquery/jquery-ui-datepicker.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ * jQuery UI Datepicker 1.7.1
2
+ *
3
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
4
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
5
+ * and GPL (GPL-LICENSE.txt) licenses.
6
+ *
7
+ * http://docs.jquery.com/UI/Datepicker
8
+ *
9
+ * Depends:
10
+ * ui.core.js
11
+ */
12
+ (function($){$.extend($.ui,{datepicker:{version:"1.7.1"}});var PROP_NAME="datepicker";function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dateFormat:"mm/dd/yy",firstDay:0,isRTL:false};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,showMonthAfterYear:false,yearRange:"-10:+10",showOtherMonths:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"normal",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){input[isRTL?"before":"after"]('<span class="'+this._appendClass+'">'+appendText+"</span>")}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){inst.trigger.remove();$target.siblings("."+this._appendClass).remove().end().removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}var inst=this._getInst(target);if(inst){if(this._curInst==inst){this._hideDatepicker(null)}extendRemove(inst.settings,settings);var date=new Date();extendRemove(inst,{rangeStart:null,endDay:null,endMonth:null,endYear:null,selectedDay:date.getDate(),selectedMonth:date.getMonth(),selectedYear:date.getFullYear(),currentDay:date.getDate(),currentMonth:date.getMonth(),currentYear:date.getFullYear(),drawMonth:date.getMonth(),drawYear:date.getFullYear()});this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,"");break;case 13:var sel=$("td."+$.datepicker._dayOverClass+", td."+$.datepicker._currentClass,inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"))}return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"));break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})}};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};var self=this;inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate)}else{if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1}}}return Math.floor(((checkDate-firstMon)/86400000)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){lookAhead(match);var origSize=(match=="@"?14:(match=="y"?4:(match=="o"?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++){size=Math.max(size,names[j].length)}var name="";var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++){if(name==names[i]){return i+1}}size--}throw"Unknown name at position "+iInit};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year==-1){year=new Date().getFullYear()}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst){var dateFormat=this._get(inst,"dateFormat");var dates=inst.input?inst.input.val():null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){this.log(event);date=defaultDate}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,"defaultDate"),new Date());var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', -"+stepMonths+", 'M');\" title=\""+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>"));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', +"+stepMonths+", 'M');\" title=\""+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>"));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"");var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#'+inst.id+"');\">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row<numMonths[0];row++){var group="";for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));var cornerClass=" ui-corner-all";var calender="";if(isMultiMonth){calender+='<div class="ui-datepicker-group ui-datepicker-group-';switch(col){case 0:calender+="first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+="last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+="middle";cornerClass="";break}calender+='">'}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var thead="";for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+="<tr>";var tbody="";for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":" onclick=\"DP_jQuery.datepicker._selectDay('#"+inst.id+"',"+drawMonth+","+drawYear+', this);return false;"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():"&#xa0;"):(unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" ui-state-active":"")+'" href="#">'+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-title">';var monthHtml="";if(secondary||!changeMonth){monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span> "}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'M');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?"&#xa0;":"")}if(secondary||!changeYear){html+='<span class="ui-datepicker-year">'+drawYear+"</span>"}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-year" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'Y');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(;year<=endYear;year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}html+="</select>"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?"&#xa0;":"")+monthHtml}html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.7.1";window.DP_jQuery=$})(jQuery);;/*
js/jquery/jquery.editinplace.js ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Another In Place Editor - a jQuery edit in place plugin
3
+ *
4
+ * Copyright (c) 2009 Dave Hauenstein
5
+ *
6
+ * License:
7
+ * This source file is subject to the BSD license bundled with this package.
8
+ * Available online: {@link http://www.opensource.org/licenses/bsd-license.php}
9
+ * If you did not receive a copy of the license, and are unable to obtain it,
10
+ * email davehauenstein@gmail.com,
11
+ * and I will send you a copy.
12
+ *
13
+ * Project home:
14
+ * http://code.google.com/p/jquery-in-place-editor/
15
+ *
16
+ */
17
+
18
+ /*
19
+ * Version 1.0.1
20
+ *
21
+ * bg_out (string) default: transparent hex code of background color on restore from hover
22
+ * bg_over (string) default: #ffc hex code of background color on hover
23
+ * callback (function) default: null function to be called when editing is complete; cancels ajax submission to the url param
24
+ * cancel_button (string) default: <input type=”submit” class=”inplace_cancel” value=”Cancel”/> image button tag to use as “Cancel” button
25
+ * default_text (string) default: “(Click here to add text)” text to show up if the element that has this functionality is empty
26
+ * element_id (string) default: element_id name of parameter holding element_id
27
+ * error (function) this function gets called if server responds with an error
28
+ * field_type (string) “text”, “textarea”, or “select”; default: “text” The type of form field that will appear on instantiation
29
+ * on_blur (string) “save” or null; default: “save” what to do on blur; will be overridden if $param show_buttons is true
30
+ * original_html (string) default: original_html name of parameter holding original_html
31
+ * params (string) example: first_name=dave&last_name=hauenstein paramters sent via the post request to the server
32
+ * save_button (string) default: <input type=”submit” class=”inplace_save” value=”Save”/> image button tag to use as “Save” button
33
+ * saving_image (string) default: uses saving text specify an image location instead of text while server is saving
34
+ * saving_text (string) default: “Saving…” text to be used when server is saving information
35
+ * select_options (string) comma delimited list of options if field_type is set to select
36
+ * select_text (string)default text to show up in select box
37
+ * show_buttons (boolean) default: false will show the buttons: cancel or save; will automatically cancel out the onBlur functionality
38
+ * success (function) default: null this function gets called if server responds with a success
39
+ * textarea_cols (integer) default: 25 set cols attribute of textarea, if field_type is set to textarea
40
+ * textarea_rows (integer) default: 10 set rows attribute of textarea, if field_type is set to textarea
41
+ * update_value (string) default: update_value name of parameter holding update_value
42
+ * url (string) POST URL to send edited content
43
+ * value_required (string) default: false if set to true, the element will not be saved unless a value is entered
44
+ *
45
+ */
46
+
47
+ jQuery.fn.editInPlace = function(options) {
48
+
49
+ /* DEFINE THE DEFAULT SETTINGS, SWITCH THEM WITH THE OPTIONS USER PROVIDES */
50
+ var settings = {
51
+ url: "",
52
+ params: "",
53
+ field_type: "text",
54
+ select_options: "",
55
+ textarea_cols: "25",
56
+ textarea_rows: "10",
57
+ bg_over: "#ffc",
58
+ bg_out: "transparent",
59
+ saving_text: "Saving...",
60
+ saving_image: "",
61
+ default_text: "(Click here to add text)",
62
+ select_text: "Choose new value",
63
+ value_required: null,
64
+ element_id: "element_id",
65
+ update_value: "update_value",
66
+ original_html: "original_html",
67
+ save_button: '<button class="inplace_save">Save</button>',
68
+ cancel_button: '<button class="inplace_cancel">Cancel</button>',
69
+ show_buttons: false,
70
+ on_blur: "save",
71
+ callback: null,
72
+ success: null,
73
+ error: function(request){
74
+ alert("Failed to save value: " + request.responseText || 'Unspecified Error');
75
+ }
76
+ };
77
+
78
+ if(options) {
79
+ jQuery.extend(settings, options);
80
+ }
81
+
82
+ /* preload the loading icon if it exists */
83
+ if(settings.saving_image != ""){
84
+ var loading_image = new Image();
85
+ loading_image.src = settings.saving_image;
86
+ }
87
+
88
+ /* THIS FUNCTION WILL TRIM WHITESPACE FROM BEFORE/AFTER A STRING */
89
+ String.prototype.trim = function() {
90
+ return this.replace(/^\s+/, '')
91
+ .replace(/\s+$/, '');
92
+ };
93
+
94
+ /* THIS FUNCTION WILL ESCAPE ANY HTML ENTITIES SO "Quoted Values" work */
95
+ String.prototype.escape_html = function() {
96
+ return this.replace(/&/g, "&amp;")
97
+ .replace(/</g, "&lt;")
98
+ .replace(/>/g, "&gt;")
99
+ .replace(/"/g, "&quot;");
100
+ };
101
+
102
+ /* CREATE THE INPLACE EDITOR */
103
+ return this.each(function(){
104
+
105
+ if(jQuery(this).html() == "") jQuery(this).html(settings.default_text);
106
+
107
+ var editing = false;
108
+
109
+ //save the original element - for change of scope
110
+ var original_element = jQuery(this);
111
+
112
+ var click_count = 0;
113
+
114
+ jQuery(this)
115
+
116
+ .mouseover(function(){
117
+ jQuery(this).css("background", settings.bg_over);
118
+ })
119
+
120
+ .mouseout(function(){
121
+ jQuery(this).css("background", settings.bg_out);
122
+ })
123
+
124
+ .click(function(){
125
+ click_count++;
126
+
127
+ if(!editing)
128
+ {
129
+ editing = true;
130
+
131
+ //save original text - for cancellation functionality
132
+ var original_html = jQuery(this).html();
133
+ var buttons_code = (settings.show_buttons) ? settings.save_button + ' ' + settings.cancel_button : '';
134
+
135
+ //if html is our default text, clear it out to prevent saving accidentally
136
+ if (original_html == settings.default_text) jQuery(this).html('');
137
+
138
+ if (settings.field_type == "textarea")
139
+ {
140
+ var use_field_type = '<textarea name="inplace_value" class="inplace_field" rows="' + settings.textarea_rows + '" cols="' + settings.textarea_cols + '">' + jQuery(this).text().trim().escape_html() + '</textarea>';
141
+ }
142
+ else if(settings.field_type == "text")
143
+ {
144
+ var use_field_type = '<input type="text" name="inplace_value" class="inplace_field" value="' +
145
+ jQuery(this).text().trim().escape_html() + '" />';
146
+ }
147
+ else if(settings.field_type == "select")
148
+ {
149
+ var optionsArray = settings.select_options.split(',');
150
+ var use_field_type = '<select name="inplace_value" class="inplace_field"><option value="">' + settings.select_text + '</option>';
151
+ for(var i=0; i<optionsArray.length; i++){
152
+ var optionsValuesArray = optionsArray[i].split(':');
153
+ var use_value = optionsValuesArray[1] || optionsValuesArray[0];
154
+ var selected = use_value == original_html ? 'selected="selected" ' : '';
155
+ use_field_type += '<option ' + selected + 'value="' + use_value.trim().escape_html() + '">' + optionsValuesArray[0].trim().escape_html() + '</option>';
156
+ }
157
+ use_field_type += '</select>';
158
+ }
159
+
160
+ /* insert the new in place form after the element they click, then empty out the original element */
161
+ jQuery(this).html('<form class="inplace_form" style="display: inline; margin: 0; padding: 0;">' + use_field_type + ' ' + buttons_code + '</form>');
162
+
163
+ }/* END- if(!editing) -END */
164
+
165
+ if(click_count == 1)
166
+ {
167
+ function cancelAction()
168
+ {
169
+ editing = false;
170
+ click_count = 0;
171
+
172
+ /* put the original background color in */
173
+ original_element.css("background", settings.bg_out);
174
+
175
+ /* put back the original text */
176
+ original_element.html(original_html);
177
+
178
+ return false;
179
+ }
180
+
181
+ function saveAction()
182
+ {
183
+ /* put the original background color in */
184
+ original_element.css("background", settings.bg_out);
185
+
186
+ var this_elem = jQuery(this);
187
+
188
+ var new_html = escape((this_elem.is('form')) ? this_elem.children(0).val() : this_elem.parent().children(0).val());
189
+
190
+ /* set saving message */
191
+ if(settings.saving_image != ""){
192
+ var saving_message = '<img src="' + settings.saving_image + '" alt="Saving..." />';
193
+ } else {
194
+ var saving_message = settings.saving_text;
195
+ }
196
+
197
+ /* place the saving text/image in the original element */
198
+ original_element.html(saving_message);
199
+
200
+ if(settings.params != ""){
201
+ settings.params = "&" + settings.params;
202
+ }
203
+
204
+ if(settings.callback) {
205
+ html = settings.callback(original_element.attr("id"), new_html, original_html, settings.params);
206
+ editing = false;
207
+ click_count = 0;
208
+ if (html) {
209
+ /* put the newly updated info into the original element */
210
+ original_element.html(html || new_html);
211
+ } else {
212
+ /* failure; put original back */
213
+ alert("Failed to save value: " + new_html);
214
+ original_element.html(original_html);
215
+ }
216
+ } else if (settings.value_required && (new_html == "" || new_html == undefined)) {
217
+ editing = false;
218
+ click_count = 0;
219
+ original_element.html(original_html);
220
+ alert("Error: You must enter a value to save this field");
221
+ } else {
222
+ jQuery.ajax({
223
+ url: settings.url,
224
+ type: "POST",
225
+ data: settings.update_value + '=' + new_html + '&' + settings.element_id + '=' + original_element.attr("id") + settings.params + '&' + settings.original_html + '=' + original_html,
226
+ dataType: "html",
227
+ complete: function(request){
228
+ editing = false;
229
+ click_count = 0;
230
+ },
231
+ success: function(html){
232
+ /* if the text returned by the server is empty, */
233
+ /* put a marker as text in the original element */
234
+ var new_text = html || settings.default_text;
235
+
236
+ /* put the newly updated info into the original element */
237
+ original_element.html(new_text);
238
+ if (settings.success) settings.success(html, original_element);
239
+ },
240
+ error: function(request) {
241
+ original_element.html(original_html);
242
+ if (settings.error) settings.error(request, original_element);
243
+ }
244
+ });
245
+ }
246
+
247
+ return false;
248
+ }
249
+
250
+ /* set the focus to the new input element */
251
+ original_element.children("form").children(".inplace_field").focus().select();
252
+
253
+ /* CLICK CANCEL BUTTON functionality */
254
+ original_element.children("form").children(".inplace_cancel").click(cancelAction);
255
+
256
+ /* CLICK SAVE BUTTON functionality */
257
+ original_element.children("form").children(".inplace_save").click(saveAction);
258
+
259
+ /* if cancel/save buttons should be shown, cancel blur functionality */
260
+ if(!settings.show_buttons){
261
+ /* if on_blur is set to save, set the save funcion */
262
+ if(settings.on_blur == "save")
263
+ original_element.children("form").children(".inplace_field").blur(saveAction);
264
+ /* if on_blur is set to cancel, set the cancel funcion */
265
+ else
266
+ original_element.children("form").children(".inplace_field").blur(cancelAction);
267
+ }
268
+
269
+ /* hit esc key */
270
+ $(document).keyup(function(event){
271
+ if (event.keyCode == 27) {
272
+ cancelAction();
273
+ }
274
+ });
275
+
276
+ original_element.children("form").submit(saveAction);
277
+
278
+ }/* END- if(click_count == 1) -END */
279
+ });
280
+ });
281
+ };
js/jquery/jquery.editinplace.packed.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery.fn.editInPlace=function(options){var settings={url:"",params:"",field_type:"text",select_options:"",textarea_cols:"25",textarea_rows:"10",bg_over:"#ffc",bg_out:"transparent",saving_text:"Saving...",saving_image:"",default_text:"(Click here to add text)",select_text:"Choose new value",value_required:null,element_id:"element_id",update_value:"update_value",original_html:"original_html",save_button:'<button class="inplace_save">Save</button>',cancel_button:'<button class="inplace_cancel">Cancel</button>',show_buttons:false,on_blur:"save",callback:null,success:null,error:function(request){alert("Failed to save value: "+request.responseText||'Unspecified Error');}};if(options){jQuery.extend(settings,options);}
2
+ if(settings.saving_image!=""){var loading_image=new Image();loading_image.src=settings.saving_image;}
3
+ String.prototype.trim=function(){return this.replace(/^\s+/,'').replace(/\s+$/,'');};String.prototype.escape_html=function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");};return this.each(function(){if(jQuery(this).html()=="")jQuery(this).html(settings.default_text);var editing=false;var original_element=jQuery(this);var click_count=0;jQuery(this).mouseover(function(){jQuery(this).css("background",settings.bg_over);}).mouseout(function(){jQuery(this).css("background",settings.bg_out);}).click(function(){click_count++;if(!editing)
4
+ {editing=true;var original_html=jQuery(this).html();var buttons_code=(settings.show_buttons)?settings.save_button+' '+settings.cancel_button:'';if(original_html==settings.default_text)jQuery(this).html('');if(settings.field_type=="textarea")
5
+ {var use_field_type='<textarea name="inplace_value" class="inplace_field" rows="'+settings.textarea_rows+'" cols="'+settings.textarea_cols+'">'+jQuery(this).text().trim().escape_html()+'</textarea>';}
6
+ else if(settings.field_type=="text")
7
+ {var use_field_type='<input type="text" name="inplace_value" class="inplace_field" value="'+
8
+ jQuery(this).text().trim().escape_html()+'" />';}
9
+ else if(settings.field_type=="select")
10
+ {var optionsArray=settings.select_options.split(',');var use_field_type='<select name="inplace_value" class="inplace_field"><option value="">'+settings.select_text+'</option>';for(var i=0;i<optionsArray.length;i++){var optionsValuesArray=optionsArray[i].split(':');var use_value=optionsValuesArray[1]||optionsValuesArray[0];var selected=use_value==original_html?'selected="selected" ':'';use_field_type+='<option '+selected+'value="'+use_value.trim().escape_html()+'">'+optionsValuesArray[0].trim().escape_html()+'</option>';}
11
+ use_field_type+='</select>';}
12
+ jQuery(this).html('<form class="inplace_form" style="display: inline; margin: 0; padding: 0;">'+use_field_type+' '+buttons_code+'</form>');}
13
+ if(click_count==1)
14
+ {function cancelAction()
15
+ {editing=false;click_count=0;original_element.css("background",settings.bg_out);original_element.html(original_html);return false;}
16
+ function saveAction()
17
+ {original_element.css("background",settings.bg_out);var this_elem=jQuery(this);var new_html=escape((this_elem.is('form'))?this_elem.children(0).val():this_elem.parent().children(0).val());if(settings.saving_image!=""){var saving_message='<img src="'+settings.saving_image+'" alt="Saving..." />';}else{var saving_message=settings.saving_text;}
18
+ original_element.html(saving_message);if(settings.params!=""){settings.params="&"+settings.params;}
19
+ if(settings.callback){html=settings.callback(original_element.attr("id"),new_html,original_html,settings.params);editing=false;click_count=0;if(html){original_element.html(html||new_html);}else{alert("Failed to save value: "+new_html);original_element.html(original_html);}}else if(settings.value_required&&(new_html==""||new_html==undefined)){editing=false;click_count=0;original_element.html(original_html);alert("Error: You must enter a value to save this field");}else{jQuery.ajax({url:settings.url,type:"POST",data:settings.update_value+'='+new_html+'&'+settings.element_id+'='+original_element.attr("id")+settings.params+'&'+settings.original_html+'='+original_html,dataType:"html",complete:function(request){editing=false;click_count=0;},success:function(html){var new_text=html||settings.default_text;original_element.html(new_text);if(settings.success)settings.success(html,original_element);},error:function(request){original_element.html(original_html);if(settings.error)settings.error(request,original_element);}});}
20
+ return false;}
21
+ original_element.children("form").children(".inplace_field").focus().select();original_element.children("form").children(".inplace_cancel").click(cancelAction);original_element.children("form").children(".inplace_save").click(saveAction);if(!settings.show_buttons){if(settings.on_blur=="save")
22
+ original_element.children("form").children(".inplace_field").blur(saveAction);else
23
+ original_element.children("form").children(".inplace_field").blur(cancelAction);}
24
+ $(document).keyup(function(event){if(event.keyCode==27){cancelAction();}});original_element.children("form").submit(saveAction);}});});};
js/list-items.js ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function(){
2
+ jQuery('.form_item_actions').hide();
3
+ jQuery('.edit_form_item').hover(
4
+ function(){jQuery(this).children(".form_item_actions").show();},
5
+ function(){jQuery(this).children(".form_item_actions").hide();}
6
+ );
7
+
8
+ jQuery('.item_actions').hide();
9
+ jQuery('.edit_item').hover(
10
+ function(){jQuery(this).children(".item_actions").show();},
11
+ function(){jQuery(this).children(".item_actions").hide();}
12
+ );
13
+
14
+ jQuery('.select-all-item-action-checkboxes').change(function(){
15
+ if (jQuery(this).attr("checked")){
16
+ jQuery(".item-action-checkbox").attr("checked","checked");
17
+ jQuery(".select-all-item-action-checkboxes").attr("checked","checked");
18
+ }else{
19
+ jQuery(".item-action-checkbox").removeAttr("checked");
20
+ jQuery(".select-all-item-action-checkboxes").removeAttr("checked");
21
+ }
22
+ });
23
+ jQuery('.item-action-checkbox').change(function(){
24
+ if(!jQuery(this).attr("checked")){
25
+ jQuery(".select-all-item-action-checkboxes").removeAttr("checked");
26
+ }
27
+ });
28
+
29
+ jQuery('.item-list-form').submit(function(){
30
+ if(jQuery('#bulkaction').val() == 'delete'){
31
+ return confirm('Are you sure you want to delete each of the selected items below?');
32
+ }
33
+ });
34
+
35
+ //jQuery(document).ready(function(){
36
+ jQuery('.toggle_container').hide();
37
+ jQuery('.trigger').toggle(
38
+ function(){jQuery(this).addClass("active");},
39
+ function(){jQuery(this).removeClass("active");}
40
+ );
41
+ jQuery('.trigger').click(function(){jQuery(this).next(".toggle_container").slideToggle("slow");});
42
+ //});
43
+
44
+ jQuery('.ui-icon-trash.frm_delete_field_option').hide();
45
+ jQuery('.frm_single_option').hover(
46
+ function(){jQuery(this).children(".ui-icon-trash.frm_delete_field_option").show(); jQuery(this).children(".frm_spacer").hide();},
47
+ function(){jQuery(this).children(".ui-icon-trash.frm_delete_field_option").hide(); jQuery(this).children(".frm_spacer").show();}
48
+ );
49
+
50
+ jQuery('.edit_form_item .ui-icon-trash').hide();
51
+ jQuery('.edit_form_item .ui-icon-arrowthick-2-n-s').hide();
52
+ jQuery('.edit_form_item .postbox').hide();
53
+ jQuery('.ui-state-default').hover(
54
+ function(){jQuery(this).children(".ui-icon-trash").show();jQuery(this).children(".ui-icon-arrowthick-2-n-s").show(); jQuery(this).children(".postbox").show();},
55
+ function(){jQuery(this).children(".ui-icon-trash").hide();jQuery(this).children(".ui-icon-arrowthick-2-n-s").hide(); jQuery(this).children(".postbox").hide();}
56
+ );
57
+
58
+ /* jQuery('.form_field').hide();
59
+ jQuery('.form_only').show();
60
+
61
+ jQuery('.get_form_fields').change(function() {
62
+ jQuery('.form_field').hide();
63
+ jQuery('.form_' + jQuery(this).val() + 'only').show();
64
+ jQuery('.form_only').show();
65
+ });*/
66
+ });
readme.txt ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Formidable ===
2
+ Contributors: sswells
3
+ Donate link: http://blog.strategy11.com/donate
4
+ Tags: WPMU, form, drag, drop, widget, wordpress, plugin, template
5
+ Requires at least: 2.0
6
+ Tested up to: 2.8.6
7
+ Stable tag: 1.0
8
+
9
+ Quickly and easily build forms with a simple drag-and-drop interface.
10
+
11
+ == Description ==
12
+ Quickly and easily build forms with a simple drag-and-drop interface. Build custom forms or create them from a template.
13
+
14
+ = Features =
15
+ * Integrates with Pretty Link, and WPreCAPTCHA
16
+ * Shortcode [formidable id=x] for use in pages, posts, or text widgets for WordPress version 2.8 and above.
17
+
18
+ Feedback and requests are welcome.
19
+
20
+ == Installation ==
21
+ 1. Upload `formidable` folder to the `/wp-content/plugins/` directory
22
+ 2. Activate the plugin through the 'Plugins' menu
23
+ 3. Go to the Formidable 'Settings' menu to select a front-end preview page.
24
+ 4. Create a new custom form or use the existing Contact Form template.
25
+ 5. Use shortcode [formidable id=x] in pages, posts, or text widgets. (Requires WordPress version 2.8)
26
+
27
+ == Screenshots ==
28
+ 1. List forms.
29
+ 2. List templates.
30
+ 3. Form builder.
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file
screenshot-3.png ADDED
Binary file
todo.txt ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BUGS:
2
+ - Required star only switches the css class two times. After that, the value is updated in the database but the class doesn't change. Switch it to a replace instead of a class change
3
+
4
+ FREE VERSION
5
+ - clear default option on radio field
6
+ - Statistics Dashboard widget that just shows the top 5 forms for impressions and the top 5 for entries. Put this near the top of the page and put some advertising space on it, Pretty Link style.
7
+
8
+
9
+
10
+ PRO FEATURES:
11
+ ** add option to use other entries as select/radio choices **
12
+ - add field options:
13
+ -Radio/checkboxes: label position option (top, left, right, bottom), display vertically or horizontally
14
+ - easier way to manage radio/select/checkbox options
15
+ - add form options (styling, email notifications to user/admin, show description or select help icon or word for popup, success message, submit button name)
16
+ - Form option to enable entry tracking management -- if this is enabled for a form, the entries could have some statuses like unread/read/resolved and contain a notes area. In case someone wants to use Formidable for bug tracking or something. Eventually you could do conversation threads in here ... maybe integrate with mingle for that? :)
17
+ - create a WIDGET that you can select a form to embed on it -- after the form is filled out the stats can be displayed?
18
+ - EXPORT/IMPORT -- provide a link to export a set of entries -- I like the way I did it in Pretty Link -- just throw a link at the bottom of the entries table. That way users can dump the whole list or if they're looking at entries for a particular form they can just dump those.
19
+ - STATISTICS -- I'd implement this the way that Google Docs does it. Each field in the form can have a simple graph to show the responses. For multiple choice, Google does a simple, horizontal bar chart for each response -- for mutually exclusive questions (radio buttons) google does a pie chart and for text boxes they show about 5 random responses.
20
+ - add multiple fields at a time (first name/last name, address/city/state/postal code/country)
21
+ - easy front-end display of data
22
+
23
+ - add option to change field type after creation (from text box <-> rte, text field <-> title ... )
24
+ - add onchange options
25
+ - ie when check box is checked/unchecked, text field shows beneath it
26
+ - ie when option is selected from drop down, specific field is displayed
27
+ - add option: 'Show when option [text field] is selected from field [dropdown]'
28
+ - onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;
29
+ - Default value options: Client IP Address, Date, HTTP User Agent, HTTP Referer URL, User Display Name, User Email, User Login
30
+ - Ability to disallow users from filling a form out more than once (just set a cookie)
31
+ - Allow users to select a custom url that the form can redirect to after the user has filled out the form. Also, give the user's the option to post (well GET should be fine) data to that page in case they want to capture data on the other page.
32
+ - Bulk add radio/select/checkbox choices
33
+
34
+ 2. Additional Templates:
35
+ a. Defect/Bug/Issue Report Form Template
36
+ b. Extended Contact Form (with full street address, social media contact info, etc) Template
37
+ c. Credit Card Info with Billing / Shipping Info Form Template
38
+ d. Suggestion/Feedback Form Template
39
+ 3. Pro Statistics:
40
+ a. Form by Form stats for each question.
41
+ b. More in-depth overall stats.
42
+ 4. In Admin Formidable ads stop displaying ads for Formidable -- but for other stuff :)
43
+ 5. Additional Form Options:
44
+ a. Only logged-in users can see and submit form if used in a page or post
45
+ b. Allow front-end edits
46
+ c. Disallow Resubmits (basic cookie based tracking)
47
+ d. Optionally disallow emailing of info because we'll have the entries displayed
48
+ 6. Entries (as is + IP address, etc)
49
+ 7. Export Entries via CSV
50
+ 8. (eventually) entry tracking management
51
+ 9. (eventually) Formidable Poll widget / with or without results
52
+
53
+
54
+ Tasks & Possible Timelines:
55
+ 3. Add / Modify Formidable free features
56
+ 4. Get some icons, etc. -- I'm on it -- I'm going to try to get russ to create some iconography/typography for us.
57
+ 5. Release the free version on to the WordPress Repository asap (I think you could possibly do it by the first week in December -- maybe sooner knowing you :) )
58
+ 6. Polish and refine the pro features
59
+ 7. Build Pro Updates system
60
+ 8. Release -- probably early January? It will rock.