Formidable Forms – Form Builder for WordPress - Version 1.0.12

Version Description

  • Validated HTML markup for front-end form
  • Simplified the way a default template is created so it will also get updated with any changes
  • Really fixed the after HTML field this time
  • Changed option to email form to default to admin's email address instead of blank
Download this release

Release Info

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

Code changes from version 1.0 to 1.0.12

Files changed (110) hide show
  1. classes/controllers/FrmApiController.php +5 -17
  2. classes/controllers/FrmAppController.php +53 -142
  3. classes/controllers/FrmEntriesController.php +18 -13
  4. classes/controllers/FrmFieldsController.php +39 -11
  5. classes/controllers/FrmFormsController.php +23 -21
  6. classes/controllers/FrmSettingsController.php +19 -64
  7. classes/controllers/FrmStatisticsController.php +2 -3
  8. classes/helpers/FrmAppHelper.php +119 -42
  9. classes/helpers/FrmEntriesHelper.php +53 -10
  10. classes/helpers/FrmFieldsHelper.php +77 -5
  11. classes/helpers/FrmFormsHelper.php +56 -8
  12. classes/helpers/FrmSettingsHelper.php +0 -14
  13. classes/models/FrmEntry.php +79 -29
  14. classes/models/FrmEntryMeta.php +23 -35
  15. classes/models/FrmField.php +123 -138
  16. classes/models/FrmForm.php +43 -45
  17. classes/models/FrmNotification.php +5 -4
  18. classes/models/FrmSettings.php +21 -8
  19. classes/models/FrmUpdate.php +283 -0
  20. classes/models/FrmUtils.php +0 -64
  21. classes/templates/contact.php +63 -0
  22. classes/views/frm-entries/direct.php +4 -0
  23. classes/views/frm-entries/form.php +39 -27
  24. classes/views/frm-entries/frm-entry.php +9 -7
  25. classes/views/frm-entries/new.php +5 -5
  26. classes/views/frm-fields/input.php +31 -0
  27. classes/views/frm-fields/show.php +1 -40
  28. classes/views/frm-fields/single-option.php +1 -1
  29. classes/views/frm-forms/add_field.php +32 -23
  30. classes/views/frm-forms/add_field_links.php +8 -2
  31. classes/views/frm-forms/default-templates.php +4 -0
  32. classes/views/frm-forms/edit.php +1 -1
  33. classes/views/frm-forms/footer.php +132 -19
  34. classes/views/frm-forms/form.php +59 -5
  35. classes/views/frm-forms/list.php +11 -6
  36. classes/views/frm-forms/new.php +1 -1
  37. classes/views/frm-settings/form.php +8 -5
  38. classes/views/frm-settings/pro-settings.php +0 -51
  39. classes/views/shared/errors.php +8 -8
  40. classes/views/shared/head.php +9 -2
  41. classes/views/shared/item-table-nav.php +1 -17
  42. classes/views/shared/nav.php +1 -0
  43. css/frm_admin.css +15 -25
  44. formidable.php +24 -27
  45. images/ajax_loader.gif +0 -0
  46. images/help.png +0 -0
  47. images/reload.png +0 -0
  48. images/required_loader.gif +0 -0
  49. images/wpspin_light.gif +0 -0
  50. js/jquery/jquery-1.3.2.min.js +19 -0
  51. js/jquery/jquery-ui-1.7.1.custom.min.js +0 -273
  52. js/jquery/jquery-ui-1.7.2.min.js +10 -0
  53. js/jquery/jquery-ui-themepicker.js +193 -0
  54. js/json2.js +461 -0
  55. js/list-items.js +14 -17
  56. js/nicedit.js +118 -0
  57. js/ofc-library/JSON.php +806 -0
  58. js/ofc-library/README.txt +16 -0
  59. js/ofc-library/dot_base.php +231 -0
  60. js/ofc-library/json_format.php +86 -0
  61. js/ofc-library/ofc_area_base.php +40 -0
  62. js/ofc-library/ofc_area_hollow.php +10 -0
  63. js/ofc-library/ofc_area_line.php +10 -0
  64. js/ofc-library/ofc_arrow.php +27 -0
  65. js/ofc-library/ofc_bar.php +34 -0
  66. js/ofc-library/ofc_bar_3d.php +22 -0
  67. js/ofc-library/ofc_bar_base.php +97 -0
  68. js/ofc-library/ofc_bar_filled.php +39 -0
  69. js/ofc-library/ofc_bar_glass.php +131 -0
  70. js/ofc-library/ofc_bar_sketch.php +29 -0
  71. js/ofc-library/ofc_bar_stack.php +55 -0
  72. js/ofc-library/ofc_candle.php +41 -0
  73. js/ofc-library/ofc_hbar.php +64 -0
  74. js/ofc-library/ofc_line.php +157 -0
  75. js/ofc-library/ofc_line_base.php +92 -0
  76. js/ofc-library/ofc_line_dot.php +33 -0
  77. js/ofc-library/ofc_line_hollow.php +9 -0
  78. js/ofc-library/ofc_line_style.php +11 -0
  79. js/ofc-library/ofc_menu.php +56 -0
  80. js/ofc-library/ofc_pie.php +257 -0
  81. js/ofc-library/ofc_radar_axis.php +47 -0
  82. js/ofc-library/ofc_radar_axis_labels.php +15 -0
  83. js/ofc-library/ofc_radar_spoke_labels.php +15 -0
  84. js/ofc-library/ofc_scatter.php +47 -0
  85. js/ofc-library/ofc_scatter_line.php +49 -0
  86. js/ofc-library/ofc_shape.php +25 -0
  87. js/ofc-library/ofc_sugar.php +43 -0
  88. js/ofc-library/ofc_tags.php +133 -0
  89. js/ofc-library/ofc_title.php +39 -0
  90. js/ofc-library/ofc_tooltip.php +67 -0
  91. js/ofc-library/ofc_upload_image.php +70 -0
  92. js/ofc-library/ofc_x_axis.php +140 -0
  93. js/ofc-library/ofc_x_axis_label.php +45 -0
  94. js/ofc-library/ofc_x_axis_labels.php +69 -0
  95. js/ofc-library/ofc_x_legend.php +15 -0
  96. js/ofc-library/ofc_y_axis.php +17 -0
  97. js/ofc-library/ofc_y_axis_base.php +116 -0
  98. js/ofc-library/ofc_y_axis_label.php +38 -0
  99. js/ofc-library/ofc_y_axis_labels.php +57 -0
  100. js/ofc-library/ofc_y_axis_right.php +6 -0
  101. js/ofc-library/ofc_y_legend.php +15 -0
  102. js/ofc-library/open-flash-chart-object.php +109 -0
  103. js/ofc-library/open-flash-chart.php +178 -0
  104. js/open-flash-chart.swf +0 -0
  105. js/swfobject.js +5 -0
  106. readme.txt +79 -10
  107. screenshot-1.png +0 -0
  108. screenshot-2.png +0 -0
  109. screenshot-3.png +0 -0
  110. todo.txt +0 -60
classes/controllers/FrmApiController.php CHANGED
@@ -11,7 +11,7 @@ class FrmApiController{
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;
@@ -26,7 +26,7 @@ class FrmApiController{
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'
@@ -34,11 +34,9 @@ class FrmApiController{
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']}";
@@ -65,7 +63,7 @@ class FrmApiController{
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){
@@ -73,16 +71,6 @@ class FrmApiController{
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
  ?>
11
 
12
  $form_key = sanitize_title($args[0]);
13
 
14
+ $where = '';//" fr.form_key = '$form_key'";
15
  $items = $frm_entry->getAll($where);
16
 
17
  $list = $form_key;
26
  global $frm_entry, $frm_form, $frm_entry_meta;
27
 
28
  $defaults = array(
29
+ 'form_key' => '',
30
  'order' => '', 'limit' => '',
31
  'search' =>'', 'search_type' => '',
32
  'search_field' => '', 'search_operator' => 'LIKE'
34
 
35
  $r = wp_parse_args( $args, $defaults );
36
 
37
+ $form = $frm_form->getOne($r['form_key']);
38
 
39
+ $where = " (it.form_id='". $form->id ."')";
 
 
40
 
41
  if (!($r['order'] == ''))
42
  $r['order'] = " ORDER BY {$r['order']}";
63
 
64
  function get_frm_item($item_key){
65
  global $frm_entry;
66
+ return $frm_entry->getOne( $item_key );
67
  }
68
 
69
  function get_frm_item_by_id($id){
71
  return $frm_entry->getOne( $id );
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
 
76
  ?>
classes/controllers/FrmAppController.php CHANGED
@@ -3,6 +3,7 @@
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'));
@@ -21,20 +22,27 @@ class FrmAppController{
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 );
@@ -44,11 +52,12 @@ class FrmAppController{
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
 
@@ -57,14 +66,6 @@ class FrmAppController{
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
 
@@ -138,153 +139,63 @@ class FrmAppController{
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
 
@@ -297,7 +208,7 @@ class FrmAppController{
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
 
3
  class FrmAppController{
4
  function FrmAppController(){
5
  add_action('admin_menu', array( $this, 'menu' ));
6
+ add_filter( 'plugin_action_links_'.FRM_PLUGIN_NAME.'/'.FRM_PLUGIN_NAME.'.php', array( $this, 'settings_link'), 10, 2 );
7
  add_filter('the_content', array( $this, 'page_route' ), 1);
8
  add_action('init', array($this, 'front_head'));
9
  add_action('admin_init', array( $this, 'admin_js'));
22
 
23
  add_menu_page(FRM_PLUGIN_TITLE, FRM_PLUGIN_TITLE, 8, FRM_PLUGIN_NAME, array($frm_forms_controller,'route'), FRM_URL . '/images/icon_16.png');
24
 
25
+ //if(!$frmpro_is_installed)
26
+ //add_submenu_page(FRM_PLUGIN_TITLE, FRM_PLUGIN_TITLE .' | Pro Statistics', 'Pro Statistics', 8, FRM_PLUGIN_TITLE.'-statistics',array($this,''));
27
+ }
28
+
29
+ // Adds a settings link to the plugins page
30
+ function settings_link($links, $file){
31
+ $settings = '<a href="'.admin_url('admin.php?page='.FRM_PLUGIN_NAME).'">' . __('Settings') . '</a>';
32
+ array_unshift($links, $settings);
33
+ return $links;
34
  }
35
 
36
  function head(){
37
+ global $frm_settings;
38
+ $css_file = array($frm_settings->theme_nicename => $frm_settings->theme_css, 'frm_admin' => FRM_URL. '/css/frm_admin.css');
39
  $js_file = 'list-items.js';
40
  require_once(FRM_VIEWS_PATH . '/shared/head.php');
41
  }
42
 
43
  function admin_js(){
44
  wp_enqueue_script('jQuery');
45
+ wp_enqueue_script('jQuery-ui-1.7.2', FRM_URL.'/js/jquery/jquery-ui-1.7.2.min.js');
46
  wp_enqueue_script('jQuery-in-place-edit-patched', FRM_URL.'/js/jquery/jquery.editinplace.packed.js');
47
 
48
  add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
52
  }
53
 
54
  function front_head(){
55
+ if (!is_admin())
56
+ wp_enqueue_style('frm-forms', FRM_URL.'/css/frm_display.css');
57
  }
58
 
59
  function install(){
60
+ global $wpdb, $frm_form, $frm_field, $frm_app_helper;
61
  $db_version = 1.0; // this is the version of the database we're moving to
62
  $old_db_version = get_option('frm_db_version');
63
 
66
  $items_table = $wpdb->prefix . "frm_items";
67
  $item_metas_table = $wpdb->prefix . "frm_item_metas";
68
 
 
 
 
 
 
 
 
 
69
  if ($db_version != $old_db_version){
70
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
71
 
139
 
140
  dbDelta($sql);
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  /***** SAVE DB VERSION *****/
143
+ update_option('frm_db_version',$db_version);
144
  }
145
+
146
+ /**** ADD DEFAULT TEMPLATES ****/
147
+ $templates = glob(FRM_TEMPLATES_PATH."/*.php");
148
+
149
+ for($i = count($templates) - 1; $i >= 0; $i--){
150
+ $filename = preg_replace("#".FRM_TEMPLATES_PATH."/#","",$templates[$i]);
151
+ $filename = str_replace('.php','', $filename);
152
+ $form = $frm_form->getAll("form_key='{$filename}' and is_template='1' and default_template='1'", '', ' LIMIT 1');
153
+ require_once($templates[$i]);
154
+ }
155
+
156
+ do_action('frm_after_install');
157
  }
158
 
159
 
160
  // Routes for wordpress pages -- we're just replacing content here folks.
161
  function page_route($content){
162
+ global $post, $frm_settings;
163
 
164
+ if( $post && $post->ID == $frm_settings->preview_page_id && isset($_GET['form'])){
165
+ global $frm_forms_controller;
166
+ $frm_forms_controller->page_preview();
167
+ return;
168
+ }
169
 
170
+ return $content;
171
  }
172
 
173
  // The tight way to process standalone requests dogg...
174
  function parse_standalone_request(){
175
+ $plugin = $this->get_param('plugin');
176
+ $action = $this->get_param('action');
177
+ $controller = $this->get_param('controller');
178
 
179
+ if( !empty($plugin) and $plugin == FRM_PLUGIN_NAME and !empty($controller) ){
180
+ $this->standalone_route($controller, $action);
181
+ exit;
182
+ }
183
  }
184
 
185
  // Routes for standalone / ajax requests
186
+ function standalone_route($controller, $action=''){
187
+ global $frm_forms_controller;
188
+
189
+ if($controller=='forms'){
190
+ //if($action=='preview')
191
+ $frm_forms_controller->preview($this->get_param('form'));
192
+ }else
193
+ do_action('frm_standalone_route', $controller, $action);
194
  }
195
 
196
  // Utility function to grab the parameter whether it's a get or post
197
  function get_param($param, $default=''){
198
+ return (isset($_POST[$param])?$_POST[$param]:(isset($_GET[$param])?$_GET[$param]:$default));
199
  }
200
 
201
 
208
 
209
  function widget_text_filter( $content ){
210
  $regex = '/\[\s*formidable\s+.*\]/';
211
+ return preg_replace_callback( $regex, array($this, 'widget_text_filter_callback'), $content );
212
  }
213
 
214
 
classes/controllers/FrmEntriesController.php CHANGED
@@ -1,9 +1,10 @@
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(){
@@ -13,19 +14,19 @@ class FrmEntriesController{
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){
@@ -33,6 +34,8 @@ class FrmEntriesController{
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 = '';
@@ -41,7 +44,7 @@ class FrmEntriesController{
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
 
@@ -50,9 +53,11 @@ class FrmEntriesController{
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 = '';
@@ -61,13 +66,13 @@ class FrmEntriesController{
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
  }
@@ -91,7 +96,7 @@ class FrmEntriesController{
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;
1
  <?php
2
 
3
  class FrmEntriesController{
4
+ var $views;
5
+
6
  function FrmEntriesController(){
7
+ //add_action('admin_menu', array( $this, 'menu' ));
 
8
  }
9
 
10
  function menu(){
14
  }
15
 
16
  function list_entries(){
17
+ require_once(FRM_VIEWS_PATH.'/frm-entries/list.php');
18
  }
19
 
20
+ function show_form($id='', $key='', $title=false, $description=false){
21
  global $frm_form, $user_ID;
22
  if ($id) $form = $frm_form->getOne($id);
23
+ else if ($key) $form = $frm_form->getOne($key);
24
  if (!$form or $form->is_template or $form->status == 'draft')
25
  return 'Please select a valid form';
26
  else if ($form->logged_in and !$user_ID)
27
  return 'You must log in';
28
  else
29
+ return FrmEntriesController::get_form(FRM_VIEWS_PATH.'/frm-entries/frm-entry.php', $form, $title, $description);
30
  }
31
 
32
  function new_entry($form){
34
  $fields = $frm_field->getAll("fi.form_id='$form->id'", ' ORDER BY field_order');
35
  $values = FrmEntriesHelper::setup_new_vars($fields);
36
  $form_name = $form->name;
37
+ $form_options = stripslashes_deep(unserialize($form->options));
38
+ $submit = isset($form_options['submit_value'])?$form_options['submit_value']:'Submit';
39
 
40
  $params = $this->get_params($form);
41
  $message = '';
44
  do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
45
  if (apply_filters('frm_continue_to_new', true)){
46
  $values = FrmEntriesHelper::setup_new_vars($fields);
47
+ require_once(FRM_VIEWS_PATH.'/frm-entries/new.php');
48
  }
49
  }
50
 
53
  $fields = $frm_field->getAll("fi.form_id='$form->id'", ' ORDER BY field_order');
54
  $values = FrmEntriesHelper::setup_new_vars($fields);
55
  $form_name = $form->name;
56
+ $form_options = stripslashes_deep(unserialize($form->options));
57
+
58
+ $submit = isset($form_options['submit_value'])?$form_options['submit_value']:'Submit';
59
  $failed_message = "We're sorry. There was an error processing your responses.";
60
+ $saved_message = (isset($form_options['success_msg']) && $form_options['success_msg'] != '') ? $form_options['success_msg'] :"Your responses were successfully submitted. Thank you!";
61
 
62
  $params = $this->get_params($form);
63
  $message = '';
66
 
67
  if( count($errors) > 0 ){
68
  $values = FrmEntriesHelper::setup_new_vars($fields);
69
+ require_once(FRM_VIEWS_PATH.'/frm-entries/new.php');
70
  }else{
71
  do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
72
  if (apply_filters('frm_continue_to_create', true)){
73
+ if ($frm_entry->create( $_POST )){
74
  echo $saved_message;
75
+ }else
76
  echo $failed_message;
77
  }
78
  }
96
  $form = $frm_form->getAll('',' ORDER BY name',' LIMIT 1');
97
  $action = apply_filters('frm_show_new_entry_page','new',$form);
98
  $values = array();
99
+ foreach (array('id' => '', 'form_name' => '', 'paged' => 1, 'form' => $form->id, 'form_id' => $form->id, 'field_id' => '', 'search' => '', 'sort' => '', 'sdir' => '', 'action' => $action) as $var => $default)
100
  $values[$var] = $frm_app_controller->get_param($var, $default);
101
 
102
  return $values;
classes/controllers/FrmFieldsController.php CHANGED
@@ -2,17 +2,19 @@
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(){
@@ -58,15 +60,25 @@ class FrmFieldsController{
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
 
@@ -136,14 +148,30 @@ class FrmFieldsController{
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
  ?>
2
 
3
  class FrmFieldsController{
4
  function FrmFieldsController(){
 
5
  add_action('wp_ajax_frm_insert_field', array($this, 'create') );
6
  add_action('wp_ajax_frm_field_name_in_place_edit', array($this, 'edit_name') );
7
  add_action('wp_ajax_frm_field_desc_in_place_edit', array($this, 'edit_description') );
8
  add_action('wp_ajax_frm_mark_required', array($this, 'mark_required') );
9
+ add_action('wp_ajax_frm_clear_on_focus', array($this, 'clear_on_focus') );
10
+ add_action('wp_ajax_frm_default_blank', array($this, 'default_blank') );
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
+ add_filter('frm_field_type',array( $this, 'change_type'));
17
+ add_filter('frm_display_field_options', array($this, 'display_field_options'));
18
  }
19
 
20
  function create(){
60
 
61
  function mark_required(){
62
  global $frm_field;
63
+ $frm_field->update($_POST['field'], array('required' => $_POST['required']));
 
64
  die();
65
  }
66
+
67
+ function clear_on_focus(){
68
+ global $frm_field;
69
+ $field = $frm_field->getOne($_POST['field']);
70
+ $field_options = unserialize($field->field_options);
71
+ $field_options['clear_on_focus'] = $_POST['active'];
72
+ $frm_field->update($_POST['field'], array('field_options' => $field_options));
73
+ die();
74
+ }
75
+
76
+ function default_blank(){
77
  global $frm_field;
78
+ $field = $frm_field->getOne($_POST['field']);
79
+ $field_options = unserialize($field->field_options);
80
+ $field_options['default_blank'] = $_POST['active'];
81
+ $frm_field->update($_POST['field'], array('field_options' => $field_options));
82
  die();
83
  }
84
 
148
  function change_type($type){
149
  global $frm_field_selection, $frmpro_is_installed;
150
 
151
+ if ($frmpro_is_installed) return $type;
 
152
 
153
  $types = array_keys($frm_field_selection);
154
+ if (!in_array($type, $types) && $type != 'captcha')
155
  $type = 'text';
156
 
157
  return $type;
158
  }
159
+
160
+ function display_field_options($display){
161
+ if ($display['type'] == 'captcha'){
162
+ $display['required'] = false;
163
+ $display['default_blank'] = false;
164
+ }else if ($display['type'] == 'radio'){
165
+ $display['default_blank'] = false;
166
+ }else if ($display['type'] == 'text'){
167
+ $display['size'] = true;
168
+ $display['clear_on_focus'] = true;
169
+ }else if ($display['type'] == 'textarea'){
170
+ $display['size'] = true;
171
+ $display['clear_on_focus'] = true;
172
+ }
173
+
174
+ return $display;
175
+ }
176
  }
177
  ?>
classes/controllers/FrmFormsController.php CHANGED
@@ -9,7 +9,6 @@ class FrmFormsController{
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(){
@@ -19,7 +18,7 @@ class FrmFormsController{
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
  }
@@ -44,15 +43,15 @@ class FrmFormsController{
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
 
@@ -60,7 +59,7 @@ class FrmFormsController{
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 );
@@ -138,11 +137,13 @@ class FrmFormsController{
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
  }
@@ -150,21 +151,22 @@ class FrmFormsController{
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();
@@ -197,12 +199,12 @@ class FrmFormsController{
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 = ''){
@@ -265,18 +267,18 @@ class FrmFormsController{
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(){
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
  }
13
 
14
  function menu(){
18
  }
19
 
20
  function head(){
21
+ $css_file = array('jquery-ui-1.7.2.custom' => FRM_URL.'/css/ui-lightness/jquery-ui-1.7.2.custom.css', 'frm_admin' => FRM_URL. '/css/frm_admin.css');
22
  $js_file = 'list-items.js';
23
  require_once(FRM_VIEWS_PATH . '/shared/head.php');
24
  }
43
  else if ($action == 'new'){
44
  $values = FrmFormsHelper::setup_new_vars();
45
  $id = $frm_form->create( $values );
46
+ require_once(FRM_VIEWS_PATH.'/frm-forms/new.php');
47
  }else{
48
  $all_templates = $frm_form->getAll('is_template=1',' ORDER BY name');
49
+ require_once(FRM_VIEWS_PATH.'/frm-forms/new-selection.php');
50
  }
51
  }
52
 
53
  function create(){
54
+ global $frm_app_controller, $frm_app_helper, $frm_field_selection, $frm_entry, $frm_form, $frm_field, $frm_recaptcha_enabled, $frm_pro_field_selection, $frmpro_is_installed;
55
  $errors = $frm_form->validate($_POST);
56
  $id = $frm_app_controller->get_param('id');
57
 
59
  $record = $frm_form->getOne( $id );
60
  $fields = $frm_field->getAll("fi.form_id=$id", ' ORDER BY field_order');
61
  $values = $frm_app_helper->setup_edit_vars($record,'forms',$fields,true);
62
+ require_once(FRM_VIEWS_PATH.'/frm-forms/new.php');
63
  }else{
64
  $items = $frm_entry->getAll('',' ORDER BY it.name');
65
  $record = $frm_form->update( $id, $_POST, true );
137
 
138
  header("Content-Type: text/html; charset=utf-8");
139
 
140
+ $plugin = FrmAppController::get_param('plugin');
141
+ $controller = FrmAppController::get_param('controller');
142
  $key = (isset($_GET['form'])?$_GET['form']:(isset($_POST['form'])?$_POST['form']:''));
143
  $form = $frm_form->getAll("form_key='$key'",'',' LIMIT 1');
144
  if (!$form) $form = $frm_form->getAll('','',' LIMIT 1');
145
+ $form_options = stripslashes_deep(maybe_unserialize($form->options));
146
+ $description = $title = true;
147
 
148
  require_once(FRM_VIEWS_PATH.'/frm-entries/direct.php');
149
  }
151
  function destroy(){
152
  global $frm_form;
153
  $params = $this->get_params();
154
+ $message = '';
155
  if ($frm_form->destroy( $params['id'] ))
156
  $message = "Form was Successfully Deleted";
157
  $this->display_forms_list($params, $message, '', 1);
158
  }
159
 
160
  function destroy_wo_fields(){
161
+ global $frm_field, $frm_form, $frm_app_helper;
162
  $id = $_POST['form_id'];
163
+ if ($frm_app_helper->getRecordCount('form_id='.$id, $frm_field->table_name) <= 0)
164
  $frm_form->destroy($id);
165
  die();
166
  }
167
 
168
  function display_forms_list($params=false, $message='', $page_params_ov = false, $current_page_ov = false, $errors = array()){
169
+ global $wpdb, $frm_app_helper, $frm_form, $frm_entry, $frm_page_size, $frmpro_is_installed;
170
 
171
  if(!$params)
172
  $params = $this->get_params();
199
  $sdir_str = $form_vars['sdir_str'];
200
  $search_str = $form_vars['search_str'];
201
 
202
+ $record_count = $frm_app_helper->getRecordCount($form_vars['where_clause'], $frm_form->table_name);
203
+ $page_count = $frm_app_helper->getPageCount($frm_page_size,$form_vars['where_clause'], $frm_form->table_name);
204
+ $forms = $frm_app_helper->getPage($current_page, $frm_page_size, $form_vars['where_clause'], $form_vars['order_by'], $frm_form->table_name);
205
+ $page_last_record = $frm_app_helper->getLastRecordNum($record_count,$current_page,$frm_page_size);
206
+ $page_first_record = $frm_app_helper->getFirstRecordNum($record_count,$current_page,$frm_page_size);
207
+ require_once(FRM_VIEWS_PATH.'/frm-forms/list.php');
208
  }
209
 
210
  function get_form_sort_vars($params,$where_clause = ''){
267
  }
268
 
269
  function get_edit_vars($id, $errors = '', $message='', $create_link=false){
270
+ global $frm_app_helper, $frm_field_selection, $frm_entry, $frm_form, $frm_field, $frm_recaptcha_enabled, $frm_pro_field_selection, $frmpro_is_installed;
271
  $record = $frm_form->getOne( $id );
272
  $items = $frm_entry->getAll('',' ORDER BY it.name');
273
 
274
  $fields = $frm_field->getAll("fi.form_id=$id", ' ORDER BY field_order');
275
  $values = $frm_app_helper->setup_edit_vars($record,'forms',$fields,true);
276
+ if (isset($values['default_template']) && $values['default_template'])
277
  wp_die('That template cannot be edited');
278
  else if($create_link)
279
+ require_once(FRM_VIEWS_PATH.'/frm-forms/new.php');
280
  else
281
+ require_once(FRM_VIEWS_PATH.'/frm-forms/edit.php');
282
  }
283
 
284
  function get_params(){
classes/controllers/FrmSettingsController.php CHANGED
@@ -3,32 +3,40 @@
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) ){
@@ -36,60 +44,7 @@ class FrmSettingsController{
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(){
3
  class FrmSettingsController{
4
  function FrmSettingsController(){
5
  add_action('admin_menu', array( $this, 'menu' ), 25);
6
+ add_action('admin_head-'.FRM_PLUGIN_NAME.'_page_'.FRM_PLUGIN_NAME.'-settings', array($this,'head'));
 
7
  }
8
 
9
  function menu(){
10
+ global $frm_update;
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($frm_update,'pro_cred_form'));
13
  }
14
 
15
  function head(){
16
+ global $frm_settings;
17
+ $css_file = array($frm_settings->theme_nicename => $frm_settings->theme_css, 'frm_admin' => FRM_URL. '/css/frm_admin.css');
18
+ $js_file = 'jquery/jquery-ui-themepicker.js';
19
+ ?>
20
+ <link type="text/css" rel="stylesheet" href="http://jqueryui.com/themes/base/ui.all.css" />
21
+ <script>
22
+ jQuery(document).ready(function($){
23
+ $('#frm_switcher').themeswitcher();
24
+ });
25
+ </script>
26
+ <?php
27
+ require_once(FRM_VIEWS_PATH . '/shared/head.php');
28
  }
29
 
30
  function display_form(){
31
  global $frm_settings;
32
+ require_once(FRM_VIEWS_PATH . '/frm-settings/form.php');
 
33
  }
34
 
35
  function process_form(){
36
  global $frm_settings;
37
 
38
+ //$errors = $frm_settings->validate($_POST,array());
39
+ $errors = array();
40
  $frm_settings->update($_POST);
41
 
42
  if( empty($errors) ){
44
  $message = 'Settings Saved';
45
  }
46
 
47
+ require_once(FRM_VIEWS_PATH . '/frm-settings/form.php');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
 
50
  function route(){
classes/controllers/FrmStatisticsController.php CHANGED
@@ -3,17 +3,16 @@
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
  }
3
  class FrmStatisticsController{
4
  function FrmStatisticsController(){
5
  add_action('admin_menu', array( $this, 'menu' ), 30);
 
6
  }
7
 
8
  function menu(){
9
  global $frmpro_is_installed;
10
  if(!$frmpro_is_installed)
11
+ add_submenu_page(FRM_PLUGIN_TITLE, FRM_PLUGIN_TITLE .' | Statistics', 'Statistics', 8, FRM_PLUGIN_TITLE.'-statistics',array($this,''));
12
  }
13
 
14
  function list_entries(){
15
+ require_once(FRM_VIEWS_PATH . '/frm-statistics/list.php');
16
  }
17
 
18
  }
classes/helpers/FrmAppHelper.php CHANGED
@@ -7,14 +7,19 @@ class FrmAppHelper{
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){
@@ -31,16 +36,19 @@ class FrmAppHelper{
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;
@@ -56,8 +64,6 @@ class FrmAppHelper{
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){
@@ -68,52 +74,76 @@ class FrmAppHelper{
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
 
@@ -129,14 +159,61 @@ END;
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
  ?>
7
  return get_posts( array('post_type' => 'page', 'post_status' => 'published', 'numberposts' => 99, 'order_by' => 'post_title', 'order' => 'ASC'));
8
  }
9
 
10
+ function wp_pages_dropdown($field_name, $page_id){
11
+ global $frm_app_controller;
12
+
13
+ $field_value = $frm_app_controller->get_param($field_name);
14
+ $pages = get_posts( array('post_type' => 'page', 'post_status' => 'published', 'numberposts' => 99, 'order_by' => 'post_title', 'order' => 'ASC'));
15
+ ?>
16
+ <select name="<?php echo $field_name; ?>" id="<?php echo $field_name; ?>" class="frm-dropdown frm-pages-dropdown">
17
+ <option value=""></option>
18
+ <?php foreach($pages as $page){ ?>
19
+ <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>
20
+ <?php } ?>
21
+ </select>
22
+ <?php
23
  }
24
 
25
  function value_is_checked_with_array($field_name, $index, $field_value){
36
  $key = base_convert( rand($min_slug_value,$max_slug_value), 10, 36 );
37
  }else
38
  $key = sanitize_title_with_dashes($name);
39
+
40
+ if (is_numeric($key))
41
+ $key = $key .'a';
42
 
43
  $query = "SELECT $column FROM $table_name WHERE $column = %s AND ID != %d LIMIT 1";
44
  $key_check = $wpdb->get_var($wpdb->prepare($query, $key, $id));
45
+ if ($key_check || is_numeric($key_check)){
46
  $suffix = 2;
47
  do {
48
  $alt_post_name = substr($key, 0, 200-(strlen($suffix)+1)). "$suffix";
49
  $key_check = $wpdb->get_var($wpdb->prepare($query, $alt_post_name, $id));
50
  $suffix++;
51
+ } while ($key_check || is_numeric($key_check));
52
  $key = $alt_post_name;
53
  }
54
  return $key;
64
  foreach (array('name' => $record->name, 'description' => $record->description) as $var => $default_val)
65
  $values[$var] = stripslashes($frm_app_controller->get_param($var, $default_val));
66
 
 
 
67
  $values['fields'] = array();
68
  if ($fields){
69
  foreach($fields as $field){
74
  $meta_value = $frm_entry_meta->get_entry_meta_by_field($record->id, $field->id, true);
75
 
76
  $field_options = stripslashes_deep(unserialize($field->field_options));
77
+ $field_type = isset($_POST['field_options']['type_'.$field->id]) ? $_POST['field_options']['type_'.$field->id] : $field->type;
78
  $new_value = (isset($_POST['item_meta'][$field->id])) ? $_POST['item_meta'][$field->id] : $meta_value;
79
+ $new_value = stripslashes(maybe_unserialize($new_value));
 
80
 
81
  $field_array = array('id' => $field->id,
82
  'value' => $new_value,
83
  'default_value' => stripslashes($field->default_value),
84
  'name' => stripslashes($field->name),
85
  'description' => stripslashes($field->description),
86
+ 'type' => apply_filters('frm_field_type',$field_type, $field),
87
  'options' => stripslashes_deep(unserialize($field->options)),
88
  'required' => $field->required,
89
  'field_key' => $field->field_key,
90
  'field_order' => $field->field_order,
91
  'form_id' => $field->form_id);
92
 
93
+ foreach (array('size' => 50,'max' => '','label' => 'top','invalid' => '','required_indicator' => '*','blank' => '', 'clear_on_focus' => 0, 'custom_html' => FrmFieldsHelper::get_default_html($field), 'default_blank' => 0) as $opt => $default_opt)
94
  $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);
95
 
96
+ $values['fields'][] = apply_filters('frm_setup_edit_fields_vars', stripslashes_deep($field_array), $field, $values['id']);
97
  }
98
+ }
99
 
100
+ if ($table == 'entries')
101
+ $form = $frm_form->getOne( $record->form_id );
102
+ else if ($table == 'forms')
103
+ $form = $frm_form->getOne( $record->id );
104
+
105
+ if ($form){
106
+ $values['form_name'] = (isset($record->form_id))?($form->name):('');
107
+ $options = stripslashes_deep(unserialize($form->options));
108
+ if (is_array($options)){
109
+ foreach ($options as $opt => $value)
110
+ $values[$opt] = $frm_app_controller->get_param($opt, $value);
111
+ }
112
+ }
113
+
114
+ $email = get_option('admin_email');
115
+ foreach (array('email_to' => $email, 'submit_value' => 'Submit', 'success_msg' => 'Your responses were successfully submitted. Thank you!') as $opt => $default){
116
+ if (!isset($values[$opt]))
117
+ $values[$opt] = ($_POST and isset($_POST['options'][$opt])) ? $_POST['options'][$opt] : $default;
118
+ }
119
 
120
+ if (!isset($values['akismet']))
121
+ $values['akismet'] = ($_POST and isset($_POST['options']['akismet'])) ? 1 : 0;
122
+
123
+ if (!isset($values['before_html']))
124
+ $values['before_html'] = (isset($_POST['options']['before_html']) ? $_POST['options']['before_html'] : FrmFormsHelper::get_default_html('before'));
125
+
126
+ if (!isset($values['after_html']))
127
+ $values['after_html'] = (isset($_POST['options']['after_html'])?$_POST['options']['after_html'] : FrmFormsHelper::get_default_html('after'));
128
+
129
+ if ($table == 'entries')
130
+ $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
131
+ else if ($table == 'forms')
132
+ $values = FrmFormsHelper::setup_edit_vars( $values, $record );
133
+
134
+ return $values;
135
  }
136
 
137
  function frm_get_main_message( $message = ''){
138
+ global $frmpro_is_installed;
139
+ include_once(ABSPATH."/wp-includes/class-IXR.php");
140
+
141
+ $url = ($frmpro_is_installed) ? 'http://formidablepro.com/' : 'http://blog.strategy11.com/';
142
+ $client = new IXR_Client($url.'xmlrpc.php');
143
+
144
+ if ($client->query('frm.get_main_message'))
145
+ $message = $client->getResponse();
146
+
 
 
 
 
147
  return $message;
148
  }
149
 
159
  COMMENT_FORM;
160
 
161
  $use_ssl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? true : false;
162
+
 
 
 
 
163
  echo $format . recaptcha_wp_get_html(isset($_GET['rerror'])?$_GET['rerror']:'', $use_ssl);
164
  }
165
 
166
+ function truncate($str, $length, $minword = 3, $continue = '...'){
167
+ $sub = '';
168
+ $len = 0;
169
+
170
+ foreach (explode(' ', $str) as $word){
171
+ $part = (($sub != '') ? ' ' : '') . $word;
172
+ $sub .= $part;
173
+ $len += strlen($part);
174
+
175
+ if (strlen($word) > $minword && strlen($sub) >= $length)
176
+ break;
177
+ }
178
+
179
+ return $sub . (($len < strlen($str)) ? $continue : '');
180
+ }
181
+
182
+ function prepend_and_or_where( $starts_with = ' WHERE', $where = '' ){
183
+ return (( $where == '' )?'':$starts_with . $where);
184
+ }
185
+
186
+ // Pagination Methods
187
+ function getLastRecordNum($r_count,$current_p,$p_size){
188
+ return (($r_count < ($current_p * $p_size))?$r_count:($current_p * $p_size));
189
+ }
190
+
191
+ function getFirstRecordNum($r_count,$current_p,$p_size){
192
+ if($current_p == 1)
193
+ return 1;
194
+ else
195
+ return ($this->getLastRecordNum($r_count,($current_p - 1),$p_size) + 1);
196
+ }
197
+
198
+ function getRecordCount($where="", $table_name){
199
+ global $wpdb, $frm_app_helper;
200
+ $query = 'SELECT COUNT(*) FROM ' . $table_name . $frm_app_helper->prepend_and_or_where(' WHERE ', $where);
201
+ return $wpdb->get_var($query);
202
+ }
203
+
204
+ function getPageCount($p_size, $where="", $table_name){
205
+ return ceil((int)$this->getRecordCount($where, $table_name) / (int)$p_size);
206
+ }
207
+
208
+ function getPage($current_p,$p_size, $where = "", $order_by = '', $table_name){
209
+ global $wpdb, $frm_app_helper;
210
+ $end_index = $current_p * $p_size;
211
+ $start_index = $end_index - $p_size;
212
+ $query = 'SELECT * FROM ' . $table_name . $frm_app_helper->prepend_and_or_where(' WHERE', $where) . $order_by .' LIMIT ' . $start_index . ',' . $p_size;
213
+ $results = $wpdb->get_results($query);
214
+ return $results;
215
+ }
216
+
217
  }
218
 
219
  ?>
classes/helpers/FrmEntriesHelper.php CHANGED
@@ -12,39 +12,82 @@ class FrmEntriesHelper{
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
  ?>
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 = apply_filters('frm_get_default_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, $field),
27
+ 'options' => stripslashes_deep(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' => '', 'clear_on_focus' => 0, 'custom_html' => FrmFieldsHelper::get_default_html($field), 'default_blank' => 0) 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', stripslashes_deep($field_array), $field);
37
+
38
+ if (!isset($form))
39
+ $form = $frm_form->getOne($field->form_id);
40
+ }
41
+
42
+ $options = stripslashes_deep(unserialize($form->options));
43
+
44
+ if (is_array($options)){
45
+ foreach ($options as $opt => $value)
46
+ $values[$opt] = $frm_app_controller->get_param($opt, $value);
47
  }
48
+ if (!isset($values['email_to']))
49
+ $values['email_to'] = '';
50
+
51
+ if (!isset($values['submit_value']))
52
+ $values['submit_value'] = 'Submit';
53
+
54
+ if (!isset($values['success_msg']))
55
+ $values['success_msg'] = 'Your responses were successfully submitted. Thank you!';
56
+
57
+ if (!isset($values['akismet']))
58
+ $values['akismet'] = 0;
59
+
60
+ if (!isset($values['before_html']))
61
+ $values['before_html'] = FrmFormsHelper::get_default_html('before');
62
+
63
+ if (!isset($values['after_html']))
64
+ $values['after_html'] = FrmFormsHelper::get_default_html('after');
65
  }
66
  return $values;
67
  }
68
 
69
  function setup_edit_vars($values, $record){
70
  //$values['description'] = unserialize( $record->description );
71
+ $values['item_key'] = ($_POST and isset($_POST['item_key']))?$_POST['item_key']:$record->item_key;
72
+ $values['form_id'] = $record->form_id;
73
+ return apply_filters('frm_setup_edit_entry_vars', $values);
74
  }
75
 
76
+ function entries_dropdown( $form_id, $field_name, $field_value='', $blank=true, $blank_label='' ){
77
+ global $frm_app_controller, $frm_entry;
78
+
79
+ $entries = $frm_entry->getAll("it.form_id=".$form_id,' ORDER BY name');
80
+ ?>
81
+ <select name="<?php echo $field_name; ?>" id="<?php echo $field_name; ?>" class="frm-dropdown">
82
+ <?php if ($blank){ ?>
83
+ <option value=""><?php echo $blank_label; ?></option>
84
+ <?php } ?>
85
+ <?php foreach($entries as $entry){ ?>
86
+ <option value="<?php echo $entry->id; ?>" <?php selected($field_value, $entry->id); ?>><?php echo (!empty($entry->name)) ? $entry->name : $entry->item_key; ?></option>
87
+ <?php } ?>
88
+ </select>
89
+ <?php
90
+ }
91
  }
92
 
93
  ?>
classes/helpers/FrmFieldsHelper.php CHANGED
@@ -3,9 +3,9 @@
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();
@@ -13,13 +13,13 @@ class FrmFieldsHelper{
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';
@@ -33,7 +33,7 @@ class FrmFieldsHelper{
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
 
@@ -51,10 +51,82 @@ class FrmFieldsHelper{
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
  ?>
3
  class FrmFieldsHelper{
4
 
5
  function setup_new_vars($type='',$form_id=''){
6
+ global $frm_field, $frm_app_helper;
7
 
8
+ $field_count = $frm_app_helper->getRecordCount("form_id=$form_id", $frm_field->table_name);
9
  $key = FrmAppHelper::get_unique_key('', $frm_field->table_name, 'field_key');
10
 
11
  $values = array();
13
  $values[$var] = $default;
14
 
15
  $values['field_options'] = array();
16
+ foreach (array('size' => '50', 'max' => '', 'label' => 'top', 'required_indicator' => '*', 'clear_on_focus' => 0, 'custom_html' => FrmFieldsHelper::get_default_html($type), 'default_blank' => 0) 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'));
23
  else if ($type == 'textarea'){
24
  $values['field_options']['size'] = '45';
25
  $values['field_options']['max'] = '5';
33
 
34
  $values = array();
35
  $values['id'] = $record->id;
36
+ $values['form_id'] = $record->form_id;
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
 
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
+ $values['clear_on_focus'] = (isset($field_options['clear_on_focus']))?($field_options['clear_on_focus']):(0);
55
+ $values['default_blank'] = (isset($field_options['default_blank']))?($field_options['default_blank']):(0);
56
+ $values['custom_html'] = (isset($field_options['custom_html']))? stripslashes($field_options['custom_html']): FrmFieldsHelper::get_default_html($record->type);
57
 
58
  return $values;
59
  }
60
 
61
+ function get_default_html($type){
62
+ if (apply_filters('frm_show_normal_field_type', true, $type)){
63
+ $default_html = <<<DEFAULT_HTML
64
+ <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
65
+ <label class="frm_pos_[label_position]">[field_name]
66
+ <span class="frm_required">[required_label]</span>
67
+ </label>
68
+ [input]
69
+ [if description]<p class="description">[description]</p>[/if description]
70
+ </div>
71
+ DEFAULT_HTML;
72
+ }else{
73
+ $default_html = apply_filters('frm_other_custom_html', '', $type);
74
+ }
75
+
76
+ return apply_filters('frm_custom_html', $default_html, $type);
77
+ }
78
+
79
+ function replace_shortcodes($html, $field, $error_keys=array()){
80
+ $field_name = "item_meta[". $field['id'] ."]";
81
+ //replace [id]
82
+ $html = str_replace('[id]', $field['id'], $html);
83
+
84
+ //replace [description] and [required_label]
85
+ $required = ($field['required'] == '0')?(''):($field['required_indicator']);
86
+ foreach (array('description' => $field['description'], 'required_label' => $required) as $code => $value){
87
+ if ($value == '')
88
+ $html = preg_replace('/(\[if\s+'.$code.'\])(.*?)(\[\/if\s+'.$code.'\])/mis', '', $html);
89
+ else{
90
+ $html = str_replace('[if '.$code.']','',$html);
91
+ $html = str_replace('[/if '.$code.']','',$html);
92
+ }
93
+ $html = str_replace('['.$code.']', $value, $html);
94
+ }
95
+
96
+ //replace [required_class]
97
+ $required_class = ($field['required'] == '0')?(''):(' form-required');
98
+ $html = str_replace('[required_class]', $required_class, $html);
99
+
100
+ //replace [label_position]
101
+ $html = str_replace('[label_position]', $field['label'], $html);
102
+
103
+ //replace [field_name]
104
+ $html = str_replace('[field_name]', $field['name'], $html);
105
+
106
+ //replace [error_class]
107
+ $error_class = in_array('field'.$field['id'], $error_keys) ? ' frm_blank_field':'';
108
+ $html = str_replace('[error_class]', $error_class, $html);
109
+
110
+ //replace [input]
111
+ ob_start();
112
+ include(FRM_VIEWS_PATH.'/frm-fields/input.php');
113
+ $contents = ob_get_contents();
114
+ ob_end_clean();
115
+ $html = str_replace('[input]', $contents, $html);
116
+
117
+ return $html;
118
+ }
119
+
120
+ function show_onfocus_js($field_id, $clear_on_focus){ ?>
121
+ <a href="javascript:frm_clear_on_focus(<?php echo $field_id; ?>,<?php echo $clear_on_focus; ?>)" class="<?php echo ($clear_on_focus) ?'':'frm_inactive_icon'; ?>" id="clear_field_<?php echo $field_id; ?>" title="Set this field to <?php echo ($clear_on_focus)?'not ':''; ?>clear on click"><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></a>
122
+ <?php
123
+ }
124
+
125
+ function show_default_blank_js($field_id, $default_blank){ ?>
126
+ <a href="javascript:frm_default_blank(<?php echo $field_id; ?>,<?php echo $default_blank ?>)" class="<?php echo ($default_blank) ?'':'frm_inactive_icon'; ?>" id="default_blank_<?php echo $field_id; ?>" title="This default value should <?php echo ($default_blank)?'not ':''; ?>be considered blank"><img src="<?php echo FRM_IMAGES_URL?>/error.png"></a>
127
+ <?php
128
+ }
129
+
130
  }
131
 
132
  ?>
classes/helpers/FrmFormsHelper.php CHANGED
@@ -21,7 +21,25 @@ class FrmFormsHelper{
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(){
@@ -34,7 +52,12 @@ class FrmFormsHelper{
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
  }
@@ -45,15 +68,40 @@ class FrmFormsHelper{
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
  ?>
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
+ <?php
25
+ }
26
+
27
+ function forms_dropdown( $field_name, $field_value='', $blank=true, $field_id=false ){
28
+ global $frm_app_controller, $frm_form;
29
+ if (!$field_id)
30
+ $field_id = $field_name;
31
+
32
+ $forms = $frm_form->getAll("is_template=0 AND (status is NULL OR status = '' OR status = 'published')",' ORDER BY name');
33
+ ?>
34
+ <select name="<?php echo $field_name; ?>" id="<?php echo $field_id ?>" class="frm-dropdown">
35
+ <?php if ($blank){ ?>
36
+ <option value=""></option>
37
+ <?php } ?>
38
+ <?php foreach($forms as $form){ ?>
39
+ <option value="<?php echo $form->id; ?>" <?php selected($field_value, $form->id); ?>><?php echo $form->name; ?></option>
40
+ <?php } ?>
41
+ </select>
42
+ <?php
43
  }
44
 
45
  function setup_new_vars(){
52
  $values[$var] = stripslashes($frm_app_controller->get_param($var, $default));
53
 
54
  $values['form_key'] = ($_POST and isset($_POST['form_key']))?$_POST['form_key']:(FrmAppHelper::get_unique_key('', $frm_form->table_name, 'form_key'));
55
+ $values['email_to'] = ($_POST and isset($_POST['options']['email_to'])) ? $_POST['options']['email_to'] : get_option('admin_email');
56
+ $values['submit_value'] = ($_POST and isset($_POST['options']['submit_value'])) ? $_POST['options']['submit_value'] : 'Submit';
57
+ $values['success_msg'] = ($_POST and isset($_POST['options']['success_msg'])) ? $_POST['options']['success_msg'] : 'Your responses were successfully submitted. Thank you!';
58
+ $values['akismet'] = ($_POST and isset($_POST['options']['akismet'])) ? 1 : 0;
59
+ $values['before_html'] = FrmFormsHelper::get_default_html('before');
60
+ $values['after_html'] = FrmFormsHelper::get_default_html('after');
61
 
62
  return apply_filters('frm_setup_new_form_vars', $values);
63
  }
68
  $values['form_key'] = $frm_app_controller->get_param('form_key', $record->form_key);
69
  $values['default_template'] = $frm_app_controller->get_param('default_template', $record->default_template);
70
  $values['is_template'] = $frm_app_controller->get_param('is_template', $record->is_template);
 
 
 
 
 
 
71
 
72
  return apply_filters('frm_setup_edit_form_vars', $values);
73
  }
74
+
75
+ function get_default_html($loc){
76
+ if ($loc == 'before'){
77
+ $default_html = <<<BEFORE_HTML
78
+ [if form_name]<h3>[form_name]</h3>[/if form_name]
79
+ [if form_description]<p class="frm_description">[form_description]</p>[/if form_description]
80
+ BEFORE_HTML;
81
+ }else{
82
+ $default_html = '';
83
+ }
84
+ return $default_html;
85
+ }
86
+
87
+ function replace_shortcodes($html, $form, $title=false, $description=false){
88
+ foreach (array('form_name' => $title,'form_description' => $description) as $code => $show){
89
+ if ($code == 'form_name')
90
+ $replace_with = $form->name;
91
+ else if ($code == 'form_description')
92
+ $replace_with = $form->description;
93
+
94
+ if (($show == true || $show == 'true') && $replace_with != '' ){
95
+ $html = str_replace('[if '.$code.']','',$html);
96
+ $html = str_replace('[/if '.$code.']','',$html);
97
+ }else{
98
+ $html = preg_replace('/(\[if\s+'.$code.'\])(.*?)(\[\/if\s+'.$code.'\])/mis', '', $html);
99
+ }
100
+ $html = str_replace('['.$code.']', $replace_with, $html);
101
+ }
102
+
103
+ return $html;
104
+ }
105
 
106
  }
107
  ?>
classes/helpers/FrmSettingsHelper.php CHANGED
@@ -1,19 +1,5 @@
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
  ?>
1
  <?php
2
 
3
  class FrmSettingsHelper{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
  ?>
classes/models/FrmEntry.php CHANGED
@@ -9,7 +9,7 @@ class FrmEntry{
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'];
@@ -22,12 +22,11 @@ class FrmEntry{
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;
@@ -57,7 +56,10 @@ class FrmEntry{
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;
@@ -66,7 +68,7 @@ class FrmEntry{
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
 
@@ -101,31 +103,34 @@ class FrmEntry{
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
 
@@ -134,21 +139,21 @@ class FrmEntry{
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
 
@@ -161,17 +166,16 @@ class FrmEntry{
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
  }
@@ -193,8 +197,54 @@ class FrmEntry{
193
  }
194
  }
195
 
 
 
 
 
 
 
 
 
 
196
  return $errors;
197
  }
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  }
200
  ?>
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'];
22
 
23
  $query_results = $wpdb->insert( $this->table_name, $new_values );
24
 
25
+ if($query_results){
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
+ do_action('frm_after_create_entry', $entry_id);
 
30
  return $entry_id;
31
  }else
32
  return false;
56
  function update( $id, $values ){
57
  global $wpdb, $frm_entry_meta, $frm_field;
58
 
59
+ $new_values = array();
60
+ if (isset($values['item_key']))
61
+ $new_values['item_key'] = FrmAppHelper::get_unique_key($values['item_key'], $this->table_name, 'item_key', $id);
62
+
63
  $new_values['name'] = isset($values['name'])?$values['name']:'';
64
  $new_values['form_id'] = isset($values['form_id'])?(int)$values['form_id']: null;
65
  //$new_values['parent_item_id'] = isset($values['parent_item_id'])?(int)$values['parent_item_id']: null;
68
 
69
  if (isset($values['item_meta']))
70
  $frm_entry_meta->update_entry_metas($id, $values['item_meta']);
71
+ do_action('frm_after_update_entry', $id);
72
  return $query_results;
73
  }
74
 
103
  function getOne( $id ){
104
  global $wpdb, $frm_form;
105
  $query = 'SELECT it.*, ' .
106
+ 'fr.name as form_name, ' .
107
+ 'fr.form_key as form_key ' .
108
  'FROM '. $this->table_name . ' it ' .
109
+ 'LEFT OUTER JOIN ' . $frm_form->table_name . ' fr ON it.form_id=fr.id';
110
+ if(is_numeric($id))
111
+ $query .= ' WHERE it.id=' . $id;
112
+ else
113
+ $query .= " WHERE it.item_key='" . $id ."'";
114
  return $wpdb->get_row($query);
115
  }
116
 
117
  function getAll($where = '', $order_by = '', $limit = ''){
118
+ global $wpdb, $frm_form, $frm_app_helper;
119
  $query = 'SELECT it.*, ' .
120
+ 'fr.name as form_name, ' .
121
+ 'fr.form_key as form_key ' .
122
  'FROM '. $this->table_name . ' it ' .
123
+ 'LEFT OUTER JOIN ' . $frm_form->table_name . ' fr ON it.form_id=fr.id' .
124
+ $frm_app_helper->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
125
  return $wpdb->get_results($query);
126
  }
127
 
128
  // Pagination Methods
129
  function getRecordCount($where=""){
130
+ global $wpdb, $frm_app_helper, $frm_form;
131
  $query = 'SELECT COUNT(*) FROM ' . $this->table_name . ' it ' .
132
+ 'LEFT OUTER JOIN ' . $frm_form->table_name . ' fr ON it.form_id=fr.id' .
133
+ $frm_app_helper->prepend_and_or_where(' WHERE ', $where);
134
  return $wpdb->get_var($query);
135
  }
136
 
139
  }
140
 
141
  function getPage($current_p,$p_size, $where = "", $order_by = ''){
142
+ global $wpdb, $frm_app_helper, $frm_form;
143
  $end_index = $current_p * $p_size;
144
  $start_index = $end_index - $p_size;
145
  $query = 'SELECT it.*, ' .
146
+ 'fr.name as form_name ' .
147
  'FROM ' . $this->table_name . ' it ' .
148
+ 'LEFT OUTER JOIN ' . $frm_form->table_name . ' fr ON it.form_id=fr.id' .
149
+ $frm_app_helper->prepend_and_or_where(' WHERE', $where) . $order_by . ' ' .
150
  'LIMIT ' . $start_index . ',' . $p_size . ';';
151
  $results = $wpdb->get_results($query);
152
  return $results;
153
  }
154
 
155
  function validate( $values ){
156
+ global $wpdb, $frm_field, $frm_entry_meta;
157
 
158
  $errors = array();
159
 
166
  }
167
 
168
  if( !isset($values['item_key']) or $values['item_key'] == '' )
169
+ $_POST['item_key'] = FrmAppHelper::get_unique_key('', $this->table_name, 'item_key');
 
 
 
170
 
171
  if (isset($values['item_meta'])){
172
  foreach($values['item_meta'] as $key => $value){
173
  $field = $frm_field->getOne($key);
174
+ if ($field->required == '1' and ($field->form_id == $values['form_id'])){
175
  $field_options = unserialize($field->field_options);
176
+
177
+ if ($values['item_meta'][$key] == null or $values['item_meta'][$key] == '' or (isset($field_options['default_blank']) and $field_options['default_blank'] and $value == $field->default_value))
178
+ $errors['field'.$field->id] = ($field_options['blank'] == 'Untitled cannot be blank' || $field_options['blank'] == '')?($field->name." can't be blank"):$field_options['blank'];
179
  }
180
  $errors = apply_filters('frm_validate_field_entry', $errors, $key, $value);
181
  }
197
  }
198
  }
199
 
200
+ if ( empty($errors) && function_exists( 'akismet_http_post' ) && (get_option('wordpress_api_key') || $wpcom_api_key) && $this->akismet($values)){
201
+ global $frm_form;
202
+ $form = $frm_form->getOne($field->form_id);
203
+ $form_options = stripslashes_deep(unserialize($form->options));
204
+
205
+ if (isset($form_options['akismet']) && $form_options['akismet'])
206
+ $errors['spam'] = 'Your entry appears to be spam!';
207
+ }
208
+
209
  return $errors;
210
  }
211
 
212
+ //Check entries for spam -- returns true if is spam
213
+ function akismet($values) {
214
+ global $akismet_api_host, $akismet_api_port, $frm_blogurl;
215
+
216
+ $content = '';
217
+ foreach ( $values as $val ) {
218
+ if ( $content != '' )
219
+ $content .= "\n\n";
220
+ $content .= $val;
221
+ }
222
+
223
+ if ($content == '')
224
+ return false;
225
+
226
+ $datas = array();
227
+ $datas['blog'] = $frm_blogurl;
228
+ $datas['user_ip'] = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] );
229
+ $datas['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
230
+ $datas['referrer'] = $_SERVER['HTTP_REFERER'];
231
+ $datas['comment_type'] = 'formidable';
232
+ if ( $permalink = get_permalink() )
233
+ $datas['permalink'] = $permalink;
234
+
235
+ $datas['comment_content'] = $content;
236
+
237
+ foreach ( $_SERVER as $key => $value )
238
+ if ( !in_array($key, array('HTTP_COOKIE', 'argv')) )
239
+ $datas["$key"] = $value;
240
+
241
+ $query_string = '';
242
+ foreach ( $datas as $key => $data )
243
+ $query_string .= $key . '=' . urlencode( stripslashes( $data ) ) . '&';
244
+
245
+ $response = akismet_http_post( $query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port );
246
+ return ( $response[1] == 'true' ) ? true : false;
247
+ }
248
+
249
  }
250
  ?>
classes/models/FrmEntryMeta.php CHANGED
@@ -12,10 +12,11 @@ class FrmEntryMeta{
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
  }
@@ -31,7 +32,8 @@ class FrmEntryMeta{
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
  }
@@ -44,18 +46,12 @@ class FrmEntryMeta{
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){
@@ -80,18 +76,17 @@ class FrmEntryMeta{
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){
@@ -103,7 +98,7 @@ class FrmEntryMeta{
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, ' .
@@ -111,7 +106,8 @@ class FrmEntryMeta{
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
@@ -120,8 +116,8 @@ class FrmEntryMeta{
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
@@ -131,15 +127,14 @@ class FrmEntryMeta{
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){
@@ -151,7 +146,7 @@ class FrmEntryMeta{
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}%";
@@ -159,13 +154,6 @@ class FrmEntryMeta{
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
  ?>
12
 
13
  $new_values = array();
14
  $new_values['meta_key'] = $meta_key;
15
+ $new_values['meta_value'] = trim($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
+ $new_values = apply_filters('frm_add_entry_meta', $new_values);
20
 
21
  return $wpdb->insert( $this->table_name, $new_values );
22
  }
32
  global $frm_field;
33
  $this->delete_entry_metas($item_id);
34
  foreach($values as $field_id => $meta_value){
35
+ $field = $frm_field->getOne( $field_id );
36
+ $meta_key = $field->field_key;
37
  $meta_value = maybe_serialize($values[$field_id]);
38
  $this->update_entry_meta($item_id, $field_id, $meta_key, $meta_value);
39
  }
46
 
47
  function delete_entry_meta($item_id, $field_id){
48
  global $wpdb;
49
+ return $wpdb->query("DELETE FROM {$this->table_name} WHERE field_id={$field_id} AND item_id={$item_id}");
 
 
 
50
  }
51
 
52
  function delete_entry_metas($item_id){
53
  global $wpdb;
54
+ return $wpdb->query("DELETE FROM {$this->table_name} WHERE item_id={$item_id}");
 
 
 
55
  }
56
 
57
  function get_entry_meta_by_field($item_id, $field_id, $return_var=false){
76
 
77
  function get_entry_metas($item_id){
78
  global $wpdb;
79
+ return $wpdb->get_col("SELECT meta_value FROM {$this->table_name} WHERE item_id={$item_id}");
80
+ }
81
+
82
+ function get_entry_metas_for_field($field_id){
83
+ global $wpdb;
84
+ return $wpdb->get_col("SELECT meta_value FROM {$this->table_name} WHERE field_id={$field_id}");
85
  }
86
 
87
  function get_entry_meta_info($item_id){
88
  global $wpdb;
89
+ return $wpdb->get_results("SELECT * FROM {$this->table_name} WHERE item_id={$item_id}");
 
 
 
90
  }
91
 
92
  function get_entry_meta_info_by_key($item_id, $meta_key){
98
  }
99
 
100
  function getAll($where = '', $order_by = '', $limit = ''){
101
+ global $wpdb, $frm_field, $frm_app_helper;
102
  $query = 'SELECT it.*, ' .
103
  'fi.type as field_type, ' .
104
  'fi.required as required, ' .
106
  'fi.name as field_name ' .
107
  'FROM '. $this->table_name . ' it ' .
108
  'LEFT OUTER JOIN ' . $frm_field->table_name . ' fi ON it.field_id=fi.id' .
109
+ $frm_app_helper->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
110
+
111
  if ($limit == ' LIMIT 1')
112
  $results = $wpdb->get_row($query);
113
  else
116
  }
117
 
118
  function getEntryIds($where = '', $order_by = '', $limit = ''){
119
+ global $wpdb, $frm_field, $frm_app_helper;
120
+ $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_app_helper->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
121
  if ($limit == ' LIMIT 1')
122
  $results = $wpdb->get_var($query);
123
  else
127
  }
128
 
129
  function getRecordCount($where=""){
130
+ global $wpdb, $frm_app_helper, $frm_field;
131
+ $query = "SELECT COUNT(*) FROM {$this->table_name} it LEFT OUTER JOIN {$frm_field->table_name} fi ON it.field_id=fi.id" .
132
+ $frm_app_helper->prepend_and_or_where(' WHERE ', $where);
 
133
  return $wpdb->get_var($query);
134
  }
135
 
136
  function search_entry_metas($search, $meta_key='', $operator){
137
+ global $wpdb, $frm_app_helper;
138
  if (is_array($search)){
139
  $where = '';
140
  foreach ($search as $field => $value){
146
  $where .= " meta_value {$operator} '%/{$value}/%' and";
147
  }
148
  $where .= " meta_key='{$meta_key}'";
149
+ $query = "SELECT DISTINCT item_id FROM {$this->table_name}". $frm_app_helper->prepend_and_or_where(' WHERE ', $where);
150
  }else{
151
  if ($operator == 'LIKE')
152
  $search = "%{$search}%";
154
  }
155
  return $wpdb->get_col($query, 0);
156
  }
 
 
 
 
 
157
 
 
 
158
  }
159
  ?>
classes/models/FrmField.php CHANGED
@@ -1,147 +1,132 @@
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
  ?>
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'] = FrmAppHelper::get_unique_key('', $this->table_name, '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($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 getOne( $id ){
72
+ global $wpdb;
73
+ if (is_numeric($id))
74
+ $query = "SELECT * FROM {$this->table_name} WHERE id=" . $id;
75
+ else
76
+ $query = "SELECT * FROM {$this->table_name} WHERE field_key='" . $id . "'";
77
+ return $wpdb->get_row($query);
78
+ }
79
+
80
+ function getAll($where = '', $order_by = '', $limit = ''){
81
+ global $wpdb, $frm_form, $frm_app_helper;
82
+ $query = 'SELECT fi.*, ' .
83
+ 'fr.name as form_name ' .
84
+ 'FROM '. $this->table_name . ' fi ' .
85
+ 'LEFT OUTER JOIN ' . $frm_form->table_name . ' fr ON fi.form_id=fr.id' .
86
+ $frm_app_helper->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
87
+ if ($limit == ' LIMIT 1')
88
+ $results = $wpdb->get_row($query);
89
+ else
90
+ $results = $wpdb->get_results($query);
91
+ return $results;
92
+ }
93
+
94
+ function getIds($where = '', $order_by = '', $limit = ''){
95
+ global $wpdb, $frm_form, $frm_app_helper;
96
+ $query = 'SELECT fi.id ' .
97
+ 'FROM '. $this->table_name . ' fi ' .
98
+ 'LEFT OUTER JOIN ' . $frm_form->table_name . ' fr ON fi.form_id=fr.id' .
99
+ $frm_app_helper->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
100
+ if ($limit == ' LIMIT 1')
101
+ $results = $wpdb->get_row($query);
102
+ else
103
+ $results = $wpdb->get_results($query);
104
+ return $results;
105
+ }
106
+
107
+ function validate( $values ){
108
+ global $wpdb, $frm_blogurl;
109
+
110
+ $errors = array();
111
+
112
+ if( $values['field_key'] == null or $values['field_key'] == '' ){
113
+ if( $values['name'] == null or $values['name'] == '' )
114
+ $errors[] = "Key can't be blank";
115
+ else
116
+ $_POST['field_key'] = $values['name'];
117
+ }
118
+
119
+ if( $values['name'] == null or $values['name'] == '' )
120
+ $errors[] = "Label can't be blank";
121
+
122
+ if( $values['type'] == null or $values['type'] == '' ){
123
+ $errors[] = "Type can't be blank";
124
+ }else{
125
+ if(($values['type'] == 'select' or $values['type'] == 'radio') and ($values['options'] == null or $values['options'] == ''))
126
+ $errors[] = "Options cannot be blank for that field type";
127
+ }
128
+
129
+ return $errors;
130
+ }
131
  }
132
  ?>
classes/models/FrmForm.php CHANGED
@@ -18,6 +18,14 @@ class FrmForm{
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 );
@@ -26,7 +34,7 @@ class FrmForm{
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
 
@@ -65,6 +73,11 @@ class FrmForm{
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();
@@ -76,13 +89,24 @@ class FrmForm{
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
 
@@ -107,8 +131,8 @@ class FrmForm{
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
  }
@@ -134,16 +158,14 @@ class FrmForm{
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 . '";';
@@ -160,8 +182,8 @@ class FrmForm{
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
@@ -169,28 +191,8 @@ class FrmForm{
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'] == '' ){
@@ -198,14 +200,10 @@ class FrmForm{
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
  ?>
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
+ $options = array();
22
+ $options['email_to'] = isset($values['options']['email_to']) ? $values['options']['email_to'] : '';
23
+ $options['submit_value'] = isset($values['options']['submit_value']) ? $values['options']['submit_value'] : 'Submit';
24
+ $options['success_msg'] = isset($values['options']['success_msg']) ? $values['options']['success_msg'] : '';
25
+ $options['akismet'] = isset($values['options']['akismet']) ? 1 : 0;
26
+ $options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
27
+ $options['after_html'] = isset($values['options']['after_html']) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html('after');
28
+ $new_values['options'] = serialize($options);
29
  $new_values['created_at'] = current_time('mysql', 1);
30
 
31
  $query_results = $wpdb->insert( $this->table_name, $new_values );
34
  }
35
 
36
  function duplicate( $id, $template=false ){
37
+ global $wpdb, $frm_form, $frm_field;
38
 
39
  $values = $frm_form->getOne( $id );
40
 
73
 
74
  $options = array();
75
  $options['email_to'] = isset($values['options']['email_to']) ? $values['options']['email_to'] : '';
76
+ $options['submit_value'] = isset($values['options']['submit_value']) ? $values['options']['submit_value'] : 'Submit';
77
+ $options['success_msg'] = isset($values['options']['success_msg']) ? $values['options']['success_msg'] : '';
78
+ $options['akismet'] = isset($values['options']['akismet']) ? 1 : 0;
79
+ $options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
80
+ $options['after_html'] = isset($values['options']['after_html']) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html('after');
81
  $options = apply_filters('frm_form_options_before_update', $options, $values);
82
 
83
  $new_values = array();
89
 
90
  $query_results = $wpdb->update( $this->table_name, $new_values, array( 'id' => $id ) );
91
 
92
+ $all_fields = $frm_field->getAll("fi.form_id=$id");
93
+ if ($all_fields && isset($values['item_meta'])){
94
+ $existing_keys = array_keys($values['item_meta']);
95
+ foreach ($all_fields as $fid){
96
+ if (!in_array($fid->id, $existing_keys))
97
+ $values['item_meta'][$fid->id] = '';
98
+ }
99
+ foreach ($values['item_meta'] as $field_id => $default_value){
100
+ $field = $frm_field->getOne($field_id);
101
+ $field_options = unserialize($field->field_options);
102
  foreach (array('size','max','label','invalid','required_indicator','blank') as $opt)
103
+ $field_options[$opt] = isset($values['field_options'][$opt.'_'.$field_id]) ? trim($values['field_options'][$opt.'_'.$field_id]) : '';
104
+ $field_options['custom_html'] = isset($values['field_options']['custom_html_'.$field_id]) ? $values['field_options']['custom_html_'.$field_id] : FrmFieldsHelper::get_default_html($field->type);
105
+ $field_options = apply_filters('frm_update_field_options', $field_options, $field_id, $values);
106
+ $default_value = maybe_serialize($values['item_meta'][$field_id]);
107
+ $field_key = (isset($values['field_options']['field_key_'.$field_id]))? $values['field_options']['field_key_'.$field_id] : $field->field_key;
108
+ $field_type = (isset($values['field_options']['type_'.$field_id]))? $values['field_options']['type_'.$field_id] : $field->type;
109
+ $frm_field->update($field_id, array('field_key' => $field_key, 'type' => $field_type, 'default_value' => $default_value, 'field_options' => $field_options));
110
  }
111
  }
112
 
131
  $link_id = prli_create_pretty_link(FrmFormsHelper::get_direct_link($values['form_key']), $values['form_key'], $form->name, $form->description, $group_id = '' );
132
  $wpdb->update( $this->table_name, array('prli_link_id' => $link_id), array( 'id' => $id ) );
133
  }
 
134
  }
135
+ do_action('frm_update_form', $id, $values);
136
 
137
  return $query_results;
138
  }
158
 
159
  function getName( $id ){
160
  global $wpdb;
161
+ if (is_numeric($id))
162
+ $query = 'SELECT name FROM ' . $this->table_name . ' WHERE id=' . $id;
163
+ else
164
+ $query = "SELECT name FROM {$this->table_name} WHERE form_key='{$id}'";
165
+
166
  return $wpdb->get_var($query);
167
  }
168
 
 
 
 
 
 
 
169
  function getIdByName( $name ){
170
  global $wpdb;
171
  $query = 'SELECT id FROM ' . $this->table_name . ' WHERE name="' . $name . '";';
182
  }
183
 
184
  function getAll( $where = '', $order_by = '', $limit = '' ){
185
+ global $wpdb, $frm_app_helper;
186
+ $query = 'SELECT * FROM ' . $this->table_name . $frm_app_helper->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
187
  if ($limit == ' LIMIT 1')
188
  $results = $wpdb->get_row($query);
189
  else
191
  return $results;
192
  }
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  function validate( $values ){
195
+ global $wpcom_api_key;
196
  $errors = array();
197
 
198
  /*if( $values['form_key'] == null or $values['form_key'] == '' ){
200
  $errors[] = "Key can't be blank";
201
  else
202
  $_POST['form_key'] = $values['name'];
203
+ }*/
204
+
 
 
 
 
 
205
  return apply_filters('frm_validate_form', $errors, $values);
206
  }
207
+
208
  }
209
  ?>
classes/models/FrmNotification.php CHANGED
@@ -4,9 +4,10 @@ class 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
 
@@ -22,7 +23,7 @@ class FrmNotification{
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);
@@ -55,7 +56,7 @@ MAIL_BODY;
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;
4
  add_action('frm_after_create_entry', array($this, 'entry_created'));
5
  }
6
 
7
+ function entry_created($entry_id){
8
+ global $frm_blogname, $frm_blogurl, $frm_form, $frm_entry, $frm_entry_meta;
9
 
10
+ $entry = $frm_entry->getOne($entry_id);
11
  $form = $frm_form->getOne($entry->form_id);
12
  $values = $frm_entry_meta->getAll("it.item_id = $entry->id", " ORDER BY fi.field_order");
13
 
23
  $val = maybe_unserialize($value->meta_value);
24
  if (is_array($val))
25
  $val = implode(', ', $val);
26
+ $entry_data .= $value->field_name . ': ' . $val . "\n\n";
27
  }
28
 
29
  $data = unserialize($entry->description);
56
  $header = "From: {$from_name} <{$from_email}>\r\n"; //optional headerfields
57
  $subject = html_entity_decode(strip_tags(stripslashes($subject)));
58
  $message = html_entity_decode(strip_tags(stripslashes($message)));
59
+ $signature = '';//$this->get_mail_signature();
60
 
61
  //$to_email = $user->email;
62
  //$to_name = $user->full_name;
classes/models/FrmSettings.php CHANGED
@@ -3,9 +3,10 @@ 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();
@@ -16,11 +17,16 @@ class FrmSettings{
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){
@@ -32,6 +38,13 @@ class FrmSettings{
32
 
33
  function update($params){
34
  $this->preview_page_id = (int)$params[ $this->preview_page_id_str ];
 
 
 
 
 
 
 
35
  }
36
 
37
  function store(){
3
  // Page Setup Variables
4
  var $preview_page_id;
5
  var $preview_page_id_str;
6
+ var $theme_css;
7
+ var $theme_name;
8
+ var $theme_nicename;
9
+ var $lock_keys;
10
 
11
  function FrmSettings(){
12
  $this->set_default_options();
17
  $this->preview_page_id = 0;
18
 
19
  $this->preview_page_id_str = 'frm-preview-page-id';
20
+
21
+ if(!isset($this->theme_css)){
22
+ $this->theme_css = FRM_URL.'/css/ui-lightness/jquery-ui-1.7.2.custom.css';
23
+ $this->theme_name = 'UI lightness';
24
+ }
25
+
26
+ $this->theme_nicename = sanitize_title_with_dashes($this->theme_name);
27
+
28
+ if(!isset($this->lock_keys))
29
+ $this->lock_keys = true;
30
  }
31
 
32
  function validate($params,$errors){
38
 
39
  function update($params){
40
  $this->preview_page_id = (int)$params[ $this->preview_page_id_str ];
41
+ if (isset($params[ 'frm_themepicker_css' ]))
42
+ $this->theme_css = $params[ 'frm_themepicker_css' ];
43
+
44
+ if (isset($params[ 'frm_themepicker_name' ]))
45
+ $this->theme_name = $params[ 'frm_themepicker_name' ];
46
+
47
+ $this->lock_keys = isset($params['frm_lock_keys']) ? 1 : 0;
48
  }
49
 
50
  function store(){
classes/models/FrmUpdate.php ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /** Okay, this class is not a pure model -- it contains all the functions
4
+ * necessary to successfully provide an update mechanism for FormidablePro!
5
+ */
6
+ class FrmUpdate{
7
+ var $plugin_name;
8
+ var $plugin_slug;
9
+ var $plugin_url;
10
+ var $pro_script;
11
+ var $pro_mothership;
12
+
13
+ var $pro_cred_store;
14
+ var $pro_auth_store;
15
+
16
+ var $pro_username_label;
17
+ var $pro_password_label;
18
+
19
+ var $pro_username_str;
20
+ var $pro_password_str;
21
+
22
+ var $pro_error_message_str;
23
+
24
+ var $pro_check_interval;
25
+ var $pro_last_checked_store;
26
+
27
+ var $pro_username;
28
+ var $pro_password;
29
+ var $pro_mothership_xmlrpc_url;
30
+
31
+ function FrmUpdate(){
32
+ // Where all the vitals are defined for this plugin
33
+ $this->plugin_name = FRM_PLUGIN_NAME.'/formidable.php';
34
+ $this->plugin_slug = FRM_PLUGIN_NAME;
35
+ $this->plugin_url = 'http://blog.strategy11.com/formidable-wordpress-plugin';
36
+ $this->pro_script = FRM_PATH . '/pro/'. FRM_PLUGIN_NAME .'-pro.php';
37
+ $this->pro_mothership = 'http://formidablepro.com';
38
+ $this->pro_cred_store = 'frmpro-credentials';
39
+ $this->pro_auth_store = 'frmpro-authorized';
40
+ $this->pro_last_checked_store = 'frmpro_last_checked_update';
41
+ $this->pro_username_label = __(FRM_PLUGIN_TITLE .' Pro Username', FRM_PLUGIN_NAME);
42
+ $this->pro_password_label = __(FRM_PLUGIN_TITLE .' Pro Password', FRM_PLUGIN_NAME);
43
+ $this->pro_error_message_str = __('Your '.FRM_PLUGIN_TITLE.' Pro Username or Password was Invalid', FRM_PLUGIN_NAME);
44
+
45
+ // Don't modify these variables
46
+ $this->pro_check_interval = 60*60; // Checking every hour
47
+ $this->pro_username_str = 'proplug-username';
48
+ $this->pro_password_str = 'proplug-password';
49
+ $this->pro_mothership_xmlrpc_url = $this->pro_mothership . '/xmlrpc.php';
50
+
51
+ // Retrieve Pro Credentials
52
+ $creds = get_option($this->pro_cred_store);
53
+ if($creds and is_array($creds)){
54
+ extract($creds);
55
+ $this->pro_username = ((isset($username) and !empty($username))?$username:'');
56
+ $this->pro_password = ((isset($password) and !empty($password))?$password:'');
57
+
58
+ // Plugin Update Actions -- gotta make sure the right url is used with pro ... don't want any downgrades of course
59
+ add_action('update_option_update_plugins', array($this, 'check_for_update_now')); // for WordPress 2.7
60
+ add_action('update_option__transient_update_plugins', array($this, 'check_for_update_now')); // for WordPress 2.8
61
+ add_action("admin_init", array($this, 'periodically_check_for_update'));
62
+ }
63
+ }
64
+
65
+ function pro_is_installed(){
66
+ return file_exists($this->pro_script);
67
+ }
68
+
69
+ function pro_is_authorized($force_check=false){
70
+ if( !empty($this->pro_username) and !empty($this->pro_password) ){
71
+ $authorized = get_option($this->pro_auth_store);
72
+ if(!$force_check and isset($authorized))
73
+ return $authorized;
74
+ else{
75
+ $new_auth = $this->authorize_user($this->pro_username,$this->pro_password);
76
+ update_option($this->pro_auth_store, $new_auth);
77
+ return $new_auth;
78
+ }
79
+ }
80
+
81
+ return false;
82
+ }
83
+
84
+ function pro_is_installed_and_authorized(){
85
+ return ($this->pro_is_installed() and $this->pro_is_authorized());
86
+ }
87
+
88
+ function authorize_user($username, $password){
89
+ include_once( ABSPATH . 'wp-includes/class-IXR.php' );
90
+
91
+ $client = new IXR_Client( $this->pro_mothership_xmlrpc_url );
92
+
93
+ if ( !$client->query( 'proplug.is_user_authorized', $username, $password ) )
94
+ return false;
95
+
96
+ return $client->getResponse();
97
+ }
98
+
99
+ function user_allowed_to_download(){
100
+ include_once( ABSPATH . 'wp-includes/class-IXR.php' );
101
+
102
+ $client = new IXR_Client( $this->pro_mothership_xmlrpc_url );
103
+
104
+ if ( !$client->query( 'proplug.is_user_allowed_to_download', $this->pro_username, $this->pro_password, get_option('home') ) )
105
+ return false;
106
+
107
+ return $client->getResponse();
108
+ }
109
+
110
+ function pro_cred_form(){ ?>
111
+ <div class="wrap">
112
+ <div id="icon-options-general" class="icon32"><br></div>
113
+ <h2><?php echo FRM_PLUGIN_TITLE ?>: Pro Account Information</h2>
114
+ <?php
115
+ if(isset($_POST) and isset($_POST['process_cred_form']) and $_POST['process_cred_form'] == 'Y'){
116
+ if($this->process_pro_cred_form()){
117
+ if(!$this->pro_is_installed()){
118
+ $inst_install_url = wp_nonce_url('update.php?action=upgrade-plugin&plugin=' . $this->plugin_name, 'upgrade-plugin_' . $this->plugin_name);
119
+
120
+ ?>
121
+ <div id="message" class="updated fade">
122
+ <strong><?php printf(__('Your Username & Password was accepted<br/>Now you can %1$sUpgrade Automatically!%2$s', FRM_PLUGIN_NAME), "<a href=\"{$inst_install_url}\">","</a>"); ?></strong>
123
+ </div>
124
+ <?php
125
+ }
126
+ }else{
127
+ ?>
128
+ <div class="error">
129
+ <ul>
130
+ <li><strong><?php _e('ERROR', FRM_PLUGIN_NAME); ?></strong>: <?php echo $this->pro_error_message_str; ?></li>
131
+ </ul>
132
+ </div>
133
+ <?php
134
+ }
135
+ }
136
+
137
+ $this->display_pro_cred_form(); ?>
138
+ </div>
139
+ <?php
140
+ }
141
+
142
+ function display_pro_cred_form(){
143
+ // Yah, this is the view for the credentials form -- this class isn't a true model
144
+ extract($this->get_pro_cred_form_vals());
145
+ ?>
146
+ <form name="cred_form" method="post" action="">
147
+ <input type="hidden" name="process_cred_form" value="Y">
148
+ <?php wp_nonce_field('cred_form'); ?>
149
+
150
+ <table class="form-table">
151
+ <tr class="form-field">
152
+ <td valign="top" width="15%"><?php echo $this->pro_username_label; ?>:</td>
153
+ <td width="85%">
154
+ <input type="text" name="<?php echo $this->pro_username_str; ?>" value="<?php echo $username; ?>"/>
155
+ </td>
156
+ </tr>
157
+ <tr class="form-field">
158
+ <td valign="top" width="15%"><?php echo $this->pro_password_label; ?>:</td>
159
+ <td width="85%">
160
+ <input type="password" name="<?php echo $this->pro_password_str; ?>" value="<?php echo $password; ?>"/>
161
+ </td>
162
+ </tr>
163
+ </table>
164
+ <p class="submit">
165
+ <input type="submit" name="Submit" value="<?php _e('Save', FRM_PLUGIN_NAME); ?>" />
166
+ </p>
167
+ </form>
168
+ <?php
169
+ }
170
+
171
+ function process_pro_cred_form(){
172
+ $creds = $this->get_pro_cred_form_vals();
173
+ $user_authorized = $this->authorize_user($creds['username'], $creds['password']);
174
+
175
+ if(!empty($user_authorized) and $user_authorized){
176
+ update_option($this->pro_cred_store, $creds);
177
+ update_option($this->pro_auth_store, $user_authorized);
178
+
179
+ extract($creds);
180
+ $this->pro_username = ((isset($username) and !empty($username))?$username:'');
181
+ $this->pro_password = ((isset($password) and !empty($password))?$password:'');
182
+
183
+ if(!$this->pro_is_installed())
184
+ $this->queue_update(true);
185
+ }
186
+
187
+ return $user_authorized;
188
+ }
189
+
190
+ function get_pro_cred_form_vals(){
191
+ $username = ((isset($_POST[$this->pro_username_str]))?$_POST[$this->pro_username_str]:$this->pro_username);
192
+ $password = ((isset($_POST[$this->pro_password_str]))?$_POST[$this->pro_password_str]:$this->pro_password);
193
+
194
+ return compact('username','password');
195
+ }
196
+
197
+ function get_download_url($version){
198
+ include_once( ABSPATH . 'wp-includes/class-IXR.php' );
199
+
200
+ $client = new IXR_Client( $this->pro_mothership_xmlrpc_url );
201
+
202
+ if( !$client->query( 'proplug.get_encoded_download_url', $this->pro_username, $this->pro_password, $version ) )
203
+ return false;
204
+
205
+ return base64_decode($client->getResponse());
206
+ }
207
+
208
+ function get_current_version(){
209
+ include_once( ABSPATH . 'wp-includes/class-IXR.php' );
210
+
211
+ $client = new IXR_Client( $this->pro_mothership_xmlrpc_url );
212
+
213
+ if( !$client->query( 'proplug.get_current_version' ) )
214
+ return false;
215
+
216
+ return $client->getResponse();
217
+ }
218
+
219
+ function queue_update($force=false){
220
+ static $already_set_option, $already_set_transient;
221
+
222
+ if(!is_admin())
223
+ return;
224
+
225
+ // Make sure this method doesn't check back with the mothership too often
226
+ if($already_set_option or $already_set_transient)
227
+ return;
228
+
229
+ if($this->pro_is_authorized()){
230
+ // If pro is authorized but not installed then we need to force an upgrade
231
+ if(!$this->pro_is_installed())
232
+ $force=true;
233
+
234
+ $plugin_updates = ((function_exists('get_transient'))?get_transient("update_plugins"):get_option("update_plugins"));
235
+
236
+ $curr_version = $this->get_current_version();
237
+ $installed_version = $plugin_updates->checked[$this->plugin_name];
238
+
239
+ if( $force or ( $curr_version != $installed_version ) ){
240
+ $download_url = $this->get_download_url($curr_version);
241
+
242
+ if(!empty($download_url) and $download_url and $this->user_allowed_to_download()){
243
+ if(isset($plugin_updates->response[$this->plugin_name]))
244
+ unset($plugin_updates->response[$this->plugin_name]);
245
+
246
+ $plugin_updates->response[$this->plugin_name] = new stdClass();
247
+ $plugin_updates->response[$this->plugin_name]->id = '0';
248
+ $plugin_updates->response[$this->plugin_name]->slug = $this->plugin_slug;
249
+ $plugin_updates->response[$this->plugin_name]->new_version = $curr_version;
250
+ $plugin_updates->response[$this->plugin_name]->url = $this->plugin_url;
251
+ $plugin_updates->response[$this->plugin_name]->package = $download_url;
252
+ }
253
+ }else{
254
+ if(isset($plugin_updates->response[$this->plugin_name]))
255
+ unset($plugin_updates->response[$this->plugin_name]);
256
+ }
257
+
258
+ if ( function_exists('set_transient') and !$already_set_transient ){
259
+ $already_set_transient = true;
260
+ set_transient("update_plugins", $plugin_updates); // for WordPress 2.8+
261
+ }
262
+
263
+ if( !$already_set_option ){
264
+ $already_set_option = true;
265
+ update_option("update_plugins", $plugin_updates); // for WordPress 2.7
266
+ }
267
+ }
268
+ }
269
+
270
+ function check_for_update_now(){
271
+ $this->queue_update();
272
+ }
273
+
274
+ function periodically_check_for_update(){
275
+ $last_checked = get_option($this->pro_last_checked_store);
276
+
277
+ if(!$last_checked or ((time() - $last_checked) >= $this->pro_check_interval)){
278
+ $this->queue_update();
279
+ update_option($this->pro_last_checked_store, time());
280
+ }
281
+ }
282
+ }
283
+ ?>
classes/models/FrmUtils.php DELETED
@@ -1,64 +0,0 @@
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/templates/contact.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $values = FrmFormsHelper::setup_new_vars();
4
+ $values['name'] = 'Contact Us';
5
+ $values['form_key'] = 'contact';
6
+ $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.';
7
+ $values['is_template'] = $values['default_template'] = 1;
8
+
9
+ if ($form){
10
+ $form_id = $form->id;
11
+ $frm_form->update($form_id, $values );
12
+ $form_fields = $frm_field->getAll("fi.form_id='$form_id'");
13
+ if (!empty($form_fields)){
14
+ foreach ($form_fields as $field)
15
+ $frm_field->destroy($field->id);
16
+ }
17
+ }else
18
+ $form_id = $frm_form->create( $values );
19
+
20
+
21
+ $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('text', $form_id));
22
+ $field_values['name'] = 'Name';
23
+ $field_values['required'] = 1;
24
+ $field_values['field_options']['blank'] = 'Name cannot be blank';
25
+ $frm_field->create( $field_values );
26
+
27
+
28
+ $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('email', $form_id));
29
+ $field_values['name'] = 'Email';
30
+ $field_values['required'] = 1;
31
+ $field_values['field_options']['blank'] = 'Email cannot be blank';
32
+ $field_values['field_options']['invalid'] = 'Please enter a valid email address';
33
+ $frm_field->create( $field_values );
34
+
35
+
36
+ $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('website', $form_id));
37
+ $field_values['name'] = 'Website';
38
+ $field_values['field_options']['blank'] = 'Website cannot be blank';
39
+ $field_values['field_options']['invalid'] = 'Website is an invalid format';
40
+ $frm_field->create( $field_values );
41
+
42
+
43
+ $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('text', $form_id));
44
+ $field_values['name'] = 'Subject';
45
+ $field_values['required'] = 1;
46
+ $field_values['field_options']['blank'] = 'Subject cannot be blank';
47
+ $frm_field->create( $field_values );
48
+
49
+
50
+ $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('textarea', $form_id));
51
+ $field_values['name'] = 'Message';
52
+ $field_values['required'] = 1;
53
+ $field_values['field_options']['blank'] = 'Message cannot be blank';
54
+ $frm_field->create( $field_values );
55
+
56
+
57
+ $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('captcha', $form_id));
58
+ $field_values['name'] = 'Captcha';
59
+ $field_values['field_options']['label'] = 'none';
60
+ $frm_field->create( $field_values );
61
+
62
+
63
+ ?>
classes/views/frm-entries/direct.php CHANGED
@@ -1,7 +1,11 @@
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'); ?>
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
+ <?php global $frm_settings, $frm_blogurl; ?>
5
  <link type="text/css" href="<?php echo FRM_URL; ?>/css/frm_display.css" rel="Stylesheet" />
6
+ <link type="text/css" href="<?php echo $frm_settings->theme_css; ?>" rel="Stylesheet" />
7
+ <script src="<?php echo FRM_URL; ?>/js/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
8
+ <script src="<?php echo FRM_URL; ?>/js/jquery/jquery-ui-1.7.2.min.js" type="text/javascript"></script>
9
  </head>
10
  <body>
11
  <?php require_once('frm-entry.php'); ?>
classes/views/frm-entries/form.php CHANGED
@@ -1,31 +1,43 @@
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']); ?>
 
 
 
 
 
 
 
1
+ <?php echo FrmFormsHelper::replace_shortcodes($values['before_html'], $form, $title, $description); ?>
 
 
 
2
 
 
 
 
 
 
3
  <div id="frm_form_fields">
4
+ <div>
5
+ <input type="hidden" name="form_id" value="<?php echo $form->id ?>" />
6
+ <?php if (isset($controller) && isset($plugin)){ ?>
7
+ <input type="hidden" name="controller" value="<?php echo $controller; ?>" />
8
+ <input type="hidden" name="plugin" value="<?php echo $plugin; ?>" />
9
+ <?php } ?>
10
+ <?php
11
 
12
+ if (isset($errors) && is_array($errors))
13
+ $error_keys = array_keys($errors);
14
+ $error_keys = (isset($error_keys)) ? $error_keys : array();
15
+
16
+ foreach($values['fields'] as $field){
17
+ $field_name = "item_meta[". $field['id'] ."]";
18
+ if (apply_filters('frm_show_normal_field_type', true, $field['type']))
19
+ echo FrmFieldsHelper::replace_shortcodes($field['custom_html'], $field, $error_keys);
20
+ else
21
+ do_action('frm_show_other_field_type', $field);
22
+
23
+ do_action('frm_get_field_scripts', $field);
24
+ }
25
+
26
+ global $frm_settings;
27
+ ?>
28
+ <?php if (is_admin() && !$frm_settings->lock_keys){ ?>
29
+ <div class="form_field">
30
+ <label class="frm_pos_top">Entry Key</label>
31
+ <input type="text" id="item_key" name="item_key" value="<?php echo $values['item_key'] ?>" />
32
+ </div>
33
+ <?php } ?>
34
+ </div>
35
  </div>
36
+
37
+ <?php echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form); ?>
38
+
39
+ <?php do_action('frm_entries_footer_scripts',$values['fields']); ?>
40
+ <script type="text/javascript">
41
+ function frmClearDefault(default_value,thefield){if(thefield.value==default_value)thefield.value='';}
42
+ function frmReplaceDefault(default_value,thefield){if(thefield.value=='')thefield.value=default_value;}
43
+ </script>
classes/views/frm-entries/frm-entry.php CHANGED
@@ -1,22 +1,24 @@
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)){
@@ -28,9 +30,9 @@ if($params['action'] == 'create'){
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
 
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
+ $form_options = stripslashes_deep(maybe_unserialize($form->options));
7
 
8
+ $submit = isset($form_options['submit_value'])?$form_options['submit_value']:'Submit';
9
  $failed_message = "We're sorry. There was an error processing your responses.";
10
+ $saved_message = isset($form_options['success_msg'])? $form_options['success_msg'] : "Your responses were successfully submitted. Thank you!";
11
 
12
  $params = FrmEntriesController::get_params($form);
13
  $message = '';
14
  $errors = '';
15
 
16
+ if($params['action'] == 'create' && $params['form_id'] == $form->id){
17
  $errors = $frm_entry->validate($_POST);
18
 
19
+ if( !empty($errors) ){
20
  $values = FrmEntriesHelper::setup_new_vars($fields);
21
+ require('new.php');
22
  }else{
23
  do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
24
  if (apply_filters('frm_continue_to_create', true)){
30
  }
31
  }else{
32
  do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
33
+ if (apply_filters('frm_continue_to_new', true, $params['action'])){
34
  $values = FrmEntriesHelper::setup_new_vars($fields);
35
+ require('new.php');
36
  }
37
  }
38
 
classes/views/frm-entries/new.php CHANGED
@@ -1,15 +1,15 @@
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
 
1
+ <div class="frm_forms" id="frm_form_<?php echo $form->id ?>_container">
2
  <?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
3
 
4
+ <form action="" enctype="multipart/form-data" method="post" class="frm-show-form" name="form_<?php echo $form->form_key ?>" id="form_<?php echo $form->form_key ?>">
5
+ <input type="hidden" name="action" value="create" />
 
6
 
7
  <?php require(FRM_VIEWS_PATH.'/frm-entries/form.php'); ?>
8
 
9
  <?php if (!$form->is_template){ ?>
10
  <p class="submit">
11
+ <?php if (!isset($submit)) $submit = 'Submit';?>
12
+ <input type="submit" name="<?php echo $submit ?>" value="<?php echo $submit ?>" />
13
  </p>
14
  <?php } ?>
15
 
classes/views/frm-fields/input.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($field['type'] == 'text'){ ?>
2
+ <input type="text" id="field_<?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'] ?>" <?php echo ($field['clear_on_focus']) ? 'onfocus="frmClearDefault(\''.$field['default_value'].'\', this)" onblur="frmReplaceDefault(\''.$field['default_value'].'\', this)"':''; ?>/>
3
+
4
+ <?php }else if ($field['type'] == 'textarea'){ ?>
5
+ <textarea name="<?php echo $field_name ?>" cols="<?php echo $field['size'] ?>" rows="<?php echo $field['max'] ?>" <?php echo ($field['clear_on_focus']) ? 'onfocus="frmClearDefault(\''.$field['default_value'].'\', this)" onblur="frmReplaceDefault(\''.$field['default_value'].'\', this)"':''; ?>><?php echo $field['value'] ?></textarea>
6
+
7
+ <?php }else if ($field['type'] == 'radio'){
8
+ if (is_array($field['options'])){
9
+ foreach($field['options'] as $opt){ ?>
10
+ <input type='radio' name='<?php echo $field_name ?>' value='<?php echo $opt ?>' <?php if ($field['value'] == $opt) echo 'checked="checked"'; ?>/>
11
+ <?php echo $opt ?><br/>
12
+ <?php }
13
+ } ?>
14
+ <?php }else if ($field['type'] == 'select'){?>
15
+ <select name="<?php echo $field_name ?>" id="item_meta<?php echo $field['id'] ?>">
16
+ <?php foreach ($field['options'] as $opt){ ?>
17
+ <option value='<?php echo $opt ?>' <?php if ($field['value'] == $opt) echo 'selected="selected"'; ?>><?php echo $opt ?></option>
18
+ <?php } ?>
19
+ </select>
20
+ <?php }else if ($field['type'] == 'captcha'){
21
+ global $frm_recaptcha_enabled;
22
+ if ($frm_recaptcha_enabled)
23
+ FrmAppHelper::display_recaptcha($errors);
24
+ }else if ($field['type'] == 'checkbox'){
25
+ $checked_values = stripslashes_deep(maybe_unserialize($field['value']));
26
+ foreach ($field['options'] as $opt){
27
+ $checked = ((!is_array($checked_values) && $checked_values == $opt ) || (is_array($checked_values) && in_array($opt, $checked_values)))?' checked="true"':'';
28
+ echo "<input type='checkbox' name='". $field_name ."[]' value='".$opt."'". $checked ."'/> ".$opt."<br/>";
29
+ }
30
+ }else do_action('frm_form_fields',$field, $field_name);
31
+ ?>
classes/views/frm-fields/show.php CHANGED
@@ -1,40 +1 @@
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>
1
+ <?php echo FrmFieldsHelper::replace_shortcodes($field['custom_html'], $field, $error_keys); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/views/frm-fields/single-option.php CHANGED
@@ -1,5 +1,5 @@
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>
1
  <span id="frm_delete_field_<?php echo $field['id']; ?>-<?php echo $opt_key ?>_container" class="frm_single_option">
2
+ <?php 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>
classes/views/frm-forms/add_field.php CHANGED
@@ -1,17 +1,17 @@
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
 
@@ -28,12 +28,15 @@
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'){
@@ -43,11 +46,18 @@
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
@@ -55,18 +65,18 @@ if ($display['description']){ ?>
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>
@@ -75,16 +85,16 @@ if ($display['options']){ ?>
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); ?>
@@ -92,10 +102,11 @@ if ($display['options']){ ?>
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",
@@ -106,11 +117,9 @@ if ($display['options']){ ?>
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>
1
+ <?php $display = apply_filters('frm_display_field_options', array('type' => $field['type'], 'field_data' => $field, 'required' => true, 'description' => true, 'options' => true, 'label_position' => true, 'invalid' => false, 'size' => false, 'clear_on_focus' => false, 'default_blank' => true)); ?>
2
+
3
  <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'] ?>">
4
  <span class="ui-icon ui-icon-arrowthick-2-n-s alignright"></span>
5
+ <a href="javascript:void(0);" class="ui-icon ui-icon-trash alignright" id="frm_delete_field<?php echo $field['id']; ?>" title="Delete Field"></a>
6
  <?php if ($display['required']){ ?>
7
  <span id="require_field_<?php echo $field['id']; ?>">
8
+ <a href="javascript:frm_mark_required( <?php echo $field['id']; ?>, <?php echo $field_required = ($field['required'] == '0')?('0'):('1'); ?>)" class="ui-icon ui-icon-star alignleft frm_required<?php echo $field_required ?>" id="req_field_<?php echo $field['id']; ?>" title="Mark as <?php echo ($field['required'] == '0')?'':'not '; ?>Required"></a>
9
  </span>
10
  <?php } ?>
11
  <div class="frm_ipe_field_label frm_pos_<?php echo $field['label']; ?>" id="field_<?php echo $field['id']; ?>"><?php echo $field['name'] ?></div>
12
 
13
  <?php if ($display['type'] == 'text'){ ?>
14
+ <input type="text" name="<?php echo $field_name ?>" value="<?php echo $field['default_value']; ?>" size="<?php echo $field['size']; ?>"/>
 
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
 
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>
32
+ <?php if ($display['default_blank']) FrmFieldsHelper::show_default_blank_js($field['id'], $field['default_blank']); ?>
33
+ <br/>
34
  <?php foreach ($field['options'] as $opt_key => $opt)
35
  require(FRM_VIEWS_PATH.'/frm-fields/single-option.php');
36
  ?>
37
  <div id="frm_add_field_<?php echo $field['id']; ?>">
38
  <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>
39
+ <?php do_action('frm_add_multiple_opts', $field); ?>
40
  </div>
41
 
42
  <?php }else if ($field['type'] == 'captcha'){
46
  <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>
47
  <input type="hidden" name="<?php echo $field_name ?>" value="1"/>
48
  <?php }else
49
+ echo 'Please download and activate the WP reCAPTCHA plugin to enable this feature.';
50
 
51
  }else
52
  do_action('frm_display_added_fields',$field);
53
 
54
+ if ($display['clear_on_focus']){
55
+ FrmFieldsHelper::show_onfocus_js($field['id'], $field['clear_on_focus']);
56
+
57
+ if ($display['default_blank'])
58
+ FrmFieldsHelper::show_default_blank_js($field['id'], $field['default_blank']);
59
+ }
60
+
61
  if ($display['description']){ ?>
62
  <div class="frm_ipe_field_desc description" id="field_<?php echo $field['id']; ?>"><?php echo $field['description']; ?></div>
63
  <?php
65
 
66
  if ($display['options']){ ?>
67
  <div class="postbox">
68
+ <h3 class="trigger">Field Options:</h3>
69
  <div class="toggle_container inside">
70
+ <?php if ($display['size']){ ?>
71
  <p><label><?php echo ($field['type'] == 'textarea' || $field['type'] == 'rte')?'Columns':'Field Size' ?></label>
72
  <input type="text" name="field_options[size_<?php echo $field['id'] ?>]" value="<?php echo $field['size']; ?>" size="5">
73
+
74
+ <label class="nofloat"><?php echo ($field['type'] == 'textarea' || $field['type'] == 'rte')?'Rows':'Max length of input' ?></label>
75
  <input type="text" name="field_options[max_<?php echo $field['id'] ?>]" value="<?php echo $field['max']; ?>" size="5">
76
  </p>
77
+ <?php } ?>
78
  <?php if ($display['label_position']){ ?>
79
+ <p><label>Label Position:</label>
80
  <select name="field_options[label_<?php echo $field['id'] ?>]">
81
  <option value="top"<?php echo ($field['label'] == 'top')?(' selected="true"'):(''); ?>>Top</option>
82
  <option value="left"<?php echo ($field['label'] == 'left')?(' selected="true"'):(''); ?>>Left</option>
85
  </p>
86
  <?php } ?>
87
  <?php if ($display['required']){ ?>
88
+ <p><label>Indicate required field with:</label>
89
  <input type="text" name="field_options[required_indicator_<?php echo $field['id'] ?>]" value="<?php echo $field['required_indicator']; ?>">
90
  </p>
91
+ <p><label>Error message if required field is left blank:</label>
92
+ <input type="text" name="field_options[blank_<?php echo $field['id'] ?>]" value="<?php echo $field['blank']; ?>" size="50">
93
  </p>
94
  <?php } ?>
95
+ <?php if ($display['invalid']){ ?>
96
+ <p><label>Error message if entry is an invalid format:</label>
97
+ <input type="text" name="field_options[invalid_<?php echo $field['id'] ?>]" value="<?php echo $field['invalid']; ?>" size="50">
98
  </p>
99
  <?php } ?>
100
  <?php do_action('frm_field_options_form', $field, $display); ?>
102
  </div>
103
  <?php } ?>
104
  </li>
105
+
106
  <script type="text/javascript">
107
  jQuery(document).ready(function() {
108
  jQuery("#frm_delete_field<?php echo $field['id']; ?>").click(function(){
109
+ if(confirm("<?php _e('Are you sure you want to delete this field and all data associated with it?', FRM_PLUGIN_NAME); ?>")){
110
  jQuery.ajax({
111
  type:"POST",
112
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
117
  }
118
  });
119
  return false;
120
+ }
121
  });
122
 
123
  function callback(){setTimeout(function(){jQuery("#frm_delete_field<?php echo $field['id']; ?>:hidden").removeAttr('style').hide().fadeIn();}, 1000);};
 
 
 
124
  });
125
  </script>
classes/views/frm-forms/add_field_links.php CHANGED
@@ -17,9 +17,9 @@
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
 
@@ -41,9 +41,15 @@
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>
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 && !function_exists( 'akismet_http_post' )){
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. Alternatively activate Akismet for captcha-free spam screening.</p>';
23
  } ?>
24
  </ul>
25
 
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><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></span> = clear default data on click</li>
45
+ <li><span class="frm_inactive_icon"><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></span> = do not clear default data on click</li>
46
+ <li><span><img src="<?php echo FRM_IMAGES_URL?>/error.png"></span> = default value will NOT pass validation</li>
47
+ <li><span class="frm_inactive_icon"><img src="<?php echo FRM_IMAGES_URL?>/error.png"></span> = default value will pass validation</li>
48
  <li><span class="ui-icon ui-icon-trash alignleft"></span> = delete field and all inputed data</li>
49
  </ul>
50
+
51
  <p class="howto">Enter or select default values into fields on this form.</p>
52
+ <?php do_action('frm_extra_form_instructions'); ?>
53
  </div>
54
 
55
  <script>
classes/views/frm-forms/default-templates.php CHANGED
@@ -20,6 +20,10 @@
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>
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
+ <?php global $frm_settings;
24
+ if ($frm_settings->preview_page_id > 0)
25
+ $url = add_query_arg('form', $form->form_key, get_permalink($frm_settings->preview_page_id));
26
+ ?>
27
  <a href="<?php echo $url ?>" title="View <?php echo stripslashes($form->name); ?>" target="blank">View</a>
28
  </div>
29
  </td>
classes/views/frm-forms/edit.php CHANGED
@@ -7,7 +7,7 @@
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'); ?>
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="">
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'); ?>
classes/views/frm-forms/footer.php CHANGED
@@ -1,37 +1,150 @@
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>
1
  <script type="text/javascript">
2
+ jQuery(document).ready(function($){
3
+ $(".frm_ipe_field_option").editInPlace({
4
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
5
+ params:"action=frm_field_option_ipe",
6
+ show_buttons:true,
7
+ default_text:'(Blank)'
8
+ });
9
 
10
+ $(".frm_ipe_field_option_select").editInPlace({
11
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
12
+ params:"action=frm_field_option_ipe",
13
+ show_buttons:true,
14
+ default_text:'(Blank)'
15
  });
16
 
17
+ $(".frm_delete_field_option").click(function(){
18
+ var thisid=this.getAttribute('id');
19
+ jQuery.ajax({
20
+ type:"POST",url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
21
+ data:"action=frm_delete_field_option&field="+thisid,
22
+ success:function(msg){ $('#'+thisid+'_container').hide('highlight');}
23
+ });
24
+ return false;
25
+ });
26
 
27
+ $(".frm_ipe_form_name").editInPlace({
28
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
29
+ params:"action=frm_form_name_in_place_edit&form_id=<?php echo $id; ?>",
30
+ value_required:"true",
31
+ show_buttons:true
32
+ });
33
+
34
+ $(".frm_ipe_form_desc").editInPlace({
35
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
36
+ params:"action=frm_form_desc_in_place_edit&form_id=<?php echo $id; ?>",
37
+ field_type:"textarea",
38
+ show_buttons:true,
39
+ textarea_rows:3,
40
+ textarea_cols:60,
41
+ default_text:"(Click here to add form description or instructions)"
42
+ });
43
+ $(".frm_ipe_field_label").editInPlace({
44
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
45
+ params:"action=frm_field_name_in_place_edit",
46
+ value_required:"true",
47
+ show_buttons:true
48
+ });
49
 
50
+ $(".frm_ipe_field_desc").editInPlace({
51
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
52
+ params:"action=frm_field_desc_in_place_edit",
53
+ default_text:"(Click here to add optional description or instructions)",
54
+ show_buttons:true,
55
+ field_type:'textarea',
56
+ textarea_rows:1
57
+ });
58
 
59
+ $(".frm_add_field_option").click(function(){
60
+ var thisid=this.getAttribute('id');
61
+ jQuery.ajax({
62
+ type:"POST",
63
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
64
+ data:"action=frm_add_field_option&field="+thisid,
65
+ success:function(msg){ $('#frm_add_'+thisid).before(msg);}
66
+ });
67
+ return false;
68
+ });
69
 
70
+ $("#new_fields").sortable({
71
+ cursor:'move',
72
+ accepts:'field_type_list',
73
+ revert:true,
74
  receive:function(event,ui){
75
  var new_id = (ui.item).attr('id');
76
+ jQuery('#new_fields .frmbutton#'+new_id).replaceWith('<img class="frmbutton frmbutton_loadingnow" id="' + new_id + '" src="<?php echo FRM_IMAGES_URL; ?>/ajax_loader.gif" alt="<?php _e('Loading...', FRM_PLUGIN_NAME); ?>" />');
77
+ jQuery.ajax({
78
+ type:"POST",
79
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
80
  data:"action=frm_insert_field&form_id=<?php echo $id; ?>&position="+ui.position+"&field="+new_id,
81
+ success:function(msg){ $('.frmbutton_loadingnow#'+new_id).replaceWith(msg);}
82
  });
83
  },
84
+ update:function(){
85
+ var order= $('#new_fields').sortable('serialize');
86
+ jQuery.ajax({
87
+ type:"POST",
88
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
89
+ data:"action=frm_update_field_order&"+order
90
+ });
91
+ }
92
+ });
93
+
94
  });
95
  jQuery('.field_type_list > li').draggable({connectToSortable:'#new_fields',cursor:'move',helper:'clone',revert:'invalid',delay:10});
96
  jQuery("ul.field_type_list, .field_type_list li").disableSelection();
97
 
98
+ //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;};
99
+
100
+ function frm_mark_required(field_id, required){
101
+ var thisid= 'req_field_' + field_id;
102
+ if (required == '0')
103
+ var switch_to = '1';
104
+ else
105
+ var switch_to = '0';
106
+ jQuery('#'+thisid).replaceWith('<img id="' + thisid + '" class="ui-icon alignleft" src="<?php echo FRM_IMAGES_URL; ?>/required_loader.gif" alt="<?php _e('Loading...', FRM_PLUGIN_NAME); ?>" />');
107
+ jQuery.ajax({
108
+ type:"POST",
109
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
110
+ data:"action=frm_mark_required&field="+field_id+"&required="+switch_to,
111
+ success:function(msg){ jQuery('#'+thisid).replaceWith('<a href="javascript:frm_mark_required( '+field_id+', '+switch_to+')" class="ui-icon ui-icon-star alignleft frm_required'+switch_to+'" id="'+thisid+'"></a>');}
112
+ });
113
+ };
114
+
115
+ function frm_clear_on_focus(field_id, active){
116
+ var thisid= 'clear_field_' + field_id;
117
+ if (active == '1'){
118
+ var switch_to = '0';
119
+ var new_class = 'frm_inactive_icon';
120
+ }else{
121
+ var switch_to = '1';
122
+ var new_class = '';
123
+ }
124
+ jQuery('#'+thisid).replaceWith('<img id="' + thisid + '" src="<?php echo FRM_IMAGES_URL; ?>/wpspin_light.gif" alt="<?php _e('Loading...', FRM_PLUGIN_NAME); ?>" />');
125
+ jQuery.ajax({
126
+ type:"POST",
127
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
128
+ data:"action=frm_clear_on_focus&field="+field_id+"&active="+switch_to,
129
+ success:function(msg){ jQuery('#'+thisid).replaceWith('<a href="javascript:frm_clear_on_focus( '+field_id+', '+switch_to+')" class="'+new_class +'" id="'+thisid+'"><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></a>');}
130
+ });
131
+ };
132
+
133
+ function frm_default_blank(field_id, active){
134
+ var thisid= 'default_blank_' + field_id;
135
+ if (active == '1'){
136
+ var switch_to = '0';
137
+ var new_class = 'frm_inactive_icon';
138
+ }else{
139
+ var switch_to = '1';
140
+ var new_class = '';
141
+ }
142
+ jQuery('#'+thisid).replaceWith('<img id="' + thisid + '" src="<?php echo FRM_IMAGES_URL; ?>/wpspin_light.gif" alt="<?php _e('Loading...', FRM_PLUGIN_NAME); ?>" />');
143
+ jQuery.ajax({
144
+ type:"POST",
145
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
146
+ data:"action=frm_default_blank&field="+field_id+"&active="+switch_to,
147
+ success:function(msg){ jQuery('#'+thisid).replaceWith('<a href="javascript:frm_default_blank( '+field_id+', '+switch_to+')" class="'+new_class +'" id="'+thisid+'"><img src="<?php echo FRM_IMAGES_URL?>/error.png"></a>');}
148
+ });
149
+ };
150
  </script>
classes/views/frm-forms/form.php CHANGED
@@ -1,5 +1,4 @@
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>
@@ -7,7 +6,7 @@
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');
@@ -18,11 +17,13 @@ if (isset($values['fields'])){
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>
@@ -30,7 +31,60 @@ if (isset($values['fields'])){
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 } ?>
1
 
 
2
  <div id="form_desc" class="edit_form_item frm_field_box frm_head_box">
3
  <h2 class="frm_ipe_form_name" id="frmform_<?php echo $id; ?>"><?php echo $values['name']; ?></h2>
4
  <div class="frm_ipe_form_desc"><?php echo wpautop($values['description']); ?></div>
6
 
7
  <ul id="new_fields">
8
  <?php
9
+ if (isset($values['fields']) && !empty($values['fields'])){
10
  foreach($values['fields'] as $field){
11
  $field_name = "item_meta[". $field['id'] ."]";
12
  require('add_field.php');
17
  <?php if (!$values['is_template']){ ?>
18
  <div class="postbox">
19
  <h3 class="trigger">Advanced Form Options</h3>
20
+ <div class="toggle_container inside">
21
+ <span class="alignright"><a title="<?php _e("Edit HTML" , FRM_PLUGIN_NAME) ?>" href="#TB_inline?height=500&width=700&inlineId=frm_editable_html" class="thickbox button"><?php _e("Edit HTML" , FRM_PLUGIN_NAME) ?></a></span>
22
+
23
+ <p style="clear:both;"><label>Form ShortCodes:</label>
24
  [formidable id=<?php echo $id; ?> title=true description=true] [formidable key=<?php echo $values['form_key']; ?>]
25
  </p>
26
+
27
  <p><label>Form Key</label>
28
  <input type="text" name="form_key" value="<?php echo $values['form_key']; ?>" />
29
  </p>
31
  <p><label>Email Form Responses to</label>
32
  <input type="text" name="options[email_to]" value="<?php echo $values['email_to']; ?>" />
33
  </p>
34
+
35
+ <p><label>New Entry Submit Button Label</label>
36
+ <input type="text" name="options[submit_value]" value="<?php echo $values['submit_value']; ?>" />
37
+ </p>
38
+
39
+ <p><label>New Entry Success Message</label>
40
+ <input type="text" name="options[success_msg]" size="55" value="<?php echo $values['success_msg']; ?>" />
41
+ </p>
42
+
43
  <?php do_action('frm_additional_form_options', $values); ?>
44
+
45
+ <?php if (function_exists( 'akismet_http_post' )){ ?>
46
+ <p><input type="checkbox" name="options[akismet]" id="akismet" value="1" <?php checked($values['akismet'], 1); ?> /> Use Akismet to check entries for spam</p>
47
+ <?php } ?>
48
  </div>
49
  </div>
50
+ <div id="frm_editable_html" style="display:none;">
51
+ <div class="alignleft" style="width:500px">
52
+ <p><label class="frm_pos_top">Before Fields</label>
53
+ <textarea name="options[before_html]" rows="4" style="width:100%"><?php echo $values['before_html']?></textarea></p>
54
+
55
+ <div id="add_html_fields">
56
+ <?php
57
+ if (isset($values['fields'])){
58
+ foreach($values['fields'] as $field){
59
+ if (apply_filters('frm_show_normal_field_type', true, $field['type'])){ ?>
60
+ <p><label class="frm_pos_top"><?php echo $field['name'] ?></label>
61
+ <textarea name="field_options[custom_html_<?php echo $field['id'] ?>]" rows="7" style="width:100%"><?php echo $field['custom_html'] ?></textarea></p>
62
+ <?php }
63
+ }
64
+ } ?>
65
+ </div>
66
+
67
+ <p><label class="frm_pos_top">After Fields</label>
68
+ <textarea name="options[after_html]" rows="3" style="width:100%"><?php echo $values['after_html']?></textarea></p>
69
+ </div>
70
+
71
+ <div class="alignright" style="width:150px;">
72
+ <h4>Key</h4>
73
+ <ul>
74
+ <li><b>Form Name:</b> [form_name]</li>
75
+ <li><b>Form Description:</b> [form_description]</li>
76
+ </ul>
77
+ <ul>
78
+ <li><b>Field Id:</b> [id]</li>
79
+ <li><b>Field Key:</b> [key]</li>
80
+ <li><b>Field Name:</b> [field_name]</li>
81
+ <li><b>Field Description:</b> [description]</li>
82
+ <li><b>Label Position:</b> [label_position]</li>
83
+ <li><b>Required label:</b> [required_label]</li>
84
+ <li><b>Input Field:</b> [input]</li>
85
+ <li><b>Add class name if field is required:</b> [required_class]</li>
86
+ <li><b>Add class name if field has an error on form submit:</b> [error_class]</li>
87
+ </ul>
88
+ </div>
89
+ </div>
90
  <?php } ?>
classes/views/frm-forms/list.php CHANGED
@@ -9,7 +9,7 @@
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'); ?>
@@ -29,12 +29,13 @@
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{
@@ -52,7 +53,7 @@
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>
@@ -61,18 +62,21 @@
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
@@ -91,6 +95,7 @@
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>
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="">
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'); ?>
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
+ <th class="manage-column" width="115px">ShortCode</th>
33
  <?php } ?>
34
  </tr>
35
  </thead>
36
  <?php if($record_count <= 0){ ?>
37
  <tr>
38
+ <td colspan="<?php echo ($params['template'])? '2':'7'; ?>">No Forms Found</td>
39
  </tr>
40
  <?php
41
  }else{
53
  </div>
54
  </td>
55
  <td><?php echo $form->description ?></td>
56
+ <?php }else{ ?>
57
  <td><?php do_action('frm_first_col', $form->id); ?> <?php echo $form->id ?></td>
58
  <td class="edit_item">
59
  <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>
62
  <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&action=edit&id=<?php echo $form->id; ?>" title="Edit <?php echo $form->name; ?>">Edit</a> |
63
  <?php if($frmpro_is_installed){ ?>
64
  <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> |
65
+ <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>-entries&form=<?php echo $form->id; ?>" title="<?php echo $form->name; ?> Entries">Entries</a> |
66
+ <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>-reports&form=<?php echo $form->id; ?>" title="<?php echo $form->name; ?> Reports">Reports</a> |
67
  <?php } ?>
68
  <a href="?page=<?php echo FRM_PLUGIN_NAME; ?>&action=duplicate&id=<?php echo $form->id; ?>" title="Copy <?php echo $form->name; ?>">Duplicate</a> |
69
  <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> |
70
  <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>
71
  </div>
72
  </td>
73
+ <td><?php echo stripslashes($form->description) ?></td>
74
  <td><?php echo $form->form_key ?></td>
75
  <td><?php echo apply_filters('frm_view_entries_link', $frm_entry->getRecordCount("it.form_id=$form->id") . ' Entries', $form->id); ?></td>
76
  <td>
77
+ <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</a>
78
+ </td>
79
+ <td><input type='text' style="font-size: 10px; width: 100%;" readonly="true" onclick='this.select();' onfocus='this.select();' value='[formidable id=<?php echo $form->id; ?>]' /></td>
80
  <?php } ?>
81
  </tr>
82
  <?php
95
  <th class="manage-column">Key</th>
96
  <th class="manage-column">Entries</th>
97
  <th class="manage-column">Direct Link</th>
98
+ <th class="manage-column">ShortCode</th>
99
  <?php } ?>
100
  </tr>
101
  </tfoot>
classes/views/frm-forms/new.php CHANGED
@@ -8,7 +8,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'); ?>
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="">
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'); ?>
classes/views/frm-settings/form.php CHANGED
@@ -1,5 +1,5 @@
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'); ?>
@@ -7,17 +7,20 @@
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">
1
  <div class="wrap">
2
+ <div id="icon-options-general" class="icon32"><br></div>
3
  <h2><?php echo FRM_PLUGIN_TITLE ?>: Settings</h2>
4
 
5
  <?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
7
  <?php require(FRM_VIEWS_PATH.'/shared/nav.php'); ?>
8
 
9
 
10
+ <form name="frm_settings_form" method="post" action="">
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 FrmAppHelper::wp_pages_dropdown( $frm_settings->preview_page_id_str, $frm_settings->preview_page_id )?>
19
  </td>
20
+ </tr>
21
+
22
+ <?php do_action('frm_settings_form', $frm_settings); ?>
23
+
24
  </table>
25
 
26
  <p class="submit">
classes/views/frm-settings/pro-settings.php DELETED
@@ -1,51 +0,0 @@
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/shared/errors.php CHANGED
@@ -1,11 +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 } ?>
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) && is_array($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 CHANGED
@@ -1,6 +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)
 
 
1
  <?php
2
+ if (isset($css_file)){
3
+ if (is_array($css_file)){
4
+ foreach ($css_file as $file_id => $file)
5
+ echo '<link rel="Stylesheet" id="'.$file_id.'" href="'. $file .'" type="text/css" />';
6
+ }else{?>
7
+ <link rel="stylesheet" href="<?php echo $css_file; ?>" type="text/css" />
8
+ <?php }
9
+ }
10
+
11
  if (isset($js_file)){
12
  if (is_array($js_file)){
13
  foreach ($js_file as $file)
classes/views/shared/item-table-nav.php CHANGED
@@ -61,23 +61,7 @@
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>
61
  </div>
62
  <?php }
63
 
64
+ do_action('frm_before_table', $footer, $params['form']); ?>
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  </div>
67
  <div style="clear:both;"></div>
classes/views/shared/nav.php CHANGED
@@ -3,6 +3,7 @@
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>
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
+ <?php do_action('frm_nav_items'); ?>
7
  </ul>
8
  </div>
9
  <div style="clear:both;"></div>
css/frm_admin.css CHANGED
@@ -1,24 +1,8 @@
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;}
@@ -53,21 +37,27 @@ ul.pane li {padding: 0px; margin: 0px;}
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
  }
@@ -76,6 +66,6 @@ ul.pane li {padding: 0px; margin: 0px;}
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;}
1
+ .options-table {width: 67%; margin-top: 10px;}
2
+ .options-table td {padding: 10px; background-color: #f4f0db;}
3
+ .options-table h3 {padding: 0px; margin: 0px; padding-left: 10px;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
+ .pane {background-color: #f4f0db; padding-left: 10px;}
6
  ul.pane li {padding: 0px; margin: 0px;}
7
 
8
  .edit_item {height: 50px;}
37
  .frm_form_builder{width:60%;}
38
  #frm_form_options{width:250px;}
39
 
40
+ .frm_form_builder a:hover{text-decoration:underline;}
41
+
42
  .frm_field_box{padding:5px;}
43
 
44
  .frm_pos_top{display:block;}
45
  .frm_pos_left{float:left;}
46
+ .frm_pos_none, .form-wrap label.frm_pos_none{display:none;}
47
  .frm_spacer{float:left; width:16px; height:16px;}
48
+ .frm_charts object{background:transparent;}
49
 
50
  .postbox{margin-bottom:5px;}
51
  .postbox h3{cursor:pointer;}
52
+ .postbox label{float:left; width:150px; text-align:right; padding-right:5px; clear:both;}
53
+ .postbox label.nofloat{clear:none; float:none; margin-left:10px;}
54
  .edit_form_item .postbox, .edit_form_item .ui-icon-arrowthick-2-n-s, .edit_form_item .ui-icon-trash{display:none;}
 
55
  #new_fields span.ui-icon{width:16px;}
56
 
57
+
58
  .ui-icon-arrowthick-2-n-s{cursor:move;}
59
 
60
+ .frm_inactive_icon, .frm_required0{
61
  opacity:.2;
62
  filter:alpha(opacity=20);
63
  }
66
 
67
  .frm_10radio{margin-right:10px; text-align:center; float:left;}
68
 
69
+ #new_fields .ui-state-default{border:none; padding:6px 6px 39px 6px; font-weight:normal; background-image:none; background-color:transparent;}
70
+ #new_fields .ui-state-default.frm_hide_options{padding-bottom:6px;}
71
+ #new_fields .ui-state-default:hover{border:1px solid #ccc; padding:5px;}
formidable.php CHANGED
@@ -1,14 +1,13 @@
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);
@@ -16,21 +15,13 @@ 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;
@@ -64,24 +55,25 @@ 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");
@@ -89,12 +81,14 @@ 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();
@@ -116,6 +110,11 @@ $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;
@@ -133,16 +132,15 @@ $frm_field_selection = array(
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',
@@ -150,17 +148,16 @@ $frm_pro_field_selection = array(
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
  ?>
1
  <?php
2
  /*
3
  Plugin Name: Formidable
4
+ Description: Quickly and easily create drag-and-drop forms
5
+ Version: 1.0.12
6
  Plugin URI: http://blog.strategy11.com/formidable-wordpress-plugin
7
  Author URI: http://blog.strategy11.com
8
  Author: Stephanie Wells
9
  */
10
 
 
11
  define('FRM_PLUGIN_TITLE','Formidable');
12
  define('FRM_PLUGIN_NAME','formidable');
13
  define('FRM_PATH',WP_PLUGIN_DIR.'/'.FRM_PLUGIN_NAME);
15
  define('FRM_VIEWS_PATH',FRM_PATH.'/classes/views');
16
  define('FRM_HELPERS_PATH',FRM_PATH.'/classes/helpers');
17
  define('FRM_CONTROLLERS_PATH',FRM_PATH.'/classes/controllers');
18
+ define('FRM_TEMPLATES_PATH',FRM_PATH.'/classes/templates');
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
+ define('FRM_IMAGES_URL',FRM_URL.'/images');
22
 
23
  require_once(FRM_MODELS_PATH.'/FrmSettings.php');
24
 
 
 
 
 
 
 
 
 
 
 
25
  // Check for WPMU installation
26
  if (!defined ('IS_WPMU')){
27
  global $wpmu_version;
55
  require_once(FRM_MODELS_PATH.'/FrmEntry.php');
56
  require_once(FRM_MODELS_PATH.'/FrmEntryMeta.php');
57
  require_once(FRM_MODELS_PATH.'/FrmNotification.php');
58
+ require_once(FRM_MODELS_PATH.'/FrmUpdate.php');
59
 
60
  global $frm_field;
61
  global $frm_form;
62
  global $frm_entry;
63
  global $frm_entry_meta;
64
  global $frm_notification;
65
+ global $frm_update;
66
 
67
  $frm_field = new FrmField();
68
  $frm_form = new FrmForm();
69
  $frm_entry = new FrmEntry();
70
  $frm_entry_meta = new FrmEntryMeta();
71
  $frm_notification = new FrmNotification();
72
+ $frm_update = new FrmUpdate();
73
 
74
 
75
  // Instansiate Controllers
76
+ require_once(FRM_CONTROLLERS_PATH . "/FrmApiController.php");
77
  require_once(FRM_CONTROLLERS_PATH . "/FrmAppController.php");
78
  require_once(FRM_CONTROLLERS_PATH . "/FrmFieldsController.php");
79
  require_once(FRM_CONTROLLERS_PATH . "/FrmFormsController.php");
81
  require_once(FRM_CONTROLLERS_PATH . "/FrmSettingsController.php");
82
  require_once(FRM_CONTROLLERS_PATH . "/FrmStatisticsController.php");
83
 
84
+ global $frm_api_controller;
85
  global $frm_app_controller;
86
  global $frm_entries_controller;
87
  global $frm_fields_controller;
88
  global $frm_forms_controller;
89
  global $frm_settings_controller;
90
 
91
+ $frm_api_controller = new FrmApiController();
92
  $frm_app_controller = new FrmAppController();
93
  $frm_entries_controller = new FrmEntriesController();
94
  $frm_fields_controller = new FrmFieldsController();
110
  $frm_fields_helper = new FrmFieldsHelper();
111
  $frm_settings_helper = new FrmSettingsHelper();
112
 
113
+ global $frmpro_is_installed;
114
+ $frmpro_is_installed = $frm_update->pro_is_installed_and_authorized();
115
+
116
+ if($frmpro_is_installed)
117
+ require_once(FRM_PATH.'/pro/formidable-pro.php');
118
 
119
  // The number of items per page on a table
120
  global $frm_page_size;
132
 
133
  global $frm_recaptcha_enabled;
134
 
135
+ $frm_recaptcha_enabled = ( in_array('wp-recaptcha/wp-recaptcha.php', get_option('active_plugins')) )? true : false;
136
  if ($frm_recaptcha_enabled)
137
  $frm_field_selection['captcha'] = 'reCAPTCHA Field';
138
 
139
  global $frm_pro_field_selection;
140
 
141
  $frm_pro_field_selection = array(
142
+ 'divider' => 'Section Divider/Heading',
143
+ 'file' => 'File Upload',
 
144
  //'rte' => 'Rich Text Editor',
145
  'phone' => 'Phone',
146
  'email' => 'Email',
148
  //'time' => 'Time',
149
  'hidden' => 'Hidden Field',
150
  'user_id' => 'Hidden User Id',
151
+ 'website' => 'Website/URL',
152
+ 'image' => 'Image URL',
153
+ '10radio' => '1-10 radio',
154
+ 'data' => 'Data from Entries'
155
  //'multiple' => 'Multiple Select Box', //http://code.google.com/p/jquery-asmselect/
 
 
156
  //'address' => 'Address', //Address line 1, Address line 2, City, State/Providence, Postal Code, Select Country
157
  //'city_selector' => 'US State/County/City selector',
158
  //'full_name' => 'First and Last Name',
159
+ //'terms' => 'Terms of Use',// checkbox or show terms (integrate with Terms of use plugin)
160
+ //'quiz' => 'Question and Answer' // for captcha alternative
 
161
  );
162
 
163
  ?>
images/ajax_loader.gif ADDED
Binary file
images/help.png ADDED
Binary file
images/reload.png ADDED
Binary file
images/required_loader.gif ADDED
Binary file
images/wpspin_light.gif ADDED
Binary file
js/jquery/jquery-1.3.2.min.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery JavaScript Library v1.3.2
3
+ * http://jquery.com/
4
+ *
5
+ * Copyright (c) 2009 John Resig
6
+ * Dual licensed under the MIT and GPL licenses.
7
+ * http://docs.jquery.com/License
8
+ *
9
+ * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
10
+ * Revision: 6246
11
+ */
12
+ (function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
13
+ /*
14
+ * Sizzle CSS Selector Engine - v0.9.3
15
+ * Copyright 2009, The Dojo Foundation
16
+ * Released under the MIT, BSD, and GPL Licenses.
17
+ * More information: http://sizzlejs.com/
18
+ */
19
+ (function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
js/jquery/jquery-ui-1.7.1.custom.min.js DELETED
@@ -1,273 +0,0 @@
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-1.7.2.min.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI 1.7.2
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||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);(function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(b);if(!this.handle){return false}return true},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)}if(c.containment){this._setContainment()}this._trigger("start",b);this._cacheHelperProportions();if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(b,true);return true},_mouseDrag:function(b,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)}return false},_mouseStop:function(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);this._clear()}return false},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_trigger:function(b,c,d){d=d||this._uiHash();a.ui.plugin.call(this,b,[c,d]);if(b=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return a.widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(b){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs}}}));a.extend(a.ui.draggable,{version:"1.7.2",eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});a.ui.plugin.add("draggable","connectToSortable",{start:function(c,e){var d=a(this).data("draggable"),f=d.options,b=a.extend({},e,{item:d.element});d.sortables=[];a(f.connectToSortable).each(function(){var g=a.data(this,"sortable");if(g&&!g.options.disabled){d.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",c,b)}})},stop:function(c,e){var d=a(this).data("draggable"),b=a.extend({},e,{item:d.element});a.each(d.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;d.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(c);this.instance.options.helper=this.instance.options._helper;if(d.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",c,b)}})},drag:function(c,f){var e=a(this).data("draggable"),b=this;var d=function(i){var n=this.offset.click.top,m=this.offset.click.left;var g=this.positionAbs.top,k=this.positionAbs.left;var j=i.height,l=i.width;var p=i.top,h=i.left;return a.ui.isOver(g+n,k+m,p,h,j,l)};a.each(e.sortables,function(g){this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;this.instance.offset.click=e.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=a(b).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return f.helper[0]};c.target=this.instance.currentItem[0];this.instance._mouseCapture(c,true);this.instance._mouseStart(c,true,true);this.instance.offset.click.top=e.offset.click.top;this.instance.offset.click.left=e.offset.click.left;this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;e._trigger("toSortable",c);e.dropped=this.instance.element;e.currentItem=e.element;this.instance.fromOutside=e}if(this.instance.currentItem){this.instance._mouseDrag(c)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",c,this.instance._uiHash(this.instance));this.instance._mouseStop(c,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}e._trigger("fromSortable",c);e.dropped=false}}})}});a.ui.plugin.add("draggable","cursor",{start:function(c,d){var b=a("body"),e=a(this).data("draggable").options;if(b.css("cursor")){e._cursor=b.css("cursor")}b.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._cursor){a("body").css("cursor",d._cursor)}}});a.ui.plugin.add("draggable","iframeFix",{start:function(b,c){var d=a(this).data("draggable").options;a(d.iframeFix===true?"iframe":d.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop+f.scrollSpeed}else{if(d.pageY-c.overflowOffset.top<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop-f.scrollSpeed}}}if(!f.axis||f.axis!="y"){if((c.overflowOffset.left+c.scrollParent[0].offsetWidth)-d.pageX<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft+f.scrollSpeed}else{if(d.pageX-c.overflowOffset.left<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft-f.scrollSpeed}}}}else{if(!f.axis||f.axis!="x"){if(d.pageY-a(document).scrollTop()<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-f.scrollSpeed)}else{if(a(window).height()-(d.pageY-a(document).scrollTop())<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+f.scrollSpeed)}}}if(!f.axis||f.axis!="y"){if(d.pageX-a(document).scrollLeft()<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-f.scrollSpeed)}else{if(a(window).width()-(d.pageX-a(document).scrollLeft())<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+f.scrollSpeed)}}}}if(b!==false&&a.ui.ddmanager&&!f.dropBehaviour){a.ui.ddmanager.prepareOffsets(c,d)}}});a.ui.plugin.add("draggable","snap",{start:function(c,d){var b=a(this).data("draggable"),e=b.options;b.snapElements=[];a(e.snap.constructor!=String?(e.snap.items||":data(draggable)"):e.snap).each(function(){var g=a(this);var f=g.offset();if(this!=b.element[0]){b.snapElements.push({item:this,width:g.outerWidth(),height:g.outerHeight(),top:f.top,left:f.left})}})},drag:function(u,p){var g=a(this).data("draggable"),q=g.options;var y=q.snapTolerance;var x=p.offset.left,w=x+g.helperProportions.width,f=p.offset.top,e=f+g.helperProportions.height;for(var v=g.snapElements.length-1;v>=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y<x&&x<n+y&&m-y<f&&f<A+y)||(s-y<x&&x<n+y&&m-y<e&&e<A+y)||(s-y<w&&w<n+y&&m-y<f&&f<A+y)||(s-y<w&&w<n+y&&m-y<e&&e<A+y))){if(g.snapElements[v].snapping){(g.options.snap.release&&g.options.snap.release.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=false;continue}if(q.snapMode!="inner"){var c=Math.abs(m-e)<=y;var z=Math.abs(A-f)<=y;var j=Math.abs(s-w)<=y;var k=Math.abs(n-x)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m-g.helperProportions.height,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s-g.helperProportions.width}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n}).left-g.margins.left}}var h=(c||z||j||k);if(q.snapMode!="outer"){var c=Math.abs(m-f)<=y;var z=Math.abs(A-e)<=y;var j=Math.abs(s-x)<=y;var k=Math.abs(n-w)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A-g.helperProportions.height,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n-g.helperProportions.width}).left-g.margins.left}}if(!g.snapElements[v].snapping&&(c||z||j||k||h)){(g.options.snap.snap&&g.options.snap.snap.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=(c||z||j||k||h)}}});a.ui.plugin.add("draggable","stack",{start:function(b,c){var e=a(this).data("draggable").options;var d=a.makeArray(a(e.stack.group)).sort(function(g,f){return(parseInt(a(g).css("zIndex"),10)||e.stack.min)-(parseInt(a(f).css("zIndex"),10)||e.stack.min)});a(d).each(function(f){this.style.zIndex=e.stack.min+f});this[0].style.zIndex=e.stack.min+d.length}});a.ui.plugin.add("draggable","zIndex",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("zIndex")){e._zIndex=b.css("zIndex")}b.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._zIndex){a(c.helper).css("zIndex",d._zIndex)}}})})(jQuery);(function(a){a.widget("ui.droppable",{_init:function(){var c=this.options,b=c.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&a.isFunction(this.options.accept)?this.options.accept:function(e){return e.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};a.ui.ddmanager.droppables[this.options.scope]=a.ui.ddmanager.droppables[this.options.scope]||[];a.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.addClasses&&this.element.addClass("ui-droppable"))},destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];for(var c=0;c<b.length;c++){if(b[c]==this){b.splice(c,1)}}this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(b,c){if(b=="accept"){this.options.accept=c&&a.isFunction(c)?c:function(e){return e.is(c)}}else{a.widget.prototype._setData.apply(this,arguments)}},_activate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.addClass(this.options.activeClass)}(b&&this._trigger("activate",c,this.ui(b)))},_deactivate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}(b&&this._trigger("deactivate",c,this.ui(b)))},_over:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)}this._trigger("over",c,this.ui(b))}},_out:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("out",c,this.ui(b))}},_drop:function(c,d){var b=d||a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return false}var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var f=a.data(this,"droppable");if(f.options.greedy&&a.ui.intersect(b,a.extend(f,{offset:f.element.offset()}),f.options.tolerance)){e=true;return false}});if(e){return false}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("drop",c,this.ui(b));return this.element}return false},ui:function(b){return{draggable:(b.currentItem||b.element),helper:b.helper,position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs}}});a.extend(a.ui.droppable,{version:"1.7.2",eventPrefix:"drop",defaults:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"}});a.ui.intersect=function(q,j,o){if(!j.offset){return false}var e=(q.positionAbs||q.position.absolute).left,d=e+q.helperProportions.width,n=(q.positionAbs||q.position.absolute).top,m=n+q.helperProportions.height;var g=j.offset.left,c=g+j.proportions.width,p=j.offset.top,k=p+j.proportions.height;switch(o){case"fit":return(g<e&&d<c&&p<n&&m<k);break;case"intersect":return(g<e+(q.helperProportions.width/2)&&d-(q.helperProportions.width/2)<c&&p<n+(q.helperProportions.height/2)&&m-(q.helperProportions.height/2)<k);break;case"pointer":var h=((q.positionAbs||q.position.absolute).left+(q.clickOffset||q.offset.click).left),i=((q.positionAbs||q.position.absolute).top+(q.clickOffset||q.offset.click).top),f=a.ui.isOver(i,h,p,g,j.proportions.height,j.proportions.width);return f;break;case"touch":return((n>=p&&n<=k)||(m>=p&&m<=k)||(n<p&&m>k))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(e<g&&d>c));break;default:return false;break}};a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,g){var b=a.ui.ddmanager.droppables[e.options.scope];var f=g?g.type:null;var h=(e.currentItem||e.element).find(":data(droppable)").andSelf();droppablesLoop:for(var d=0;d<b.length;d++){if(b[d].options.disabled||(e&&!b[d].options.accept.call(b[d].element[0],(e.currentItem||e.element)))){continue}for(var c=0;c<h.length;c++){if(h[c]==b[d].element[0]){b[d].proportions.height=0;continue droppablesLoop}}b[d].visible=b[d].element.css("display")!="none";if(!b[d].visible){continue}b[d].offset=b[d].element.offset();b[d].proportions={width:b[d].element[0].offsetWidth,height:b[d].element[0].offsetHeight};if(f=="mousedown"){b[d]._activate.call(b[d],g)}}},drop:function(b,c){var d=false;a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(!this.options){return}if(!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)){d=this._drop.call(this,c)}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],(b.currentItem||b.element))){this.isout=1;this.isover=0;this._deactivate.call(this,c)}});return d},drag:function(b,c){if(b.options.refreshPositions){a.ui.ddmanager.prepareOffsets(b,c)}a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return}var e=a.ui.intersect(b,this,this.options.tolerance);var g=!e&&this.isover==1?"isout":(e&&this.isover==0?"isover":null);if(!g){return}var f;if(this.options.greedy){var d=this.element.parents(":data(droppable):eq(0)");if(d.length){f=a.data(d[0],"droppable");f.greedyChild=(g=="isover"?1:0)}}if(f&&g=="isover"){f.isover=0;f.isout=1;f._out.call(f,c)}this[g]=1;this[g=="isout"?"isover":"isout"]=0;this[g=="isover"?"_over":"_out"].call(this,c);if(f&&g=="isout"){f.isout=0;f.isover=1;f._over.call(f,c)}})}}})(jQuery);(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f<k.length;f++){var h=c.trim(k[f]),d="ui-resizable-"+h;var g=c('<div class="ui-resizable-handle '+d+'"></div>');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidth<k.width),l=a(k.height)&&h.maxHeight&&(h.maxHeight<k.height),g=a(k.width)&&h.minWidth&&(h.minWidth>k.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e<this._proportionallyResizeElements.length;e++){var g=this._proportionallyResizeElements[e];if(!this.borderDif){var d=[g.css("borderTopWidth"),g.css("borderRightWidth"),g.css("borderBottomWidth"),g.css("borderLeftWidth")],h=[g.css("paddingTop"),g.css("paddingRight"),g.css("paddingBottom"),g.css("paddingLeft")];this.borderDif=c.map(d,function(k,m){var l=parseInt(k,10)||0,n=parseInt(h[m],10)||0;return l+n})}if(c.browser.msie&&!(!(c(f).is(":hidden")||c(f).parents(":hidden").length))){continue}g.css({height:(f.height()-this.borderDif[0]-this.borderDif[2])||0,width:(f.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var e=this.element,h=this.options;this.elementOffset=e.offset();if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,u){var s=(q[u]||0)+(j[u]||0);if(s&&s>=0){o[u]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)){s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);(function(a){a.widget("ui.selectable",a.extend({},a.ui.mouse,{_init:function(){var b=this;this.element.addClass("ui-selectable");this.dragged=false;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]);c.each(function(){var d=a(this);var e=d.offset();a.data(this,"selectable-item",{element:this,$element:d,left:e.left,top:e.top,right:e.left+d.outerWidth(),bottom:e.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=c.addClass("ui-selectee");this._mouseInit();this.helper=a(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy()},_mouseStart:function(d){var b=this;this.opos=[d.pageX,d.pageY];if(this.options.disabled){return}var c=this.options;this.selectees=a(c.filter,this.element[0]);this._trigger("start",d);a(c.appendTo).append(this.helper);this.helper.css({"z-index":100,position:"absolute",left:d.clientX,top:d.clientY,width:0,height:0});if(c.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var e=a.data(this,"selectable-item");e.startselected=true;if(!d.metaKey){e.$element.removeClass("ui-selected");e.selected=false;e.$element.addClass("ui-unselecting");e.unselecting=true;b._trigger("unselecting",d,{unselecting:e.element})}});a(d.target).parents().andSelf().each(function(){var e=a.data(this,"selectable-item");if(e){e.$element.removeClass("ui-unselecting").addClass("ui-selecting");e.unselecting=false;e.selecting=true;e.selected=true;b._trigger("selecting",d,{selecting:e.element});return false}})},_mouseDrag:function(i){var c=this;this.dragged=true;if(this.options.disabled){return}var e=this.options;var d=this.opos[0],h=this.opos[1],b=i.pageX,g=i.pageY;if(d>b){var f=b;b=d;d=f}if(h>g){var f=g;g=h;h=f}this.helper.css({left:d,top:h,width:b-d,height:g-h});this.selectees.each(function(){var j=a.data(this,"selectable-item");if(!j||j.element==c.element[0]){return}var k=false;if(e.tolerance=="touch"){k=(!(j.left>b||j.right<d||j.top>g||j.bottom<h))}else{if(e.tolerance=="fit"){k=(j.left>d&&j.right<b&&j.top>h&&j.bottom<g)}}if(k){if(j.selected){j.$element.removeClass("ui-selected");j.selected=false}if(j.unselecting){j.$element.removeClass("ui-unselecting");j.unselecting=false}if(!j.selecting){j.$element.addClass("ui-selecting");j.selecting=true;c._trigger("selecting",i,{selecting:j.element})}}else{if(j.selecting){if(i.metaKey&&j.startselected){j.$element.removeClass("ui-selecting");j.selecting=false;j.$element.addClass("ui-selected");j.selected=true}else{j.$element.removeClass("ui-selecting");j.selecting=false;if(j.startselected){j.$element.addClass("ui-unselecting");j.unselecting=true}c._trigger("unselecting",i,{unselecting:j.element})}}if(j.selected){if(!i.metaKey&&!j.startselected){j.$element.removeClass("ui-selected");j.selected=false;j.$element.addClass("ui-unselecting");j.unselecting=true;c._trigger("unselecting",i,{unselecting:j.element})}}}});return false},_mouseStop:function(d){var b=this;this.dragged=false;var c=this.options;a(".ui-unselecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");e.$element.removeClass("ui-unselecting");e.unselecting=false;e.startselected=false;b._trigger("unselected",d,{unselected:e.element})});a(".ui-selecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");e.$element.removeClass("ui-selecting").addClass("ui-selected");e.selecting=false;e.selected=true;e.startselected=true;b._trigger("selected",d,{selected:e.element})});this._trigger("stop",d);this.helper.remove();return false}}));a.extend(a.ui.selectable,{version:"1.7.2",defaults:{appendTo:"body",autoRefresh:true,cancel:":input,option",delay:0,distance:0,filter:"*",tolerance:"touch"}})})(jQuery);(function(a){a.widget("ui.sortable",a.extend({},a.ui.mouse,{_init:function(){var b=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--){this.items[b].item.removeData("sortable-item")}},_mouseCapture:function(e,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(e);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");a.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=e.pageY;if(g.cursorAt){this._adjustOffsetFromHelper(g.cursorAt)}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",e,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop+g.scrollSpeed}else{if(f.pageY-this.overflowOffset.top<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop-g.scrollSpeed}}if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-f.pageX<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft+g.scrollSpeed}else{if(f.pageX-this.overflowOffset.left<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft-g.scrollSpeed}}}else{if(f.pageY-a(document).scrollTop()<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-g.scrollSpeed)}else{if(a(window).height()-(f.pageY-a(document).scrollTop())<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+g.scrollSpeed)}}if(f.pageX-a(document).scrollLeft()<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-g.scrollSpeed)}else{if(a(window).width()-(f.pageX-a(document).scrollLeft())<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+g.scrollSpeed)}}}if(b!==false&&a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,f)}}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-b.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){b._clear(c)})}else{this._clear(c,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}a.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){a(this.domPosition.prev).after(this.currentItem)}else{a(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};a(b).each(function(){var e=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));if(e){c.push((d.key||e[1]+"[]")+"="+(d.key&&d.expression?e[1]:e[2]))}});return c.join("&")},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")});return c},_intersectsWith:function(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)<i&&(e+h)>f&&(e+h)<c;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>m[this.floating?"width":"height"])){return g}else{return(f<e+(this.helperProportions.width/2)&&d-(this.helperProportions.width/2)<c&&n<k+(this.helperProportions.height/2)&&j-(this.helperProportions.height/2)<i)}},_intersectsWithPointer:function(d){var e=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,d.top,d.height),c=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,d.left,d.width),g=e&&c,b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(!g){return false}return this.floating?(((f&&f=="right")||b=="down")?2:1):(b&&(b=="down"?2:1))},_intersectsWithSides:function(e){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+(e.height/2),e.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+(e.width/2),e.width),b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(this.floating&&f){return((f=="right"&&d)||(f=="left"&&!d))}else{return b&&((b=="down"&&c)||(b=="up"&&!c))}},_getDragVerticalDirection:function(){var b=this.positionAbs.top-this.lastPositionAbs.top;return b!=0&&(b>0?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;return b!=0&&(b>0?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions()},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c<this.items.length;c++){for(var b=0;b<d.length;b++){if(d[b]==this.items[c].item[0]){this.items.splice(c,1)}}}},_refreshItems:function(b){this.items=[];this.containers=[this];var h=this.items;var p=this;var f=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]];var l=this._connectWith();if(l){for(var e=l.length-1;e>=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element[0],b,{item:this.currentItem}):a(g.options.items,g.element),g]);this.containers.push(g)}}}}for(var e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=c.length;d<n;d++){var o=a(c[d]);o.data("sortable-item",k);h.push({item:o,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d];if(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0]){continue}var c=this.options.toleranceElement?a(this.options.toleranceElement,e.item):e.item;if(!b){e.width=c.outerWidth();e.height=c.outerHeight()}var f=c.offset();e.left=f.left;e.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var d=this.containers.length-1;d>=0;d--){var f=this.containers[d].element.offset();this.containers[d].containerCache.left=f.left;this.containers[d].containerCache.top=f.top;this.containers[d].containerCache.width=this.containers[d].element.outerWidth();this.containers[d].containerCache.height=this.containers[d].element.outerHeight()}}},_createPlaceholder:function(d){var b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.placeholder)},_contactContainers:function(d){for(var c=this.containers.length-1;c>=0;c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var h=10000;var g=null;var e=this.positionAbs[this.containers[c].floating?"left":"top"];for(var b=this.items.length-1;b>=0;b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue}var f=this.items[b][this.containers[c].floating?"left":"top"];if(Math.abs(f-e)<h){h=Math.abs(f-e);g=this.items[b]}}if(!g&&!this.options.dropOnEmpty){continue}this.currentContainer=this.containers[c];g?this._rearrange(d,g,null,true):this._rearrange(d,null,this.containers[c].element,true);this._trigger("change",d,this._uiHash());this.containers[c]._trigger("change",d,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder)}this.containers[c]._trigger("over",d,this._uiHash(this));this.containers[c].containerCache.over=1}}else{if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",d,this._uiHash(this));this.containers[c].containerCache.over=0}}}},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c,this.currentItem])):(d.helper=="clone"?this.currentItem.clone():this.currentItem);if(!b.parents("body").length){a(d.appendTo!="parent"?d.appendTo:this.currentItem[0].parentNode)[0].appendChild(b[0])}if(b[0]==this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(b[0].style.width==""||d.forceHelperSize){b.width(this.currentItem.width())}if(b[0].style.height==""||d.forceHelperSize){b.height(this.currentItem.height())}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.currentItem.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)){var c=a(e.containment)[0];var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_rearrange:function(g,f,c,e){c?c[0].appendChild(this.placeholder[0]):f.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?f.item[0]:f.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var d=this,b=this.counter;window.setTimeout(function(){if(b==d.counter){d.refreshPositions(!e)}},0)},_clear:function(d,e){this.reverting=false;var f=[],b=this;if(!this._noFinalSort&&this.currentItem[0].parentNode){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var c in this._storedCSS){if(this._storedCSS[c]=="auto"||this._storedCSS[c]=="static"){this._storedCSS[c]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!e){f.push(function(g){this._trigger("receive",g,this._uiHash(this.fromOutside))})}if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!e){f.push(function(g){this._trigger("update",g,this._uiHash())})}if(!a.ui.contains(this.element[0],this.currentItem[0])){if(!e){f.push(function(g){this._trigger("remove",g,this._uiHash())})}for(var c=this.containers.length-1;c>=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}return false}if(!e){this._trigger("beforeStop",d,this._uiHash())}this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0]){this.helper.remove()}this.helper=null;if(!e){for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){if(a.widget.prototype._trigger.apply(this,arguments)===false){this.cancel()}},_uiHash:function(c){var b=c||this;return{helper:b.helper,placeholder:b.placeholder||a([]),position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs,item:b.currentItem,sender:c?c.element:null}}}));a.extend(a.ui.sortable,{getter:"serialize toArray",version:"1.7.2",eventPrefix:"sort",defaults:{appendTo:"parent",axis:false,cancel:":input,option",connectWith:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})})(jQuery);jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(var f=0;f<h.length;f++){if(h[f]!==null){g.data("ec.storage."+h[f],g[0].style[h[f]])}}},restore:function(g,h){for(var f=0;f<h.length;f++){if(h[f]!==null){g.css(h[f],g.data("ec.storage."+h[f]))}}},setMode:function(f,g){if(g=="toggle"){g=f.is(":hidden")?"show":"hide"}return g},getBaseline:function(g,h){var i,f;switch(g[0]){case"top":i=0;break;case"middle":i=0.5;break;case"bottom":i=1;break;default:i=g[0]/h.height}switch(g[1]){case"left":f=0;break;case"center":f=0.5;break;case"right":f=1;break;default:f=g[1]/h.width}return{x:f,y:i}},createWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent()}var g={width:f.outerWidth(true),height:f.outerHeight(true),"float":f.css("float")};f.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var j=f.parent();if(f.css("position")=="static"){j.css({position:"relative"});f.css({position:"relative"})}else{var i=f.css("top");if(isNaN(parseInt(i,10))){i="auto"}var h=f.css("left");if(isNaN(parseInt(h,10))){h="auto"}j.css({position:f.css("position"),top:i,left:h,zIndex:f.css("z-index")}).show();f.css({position:"relative",top:0,left:0})}j.css(g);return j},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)}return f},setTransition:function(g,i,f,h){h=h||{};d.each(i,function(k,j){unit=g.cssUnit(j);if(unit[0]>0){h[j]=unit[0]*f+unit[1]}});return h},animateClass:function(h,i,k,j){var f=(typeof k=="function"?k:(j?j:null));var g=(typeof k=="string"?k:null);return this.each(function(){var q={};var o=d(this);var p=o.attr("style")||"";if(typeof p=="object"){p=p.cssText}if(h.toggle){o.hasClass(h.toggle)?h.remove=h.toggle:h.add=h.toggle}var l=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.addClass(h.add)}if(h.remove){o.removeClass(h.remove)}var m=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.removeClass(h.add)}if(h.remove){o.addClass(h.remove)}for(var r in m){if(typeof m[r]!="function"&&m[r]&&r.indexOf("Moz")==-1&&r.indexOf("length")==-1&&m[r]!=l[r]&&(r.match(/color/i)||(!r.match(/color/i)&&!isNaN(parseInt(m[r],10))))&&(l.position!="static"||(l.position=="static"&&!r.match(/left|top|bottom|right/)))){q[r]=m[r]}}o.animate(q,i,g,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";d(this).attr("style")["cssText"]=p}else{d(this).attr("style",p)}if(h.add){d(this).addClass(h.add)}if(h.remove){d(this).removeClass(h.remove)}if(f){f.apply(this,arguments)}})})}};function c(g,f){var i=g[1]&&g[1].constructor==Object?g[1]:{};if(f){i.mode=f}var h=g[1]&&g[1].constructor!=Object?g[1]:(i.duration?i.duration:g[2]);h=d.fx.off?0:typeof h==="number"?h:d.fx.speeds[h]||d.fx.speeds._default;var j=i.callback||(d.isFunction(g[1])&&g[1])||(d.isFunction(g[2])&&g[2])||(d.isFunction(g[3])&&g[3]);return[g[0],i,h,j]}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass,_toggleClass:d.fn.toggleClass,effect:function(g,f,h,i){return d.effects[g]?d.effects[g].call(this,{method:g,options:f||{},duration:h,callback:i}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"show"))}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"hide"))}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(d.isFunction(arguments[0])||typeof arguments[0]=="boolean")){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"toggle"))}},addClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{add:g},f,i,h]):this._addClass(g)},removeClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{remove:g},f,i,h]):this._removeClass(g)},toggleClass:function(g,f,i,h){return((typeof f!=="boolean")&&f)?d.effects.animateClass.apply(this,[{toggle:g},f,i,h]):this._toggleClass(g,f)},morph:function(f,h,g,j,i){return d.effects.animateClass.apply(this,[{add:h,remove:f},g,j,i])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(f){var g=this.css(f),h=[];d.each(["em","px","%","pt"],function(j,k){if(g.indexOf(k)>0){h=[parseFloat(g),k]}});return h}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){d.fx.step[f]=function(h){if(h.state==0){h.start=e(h.elem,f);h.end=b(h.end)}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2],10),255),0)].join(",")+")"}});function b(g){var f;if(g&&g.constructor==Array&&g.length==3){return g}if(f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g)){return[parseInt(f[1],10),parseInt(f[2],10),parseInt(f[3],10)]}if(f=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(g)){return[parseFloat(f[1])*2.55,parseFloat(f[2])*2.55,parseFloat(f[3])*2.55]}if(f=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(g)){return[parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16)]}if(f=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(g)){return[parseInt(f[1]+f[1],16),parseInt(f[2]+f[2],16),parseInt(f[3]+f[3],16)]}if(f=/rgba\(0, 0, 0, 0\)/.exec(g)){return a.transparent}return a[d.trim(g).toLowerCase()]}function e(h,f){var g;do{g=d.curCSS(h,f);if(g!=""&&g!="transparent"||d.nodeName(h,"body")){break}f="backgroundColor"}while(h=h.parentNode);return b(g)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};d.easing.jswing=d.easing.swing;d.extend(d.easing,{def:"easeOutQuad",swing:function(g,h,f,j,i){return d.easing[d.easing.def](g,h,f,j,i)},easeInQuad:function(g,h,f,j,i){return j*(h/=i)*h+f},easeOutQuad:function(g,h,f,j,i){return -j*(h/=i)*(h-2)+f},easeInOutQuad:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h+f}return -j/2*((--h)*(h-2)-1)+f},easeInCubic:function(g,h,f,j,i){return j*(h/=i)*h*h+f},easeOutCubic:function(g,h,f,j,i){return j*((h=h/i-1)*h*h+1)+f},easeInOutCubic:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h+f}return j/2*((h-=2)*h*h+2)+f},easeInQuart:function(g,h,f,j,i){return j*(h/=i)*h*h*h+f},easeOutQuart:function(g,h,f,j,i){return -j*((h=h/i-1)*h*h*h-1)+f},easeInOutQuart:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h+f}return -j/2*((h-=2)*h*h*h-2)+f},easeInQuint:function(g,h,f,j,i){return j*(h/=i)*h*h*h*h+f},easeOutQuint:function(g,h,f,j,i){return j*((h=h/i-1)*h*h*h*h+1)+f},easeInOutQuint:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h*h+f}return j/2*((h-=2)*h*h*h*h+2)+f},easeInSine:function(g,h,f,j,i){return -j*Math.cos(h/i*(Math.PI/2))+j+f},easeOutSine:function(g,h,f,j,i){return j*Math.sin(h/i*(Math.PI/2))+f},easeInOutSine:function(g,h,f,j,i){return -j/2*(Math.cos(Math.PI*h/i)-1)+f},easeInExpo:function(g,h,f,j,i){return(h==0)?f:j*Math.pow(2,10*(h/i-1))+f},easeOutExpo:function(g,h,f,j,i){return(h==i)?f+j:j*(-Math.pow(2,-10*h/i)+1)+f},easeInOutExpo:function(g,h,f,j,i){if(h==0){return f}if(h==i){return f+j}if((h/=i/2)<1){return j/2*Math.pow(2,10*(h-1))+f}return j/2*(-Math.pow(2,-10*--h)+2)+f},easeInCirc:function(g,h,f,j,i){return -j*(Math.sqrt(1-(h/=i)*h)-1)+f},easeOutCirc:function(g,h,f,j,i){return j*Math.sqrt(1-(h=h/i-1)*h)+f},easeInOutCirc:function(g,h,f,j,i){if((h/=i/2)<1){return -j/2*(Math.sqrt(1-h*h)-1)+f}return j/2*(Math.sqrt(1-(h-=2)*h)+1)+f},easeInElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}return -(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f},easeOutElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}return h*Math.pow(2,-10*i)*Math.sin((i*l-j)*(2*Math.PI)/k)+m+f},easeInOutElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l/2)==2){return f+m}if(!k){k=l*(0.3*1.5)}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}if(i<1){return -0.5*(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f}return h*Math.pow(2,-10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k)*0.5+m+f},easeInBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}return k*(h/=j)*h*((i+1)*h-i)+f},easeOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}return k*((h=h/j-1)*h*((i+1)*h+i)+1)+f},easeInOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}if((h/=j/2)<1){return k/2*(h*h*(((i*=(1.525))+1)*h-i))+f}return k/2*((h-=2)*h*(((i*=(1.525))+1)*h+i)+2)+f},easeInBounce:function(g,h,f,j,i){return j-d.easing.easeOutBounce(g,i-h,0,j,i)+f},easeOutBounce:function(g,h,f,j,i){if((h/=i)<(1/2.75)){return j*(7.5625*h*h)+f}else{if(h<(2/2.75)){return j*(7.5625*(h-=(1.5/2.75))*h+0.75)+f}else{if(h<(2.5/2.75)){return j*(7.5625*(h-=(2.25/2.75))*h+0.9375)+f}else{return j*(7.5625*(h-=(2.625/2.75))*h+0.984375)+f}}}},easeInOutBounce:function(g,h,f,j,i){if(h<i/2){return d.easing.easeInBounce(g,h*2,0,j,i)*0.5+f}return d.easing.easeOutBounce(g,h*2-i,0,j,i)*0.5+j*0.5+f}})})(jQuery);(function(a){a.effects.blind=function(b){return this.queue(function(){var d=a(this),c=["position","top","left"];var h=a.effects.setMode(d,b.options.mode||"hide");var g=b.options.direction||"vertical";a.effects.save(d,c);d.show();var j=a.effects.createWrapper(d).css({overflow:"hidden"});var e=(g=="vertical")?"height":"width";var i=(g=="vertical")?j.height():j.width();if(h=="show"){j.css(e,0)}var f={};f[e]=h=="show"?i:0;j.animate(f,b.duration,b.options.easing,function(){if(h=="hide"){d.hide()}a.effects.restore(d,c);a.effects.removeWrapper(d);if(b.callback){b.callback.apply(d[0],arguments)}d.dequeue()})})}})(jQuery);(function(a){a.effects.bounce=function(b){return this.queue(function(){var e=a(this),l=["position","top","left"];var k=a.effects.setMode(e,b.options.mode||"effect");var n=b.options.direction||"up";var c=b.options.distance||20;var d=b.options.times||5;var g=b.duration||250;if(/show|hide/.test(k)){l.push("opacity")}a.effects.save(e,l);e.show();a.effects.createWrapper(e);var f=(n=="up"||n=="down")?"top":"left";var p=(n=="up"||n=="left")?"pos":"neg";var c=b.options.distance||(f=="top"?e.outerHeight({margin:true})/3:e.outerWidth({margin:true})/3);if(k=="show"){e.css("opacity",0).css(f,p=="pos"?-c:c)}if(k=="hide"){c=c/(d*2)}if(k!="hide"){d--}if(k=="show"){var h={opacity:1};h[f]=(p=="pos"?"+=":"-=")+c;e.animate(h,g/2,b.options.easing);c=c/2;d--}for(var j=0;j<d;j++){var o={},m={};o[f]=(p=="pos"?"-=":"+=")+c;m[f]=(p=="pos"?"+=":"-=")+c;e.animate(o,g/2,b.options.easing).animate(m,g/2,b.options.easing);c=(k=="hide")?c*2:c/2}if(k=="hide"){var h={opacity:0};h[f]=(p=="pos"?"-=":"+=")+c;e.animate(h,g/2,b.options.easing,function(){e.hide();a.effects.restore(e,l);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}})}else{var o={},m={};o[f]=(p=="pos"?"-=":"+=")+c;m[f]=(p=="pos"?"+=":"-=")+c;e.animate(o,g/2,b.options.easing).animate(m,g/2,b.options.easing,function(){a.effects.restore(e,l);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}})}e.queue("fx",function(){e.dequeue()});e.dequeue()})}})(jQuery);(function(a){a.effects.clip=function(b){return this.queue(function(){var f=a(this),j=["position","top","left","height","width"];var i=a.effects.setMode(f,b.options.mode||"hide");var k=b.options.direction||"vertical";a.effects.save(f,j);f.show();var c=a.effects.createWrapper(f).css({overflow:"hidden"});var e=f[0].tagName=="IMG"?c:f;var g={size:(k=="vertical")?"height":"width",position:(k=="vertical")?"top":"left"};var d=(k=="vertical")?e.height():e.width();if(i=="show"){e.css(g.size,0);e.css(g.position,d/2)}var h={};h[g.size]=i=="show"?d:0;h[g.position]=i=="show"?0:d/2;e.animate(h,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){f.hide()}a.effects.restore(f,j);a.effects.removeWrapper(f);if(b.callback){b.callback.apply(f[0],arguments)}f.dequeue()}})})}})(jQuery);(function(a){a.effects.drop=function(b){return this.queue(function(){var e=a(this),d=["position","top","left","opacity"];var i=a.effects.setMode(e,b.options.mode||"hide");var h=b.options.direction||"left";a.effects.save(e,d);e.show();a.effects.createWrapper(e);var f=(h=="up"||h=="down")?"top":"left";var c=(h=="up"||h=="left")?"pos":"neg";var j=b.options.distance||(f=="top"?e.outerHeight({margin:true})/2:e.outerWidth({margin:true})/2);if(i=="show"){e.css("opacity",0).css(f,c=="pos"?-j:j)}var g={opacity:i=="show"?1:0};g[f]=(i=="show"?(c=="pos"?"+=":"-="):(c=="pos"?"-=":"+="))+j;e.animate(g,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){e.hide()}a.effects.restore(e,d);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);(function(a){a.effects.explode=function(b){return this.queue(function(){var k=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;var e=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;b.options.mode=b.options.mode=="toggle"?(a(this).is(":visible")?"hide":"show"):b.options.mode;var h=a(this).show().css("visibility","hidden");var l=h.offset();l.top-=parseInt(h.css("marginTop"),10)||0;l.left-=parseInt(h.css("marginLeft"),10)||0;var g=h.outerWidth(true);var c=h.outerHeight(true);for(var f=0;f<k;f++){for(var d=0;d<e;d++){h.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-d*(g/e),top:-f*(c/k)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/e,height:c/k,left:l.left+d*(g/e)+(b.options.mode=="show"?(d-Math.floor(e/2))*(g/e):0),top:l.top+f*(c/k)+(b.options.mode=="show"?(f-Math.floor(k/2))*(c/k):0),opacity:b.options.mode=="show"?0:1}).animate({left:l.left+d*(g/e)+(b.options.mode=="show"?0:(d-Math.floor(e/2))*(g/e)),top:l.top+f*(c/k)+(b.options.mode=="show"?0:(f-Math.floor(k/2))*(c/k)),opacity:b.options.mode=="show"?1:0},b.duration||500)}}setTimeout(function(){b.options.mode=="show"?h.css({visibility:"visible"}):h.css({visibility:"visible"}).hide();if(b.callback){b.callback.apply(h[0])}h.dequeue();a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);(function(a){a.effects.fold=function(b){return this.queue(function(){var e=a(this),k=["position","top","left"];var h=a.effects.setMode(e,b.options.mode||"hide");var o=b.options.size||15;var n=!(!b.options.horizFirst);var g=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(e,k);e.show();var d=a.effects.createWrapper(e).css({overflow:"hidden"});var i=((h=="show")!=n);var f=i?["width","height"]:["height","width"];var c=i?[d.width(),d.height()]:[d.height(),d.width()];var j=/([0-9]+)%/.exec(o);if(j){o=parseInt(j[1],10)/100*c[h=="hide"?0:1]}if(h=="show"){d.css(n?{height:0,width:o}:{height:o,width:0})}var m={},l={};m[f[0]]=h=="show"?c[0]:o;l[f[1]]=h=="show"?c[1]:0;d.animate(m,g,b.options.easing).animate(l,g,b.options.easing,function(){if(h=="hide"){e.hide()}a.effects.restore(e,k);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(e[0],arguments)}e.dequeue()})})}})(jQuery);(function(a){a.effects.highlight=function(b){return this.queue(function(){var e=a(this),d=["backgroundImage","backgroundColor","opacity"];var h=a.effects.setMode(e,b.options.mode||"show");var c=b.options.color||"#ffff99";var g=e.css("backgroundColor");a.effects.save(e,d);e.show();e.css({backgroundImage:"none",backgroundColor:c});var f={backgroundColor:g};if(h=="hide"){f.opacity=0}e.animate(f,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(h=="hide"){e.hide()}a.effects.restore(e,d);if(h=="show"&&a.browser.msie){this.style.removeAttribute("filter")}if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);(function(a){a.effects.pulsate=function(b){return this.queue(function(){var d=a(this);var g=a.effects.setMode(d,b.options.mode||"show");var f=b.options.times||5;var e=b.duration?b.duration/2:a.fx.speeds._default/2;if(g=="hide"){f--}if(d.is(":hidden")){d.css("opacity",0);d.show();d.animate({opacity:1},e,b.options.easing);f=f-2}for(var c=0;c<f;c++){d.animate({opacity:0},e,b.options.easing).animate({opacity:1},e,b.options.easing)}if(g=="hide"){d.animate({opacity:0},e,b.options.easing,function(){d.hide();if(b.callback){b.callback.apply(this,arguments)}})}else{d.animate({opacity:0},e,b.options.easing).animate({opacity:1},e,b.options.easing,function(){if(b.callback){b.callback.apply(this,arguments)}})}d.queue("fx",function(){d.dequeue()});d.dequeue()})}})(jQuery);(function(a){a.effects.puff=function(b){return this.queue(function(){var f=a(this);var c=a.extend(true,{},b.options);var h=a.effects.setMode(f,b.options.mode||"hide");var g=parseInt(b.options.percent,10)||150;c.fade=true;var e={height:f.height(),width:f.width()};var d=g/100;f.from=(h=="hide")?e:{height:e.height*d,width:e.width*d};c.from=f.from;c.percent=(h=="hide")?g:100;c.mode=h;f.effect("scale",c,b.duration,b.callback);f.dequeue()})};a.effects.scale=function(b){return this.queue(function(){var g=a(this);var d=a.extend(true,{},b.options);var j=a.effects.setMode(g,b.options.mode||"effect");var h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:(j=="hide"?0:100));var i=b.options.direction||"both";var c=b.options.origin;if(j!="effect"){d.origin=c||["middle","center"];d.restore=true}var f={height:g.height(),width:g.width()};g.from=b.options.from||(j=="show"?{height:0,width:0}:f);var e={y:i!="horizontal"?(h/100):1,x:i!="vertical"?(h/100):1};g.to={height:f.height*e.y,width:f.width*e.x};if(b.options.fade){if(j=="show"){g.from.opacity=0;g.to.opacity=1}if(j=="hide"){g.from.opacity=1;g.to.opacity=0}}d.from=g.from;d.to=g.to;d.mode=j;g.effect("size",d,b.duration,b.callback);g.dequeue()})};a.effects.size=function(b){return this.queue(function(){var c=a(this),n=["position","top","left","width","height","overflow","opacity"];var m=["position","top","left","overflow","opacity"];var j=["width","height","overflow"];var p=["fontSize"];var k=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];var f=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"];var g=a.effects.setMode(c,b.options.mode||"effect");var i=b.options.restore||false;var e=b.options.scale||"both";var o=b.options.origin;var d={height:c.height(),width:c.width()};c.from=b.options.from||d;c.to=b.options.to||d;if(o){var h=a.effects.getBaseline(o,d);c.from.top=(d.height-c.from.height)*h.y;c.from.left=(d.width-c.from.width)*h.x;c.to.top=(d.height-c.to.height)*h.y;c.to.left=(d.width-c.to.width)*h.x}var l={from:{y:c.from.height/d.height,x:c.from.width/d.width},to:{y:c.to.height/d.height,x:c.to.width/d.width}};if(e=="box"||e=="both"){if(l.from.y!=l.to.y){n=n.concat(k);c.from=a.effects.setTransition(c,k,l.from.y,c.from);c.to=a.effects.setTransition(c,k,l.to.y,c.to)}if(l.from.x!=l.to.x){n=n.concat(f);c.from=a.effects.setTransition(c,f,l.from.x,c.from);c.to=a.effects.setTransition(c,f,l.to.x,c.to)}}if(e=="content"||e=="both"){if(l.from.y!=l.to.y){n=n.concat(p);c.from=a.effects.setTransition(c,p,l.from.y,c.from);c.to=a.effects.setTransition(c,p,l.to.y,c.to)}}a.effects.save(c,i?n:m);c.show();a.effects.createWrapper(c);c.css("overflow","hidden").css(c.from);if(e=="content"||e=="both"){k=k.concat(["marginTop","marginBottom"]).concat(p);f=f.concat(["marginLeft","marginRight"]);j=n.concat(k).concat(f);c.find("*[width]").each(function(){child=a(this);if(i){a.effects.save(child,j)}var q={height:child.height(),width:child.width()};child.from={height:q.height*l.from.y,width:q.width*l.from.x};child.to={height:q.height*l.to.y,width:q.width*l.to.x};if(l.from.y!=l.to.y){child.from=a.effects.setTransition(child,k,l.from.y,child.from);child.to=a.effects.setTransition(child,k,l.to.y,child.to)}if(l.from.x!=l.to.x){child.from=a.effects.setTransition(child,f,l.from.x,child.from);child.to=a.effects.setTransition(child,f,l.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){if(i){a.effects.restore(child,j)}})})}c.animate(c.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(g=="hide"){c.hide()}a.effects.restore(c,i?n:m);a.effects.removeWrapper(c);if(b.callback){b.callback.apply(this,arguments)}c.dequeue()}})})}})(jQuery);(function(a){a.effects.shake=function(b){return this.queue(function(){var e=a(this),l=["position","top","left"];var k=a.effects.setMode(e,b.options.mode||"effect");var n=b.options.direction||"left";var c=b.options.distance||20;var d=b.options.times||3;var g=b.duration||b.options.duration||140;a.effects.save(e,l);e.show();a.effects.createWrapper(e);var f=(n=="up"||n=="down")?"top":"left";var p=(n=="up"||n=="left")?"pos":"neg";var h={},o={},m={};h[f]=(p=="pos"?"-=":"+=")+c;o[f]=(p=="pos"?"+=":"-=")+c*2;m[f]=(p=="pos"?"-=":"+=")+c*2;e.animate(h,g,b.options.easing);for(var j=1;j<d;j++){e.animate(o,g,b.options.easing).animate(m,g,b.options.easing)}e.animate(o,g,b.options.easing).animate(h,g/2,b.options.easing,function(){a.effects.restore(e,l);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}});e.queue("fx",function(){e.dequeue()});e.dequeue()})}})(jQuery);(function(a){a.effects.slide=function(b){return this.queue(function(){var e=a(this),d=["position","top","left"];var i=a.effects.setMode(e,b.options.mode||"show");var h=b.options.direction||"left";a.effects.save(e,d);e.show();a.effects.createWrapper(e).css({overflow:"hidden"});var f=(h=="up"||h=="down")?"top":"left";var c=(h=="up"||h=="left")?"pos":"neg";var j=b.options.distance||(f=="top"?e.outerHeight({margin:true}):e.outerWidth({margin:true}));if(i=="show"){e.css(f,c=="pos"?-j:j)}var g={};g[f]=(i=="show"?(c=="pos"?"+=":"-="):(c=="pos"?"-=":"+="))+j;e.animate(g,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){e.hide()}a.effects.restore(e,d);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);(function(a){a.effects.transfer=function(b){return this.queue(function(){var f=a(this),h=a(b.options.to),e=h.offset(),g={top:e.top,left:e.left,height:h.innerHeight(),width:h.innerWidth()},d=f.offset(),c=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:f.innerHeight(),width:f.innerWidth(),position:"absolute"}).animate(g,b.duration,b.options.easing,function(){c.remove();(b.callback&&b.callback.apply(f[0],arguments));f.dequeue()})})}})(jQuery);(function(a){a.widget("ui.accordion",{_init:function(){var d=this.options,b=this;this.running=0;if(d.collapsible==a.ui.accordion.defaults.collapsible&&d.alwaysOpen!=a.ui.accordion.defaults.alwaysOpen){d.collapsible=!d.alwaysOpen}if(d.navigation){var c=this.element.find("a").filter(d.navigationFilter);if(c.length){if(c.filter(d.header).length){this.active=c}else{this.active=c.parent().parent().prev();c.addClass("ui-accordion-content-active")}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")}this.headers=this.element.find(d.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){a(this).removeClass("ui-state-focus")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||d.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");a("<span/>").addClass("ui-icon "+d.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(d.icons.header).toggleClass(d.icons.headerSelected);if(a.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(e){return b._keydown(e)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!a.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(d.event){this.headers.bind((d.event)+".accordion",function(e){return b._clickHandler.call(b,e,this)})}},destroy:function(){var c=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(c.autoHeight||c.fillHeight){b.css("height","")}},_setData:function(b,c){if(b=="alwaysOpen"){b="collapsible";c=!c}a.widget.prototype._setData.apply(this,arguments)},_keydown:function(e){var g=this.options,f=a.ui.keyCode;if(g.disabled||e.altKey||e.ctrlKey){return}var d=this.headers.length;var b=this.headers.index(e.target);var c=false;switch(e.keyCode){case f.RIGHT:case f.DOWN:c=this.headers[(b+1)%d];break;case f.LEFT:case f.UP:c=this.headers[(b-1+d)%d];break;case f.SPACE:case f.ENTER:return this._clickHandler({target:e.target},e.target)}if(c){a(e.target).attr("tabIndex","-1");a(c).attr("tabIndex","0");c.focus();return false}return true},resize:function(){var e=this.options,d;if(e.fillSpace){if(a.browser.msie){var b=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}d=this.element.parent().height();if(a.browser.msie){this.element.parent().css("overflow",b)}this.headers.each(function(){d-=a(this).outerHeight()});var c=0;this.headers.next().each(function(){c=Math.max(c,a(this).innerHeight()-a(this).height())}).height(Math.max(0,d-c)).css("overflow","auto")}else{if(e.autoHeight){d=0;this.headers.next().each(function(){d=Math.max(d,a(this).outerHeight())}).height(d)}}},activate:function(b){var c=this._findActive(b)[0];this._clickHandler({target:c},c)},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===false?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,f){var d=this.options;if(d.disabled){return false}if(!b.target&&d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var h=this.active.next(),e={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:h},c=(this.active=a([]));this._toggle(c,h,e);return false}var g=a(b.currentTarget||f);var i=g[0]==this.active[0];if(this.running||(!d.collapsible&&i)){return false}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");if(!i){g.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);g.next().addClass("ui-accordion-content-active")}var c=g.next(),h=this.active.next(),e={options:d,newHeader:i&&d.collapsible?a([]):g,oldHeader:this.active,newContent:i&&d.collapsible?a([]):c.find("> *"),oldContent:h.find("> *")},j=this.headers.index(this.active[0])>this.headers.index(g[0]);this.active=i?a([]):g;this._toggle(c,h,e,i,j);return false},_toggle:function(b,i,g,j,k){var d=this.options,m=this;this.toShow=b;this.toHide=i;this.data=g;var c=function(){if(!m){return}return m._completed.apply(m,arguments)};this._trigger("changestart",null,this.data);this.running=i.size()===0?b.size():i.size();if(d.animated){var f={};if(d.collapsible&&j){f={toShow:a([]),toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}else{f={toShow:b,toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}if(!d.proxied){d.proxied=d.animated}if(!d.proxiedDuration){d.proxiedDuration=d.duration}d.animated=a.isFunction(d.proxied)?d.proxied(f):d.proxied;d.duration=a.isFunction(d.proxiedDuration)?d.proxiedDuration(f):d.proxiedDuration;var l=a.ui.accordion.animations,e=d.duration,h=d.animated;if(!l[h]){l[h]=function(n){this.slide(n,{easing:h,duration:e||700})}}l[h](f)}else{if(d.collapsible&&j){b.toggle()}else{i.hide();b.show()}c(true)}i.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();b.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(b){var c=this.options;this.running=b?0:--this.running;if(this.running){return}if(c.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this._trigger("change",null,this.data)}});a.extend(a.ui.accordion,{version:"1.7.2",defaults:{active:null,alwaysOpen:true,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(j,h){j=a.extend({easing:"swing",duration:300},j,h);if(!j.toHide.size()){j.toShow.animate({height:"show"},j);return}if(!j.toShow.size()){j.toHide.animate({height:"hide"},j);return}var c=j.toShow.css("overflow"),g,d={},f={},e=["height","paddingTop","paddingBottom"],b;var i=j.toShow;b=i[0].style.width;i.width(parseInt(i.parent().width(),10)-parseInt(i.css("paddingLeft"),10)-parseInt(i.css("paddingRight"),10)-(parseInt(i.css("borderLeftWidth"),10)||0)-(parseInt(i.css("borderRightWidth"),10)||0));a.each(e,function(k,m){f[m]="hide";var l=(""+a.css(j.toShow[0],m)).match(/^([\d+-.]+)(.*)$/);d[m]={value:l[1],unit:l[2]||"px"}});j.toShow.css({height:0,overflow:"hidden"}).show();j.toHide.filter(":hidden").each(j.complete).end().filter(":visible").animate(f,{step:function(k,l){if(l.prop=="height"){g=(l.now-l.start)/(l.end-l.start)}j.toShow[0].style[l.prop]=(g*d[l.prop].value)+d[l.prop].unit},duration:j.duration,easing:j.easing,complete:function(){if(!j.autoHeight){j.toShow.css("height","")}j.toShow.css("width",b);j.toShow.css({overflow:c});j.complete()}})},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1000:200})},easeslide:function(b){this.slide(b,{easing:"easeinout",duration:700})}}})})(jQuery);(function($){$.extend($.ui,{datepicker:{version:"1.7.2"}});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.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){inst.append=$('<span class="'+this._appendClass+'">'+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}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.append.remove();inst.trigger.remove();$target.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 inst=this._getInst(target);if(arguments.length==2&&typeof name=="string"){return(name=="defaults"?$.extend({},$.datepicker._defaults):(inst?(name=="all"?$.extend({},inst.settings):this._get(inst,name)):null))}var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}if(inst){if(this._curInst==inst){this._hideDatepicker(null)}var date=this._getDateDatepicker(target);extendRemove(inst.settings,settings);this._setDateDatepicker(target,date);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))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){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.2";window.DP_jQuery=$})(jQuery);(function(c){var b={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},a="ui-dialog ui-widget ui-widget-content ui-corner-all ";c.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");var l=this,m=this.options,j=m.title||this.originalTitle||"&nbsp;",e=c.ui.dialog.getTitleId(this.element),k=(this.uiDialog=c("<div/>")).appendTo(document.body).hide().addClass(a+m.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:m.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){(m.closeOnEscape&&n.keyCode&&n.keyCode==c.ui.keyCode.ESCAPE&&l.close(n))}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(n){l.moveToTop(false,n)}),g=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k),f=(this.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k),i=c('<a href="#"/>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){i.addClass("ui-state-hover")},function(){i.removeClass("ui-state-hover")}).focus(function(){i.addClass("ui-state-focus")}).blur(function(){i.removeClass("ui-state-focus")}).mousedown(function(n){n.stopPropagation()}).click(function(n){l.close(n);return false}).appendTo(f),h=(this.uiDialogTitlebarCloseText=c("<span/>")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i),d=c("<span/>").addClass("ui-dialog-title").attr("id",e).html(j).prependTo(f);f.find("*").add(f).disableSelection();(m.draggable&&c.fn.draggable&&this._makeDraggable());(m.resizable&&c.fn.resizable&&this._makeResizable());this._createButtons(m.buttons);this._isOpen=false;(m.bgiframe&&c.fn.bgiframe&&k.bgiframe());(m.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(f){var d=this;if(false===d._trigger("beforeclose",f)){return}(d.overlay&&d.overlay.destroy());d.uiDialog.unbind("keypress.ui-dialog");(d.options.hide?d.uiDialog.hide(d.options.hide,function(){d._trigger("close",f)}):d.uiDialog.hide()&&d._trigger("close",f));c.ui.dialog.overlay.resize();d._isOpen=false;if(d.options.modal){var e=0;c(".ui-dialog").each(function(){if(this!=d.uiDialog[0]){e=Math.max(e,c(this).css("z-index"))}});c.ui.dialog.maxZ=e}},isOpen:function(){return this._isOpen},moveToTop:function(f,e){if((this.options.modal&&!f)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",e)}if(this.options.zIndex>c.ui.dialog.maxZ){c.ui.dialog.maxZ=this.options.zIndex}(this.overlay&&this.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=++c.ui.dialog.maxZ));var d={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++c.ui.dialog.maxZ);this.element.attr(d);this._trigger("focus",e)},open:function(){if(this._isOpen){return}var e=this.options,d=this.uiDialog;this.overlay=e.modal?new c.ui.dialog.overlay(this):null;(d.next().length&&d.appendTo("body"));this._size();this._position(e.position);d.show(e.show);this.moveToTop(true);(e.modal&&d.bind("keypress.ui-dialog",function(h){if(h.keyCode!=c.ui.keyCode.TAB){return}var g=c(":tabbable",this),i=g.filter(":first")[0],f=g.filter(":last")[0];if(h.target==f&&!h.shiftKey){setTimeout(function(){i.focus()},1)}else{if(h.target==i&&h.shiftKey){setTimeout(function(){f.focus()},1)}}}));c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();this._trigger("open");this._isOpen=true},_createButtons:function(g){var f=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiDialog.find(".ui-dialog-buttonpane").remove();(typeof g=="object"&&g!==null&&c.each(g,function(){return !(d=true)}));if(d){c.each(g,function(h,i){c('<button type="button"></button>').addClass("ui-state-default ui-corner-all").text(h).click(function(){i.apply(f.element[0],arguments)}).hover(function(){c(this).addClass("ui-state-hover")},function(){c(this).removeClass("ui-state-hover")}).focus(function(){c(this).addClass("ui-state-focus")}).blur(function(){c(this).removeClass("ui-state-focus")}).appendTo(e)});e.appendTo(this.uiDialog)}},_makeDraggable:function(){var d=this,f=this.options,e;this.uiDialog.draggable({cancel:".ui-dialog-content",handle:".ui-dialog-titlebar",containment:"document",start:function(){e=f.height;c(this).height(c(this).height()).addClass("ui-dialog-dragging");(f.dragStart&&f.dragStart.apply(d.element[0],arguments))},drag:function(){(f.drag&&f.drag.apply(d.element[0],arguments))},stop:function(){c(this).removeClass("ui-dialog-dragging").height(e);(f.dragStop&&f.dragStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}})},_makeResizable:function(g){g=(g===undefined?this.options.resizable:g);var d=this,f=this.options,e=typeof g=="string"?g:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:f.minHeight,start:function(){c(this).addClass("ui-dialog-resizing");(f.resizeStart&&f.resizeStart.apply(d.element[0],arguments))},resize:function(){(f.resize&&f.resize.apply(d.element[0],arguments))},handles:e,stop:function(){c(this).removeClass("ui-dialog-resizing");f.height=c(this).height();f.width=c(this).width();(f.resizeStop&&f.resizeStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_position:function(i){var e=c(window),f=c(document),g=f.scrollTop(),d=f.scrollLeft(),h=g;if(c.inArray(i,["center","top","right","bottom","left"])>=0){i=[i=="right"||i=="left"?i:"center",i=="top"||i=="bottom"?i:"middle"]}if(i.constructor!=Array){i=["center","middle"]}if(i[0].constructor==Number){d+=i[0]}else{switch(i[0]){case"left":d+=0;break;case"right":d+=e.width()-this.uiDialog.outerWidth();break;default:case"center":d+=(e.width()-this.uiDialog.outerWidth())/2}}if(i[1].constructor==Number){g+=i[1]}else{switch(i[1]){case"top":g+=0;break;case"bottom":g+=e.height()-this.uiDialog.outerHeight();break;default:case"middle":g+=(e.height()-this.uiDialog.outerHeight())/2}}g=Math.max(g,h);this.uiDialog.css({top:g,left:d})},_setData:function(e,f){(b[e]&&this.uiDialog.data(b[e],f));switch(e){case"buttons":this._createButtons(f);break;case"closeText":this.uiDialogTitlebarCloseText.text(f);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(a+f);break;case"draggable":(f?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(f);break;case"position":this._position(f);break;case"resizable":var d=this.uiDialog,g=this.uiDialog.is(":data(resizable)");(g&&!f&&d.resizable("destroy"));(g&&typeof f=="string"&&d.resizable("option","handles",f));(g||this._makeResizable(f));break;case"title":c(".ui-dialog-title",this.uiDialogTitlebar).html(f||"&nbsp;");break;case"width":this.uiDialog.width(f);break}c.widget.prototype._setData.apply(this,arguments)},_size:function(){var e=this.options;this.element.css({height:0,minHeight:0,width:"auto"});var d=this.uiDialog.css({height:"auto",width:e.width}).height();this.element.css({minHeight:Math.max(e.minHeight-d,0),height:e.height=="auto"?"auto":Math.max(e.height-d,0)})}});c.extend(c.ui.dialog,{version:"1.7.2",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,maxZ:0,getTitleId:function(d){return"ui-dialog-title-"+(d.attr("id")||++this.uuid)},overlay:function(d){this.$el=c.ui.dialog.overlay.create(d)}});c.extend(c.ui.dialog.overlay,{instances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(d){return d+".dialog-overlay"}).join(" "),create:function(e){if(this.instances.length===0){setTimeout(function(){if(c.ui.dialog.overlay.instances.length){c(document).bind(c.ui.dialog.overlay.events,function(f){var g=c(f.target).parents(".ui-dialog").css("zIndex")||0;return(g>c.ui.dialog.overlay.maxZ)})}},1);c(document).bind("keydown.dialog-overlay",function(f){(e.options.closeOnEscape&&f.keyCode&&f.keyCode==c.ui.keyCode.ESCAPE&&e.close(f))});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var d=c("<div></div>").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});(e.options.bgiframe&&c.fn.bgiframe&&d.bgiframe());this.instances.push(d);return d},destroy:function(d){this.instances.splice(c.inArray(this.instances,d),1);if(this.instances.length===0){c([document,window]).unbind(".dialog-overlay")}d.remove();var e=0;c.each(this.instances,function(){e=Math.max(e,this.css("z-index"))});this.maxZ=e},height:function(){if(c.browser.msie&&c.browser.version<7){var e=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var d=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(e<d){return c(window).height()+"px"}else{return e+"px"}}else{return c(document).height()+"px"}},width:function(){if(c.browser.msie&&c.browser.version<7){var d=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var e=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(d<e){return c(window).width()+"px"}else{return d+"px"}}else{return c(document).width()+"px"}},resize:function(){var d=c([]);c.each(c.ui.dialog.overlay.instances,function(){d=d.add(this)});d.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);(function(a){a.widget("ui.progressbar",{_init:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this._valueMin(),"aria-valuemax":this._valueMax(),"aria-valuenow":this._value()});this.valueDiv=a('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow").removeData("progressbar").unbind(".progressbar");this.valueDiv.remove();a.widget.prototype.destroy.apply(this,arguments)},value:function(b){if(b===undefined){return this._value()}this._setData("value",b);return this},_setData:function(b,c){switch(b){case"value":this.options.value=c;this._refreshValue();this._trigger("change",null,{});break}a.widget.prototype._setData.apply(this,arguments)},_value:function(){var b=this.options.value;if(b<this._valueMin()){b=this._valueMin()}if(b>this._valueMax()){b=this._valueMax()}return b},_valueMin:function(){var b=0;return b},_valueMax:function(){var b=100;return b},_refreshValue:function(){var b=this.value();this.valueDiv[b==this._valueMax()?"addClass":"removeClass"]("ui-corner-right");this.valueDiv.width(b+"%");this.element.attr("aria-valuenow",b)}});a.extend(a.ui.progressbar,{version:"1.7.2",defaults:{value:0}})})(jQuery);(function(a){a.widget("ui.slider",a.extend({},a.ui.mouse,{_init:function(){var b=this,c=this.options;this._keySliding=false;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");this.range=a([]);if(c.range){if(c.range===true){this.range=a("<div></div>");if(!c.values){c.values=[this._valueMin(),this._valueMin()]}if(c.values.length&&c.values.length!=2){c.values=[c.values[0],c.values[0]]}}else{this.range=a("<div></div>")}this.range.appendTo(this.element).addClass("ui-slider-range");if(c.range=="min"||c.range=="max"){this.range.addClass("ui-slider-range-"+c.range)}this.range.addClass("ui-widget-header")}if(a(".ui-slider-handle",this.element).length==0){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")}if(c.values&&c.values.length){while(a(".ui-slider-handle",this.element).length<c.values.length){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")}}this.handles=a(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(d){d.preventDefault()}).hover(function(){if(!c.disabled){a(this).addClass("ui-state-hover")}},function(){a(this).removeClass("ui-state-hover")}).focus(function(){if(!c.disabled){a(".ui-slider .ui-state-focus").removeClass("ui-state-focus");a(this).addClass("ui-state-focus")}else{a(this).blur()}}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(d){a(this).data("index.ui-slider-handle",d)});this.handles.keydown(function(i){var f=true;var e=a(this).data("index.ui-slider-handle");if(b.options.disabled){return}switch(i.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:f=false;if(!b._keySliding){b._keySliding=true;a(this).addClass("ui-state-active");b._start(i,e)}break}var g,d,h=b._step();if(b.options.values&&b.options.values.length){g=d=b.values(e)}else{g=d=b.value()}switch(i.keyCode){case a.ui.keyCode.HOME:d=b._valueMin();break;case a.ui.keyCode.END:d=b._valueMax();break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g==b._valueMax()){return}d=g+h;break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g==b._valueMin()){return}d=g-h;break}b._slide(i,e,d);return f}).keyup(function(e){var d=a(this).data("index.ui-slider-handle");if(b._keySliding){b._stop(e,d);b._change(e,d);b._keySliding=false;a(this).removeClass("ui-state-active")}});this._refreshValue()},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy()},_mouseCapture:function(d){var e=this.options;if(e.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();var h={x:d.pageX,y:d.pageY};var j=this._normValueFromMouse(h);var c=this._valueMax()-this._valueMin()+1,f;var k=this,i;this.handles.each(function(l){var m=Math.abs(j-k.values(l));if(c>m){c=m;f=a(this);i=l}});if(e.range==true&&this.values(1)==e.min){f=a(this.handles[++i])}this._start(d,i);k._handleIndex=i;f.addClass("ui-state-active").focus();var g=f.offset();var b=!a(d.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=b?{left:0,top:0}:{left:d.pageX-g.left-(f.width()/2),top:d.pageY-g.top-(f.height()/2)-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};j=this._normValueFromMouse(h);this._slide(d,i,j);return true},_mouseStart:function(b){return true},_mouseDrag:function(d){var b={x:d.pageX,y:d.pageY};var c=this._normValueFromMouse(b);this._slide(d,this._handleIndex,c);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._handleIndex=null;this._clickOffset=null;return false},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(d){var c,h;if("horizontal"==this.orientation){c=this.elementSize.width;h=d.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{c=this.elementSize.height;h=d.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}var f=(h/c);if(f>1){f=1}if(f<0){f=0}if("vertical"==this.orientation){f=1-f}var e=this._valueMax()-this._valueMin(),i=f*e,b=i%this.options.step,g=this._valueMin()+i-b;if(b>(this.options.step/2)){g+=this.options.step}return parseFloat(g.toFixed(5))},_start:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("start",d,b)},_slide:function(f,e,d){var g=this.handles[e];if(this.options.values&&this.options.values.length){var b=this.values(e?0:1);if((this.options.values.length==2&&this.options.range===true)&&((e==0&&d>b)||(e==1&&d<b))){d=b}if(d!=this.values(e)){var c=this.values();c[e]=d;var h=this._trigger("slide",f,{handle:this.handles[e],value:d,values:c});var b=this.values(e?0:1);if(h!==false){this.values(e,d,(f.type=="mousedown"&&this.options.animate),true)}}}else{if(d!=this.value()){var h=this._trigger("slide",f,{handle:this.handles[e],value:d});if(h!==false){this._setData("value",d,(f.type=="mousedown"&&this.options.animate))}}}},_stop:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("stop",d,b)},_change:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("change",d,b)},value:function(b){if(arguments.length){this._setData("value",b);this._change(null,0)}return this._value()},values:function(b,e,c,d){if(arguments.length>1){this.options.values[b]=e;this._refreshValue(c);if(!d){this._change(null,b)}}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(b)}else{return this.value()}}else{return this._values()}},_setData:function(b,d,c){a.widget.prototype._setData.apply(this,arguments);switch(b){case"disabled":if(d){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled")}else{this.handles.removeAttr("disabled")}case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue(c);break;case"value":this._refreshValue(c);break}},_step:function(){var b=this.options.step;return b},_value:function(){var b=this.options.value;if(b<this._valueMin()){b=this._valueMin()}if(b>this._valueMax()){b=this._valueMax()}return b},_values:function(b){if(arguments.length){var c=this.options.values[b];if(c<this._valueMin()){c=this._valueMin()}if(c>this._valueMax()){c=this._valueMax()}return c}else{return this.options.values}},_valueMin:function(){var b=this.options.min;return b},_valueMax:function(){var b=this.options.max;return b},_refreshValue:function(c){var f=this.options.range,d=this.options,l=this;if(this.options.values&&this.options.values.length){var i,h;this.handles.each(function(p,n){var o=(l.values(p)-l._valueMin())/(l._valueMax()-l._valueMin())*100;var m={};m[l.orientation=="horizontal"?"left":"bottom"]=o+"%";a(this).stop(1,1)[c?"animate":"css"](m,d.animate);if(l.options.range===true){if(l.orientation=="horizontal"){(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({left:o+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({width:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}else{(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({bottom:(o)+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({height:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}}lastValPercent=o})}else{var j=this.value(),g=this._valueMin(),k=this._valueMax(),e=k!=g?(j-g)/(k-g)*100:0;var b={};b[l.orientation=="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[c?"animate":"css"](b,d.animate);(f=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[c?"animate":"css"]({width:e+"%"},d.animate);(f=="max")&&(this.orientation=="horizontal")&&this.range[c?"animate":"css"]({width:(100-e)+"%"},{queue:false,duration:d.animate});(f=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[c?"animate":"css"]({height:e+"%"},d.animate);(f=="max")&&(this.orientation=="vertical")&&this.range[c?"animate":"css"]({height:(100-e)+"%"},{queue:false,duration:d.animate})}}}));a.extend(a.ui.slider,{getter:"value values",version:"1.7.2",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}})})(jQuery);(function(a){a.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable}this._tabify(true)},_setData:function(b,c){if(b=="selected"){if(this.options.collapsible&&c==this.options.selected){return}this.select(c)}else{this.options[b]=c;if(b=="deselectable"){this.options.collapsible=c}this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(b)},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(c,b){return{tab:c,panel:b,index:this.anchors.index(c)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(n){this.list=this.element.children("ul:first");this.lis=a("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return a("a",this)[0]});this.panels=a([]);var p=this,d=this.options;var c=/^#.+/;this.anchors.each(function(r,o){var q=a(o).attr("href");var s=q.split("#")[0],u;if(s&&(s===location.toString().split("#")[0]||(u=a("base")[0])&&s===u.href)){q=o.hash;o.href=q}if(c.test(q)){p.panels=p.panels.add(p._sanitizeSelector(q))}else{if(q!="#"){a.data(o,"href.tabs",q);a.data(o,"load.tabs",q.replace(/#.*$/,""));var w=p._tabId(o);o.href="#"+w;var v=a("#"+w);if(!v.length){v=a(d.panelTemplate).attr("id",w).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(p.panels[r-1]||p.list);v.data("destroy.tabs",true)}p.panels=p.panels.add(v)}else{d.disabled.push(r)}}});if(n){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(d.selected===undefined){if(location.hash){this.anchors.each(function(q,o){if(o.hash==location.hash){d.selected=q;return false}})}if(typeof d.selected!="number"&&d.cookie){d.selected=parseInt(p._cookie(),10)}if(typeof d.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}d.selected=d.selected||0}else{if(d.selected===null){d.selected=-1}}d.selected=((d.selected>=0&&this.anchors[d.selected])||d.selected<0)?d.selected:0;d.disabled=a.unique(d.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(q,o){return p.lis.index(q)}))).sort();if(a.inArray(d.selected,d.disabled)!=-1){d.disabled.splice(a.inArray(d.selected,d.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(d.selected>=0&&this.anchors.length){this.panels.eq(d.selected).removeClass("ui-tabs-hide");this.lis.eq(d.selected).addClass("ui-tabs-selected ui-state-active");p.element.queue("tabs",function(){p._trigger("show",null,p._ui(p.anchors[d.selected],p.panels[d.selected]))});this.load(d.selected)}a(window).bind("unload",function(){p.lis.add(p.anchors).unbind(".tabs");p.lis=p.anchors=p.panels=null})}else{d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[d.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(d.cookie){this._cookie(d.selected,d.cookie)}for(var g=0,m;(m=this.lis[g]);g++){a(m)[a.inArray(g,d.disabled)!=-1&&!a(m).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(d.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(d.event!="mouseover"){var f=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var j=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){f("hover",a(this))});this.lis.bind("mouseout.tabs",function(){j("hover",a(this))});this.anchors.bind("focus.tabs",function(){f("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var b,h;if(d.fx){if(a.isArray(d.fx)){b=d.fx[0];h=d.fx[1]}else{b=h=d.fx}}function e(i,o){i.css({display:""});if(a.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")}}var k=h?function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(h,h.duration||"normal",function(){e(o,h);p._trigger("show",null,p._ui(i,o[0]))})}:function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");p._trigger("show",null,p._ui(i,o[0]))};var l=b?function(o,i){i.animate(b,b.duration||"normal",function(){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");e(i,b);p.element.dequeue("tabs")})}:function(o,i,q){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");p.element.dequeue("tabs")};this.anchors.bind(d.event+".tabs",function(){var o=this,r=a(this).closest("li"),i=p.panels.filter(":not(.ui-tabs-hide)"),q=a(p._sanitizeSelector(this.hash));if((r.hasClass("ui-tabs-selected")&&!d.collapsible)||r.hasClass("ui-state-disabled")||r.hasClass("ui-state-processing")||p._trigger("select",null,p._ui(this,q[0]))===false){this.blur();return false}d.selected=p.anchors.index(this);p.abort();if(d.collapsible){if(r.hasClass("ui-tabs-selected")){d.selected=-1;if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){l(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this));this.blur();return false}}}if(d.cookie){p._cookie(d.selected,d.cookie)}if(q.length){if(i.length){p.element.queue("tabs",function(){l(o,i)})}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(a.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var c=a.data(this,"href.tabs");if(c){this.href=c}var d=a(this).unbind(".tabs");a.each(["href","load","cache"],function(e,f){d.removeData(f+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(a.data(this,"destroy.tabs")){a(this).remove()}else{a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(b.cookie){this._cookie(null,b.cookie)}},add:function(e,d,c){if(c===undefined){c=this.anchors.length}var b=this,g=this.options,i=a(g.tabTemplate.replace(/#\{href\}/g,e).replace(/#\{label\}/g,d)),h=!e.indexOf("#")?e.replace("#",""):this._tabId(a("a",i)[0]);i.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var f=a("#"+h);if(!f.length){f=a(g.panelTemplate).attr("id",h).data("destroy.tabs",true)}f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(c>=this.lis.length){i.appendTo(this.list);f.appendTo(this.list[0].parentNode)}else{i.insertBefore(this.lis[c]);f.insertBefore(this.panels[c])}g.disabled=a.map(g.disabled,function(k,j){return k>=c?++k:k});this._tabify();if(this.anchors.length==1){i.addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[c],this.panels[c]))},remove:function(b){var d=this.options,e=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();if(e.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(b+(b+1<this.anchors.length?1:-1))}d.disabled=a.map(a.grep(d.disabled,function(g,f){return g!=b}),function(g,f){return g>=b?--g:g});this._tabify();this._trigger("remove",null,this._ui(e.find("a")[0],c[0]))},enable:function(b){var c=this.options;if(a.inArray(b,c.disabled)==-1){return}this.lis.eq(b).removeClass("ui-state-disabled");c.disabled=a.grep(c.disabled,function(e,d){return e!=b});this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]))},disable:function(c){var b=this,d=this.options;if(c!=d.selected){this.lis.eq(c).addClass("ui-state-disabled");d.disabled.push(c);d.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))}},select:function(b){if(typeof b=="string"){b=this.anchors.index(this.anchors.filter("[href$="+b+"]"))}else{if(b===null){b=-1}}if(b==-1&&this.options.collapsible){b=this.options.selected}this.anchors.eq(b).trigger(this.options.event+".tabs")},load:function(e){var c=this,g=this.options,b=this.anchors.eq(e)[0],d=a.data(b,"load.tabs");this.abort();if(!d||this.element.queue("tabs").length!==0&&a.data(b,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(e).addClass("ui-state-processing");if(g.spinner){var f=a("span",b);f.data("label.tabs",f.html()).html(g.spinner)}this.xhr=a.ajax(a.extend({},g.ajaxOptions,{url:d,success:function(i,h){a(c._sanitizeSelector(b.hash)).html(i);c._cleanup();if(g.cache){a.data(b,"cache.tabs",true)}c._trigger("load",null,c._ui(c.anchors[e],c.panels[e]));try{g.ajaxOptions.success(i,h)}catch(j){}c.element.dequeue("tabs")}}))},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup()},url:function(c,b){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",b)},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.7.2",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"<div></div>",spinner:"<em>Loading&#8230;</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(d,f){var b=this,g=this.options;var c=b._rotate||(b._rotate=function(h){clearTimeout(b.rotation);b.rotation=setTimeout(function(){var i=g.selected;b.select(++i<b.anchors.length?i:0)},d);if(h){h.stopPropagation()}});var e=b._unrotate||(b._unrotate=!f?function(h){if(h.clientX){b.rotate(null)}}:function(h){t=g.selected;c()});if(d){this.element.bind("tabsshow",c);this.anchors.bind(g.event+".tabs",e);c()}else{clearTimeout(b.rotation);this.element.unbind("tabsshow",c);this.anchors.unbind(g.event+".tabs",e);delete this._rotate;delete this._unrotate}}})})(jQuery);
js/jquery/jquery-ui-themepicker.js ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* jQuery plugin themeswitcher
2
+ ---------------------------------------------------------------------*/
3
+ jQuery.fn.themeswitcher = function(settings){
4
+ var options = jQuery.extend({
5
+ initialText: 'Select Theme',
6
+ width: 150,
7
+ height: 200,
8
+ buttonPreText: 'Theme: ',
9
+ closeOnSelect: true,
10
+ buttonHeight: 14,
11
+ onOpen: function(){},
12
+ onClose: function(){},
13
+ onSelect: function(){}
14
+ }, settings);
15
+
16
+ //markup
17
+ var button = jQuery('<a href="#" class="jquery-ui-themeswitcher-trigger"><span class="jquery-ui-themeswitcher-icon"></span><span class="jquery-ui-themeswitcher-title">'+ options.initialText +'</span></a>');
18
+ var switcherpane = jQuery('<div class="jquery-ui-themeswitcher"><div id="themeGallery"> <ul> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_ui_light.png" alt="UI Lightness" title="UI Lightness" /> <span class="themeName">UI lightness</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-darkness/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_ui_dark.png" alt="UI Darkness" title="UI Darkness" /> <span class="themeName">UI darkness</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/smoothness/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_smoothness.png" alt="Smoothness" title="Smoothness" /> <span class="themeName">Smoothness</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/start/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_start_menu.png" alt="Start" title="Start" /> <span class="themeName">Start</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/redmond/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_windoze.png" alt="Redmond" title="Redmond" /> <span class="themeName">Redmond</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/sunny/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_sunny.png" alt="Sunny" title="Sunny" /> <span class="themeName">Sunny</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/overcast/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_overcast.png" alt="Overcast" title="Overcast" /> <span class="themeName">Overcast</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/le-frog/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_le_frog.png" alt="Le Frog" title="Le Frog" /> <span class="themeName">Le Frog</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/flick/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_flick.png" alt="Flick" title="Flick" /> <span class="themeName">Flick</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/pepper-grinder/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_pepper_grinder.png" alt="Pepper Grinder" title="Pepper Grinder" /> <span class="themeName">Pepper Grinder</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/eggplant/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_eggplant.png" alt="Eggplant" title="Eggplant" /> <span class="themeName">Eggplant</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/dark-hive/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_dark_hive.png" alt="Dark Hive" title="Dark Hive" /> <span class="themeName">Dark Hive</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/cupertino/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_cupertino.png" alt="Cupertino" title="Cupertino" /> <span class="themeName">Cupertino</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/south-street/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_south_street.png" alt="South St" title="South St" /> <span class="themeName">South Street</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/blitzer/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_blitzer.png" alt="Blitzer" title="Blitzer" /> <span class="themeName">Blitzer</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/humanity/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_humanity.png" alt="Humanity" title="Humanity" /> <span class="themeName">Humanity</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/hot-sneaks/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_hot_sneaks.png" alt="Hot Sneaks" title="Hot Sneaks" /> <span class="themeName">Hot sneaks</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/excite-bike/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_excite_bike.png" alt="Excite Bike" title="Excite Bike" /> <span class="themeName">Excite Bike</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/vader/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_black_matte.png" alt="Vader" title="Vader" /> <span class="themeName">Vader</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/dot-luv/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_dot_luv.png" alt="Dot Luv" title="Dot Luv" /> <span class="themeName">Dot Luv</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/mint-choc/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_mint_choco.png" alt="Mint Choc" title="Mint Choc" /> <span class="themeName">Mint Choc</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/black-tie/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_black_tie.png" alt="Black Tie" title="Black Tie" /> <span class="themeName">Black Tie</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/trontastic/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_trontastic.png" alt="Trontastic" title="Trontastic" /> <span class="themeName">Trontastic</span> </a></li> <li><a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/swanky-purse/jquery-ui.css"> <img src="http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_swanky_purse.png" alt="Swanky Purse" title="Swanky Purse" /> <span class="themeName">Swanky Purse</span> </a></li> </ul></div></div>').find('div').removeAttr('id');
19
+
20
+ //button events
21
+ button.click(
22
+ function(){
23
+ if(switcherpane.is(':visible')){ switcherpane.spHide(); }
24
+ else{ switcherpane.spShow(); }
25
+ return false;
26
+ }
27
+ );
28
+
29
+ //menu events (mouseout didn't work...)
30
+ switcherpane.hover(
31
+ function(){},
32
+ function(){if(switcherpane.is(':visible')){jQuery(this).spHide();}}
33
+ );
34
+
35
+ //show/hide panel functions
36
+ jQuery.fn.spShow = function(){ jQuery(this).css({top: button.offset().top + options.buttonHeight + 6, left: button.offset().left}).slideDown(50); button.css(button_active); options.onOpen(); }
37
+ jQuery.fn.spHide = function(){ jQuery(this).slideUp(50, function(){options.onClose();}); button.css(button_default); }
38
+
39
+
40
+ /* Theme Loading
41
+ ---------------------------------------------------------------------*/
42
+ switcherpane.find('a').click(function(){
43
+ var css = jQuery(this).attr('href');
44
+ updateCSS( css );
45
+ var themeName = jQuery(this).find('span').text();
46
+ button.find('.jquery-ui-themeswitcher-title').text( options.buttonPreText + themeName );
47
+ jQuery('#frm_themepicker_input').html('<input type="hidden" value="'+css+'" id="frm_themepicker_css" name="frm_themepicker_css"><input type="hidden" value="'+themeName+'" id="frm_themepicker_name" name="frm_themepicker_name">');
48
+ options.onSelect();
49
+ if(options.closeOnSelect && switcherpane.is(':visible')){ switcherpane.spHide(); }
50
+ return false;
51
+ });
52
+
53
+ //function to append a new theme stylesheet with the new style changes
54
+ function updateCSS(locStr){
55
+ var cssLink = jQuery('<link href="'+locStr+'" type="text/css" rel="Stylesheet" class="ui-theme" />');
56
+ jQuery("head").append(cssLink);
57
+
58
+
59
+ if( jQuery("link.ui-theme").size() > 3){
60
+ jQuery("link.ui-theme:first").remove();
61
+ }
62
+ }
63
+
64
+ /* Inline CSS
65
+ ---------------------------------------------------------------------*/
66
+ var button_default = {
67
+ fontFamily: 'Trebuchet MS, Verdana, sans-serif',
68
+ fontSize: '11px',
69
+ color: '#000',
70
+ background: '#fff',
71
+ border: '1px solid #dfdfdf',
72
+ '-moz-border-radius': '4px',
73
+ '-webkit-border-radius': '4px',
74
+ textDecoration: 'none',
75
+ padding: '3px 3px 3px 8px',
76
+ width: options.width - 11,//minus must match left and right padding
77
+ display: 'block',
78
+ height: options.buttonHeight,
79
+ outline: '0'
80
+ };
81
+ var button_hover = {
82
+ 'borderColor':'#bbb',
83
+ 'background': '#f0f0f0',
84
+ cursor: 'pointer',
85
+ color: '#444'
86
+ };
87
+ var button_active = {
88
+ color: '#aaa',
89
+ background: '#000',
90
+ border: '1px solid #ccc',
91
+ borderBottom: 0,
92
+ '-moz-border-radius-bottomleft': 0,
93
+ '-webkit-border-bottom-left-radius': 0,
94
+ '-moz-border-radius-bottomright': 0,
95
+ '-webkit-border-bottom-right-radius': 0,
96
+ outline: '0'
97
+ };
98
+
99
+
100
+
101
+ //button css
102
+ button.css(button_default)
103
+ .hover(
104
+ function(){
105
+ jQuery(this).css(button_hover);
106
+ },
107
+ function(){
108
+ if( !switcherpane.is(':animated') && switcherpane.is(':hidden') ){ jQuery(this).css(button_default); }
109
+ }
110
+ )
111
+ .find('.jquery-ui-themeswitcher-icon').css({
112
+ float: 'right',
113
+ width: '16px',
114
+ height: '16px',
115
+ background: 'url(http://jqueryui.com/themeroller/themeswitchertool/images/icon_color_arrow.gif) 50% 50% no-repeat'
116
+ });
117
+ //pane css
118
+ switcherpane.css({
119
+ position: 'absolute',
120
+ float: 'left',
121
+ fontFamily: 'Trebuchet MS, Verdana, sans-serif',
122
+ fontSize: '12px',
123
+ background: '#000',
124
+ color: '#fff',
125
+ padding: '8px 3px 3px',
126
+ border: '1px solid #ccc',
127
+ '-moz-border-radius-bottomleft': '6px',
128
+ '-webkit-border-bottom-left-radius': '6px',
129
+ '-moz-border-radius-bottomright': '6px',
130
+ '-webkit-border-bottom-right-radius': '6px',
131
+ borderTop: 0,
132
+ zIndex: 999999,
133
+ width: options.width-6//minus must match left and right padding
134
+ })
135
+ .find('ul').css({
136
+ listStyle: 'none',
137
+ margin: '0',
138
+ padding: '0',
139
+ overflow: 'auto',
140
+ height: options.height
141
+ }).end()
142
+ .find('li').hover(
143
+ function(){
144
+ jQuery(this).css({
145
+ 'borderColor':'#555',
146
+ 'background': 'url(http://jqueryui.com/themeroller/themeswitchertool/images/menuhoverbg.png) 50% 50% repeat-x',
147
+ cursor: 'pointer'
148
+ });
149
+ },
150
+ function(){
151
+ jQuery(this).css({
152
+ 'borderColor':'#111',
153
+ 'background': '#000',
154
+ cursor: 'auto'
155
+ });
156
+ }
157
+ ).css({
158
+ width: options.width-30,
159
+ height: '',
160
+ padding: '2px',
161
+ margin: '1px',
162
+ border: '1px solid #111',
163
+ '-moz-border-radius': '4px',
164
+ clear: 'left',
165
+ float: 'left'
166
+ }).end()
167
+ .find('a').css({
168
+ color: '#aaa',
169
+ textDecoration: 'none',
170
+ float: 'left',
171
+ width: '100%',
172
+ outline: '0'
173
+ }).end()
174
+ .find('img').css({
175
+ float: 'left',
176
+ border: '1px solid #333',
177
+ margin: '0 2px'
178
+ }).end()
179
+ .find('.themeName').css({
180
+ float: 'left',
181
+ margin: '3px 0'
182
+ }).end();
183
+
184
+
185
+
186
+ jQuery(this).append(button);
187
+ jQuery('body').append(switcherpane);
188
+ switcherpane.hide();
189
+ var themeName = document.getElementById("frm_themepicker_name").value;
190
+ switcherpane.find('a:contains('+ themeName +')').trigger('click');
191
+
192
+ return this;
193
+ };
js/json2.js ADDED
@@ -0,0 +1,461 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ http://www.JSON.org/json2.js
3
+ 2008-03-24
4
+
5
+ Public Domain.
6
+
7
+ NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
8
+
9
+ See http://www.JSON.org/js.html
10
+
11
+ This file creates a global JSON object containing three methods: stringify,
12
+ parse, and quote.
13
+
14
+
15
+ JSON.stringify(value, replacer, space)
16
+ value any JavaScript value, usually an object or array.
17
+
18
+ replacer an optional parameter that determines how object
19
+ values are stringified for objects without a toJSON
20
+ method. It can be a function or an array.
21
+
22
+ space an optional parameter that specifies the indentation
23
+ of nested structures. If it is omitted, the text will
24
+ be packed without extra whitespace. If it is a number,
25
+ it will specify the number of spaces to indent at each
26
+ level. If it is a string (such as '\t'), it contains the
27
+ characters used to indent at each level.
28
+
29
+ This method produces a JSON text from a JavaScript value.
30
+
31
+ When an object value is found, if the object contains a toJSON
32
+ method, its toJSON method will be called and the result will be
33
+ stringified. A toJSON method does not serialize: it returns the
34
+ value represented by the name/value pair that should be serialized,
35
+ or undefined if nothing should be serialized. The toJSON method will
36
+ be passed the key associated with the value, and this will be bound
37
+ to the object holding the key.
38
+
39
+ This is the toJSON method added to Dates:
40
+
41
+ function toJSON(key) {
42
+ return this.getUTCFullYear() + '-' +
43
+ f(this.getUTCMonth() + 1) + '-' +
44
+ f(this.getUTCDate()) + 'T' +
45
+ f(this.getUTCHours()) + ':' +
46
+ f(this.getUTCMinutes()) + ':' +
47
+ f(this.getUTCSeconds()) + 'Z';
48
+ }
49
+
50
+ You can provide an optional replacer method. It will be passed the
51
+ key and value of each member, with this bound to the containing
52
+ object. The value that is returned from your method will be
53
+ serialized. If your method returns undefined, then the member will
54
+ be excluded from the serialization.
55
+
56
+ If no replacer parameter is provided, then a default replacer
57
+ will be used:
58
+
59
+ function replacer(key, value) {
60
+ return Object.hasOwnProperty.call(this, key) ?
61
+ value : undefined;
62
+ }
63
+
64
+ The default replacer is passed the key and value for each item in
65
+ the structure. It excludes inherited members.
66
+
67
+ If the replacer parameter is an array, then it will be used to
68
+ select the members to be serialized. It filters the results such
69
+ that only members with keys listed in the replacer array are
70
+ stringified.
71
+
72
+ Values that do not have JSON representaions, such as undefined or
73
+ functions, will not be serialized. Such values in objects will be
74
+ dropped; in arrays they will be replaced with null. You can use
75
+ a replacer function to replace those with JSON values.
76
+ JSON.stringify(undefined) returns undefined.
77
+
78
+ The optional space parameter produces a stringification of the value
79
+ that is filled with line breaks and indentation to make it easier to
80
+ read.
81
+
82
+ If the space parameter is a non-empty string, then that string will
83
+ be used for indentation. If the space parameter is a number, then
84
+ then indentation will be that many spaces.
85
+
86
+ Example:
87
+
88
+ text = JSON.stringify(['e', {pluribus: 'unum'}]);
89
+ // text is '["e",{"pluribus":"unum"}]'
90
+
91
+
92
+ text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
93
+ // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
94
+
95
+
96
+ JSON.parse(text, reviver)
97
+ This method parses a JSON text to produce an object or array.
98
+ It can throw a SyntaxError exception.
99
+
100
+ The optional reviver parameter is a function that can filter and
101
+ transform the results. It receives each of the keys and values,
102
+ and its return value is used instead of the original value.
103
+ If it returns what it received, then the structure is not modified.
104
+ If it returns undefined then the member is deleted.
105
+
106
+ Example:
107
+
108
+ // Parse the text. Values that look like ISO date strings will
109
+ // be converted to Date objects.
110
+
111
+ myData = JSON.parse(text, function (key, value) {
112
+ var a;
113
+ if (typeof value === 'string') {
114
+ a =
115
+ /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
116
+ if (a) {
117
+ return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
118
+ +a[5], +a[6]));
119
+ }
120
+ }
121
+ return value;
122
+ });
123
+
124
+
125
+ JSON.quote(text)
126
+ This method wraps a string in quotes, escaping some characters
127
+ as needed.
128
+
129
+
130
+ This is a reference implementation. You are free to copy, modify, or
131
+ redistribute.
132
+
133
+ USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD THIRD PARTY
134
+ CODE INTO YOUR PAGES.
135
+ */
136
+
137
+ /*jslint regexp: true, forin: true, evil: true */
138
+
139
+ /*global JSON */
140
+
141
+ /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
142
+ call, charCodeAt, floor, getUTCDate, getUTCFullYear, getUTCHours,
143
+ getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, length,
144
+ parse, propertyIsEnumerable, prototype, push, quote, replace, stringify,
145
+ test, toJSON, toString
146
+ */
147
+
148
+ if (!this.JSON) {
149
+
150
+ // Create a JSON object only if one does not already exist. We create the
151
+ // object in a closure to avoid global variables.
152
+
153
+ JSON = function () {
154
+
155
+ function f(n) { // Format integers to have at least two digits.
156
+ return n < 10 ? '0' + n : n;
157
+ }
158
+
159
+ Date.prototype.toJSON = function () {
160
+
161
+ // Eventually, this method will be based on the date.toISOString method.
162
+
163
+ return this.getUTCFullYear() + '-' +
164
+ f(this.getUTCMonth() + 1) + '-' +
165
+ f(this.getUTCDate()) + 'T' +
166
+ f(this.getUTCHours()) + ':' +
167
+ f(this.getUTCMinutes()) + ':' +
168
+ f(this.getUTCSeconds()) + 'Z';
169
+ };
170
+
171
+
172
+ var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g,
173
+ gap,
174
+ indent,
175
+ meta = { // table of character substitutions
176
+ '\b': '\\b',
177
+ '\t': '\\t',
178
+ '\n': '\\n',
179
+ '\f': '\\f',
180
+ '\r': '\\r',
181
+ '"' : '\\"',
182
+ '\\': '\\\\'
183
+ },
184
+ rep;
185
+
186
+
187
+ function quote(string) {
188
+
189
+ // If the string contains no control characters, no quote characters, and no
190
+ // backslash characters, then we can safely slap some quotes around it.
191
+ // Otherwise we must also replace the offending characters with safe escape
192
+ // sequences.
193
+
194
+ return escapeable.test(string) ?
195
+ '"' + string.replace(escapeable, function (a) {
196
+ var c = meta[a];
197
+ if (typeof c === 'string') {
198
+ return c;
199
+ }
200
+ c = a.charCodeAt();
201
+ return '\\u00' + Math.floor(c / 16).toString(16) +
202
+ (c % 16).toString(16);
203
+ }) + '"' :
204
+ '"' + string + '"';
205
+ }
206
+
207
+
208
+ function str(key, holder) {
209
+
210
+ // Produce a string from holder[key].
211
+
212
+ var i, // The loop counter.
213
+ k, // The member key.
214
+ v, // The member value.
215
+ length,
216
+ mind = gap,
217
+ partial,
218
+ value = holder[key];
219
+
220
+ // If the value has a toJSON method, call it to obtain a replacement value.
221
+
222
+ if (value && typeof value === 'object' &&
223
+ typeof value.toJSON === 'function') {
224
+ value = value.toJSON(key);
225
+ }
226
+
227
+ // If we were called with a replacer function, then call the replacer to
228
+ // obtain a replacement value.
229
+
230
+ if (typeof rep === 'function') {
231
+ value = rep.call(holder, key, value);
232
+ }
233
+
234
+ // What happens next depends on the value's type.
235
+
236
+ switch (typeof value) {
237
+ case 'string':
238
+ return quote(value);
239
+
240
+ case 'number':
241
+
242
+ // JSON numbers must be finite. Encode non-finite numbers as null.
243
+
244
+ return isFinite(value) ? String(value) : 'null';
245
+
246
+ case 'boolean':
247
+ case 'null':
248
+
249
+ // If the value is a boolean or null, convert it to a string. Note:
250
+ // typeof null does not produce 'null'. The case is included here in
251
+ // the remote chance that this gets fixed someday.
252
+
253
+ return String(value);
254
+
255
+ // If the type is 'object', we might be dealing with an object or an array or
256
+ // null.
257
+
258
+ case 'object':
259
+
260
+ // Due to a specification blunder in ECMAScript, typeof null is 'object',
261
+ // so watch out for that case.
262
+
263
+ if (!value) {
264
+ return 'null';
265
+ }
266
+
267
+ // Make an array to hold the partial results of stringifying this object value.
268
+
269
+ gap += indent;
270
+ partial = [];
271
+
272
+ // If the object has a dontEnum length property, we'll treat it as an array.
273
+
274
+ if (typeof value.length === 'number' &&
275
+ !(value.propertyIsEnumerable('length'))) {
276
+
277
+ // The object is an array. Stringify every element. Use null as a placeholder
278
+ // for non-JSON values.
279
+
280
+ length = value.length;
281
+ for (i = 0; i < length; i += 1) {
282
+ partial[i] = str(i, value) || 'null';
283
+ }
284
+
285
+ // Join all of the elements together, separated with commas, and wrap them in
286
+ // brackets.
287
+
288
+ v = partial.length === 0 ? '[]' :
289
+ gap ? '[\n' + gap + partial.join(',\n' + gap) +
290
+ '\n' + mind + ']' :
291
+ '[' + partial.join(',') + ']';
292
+ gap = mind;
293
+ return v;
294
+ }
295
+
296
+ // If the replacer is an array, use it to select the members to be stringified.
297
+
298
+ if (typeof rep === 'object') {
299
+ length = rep.length;
300
+ for (i = 0; i < length; i += 1) {
301
+ k = rep[i];
302
+ if (typeof k === 'string') {
303
+ v = str(k, value, rep);
304
+ if (v) {
305
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
306
+ }
307
+ }
308
+ }
309
+ } else {
310
+
311
+ // Otherwise, iterate through all of the keys in the object.
312
+
313
+ for (k in value) {
314
+ v = str(k, value, rep);
315
+ if (v) {
316
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
317
+ }
318
+ }
319
+ }
320
+
321
+ // Join all of the member texts together, separated with commas,
322
+ // and wrap them in braces.
323
+
324
+ v = partial.length === 0 ? '{}' :
325
+ gap ? '{\n' + gap + partial.join(',\n' + gap) +
326
+ '\n' + mind + '}' :
327
+ '{' + partial.join(',') + '}';
328
+ gap = mind;
329
+ return v;
330
+ }
331
+ }
332
+
333
+
334
+ // Return the JSON object containing the stringify, parse, and quote methods.
335
+
336
+ return {
337
+ stringify: function (value, replacer, space) {
338
+
339
+ // The stringify method takes a value and an optional replacer, and an optional
340
+ // space parameter, and returns a JSON text. The replacer can be a function
341
+ // that can replace values, or an array of strings that will select the keys.
342
+ // A default replacer method can be provided. Use of the space parameter can
343
+ // produce text that is more easily readable.
344
+
345
+ var i;
346
+ gap = '';
347
+ indent = '';
348
+ if (space) {
349
+
350
+ // If the space parameter is a number, make an indent string containing that
351
+ // many spaces.
352
+
353
+ if (typeof space === 'number') {
354
+ for (i = 0; i < space; i += 1) {
355
+ indent += ' ';
356
+ }
357
+
358
+ // If the space parameter is a string, it will be used as the indent string.
359
+
360
+ } else if (typeof space === 'string') {
361
+ indent = space;
362
+ }
363
+ }
364
+
365
+ // If there is no replacer parameter, use the default replacer.
366
+
367
+ if (!replacer) {
368
+ rep = function (key, value) {
369
+ if (!Object.hasOwnProperty.call(this, key)) {
370
+ return undefined;
371
+ }
372
+ return value;
373
+ };
374
+
375
+ // The replacer can be a function or an array. Otherwise, throw an error.
376
+
377
+ } else if (typeof replacer === 'function' ||
378
+ (typeof replacer === 'object' &&
379
+ typeof replacer.length === 'number')) {
380
+ rep = replacer;
381
+ } else {
382
+ throw new Error('JSON.stringify');
383
+ }
384
+
385
+ // Make a fake root object containing our value under the key of ''.
386
+ // Return the result of stringifying the value.
387
+
388
+ return str('', {'': value});
389
+ },
390
+
391
+
392
+ parse: function (text, reviver) {
393
+
394
+ // The parse method takes a text and an optional reviver function, and returns
395
+ // a JavaScript value if the text is a valid JSON text.
396
+
397
+ var j;
398
+
399
+ function walk(holder, key) {
400
+
401
+ // The walk method is used to recursively walk the resulting structure so
402
+ // that modifications can be made.
403
+
404
+ var k, v, value = holder[key];
405
+ if (value && typeof value === 'object') {
406
+ for (k in value) {
407
+ if (Object.hasOwnProperty.call(value, k)) {
408
+ v = walk(value, k);
409
+ if (v !== undefined) {
410
+ value[k] = v;
411
+ } else {
412
+ delete value[k];
413
+ }
414
+ }
415
+ }
416
+ }
417
+ return reviver.call(holder, key, value);
418
+ }
419
+
420
+
421
+ // Parsing happens in three stages. In the first stage, we run the text against
422
+ // regular expressions that look for non-JSON patterns. We are especially
423
+ // concerned with '()' and 'new' because they can cause invocation, and '='
424
+ // because it can cause mutation. But just to be safe, we want to reject all
425
+ // unexpected forms.
426
+
427
+ // We split the first stage into 4 regexp operations in order to work around
428
+ // crippling inefficiencies in IE's and Safari's regexp engines. First we
429
+ // replace all backslash pairs with '@' (a non-JSON character). Second, we
430
+ // replace all simple value tokens with ']' characters. Third, we delete all
431
+ // open brackets that follow a colon or comma or that begin the text. Finally,
432
+ // we look to see that the remaining characters are only whitespace or ']' or
433
+ // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
434
+
435
+ if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g, '@').
436
+ replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
437
+ replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
438
+
439
+ // In the second stage we use the eval function to compile the text into a
440
+ // JavaScript structure. The '{' operator is subject to a syntactic ambiguity
441
+ // in JavaScript: it can begin a block or an object literal. We wrap the text
442
+ // in parens to eliminate the ambiguity.
443
+
444
+ j = eval('(' + text + ')');
445
+
446
+ // In the optional third stage, we recursively walk the new structure, passing
447
+ // each name/value pair to a reviver function for possible transformation.
448
+
449
+ return typeof reviver === 'function' ?
450
+ walk({'': j}, '') : j;
451
+ }
452
+
453
+ // If the text is not JSON parseable, then a SyntaxError is thrown.
454
+
455
+ throw new SyntaxError('JSON.parse');
456
+ },
457
+
458
+ quote: quote
459
+ };
460
+ }();
461
+ }
js/list-items.js CHANGED
@@ -32,14 +32,12 @@ jQuery(document).ready(function(){
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(
@@ -51,16 +49,15 @@ 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
  });
32
  }
33
  });
34
 
35
+ jQuery('.toggle_container').hide();
36
+ jQuery('.trigger').toggle(
 
37
  function(){jQuery(this).addClass("active");},
38
  function(){jQuery(this).removeClass("active");}
39
+ );
40
+ jQuery('.trigger').click(function(){jQuery(this).next(".toggle_container").slideToggle("slow");});
 
41
 
42
  jQuery('.ui-icon-trash.frm_delete_field_option').hide();
43
  jQuery('.frm_single_option').hover(
49
  jQuery('.edit_form_item .ui-icon-arrowthick-2-n-s').hide();
50
  jQuery('.edit_form_item .postbox').hide();
51
  jQuery('.ui-state-default').hover(
52
+ function(){
53
+ jQuery(this).children(".ui-icon-trash").show();
54
+ jQuery(this).children(".ui-icon-arrowthick-2-n-s").show();
55
+ jQuery(this).children(".postbox").show();
56
+ },
57
+ function(){
58
+ jQuery(this).children(".ui-icon-trash").hide();
59
+ jQuery(this).children(".ui-icon-arrowthick-2-n-s").hide();
60
+ jQuery(this).children(".postbox").hide();
61
+ }
62
  );
 
 
 
 
 
 
 
 
 
63
  });
js/nicedit.js ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* NicEdit - Micro Inline WYSIWYG
2
+ * Copyright 2007-2008 Brian Kirchoff
3
+ *
4
+ * NicEdit is distributed under the terms of the MIT license
5
+ * For more information visit http://nicedit.com/
6
+ * Do not remove this copyright message
7
+ */
8
+ var bkExtend=function(){var A=arguments;if(A.length==1){A=[this,A[0]]}for(var B in A[1]){A[0][B]=A[1][B]}return A[0]};function bkClass(){}bkClass.prototype.construct=function(){};bkClass.extend=function(C){var A=function(){if(arguments[0]!==bkClass){return this.construct.apply(this,arguments)}};var B=new this(bkClass);bkExtend(B,C);A.prototype=B;A.extend=this.extend;return A};var bkElement=bkClass.extend({construct:function(B,A){if(typeof (B)=="string"){B=(A||document).createElement(B)}B=$BK(B);return B},appendTo:function(A){A.appendChild(this);return this},appendBefore:function(A){A.parentNode.insertBefore(this,A);return this},addEvent:function(B,A){bkLib.addEvent(this,B,A);return this},setContent:function(A){this.innerHTML=A;return this},pos:function(){var C=curtop=0;var B=obj=this;if(obj.offsetParent){do{C+=obj.offsetLeft;curtop+=obj.offsetTop}while(obj=obj.offsetParent)}var A=(!window.opera)?parseInt(this.getStyle("border-width")||this.style.border)||0:0;return[C+A,curtop+A+this.offsetHeight]},noSelect:function(){bkLib.noSelect(this);return this},parentTag:function(A){var B=this;do{if(B&&B.nodeName&&B.nodeName.toUpperCase()==A){return B}B=B.parentNode}while(B);return false},hasClass:function(A){return this.className.match(new RegExp("(\\s|^)nicEdit-"+A+"(\\s|$)"))},addClass:function(A){if(!this.hasClass(A)){this.className+=" nicEdit-"+A}return this},removeClass:function(A){if(this.hasClass(A)){this.className=this.className.replace(new RegExp("(\\s|^)nicEdit-"+A+"(\\s|$)")," ")}return this},setStyle:function(A){var B=this.style;for(var C in A){switch(C){case"float":B.cssFloat=B.styleFloat=A[C];break;case"opacity":B.opacity=A[C];B.filter="alpha(opacity="+Math.round(A[C]*100)+")";break;case"className":this.className=A[C];break;default:B[C]=A[C]}}return this},getStyle:function(A,C){var B=(!C)?document.defaultView:C;if(this.nodeType==1){return(B&&B.getComputedStyle)?B.getComputedStyle(this,null).getPropertyValue(A):this.currentStyle[bkLib.camelize(A)]}},remove:function(){this.parentNode.removeChild(this);return this},setAttributes:function(A){for(var B in A){this[B]=A[B]}return this}});var bkLib={isMSIE:(navigator.appVersion.indexOf("MSIE")!=-1),addEvent:function(C,B,A){(C.addEventListener)?C.addEventListener(B,A,false):C.attachEvent("on"+B,A)},toArray:function(C){var B=C.length,A=new Array(B);while(B--){A[B]=C[B]}return A},noSelect:function(B){if(B.setAttribute&&B.nodeName.toLowerCase()!="input"&&B.nodeName.toLowerCase()!="textarea"){B.setAttribute("unselectable","on")}for(var A=0;A<B.childNodes.length;A++){bkLib.noSelect(B.childNodes[A])}},camelize:function(A){return A.replace(/\-(.)/g,function(B,C){return C.toUpperCase()})},inArray:function(A,B){return(bkLib.search(A,B)!=null)},search:function(A,C){for(var B=0;B<A.length;B++){if(A[B]==C){return B}}return null},cancelEvent:function(A){A=A||window.event;if(A.preventDefault&&A.stopPropagation){A.preventDefault();A.stopPropagation()}return false},domLoad:[],domLoaded:function(){if(arguments.callee.done){return }arguments.callee.done=true;for(i=0;i<bkLib.domLoad.length;i++){bkLib.domLoad[i]()}},onDomLoaded:function(A){this.domLoad.push(A);if(document.addEventListener){document.addEventListener("DOMContentLoaded",bkLib.domLoaded,null)}else{if(bkLib.isMSIE){document.write("<style>.nicEdit-main p { margin: 0; }</style><script id=__ie_onload defer "+((location.protocol=="https:")?"src='javascript:void(0)'":"src=//0")+"><\/script>");$BK("__ie_onload").onreadystatechange=function(){if(this.readyState=="complete"){bkLib.domLoaded()}}}}window.onload=bkLib.domLoaded}};function $BK(A){if(typeof (A)=="string"){A=document.getElementById(A)}return(A&&!A.appendTo)?bkExtend(A,bkElement.prototype):A}var bkEvent={addEvent:function(A,B){if(B){this.eventList=this.eventList||{};this.eventList[A]=this.eventList[A]||[];this.eventList[A].push(B)}return this},fireEvent:function(){var A=bkLib.toArray(arguments),C=A.shift();if(this.eventList&&this.eventList[C]){for(var B=0;B<this.eventList[C].length;B++){this.eventList[C][B].apply(this,A)}}}};function __(A){return A}Function.prototype.closure=function(){var A=this,B=bkLib.toArray(arguments),C=B.shift();return function(){if(typeof (bkLib)!="undefined"){return A.apply(C,B.concat(bkLib.toArray(arguments)))}}};Function.prototype.closureListener=function(){var A=this,C=bkLib.toArray(arguments),B=C.shift();return function(E){E=E||window.event;if(E.target){var D=E.target}else{var D=E.srcElement}return A.apply(B,[E,D].concat(C))}};
9
+
10
+ var nicEditorConfig = bkClass.extend({
11
+ buttons : {
12
+ 'bold' : {name : __('Click to Bold'), command : 'Bold', tags : ['B','STRONG'], css : {'font-weight' : 'bold'}, key : 'b'},
13
+ 'italic' : {name : __('Click to Italic'), command : 'Italic', tags : ['EM','I'], css : {'font-style' : 'italic'}, key : 'i'},
14
+ 'underline' : {name : __('Click to Underline'), command : 'Underline', tags : ['U'], css : {'text-decoration' : 'underline'}, key : 'u'},
15
+ 'left' : {name : __('Left Align'), command : 'justifyleft', noActive : true},
16
+ 'center' : {name : __('Center Align'), command : 'justifycenter', noActive : true},
17
+ 'right' : {name : __('Right Align'), command : 'justifyright', noActive : true},
18
+ 'justify' : {name : __('Justify Align'), command : 'justifyfull', noActive : true},
19
+ 'ol' : {name : __('Insert Ordered List'), command : 'insertorderedlist', tags : ['OL']},
20
+ 'ul' : {name : __('Insert Unordered List'), command : 'insertunorderedlist', tags : ['UL']},
21
+ 'subscript' : {name : __('Click to Subscript'), command : 'subscript', tags : ['SUB']},
22
+ 'superscript' : {name : __('Click to Superscript'), command : 'superscript', tags : ['SUP']},
23
+ 'strikethrough' : {name : __('Click to Strike Through'), command : 'strikeThrough', css : {'text-decoration' : 'line-through'}},
24
+ 'removeformat' : {name : __('Remove Formatting'), command : 'removeformat', noActive : true},
25
+ 'indent' : {name : __('Indent Text'), command : 'indent', noActive : true},
26
+ 'outdent' : {name : __('Remove Indent'), command : 'outdent', noActive : true},
27
+ 'hr' : {name : __('Horizontal Rule'), command : 'insertHorizontalRule', noActive : true}
28
+ },
29
+ iconsPath : 'http://js.nicedit.com/nicEditIcons-latest.gif',
30
+ buttonList : ['save','bold','italic','underline','left','center','right','justify','ol','ul','fontSize','fontFamily','fontFormat','indent','outdent','image','upload','link','unlink','forecolor','bgcolor'],
31
+ iconList : {"xhtml":1,"bgcolor":2,"forecolor":3,"bold":4,"center":5,"hr":6,"indent":7,"italic":8,"justify":9,"left":10,"ol":11,"outdent":12,"removeformat":13,"right":14,"save":25,"strikethrough":16,"subscript":17,"superscript":18,"ul":19,"underline":20,"image":21,"link":22,"unlink":23,"close":24,"arrow":26,"upload":27}
32
+
33
+ });
34
+ ;
35
+ var nicEditors={nicPlugins:[],editors:[],registerPlugin:function(B,A){this.nicPlugins.push({p:B,o:A})},allTextAreas:function(C){var A=document.getElementsByTagName("textarea");for(var B=0;B<A.length;B++){nicEditors.editors.push(new nicEditor(C).panelInstance(A[B]))}return nicEditors.editors},findEditor:function(C){var B=nicEditors.editors;for(var A=0;A<B.length;A++){if(B[A].instanceById(C)){return B[A].instanceById(C)}}}};var nicEditor=bkClass.extend({construct:function(C){this.options=new nicEditorConfig();bkExtend(this.options,C);this.nicInstances=new Array();this.loadedPlugins=new Array();var A=nicEditors.nicPlugins;for(var B=0;B<A.length;B++){this.loadedPlugins.push(new A[B].p(this,A[B].o))}nicEditors.editors.push(this);bkLib.addEvent(document.body,"mousedown",this.selectCheck.closureListener(this))},panelInstance:function(B,C){B=this.checkReplace($BK(B));var A=new bkElement("DIV").setStyle({width:(parseInt(B.getStyle("width"))||B.clientWidth)+"px"}).appendBefore(B);this.setPanel(A);return this.addInstance(B,C)},checkReplace:function(B){var A=nicEditors.findEditor(B);if(A){A.removeInstance(B);A.removePanel()}return B},addInstance:function(B,C){B=this.checkReplace($BK(B));if(B.contentEditable||!!window.opera){var A=new nicEditorInstance(B,C,this)}else{var A=new nicEditorIFrameInstance(B,C,this)}this.nicInstances.push(A);return this},removeInstance:function(C){C=$BK(C);var B=this.nicInstances;for(var A=0;A<B.length;A++){if(B[A].e==C){B[A].remove();this.nicInstances.splice(A,1)}}},removePanel:function(A){if(this.nicPanel){this.nicPanel.remove();this.nicPanel=null}},instanceById:function(C){C=$BK(C);var B=this.nicInstances;for(var A=0;A<B.length;A++){if(B[A].e==C){return B[A]}}},setPanel:function(A){this.nicPanel=new nicEditorPanel($BK(A),this.options,this);this.fireEvent("panel",this.nicPanel);return this},nicCommand:function(B,A){if(this.selectedInstance){this.selectedInstance.nicCommand(B,A)}},getIcon:function(D,A){var C=this.options.iconList[D];var B=(A.iconFiles)?A.iconFiles[D]:"";return{backgroundImage:"url('"+((C)?this.options.iconsPath:B)+"')",backgroundPosition:((C)?((C-1)*-18):0)+"px 0px"}},selectCheck:function(C,A){var B=false;do{if(A.className&&A.className.indexOf("nicEdit")!=-1){return false}}while(A=A.parentNode);this.fireEvent("blur",this.selectedInstance,A);this.lastSelectedInstance=this.selectedInstance;this.selectedInstance=null;return false}});nicEditor=nicEditor.extend(bkEvent);
36
+ var nicEditorInstance=bkClass.extend({isSelected:false,construct:function(G,D,C){this.ne=C;this.elm=this.e=G;this.options=D||{};newX=parseInt(G.getStyle("width"))||G.clientWidth;newY=parseInt(G.getStyle("height"))||G.clientHeight;this.initialHeight=newY-8;var H=(G.nodeName.toLowerCase()=="textarea");if(H||this.options.hasPanel){var B=(bkLib.isMSIE&&!((typeof document.body.style.maxHeight!="undefined")&&document.compatMode=="CSS1Compat"));var E={width:newX+"px",border:"1px solid #ccc",borderTop:0,overflowY:"auto",overflowX:"hidden"};E[(B)?"height":"maxHeight"]=(this.ne.options.maxHeight)?this.ne.options.maxHeight+"px":null;this.editorContain=new bkElement("DIV").setStyle(E).appendBefore(G);var A=new bkElement("DIV").setStyle({width:(newX-8)+"px",margin:"4px",minHeight:newY+"px"}).addClass("main").appendTo(this.editorContain);G.setStyle({display:"none"});A.innerHTML=G.innerHTML;if(H){A.setContent(G.value);this.copyElm=G;var F=G.parentTag("FORM");if(F){bkLib.addEvent(F,"submit",this.saveContent.closure(this))}}A.setStyle((B)?{height:newY+"px"}:{overflow:"hidden"});this.elm=A}this.ne.addEvent("blur",this.blur.closure(this));this.init();this.blur()},init:function(){this.elm.setAttribute("contentEditable","true");if(this.getContent()==""){this.setContent("<br />")}this.instanceDoc=document.defaultView;this.elm.addEvent("mousedown",this.selected.closureListener(this)).addEvent("keypress",this.keyDown.closureListener(this)).addEvent("focus",this.selected.closure(this)).addEvent("blur",this.blur.closure(this)).addEvent("keyup",this.selected.closure(this));this.ne.fireEvent("add",this)},remove:function(){this.saveContent();if(this.copyElm||this.options.hasPanel){this.editorContain.remove();this.e.setStyle({display:"block"});this.ne.removePanel()}this.disable();this.ne.fireEvent("remove",this)},disable:function(){this.elm.setAttribute("contentEditable","false")},getSel:function(){return(window.getSelection)?window.getSelection():document.selection},getRng:function(){var A=this.getSel();if(!A){return null}return(A.rangeCount>0)?A.getRangeAt(0):A.createRange()},selRng:function(A,B){if(window.getSelection){B.removeAllRanges();B.addRange(A)}else{A.select()}},selElm:function(){var C=this.getRng();if(C.startContainer){var D=C.startContainer;if(C.cloneContents().childNodes.length==1){for(var B=0;B<D.childNodes.length;B++){var A=D.childNodes[B].ownerDocument.createRange();A.selectNode(D.childNodes[B]);if(C.compareBoundaryPoints(Range.START_TO_START,A)!=1&&C.compareBoundaryPoints(Range.END_TO_END,A)!=-1){return $BK(D.childNodes[B])}}}return $BK(D)}else{return $BK((this.getSel().type=="Control")?C.item(0):C.parentElement())}},saveRng:function(){this.savedRange=this.getRng();this.savedSel=this.getSel()},restoreRng:function(){if(this.savedRange){this.selRng(this.savedRange,this.savedSel)}},keyDown:function(B,A){if(B.ctrlKey){this.ne.fireEvent("key",this,B)}},selected:function(C,A){if(!A){A=this.selElm()}if(!C.ctrlKey){var B=this.ne.selectedInstance;if(B!=this){if(B){this.ne.fireEvent("blur",B,A)}this.ne.selectedInstance=this;this.ne.fireEvent("focus",B,A)}this.ne.fireEvent("selected",B,A);this.isFocused=true;this.elm.addClass("selected")}return false},blur:function(){this.isFocused=false;this.elm.removeClass("selected")},saveContent:function(){if(this.copyElm||this.options.hasPanel){this.ne.fireEvent("save",this);(this.copyElm)?this.copyElm.value=this.getContent():this.e.innerHTML=this.getContent()}},getElm:function(){return this.elm},getContent:function(){this.content=this.getElm().innerHTML;this.ne.fireEvent("get",this);return this.content},setContent:function(A){this.content=A;this.ne.fireEvent("set",this);this.elm.innerHTML=this.content},nicCommand:function(B,A){document.execCommand(B,false,A)}});
37
+ var nicEditorIFrameInstance=nicEditorInstance.extend({savedStyles:[],init:function(){var B=this.elm.innerHTML.replace(/^\s+|\s+$/g,"");this.elm.innerHTML="";(!B)?B="<br />":B;this.initialContent=B;this.elmFrame=new bkElement("iframe").setAttributes({src:"javascript:;",frameBorder:0,allowTransparency:"true",scrolling:"no"}).setStyle({height:"100px",width:"100%"}).addClass("frame").appendTo(this.elm);if(this.copyElm){this.elmFrame.setStyle({width:(this.elm.offsetWidth-4)+"px"})}var A=["font-size","font-family","font-weight","color"];for(itm in A){this.savedStyles[bkLib.camelize(itm)]=this.elm.getStyle(itm)}setTimeout(this.initFrame.closure(this),50)},disable:function(){this.elm.innerHTML=this.getContent()},initFrame:function(){var B=$BK(this.elmFrame.contentWindow.document);B.designMode="on";B.open();var A=this.ne.options.externalCSS;B.write("<html><head>"+((A)?'<link href="'+A+'" rel="stylesheet" type="text/css" />':"")+'</head><body id="nicEditContent" style="margin: 0 !important; background-color: transparent !important;">'+this.initialContent+"</body></html>");B.close();this.frameDoc=B;this.frameWin=$BK(this.elmFrame.contentWindow);this.frameContent=$BK(this.frameWin.document.body).setStyle(this.savedStyles);this.instanceDoc=this.frameWin.document.defaultView;this.heightUpdate();this.frameDoc.addEvent("mousedown",this.selected.closureListener(this)).addEvent("keyup",this.heightUpdate.closureListener(this)).addEvent("keydown",this.keyDown.closureListener(this)).addEvent("keyup",this.selected.closure(this));this.ne.fireEvent("add",this)},getElm:function(){return this.frameContent},setContent:function(A){this.content=A;this.ne.fireEvent("set",this);this.frameContent.innerHTML=this.content;this.heightUpdate()},getSel:function(){return(this.frameWin)?this.frameWin.getSelection():this.frameDoc.selection},heightUpdate:function(){this.elmFrame.style.height=Math.max(this.frameContent.offsetHeight,this.initialHeight)+"px"},nicCommand:function(B,A){this.frameDoc.execCommand(B,false,A);setTimeout(this.heightUpdate.closure(this),100)}});
38
+ var nicEditorPanel=bkClass.extend({construct:function(E,B,A){this.elm=E;this.options=B;this.ne=A;this.panelButtons=new Array();this.buttonList=bkExtend([],this.ne.options.buttonList);this.panelContain=new bkElement("DIV").setStyle({overflow:"hidden",width:"100%",border:"1px solid #cccccc",backgroundColor:"#efefef"}).addClass("panelContain");this.panelElm=new bkElement("DIV").setStyle({margin:"2px",marginTop:"0px",zoom:1,overflow:"hidden"}).addClass("panel").appendTo(this.panelContain);this.panelContain.appendTo(E);var C=this.ne.options;var D=C.buttons;for(button in D){this.addButton(button,C,true)}this.reorder();E.noSelect()},addButton:function(buttonName,options,noOrder){var button=options.buttons[buttonName];var type=(button.type)?eval("(typeof("+button.type+') == "undefined") ? null : '+button.type+";"):nicEditorButton;var hasButton=bkLib.inArray(this.buttonList,buttonName);if(type&&(hasButton||this.ne.options.fullPanel)){this.panelButtons.push(new type(this.panelElm,buttonName,options,this.ne));if(!hasButton){this.buttonList.push(buttonName)}}},findButton:function(B){for(var A=0;A<this.panelButtons.length;A++){if(this.panelButtons[A].name==B){return this.panelButtons[A]}}},reorder:function(){var C=this.buttonList;for(var B=0;B<C.length;B++){var A=this.findButton(C[B]);if(A){this.panelElm.appendChild(A.margin)}}},remove:function(){this.elm.remove()}});
39
+ var nicEditorButton=bkClass.extend({construct:function(D,A,C,B){this.options=C.buttons[A];this.name=A;this.ne=B;this.elm=D;this.margin=new bkElement("DIV").setStyle({"float":"left",marginTop:"2px"}).appendTo(D);this.contain=new bkElement("DIV").setStyle({width:"20px",height:"20px"}).addClass("buttonContain").appendTo(this.margin);this.border=new bkElement("DIV").setStyle({backgroundColor:"#efefef",border:"1px solid #efefef"}).appendTo(this.contain);this.button=new bkElement("DIV").setStyle({width:"18px",height:"18px",overflow:"hidden",zoom:1,cursor:"pointer"}).addClass("button").setStyle(this.ne.getIcon(A,C)).appendTo(this.border);this.button.addEvent("mouseover",this.hoverOn.closure(this)).addEvent("mouseout",this.hoverOff.closure(this)).addEvent("mousedown",this.mouseClick.closure(this)).noSelect();if(!window.opera){this.button.onmousedown=this.button.onclick=bkLib.cancelEvent}B.addEvent("selected",this.enable.closure(this)).addEvent("blur",this.disable.closure(this)).addEvent("key",this.key.closure(this));this.disable();this.init()},init:function(){},hide:function(){this.contain.setStyle({display:"none"})},updateState:function(){if(this.isDisabled){this.setBg()}else{if(this.isHover){this.setBg("hover")}else{if(this.isActive){this.setBg("active")}else{this.setBg()}}}},setBg:function(A){switch(A){case"hover":var B={border:"1px solid #666",backgroundColor:"#ddd"};break;case"active":var B={border:"1px solid #666",backgroundColor:"#ccc"};break;default:var B={border:"1px solid #efefef",backgroundColor:"#efefef"}}this.border.setStyle(B).addClass("button-"+A)},checkNodes:function(A){var B=A;do{if(this.options.tags&&bkLib.inArray(this.options.tags,B.nodeName)){this.activate();return true}}while(B=B.parentNode&&B.className!="nicEdit");B=$BK(A);while(B.nodeType==3){B=$BK(B.parentNode)}if(this.options.css){for(itm in this.options.css){if(B.getStyle(itm,this.ne.selectedInstance.instanceDoc)==this.options.css[itm]){this.activate();return true}}}this.deactivate();return false},activate:function(){if(!this.isDisabled){this.isActive=true;this.updateState();this.ne.fireEvent("buttonActivate",this)}},deactivate:function(){this.isActive=false;this.updateState();if(!this.isDisabled){this.ne.fireEvent("buttonDeactivate",this)}},enable:function(A,B){this.isDisabled=false;this.contain.setStyle({opacity:1}).addClass("buttonEnabled");this.updateState();this.checkNodes(B)},disable:function(A,B){this.isDisabled=true;this.contain.setStyle({opacity:0.6}).removeClass("buttonEnabled");this.updateState()},toggleActive:function(){(this.isActive)?this.deactivate():this.activate()},hoverOn:function(){if(!this.isDisabled){this.isHover=true;this.updateState();this.ne.fireEvent("buttonOver",this)}},hoverOff:function(){this.isHover=false;this.updateState();this.ne.fireEvent("buttonOut",this)},mouseClick:function(){if(this.options.command){this.ne.nicCommand(this.options.command,this.options.commandArgs);if(!this.options.noActive){this.toggleActive()}}this.ne.fireEvent("buttonClick",this)},key:function(A,B){if(this.options.key&&B.ctrlKey&&String.fromCharCode(B.keyCode||B.charCode).toLowerCase()==this.options.key){this.mouseClick();if(B.preventDefault){B.preventDefault()}}}});
40
+ var nicPlugin=bkClass.extend({construct:function(B,A){this.options=A;this.ne=B;this.ne.addEvent("panel",this.loadPanel.closure(this));this.init()},loadPanel:function(C){var B=this.options.buttons;for(var A in B){C.addButton(A,this.options)}C.reorder()},init:function(){}});
41
+
42
+
43
+ var nicPaneOptions = { };
44
+
45
+ var nicEditorPane=bkClass.extend({construct:function(D,C,B,A){this.ne=C;this.elm=D;this.pos=D.pos();this.contain=new bkElement("div").setStyle({zIndex:"99999",overflow:"hidden",position:"absolute",left:this.pos[0]+"px",top:this.pos[1]+"px"});this.pane=new bkElement("div").setStyle({fontSize:"12px",border:"1px solid #ccc",overflow:"hidden",padding:"4px",textAlign:"left",backgroundColor:"#ffffc9"}).addClass("pane").setStyle(B).appendTo(this.contain);if(A&&!A.options.noClose){this.close=new bkElement("div").setStyle({"float":"right",height:"16px",width:"16px",cursor:"pointer"}).setStyle(this.ne.getIcon("close",nicPaneOptions)).addEvent("mousedown",A.removePane.closure(this)).appendTo(this.pane)}this.contain.noSelect().appendTo(document.body);this.position();this.init()},init:function(){},position:function(){if(this.ne.nicPanel){var B=this.ne.nicPanel.elm;var A=B.pos();var C=A[0]+parseInt(B.getStyle("width"))-(parseInt(this.pane.getStyle("width"))+8);if(C<this.pos[0]){this.contain.setStyle({left:C+"px"})}}},toggle:function(){this.isVisible=!this.isVisible;this.contain.setStyle({display:((this.isVisible)?"block":"none")})},remove:function(){if(this.contain){this.contain.remove();this.contain=null}},append:function(A){A.appendTo(this.pane)},setContent:function(A){this.pane.setContent(A)}});
46
+
47
+
48
+ var nicSelectOptions = {
49
+ buttons : {
50
+ 'fontSize' : {name : __('Select Font Size'), type : 'nicEditorFontSizeSelect', command : 'fontsize'},
51
+ 'fontFamily' : {name : __('Select Font Family'), type : 'nicEditorFontFamilySelect', command : 'fontname'},
52
+ 'fontFormat' : {name : __('Select Font Format'), type : 'nicEditorFontFormatSelect', command : 'formatBlock'}
53
+ }
54
+ };
55
+
56
+ var nicEditorSelect=bkClass.extend({construct:function(D,A,C,B){this.options=C.buttons[A];this.elm=D;this.ne=B;this.name=A;this.selOptions=new Array();this.margin=new bkElement("div").setStyle({"float":"left",margin:"2px 1px 0 1px"}).appendTo(this.elm);this.contain=new bkElement("div").setStyle({width:"90px",height:"20px",cursor:"pointer",overflow:"hidden"}).addClass("selectContain").addEvent("click",this.toggle.closure(this)).appendTo(this.margin);this.items=new bkElement("div").setStyle({overflow:"hidden",zoom:1,border:"1px solid #ccc",paddingLeft:"3px",backgroundColor:"#fff"}).appendTo(this.contain);this.control=new bkElement("div").setStyle({overflow:"hidden","float":"right",height:"18px",width:"16px"}).addClass("selectControl").setStyle(this.ne.getIcon("arrow",C)).appendTo(this.items);this.txt=new bkElement("div").setStyle({overflow:"hidden","float":"left",width:"66px",height:"14px",marginTop:"1px",fontFamily:"sans-serif",textAlign:"center",fontSize:"12px"}).addClass("selectTxt").appendTo(this.items);if(!window.opera){this.contain.onmousedown=this.control.onmousedown=this.txt.onmousedown=bkLib.cancelEvent}this.margin.noSelect();this.ne.addEvent("selected",this.enable.closure(this)).addEvent("blur",this.disable.closure(this));this.disable();this.init()},disable:function(){this.isDisabled=true;this.close();this.contain.setStyle({opacity:0.6})},enable:function(A){this.isDisabled=false;this.close();this.contain.setStyle({opacity:1})},setDisplay:function(A){this.txt.setContent(A)},toggle:function(){if(!this.isDisabled){(this.pane)?this.close():this.open()}},open:function(){this.pane=new nicEditorPane(this.items,this.ne,{width:"88px",padding:"0px",borderTop:0,borderLeft:"1px solid #ccc",borderRight:"1px solid #ccc",borderBottom:"0px",backgroundColor:"#fff"});for(var C=0;C<this.selOptions.length;C++){var B=this.selOptions[C];var A=new bkElement("div").setStyle({overflow:"hidden",borderBottom:"1px solid #ccc",width:"88px",textAlign:"left",overflow:"hidden",cursor:"pointer"});var D=new bkElement("div").setStyle({padding:"0px 4px"}).setContent(B[1]).appendTo(A).noSelect();D.addEvent("click",this.update.closure(this,B[0])).addEvent("mouseover",this.over.closure(this,D)).addEvent("mouseout",this.out.closure(this,D)).setAttributes("id",B[0]);this.pane.append(A);if(!window.opera){D.onmousedown=bkLib.cancelEvent}}},close:function(){if(this.pane){this.pane=this.pane.remove()}},over:function(A){A.setStyle({backgroundColor:"#ccc"})},out:function(A){A.setStyle({backgroundColor:"#fff"})},add:function(B,A){this.selOptions.push(new Array(B,A))},update:function(A){this.ne.nicCommand(this.options.command,A);this.close()}});var nicEditorFontSizeSelect=nicEditorSelect.extend({sel:{1:"1&nbsp;(8pt)",2:"2&nbsp;(10pt)",3:"3&nbsp;(12pt)",4:"4&nbsp;(14pt)",5:"5&nbsp;(18pt)",6:"6&nbsp;(24pt)"},init:function(){this.setDisplay("Font&nbsp;Size...");for(itm in this.sel){this.add(itm,'<font size="'+itm+'">'+this.sel[itm]+"</font>")}}});var nicEditorFontFamilySelect=nicEditorSelect.extend({sel:{arial:"Arial","comic sans ms":"Comic Sans","courier new":"Courier New",georgia:"Georgia",helvetica:"Helvetica",impact:"Impact","times new roman":"Times","trebuchet ms":"Trebuchet",verdana:"Verdana"},init:function(){this.setDisplay("Font&nbsp;Family...");for(itm in this.sel){this.add(itm,'<font face="'+itm+'">'+this.sel[itm]+"</font>")}}});var nicEditorFontFormatSelect=nicEditorSelect.extend({sel:{p:"Paragraph",pre:"Pre",h6:"Heading&nbsp;6",h5:"Heading&nbsp;5",h4:"Heading&nbsp;4",h3:"Heading&nbsp;3",h2:"Heading&nbsp;2",h1:"Heading&nbsp;1"},init:function(){this.setDisplay("Font&nbsp;Format...");for(itm in this.sel){var A=itm.toUpperCase();this.add("<"+A+">","<"+itm+' style="padding: 0px; margin: 0px;">'+this.sel[itm]+"</"+A+">")}}});nicEditors.registerPlugin(nicPlugin,nicSelectOptions);
57
+
58
+ var nicButtonTips=bkClass.extend({construct:function(A){this.ne=A;A.addEvent("buttonOver",this.show.closure(this)).addEvent("buttonOut",this.hide.closure(this))},show:function(A){this.timer=setTimeout(this.create.closure(this,A),400)},create:function(A){this.timer=null;if(!this.pane){this.pane=new nicEditorPane(A.button,this.ne,{fontSize:"12px",marginTop:"5px"});this.pane.setContent(A.options.name)}},hide:function(A){if(this.timer){clearTimeout(this.timer)}if(this.pane){this.pane=this.pane.remove()}}});nicEditors.registerPlugin(nicButtonTips);
59
+
60
+ var nicEditorAdvancedButton=nicEditorButton.extend({init:function(){this.ne.addEvent("selected",this.removePane.closure(this)).addEvent("blur",this.removePane.closure(this))},mouseClick:function(){if(!this.isDisabled){if(this.pane&&this.pane.pane){this.removePane()}else{this.pane=new nicEditorPane(this.contain,this.ne,{width:(this.width||"270px"),backgroundColor:"#fff"},this);this.addPane();this.ne.selectedInstance.saveRng()}}},addForm:function(C,G){this.form=new bkElement("form").addEvent("submit",this.submit.closureListener(this));this.pane.append(this.form);this.inputs={};for(itm in C){var D=C[itm];var F="";if(G){F=G.getAttribute(itm)}if(!F){F=D.value||""}var A=C[itm].type;if(A=="title"){new bkElement("div").setContent(D.txt).setStyle({fontSize:"14px",fontWeight:"bold",padding:"0px",margin:"2px 0"}).appendTo(this.form)}else{var B=new bkElement("div").setStyle({overflow:"hidden",clear:"both"}).appendTo(this.form);if(D.txt){new bkElement("label").setAttributes({"for":itm}).setContent(D.txt).setStyle({margin:"2px 4px",fontSize:"13px",width:"50px",lineHeight:"20px",textAlign:"right","float":"left"}).appendTo(B)}switch(A){case"text":this.inputs[itm]=new bkElement("input").setAttributes({id:itm,value:F,type:"text"}).setStyle({margin:"2px 0",fontSize:"13px","float":"left",height:"20px",border:"1px solid #ccc",overflow:"hidden"}).setStyle(D.style).appendTo(B);break;case"select":this.inputs[itm]=new bkElement("select").setAttributes({id:itm}).setStyle({border:"1px solid #ccc","float":"left",margin:"2px 0"}).appendTo(B);for(opt in D.options){var E=new bkElement("option").setAttributes({value:opt,selected:(opt==F)?"selected":""}).setContent(D.options[opt]).appendTo(this.inputs[itm])}break;case"content":this.inputs[itm]=new bkElement("textarea").setAttributes({id:itm}).setStyle({border:"1px solid #ccc","float":"left"}).setStyle(D.style).appendTo(B);this.inputs[itm].value=F}}}new bkElement("input").setAttributes({type:"submit"}).setStyle({backgroundColor:"#efefef",border:"1px solid #ccc",margin:"3px 0","float":"left",clear:"both"}).appendTo(this.form);this.form.onsubmit=bkLib.cancelEvent},submit:function(){},findElm:function(B,A,E){var D=this.ne.selectedInstance.getElm().getElementsByTagName(B);for(var C=0;C<D.length;C++){if(D[C].getAttribute(A)==E){return $BK(D[C])}}},removePane:function(){if(this.pane){this.pane.remove();this.pane=null;this.ne.selectedInstance.restoreRng()}}});
61
+
62
+
63
+ var nicLinkOptions = {
64
+ buttons : {
65
+ 'link' : {name : 'Add Link', type : 'nicLinkButton', tags : ['A']},
66
+ 'unlink' : {name : 'Remove Link', command : 'unlink', noActive : true}
67
+ }
68
+ };
69
+
70
+ var nicLinkButton=nicEditorAdvancedButton.extend({addPane:function(){this.ln=this.ne.selectedInstance.selElm().parentTag("A");this.addForm({"":{type:"title",txt:"Add/Edit Link"},href:{type:"text",txt:"URL",value:"http://",style:{width:"150px"}},title:{type:"text",txt:"Title"},target:{type:"select",txt:"Open In",options:{"":"Current Window",_blank:"New Window"},style:{width:"100px"}}},this.ln)},submit:function(C){var A=this.inputs.href.value;if(A=="http://"||A==""){alert("You must enter a URL to Create a Link");return false}this.removePane();if(!this.ln){var B="javascript:nicTemp();";this.ne.nicCommand("createlink",B);this.ln=this.findElm("A","href",B)}if(this.ln){this.ln.setAttributes({href:this.inputs.href.value,title:this.inputs.title.value,target:this.inputs.target.options[this.inputs.target.selectedIndex].value})}}});nicEditors.registerPlugin(nicPlugin,nicLinkOptions);
71
+
72
+
73
+ var nicColorOptions = {
74
+ buttons : {
75
+ 'forecolor' : {name : __('Change Text Color'), type : 'nicEditorColorButton', noClose : true},
76
+ 'bgcolor' : {name : __('Change Background Color'), type : 'nicEditorBgColorButton', noClose : true}
77
+ }
78
+ };
79
+
80
+ var nicEditorColorButton=nicEditorAdvancedButton.extend({addPane:function(){var D={0:"00",1:"33",2:"66",3:"99",4:"CC",5:"FF"};var H=new bkElement("DIV").setStyle({width:"270px"});for(var A in D){for(var F in D){for(var E in D){var I="#"+D[A]+D[E]+D[F];var C=new bkElement("DIV").setStyle({cursor:"pointer",height:"15px","float":"left"}).appendTo(H);var G=new bkElement("DIV").setStyle({border:"2px solid "+I}).appendTo(C);var B=new bkElement("DIV").setStyle({backgroundColor:I,overflow:"hidden",width:"11px",height:"11px"}).addEvent("click",this.colorSelect.closure(this,I)).addEvent("mouseover",this.on.closure(this,G)).addEvent("mouseout",this.off.closure(this,G,I)).appendTo(G);if(!window.opera){C.onmousedown=B.onmousedown=bkLib.cancelEvent}}}}this.pane.append(H.noSelect())},colorSelect:function(A){this.ne.nicCommand("foreColor",A);this.removePane()},on:function(A){A.setStyle({border:"2px solid #000"})},off:function(A,B){A.setStyle({border:"2px solid "+B})}});var nicEditorBgColorButton=nicEditorColorButton.extend({colorSelect:function(A){this.ne.nicCommand("hiliteColor",A);this.removePane()}});nicEditors.registerPlugin(nicPlugin,nicColorOptions);
81
+
82
+
83
+ var nicImageOptions = {
84
+ buttons : {
85
+ 'image' : {name : 'Add Image', type : 'nicImageButton', tags : ['IMG']}
86
+ }
87
+
88
+ };
89
+
90
+ var nicImageButton=nicEditorAdvancedButton.extend({addPane:function(){this.im=this.ne.selectedInstance.selElm().parentTag("IMG");this.addForm({"":{type:"title",txt:"Add/Edit Image"},src:{type:"text",txt:"URL",value:"http://",style:{width:"150px"}},alt:{type:"text",txt:"Alt Text",style:{width:"100px"}},align:{type:"select",txt:"Align",options:{none:"Default",left:"Left",right:"Right"}}},this.im)},submit:function(B){var C=this.inputs.src.value;if(C==""||C=="http://"){alert("You must enter a Image URL to insert");return false}this.removePane();if(!this.im){var A="javascript:nicImTemp();";this.ne.nicCommand("insertImage",A);this.im=this.findElm("IMG","src",A)}if(this.im){this.im.setAttributes({src:this.inputs.src.value,alt:this.inputs.alt.value,align:this.inputs.align.value})}}});nicEditors.registerPlugin(nicPlugin,nicImageOptions);
91
+
92
+
93
+ var nicSaveOptions = {
94
+ buttons : {
95
+ 'save' : {name : __('Save this content'), type : 'nicEditorSaveButton'}
96
+ }
97
+ };
98
+
99
+ var nicEditorSaveButton=nicEditorButton.extend({init:function(){if(!this.ne.options.onSave){this.margin.setStyle({display:"none"})}},mouseClick:function(){var B=this.ne.options.onSave;var A=this.ne.selectedInstance;B(A.getContent(),A.elm.id,A)}});nicEditors.registerPlugin(nicPlugin,nicSaveOptions);
100
+
101
+ var nicXHTML=bkClass.extend({stripAttributes:["_moz_dirty","_moz_resizing","_extended"],noShort:["style","title","script","textarea","a"],cssReplace:{"font-weight:bold;":"strong","font-style:italic;":"em"},sizes:{1:"xx-small",2:"x-small",3:"small",4:"medium",5:"large",6:"x-large"},construct:function(A){this.ne=A;if(this.ne.options.xhtml){A.addEvent("get",this.cleanup.closure(this))}},cleanup:function(A){var B=A.getElm();var C=this.toXHTML(B);A.content=C},toXHTML:function(C,A,L){var G="";var O="";var P="";var I=C.nodeType;var Q=C.nodeName.toLowerCase();var N=C.hasChildNodes&&C.hasChildNodes();var B=new Array();switch(I){case 1:var H=C.attributes;switch(Q){case"b":Q="strong";break;case"i":Q="em";break;case"font":Q="span";break}if(A){for(var F=0;F<H.length;F++){var K=H[F];var M=K.nodeName.toLowerCase();var D=K.nodeValue;if(!K.specified||!D||bkLib.inArray(this.stripAttributes,M)||typeof (D)=="function"){continue}switch(M){case"style":var J=D.replace(/ /g,"");for(itm in this.cssReplace){if(J.indexOf(itm)!=-1){B.push(this.cssReplace[itm]);J=J.replace(itm,"")}}P+=J;D="";break;case"class":D=D.replace("Apple-style-span","");break;case"size":P+="font-size:"+this.sizes[D]+";";D="";break}if(D){O+=" "+M+'="'+D+'"'}}if(P){O+=' style="'+P+'"'}for(var F=0;F<B.length;F++){G+="<"+B[F]+">"}if(O==""&&Q=="span"){A=false}if(A){G+="<"+Q;if(Q!="br"){G+=O}}}if(!N&&!bkLib.inArray(this.noShort,M)){if(A){G+=" />"}}else{if(A){G+=">"}for(var F=0;F<C.childNodes.length;F++){var E=this.toXHTML(C.childNodes[F],true,true);if(E){G+=E}}}if(A&&N){G+="</"+Q+">"}for(var F=0;F<B.length;F++){G+="</"+B[F]+">"}break;case 3:G+=C.nodeValue;break}return G}});nicEditors.registerPlugin(nicXHTML);
102
+
103
+ var nicCodeOptions = {
104
+ buttons : {
105
+ 'xhtml' : {name : 'Edit HTML', type : 'nicCodeButton'}
106
+ }
107
+
108
+ };
109
+
110
+ var nicCodeButton=nicEditorAdvancedButton.extend({width:"350px",addPane:function(){this.addForm({"":{type:"title",txt:"Edit HTML"},code:{type:"content",value:this.ne.selectedInstance.getContent(),style:{width:"340px",height:"200px"}}})},submit:function(B){var A=this.inputs.code.value;this.ne.selectedInstance.setContent(A);this.removePane()}});nicEditors.registerPlugin(nicPlugin,nicCodeOptions);
111
+ var nicBBCode=bkClass.extend({construct:function(A){this.ne=A;if(this.ne.options.bbCode){A.addEvent("get",this.bbGet.closure(this));A.addEvent("set",this.bbSet.closure(this));var B=this.ne.loadedPlugins;for(itm in B){if(B[itm].toXHTML){this.xhtml=B[itm]}}}},bbGet:function(A){var B=this.xhtml.toXHTML(A.getElm());A.content=this.toBBCode(B)},bbSet:function(A){A.content=this.fromBBCode(A.content)},toBBCode:function(B){function A(D,C){B=B.replace(D,C)}A(/\n/gi,"");A(/<strong>(.*?)<\/strong>/gi,"[b]$1[/b]");A(/<em>(.*?)<\/em>/gi,"[i]$1[/i]");A(/<span.*?style="text-decoration:underline;">(.*?)<\/span>/gi,"[u]$1[/u]");A(/<ul>(.*?)<\/ul>/gi,"[list]$1[/list]");A(/<li>(.*?)<\/li>/gi,"[*]$1[]");A(/<ol>(.*?)<\/ol>/gi,"[list=1]$1[/list]");A(/<img.*?src="(.*?)".*?>/gi,"[img]$1[/img]");A(/<a.*?href="(.*?)".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");A(/<br.*?>/gi,"\n");A(/<.*?>.*?<\/.*?>/gi,"");return B},fromBBCode:function(A){function B(D,C){A=A.replace(D,C)}B(/\[b\](.*?)\[\/b\]/gi,"<strong>$1</strong>");B(/\[i\](.*?)\[\/i\]/gi,"<em>$1</em>");B(/\[u\](.*?)\[\/u\]/gi,'<span style="text-decoration:underline;">$1</span>');B(/\[list\](.*?)\[\/list\]/gi,"<ul>$1</ul>");B(/\[list=1\](.*?)\[\/list\]/gi,"<ol>$1</ol>");B(/\[\*\](.*?)\[\/\*\]/gi,"<li>$1</li>");B(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />');B(/\[url=(.*?)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>');B(/\n/gi,"<br />");return A}});nicEditors.registerPlugin(nicBBCode);
112
+ var nicUploadOptions = {
113
+ buttons : {
114
+ 'upload' : {name : 'Upload Image', type : 'nicUploadButton'}
115
+ }
116
+
117
+ };
118
+ var nicUploadButton=nicEditorAdvancedButton.extend({nicURI:"http://files.nicedit.com/",addPane:function(){this.im=this.ne.selectedInstance.selElm().parentTag("IMG");this.myID=Math.round(Math.random()*Math.pow(10,15));this.requestInterval=1000;this.uri=this.ne.options.uploadURI||this.nicURI;nicUploadButton.lastPlugin=this;this.myFrame=new bkElement("iframe").setAttributes({width:"100%",height:"100px",frameBorder:0,scrolling:"no"}).setStyle({border:0}).appendTo(this.pane.pane);this.progressWrapper=new bkElement("div").setStyle({display:"none",width:"100%",height:"20px",border:"1px solid #ccc"}).appendTo(this.pane.pane);this.progress=new bkElement("div").setStyle({width:"0%",height:"20px",backgroundColor:"#ccc"}).setContent("&nbsp").appendTo(this.progressWrapper);setTimeout(this.addForm.closure(this),50)},addForm:function(){var A=this.myDoc=this.myFrame.contentWindow.document;A.open();A.write("<html><body>");A.write('<form method="post" action="'+this.uri+"?id="+this.myID+'" enctype="multipart/form-data">');A.write('<input type="hidden" name="APC_UPLOAD_PROGRESS" value="'+this.myID+'" />');if(this.uri==this.nicURI){A.write('<div style="position: absolute; margin-left: 160px;"><img src="http://imageshack.us/img/imageshack.png" width="30" style="float: left;" /><div style="float: left; margin-left: 5px; font-size: 10px;">Hosted by<br /><a href="http://www.imageshack.us/" target="_blank">ImageShack</a></div></div>')}A.write('<div style="font-size: 14px; font-weight: bold; padding-top: 5px;">Insert an Image</div>');A.write('<input name="nicImage" type="file" style="margin-top: 10px;" />');A.write("</form>");A.write("</body></html>");A.close();this.myBody=A.body;this.myForm=$BK(this.myBody.getElementsByTagName("form")[0]);this.myInput=$BK(this.myBody.getElementsByTagName("input")[1]).addEvent("change",this.startUpload.closure(this));this.myStatus=new bkElement("div",this.myDoc).setStyle({textAlign:"center",fontSize:"14px"}).appendTo(this.myBody)},startUpload:function(){this.myForm.setStyle({display:"none"});this.myStatus.setContent('<img src="http://files.nicedit.com/ajax-loader.gif" style="float: right; margin-right: 40px;" /><strong>Uploading...</strong><br />Please wait');this.myForm.submit();setTimeout(this.makeRequest.closure(this),this.requestInterval)},makeRequest:function(){if(this.pane&&this.pane.pane){nicUploadButton.lastPlugin=this;var A=new bkElement("script").setAttributes({type:"text/javascript",src:this.uri+"?check="+this.myID+"&rand="+Math.round(Math.random()*Math.pow(10,15))}).addEvent("load",function(){A.parentNode.removeChild(A)}).appendTo(document.getElementsByTagName("head")[0]);if(this.requestInterval){setTimeout(this.makeRequest.closure(this),this.requestInterval)}}},setProgress:function(A){this.progressWrapper.setStyle({display:"block"});this.progress.setStyle({width:A+"%"})},update:function(C){if(C==false){this.progressWrapper.setStyle({display:"none"})}else{if(C.url){this.setProgress(100);this.requestInterval=false;if(!this.im){this.ne.selectedInstance.restoreRng();var B="javascript:nicImTemp();";this.ne.nicCommand("insertImage",B);this.im=this.findElm("IMG","src",B)}var A=parseInt(this.ne.selectedInstance.elm.getStyle("width"));if(this.im){this.im.setAttributes({src:C.url,width:(A&&C.width)?Math.min(A,C.width):""})}this.removePane()}else{if(C.error){this.requestInterval=false;this.setProgress(100);alert("There was an error uploading your image ("+C.error+").");this.removePane()}else{if(C.noprogress){this.progressWrapper.setStyle({display:"none"});if(this.uri.indexOf("http:")==-1||this.uri.indexOf(window.location.host)!=-1){this.requestInterval=false}}else{this.setProgress(Math.round((C.current/C.total)*75));if(C.interval){this.requestInterval=C.interval}}}}}}});nicUploadButton.statusCb=function(A){nicUploadButton.lastPlugin.update(A)};nicEditors.registerPlugin(nicPlugin,nicUploadOptions);
js/ofc-library/JSON.php ADDED
@@ -0,0 +1,806 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
+
4
+ /**
5
+ * Converts to and from JSON format.
6
+ *
7
+ * JSON (JavaScript Object Notation) is a lightweight data-interchange
8
+ * format. It is easy for humans to read and write. It is easy for machines
9
+ * to parse and generate. It is based on a subset of the JavaScript
10
+ * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
11
+ * This feature can also be found in Python. JSON is a text format that is
12
+ * completely language independent but uses conventions that are familiar
13
+ * to programmers of the C-family of languages, including C, C++, C#, Java,
14
+ * JavaScript, Perl, TCL, and many others. These properties make JSON an
15
+ * ideal data-interchange language.
16
+ *
17
+ * This package provides a simple encoder and decoder for JSON notation. It
18
+ * is intended for use with client-side Javascript applications that make
19
+ * use of HTTPRequest to perform server communication functions - data can
20
+ * be encoded into JSON notation for use in a client-side javascript, or
21
+ * decoded from incoming Javascript requests. JSON format is native to
22
+ * Javascript, and can be directly eval()'ed with no further parsing
23
+ * overhead
24
+ *
25
+ * All strings should be in ASCII or UTF-8 format!
26
+ *
27
+ * LICENSE: Redistribution and use in source and binary forms, with or
28
+ * without modification, are permitted provided that the following
29
+ * conditions are met: Redistributions of source code must retain the
30
+ * above copyright notice, this list of conditions and the following
31
+ * disclaimer. Redistributions in binary form must reproduce the above
32
+ * copyright notice, this list of conditions and the following disclaimer
33
+ * in the documentation and/or other materials provided with the
34
+ * distribution.
35
+ *
36
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
37
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
38
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
39
+ * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
40
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
41
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
42
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
44
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
45
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
46
+ * DAMAGE.
47
+ *
48
+ * @category
49
+ * @package Services_JSON
50
+ * @author Michal Migurski <mike-json@teczno.com>
51
+ * @author Matt Knapp <mdknapp[at]gmail[dot]com>
52
+ * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
53
+ * @copyright 2005 Michal Migurski
54
+ * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
55
+ * @license http://www.opensource.org/licenses/bsd-license.php
56
+ * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
57
+ */
58
+
59
+ /**
60
+ * Marker constant for Services_JSON::decode(), used to flag stack state
61
+ */
62
+ define('SERVICES_JSON_SLICE', 1);
63
+
64
+ /**
65
+ * Marker constant for Services_JSON::decode(), used to flag stack state
66
+ */
67
+ define('SERVICES_JSON_IN_STR', 2);
68
+
69
+ /**
70
+ * Marker constant for Services_JSON::decode(), used to flag stack state
71
+ */
72
+ define('SERVICES_JSON_IN_ARR', 3);
73
+
74
+ /**
75
+ * Marker constant for Services_JSON::decode(), used to flag stack state
76
+ */
77
+ define('SERVICES_JSON_IN_OBJ', 4);
78
+
79
+ /**
80
+ * Marker constant for Services_JSON::decode(), used to flag stack state
81
+ */
82
+ define('SERVICES_JSON_IN_CMT', 5);
83
+
84
+ /**
85
+ * Behavior switch for Services_JSON::decode()
86
+ */
87
+ define('SERVICES_JSON_LOOSE_TYPE', 16);
88
+
89
+ /**
90
+ * Behavior switch for Services_JSON::decode()
91
+ */
92
+ define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
93
+
94
+ /**
95
+ * Converts to and from JSON format.
96
+ *
97
+ * Brief example of use:
98
+ *
99
+ * <code>
100
+ * // create a new instance of Services_JSON
101
+ * $json = new Services_JSON();
102
+ *
103
+ * // convert a complexe value to JSON notation, and send it to the browser
104
+ * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
105
+ * $output = $json->encode($value);
106
+ *
107
+ * print($output);
108
+ * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
109
+ *
110
+ * // accept incoming POST data, assumed to be in JSON notation
111
+ * $input = file_get_contents('php://input', 1000000);
112
+ * $value = $json->decode($input);
113
+ * </code>
114
+ */
115
+ class Services_JSON
116
+ {
117
+ /**
118
+ * constructs a new JSON instance
119
+ *
120
+ * @param int $use object behavior flags; combine with boolean-OR
121
+ *
122
+ * possible values:
123
+ * - SERVICES_JSON_LOOSE_TYPE: loose typing.
124
+ * "{...}" syntax creates associative arrays
125
+ * instead of objects in decode().
126
+ * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
127
+ * Values which can't be encoded (e.g. resources)
128
+ * appear as NULL instead of throwing errors.
129
+ * By default, a deeply-nested resource will
130
+ * bubble up with an error, so all return values
131
+ * from encode() should be checked with isError()
132
+ */
133
+ function Services_JSON($use = 0)
134
+ {
135
+ $this->use = $use;
136
+ }
137
+
138
+ /**
139
+ * convert a string from one UTF-16 char to one UTF-8 char
140
+ *
141
+ * Normally should be handled by mb_convert_encoding, but
142
+ * provides a slower PHP-only method for installations
143
+ * that lack the multibye string extension.
144
+ *
145
+ * @param string $utf16 UTF-16 character
146
+ * @return string UTF-8 character
147
+ * @access private
148
+ */
149
+ function utf162utf8($utf16)
150
+ {
151
+ // oh please oh please oh please oh please oh please
152
+ if(function_exists('mb_convert_encoding')) {
153
+ return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
154
+ }
155
+
156
+ $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
157
+
158
+ switch(true) {
159
+ case ((0x7F & $bytes) == $bytes):
160
+ // this case should never be reached, because we are in ASCII range
161
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
162
+ return chr(0x7F & $bytes);
163
+
164
+ case (0x07FF & $bytes) == $bytes:
165
+ // return a 2-byte UTF-8 character
166
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
167
+ return chr(0xC0 | (($bytes >> 6) & 0x1F))
168
+ . chr(0x80 | ($bytes & 0x3F));
169
+
170
+ case (0xFFFF & $bytes) == $bytes:
171
+ // return a 3-byte UTF-8 character
172
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
173
+ return chr(0xE0 | (($bytes >> 12) & 0x0F))
174
+ . chr(0x80 | (($bytes >> 6) & 0x3F))
175
+ . chr(0x80 | ($bytes & 0x3F));
176
+ }
177
+
178
+ // ignoring UTF-32 for now, sorry
179
+ return '';
180
+ }
181
+
182
+ /**
183
+ * convert a string from one UTF-8 char to one UTF-16 char
184
+ *
185
+ * Normally should be handled by mb_convert_encoding, but
186
+ * provides a slower PHP-only method for installations
187
+ * that lack the multibye string extension.
188
+ *
189
+ * @param string $utf8 UTF-8 character
190
+ * @return string UTF-16 character
191
+ * @access private
192
+ */
193
+ function utf82utf16($utf8)
194
+ {
195
+ // oh please oh please oh please oh please oh please
196
+ if(function_exists('mb_convert_encoding')) {
197
+ return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
198
+ }
199
+
200
+ switch(strlen($utf8)) {
201
+ case 1:
202
+ // this case should never be reached, because we are in ASCII range
203
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
204
+ return $utf8;
205
+
206
+ case 2:
207
+ // return a UTF-16 character from a 2-byte UTF-8 char
208
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
209
+ return chr(0x07 & (ord($utf8{0}) >> 2))
210
+ . chr((0xC0 & (ord($utf8{0}) << 6))
211
+ | (0x3F & ord($utf8{1})));
212
+
213
+ case 3:
214
+ // return a UTF-16 character from a 3-byte UTF-8 char
215
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
216
+ return chr((0xF0 & (ord($utf8{0}) << 4))
217
+ | (0x0F & (ord($utf8{1}) >> 2)))
218
+ . chr((0xC0 & (ord($utf8{1}) << 6))
219
+ | (0x7F & ord($utf8{2})));
220
+ }
221
+
222
+ // ignoring UTF-32 for now, sorry
223
+ return '';
224
+ }
225
+
226
+ /**
227
+ * encodes an arbitrary variable into JSON format
228
+ *
229
+ * @param mixed $var any number, boolean, string, array, or object to be encoded.
230
+ * see argument 1 to Services_JSON() above for array-parsing behavior.
231
+ * if var is a strng, note that encode() always expects it
232
+ * to be in ASCII or UTF-8 format!
233
+ *
234
+ * @return mixed JSON string representation of input var or an error if a problem occurs
235
+ * @access public
236
+ */
237
+ function encode($var)
238
+ {
239
+ switch (gettype($var)) {
240
+ case 'boolean':
241
+ return $var ? 'true' : 'false';
242
+
243
+ case 'NULL':
244
+ return 'null';
245
+
246
+ case 'integer':
247
+ return (int) $var;
248
+
249
+ case 'double':
250
+ case 'float':
251
+ return (float) $var;
252
+
253
+ case 'string':
254
+ // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
255
+ $ascii = '';
256
+ $strlen_var = strlen($var);
257
+
258
+ /*
259
+ * Iterate over every character in the string,
260
+ * escaping with a slash or encoding to UTF-8 where necessary
261
+ */
262
+ for ($c = 0; $c < $strlen_var; ++$c) {
263
+
264
+ $ord_var_c = ord($var{$c});
265
+
266
+ switch (true) {
267
+ case $ord_var_c == 0x08:
268
+ $ascii .= '\b';
269
+ break;
270
+ case $ord_var_c == 0x09:
271
+ $ascii .= '\t';
272
+ break;
273
+ case $ord_var_c == 0x0A:
274
+ $ascii .= '\n';
275
+ break;
276
+ case $ord_var_c == 0x0C:
277
+ $ascii .= '\f';
278
+ break;
279
+ case $ord_var_c == 0x0D:
280
+ $ascii .= '\r';
281
+ break;
282
+
283
+ case $ord_var_c == 0x22:
284
+ case $ord_var_c == 0x2F:
285
+ case $ord_var_c == 0x5C:
286
+ // double quote, slash, slosh
287
+ $ascii .= '\\'.$var{$c};
288
+ break;
289
+
290
+ case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
291
+ // characters U-00000000 - U-0000007F (same as ASCII)
292
+ $ascii .= $var{$c};
293
+ break;
294
+
295
+ case (($ord_var_c & 0xE0) == 0xC0):
296
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
297
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
298
+ $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
299
+ $c += 1;
300
+ $utf16 = $this->utf82utf16($char);
301
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
302
+ break;
303
+
304
+ case (($ord_var_c & 0xF0) == 0xE0):
305
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
306
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
307
+ $char = pack('C*', $ord_var_c,
308
+ ord($var{$c + 1}),
309
+ ord($var{$c + 2}));
310
+ $c += 2;
311
+ $utf16 = $this->utf82utf16($char);
312
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
313
+ break;
314
+
315
+ case (($ord_var_c & 0xF8) == 0xF0):
316
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
317
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
318
+ $char = pack('C*', $ord_var_c,
319
+ ord($var{$c + 1}),
320
+ ord($var{$c + 2}),
321
+ ord($var{$c + 3}));
322
+ $c += 3;
323
+ $utf16 = $this->utf82utf16($char);
324
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
325
+ break;
326
+
327
+ case (($ord_var_c & 0xFC) == 0xF8):
328
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
329
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
330
+ $char = pack('C*', $ord_var_c,
331
+ ord($var{$c + 1}),
332
+ ord($var{$c + 2}),
333
+ ord($var{$c + 3}),
334
+ ord($var{$c + 4}));
335
+ $c += 4;
336
+ $utf16 = $this->utf82utf16($char);
337
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
338
+ break;
339
+
340
+ case (($ord_var_c & 0xFE) == 0xFC):
341
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
342
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
343
+ $char = pack('C*', $ord_var_c,
344
+ ord($var{$c + 1}),
345
+ ord($var{$c + 2}),
346
+ ord($var{$c + 3}),
347
+ ord($var{$c + 4}),
348
+ ord($var{$c + 5}));
349
+ $c += 5;
350
+ $utf16 = $this->utf82utf16($char);
351
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
352
+ break;
353
+ }
354
+ }
355
+
356
+ return '"'.$ascii.'"';
357
+
358
+ case 'array':
359
+ /*
360
+ * As per JSON spec if any array key is not an integer
361
+ * we must treat the the whole array as an object. We
362
+ * also try to catch a sparsely populated associative
363
+ * array with numeric keys here because some JS engines
364
+ * will create an array with empty indexes up to
365
+ * max_index which can cause memory issues and because
366
+ * the keys, which may be relevant, will be remapped
367
+ * otherwise.
368
+ *
369
+ * As per the ECMA and JSON specification an object may
370
+ * have any string as a property. Unfortunately due to
371
+ * a hole in the ECMA specification if the key is a
372
+ * ECMA reserved word or starts with a digit the
373
+ * parameter is only accessible using ECMAScript's
374
+ * bracket notation.
375
+ */
376
+
377
+ // treat as a JSON object
378
+ if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
379
+ $properties = array_map(array($this, 'name_value'),
380
+ array_keys($var),
381
+ array_values($var));
382
+
383
+ foreach($properties as $property) {
384
+ if(Services_JSON::isError($property)) {
385
+ return $property;
386
+ }
387
+ }
388
+
389
+ return '{' . join(',', $properties) . '}';
390
+ }
391
+
392
+ // treat it like a regular array
393
+ $elements = array_map(array($this, 'encode'), $var);
394
+
395
+ foreach($elements as $element) {
396
+ if(Services_JSON::isError($element)) {
397
+ return $element;
398
+ }
399
+ }
400
+
401
+ return '[' . join(',', $elements) . ']';
402
+
403
+ case 'object':
404
+ $vars = get_object_vars($var);
405
+
406
+ $properties = array_map(array($this, 'name_value'),
407
+ array_keys($vars),
408
+ array_values($vars));
409
+
410
+ foreach($properties as $property) {
411
+ if(Services_JSON::isError($property)) {
412
+ return $property;
413
+ }
414
+ }
415
+
416
+ return '{' . join(',', $properties) . '}';
417
+
418
+ default:
419
+ return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
420
+ ? 'null'
421
+ : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
422
+ }
423
+ }
424
+
425
+ /**
426
+ * array-walking function for use in generating JSON-formatted name-value pairs
427
+ *
428
+ * @param string $name name of key to use
429
+ * @param mixed $value reference to an array element to be encoded
430
+ *
431
+ * @return string JSON-formatted name-value pair, like '"name":value'
432
+ * @access private
433
+ */
434
+ function name_value($name, $value)
435
+ {
436
+ $encoded_value = $this->encode($value);
437
+
438
+ if(Services_JSON::isError($encoded_value)) {
439
+ return $encoded_value;
440
+ }
441
+
442
+ return $this->encode(strval($name)) . ':' . $encoded_value;
443
+ }
444
+
445
+ /**
446
+ * reduce a string by removing leading and trailing comments and whitespace
447
+ *
448
+ * @param $str string string value to strip of comments and whitespace
449
+ *
450
+ * @return string string value stripped of comments and whitespace
451
+ * @access private
452
+ */
453
+ function reduce_string($str)
454
+ {
455
+ $str = preg_replace(array(
456
+
457
+ // eliminate single line comments in '// ...' form
458
+ '#^\s*//(.+)$#m',
459
+
460
+ // eliminate multi-line comments in '/* ... */' form, at start of string
461
+ '#^\s*/\*(.+)\*/#Us',
462
+
463
+ // eliminate multi-line comments in '/* ... */' form, at end of string
464
+ '#/\*(.+)\*/\s*$#Us'
465
+
466
+ ), '', $str);
467
+
468
+ // eliminate extraneous space
469
+ return trim($str);
470
+ }
471
+
472
+ /**
473
+ * decodes a JSON string into appropriate variable
474
+ *
475
+ * @param string $str JSON-formatted string
476
+ *
477
+ * @return mixed number, boolean, string, array, or object
478
+ * corresponding to given JSON input string.
479
+ * See argument 1 to Services_JSON() above for object-output behavior.
480
+ * Note that decode() always returns strings
481
+ * in ASCII or UTF-8 format!
482
+ * @access public
483
+ */
484
+ function decode($str)
485
+ {
486
+ $str = $this->reduce_string($str);
487
+
488
+ switch (strtolower($str)) {
489
+ case 'true':
490
+ return true;
491
+
492
+ case 'false':
493
+ return false;
494
+
495
+ case 'null':
496
+ return null;
497
+
498
+ default:
499
+ $m = array();
500
+
501
+ if (is_numeric($str)) {
502
+ // Lookie-loo, it's a number
503
+
504
+ // This would work on its own, but I'm trying to be
505
+ // good about returning integers where appropriate:
506
+ // return (float)$str;
507
+
508
+ // Return float or int, as appropriate
509
+ return ((float)$str == (integer)$str)
510
+ ? (integer)$str
511
+ : (float)$str;
512
+
513
+ } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
514
+ // STRINGS RETURNED IN UTF-8 FORMAT
515
+ $delim = substr($str, 0, 1);
516
+ $chrs = substr($str, 1, -1);
517
+ $utf8 = '';
518
+ $strlen_chrs = strlen($chrs);
519
+
520
+ for ($c = 0; $c < $strlen_chrs; ++$c) {
521
+
522
+ $substr_chrs_c_2 = substr($chrs, $c, 2);
523
+ $ord_chrs_c = ord($chrs{$c});
524
+
525
+ switch (true) {
526
+ case $substr_chrs_c_2 == '\b':
527
+ $utf8 .= chr(0x08);
528
+ ++$c;
529
+ break;
530
+ case $substr_chrs_c_2 == '\t':
531
+ $utf8 .= chr(0x09);
532
+ ++$c;
533
+ break;
534
+ case $substr_chrs_c_2 == '\n':
535
+ $utf8 .= chr(0x0A);
536
+ ++$c;
537
+ break;
538
+ case $substr_chrs_c_2 == '\f':
539
+ $utf8 .= chr(0x0C);
540
+ ++$c;
541
+ break;
542
+ case $substr_chrs_c_2 == '\r':
543
+ $utf8 .= chr(0x0D);
544
+ ++$c;
545
+ break;
546
+
547
+ case $substr_chrs_c_2 == '\\"':
548
+ case $substr_chrs_c_2 == '\\\'':
549
+ case $substr_chrs_c_2 == '\\\\':
550
+ case $substr_chrs_c_2 == '\\/':
551
+ if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
552
+ ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
553
+ $utf8 .= $chrs{++$c};
554
+ }
555
+ break;
556
+
557
+ case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
558
+ // single, escaped unicode character
559
+ $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
560
+ . chr(hexdec(substr($chrs, ($c + 4), 2)));
561
+ $utf8 .= $this->utf162utf8($utf16);
562
+ $c += 5;
563
+ break;
564
+
565
+ case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
566
+ $utf8 .= $chrs{$c};
567
+ break;
568
+
569
+ case ($ord_chrs_c & 0xE0) == 0xC0:
570
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
571
+ //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
572
+ $utf8 .= substr($chrs, $c, 2);
573
+ ++$c;
574
+ break;
575
+
576
+ case ($ord_chrs_c & 0xF0) == 0xE0:
577
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
578
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
579
+ $utf8 .= substr($chrs, $c, 3);
580
+ $c += 2;
581
+ break;
582
+
583
+ case ($ord_chrs_c & 0xF8) == 0xF0:
584
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
585
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
586
+ $utf8 .= substr($chrs, $c, 4);
587
+ $c += 3;
588
+ break;
589
+
590
+ case ($ord_chrs_c & 0xFC) == 0xF8:
591
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
592
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
593
+ $utf8 .= substr($chrs, $c, 5);
594
+ $c += 4;
595
+ break;
596
+
597
+ case ($ord_chrs_c & 0xFE) == 0xFC:
598
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
599
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
600
+ $utf8 .= substr($chrs, $c, 6);
601
+ $c += 5;
602
+ break;
603
+
604
+ }
605
+
606
+ }
607
+
608
+ return $utf8;
609
+
610
+ } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
611
+ // array, or object notation
612
+
613
+ if ($str{0} == '[') {
614
+ $stk = array(SERVICES_JSON_IN_ARR);
615
+ $arr = array();
616
+ } else {
617
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
618
+ $stk = array(SERVICES_JSON_IN_OBJ);
619
+ $obj = array();
620
+ } else {
621
+ $stk = array(SERVICES_JSON_IN_OBJ);
622
+ $obj = new stdClass();
623
+ }
624
+ }
625
+
626
+ array_push($stk, array('what' => SERVICES_JSON_SLICE,
627
+ 'where' => 0,
628
+ 'delim' => false));
629
+
630
+ $chrs = substr($str, 1, -1);
631
+ $chrs = $this->reduce_string($chrs);
632
+
633
+ if ($chrs == '') {
634
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
635
+ return $arr;
636
+
637
+ } else {
638
+ return $obj;
639
+
640
+ }
641
+ }
642
+
643
+ //print("\nparsing {$chrs}\n");
644
+
645
+ $strlen_chrs = strlen($chrs);
646
+
647
+ for ($c = 0; $c <= $strlen_chrs; ++$c) {
648
+
649
+ $top = end($stk);
650
+ $substr_chrs_c_2 = substr($chrs, $c, 2);
651
+
652
+ if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
653
+ // found a comma that is not inside a string, array, etc.,
654
+ // OR we've reached the end of the character list
655
+ $slice = substr($chrs, $top['where'], ($c - $top['where']));
656
+ array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
657
+ //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
658
+
659
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
660
+ // we are in an array, so just push an element onto the stack
661
+ array_push($arr, $this->decode($slice));
662
+
663
+ } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
664
+ // we are in an object, so figure
665
+ // out the property name and set an
666
+ // element in an associative array,
667
+ // for now
668
+ $parts = array();
669
+
670
+ if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
671
+ // "name":value pair
672
+ $key = $this->decode($parts[1]);
673
+ $val = $this->decode($parts[2]);
674
+
675
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
676
+ $obj[$key] = $val;
677
+ } else {
678
+ $obj->$key = $val;
679
+ }
680
+ } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
681
+ // name:value pair, where name is unquoted
682
+ $key = $parts[1];
683
+ $val = $this->decode($parts[2]);
684
+
685
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
686
+ $obj[$key] = $val;
687
+ } else {
688
+ $obj->$key = $val;
689
+ }
690
+ }
691
+
692
+ }
693
+
694
+ } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
695
+ // found a quote, and we are not inside a string
696
+ array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
697
+ //print("Found start of string at {$c}\n");
698
+
699
+ } elseif (($chrs{$c} == $top['delim']) &&
700
+ ($top['what'] == SERVICES_JSON_IN_STR) &&
701
+ ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
702
+ // found a quote, we're in a string, and it's not escaped
703
+ // we know that it's not escaped becase there is _not_ an
704
+ // odd number of backslashes at the end of the string so far
705
+ array_pop($stk);
706
+ //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
707
+
708
+ } elseif (($chrs{$c} == '[') &&
709
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
710
+ // found a left-bracket, and we are in an array, object, or slice
711
+ array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
712
+ //print("Found start of array at {$c}\n");
713
+
714
+ } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
715
+ // found a right-bracket, and we're in an array
716
+ array_pop($stk);
717
+ //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
718
+
719
+ } elseif (($chrs{$c} == '{') &&
720
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
721
+ // found a left-brace, and we are in an array, object, or slice
722
+ array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
723
+ //print("Found start of object at {$c}\n");
724
+
725
+ } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
726
+ // found a right-brace, and we're in an object
727
+ array_pop($stk);
728
+ //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
729
+
730
+ } elseif (($substr_chrs_c_2 == '/*') &&
731
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
732
+ // found a comment start, and we are in an array, object, or slice
733
+ array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
734
+ $c++;
735
+ //print("Found start of comment at {$c}\n");
736
+
737
+ } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
738
+ // found a comment end, and we're in one now
739
+ array_pop($stk);
740
+ $c++;
741
+
742
+ for ($i = $top['where']; $i <= $c; ++$i)
743
+ $chrs = substr_replace($chrs, ' ', $i, 1);
744
+
745
+ //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
746
+
747
+ }
748
+
749
+ }
750
+
751
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
752
+ return $arr;
753
+
754
+ } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
755
+ return $obj;
756
+
757
+ }
758
+
759
+ }
760
+ }
761
+ }
762
+
763
+ /**
764
+ * @todo Ultimately, this should just call PEAR::isError()
765
+ */
766
+ function isError($data, $code = null)
767
+ {
768
+ if (class_exists('pear')) {
769
+ return PEAR::isError($data, $code);
770
+ } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
771
+ is_subclass_of($data, 'services_json_error'))) {
772
+ return true;
773
+ }
774
+
775
+ return false;
776
+ }
777
+ }
778
+
779
+ if (class_exists('PEAR_Error')) {
780
+
781
+ class Services_JSON_Error extends PEAR_Error
782
+ {
783
+ function Services_JSON_Error($message = 'unknown error', $code = null,
784
+ $mode = null, $options = null, $userinfo = null)
785
+ {
786
+ parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
787
+ }
788
+ }
789
+
790
+ } else {
791
+
792
+ /**
793
+ * @todo Ultimately, this class shall be descended from PEAR_Error
794
+ */
795
+ class Services_JSON_Error
796
+ {
797
+ function Services_JSON_Error($message = 'unknown error', $code = null,
798
+ $mode = null, $options = null, $userinfo = null)
799
+ {
800
+
801
+ }
802
+ }
803
+
804
+ }
805
+
806
+ ?>
js/ofc-library/README.txt ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Open Flash Chart - PHP libraries. These help create data files for Open Flash Chart.
2
+ Copyright (C) 2007
3
+
4
+ This library is free software; you can redistribute it and/or
5
+ modify it under the terms of the GNU Lesser General Public
6
+ License as published by the Free Software Foundation; either
7
+ version 2.1 of the License, or (at your option) any later version.
8
+
9
+ This library is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ Lesser General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Lesser General Public
15
+ License along with this library; if not, write to the Free Software
16
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
js/ofc-library/dot_base.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * A private class. All the other line-dots inherit from this.
5
+ * Gives them all some common methods.
6
+ */
7
+ class dot_base
8
+ {
9
+ /**
10
+ * @param $type string
11
+ * @param $value integer
12
+ */
13
+ function dot_base($type, $value=null)
14
+ {
15
+ $this->type = $type;
16
+ if( isset( $value ) )
17
+ $this->value( $value );
18
+ }
19
+
20
+ /**
21
+ * For line charts that only require a Y position
22
+ * for each point.
23
+ * @param $value as integer, the Y position
24
+ */
25
+ function value( $value )
26
+ {
27
+ $this->value = $value;
28
+ }
29
+
30
+ /**
31
+ * For scatter charts that require an X and Y position for
32
+ * each point.
33
+ *
34
+ * @param $x as integer
35
+ * @param $y as integer
36
+ */
37
+ function position( $x, $y )
38
+ {
39
+ $this->x = $x;
40
+ $this->y = $y;
41
+ }
42
+
43
+ /**
44
+ * @param $colour is a string, HEX colour, e.g. '#FF0000' red
45
+ */
46
+ function colour($colour)
47
+ {
48
+ $this->colour = $colour;
49
+ return $this;
50
+ }
51
+
52
+ /**
53
+ * The tooltip for this dot.
54
+ */
55
+ function tooltip( $tip )
56
+ {
57
+ $this->tip = $tip;
58
+ return $this;
59
+ }
60
+
61
+ /**
62
+ * @param $size is an integer. Size of the dot.
63
+ */
64
+ function size($size)
65
+ {
66
+ $tmp = 'dot-size';
67
+ $this->$tmp = $size;
68
+ return $this;
69
+ }
70
+
71
+ /**
72
+ * a private method
73
+ */
74
+ function type( $type )
75
+ {
76
+ $this->type = $type;
77
+ return $this;
78
+ }
79
+
80
+ /**
81
+ * @param $size is an integer. The size of the hollow 'halo' around the dot that masks the line.
82
+ */
83
+ function halo_size( $size )
84
+ {
85
+ $tmp = 'halo-size';
86
+ $this->$tmp = $size;
87
+ return $this;
88
+ }
89
+
90
+ /**
91
+ * @param $do as string. One of three options (examples):
92
+ * - "http://example.com" - browse to this URL
93
+ * - "https://example.com" - browse to this URL
94
+ * - "trace:message" - print this message in the FlashDevelop debug pane
95
+ * - all other strings will be called as Javascript functions, so a string "hello_world"
96
+ * will call the JS function "hello_world(index)". It passes in the index of the
97
+ * point.
98
+ */
99
+ function on_click( $do )
100
+ {
101
+ $tmp = 'on-click';
102
+ $this->$tmp = $do;
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Draw a hollow dot
108
+ */
109
+ class hollow_dot extends dot_base
110
+ {
111
+ function hollow_dot($value=null)
112
+ {
113
+ parent::dot_base( 'hollow-dot', $value );
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Draw a star
119
+ */
120
+ class star extends dot_base
121
+ {
122
+ /**
123
+ * The constructor, takes an optional $value
124
+ */
125
+ function star($value=null)
126
+ {
127
+ parent::dot_base( 'star', $value );
128
+ }
129
+
130
+ /**
131
+ * @param $angle is an integer.
132
+ */
133
+ function rotation($angle)
134
+ {
135
+ $this->rotation = $angle;
136
+ return $this;
137
+ }
138
+
139
+ /**
140
+ * @param $is_hollow is a boolean.
141
+ */
142
+ function hollow($is_hollow)
143
+ {
144
+ $this->hollow = $is_hollow;
145
+ }
146
+ }
147
+
148
+ /**
149
+ * Draw a 'bow tie' shape.
150
+ */
151
+ class bow extends dot_base
152
+ {
153
+ /**
154
+ * The constructor, takes an optional $value
155
+ */
156
+ function bow($value=null)
157
+ {
158
+ parent::dot_base( 'bow', $value );
159
+ }
160
+
161
+ /**
162
+ * Rotate the anchor object.
163
+ * @param $angle is an integer.
164
+ */
165
+ function rotation($angle)
166
+ {
167
+ $this->rotation = $angle;
168
+ return $this;
169
+ }
170
+ }
171
+
172
+ /**
173
+ * An <i><b>n</b></i> sided shape.
174
+ */
175
+ class anchor extends dot_base
176
+ {
177
+ /**
178
+ * The constructor, takes an optional $value
179
+ */
180
+ function anchor($value=null)
181
+ {
182
+ parent::dot_base( 'anchor', $value );
183
+ }
184
+
185
+ /**
186
+ * Rotate the anchor object.
187
+ * @param $angle is an integer.
188
+ */
189
+ function rotation($angle)
190
+ {
191
+ $this->rotation = $angle;
192
+ return $this;
193
+ }
194
+
195
+ /**
196
+ * @param $sides is an integer. Number of sides this shape has.
197
+ */
198
+ function sides($sides)
199
+ {
200
+ $this->sides = $sides;
201
+ return $this;
202
+ }
203
+ }
204
+
205
+ /**
206
+ * A simple dot
207
+ */
208
+ class dot extends dot_base
209
+ {
210
+ /**
211
+ * The constructor, takes an optional $value
212
+ */
213
+ function dot($value=null)
214
+ {
215
+ parent::dot_base( 'dot', $value );
216
+ }
217
+ }
218
+
219
+ /**
220
+ * A simple dot
221
+ */
222
+ class solid_dot extends dot_base
223
+ {
224
+ /**
225
+ * The constructor, takes an optional $value
226
+ */
227
+ function solid_dot($value=null)
228
+ {
229
+ parent::dot_base( 'solid-dot', $value );
230
+ }
231
+ }
js/ofc-library/json_format.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Pretty print some JSON
4
+ function json_format($json)
5
+ {
6
+ $tab = " ";
7
+ $new_json = "";
8
+ $indent_level = 0;
9
+ $in_string = false;
10
+
11
+ /*
12
+ commented out by monk.e.boy 22nd May '08
13
+ because my web server is PHP4, and
14
+ json_* are PHP5 functions...
15
+
16
+ $json_obj = json_decode($json);
17
+
18
+ if($json_obj === false)
19
+ return false;
20
+
21
+ $json = json_encode($json_obj);
22
+ */
23
+ $len = strlen($json);
24
+
25
+ for($c = 0; $c < $len; $c++)
26
+ {
27
+ $char = $json[$c];
28
+ switch($char)
29
+ {
30
+ case '{':
31
+ case '[':
32
+ if(!$in_string)
33
+ {
34
+ $new_json .= $char . "\n" . str_repeat($tab, $indent_level+1);
35
+ $indent_level++;
36
+ }
37
+ else
38
+ {
39
+ $new_json .= $char;
40
+ }
41
+ break;
42
+ case '}':
43
+ case ']':
44
+ if(!$in_string)
45
+ {
46
+ $indent_level--;
47
+ $new_json .= "\n" . str_repeat($tab, $indent_level) . $char;
48
+ }
49
+ else
50
+ {
51
+ $new_json .= $char;
52
+ }
53
+ break;
54
+ case ',':
55
+ if(!$in_string)
56
+ {
57
+ $new_json .= ",\n" . str_repeat($tab, $indent_level);
58
+ }
59
+ else
60
+ {
61
+ $new_json .= $char;
62
+ }
63
+ break;
64
+ case ':':
65
+ if(!$in_string)
66
+ {
67
+ $new_json .= ": ";
68
+ }
69
+ else
70
+ {
71
+ $new_json .= $char;
72
+ }
73
+ break;
74
+ case '"':
75
+ if($c > 0 && $json[$c-1] != '\\')
76
+ {
77
+ $in_string = !$in_string;
78
+ }
79
+ default:
80
+ $new_json .= $char;
81
+ break;
82
+ }
83
+ }
84
+
85
+ return $new_json;
86
+ }
js/ofc-library/ofc_area_base.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * inherits from line
5
+ */
6
+ class area extends line
7
+ {
8
+ function area()
9
+ {
10
+ $this->type = "area";
11
+ }
12
+
13
+ /**
14
+ * the fill colour
15
+ */
16
+ function set_fill_colour( $colour )
17
+ {
18
+ $this->fill = $colour;
19
+ }
20
+
21
+ /**
22
+ * sugar: see set_fill_colour
23
+ */
24
+ function fill_colour( $colour )
25
+ {
26
+ $this->set_fill_colour( $colour );
27
+ return $this;
28
+ }
29
+
30
+ function set_fill_alpha( $alpha )
31
+ {
32
+ $tmp = "fill-alpha";
33
+ $this->$tmp = $alpha;
34
+ }
35
+
36
+ function set_loop()
37
+ {
38
+ $this->loop = true;
39
+ }
40
+ }
js/ofc-library/ofc_area_hollow.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class area_hollow extends area_base
4
+ {
5
+ function area_hollow()
6
+ {
7
+ $this->type = "area_hollow";
8
+ parent::area_base();
9
+ }
10
+ }
js/ofc-library/ofc_area_line.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class area_line extends area_base
4
+ {
5
+ function area_line()
6
+ {
7
+ $this->type = "area_line";
8
+ parent::area_base();
9
+ }
10
+ }
js/ofc-library/ofc_arrow.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ofc_arrow
4
+ {
5
+ /**
6
+ *@param $x as number. Start x position
7
+ *@param $y as number. Start y position
8
+ *@param $a as number. End x position
9
+ *@param $b as number. End y position
10
+ *@param $colour as string.
11
+ *@param $barb_length as number. Length of the barbs in pixels.
12
+ */
13
+ function ofc_arrow($x, $y, $a, $b, $colour, $barb_length=10)
14
+ {
15
+ $this->type = "arrow";
16
+ $this->start = array("x"=>$x, "y"=>$y);
17
+ $this->end = array("x"=>$a, "y"=>$b);
18
+ $this->colour($colour);
19
+ $this->{"barb-length"} = $barb_length;
20
+ }
21
+
22
+ function colour( $colour )
23
+ {
24
+ $this->colour = $colour;
25
+ return $this;
26
+ }
27
+ }
js/ofc-library/ofc_bar.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once 'ofc_bar_base.php';
4
+
5
+ class bar_value
6
+ {
7
+ function bar_value( $top, $bottom=null )
8
+ {
9
+ $this->top = $top;
10
+
11
+ if( isset( $bottom ) )
12
+ $this->bottom = $bottom;
13
+ }
14
+
15
+ function set_colour( $colour )
16
+ {
17
+ $this->colour = $colour;
18
+ }
19
+
20
+ function set_tooltip( $tip )
21
+ {
22
+ $this->tip = $tip;
23
+ }
24
+ }
25
+
26
+ class bar extends bar_base
27
+ {
28
+ function bar()
29
+ {
30
+ $this->type = "bar";
31
+ parent::bar_base();
32
+ }
33
+ }
34
+
js/ofc-library/ofc_bar_3d.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once 'ofc_bar_base.php';
4
+
5
+ class bar_3d_value
6
+ {
7
+ function bar_3d_value( $top )
8
+ {
9
+ $this->top = $top;
10
+ }
11
+
12
+ function set_colour( $colour )
13
+ {
14
+ $this->colour = $colour;
15
+ }
16
+
17
+ function set_tooltip( $tip )
18
+ {
19
+ $this->tip = $tip;
20
+ }
21
+ }
22
+
js/ofc-library/ofc_bar_base.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* this is a base class */
4
+
5
+ class bar_base
6
+ {
7
+ function bar_base(){}
8
+
9
+ /**
10
+ * @param $text as string the key text
11
+ * @param $size as integer, size in pixels
12
+ */
13
+ function set_key( $text, $size )
14
+ {
15
+ $this->text = $text;
16
+ $tmp = 'font-size';
17
+ $this->$tmp = $size;
18
+ }
19
+
20
+ /**
21
+ * syntatical sugar.
22
+ */
23
+ function key( $text, $size )
24
+ {
25
+ $this->set_key( $text, $size );
26
+ }
27
+
28
+ /**
29
+ * @param $v as an array, a mix of:
30
+ * - a bar_value class. You can use this to customise the paramters of each bar.
31
+ * - integer. This is the Y position of the top of the bar.
32
+ */
33
+ function set_values( $v )
34
+ {
35
+ $this->values = $v;
36
+ }
37
+
38
+ /**
39
+ * see set_values
40
+ */
41
+ function append_value( $v )
42
+ {
43
+ $this->values[] = $v;
44
+ }
45
+
46
+ /**
47
+ * @param $colour as string, a HEX colour, e.g. '#ff0000' red
48
+ */
49
+ function set_colour( $colour )
50
+ {
51
+ $this->colour = $colour;
52
+ }
53
+
54
+ /**
55
+ *syntatical sugar
56
+ */
57
+ function colour( $colour )
58
+ {
59
+ $this->set_colour( $colour );
60
+ }
61
+
62
+ /**
63
+ * @param $alpha as real number (range 0 to 1), e.g. 0.5 is half transparent
64
+ */
65
+ function set_alpha( $alpha )
66
+ {
67
+ $this->alpha = $alpha;
68
+ }
69
+
70
+ /**
71
+ * @param $tip as string, the tip to show. May contain various magic variables.
72
+ */
73
+ function set_tooltip( $tip )
74
+ {
75
+ $this->tip = $tip;
76
+ }
77
+
78
+ /**
79
+ *@param $on_show as line_on_show object
80
+ */
81
+ function set_on_show($on_show)
82
+ {
83
+ $this->{'on-show'} = $on_show;
84
+ }
85
+
86
+ function set_on_click( $text )
87
+ {
88
+ $tmp = 'on-click';
89
+ $this->$tmp = $text;
90
+ }
91
+
92
+ function attach_to_right_y_axis()
93
+ {
94
+ $this->axis = 'right';
95
+ }
96
+ }
97
+
js/ofc-library/ofc_bar_filled.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once 'ofc_bar_base.php';
4
+
5
+ class bar_filled_value extends bar_value
6
+ {
7
+ function bar_filled_value( $top, $bottom=null )
8
+ {
9
+ parent::bar_value( $top, $bottom );
10
+ }
11
+
12
+ function set_outline_colour( $outline_colour )
13
+ {
14
+ $tmp = 'outline-colour';
15
+ $this->$tmp = $outline_colour;
16
+ }
17
+ }
18
+
19
+ class bar_filled extends bar_base
20
+ {
21
+ function bar_filled( $colour=null, $outline_colour=null )
22
+ {
23
+ $this->type = "bar_filled";
24
+ parent::bar_base();
25
+
26
+ if( isset( $colour ) )
27
+ $this->set_colour( $colour );
28
+
29
+ if( isset( $outline_colour ) )
30
+ $this->set_outline_colour( $outline_colour );
31
+ }
32
+
33
+ function set_outline_colour( $outline_colour )
34
+ {
35
+ $tmp = 'outline-colour';
36
+ $this->$tmp = $outline_colour;
37
+ }
38
+ }
39
+
js/ofc-library/ofc_bar_glass.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once 'ofc_bar_base.php';
4
+
5
+ class bar_on_show
6
+ {
7
+ /**
8
+ *@param $type as string. Can be any one of:
9
+ * - 'pop-up'
10
+ * - 'drop'
11
+ * - 'fade-in'
12
+ * - 'grow-up'
13
+ * - 'grow-down'
14
+ * - 'pop'
15
+ *
16
+ * @param $cascade as float. Cascade in seconds
17
+ * @param $delay as float. Delay before animation starts in seconds.
18
+ */
19
+ function __construct($type, $cascade, $delay)
20
+ {
21
+ $this->type = $type;
22
+ $this->cascade = (float)$cascade;
23
+ $this->delay = (float)$delay;
24
+ }
25
+ }
26
+
27
+ class bar_value
28
+ {
29
+ /**
30
+ * @param $top as integer. The Y value of the top of the bar
31
+ * @param OPTIONAL $bottom as integer. The Y value of the bottom of the bar, defaults to Y min.
32
+ */
33
+ function bar_value( $top, $bottom=null )
34
+ {
35
+ $this->top = $top;
36
+
37
+ if( isset( $bottom ) )
38
+ $this->bottom = $bottom;
39
+ }
40
+
41
+ function set_colour( $colour )
42
+ {
43
+ $this->colour = $colour;
44
+ }
45
+
46
+ function set_tooltip( $tip )
47
+ {
48
+ $this->tip = $tip;
49
+ }
50
+ }
51
+
52
+ class bar extends bar_base
53
+ {
54
+ function bar()
55
+ {
56
+ $this->type = "bar";
57
+ parent::bar_base();
58
+ }
59
+ }
60
+
61
+ class bar_glass extends bar_base
62
+ {
63
+ function bar_glass()
64
+ {
65
+ $this->type = "bar_glass";
66
+ parent::bar_base();
67
+ }
68
+ }
69
+
70
+ class bar_cylinder extends bar_base
71
+ {
72
+ function bar_cylinder()
73
+ {
74
+ $this->type = "bar_cylinder";
75
+ parent::bar_base();
76
+ }
77
+ }
78
+
79
+ class bar_cylinder_outline extends bar_base
80
+ {
81
+ function bar_cylinder_outline()
82
+ {
83
+ $this->type = "bar_cylinder_outline";
84
+ parent::bar_base();
85
+ }
86
+ }
87
+
88
+ class bar_rounded_glass extends bar_base
89
+ {
90
+ function bar_rounded_glass()
91
+ {
92
+ $this->type = "bar_round_glass";
93
+ parent::bar_base();
94
+ }
95
+ }
96
+
97
+ class bar_round extends bar_base
98
+ {
99
+ function bar_round()
100
+ {
101
+ $this->type = "bar_round";
102
+ parent::bar_base();
103
+ }
104
+ }
105
+
106
+ class bar_dome extends bar_base
107
+ {
108
+ function bar_dome()
109
+ {
110
+ $this->type = "bar_dome";
111
+ parent::bar_base();
112
+ }
113
+ }
114
+
115
+ class bar_round3d extends bar_base
116
+ {
117
+ function bar_round3d()
118
+ {
119
+ $this->type = "bar_round3d";
120
+ parent::bar_base();
121
+ }
122
+ }
123
+
124
+ class bar_3d extends bar_base
125
+ {
126
+ function bar_3d()
127
+ {
128
+ $this->type = "bar_3d";
129
+ parent::bar_base();
130
+ }
131
+ }
js/ofc-library/ofc_bar_sketch.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once 'ofc_bar_base.php';
4
+
5
+ class bar_sketch extends bar_base
6
+ {
7
+ /**
8
+ * @param $colour as string, HEX colour e.g. '#00ff00'
9
+ * @param $outline_colour as string, HEX colour e.g. '#ff0000'
10
+ * @param $fun_factor as integer, range 0 to 10. 0,1 and 2 are pretty boring.
11
+ * 4 to 6 is a bit fun, 7 and above is lots of fun.
12
+ */
13
+ function bar_sketch( $colour, $outline_colour, $fun_factor )
14
+ {
15
+ $this->type = "bar_sketch";
16
+ parent::bar_base();
17
+
18
+ $this->set_colour( $colour );
19
+ $this->set_outline_colour( $outline_colour );
20
+ $this->offset = $fun_factor;
21
+ }
22
+
23
+ function set_outline_colour( $outline_colour )
24
+ {
25
+ $tmp = 'outline-colour';
26
+ $this->$tmp = $outline_colour;
27
+ }
28
+ }
29
+
js/ofc-library/ofc_bar_stack.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once 'ofc_bar_base.php';
4
+
5
+ class bar_stack extends bar_base
6
+ {
7
+ function bar_stack()
8
+ {
9
+ $this->type = "bar_stack";
10
+ parent::bar_base();
11
+ }
12
+
13
+ function append_stack( $v )
14
+ {
15
+ $this->append_value( $v );
16
+ }
17
+
18
+ // an array of HEX colours strings
19
+ // e.g. array( '#ff0000', '#00ff00' );
20
+ function set_colours( $colours )
21
+ {
22
+ $this->colours = $colours;
23
+ }
24
+
25
+ // an array of bar_stack_value
26
+ function set_keys( $keys )
27
+ {
28
+ $this->keys = $keys;
29
+ }
30
+ }
31
+
32
+ class bar_stack_value
33
+ {
34
+ function bar_stack_value( $val, $colour )
35
+ {
36
+ $this->val = $val;
37
+ $this->colour = $colour;
38
+ }
39
+
40
+ function set_tooltip( $tip )
41
+ {
42
+ $this->tip = $tip;
43
+ }
44
+ }
45
+
46
+ class bar_stack_key
47
+ {
48
+ function bar_stack_key( $colour, $text, $font_size )
49
+ {
50
+ $this->colour = $colour;
51
+ $this->text = $text;
52
+ $tmp = 'font-size';
53
+ $this->$tmp = $font_size;
54
+ }
55
+ }
js/ofc-library/ofc_candle.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once 'ofc_bar_base.php';
4
+
5
+ class candle_value
6
+ {
7
+ /**
8
+ *
9
+ */
10
+ function candle_value( $high, $open, $close, $low )
11
+ {
12
+ $this->high = $high;
13
+ $this->top = $open;
14
+ $this->bottom = $close;
15
+ $this->low = $low;
16
+ }
17
+
18
+ function set_colour( $colour )
19
+ {
20
+ $this->colour = $colour;
21
+ }
22
+
23
+ function set_tooltip( $tip )
24
+ {
25
+ $this->tip = $tip;
26
+ }
27
+ }
28
+
29
+ class candle extends bar_base
30
+ {
31
+ function candle($colour, $negative_colour=null)
32
+ {
33
+ $this->type = "candle";
34
+ parent::bar_base();
35
+
36
+ $this->set_colour( $colour );
37
+ if(!is_null($negative_colour))
38
+ $this->{'negative-colour'} = $negative_colour;
39
+ }
40
+ }
41
+
js/ofc-library/ofc_hbar.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class hbar_value
4
+ {
5
+ function hbar_value( $left, $right=null )
6
+ {
7
+ if( isset( $right ) )
8
+ {
9
+ $this->left = $left;
10
+ $this->right = $right;
11
+ }
12
+ else
13
+ $this->right = $left;
14
+ }
15
+
16
+ function set_colour( $colour )
17
+ {
18
+ $this->colour = $colour;
19
+ }
20
+
21
+ function set_tooltip( $tip )
22
+ {
23
+ $this->tip = $tip;
24
+ }
25
+ }
26
+
27
+ class hbar
28
+ {
29
+ function hbar( $colour )
30
+ {
31
+ $this->type = "hbar";
32
+ $this->values = array();
33
+ $this->set_colour( $colour );
34
+ }
35
+
36
+ function append_value( $v )
37
+ {
38
+ $this->values[] = $v;
39
+ }
40
+
41
+ function set_values( $v )
42
+ {
43
+ foreach( $v as $val )
44
+ $this->append_value( new hbar_value( $val ) );
45
+ }
46
+
47
+ function set_colour( $colour )
48
+ {
49
+ $this->colour = $colour;
50
+ }
51
+
52
+ function set_key( $text, $size )
53
+ {
54
+ $this->text = $text;
55
+ $tmp = 'font-size';
56
+ $this->$tmp = $size;
57
+ }
58
+
59
+ function set_tooltip( $tip )
60
+ {
61
+ $this->tip = $tip;
62
+ }
63
+ }
64
+
js/ofc-library/ofc_line.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class line_on_show
4
+ {
5
+ /**
6
+ *@param $type as string. Can be any one of:
7
+ * - 'pop-up'
8
+ * - 'explode'
9
+ * - 'mid-slide'
10
+ * - 'drop'
11
+ * - 'fade-in'
12
+ * - 'shrink-in'
13
+ *
14
+ * @param $cascade as float. Cascade in seconds
15
+ * @param $delay as float. Delay before animation starts in seconds.
16
+ */
17
+ function __construct($type, $cascade, $delay)
18
+ {
19
+ $this->type = $type;
20
+ $this->cascade = (float)$cascade;
21
+ $this->delay = (float)$delay;
22
+ }
23
+ }
24
+
25
+ class line
26
+ {
27
+ function line()
28
+ {
29
+ $this->type = "line";
30
+ $this->values = array();
31
+ }
32
+
33
+ /**
34
+ * Set the default dot that all the real
35
+ * dots inherit their properties from. If you set the
36
+ * default dot to be red, all values in your chart that
37
+ * do not specify a colour will be red. Same for all the
38
+ * other attributes such as tooltip, on-click, size etc...
39
+ *
40
+ * @param $style as any class that inherits base_dot
41
+ */
42
+ function set_default_dot_style( $style )
43
+ {
44
+ $tmp = 'dot-style';
45
+ $this->$tmp = $style;
46
+ }
47
+
48
+ /**
49
+ * @param $v as array, can contain any combination of:
50
+ * - integer, Y position of the point
51
+ * - any class that inherits from dot_base
52
+ * - <b>null</b>
53
+ */
54
+ function set_values( $v )
55
+ {
56
+ $this->values = $v;
57
+ }
58
+
59
+ /**
60
+ * Append a value to the line.
61
+ *
62
+ * @param mixed $v
63
+ */
64
+ function append_value($v)
65
+ {
66
+ $this->values[] = $v;
67
+ }
68
+
69
+ function set_width( $width )
70
+ {
71
+ $this->width = $width;
72
+ }
73
+
74
+ function set_colour( $colour )
75
+ {
76
+ $this->colour = $colour;
77
+ }
78
+
79
+ /**
80
+ * sytnatical sugar for set_colour
81
+ */
82
+ function colour( $colour )
83
+ {
84
+ $this->set_colour( $colour );
85
+ return $this;
86
+ }
87
+
88
+ function set_halo_size( $size )
89
+ {
90
+ $tmp = 'halo-size';
91
+ $this->$tmp = $size;
92
+ }
93
+
94
+ function set_key( $text, $font_size )
95
+ {
96
+ $this->text = $text;
97
+ $tmp = 'font-size';
98
+ $this->$tmp = $font_size;
99
+ }
100
+
101
+ function set_tooltip( $tip )
102
+ {
103
+ $this->tip = $tip;
104
+ }
105
+
106
+ /**
107
+ * @param $text as string. A javascript function name as a string. The chart will
108
+ * try to call this function, it will pass the chart id as the only parameter into
109
+ * this function. E.g:
110
+ *
111
+ */
112
+ function set_on_click( $text )
113
+ {
114
+ $tmp = 'on-click';
115
+ $this->$tmp = $text;
116
+ }
117
+
118
+ function loop()
119
+ {
120
+ $this->loop = true;
121
+ }
122
+
123
+ function line_style( $s )
124
+ {
125
+ $tmp = "line-style";
126
+ $this->$tmp = $s;
127
+ }
128
+
129
+ /**
130
+ * Sets the text for the line.
131
+ *
132
+ * @param string $text
133
+ */
134
+ function set_text($text)
135
+ {
136
+ $this->text = $text;
137
+ }
138
+
139
+ function attach_to_right_y_axis()
140
+ {
141
+ $this->axis = 'right';
142
+ }
143
+
144
+ /**
145
+ *@param $on_show as line_on_show object
146
+ */
147
+ function set_on_show($on_show)
148
+ {
149
+ $this->{'on-show'} = $on_show;
150
+ }
151
+
152
+ function on_show($on_show)
153
+ {
154
+ $this->set_on_show($on_show);
155
+ return $this;
156
+ }
157
+ }
js/ofc-library/ofc_line_base.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class line_base
4
+ {
5
+ function line_base()
6
+ {
7
+ $this->type = "line";
8
+ $this->text = "Page views";
9
+ $tmp = 'font-size';
10
+ $this->$tmp = 10;
11
+
12
+ $this->values = array();
13
+ }
14
+
15
+ function set_values( $v )
16
+ {
17
+ $this->values = $v;
18
+ }
19
+
20
+ /**
21
+ * Append a value to the line.
22
+ *
23
+ * @param mixed $v
24
+ */
25
+ function append_value($v)
26
+ {
27
+ $this->values[] = $v;
28
+ }
29
+
30
+ function set_width( $width )
31
+ {
32
+ $this->width = $width;
33
+ }
34
+
35
+ function set_colour( $colour )
36
+ {
37
+ $this->colour = $colour;
38
+ }
39
+
40
+ function set_dot_size( $size )
41
+ {
42
+ $tmp = 'dot-size';
43
+ $this->$tmp = $size;
44
+ }
45
+
46
+ function set_halo_size( $size )
47
+ {
48
+ $tmp = 'halo-size';
49
+ $this->$tmp = $size;
50
+ }
51
+
52
+ function set_key( $text, $font_size )
53
+ {
54
+ $this->text = $text;
55
+ $tmp = 'font-size';
56
+ $this->$tmp = $font_size;
57
+ }
58
+
59
+ function set_tooltip( $tip )
60
+ {
61
+ $this->tip = $tip;
62
+ }
63
+
64
+ function set_on_click( $text )
65
+ {
66
+ $tmp = 'on-click';
67
+ $this->$tmp = $text;
68
+ }
69
+
70
+ function loop()
71
+ {
72
+ $this->loop = true;
73
+ }
74
+
75
+ function line_style( $s )
76
+ {
77
+ $tmp = "line-style";
78
+ $this->$tmp = $s;
79
+ }
80
+
81
+ /**
82
+ * Sets the text for the line.
83
+ *
84
+ * @param string $text
85
+ */
86
+ function set_text($text)
87
+ {
88
+ $this->text = $text;
89
+ }
90
+
91
+
92
+ }
js/ofc-library/ofc_line_dot.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class dot_value
4
+ {
5
+ function dot_value( $value, $colour )
6
+ {
7
+ $this->value = $value;
8
+ $this->colour = $colour;
9
+ }
10
+
11
+ function set_colour( $colour )
12
+ {
13
+ $this->colour = $colour;
14
+ }
15
+
16
+ function set_size( $size )
17
+ {
18
+ $this->size = $size;
19
+ }
20
+
21
+ function set_tooltip( $tip )
22
+ {
23
+ $this->tip = $tip;
24
+ }
25
+ }
26
+
27
+ class line_dot extends line_base
28
+ {
29
+ function line_dot()
30
+ {
31
+ $this->type = "line_dot";
32
+ }
33
+ }
js/ofc-library/ofc_line_hollow.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class line_hollow extends line_base
4
+ {
5
+ function line_hollow()
6
+ {
7
+ $this->type = "line_hollow";
8
+ }
9
+ }
js/ofc-library/ofc_line_style.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class line_style
4
+ {
5
+ function line_style($on, $off)
6
+ {
7
+ $this->style = "dash";
8
+ $this->on = $on;
9
+ $this->off = $off;
10
+ }
11
+ }
js/ofc-library/ofc_menu.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ofc_menu_item
4
+ {
5
+ /**
6
+ * @param $text as string. The menu item text.
7
+ * @param $javascript_function_name as string. The javascript function name, the
8
+ * js function takes one parameter, the chart ID. See ofc_menu_item_camera for
9
+ * some example code.
10
+ */
11
+ function ofc_menu_item($text, $javascript_function_name)
12
+ {
13
+ $this->type = "text";
14
+ $this->text = $text;
15
+ $tmp = 'javascript-function';
16
+ $this->$tmp = $javascript_function_name;
17
+ }
18
+ }
19
+
20
+ class ofc_menu_item_camera
21
+ {
22
+ /**
23
+ * @param $text as string. The menu item text.
24
+ * @param $javascript_function_name as string. The javascript function name, the
25
+ * js function takes one parameter, the chart ID. So for example, our js function
26
+ * could look like this:
27
+ *
28
+ * function save_image( chart_id )
29
+ * {
30
+ * alert( chart_id );
31
+ * }
32
+ *
33
+ * to make a menu item call this: ofc_menu_item_camera('Save chart', 'save_image');
34
+ */
35
+ function ofc_menu_item_camera($text, $javascript_function_name)
36
+ {
37
+ $this->type = "camera-icon";
38
+ $this->text = $text;
39
+ $tmp = 'javascript-function';
40
+ $this->$tmp = $javascript_function_name;
41
+ }
42
+ }
43
+
44
+ class ofc_menu
45
+ {
46
+ function ofc_menu($colour, $outline_colour)
47
+ {
48
+ $this->colour = $colour;
49
+ $this->outline_colour = $outline_colour;
50
+ }
51
+
52
+ function values($values)
53
+ {
54
+ $this->values = $values;
55
+ }
56
+ }
js/ofc-library/ofc_pie.php ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class pie_value
4
+ {
5
+ function pie_value( $value, $label )
6
+ {
7
+ $this->value = $value;
8
+ $this->label = $label;
9
+ }
10
+
11
+ function set_colour( $colour )
12
+ {
13
+ $this->colour = $colour;
14
+ }
15
+
16
+ function set_label( $label, $label_colour, $font_size )
17
+ {
18
+ $this->label = $label;
19
+
20
+ $tmp = 'label-colour';
21
+ $this->$tmp = $label_colour;
22
+
23
+ $tmp = 'font-size';
24
+ $this->$tmp = $font_size;
25
+
26
+ }
27
+
28
+ function set_tooltip( $tip )
29
+ {
30
+ $this->tip = $tip;
31
+ }
32
+
33
+ function on_click( $event )
34
+ {
35
+ $tmp = 'on-click';
36
+ $this->$tmp = $event;
37
+ }
38
+
39
+
40
+ /**
41
+ * An object that inherits from base_pie_animation
42
+ */
43
+ function add_animation( $animation )
44
+ {
45
+ if( !isset( $this->animate ) )
46
+ $this->animate = array();
47
+
48
+ $this->animate[] = $animation;
49
+
50
+ return $this;
51
+ }
52
+ }
53
+
54
+ class base_pie_animation{}
55
+
56
+ /**
57
+ * fade the pie slice from $alpha (pie set_alpha) to 100% opaque.
58
+ */
59
+ class pie_fade extends base_pie_animation
60
+ {
61
+ function pie_fade()
62
+ {
63
+ $this->type="fade";
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Bounce the pie slice out a little
69
+ */
70
+ class pie_bounce extends base_pie_animation
71
+ {
72
+ /**
73
+ * @param $distance as integer, distance to bounce in pixels
74
+ */
75
+ function pie_bounce( $distance )
76
+ {
77
+ $this->type="bounce";
78
+ $this->distance = $distance;
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Make a pie chart and fill it with pie slices
84
+ */
85
+ class pie
86
+ {
87
+ function pie()
88
+ {
89
+ $this->type = 'pie';
90
+ }
91
+
92
+ function set_colours( $colours )
93
+ {
94
+ $this->colours = $colours;
95
+ }
96
+
97
+ /**
98
+ * Sugar wrapped around set_colours
99
+ */
100
+ function colours( $colours )
101
+ {
102
+ $this->set_colours( $colours );
103
+ return $this;
104
+ }
105
+
106
+ /**
107
+ * @param $alpha as float (0-1) 0.75 = 3/4 visible
108
+ */
109
+ function set_alpha( $alpha )
110
+ {
111
+ $this->alpha = $alpha;
112
+ }
113
+
114
+ /**
115
+ *sugar wrapped set_alpha
116
+ **/
117
+ function alpha( $alpha )
118
+ {
119
+ $this->set_alpha( $alpha );
120
+ return $this;
121
+ }
122
+
123
+ /**
124
+ * @param $v as array containing one of
125
+ * - null
126
+ * - real or integer number
127
+ * - a pie_value object
128
+ */
129
+ function set_values( $v )
130
+ {
131
+ $this->values = $v;
132
+ }
133
+
134
+ /**
135
+ * sugar for set_values
136
+ */
137
+ function values( $v )
138
+ {
139
+ $this->set_values( $v );
140
+ return $this;
141
+ }
142
+
143
+ /**
144
+ * HACK to keep old code working.
145
+ */
146
+ function set_animate( $bool )
147
+ {
148
+ if( $bool )
149
+ $this->add_animation( new pie_fade() );
150
+
151
+ }
152
+
153
+ /**
154
+ * An object that inherits from base_pie_animation
155
+ */
156
+ function add_animation( $animation )
157
+ {
158
+ if( !isset( $this->animate ) )
159
+ $this->animate = array();
160
+
161
+ $this->animate[] = $animation;
162
+
163
+ return $this;
164
+ }
165
+
166
+ /**
167
+ * @param $angle as real number
168
+ */
169
+ function set_start_angle( $angle )
170
+ {
171
+ $tmp = 'start-angle';
172
+ $this->$tmp = $angle;
173
+ }
174
+
175
+ /**
176
+ * sugar for set_start_angle
177
+ */
178
+ function start_angle($angle)
179
+ {
180
+ $this->set_start_angle( $angle );
181
+ return $this;
182
+ }
183
+
184
+ /**
185
+ * @param $tip as string. The tooltip text. May contain magic varibles
186
+ */
187
+ function set_tooltip( $tip )
188
+ {
189
+ $this->tip = $tip;
190
+ }
191
+
192
+ /**
193
+ * sugar for set_tooltip
194
+ */
195
+ function tooltip( $tip )
196
+ {
197
+ $this->set_tooltip( $tip );
198
+ return $this;
199
+ }
200
+
201
+ function set_gradient_fill()
202
+ {
203
+ $tmp = 'gradient-fill';
204
+ $this->$tmp = true;
205
+ }
206
+
207
+ function gradient_fill()
208
+ {
209
+ $this->set_gradient_fill();
210
+ return $this;
211
+ }
212
+
213
+ /**
214
+ * By default each label is the same colour as the slice,
215
+ * but you can ovveride that behaviour using this method.
216
+ *
217
+ * @param $label_colour as string HEX colour;
218
+ */
219
+ function set_label_colour( $label_colour )
220
+ {
221
+ $tmp = 'label-colour';
222
+ $this->$tmp = $label_colour;
223
+ }
224
+
225
+ function label_colour( $label_colour )
226
+ {
227
+ $this->set_label_colour( $label_colour );
228
+ return $this;
229
+ }
230
+
231
+ /**
232
+ * Turn off the labels
233
+ */
234
+ function set_no_labels()
235
+ {
236
+ $tmp = 'no-labels';
237
+ $this->$tmp = true;
238
+ }
239
+
240
+ function on_click( $event )
241
+ {
242
+ $tmp = 'on-click';
243
+ $this->$tmp = $event;
244
+ }
245
+
246
+ /**
247
+ * Fix the radius of the pie chart. Take a look at the magic variable #radius#
248
+ * for helping figure out what radius to set it to.
249
+ *
250
+ * @param $radius as number
251
+ */
252
+ function radius( $radius )
253
+ {
254
+ $this->radius = $radius;
255
+ return $this;
256
+ }
257
+ }
js/ofc-library/ofc_radar_axis.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class radar_axis
4
+ {
5
+ function radar_axis( $max )
6
+ {
7
+ $this->set_max( $max );
8
+ }
9
+
10
+ function set_max( $max )
11
+ {
12
+ $this->max = $max;
13
+ }
14
+
15
+ function set_steps( $steps )
16
+ {
17
+ $this->steps = $steps;
18
+ }
19
+
20
+ function set_stroke( $s )
21
+ {
22
+ $this->stroke = $s;
23
+ }
24
+
25
+ function set_colour( $colour )
26
+ {
27
+ $this->colour = $colour;
28
+ }
29
+
30
+ function set_grid_colour( $colour )
31
+ {
32
+ $tmp = 'grid-colour';
33
+ $this->$tmp = $colour;
34
+ }
35
+
36
+ function set_labels( $labels )
37
+ {
38
+ $this->labels = $labels;
39
+ }
40
+
41
+ function set_spoke_labels( $labels )
42
+ {
43
+ $tmp = 'spoke-labels';
44
+ $this->$tmp = $labels;
45
+ }
46
+ }
47
+
js/ofc-library/ofc_radar_axis_labels.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class radar_axis_labels
4
+ {
5
+ // $labels : array
6
+ function radar_axis_labels( $labels )
7
+ {
8
+ $this->labels = $labels;
9
+ }
10
+
11
+ function set_colour( $colour )
12
+ {
13
+ $this->colour = $colour;
14
+ }
15
+ }
js/ofc-library/ofc_radar_spoke_labels.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class radar_spoke_labels
4
+ {
5
+ // $labels : array
6
+ function radar_spoke_labels( $labels )
7
+ {
8
+ $this->labels = $labels;
9
+ }
10
+
11
+ function set_colour( $colour )
12
+ {
13
+ $this->colour = $colour;
14
+ }
15
+ }
js/ofc-library/ofc_scatter.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class scatter_value
4
+ {
5
+ function scatter_value( $x, $y, $dot_size=-1 )
6
+ {
7
+ $this->x = $x;
8
+ $this->y = $y;
9
+
10
+ if( $dot_size > 0 )
11
+ {
12
+ $tmp = 'dot-size';
13
+ $this->$tmp = $dot_size;
14
+ }
15
+ }
16
+ }
17
+
18
+ class scatter
19
+ {
20
+ function scatter( $colour )
21
+ {
22
+ $this->type = "scatter";
23
+ $this->set_colour( $colour );
24
+ }
25
+
26
+ function set_colour( $colour )
27
+ {
28
+ $this->colour = $colour;
29
+ }
30
+
31
+ function set_default_dot_style( $style )
32
+ {
33
+ $tmp = 'dot-style';
34
+ $this->$tmp = $style;
35
+ }
36
+
37
+ /**
38
+ * @param $v as array, can contain any combination of:
39
+ * - integer, Y position of the point
40
+ * - any class that inherits from scatter_value
41
+ * - <b>null</b>
42
+ */
43
+ function set_values( $values )
44
+ {
45
+ $this->values = $values;
46
+ }
47
+ }
js/ofc-library/ofc_scatter_line.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class scatter_line
4
+ {
5
+ function scatter_line( $colour, $width )
6
+ {
7
+ $this->type = "scatter_line";
8
+ $this->set_colour( $colour );
9
+ $this->set_width( $width );
10
+ }
11
+
12
+ function set_default_dot_style( $style )
13
+ {
14
+ $tmp = 'dot-style';
15
+ $this->$tmp = $style;
16
+ }
17
+
18
+ function set_colour( $colour )
19
+ {
20
+ $this->colour = $colour;
21
+ }
22
+
23
+ function set_width( $width )
24
+ {
25
+ $this->width = $width;
26
+ }
27
+
28
+ function set_values( $values )
29
+ {
30
+ $this->values = $values;
31
+ }
32
+
33
+ function set_step_horizontal()
34
+ {
35
+ $this->stepgraph = 'horizontal';
36
+ }
37
+
38
+ function set_step_vertical()
39
+ {
40
+ $this->stepgraph = 'vertical';
41
+ }
42
+
43
+ function set_key( $text, $font_size )
44
+ {
45
+ $this->text = $text;
46
+ $tmp = 'font-size';
47
+ $this->$tmp = $font_size;
48
+ }
49
+ }
js/ofc-library/ofc_shape.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class shape_point
4
+ {
5
+ function shape_point( $x, $y )
6
+ {
7
+ $this->x = $x;
8
+ $this->y = $y;
9
+ }
10
+ }
11
+
12
+ class shape
13
+ {
14
+ function shape( $colour )
15
+ {
16
+ $this->type = "shape";
17
+ $this->colour = $colour;
18
+ $this->values = array();
19
+ }
20
+
21
+ function append_value( $p )
22
+ {
23
+ $this->values[] = $p;
24
+ }
25
+ }
js/ofc-library/ofc_sugar.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Sugar: to make stars easier sometimes
5
+ */
6
+ class s_star extends star
7
+ {
8
+ /**
9
+ * I use this wrapper for default dot types,
10
+ * it just makes the code easier to read.
11
+ */
12
+ function s_star($colour, $size)
13
+ {
14
+ parent::star();
15
+ $this->colour($colour)->size($size);
16
+ }
17
+ }
18
+
19
+ class s_box extends anchor
20
+ {
21
+ /**
22
+ * I use this wrapper for default dot types,
23
+ * it just makes the code easier to read.
24
+ */
25
+ function s_box($colour, $size)
26
+ {
27
+ parent::anchor();
28
+ $this->colour($colour)->size($size)->rotation(45)->sides(4);
29
+ }
30
+ }
31
+
32
+ class s_hollow_dot extends hollow_dot
33
+ {
34
+ /**
35
+ * I use this wrapper for default dot types,
36
+ * it just makes the code easier to read.
37
+ */
38
+ function s_hollow_dot($colour, $size)
39
+ {
40
+ parent::hollow_dot();
41
+ $this->colour($colour)->size($size);
42
+ }
43
+ }
js/ofc-library/ofc_tags.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ofc_tags
4
+ {
5
+ function ofc_tags()
6
+ {
7
+ $this->type = "tags";
8
+ $this->values = array();
9
+ }
10
+
11
+ function colour( $colour )
12
+ {
13
+ $this->colour = $colour;
14
+ return $this;
15
+ }
16
+
17
+ /**
18
+ *@param $font as string. e.g. "Verdana"
19
+ *@param $size as integer. Size in px
20
+ */
21
+ function font($font, $size)
22
+ {
23
+ $this->font = $font;
24
+ $this->{'font-size'} = $size;
25
+ return $this;
26
+ }
27
+
28
+ /**
29
+ *@param $x as integer. Size of x padding in px
30
+ *@param $y as integer. Size of y padding in px
31
+ */
32
+ function padding($x, $y)
33
+ {
34
+ $this->{"pad-x"} = $x;
35
+ $this->{"pad-y"} = $y;
36
+ return $this;
37
+ }
38
+
39
+ function rotate($angle)
40
+ {
41
+ $this->rotate($angle);
42
+ return $this;
43
+ }
44
+
45
+ function align_x_center()
46
+ {
47
+ $this->{"align-x"} = "center";
48
+ return $this;
49
+ }
50
+
51
+ function align_x_left()
52
+ {
53
+ $this->{"align-x"} = "left";
54
+ return $this;
55
+ }
56
+
57
+ function align_x_right()
58
+ {
59
+ $this->{"align-x"} = "right";
60
+ return $this;
61
+ }
62
+
63
+ function align_y_above()
64
+ {
65
+ $this->{"align-y"} = "above";
66
+ return $this;
67
+ }
68
+
69
+ function align_y_below()
70
+ {
71
+ $this->{"align-y"} = "below";
72
+ return $this;
73
+ }
74
+
75
+ function align_y_center()
76
+ {
77
+ $this->{"align-y"} = "center";
78
+ return $this;
79
+ }
80
+
81
+ /**
82
+ * This can contain some HTML, e.g:
83
+ * - "More <a href="javascript:alert(12);">info</a>"
84
+ * - "<a href="http://teethgrinder.co.uk">ofc</a>"
85
+ */
86
+ function text($text)
87
+ {
88
+ $this->text = $text;
89
+ return $this;
90
+ }
91
+
92
+ /**
93
+ * This works, but to get the mouse pointer to change
94
+ * to a little hand you need to use "<a href="">stuff</a>"-- see text()
95
+ */
96
+ function on_click($on_click)
97
+ {
98
+ $this->{'on-click'} = $on_click;
99
+ return $this;
100
+ }
101
+
102
+ /**
103
+ *@param $bold boolean.
104
+ *@param $underline boolean.
105
+ *@param $border boolean.
106
+ *@prarm $alpha real (0 to 1.0)
107
+ */
108
+ function style($bold, $underline, $border, $alpha )
109
+ {
110
+ $this->bold = $bold;
111
+ $this->border = $underline;
112
+ $this->underline = $border;
113
+ $this->alpha = $alpha;
114
+ return $this;
115
+ }
116
+
117
+ /**
118
+ *@param $tag as ofc_tag
119
+ */
120
+ function append_tag($tag)
121
+ {
122
+ $this->values[] = $tag;
123
+ }
124
+ }
125
+
126
+ class ofc_tag extends ofc_tags
127
+ {
128
+ function ofc_tag($x, $y)
129
+ {
130
+ $this->x = $x;
131
+ $this->y = $y;
132
+ }
133
+ }
js/ofc-library/ofc_title.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Set the title of a chart, make one of these and pass it into
5
+ * open_flash_chart set_title
6
+ */
7
+ class title
8
+ {
9
+ function title( $text='' )
10
+ {
11
+ $this->text = $text;
12
+ }
13
+
14
+ /**
15
+ * A css string. Can optionally contain:
16
+ * - font-size
17
+ * - font-family
18
+ * - font-weight
19
+ * - color
20
+ * - background-color
21
+ * - text-align
22
+ * - margin
23
+ * - margin-left
24
+ * - margin-right
25
+ * - margin-top
26
+ * - margin-bottom
27
+ * - padding
28
+ * - padding-left
29
+ * - padding-right
30
+ * - padding-top
31
+ * - padding-bottom
32
+ * just like the css we use all the time :-)
33
+ */
34
+ function set_style( $css )
35
+ {
36
+ $this->style = $css;
37
+ //"{font-size: 20px; color:#0000ff; font-family: Verdana; text-align: center;}";
38
+ }
39
+ }
js/ofc-library/ofc_tooltip.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once 'ofc_bar_base.php';
4
+
5
+ class tooltip
6
+ {
7
+ function tooltip(){}
8
+
9
+ /**
10
+ * @param $shadow as boolean. Enable drop shadow.
11
+ */
12
+ function set_shadow( $shadow )
13
+ {
14
+ $this->shadow = $shadow;
15
+ }
16
+
17
+ /**
18
+ * @param $stroke as integer, border width in pixels (e.g. 5 )
19
+ */
20
+ function set_stroke( $stroke )
21
+ {
22
+ $this->stroke = $stroke;
23
+ }
24
+
25
+ /**
26
+ * @param $colour as string, HEX colour e.g. '#0000ff'
27
+ */
28
+ function set_colour( $colour )
29
+ {
30
+ $this->colour = $colour;
31
+ }
32
+
33
+ /**
34
+ * @param $bg as string, HEX colour e.g. '#0000ff'
35
+ */
36
+ function set_background_colour( $bg )
37
+ {
38
+ $this->background = $bg;
39
+ }
40
+
41
+ /**
42
+ * @param $style as string. A css style.
43
+ */
44
+ function set_title_style( $style )
45
+ {
46
+ $this->title = $style;
47
+ }
48
+
49
+ /**
50
+ * @param $style as string. A css style.
51
+ */
52
+ function set_body_style( $style )
53
+ {
54
+ $this->body = $style;
55
+ }
56
+
57
+ function set_proximity()
58
+ {
59
+ $this->mouse = 1;
60
+ }
61
+
62
+ function set_hover()
63
+ {
64
+ $this->mouse = 2;
65
+ }
66
+ }
67
+
js/ofc-library/ofc_upload_image.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //
4
+ // In Open Flash Chart -> save_image debug mode, you
5
+ // will see the 'echo' text in a new window.
6
+ //
7
+
8
+ /*
9
+
10
+ print_r( $_GET );
11
+ print_r( $_POST );
12
+ print_r( $_FILES );
13
+
14
+ print_r( $GLOBALS );
15
+ print_r( $GLOBALS["HTTP_RAW_POST_DATA"] );
16
+
17
+ */
18
+
19
+
20
+ // default path for the image to be stored //
21
+ $default_path = '../tmp-upload-images/';
22
+
23
+ if (!file_exists($default_path)) mkdir($default_path, 0777, true);
24
+
25
+ // full path to the saved image including filename //
26
+ $destination = $default_path . basename( $_GET[ 'name' ] );
27
+
28
+ echo 'Saving your image to: '. $destination;
29
+ // print_r( $_POST );
30
+ // print_r( $_SERVER );
31
+ // echo $HTTP_RAW_POST_DATA;
32
+
33
+ //
34
+ // POST data is usually string data, but we are passing a RAW .png
35
+ // so PHP is a bit confused and $_POST is empty. But it has saved
36
+ // the raw bits into $HTTP_RAW_POST_DATA
37
+ //
38
+
39
+ $jfh = fopen($destination, 'w') or die("can't open file");
40
+ fwrite($jfh, $HTTP_RAW_POST_DATA);
41
+ fclose($jfh);
42
+
43
+ //
44
+ // LOOK:
45
+ //
46
+ exit();
47
+
48
+
49
+ //
50
+ // PHP5:
51
+ //
52
+
53
+
54
+ // default path for the image to be stored //
55
+ $default_path = 'tmp-upload-images/';
56
+
57
+ if (!file_exists($default_path)) mkdir($default_path, 0777, true);
58
+
59
+ // full path to the saved image including filename //
60
+ $destination = $default_path . basename( $_FILES[ 'Filedata' ][ 'name' ] );
61
+
62
+ // move the image into the specified directory //
63
+ if (move_uploaded_file($_FILES[ 'Filedata' ][ 'tmp_name' ], $destination)) {
64
+ echo "The file " . basename( $_FILES[ 'Filedata' ][ 'name' ] ) . " has been uploaded;";
65
+ } else {
66
+ echo "FILE UPLOAD FAILED";
67
+ }
68
+
69
+
70
+ ?>
js/ofc-library/ofc_x_axis.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class x_axis
4
+ {
5
+ function x_axis(){}
6
+
7
+ /**
8
+ * @param $stroke as integer, with of the line and ticks
9
+ */
10
+ function set_stroke( $stroke )
11
+ {
12
+ $this->stroke = $stroke;
13
+ }
14
+
15
+ function stroke( $stroke )
16
+ {
17
+ $this->set_stroke( $stroke );
18
+ return $this;
19
+ }
20
+
21
+ /**
22
+ *@param $colour as string HEX colour
23
+ *@param $grid_colour as string HEX colour
24
+ */
25
+ function set_colours( $colour, $grid_colour )
26
+ {
27
+ $this->set_colour( $colour );
28
+ $this->set_grid_colour( $grid_colour );
29
+ }
30
+
31
+ /**
32
+ *@param $colour as string HEX colour
33
+ */
34
+ function set_colour( $colour )
35
+ {
36
+ $this->colour = $colour;
37
+ }
38
+
39
+ function colour( $colour )
40
+ {
41
+ $this->set_colour($colour);
42
+ return $this;
43
+ }
44
+
45
+ function set_tick_height( $height )
46
+ {
47
+ $tmp = 'tick-height';
48
+ $this->$tmp = $height;
49
+ }
50
+
51
+ function tick_height( $height )
52
+ {
53
+ $this->set_tick_height($height);
54
+ return $this;
55
+ }
56
+
57
+ function set_grid_colour( $colour )
58
+ {
59
+ $tmp = 'grid-colour';
60
+ $this->$tmp = $colour;
61
+ }
62
+
63
+ function grid_colour( $colour )
64
+ {
65
+ $this->set_grid_colour($colour);
66
+ return $this;
67
+ }
68
+
69
+ /**
70
+ * @param $o is a boolean. If true, the X axis start half a step in
71
+ * This defaults to True
72
+ */
73
+ function set_offset( $o )
74
+ {
75
+ $this->offset = $o?true:false;
76
+ }
77
+
78
+ function offset( $o )
79
+ {
80
+ $this->set_offset($o);
81
+ return $this;
82
+ }
83
+
84
+ /**
85
+ * @param $steps as integer. Which grid lines and ticks are visible.
86
+ */
87
+ function set_steps( $steps )
88
+ {
89
+ $this->steps = $steps;
90
+ }
91
+
92
+ function steps( $steps )
93
+ {
94
+ $this->set_steps($steps);
95
+ return $this;
96
+ }
97
+
98
+ /**
99
+ * @param $val as an integer, the height in pixels of the 3D bar. Mostly
100
+ * used for the 3D bar chart.
101
+ */
102
+ function set_3d( $val )
103
+ {
104
+ $tmp = '3d';
105
+ $this->$tmp = $val;
106
+ }
107
+
108
+ /**
109
+ * @param $x_axis_labels as an x_axis_labels object
110
+ * Use this to customize the labels (colour, font, etc...)
111
+ */
112
+ function set_labels( $x_axis_labels )
113
+ {
114
+ //$this->labels = $v;
115
+ $this->labels = $x_axis_labels;
116
+ }
117
+
118
+ /**
119
+ * Sugar syntax: helper function to make the examples simpler.
120
+ * @param $a is an array of labels
121
+ */
122
+ function set_labels_from_array( $a )
123
+ {
124
+ $x_axis_labels = new x_axis_labels();
125
+ $x_axis_labels->set_labels( $a );
126
+ $this->labels = $x_axis_labels;
127
+
128
+ if( isset( $this->steps ) )
129
+ $x_axis_labels->set_steps( $this->steps );
130
+ }
131
+
132
+ /**
133
+ * min and max.
134
+ */
135
+ function set_range( $min, $max )
136
+ {
137
+ $this->min = $min;
138
+ $this->max = $max;
139
+ }
140
+ }
js/ofc-library/ofc_x_axis_label.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * x_axis_label see x_axis_labels
5
+ */
6
+ class x_axis_label
7
+ {
8
+ function x_axis_label( $text, $colour, $size, $rotate )
9
+ {
10
+ $this->set_text( $text );
11
+ $this->set_colour( $colour );
12
+ $this->set_size( $size );
13
+ $this->set_rotate( $rotate );
14
+ }
15
+
16
+ function set_text( $text )
17
+ {
18
+ $this->text = $text;
19
+ }
20
+
21
+ function set_colour( $colour )
22
+ {
23
+ $this->colour = $colour;
24
+ }
25
+
26
+ function set_size( $size )
27
+ {
28
+ $this->size = $size;
29
+ }
30
+
31
+ function set_rotate( $rotate )
32
+ {
33
+ $this->rotate = $rotate;
34
+ }
35
+
36
+ function set_vertical()
37
+ {
38
+ $this->rotate = "vertical";
39
+ }
40
+
41
+ function set_visible()
42
+ {
43
+ $this->visible = true;
44
+ }
45
+ }
js/ofc-library/ofc_x_axis_labels.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class x_axis_labels
4
+ {
5
+ function x_axis_labels(){}
6
+
7
+ /**
8
+ * @param $steps which labels are generated
9
+ */
10
+ function set_steps( $steps )
11
+ {
12
+ $this->steps = $steps;
13
+ }
14
+
15
+ /**
16
+ * @param $steps as integer which labels are visible
17
+ */
18
+ function visible_steps( $steps )
19
+ {
20
+ $this->{"visible-steps"} = $steps;
21
+ return $this;
22
+ }
23
+
24
+ /**
25
+ *
26
+ * @param $labels as an array of [x_axis_label or string]
27
+ */
28
+ function set_labels( $labels )
29
+ {
30
+ $this->labels = $labels;
31
+ }
32
+
33
+ function set_colour( $colour )
34
+ {
35
+ $this->colour = $colour;
36
+ }
37
+
38
+ /**
39
+ * font size in pixels
40
+ */
41
+ function set_size( $size )
42
+ {
43
+ $this->size = $size;
44
+ }
45
+
46
+ /**
47
+ * rotate labels
48
+ */
49
+ function set_vertical()
50
+ {
51
+ $this->rotate = 270;
52
+ }
53
+
54
+ /**
55
+ * @param @angle as real. The angle of the text.
56
+ */
57
+ function rotate( $angle )
58
+ {
59
+ $this->rotate = $angle;
60
+ }
61
+
62
+ /**
63
+ * @param $text as string. Replace and magic variables with actual x axis position.
64
+ */
65
+ function text( $text )
66
+ {
67
+ $this->text = $text;
68
+ }
69
+ }
js/ofc-library/ofc_x_legend.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class x_legend
4
+ {
5
+ function x_legend( $text='' )
6
+ {
7
+ $this->text = $text;
8
+ }
9
+
10
+ function set_style( $css )
11
+ {
12
+ $this->style = $css;
13
+ //"{font-size: 20px; color:#0000ff; font-family: Verdana; text-align: center;}";
14
+ }
15
+ }
js/ofc-library/ofc_y_axis.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class y_axis extends y_axis_base
4
+ {
5
+ function y_axis(){}
6
+
7
+ /**
8
+ * @param $colour as string. The grid are the lines inside the chart.
9
+ * HEX colour, e.g. '#ff0000'
10
+ */
11
+ function set_grid_colour( $colour )
12
+ {
13
+ $tmp = 'grid-colour';
14
+ $this->$tmp = $colour;
15
+ }
16
+
17
+ }
js/ofc-library/ofc_y_axis_base.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class y_axis_base
4
+ {
5
+ function y_axis_base(){}
6
+
7
+ /**
8
+ * @param $s as integer, thickness of the Y axis line
9
+ */
10
+ function set_stroke( $s )
11
+ {
12
+ $this->stroke = $s;
13
+ }
14
+
15
+ /**
16
+ * @param $val as integer. The length of the ticks in pixels
17
+ */
18
+ function set_tick_length( $val )
19
+ {
20
+ $tmp = 'tick-length';
21
+ $this->$tmp = $val;
22
+ }
23
+
24
+ function set_colours( $colour, $grid_colour )
25
+ {
26
+ $this->set_colour( $colour );
27
+ $this->set_grid_colour( $grid_colour );
28
+ }
29
+
30
+ function set_colour( $colour )
31
+ {
32
+ $this->colour = $colour;
33
+ }
34
+
35
+ function set_grid_colour( $colour )
36
+ {
37
+ $tmp = 'grid-colour';
38
+ $this->$tmp = $colour;
39
+ }
40
+
41
+ /**
42
+ * Set min and max values, also (optionally) set the steps value.
43
+ * You can reverse the chart by setting min larger than max, e.g. min = 10
44
+ * and max = 0.
45
+ *
46
+ * @param $min as integer
47
+ * @param $max as integer
48
+ * @param $steps as integer.
49
+ */
50
+ function set_range( $min, $max, $steps=1 )
51
+ {
52
+ $this->min = $min;
53
+ $this->max = $max;
54
+ $this->set_steps( $steps );
55
+ }
56
+
57
+ /**
58
+ * Sugar for set_range
59
+ */
60
+ function range( $min, $max, $steps=1 )
61
+ {
62
+ $this->set_range( $min, $max, $steps );
63
+ return $this;
64
+ }
65
+
66
+ /**
67
+ * @param $off as Boolean. If true the Y axis is nudged up half a step.
68
+ */
69
+ function set_offset( $off )
70
+ {
71
+ $this->offset = $off?1:0;
72
+ }
73
+
74
+ /**
75
+ * @param $y_axis_labels as an y_axis_labels object
76
+ * Use this to customize the labels (colour, font, etc...)
77
+ */
78
+ function set_labels( $y_axis_labels )
79
+ {
80
+ $this->labels = $y_axis_labels;
81
+ }
82
+
83
+ /**
84
+ * Pass in some text for each label. This can contain magic variables "#val#" which
85
+ * will get replaced with the value for that Y axis label. Useful for:
86
+ * - "�#val#"
87
+ * - "#val#%"
88
+ * - "#val# million"
89
+ *
90
+ * @param $text as string.
91
+ */
92
+ function set_label_text( $text )
93
+ {
94
+ $tmp = new y_axis_labels();
95
+ $tmp->set_text( $text );
96
+ $this->labels = $tmp;
97
+ }
98
+
99
+ /**
100
+ * @param $steps as integer.
101
+ *
102
+ * Only show every $steps label, e.g. every 10th
103
+ */
104
+ function set_steps( $steps )
105
+ {
106
+ $this->steps = $steps;
107
+ }
108
+
109
+ /**
110
+ * Make the labels show vertical
111
+ */
112
+ function set_vertical()
113
+ {
114
+ $this->rotate = "vertical";
115
+ }
116
+ }
js/ofc-library/ofc_y_axis_label.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * y_axis_label see y_axis_labels
5
+ */
6
+ class y_axis_label
7
+ {
8
+ function y_axis_label( $y, $text)
9
+ {
10
+ $this->y = $y;
11
+ $this->set_text( $text );
12
+ }
13
+
14
+ function set_text( $text )
15
+ {
16
+ $this->text = $text;
17
+ }
18
+
19
+ function set_colour( $colour )
20
+ {
21
+ $this->colour = $colour;
22
+ }
23
+
24
+ function set_size( $size )
25
+ {
26
+ $this->size = $size;
27
+ }
28
+
29
+ function set_rotate( $rotate )
30
+ {
31
+ $this->rotate = $rotate;
32
+ }
33
+
34
+ function set_vertical()
35
+ {
36
+ $this->rotate = "vertical";
37
+ }
38
+ }
js/ofc-library/ofc_y_axis_labels.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class y_axis_labels
4
+ {
5
+ function y_axis_labels(){}
6
+
7
+ /**
8
+ * @param $steps which labels are generated
9
+ */
10
+ function set_steps( $steps )
11
+ {
12
+ $this->steps = $steps;
13
+ }
14
+
15
+ /**
16
+ *
17
+ * @param $labels as an array of [y_axis_label or string]
18
+ */
19
+ function set_labels( $labels )
20
+ {
21
+ $this->labels = $labels;
22
+ }
23
+
24
+ function set_colour( $colour )
25
+ {
26
+ $this->colour = $colour;
27
+ }
28
+
29
+ /**
30
+ * font size in pixels
31
+ */
32
+ function set_size( $size )
33
+ {
34
+ $this->size = $size;
35
+ }
36
+
37
+ /**
38
+ * rotate labels
39
+ */
40
+ function set_vertical()
41
+ {
42
+ $this->rotate = 270;
43
+ }
44
+
45
+ function rotate( $angle )
46
+ {
47
+ $this->rotate = $angle;
48
+ }
49
+
50
+ /**
51
+ * @param $text default text that all labels inherit
52
+ */
53
+ function set_text( $text )
54
+ {
55
+ $this->text = $text;
56
+ }
57
+ }
js/ofc-library/ofc_y_axis_right.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class y_axis_right extends y_axis_base
4
+ {
5
+ function y_axis_right(){}
6
+ }
js/ofc-library/ofc_y_legend.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class y_legend
4
+ {
5
+ function y_legend( $text='' )
6
+ {
7
+ $this->text = $text;
8
+ }
9
+
10
+ function set_style( $css )
11
+ {
12
+ $this->style = $css;
13
+ //"{font-size: 20px; color:#0000ff; font-family: Verdana; text-align: center;}";
14
+ }
15
+ }
js/ofc-library/open-flash-chart-object.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function open_flash_chart_object_str( $width, $height, $url, $use_swfobject=true, $base='' )
4
+ {
5
+ //
6
+ // return the HTML as a string
7
+ //
8
+ return _ofc( $width, $height, $url, $use_swfobject, $base );
9
+ }
10
+
11
+ function open_flash_chart_object( $width, $height, $url, $use_swfobject=true, $base='' )
12
+ {
13
+ //
14
+ // stream the HTML into the page
15
+ //
16
+ echo _ofc( $width, $height, $url, $use_swfobject, $base );
17
+ }
18
+
19
+ function _ofc( $width, $height, $url, $use_swfobject, $base )
20
+ {
21
+ //
22
+ // I think we may use swfobject for all browsers,
23
+ // not JUST for IE...
24
+ //
25
+ //$ie = strstr(getenv('HTTP_USER_AGENT'), 'MSIE');
26
+
27
+ //
28
+ // escape the & and stuff:
29
+ //
30
+ $url = urlencode($url);
31
+
32
+ //
33
+ // output buffer
34
+ //
35
+ $out = array();
36
+
37
+ //
38
+ // check for http or https:
39
+ //
40
+ if (isset ($_SERVER['HTTPS']))
41
+ {
42
+ if (strtoupper ($_SERVER['HTTPS']) == 'ON')
43
+ {
44
+ $protocol = 'https';
45
+ }
46
+ else
47
+ {
48
+ $protocol = 'http';
49
+ }
50
+ }
51
+ else
52
+ {
53
+ $protocol = 'http';
54
+ }
55
+
56
+ //
57
+ // if there are more than one charts on the
58
+ // page, give each a different ID
59
+ //
60
+ global $open_flash_chart_seqno;
61
+ $obj_id = 'chart';
62
+ $div_name = 'flashcontent';
63
+
64
+ //$out[] = '<script type="text/javascript" src="'. $base .'js/ofc.js"></script>';
65
+
66
+ if( !isset( $open_flash_chart_seqno ) )
67
+ {
68
+ $open_flash_chart_seqno = 1;
69
+ $out[] = '<script type="text/javascript" src="'. $base .'js/swfobject.js"></script>';
70
+ }
71
+ else
72
+ {
73
+ $open_flash_chart_seqno++;
74
+ $obj_id .= '_'. $open_flash_chart_seqno;
75
+ $div_name .= '_'. $open_flash_chart_seqno;
76
+ }
77
+
78
+ if( $use_swfobject )
79
+ {
80
+ // Using library for auto-enabling Flash object on IE, disabled-Javascript proof
81
+ $out[] = '<div id="'. $div_name .'"></div>';
82
+ $out[] = '<script type="text/javascript">';
83
+ $out[] = 'var so = new SWFObject("'. $base .'open-flash-chart.swf", "'. $obj_id .'", "'. $width . '", "' . $height . '", "9", "#FFFFFF");';
84
+
85
+ $out[] = 'so.addVariable("data-file", "'. $url . '");';
86
+
87
+ $out[] = 'so.addParam("allowScriptAccess", "always" );//"sameDomain");';
88
+ $out[] = 'so.write("'. $div_name .'");';
89
+ $out[] = '</script>';
90
+ $out[] = '<noscript>';
91
+ }
92
+
93
+ $out[] = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="' . $protocol . '://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';
94
+ $out[] = 'width="' . $width . '" height="' . $height . '" id="ie_'. $obj_id .'" align="middle">';
95
+ $out[] = '<param name="allowScriptAccess" value="sameDomain" />';
96
+ $out[] = '<param name="movie" value="'. $base .'open-flash-chart.swf?data='. $url .'" />';
97
+ $out[] = '<param name="quality" value="high" />';
98
+ $out[] = '<param name="bgcolor" value="#FFFFFF" />';
99
+ $out[] = '<embed src="'. $base .'open-flash-chart.swf?data=' . $url .'" quality="high" bgcolor="#FFFFFF" width="'. $width .'" height="'. $height .'" name="'. $obj_id .'" align="middle" allowScriptAccess="sameDomain" ';
100
+ $out[] = 'type="application/x-shockwave-flash" pluginspage="' . $protocol . '://www.macromedia.com/go/getflashplayer" id="'. $obj_id .'"/>';
101
+ $out[] = '</object>';
102
+
103
+ if ( $use_swfobject ) {
104
+ $out[] = '</noscript>';
105
+ }
106
+
107
+ return implode("\n",$out);
108
+ }
109
+ ?>
js/ofc-library/open-flash-chart.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // var_dump(debug_backtrace());
4
+
5
+ //
6
+ // Omar Kilani's php C extension for encoding JSON has been incorporated in stock PHP since 5.2.0
7
+ // http://www.aurore.net/projects/php-json/
8
+ //
9
+ // -- Marcus Engene
10
+ //
11
+ if (! function_exists('json_encode'))
12
+ {
13
+ include_once 'JSON.php';
14
+ }
15
+
16
+ include_once 'json_format.php';
17
+
18
+ // ofc classes
19
+ include_once 'ofc_title.php';
20
+ include_once 'ofc_y_axis_base.php';
21
+ include_once 'ofc_y_axis.php';
22
+ include_once 'ofc_y_axis_right.php';
23
+ include_once 'ofc_y_axis_labels.php';
24
+ include_once 'ofc_y_axis_label.php';
25
+ include_once 'ofc_x_axis.php';
26
+
27
+
28
+ include_once 'ofc_pie.php';
29
+ //include_once 'ofc_bar.php';
30
+ include_once 'ofc_bar_glass.php';
31
+ include_once 'ofc_bar_filled.php';
32
+ include_once 'ofc_bar_stack.php';
33
+ //include_once 'ofc_bar_3d.php';
34
+ include_once 'ofc_hbar.php';
35
+ include_once 'ofc_line_base.php';
36
+ include_once 'ofc_line.php';
37
+ //include_once 'ofc_line_dot.php';
38
+ //include_once 'ofc_line_hollow.php';
39
+ include_once 'ofc_candle.php';
40
+ include_once 'ofc_area_base.php';
41
+ include_once 'ofc_tags.php';
42
+ include_once 'ofc_arrow.php';
43
+ //include_once 'ofc_area_hollow.php';
44
+ //include_once 'ofc_area_line.php';
45
+
46
+ include_once 'ofc_x_legend.php';
47
+ include_once 'ofc_y_legend.php';
48
+ include_once 'ofc_bar_sketch.php';
49
+ include_once 'ofc_scatter.php';
50
+ include_once 'ofc_scatter_line.php';
51
+ include_once 'ofc_x_axis_labels.php';
52
+ include_once 'ofc_x_axis_label.php';
53
+ include_once 'ofc_tooltip.php';
54
+ include_once 'ofc_shape.php';
55
+ include_once 'ofc_radar_axis.php';
56
+ include_once 'ofc_radar_axis_labels.php';
57
+ include_once 'ofc_radar_spoke_labels.php';
58
+ include_once 'ofc_line_style.php';
59
+
60
+ include_once 'dot_base.php';
61
+ include_once 'ofc_menu.php';
62
+
63
+ class open_flash_chart
64
+ {
65
+ function open_flash_chart()
66
+ {
67
+ //$this->title = new title( "Many data lines" );
68
+ $this->elements = array();
69
+ }
70
+
71
+ function set_title( $t )
72
+ {
73
+ $this->title = $t;
74
+ }
75
+
76
+ function set_x_axis( $x )
77
+ {
78
+ $this->x_axis = $x;
79
+ }
80
+
81
+ function set_y_axis( $y )
82
+ {
83
+ $this->y_axis = $y;
84
+ }
85
+
86
+ function add_y_axis( $y )
87
+ {
88
+ $this->y_axis = $y;
89
+ }
90
+
91
+ function set_y_axis_right( $y )
92
+ {
93
+ $this->y_axis_right = $y;
94
+ }
95
+
96
+ function add_element( $e )
97
+ {
98
+ $this->elements[] = $e;
99
+ }
100
+
101
+ function set_x_legend( $x )
102
+ {
103
+ $this->x_legend = $x;
104
+ }
105
+
106
+ function set_y_legend( $y )
107
+ {
108
+ $this->y_legend = $y;
109
+ }
110
+
111
+ function set_bg_colour( $colour )
112
+ {
113
+ $this->bg_colour = $colour;
114
+ }
115
+
116
+ function set_radar_axis( $radar )
117
+ {
118
+ $this->radar_axis = $radar;
119
+ }
120
+
121
+ function set_tooltip( $tooltip )
122
+ {
123
+ $this->tooltip = $tooltip;
124
+ }
125
+
126
+ /**
127
+ * This is a bit funky :(
128
+ *
129
+ * @param $num_decimals as integer. Truncate the decimals to $num_decimals, e.g. set it
130
+ * to 5 and 3.333333333 will display as 3.33333. 2.0 will display as 2 (or 2.00000 - see below)
131
+ * @param $is_fixed_num_decimals_forced as boolean. If true it will pad the decimals.
132
+ * @param $is_decimal_separator_comma as boolean
133
+ * @param $is_thousand_separator_disabled as boolean
134
+ *
135
+ * This needs a bit of love and attention
136
+ */
137
+ function set_number_format($num_decimals, $is_fixed_num_decimals_forced, $is_decimal_separator_comma, $is_thousand_separator_disabled )
138
+ {
139
+ $this->num_decimals = $num_decimals;
140
+ $this->is_fixed_num_decimals_forced = $is_fixed_num_decimals_forced;
141
+ $this->is_decimal_separator_comma = $is_decimal_separator_comma;
142
+ $this->is_thousand_separator_disabled = $is_thousand_separator_disabled;
143
+ }
144
+
145
+ /**
146
+ * This is experimental and will change as we make it work
147
+ *
148
+ * @param $m as ofc_menu
149
+ */
150
+ function set_menu($m)
151
+ {
152
+ $this->menu = $m;
153
+ }
154
+
155
+ function toString()
156
+ {
157
+ if (function_exists('json_encode'))
158
+ {
159
+ return json_encode($this);
160
+ }
161
+ else
162
+ {
163
+ $json = new Services_JSON();
164
+ return $json->encode( $this );
165
+ }
166
+ }
167
+
168
+ function toPrettyString()
169
+ {
170
+ return json_format( $this->toString() );
171
+ }
172
+ }
173
+
174
+
175
+
176
+ //
177
+ // there is no PHP end tag so we don't mess the headers up!
178
+ //
js/open-flash-chart.swf ADDED
Binary file
js/swfobject.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ /* SWFObject v2.1 <http://code.google.com/p/swfobject/>
2
+ Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
3
+ This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
4
+ */
5
+ var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
readme.txt CHANGED
@@ -1,19 +1,28 @@
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
 
@@ -22,9 +31,69 @@ Feedback and requests are welcome.
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.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  === Formidable ===
2
  Contributors: sswells
3
  Donate link: http://blog.strategy11.com/donate
4
+ Tags: WPMU, form, builder, drag, drop, widget, sidebar, Post, posts, page, wordpress, plugin, template, contact, contact form, captcha, email, database, save, admin, akismet, AJAX, links, javascript, jquery, theme, spam, content, image, images, poll, survey, feedback
5
+ Requires at least: 2.5
6
+ Tested up to: 2.9.1
7
+ Stable tag: 1.0.11
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.
13
 
14
  = Features =
15
+ * Integrates with Pretty Link, WP reCAPTCHA, and Akismet
16
  * Shortcode [formidable id=x] for use in pages, posts, or text widgets for WordPress version 2.8 and above.
17
+ * Alternatively use `<?php echo FrmEntriesController::show_form(2, $key = '', $title=true, $description=true); ?>` in your template
18
+ * Customize most HTML when editing the form (code for editing HTML when creating the form is soon to follow... and documentation too)
19
+ * Create forms from existing templates or add your own
20
+ * Direct links available with and without integration with your current theme
21
+ * Select an email address to send form responses under "Advanced Form Options"
22
+ * Input default data into form fields with the option to clear when clicked
23
+ * Saves responses to the database for future retrieval, reports, and display in [Formidable Pro](http://formidablepro.com/ "Formidable Pro")
24
+ * PHP ninjas can display data in templates using functions in FrmApiController. However, there is currently no documentation for these functions.
25
+
26
 
27
  Feedback and requests are welcome.
28
 
31
  2. Activate the plugin through the 'Plugins' menu
32
  3. Go to the Formidable 'Settings' menu to select a front-end preview page.
33
  4. Create a new custom form or use the existing Contact Form template.
34
+ 5. Use shortcode [formidable id=x] in pages, posts, or text widgets. (Requires WordPress version 2.8 or higher)
35
 
36
  == Screenshots ==
37
+ [Formidable Screenshots](http://blog.strategy11.com/formidable-wordpress-plugin/ "Formidable Screenshots")
38
+
39
+ [Formidable Pro Screenshots](http://blog.strategy11.com/formidablepro/ "Formidable Pro Screenshots")
40
+
41
+ == Frequently Asked Questions ==
42
+ [Formidable FAQs](http://blog.strategy11.com/formidable-faqs/ "Formidable FAQs")
43
+
44
+ == Changelog ==
45
+ = 1.0.12 =
46
+ * Validated HTML markup for front-end form
47
+ * Simplified the way a default template is created so it will also get updated with any changes
48
+ * Really fixed the after HTML field this time
49
+ * Changed option to email form to default to admin's email address instead of blank
50
+
51
+ = 1.0.11 =
52
+ * Added a selectable shortcode on the forms listing page
53
+ * Fixed the before and after HTML fields to display properly
54
+ * Added option to clear default text on a textarea (paragraph input)
55
+ * Added option for validation to ignore default values
56
+
57
+ = 1.0.10 =
58
+ * Started HTML customization. Will be updated, but for now you can only edit the HTML when editing the form.
59
+ * Added 'Settings' link on plugin page
60
+
61
+ = 1.0.09 =
62
+ * Fixes for PHP 4 compatibility
63
+
64
+ = 1.0.08 =
65
+ * Allow required indicator to be blank
66
+ * Hide paragraph tags if field description is empty
67
+ * General code cleanup
68
+
69
+ = 1.0.07 =
70
+ * Added Akismet integration
71
+ * Replaced all instances of `<?` with `<?php`
72
+ * Fixed bug preventing multiple forms from showing on the same page
73
+
74
+ = 1.0.06 =
75
+ * Added option to rename submit button
76
+ * Added option to customize success message
77
+ * Moved default form values from pro to free version
78
+ * Added option to clear default text when field is clicked
79
+
80
+ = 1.0.05 =
81
+ * Added loading indicator to required star and when field is added by dragging
82
+ * Added confirmation before field is deleted
83
+ * Fixed field options for radio buttons to correctly save
84
+ * Don't call pluggable.php if functions are already defined (To remove conflict with Role Scoper)
85
+ * Added Pro auto-update code for testing
86
+
87
+ = 1.0.4 =
88
+ * Fix captcha for WPMU
89
+ * Hide captcha field if WP reCAPTCHA is not installed
90
+
91
+ = 1.0.3 =
92
+ * Allow `<?php echo FrmEntriesController::show_form(id, key, title, description);?>` to be used in a template
93
+
94
+ = 1.0.2 =
95
+ * Fixed error on submission from direct link
96
+
97
+ = 1.0.1 =
98
+ * Fixed shortcode for text widget
99
+ * Removed extra menu item
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file
todo.txt DELETED
@@ -1,60 +0,0 @@
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.