Changeset 510077
- Timestamp:
- 02/24/2012 08:14:01 PM (14 years ago)
- Location:
- polizeipresse/trunk
- Files:
-
- 5 edited
-
Polizeipresse.php (modified) (1 diff)
-
admin.php (modified) (5 diffs)
-
i18n/Polizeipresse-de_DE.mo (modified) (previous)
-
i18n/Polizeipresse-de_DE.po (modified) (3 diffs)
-
js/admin.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
polizeipresse/trunk/Polizeipresse.php
r509517 r510077 3 3 Plugin Name: Polizeipresse Plugin 4 4 Plugin URI: http://wordpress.org/extend/plugins/polizeipresse/ 5 Description: The plugin loads police news from German police stations and shows them in your blog.5 Description: The plugin loads police news from German police offices and shows them in your blog. 6 6 Version: 0.2 7 7 Author: Karsten Strunk -
polizeipresse/trunk/admin.php
r509517 r510077 12 12 13 13 if (empty($api_key) || empty($office_id)) { 14 print ('<div id="message" class="error">' . __('Polizeipresse plugin: Please enter API key and office id', 'Polizeipresse') . '</div>');14 print ('<div id="message" class="error">' . __('Polizeipresse plugin: Please enter API key select police office', 'Polizeipresse') . '</div>'); 15 15 } 16 16 } … … 172 172 <td> 173 173 <?php $api_key = polizeipresse_get_option(POLIZEIPRESSE_API_KEY); ?> 174 <input name="api_key" size="50" value="<?php echo $api_key; ?>" type="text" class="regular-text" />174 <input name="api_key" id="api_key" size="50" value="<?php echo $api_key; ?>" type="text" class="regular-text" /> 175 175 </td> 176 176 </tr> … … 342 342 </div> 343 343 344 <p> 345 <label for="office_search"><?php _e('Search terms', 'Polizeipresse'); ?>:</lable> 346 <input id="office_search_terms" size="30" type="text" class="regular-text" 347 value="<?php echo polizeipresse_get_option(POLIZEIPRESSE_OFFICE_NAME); ?>" /> 348 </p> 349 350 <p style="text-align: center;"> 351 <button id="searchOfficeButton" class="button-primary"> 352 <?php _e('Search', 'Polizeipresse'); ?> 353 </button> 354 <button id="cancelSearchOfficeDialog" class="button-primary"><?php _e('Cancel', 'Polizeipresse'); ?></button> 355 </p> 344 <form> 345 <p> 346 <label for="office_search"><?php _e('Search terms', 'Polizeipresse'); ?>:</lable> 347 <input id="office_search_terms" size="30" type="text" class="regular-text" 348 value="<?php echo polizeipresse_get_option(POLIZEIPRESSE_OFFICE_NAME); ?>" /> 349 </p> 350 351 <p style="text-align: center;"> 352 <button id="searchOfficeButton" class="button-primary"> 353 <?php _e('Search', 'Polizeipresse'); ?> 354 </button> 355 <button id="cancelSearchOfficeDialog" class="button-primary"><?php _e('Cancel', 'Polizeipresse'); ?></button> 356 </p> 357 </form> 356 358 357 359 <div id="searchOfficeResult" style="display: none;"> … … 415 417 416 418 $terms = trim($_POST['terms']); 419 417 420 $api_key = polizeipresse_get_option(POLIZEIPRESSE_API_KEY); 421 if (empty($api_key)) { 422 // If api key is not in database, use api_key from request 423 $api_key = trim($_POST['api_key']); 424 }; 418 425 419 426 if (!empty ($terms) && !empty ($api_key)) { … … 432 439 } 433 440 441 // Return reponse 434 442 echo json_encode($result); 435 443 -
polizeipresse/trunk/i18n/Polizeipresse-de_DE.po
r508487 r510077 3 3 "Project-Id-Version: Polizeipresse\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 2012-02-2 1 21:45+0100\n"6 "PO-Revision-Date: 2012-02-2 1 21:45+0100\n"5 "POT-Creation-Date: 2012-02-24 20:29+0100\n" 6 "PO-Revision-Date: 2012-02-24 20:29+0100\n" 7 7 "Last-Translator: Karsten Strunk <karsten@strunk.eu>\n" 8 8 "Language-Team: Karsten Strunk <karsten@strunk.eu>\n" … … 16 16 17 17 #: admin.php:14 18 msgid "Polizeipresse plugin: Please enter API key and office id"19 msgstr "Polizeipresse plugin: Bitte API-Schlüssel und Dienststellen-Id eingeben."20 21 #: admin.php:10 118 msgid "Polizeipresse plugin: Please enter API key select police office" 19 msgstr "Polizeipresse plugin: Bitte API-Schlüssel eingeben und Dienststellen auswählen." 20 21 #: admin.php:105 22 22 msgid "Your settings have been saved." 23 23 msgstr "Ihre Einstellungen wurden gespeichert." 24 24 25 #: admin.php:11 025 #: admin.php:114 26 26 msgid "Stories have been loaded." 27 27 msgstr "Meldungen wurden geladen." 28 28 29 #: admin.php:12 129 #: admin.php:125 30 30 msgid "Last processed story id has been reset." 31 31 msgstr "Zuletzt verarbeitete Meldungs-ID wurde zurückgesetzt." 32 32 33 #: admin.php:146 34 msgid "API key is required" 35 msgstr "API-Schlüssel wird benötigt." 36 37 #: admin.php:147 38 msgid "Office id is required and must be numerical" 39 msgstr "Numerisch Dienststellen-ID wird benötigt" 40 41 #: admin.php:173 33 #: admin.php:144 42 34 msgid "Options" 43 35 msgstr "Optionen" 44 36 45 #: admin.php:1 7837 #: admin.php:149 46 38 msgid "General" 47 39 msgstr "Allgemein" 48 40 49 #: admin.php:1 7941 #: admin.php:150 50 42 msgid "Filter" 51 43 msgstr "Filter" 52 44 53 #: admin.php:1 8045 #: admin.php:151 54 46 msgid "Cronjob" 55 47 msgstr "Cronjob" 56 48 57 #: admin.php:1 8949 #: admin.php:160 58 50 msgid "This page contains fundamental plugin settings. Without API key and office id the plugin is unable to work." 59 msgstr "Auf dieser Seite legen Sie grundlegende Einstellungen des Plugins fest. Ohne API-Schlüssel und Dienststellen-IDfunktioniert das Plugin nicht."60 61 #: admin.php:1 9151 msgstr "Auf dieser Seite legen Sie grundlegende Einstellungen des Plugins fest. Ohne API-Schlüssel und ausgewählte Dienststelle funktioniert das Plugin nicht." 52 53 #: admin.php:162 62 54 msgid "If you do not have an API key, please register on the following page to get one" 63 55 msgstr "Wenn Sie noch keinen API-Schlüssel haben, können Sie diesen auf der folgenden Seite bekommen" 64 56 65 #: admin.php:192 66 #: admin.php:194 57 #: admin.php:163 67 58 msgid "Click here" 68 59 msgstr "Hier clicken" 69 60 70 #: admin.php:193 71 msgid "You will find the required office id on this site" 72 msgstr "Die Dienststellen-ID für die gewünschte Dienststelle finden Sie auf folgender Seite" 73 74 #: admin.php:201 61 #: admin.php:170 75 62 msgid "Polizeipresse API key" 76 63 msgstr "Polizeipresse API-Schlüssel" 77 64 78 #: admin.php:210 79 msgid "Office id" 80 msgstr "Dienststellen-ID" 81 82 #: admin.php:225 65 #: admin.php:180 66 msgid "Police office" 67 msgstr "Polizeidienststelle" 68 69 #: admin.php:188 70 #: admin.php:337 71 msgid "Search for offices" 72 msgstr "Nach Polizeistationen suchen" 73 74 #: admin.php:201 83 75 msgid "On this page you can define filters. These filteres are used to filter police stories. Multiple filters can be separated by comma." 84 76 msgstr "Auf dieser Seite können Sie Filter definieren. Diese Filter werden verwendet, um Polizeimeldungen zu filtern. Mehrere Filter können durch Komma getrennt werden." 85 77 86 #: admin.php:2 3278 #: admin.php:208 87 79 msgid "Positive filters" 88 80 msgstr "Positive Filter" 89 81 90 #: admin.php:2 3391 #: admin.php:2 4482 #: admin.php:209 83 #: admin.php:220 92 84 msgid "Separate multiple filters by comma." 93 85 msgstr "Mehrere Filter durch Komma trennen" 94 86 95 #: admin.php:2 4387 #: admin.php:219 96 88 msgid "Negative filters" 97 89 msgstr "Negative Filter" 98 90 99 #: admin.php:2 6091 #: admin.php:236 100 92 msgid "New police stories can be automatically loaded and added to your blog. This is done every hour." 101 93 msgstr "Neue Polizeimeldungen können automatisch abgefragt und zu Ihrem Blog hinzugefügt werden. Die Abfrage geschieht stündlich." 102 94 103 #: admin.php:2 6795 #: admin.php:243 104 96 msgid "Enable cronjob" 105 97 msgstr "Cronjob einschalten" 106 98 107 #: admin.php:2 7699 #: admin.php:252 108 100 msgid "User for new posts" 109 101 msgstr "Benutzer für neue Artikel" 110 102 111 #: admin.php:2 88103 #: admin.php:264 112 104 msgid "Category for new posts" 113 105 msgstr "Kategorie für neue Artikel" 114 106 115 #: admin.php: 300107 #: admin.php:276 116 108 msgid "Publish new posts immediately" 117 109 msgstr "Neue Meldungen sofort veröffentlichen" 118 110 119 #: admin.php: 309111 #: admin.php:285 120 112 msgid "Notify on new stories" 121 113 msgstr "Alarmierung bei neuen Meldungen" 122 114 123 #: admin.php: 318115 #: admin.php:294 124 116 msgid "Last processed story id" 125 117 msgstr "Letzte verarbeitete Meldungs-ID" 126 118 127 #: admin.php:3 27128 #: admin.php:3 35119 #: admin.php:303 120 #: admin.php:311 129 121 msgid "unknown" 130 122 msgstr "unbekannt" 131 123 132 #: admin.php:3 35124 #: admin.php:311 133 125 msgid "Date/time" 134 126 msgstr "Datum/Uhrzeit" 135 127 136 #: admin.php:3 35128 #: admin.php:311 137 129 msgid "State" 138 130 msgstr "Status" 139 131 140 #: admin.php:3 35132 #: admin.php:311 141 133 msgid "successfull" 142 134 msgstr "erfolgreich" 143 135 144 #: admin.php:3 42136 #: admin.php:318 145 137 msgid "Load stories now" 146 138 msgstr "Jetzt neue Meldungen laden" 147 139 148 #: admin.php:3 43140 #: admin.php:320 149 141 msgid "Reset last processed story id" 150 142 msgstr "Zuletzt verarbeitete Meldungs-ID zurücksetzen" 151 143 152 #: admin.php:3 52144 #: admin.php:329 153 145 msgid "Save all" 154 146 msgstr "Alles speichern" 147 148 #: admin.php:341 149 msgid "You can search for German police offices here. Start the search and select one item from the result list. Press apply to accept." 150 msgstr "Sie können hier nach deutschen Polizeidienststellen suchen. Nach der Suche wählen sie eine Dienststelle aus und drücken 'übernehmen'." 151 152 #: admin.php:345 153 msgid "Search terms" 154 msgstr "Suche" 155 156 #: admin.php:352 157 msgid "Search" 158 msgstr "Suchen" 159 160 #: admin.php:354 161 msgid "Cancel" 162 msgstr "Abbrechen" 163 164 #: admin.php:360 165 msgid "Search result" 166 msgstr "Suchergebnis" 167 168 #: admin.php:364 169 msgid "Apply" 170 msgstr "Übernehmen" 155 171 156 172 #: Polizeipresse.php:294 … … 213 229 msgstr "Stunden" 214 230 231 #~ msgid "API key is required" 232 #~ msgstr "API-Schlüssel wird benötigt." 233 234 #~ msgid "Office id is required and must be numerical" 235 #~ msgstr "Numerisch Dienststellen-ID wird benötigt" 236 237 #~ msgid "You will find the required office id on this site" 238 #~ msgstr "" 239 #~ "Die Dienststellen-ID für die gewünschte Dienststelle finden Sie auf " 240 #~ "folgender Seite" 241 242 #~ msgid "Office id" 243 #~ msgstr "Dienststellen-ID" -
polizeipresse/trunk/js/admin.js
r509518 r510077 60 60 function polizeipresse_admin_init_search_dialog() { 61 61 62 // Button for opening the search dialog62 // Define button for opening the search dialog 63 63 jQuery("#searchDialogButton").click(function(){ 64 jQuery("#searchDialog").dialog({ 65 closeOnEscape: true, 66 modal: true, 67 width: 500, 68 dialogClass: 'wp-dialog', 69 }); 64 api_key = jQuery('#api_key').val(); 65 if (api_key) { 66 jQuery("#searchDialog").dialog({ 67 closeOnEscape: true, 68 modal: true, 69 width: 500, 70 dialogClass: 'wp-dialog', 71 }); 72 } 70 73 return false; 74 }); 75 76 // Enable search dialog button only if api_key is set 77 jQuery("#api_key").keyup(function(){ 78 api_key = jQuery("#api_key").val(); 79 if (api_key) { 80 jQuery("#searchDialogButton").removeAttr("disabled"); 81 } 82 else { 83 jQuery("#searchDialogButton").attr("disabled", "disabled"); 84 } 85 return true; 71 86 }); 72 87 … … 76 91 jQuery("#searchDialogButton").click(); 77 92 } 93 return true; 78 94 }); 79 95 … … 87 103 jQuery("#searchOfficeButton").click(function(){ 88 104 105 // Disable search button 106 jQuery("#searchOfficeButton").attr("disabled", "disabled"); 107 89 108 // Hide result list 90 109 jQuery("#searchOfficeResult").hide(); … … 95 114 action: 'polizeipresse_search_office', 96 115 terms: jQuery('#office_search_terms').val(), 116 api_key: jQuery('#api_key').val(), 97 117 }, 98 118 polizeipresse_admin_handle_search_result … … 118 138 119 139 function polizeipresse_admin_handle_search_result(response, textStatus) { 120 try { 121 var offices = JSON.parse(response); 140 if (response && response.length > 0) { 141 try { 142 var offices = JSON.parse(response); 122 143 123 // Add offices to result list124 jQuery("#officeSelector").empty();125 jQuery.each(offices, function(index, office) {126 jQuery("<option/>").val(office.id).text(office.name).appendTo("#officeSelector");127 });128 jQuery("#officeSelector option:first").attr("selected", "selected");144 // Add offices to result list 145 jQuery("#officeSelector").empty(); 146 jQuery.each(offices, function(index, office) { 147 jQuery("<option/>").val(office.id).text(office.name).appendTo("#officeSelector"); 148 }); 149 jQuery("#officeSelector option:first").attr("selected", "selected"); 129 150 130 // Show result list 131 jQuery("#searchOfficeResult").show(); 151 // Show result list 152 jQuery("#searchOfficeResult").show(); 153 } 154 catch(e) { 155 // TODO Handle error 156 alert("An error occurred: " + e); 157 } 132 158 } 133 catch(e){159 else { 134 160 // TODO Handle error 135 alert( e);161 alert("No result from server. Please check api key and/or connection."); 136 162 } 163 164 // Enable search button 165 jQuery("#searchOfficeButton").removeAttr("disabled"); 137 166 }
Note: See TracChangeset
for help on using the changeset viewer.