Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMadhura Jayaratne <madhura.cj@gmail.com>2011-08-01 23:02:32 +0400
committerMadhura Jayaratne <madhura.cj@gmail.com>2011-08-01 23:02:32 +0400
commitdc823602428de00f987425ccdbbb903044572551 (patch)
tree40a09e94c89ce8a5f7a157e7b962bcf4eb090355 /js/gis_data_editor.js
parent3611d48325f6e2990a5d29060503237f83d52257 (diff)
Prepares and insert GIS data to the input field on pressing 'enter'
Diffstat (limited to 'js/gis_data_editor.js')
-rw-r--r--js/gis_data_editor.js42
1 files changed, 28 insertions, 14 deletions
diff --git a/js/gis_data_editor.js b/js/gis_data_editor.js
index e8b8dee29b..b2bab89ba7 100644
--- a/js/gis_data_editor.js
+++ b/js/gis_data_editor.js
@@ -120,31 +120,45 @@ function openGISEditor(value, field, type, input_name, token) {
$gis_editor.fadeIn("fast");
}
+/**
+ * Prepare and insert the GIS data in Well Known Text format
+ * to the input field.
+ */
+function insertDataAndClose() {
+ var $form = $('form#gis_data_editor_form');
+ var input_name = $form.find("input[name='input_name']").val();
+
+ $.post('gis_data_editor.php', $form.serialize() + "&generate=true", function(data) {
+ if(data.success == true) {
+ $("input[name='" + input_name + "']").val(data.result);
+ } else {
+ PMA_ajaxShowMessage(data.error);
+ }
+ }, 'json');
+ closeGISEditor();
+}
+
$(document).ready(function() {
// Remove the class that is added due to the URL being too long.
$('.open_gis_editor a').removeClass('formLinkSubmit');
/**
- * Prepare and insert the GIS data in Well Known Text format
- * to the input field.
+ * Prepares and insert the GIS data to the input field on clicking 'copy'.
*/
$("input[name='gis_data[save]']").live('click', function(event) {
event.preventDefault();
+ insertDataAndClose();
+ });
- var $form = $('form#gis_data_editor_form');
- var input_name = $form.find("input[name='input_name']").val();
-
- $.post('gis_data_editor.php', $form.serialize() + "&generate=true", function(data) {
- if(data.success == true) {
- $("input[name='" + input_name + "']").val(data.result);
- } else {
- PMA_ajaxShowMessage(data.error);
- }
- }, 'json');
- closeGISEditor();
+ /**
+ * Prepares and insert the GIS data to the input field on pressing 'enter'.
+ */
+ $('#gis_editor').live('submit', function(event) {
+ event.preventDefault();
+ insertDataAndClose();
});
-
+
/**
* Trigger asynchronous calls on data change and update the output.
*/