diff --git a/lang/en.json b/lang/en.json index 6aefd3199d8201b2eb5259f52e762c78895bfb43..725ff8a0f02b3c6423920ca5edc671b654dbc3c2 100644 --- a/lang/en.json +++ b/lang/en.json @@ -718,7 +718,8 @@ "MenuExtend": "Extend", "PluginNotCompatibleWith": "%1$s plugin is not compatible with %2$s.", "PluginAskDevToUpdate": "If you enjoyed this plugin, maybe you can ask the developers to update it to work on the latest Piwik. ", - "UninstallConfirm": "You are about to uninstall a plugin %s. The plugin will be completely removed from your platform and it won't be recoverable. Are you sure you want to do this?" + "UninstallConfirm": "You are about to uninstall a plugin %s. The plugin will be completely removed from your platform and it won't be recoverable. Are you sure you want to do this?", + "NoZipFileSelected": "Please select a ZIP file." }, "CoreUpdater": { "PluginDescription": "Piwik updating mechanism", diff --git a/plugins/CorePluginsAdmin/CorePluginsAdmin.php b/plugins/CorePluginsAdmin/CorePluginsAdmin.php index 6fb999a1ced794978f0d15094c584fe0deb705d1..c0221c712f977a8c8e7e89a2d8672360ecb2344a 100644 --- a/plugins/CorePluginsAdmin/CorePluginsAdmin.php +++ b/plugins/CorePluginsAdmin/CorePluginsAdmin.php @@ -30,6 +30,7 @@ class CorePluginsAdmin extends \Piwik\Plugin 'AssetManager.getJsFiles' => 'getJsFiles', 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', 'TaskScheduler.getScheduledTasks' => 'getScheduledTasks', + 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys' ); } @@ -93,4 +94,9 @@ class CorePluginsAdmin extends \Piwik\Plugin $jsFiles[] = "plugins/CorePluginsAdmin/javascripts/pluginExtend.js"; } + public function getClientSideTranslationKeys(&$translations) + { + $translations[] = 'CorePluginsAdmin_NoZipFileSelected'; + } + } diff --git a/plugins/CorePluginsAdmin/javascripts/pluginExtend.js b/plugins/CorePluginsAdmin/javascripts/pluginExtend.js index b67e95ab076b87244371845259ec67f2bb6f0451..560cbc170083b83f3d21a5ef8b12dc7dde7c5794 100644 --- a/plugins/CorePluginsAdmin/javascripts/pluginExtend.js +++ b/plugins/CorePluginsAdmin/javascripts/pluginExtend.js @@ -19,11 +19,12 @@ $(document).ready(function () { $('#uploadPluginForm').submit(function (event) { - $zipFile = $('[name=pluginZip]'); + var $zipFile = $('[name=pluginZip]'); + var fileName = $zipFile.val(); - if (!$zipFile.val()) { + if (!fileName || '.zip' != fileName.slice(-4)) { event.preventDefault(); - alert('Please select a ZIP file.'); + alert(_pk_translate('CorePluginsAdmin_NoZipFileSelected')); } });