diff --git a/docs-web/src/main/java/com/sismics/docs/rest/resource/DocumentResource.java b/docs-web/src/main/java/com/sismics/docs/rest/resource/DocumentResource.java index 54194e92..30ffa7cf 100644 --- a/docs-web/src/main/java/com/sismics/docs/rest/resource/DocumentResource.java +++ b/docs-web/src/main/java/com/sismics/docs/rest/resource/DocumentResource.java @@ -3,6 +3,7 @@ package com.sismics.docs.rest.resource; import com.google.common.base.Joiner; import com.google.common.base.Strings; import com.sismics.docs.core.constant.AclType; +import com.sismics.docs.core.constant.ConfigType; import com.sismics.docs.core.constant.Constants; import com.sismics.docs.core.constant.PermType; import com.sismics.docs.core.dao.jpa.*; @@ -16,6 +17,7 @@ import com.sismics.docs.core.event.FileDeletedAsyncEvent; import com.sismics.docs.core.model.jpa.Document; import com.sismics.docs.core.model.jpa.File; import com.sismics.docs.core.model.jpa.User; +import com.sismics.docs.core.util.ConfigUtil; import com.sismics.docs.core.util.DocumentUtil; import com.sismics.docs.core.util.FileUtil; import com.sismics.docs.core.util.PdfUtil; @@ -831,7 +833,7 @@ public class DocumentResource extends BaseResource { document.setSubject(StringUtils.abbreviate(mailContent.getSubject(), 500)); document.setFormat("EML"); document.setSource("Email"); - document.setLanguage("eng"); + document.setLanguage(ConfigUtil.getConfigStringValue(ConfigType.DEFAULT_LANGUAGE)); if (mailContent.getDate() == null) { document.setCreateDate(new Date()); } else { diff --git a/docs-web/src/main/webapp/src/app/docs/controller/Footer.js b/docs-web/src/main/webapp/src/app/docs/controller/Footer.js index 5daf0f3b..2351424b 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/Footer.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/Footer.js @@ -6,7 +6,7 @@ angular.module('docs').controller('Footer', function($scope, $rootScope, Restangular, $translate, timeAgoSettings, tmhDynamicLocale, $locale) { // Load app data Restangular.one('app').get().then(function(data) { - $scope.app = data; + $rootScope.app = data; }); // Save the current language to local storage diff --git a/docs-web/src/main/webapp/src/app/docs/controller/Login.js b/docs-web/src/main/webapp/src/app/docs/controller/Login.js index d48a5f57..9f862cda 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/Login.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/Login.js @@ -8,7 +8,7 @@ angular.module('docs').controller('Login', function(Restangular, $scope, $rootSc // Get the app configuration Restangular.one('app').get().then(function(data) { - $scope.app = data; + $rootScope.app = data; }); // Login as guest diff --git a/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentEdit.js b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentEdit.js index 4789d4b3..e8d366a6 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentEdit.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentEdit.js @@ -51,17 +51,15 @@ angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $ * Reset the form to add a new document. */ $scope.resetForm = function() { - var languages = { - en: 'eng', - fr: 'fra', - zh_CN: 'chi_sim' - }; - var language = languages[$translate.use()]; + var language = 'eng'; + if ($rootScope.app && $rootScope.app.default_language) { + language = $rootScope.app.default_language; + } $scope.document = { tags: [], relations: [], - language: language ? language : 'eng' + language: language }; $scope.newFiles = []; diff --git a/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsConfig.js b/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsConfig.js index 932b41d0..22cc0de8 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsConfig.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsConfig.js @@ -6,7 +6,10 @@ angular.module('docs').controller('SettingsConfig', function($scope, $rootScope, Restangular) { // Get the app configuration Restangular.one('app').get().then(function (data) { - $scope.app = data; + $rootScope.app = data; + $scope.general = { + default_language: data.default_language + } }); // Enable/disable guest login @@ -74,4 +77,9 @@ angular.module('docs').controller('SettingsConfig', function($scope, $rootScope, $scope.editSmtpConfig = function () { Restangular.one('app').post('config_smtp', $scope.smtp); }; + + // Edit general config + $scope.editGeneralConfig = function () { + Restangular.one('app').post('config', $scope.general); + }; }); \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/locale/en.json b/docs-web/src/main/webapp/src/locale/en.json index 92d7c81c..aa0c4058 100644 --- a/docs-web/src/main/webapp/src/locale/en.json +++ b/docs-web/src/main/webapp/src/locale/en.json @@ -247,7 +247,7 @@ "menu_configuration": "Configuration", "menu_server_logs": "Server logs", "user": { - "title": "Users management", + "title": "Users management", "add_user": "Add a user", "username": "Username", "create_date": "Create date", @@ -257,8 +257,8 @@ "delete_user_message": "Do you really want to delete this user? All associated documents, files and tags will be deleted", "edit_user_failed_title": "User already exists", "edit_user_failed_message": "This username is already taken by another user", - "edit_user_title": "Edit \"{{ username }}\"", - "add_user_title": "Add a user", + "edit_user_title": "Edit \"{{ username }}\"", + "add_user_title": "Add a user", "username": "Username", "email": "E-mail", "groups": "Groups", @@ -273,15 +273,15 @@ } }, "workflow": { - "title": "Workflow configuration", + "title": "Workflow configuration", "add_workflow": "Add a workflow", "name": "Name", "create_date": "Create date", "edit": { "delete_workflow_title": "Delete workflow", "delete_workflow_message": "Do you really want to delete this workflow? Currently running workflows will not be deleted", - "edit_workflow_title": "Edit \"{{ name }}\"", - "add_workflow_title": "Add a workflow", + "edit_workflow_title": "Edit \"{{ name }}\"", + "add_workflow_title": "Add a workflow", "name": "Name", "name_placeholder": "Step name or description", "drag_help": "Drag and drop to rorder the step", @@ -296,7 +296,7 @@ "security": { "enable_totp": "Enable two-factor authentication", "enable_totp_message": "Make sure you have a TOTP-compatible application on your phone ready to add a new account", - "title": "Two-factor authentication", + "title": "Two-factor authentication", "message_1": "Two-factor authentication allows you to add a layer of security on your {{ appName }} account.
Before activating this feature, make sure you have a TOTP-compatible app on your phone:", "message_google_authenticator": "For Android, iOS, and Blackberry: Google Authenticator", "message_duo_mobile": "For Android and iOS: Duo Mobile", @@ -313,7 +313,7 @@ } }, "group": { - "title": "Groups management", + "title": "Groups management", "add_group": "Add a group", "name": "Name", "edit": { @@ -321,8 +321,8 @@ "delete_group_message": "Do you really want to delete this group?", "edit_group_failed_title": "Group already exists", "edit_group_failed_message": "This group name is already taken by another group", - "edit_group_title": "Edit \"{{ name }}\"", - "add_group_title": "Add a group", + "edit_group_title": "Edit \"{{ name }}\"", + "add_group_title": "Add a group", "name": "Name", "parent_group": "Parent group", "search_group": "Search a group", @@ -332,17 +332,19 @@ } }, "account": { - "title": "User account", + "title": "User account", "password": "Password", "password_confirm": "Password (confirm)", "updated": "Account successfully updated" }, "config": { - "title_guest_access": "Guest access", + "title_guest_access": "Guest access", "message_guest_access": "Guest access is a mode where anyone can access {{ appName }} without password.
Like a normal user, the guest user can only access its documents and those accessible through permissions.
", "enable_guest_access": "Enable guest access", "disable_guest_access": "Disable guest access", - "title_theme": "Theme customization", + "title_theme": "Theme customization", + "title_general": "General configuration", + "default_language": "Default language for new documents", "application_name": "Application name", "main_color": "Main color", "custom_css": "Custom CSS", @@ -350,7 +352,7 @@ "logo": "Logo (squared size)", "background_image": "Background image", "uploading_image": "Uploading the image...", - "title_smtp": "Email configuration", + "title_smtp": "Email configuration", "smtp_hostname": "SMTP hostname", "smtp_port": "SMTP port", "smtp_from": "Sender e-mail", @@ -359,13 +361,13 @@ "smtp_updated": "SMTP configuration updated successfully" }, "log": { - "title": "Server logs", + "title": "Server logs", "date": "Date", "tag": "Tag", "message": "Message" }, "session": { - "title": "Opened sessions", + "title": "Opened sessions", "created_date": "Created date", "last_connection_date": "Last connection date", "user_agent": "From", @@ -375,7 +377,7 @@ "clear": "Clear all other sessions" }, "vocabulary": { - "title": "Vocabulary entries", + "title": "Vocabulary entries", "choose_vocabulary": "Choose a vocabulary to edit", "type": "Type", "coverage": "Coverage", diff --git a/docs-web/src/main/webapp/src/partial/docs/settings.config.html b/docs-web/src/main/webapp/src/partial/docs/settings.config.html index f796e160..8276ce9b 100644 --- a/docs-web/src/main/webapp/src/partial/docs/settings.config.html +++ b/docs-web/src/main/webapp/src/partial/docs/settings.config.html @@ -1,9 +1,9 @@ -

+

{{ app.guest_login ? 'enabled' : 'disabled' | translate }} -

+

@@ -11,7 +11,27 @@
-

+

+
+
+ +
+ +
+
+ +
+
+ +
+
+
+ +

@@ -75,7 +95,7 @@
-

+