Version Description
Popover forms will be added in September 2010.
Download this release
Release Info
Developer | tlovett1 |
Plugin | Custom Contact Forms |
Version | 3.0.0 |
Comparing to | |
See all releases |
Code changes from version 2.2.5 to 3.0.0
- custom-contact-forms-db.php +42 -24
- custom-contact-forms.css +21 -25
- custom-contact-forms.php +299 -146
- error_log +18 -0
- images/_notes/dwsync.xml +8 -0
- js/custom-contact-forms-admin.js +39 -0
- js/jquery-ui-1.8.4.custom.js +1578 -1578
- js/jquery.bgiframe-2.1.1.js +9 -9
- js/jquery.ui.dialog.js +827 -0
- js/jquery.ui.position.js +233 -233
- js/jquery.ui.widget.js +237 -237
- readme.txt +97 -99
custom-contact-forms-db.php
CHANGED
@@ -98,6 +98,12 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
98 |
$wpdb->query("ALTER TABLE `" . $this->fields_table . "` ADD `user_field` INT( 1 ) NOT NULL DEFAULT '1'");
|
99 |
if (!$this->columnExists('form_style', $this->forms_table))
|
100 |
$wpdb->query("ALTER TABLE `" . $this->forms_table . "` ADD `form_style` INT( 10 ) NOT NULL DEFAULT '0'");
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
if (!$this->columnExists('field_backgroundcolor', $this->styles_table))
|
102 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `field_backgroundcolor` VARCHAR( 20 ) NOT NULL DEFAULT '#efefef'");
|
103 |
if (!$this->columnExists('field_borderstyle', $this->styles_table))
|
@@ -110,8 +116,13 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
110 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `title_margin` VARCHAR( 20 ) NOT NULL DEFAULT '2px'");
|
111 |
if (!$this->columnExists('label_margin', $this->styles_table))
|
112 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `label_margin` VARCHAR( 20 ) NOT NULL DEFAULT '3px'");
|
|
|
|
|
113 |
if (!$this->columnExists('field_instructions', $this->fields_table))
|
114 |
$wpdb->query("ALTER TABLE `" . $this->fields_table . "` ADD `field_instructions` TEXT NOT NULL");
|
|
|
|
|
|
|
115 |
}
|
116 |
|
117 |
function insertFixedFields() {
|
@@ -133,10 +144,14 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
133 |
return (!empty($test[0]) && $test[0]->COLUMN_NAME == $column);
|
134 |
}
|
135 |
|
136 |
-
function insertForm($
|
137 |
global $wpdb;
|
138 |
-
if ($this->formSlugExists($this->formatSlug($form_slug))) return false;
|
139 |
-
$
|
|
|
|
|
|
|
|
|
140 |
return true;
|
141 |
}
|
142 |
|
@@ -179,38 +194,41 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
179 |
return ($wpdb->get_var("show tables like '". $this->styles_table . "'") == $this->styles_table);
|
180 |
}
|
181 |
|
182 |
-
function updateForm($
|
183 |
global $wpdb;
|
184 |
-
if (empty($form_slug))
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
|
|
189 |
return true;
|
190 |
}
|
191 |
|
192 |
-
function updateField($
|
193 |
global $wpdb;
|
194 |
-
if (empty($field_slug))
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
|
|
|
|
199 |
return true;
|
200 |
}
|
201 |
|
202 |
-
function updateStyle($style) {
|
203 |
global $wpdb;
|
204 |
if (empty($style[style_slug])) return false;
|
205 |
-
$test = $this->selectStyle('', $style[style_slug]);
|
206 |
-
if (!empty($test) and $test->id != $
|
207 |
return false;
|
208 |
$style[style_slug] = $this->formatSlug($style[style_slug]);
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
}
|
213 |
-
$wpdb->update($this->styles_table, $style, array('id' => $style[id]));
|
214 |
return true;
|
215 |
}
|
216 |
|
@@ -247,7 +265,7 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
247 |
return $wpdb->get_results("SELECT * FROM " . $this->styles_table . " ORDER BY style_slug ASC");
|
248 |
}
|
249 |
|
250 |
-
function selectForm($fid, $form_slug) {
|
251 |
global $wpdb;
|
252 |
$extra = (!empty($form_slug)) ? " or form_slug = '$form_slug'" : '';
|
253 |
return $wpdb->get_row("SELECT * FROM " . $this->forms_table . " WHERE id='$fid' $extra");
|
98 |
$wpdb->query("ALTER TABLE `" . $this->fields_table . "` ADD `user_field` INT( 1 ) NOT NULL DEFAULT '1'");
|
99 |
if (!$this->columnExists('form_style', $this->forms_table))
|
100 |
$wpdb->query("ALTER TABLE `" . $this->forms_table . "` ADD `form_style` INT( 10 ) NOT NULL DEFAULT '0'");
|
101 |
+
if (!$this->columnExists('form_email', $this->forms_table))
|
102 |
+
$wpdb->query("ALTER TABLE `" . $this->forms_table . "` ADD `form_email` VARCHAR( 50 ) NOT NULL");
|
103 |
+
if (!$this->columnExists('form_success_message', $this->forms_table))
|
104 |
+
$wpdb->query("ALTER TABLE `" . $this->forms_table . "` ADD `form_success_message` TEXT NOT NULL");
|
105 |
+
if (!$this->columnExists('form_thank_you_page', $this->forms_table))
|
106 |
+
$wpdb->query("ALTER TABLE `" . $this->forms_table . "` ADD `form_thank_you_page` VARCHAR ( 200 ) NOT NULL");
|
107 |
if (!$this->columnExists('field_backgroundcolor', $this->styles_table))
|
108 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `field_backgroundcolor` VARCHAR( 20 ) NOT NULL DEFAULT '#efefef'");
|
109 |
if (!$this->columnExists('field_borderstyle', $this->styles_table))
|
116 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `title_margin` VARCHAR( 20 ) NOT NULL DEFAULT '2px'");
|
117 |
if (!$this->columnExists('label_margin', $this->styles_table))
|
118 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `label_margin` VARCHAR( 20 ) NOT NULL DEFAULT '3px'");
|
119 |
+
if (!$this->columnExists('textarea_backgroundcolor', $this->styles_table))
|
120 |
+
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `textarea_backgroundcolor` VARCHAR( 20 ) NOT NULL DEFAULT '#efefef'");
|
121 |
if (!$this->columnExists('field_instructions', $this->fields_table))
|
122 |
$wpdb->query("ALTER TABLE `" . $this->fields_table . "` ADD `field_instructions` TEXT NOT NULL");
|
123 |
+
if (!$this->columnExists('field_required', $this->fields_table))
|
124 |
+
$wpdb->query("ALTER TABLE `" . $this->fields_table . "` ADD `field_required` INT( 1 ) NOT NULL DEFAULT '0'");
|
125 |
+
|
126 |
}
|
127 |
|
128 |
function insertFixedFields() {
|
144 |
return (!empty($test[0]) && $test[0]->COLUMN_NAME == $column);
|
145 |
}
|
146 |
|
147 |
+
function insertForm($form) {
|
148 |
global $wpdb;
|
149 |
+
if (empty($form) or empty($form[form_slug]) or $this->formSlugExists($this->formatSlug($form[form_slug]))) return false;
|
150 |
+
$form[form_slug] = $this->formatSlug($form[form_slug]);
|
151 |
+
//foreach ($form as $key => $value)
|
152 |
+
// $form[$key] = $this->encodeOption($value);
|
153 |
+
$form = array_map(array(&$this, 'encodeOption'), $form);
|
154 |
+
$wpdb->insert($this->forms_table, $form);
|
155 |
return true;
|
156 |
}
|
157 |
|
194 |
return ($wpdb->get_var("show tables like '". $this->styles_table . "'") == $this->styles_table);
|
195 |
}
|
196 |
|
197 |
+
function updateForm($form, $fid) {
|
198 |
global $wpdb;
|
199 |
+
if (!empty($form[form_slug])) {
|
200 |
+
$test = $this->selectForm('', $this->formatSlug($form[form_slug]));
|
201 |
+
if (!empty($test) and $test->id != $fid) return false;
|
202 |
+
$form[form_slug] = $this->formatSlug($form[form_slug]);
|
203 |
+
}
|
204 |
+
$form = array_map(array(&$this, 'encodeOption'), $form);
|
205 |
+
$wpdb->update($this->forms_table, $form, array('id' => $fid));
|
206 |
return true;
|
207 |
}
|
208 |
|
209 |
+
function updateField($field, $fid) {
|
210 |
global $wpdb;
|
211 |
+
if (!empty($field[field_slug])) {
|
212 |
+
$test = $this->selectField('', $this->formatSlug($field[field_slug]));
|
213 |
+
if (!empty($test) and $test->id != $fid)
|
214 |
+
return false;
|
215 |
+
$field[field_slug] = $this->formatSlug($field[field_slug]);
|
216 |
+
}
|
217 |
+
$field = array_map(array(&$this, 'encodeOption'), $field);
|
218 |
+
$wpdb->update($this->fields_table, $field, array('id' => $fid));
|
219 |
return true;
|
220 |
}
|
221 |
|
222 |
+
function updateStyle($style, $sid) {
|
223 |
global $wpdb;
|
224 |
if (empty($style[style_slug])) return false;
|
225 |
+
$test = $this->selectStyle('', $this->formatSlug($style[style_slug]));
|
226 |
+
if (!empty($test) and $test->id != $sid) // if style_slug is different then make sure it is unique
|
227 |
return false;
|
228 |
$style[style_slug] = $this->formatSlug($style[style_slug]);
|
229 |
+
$style = array_map(array(&$this, 'encodeOption'), $style);
|
230 |
+
|
231 |
+
$wpdb->update($this->styles_table, $style, array('id' => $sid));
|
|
|
|
|
232 |
return true;
|
233 |
}
|
234 |
|
265 |
return $wpdb->get_results("SELECT * FROM " . $this->styles_table . " ORDER BY style_slug ASC");
|
266 |
}
|
267 |
|
268 |
+
function selectForm($fid, $form_slug = '') {
|
269 |
global $wpdb;
|
270 |
$extra = (!empty($form_slug)) ? " or form_slug = '$form_slug'" : '';
|
271 |
return $wpdb->get_row("SELECT * FROM " . $this->forms_table . " WHERE id='$fid' $extra");
|
custom-contact-forms.css
CHANGED
@@ -104,6 +104,17 @@ form.customcontactform-sidebar div p input[type=text], form.customcontactform-si
|
|
104 |
width:450px;
|
105 |
margin:5px 1em 1em 6px;
|
106 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
#customcontactforms-admin #contact-author form label {
|
108 |
display:block; font-weight:bold;
|
109 |
}
|
@@ -127,7 +138,7 @@ form.customcontactform-sidebar div p input[type=text], form.customcontactform-si
|
|
127 |
}
|
128 |
#customcontactforms-admin #create-styles {
|
129 |
clear:both;
|
130 |
-
height:
|
131 |
width:1000px;
|
132 |
margin:20px 1em 1em 5px;
|
133 |
}
|
@@ -226,34 +237,19 @@ form.customcontactform-sidebar div p input[type=text], form.customcontactform-si
|
|
226 |
#customcontactforms-admin #plugin-nav li.last {
|
227 |
border-right:none;
|
228 |
}
|
229 |
-
.width25 {
|
230 |
-
|
231 |
-
}
|
232 |
-
|
233 |
-
width:50px;
|
234 |
-
}
|
235 |
-
.width75 {
|
236 |
-
width:75px;
|
237 |
-
}
|
238 |
-
.width100 {
|
239 |
-
width:100px;
|
240 |
-
}
|
241 |
-
.width125 {
|
242 |
-
width:125px;
|
243 |
-
}
|
244 |
-
.width150 {
|
245 |
-
width:150px;
|
246 |
-
}
|
247 |
-
.width175 {
|
248 |
-
width:175px;
|
249 |
-
}
|
250 |
-
.width200 {
|
251 |
-
width:200px;
|
252 |
-
}
|
253 |
.red { color:#F00; }
|
254 |
.bold { font-weight:bold; }
|
255 |
.italic { font-style:italic; }
|
256 |
.hide { display:none; }
|
|
|
|
|
|
|
|
|
|
|
257 |
|
258 |
/* ----- popover box ---------- */
|
259 |
|
104 |
width:450px;
|
105 |
margin:5px 1em 1em 6px;
|
106 |
}
|
107 |
+
|
108 |
+
#customcontactforms-admin #custom-html {
|
109 |
+
float:left;
|
110 |
+
width:520px;
|
111 |
+
margin:5px 1em 1em 6px;
|
112 |
+
}
|
113 |
+
#customcontactforms-admin #custom-html p { margin: 4px 0 4px 0 ; }
|
114 |
+
#customcontactforms-admin #custom-html #custom_html_textarea {
|
115 |
+
width:495px;
|
116 |
+
height:220px;
|
117 |
+
}
|
118 |
#customcontactforms-admin #contact-author form label {
|
119 |
display:block; font-weight:bold;
|
120 |
}
|
138 |
}
|
139 |
#customcontactforms-admin #create-styles {
|
140 |
clear:both;
|
141 |
+
height:40em;
|
142 |
width:1000px;
|
143 |
margin:20px 1em 1em 5px;
|
144 |
}
|
237 |
#customcontactforms-admin #plugin-nav li.last {
|
238 |
border-right:none;
|
239 |
}
|
240 |
+
.width25 { width:25px; } .width50 { width:50px; } .width75 { width:75px; } .width100 { width:100px; }
|
241 |
+
.width125 { width:125px; } .width150 { width:150px; } .width175 { width:175px; } .width200 { width:200px; }
|
242 |
+
.width225 { width:225px; } .width250 { width:250px; } .width275 { width:275px; } .width300 { width:300px; }
|
243 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
.red { color:#F00; }
|
245 |
.bold { font-weight:bold; }
|
246 |
.italic { font-style:italic; }
|
247 |
.hide { display:none; }
|
248 |
+
.clear { clear:both; }
|
249 |
+
.textcenter { text-align:center; }
|
250 |
+
.floatleft { float:left; }
|
251 |
+
.floatright { float:right; }
|
252 |
+
.form-extra-options-table { margin:0 auto 0 auto; }
|
253 |
|
254 |
/* ----- popover box ---------- */
|
255 |
|
custom-contact-forms.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/*
|
3 |
Plugin Name: Custom Contact Forms
|
4 |
Plugin URI: http://taylorlovett.com/wordpress-plugins
|
5 |
-
Description:
|
6 |
-
Version:
|
7 |
Author: <a href="http://www.taylorlovett.com" title="Maryland Wordpress Developer">Taylor Lovett</a>
|
8 |
Author URI: http://www.taylorlovett.com
|
9 |
Contributors: Taylor Lovett
|
@@ -32,7 +32,14 @@ if (!class_exists('CustomContactForms')) {
|
|
32 |
var $form_errors;
|
33 |
var $error_return;
|
34 |
var $gets;
|
35 |
-
var $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
function CustomContactForms() {
|
38 |
parent::CustomContactFormsDB();
|
@@ -42,7 +49,7 @@ if (!class_exists('CustomContactForms')) {
|
|
42 |
function getAdminOptions() {
|
43 |
$admin_email = get_option('admin_email');
|
44 |
$customcontactAdminOptions = array('show_widget_home' => 1, 'show_widget_pages' => 1, 'show_widget_singles' => 1, 'show_widget_categories' => 1, 'show_widget_archives' => 1, 'default_to_email' => $admin_email, 'default_from_email' => $admin_email, 'default_form_subject' => 'Someone Filled Out Your Contact Form!',
|
45 |
-
'
|
46 |
$customcontactOptions = get_option($this->adminOptionsName);
|
47 |
if (!empty($customcontactOptions)) {
|
48 |
foreach ($customcontactOptions as $key => $option)
|
@@ -108,12 +115,18 @@ if (!class_exists('CustomContactForms')) {
|
|
108 |
echo $before_widget . $this->getFormCode($option[widget_form_id], true) . $after_widget;
|
109 |
}
|
110 |
function addHeaderCode() {
|
111 |
-
|
112 |
?>
|
113 |
-
<!-- Custom Contact Forms by Taylor Lovett - http://www.taylorlovett.com -->
|
114 |
-
<link rel="stylesheet" href="<?php echo get_option('siteurl'); ?>/wp-content/plugins/custom-contact-forms/custom-contact-forms.css" type="text/css" media="screen" />
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
//wp_enqueue_script('jquery-ui-position', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.ui.position.js');
|
118 |
//wp_enqueue_script('jquery-ui-widget', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.ui.widget.js');
|
119 |
//wp_enqueue_script('jquery-bgiframe', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.bgiframe-2.1.1.js');
|
@@ -142,7 +155,7 @@ if (!class_exists('CustomContactForms')) {
|
|
142 |
function printAdminPage() {
|
143 |
$admin_options = $this->getAdminOptions();
|
144 |
if ($_POST[form_create]) {
|
145 |
-
parent::insertForm($_POST[
|
146 |
} elseif ($_POST[field_create]) {
|
147 |
parent::insertField($_POST[field]);
|
148 |
} elseif ($_POST[general_settings]) {
|
@@ -162,13 +175,13 @@ if (!class_exists('CustomContactForms')) {
|
|
162 |
$admin_options[remember_field_values] = $_POST[remember_field_values];
|
163 |
update_option($this->adminOptionsName, $admin_options);
|
164 |
} elseif ($_POST[field_edit]) {
|
165 |
-
parent::updateField($_POST[
|
166 |
} elseif ($_POST[field_delete]) {
|
167 |
parent::deleteField($_POST[fid]);
|
168 |
} elseif ($_POST[form_delete]) {
|
169 |
parent::deleteForm($_POST[fid]);
|
170 |
} elseif ($_POST[form_edit]) {
|
171 |
-
parent::updateForm($_POST[
|
172 |
} elseif ($_POST[form_add_field]) {
|
173 |
parent::addFieldToForm($_POST[field_id], $_POST[fid]);
|
174 |
} elseif ($_POST[disattach_field]) {
|
@@ -176,9 +189,9 @@ if (!class_exists('CustomContactForms')) {
|
|
176 |
} elseif ($_POST[style_create]) {
|
177 |
parent::insertStyle($_POST[style]);
|
178 |
} elseif ($_POST[style_edit]) {
|
179 |
-
parent::updateStyle($_POST[style]);
|
180 |
} elseif ($_POST[style_delete]) {
|
181 |
-
parent::deleteStyle($_POST[
|
182 |
} elseif ($_POST[contact_author]) {
|
183 |
$this_url = (!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : $_SERVER['SERVER_NAME'];
|
184 |
$this->contactAuthor($_POST[name], $_POST[email], $this_url, $_POST[message], $_POST[type]);
|
@@ -203,6 +216,7 @@ if (!class_exists('CustomContactForms')) {
|
|
203 |
<li><a href="#manage-styles">Manage Styles</a></li>
|
204 |
<li><a href="#contact-author">Suggest a Feature</a></li>
|
205 |
<li><a href="#contact-author">Bug Report</a></li>
|
|
|
206 |
<li class="last"><a href="#plugin-news">Plugin News</a></li>
|
207 |
</ul><a name="create-fields"></a>
|
208 |
<div id="create-fields" class="postbox">
|
@@ -235,6 +249,9 @@ if (!class_exists('CustomContactForms')) {
|
|
235 |
<label for="field_maxlength">Max Length:</label>
|
236 |
<input class="width50" size="10" name="field[field_maxlength]" type="text" maxlength="4" />
|
237 |
(0 for no limit; only applies to Text fields)</li>
|
|
|
|
|
|
|
238 |
<li>
|
239 |
<label for="field_value">Field Instructions:</label>
|
240 |
<input name="field[field_instructions]" type="text" /><br />
|
@@ -253,36 +270,48 @@ if (!class_exists('CustomContactForms')) {
|
|
253 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
254 |
<ul>
|
255 |
<li>
|
256 |
-
<label for="form_name">Form Slug:</label>
|
257 |
-
<input type="text" maxlength="100" name="form_slug" />
|
258 |
-
(Must be unique)</li>
|
259 |
<li>
|
260 |
-
<label for="form_title">Form Title:</label>
|
261 |
-
<input type="text" maxlength="200" name="form_title" />
|
262 |
(The form header text)</li>
|
263 |
<li>
|
264 |
-
<label for="form_method">Form Method:</label>
|
265 |
-
<select name="form_method">
|
266 |
<option>Post</option>
|
267 |
<option>Get</option>
|
268 |
</select>
|
269 |
(If unsure, leave as is.)</li>
|
270 |
<li>
|
271 |
-
<label for="form_action">Form Action:</label>
|
272 |
-
<input type="text" name="form_action" value="" />
|
273 |
(If unsure, leave blank.)</li>
|
274 |
<li>
|
275 |
-
<label for="form_action">Form Style:</label>
|
276 |
-
<select name="form_style"><?php echo $style_options; ?></select>
|
277 |
(<a href="#create-styles">Click to create a style</a>)</li>
|
278 |
<li>
|
279 |
-
<label for="submit_button_text">Submit Button Text:</label>
|
280 |
-
<input type="text" maxlength="200" name="submit_button_text" />
|
281 |
</li>
|
282 |
<li>
|
283 |
-
<label for="custom_code">Custom Code:</label>
|
284 |
-
<input type="text" name="custom_code" />
|
285 |
-
(If unsure, leave blank.)</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
<li>
|
287 |
<input type="submit" value="Create Form" name="form_create" />
|
288 |
</li>
|
@@ -298,6 +327,7 @@ if (!class_exists('CustomContactForms')) {
|
|
298 |
<th scope="col" class="manage-column field-label">Label</th>
|
299 |
<th scope="col" class="manage-column field-type">Type</th>
|
300 |
<th scope="col" class="manage-column field-value">Initial Value</th>
|
|
|
301 |
<th scope="col" class="manage-column field-maxlength">Maxlength</th>
|
302 |
<th scope="col" class="manage-column field-action">Action</th>
|
303 |
</tr>
|
@@ -314,20 +344,22 @@ if (!class_exists('CustomContactForms')) {
|
|
314 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
315 |
<tr<?php if ($z % 2 == 1) echo ' class="evenrow"'; ?>>
|
316 |
|
317 |
-
<td><input type="text" name="field_slug" maxlength="50" value="<?php echo $fields[$i]->field_slug; ?>" /></td>
|
318 |
-
<td><input type="text" name="field_label" maxlength="100" value="<?php echo $fields[$i]->field_label; ?>" /></td>
|
319 |
-
<td><select name="field_type">
|
320 |
<?php echo $field_types; ?>
|
321 |
</select></td>
|
322 |
-
<td><input type="text" name="field_value" maxlength="50" value="<?php echo $fields[$i]->field_value; ?>" /></td>
|
323 |
-
<td><
|
|
|
324 |
<td><input type="hidden" name="fid" value="<?php echo $fields[$i]->id; ?>" />
|
|
|
325 |
<input type="submit" name="field_edit" value="Edit" />
|
326 |
<input type="submit" name="field_delete" value="Delete" /></td>
|
327 |
|
328 |
</tr>
|
329 |
<tr<?php if ($z % 2 == 1) echo ' class="evenrow"'; ?>>
|
330 |
-
<td colspan="
|
331 |
</tr>
|
332 |
</form>
|
333 |
<?php
|
@@ -340,6 +372,7 @@ if (!class_exists('CustomContactForms')) {
|
|
340 |
<th scope="col" class="manage-column field-label">Label</th>
|
341 |
<th scope="col" class="manage-column field-type">Type</th>
|
342 |
<th scope="col" class="manage-column field-value">Initial Value</th>
|
|
|
343 |
<th scope="col" class="manage-column field-maxlength">Maxlength</th>
|
344 |
<th scope="col" class="manage-column field-action">Action</th>
|
345 |
</tr>
|
@@ -353,6 +386,7 @@ if (!class_exists('CustomContactForms')) {
|
|
353 |
<th scope="col" class="manage-column field-label">Label</th>
|
354 |
<th scope="col" class="manage-column field-type">Type</th>
|
355 |
<th scope="col" class="manage-column field-value">Initial Value</th>
|
|
|
356 |
<th scope="col" class="manage-column field-maxlength">Maxlength</th>
|
357 |
<th scope="col" class="manage-column field-action">Action</th>
|
358 |
</tr>
|
@@ -367,33 +401,38 @@ if (!class_exists('CustomContactForms')) {
|
|
367 |
|
368 |
?>
|
369 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
370 |
-
<tr <?php if ($z % 2 == 0) echo ' class="evenrow"';
|
371 |
|
372 |
-
<td><?php echo $fields[$i]->field_slug;
|
373 |
-
|
374 |
-
<td><input type="text" name="field_label" maxlength="100" value="<?php echo $fields[$i]->field_label; ?>" /></td>
|
375 |
<td><?php echo $fields[$i]->field_type; ?>
|
376 |
-
<
|
377 |
-
|
378 |
-
<input type="text" name="field_value" maxlength="50" value="<?php echo $fields[$i]->field_value; ?>" />
|
379 |
<?php } else {
|
380 |
echo $fields[$i]->field_value;
|
381 |
?>
|
382 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
<?php } ?>
|
384 |
</td>
|
385 |
<td><?php if ($fields[$i]->field_type != 'Checkbox') { ?>
|
386 |
-
<input type="text" class="width50" name="field_maxlength" value="<?php echo $fields[$i]->field_maxlength; ?>" />
|
387 |
<?php } else { ?>
|
388 |
-
None
|
389 |
<?php } ?>
|
390 |
</td>
|
391 |
|
392 |
<td><input type="hidden" name="fid" value="<?php echo $fields[$i]->id; ?>" />
|
|
|
393 |
<input type="submit" name="field_edit" value="Edit" /></td>
|
394 |
</tr>
|
395 |
-
<tr <?php if ($z % 2 == 0) echo ' class="evenrow"';
|
396 |
-
<td colspan="
|
397 |
</tr>
|
398 |
</form>
|
399 |
<?php
|
@@ -406,6 +445,7 @@ if (!class_exists('CustomContactForms')) {
|
|
406 |
<th scope="col" class="manage-column field-label">Label</th>
|
407 |
<th scope="col" class="manage-column field-type">Type</th>
|
408 |
<th scope="col" class="manage-column field-value">Initial Value</th>
|
|
|
409 |
<th scope="col" class="manage-column field-maxlength">Maxlength</th>
|
410 |
<th scope="col" class="manage-column field-action">Action</th>
|
411 |
</tr>
|
@@ -415,13 +455,12 @@ if (!class_exists('CustomContactForms')) {
|
|
415 |
<table class="widefat post" id="manage-forms" cellspacing="0">
|
416 |
<thead>
|
417 |
<tr>
|
|
|
418 |
<th scope="col" class="manage-column form-slug">Slug</th>
|
419 |
<th scope="col" class="manage-column form-title">Title</th>
|
420 |
-
<th scope="col" class="manage-column form-method">Method</th>
|
421 |
-
<th scope="col" class="manage-column form-action">Form Action</th>
|
422 |
<th scope="col" class="manage-column form-submit">Button Text</th>
|
423 |
-
<th scope="col" class="manage-column form-submit">Custom Code</th>
|
424 |
<th scope="col" class="manage-column form-submit">Style</th>
|
|
|
425 |
</tr>
|
426 |
</thead>
|
427 |
<tbody>
|
@@ -436,56 +475,68 @@ if (!class_exists('CustomContactForms')) {
|
|
436 |
?>
|
437 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
438 |
<tr class="<?php if ($i % 2 == 0) echo 'evenrow'; ?>">
|
439 |
-
|
440 |
-
<td><input type="text" class="
|
441 |
-
<td><
|
442 |
-
|
443 |
-
|
444 |
-
<td><input
|
445 |
-
|
446 |
-
|
447 |
-
|
|
|
448 |
</tr>
|
449 |
<tr class="<?php if ($i % 2 == 0) echo 'evenrow'; ?>">
|
450 |
-
<td colspan="8" style="border-bottom:1px solid black;"
|
451 |
-
<
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
</tr>
|
|
|
489 |
</form>
|
490 |
<?php
|
491 |
}
|
@@ -499,13 +550,12 @@ if (!class_exists('CustomContactForms')) {
|
|
499 |
<tfoot>
|
500 |
<tr>
|
501 |
<tr>
|
|
|
502 |
<th scope="col" class="manage-column form-slug">Slug</th>
|
503 |
<th scope="col" class="manage-column form-title">Title</th>
|
504 |
-
<th scope="col" class="manage-column form-method">Method</th>
|
505 |
-
<th scope="col" class="manage-column form-action">Form Action</th>
|
506 |
<th scope="col" class="manage-column form-submit">Button Text</th>
|
507 |
-
<th scope="col" class="manage-column form-submit">Custom Code</th>
|
508 |
<th scope="col" class="manage-column form-submit">Style</th>
|
|
|
509 |
</tr>
|
510 |
</tr>
|
511 |
|
@@ -520,27 +570,22 @@ if (!class_exists('CustomContactForms')) {
|
|
520 |
<label for="default_to_email">Default Email:</label>
|
521 |
<input name="default_to_email" value="<?php echo $admin_options[default_to_email]; ?>" type="text" maxlength="100" />
|
522 |
</li>
|
523 |
-
<li class="descrip">Form emails will be sent <span>to</span> this address.</li>
|
524 |
<li>
|
525 |
<label for="default_from_email">Default From Email:</label>
|
526 |
<input name="default_from_email" value="<?php echo $admin_options[default_from_email]; ?>" type="text" maxlength="100" />
|
527 |
</li>
|
528 |
-
<li class="descrip">Form emails will be sent <span>from</span> this address.</li>
|
529 |
<li>
|
530 |
<label for="default_form_subject">Default Email Subject:</label>
|
531 |
<input name="default_form_subject" value="<?php echo $admin_options[default_form_subject]; ?>" type="text" />
|
532 |
</li>
|
533 |
<li class="descrip">Default subject to be included in all form emails.</li>
|
534 |
<li>
|
535 |
-
<label for="
|
536 |
-
<input name="custom_thank_you" value="<?php echo $admin_options[custom_thank_you]; ?>" type="text" maxlength="150" />
|
537 |
-
</li>
|
538 |
-
<li class="descrip">Upon filling out forms, users will be sent back to the form page if this is left blank.</li>
|
539 |
-
<li>
|
540 |
-
<label for="form_success_message">Thank You Message:</label>
|
541 |
<input name="form_success_message" value="<?php echo $admin_options[form_success_message]; ?>" type="text"/>
|
542 |
</li>
|
543 |
-
<li class="descrip">If a
|
544 |
|
545 |
<li>
|
546 |
<label for="remember_field_values">Remember Field Values:</label>
|
@@ -599,11 +644,12 @@ if (!class_exists('CustomContactForms')) {
|
|
599 |
<div class="inside">
|
600 |
<p>1. Create a form.</p>
|
601 |
<p>2. Create fields and attach those fields to the forms of your choice. <b>* Attach the fields in the order that you want them to show up in the form. If you mess up you can detach and reattach them.</b></p>
|
602 |
-
<p>3. Display those forms in posts and pages by inserting the code: [customcontact form=<b>FORMID</b>]. Replace <b>FORMID</b> with the id listed to the left of the form slug next to the form of your choice above.</p>
|
603 |
<p>4. Prevent spam by attaching the fixed field, captcha or ishuman. Captcha requires users to type in a number shown on an image. Ishuman requires users to check a box to prove they aren't a spam bot.</p>
|
604 |
<p>5. Add a form to your sidebar, by dragging the Custom Contact Form widget in to your sidebar.</p>
|
605 |
<p>6. Configure the General Settings appropriately; this is important if you want to receive your web form messages!</p>
|
606 |
<p>7. Create form styles to change your forms appearances. The image below explains how each style field can change the look of your forms.</p>
|
|
|
607 |
<div id="style-example"></div>
|
608 |
</div>
|
609 |
</div>
|
@@ -723,6 +769,10 @@ if (!class_exists('CustomContactForms')) {
|
|
723 |
<label for="title_margin">Title Margin:</label>
|
724 |
<input type="text" maxlength="20" value="2px" name="style[title_margin]" />
|
725 |
(ex: 5px or 1em)</li>
|
|
|
|
|
|
|
|
|
726 |
<li>
|
727 |
<input type="submit" value="Create Style" name="style_create" />
|
728 |
</li>
|
@@ -752,6 +802,7 @@ if (!class_exists('CustomContactForms')) {
|
|
752 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
753 |
<td><label>Slug:</label> <input type="text" maxlength="30" value="<?php echo $style->style_slug; ?>" name="style[style_slug]" /><br />
|
754 |
<label>Font Family:</label><input type="text" maxlength="20" value="<?php echo $style->form_fontfamily; ?>" name="style[form_fontfamily]" /><br />
|
|
|
755 |
<input type="submit" class="submit-styles" name="style_edit" value="Update Style" /><br />
|
756 |
<input type="submit" class="submit-styles" name="style_delete" value="Delete Style" />
|
757 |
</td>
|
@@ -792,7 +843,7 @@ if (!class_exists('CustomContactForms')) {
|
|
792 |
<label>Form Border Color:</label><input type="text" maxlength="20" value="<?php echo $style->form_bordercolor; ?>" name="style[form_bordercolor]" /><br />
|
793 |
<label>Field Border Color:</label><input type="text" maxlength="20" value="<?php echo $style->field_bordercolor; ?>" name="style[field_bordercolor]" />
|
794 |
<label>Field Border Style:</label><select name="style[field_borderstyle]"><?php echo str_replace('<option>'.$style->field_borderstyle.'</option>', '<option selected="selected">'.$style->field_borderstyle.'</option>', $border_style_options); ?></select>
|
795 |
-
<input name="
|
796 |
</td>
|
797 |
|
798 |
</form>
|
@@ -836,6 +887,30 @@ if (!class_exists('CustomContactForms')) {
|
|
836 |
</form>
|
837 |
</div>
|
838 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
839 |
</div>
|
840 |
<?php
|
841 |
}
|
@@ -848,7 +923,8 @@ if (!class_exists('CustomContactForms')) {
|
|
848 |
foreach ($errors as $error) {
|
849 |
$out .= '<li>'.$error.'</li>' . "\n";
|
850 |
}
|
851 |
-
|
|
|
852 |
}
|
853 |
$matches = array();
|
854 |
preg_match_all('/\[customcontact form=([0-9]+)\]/si', $content, $matches);
|
@@ -922,66 +998,95 @@ if (!class_exists('CustomContactForms')) {
|
|
922 |
return $str;
|
923 |
}
|
924 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
925 |
function getFormCode($fid, $is_sidebar = false, $popover = false) {
|
926 |
$admin_options = $this->getAdminOptions();
|
927 |
$form = parent::selectForm($fid, '');
|
|
|
928 |
$out = '';
|
929 |
-
$
|
930 |
-
$
|
|
|
931 |
if ($form->form_style != 0) {
|
932 |
$style = parent::selectStyle($form->form_style, '');
|
933 |
-
$
|
934 |
-
$out .= '<style type="text/css">' . "\n";
|
935 |
-
$out .= '.' . $style->style_slug . " { width: ".$style->form_width."; padding:".$style->form_padding."; margin:".$style->form_margin."; border:".$style->form_borderwidth." ".$style->form_borderstyle." ".$style->form_bordercolor."; font-family:".$style->form_fontfamily."; }\n";
|
936 |
-
$out .= '.' . $style->style_slug . " div { padding:0; margin:0; }\n";
|
937 |
-
$out .= '.' . $style->style_slug . " h4 { padding:0; margin:".$style->title_margin." ".$style->title_margin." ".$style->title_margin." 0; color:".$style->title_fontcolor."; font-size:".$style->title_fontsize."; } \n";
|
938 |
-
$out .= '.' . $style->style_slug . " label { padding:0; margin:".$style->label_margin." ".$style->label_margin." ".$style->label_margin." 0; display:block; color:".$style->label_fontcolor."; width:".$style->label_width."; font-size:".$style->label_fontsize."; } \n";
|
939 |
-
$out .= '.' . $style->style_slug . " label.checkbox { display:inline; }; \n";
|
940 |
-
$out .= '.' . $style->style_slug . " input[type=text] { color:".$style->field_fontcolor."; margin:0; width:".$style->input_width."; font-size:".$style->field_fontsize."; background-color:".$style->field_backgroundcolor."; border:1px ".$style->field_borderstyle." ".$style->field_bordercolor."; } \n";
|
941 |
-
$out .= '.' . $style->style_slug . " .submit { color:".$style->submit_fontcolor."; width:".$style->submit_width."; height:".$style->submit_height."; font-size:".$style->submit_fontsize."; } \n";
|
942 |
-
$out .= '.' . $style->style_slug . " textarea { color:".$style->field_fontcolor."; width:".$style->textarea_width."; margin:0; height:".$style->textarea_height."; font-size:".$style->field_fontsize."; border:1px ".$style->field_borderstyle." ".$style->field_bordercolor."; } \n";
|
943 |
-
$out .= '</style>' . "\n";
|
944 |
-
|
945 |
}
|
946 |
$action = (!empty($form->form_action)) ? $form->form_action : get_permalink();
|
947 |
-
$out .= '<form method="'.strtolower($form->form_method).'" action="'.$action.'"'.$
|
948 |
-
$out .= parent::decodeOption($form->custom_code, 1, 1) . '<h4>' . parent::decodeOption($form->form_title, 1, 1) . '</h4>' . "\n" . '<div>';
|
949 |
$fields = parent::getAttachedFieldsArray($fid);
|
950 |
$hiddens = '';
|
951 |
foreach ($fields as $field_id) {
|
952 |
$field = parent::selectField($field_id, '');
|
|
|
|
|
953 |
$input_id = 'id="'.parent::decodeOption($field->field_slug, 1, 1).'"';
|
954 |
$field_value = parent::decodeOption($field->field_value, 1, 1);
|
955 |
-
$instructions = (empty($field->field_instructions)) ? '' : 'title="'
|
956 |
if ($admin_options[enable_widget_tooltips] == 0 && $is_sidebar) $instructions = '';
|
957 |
if ($_SESSION[fields][$field->field_slug]) {
|
958 |
if ($admin_options[remember_field_values] == 1)
|
959 |
$field_value = $_SESSION[fields][$field->field_slug];
|
960 |
}
|
|
|
961 |
if ($field->user_field == 0 && $field->field_slug == 'captcha') {
|
962 |
$out .= '<p>' . $this->getCaptchaCode($form->id) . '</p>';
|
963 |
} elseif ($field->field_type == 'Text') {
|
964 |
$maxlength = (empty($field->field_maxlength) or $field->field_maxlength <= 0) ? '' : ' maxlength="'.$field->field_maxlength.'"';
|
965 |
-
$out .= '<p><label for="'.parent::decodeOption($field->field_slug, 1, 1).'">'.parent::decodeOption($field->field_label, 1, 1).'</label><input '.$instructions.' '.$input_id.' type="text" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.$field_value.'"'.$maxlength.' /></p>' . "\n";
|
966 |
} elseif ($field->field_type == 'Hidden') {
|
967 |
$hiddens .= '<p><input type="hidden" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.$field_value.'" '.$input_id.' /></p>' . "\n";
|
968 |
} elseif ($field->field_type == 'Checkbox') {
|
969 |
-
$out .= '<p><input '.$instructions.' type="checkbox" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.parent::decodeOption($field->field_value, 1, 1).'" '.$input_id.' /> <label class="checkbox" for="'.parent::decodeOption($field->field_slug, 1, 1).'">'.parent::decodeOption($field->field_label, 1, 1).'</label></p>' . "\n";
|
970 |
} elseif ($field->field_type == 'Textarea') {
|
971 |
-
$out .= '<p><label for="'.parent::decodeOption($field->field_slug, 1, 1).'">'.parent::decodeOption($field->field_label, 1, 1).'</label><textarea '.$instructions.' '.$input_id.' rows="5" cols="40" name="'.parent::decodeOption($field->field_slug, 1, 1).'">'.$field_value.'</textarea></p>' . "\n";
|
972 |
}
|
973 |
}
|
974 |
$submit_text = (!empty($form->submit_button_text)) ? parent::decodeOption($form->submit_button_text, 1, 0) : 'Submit';
|
975 |
-
$out .= '</div>'."\n".'<p><input name="form_page" value="'.$_SERVER['REQUEST_URI'].'" type="hidden" /><input type="hidden" name="fid" value="'.$form->id.'" />'."\n".$hiddens."\n".'<input type="submit" class="submit" value="' . $submit_text . '" name="customcontactforms_submit" /></p>' . "\n" . '</form>';
|
976 |
if ($admin_options[author_link] == 1) $out .= '<a class="hide" href="http://www.taylorlovett.com" title="Rockville Web Developer, Wordpress Plugins">Wordpress plugin expert and Rockville Web Developer Taylor Lovett</a>';
|
977 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
978 |
}
|
979 |
|
980 |
function getCaptchaCode($form_id) {
|
981 |
$captcha = parent::selectField('', 'captcha');
|
982 |
$instructions = (empty($captcha->field_instructions)) ? '' : 'title="'.$captcha->field_instructions.'" class="tooltip-field"';
|
983 |
$out = '<img id="captcha-image" src="' . get_bloginfo('wpurl') . '/wp-content/plugins/custom-contact-forms/image.php?fid='.$form_id.'" />
|
984 |
-
<br /><label for="captcha'.$form_id.'"
|
985 |
return $out;
|
986 |
}
|
987 |
|
@@ -1002,23 +1107,56 @@ if (!class_exists('CustomContactForms')) {
|
|
1002 |
}
|
1003 |
|
1004 |
function insertFormSuccessCode() {
|
1005 |
-
$admin_options = $this->getAdminOptions();
|
1006 |
?>
|
1007 |
<div id="ccf-form-success">
|
1008 |
<h5>Successful Form Submission</h5>
|
1009 |
-
<p><?php echo $
|
1010 |
<a href="javascript:void(0)" class="close">[close]</a>
|
1011 |
</div>
|
1012 |
|
1013 |
<?php
|
1014 |
}
|
1015 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1016 |
function processForms() {
|
1017 |
-
if ($_POST[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1018 |
$this->startSession();
|
1019 |
$this->error_return = $_POST[form_page];
|
1020 |
$admin_options = $this->getAdminOptions();
|
1021 |
$fields = parent::getAttachedFieldsArray($_POST[fid]);
|
|
|
1022 |
$checks = array();
|
1023 |
$cap_name = 'captcha_' . $_POST[fid];
|
1024 |
foreach ($fields as $field_id) {
|
@@ -1029,16 +1167,19 @@ if (!class_exists('CustomContactForms')) {
|
|
1029 |
} elseif ($field->field_slug == 'captcha') {
|
1030 |
if ($_POST[captcha] != $_SESSION[$cap_name])
|
1031 |
$this->setFormError('captcha', 'You entered the captcha image code incorrectly');
|
|
|
|
|
1032 |
} else {
|
1033 |
-
if ($field->
|
1034 |
-
$
|
1035 |
-
}
|
|
|
1036 |
}
|
1037 |
$body = '';
|
1038 |
foreach ($_POST as $key => $value) {
|
1039 |
$_SESSION[fields][$key] = $value;
|
1040 |
$field = parent::selectField('', $key);
|
1041 |
-
if (!
|
1042 |
$body .= $field->field_label . ': ' . $value . "\n";
|
1043 |
if (in_array($key, $checks)) {
|
1044 |
$checks_key = array_search($key, $checks);
|
@@ -1053,11 +1194,13 @@ if (!class_exists('CustomContactForms')) {
|
|
1053 |
unset($_SESSION['captcha_' . $_POST[fid]]);
|
1054 |
unset($_SESSION[fields]);
|
1055 |
$body .= 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "\n";
|
1056 |
-
$
|
|
|
1057 |
$mailer->send();
|
1058 |
-
if (!empty($
|
1059 |
-
header("Location: " . $
|
1060 |
}
|
|
|
1061 |
add_action('wp_footer', array(&$this, 'insertFormSuccessCode'), 1);
|
1062 |
}
|
1063 |
unset($_POST);
|
@@ -1075,11 +1218,21 @@ if (!function_exists('CustomContactForms_ap')) {
|
|
1075 |
}
|
1076 |
}
|
1077 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1078 |
if (isset($customcontact)) {
|
1079 |
add_action('init', array(&$customcontact, 'init'), 1);
|
1080 |
add_action('wp_head', array(&$customcontact, 'addHeaderCode'), 1);
|
|
|
1081 |
add_action('admin_head', array(&$customcontact, 'addHeaderCode'), 1);
|
1082 |
add_filter('the_content', array(&$customcontact, 'contentFilter'));
|
|
|
1083 |
//add_action('wp_footer', array(&$customcontact, 'insertPopoverCode'));
|
1084 |
}
|
1085 |
add_action('admin_menu', 'CustomContactForms_ap');
|
2 |
/*
|
3 |
Plugin Name: Custom Contact Forms
|
4 |
Plugin URI: http://taylorlovett.com/wordpress-plugins
|
5 |
+
Description: Guaranteed to be 1000X more customizable and intuitive than Fast Secure Contact Forms or Contact Form 7. Customize every aspect of your forms without any knowledge of CSS: borders, padding, sizes, colors. Ton's of great features. Required fields, captchas, tooltip popovers, unlimited fields/forms/form styles, use a custom thank you page or built-in popover with a custom success message set for each form. <a href="options-general.php?page=custom-contact-forms">Settings</a>
|
6 |
+
Version: 3.0.0
|
7 |
Author: <a href="http://www.taylorlovett.com" title="Maryland Wordpress Developer">Taylor Lovett</a>
|
8 |
Author URI: http://www.taylorlovett.com
|
9 |
Contributors: Taylor Lovett
|
32 |
var $form_errors;
|
33 |
var $error_return;
|
34 |
var $gets;
|
35 |
+
var $current_thank_you_message;
|
36 |
+
var $fixed_fields = array('customcontactforms_submit' => '',
|
37 |
+
'fid' => '',
|
38 |
+
'fixedEmail' => 'Use this field if you want the plugin to throw an error on fake emails.',
|
39 |
+
'form_page' => '',
|
40 |
+
'captcha' => 'This field requires users to type numbers in an image preventing spam.',
|
41 |
+
'ishuman' => 'This field requires users to check a box to prove they aren\'t a spam bot.'
|
42 |
+
);
|
43 |
|
44 |
function CustomContactForms() {
|
45 |
parent::CustomContactFormsDB();
|
49 |
function getAdminOptions() {
|
50 |
$admin_email = get_option('admin_email');
|
51 |
$customcontactAdminOptions = array('show_widget_home' => 1, 'show_widget_pages' => 1, 'show_widget_singles' => 1, 'show_widget_categories' => 1, 'show_widget_archives' => 1, 'default_to_email' => $admin_email, 'default_from_email' => $admin_email, 'default_form_subject' => 'Someone Filled Out Your Contact Form!',
|
52 |
+
'remember_field_values' => 0, 'author_link' => 1, 'enable_widget_tooltips' => 1, 'wp_mail_function' => 1, 'form_success_message' => 'Thank you for filling out our web form. We will get back to you ASAP.'); // default general settings
|
53 |
$customcontactOptions = get_option($this->adminOptionsName);
|
54 |
if (!empty($customcontactOptions)) {
|
55 |
foreach ($customcontactOptions as $key => $option)
|
115 |
echo $before_widget . $this->getFormCode($option[widget_form_id], true) . $after_widget;
|
116 |
}
|
117 |
function addHeaderCode() {
|
|
|
118 |
?>
|
119 |
+
<!-- Custom Contact Forms by Taylor Lovett - http://www.taylorlovett.com -->
|
120 |
+
<link rel="stylesheet" href="<?php echo get_option('siteurl'); ?>/wp-content/plugins/custom-contact-forms/custom-contact-forms.css" type="text/css" media="screen" />
|
121 |
+
<?php
|
122 |
+
}
|
123 |
+
|
124 |
+
function insertAdminScripts() {
|
125 |
+
wp_enqueue_script('ccf-main', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/custom-contact-forms-admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-tabs'/*, 'jquery-ui-draggable', 'jquery-ui-resizable', 'jquery-ui-dialog'*/), '1.0');
|
126 |
+
}
|
127 |
+
|
128 |
+
function insertFrontEndScripts() {
|
129 |
+
wp_enqueue_script('jquery-tools', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.tools.min.js');
|
130 |
//wp_enqueue_script('jquery-ui-position', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.ui.position.js');
|
131 |
//wp_enqueue_script('jquery-ui-widget', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.ui.widget.js');
|
132 |
//wp_enqueue_script('jquery-bgiframe', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.bgiframe-2.1.1.js');
|
155 |
function printAdminPage() {
|
156 |
$admin_options = $this->getAdminOptions();
|
157 |
if ($_POST[form_create]) {
|
158 |
+
parent::insertForm($_POST[form]);
|
159 |
} elseif ($_POST[field_create]) {
|
160 |
parent::insertField($_POST[field]);
|
161 |
} elseif ($_POST[general_settings]) {
|
175 |
$admin_options[remember_field_values] = $_POST[remember_field_values];
|
176 |
update_option($this->adminOptionsName, $admin_options);
|
177 |
} elseif ($_POST[field_edit]) {
|
178 |
+
parent::updateField($_POST[field], $_POST[fid]);
|
179 |
} elseif ($_POST[field_delete]) {
|
180 |
parent::deleteField($_POST[fid]);
|
181 |
} elseif ($_POST[form_delete]) {
|
182 |
parent::deleteForm($_POST[fid]);
|
183 |
} elseif ($_POST[form_edit]) {
|
184 |
+
parent::updateForm($_POST[form], $_POST[fid]);
|
185 |
} elseif ($_POST[form_add_field]) {
|
186 |
parent::addFieldToForm($_POST[field_id], $_POST[fid]);
|
187 |
} elseif ($_POST[disattach_field]) {
|
189 |
} elseif ($_POST[style_create]) {
|
190 |
parent::insertStyle($_POST[style]);
|
191 |
} elseif ($_POST[style_edit]) {
|
192 |
+
parent::updateStyle($_POST[style], $_POST[sid]);
|
193 |
} elseif ($_POST[style_delete]) {
|
194 |
+
parent::deleteStyle($_POST[sid]);
|
195 |
} elseif ($_POST[contact_author]) {
|
196 |
$this_url = (!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : $_SERVER['SERVER_NAME'];
|
197 |
$this->contactAuthor($_POST[name], $_POST[email], $this_url, $_POST[message], $_POST[type]);
|
216 |
<li><a href="#manage-styles">Manage Styles</a></li>
|
217 |
<li><a href="#contact-author">Suggest a Feature</a></li>
|
218 |
<li><a href="#contact-author">Bug Report</a></li>
|
219 |
+
<li><a href="#custom-html">Custom HTML Forms (New!)</a></li>
|
220 |
<li class="last"><a href="#plugin-news">Plugin News</a></li>
|
221 |
</ul><a name="create-fields"></a>
|
222 |
<div id="create-fields" class="postbox">
|
249 |
<label for="field_maxlength">Max Length:</label>
|
250 |
<input class="width50" size="10" name="field[field_maxlength]" type="text" maxlength="4" />
|
251 |
(0 for no limit; only applies to Text fields)</li>
|
252 |
+
<li>
|
253 |
+
<label for="field_required">Required Field:</label>
|
254 |
+
<select name="field[field_required]"><option value="0">No</option><option value="1">Yes</option></select></li>
|
255 |
<li>
|
256 |
<label for="field_value">Field Instructions:</label>
|
257 |
<input name="field[field_instructions]" type="text" /><br />
|
270 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
271 |
<ul>
|
272 |
<li>
|
273 |
+
<label for="form[form_name]">Form Slug:</label>
|
274 |
+
<input type="text" maxlength="100" name="form[form_slug]" /><br />
|
275 |
+
(Must be unique and contain only underscores and alphanumeric characters.)</li>
|
276 |
<li>
|
277 |
+
<label for="form[form_title]">Form Title:</label>
|
278 |
+
<input type="text" maxlength="200" name="form[form_title]" />
|
279 |
(The form header text)</li>
|
280 |
<li>
|
281 |
+
<label for="form[form_method]">Form Method:</label>
|
282 |
+
<select name="form[form_method]">
|
283 |
<option>Post</option>
|
284 |
<option>Get</option>
|
285 |
</select>
|
286 |
(If unsure, leave as is.)</li>
|
287 |
<li>
|
288 |
+
<label for="form[form_action]">Form Action:</label>
|
289 |
+
<input type="text" name="form[form_action]" value="" />
|
290 |
(If unsure, leave blank.)</li>
|
291 |
<li>
|
292 |
+
<label for="form[form_action]">Form Style:</label>
|
293 |
+
<select name="form[form_style]"><?php echo $style_options; ?></select>
|
294 |
(<a href="#create-styles">Click to create a style</a>)</li>
|
295 |
<li>
|
296 |
+
<label for="form[submit_button_text]">Submit Button Text:</label>
|
297 |
+
<input type="text" maxlength="200" name="form[submit_button_text]" />
|
298 |
</li>
|
299 |
<li>
|
300 |
+
<label for="form[custom_code]">Custom Code:</label>
|
301 |
+
<input type="text" name="form[custom_code]" /><br />
|
302 |
+
(If unsure, leave blank. This field allows you to insert custom HTML directly after the starting form tag.)</li>
|
303 |
+
<li>
|
304 |
+
<label for="form[form_email]">Form Destination Email:</label>
|
305 |
+
<input type="text" name="form[form_email]" /><br />
|
306 |
+
(Will receive all submissions from this form; if left blank it will use the default specified in general settings.)</li>
|
307 |
+
<li>
|
308 |
+
<label for="form[form_success_message]">Form Success Message:</label>
|
309 |
+
<input type="text" name="form[form_success_message]" /><br />
|
310 |
+
(Will be displayed in a popover when the form is filled out successfully when no custom success page is specified; if left blank it will use the default specified in general settings.)</li>
|
311 |
+
<li>
|
312 |
+
<label for="form[form_thank_you_page]">Custom Success URL:</label>
|
313 |
+
<input type="text" name="form[form_thank_you_page]" /><br />
|
314 |
+
(If this is filled out, users will be sent to this page when they successfully fill out this form. If it is left blank, a popover showing the form's "success message" will be displayed on form success.)</li>
|
315 |
<li>
|
316 |
<input type="submit" value="Create Form" name="form_create" />
|
317 |
</li>
|
327 |
<th scope="col" class="manage-column field-label">Label</th>
|
328 |
<th scope="col" class="manage-column field-type">Type</th>
|
329 |
<th scope="col" class="manage-column field-value">Initial Value</th>
|
330 |
+
<th scope="col" class="manage-column field-required">Required</th>
|
331 |
<th scope="col" class="manage-column field-maxlength">Maxlength</th>
|
332 |
<th scope="col" class="manage-column field-action">Action</th>
|
333 |
</tr>
|
344 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
345 |
<tr<?php if ($z % 2 == 1) echo ' class="evenrow"'; ?>>
|
346 |
|
347 |
+
<td><input type="text" name="field[field_slug]" class="width100" maxlength="50" value="<?php echo $fields[$i]->field_slug; ?>" /></td>
|
348 |
+
<td><input type="text" name="field[field_label]" maxlength="100" value="<?php echo $fields[$i]->field_label; ?>" /></td>
|
349 |
+
<td><select name="field[field_type]">
|
350 |
<?php echo $field_types; ?>
|
351 |
</select></td>
|
352 |
+
<td><input type="text" name="field[field_value]" maxlength="50" class="width75" value="<?php echo $fields[$i]->field_value; ?>" /></td>
|
353 |
+
<td><select name="field[field_required]"><option value="1">Yes</option><option value="0" <?php if ($fields[$i]->field_required != 1) echo 'selected="selected"'; ?>>No</option></select></td>
|
354 |
+
<td><input type="text" class="width50" name="field[field_maxlength]" value="<?php echo $fields[$i]->field_maxlength; ?>" /></td>
|
355 |
<td><input type="hidden" name="fid" value="<?php echo $fields[$i]->id; ?>" />
|
356 |
+
<span class="fields-options-expand"></span>
|
357 |
<input type="submit" name="field_edit" value="Edit" />
|
358 |
<input type="submit" name="field_delete" value="Delete" /></td>
|
359 |
|
360 |
</tr>
|
361 |
<tr<?php if ($z % 2 == 1) echo ' class="evenrow"'; ?>>
|
362 |
+
<td class="fields-extra-options" colspan="7" style="border-bottom:1px solid black;">Field Instructions: <input type="text" class="width200" name="field[field_instructions]" value="<?php echo $fields[$i]->field_instructions; ?>" /></td>
|
363 |
</tr>
|
364 |
</form>
|
365 |
<?php
|
372 |
<th scope="col" class="manage-column field-label">Label</th>
|
373 |
<th scope="col" class="manage-column field-type">Type</th>
|
374 |
<th scope="col" class="manage-column field-value">Initial Value</th>
|
375 |
+
<th scope="col" class="manage-column field-required">Required</th>
|
376 |
<th scope="col" class="manage-column field-maxlength">Maxlength</th>
|
377 |
<th scope="col" class="manage-column field-action">Action</th>
|
378 |
</tr>
|
386 |
<th scope="col" class="manage-column field-label">Label</th>
|
387 |
<th scope="col" class="manage-column field-type">Type</th>
|
388 |
<th scope="col" class="manage-column field-value">Initial Value</th>
|
389 |
+
<th scope="col" class="manage-column field-value">Required</th>
|
390 |
<th scope="col" class="manage-column field-maxlength">Maxlength</th>
|
391 |
<th scope="col" class="manage-column field-action">Action</th>
|
392 |
</tr>
|
401 |
|
402 |
?>
|
403 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
404 |
+
<tr <?php if ($z % 2 == 0) echo ' class="evenrow"'; ?> style="border:none;">
|
405 |
|
406 |
+
<td><?php echo $fields[$i]->field_slug; ?></td>
|
407 |
+
<td><input type="text" name="field[field_label]" maxlength="100" value="<?php echo $fields[$i]->field_label; ?>" /></td>
|
|
|
408 |
<td><?php echo $fields[$i]->field_type; ?>
|
409 |
+
<td><?php if ($fields[$i]->field_type != 'Checkbox') { ?>
|
410 |
+
<input type="text" name="field[field_value]" class="width75" maxlength="50" value="<?php echo $fields[$i]->field_value; ?>" />
|
|
|
411 |
<?php } else {
|
412 |
echo $fields[$i]->field_value;
|
413 |
?>
|
414 |
+
<?php } ?>
|
415 |
+
</td>
|
416 |
+
<td>
|
417 |
+
<?php if ($fields[$i]->field_slug == 'fixedEmail') { ?>
|
418 |
+
<select name="field[field_required]"><option value="1">Yes</option><option <?php if($fields[$i]->field_required != 1) echo 'selected="selected"'; ?> value="0">No</option></select>
|
419 |
+
<?php } else { ?>
|
420 |
+
Yes
|
421 |
<?php } ?>
|
422 |
</td>
|
423 |
<td><?php if ($fields[$i]->field_type != 'Checkbox') { ?>
|
424 |
+
<input type="text" class="width50" name="field[field_maxlength]" value="<?php echo $fields[$i]->field_maxlength; ?>" />
|
425 |
<?php } else { ?>
|
426 |
+
None
|
427 |
<?php } ?>
|
428 |
</td>
|
429 |
|
430 |
<td><input type="hidden" name="fid" value="<?php echo $fields[$i]->id; ?>" />
|
431 |
+
<span class="fixed-fields-options-expand"></span>
|
432 |
<input type="submit" name="field_edit" value="Edit" /></td>
|
433 |
</tr>
|
434 |
+
<tr <?php if ($z % 2 == 0) echo ' class="evenrow"'; ?> style="border:none;">
|
435 |
+
<td class="fixed-fields-extra-options" colspan="7" style="border-bottom:1px solid black;">Field Instructions: <input type="text" name="field[field_instructions]" class="width200" value="<?php echo $fields[$i]->field_instructions; ?>" /> - <?php echo $this->fixed_fields[$fields[$i]->field_slug]; ?></td>
|
436 |
</tr>
|
437 |
</form>
|
438 |
<?php
|
445 |
<th scope="col" class="manage-column field-label">Label</th>
|
446 |
<th scope="col" class="manage-column field-type">Type</th>
|
447 |
<th scope="col" class="manage-column field-value">Initial Value</th>
|
448 |
+
<th scope="col" class="manage-column field-value">Required</th>
|
449 |
<th scope="col" class="manage-column field-maxlength">Maxlength</th>
|
450 |
<th scope="col" class="manage-column field-action">Action</th>
|
451 |
</tr>
|
455 |
<table class="widefat post" id="manage-forms" cellspacing="0">
|
456 |
<thead>
|
457 |
<tr>
|
458 |
+
<th scope="col" class="manage-column form-code">Form Display Code</th>
|
459 |
<th scope="col" class="manage-column form-slug">Slug</th>
|
460 |
<th scope="col" class="manage-column form-title">Title</th>
|
|
|
|
|
461 |
<th scope="col" class="manage-column form-submit">Button Text</th>
|
|
|
462 |
<th scope="col" class="manage-column form-submit">Style</th>
|
463 |
+
<th scope="col" class="manage-column form-submit">Action</th>
|
464 |
</tr>
|
465 |
</thead>
|
466 |
<tbody>
|
475 |
?>
|
476 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
477 |
<tr class="<?php if ($i % 2 == 0) echo 'evenrow'; ?>">
|
478 |
+
<td><span class="bold">[customcontact form=<?php echo $forms[$i]->id ?>]</span></td>
|
479 |
+
<td><input type="text" class="width75" name="form[form_slug]" value="<?php echo $forms[$i]->form_slug; ?>" /></td>
|
480 |
+
<td><input type="text" class="width125" name="form[form_title]" value="<?php echo $forms[$i]->form_title; ?>" /></td>
|
481 |
+
<td><input class="width100" type="text" name="form[submit_button_text]" value="<?php echo $forms[$i]->submit_button_text; ?>" /></td>
|
482 |
+
<td><select name="form[form_style]"><?php echo $sty_opt; ?></select></td>
|
483 |
+
<td><input type="hidden" name="fid" value="<?php echo $forms[$i]->id; ?>" />
|
484 |
+
<span class="form-options-expand"></span>
|
485 |
+
<input type="submit" name="form_edit" value="Edit" />
|
486 |
+
<input type="submit" name="form_delete" value="Delete" />
|
487 |
+
</td>
|
488 |
</tr>
|
489 |
<tr class="<?php if ($i % 2 == 0) echo 'evenrow'; ?>">
|
490 |
+
<td class="form-extra-options textcenter" colspan="8" style="border-bottom:1px solid black;">
|
491 |
+
<table class="form-extra-options-table">
|
492 |
+
<tbody>
|
493 |
+
<tr>
|
494 |
+
<td class="bold">Form Method</td>
|
495 |
+
<td class="bold">Form Action</td>
|
496 |
+
<td class="bold">Destination Email</td>
|
497 |
+
<td class="bold">Custom Code</td>
|
498 |
+
<td class="bold">Success Message</td>
|
499 |
+
<td class="bold">Custom Success URL</td>
|
500 |
+
</tr>
|
501 |
+
<tr>
|
502 |
+
<td><select name="form[form_method]"><?php echo $form_methods; ?></select></td>
|
503 |
+
<td><input type="text" name="form[form_action]" value="<?php echo $forms[$i]->form_action; ?>" /></td>
|
504 |
+
<td><input type="text" name="form[form_email]" value="<?php echo $forms[$i]->form_email; ?>" /></td>
|
505 |
+
<td><input type="text" name="form[custom_code]" value="<?php echo $forms[$i]->custom_code; ?>" /></td>
|
506 |
+
<td><input type="text" name="form[form_success_message]" value="<?php echo $forms[$i]->form_success_message; ?>" /></td>
|
507 |
+
<td><input type="text" class="width125" name="form[form_thank_you_page]" value="<?php echo $forms[$i]->form_thank_you_page; ?>" /></td>
|
508 |
+
</tr>
|
509 |
+
<tr>
|
510 |
+
<td colspan="3">
|
511 |
+
<label for="disattach_field_id"><span>Attached Fields:</span></label>
|
512 |
+
<?php
|
513 |
+
$attached_fields = parent::getAttachedFieldsArray($forms[$i]->id);
|
514 |
+
if (empty($attached_fields)) echo 'None ';
|
515 |
+
else {
|
516 |
+
echo '<select name="disattach_field_id">';
|
517 |
+
foreach($attached_fields as $attached_field) {
|
518 |
+
$this_field = parent::selectField($attached_field, '');
|
519 |
+
echo $this_field->field_slug . ' <option value="'.$this_field->id.'">'.$this_field->field_slug.'</option>';
|
520 |
+
}
|
521 |
+
echo '</select> <input type="submit" value="Disattach Field" name="disattach_field" />';
|
522 |
+
}
|
523 |
+
?><br />
|
524 |
+
<span class="red bold">*</span> Attach fields in the order you want them displayed.
|
525 |
+
</td>
|
526 |
+
<td colspan="3">
|
527 |
+
<label for="field_id"><span>Attach Field:</span></label>
|
528 |
+
<select name="field_id"><?php echo $add_fields; ?></select> <input type="submit" name="form_add_field" value="Attach Field" />
|
529 |
+
<br /><span class="red bold">*</span> Attach fixed fields or ones you <a href="#create-fields">create</a>.
|
530 |
+
</td>
|
531 |
+
</tr>
|
532 |
+
<tr>
|
533 |
+
<td colspan="6"><label for="theme_code_<?php echo $forms[$i]->id; ?>"><span>Code to Display Form in Theme Files:</span></label> <input type="text" class="width225" value="if (function_exists('serveCustomContactForm')) { serveCustomContactForm(<?php echo $forms[$i]->id; ?>); }" name="theme_code_<?php echo $form[$i]->id; ?>" /></td>
|
534 |
+
</tr>
|
535 |
+
</tbody>
|
536 |
+
</table>
|
537 |
+
</td>
|
538 |
</tr>
|
539 |
+
|
540 |
</form>
|
541 |
<?php
|
542 |
}
|
550 |
<tfoot>
|
551 |
<tr>
|
552 |
<tr>
|
553 |
+
<th scope="col" class="manage-column form-code">Form Code</th>
|
554 |
<th scope="col" class="manage-column form-slug">Slug</th>
|
555 |
<th scope="col" class="manage-column form-title">Title</th>
|
|
|
|
|
556 |
<th scope="col" class="manage-column form-submit">Button Text</th>
|
|
|
557 |
<th scope="col" class="manage-column form-submit">Style</th>
|
558 |
+
<th scope="col" class="manage-column form-submit">Action</th>
|
559 |
</tr>
|
560 |
</tr>
|
561 |
|
570 |
<label for="default_to_email">Default Email:</label>
|
571 |
<input name="default_to_email" value="<?php echo $admin_options[default_to_email]; ?>" type="text" maxlength="100" />
|
572 |
</li>
|
573 |
+
<li class="descrip">Form emails will be sent <span>to</span> this address, if no destination email is specified by the form.</li>
|
574 |
<li>
|
575 |
<label for="default_from_email">Default From Email:</label>
|
576 |
<input name="default_from_email" value="<?php echo $admin_options[default_from_email]; ?>" type="text" maxlength="100" />
|
577 |
</li>
|
578 |
+
<li class="descrip">Form emails will be sent <span>from</span> this address. It is recommended you provide a real email address that has been created through your host.</li>
|
579 |
<li>
|
580 |
<label for="default_form_subject">Default Email Subject:</label>
|
581 |
<input name="default_form_subject" value="<?php echo $admin_options[default_form_subject]; ?>" type="text" />
|
582 |
</li>
|
583 |
<li class="descrip">Default subject to be included in all form emails.</li>
|
584 |
<li>
|
585 |
+
<label for="form_success_message">Default Thank You Message:</label>
|
|
|
|
|
|
|
|
|
|
|
586 |
<input name="form_success_message" value="<?php echo $admin_options[form_success_message]; ?>" type="text"/>
|
587 |
</li>
|
588 |
+
<li class="descrip">If someone fills out a form for which a success message is not provided and a custom success page is not provided, the plugin will show a popover containing this message.</li>
|
589 |
|
590 |
<li>
|
591 |
<label for="remember_field_values">Remember Field Values:</label>
|
644 |
<div class="inside">
|
645 |
<p>1. Create a form.</p>
|
646 |
<p>2. Create fields and attach those fields to the forms of your choice. <b>* Attach the fields in the order that you want them to show up in the form. If you mess up you can detach and reattach them.</b></p>
|
647 |
+
<p>3. Display those forms in posts and pages by inserting the code: [customcontact form=<b>FORMID</b>]. Replace <b>FORMID</b> with the id listed to the left of the form slug next to the form of your choice above. You can also display forms in theme files; the code for this is provided within each forms admin section.</p>
|
648 |
<p>4. Prevent spam by attaching the fixed field, captcha or ishuman. Captcha requires users to type in a number shown on an image. Ishuman requires users to check a box to prove they aren't a spam bot.</p>
|
649 |
<p>5. Add a form to your sidebar, by dragging the Custom Contact Form widget in to your sidebar.</p>
|
650 |
<p>6. Configure the General Settings appropriately; this is important if you want to receive your web form messages!</p>
|
651 |
<p>7. Create form styles to change your forms appearances. The image below explains how each style field can change the look of your forms.</p>
|
652 |
+
<p>8. (advanced) If you are confident in your HTML and CSS skills, you can use the <a href="#custom-html">Custom HTML Forms feature</a> as a framework and write your forms from scratch. This allows you to use this plugin simply to process your form requests. The Custom HTML Forms feature will process and email any form variables sent to it regardless of whether they are created in the fields manager.</p>
|
653 |
<div id="style-example"></div>
|
654 |
</div>
|
655 |
</div>
|
769 |
<label for="title_margin">Title Margin:</label>
|
770 |
<input type="text" maxlength="20" value="2px" name="style[title_margin]" />
|
771 |
(ex: 5px or 1em)</li>
|
772 |
+
<li>
|
773 |
+
<label for="textarea_backgroundcolor">Textarea Background Color:</label>
|
774 |
+
<input type="text" maxlength="20" value="#efefef" name="style[textarea_backgroundcolor]" />
|
775 |
+
(ex: #FF0000 or red)</li>
|
776 |
<li>
|
777 |
<input type="submit" value="Create Style" name="style_create" />
|
778 |
</li>
|
802 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
803 |
<td><label>Slug:</label> <input type="text" maxlength="30" value="<?php echo $style->style_slug; ?>" name="style[style_slug]" /><br />
|
804 |
<label>Font Family:</label><input type="text" maxlength="20" value="<?php echo $style->form_fontfamily; ?>" name="style[form_fontfamily]" /><br />
|
805 |
+
<label>Textarea Background<br />Color:</label><input type="text" maxlength="20" value="<?php echo $style->textarea_backgroundcolor; ?>" name="style[textarea_backgroundcolor]" /><br />
|
806 |
<input type="submit" class="submit-styles" name="style_edit" value="Update Style" /><br />
|
807 |
<input type="submit" class="submit-styles" name="style_delete" value="Delete Style" />
|
808 |
</td>
|
843 |
<label>Form Border Color:</label><input type="text" maxlength="20" value="<?php echo $style->form_bordercolor; ?>" name="style[form_bordercolor]" /><br />
|
844 |
<label>Field Border Color:</label><input type="text" maxlength="20" value="<?php echo $style->field_bordercolor; ?>" name="style[field_bordercolor]" />
|
845 |
<label>Field Border Style:</label><select name="style[field_borderstyle]"><?php echo str_replace('<option>'.$style->field_borderstyle.'</option>', '<option selected="selected">'.$style->field_borderstyle.'</option>', $border_style_options); ?></select>
|
846 |
+
<input name="sid" type="hidden" value="<?php echo $style->id; ?>" />
|
847 |
</td>
|
848 |
|
849 |
</form>
|
887 |
</form>
|
888 |
</div>
|
889 |
</div>
|
890 |
+
<a name="custom-html"></a>
|
891 |
+
<div id="custom-html" class="postbox">
|
892 |
+
<h3 class="hndle"><span>Custom HTML Forms (Advanced)</span></h3>
|
893 |
+
<div class="inside">
|
894 |
+
<p>If you know HTML and simply want to use this plugin to process form requests, this feature is for you.
|
895 |
+
The following HTML is a the framework to which you must adhere. In order for your form to work you MUST do the following:
|
896 |
+
<b>a)</b> Keep the form action/method the same (yes the action is supposed to be empty), <b>b)</b> Include all the hidden fields shown below, <b>c)</b> provide a
|
897 |
+
hidden field with a success message or thank you page (both hidden fields are included below, you must choose one or the other and fill in the value part of the input field appropriately.</p>
|
898 |
+
<textarea id="custom_html_textarea">
|
899 |
+
<form method="post" action="">
|
900 |
+
<input type="hidden" name="ccf_customhtml" value="1" />
|
901 |
+
<input type="hidden" name="success_message" value="Thank you for filling out our form!" />
|
902 |
+
<input type="hidden" name="thank_you_page" value="http://www.google.com" />
|
903 |
+
<input type="hidden" name="destination_email" value="<?php echo $admin_options[default_to_email]; ?>" />
|
904 |
+
<input type="hidden" name="required_fields" value="field_name1, field_name2" />
|
905 |
+
|
906 |
+
<!-- Build your form in here. It is recommended you only use this feature if you are experienced with HTML.
|
907 |
+
The success_message field will add a popover containing the message when the form is completed successfully, the thank_you_page field will force
|
908 |
+
the user to be redirected to that specific page on successful form completion. The required_fields hidden field is optional; to use it seperate
|
909 |
+
the field names you want required by commas. Remember to use underscores instead of spaces in field names! -->
|
910 |
+
|
911 |
+
</form></textarea>
|
912 |
+
</div>
|
913 |
+
</div>
|
914 |
</div>
|
915 |
<?php
|
916 |
}
|
923 |
foreach ($errors as $error) {
|
924 |
$out .= '<li>'.$error.'</li>' . "\n";
|
925 |
}
|
926 |
+
$err_link = (!empty($this->error_return)) ? '<p><a href="'.$this->error_return.'" title="Go Back">< Back to Form</a></p>' : '';
|
927 |
+
return $out . '</ul>' . "\n" . $err_link . '</div>';
|
928 |
}
|
929 |
$matches = array();
|
930 |
preg_match_all('/\[customcontact form=([0-9]+)\]/si', $content, $matches);
|
998 |
return $str;
|
999 |
}
|
1000 |
|
1001 |
+
function validEmail($email) {
|
1002 |
+
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) return false;
|
1003 |
+
$email_array = explode("@", $email);
|
1004 |
+
$local_array = explode(".", $email_array[0]);
|
1005 |
+
for ($i = 0; $i < sizeof($local_array); $i++) {
|
1006 |
+
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
|
1007 |
+
return false;
|
1008 |
+
}
|
1009 |
+
}
|
1010 |
+
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
|
1011 |
+
$domain_array = explode(".", $email_array[1]);
|
1012 |
+
if (sizeof($domain_array) < 2) return false;
|
1013 |
+
for ($i = 0; $i < sizeof($domain_array); $i++) {
|
1014 |
+
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
|
1015 |
+
return false;
|
1016 |
+
}
|
1017 |
+
}
|
1018 |
+
}
|
1019 |
+
return true;
|
1020 |
+
}
|
1021 |
+
|
1022 |
function getFormCode($fid, $is_sidebar = false, $popover = false) {
|
1023 |
$admin_options = $this->getAdminOptions();
|
1024 |
$form = parent::selectForm($fid, '');
|
1025 |
+
$form_key = time();
|
1026 |
$out = '';
|
1027 |
+
$form_styles = '';
|
1028 |
+
$style_class = (!$is_sidebar) ? ' customcontactform' : ' customcontactform-sidebar';
|
1029 |
+
$form_id = 'form-' . $form->id . '-'.$form_key;
|
1030 |
if ($form->form_style != 0) {
|
1031 |
$style = parent::selectStyle($form->form_style, '');
|
1032 |
+
$style_class = $style->style_slug;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1033 |
}
|
1034 |
$action = (!empty($form->form_action)) ? $form->form_action : get_permalink();
|
1035 |
+
$out .= '<form id="'.$form_id.'" method="'.strtolower($form->form_method).'" action="'.$action.'" class="'.$style_class.'">' . "\n";
|
1036 |
+
$out .= parent::decodeOption($form->custom_code, 1, 1) . '<h4 id="h4-' . $form->id . '-'.$form_key.'">' . parent::decodeOption($form->form_title, 1, 1) . '</h4>' . "\n" . '<div id="div-' . $form->id . '-'.$form_key.'">';
|
1037 |
$fields = parent::getAttachedFieldsArray($fid);
|
1038 |
$hiddens = '';
|
1039 |
foreach ($fields as $field_id) {
|
1040 |
$field = parent::selectField($field_id, '');
|
1041 |
+
$req = ($field->field_required == 1) ? '* ' : '';
|
1042 |
+
$req_long = ($field->field_required == 1) ? ' (required)' : '';
|
1043 |
$input_id = 'id="'.parent::decodeOption($field->field_slug, 1, 1).'"';
|
1044 |
$field_value = parent::decodeOption($field->field_value, 1, 1);
|
1045 |
+
$instructions = (empty($field->field_instructions)) ? '' : 'title="' . $field->field_instructions . $req_long . '" class="tooltip-field"';
|
1046 |
if ($admin_options[enable_widget_tooltips] == 0 && $is_sidebar) $instructions = '';
|
1047 |
if ($_SESSION[fields][$field->field_slug]) {
|
1048 |
if ($admin_options[remember_field_values] == 1)
|
1049 |
$field_value = $_SESSION[fields][$field->field_slug];
|
1050 |
}
|
1051 |
+
|
1052 |
if ($field->user_field == 0 && $field->field_slug == 'captcha') {
|
1053 |
$out .= '<p>' . $this->getCaptchaCode($form->id) . '</p>';
|
1054 |
} elseif ($field->field_type == 'Text') {
|
1055 |
$maxlength = (empty($field->field_maxlength) or $field->field_maxlength <= 0) ? '' : ' maxlength="'.$field->field_maxlength.'"';
|
1056 |
+
$out .= '<p><label for="'.parent::decodeOption($field->field_slug, 1, 1).'">'. $req .parent::decodeOption($field->field_label, 1, 1).'</label><input '.$instructions.' '.$input_id.' type="text" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.$field_value.'"'.$maxlength.' /></p>' . "\n";
|
1057 |
} elseif ($field->field_type == 'Hidden') {
|
1058 |
$hiddens .= '<p><input type="hidden" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.$field_value.'" '.$input_id.' /></p>' . "\n";
|
1059 |
} elseif ($field->field_type == 'Checkbox') {
|
1060 |
+
$out .= '<p><input '.$instructions.' type="checkbox" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.parent::decodeOption($field->field_value, 1, 1).'" '.$input_id.' /> <label class="checkbox" for="'.parent::decodeOption($field->field_slug, 1, 1).'">' . $req .parent::decodeOption($field->field_label, 1, 1).'</label></p>' . "\n";
|
1061 |
} elseif ($field->field_type == 'Textarea') {
|
1062 |
+
$out .= '<p><label for="'.parent::decodeOption($field->field_slug, 1, 1).'">'. $req .parent::decodeOption($field->field_label, 1, 1).'</label><textarea '.$instructions.' '.$input_id.' rows="5" cols="40" name="'.parent::decodeOption($field->field_slug, 1, 1).'">'.$field_value.'</textarea></p>' . "\n";
|
1063 |
}
|
1064 |
}
|
1065 |
$submit_text = (!empty($form->submit_button_text)) ? parent::decodeOption($form->submit_button_text, 1, 0) : 'Submit';
|
1066 |
+
$out .= '</div>'."\n".'<p><input name="form_page" value="'.$_SERVER['REQUEST_URI'].'" type="hidden" /><input type="hidden" name="fid" value="'.$form->id.'" />'."\n".$hiddens."\n".'<input type="submit" id="submit-' . $form->id . '-'.$form_key.'" class="submit" value="' . $submit_text . '" name="customcontactforms_submit" /></p>' . "\n" . '</form>';
|
1067 |
if ($admin_options[author_link] == 1) $out .= '<a class="hide" href="http://www.taylorlovett.com" title="Rockville Web Developer, Wordpress Plugins">Wordpress plugin expert and Rockville Web Developer Taylor Lovett</a>';
|
1068 |
+
|
1069 |
+
if ($form->form_style != 0) {
|
1070 |
+
$form_styles .= '<style type="text/css">' . "\n";
|
1071 |
+
$form_styles .= '#' . $form_id . " { width: ".$style->form_width."; padding:".$style->form_padding."; margin:".$style->form_margin."; border:".$style->form_borderwidth." ".$style->form_borderstyle." ".$style->form_bordercolor."; font-family:".$style->form_fontfamily."; }\n";
|
1072 |
+
$form_styles .= '#' . $form_id . " div { padding:0; margin:0; }\n";
|
1073 |
+
$form_styles .= '#' . $form_id . " h4 { padding:0; margin:".$style->title_margin." ".$style->title_margin." ".$style->title_margin." 0; color:".$style->title_fontcolor."; font-size:".$style->title_fontsize."; } \n";
|
1074 |
+
$form_styles .= '#' . $form_id . " label { padding:0; margin:".$style->label_margin." ".$style->label_margin." ".$style->label_margin." 0; display:block; color:".$style->label_fontcolor."; width:".$style->label_width."; font-size:".$style->label_fontsize."; } \n";
|
1075 |
+
$form_styles .= '#' . $form_id . " label.checkbox { display:inline; } \n";
|
1076 |
+
$form_styles .= '#' . $form_id . " input[type=text] { color:".$style->field_fontcolor."; margin:0; width:".$style->input_width."; font-size:".$style->field_fontsize."; background-color:".$style->field_backgroundcolor."; border:1px ".$style->field_borderstyle." ".$style->field_bordercolor."; } \n";
|
1077 |
+
$form_styles .= '#' . $form_id . " .submit { color:".$style->submit_fontcolor."; width:".$style->submit_width."; height:".$style->submit_height."; font-size:".$style->submit_fontsize."; } \n";
|
1078 |
+
$form_styles .= '#' . $form_id . " textarea { color:".$style->field_fontcolor."; width:".$style->textarea_width."; margin:0; background-color:".$style->textarea_backgroundcolor."; height:".$style->textarea_height."; font-size:".$style->field_fontsize."; border:1px ".$style->field_borderstyle." ".$style->field_bordercolor."; } \n";
|
1079 |
+
$form_styles .= '</style>' . "\n";
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
return $form_styles . $out . $this->wheresWaldo();
|
1083 |
}
|
1084 |
|
1085 |
function getCaptchaCode($form_id) {
|
1086 |
$captcha = parent::selectField('', 'captcha');
|
1087 |
$instructions = (empty($captcha->field_instructions)) ? '' : 'title="'.$captcha->field_instructions.'" class="tooltip-field"';
|
1088 |
$out = '<img id="captcha-image" src="' . get_bloginfo('wpurl') . '/wp-content/plugins/custom-contact-forms/image.php?fid='.$form_id.'" />
|
1089 |
+
<br /><label for="captcha'.$form_id.'">* '.$captcha->field_label.'</label> <input type="text" '.$instructions.' name="captcha" id="captcha'.$form_id.'" maxlength="20" />';
|
1090 |
return $out;
|
1091 |
}
|
1092 |
|
1107 |
}
|
1108 |
|
1109 |
function insertFormSuccessCode() {
|
|
|
1110 |
?>
|
1111 |
<div id="ccf-form-success">
|
1112 |
<h5>Successful Form Submission</h5>
|
1113 |
+
<p><?php echo $this->current_thank_you_message; ?></p>
|
1114 |
<a href="javascript:void(0)" class="close">[close]</a>
|
1115 |
</div>
|
1116 |
|
1117 |
<?php
|
1118 |
}
|
1119 |
|
1120 |
+
function requiredFieldsArrayFromList($list) {
|
1121 |
+
if (empty($list)) return array();
|
1122 |
+
$list = str_replace(' ', '', $list);
|
1123 |
+
$array = explode(',', $list);
|
1124 |
+
foreach ($array as $k => $v) {
|
1125 |
+
if (empty($array[$k])) unset($array[$k]);
|
1126 |
+
}
|
1127 |
+
return $array;
|
1128 |
+
}
|
1129 |
+
|
1130 |
function processForms() {
|
1131 |
+
if ($_POST[ccf_customhtml]) {
|
1132 |
+
$admin_options = $this->getAdminOptions();
|
1133 |
+
$fixed_customhtml_fields = array('required_fields', 'success_message', 'thank_you_page', 'destination_email', 'ccf_customhtml');
|
1134 |
+
$req_fields = $this->requiredFieldsArrayFromList($_POST[required_fields]);
|
1135 |
+
$body = '';
|
1136 |
+
foreach ($_POST as $key => $value) {
|
1137 |
+
if (!in_array($key, $fixed_customhtml_fields)) {
|
1138 |
+
if (in_array($key, $req_fields) && !empty($value))
|
1139 |
+
unset($req_fields[array_search($key, $req_fields)]);
|
1140 |
+
$body .= ucwords(str_replace('_', ' ', $key)) . ': ' . $value . "\n";
|
1141 |
+
}
|
1142 |
+
} foreach($req_fields as $err)
|
1143 |
+
$this->setFormError($err, 'You left the "' . $err . '" field blank.');
|
1144 |
+
$errors = $this->getAllFormErrors();
|
1145 |
+
if (empty($errors)) {
|
1146 |
+
$body .= "\n" . 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "\n";
|
1147 |
+
$mailer = new CustomContactFormsMailer($_POST[destination_email], $admin_options[default_from_email], $admin_options[default_form_subject], stripslashes($body), $admin_options[wp_mail_function]);
|
1148 |
+
$mailer->send();
|
1149 |
+
if ($_POST[thank_you_page])
|
1150 |
+
header("Location: " . $_POST[thank_you_page]);
|
1151 |
+
$this->current_thank_you_message = (!empty($_POST[success_message])) ? $_POST[success_message] : $admin_options[form_success_message];
|
1152 |
+
add_action('wp_footer', array(&$this, 'insertFormSuccessCode'), 1);
|
1153 |
+
}
|
1154 |
+
} elseif ($_POST[customcontactforms_submit]) {
|
1155 |
$this->startSession();
|
1156 |
$this->error_return = $_POST[form_page];
|
1157 |
$admin_options = $this->getAdminOptions();
|
1158 |
$fields = parent::getAttachedFieldsArray($_POST[fid]);
|
1159 |
+
$form = parent::selectForm($_POST[fid]);
|
1160 |
$checks = array();
|
1161 |
$cap_name = 'captcha_' . $_POST[fid];
|
1162 |
foreach ($fields as $field_id) {
|
1167 |
} elseif ($field->field_slug == 'captcha') {
|
1168 |
if ($_POST[captcha] != $_SESSION[$cap_name])
|
1169 |
$this->setFormError('captcha', 'You entered the captcha image code incorrectly');
|
1170 |
+
} elseif ($field->field_slug == 'fixedEmail' && $field->field_required == 1 && !empty($_POST[fixedEmail])) {
|
1171 |
+
if (!$this->validEmail($_POST[fixedEmail])) $this->setFormError('bad_email', 'The email address you provided was invalid.');
|
1172 |
} else {
|
1173 |
+
if ($field->field_required == 1 && empty($_POST[$field->field_slug]))
|
1174 |
+
$this->setFormError($field->field_slug, 'You left the "'.$field->field_label.'" field blank.');
|
1175 |
+
} if ($field->field_type == 'Checkbox')
|
1176 |
+
$checks[] = $field->field_slug;
|
1177 |
}
|
1178 |
$body = '';
|
1179 |
foreach ($_POST as $key => $value) {
|
1180 |
$_SESSION[fields][$key] = $value;
|
1181 |
$field = parent::selectField('', $key);
|
1182 |
+
if (!array_key_exists($key, $this->fixed_fields))
|
1183 |
$body .= $field->field_label . ': ' . $value . "\n";
|
1184 |
if (in_array($key, $checks)) {
|
1185 |
$checks_key = array_search($key, $checks);
|
1194 |
unset($_SESSION['captcha_' . $_POST[fid]]);
|
1195 |
unset($_SESSION[fields]);
|
1196 |
$body .= 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "\n";
|
1197 |
+
$to_email = (!empty($form->form_email)) ? $form->form_email : $admin_options[default_to_email];
|
1198 |
+
$mailer = new CustomContactFormsMailer($to_email, $admin_options[default_from_email], $admin_options[default_form_subject], stripslashes($body), $admin_options[wp_mail_function]);
|
1199 |
$mailer->send();
|
1200 |
+
if (!empty($form->form_thank_you_page)) {
|
1201 |
+
header("Location: " . $form->form_thank_you_page);
|
1202 |
}
|
1203 |
+
$this->current_thank_you_message = (!empty($form->form_success_message)) ? $form->form_success_message : $admin_options[form_success_message];
|
1204 |
add_action('wp_footer', array(&$this, 'insertFormSuccessCode'), 1);
|
1205 |
}
|
1206 |
unset($_POST);
|
1218 |
}
|
1219 |
}
|
1220 |
}
|
1221 |
+
|
1222 |
+
if (!function_exists('serveCustomContactForm')) {
|
1223 |
+
function serveCustomContactForm($fid) {
|
1224 |
+
global $customcontact;
|
1225 |
+
echo $customcontact->getFormCode($fid);
|
1226 |
+
}
|
1227 |
+
}
|
1228 |
+
|
1229 |
if (isset($customcontact)) {
|
1230 |
add_action('init', array(&$customcontact, 'init'), 1);
|
1231 |
add_action('wp_head', array(&$customcontact, 'addHeaderCode'), 1);
|
1232 |
+
add_action('wp_head', array(&$customcontact, 'insertFrontEndScripts'), 1);
|
1233 |
add_action('admin_head', array(&$customcontact, 'addHeaderCode'), 1);
|
1234 |
add_filter('the_content', array(&$customcontact, 'contentFilter'));
|
1235 |
+
add_action('admin_print_scripts', array(&$customcontact, 'insertAdminScripts'), 1);
|
1236 |
//add_action('wp_footer', array(&$customcontact, 'insertPopoverCode'));
|
1237 |
}
|
1238 |
add_action('admin_menu', 'CustomContactForms_ap');
|
error_log
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[12-Aug-2010 15:45:31] PHP Fatal error: Call to a member function get_var() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 161
|
2 |
+
[12-Aug-2010 18:02:20] PHP Fatal error: Call to a member function get_var() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 161
|
3 |
+
[12-Aug-2010 18:02:43] PHP Fatal error: Call to a member function get_var() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 161
|
4 |
+
[12-Aug-2010 18:03:50] PHP Fatal error: Call to a member function get_var() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 161
|
5 |
+
[12-Aug-2010 18:04:52] PHP Fatal error: Call to a member function get_var() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 161
|
6 |
+
[12-Aug-2010 18:05:29] PHP Fatal error: Call to a member function get_var() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 161
|
7 |
+
[12-Aug-2010 22:45:47] PHP Fatal error: Call to a member function get_var() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 161
|
8 |
+
[12-Aug-2010 22:46:12] PHP Fatal error: Call to a member function get_var() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 162
|
9 |
+
[12-Aug-2010 22:50:12] PHP Fatal error: Call to a member function get_row() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 253
|
10 |
+
[12-Aug-2010 22:50:32] PHP Fatal error: Call to a member function get_row() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 253
|
11 |
+
[12-Aug-2010 23:13:33] PHP Fatal error: Call to a member function get_row() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 253
|
12 |
+
[12-Aug-2010 23:14:38] PHP Fatal error: Call to a member function get_row() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 253
|
13 |
+
[12-Aug-2010 23:14:49] PHP Fatal error: Call to a member function get_row() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 253
|
14 |
+
[12-Aug-2010 23:15:23] PHP Fatal error: Call to a member function get_row() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 253
|
15 |
+
[12-Aug-2010 23:15:29] PHP Fatal error: Call to a member function get_row() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 253
|
16 |
+
[12-Aug-2010 23:15:51] PHP Fatal error: Call to a member function get_row() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 253
|
17 |
+
[12-Aug-2010 23:17:07] PHP Fatal error: Call to a member function get_row() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 253
|
18 |
+
[12-Aug-2010 23:18:01] PHP Fatal error: Call to a member function get_row() on a non-object in /home/tlovett1/public_html/guitar/wp-content/plugins/custom-contact-forms/custom-contact-forms-db.php on line 253
|
images/_notes/dwsync.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
2 |
+
<dwsync>
|
3 |
+
<file name="gd1.png" server="ftp.taylorlovett.com/www/" local="129256005000000000" remote="129256005000000000" />
|
4 |
+
<file name="gd2.png" server="ftp.taylorlovett.com/www/" local="129256005000000000" remote="129256005000000000" />
|
5 |
+
<file name="gd3.png" server="ftp.taylorlovett.com/www/" local="129256005000000000" remote="129256005000000000" />
|
6 |
+
<file name="gd4.png" server="ftp.taylorlovett.com/www/" local="129256005000000000" remote="129256005000000000" />
|
7 |
+
<file name="style-example.gif" server="ftp.taylorlovett.com/www/" local="129256005000000000" remote="129256005000000000" />
|
8 |
+
</dwsync>
|
js/custom-contact-forms-admin.js
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var $j = jQuery.noConflict();
|
2 |
+
//alert('shit');
|
3 |
+
$j(document).ready(function(){
|
4 |
+
$j('.form-extra-options').hide();
|
5 |
+
$j('.form-options-expand').prepend('<input type="button" class="form-options-expand-link" value="More Options" />');
|
6 |
+
$j('.form-options-expand-link').click(function() {
|
7 |
+
$j(this)
|
8 |
+
.parent()
|
9 |
+
.parent()
|
10 |
+
.parent()
|
11 |
+
.next()
|
12 |
+
.find(".form-extra-options:first")
|
13 |
+
.toggle();
|
14 |
+
});
|
15 |
+
|
16 |
+
$j('.fixed-fields-extra-options').hide();
|
17 |
+
$j('.fixed-fields-options-expand').prepend('<input type="button" class="fixed-fields-options-expand-link" value="More Options" />');
|
18 |
+
$j('.fixed-fields-options-expand-link').click(function() {
|
19 |
+
$j(this)
|
20 |
+
.parent()
|
21 |
+
.parent()
|
22 |
+
.parent()
|
23 |
+
.next()
|
24 |
+
.find(".fixed-fields-extra-options:first")
|
25 |
+
.toggle();
|
26 |
+
});
|
27 |
+
|
28 |
+
$j('.fields-extra-options').hide();
|
29 |
+
$j('.fields-options-expand').prepend('<input type="button" class="fields-options-expand-link" value="More Options" />');
|
30 |
+
$j('.fields-options-expand-link').click(function() {
|
31 |
+
$j(this)
|
32 |
+
.parent()
|
33 |
+
.parent()
|
34 |
+
.parent()
|
35 |
+
.next()
|
36 |
+
.find(".fields-extra-options:first")
|
37 |
+
.toggle();
|
38 |
+
});
|
39 |
+
});
|
js/jquery-ui-1.8.4.custom.js
CHANGED
@@ -1,1578 +1,1578 @@
|
|
1 |
-
/*!
|
2 |
-
* jQuery UI 1.8.4
|
3 |
-
*
|
4 |
-
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
-
* http://jquery.org/license
|
7 |
-
*
|
8 |
-
* http://docs.jquery.com/UI
|
9 |
-
*/
|
10 |
-
(function( $, undefined ) {
|
11 |
-
|
12 |
-
// prevent duplicate loading
|
13 |
-
// this is only a problem because we proxy existing functions
|
14 |
-
// and we don't want to double proxy them
|
15 |
-
$.ui = $.ui || {};
|
16 |
-
if ( $.ui.version ) {
|
17 |
-
return;
|
18 |
-
}
|
19 |
-
|
20 |
-
//Helper functions and ui object
|
21 |
-
$.extend( $.ui, {
|
22 |
-
version: "1.8.4",
|
23 |
-
|
24 |
-
// $.ui.plugin is deprecated. Use the proxy pattern instead.
|
25 |
-
plugin: {
|
26 |
-
add: function( module, option, set ) {
|
27 |
-
var proto = $.ui[ module ].prototype;
|
28 |
-
for ( var i in set ) {
|
29 |
-
proto.plugins[ i ] = proto.plugins[ i ] || [];
|
30 |
-
proto.plugins[ i ].push( [ option, set[ i ] ] );
|
31 |
-
}
|
32 |
-
},
|
33 |
-
call: function( instance, name, args ) {
|
34 |
-
var set = instance.plugins[ name ];
|
35 |
-
if ( !set || !instance.element[ 0 ].parentNode ) {
|
36 |
-
return;
|
37 |
-
}
|
38 |
-
|
39 |
-
for ( var i = 0; i < set.length; i++ ) {
|
40 |
-
if ( instance.options[ set[ i ][ 0 ] ] ) {
|
41 |
-
set[ i ][ 1 ].apply( instance.element, args );
|
42 |
-
}
|
43 |
-
}
|
44 |
-
}
|
45 |
-
},
|
46 |
-
|
47 |
-
contains: function( a, b ) {
|
48 |
-
return document.compareDocumentPosition ?
|
49 |
-
a.compareDocumentPosition( b ) & 16 :
|
50 |
-
a !== b && a.contains( b );
|
51 |
-
},
|
52 |
-
|
53 |
-
hasScroll: function( el, a ) {
|
54 |
-
|
55 |
-
//If overflow is hidden, the element might have extra content, but the user wants to hide it
|
56 |
-
if ( $( el ).css( "overflow" ) === "hidden") {
|
57 |
-
return false;
|
58 |
-
}
|
59 |
-
|
60 |
-
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
|
61 |
-
has = false;
|
62 |
-
|
63 |
-
if ( el[ scroll ] > 0 ) {
|
64 |
-
return true;
|
65 |
-
}
|
66 |
-
|
67 |
-
// TODO: determine which cases actually cause this to happen
|
68 |
-
// if the element doesn't have the scroll set, see if it's possible to
|
69 |
-
// set the scroll
|
70 |
-
el[ scroll ] = 1;
|
71 |
-
has = ( el[ scroll ] > 0 );
|
72 |
-
el[ scroll ] = 0;
|
73 |
-
return has;
|
74 |
-
},
|
75 |
-
|
76 |
-
isOverAxis: function( x, reference, size ) {
|
77 |
-
//Determines when x coordinate is over "b" element axis
|
78 |
-
return ( x > reference ) && ( x < ( reference + size ) );
|
79 |
-
},
|
80 |
-
|
81 |
-
isOver: function( y, x, top, left, height, width ) {
|
82 |
-
//Determines when x, y coordinates is over "b" element
|
83 |
-
return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
|
84 |
-
},
|
85 |
-
|
86 |
-
keyCode: {
|
87 |
-
ALT: 18,
|
88 |
-
BACKSPACE: 8,
|
89 |
-
CAPS_LOCK: 20,
|
90 |
-
COMMA: 188,
|
91 |
-
COMMAND: 91,
|
92 |
-
COMMAND_LEFT: 91, // COMMAND
|
93 |
-
COMMAND_RIGHT: 93,
|
94 |
-
CONTROL: 17,
|
95 |
-
DELETE: 46,
|
96 |
-
DOWN: 40,
|
97 |
-
END: 35,
|
98 |
-
ENTER: 13,
|
99 |
-
ESCAPE: 27,
|
100 |
-
HOME: 36,
|
101 |
-
INSERT: 45,
|
102 |
-
LEFT: 37,
|
103 |
-
MENU: 93, // COMMAND_RIGHT
|
104 |
-
NUMPAD_ADD: 107,
|
105 |
-
NUMPAD_DECIMAL: 110,
|
106 |
-
NUMPAD_DIVIDE: 111,
|
107 |
-
NUMPAD_ENTER: 108,
|
108 |
-
NUMPAD_MULTIPLY: 106,
|
109 |
-
NUMPAD_SUBTRACT: 109,
|
110 |
-
PAGE_DOWN: 34,
|
111 |
-
PAGE_UP: 33,
|
112 |
-
PERIOD: 190,
|
113 |
-
RIGHT: 39,
|
114 |
-
SHIFT: 16,
|
115 |
-
SPACE: 32,
|
116 |
-
TAB: 9,
|
117 |
-
UP: 38,
|
118 |
-
WINDOWS: 91 // COMMAND
|
119 |
-
}
|
120 |
-
});
|
121 |
-
|
122 |
-
//jQuery plugins
|
123 |
-
$.fn.extend({
|
124 |
-
_focus: $.fn.focus,
|
125 |
-
focus: function( delay, fn ) {
|
126 |
-
return typeof delay === "number" ?
|
127 |
-
this.each(function() {
|
128 |
-
var elem = this;
|
129 |
-
setTimeout(function() {
|
130 |
-
$( elem ).focus();
|
131 |
-
if ( fn ) {
|
132 |
-
fn.call( elem );
|
133 |
-
}
|
134 |
-
}, delay );
|
135 |
-
}) :
|
136 |
-
this._focus.apply( this, arguments );
|
137 |
-
},
|
138 |
-
|
139 |
-
enableSelection: function() {
|
140 |
-
return this
|
141 |
-
.attr( "unselectable", "off" )
|
142 |
-
.css( "MozUserSelect", "" );
|
143 |
-
},
|
144 |
-
|
145 |
-
disableSelection: function() {
|
146 |
-
return this
|
147 |
-
.attr( "unselectable", "on" )
|
148 |
-
.css( "MozUserSelect", "none" );
|
149 |
-
},
|
150 |
-
|
151 |
-
scrollParent: function() {
|
152 |
-
var scrollParent;
|
153 |
-
if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
|
154 |
-
scrollParent = this.parents().filter(function() {
|
155 |
-
return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
|
156 |
-
}).eq(0);
|
157 |
-
} else {
|
158 |
-
scrollParent = this.parents().filter(function() {
|
159 |
-
return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
|
160 |
-
}).eq(0);
|
161 |
-
}
|
162 |
-
|
163 |
-
return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
|
164 |
-
},
|
165 |
-
|
166 |
-
zIndex: function( zIndex ) {
|
167 |
-
if ( zIndex !== undefined ) {
|
168 |
-
return this.css( "zIndex", zIndex );
|
169 |
-
}
|
170 |
-
|
171 |
-
if ( this.length ) {
|
172 |
-
var elem = $( this[ 0 ] ), position, value;
|
173 |
-
while ( elem.length && elem[ 0 ] !== document ) {
|
174 |
-
// Ignore z-index if position is set to a value where z-index is ignored by the browser
|
175 |
-
// This makes behavior of this function consistent across browsers
|
176 |
-
// WebKit always returns auto if the element is positioned
|
177 |
-
position = elem.css( "position" );
|
178 |
-
if ( position === "absolute" || position === "relative" || position === "fixed" ) {
|
179 |
-
// IE returns 0 when zIndex is not specified
|
180 |
-
// other browsers return a string
|
181 |
-
// we ignore the case of nested elements with an explicit value of 0
|
182 |
-
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
|
183 |
-
value = parseInt( elem.css( "zIndex" ) );
|
184 |
-
if ( !isNaN( value ) && value != 0 ) {
|
185 |
-
return value;
|
186 |
-
}
|
187 |
-
}
|
188 |
-
elem = elem.parent();
|
189 |
-
}
|
190 |
-
}
|
191 |
-
|
192 |
-
return 0;
|
193 |
-
}
|
194 |
-
});
|
195 |
-
|
196 |
-
$.each( [ "Width", "Height" ], function( i, name ) {
|
197 |
-
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
|
198 |
-
type = name.toLowerCase(),
|
199 |
-
orig = {
|
200 |
-
innerWidth: $.fn.innerWidth,
|
201 |
-
innerHeight: $.fn.innerHeight,
|
202 |
-
outerWidth: $.fn.outerWidth,
|
203 |
-
outerHeight: $.fn.outerHeight
|
204 |
-
};
|
205 |
-
|
206 |
-
function reduce( elem, size, border, margin ) {
|
207 |
-
$.each( side, function() {
|
208 |
-
size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
|
209 |
-
if ( border ) {
|
210 |
-
size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
|
211 |
-
}
|
212 |
-
if ( margin ) {
|
213 |
-
size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
|
214 |
-
}
|
215 |
-
});
|
216 |
-
return size;
|
217 |
-
}
|
218 |
-
|
219 |
-
$.fn[ "inner" + name ] = function( size ) {
|
220 |
-
if ( size === undefined ) {
|
221 |
-
return orig[ "inner" + name ].call( this );
|
222 |
-
}
|
223 |
-
|
224 |
-
return this.each(function() {
|
225 |
-
$.style( this, type, reduce( this, size ) + "px" );
|
226 |
-
});
|
227 |
-
};
|
228 |
-
|
229 |
-
$.fn[ "outer" + name] = function( size, margin ) {
|
230 |
-
if ( typeof size !== "number" ) {
|
231 |
-
return orig[ "outer" + name ].call( this, size );
|
232 |
-
}
|
233 |
-
|
234 |
-
return this.each(function() {
|
235 |
-
$.style( this, type, reduce( this, size, true, margin ) + "px" );
|
236 |
-
});
|
237 |
-
};
|
238 |
-
});
|
239 |
-
|
240 |
-
//Additional selectors
|
241 |
-
function visible( element ) {
|
242 |
-
return !$( element ).parents().andSelf().filter(function() {
|
243 |
-
return $.curCSS( this, "visibility" ) === "hidden" ||
|
244 |
-
$.expr.filters.hidden( this );
|
245 |
-
}).length;
|
246 |
-
}
|
247 |
-
|
248 |
-
$.extend( $.expr[ ":" ], {
|
249 |
-
data: function( elem, i, match ) {
|
250 |
-
return !!$.data( elem, match[ 3 ] );
|
251 |
-
},
|
252 |
-
|
253 |
-
focusable: function( element ) {
|
254 |
-
var nodeName = element.nodeName.toLowerCase(),
|
255 |
-
tabIndex = $.attr( element, "tabindex" );
|
256 |
-
if ( "area" === nodeName ) {
|
257 |
-
var map = element.parentNode,
|
258 |
-
mapName = map.name,
|
259 |
-
img;
|
260 |
-
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
|
261 |
-
return false;
|
262 |
-
}
|
263 |
-
img = $( "img[usemap=#" + mapName + "]" )[0];
|
264 |
-
return !!img && visible( img );
|
265 |
-
}
|
266 |
-
return ( /input|select|textarea|button|object/.test( nodeName )
|
267 |
-
? !element.disabled
|
268 |
-
: "a" == nodeName
|
269 |
-
? element.href || !isNaN( tabIndex )
|
270 |
-
: !isNaN( tabIndex ))
|
271 |
-
// the element and all of its ancestors must be visible
|
272 |
-
&& visible( element );
|
273 |
-
},
|
274 |
-
|
275 |
-
tabbable: function( element ) {
|
276 |
-
var tabIndex = $.attr( element, "tabindex" );
|
277 |
-
return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
|
278 |
-
}
|
279 |
-
});
|
280 |
-
|
281 |
-
})( jQuery );
|
282 |
-
/*!
|
283 |
-
* jQuery UI Widget 1.8.4
|
284 |
-
*
|
285 |
-
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
286 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
287 |
-
* http://jquery.org/license
|
288 |
-
*
|
289 |
-
* http://docs.jquery.com/UI/Widget
|
290 |
-
*/
|
291 |
-
(function( $, undefined ) {
|
292 |
-
|
293 |
-
var _remove = $.fn.remove;
|
294 |
-
|
295 |
-
$.fn.remove = function( selector, keepData ) {
|
296 |
-
return this.each(function() {
|
297 |
-
if ( !keepData ) {
|
298 |
-
if ( !selector || $.filter( selector, [ this ] ).length ) {
|
299 |
-
$( "*", this ).add( [ this ] ).each(function() {
|
300 |
-
$( this ).triggerHandler( "remove" );
|
301 |
-
});
|
302 |
-
}
|
303 |
-
}
|
304 |
-
return _remove.call( $(this), selector, keepData );
|
305 |
-
});
|
306 |
-
};
|
307 |
-
|
308 |
-
$.widget = function( name, base, prototype ) {
|
309 |
-
var namespace = name.split( "." )[ 0 ],
|
310 |
-
fullName;
|
311 |
-
name = name.split( "." )[ 1 ];
|
312 |
-
fullName = namespace + "-" + name;
|
313 |
-
|
314 |
-
if ( !prototype ) {
|
315 |
-
prototype = base;
|
316 |
-
base = $.Widget;
|
317 |
-
}
|
318 |
-
|
319 |
-
// create selector for plugin
|
320 |
-
$.expr[ ":" ][ fullName ] = function( elem ) {
|
321 |
-
return !!$.data( elem, name );
|
322 |
-
};
|
323 |
-
|
324 |
-
$[ namespace ] = $[ namespace ] || {};
|
325 |
-
$[ namespace ][ name ] = function( options, element ) {
|
326 |
-
// allow instantiation without initializing for simple inheritance
|
327 |
-
if ( arguments.length ) {
|
328 |
-
this._createWidget( options, element );
|
329 |
-
}
|
330 |
-
};
|
331 |
-
|
332 |
-
var basePrototype = new base();
|
333 |
-
// we need to make the options hash a property directly on the new instance
|
334 |
-
// otherwise we'll modify the options hash on the prototype that we're
|
335 |
-
// inheriting from
|
336 |
-
// $.each( basePrototype, function( key, val ) {
|
337 |
-
// if ( $.isPlainObject(val) ) {
|
338 |
-
// basePrototype[ key ] = $.extend( {}, val );
|
339 |
-
// }
|
340 |
-
// });
|
341 |
-
basePrototype.options = $.extend( true, {}, basePrototype.options );
|
342 |
-
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
|
343 |
-
namespace: namespace,
|
344 |
-
widgetName: name,
|
345 |
-
widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
|
346 |
-
widgetBaseClass: fullName
|
347 |
-
}, prototype );
|
348 |
-
|
349 |
-
$.widget.bridge( name, $[ namespace ][ name ] );
|
350 |
-
};
|
351 |
-
|
352 |
-
$.widget.bridge = function( name, object ) {
|
353 |
-
$.fn[ name ] = function( options ) {
|
354 |
-
var isMethodCall = typeof options === "string",
|
355 |
-
args = Array.prototype.slice.call( arguments, 1 ),
|
356 |
-
returnValue = this;
|
357 |
-
|
358 |
-
// allow multiple hashes to be passed on init
|
359 |
-
options = !isMethodCall && args.length ?
|
360 |
-
$.extend.apply( null, [ true, options ].concat(args) ) :
|
361 |
-
options;
|
362 |
-
|
363 |
-
// prevent calls to internal methods
|
364 |
-
if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
|
365 |
-
return returnValue;
|
366 |
-
}
|
367 |
-
|
368 |
-
if ( isMethodCall ) {
|
369 |
-
this.each(function() {
|
370 |
-
var instance = $.data( this, name ),
|
371 |
-
methodValue = instance && $.isFunction( instance[options] ) ?
|
372 |
-
instance[ options ].apply( instance, args ) :
|
373 |
-
instance;
|
374 |
-
if ( methodValue !== instance && methodValue !== undefined ) {
|
375 |
-
returnValue = methodValue;
|
376 |
-
return false;
|
377 |
-
}
|
378 |
-
});
|
379 |
-
} else {
|
380 |
-
this.each(function() {
|
381 |
-
var instance = $.data( this, name );
|
382 |
-
if ( instance ) {
|
383 |
-
if ( options ) {
|
384 |
-
instance.option( options );
|
385 |
-
}
|
386 |
-
instance._init();
|
387 |
-
} else {
|
388 |
-
$.data( this, name, new object( options, this ) );
|
389 |
-
}
|
390 |
-
});
|
391 |
-
}
|
392 |
-
|
393 |
-
return returnValue;
|
394 |
-
};
|
395 |
-
};
|
396 |
-
|
397 |
-
$.Widget = function( options, element ) {
|
398 |
-
// allow instantiation without initializing for simple inheritance
|
399 |
-
if ( arguments.length ) {
|
400 |
-
this._createWidget( options, element );
|
401 |
-
}
|
402 |
-
};
|
403 |
-
|
404 |
-
$.Widget.prototype = {
|
405 |
-
widgetName: "widget",
|
406 |
-
widgetEventPrefix: "",
|
407 |
-
options: {
|
408 |
-
disabled: false
|
409 |
-
},
|
410 |
-
_createWidget: function( options, element ) {
|
411 |
-
// $.widget.bridge stores the plugin instance, but we do it anyway
|
412 |
-
// so that it's stored even before the _create function runs
|
413 |
-
$.data( element, this.widgetName, this );
|
414 |
-
this.element = $( element );
|
415 |
-
this.options = $.extend( true, {},
|
416 |
-
this.options,
|
417 |
-
$.metadata && $.metadata.get( element )[ this.widgetName ],
|
418 |
-
options );
|
419 |
-
|
420 |
-
var self = this;
|
421 |
-
this.element.bind( "remove." + this.widgetName, function() {
|
422 |
-
self.destroy();
|
423 |
-
});
|
424 |
-
|
425 |
-
this._create();
|
426 |
-
this._init();
|
427 |
-
},
|
428 |
-
_create: function() {},
|
429 |
-
_init: function() {},
|
430 |
-
|
431 |
-
destroy: function() {
|
432 |
-
this.element
|
433 |
-
.unbind( "." + this.widgetName )
|
434 |
-
.removeData( this.widgetName );
|
435 |
-
this.widget()
|
436 |
-
.unbind( "." + this.widgetName )
|
437 |
-
.removeAttr( "aria-disabled" )
|
438 |
-
.removeClass(
|
439 |
-
this.widgetBaseClass + "-disabled " +
|
440 |
-
"ui-state-disabled" );
|
441 |
-
},
|
442 |
-
|
443 |
-
widget: function() {
|
444 |
-
return this.element;
|
445 |
-
},
|
446 |
-
|
447 |
-
option: function( key, value ) {
|
448 |
-
var options = key,
|
449 |
-
self = this;
|
450 |
-
|
451 |
-
if ( arguments.length === 0 ) {
|
452 |
-
// don't return a reference to the internal hash
|
453 |
-
return $.extend( {}, self.options );
|
454 |
-
}
|
455 |
-
|
456 |
-
if (typeof key === "string" ) {
|
457 |
-
if ( value === undefined ) {
|
458 |
-
return this.options[ key ];
|
459 |
-
}
|
460 |
-
options = {};
|
461 |
-
options[ key ] = value;
|
462 |
-
}
|
463 |
-
|
464 |
-
$.each( options, function( key, value ) {
|
465 |
-
self._setOption( key, value );
|
466 |
-
});
|
467 |
-
|
468 |
-
return self;
|
469 |
-
},
|
470 |
-
_setOption: function( key, value ) {
|
471 |
-
this.options[ key ] = value;
|
472 |
-
|
473 |
-
if ( key === "disabled" ) {
|
474 |
-
this.widget()
|
475 |
-
[ value ? "addClass" : "removeClass"](
|
476 |
-
this.widgetBaseClass + "-disabled" + " " +
|
477 |
-
"ui-state-disabled" )
|
478 |
-
.attr( "aria-disabled", value );
|
479 |
-
}
|
480 |
-
|
481 |
-
return this;
|
482 |
-
},
|
483 |
-
|
484 |
-
enable: function() {
|
485 |
-
return this._setOption( "disabled", false );
|
486 |
-
},
|
487 |
-
disable: function() {
|
488 |
-
return this._setOption( "disabled", true );
|
489 |
-
},
|
490 |
-
|
491 |
-
_trigger: function( type, event, data ) {
|
492 |
-
var callback = this.options[ type ];
|
493 |
-
|
494 |
-
event = $.Event( event );
|
495 |
-
event.type = ( type === this.widgetEventPrefix ?
|
496 |
-
type :
|
497 |
-
this.widgetEventPrefix + type ).toLowerCase();
|
498 |
-
data = data || {};
|
499 |
-
|
500 |
-
// copy original event properties over to the new event
|
501 |
-
// this would happen if we could call $.event.fix instead of $.Event
|
502 |
-
// but we don't have a way to force an event to be fixed multiple times
|
503 |
-
if ( event.originalEvent ) {
|
504 |
-
for ( var i = $.event.props.length, prop; i; ) {
|
505 |
-
prop = $.event.props[ --i ];
|
506 |
-
event[ prop ] = event.originalEvent[ prop ];
|
507 |
-
}
|
508 |
-
}
|
509 |
-
|
510 |
-
this.element.trigger( event, data );
|
511 |
-
|
512 |
-
return !( $.isFunction(callback) &&
|
513 |
-
callback.call( this.element[0], event, data ) === false ||
|
514 |
-
event.isDefaultPrevented() );
|
515 |
-
}
|
516 |
-
};
|
517 |
-
|
518 |
-
})( jQuery );
|
519 |
-
/*
|
520 |
-
* jQuery UI Position 1.8.4
|
521 |
-
*
|
522 |
-
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
523 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
524 |
-
* http://jquery.org/license
|
525 |
-
*
|
526 |
-
* http://docs.jquery.com/UI/Position
|
527 |
-
*/
|
528 |
-
(function( $, undefined ) {
|
529 |
-
|
530 |
-
$.ui = $.ui || {};
|
531 |
-
|
532 |
-
var horizontalPositions = /left|center|right/,
|
533 |
-
horizontalDefault = "center",
|
534 |
-
verticalPositions = /top|center|bottom/,
|
535 |
-
verticalDefault = "center",
|
536 |
-
_position = $.fn.position,
|
537 |
-
_offset = $.fn.offset;
|
538 |
-
|
539 |
-
$.fn.position = function( options ) {
|
540 |
-
if ( !options || !options.of ) {
|
541 |
-
return _position.apply( this, arguments );
|
542 |
-
}
|
543 |
-
|
544 |
-
// make a copy, we don't want to modify arguments
|
545 |
-
options = $.extend( {}, options );
|
546 |
-
|
547 |
-
var target = $( options.of ),
|
548 |
-
collision = ( options.collision || "flip" ).split( " " ),
|
549 |
-
offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
|
550 |
-
targetWidth,
|
551 |
-
targetHeight,
|
552 |
-
basePosition;
|
553 |
-
|
554 |
-
if ( options.of.nodeType === 9 ) {
|
555 |
-
targetWidth = target.width();
|
556 |
-
targetHeight = target.height();
|
557 |
-
basePosition = { top: 0, left: 0 };
|
558 |
-
} else if ( options.of.scrollTo && options.of.document ) {
|
559 |
-
targetWidth = target.width();
|
560 |
-
targetHeight = target.height();
|
561 |
-
basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
|
562 |
-
} else if ( options.of.preventDefault ) {
|
563 |
-
// force left top to allow flipping
|
564 |
-
options.at = "left top";
|
565 |
-
targetWidth = targetHeight = 0;
|
566 |
-
basePosition = { top: options.of.pageY, left: options.of.pageX };
|
567 |
-
} else {
|
568 |
-
targetWidth = target.outerWidth();
|
569 |
-
targetHeight = target.outerHeight();
|
570 |
-
basePosition = target.offset();
|
571 |
-
}
|
572 |
-
|
573 |
-
// force my and at to have valid horizontal and veritcal positions
|
574 |
-
// if a value is missing or invalid, it will be converted to center
|
575 |
-
$.each( [ "my", "at" ], function() {
|
576 |
-
var pos = ( options[this] || "" ).split( " " );
|
577 |
-
if ( pos.length === 1) {
|
578 |
-
pos = horizontalPositions.test( pos[0] ) ?
|
579 |
-
pos.concat( [verticalDefault] ) :
|
580 |
-
verticalPositions.test( pos[0] ) ?
|
581 |
-
[ horizontalDefault ].concat( pos ) :
|
582 |
-
[ horizontalDefault, verticalDefault ];
|
583 |
-
}
|
584 |
-
pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : horizontalDefault;
|
585 |
-
pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : verticalDefault;
|
586 |
-
options[ this ] = pos;
|
587 |
-
});
|
588 |
-
|
589 |
-
// normalize collision option
|
590 |
-
if ( collision.length === 1 ) {
|
591 |
-
collision[ 1 ] = collision[ 0 ];
|
592 |
-
}
|
593 |
-
|
594 |
-
// normalize offset option
|
595 |
-
offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
|
596 |
-
if ( offset.length === 1 ) {
|
597 |
-
offset[ 1 ] = offset[ 0 ];
|
598 |
-
}
|
599 |
-
offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
|
600 |
-
|
601 |
-
if ( options.at[0] === "right" ) {
|
602 |
-
basePosition.left += targetWidth;
|
603 |
-
} else if (options.at[0] === horizontalDefault ) {
|
604 |
-
basePosition.left += targetWidth / 2;
|
605 |
-
}
|
606 |
-
|
607 |
-
if ( options.at[1] === "bottom" ) {
|
608 |
-
basePosition.top += targetHeight;
|
609 |
-
} else if ( options.at[1] === verticalDefault ) {
|
610 |
-
basePosition.top += targetHeight / 2;
|
611 |
-
}
|
612 |
-
|
613 |
-
basePosition.left += offset[ 0 ];
|
614 |
-
basePosition.top += offset[ 1 ];
|
615 |
-
|
616 |
-
return this.each(function() {
|
617 |
-
var elem = $( this ),
|
618 |
-
elemWidth = elem.outerWidth(),
|
619 |
-
elemHeight = elem.outerHeight(),
|
620 |
-
position = $.extend( {}, basePosition );
|
621 |
-
|
622 |
-
if ( options.my[0] === "right" ) {
|
623 |
-
position.left -= elemWidth;
|
624 |
-
} else if ( options.my[0] === horizontalDefault ) {
|
625 |
-
position.left -= elemWidth / 2;
|
626 |
-
}
|
627 |
-
|
628 |
-
if ( options.my[1] === "bottom" ) {
|
629 |
-
position.top -= elemHeight;
|
630 |
-
} else if ( options.my[1] === verticalDefault ) {
|
631 |
-
position.top -= elemHeight / 2;
|
632 |
-
}
|
633 |
-
|
634 |
-
// prevent fractions (see #5280)
|
635 |
-
position.left = parseInt( position.left );
|
636 |
-
position.top = parseInt( position.top );
|
637 |
-
|
638 |
-
$.each( [ "left", "top" ], function( i, dir ) {
|
639 |
-
if ( $.ui.position[ collision[i] ] ) {
|
640 |
-
$.ui.position[ collision[i] ][ dir ]( position, {
|
641 |
-
targetWidth: targetWidth,
|
642 |
-
targetHeight: targetHeight,
|
643 |
-
elemWidth: elemWidth,
|
644 |
-
elemHeight: elemHeight,
|
645 |
-
offset: offset,
|
646 |
-
my: options.my,
|
647 |
-
at: options.at
|
648 |
-
});
|
649 |
-
}
|
650 |
-
});
|
651 |
-
|
652 |
-
if ( $.fn.bgiframe ) {
|
653 |
-
elem.bgiframe();
|
654 |
-
}
|
655 |
-
elem.offset( $.extend( position, { using: options.using } ) );
|
656 |
-
});
|
657 |
-
};
|
658 |
-
|
659 |
-
$.ui.position = {
|
660 |
-
fit: {
|
661 |
-
left: function( position, data ) {
|
662 |
-
var win = $( window ),
|
663 |
-
over = position.left + data.elemWidth - win.width() - win.scrollLeft();
|
664 |
-
position.left = over > 0 ? position.left - over : Math.max( 0, position.left );
|
665 |
-
},
|
666 |
-
top: function( position, data ) {
|
667 |
-
var win = $( window ),
|
668 |
-
over = position.top + data.elemHeight - win.height() - win.scrollTop();
|
669 |
-
position.top = over > 0 ? position.top - over : Math.max( 0, position.top );
|
670 |
-
}
|
671 |
-
},
|
672 |
-
|
673 |
-
flip: {
|
674 |
-
left: function( position, data ) {
|
675 |
-
if ( data.at[0] === "center" ) {
|
676 |
-
return;
|
677 |
-
}
|
678 |
-
var win = $( window ),
|
679 |
-
over = position.left + data.elemWidth - win.width() - win.scrollLeft(),
|
680 |
-
myOffset = data.my[ 0 ] === "left" ?
|
681 |
-
-data.elemWidth :
|
682 |
-
data.my[ 0 ] === "right" ?
|
683 |
-
data.elemWidth :
|
684 |
-
0,
|
685 |
-
offset = -2 * data.offset[ 0 ];
|
686 |
-
position.left += position.left < 0 ?
|
687 |
-
myOffset + data.targetWidth + offset :
|
688 |
-
over > 0 ?
|
689 |
-
myOffset - data.targetWidth + offset :
|
690 |
-
0;
|
691 |
-
},
|
692 |
-
top: function( position, data ) {
|
693 |
-
if ( data.at[1] === "center" ) {
|
694 |
-
return;
|
695 |
-
}
|
696 |
-
var win = $( window ),
|
697 |
-
over = position.top + data.elemHeight - win.height() - win.scrollTop(),
|
698 |
-
myOffset = data.my[ 1 ] === "top" ?
|
699 |
-
-data.elemHeight :
|
700 |
-
data.my[ 1 ] === "bottom" ?
|
701 |
-
data.elemHeight :
|
702 |
-
0,
|
703 |
-
atOffset = data.at[ 1 ] === "top" ?
|
704 |
-
data.targetHeight :
|
705 |
-
-data.targetHeight,
|
706 |
-
offset = -2 * data.offset[ 1 ];
|
707 |
-
position.top += position.top < 0 ?
|
708 |
-
myOffset + data.targetHeight + offset :
|
709 |
-
over > 0 ?
|
710 |
-
myOffset + atOffset + offset :
|
711 |
-
0;
|
712 |
-
}
|
713 |
-
}
|
714 |
-
};
|
715 |
-
|
716 |
-
// offset setter from jQuery 1.4
|
717 |
-
if ( !$.offset.setOffset ) {
|
718 |
-
$.offset.setOffset = function( elem, options ) {
|
719 |
-
// set position first, in-case top/left are set even on static elem
|
720 |
-
if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
|
721 |
-
elem.style.position = "relative";
|
722 |
-
}
|
723 |
-
var curElem = $( elem ),
|
724 |
-
curOffset = curElem.offset(),
|
725 |
-
curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
|
726 |
-
curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
|
727 |
-
props = {
|
728 |
-
top: (options.top - curOffset.top) + curTop,
|
729 |
-
left: (options.left - curOffset.left) + curLeft
|
730 |
-
};
|
731 |
-
|
732 |
-
if ( 'using' in options ) {
|
733 |
-
options.using.call( elem, props );
|
734 |
-
} else {
|
735 |
-
curElem.css( props );
|
736 |
-
}
|
737 |
-
};
|
738 |
-
|
739 |
-
$.fn.offset = function( options ) {
|
740 |
-
var elem = this[ 0 ];
|
741 |
-
if ( !elem || !elem.ownerDocument ) { return null; }
|
742 |
-
if ( options ) {
|
743 |
-
return this.each(function() {
|
744 |
-
$.offset.setOffset( this, options );
|
745 |
-
});
|
746 |
-
}
|
747 |
-
return _offset.call( this );
|
748 |
-
};
|
749 |
-
}
|
750 |
-
|
751 |
-
}( jQuery ));
|
752 |
-
/*
|
753 |
-
* jQuery UI Dialog 1.8.4
|
754 |
-
*
|
755 |
-
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
756 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
757 |
-
* http://jquery.org/license
|
758 |
-
*
|
759 |
-
* http://docs.jquery.com/UI/Dialog
|
760 |
-
*
|
761 |
-
* Depends:
|
762 |
-
* jquery.ui.core.js
|
763 |
-
* jquery.ui.widget.js
|
764 |
-
* jquery.ui.button.js
|
765 |
-
* jquery.ui.draggable.js
|
766 |
-
* jquery.ui.mouse.js
|
767 |
-
* jquery.ui.position.js
|
768 |
-
* jquery.ui.resizable.js
|
769 |
-
*/
|
770 |
-
(function( $, undefined ) {
|
771 |
-
|
772 |
-
var uiDialogClasses =
|
773 |
-
'ui-dialog ' +
|
774 |
-
'ui-widget ' +
|
775 |
-
'ui-widget-content ' +
|
776 |
-
'ui-corner-all ';
|
777 |
-
|
778 |
-
$.widget("ui.dialog", {
|
779 |
-
options: {
|
780 |
-
autoOpen: true,
|
781 |
-
buttons: {},
|
782 |
-
closeOnEscape: true,
|
783 |
-
closeText: 'close',
|
784 |
-
dialogClass: '',
|
785 |
-
draggable: true,
|
786 |
-
hide: null,
|
787 |
-
height: 'auto',
|
788 |
-
maxHeight: false,
|
789 |
-
maxWidth: false,
|
790 |
-
minHeight: 150,
|
791 |
-
minWidth: 150,
|
792 |
-
modal: false,
|
793 |
-
position: {
|
794 |
-
my: 'center',
|
795 |
-
at: 'center',
|
796 |
-
of: window,
|
797 |
-
collision: 'fit',
|
798 |
-
// ensure that the titlebar is never outside the document
|
799 |
-
using: function(pos) {
|
800 |
-
var topOffset = $(this).css(pos).offset().top;
|
801 |
-
if (topOffset < 0) {
|
802 |
-
$(this).css('top', pos.top - topOffset);
|
803 |
-
}
|
804 |
-
}
|
805 |
-
},
|
806 |
-
resizable: true,
|
807 |
-
show: null,
|
808 |
-
stack: true,
|
809 |
-
title: '',
|
810 |
-
width: 300,
|
811 |
-
zIndex: 1000
|
812 |
-
},
|
813 |
-
|
814 |
-
_create: function() {
|
815 |
-
this.originalTitle = this.element.attr('title');
|
816 |
-
// #5742 - .attr() might return a DOMElement
|
817 |
-
if ( typeof this.originalTitle !== "string" ) {
|
818 |
-
this.originalTitle = "";
|
819 |
-
}
|
820 |
-
|
821 |
-
var self = this,
|
822 |
-
options = self.options,
|
823 |
-
|
824 |
-
title = options.title || self.originalTitle || ' ',
|
825 |
-
titleId = $.ui.dialog.getTitleId(self.element),
|
826 |
-
|
827 |
-
uiDialog = (self.uiDialog = $('<div></div>'))
|
828 |
-
.appendTo(document.body)
|
829 |
-
.hide()
|
830 |
-
.addClass(uiDialogClasses + options.dialogClass)
|
831 |
-
.css({
|
832 |
-
zIndex: options.zIndex
|
833 |
-
})
|
834 |
-
// setting tabIndex makes the div focusable
|
835 |
-
// setting outline to 0 prevents a border on focus in Mozilla
|
836 |
-
.attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
|
837 |
-
if (options.closeOnEscape && event.keyCode &&
|
838 |
-
event.keyCode === $.ui.keyCode.ESCAPE) {
|
839 |
-
|
840 |
-
self.close(event);
|
841 |
-
event.preventDefault();
|
842 |
-
}
|
843 |
-
})
|
844 |
-
.attr({
|
845 |
-
role: 'dialog',
|
846 |
-
'aria-labelledby': titleId
|
847 |
-
})
|
848 |
-
.mousedown(function(event) {
|
849 |
-
self.moveToTop(false, event);
|
850 |
-
}),
|
851 |
-
|
852 |
-
uiDialogContent = self.element
|
853 |
-
.show()
|
854 |
-
.removeAttr('title')
|
855 |
-
.addClass(
|
856 |
-
'ui-dialog-content ' +
|
857 |
-
'ui-widget-content')
|
858 |
-
.appendTo(uiDialog),
|
859 |
-
|
860 |
-
uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))
|
861 |
-
.addClass(
|
862 |
-
'ui-dialog-titlebar ' +
|
863 |
-
'ui-widget-header ' +
|
864 |
-
'ui-corner-all ' +
|
865 |
-
'ui-helper-clearfix'
|
866 |
-
)
|
867 |
-
.prependTo(uiDialog),
|
868 |
-
|
869 |
-
uiDialogTitlebarClose = $('<a href="#"></a>')
|
870 |
-
.addClass(
|
871 |
-
'ui-dialog-titlebar-close ' +
|
872 |
-
'ui-corner-all'
|
873 |
-
)
|
874 |
-
.attr('role', 'button')
|
875 |
-
.hover(
|
876 |
-
function() {
|
877 |
-
uiDialogTitlebarClose.addClass('ui-state-hover');
|
878 |
-
},
|
879 |
-
function() {
|
880 |
-
uiDialogTitlebarClose.removeClass('ui-state-hover');
|
881 |
-
}
|
882 |
-
)
|
883 |
-
.focus(function() {
|
884 |
-
uiDialogTitlebarClose.addClass('ui-state-focus');
|
885 |
-
})
|
886 |
-
.blur(function() {
|
887 |
-
uiDialogTitlebarClose.removeClass('ui-state-focus');
|
888 |
-
})
|
889 |
-
.click(function(event) {
|
890 |
-
self.close(event);
|
891 |
-
return false;
|
892 |
-
})
|
893 |
-
.appendTo(uiDialogTitlebar),
|
894 |
-
|
895 |
-
uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))
|
896 |
-
.addClass(
|
897 |
-
'ui-icon ' +
|
898 |
-
'ui-icon-closethick'
|
899 |
-
)
|
900 |
-
.text(options.closeText)
|
901 |
-
.appendTo(uiDialogTitlebarClose),
|
902 |
-
|
903 |
-
uiDialogTitle = $('<span></span>')
|
904 |
-
.addClass('ui-dialog-title')
|
905 |
-
.attr('id', titleId)
|
906 |
-
.html(title)
|
907 |
-
.prependTo(uiDialogTitlebar);
|
908 |
-
|
909 |
-
//handling of deprecated beforeclose (vs beforeClose) option
|
910 |
-
//Ticket #4669 http://dev.jqueryui.com/ticket/4669
|
911 |
-
//TODO: remove in 1.9pre
|
912 |
-
if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {
|
913 |
-
options.beforeClose = options.beforeclose;
|
914 |
-
}
|
915 |
-
|
916 |
-
uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
|
917 |
-
|
918 |
-
if (options.draggable && $.fn.draggable) {
|
919 |
-
self._makeDraggable();
|
920 |
-
}
|
921 |
-
if (options.resizable && $.fn.resizable) {
|
922 |
-
self._makeResizable();
|
923 |
-
}
|
924 |
-
|
925 |
-
self._createButtons(options.buttons);
|
926 |
-
self._isOpen = false;
|
927 |
-
|
928 |
-
if ($.fn.bgiframe) {
|
929 |
-
uiDialog.bgiframe();
|
930 |
-
}
|
931 |
-
},
|
932 |
-
|
933 |
-
_init: function() {
|
934 |
-
if ( this.options.autoOpen ) {
|
935 |
-
this.open();
|
936 |
-
}
|
937 |
-
},
|
938 |
-
|
939 |
-
destroy: function() {
|
940 |
-
var self = this;
|
941 |
-
|
942 |
-
if (self.overlay) {
|
943 |
-
self.overlay.destroy();
|
944 |
-
}
|
945 |
-
self.uiDialog.hide();
|
946 |
-
self.element
|
947 |
-
.unbind('.dialog')
|
948 |
-
.removeData('dialog')
|
949 |
-
.removeClass('ui-dialog-content ui-widget-content')
|
950 |
-
.hide().appendTo('body');
|
951 |
-
self.uiDialog.remove();
|
952 |
-
|
953 |
-
if (self.originalTitle) {
|
954 |
-
self.element.attr('title', self.originalTitle);
|
955 |
-
}
|
956 |
-
|
957 |
-
return self;
|
958 |
-
},
|
959 |
-
|
960 |
-
widget: function() {
|
961 |
-
return this.uiDialog;
|
962 |
-
},
|
963 |
-
|
964 |
-
close: function(event) {
|
965 |
-
var self = this,
|
966 |
-
maxZ;
|
967 |
-
|
968 |
-
if (false === self._trigger('beforeClose', event)) {
|
969 |
-
return;
|
970 |
-
}
|
971 |
-
|
972 |
-
if (self.overlay) {
|
973 |
-
self.overlay.destroy();
|
974 |
-
}
|
975 |
-
self.uiDialog.unbind('keypress.ui-dialog');
|
976 |
-
|
977 |
-
self._isOpen = false;
|
978 |
-
|
979 |
-
if (self.options.hide) {
|
980 |
-
self.uiDialog.hide(self.options.hide, function() {
|
981 |
-
self._trigger('close', event);
|
982 |
-
});
|
983 |
-
} else {
|
984 |
-
self.uiDialog.hide();
|
985 |
-
self._trigger('close', event);
|
986 |
-
}
|
987 |
-
|
988 |
-
$.ui.dialog.overlay.resize();
|
989 |
-
|
990 |
-
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
|
991 |
-
if (self.options.modal) {
|
992 |
-
maxZ = 0;
|
993 |
-
$('.ui-dialog').each(function() {
|
994 |
-
if (this !== self.uiDialog[0]) {
|
995 |
-
maxZ = Math.max(maxZ, $(this).css('z-index'));
|
996 |
-
}
|
997 |
-
});
|
998 |
-
$.ui.dialog.maxZ = maxZ;
|
999 |
-
}
|
1000 |
-
|
1001 |
-
return self;
|
1002 |
-
},
|
1003 |
-
|
1004 |
-
isOpen: function() {
|
1005 |
-
return this._isOpen;
|
1006 |
-
},
|
1007 |
-
|
1008 |
-
// the force parameter allows us to move modal dialogs to their correct
|
1009 |
-
// position on open
|
1010 |
-
moveToTop: function(force, event) {
|
1011 |
-
var self = this,
|
1012 |
-
options = self.options,
|
1013 |
-
saveScroll;
|
1014 |
-
|
1015 |
-
if ((options.modal && !force) ||
|
1016 |
-
(!options.stack && !options.modal)) {
|
1017 |
-
return self._trigger('focus', event);
|
1018 |
-
}
|
1019 |
-
|
1020 |
-
if (options.zIndex > $.ui.dialog.maxZ) {
|
1021 |
-
$.ui.dialog.maxZ = options.zIndex;
|
1022 |
-
}
|
1023 |
-
if (self.overlay) {
|
1024 |
-
$.ui.dialog.maxZ += 1;
|
1025 |
-
self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);
|
1026 |
-
}
|
1027 |
-
|
1028 |
-
//Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
|
1029 |
-
// http://ui.jquery.com/bugs/ticket/3193
|
1030 |
-
saveScroll = { scrollTop: self.element.attr('scrollTop'), scrollLeft: self.element.attr('scrollLeft') };
|
1031 |
-
$.ui.dialog.maxZ += 1;
|
1032 |
-
self.uiDialog.css('z-index', $.ui.dialog.maxZ);
|
1033 |
-
self.element.attr(saveScroll);
|
1034 |
-
self._trigger('focus', event);
|
1035 |
-
|
1036 |
-
return self;
|
1037 |
-
},
|
1038 |
-
|
1039 |
-
open: function() {
|
1040 |
-
if (this._isOpen) { return; }
|
1041 |
-
|
1042 |
-
var self = this,
|
1043 |
-
options = self.options,
|
1044 |
-
uiDialog = self.uiDialog;
|
1045 |
-
|
1046 |
-
self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
|
1047 |
-
if (uiDialog.next().length) {
|
1048 |
-
uiDialog.appendTo('body');
|
1049 |
-
}
|
1050 |
-
self._size();
|
1051 |
-
self._position(options.position);
|
1052 |
-
uiDialog.show(options.show);
|
1053 |
-
self.moveToTop(true);
|
1054 |
-
|
1055 |
-
// prevent tabbing out of modal dialogs
|
1056 |
-
if (options.modal) {
|
1057 |
-
uiDialog.bind('keypress.ui-dialog', function(event) {
|
1058 |
-
if (event.keyCode !== $.ui.keyCode.TAB) {
|
1059 |
-
return;
|
1060 |
-
}
|
1061 |
-
|
1062 |
-
var tabbables = $(':tabbable', this),
|
1063 |
-
first = tabbables.filter(':first'),
|
1064 |
-
last = tabbables.filter(':last');
|
1065 |
-
|
1066 |
-
if (event.target === last[0] && !event.shiftKey) {
|
1067 |
-
first.focus(1);
|
1068 |
-
return false;
|
1069 |
-
} else if (event.target === first[0] && event.shiftKey) {
|
1070 |
-
last.focus(1);
|
1071 |
-
return false;
|
1072 |
-
}
|
1073 |
-
});
|
1074 |
-
}
|
1075 |
-
|
1076 |
-
// set focus to the first tabbable element in the content area or the first button
|
1077 |
-
// if there are no tabbable elements, set focus on the dialog itself
|
1078 |
-
$(self.element.find(':tabbable').get().concat(
|
1079 |
-
uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
|
1080 |
-
uiDialog.get()))).eq(0).focus();
|
1081 |
-
|
1082 |
-
self._trigger('open');
|
1083 |
-
self._isOpen = true;
|
1084 |
-
|
1085 |
-
return self;
|
1086 |
-
},
|
1087 |
-
|
1088 |
-
_createButtons: function(buttons) {
|
1089 |
-
var self = this,
|
1090 |
-
hasButtons = false,
|
1091 |
-
uiDialogButtonPane = $('<div></div>')
|
1092 |
-
.addClass(
|
1093 |
-
'ui-dialog-buttonpane ' +
|
1094 |
-
'ui-widget-content ' +
|
1095 |
-
'ui-helper-clearfix'
|
1096 |
-
),
|
1097 |
-
uiButtonSet = $( "<div></div>" )
|
1098 |
-
.addClass( "ui-dialog-buttonset" )
|
1099 |
-
.appendTo( uiDialogButtonPane );
|
1100 |
-
|
1101 |
-
// if we already have a button pane, remove it
|
1102 |
-
self.uiDialog.find('.ui-dialog-buttonpane').remove();
|
1103 |
-
|
1104 |
-
if (typeof buttons === 'object' && buttons !== null) {
|
1105 |
-
$.each(buttons, function() {
|
1106 |
-
return !(hasButtons = true);
|
1107 |
-
});
|
1108 |
-
}
|
1109 |
-
if (hasButtons) {
|
1110 |
-
$.each(buttons, function(name, fn) {
|
1111 |
-
var button = $('<button type="button"></button>')
|
1112 |
-
.text(name)
|
1113 |
-
.click(function() { fn.apply(self.element[0], arguments); })
|
1114 |
-
.appendTo(uiButtonSet);
|
1115 |
-
if ($.fn.button) {
|
1116 |
-
button.button();
|
1117 |
-
}
|
1118 |
-
});
|
1119 |
-
uiDialogButtonPane.appendTo(self.uiDialog);
|
1120 |
-
}
|
1121 |
-
},
|
1122 |
-
|
1123 |
-
_makeDraggable: function() {
|
1124 |
-
var self = this,
|
1125 |
-
options = self.options,
|
1126 |
-
doc = $(document),
|
1127 |
-
heightBeforeDrag;
|
1128 |
-
|
1129 |
-
function filteredUi(ui) {
|
1130 |
-
return {
|
1131 |
-
position: ui.position,
|
1132 |
-
offset: ui.offset
|
1133 |
-
};
|
1134 |
-
}
|
1135 |
-
|
1136 |
-
self.uiDialog.draggable({
|
1137 |
-
cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
|
1138 |
-
handle: '.ui-dialog-titlebar',
|
1139 |
-
containment: 'document',
|
1140 |
-
start: function(event, ui) {
|
1141 |
-
heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
|
1142 |
-
$(this).height($(this).height()).addClass("ui-dialog-dragging");
|
1143 |
-
self._trigger('dragStart', event, filteredUi(ui));
|
1144 |
-
},
|
1145 |
-
drag: function(event, ui) {
|
1146 |
-
self._trigger('drag', event, filteredUi(ui));
|
1147 |
-
},
|
1148 |
-
stop: function(event, ui) {
|
1149 |
-
options.position = [ui.position.left - doc.scrollLeft(),
|
1150 |
-
ui.position.top - doc.scrollTop()];
|
1151 |
-
$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
|
1152 |
-
self._trigger('dragStop', event, filteredUi(ui));
|
1153 |
-
$.ui.dialog.overlay.resize();
|
1154 |
-
}
|
1155 |
-
});
|
1156 |
-
},
|
1157 |
-
|
1158 |
-
_makeResizable: function(handles) {
|
1159 |
-
handles = (handles === undefined ? this.options.resizable : handles);
|
1160 |
-
var self = this,
|
1161 |
-
options = self.options,
|
1162 |
-
// .ui-resizable has position: relative defined in the stylesheet
|
1163 |
-
// but dialogs have to use absolute or fixed positioning
|
1164 |
-
position = self.uiDialog.css('position'),
|
1165 |
-
resizeHandles = (typeof handles === 'string' ?
|
1166 |
-
handles :
|
1167 |
-
'n,e,s,w,se,sw,ne,nw'
|
1168 |
-
);
|
1169 |
-
|
1170 |
-
function filteredUi(ui) {
|
1171 |
-
return {
|
1172 |
-
originalPosition: ui.originalPosition,
|
1173 |
-
originalSize: ui.originalSize,
|
1174 |
-
position: ui.position,
|
1175 |
-
size: ui.size
|
1176 |
-
};
|
1177 |
-
}
|
1178 |
-
|
1179 |
-
self.uiDialog.resizable({
|
1180 |
-
cancel: '.ui-dialog-content',
|
1181 |
-
containment: 'document',
|
1182 |
-
alsoResize: self.element,
|
1183 |
-
maxWidth: options.maxWidth,
|
1184 |
-
maxHeight: options.maxHeight,
|
1185 |
-
minWidth: options.minWidth,
|
1186 |
-
minHeight: self._minHeight(),
|
1187 |
-
handles: resizeHandles,
|
1188 |
-
start: function(event, ui) {
|
1189 |
-
$(this).addClass("ui-dialog-resizing");
|
1190 |
-
self._trigger('resizeStart', event, filteredUi(ui));
|
1191 |
-
},
|
1192 |
-
resize: function(event, ui) {
|
1193 |
-
self._trigger('resize', event, filteredUi(ui));
|
1194 |
-
},
|
1195 |
-
stop: function(event, ui) {
|
1196 |
-
$(this).removeClass("ui-dialog-resizing");
|
1197 |
-
options.height = $(this).height();
|
1198 |
-
options.width = $(this).width();
|
1199 |
-
self._trigger('resizeStop', event, filteredUi(ui));
|
1200 |
-
$.ui.dialog.overlay.resize();
|
1201 |
-
}
|
1202 |
-
})
|
1203 |
-
.css('position', position)
|
1204 |
-
.find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
|
1205 |
-
},
|
1206 |
-
|
1207 |
-
_minHeight: function() {
|
1208 |
-
var options = this.options;
|
1209 |
-
|
1210 |
-
if (options.height === 'auto') {
|
1211 |
-
return options.minHeight;
|
1212 |
-
} else {
|
1213 |
-
return Math.min(options.minHeight, options.height);
|
1214 |
-
}
|
1215 |
-
},
|
1216 |
-
|
1217 |
-
_position: function(position) {
|
1218 |
-
var myAt = [],
|
1219 |
-
offset = [0, 0],
|
1220 |
-
isVisible;
|
1221 |
-
|
1222 |
-
if (position) {
|
1223 |
-
// deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
|
1224 |
-
// if (typeof position == 'string' || $.isArray(position)) {
|
1225 |
-
// myAt = $.isArray(position) ? position : position.split(' ');
|
1226 |
-
|
1227 |
-
if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
|
1228 |
-
myAt = position.split ? position.split(' ') : [position[0], position[1]];
|
1229 |
-
if (myAt.length === 1) {
|
1230 |
-
myAt[1] = myAt[0];
|
1231 |
-
}
|
1232 |
-
|
1233 |
-
$.each(['left', 'top'], function(i, offsetPosition) {
|
1234 |
-
if (+myAt[i] === myAt[i]) {
|
1235 |
-
offset[i] = myAt[i];
|
1236 |
-
myAt[i] = offsetPosition;
|
1237 |
-
}
|
1238 |
-
});
|
1239 |
-
|
1240 |
-
position = {
|
1241 |
-
my: myAt.join(" "),
|
1242 |
-
at: myAt.join(" "),
|
1243 |
-
offset: offset.join(" ")
|
1244 |
-
};
|
1245 |
-
}
|
1246 |
-
|
1247 |
-
position = $.extend({}, $.ui.dialog.prototype.options.position, position);
|
1248 |
-
} else {
|
1249 |
-
position = $.ui.dialog.prototype.options.position;
|
1250 |
-
}
|
1251 |
-
|
1252 |
-
// need to show the dialog to get the actual offset in the position plugin
|
1253 |
-
isVisible = this.uiDialog.is(':visible');
|
1254 |
-
if (!isVisible) {
|
1255 |
-
this.uiDialog.show();
|
1256 |
-
}
|
1257 |
-
this.uiDialog
|
1258 |
-
// workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
|
1259 |
-
.css({ top: 0, left: 0 })
|
1260 |
-
.position(position);
|
1261 |
-
if (!isVisible) {
|
1262 |
-
this.uiDialog.hide();
|
1263 |
-
}
|
1264 |
-
},
|
1265 |
-
|
1266 |
-
_setOption: function(key, value){
|
1267 |
-
var self = this,
|
1268 |
-
uiDialog = self.uiDialog,
|
1269 |
-
isResizable = uiDialog.is(':data(resizable)'),
|
1270 |
-
resize = false;
|
1271 |
-
|
1272 |
-
switch (key) {
|
1273 |
-
//handling of deprecated beforeclose (vs beforeClose) option
|
1274 |
-
//Ticket #4669 http://dev.jqueryui.com/ticket/4669
|
1275 |
-
//TODO: remove in 1.9pre
|
1276 |
-
case "beforeclose":
|
1277 |
-
key = "beforeClose";
|
1278 |
-
break;
|
1279 |
-
case "buttons":
|
1280 |
-
self._createButtons(value);
|
1281 |
-
resize = true;
|
1282 |
-
break;
|
1283 |
-
case "closeText":
|
1284 |
-
// convert whatever was passed in to a string, for text() to not throw up
|
1285 |
-
self.uiDialogTitlebarCloseText.text("" + value);
|
1286 |
-
break;
|
1287 |
-
case "dialogClass":
|
1288 |
-
uiDialog
|
1289 |
-
.removeClass(self.options.dialogClass)
|
1290 |
-
.addClass(uiDialogClasses + value);
|
1291 |
-
break;
|
1292 |
-
case "disabled":
|
1293 |
-
if (value) {
|
1294 |
-
uiDialog.addClass('ui-dialog-disabled');
|
1295 |
-
} else {
|
1296 |
-
uiDialog.removeClass('ui-dialog-disabled');
|
1297 |
-
}
|
1298 |
-
break;
|
1299 |
-
case "draggable":
|
1300 |
-
if (value) {
|
1301 |
-
self._makeDraggable();
|
1302 |
-
} else {
|
1303 |
-
uiDialog.draggable('destroy');
|
1304 |
-
}
|
1305 |
-
break;
|
1306 |
-
case "height":
|
1307 |
-
resize = true;
|
1308 |
-
break;
|
1309 |
-
case "maxHeight":
|
1310 |
-
if (isResizable) {
|
1311 |
-
uiDialog.resizable('option', 'maxHeight', value);
|
1312 |
-
}
|
1313 |
-
resize = true;
|
1314 |
-
break;
|
1315 |
-
case "maxWidth":
|
1316 |
-
if (isResizable) {
|
1317 |
-
uiDialog.resizable('option', 'maxWidth', value);
|
1318 |
-
}
|
1319 |
-
resize = true;
|
1320 |
-
break;
|
1321 |
-
case "minHeight":
|
1322 |
-
if (isResizable) {
|
1323 |
-
uiDialog.resizable('option', 'minHeight', value);
|
1324 |
-
}
|
1325 |
-
resize = true;
|
1326 |
-
break;
|
1327 |
-
case "minWidth":
|
1328 |
-
if (isResizable) {
|
1329 |
-
uiDialog.resizable('option', 'minWidth', value);
|
1330 |
-
}
|
1331 |
-
resize = true;
|
1332 |
-
break;
|
1333 |
-
case "position":
|
1334 |
-
self._position(value);
|
1335 |
-
break;
|
1336 |
-
case "resizable":
|
1337 |
-
// currently resizable, becoming non-resizable
|
1338 |
-
if (isResizable && !value) {
|
1339 |
-
uiDialog.resizable('destroy');
|
1340 |
-
}
|
1341 |
-
|
1342 |
-
// currently resizable, changing handles
|
1343 |
-
if (isResizable && typeof value === 'string') {
|
1344 |
-
uiDialog.resizable('option', 'handles', value);
|
1345 |
-
}
|
1346 |
-
|
1347 |
-
// currently non-resizable, becoming resizable
|
1348 |
-
if (!isResizable && value !== false) {
|
1349 |
-
self._makeResizable(value);
|
1350 |
-
}
|
1351 |
-
break;
|
1352 |
-
case "title":
|
1353 |
-
// convert whatever was passed in o a string, for html() to not throw up
|
1354 |
-
$(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || ' '));
|
1355 |
-
break;
|
1356 |
-
case "width":
|
1357 |
-
resize = true;
|
1358 |
-
break;
|
1359 |
-
}
|
1360 |
-
|
1361 |
-
$.Widget.prototype._setOption.apply(self, arguments);
|
1362 |
-
if (resize) {
|
1363 |
-
self._size();
|
1364 |
-
}
|
1365 |
-
},
|
1366 |
-
|
1367 |
-
_size: function() {
|
1368 |
-
/* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
|
1369 |
-
* divs will both have width and height set, so we need to reset them
|
1370 |
-
*/
|
1371 |
-
var options = this.options,
|
1372 |
-
nonContentHeight;
|
1373 |
-
|
1374 |
-
// reset content sizing
|
1375 |
-
// hide for non content measurement because height: 0 doesn't work in IE quirks mode (see #4350)
|
1376 |
-
this.element.css({
|
1377 |
-
width: 'auto',
|
1378 |
-
minHeight: 0,
|
1379 |
-
height: 0
|
1380 |
-
});
|
1381 |
-
|
1382 |
-
if (options.minWidth > options.width) {
|
1383 |
-
options.width = options.minWidth;
|
1384 |
-
}
|
1385 |
-
|
1386 |
-
// reset wrapper sizing
|
1387 |
-
// determine the height of all the non-content elements
|
1388 |
-
nonContentHeight = this.uiDialog.css({
|
1389 |
-
height: 'auto',
|
1390 |
-
width: options.width
|
1391 |
-
})
|
1392 |
-
.height();
|
1393 |
-
|
1394 |
-
this.element
|
1395 |
-
.css(options.height === 'auto' ? {
|
1396 |
-
minHeight: Math.max(options.minHeight - nonContentHeight, 0),
|
1397 |
-
height: 'auto'
|
1398 |
-
} : {
|
1399 |
-
minHeight: 0,
|
1400 |
-
height: Math.max(options.height - nonContentHeight, 0)
|
1401 |
-
})
|
1402 |
-
.show();
|
1403 |
-
|
1404 |
-
if (this.uiDialog.is(':data(resizable)')) {
|
1405 |
-
this.uiDialog.resizable('option', 'minHeight', this._minHeight());
|
1406 |
-
}
|
1407 |
-
}
|
1408 |
-
});
|
1409 |
-
|
1410 |
-
$.extend($.ui.dialog, {
|
1411 |
-
version: "1.8.4",
|
1412 |
-
|
1413 |
-
uuid: 0,
|
1414 |
-
maxZ: 0,
|
1415 |
-
|
1416 |
-
getTitleId: function($el) {
|
1417 |
-
var id = $el.attr('id');
|
1418 |
-
if (!id) {
|
1419 |
-
this.uuid += 1;
|
1420 |
-
id = this.uuid;
|
1421 |
-
}
|
1422 |
-
return 'ui-dialog-title-' + id;
|
1423 |
-
},
|
1424 |
-
|
1425 |
-
overlay: function(dialog) {
|
1426 |
-
this.$el = $.ui.dialog.overlay.create(dialog);
|
1427 |
-
}
|
1428 |
-
});
|
1429 |
-
|
1430 |
-
$.extend($.ui.dialog.overlay, {
|
1431 |
-
instances: [],
|
1432 |
-
// reuse old instances due to IE memory leak with alpha transparency (see #5185)
|
1433 |
-
oldInstances: [],
|
1434 |
-
maxZ: 0,
|
1435 |
-
events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
|
1436 |
-
function(event) { return event + '.dialog-overlay'; }).join(' '),
|
1437 |
-
create: function(dialog) {
|
1438 |
-
if (this.instances.length === 0) {
|
1439 |
-
// prevent use of anchors and inputs
|
1440 |
-
// we use a setTimeout in case the overlay is created from an
|
1441 |
-
// event that we're going to be cancelling (see #2804)
|
1442 |
-
setTimeout(function() {
|
1443 |
-
// handle $(el).dialog().dialog('close') (see #4065)
|
1444 |
-
if ($.ui.dialog.overlay.instances.length) {
|
1445 |
-
$(document).bind($.ui.dialog.overlay.events, function(event) {
|
1446 |
-
// stop events if the z-index of the target is < the z-index of the overlay
|
1447 |
-
return ($(event.target).zIndex() >= $.ui.dialog.overlay.maxZ);
|
1448 |
-
});
|
1449 |
-
}
|
1450 |
-
}, 1);
|
1451 |
-
|
1452 |
-
// allow closing by pressing the escape key
|
1453 |
-
$(document).bind('keydown.dialog-overlay', function(event) {
|
1454 |
-
if (dialog.options.closeOnEscape && event.keyCode &&
|
1455 |
-
event.keyCode === $.ui.keyCode.ESCAPE) {
|
1456 |
-
|
1457 |
-
dialog.close(event);
|
1458 |
-
event.preventDefault();
|
1459 |
-
}
|
1460 |
-
});
|
1461 |
-
|
1462 |
-
// handle window resize
|
1463 |
-
$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
|
1464 |
-
}
|
1465 |
-
|
1466 |
-
var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))
|
1467 |
-
.appendTo(document.body)
|
1468 |
-
.css({
|
1469 |
-
width: this.width(),
|
1470 |
-
height: this.height()
|
1471 |
-
});
|
1472 |
-
|
1473 |
-
if ($.fn.bgiframe) {
|
1474 |
-
$el.bgiframe();
|
1475 |
-
}
|
1476 |
-
|
1477 |
-
this.instances.push($el);
|
1478 |
-
return $el;
|
1479 |
-
},
|
1480 |
-
|
1481 |
-
destroy: function($el) {
|
1482 |
-
this.oldInstances.push(this.instances.splice($.inArray($el, this.instances), 1)[0]);
|
1483 |
-
|
1484 |
-
if (this.instances.length === 0) {
|
1485 |
-
$([document, window]).unbind('.dialog-overlay');
|
1486 |
-
}
|
1487 |
-
|
1488 |
-
$el.remove();
|
1489 |
-
|
1490 |
-
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
|
1491 |
-
var maxZ = 0;
|
1492 |
-
$.each(this.instances, function() {
|
1493 |
-
maxZ = Math.max(maxZ, this.css('z-index'));
|
1494 |
-
});
|
1495 |
-
this.maxZ = maxZ;
|
1496 |
-
},
|
1497 |
-
|
1498 |
-
height: function() {
|
1499 |
-
var scrollHeight,
|
1500 |
-
offsetHeight;
|
1501 |
-
// handle IE 6
|
1502 |
-
if ($.browser.msie && $.browser.version < 7) {
|
1503 |
-
scrollHeight = Math.max(
|
1504 |
-
document.documentElement.scrollHeight,
|
1505 |
-
document.body.scrollHeight
|
1506 |
-
);
|
1507 |
-
offsetHeight = Math.max(
|
1508 |
-
document.documentElement.offsetHeight,
|
1509 |
-
document.body.offsetHeight
|
1510 |
-
);
|
1511 |
-
|
1512 |
-
if (scrollHeight < offsetHeight) {
|
1513 |
-
return $(window).height() + 'px';
|
1514 |
-
} else {
|
1515 |
-
return scrollHeight + 'px';
|
1516 |
-
}
|
1517 |
-
// handle "good" browsers
|
1518 |
-
} else {
|
1519 |
-
return $(document).height() + 'px';
|
1520 |
-
}
|
1521 |
-
},
|
1522 |
-
|
1523 |
-
width: function() {
|
1524 |
-
var scrollWidth,
|
1525 |
-
offsetWidth;
|
1526 |
-
// handle IE 6
|
1527 |
-
if ($.browser.msie && $.browser.version < 7) {
|
1528 |
-
scrollWidth = Math.max(
|
1529 |
-
document.documentElement.scrollWidth,
|
1530 |
-
document.body.scrollWidth
|
1531 |
-
);
|
1532 |
-
offsetWidth = Math.max(
|
1533 |
-
document.documentElement.offsetWidth,
|
1534 |
-
document.body.offsetWidth
|
1535 |
-
);
|
1536 |
-
|
1537 |
-
if (scrollWidth < offsetWidth) {
|
1538 |
-
return $(window).width() + 'px';
|
1539 |
-
} else {
|
1540 |
-
return scrollWidth + 'px';
|
1541 |
-
}
|
1542 |
-
// handle "good" browsers
|
1543 |
-
} else {
|
1544 |
-
return $(document).width() + 'px';
|
1545 |
-
}
|
1546 |
-
},
|
1547 |
-
|
1548 |
-
resize: function() {
|
1549 |
-
/* If the dialog is draggable and the user drags it past the
|
1550 |
-
* right edge of the window, the document becomes wider so we
|
1551 |
-
* need to stretch the overlay. If the user then drags the
|
1552 |
-
* dialog back to the left, the document will become narrower,
|
1553 |
-
* so we need to shrink the overlay to the appropriate size.
|
1554 |
-
* This is handled by shrinking the overlay before setting it
|
1555 |
-
* to the full document size.
|
1556 |
-
*/
|
1557 |
-
var $overlays = $([]);
|
1558 |
-
$.each($.ui.dialog.overlay.instances, function() {
|
1559 |
-
$overlays = $overlays.add(this);
|
1560 |
-
});
|
1561 |
-
|
1562 |
-
$overlays.css({
|
1563 |
-
width: 0,
|
1564 |
-
height: 0
|
1565 |
-
}).css({
|
1566 |
-
width: $.ui.dialog.overlay.width(),
|
1567 |
-
height: $.ui.dialog.overlay.height()
|
1568 |
-
});
|
1569 |
-
}
|
1570 |
-
});
|
1571 |
-
|
1572 |
-
$.extend($.ui.dialog.overlay.prototype, {
|
1573 |
-
destroy: function() {
|
1574 |
-
$.ui.dialog.overlay.destroy(this.$el);
|
1575 |
-
}
|
1576 |
-
});
|
1577 |
-
|
1578 |
-
}(jQuery));
|
1 |
+
/*!
|
2 |
+
* jQuery UI 1.8.4
|
3 |
+
*
|
4 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
* http://jquery.org/license
|
7 |
+
*
|
8 |
+
* http://docs.jquery.com/UI
|
9 |
+
*/
|
10 |
+
(function( $, undefined ) {
|
11 |
+
|
12 |
+
// prevent duplicate loading
|
13 |
+
// this is only a problem because we proxy existing functions
|
14 |
+
// and we don't want to double proxy them
|
15 |
+
$.ui = $.ui || {};
|
16 |
+
if ( $.ui.version ) {
|
17 |
+
return;
|
18 |
+
}
|
19 |
+
|
20 |
+
//Helper functions and ui object
|
21 |
+
$.extend( $.ui, {
|
22 |
+
version: "1.8.4",
|
23 |
+
|
24 |
+
// $.ui.plugin is deprecated. Use the proxy pattern instead.
|
25 |
+
plugin: {
|
26 |
+
add: function( module, option, set ) {
|
27 |
+
var proto = $.ui[ module ].prototype;
|
28 |
+
for ( var i in set ) {
|
29 |
+
proto.plugins[ i ] = proto.plugins[ i ] || [];
|
30 |
+
proto.plugins[ i ].push( [ option, set[ i ] ] );
|
31 |
+
}
|
32 |
+
},
|
33 |
+
call: function( instance, name, args ) {
|
34 |
+
var set = instance.plugins[ name ];
|
35 |
+
if ( !set || !instance.element[ 0 ].parentNode ) {
|
36 |
+
return;
|
37 |
+
}
|
38 |
+
|
39 |
+
for ( var i = 0; i < set.length; i++ ) {
|
40 |
+
if ( instance.options[ set[ i ][ 0 ] ] ) {
|
41 |
+
set[ i ][ 1 ].apply( instance.element, args );
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
},
|
46 |
+
|
47 |
+
contains: function( a, b ) {
|
48 |
+
return document.compareDocumentPosition ?
|
49 |
+
a.compareDocumentPosition( b ) & 16 :
|
50 |
+
a !== b && a.contains( b );
|
51 |
+
},
|
52 |
+
|
53 |
+
hasScroll: function( el, a ) {
|
54 |
+
|
55 |
+
//If overflow is hidden, the element might have extra content, but the user wants to hide it
|
56 |
+
if ( $( el ).css( "overflow" ) === "hidden") {
|
57 |
+
return false;
|
58 |
+
}
|
59 |
+
|
60 |
+
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
|
61 |
+
has = false;
|
62 |
+
|
63 |
+
if ( el[ scroll ] > 0 ) {
|
64 |
+
return true;
|
65 |
+
}
|
66 |
+
|
67 |
+
// TODO: determine which cases actually cause this to happen
|
68 |
+
// if the element doesn't have the scroll set, see if it's possible to
|
69 |
+
// set the scroll
|
70 |
+
el[ scroll ] = 1;
|
71 |
+
has = ( el[ scroll ] > 0 );
|
72 |
+
el[ scroll ] = 0;
|
73 |
+
return has;
|
74 |
+
},
|
75 |
+
|
76 |
+
isOverAxis: function( x, reference, size ) {
|
77 |
+
//Determines when x coordinate is over "b" element axis
|
78 |
+
return ( x > reference ) && ( x < ( reference + size ) );
|
79 |
+
},
|
80 |
+
|
81 |
+
isOver: function( y, x, top, left, height, width ) {
|
82 |
+
//Determines when x, y coordinates is over "b" element
|
83 |
+
return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
|
84 |
+
},
|
85 |
+
|
86 |
+
keyCode: {
|
87 |
+
ALT: 18,
|
88 |
+
BACKSPACE: 8,
|
89 |
+
CAPS_LOCK: 20,
|
90 |
+
COMMA: 188,
|
91 |
+
COMMAND: 91,
|
92 |
+
COMMAND_LEFT: 91, // COMMAND
|
93 |
+
COMMAND_RIGHT: 93,
|
94 |
+
CONTROL: 17,
|
95 |
+
DELETE: 46,
|
96 |
+
DOWN: 40,
|
97 |
+
END: 35,
|
98 |
+
ENTER: 13,
|
99 |
+
ESCAPE: 27,
|
100 |
+
HOME: 36,
|
101 |
+
INSERT: 45,
|
102 |
+
LEFT: 37,
|
103 |
+
MENU: 93, // COMMAND_RIGHT
|
104 |
+
NUMPAD_ADD: 107,
|
105 |
+
NUMPAD_DECIMAL: 110,
|
106 |
+
NUMPAD_DIVIDE: 111,
|
107 |
+
NUMPAD_ENTER: 108,
|
108 |
+
NUMPAD_MULTIPLY: 106,
|
109 |
+
NUMPAD_SUBTRACT: 109,
|
110 |
+
PAGE_DOWN: 34,
|
111 |
+
PAGE_UP: 33,
|
112 |
+
PERIOD: 190,
|
113 |
+
RIGHT: 39,
|
114 |
+
SHIFT: 16,
|
115 |
+
SPACE: 32,
|
116 |
+
TAB: 9,
|
117 |
+
UP: 38,
|
118 |
+
WINDOWS: 91 // COMMAND
|
119 |
+
}
|
120 |
+
});
|
121 |
+
|
122 |
+
//jQuery plugins
|
123 |
+
$.fn.extend({
|
124 |
+
_focus: $.fn.focus,
|
125 |
+
focus: function( delay, fn ) {
|
126 |
+
return typeof delay === "number" ?
|
127 |
+
this.each(function() {
|
128 |
+
var elem = this;
|
129 |
+
setTimeout(function() {
|
130 |
+
$( elem ).focus();
|
131 |
+
if ( fn ) {
|
132 |
+
fn.call( elem );
|
133 |
+
}
|
134 |
+
}, delay );
|
135 |
+
}) :
|
136 |
+
this._focus.apply( this, arguments );
|
137 |
+
},
|
138 |
+
|
139 |
+
enableSelection: function() {
|
140 |
+
return this
|
141 |
+
.attr( "unselectable", "off" )
|
142 |
+
.css( "MozUserSelect", "" );
|
143 |
+
},
|
144 |
+
|
145 |
+
disableSelection: function() {
|
146 |
+
return this
|
147 |
+
.attr( "unselectable", "on" )
|
148 |
+
.css( "MozUserSelect", "none" );
|
149 |
+
},
|
150 |
+
|
151 |
+
scrollParent: function() {
|
152 |
+
var scrollParent;
|
153 |
+
if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
|
154 |
+
scrollParent = this.parents().filter(function() {
|
155 |
+
return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
|
156 |
+
}).eq(0);
|
157 |
+
} else {
|
158 |
+
scrollParent = this.parents().filter(function() {
|
159 |
+
return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
|
160 |
+
}).eq(0);
|
161 |
+
}
|
162 |
+
|
163 |
+
return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
|
164 |
+
},
|
165 |
+
|
166 |
+
zIndex: function( zIndex ) {
|
167 |
+
if ( zIndex !== undefined ) {
|
168 |
+
return this.css( "zIndex", zIndex );
|
169 |
+
}
|
170 |
+
|
171 |
+
if ( this.length ) {
|
172 |
+
var elem = $( this[ 0 ] ), position, value;
|
173 |
+
while ( elem.length && elem[ 0 ] !== document ) {
|
174 |
+
// Ignore z-index if position is set to a value where z-index is ignored by the browser
|
175 |
+
// This makes behavior of this function consistent across browsers
|
176 |
+
// WebKit always returns auto if the element is positioned
|
177 |
+
position = elem.css( "position" );
|
178 |
+
if ( position === "absolute" || position === "relative" || position === "fixed" ) {
|
179 |
+
// IE returns 0 when zIndex is not specified
|
180 |
+
// other browsers return a string
|
181 |
+
// we ignore the case of nested elements with an explicit value of 0
|
182 |
+
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
|
183 |
+
value = parseInt( elem.css( "zIndex" ) );
|
184 |
+
if ( !isNaN( value ) && value != 0 ) {
|
185 |
+
return value;
|
186 |
+
}
|
187 |
+
}
|
188 |
+
elem = elem.parent();
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
return 0;
|
193 |
+
}
|
194 |
+
});
|
195 |
+
|
196 |
+
$.each( [ "Width", "Height" ], function( i, name ) {
|
197 |
+
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
|
198 |
+
type = name.toLowerCase(),
|
199 |
+
orig = {
|
200 |
+
innerWidth: $.fn.innerWidth,
|
201 |
+
innerHeight: $.fn.innerHeight,
|
202 |
+
outerWidth: $.fn.outerWidth,
|
203 |
+
outerHeight: $.fn.outerHeight
|
204 |
+
};
|
205 |
+
|
206 |
+
function reduce( elem, size, border, margin ) {
|
207 |
+
$.each( side, function() {
|
208 |
+
size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
|
209 |
+
if ( border ) {
|
210 |
+
size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
|
211 |
+
}
|
212 |
+
if ( margin ) {
|
213 |
+
size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
|
214 |
+
}
|
215 |
+
});
|
216 |
+
return size;
|
217 |
+
}
|
218 |
+
|
219 |
+
$.fn[ "inner" + name ] = function( size ) {
|
220 |
+
if ( size === undefined ) {
|
221 |
+
return orig[ "inner" + name ].call( this );
|
222 |
+
}
|
223 |
+
|
224 |
+
return this.each(function() {
|
225 |
+
$.style( this, type, reduce( this, size ) + "px" );
|
226 |
+
});
|
227 |
+
};
|
228 |
+
|
229 |
+
$.fn[ "outer" + name] = function( size, margin ) {
|
230 |
+
if ( typeof size !== "number" ) {
|
231 |
+
return orig[ "outer" + name ].call( this, size );
|
232 |
+
}
|
233 |
+
|
234 |
+
return this.each(function() {
|
235 |
+
$.style( this, type, reduce( this, size, true, margin ) + "px" );
|
236 |
+
});
|
237 |
+
};
|
238 |
+
});
|
239 |
+
|
240 |
+
//Additional selectors
|
241 |
+
function visible( element ) {
|
242 |
+
return !$( element ).parents().andSelf().filter(function() {
|
243 |
+
return $.curCSS( this, "visibility" ) === "hidden" ||
|
244 |
+
$.expr.filters.hidden( this );
|
245 |
+
}).length;
|
246 |
+
}
|
247 |
+
|
248 |
+
$.extend( $.expr[ ":" ], {
|
249 |
+
data: function( elem, i, match ) {
|
250 |
+
return !!$.data( elem, match[ 3 ] );
|
251 |
+
},
|
252 |
+
|
253 |
+
focusable: function( element ) {
|
254 |
+
var nodeName = element.nodeName.toLowerCase(),
|
255 |
+
tabIndex = $.attr( element, "tabindex" );
|
256 |
+
if ( "area" === nodeName ) {
|
257 |
+
var map = element.parentNode,
|
258 |
+
mapName = map.name,
|
259 |
+
img;
|
260 |
+
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
|
261 |
+
return false;
|
262 |
+
}
|
263 |
+
img = $( "img[usemap=#" + mapName + "]" )[0];
|
264 |
+
return !!img && visible( img );
|
265 |
+
}
|
266 |
+
return ( /input|select|textarea|button|object/.test( nodeName )
|
267 |
+
? !element.disabled
|
268 |
+
: "a" == nodeName
|
269 |
+
? element.href || !isNaN( tabIndex )
|
270 |
+
: !isNaN( tabIndex ))
|
271 |
+
// the element and all of its ancestors must be visible
|
272 |
+
&& visible( element );
|
273 |
+
},
|
274 |
+
|
275 |
+
tabbable: function( element ) {
|
276 |
+
var tabIndex = $.attr( element, "tabindex" );
|
277 |
+
return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
|
278 |
+
}
|
279 |
+
});
|
280 |
+
|
281 |
+
})( jQuery );
|
282 |
+
/*!
|
283 |
+
* jQuery UI Widget 1.8.4
|
284 |
+
*
|
285 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
286 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
287 |
+
* http://jquery.org/license
|
288 |
+
*
|
289 |
+
* http://docs.jquery.com/UI/Widget
|
290 |
+
*/
|
291 |
+
(function( $, undefined ) {
|
292 |
+
|
293 |
+
var _remove = $.fn.remove;
|
294 |
+
|
295 |
+
$.fn.remove = function( selector, keepData ) {
|
296 |
+
return this.each(function() {
|
297 |
+
if ( !keepData ) {
|
298 |
+
if ( !selector || $.filter( selector, [ this ] ).length ) {
|
299 |
+
$( "*", this ).add( [ this ] ).each(function() {
|
300 |
+
$( this ).triggerHandler( "remove" );
|
301 |
+
});
|
302 |
+
}
|
303 |
+
}
|
304 |
+
return _remove.call( $(this), selector, keepData );
|
305 |
+
});
|
306 |
+
};
|
307 |
+
|
308 |
+
$.widget = function( name, base, prototype ) {
|
309 |
+
var namespace = name.split( "." )[ 0 ],
|
310 |
+
fullName;
|
311 |
+
name = name.split( "." )[ 1 ];
|
312 |
+
fullName = namespace + "-" + name;
|
313 |
+
|
314 |
+
if ( !prototype ) {
|
315 |
+
prototype = base;
|
316 |
+
base = $.Widget;
|
317 |
+
}
|
318 |
+
|
319 |
+
// create selector for plugin
|
320 |
+
$.expr[ ":" ][ fullName ] = function( elem ) {
|
321 |
+
return !!$.data( elem, name );
|
322 |
+
};
|
323 |
+
|
324 |
+
$[ namespace ] = $[ namespace ] || {};
|
325 |
+
$[ namespace ][ name ] = function( options, element ) {
|
326 |
+
// allow instantiation without initializing for simple inheritance
|
327 |
+
if ( arguments.length ) {
|
328 |
+
this._createWidget( options, element );
|
329 |
+
}
|
330 |
+
};
|
331 |
+
|
332 |
+
var basePrototype = new base();
|
333 |
+
// we need to make the options hash a property directly on the new instance
|
334 |
+
// otherwise we'll modify the options hash on the prototype that we're
|
335 |
+
// inheriting from
|
336 |
+
// $.each( basePrototype, function( key, val ) {
|
337 |
+
// if ( $.isPlainObject(val) ) {
|
338 |
+
// basePrototype[ key ] = $.extend( {}, val );
|
339 |
+
// }
|
340 |
+
// });
|
341 |
+
basePrototype.options = $.extend( true, {}, basePrototype.options );
|
342 |
+
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
|
343 |
+
namespace: namespace,
|
344 |
+
widgetName: name,
|
345 |
+
widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
|
346 |
+
widgetBaseClass: fullName
|
347 |
+
}, prototype );
|
348 |
+
|
349 |
+
$.widget.bridge( name, $[ namespace ][ name ] );
|
350 |
+
};
|
351 |
+
|
352 |
+
$.widget.bridge = function( name, object ) {
|
353 |
+
$.fn[ name ] = function( options ) {
|
354 |
+
var isMethodCall = typeof options === "string",
|
355 |
+
args = Array.prototype.slice.call( arguments, 1 ),
|
356 |
+
returnValue = this;
|
357 |
+
|
358 |
+
// allow multiple hashes to be passed on init
|
359 |
+
options = !isMethodCall && args.length ?
|
360 |
+
$.extend.apply( null, [ true, options ].concat(args) ) :
|
361 |
+
options;
|
362 |
+
|
363 |
+
// prevent calls to internal methods
|
364 |
+
if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
|
365 |
+
return returnValue;
|
366 |
+
}
|
367 |
+
|
368 |
+
if ( isMethodCall ) {
|
369 |
+
this.each(function() {
|
370 |
+
var instance = $.data( this, name ),
|
371 |
+
methodValue = instance && $.isFunction( instance[options] ) ?
|
372 |
+
instance[ options ].apply( instance, args ) :
|
373 |
+
instance;
|
374 |
+
if ( methodValue !== instance && methodValue !== undefined ) {
|
375 |
+
returnValue = methodValue;
|
376 |
+
return false;
|
377 |
+
}
|
378 |
+
});
|
379 |
+
} else {
|
380 |
+
this.each(function() {
|
381 |
+
var instance = $.data( this, name );
|
382 |
+
if ( instance ) {
|
383 |
+
if ( options ) {
|
384 |
+
instance.option( options );
|
385 |
+
}
|
386 |
+
instance._init();
|
387 |
+
} else {
|
388 |
+
$.data( this, name, new object( options, this ) );
|
389 |
+
}
|
390 |
+
});
|
391 |
+
}
|
392 |
+
|
393 |
+
return returnValue;
|
394 |
+
};
|
395 |
+
};
|
396 |
+
|
397 |
+
$.Widget = function( options, element ) {
|
398 |
+
// allow instantiation without initializing for simple inheritance
|
399 |
+
if ( arguments.length ) {
|
400 |
+
this._createWidget( options, element );
|
401 |
+
}
|
402 |
+
};
|
403 |
+
|
404 |
+
$.Widget.prototype = {
|
405 |
+
widgetName: "widget",
|
406 |
+
widgetEventPrefix: "",
|
407 |
+
options: {
|
408 |
+
disabled: false
|
409 |
+
},
|
410 |
+
_createWidget: function( options, element ) {
|
411 |
+
// $.widget.bridge stores the plugin instance, but we do it anyway
|
412 |
+
// so that it's stored even before the _create function runs
|
413 |
+
$.data( element, this.widgetName, this );
|
414 |
+
this.element = $( element );
|
415 |
+
this.options = $.extend( true, {},
|
416 |
+
this.options,
|
417 |
+
$.metadata && $.metadata.get( element )[ this.widgetName ],
|
418 |
+
options );
|
419 |
+
|
420 |
+
var self = this;
|
421 |
+
this.element.bind( "remove." + this.widgetName, function() {
|
422 |
+
self.destroy();
|
423 |
+
});
|
424 |
+
|
425 |
+
this._create();
|
426 |
+
this._init();
|
427 |
+
},
|
428 |
+
_create: function() {},
|
429 |
+
_init: function() {},
|
430 |
+
|
431 |
+
destroy: function() {
|
432 |
+
this.element
|
433 |
+
.unbind( "." + this.widgetName )
|
434 |
+
.removeData( this.widgetName );
|
435 |
+
this.widget()
|
436 |
+
.unbind( "." + this.widgetName )
|
437 |
+
.removeAttr( "aria-disabled" )
|
438 |
+
.removeClass(
|
439 |
+
this.widgetBaseClass + "-disabled " +
|
440 |
+
"ui-state-disabled" );
|
441 |
+
},
|
442 |
+
|
443 |
+
widget: function() {
|
444 |
+
return this.element;
|
445 |
+
},
|
446 |
+
|
447 |
+
option: function( key, value ) {
|
448 |
+
var options = key,
|
449 |
+
self = this;
|
450 |
+
|
451 |
+
if ( arguments.length === 0 ) {
|
452 |
+
// don't return a reference to the internal hash
|
453 |
+
return $.extend( {}, self.options );
|
454 |
+
}
|
455 |
+
|
456 |
+
if (typeof key === "string" ) {
|
457 |
+
if ( value === undefined ) {
|
458 |
+
return this.options[ key ];
|
459 |
+
}
|
460 |
+
options = {};
|
461 |
+
options[ key ] = value;
|
462 |
+
}
|
463 |
+
|
464 |
+
$.each( options, function( key, value ) {
|
465 |
+
self._setOption( key, value );
|
466 |
+
});
|
467 |
+
|
468 |
+
return self;
|
469 |
+
},
|
470 |
+
_setOption: function( key, value ) {
|
471 |
+
this.options[ key ] = value;
|
472 |
+
|
473 |
+
if ( key === "disabled" ) {
|
474 |
+
this.widget()
|
475 |
+
[ value ? "addClass" : "removeClass"](
|
476 |
+
this.widgetBaseClass + "-disabled" + " " +
|
477 |
+
"ui-state-disabled" )
|
478 |
+
.attr( "aria-disabled", value );
|
479 |
+
}
|
480 |
+
|
481 |
+
return this;
|
482 |
+
},
|
483 |
+
|
484 |
+
enable: function() {
|
485 |
+
return this._setOption( "disabled", false );
|
486 |
+
},
|
487 |
+
disable: function() {
|
488 |
+
return this._setOption( "disabled", true );
|
489 |
+
},
|
490 |
+
|
491 |
+
_trigger: function( type, event, data ) {
|
492 |
+
var callback = this.options[ type ];
|
493 |
+
|
494 |
+
event = $.Event( event );
|
495 |
+
event.type = ( type === this.widgetEventPrefix ?
|
496 |
+
type :
|
497 |
+
this.widgetEventPrefix + type ).toLowerCase();
|
498 |
+
data = data || {};
|
499 |
+
|
500 |
+
// copy original event properties over to the new event
|
501 |
+
// this would happen if we could call $.event.fix instead of $.Event
|
502 |
+
// but we don't have a way to force an event to be fixed multiple times
|
503 |
+
if ( event.originalEvent ) {
|
504 |
+
for ( var i = $.event.props.length, prop; i; ) {
|
505 |
+
prop = $.event.props[ --i ];
|
506 |
+
event[ prop ] = event.originalEvent[ prop ];
|
507 |
+
}
|
508 |
+
}
|
509 |
+
|
510 |
+
this.element.trigger( event, data );
|
511 |
+
|
512 |
+
return !( $.isFunction(callback) &&
|
513 |
+
callback.call( this.element[0], event, data ) === false ||
|
514 |
+
event.isDefaultPrevented() );
|
515 |
+
}
|
516 |
+
};
|
517 |
+
|
518 |
+
})( jQuery );
|
519 |
+
/*
|
520 |
+
* jQuery UI Position 1.8.4
|
521 |
+
*
|
522 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
523 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
524 |
+
* http://jquery.org/license
|
525 |
+
*
|
526 |
+
* http://docs.jquery.com/UI/Position
|
527 |
+
*/
|
528 |
+
(function( $, undefined ) {
|
529 |
+
|
530 |
+
$.ui = $.ui || {};
|
531 |
+
|
532 |
+
var horizontalPositions = /left|center|right/,
|
533 |
+
horizontalDefault = "center",
|
534 |
+
verticalPositions = /top|center|bottom/,
|
535 |
+
verticalDefault = "center",
|
536 |
+
_position = $.fn.position,
|
537 |
+
_offset = $.fn.offset;
|
538 |
+
|
539 |
+
$.fn.position = function( options ) {
|
540 |
+
if ( !options || !options.of ) {
|
541 |
+
return _position.apply( this, arguments );
|
542 |
+
}
|
543 |
+
|
544 |
+
// make a copy, we don't want to modify arguments
|
545 |
+
options = $.extend( {}, options );
|
546 |
+
|
547 |
+
var target = $( options.of ),
|
548 |
+
collision = ( options.collision || "flip" ).split( " " ),
|
549 |
+
offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
|
550 |
+
targetWidth,
|
551 |
+
targetHeight,
|
552 |
+
basePosition;
|
553 |
+
|
554 |
+
if ( options.of.nodeType === 9 ) {
|
555 |
+
targetWidth = target.width();
|
556 |
+
targetHeight = target.height();
|
557 |
+
basePosition = { top: 0, left: 0 };
|
558 |
+
} else if ( options.of.scrollTo && options.of.document ) {
|
559 |
+
targetWidth = target.width();
|
560 |
+
targetHeight = target.height();
|
561 |
+
basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
|
562 |
+
} else if ( options.of.preventDefault ) {
|
563 |
+
// force left top to allow flipping
|
564 |
+
options.at = "left top";
|
565 |
+
targetWidth = targetHeight = 0;
|
566 |
+
basePosition = { top: options.of.pageY, left: options.of.pageX };
|
567 |
+
} else {
|
568 |
+
targetWidth = target.outerWidth();
|
569 |
+
targetHeight = target.outerHeight();
|
570 |
+
basePosition = target.offset();
|
571 |
+
}
|
572 |
+
|
573 |
+
// force my and at to have valid horizontal and veritcal positions
|
574 |
+
// if a value is missing or invalid, it will be converted to center
|
575 |
+
$.each( [ "my", "at" ], function() {
|
576 |
+
var pos = ( options[this] || "" ).split( " " );
|
577 |
+
if ( pos.length === 1) {
|
578 |
+
pos = horizontalPositions.test( pos[0] ) ?
|
579 |
+
pos.concat( [verticalDefault] ) :
|
580 |
+
verticalPositions.test( pos[0] ) ?
|
581 |
+
[ horizontalDefault ].concat( pos ) :
|
582 |
+
[ horizontalDefault, verticalDefault ];
|
583 |
+
}
|
584 |
+
pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : horizontalDefault;
|
585 |
+
pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : verticalDefault;
|
586 |
+
options[ this ] = pos;
|
587 |
+
});
|
588 |
+
|
589 |
+
// normalize collision option
|
590 |
+
if ( collision.length === 1 ) {
|
591 |
+
collision[ 1 ] = collision[ 0 ];
|
592 |
+
}
|
593 |
+
|
594 |
+
// normalize offset option
|
595 |
+
offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
|
596 |
+
if ( offset.length === 1 ) {
|
597 |
+
offset[ 1 ] = offset[ 0 ];
|
598 |
+
}
|
599 |
+
offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
|
600 |
+
|
601 |
+
if ( options.at[0] === "right" ) {
|
602 |
+
basePosition.left += targetWidth;
|
603 |
+
} else if (options.at[0] === horizontalDefault ) {
|
604 |
+
basePosition.left += targetWidth / 2;
|
605 |
+
}
|
606 |
+
|
607 |
+
if ( options.at[1] === "bottom" ) {
|
608 |
+
basePosition.top += targetHeight;
|
609 |
+
} else if ( options.at[1] === verticalDefault ) {
|
610 |
+
basePosition.top += targetHeight / 2;
|
611 |
+
}
|
612 |
+
|
613 |
+
basePosition.left += offset[ 0 ];
|
614 |
+
basePosition.top += offset[ 1 ];
|
615 |
+
|
616 |
+
return this.each(function() {
|
617 |
+
var elem = $( this ),
|
618 |
+
elemWidth = elem.outerWidth(),
|
619 |
+
elemHeight = elem.outerHeight(),
|
620 |
+
position = $.extend( {}, basePosition );
|
621 |
+
|
622 |
+
if ( options.my[0] === "right" ) {
|
623 |
+
position.left -= elemWidth;
|
624 |
+
} else if ( options.my[0] === horizontalDefault ) {
|
625 |
+
position.left -= elemWidth / 2;
|
626 |
+
}
|
627 |
+
|
628 |
+
if ( options.my[1] === "bottom" ) {
|
629 |
+
position.top -= elemHeight;
|
630 |
+
} else if ( options.my[1] === verticalDefault ) {
|
631 |
+
position.top -= elemHeight / 2;
|
632 |
+
}
|
633 |
+
|
634 |
+
// prevent fractions (see #5280)
|
635 |
+
position.left = parseInt( position.left );
|
636 |
+
position.top = parseInt( position.top );
|
637 |
+
|
638 |
+
$.each( [ "left", "top" ], function( i, dir ) {
|
639 |
+
if ( $.ui.position[ collision[i] ] ) {
|
640 |
+
$.ui.position[ collision[i] ][ dir ]( position, {
|
641 |
+
targetWidth: targetWidth,
|
642 |
+
targetHeight: targetHeight,
|
643 |
+
elemWidth: elemWidth,
|
644 |
+
elemHeight: elemHeight,
|
645 |
+
offset: offset,
|
646 |
+
my: options.my,
|
647 |
+
at: options.at
|
648 |
+
});
|
649 |
+
}
|
650 |
+
});
|
651 |
+
|
652 |
+
if ( $.fn.bgiframe ) {
|
653 |
+
elem.bgiframe();
|
654 |
+
}
|
655 |
+
elem.offset( $.extend( position, { using: options.using } ) );
|
656 |
+
});
|
657 |
+
};
|
658 |
+
|
659 |
+
$.ui.position = {
|
660 |
+
fit: {
|
661 |
+
left: function( position, data ) {
|
662 |
+
var win = $( window ),
|
663 |
+
over = position.left + data.elemWidth - win.width() - win.scrollLeft();
|
664 |
+
position.left = over > 0 ? position.left - over : Math.max( 0, position.left );
|
665 |
+
},
|
666 |
+
top: function( position, data ) {
|
667 |
+
var win = $( window ),
|
668 |
+
over = position.top + data.elemHeight - win.height() - win.scrollTop();
|
669 |
+
position.top = over > 0 ? position.top - over : Math.max( 0, position.top );
|
670 |
+
}
|
671 |
+
},
|
672 |
+
|
673 |
+
flip: {
|
674 |
+
left: function( position, data ) {
|
675 |
+
if ( data.at[0] === "center" ) {
|
676 |
+
return;
|
677 |
+
}
|
678 |
+
var win = $( window ),
|
679 |
+
over = position.left + data.elemWidth - win.width() - win.scrollLeft(),
|
680 |
+
myOffset = data.my[ 0 ] === "left" ?
|
681 |
+
-data.elemWidth :
|
682 |
+
data.my[ 0 ] === "right" ?
|
683 |
+
data.elemWidth :
|
684 |
+
0,
|
685 |
+
offset = -2 * data.offset[ 0 ];
|
686 |
+
position.left += position.left < 0 ?
|
687 |
+
myOffset + data.targetWidth + offset :
|
688 |
+
over > 0 ?
|
689 |
+
myOffset - data.targetWidth + offset :
|
690 |
+
0;
|
691 |
+
},
|
692 |
+
top: function( position, data ) {
|
693 |
+
if ( data.at[1] === "center" ) {
|
694 |
+
return;
|
695 |
+
}
|
696 |
+
var win = $( window ),
|
697 |
+
over = position.top + data.elemHeight - win.height() - win.scrollTop(),
|
698 |
+
myOffset = data.my[ 1 ] === "top" ?
|
699 |
+
-data.elemHeight :
|
700 |
+
data.my[ 1 ] === "bottom" ?
|
701 |
+
data.elemHeight :
|
702 |
+
0,
|
703 |
+
atOffset = data.at[ 1 ] === "top" ?
|
704 |
+
data.targetHeight :
|
705 |
+
-data.targetHeight,
|
706 |
+
offset = -2 * data.offset[ 1 ];
|
707 |
+
position.top += position.top < 0 ?
|
708 |
+
myOffset + data.targetHeight + offset :
|
709 |
+
over > 0 ?
|
710 |
+
myOffset + atOffset + offset :
|
711 |
+
0;
|
712 |
+
}
|
713 |
+
}
|
714 |
+
};
|
715 |
+
|
716 |
+
// offset setter from jQuery 1.4
|
717 |
+
if ( !$.offset.setOffset ) {
|
718 |
+
$.offset.setOffset = function( elem, options ) {
|
719 |
+
// set position first, in-case top/left are set even on static elem
|
720 |
+
if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
|
721 |
+
elem.style.position = "relative";
|
722 |
+
}
|
723 |
+
var curElem = $( elem ),
|
724 |
+
curOffset = curElem.offset(),
|
725 |
+
curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
|
726 |
+
curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
|
727 |
+
props = {
|
728 |
+
top: (options.top - curOffset.top) + curTop,
|
729 |
+
left: (options.left - curOffset.left) + curLeft
|
730 |
+
};
|
731 |
+
|
732 |
+
if ( 'using' in options ) {
|
733 |
+
options.using.call( elem, props );
|
734 |
+
} else {
|
735 |
+
curElem.css( props );
|
736 |
+
}
|
737 |
+
};
|
738 |
+
|
739 |
+
$.fn.offset = function( options ) {
|
740 |
+
var elem = this[ 0 ];
|
741 |
+
if ( !elem || !elem.ownerDocument ) { return null; }
|
742 |
+
if ( options ) {
|
743 |
+
return this.each(function() {
|
744 |
+
$.offset.setOffset( this, options );
|
745 |
+
});
|
746 |
+
}
|
747 |
+
return _offset.call( this );
|
748 |
+
};
|
749 |
+
}
|
750 |
+
|
751 |
+
}( jQuery ));
|
752 |
+
/*
|
753 |
+
* jQuery UI Dialog 1.8.4
|
754 |
+
*
|
755 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
756 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
757 |
+
* http://jquery.org/license
|
758 |
+
*
|
759 |
+
* http://docs.jquery.com/UI/Dialog
|
760 |
+
*
|
761 |
+
* Depends:
|
762 |
+
* jquery.ui.core.js
|
763 |
+
* jquery.ui.widget.js
|
764 |
+
* jquery.ui.button.js
|
765 |
+
* jquery.ui.draggable.js
|
766 |
+
* jquery.ui.mouse.js
|
767 |
+
* jquery.ui.position.js
|
768 |
+
* jquery.ui.resizable.js
|
769 |
+
*/
|
770 |
+
(function( $, undefined ) {
|
771 |
+
|
772 |
+
var uiDialogClasses =
|
773 |
+
'ui-dialog ' +
|
774 |
+
'ui-widget ' +
|
775 |
+
'ui-widget-content ' +
|
776 |
+
'ui-corner-all ';
|
777 |
+
|
778 |
+
$.widget("ui.dialog", {
|
779 |
+
options: {
|
780 |
+
autoOpen: true,
|
781 |
+
buttons: {},
|
782 |
+
closeOnEscape: true,
|
783 |
+
closeText: 'close',
|
784 |
+
dialogClass: '',
|
785 |
+
draggable: true,
|
786 |
+
hide: null,
|
787 |
+
height: 'auto',
|
788 |
+
maxHeight: false,
|
789 |
+
maxWidth: false,
|
790 |
+
minHeight: 150,
|
791 |
+
minWidth: 150,
|
792 |
+
modal: false,
|
793 |
+
position: {
|
794 |
+
my: 'center',
|
795 |
+
at: 'center',
|
796 |
+
of: window,
|
797 |
+
collision: 'fit',
|
798 |
+
// ensure that the titlebar is never outside the document
|
799 |
+
using: function(pos) {
|
800 |
+
var topOffset = $(this).css(pos).offset().top;
|
801 |
+
if (topOffset < 0) {
|
802 |
+
$(this).css('top', pos.top - topOffset);
|
803 |
+
}
|
804 |
+
}
|
805 |
+
},
|
806 |
+
resizable: true,
|
807 |
+
show: null,
|
808 |
+
stack: true,
|
809 |
+
title: '',
|
810 |
+
width: 300,
|
811 |
+
zIndex: 1000
|
812 |
+
},
|
813 |
+
|
814 |
+
_create: function() {
|
815 |
+
this.originalTitle = this.element.attr('title');
|
816 |
+
// #5742 - .attr() might return a DOMElement
|
817 |
+
if ( typeof this.originalTitle !== "string" ) {
|
818 |
+
this.originalTitle = "";
|
819 |
+
}
|
820 |
+
|
821 |
+
var self = this,
|
822 |
+
options = self.options,
|
823 |
+
|
824 |
+
title = options.title || self.originalTitle || ' ',
|
825 |
+
titleId = $.ui.dialog.getTitleId(self.element),
|
826 |
+
|
827 |
+
uiDialog = (self.uiDialog = $('<div></div>'))
|
828 |
+
.appendTo(document.body)
|
829 |
+
.hide()
|
830 |
+
.addClass(uiDialogClasses + options.dialogClass)
|
831 |
+
.css({
|
832 |
+
zIndex: options.zIndex
|
833 |
+
})
|
834 |
+
// setting tabIndex makes the div focusable
|
835 |
+
// setting outline to 0 prevents a border on focus in Mozilla
|
836 |
+
.attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
|
837 |
+
if (options.closeOnEscape && event.keyCode &&
|
838 |
+
event.keyCode === $.ui.keyCode.ESCAPE) {
|
839 |
+
|
840 |
+
self.close(event);
|
841 |
+
event.preventDefault();
|
842 |
+
}
|
843 |
+
})
|
844 |
+
.attr({
|
845 |
+
role: 'dialog',
|
846 |
+
'aria-labelledby': titleId
|
847 |
+
})
|
848 |
+
.mousedown(function(event) {
|
849 |
+
self.moveToTop(false, event);
|
850 |
+
}),
|
851 |
+
|
852 |
+
uiDialogContent = self.element
|
853 |
+
.show()
|
854 |
+
.removeAttr('title')
|
855 |
+
.addClass(
|
856 |
+
'ui-dialog-content ' +
|
857 |
+
'ui-widget-content')
|
858 |
+
.appendTo(uiDialog),
|
859 |
+
|
860 |
+
uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))
|
861 |
+
.addClass(
|
862 |
+
'ui-dialog-titlebar ' +
|
863 |
+
'ui-widget-header ' +
|
864 |
+
'ui-corner-all ' +
|
865 |
+
'ui-helper-clearfix'
|
866 |
+
)
|
867 |
+
.prependTo(uiDialog),
|
868 |
+
|
869 |
+
uiDialogTitlebarClose = $('<a href="#"></a>')
|
870 |
+
.addClass(
|
871 |
+
'ui-dialog-titlebar-close ' +
|
872 |
+
'ui-corner-all'
|
873 |
+
)
|
874 |
+
.attr('role', 'button')
|
875 |
+
.hover(
|
876 |
+
function() {
|
877 |
+
uiDialogTitlebarClose.addClass('ui-state-hover');
|
878 |
+
},
|
879 |
+
function() {
|
880 |
+
uiDialogTitlebarClose.removeClass('ui-state-hover');
|
881 |
+
}
|
882 |
+
)
|
883 |
+
.focus(function() {
|
884 |
+
uiDialogTitlebarClose.addClass('ui-state-focus');
|
885 |
+
})
|
886 |
+
.blur(function() {
|
887 |
+
uiDialogTitlebarClose.removeClass('ui-state-focus');
|
888 |
+
})
|
889 |
+
.click(function(event) {
|
890 |
+
self.close(event);
|
891 |
+
return false;
|
892 |
+
})
|
893 |
+
.appendTo(uiDialogTitlebar),
|
894 |
+
|
895 |
+
uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))
|
896 |
+
.addClass(
|
897 |
+
'ui-icon ' +
|
898 |
+
'ui-icon-closethick'
|
899 |
+
)
|
900 |
+
.text(options.closeText)
|
901 |
+
.appendTo(uiDialogTitlebarClose),
|
902 |
+
|
903 |
+
uiDialogTitle = $('<span></span>')
|
904 |
+
.addClass('ui-dialog-title')
|
905 |
+
.attr('id', titleId)
|
906 |
+
.html(title)
|
907 |
+
.prependTo(uiDialogTitlebar);
|
908 |
+
|
909 |
+
//handling of deprecated beforeclose (vs beforeClose) option
|
910 |
+
//Ticket #4669 http://dev.jqueryui.com/ticket/4669
|
911 |
+
//TODO: remove in 1.9pre
|
912 |
+
if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {
|
913 |
+
options.beforeClose = options.beforeclose;
|
914 |
+
}
|
915 |
+
|
916 |
+
uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
|
917 |
+
|
918 |
+
if (options.draggable && $.fn.draggable) {
|
919 |
+
self._makeDraggable();
|
920 |
+
}
|
921 |
+
if (options.resizable && $.fn.resizable) {
|
922 |
+
self._makeResizable();
|
923 |
+
}
|
924 |
+
|
925 |
+
self._createButtons(options.buttons);
|
926 |
+
self._isOpen = false;
|
927 |
+
|
928 |
+
if ($.fn.bgiframe) {
|
929 |
+
uiDialog.bgiframe();
|
930 |
+
}
|
931 |
+
},
|
932 |
+
|
933 |
+
_init: function() {
|
934 |
+
if ( this.options.autoOpen ) {
|
935 |
+
this.open();
|
936 |
+
}
|
937 |
+
},
|
938 |
+
|
939 |
+
destroy: function() {
|
940 |
+
var self = this;
|
941 |
+
|
942 |
+
if (self.overlay) {
|
943 |
+
self.overlay.destroy();
|
944 |
+
}
|
945 |
+
self.uiDialog.hide();
|
946 |
+
self.element
|
947 |
+
.unbind('.dialog')
|
948 |
+
.removeData('dialog')
|
949 |
+
.removeClass('ui-dialog-content ui-widget-content')
|
950 |
+
.hide().appendTo('body');
|
951 |
+
self.uiDialog.remove();
|
952 |
+
|
953 |
+
if (self.originalTitle) {
|
954 |
+
self.element.attr('title', self.originalTitle);
|
955 |
+
}
|
956 |
+
|
957 |
+
return self;
|
958 |
+
},
|
959 |
+
|
960 |
+
widget: function() {
|
961 |
+
return this.uiDialog;
|
962 |
+
},
|
963 |
+
|
964 |
+
close: function(event) {
|
965 |
+
var self = this,
|
966 |
+
maxZ;
|
967 |
+
|
968 |
+
if (false === self._trigger('beforeClose', event)) {
|
969 |
+
return;
|
970 |
+
}
|
971 |
+
|
972 |
+
if (self.overlay) {
|
973 |
+
self.overlay.destroy();
|
974 |
+
}
|
975 |
+
self.uiDialog.unbind('keypress.ui-dialog');
|
976 |
+
|
977 |
+
self._isOpen = false;
|
978 |
+
|
979 |
+
if (self.options.hide) {
|
980 |
+
self.uiDialog.hide(self.options.hide, function() {
|
981 |
+
self._trigger('close', event);
|
982 |
+
});
|
983 |
+
} else {
|
984 |
+
self.uiDialog.hide();
|
985 |
+
self._trigger('close', event);
|
986 |
+
}
|
987 |
+
|
988 |
+
$.ui.dialog.overlay.resize();
|
989 |
+
|
990 |
+
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
|
991 |
+
if (self.options.modal) {
|
992 |
+
maxZ = 0;
|
993 |
+
$('.ui-dialog').each(function() {
|
994 |
+
if (this !== self.uiDialog[0]) {
|
995 |
+
maxZ = Math.max(maxZ, $(this).css('z-index'));
|
996 |
+
}
|
997 |
+
});
|
998 |
+
$.ui.dialog.maxZ = maxZ;
|
999 |
+
}
|
1000 |
+
|
1001 |
+
return self;
|
1002 |
+
},
|
1003 |
+
|
1004 |
+
isOpen: function() {
|
1005 |
+
return this._isOpen;
|
1006 |
+
},
|
1007 |
+
|
1008 |
+
// the force parameter allows us to move modal dialogs to their correct
|
1009 |
+
// position on open
|
1010 |
+
moveToTop: function(force, event) {
|
1011 |
+
var self = this,
|
1012 |
+
options = self.options,
|
1013 |
+
saveScroll;
|
1014 |
+
|
1015 |
+
if ((options.modal && !force) ||
|
1016 |
+
(!options.stack && !options.modal)) {
|
1017 |
+
return self._trigger('focus', event);
|
1018 |
+
}
|
1019 |
+
|
1020 |
+
if (options.zIndex > $.ui.dialog.maxZ) {
|
1021 |
+
$.ui.dialog.maxZ = options.zIndex;
|
1022 |
+
}
|
1023 |
+
if (self.overlay) {
|
1024 |
+
$.ui.dialog.maxZ += 1;
|
1025 |
+
self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);
|
1026 |
+
}
|
1027 |
+
|
1028 |
+
//Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
|
1029 |
+
// http://ui.jquery.com/bugs/ticket/3193
|
1030 |
+
saveScroll = { scrollTop: self.element.attr('scrollTop'), scrollLeft: self.element.attr('scrollLeft') };
|
1031 |
+
$.ui.dialog.maxZ += 1;
|
1032 |
+
self.uiDialog.css('z-index', $.ui.dialog.maxZ);
|
1033 |
+
self.element.attr(saveScroll);
|
1034 |
+
self._trigger('focus', event);
|
1035 |
+
|
1036 |
+
return self;
|
1037 |
+
},
|
1038 |
+
|
1039 |
+
open: function() {
|
1040 |
+
if (this._isOpen) { return; }
|
1041 |
+
|
1042 |
+
var self = this,
|
1043 |
+
options = self.options,
|
1044 |
+
uiDialog = self.uiDialog;
|
1045 |
+
|
1046 |
+
self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
|
1047 |
+
if (uiDialog.next().length) {
|
1048 |
+
uiDialog.appendTo('body');
|
1049 |
+
}
|
1050 |
+
self._size();
|
1051 |
+
self._position(options.position);
|
1052 |
+
uiDialog.show(options.show);
|
1053 |
+
self.moveToTop(true);
|
1054 |
+
|
1055 |
+
// prevent tabbing out of modal dialogs
|
1056 |
+
if (options.modal) {
|
1057 |
+
uiDialog.bind('keypress.ui-dialog', function(event) {
|
1058 |
+
if (event.keyCode !== $.ui.keyCode.TAB) {
|
1059 |
+
return;
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
var tabbables = $(':tabbable', this),
|
1063 |
+
first = tabbables.filter(':first'),
|
1064 |
+
last = tabbables.filter(':last');
|
1065 |
+
|
1066 |
+
if (event.target === last[0] && !event.shiftKey) {
|
1067 |
+
first.focus(1);
|
1068 |
+
return false;
|
1069 |
+
} else if (event.target === first[0] && event.shiftKey) {
|
1070 |
+
last.focus(1);
|
1071 |
+
return false;
|
1072 |
+
}
|
1073 |
+
});
|
1074 |
+
}
|
1075 |
+
|
1076 |
+
// set focus to the first tabbable element in the content area or the first button
|
1077 |
+
// if there are no tabbable elements, set focus on the dialog itself
|
1078 |
+
$(self.element.find(':tabbable').get().concat(
|
1079 |
+
uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
|
1080 |
+
uiDialog.get()))).eq(0).focus();
|
1081 |
+
|
1082 |
+
self._trigger('open');
|
1083 |
+
self._isOpen = true;
|
1084 |
+
|
1085 |
+
return self;
|
1086 |
+
},
|
1087 |
+
|
1088 |
+
_createButtons: function(buttons) {
|
1089 |
+
var self = this,
|
1090 |
+
hasButtons = false,
|
1091 |
+
uiDialogButtonPane = $('<div></div>')
|
1092 |
+
.addClass(
|
1093 |
+
'ui-dialog-buttonpane ' +
|
1094 |
+
'ui-widget-content ' +
|
1095 |
+
'ui-helper-clearfix'
|
1096 |
+
),
|
1097 |
+
uiButtonSet = $( "<div></div>" )
|
1098 |
+
.addClass( "ui-dialog-buttonset" )
|
1099 |
+
.appendTo( uiDialogButtonPane );
|
1100 |
+
|
1101 |
+
// if we already have a button pane, remove it
|
1102 |
+
self.uiDialog.find('.ui-dialog-buttonpane').remove();
|
1103 |
+
|
1104 |
+
if (typeof buttons === 'object' && buttons !== null) {
|
1105 |
+
$.each(buttons, function() {
|
1106 |
+
return !(hasButtons = true);
|
1107 |
+
});
|
1108 |
+
}
|
1109 |
+
if (hasButtons) {
|
1110 |
+
$.each(buttons, function(name, fn) {
|
1111 |
+
var button = $('<button type="button"></button>')
|
1112 |
+
.text(name)
|
1113 |
+
.click(function() { fn.apply(self.element[0], arguments); })
|
1114 |
+
.appendTo(uiButtonSet);
|
1115 |
+
if ($.fn.button) {
|
1116 |
+
button.button();
|
1117 |
+
}
|
1118 |
+
});
|
1119 |
+
uiDialogButtonPane.appendTo(self.uiDialog);
|
1120 |
+
}
|
1121 |
+
},
|
1122 |
+
|
1123 |
+
_makeDraggable: function() {
|
1124 |
+
var self = this,
|
1125 |
+
options = self.options,
|
1126 |
+
doc = $(document),
|
1127 |
+
heightBeforeDrag;
|
1128 |
+
|
1129 |
+
function filteredUi(ui) {
|
1130 |
+
return {
|
1131 |
+
position: ui.position,
|
1132 |
+
offset: ui.offset
|
1133 |
+
};
|
1134 |
+
}
|
1135 |
+
|
1136 |
+
self.uiDialog.draggable({
|
1137 |
+
cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
|
1138 |
+
handle: '.ui-dialog-titlebar',
|
1139 |
+
containment: 'document',
|
1140 |
+
start: function(event, ui) {
|
1141 |
+
heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
|
1142 |
+
$(this).height($(this).height()).addClass("ui-dialog-dragging");
|
1143 |
+
self._trigger('dragStart', event, filteredUi(ui));
|
1144 |
+
},
|
1145 |
+
drag: function(event, ui) {
|
1146 |
+
self._trigger('drag', event, filteredUi(ui));
|
1147 |
+
},
|
1148 |
+
stop: function(event, ui) {
|
1149 |
+
options.position = [ui.position.left - doc.scrollLeft(),
|
1150 |
+
ui.position.top - doc.scrollTop()];
|
1151 |
+
$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
|
1152 |
+
self._trigger('dragStop', event, filteredUi(ui));
|
1153 |
+
$.ui.dialog.overlay.resize();
|
1154 |
+
}
|
1155 |
+
});
|
1156 |
+
},
|
1157 |
+
|
1158 |
+
_makeResizable: function(handles) {
|
1159 |
+
handles = (handles === undefined ? this.options.resizable : handles);
|
1160 |
+
var self = this,
|
1161 |
+
options = self.options,
|
1162 |
+
// .ui-resizable has position: relative defined in the stylesheet
|
1163 |
+
// but dialogs have to use absolute or fixed positioning
|
1164 |
+
position = self.uiDialog.css('position'),
|
1165 |
+
resizeHandles = (typeof handles === 'string' ?
|
1166 |
+
handles :
|
1167 |
+
'n,e,s,w,se,sw,ne,nw'
|
1168 |
+
);
|
1169 |
+
|
1170 |
+
function filteredUi(ui) {
|
1171 |
+
return {
|
1172 |
+
originalPosition: ui.originalPosition,
|
1173 |
+
originalSize: ui.originalSize,
|
1174 |
+
position: ui.position,
|
1175 |
+
size: ui.size
|
1176 |
+
};
|
1177 |
+
}
|
1178 |
+
|
1179 |
+
self.uiDialog.resizable({
|
1180 |
+
cancel: '.ui-dialog-content',
|
1181 |
+
containment: 'document',
|
1182 |
+
alsoResize: self.element,
|
1183 |
+
maxWidth: options.maxWidth,
|
1184 |
+
maxHeight: options.maxHeight,
|
1185 |
+
minWidth: options.minWidth,
|
1186 |
+
minHeight: self._minHeight(),
|
1187 |
+
handles: resizeHandles,
|
1188 |
+
start: function(event, ui) {
|
1189 |
+
$(this).addClass("ui-dialog-resizing");
|
1190 |
+
self._trigger('resizeStart', event, filteredUi(ui));
|
1191 |
+
},
|
1192 |
+
resize: function(event, ui) {
|
1193 |
+
self._trigger('resize', event, filteredUi(ui));
|
1194 |
+
},
|
1195 |
+
stop: function(event, ui) {
|
1196 |
+
$(this).removeClass("ui-dialog-resizing");
|
1197 |
+
options.height = $(this).height();
|
1198 |
+
options.width = $(this).width();
|
1199 |
+
self._trigger('resizeStop', event, filteredUi(ui));
|
1200 |
+
$.ui.dialog.overlay.resize();
|
1201 |
+
}
|
1202 |
+
})
|
1203 |
+
.css('position', position)
|
1204 |
+
.find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
|
1205 |
+
},
|
1206 |
+
|
1207 |
+
_minHeight: function() {
|
1208 |
+
var options = this.options;
|
1209 |
+
|
1210 |
+
if (options.height === 'auto') {
|
1211 |
+
return options.minHeight;
|
1212 |
+
} else {
|
1213 |
+
return Math.min(options.minHeight, options.height);
|
1214 |
+
}
|
1215 |
+
},
|
1216 |
+
|
1217 |
+
_position: function(position) {
|
1218 |
+
var myAt = [],
|
1219 |
+
offset = [0, 0],
|
1220 |
+
isVisible;
|
1221 |
+
|
1222 |
+
if (position) {
|
1223 |
+
// deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
|
1224 |
+
// if (typeof position == 'string' || $.isArray(position)) {
|
1225 |
+
// myAt = $.isArray(position) ? position : position.split(' ');
|
1226 |
+
|
1227 |
+
if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
|
1228 |
+
myAt = position.split ? position.split(' ') : [position[0], position[1]];
|
1229 |
+
if (myAt.length === 1) {
|
1230 |
+
myAt[1] = myAt[0];
|
1231 |
+
}
|
1232 |
+
|
1233 |
+
$.each(['left', 'top'], function(i, offsetPosition) {
|
1234 |
+
if (+myAt[i] === myAt[i]) {
|
1235 |
+
offset[i] = myAt[i];
|
1236 |
+
myAt[i] = offsetPosition;
|
1237 |
+
}
|
1238 |
+
});
|
1239 |
+
|
1240 |
+
position = {
|
1241 |
+
my: myAt.join(" "),
|
1242 |
+
at: myAt.join(" "),
|
1243 |
+
offset: offset.join(" ")
|
1244 |
+
};
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
position = $.extend({}, $.ui.dialog.prototype.options.position, position);
|
1248 |
+
} else {
|
1249 |
+
position = $.ui.dialog.prototype.options.position;
|
1250 |
+
}
|
1251 |
+
|
1252 |
+
// need to show the dialog to get the actual offset in the position plugin
|
1253 |
+
isVisible = this.uiDialog.is(':visible');
|
1254 |
+
if (!isVisible) {
|
1255 |
+
this.uiDialog.show();
|
1256 |
+
}
|
1257 |
+
this.uiDialog
|
1258 |
+
// workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
|
1259 |
+
.css({ top: 0, left: 0 })
|
1260 |
+
.position(position);
|
1261 |
+
if (!isVisible) {
|
1262 |
+
this.uiDialog.hide();
|
1263 |
+
}
|
1264 |
+
},
|
1265 |
+
|
1266 |
+
_setOption: function(key, value){
|
1267 |
+
var self = this,
|
1268 |
+
uiDialog = self.uiDialog,
|
1269 |
+
isResizable = uiDialog.is(':data(resizable)'),
|
1270 |
+
resize = false;
|
1271 |
+
|
1272 |
+
switch (key) {
|
1273 |
+
//handling of deprecated beforeclose (vs beforeClose) option
|
1274 |
+
//Ticket #4669 http://dev.jqueryui.com/ticket/4669
|
1275 |
+
//TODO: remove in 1.9pre
|
1276 |
+
case "beforeclose":
|
1277 |
+
key = "beforeClose";
|
1278 |
+
break;
|
1279 |
+
case "buttons":
|
1280 |
+
self._createButtons(value);
|
1281 |
+
resize = true;
|
1282 |
+
break;
|
1283 |
+
case "closeText":
|
1284 |
+
// convert whatever was passed in to a string, for text() to not throw up
|
1285 |
+
self.uiDialogTitlebarCloseText.text("" + value);
|
1286 |
+
break;
|
1287 |
+
case "dialogClass":
|
1288 |
+
uiDialog
|
1289 |
+
.removeClass(self.options.dialogClass)
|
1290 |
+
.addClass(uiDialogClasses + value);
|
1291 |
+
break;
|
1292 |
+
case "disabled":
|
1293 |
+
if (value) {
|
1294 |
+
uiDialog.addClass('ui-dialog-disabled');
|
1295 |
+
} else {
|
1296 |
+
uiDialog.removeClass('ui-dialog-disabled');
|
1297 |
+
}
|
1298 |
+
break;
|
1299 |
+
case "draggable":
|
1300 |
+
if (value) {
|
1301 |
+
self._makeDraggable();
|
1302 |
+
} else {
|
1303 |
+
uiDialog.draggable('destroy');
|
1304 |
+
}
|
1305 |
+
break;
|
1306 |
+
case "height":
|
1307 |
+
resize = true;
|
1308 |
+
break;
|
1309 |
+
case "maxHeight":
|
1310 |
+
if (isResizable) {
|
1311 |
+
uiDialog.resizable('option', 'maxHeight', value);
|
1312 |
+
}
|
1313 |
+
resize = true;
|
1314 |
+
break;
|
1315 |
+
case "maxWidth":
|
1316 |
+
if (isResizable) {
|
1317 |
+
uiDialog.resizable('option', 'maxWidth', value);
|
1318 |
+
}
|
1319 |
+
resize = true;
|
1320 |
+
break;
|
1321 |
+
case "minHeight":
|
1322 |
+
if (isResizable) {
|
1323 |
+
uiDialog.resizable('option', 'minHeight', value);
|
1324 |
+
}
|
1325 |
+
resize = true;
|
1326 |
+
break;
|
1327 |
+
case "minWidth":
|
1328 |
+
if (isResizable) {
|
1329 |
+
uiDialog.resizable('option', 'minWidth', value);
|
1330 |
+
}
|
1331 |
+
resize = true;
|
1332 |
+
break;
|
1333 |
+
case "position":
|
1334 |
+
self._position(value);
|
1335 |
+
break;
|
1336 |
+
case "resizable":
|
1337 |
+
// currently resizable, becoming non-resizable
|
1338 |
+
if (isResizable && !value) {
|
1339 |
+
uiDialog.resizable('destroy');
|
1340 |
+
}
|
1341 |
+
|
1342 |
+
// currently resizable, changing handles
|
1343 |
+
if (isResizable && typeof value === 'string') {
|
1344 |
+
uiDialog.resizable('option', 'handles', value);
|
1345 |
+
}
|
1346 |
+
|
1347 |
+
// currently non-resizable, becoming resizable
|
1348 |
+
if (!isResizable && value !== false) {
|
1349 |
+
self._makeResizable(value);
|
1350 |
+
}
|
1351 |
+
break;
|
1352 |
+
case "title":
|
1353 |
+
// convert whatever was passed in o a string, for html() to not throw up
|
1354 |
+
$(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || ' '));
|
1355 |
+
break;
|
1356 |
+
case "width":
|
1357 |
+
resize = true;
|
1358 |
+
break;
|
1359 |
+
}
|
1360 |
+
|
1361 |
+
$.Widget.prototype._setOption.apply(self, arguments);
|
1362 |
+
if (resize) {
|
1363 |
+
self._size();
|
1364 |
+
}
|
1365 |
+
},
|
1366 |
+
|
1367 |
+
_size: function() {
|
1368 |
+
/* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
|
1369 |
+
* divs will both have width and height set, so we need to reset them
|
1370 |
+
*/
|
1371 |
+
var options = this.options,
|
1372 |
+
nonContentHeight;
|
1373 |
+
|
1374 |
+
// reset content sizing
|
1375 |
+
// hide for non content measurement because height: 0 doesn't work in IE quirks mode (see #4350)
|
1376 |
+
this.element.css({
|
1377 |
+
width: 'auto',
|
1378 |
+
minHeight: 0,
|
1379 |
+
height: 0
|
1380 |
+
});
|
1381 |
+
|
1382 |
+
if (options.minWidth > options.width) {
|
1383 |
+
options.width = options.minWidth;
|
1384 |
+
}
|
1385 |
+
|
1386 |
+
// reset wrapper sizing
|
1387 |
+
// determine the height of all the non-content elements
|
1388 |
+
nonContentHeight = this.uiDialog.css({
|
1389 |
+
height: 'auto',
|
1390 |
+
width: options.width
|
1391 |
+
})
|
1392 |
+
.height();
|
1393 |
+
|
1394 |
+
this.element
|
1395 |
+
.css(options.height === 'auto' ? {
|
1396 |
+
minHeight: Math.max(options.minHeight - nonContentHeight, 0),
|
1397 |
+
height: 'auto'
|
1398 |
+
} : {
|
1399 |
+
minHeight: 0,
|
1400 |
+
height: Math.max(options.height - nonContentHeight, 0)
|
1401 |
+
})
|
1402 |
+
.show();
|
1403 |
+
|
1404 |
+
if (this.uiDialog.is(':data(resizable)')) {
|
1405 |
+
this.uiDialog.resizable('option', 'minHeight', this._minHeight());
|
1406 |
+
}
|
1407 |
+
}
|
1408 |
+
});
|
1409 |
+
|
1410 |
+
$.extend($.ui.dialog, {
|
1411 |
+
version: "1.8.4",
|
1412 |
+
|
1413 |
+
uuid: 0,
|
1414 |
+
maxZ: 0,
|
1415 |
+
|
1416 |
+
getTitleId: function($el) {
|
1417 |
+
var id = $el.attr('id');
|
1418 |
+
if (!id) {
|
1419 |
+
this.uuid += 1;
|
1420 |
+
id = this.uuid;
|
1421 |
+
}
|
1422 |
+
return 'ui-dialog-title-' + id;
|
1423 |
+
},
|
1424 |
+
|
1425 |
+
overlay: function(dialog) {
|
1426 |
+
this.$el = $.ui.dialog.overlay.create(dialog);
|
1427 |
+
}
|
1428 |
+
});
|
1429 |
+
|
1430 |
+
$.extend($.ui.dialog.overlay, {
|
1431 |
+
instances: [],
|
1432 |
+
// reuse old instances due to IE memory leak with alpha transparency (see #5185)
|
1433 |
+
oldInstances: [],
|
1434 |
+
maxZ: 0,
|
1435 |
+
events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
|
1436 |
+
function(event) { return event + '.dialog-overlay'; }).join(' '),
|
1437 |
+
create: function(dialog) {
|
1438 |
+
if (this.instances.length === 0) {
|
1439 |
+
// prevent use of anchors and inputs
|
1440 |
+
// we use a setTimeout in case the overlay is created from an
|
1441 |
+
// event that we're going to be cancelling (see #2804)
|
1442 |
+
setTimeout(function() {
|
1443 |
+
// handle $(el).dialog().dialog('close') (see #4065)
|
1444 |
+
if ($.ui.dialog.overlay.instances.length) {
|
1445 |
+
$(document).bind($.ui.dialog.overlay.events, function(event) {
|
1446 |
+
// stop events if the z-index of the target is < the z-index of the overlay
|
1447 |
+
return ($(event.target).zIndex() >= $.ui.dialog.overlay.maxZ);
|
1448 |
+
});
|
1449 |
+
}
|
1450 |
+
}, 1);
|
1451 |
+
|
1452 |
+
// allow closing by pressing the escape key
|
1453 |
+
$(document).bind('keydown.dialog-overlay', function(event) {
|
1454 |
+
if (dialog.options.closeOnEscape && event.keyCode &&
|
1455 |
+
event.keyCode === $.ui.keyCode.ESCAPE) {
|
1456 |
+
|
1457 |
+
dialog.close(event);
|
1458 |
+
event.preventDefault();
|
1459 |
+
}
|
1460 |
+
});
|
1461 |
+
|
1462 |
+
// handle window resize
|
1463 |
+
$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
|
1464 |
+
}
|
1465 |
+
|
1466 |
+
var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))
|
1467 |
+
.appendTo(document.body)
|
1468 |
+
.css({
|
1469 |
+
width: this.width(),
|
1470 |
+
height: this.height()
|
1471 |
+
});
|
1472 |
+
|
1473 |
+
if ($.fn.bgiframe) {
|
1474 |
+
$el.bgiframe();
|
1475 |
+
}
|
1476 |
+
|
1477 |
+
this.instances.push($el);
|
1478 |
+
return $el;
|
1479 |
+
},
|
1480 |
+
|
1481 |
+
destroy: function($el) {
|
1482 |
+
this.oldInstances.push(this.instances.splice($.inArray($el, this.instances), 1)[0]);
|
1483 |
+
|
1484 |
+
if (this.instances.length === 0) {
|
1485 |
+
$([document, window]).unbind('.dialog-overlay');
|
1486 |
+
}
|
1487 |
+
|
1488 |
+
$el.remove();
|
1489 |
+
|
1490 |
+
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
|
1491 |
+
var maxZ = 0;
|
1492 |
+
$.each(this.instances, function() {
|
1493 |
+
maxZ = Math.max(maxZ, this.css('z-index'));
|
1494 |
+
});
|
1495 |
+
this.maxZ = maxZ;
|
1496 |
+
},
|
1497 |
+
|
1498 |
+
height: function() {
|
1499 |
+
var scrollHeight,
|
1500 |
+
offsetHeight;
|
1501 |
+
// handle IE 6
|
1502 |
+
if ($.browser.msie && $.browser.version < 7) {
|
1503 |
+
scrollHeight = Math.max(
|
1504 |
+
document.documentElement.scrollHeight,
|
1505 |
+
document.body.scrollHeight
|
1506 |
+
);
|
1507 |
+
offsetHeight = Math.max(
|
1508 |
+
document.documentElement.offsetHeight,
|
1509 |
+
document.body.offsetHeight
|
1510 |
+
);
|
1511 |
+
|
1512 |
+
if (scrollHeight < offsetHeight) {
|
1513 |
+
return $(window).height() + 'px';
|
1514 |
+
} else {
|
1515 |
+
return scrollHeight + 'px';
|
1516 |
+
}
|
1517 |
+
// handle "good" browsers
|
1518 |
+
} else {
|
1519 |
+
return $(document).height() + 'px';
|
1520 |
+
}
|
1521 |
+
},
|
1522 |
+
|
1523 |
+
width: function() {
|
1524 |
+
var scrollWidth,
|
1525 |
+
offsetWidth;
|
1526 |
+
// handle IE 6
|
1527 |
+
if ($.browser.msie && $.browser.version < 7) {
|
1528 |
+
scrollWidth = Math.max(
|
1529 |
+
document.documentElement.scrollWidth,
|
1530 |
+
document.body.scrollWidth
|
1531 |
+
);
|
1532 |
+
offsetWidth = Math.max(
|
1533 |
+
document.documentElement.offsetWidth,
|
1534 |
+
document.body.offsetWidth
|
1535 |
+
);
|
1536 |
+
|
1537 |
+
if (scrollWidth < offsetWidth) {
|
1538 |
+
return $(window).width() + 'px';
|
1539 |
+
} else {
|
1540 |
+
return scrollWidth + 'px';
|
1541 |
+
}
|
1542 |
+
// handle "good" browsers
|
1543 |
+
} else {
|
1544 |
+
return $(document).width() + 'px';
|
1545 |
+
}
|
1546 |
+
},
|
1547 |
+
|
1548 |
+
resize: function() {
|
1549 |
+
/* If the dialog is draggable and the user drags it past the
|
1550 |
+
* right edge of the window, the document becomes wider so we
|
1551 |
+
* need to stretch the overlay. If the user then drags the
|
1552 |
+
* dialog back to the left, the document will become narrower,
|
1553 |
+
* so we need to shrink the overlay to the appropriate size.
|
1554 |
+
* This is handled by shrinking the overlay before setting it
|
1555 |
+
* to the full document size.
|
1556 |
+
*/
|
1557 |
+
var $overlays = $([]);
|
1558 |
+
$.each($.ui.dialog.overlay.instances, function() {
|
1559 |
+
$overlays = $overlays.add(this);
|
1560 |
+
});
|
1561 |
+
|
1562 |
+
$overlays.css({
|
1563 |
+
width: 0,
|
1564 |
+
height: 0
|
1565 |
+
}).css({
|
1566 |
+
width: $.ui.dialog.overlay.width(),
|
1567 |
+
height: $.ui.dialog.overlay.height()
|
1568 |
+
});
|
1569 |
+
}
|
1570 |
+
});
|
1571 |
+
|
1572 |
+
$.extend($.ui.dialog.overlay.prototype, {
|
1573 |
+
destroy: function() {
|
1574 |
+
$.ui.dialog.overlay.destroy(this.$el);
|
1575 |
+
}
|
1576 |
+
});
|
1577 |
+
|
1578 |
+
}(jQuery));
|
js/jquery.bgiframe-2.1.1.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
|
2 |
-
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
3 |
-
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
4 |
-
*
|
5 |
-
* $LastChangedDate: 2007-07-21 18:45:56 -0500 (Sat, 21 Jul 2007) $
|
6 |
-
* $Rev: 2447 $
|
7 |
-
*
|
8 |
-
* Version 2.1.1
|
9 |
-
*/
|
10 |
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);
|
1 |
+
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
|
2 |
+
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
3 |
+
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
4 |
+
*
|
5 |
+
* $LastChangedDate: 2007-07-21 18:45:56 -0500 (Sat, 21 Jul 2007) $
|
6 |
+
* $Rev: 2447 $
|
7 |
+
*
|
8 |
+
* Version 2.1.1
|
9 |
+
*/
|
10 |
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);
|
js/jquery.ui.dialog.js
ADDED
@@ -0,0 +1,827 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* jQuery UI Dialog 1.8.4
|
3 |
+
*
|
4 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
* http://jquery.org/license
|
7 |
+
*
|
8 |
+
* http://docs.jquery.com/UI/Dialog
|
9 |
+
*
|
10 |
+
* Depends:
|
11 |
+
* jquery.ui.core.js
|
12 |
+
* jquery.ui.widget.js
|
13 |
+
* jquery.ui.button.js
|
14 |
+
* jquery.ui.draggable.js
|
15 |
+
* jquery.ui.mouse.js
|
16 |
+
* jquery.ui.position.js
|
17 |
+
* jquery.ui.resizable.js
|
18 |
+
*/
|
19 |
+
(function( $, undefined ) {
|
20 |
+
|
21 |
+
var uiDialogClasses =
|
22 |
+
'ui-dialog ' +
|
23 |
+
'ui-widget ' +
|
24 |
+
'ui-widget-content ' +
|
25 |
+
'ui-corner-all ';
|
26 |
+
|
27 |
+
$.widget("ui.dialog", {
|
28 |
+
options: {
|
29 |
+
autoOpen: true,
|
30 |
+
buttons: {},
|
31 |
+
closeOnEscape: true,
|
32 |
+
closeText: 'close',
|
33 |
+
dialogClass: '',
|
34 |
+
draggable: true,
|
35 |
+
hide: null,
|
36 |
+
height: 'auto',
|
37 |
+
maxHeight: false,
|
38 |
+
maxWidth: false,
|
39 |
+
minHeight: 150,
|
40 |
+
minWidth: 150,
|
41 |
+
modal: false,
|
42 |
+
position: {
|
43 |
+
my: 'center',
|
44 |
+
at: 'center',
|
45 |
+
of: window,
|
46 |
+
collision: 'fit',
|
47 |
+
// ensure that the titlebar is never outside the document
|
48 |
+
using: function(pos) {
|
49 |
+
var topOffset = $(this).css(pos).offset().top;
|
50 |
+
if (topOffset < 0) {
|
51 |
+
$(this).css('top', pos.top - topOffset);
|
52 |
+
}
|
53 |
+
}
|
54 |
+
},
|
55 |
+
resizable: true,
|
56 |
+
show: null,
|
57 |
+
stack: true,
|
58 |
+
title: '',
|
59 |
+
width: 300,
|
60 |
+
zIndex: 1000
|
61 |
+
},
|
62 |
+
|
63 |
+
_create: function() {
|
64 |
+
this.originalTitle = this.element.attr('title');
|
65 |
+
// #5742 - .attr() might return a DOMElement
|
66 |
+
if ( typeof this.originalTitle !== "string" ) {
|
67 |
+
this.originalTitle = "";
|
68 |
+
}
|
69 |
+
|
70 |
+
var self = this,
|
71 |
+
options = self.options,
|
72 |
+
|
73 |
+
title = options.title || self.originalTitle || ' ',
|
74 |
+
titleId = $.ui.dialog.getTitleId(self.element),
|
75 |
+
|
76 |
+
uiDialog = (self.uiDialog = $('<div></div>'))
|
77 |
+
.appendTo(document.body)
|
78 |
+
.hide()
|
79 |
+
.addClass(uiDialogClasses + options.dialogClass)
|
80 |
+
.css({
|
81 |
+
zIndex: options.zIndex
|
82 |
+
})
|
83 |
+
// setting tabIndex makes the div focusable
|
84 |
+
// setting outline to 0 prevents a border on focus in Mozilla
|
85 |
+
.attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
|
86 |
+
if (options.closeOnEscape && event.keyCode &&
|
87 |
+
event.keyCode === $.ui.keyCode.ESCAPE) {
|
88 |
+
|
89 |
+
self.close(event);
|
90 |
+
event.preventDefault();
|
91 |
+
}
|
92 |
+
})
|
93 |
+
.attr({
|
94 |
+
role: 'dialog',
|
95 |
+
'aria-labelledby': titleId
|
96 |
+
})
|
97 |
+
.mousedown(function(event) {
|
98 |
+
self.moveToTop(false, event);
|
99 |
+
}),
|
100 |
+
|
101 |
+
uiDialogContent = self.element
|
102 |
+
.show()
|
103 |
+
.removeAttr('title')
|
104 |
+
.addClass(
|
105 |
+
'ui-dialog-content ' +
|
106 |
+
'ui-widget-content')
|
107 |
+
.appendTo(uiDialog),
|
108 |
+
|
109 |
+
uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))
|
110 |
+
.addClass(
|
111 |
+
'ui-dialog-titlebar ' +
|
112 |
+
'ui-widget-header ' +
|
113 |
+
'ui-corner-all ' +
|
114 |
+
'ui-helper-clearfix'
|
115 |
+
)
|
116 |
+
.prependTo(uiDialog),
|
117 |
+
|
118 |
+
uiDialogTitlebarClose = $('<a href="#"></a>')
|
119 |
+
.addClass(
|
120 |
+
'ui-dialog-titlebar-close ' +
|
121 |
+
'ui-corner-all'
|
122 |
+
)
|
123 |
+
.attr('role', 'button')
|
124 |
+
.hover(
|
125 |
+
function() {
|
126 |
+
uiDialogTitlebarClose.addClass('ui-state-hover');
|
127 |
+
},
|
128 |
+
function() {
|
129 |
+
uiDialogTitlebarClose.removeClass('ui-state-hover');
|
130 |
+
}
|
131 |
+
)
|
132 |
+
.focus(function() {
|
133 |
+
uiDialogTitlebarClose.addClass('ui-state-focus');
|
134 |
+
})
|
135 |
+
.blur(function() {
|
136 |
+
uiDialogTitlebarClose.removeClass('ui-state-focus');
|
137 |
+
})
|
138 |
+
.click(function(event) {
|
139 |
+
self.close(event);
|
140 |
+
return false;
|
141 |
+
})
|
142 |
+
.appendTo(uiDialogTitlebar),
|
143 |
+
|
144 |
+
uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))
|
145 |
+
.addClass(
|
146 |
+
'ui-icon ' +
|
147 |
+
'ui-icon-closethick'
|
148 |
+
)
|
149 |
+
.text(options.closeText)
|
150 |
+
.appendTo(uiDialogTitlebarClose),
|
151 |
+
|
152 |
+
uiDialogTitle = $('<span></span>')
|
153 |
+
.addClass('ui-dialog-title')
|
154 |
+
.attr('id', titleId)
|
155 |
+
.html(title)
|
156 |
+
.prependTo(uiDialogTitlebar);
|
157 |
+
|
158 |
+
//handling of deprecated beforeclose (vs beforeClose) option
|
159 |
+
//Ticket #4669 http://dev.jqueryui.com/ticket/4669
|
160 |
+
//TODO: remove in 1.9pre
|
161 |
+
if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {
|
162 |
+
options.beforeClose = options.beforeclose;
|
163 |
+
}
|
164 |
+
|
165 |
+
uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
|
166 |
+
|
167 |
+
if (options.draggable && $.fn.draggable) {
|
168 |
+
self._makeDraggable();
|
169 |
+
}
|
170 |
+
if (options.resizable && $.fn.resizable) {
|
171 |
+
self._makeResizable();
|
172 |
+
}
|
173 |
+
|
174 |
+
self._createButtons(options.buttons);
|
175 |
+
self._isOpen = false;
|
176 |
+
|
177 |
+
if ($.fn.bgiframe) {
|
178 |
+
uiDialog.bgiframe();
|
179 |
+
}
|
180 |
+
},
|
181 |
+
|
182 |
+
_init: function() {
|
183 |
+
if ( this.options.autoOpen ) {
|
184 |
+
this.open();
|
185 |
+
}
|
186 |
+
},
|
187 |
+
|
188 |
+
destroy: function() {
|
189 |
+
var self = this;
|
190 |
+
|
191 |
+
if (self.overlay) {
|
192 |
+
self.overlay.destroy();
|
193 |
+
}
|
194 |
+
self.uiDialog.hide();
|
195 |
+
self.element
|
196 |
+
.unbind('.dialog')
|
197 |
+
.removeData('dialog')
|
198 |
+
.removeClass('ui-dialog-content ui-widget-content')
|
199 |
+
.hide().appendTo('body');
|
200 |
+
self.uiDialog.remove();
|
201 |
+
|
202 |
+
if (self.originalTitle) {
|
203 |
+
self.element.attr('title', self.originalTitle);
|
204 |
+
}
|
205 |
+
|
206 |
+
return self;
|
207 |
+
},
|
208 |
+
|
209 |
+
widget: function() {
|
210 |
+
return this.uiDialog;
|
211 |
+
},
|
212 |
+
|
213 |
+
close: function(event) {
|
214 |
+
var self = this,
|
215 |
+
maxZ;
|
216 |
+
|
217 |
+
if (false === self._trigger('beforeClose', event)) {
|
218 |
+
return;
|
219 |
+
}
|
220 |
+
|
221 |
+
if (self.overlay) {
|
222 |
+
self.overlay.destroy();
|
223 |
+
}
|
224 |
+
self.uiDialog.unbind('keypress.ui-dialog');
|
225 |
+
|
226 |
+
self._isOpen = false;
|
227 |
+
|
228 |
+
if (self.options.hide) {
|
229 |
+
self.uiDialog.hide(self.options.hide, function() {
|
230 |
+
self._trigger('close', event);
|
231 |
+
});
|
232 |
+
} else {
|
233 |
+
self.uiDialog.hide();
|
234 |
+
self._trigger('close', event);
|
235 |
+
}
|
236 |
+
|
237 |
+
$.ui.dialog.overlay.resize();
|
238 |
+
|
239 |
+
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
|
240 |
+
if (self.options.modal) {
|
241 |
+
maxZ = 0;
|
242 |
+
$('.ui-dialog').each(function() {
|
243 |
+
if (this !== self.uiDialog[0]) {
|
244 |
+
maxZ = Math.max(maxZ, $(this).css('z-index'));
|
245 |
+
}
|
246 |
+
});
|
247 |
+
$.ui.dialog.maxZ = maxZ;
|
248 |
+
}
|
249 |
+
|
250 |
+
return self;
|
251 |
+
},
|
252 |
+
|
253 |
+
isOpen: function() {
|
254 |
+
return this._isOpen;
|
255 |
+
},
|
256 |
+
|
257 |
+
// the force parameter allows us to move modal dialogs to their correct
|
258 |
+
// position on open
|
259 |
+
moveToTop: function(force, event) {
|
260 |
+
var self = this,
|
261 |
+
options = self.options,
|
262 |
+
saveScroll;
|
263 |
+
|
264 |
+
if ((options.modal && !force) ||
|
265 |
+
(!options.stack && !options.modal)) {
|
266 |
+
return self._trigger('focus', event);
|
267 |
+
}
|
268 |
+
|
269 |
+
if (options.zIndex > $.ui.dialog.maxZ) {
|
270 |
+
$.ui.dialog.maxZ = options.zIndex;
|
271 |
+
}
|
272 |
+
if (self.overlay) {
|
273 |
+
$.ui.dialog.maxZ += 1;
|
274 |
+
self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);
|
275 |
+
}
|
276 |
+
|
277 |
+
//Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
|
278 |
+
// http://ui.jquery.com/bugs/ticket/3193
|
279 |
+
saveScroll = { scrollTop: self.element.attr('scrollTop'), scrollLeft: self.element.attr('scrollLeft') };
|
280 |
+
$.ui.dialog.maxZ += 1;
|
281 |
+
self.uiDialog.css('z-index', $.ui.dialog.maxZ);
|
282 |
+
self.element.attr(saveScroll);
|
283 |
+
self._trigger('focus', event);
|
284 |
+
|
285 |
+
return self;
|
286 |
+
},
|
287 |
+
|
288 |
+
open: function() {
|
289 |
+
if (this._isOpen) { return; }
|
290 |
+
|
291 |
+
var self = this,
|
292 |
+
options = self.options,
|
293 |
+
uiDialog = self.uiDialog;
|
294 |
+
|
295 |
+
self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
|
296 |
+
if (uiDialog.next().length) {
|
297 |
+
uiDialog.appendTo('body');
|
298 |
+
}
|
299 |
+
self._size();
|
300 |
+
self._position(options.position);
|
301 |
+
uiDialog.show(options.show);
|
302 |
+
self.moveToTop(true);
|
303 |
+
|
304 |
+
// prevent tabbing out of modal dialogs
|
305 |
+
if (options.modal) {
|
306 |
+
uiDialog.bind('keypress.ui-dialog', function(event) {
|
307 |
+
if (event.keyCode !== $.ui.keyCode.TAB) {
|
308 |
+
return;
|
309 |
+
}
|
310 |
+
|
311 |
+
var tabbables = $(':tabbable', this),
|
312 |
+
first = tabbables.filter(':first'),
|
313 |
+
last = tabbables.filter(':last');
|
314 |
+
|
315 |
+
if (event.target === last[0] && !event.shiftKey) {
|
316 |
+
first.focus(1);
|
317 |
+
return false;
|
318 |
+
} else if (event.target === first[0] && event.shiftKey) {
|
319 |
+
last.focus(1);
|
320 |
+
return false;
|
321 |
+
}
|
322 |
+
});
|
323 |
+
}
|
324 |
+
|
325 |
+
// set focus to the first tabbable element in the content area or the first button
|
326 |
+
// if there are no tabbable elements, set focus on the dialog itself
|
327 |
+
$(self.element.find(':tabbable').get().concat(
|
328 |
+
uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
|
329 |
+
uiDialog.get()))).eq(0).focus();
|
330 |
+
|
331 |
+
self._trigger('open');
|
332 |
+
self._isOpen = true;
|
333 |
+
|
334 |
+
return self;
|
335 |
+
},
|
336 |
+
|
337 |
+
_createButtons: function(buttons) {
|
338 |
+
var self = this,
|
339 |
+
hasButtons = false,
|
340 |
+
uiDialogButtonPane = $('<div></div>')
|
341 |
+
.addClass(
|
342 |
+
'ui-dialog-buttonpane ' +
|
343 |
+
'ui-widget-content ' +
|
344 |
+
'ui-helper-clearfix'
|
345 |
+
),
|
346 |
+
uiButtonSet = $( "<div></div>" )
|
347 |
+
.addClass( "ui-dialog-buttonset" )
|
348 |
+
.appendTo( uiDialogButtonPane );
|
349 |
+
|
350 |
+
// if we already have a button pane, remove it
|
351 |
+
self.uiDialog.find('.ui-dialog-buttonpane').remove();
|
352 |
+
|
353 |
+
if (typeof buttons === 'object' && buttons !== null) {
|
354 |
+
$.each(buttons, function() {
|
355 |
+
return !(hasButtons = true);
|
356 |
+
});
|
357 |
+
}
|
358 |
+
if (hasButtons) {
|
359 |
+
$.each(buttons, function(name, fn) {
|
360 |
+
var button = $('<button type="button"></button>')
|
361 |
+
.text(name)
|
362 |
+
.click(function() { fn.apply(self.element[0], arguments); })
|
363 |
+
.appendTo(uiButtonSet);
|
364 |
+
if ($.fn.button) {
|
365 |
+
button.button();
|
366 |
+
}
|
367 |
+
});
|
368 |
+
uiDialogButtonPane.appendTo(self.uiDialog);
|
369 |
+
}
|
370 |
+
},
|
371 |
+
|
372 |
+
_makeDraggable: function() {
|
373 |
+
var self = this,
|
374 |
+
options = self.options,
|
375 |
+
doc = $(document),
|
376 |
+
heightBeforeDrag;
|
377 |
+
|
378 |
+
function filteredUi(ui) {
|
379 |
+
return {
|
380 |
+
position: ui.position,
|
381 |
+
offset: ui.offset
|
382 |
+
};
|
383 |
+
}
|
384 |
+
|
385 |
+
self.uiDialog.draggable({
|
386 |
+
cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
|
387 |
+
handle: '.ui-dialog-titlebar',
|
388 |
+
containment: 'document',
|
389 |
+
start: function(event, ui) {
|
390 |
+
heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
|
391 |
+
$(this).height($(this).height()).addClass("ui-dialog-dragging");
|
392 |
+
self._trigger('dragStart', event, filteredUi(ui));
|
393 |
+
},
|
394 |
+
drag: function(event, ui) {
|
395 |
+
self._trigger('drag', event, filteredUi(ui));
|
396 |
+
},
|
397 |
+
stop: function(event, ui) {
|
398 |
+
options.position = [ui.position.left - doc.scrollLeft(),
|
399 |
+
ui.position.top - doc.scrollTop()];
|
400 |
+
$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
|
401 |
+
self._trigger('dragStop', event, filteredUi(ui));
|
402 |
+
$.ui.dialog.overlay.resize();
|
403 |
+
}
|
404 |
+
});
|
405 |
+
},
|
406 |
+
|
407 |
+
_makeResizable: function(handles) {
|
408 |
+
handles = (handles === undefined ? this.options.resizable : handles);
|
409 |
+
var self = this,
|
410 |
+
options = self.options,
|
411 |
+
// .ui-resizable has position: relative defined in the stylesheet
|
412 |
+
// but dialogs have to use absolute or fixed positioning
|
413 |
+
position = self.uiDialog.css('position'),
|
414 |
+
resizeHandles = (typeof handles === 'string' ?
|
415 |
+
handles :
|
416 |
+
'n,e,s,w,se,sw,ne,nw'
|
417 |
+
);
|
418 |
+
|
419 |
+
function filteredUi(ui) {
|
420 |
+
return {
|
421 |
+
originalPosition: ui.originalPosition,
|
422 |
+
originalSize: ui.originalSize,
|
423 |
+
position: ui.position,
|
424 |
+
size: ui.size
|
425 |
+
};
|
426 |
+
}
|
427 |
+
|
428 |
+
self.uiDialog.resizable({
|
429 |
+
cancel: '.ui-dialog-content',
|
430 |
+
containment: 'document',
|
431 |
+
alsoResize: self.element,
|
432 |
+
maxWidth: options.maxWidth,
|
433 |
+
maxHeight: options.maxHeight,
|
434 |
+
minWidth: options.minWidth,
|
435 |
+
minHeight: self._minHeight(),
|
436 |
+
handles: resizeHandles,
|
437 |
+
start: function(event, ui) {
|
438 |
+
$(this).addClass("ui-dialog-resizing");
|
439 |
+
self._trigger('resizeStart', event, filteredUi(ui));
|
440 |
+
},
|
441 |
+
resize: function(event, ui) {
|
442 |
+
self._trigger('resize', event, filteredUi(ui));
|
443 |
+
},
|
444 |
+
stop: function(event, ui) {
|
445 |
+
$(this).removeClass("ui-dialog-resizing");
|
446 |
+
options.height = $(this).height();
|
447 |
+
options.width = $(this).width();
|
448 |
+
self._trigger('resizeStop', event, filteredUi(ui));
|
449 |
+
$.ui.dialog.overlay.resize();
|
450 |
+
}
|
451 |
+
})
|
452 |
+
.css('position', position)
|
453 |
+
.find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
|
454 |
+
},
|
455 |
+
|
456 |
+
_minHeight: function() {
|
457 |
+
var options = this.options;
|
458 |
+
|
459 |
+
if (options.height === 'auto') {
|
460 |
+
return options.minHeight;
|
461 |
+
} else {
|
462 |
+
return Math.min(options.minHeight, options.height);
|
463 |
+
}
|
464 |
+
},
|
465 |
+
|
466 |
+
_position: function(position) {
|
467 |
+
var myAt = [],
|
468 |
+
offset = [0, 0],
|
469 |
+
isVisible;
|
470 |
+
|
471 |
+
if (position) {
|
472 |
+
// deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
|
473 |
+
// if (typeof position == 'string' || $.isArray(position)) {
|
474 |
+
// myAt = $.isArray(position) ? position : position.split(' ');
|
475 |
+
|
476 |
+
if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
|
477 |
+
myAt = position.split ? position.split(' ') : [position[0], position[1]];
|
478 |
+
if (myAt.length === 1) {
|
479 |
+
myAt[1] = myAt[0];
|
480 |
+
}
|
481 |
+
|
482 |
+
$.each(['left', 'top'], function(i, offsetPosition) {
|
483 |
+
if (+myAt[i] === myAt[i]) {
|
484 |
+
offset[i] = myAt[i];
|
485 |
+
myAt[i] = offsetPosition;
|
486 |
+
}
|
487 |
+
});
|
488 |
+
|
489 |
+
position = {
|
490 |
+
my: myAt.join(" "),
|
491 |
+
at: myAt.join(" "),
|
492 |
+
offset: offset.join(" ")
|
493 |
+
};
|
494 |
+
}
|
495 |
+
|
496 |
+
position = $.extend({}, $.ui.dialog.prototype.options.position, position);
|
497 |
+
} else {
|
498 |
+
position = $.ui.dialog.prototype.options.position;
|
499 |
+
}
|
500 |
+
|
501 |
+
// need to show the dialog to get the actual offset in the position plugin
|
502 |
+
isVisible = this.uiDialog.is(':visible');
|
503 |
+
if (!isVisible) {
|
504 |
+
this.uiDialog.show();
|
505 |
+
}
|
506 |
+
this.uiDialog
|
507 |
+
// workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
|
508 |
+
.css({ top: 0, left: 0 })
|
509 |
+
.position(position);
|
510 |
+
if (!isVisible) {
|
511 |
+
this.uiDialog.hide();
|
512 |
+
}
|
513 |
+
},
|
514 |
+
|
515 |
+
_setOption: function(key, value){
|
516 |
+
var self = this,
|
517 |
+
uiDialog = self.uiDialog,
|
518 |
+
isResizable = uiDialog.is(':data(resizable)'),
|
519 |
+
resize = false;
|
520 |
+
|
521 |
+
switch (key) {
|
522 |
+
//handling of deprecated beforeclose (vs beforeClose) option
|
523 |
+
//Ticket #4669 http://dev.jqueryui.com/ticket/4669
|
524 |
+
//TODO: remove in 1.9pre
|
525 |
+
case "beforeclose":
|
526 |
+
key = "beforeClose";
|
527 |
+
break;
|
528 |
+
case "buttons":
|
529 |
+
self._createButtons(value);
|
530 |
+
resize = true;
|
531 |
+
break;
|
532 |
+
case "closeText":
|
533 |
+
// convert whatever was passed in to a string, for text() to not throw up
|
534 |
+
self.uiDialogTitlebarCloseText.text("" + value);
|
535 |
+
break;
|
536 |
+
case "dialogClass":
|
537 |
+
uiDialog
|
538 |
+
.removeClass(self.options.dialogClass)
|
539 |
+
.addClass(uiDialogClasses + value);
|
540 |
+
break;
|
541 |
+
case "disabled":
|
542 |
+
if (value) {
|
543 |
+
uiDialog.addClass('ui-dialog-disabled');
|
544 |
+
} else {
|
545 |
+
uiDialog.removeClass('ui-dialog-disabled');
|
546 |
+
}
|
547 |
+
break;
|
548 |
+
case "draggable":
|
549 |
+
if (value) {
|
550 |
+
self._makeDraggable();
|
551 |
+
} else {
|
552 |
+
uiDialog.draggable('destroy');
|
553 |
+
}
|
554 |
+
break;
|
555 |
+
case "height":
|
556 |
+
resize = true;
|
557 |
+
break;
|
558 |
+
case "maxHeight":
|
559 |
+
if (isResizable) {
|
560 |
+
uiDialog.resizable('option', 'maxHeight', value);
|
561 |
+
}
|
562 |
+
resize = true;
|
563 |
+
break;
|
564 |
+
case "maxWidth":
|
565 |
+
if (isResizable) {
|
566 |
+
uiDialog.resizable('option', 'maxWidth', value);
|
567 |
+
}
|
568 |
+
resize = true;
|
569 |
+
break;
|
570 |
+
case "minHeight":
|
571 |
+
if (isResizable) {
|
572 |
+
uiDialog.resizable('option', 'minHeight', value);
|
573 |
+
}
|
574 |
+
resize = true;
|
575 |
+
break;
|
576 |
+
case "minWidth":
|
577 |
+
if (isResizable) {
|
578 |
+
uiDialog.resizable('option', 'minWidth', value);
|
579 |
+
}
|
580 |
+
resize = true;
|
581 |
+
break;
|
582 |
+
case "position":
|
583 |
+
self._position(value);
|
584 |
+
break;
|
585 |
+
case "resizable":
|
586 |
+
// currently resizable, becoming non-resizable
|
587 |
+
if (isResizable && !value) {
|
588 |
+
uiDialog.resizable('destroy');
|
589 |
+
}
|
590 |
+
|
591 |
+
// currently resizable, changing handles
|
592 |
+
if (isResizable && typeof value === 'string') {
|
593 |
+
uiDialog.resizable('option', 'handles', value);
|
594 |
+
}
|
595 |
+
|
596 |
+
// currently non-resizable, becoming resizable
|
597 |
+
if (!isResizable && value !== false) {
|
598 |
+
self._makeResizable(value);
|
599 |
+
}
|
600 |
+
break;
|
601 |
+
case "title":
|
602 |
+
// convert whatever was passed in o a string, for html() to not throw up
|
603 |
+
$(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || ' '));
|
604 |
+
break;
|
605 |
+
case "width":
|
606 |
+
resize = true;
|
607 |
+
break;
|
608 |
+
}
|
609 |
+
|
610 |
+
$.Widget.prototype._setOption.apply(self, arguments);
|
611 |
+
if (resize) {
|
612 |
+
self._size();
|
613 |
+
}
|
614 |
+
},
|
615 |
+
|
616 |
+
_size: function() {
|
617 |
+
/* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
|
618 |
+
* divs will both have width and height set, so we need to reset them
|
619 |
+
*/
|
620 |
+
var options = this.options,
|
621 |
+
nonContentHeight;
|
622 |
+
|
623 |
+
// reset content sizing
|
624 |
+
// hide for non content measurement because height: 0 doesn't work in IE quirks mode (see #4350)
|
625 |
+
this.element.css({
|
626 |
+
width: 'auto',
|
627 |
+
minHeight: 0,
|
628 |
+
height: 0
|
629 |
+
});
|
630 |
+
|
631 |
+
if (options.minWidth > options.width) {
|
632 |
+
options.width = options.minWidth;
|
633 |
+
}
|
634 |
+
|
635 |
+
// reset wrapper sizing
|
636 |
+
// determine the height of all the non-content elements
|
637 |
+
nonContentHeight = this.uiDialog.css({
|
638 |
+
height: 'auto',
|
639 |
+
width: options.width
|
640 |
+
})
|
641 |
+
.height();
|
642 |
+
|
643 |
+
this.element
|
644 |
+
.css(options.height === 'auto' ? {
|
645 |
+
minHeight: Math.max(options.minHeight - nonContentHeight, 0),
|
646 |
+
height: 'auto'
|
647 |
+
} : {
|
648 |
+
minHeight: 0,
|
649 |
+
height: Math.max(options.height - nonContentHeight, 0)
|
650 |
+
})
|
651 |
+
.show();
|
652 |
+
|
653 |
+
if (this.uiDialog.is(':data(resizable)')) {
|
654 |
+
this.uiDialog.resizable('option', 'minHeight', this._minHeight());
|
655 |
+
}
|
656 |
+
}
|
657 |
+
});
|
658 |
+
|
659 |
+
$.extend($.ui.dialog, {
|
660 |
+
version: "1.8.4",
|
661 |
+
|
662 |
+
uuid: 0,
|
663 |
+
maxZ: 0,
|
664 |
+
|
665 |
+
getTitleId: function($el) {
|
666 |
+
var id = $el.attr('id');
|
667 |
+
if (!id) {
|
668 |
+
this.uuid += 1;
|
669 |
+
id = this.uuid;
|
670 |
+
}
|
671 |
+
return 'ui-dialog-title-' + id;
|
672 |
+
},
|
673 |
+
|
674 |
+
overlay: function(dialog) {
|
675 |
+
this.$el = $.ui.dialog.overlay.create(dialog);
|
676 |
+
}
|
677 |
+
});
|
678 |
+
|
679 |
+
$.extend($.ui.dialog.overlay, {
|
680 |
+
instances: [],
|
681 |
+
// reuse old instances due to IE memory leak with alpha transparency (see #5185)
|
682 |
+
oldInstances: [],
|
683 |
+
maxZ: 0,
|
684 |
+
events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
|
685 |
+
function(event) { return event + '.dialog-overlay'; }).join(' '),
|
686 |
+
create: function(dialog) {
|
687 |
+
if (this.instances.length === 0) {
|
688 |
+
// prevent use of anchors and inputs
|
689 |
+
// we use a setTimeout in case the overlay is created from an
|
690 |
+
// event that we're going to be cancelling (see #2804)
|
691 |
+
setTimeout(function() {
|
692 |
+
// handle $(el).dialog().dialog('close') (see #4065)
|
693 |
+
if ($.ui.dialog.overlay.instances.length) {
|
694 |
+
$(document).bind($.ui.dialog.overlay.events, function(event) {
|
695 |
+
// stop events if the z-index of the target is < the z-index of the overlay
|
696 |
+
return ($(event.target).zIndex() >= $.ui.dialog.overlay.maxZ);
|
697 |
+
});
|
698 |
+
}
|
699 |
+
}, 1);
|
700 |
+
|
701 |
+
// allow closing by pressing the escape key
|
702 |
+
$(document).bind('keydown.dialog-overlay', function(event) {
|
703 |
+
if (dialog.options.closeOnEscape && event.keyCode &&
|
704 |
+
event.keyCode === $.ui.keyCode.ESCAPE) {
|
705 |
+
|
706 |
+
dialog.close(event);
|
707 |
+
event.preventDefault();
|
708 |
+
}
|
709 |
+
});
|
710 |
+
|
711 |
+
// handle window resize
|
712 |
+
$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
|
713 |
+
}
|
714 |
+
|
715 |
+
var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))
|
716 |
+
.appendTo(document.body)
|
717 |
+
.css({
|
718 |
+
width: this.width(),
|
719 |
+
height: this.height()
|
720 |
+
});
|
721 |
+
|
722 |
+
if ($.fn.bgiframe) {
|
723 |
+
$el.bgiframe();
|
724 |
+
}
|
725 |
+
|
726 |
+
this.instances.push($el);
|
727 |
+
return $el;
|
728 |
+
},
|
729 |
+
|
730 |
+
destroy: function($el) {
|
731 |
+
this.oldInstances.push(this.instances.splice($.inArray($el, this.instances), 1)[0]);
|
732 |
+
|
733 |
+
if (this.instances.length === 0) {
|
734 |
+
$([document, window]).unbind('.dialog-overlay');
|
735 |
+
}
|
736 |
+
|
737 |
+
$el.remove();
|
738 |
+
|
739 |
+
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
|
740 |
+
var maxZ = 0;
|
741 |
+
$.each(this.instances, function() {
|
742 |
+
maxZ = Math.max(maxZ, this.css('z-index'));
|
743 |
+
});
|
744 |
+
this.maxZ = maxZ;
|
745 |
+
},
|
746 |
+
|
747 |
+
height: function() {
|
748 |
+
var scrollHeight,
|
749 |
+
offsetHeight;
|
750 |
+
// handle IE 6
|
751 |
+
if ($.browser.msie && $.browser.version < 7) {
|
752 |
+
scrollHeight = Math.max(
|
753 |
+
document.documentElement.scrollHeight,
|
754 |
+
document.body.scrollHeight
|
755 |
+
);
|
756 |
+
offsetHeight = Math.max(
|
757 |
+
document.documentElement.offsetHeight,
|
758 |
+
document.body.offsetHeight
|
759 |
+
);
|
760 |
+
|
761 |
+
if (scrollHeight < offsetHeight) {
|
762 |
+
return $(window).height() + 'px';
|
763 |
+
} else {
|
764 |
+
return scrollHeight + 'px';
|
765 |
+
}
|
766 |
+
// handle "good" browsers
|
767 |
+
} else {
|
768 |
+
return $(document).height() + 'px';
|
769 |
+
}
|
770 |
+
},
|
771 |
+
|
772 |
+
width: function() {
|
773 |
+
var scrollWidth,
|
774 |
+
offsetWidth;
|
775 |
+
// handle IE 6
|
776 |
+
if ($.browser.msie && $.browser.version < 7) {
|
777 |
+
scrollWidth = Math.max(
|
778 |
+
document.documentElement.scrollWidth,
|
779 |
+
document.body.scrollWidth
|
780 |
+
);
|
781 |
+
offsetWidth = Math.max(
|
782 |
+
document.documentElement.offsetWidth,
|
783 |
+
document.body.offsetWidth
|
784 |
+
);
|
785 |
+
|
786 |
+
if (scrollWidth < offsetWidth) {
|
787 |
+
return $(window).width() + 'px';
|
788 |
+
} else {
|
789 |
+
return scrollWidth + 'px';
|
790 |
+
}
|
791 |
+
// handle "good" browsers
|
792 |
+
} else {
|
793 |
+
return $(document).width() + 'px';
|
794 |
+
}
|
795 |
+
},
|
796 |
+
|
797 |
+
resize: function() {
|
798 |
+
/* If the dialog is draggable and the user drags it past the
|
799 |
+
* right edge of the window, the document becomes wider so we
|
800 |
+
* need to stretch the overlay. If the user then drags the
|
801 |
+
* dialog back to the left, the document will become narrower,
|
802 |
+
* so we need to shrink the overlay to the appropriate size.
|
803 |
+
* This is handled by shrinking the overlay before setting it
|
804 |
+
* to the full document size.
|
805 |
+
*/
|
806 |
+
var $overlays = $([]);
|
807 |
+
$.each($.ui.dialog.overlay.instances, function() {
|
808 |
+
$overlays = $overlays.add(this);
|
809 |
+
});
|
810 |
+
|
811 |
+
$overlays.css({
|
812 |
+
width: 0,
|
813 |
+
height: 0
|
814 |
+
}).css({
|
815 |
+
width: $.ui.dialog.overlay.width(),
|
816 |
+
height: $.ui.dialog.overlay.height()
|
817 |
+
});
|
818 |
+
}
|
819 |
+
});
|
820 |
+
|
821 |
+
$.extend($.ui.dialog.overlay.prototype, {
|
822 |
+
destroy: function() {
|
823 |
+
$.ui.dialog.overlay.destroy(this.$el);
|
824 |
+
}
|
825 |
+
});
|
826 |
+
|
827 |
+
}(jQuery));
|
js/jquery.ui.position.js
CHANGED
@@ -1,233 +1,233 @@
|
|
1 |
-
/*
|
2 |
-
* jQuery UI Position 1.8.4
|
3 |
-
*
|
4 |
-
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
-
* http://jquery.org/license
|
7 |
-
*
|
8 |
-
* http://docs.jquery.com/UI/Position
|
9 |
-
*/
|
10 |
-
(function( $, undefined ) {
|
11 |
-
|
12 |
-
$.ui = $.ui || {};
|
13 |
-
|
14 |
-
var horizontalPositions = /left|center|right/,
|
15 |
-
horizontalDefault = "center",
|
16 |
-
verticalPositions = /top|center|bottom/,
|
17 |
-
verticalDefault = "center",
|
18 |
-
_position = $.fn.position,
|
19 |
-
_offset = $.fn.offset;
|
20 |
-
|
21 |
-
$.fn.position = function( options ) {
|
22 |
-
if ( !options || !options.of ) {
|
23 |
-
return _position.apply( this, arguments );
|
24 |
-
}
|
25 |
-
|
26 |
-
// make a copy, we don't want to modify arguments
|
27 |
-
options = $.extend( {}, options );
|
28 |
-
|
29 |
-
var target = $( options.of ),
|
30 |
-
collision = ( options.collision || "flip" ).split( " " ),
|
31 |
-
offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
|
32 |
-
targetWidth,
|
33 |
-
targetHeight,
|
34 |
-
basePosition;
|
35 |
-
|
36 |
-
if ( options.of.nodeType === 9 ) {
|
37 |
-
targetWidth = target.width();
|
38 |
-
targetHeight = target.height();
|
39 |
-
basePosition = { top: 0, left: 0 };
|
40 |
-
} else if ( options.of.scrollTo && options.of.document ) {
|
41 |
-
targetWidth = target.width();
|
42 |
-
targetHeight = target.height();
|
43 |
-
basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
|
44 |
-
} else if ( options.of.preventDefault ) {
|
45 |
-
// force left top to allow flipping
|
46 |
-
options.at = "left top";
|
47 |
-
targetWidth = targetHeight = 0;
|
48 |
-
basePosition = { top: options.of.pageY, left: options.of.pageX };
|
49 |
-
} else {
|
50 |
-
targetWidth = target.outerWidth();
|
51 |
-
targetHeight = target.outerHeight();
|
52 |
-
basePosition = target.offset();
|
53 |
-
}
|
54 |
-
|
55 |
-
// force my and at to have valid horizontal and veritcal positions
|
56 |
-
// if a value is missing or invalid, it will be converted to center
|
57 |
-
$.each( [ "my", "at" ], function() {
|
58 |
-
var pos = ( options[this] || "" ).split( " " );
|
59 |
-
if ( pos.length === 1) {
|
60 |
-
pos = horizontalPositions.test( pos[0] ) ?
|
61 |
-
pos.concat( [verticalDefault] ) :
|
62 |
-
verticalPositions.test( pos[0] ) ?
|
63 |
-
[ horizontalDefault ].concat( pos ) :
|
64 |
-
[ horizontalDefault, verticalDefault ];
|
65 |
-
}
|
66 |
-
pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : horizontalDefault;
|
67 |
-
pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : verticalDefault;
|
68 |
-
options[ this ] = pos;
|
69 |
-
});
|
70 |
-
|
71 |
-
// normalize collision option
|
72 |
-
if ( collision.length === 1 ) {
|
73 |
-
collision[ 1 ] = collision[ 0 ];
|
74 |
-
}
|
75 |
-
|
76 |
-
// normalize offset option
|
77 |
-
offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
|
78 |
-
if ( offset.length === 1 ) {
|
79 |
-
offset[ 1 ] = offset[ 0 ];
|
80 |
-
}
|
81 |
-
offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
|
82 |
-
|
83 |
-
if ( options.at[0] === "right" ) {
|
84 |
-
basePosition.left += targetWidth;
|
85 |
-
} else if (options.at[0] === horizontalDefault ) {
|
86 |
-
basePosition.left += targetWidth / 2;
|
87 |
-
}
|
88 |
-
|
89 |
-
if ( options.at[1] === "bottom" ) {
|
90 |
-
basePosition.top += targetHeight;
|
91 |
-
} else if ( options.at[1] === verticalDefault ) {
|
92 |
-
basePosition.top += targetHeight / 2;
|
93 |
-
}
|
94 |
-
|
95 |
-
basePosition.left += offset[ 0 ];
|
96 |
-
basePosition.top += offset[ 1 ];
|
97 |
-
|
98 |
-
return this.each(function() {
|
99 |
-
var elem = $( this ),
|
100 |
-
elemWidth = elem.outerWidth(),
|
101 |
-
elemHeight = elem.outerHeight(),
|
102 |
-
position = $.extend( {}, basePosition );
|
103 |
-
|
104 |
-
if ( options.my[0] === "right" ) {
|
105 |
-
position.left -= elemWidth;
|
106 |
-
} else if ( options.my[0] === horizontalDefault ) {
|
107 |
-
position.left -= elemWidth / 2;
|
108 |
-
}
|
109 |
-
|
110 |
-
if ( options.my[1] === "bottom" ) {
|
111 |
-
position.top -= elemHeight;
|
112 |
-
} else if ( options.my[1] === verticalDefault ) {
|
113 |
-
position.top -= elemHeight / 2;
|
114 |
-
}
|
115 |
-
|
116 |
-
// prevent fractions (see #5280)
|
117 |
-
position.left = parseInt( position.left );
|
118 |
-
position.top = parseInt( position.top );
|
119 |
-
|
120 |
-
$.each( [ "left", "top" ], function( i, dir ) {
|
121 |
-
if ( $.ui.position[ collision[i] ] ) {
|
122 |
-
$.ui.position[ collision[i] ][ dir ]( position, {
|
123 |
-
targetWidth: targetWidth,
|
124 |
-
targetHeight: targetHeight,
|
125 |
-
elemWidth: elemWidth,
|
126 |
-
elemHeight: elemHeight,
|
127 |
-
offset: offset,
|
128 |
-
my: options.my,
|
129 |
-
at: options.at
|
130 |
-
});
|
131 |
-
}
|
132 |
-
});
|
133 |
-
|
134 |
-
if ( $.fn.bgiframe ) {
|
135 |
-
elem.bgiframe();
|
136 |
-
}
|
137 |
-
elem.offset( $.extend( position, { using: options.using } ) );
|
138 |
-
});
|
139 |
-
};
|
140 |
-
|
141 |
-
$.ui.position = {
|
142 |
-
fit: {
|
143 |
-
left: function( position, data ) {
|
144 |
-
var win = $( window ),
|
145 |
-
over = position.left + data.elemWidth - win.width() - win.scrollLeft();
|
146 |
-
position.left = over > 0 ? position.left - over : Math.max( 0, position.left );
|
147 |
-
},
|
148 |
-
top: function( position, data ) {
|
149 |
-
var win = $( window ),
|
150 |
-
over = position.top + data.elemHeight - win.height() - win.scrollTop();
|
151 |
-
position.top = over > 0 ? position.top - over : Math.max( 0, position.top );
|
152 |
-
}
|
153 |
-
},
|
154 |
-
|
155 |
-
flip: {
|
156 |
-
left: function( position, data ) {
|
157 |
-
if ( data.at[0] === "center" ) {
|
158 |
-
return;
|
159 |
-
}
|
160 |
-
var win = $( window ),
|
161 |
-
over = position.left + data.elemWidth - win.width() - win.scrollLeft(),
|
162 |
-
myOffset = data.my[ 0 ] === "left" ?
|
163 |
-
-data.elemWidth :
|
164 |
-
data.my[ 0 ] === "right" ?
|
165 |
-
data.elemWidth :
|
166 |
-
0,
|
167 |
-
offset = -2 * data.offset[ 0 ];
|
168 |
-
position.left += position.left < 0 ?
|
169 |
-
myOffset + data.targetWidth + offset :
|
170 |
-
over > 0 ?
|
171 |
-
myOffset - data.targetWidth + offset :
|
172 |
-
0;
|
173 |
-
},
|
174 |
-
top: function( position, data ) {
|
175 |
-
if ( data.at[1] === "center" ) {
|
176 |
-
return;
|
177 |
-
}
|
178 |
-
var win = $( window ),
|
179 |
-
over = position.top + data.elemHeight - win.height() - win.scrollTop(),
|
180 |
-
myOffset = data.my[ 1 ] === "top" ?
|
181 |
-
-data.elemHeight :
|
182 |
-
data.my[ 1 ] === "bottom" ?
|
183 |
-
data.elemHeight :
|
184 |
-
0,
|
185 |
-
atOffset = data.at[ 1 ] === "top" ?
|
186 |
-
data.targetHeight :
|
187 |
-
-data.targetHeight,
|
188 |
-
offset = -2 * data.offset[ 1 ];
|
189 |
-
position.top += position.top < 0 ?
|
190 |
-
myOffset + data.targetHeight + offset :
|
191 |
-
over > 0 ?
|
192 |
-
myOffset + atOffset + offset :
|
193 |
-
0;
|
194 |
-
}
|
195 |
-
}
|
196 |
-
};
|
197 |
-
|
198 |
-
// offset setter from jQuery 1.4
|
199 |
-
if ( !$.offset.setOffset ) {
|
200 |
-
$.offset.setOffset = function( elem, options ) {
|
201 |
-
// set position first, in-case top/left are set even on static elem
|
202 |
-
if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
|
203 |
-
elem.style.position = "relative";
|
204 |
-
}
|
205 |
-
var curElem = $( elem ),
|
206 |
-
curOffset = curElem.offset(),
|
207 |
-
curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
|
208 |
-
curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
|
209 |
-
props = {
|
210 |
-
top: (options.top - curOffset.top) + curTop,
|
211 |
-
left: (options.left - curOffset.left) + curLeft
|
212 |
-
};
|
213 |
-
|
214 |
-
if ( 'using' in options ) {
|
215 |
-
options.using.call( elem, props );
|
216 |
-
} else {
|
217 |
-
curElem.css( props );
|
218 |
-
}
|
219 |
-
};
|
220 |
-
|
221 |
-
$.fn.offset = function( options ) {
|
222 |
-
var elem = this[ 0 ];
|
223 |
-
if ( !elem || !elem.ownerDocument ) { return null; }
|
224 |
-
if ( options ) {
|
225 |
-
return this.each(function() {
|
226 |
-
$.offset.setOffset( this, options );
|
227 |
-
});
|
228 |
-
}
|
229 |
-
return _offset.call( this );
|
230 |
-
};
|
231 |
-
}
|
232 |
-
|
233 |
-
}( jQuery ));
|
1 |
+
/*
|
2 |
+
* jQuery UI Position 1.8.4
|
3 |
+
*
|
4 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
* http://jquery.org/license
|
7 |
+
*
|
8 |
+
* http://docs.jquery.com/UI/Position
|
9 |
+
*/
|
10 |
+
(function( $, undefined ) {
|
11 |
+
|
12 |
+
$.ui = $.ui || {};
|
13 |
+
|
14 |
+
var horizontalPositions = /left|center|right/,
|
15 |
+
horizontalDefault = "center",
|
16 |
+
verticalPositions = /top|center|bottom/,
|
17 |
+
verticalDefault = "center",
|
18 |
+
_position = $.fn.position,
|
19 |
+
_offset = $.fn.offset;
|
20 |
+
|
21 |
+
$.fn.position = function( options ) {
|
22 |
+
if ( !options || !options.of ) {
|
23 |
+
return _position.apply( this, arguments );
|
24 |
+
}
|
25 |
+
|
26 |
+
// make a copy, we don't want to modify arguments
|
27 |
+
options = $.extend( {}, options );
|
28 |
+
|
29 |
+
var target = $( options.of ),
|
30 |
+
collision = ( options.collision || "flip" ).split( " " ),
|
31 |
+
offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
|
32 |
+
targetWidth,
|
33 |
+
targetHeight,
|
34 |
+
basePosition;
|
35 |
+
|
36 |
+
if ( options.of.nodeType === 9 ) {
|
37 |
+
targetWidth = target.width();
|
38 |
+
targetHeight = target.height();
|
39 |
+
basePosition = { top: 0, left: 0 };
|
40 |
+
} else if ( options.of.scrollTo && options.of.document ) {
|
41 |
+
targetWidth = target.width();
|
42 |
+
targetHeight = target.height();
|
43 |
+
basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
|
44 |
+
} else if ( options.of.preventDefault ) {
|
45 |
+
// force left top to allow flipping
|
46 |
+
options.at = "left top";
|
47 |
+
targetWidth = targetHeight = 0;
|
48 |
+
basePosition = { top: options.of.pageY, left: options.of.pageX };
|
49 |
+
} else {
|
50 |
+
targetWidth = target.outerWidth();
|
51 |
+
targetHeight = target.outerHeight();
|
52 |
+
basePosition = target.offset();
|
53 |
+
}
|
54 |
+
|
55 |
+
// force my and at to have valid horizontal and veritcal positions
|
56 |
+
// if a value is missing or invalid, it will be converted to center
|
57 |
+
$.each( [ "my", "at" ], function() {
|
58 |
+
var pos = ( options[this] || "" ).split( " " );
|
59 |
+
if ( pos.length === 1) {
|
60 |
+
pos = horizontalPositions.test( pos[0] ) ?
|
61 |
+
pos.concat( [verticalDefault] ) :
|
62 |
+
verticalPositions.test( pos[0] ) ?
|
63 |
+
[ horizontalDefault ].concat( pos ) :
|
64 |
+
[ horizontalDefault, verticalDefault ];
|
65 |
+
}
|
66 |
+
pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : horizontalDefault;
|
67 |
+
pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : verticalDefault;
|
68 |
+
options[ this ] = pos;
|
69 |
+
});
|
70 |
+
|
71 |
+
// normalize collision option
|
72 |
+
if ( collision.length === 1 ) {
|
73 |
+
collision[ 1 ] = collision[ 0 ];
|
74 |
+
}
|
75 |
+
|
76 |
+
// normalize offset option
|
77 |
+
offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
|
78 |
+
if ( offset.length === 1 ) {
|
79 |
+
offset[ 1 ] = offset[ 0 ];
|
80 |
+
}
|
81 |
+
offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
|
82 |
+
|
83 |
+
if ( options.at[0] === "right" ) {
|
84 |
+
basePosition.left += targetWidth;
|
85 |
+
} else if (options.at[0] === horizontalDefault ) {
|
86 |
+
basePosition.left += targetWidth / 2;
|
87 |
+
}
|
88 |
+
|
89 |
+
if ( options.at[1] === "bottom" ) {
|
90 |
+
basePosition.top += targetHeight;
|
91 |
+
} else if ( options.at[1] === verticalDefault ) {
|
92 |
+
basePosition.top += targetHeight / 2;
|
93 |
+
}
|
94 |
+
|
95 |
+
basePosition.left += offset[ 0 ];
|
96 |
+
basePosition.top += offset[ 1 ];
|
97 |
+
|
98 |
+
return this.each(function() {
|
99 |
+
var elem = $( this ),
|
100 |
+
elemWidth = elem.outerWidth(),
|
101 |
+
elemHeight = elem.outerHeight(),
|
102 |
+
position = $.extend( {}, basePosition );
|
103 |
+
|
104 |
+
if ( options.my[0] === "right" ) {
|
105 |
+
position.left -= elemWidth;
|
106 |
+
} else if ( options.my[0] === horizontalDefault ) {
|
107 |
+
position.left -= elemWidth / 2;
|
108 |
+
}
|
109 |
+
|
110 |
+
if ( options.my[1] === "bottom" ) {
|
111 |
+
position.top -= elemHeight;
|
112 |
+
} else if ( options.my[1] === verticalDefault ) {
|
113 |
+
position.top -= elemHeight / 2;
|
114 |
+
}
|
115 |
+
|
116 |
+
// prevent fractions (see #5280)
|
117 |
+
position.left = parseInt( position.left );
|
118 |
+
position.top = parseInt( position.top );
|
119 |
+
|
120 |
+
$.each( [ "left", "top" ], function( i, dir ) {
|
121 |
+
if ( $.ui.position[ collision[i] ] ) {
|
122 |
+
$.ui.position[ collision[i] ][ dir ]( position, {
|
123 |
+
targetWidth: targetWidth,
|
124 |
+
targetHeight: targetHeight,
|
125 |
+
elemWidth: elemWidth,
|
126 |
+
elemHeight: elemHeight,
|
127 |
+
offset: offset,
|
128 |
+
my: options.my,
|
129 |
+
at: options.at
|
130 |
+
});
|
131 |
+
}
|
132 |
+
});
|
133 |
+
|
134 |
+
if ( $.fn.bgiframe ) {
|
135 |
+
elem.bgiframe();
|
136 |
+
}
|
137 |
+
elem.offset( $.extend( position, { using: options.using } ) );
|
138 |
+
});
|
139 |
+
};
|
140 |
+
|
141 |
+
$.ui.position = {
|
142 |
+
fit: {
|
143 |
+
left: function( position, data ) {
|
144 |
+
var win = $( window ),
|
145 |
+
over = position.left + data.elemWidth - win.width() - win.scrollLeft();
|
146 |
+
position.left = over > 0 ? position.left - over : Math.max( 0, position.left );
|
147 |
+
},
|
148 |
+
top: function( position, data ) {
|
149 |
+
var win = $( window ),
|
150 |
+
over = position.top + data.elemHeight - win.height() - win.scrollTop();
|
151 |
+
position.top = over > 0 ? position.top - over : Math.max( 0, position.top );
|
152 |
+
}
|
153 |
+
},
|
154 |
+
|
155 |
+
flip: {
|
156 |
+
left: function( position, data ) {
|
157 |
+
if ( data.at[0] === "center" ) {
|
158 |
+
return;
|
159 |
+
}
|
160 |
+
var win = $( window ),
|
161 |
+
over = position.left + data.elemWidth - win.width() - win.scrollLeft(),
|
162 |
+
myOffset = data.my[ 0 ] === "left" ?
|
163 |
+
-data.elemWidth :
|
164 |
+
data.my[ 0 ] === "right" ?
|
165 |
+
data.elemWidth :
|
166 |
+
0,
|
167 |
+
offset = -2 * data.offset[ 0 ];
|
168 |
+
position.left += position.left < 0 ?
|
169 |
+
myOffset + data.targetWidth + offset :
|
170 |
+
over > 0 ?
|
171 |
+
myOffset - data.targetWidth + offset :
|
172 |
+
0;
|
173 |
+
},
|
174 |
+
top: function( position, data ) {
|
175 |
+
if ( data.at[1] === "center" ) {
|
176 |
+
return;
|
177 |
+
}
|
178 |
+
var win = $( window ),
|
179 |
+
over = position.top + data.elemHeight - win.height() - win.scrollTop(),
|
180 |
+
myOffset = data.my[ 1 ] === "top" ?
|
181 |
+
-data.elemHeight :
|
182 |
+
data.my[ 1 ] === "bottom" ?
|
183 |
+
data.elemHeight :
|
184 |
+
0,
|
185 |
+
atOffset = data.at[ 1 ] === "top" ?
|
186 |
+
data.targetHeight :
|
187 |
+
-data.targetHeight,
|
188 |
+
offset = -2 * data.offset[ 1 ];
|
189 |
+
position.top += position.top < 0 ?
|
190 |
+
myOffset + data.targetHeight + offset :
|
191 |
+
over > 0 ?
|
192 |
+
myOffset + atOffset + offset :
|
193 |
+
0;
|
194 |
+
}
|
195 |
+
}
|
196 |
+
};
|
197 |
+
|
198 |
+
// offset setter from jQuery 1.4
|
199 |
+
if ( !$.offset.setOffset ) {
|
200 |
+
$.offset.setOffset = function( elem, options ) {
|
201 |
+
// set position first, in-case top/left are set even on static elem
|
202 |
+
if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
|
203 |
+
elem.style.position = "relative";
|
204 |
+
}
|
205 |
+
var curElem = $( elem ),
|
206 |
+
curOffset = curElem.offset(),
|
207 |
+
curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
|
208 |
+
curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
|
209 |
+
props = {
|
210 |
+
top: (options.top - curOffset.top) + curTop,
|
211 |
+
left: (options.left - curOffset.left) + curLeft
|
212 |
+
};
|
213 |
+
|
214 |
+
if ( 'using' in options ) {
|
215 |
+
options.using.call( elem, props );
|
216 |
+
} else {
|
217 |
+
curElem.css( props );
|
218 |
+
}
|
219 |
+
};
|
220 |
+
|
221 |
+
$.fn.offset = function( options ) {
|
222 |
+
var elem = this[ 0 ];
|
223 |
+
if ( !elem || !elem.ownerDocument ) { return null; }
|
224 |
+
if ( options ) {
|
225 |
+
return this.each(function() {
|
226 |
+
$.offset.setOffset( this, options );
|
227 |
+
});
|
228 |
+
}
|
229 |
+
return _offset.call( this );
|
230 |
+
};
|
231 |
+
}
|
232 |
+
|
233 |
+
}( jQuery ));
|
js/jquery.ui.widget.js
CHANGED
@@ -1,237 +1,237 @@
|
|
1 |
-
/*!
|
2 |
-
* jQuery UI Widget 1.8.4
|
3 |
-
*
|
4 |
-
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
-
* http://jquery.org/license
|
7 |
-
*
|
8 |
-
* http://docs.jquery.com/UI/Widget
|
9 |
-
*/
|
10 |
-
(function( $, undefined ) {
|
11 |
-
|
12 |
-
var _remove = $.fn.remove;
|
13 |
-
|
14 |
-
$.fn.remove = function( selector, keepData ) {
|
15 |
-
return this.each(function() {
|
16 |
-
if ( !keepData ) {
|
17 |
-
if ( !selector || $.filter( selector, [ this ] ).length ) {
|
18 |
-
$( "*", this ).add( [ this ] ).each(function() {
|
19 |
-
$( this ).triggerHandler( "remove" );
|
20 |
-
});
|
21 |
-
}
|
22 |
-
}
|
23 |
-
return _remove.call( $(this), selector, keepData );
|
24 |
-
});
|
25 |
-
};
|
26 |
-
|
27 |
-
$.widget = function( name, base, prototype ) {
|
28 |
-
var namespace = name.split( "." )[ 0 ],
|
29 |
-
fullName;
|
30 |
-
name = name.split( "." )[ 1 ];
|
31 |
-
fullName = namespace + "-" + name;
|
32 |
-
|
33 |
-
if ( !prototype ) {
|
34 |
-
prototype = base;
|
35 |
-
base = $.Widget;
|
36 |
-
}
|
37 |
-
|
38 |
-
// create selector for plugin
|
39 |
-
$.expr[ ":" ][ fullName ] = function( elem ) {
|
40 |
-
return !!$.data( elem, name );
|
41 |
-
};
|
42 |
-
|
43 |
-
$[ namespace ] = $[ namespace ] || {};
|
44 |
-
$[ namespace ][ name ] = function( options, element ) {
|
45 |
-
// allow instantiation without initializing for simple inheritance
|
46 |
-
if ( arguments.length ) {
|
47 |
-
this._createWidget( options, element );
|
48 |
-
}
|
49 |
-
};
|
50 |
-
|
51 |
-
var basePrototype = new base();
|
52 |
-
// we need to make the options hash a property directly on the new instance
|
53 |
-
// otherwise we'll modify the options hash on the prototype that we're
|
54 |
-
// inheriting from
|
55 |
-
// $.each( basePrototype, function( key, val ) {
|
56 |
-
// if ( $.isPlainObject(val) ) {
|
57 |
-
// basePrototype[ key ] = $.extend( {}, val );
|
58 |
-
// }
|
59 |
-
// });
|
60 |
-
basePrototype.options = $.extend( true, {}, basePrototype.options );
|
61 |
-
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
|
62 |
-
namespace: namespace,
|
63 |
-
widgetName: name,
|
64 |
-
widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
|
65 |
-
widgetBaseClass: fullName
|
66 |
-
}, prototype );
|
67 |
-
|
68 |
-
$.widget.bridge( name, $[ namespace ][ name ] );
|
69 |
-
};
|
70 |
-
|
71 |
-
$.widget.bridge = function( name, object ) {
|
72 |
-
$.fn[ name ] = function( options ) {
|
73 |
-
var isMethodCall = typeof options === "string",
|
74 |
-
args = Array.prototype.slice.call( arguments, 1 ),
|
75 |
-
returnValue = this;
|
76 |
-
|
77 |
-
// allow multiple hashes to be passed on init
|
78 |
-
options = !isMethodCall && args.length ?
|
79 |
-
$.extend.apply( null, [ true, options ].concat(args) ) :
|
80 |
-
options;
|
81 |
-
|
82 |
-
// prevent calls to internal methods
|
83 |
-
if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
|
84 |
-
return returnValue;
|
85 |
-
}
|
86 |
-
|
87 |
-
if ( isMethodCall ) {
|
88 |
-
this.each(function() {
|
89 |
-
var instance = $.data( this, name ),
|
90 |
-
methodValue = instance && $.isFunction( instance[options] ) ?
|
91 |
-
instance[ options ].apply( instance, args ) :
|
92 |
-
instance;
|
93 |
-
if ( methodValue !== instance && methodValue !== undefined ) {
|
94 |
-
returnValue = methodValue;
|
95 |
-
return false;
|
96 |
-
}
|
97 |
-
});
|
98 |
-
} else {
|
99 |
-
this.each(function() {
|
100 |
-
var instance = $.data( this, name );
|
101 |
-
if ( instance ) {
|
102 |
-
if ( options ) {
|
103 |
-
instance.option( options );
|
104 |
-
}
|
105 |
-
instance._init();
|
106 |
-
} else {
|
107 |
-
$.data( this, name, new object( options, this ) );
|
108 |
-
}
|
109 |
-
});
|
110 |
-
}
|
111 |
-
|
112 |
-
return returnValue;
|
113 |
-
};
|
114 |
-
};
|
115 |
-
|
116 |
-
$.Widget = function( options, element ) {
|
117 |
-
// allow instantiation without initializing for simple inheritance
|
118 |
-
if ( arguments.length ) {
|
119 |
-
this._createWidget( options, element );
|
120 |
-
}
|
121 |
-
};
|
122 |
-
|
123 |
-
$.Widget.prototype = {
|
124 |
-
widgetName: "widget",
|
125 |
-
widgetEventPrefix: "",
|
126 |
-
options: {
|
127 |
-
disabled: false
|
128 |
-
},
|
129 |
-
_createWidget: function( options, element ) {
|
130 |
-
// $.widget.bridge stores the plugin instance, but we do it anyway
|
131 |
-
// so that it's stored even before the _create function runs
|
132 |
-
$.data( element, this.widgetName, this );
|
133 |
-
this.element = $( element );
|
134 |
-
this.options = $.extend( true, {},
|
135 |
-
this.options,
|
136 |
-
$.metadata && $.metadata.get( element )[ this.widgetName ],
|
137 |
-
options );
|
138 |
-
|
139 |
-
var self = this;
|
140 |
-
this.element.bind( "remove." + this.widgetName, function() {
|
141 |
-
self.destroy();
|
142 |
-
});
|
143 |
-
|
144 |
-
this._create();
|
145 |
-
this._init();
|
146 |
-
},
|
147 |
-
_create: function() {},
|
148 |
-
_init: function() {},
|
149 |
-
|
150 |
-
destroy: function() {
|
151 |
-
this.element
|
152 |
-
.unbind( "." + this.widgetName )
|
153 |
-
.removeData( this.widgetName );
|
154 |
-
this.widget()
|
155 |
-
.unbind( "." + this.widgetName )
|
156 |
-
.removeAttr( "aria-disabled" )
|
157 |
-
.removeClass(
|
158 |
-
this.widgetBaseClass + "-disabled " +
|
159 |
-
"ui-state-disabled" );
|
160 |
-
},
|
161 |
-
|
162 |
-
widget: function() {
|
163 |
-
return this.element;
|
164 |
-
},
|
165 |
-
|
166 |
-
option: function( key, value ) {
|
167 |
-
var options = key,
|
168 |
-
self = this;
|
169 |
-
|
170 |
-
if ( arguments.length === 0 ) {
|
171 |
-
// don't return a reference to the internal hash
|
172 |
-
return $.extend( {}, self.options );
|
173 |
-
}
|
174 |
-
|
175 |
-
if (typeof key === "string" ) {
|
176 |
-
if ( value === undefined ) {
|
177 |
-
return this.options[ key ];
|
178 |
-
}
|
179 |
-
options = {};
|
180 |
-
options[ key ] = value;
|
181 |
-
}
|
182 |
-
|
183 |
-
$.each( options, function( key, value ) {
|
184 |
-
self._setOption( key, value );
|
185 |
-
});
|
186 |
-
|
187 |
-
return self;
|
188 |
-
},
|
189 |
-
_setOption: function( key, value ) {
|
190 |
-
this.options[ key ] = value;
|
191 |
-
|
192 |
-
if ( key === "disabled" ) {
|
193 |
-
this.widget()
|
194 |
-
[ value ? "addClass" : "removeClass"](
|
195 |
-
this.widgetBaseClass + "-disabled" + " " +
|
196 |
-
"ui-state-disabled" )
|
197 |
-
.attr( "aria-disabled", value );
|
198 |
-
}
|
199 |
-
|
200 |
-
return this;
|
201 |
-
},
|
202 |
-
|
203 |
-
enable: function() {
|
204 |
-
return this._setOption( "disabled", false );
|
205 |
-
},
|
206 |
-
disable: function() {
|
207 |
-
return this._setOption( "disabled", true );
|
208 |
-
},
|
209 |
-
|
210 |
-
_trigger: function( type, event, data ) {
|
211 |
-
var callback = this.options[ type ];
|
212 |
-
|
213 |
-
event = $.Event( event );
|
214 |
-
event.type = ( type === this.widgetEventPrefix ?
|
215 |
-
type :
|
216 |
-
this.widgetEventPrefix + type ).toLowerCase();
|
217 |
-
data = data || {};
|
218 |
-
|
219 |
-
// copy original event properties over to the new event
|
220 |
-
// this would happen if we could call $.event.fix instead of $.Event
|
221 |
-
// but we don't have a way to force an event to be fixed multiple times
|
222 |
-
if ( event.originalEvent ) {
|
223 |
-
for ( var i = $.event.props.length, prop; i; ) {
|
224 |
-
prop = $.event.props[ --i ];
|
225 |
-
event[ prop ] = event.originalEvent[ prop ];
|
226 |
-
}
|
227 |
-
}
|
228 |
-
|
229 |
-
this.element.trigger( event, data );
|
230 |
-
|
231 |
-
return !( $.isFunction(callback) &&
|
232 |
-
callback.call( this.element[0], event, data ) === false ||
|
233 |
-
event.isDefaultPrevented() );
|
234 |
-
}
|
235 |
-
};
|
236 |
-
|
237 |
-
})( jQuery );
|
1 |
+
/*!
|
2 |
+
* jQuery UI Widget 1.8.4
|
3 |
+
*
|
4 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
* http://jquery.org/license
|
7 |
+
*
|
8 |
+
* http://docs.jquery.com/UI/Widget
|
9 |
+
*/
|
10 |
+
(function( $, undefined ) {
|
11 |
+
|
12 |
+
var _remove = $.fn.remove;
|
13 |
+
|
14 |
+
$.fn.remove = function( selector, keepData ) {
|
15 |
+
return this.each(function() {
|
16 |
+
if ( !keepData ) {
|
17 |
+
if ( !selector || $.filter( selector, [ this ] ).length ) {
|
18 |
+
$( "*", this ).add( [ this ] ).each(function() {
|
19 |
+
$( this ).triggerHandler( "remove" );
|
20 |
+
});
|
21 |
+
}
|
22 |
+
}
|
23 |
+
return _remove.call( $(this), selector, keepData );
|
24 |
+
});
|
25 |
+
};
|
26 |
+
|
27 |
+
$.widget = function( name, base, prototype ) {
|
28 |
+
var namespace = name.split( "." )[ 0 ],
|
29 |
+
fullName;
|
30 |
+
name = name.split( "." )[ 1 ];
|
31 |
+
fullName = namespace + "-" + name;
|
32 |
+
|
33 |
+
if ( !prototype ) {
|
34 |
+
prototype = base;
|
35 |
+
base = $.Widget;
|
36 |
+
}
|
37 |
+
|
38 |
+
// create selector for plugin
|
39 |
+
$.expr[ ":" ][ fullName ] = function( elem ) {
|
40 |
+
return !!$.data( elem, name );
|
41 |
+
};
|
42 |
+
|
43 |
+
$[ namespace ] = $[ namespace ] || {};
|
44 |
+
$[ namespace ][ name ] = function( options, element ) {
|
45 |
+
// allow instantiation without initializing for simple inheritance
|
46 |
+
if ( arguments.length ) {
|
47 |
+
this._createWidget( options, element );
|
48 |
+
}
|
49 |
+
};
|
50 |
+
|
51 |
+
var basePrototype = new base();
|
52 |
+
// we need to make the options hash a property directly on the new instance
|
53 |
+
// otherwise we'll modify the options hash on the prototype that we're
|
54 |
+
// inheriting from
|
55 |
+
// $.each( basePrototype, function( key, val ) {
|
56 |
+
// if ( $.isPlainObject(val) ) {
|
57 |
+
// basePrototype[ key ] = $.extend( {}, val );
|
58 |
+
// }
|
59 |
+
// });
|
60 |
+
basePrototype.options = $.extend( true, {}, basePrototype.options );
|
61 |
+
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
|
62 |
+
namespace: namespace,
|
63 |
+
widgetName: name,
|
64 |
+
widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
|
65 |
+
widgetBaseClass: fullName
|
66 |
+
}, prototype );
|
67 |
+
|
68 |
+
$.widget.bridge( name, $[ namespace ][ name ] );
|
69 |
+
};
|
70 |
+
|
71 |
+
$.widget.bridge = function( name, object ) {
|
72 |
+
$.fn[ name ] = function( options ) {
|
73 |
+
var isMethodCall = typeof options === "string",
|
74 |
+
args = Array.prototype.slice.call( arguments, 1 ),
|
75 |
+
returnValue = this;
|
76 |
+
|
77 |
+
// allow multiple hashes to be passed on init
|
78 |
+
options = !isMethodCall && args.length ?
|
79 |
+
$.extend.apply( null, [ true, options ].concat(args) ) :
|
80 |
+
options;
|
81 |
+
|
82 |
+
// prevent calls to internal methods
|
83 |
+
if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
|
84 |
+
return returnValue;
|
85 |
+
}
|
86 |
+
|
87 |
+
if ( isMethodCall ) {
|
88 |
+
this.each(function() {
|
89 |
+
var instance = $.data( this, name ),
|
90 |
+
methodValue = instance && $.isFunction( instance[options] ) ?
|
91 |
+
instance[ options ].apply( instance, args ) :
|
92 |
+
instance;
|
93 |
+
if ( methodValue !== instance && methodValue !== undefined ) {
|
94 |
+
returnValue = methodValue;
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
});
|
98 |
+
} else {
|
99 |
+
this.each(function() {
|
100 |
+
var instance = $.data( this, name );
|
101 |
+
if ( instance ) {
|
102 |
+
if ( options ) {
|
103 |
+
instance.option( options );
|
104 |
+
}
|
105 |
+
instance._init();
|
106 |
+
} else {
|
107 |
+
$.data( this, name, new object( options, this ) );
|
108 |
+
}
|
109 |
+
});
|
110 |
+
}
|
111 |
+
|
112 |
+
return returnValue;
|
113 |
+
};
|
114 |
+
};
|
115 |
+
|
116 |
+
$.Widget = function( options, element ) {
|
117 |
+
// allow instantiation without initializing for simple inheritance
|
118 |
+
if ( arguments.length ) {
|
119 |
+
this._createWidget( options, element );
|
120 |
+
}
|
121 |
+
};
|
122 |
+
|
123 |
+
$.Widget.prototype = {
|
124 |
+
widgetName: "widget",
|
125 |
+
widgetEventPrefix: "",
|
126 |
+
options: {
|
127 |
+
disabled: false
|
128 |
+
},
|
129 |
+
_createWidget: function( options, element ) {
|
130 |
+
// $.widget.bridge stores the plugin instance, but we do it anyway
|
131 |
+
// so that it's stored even before the _create function runs
|
132 |
+
$.data( element, this.widgetName, this );
|
133 |
+
this.element = $( element );
|
134 |
+
this.options = $.extend( true, {},
|
135 |
+
this.options,
|
136 |
+
$.metadata && $.metadata.get( element )[ this.widgetName ],
|
137 |
+
options );
|
138 |
+
|
139 |
+
var self = this;
|
140 |
+
this.element.bind( "remove." + this.widgetName, function() {
|
141 |
+
self.destroy();
|
142 |
+
});
|
143 |
+
|
144 |
+
this._create();
|
145 |
+
this._init();
|
146 |
+
},
|
147 |
+
_create: function() {},
|
148 |
+
_init: function() {},
|
149 |
+
|
150 |
+
destroy: function() {
|
151 |
+
this.element
|
152 |
+
.unbind( "." + this.widgetName )
|
153 |
+
.removeData( this.widgetName );
|
154 |
+
this.widget()
|
155 |
+
.unbind( "." + this.widgetName )
|
156 |
+
.removeAttr( "aria-disabled" )
|
157 |
+
.removeClass(
|
158 |
+
this.widgetBaseClass + "-disabled " +
|
159 |
+
"ui-state-disabled" );
|
160 |
+
},
|
161 |
+
|
162 |
+
widget: function() {
|
163 |
+
return this.element;
|
164 |
+
},
|
165 |
+
|
166 |
+
option: function( key, value ) {
|
167 |
+
var options = key,
|
168 |
+
self = this;
|
169 |
+
|
170 |
+
if ( arguments.length === 0 ) {
|
171 |
+
// don't return a reference to the internal hash
|
172 |
+
return $.extend( {}, self.options );
|
173 |
+
}
|
174 |
+
|
175 |
+
if (typeof key === "string" ) {
|
176 |
+
if ( value === undefined ) {
|
177 |
+
return this.options[ key ];
|
178 |
+
}
|
179 |
+
options = {};
|
180 |
+
options[ key ] = value;
|
181 |
+
}
|
182 |
+
|
183 |
+
$.each( options, function( key, value ) {
|
184 |
+
self._setOption( key, value );
|
185 |
+
});
|
186 |
+
|
187 |
+
return self;
|
188 |
+
},
|
189 |
+
_setOption: function( key, value ) {
|
190 |
+
this.options[ key ] = value;
|
191 |
+
|
192 |
+
if ( key === "disabled" ) {
|
193 |
+
this.widget()
|
194 |
+
[ value ? "addClass" : "removeClass"](
|
195 |
+
this.widgetBaseClass + "-disabled" + " " +
|
196 |
+
"ui-state-disabled" )
|
197 |
+
.attr( "aria-disabled", value );
|
198 |
+
}
|
199 |
+
|
200 |
+
return this;
|
201 |
+
},
|
202 |
+
|
203 |
+
enable: function() {
|
204 |
+
return this._setOption( "disabled", false );
|
205 |
+
},
|
206 |
+
disable: function() {
|
207 |
+
return this._setOption( "disabled", true );
|
208 |
+
},
|
209 |
+
|
210 |
+
_trigger: function( type, event, data ) {
|
211 |
+
var callback = this.options[ type ];
|
212 |
+
|
213 |
+
event = $.Event( event );
|
214 |
+
event.type = ( type === this.widgetEventPrefix ?
|
215 |
+
type :
|
216 |
+
this.widgetEventPrefix + type ).toLowerCase();
|
217 |
+
data = data || {};
|
218 |
+
|
219 |
+
// copy original event properties over to the new event
|
220 |
+
// this would happen if we could call $.event.fix instead of $.Event
|
221 |
+
// but we don't have a way to force an event to be fixed multiple times
|
222 |
+
if ( event.originalEvent ) {
|
223 |
+
for ( var i = $.event.props.length, prop; i; ) {
|
224 |
+
prop = $.event.props[ --i ];
|
225 |
+
event[ prop ] = event.originalEvent[ prop ];
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
this.element.trigger( event, data );
|
230 |
+
|
231 |
+
return !( $.isFunction(callback) &&
|
232 |
+
callback.call( this.element[0], event, data ) === false ||
|
233 |
+
event.isDefaultPrevented() );
|
234 |
+
}
|
235 |
+
};
|
236 |
+
|
237 |
+
})( jQuery );
|
readme.txt
CHANGED
@@ -2,72 +2,62 @@
|
|
2 |
Plugin Name: Custom Contact Forms
|
3 |
Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers
|
4 |
Requires at least: 2.7.1
|
5 |
-
Tested up to: 3.1
|
6 |
-
Stable tag: 2.2.5
|
7 |
Contributors: Taylor Lovett
|
8 |
Download link: http://www.taylorlovett.com/wordpress-plugins/
|
9 |
Author: Taylor Lovett
|
10 |
Author URI: http://www.taylorlovett.com
|
|
|
|
|
11 |
|
12 |
-
Gauranteed the most customizable contact form plugin
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
-
Guaranteed to be 1000X more customizable and intuitive than Fast Secure Contact Forms or Contact Form 7.
|
17 |
|
18 |
Special Features:
|
19 |
------------------
|
20 |
|
21 |
-
*
|
22 |
-
|
23 |
-
*
|
24 |
-
|
25 |
-
*
|
26 |
-
|
27 |
-
*
|
28 |
-
|
29 |
-
*
|
30 |
-
|
31 |
-
*
|
32 |
-
|
33 |
-
*
|
34 |
-
|
35 |
-
*
|
36 |
-
|
37 |
-
*
|
38 |
-
|
39 |
-
*
|
40 |
-
|
41 |
-
*
|
42 |
-
|
43 |
-
*
|
44 |
-
|
45 |
-
* Script in constant development - new version released every week
|
46 |
-
|
47 |
-
* Easily process your forms with 3rd party sites like Infusionsoft or Aweber
|
48 |
-
|
49 |
-
* Valid XHTML and CSS
|
50 |
-
|
51 |
-
* No javascript required
|
52 |
-
|
53 |
-
* Stylish field tooltips powered by jquery
|
54 |
-
|
55 |
-
* Popover forms with Jquery (Coming soon!)
|
56 |
-
|
57 |
-
* Free unlimited support
|
58 |
|
59 |
== Installation ==
|
60 |
1. Upload to /wp-content/plugins
|
61 |
2. Activate the plugin from your Wordpress Admin Panel
|
62 |
3. Configure the plugin, create fields, and create forms in the Settings page called Custom Contact Forms
|
63 |
-
4. Display those forms in posts and pages by inserting the code: [customcontact form=FORMID]
|
64 |
|
65 |
== Configuring and Using the Plugin ==
|
66 |
-
1. Create
|
67 |
-
2. Create fields and attach those fields to the forms of your choice.
|
68 |
-
3. Display those forms in posts and pages by inserting the code: [customcontact form=FORMID]. Replace
|
69 |
-
4.
|
70 |
-
5.
|
|
|
|
|
|
|
71 |
|
72 |
== Support ==
|
73 |
For questions, feature requests, and support concerning the Custom Contact Forms plugin, please email me at:
|
@@ -77,72 +67,80 @@ I respond to emails same-day!
|
|
77 |
== Upgrade Notice ==
|
78 |
Popover forms will be added in September 2010.
|
79 |
|
80 |
-
==
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
-
1.0.
|
83 |
-
*
|
84 |
|
85 |
-
1.0
|
86 |
-
*
|
|
|
|
|
|
|
|
|
87 |
|
88 |
-
1.1.
|
89 |
-
*
|
90 |
-
*
|
91 |
-
* custom-contact-forms.css - Forms restyled
|
92 |
-
* custom-contact-forms-images.php - Image handling class added
|
93 |
-
* image.php, images/ - Image for captcha displaying
|
94 |
|
95 |
-
1.1.
|
96 |
-
*
|
97 |
-
* custom-contact-forms.php - Admin option added to remember field values
|
98 |
|
99 |
-
1.1.
|
100 |
-
*
|
|
|
101 |
|
102 |
-
1.
|
103 |
-
*
|
104 |
-
* custom-contact-forms-db.php - Default captcha label changed
|
105 |
|
106 |
-
1.2.
|
107 |
-
*
|
|
|
108 |
|
109 |
-
|
110 |
-
*
|
111 |
-
*
|
|
|
112 |
|
113 |
-
2.0.
|
114 |
-
*
|
115 |
-
*
|
116 |
-
* custom-contact-forms-db.php - Style manager db functions added
|
117 |
|
118 |
-
2.0.
|
119 |
-
*
|
120 |
-
*
|
121 |
|
122 |
-
2.0.
|
123 |
-
*
|
124 |
-
*
|
125 |
|
126 |
-
2.0
|
127 |
-
*
|
128 |
-
*
|
|
|
129 |
|
130 |
-
2.
|
131 |
-
*
|
132 |
-
*
|
133 |
-
* custom-contact-forms-db.php - New fixed field added
|
134 |
|
135 |
-
2.2.
|
136 |
-
*
|
137 |
-
*
|
|
|
138 |
|
139 |
-
2.2.
|
140 |
-
*
|
141 |
-
* custom-contact-forms.css
|
142 |
-
* custom-contact-forms-db.php
|
143 |
|
144 |
-
2.2.
|
145 |
-
*
|
146 |
|
147 |
-
|
148 |
-
*
|
|
|
|
2 |
Plugin Name: Custom Contact Forms
|
3 |
Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers
|
4 |
Requires at least: 2.7.1
|
|
|
|
|
5 |
Contributors: Taylor Lovett
|
6 |
Download link: http://www.taylorlovett.com/wordpress-plugins/
|
7 |
Author: Taylor Lovett
|
8 |
Author URI: http://www.taylorlovett.com
|
9 |
+
Tested up to: 3.1
|
10 |
+
Stable tag: 3.0.0
|
11 |
|
12 |
+
Gauranteed to be the most customizable and intuitive contact form plugin for Wordpress.
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
+
Guaranteed to be 1000X more customizable and intuitive than Fast Secure Contact Forms or Contact Form 7. Customize every aspect of your forms without any knowledge of CSS: borders, padding, sizes, colors. Ton's of great features. Required fields, captchas, tooltip popovers, unlimited fields/forms/form styles, use a custom thank you page or built-in popover with a custom success message set for each form.
|
17 |
|
18 |
Special Features:
|
19 |
------------------
|
20 |
|
21 |
+
* The most customizable form plugin for Wordpress, guaranteed
|
22 |
+
* Create __unlimited__ forms
|
23 |
+
* Create __unlimited__ fields
|
24 |
+
* Required Fields (New!)
|
25 |
+
* Custom HTML Forms Feature - if you are a web developer you can write your own form html and __use this plugin simply to process your form requests__. Comes with a few useful features.
|
26 |
+
* __Displays forms in theme files__ as well as pages and posts.
|
27 |
+
* Set a different destination email address for each form
|
28 |
+
* Customize every aspect of fields and forms: titles, labels, maxlength, initial value, form action, form method, form style, and much more
|
29 |
+
* Create checkboxes, textareas, text fields, etc.
|
30 |
+
* __Captcha__ and __"Are You Human?"__ spam blockers included and easily attached to any form
|
31 |
+
* Create __custom styles in the style manager__ to change the appearance of your forms: borders, font sizes, colors, padding, margins, background, and more
|
32 |
+
* You can create unlimited styles to use on as many forms as you want without any knowledge of css or html.
|
33 |
+
* Show a stylish JQuery form thank you message or use a custom thank you page.
|
34 |
+
* Custom error pages for when forms are filled out incorrectly
|
35 |
+
* Option to have forms remember field values for when users hit the back button after an error
|
36 |
+
* Easily report bugs and suggest new features
|
37 |
+
* Script in constant development - new version released every week
|
38 |
+
* Easily process your forms with 3rd party sites like Infusionsoft or Aweber
|
39 |
+
* Set a __custom thank you page__ for each form or use the built in thank you page popover with a custom thank you message
|
40 |
+
* Valid XHTML and CSS
|
41 |
+
* No javascript required
|
42 |
+
* Stylish field tooltips powered by jquery
|
43 |
+
* Popover forms with Jquery (Coming soon!)
|
44 |
+
* Free unlimited support
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
== Installation ==
|
47 |
1. Upload to /wp-content/plugins
|
48 |
2. Activate the plugin from your Wordpress Admin Panel
|
49 |
3. Configure the plugin, create fields, and create forms in the Settings page called Custom Contact Forms
|
50 |
+
4. Display those forms in posts and pages by inserting the code: __[customcontact form=FORMID]__
|
51 |
|
52 |
== Configuring and Using the Plugin ==
|
53 |
+
1. Create as many forms as you want.
|
54 |
+
2. Create fields and attach those fields to the forms of your choice. Attach the fields in the order that you want them to show up in the form. If you mess up you can detach and reattach them.
|
55 |
+
3. Display those forms in posts and pages by inserting the code: __[customcontact form=FORMID]__. Replace __FORMID__ with the id listed to the left of the form slug next to the form of your choice above. You can also __display forms in theme files__; the code for this is provided within each forms admin section.
|
56 |
+
4. Prevent spam by attaching the fixed field, captcha or ishuman. Captcha requires users to type in a number shown on an image. Ishuman requires users to check a box to prove they aren't a spam bot.
|
57 |
+
5. Add a form to your sidebar, by dragging the Custom Contact Form widget in to your sidebar.
|
58 |
+
6. Configure the General Settings appropriately; this is important if you want to receive your web form messages!
|
59 |
+
7. Create form styles to change your forms appearances. The image below explains how each style field can change the look of your forms.
|
60 |
+
8. (advanced) If you are confident in your HTML and CSS skills, you can use the Custom HTML Forms feature as a framework and write your forms from scratch. This allows you to use this plugin simply to process your form requests. The Custom HTML Forms feature will process and email any form variables sent to it regardless of whether they are created in the fields manager.
|
61 |
|
62 |
== Support ==
|
63 |
For questions, feature requests, and support concerning the Custom Contact Forms plugin, please email me at:
|
67 |
== Upgrade Notice ==
|
68 |
Popover forms will be added in September 2010.
|
69 |
|
70 |
+
== Screenshots ==
|
71 |
+
Visit http://www.taylorlovett.com/wordpress-plugins for screenshots.
|
72 |
+
|
73 |
+
== Changelog ==
|
74 |
+
|
75 |
+
= 1.0.0 =
|
76 |
+
* Plugin Release
|
77 |
|
78 |
+
= 1.0.1 =
|
79 |
+
* custom-contact-forms.css - Form style changes
|
80 |
|
81 |
+
= 1.1.0 =
|
82 |
+
* custom-contact-forms-db.php - Table upgrade functions added
|
83 |
+
* custom-contact-forms.php - New functions for error handling and captcha
|
84 |
+
* custom-contact-forms.css - Forms restyled
|
85 |
+
* custom-contact-forms-images.php - Image handling class added
|
86 |
+
* image.php, images/ - Image for captcha displaying
|
87 |
|
88 |
+
= 1.1.1 =
|
89 |
+
* custom-contact-forms.css - Label styles changed
|
90 |
+
* custom-contact-forms.php - Admin option added to remember field values
|
|
|
|
|
|
|
91 |
|
92 |
+
= 1.1.2 =
|
93 |
+
* custom-contact-forms-db.php - create_tables function edited to work for Wordpress MU due to error in wp-admin/includes/upgrade.php
|
|
|
94 |
|
95 |
+
= 1.1.3 =
|
96 |
+
* custom-contact-forms.php - Captcha label bug fixed
|
97 |
+
* custom-contact-forms-db.php - Default captcha label changed
|
98 |
|
99 |
+
= 1.2.0 =
|
100 |
+
* custom-contact-forms.php - Option to update to Custom Contact Forms Pro
|
|
|
101 |
|
102 |
+
= 1.2.1 =
|
103 |
+
* custom-contact-forms.php - Upgrade options changed
|
104 |
+
* custom-contact-forms-css.php - CSS bug corrected
|
105 |
|
106 |
+
= 2.0.0 =
|
107 |
+
* custom-contact-forms.php - Style manager added
|
108 |
+
* custom-contact-forms.css - style manager styles added
|
109 |
+
* custom-contact-forms-db.php - Style manager db functions added
|
110 |
|
111 |
+
= 2.0.1 =
|
112 |
+
* custom-contact-forms.php - Duplicate form slug bug fixed, default style values added, stripslahses on form messages
|
113 |
+
* custom-contact-forms-db.php - default style values added
|
|
|
114 |
|
115 |
+
= 2.0.2 =
|
116 |
+
* custom-contact-forms.php - Form li's changed to p's
|
117 |
+
* images/ - folder readded to correct captcha error
|
118 |
|
119 |
+
= 2.0.3 =
|
120 |
+
* custom-contact-forms.php - custom style checkbox display:block error fixed
|
121 |
+
* custom-contact-forms.css - li's converted to p's
|
122 |
|
123 |
+
= 2.1.0 =
|
124 |
+
* custom-contact-forms.php - New fixed field added, plugin news, bug fixes
|
125 |
+
* custom-contact-forms.css - New styles added and style bugs fixed
|
126 |
+
* custom-contact-forms-db.php - New fixed field added
|
127 |
|
128 |
+
= 2.2.0 =
|
129 |
+
* custom-contact-forms.php - Plugin nav, hide plugin author link, bug reporting, suggest a feature
|
130 |
+
* custom-contact-forms.css - New styles added and style bugs fixed
|
|
|
131 |
|
132 |
+
= 2.2.3 =
|
133 |
+
* custom-contact-forms.php - Remember fields bug fixed, init rearranged, field instructions
|
134 |
+
* custom-contact-forms.css
|
135 |
+
* custom-contact-forms-db.php
|
136 |
|
137 |
+
= 2.2.4 =
|
138 |
+
* custom-contact-forms.php - Textarea field instruction bug fixed
|
|
|
|
|
139 |
|
140 |
+
= 2.2.5 =
|
141 |
+
* custom-contact-forms.php - Fixed field insert bug fixed
|
142 |
|
143 |
+
= 3.0.0 =
|
144 |
+
* custom-contact-forms.php - Required fields, admin panel changed, style manager bugs fixed, custom html feature added, much more
|
145 |
+
* custom-contact-forms-db.php - New functions added and old ones fixed
|
146 |
+
* custom-contact-forms.css - New styles added and old ones modified
|