Changeset 788218
- Timestamp:
- 10/15/2013 03:26:32 PM (12 years ago)
- File:
-
- 1 edited
-
polizeipresse/trunk/js/admin.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
polizeipresse/trunk/js/admin.js
r511342 r788218 64 64 function polizeipresse_admin_init_search_dialog() { 65 65 66 // Define button for opening the search dialog67 jQuery("#searchOfficeDialogButton").click(function() {68 polizeipresse_admin_open_search_dialog();69 return false;70 });71 72 66 // Enable search dialog button only if api_key is set 73 67 jQuery("#api_key").keyup(function() { 74 68 api_key = jQuery("#api_key").val(); 75 69 if (api_key) { 76 jQuery(" #searchOfficeDialogButton").removeAttr("disabled");70 jQuery(".searchOfficeDialogButton").removeAttr("disabled"); 77 71 } 78 72 else { 79 jQuery(" #searchOfficeDialogButton").attr("disabled", "disabled");73 jQuery(".searchOfficeDialogButton").attr("disabled", "disabled"); 80 74 } 81 75 return true; 82 76 }); 83 77 78 // Open search dialog on click on button click 79 jQuery(".searchOfficeDialogButton").each(function(office_index) { 80 jQuery(this).click(function() { 81 polizeipresse_admin_open_search_dialog(office_index); 82 return false; 83 }); 84 }); 85 84 86 // Open search dialog on click on office name 85 jQuery("#office_name").focus(function() { 86 if(!jQuery("#searchOfficeDialogButton").attr("disabled")) { 87 jQuery("#searchOfficeDialogButton").click(); 88 } 89 return true; 87 jQuery(".office_name").each(function(office_index) { 88 jQuery(this).click(function() { 89 polizeipresse_admin_open_search_dialog(office_index); 90 return false; 91 }); 92 }); 93 94 // Delete office button 95 jQuery(".removeOfficeButton").each(function(office_index) { 96 jQuery(this).click(function() { 97 jQuery("#office_id" + office_index).val(""); 98 jQuery("#office_name" + office_index).val(""); 99 return false; 100 }); 90 101 }); 91 102 92 103 // Init cancel button in serch dialog 93 104 jQuery("#cancelSearchOfficeDialog").click(function() { 94 jQuery("#searchOfficeDialog").dialog(" close");105 jQuery("#searchOfficeDialog").dialog("destroy"); 95 106 return false; 96 107 }); … … 101 112 return false; 102 113 }); 103 104 // Init apply button in search dialog105 jQuery("#applySearchOfficeDialog").click(function() {106 polizeipresse_admin_apply_selected_office();107 return false;108 });109 114 } 110 115 … … 112 117 * Opens the search dialog 113 118 */ 114 function polizeipresse_admin_open_search_dialog( ) {119 function polizeipresse_admin_open_search_dialog(office_index) { 115 120 api_key = jQuery('#api_key').val(); 116 121 if (api_key) { 122 // Init apply button in search dialog 123 jQuery("#applySearchOfficeDialog").click(function() { 124 polizeipresse_admin_apply_selected_office(office_index); 125 jQuery("#searchOfficeDialog").dialog("close"); 126 }); 127 117 128 jQuery("#searchOfficeDialog").dialog({ 118 129 closeOnEscape: true, … … 196 207 * When the user has chosen an office, this method applies the new office. 197 208 */ 198 function polizeipresse_admin_apply_selected_office( ) {199 // Copy selected office to admin form209 function polizeipresse_admin_apply_selected_office(office_index) { 210 // Copy selected office from dialog to admin page 200 211 201 212 office_id = jQuery("#officeSelector option:selected").val(); 202 jQuery("#office_id" ).val(office_id);213 jQuery("#office_id" + office_index).val(office_id); 203 214 204 215 office_name = jQuery("#officeSelector option:selected").text(); 205 jQuery("#office_name").val(office_name); 206 207 jQuery("#searchOfficeDialog").dialog("close"); 208 } 216 jQuery("#office_name" + office_index).val(office_name); 217 }
Note: See TracChangeset
for help on using the changeset viewer.