diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileController.js index 23102d6a6d648940160f75935ed7637c4a70c069..f4fb3b515664e25d1071b020b3cb832c47840978 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileController.js @@ -19,6 +19,8 @@ function UserProfileController(mainController, mode) { this._userProfileModel = new UserProfileModel(mode); this._userProfileView = new UserProfileView(this, this._userProfileModel); + this._zenodoApiTokenKey = "personal-zenodo-api-token"; + this.init = function(views) { this._userProfileView.repaint(views); } @@ -49,6 +51,8 @@ function UserProfileController(mainController, mode) { return; } var userId = this._mainController.serverFacade.getUserId(); + + this.setSettingValue(this._zenodoApiTokenKey, userInformation.zenodoToken); this._mainController.serverFacade.updateUserInformation(userId, userInformation, (function(ok) { if (ok) { Util.showInfo("Profile saved. You will be logged out automatically in order to reload the profile data upon login.", (function() { @@ -74,4 +78,12 @@ function UserProfileController(mainController, mode) { this._mainController.profile.isFileAuthenticationUser; } + this.getSettingValue = function (key, callback) { + this._mainController.serverFacade.getSetting(key, callback); + }; + + this.setSettingValue = function (key, value) { + this._mainController.serverFacade.setSetting(key, value); + }; + } \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileView.js index c62644afa24a64775707bac7880390024b097ab0..e87f1560104fa3648e9c5272595f62858e0de5fa 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileView.js @@ -21,6 +21,7 @@ function UserProfileView(userProfileController, userProfileModel) { this._$firstNameInput = null; this._$lastNameInput = null; this._$emailInput = null; + this._$zenodoToken = null; this.repaint = function(views) { @@ -71,6 +72,16 @@ function UserProfileView(userProfileController, userProfileModel) { this._$emailInput = $("<input>", { type : "text", class : "form-control" }); this._$emailInput.val(getUserInformation.email); $formColumn.append(this._getFormGroup(this._$emailInput, "Email:")); + // personal Zenodo API token + this._$zenodoToken = $("<input>", { type : "text", class : "form-control" }); + + this._userProfileController.getSettingValue(this._userProfileController._zenodoApiTokenKey, (function (settingsValue) { + if (settingsValue) { + this._$zenodoToken.val(settingsValue); + } + }).bind(this)); + $formColumn.append(this._getFormGroup(this._$zenodoToken, "Zenodo API Token:")); + // disable in view mode if (this._userProfileModel.mode === FormMode.VIEW || !this._userProfileController.isFileAuthentication()) { @@ -78,6 +89,10 @@ function UserProfileView(userProfileController, userProfileModel) { this._$lastNameInput.prop("disabled", true); this._$emailInput.prop("disabled", true); } + + if (this._userProfileModel.mode === FormMode.VIEW) { + this._$zenodoToken.prop("disabled", true); + } }).bind(this)); } @@ -97,6 +112,7 @@ function UserProfileView(userProfileController, userProfileModel) { firstName : this._$firstNameInput.val(), lastName : this._$lastNameInput.val(), email : this._$emailInput.val(), + zenodoToken : this._$zenodoToken.val() }; }