From c9033c7ad0239164ca25d4b50399d1dd24737106 Mon Sep 17 00:00:00 2001 From: Yuriko Oshima Date: Thu, 6 Jan 2022 10:54:30 +0900 Subject: [PATCH 01/11] Add author affiliation managment UI --- app-author-add/src/app/app.component.css | 5 + app-author-add/src/app/app.component.html | 191 +++++++++++- app-author-add/src/app/app.component.ts | 214 ++++++++++++- app-author-affiliation/.angular-cli.json | 61 ++++ app-author-affiliation/.editorconfig | 13 + app-author-affiliation/.gitignore | 43 +++ app-author-affiliation/README.md | 27 ++ app-author-affiliation/e2e/app.e2e-spec.ts | 14 + app-author-affiliation/e2e/app.po.ts | 11 + app-author-affiliation/e2e/tsconfig.e2e.json | 14 + app-author-affiliation/karma.conf.js | 33 ++ app-author-affiliation/package.json | 50 +++ app-author-affiliation/protractor.conf.js | 28 ++ .../src/app/app.component.css | 27 ++ .../src/app/app.component.html | 114 +++++++ .../src/app/app.component.ts | 295 ++++++++++++++++++ app-author-affiliation/src/app/app.module.ts | 22 ++ app-author-affiliation/src/assets/.gitkeep | 0 .../src/environments/environment.prod.ts | 3 + .../src/environments/environment.ts | 8 + app-author-affiliation/src/favicon.ico | Bin 0 -> 5430 bytes app-author-affiliation/src/index.html | 14 + app-author-affiliation/src/main.ts | 12 + app-author-affiliation/src/polyfills.ts | 66 ++++ app-author-affiliation/src/styles.css | 62 ++++ app-author-affiliation/src/test.ts | 20 ++ app-author-affiliation/src/tsconfig.app.json | 13 + app-author-affiliation/src/tsconfig.spec.json | 19 ++ app-author-affiliation/src/typings.d.ts | 5 + app-author-affiliation/tsconfig.json | 19 ++ app-author-affiliation/tslint.json | 143 +++++++++ app-author-prefix/src/app/app.component.html | 20 +- app-author-prefix/src/app/app.component.ts | 44 +++ cp_app_author_affiliation.sh | 25 ++ 34 files changed, 1617 insertions(+), 18 deletions(-) create mode 100644 app-author-affiliation/.angular-cli.json create mode 100644 app-author-affiliation/.editorconfig create mode 100644 app-author-affiliation/.gitignore create mode 100644 app-author-affiliation/README.md create mode 100644 app-author-affiliation/e2e/app.e2e-spec.ts create mode 100644 app-author-affiliation/e2e/app.po.ts create mode 100644 app-author-affiliation/e2e/tsconfig.e2e.json create mode 100644 app-author-affiliation/karma.conf.js create mode 100644 app-author-affiliation/package.json create mode 100644 app-author-affiliation/protractor.conf.js create mode 100644 app-author-affiliation/src/app/app.component.css create mode 100644 app-author-affiliation/src/app/app.component.html create mode 100644 app-author-affiliation/src/app/app.component.ts create mode 100644 app-author-affiliation/src/app/app.module.ts create mode 100644 app-author-affiliation/src/assets/.gitkeep create mode 100644 app-author-affiliation/src/environments/environment.prod.ts create mode 100644 app-author-affiliation/src/environments/environment.ts create mode 100644 app-author-affiliation/src/favicon.ico create mode 100644 app-author-affiliation/src/index.html create mode 100644 app-author-affiliation/src/main.ts create mode 100644 app-author-affiliation/src/polyfills.ts create mode 100644 app-author-affiliation/src/styles.css create mode 100644 app-author-affiliation/src/test.ts create mode 100644 app-author-affiliation/src/tsconfig.app.json create mode 100644 app-author-affiliation/src/tsconfig.spec.json create mode 100644 app-author-affiliation/src/typings.d.ts create mode 100644 app-author-affiliation/tsconfig.json create mode 100644 app-author-affiliation/tslint.json create mode 100755 cp_app_author_affiliation.sh diff --git a/app-author-add/src/app/app.component.css b/app-author-add/src/app/app.component.css index dbb5931..0e480dc 100644 --- a/app-author-add/src/app/app.component.css +++ b/app-author-add/src/app/app.component.css @@ -7,3 +7,8 @@ .author-id-add input[type=radio] { margin-left: 10px; } + +.author-id-add .affiliation-panel{ + border-left: transparent; + border-right: transparent; +} \ No newline at end of file diff --git a/app-author-add/src/app/app.component.html b/app-author-add/src/app/app.component.html index 3ed1a9d..de51fd7 100644 --- a/app-author-add/src/app/app.component.html +++ b/app-author-add/src/app/app.component.html @@ -157,7 +157,7 @@

- +
+ @@ -213,19 +214,201 @@

+ + +
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+ + + {{langJson.Author_Identifier[1]}} +
+
+ + +
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+
+
+   + + + {{langJson.Author_Display[1]}} +   + + + {{langJson.Author_Hide[1]}} +
+
+
+
+
+ +
+
+
+
+

+
+ +
+
+ +
+
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+
+ +
+
+ +
+
+
+
+   + + + {{langJson.Author_Display[1]}} +   + + + {{langJson.Author_Hide[1]}} +
+
+
+
+
+ +
+
+
+
+

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

-
- ' + this.langJson.Author_Confirm_Msg[1] + '
'); } } + /** + * affiliation confirm identifier url + */ + affiliationConfirm(affiliationNameIdentifier: any, affiliationNameIdentifierScheme: any) { + let url_identifier = ""; + for (let i = 0; i < this.identifierOptions.length; i++) { + if (affiliationNameIdentifier == this.identifierOptions[i].id) { + url_identifier = this.identifierOptions[i].url; + } + } + if (url_identifier != "") { + window.open(url_identifier.replace(/#+$/, affiliationNameIdentifierScheme), "_blank"); + } else { + $('#alerts').append( + '
' + + '' + this.langJson.Author_Confirm_Msg[1] + '
'); + } + } + /** * エラー処理 */ diff --git a/app-author-affiliation/.angular-cli.json b/app-author-affiliation/.angular-cli.json new file mode 100644 index 0000000..a236162 --- /dev/null +++ b/app-author-affiliation/.angular-cli.json @@ -0,0 +1,61 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "project": { + "name": "app-angular-js" + }, + "apps": [ + { + "root": "src", + "outDir": "dist", + "assets": [ + "assets", + "favicon.ico" + ], + "index": "index.html", + "main": "main.ts", + "polyfills": "polyfills.ts", + "test": "test.ts", + "tsconfig": "tsconfig.app.json", + "testTsconfig": "tsconfig.spec.json", + "prefix": "app", + "styles": [ + "styles.css" + ], + "scripts": [ + ], + "environmentSource": "environments/environment.ts", + "environments": { + "dev": "environments/environment.ts", + "prod": "environments/environment.prod.ts" + } + } + ], + "e2e": { + "protractor": { + "config": "./protractor.conf.js" + } + }, + "lint": [ + { + "project": "src/tsconfig.app.json", + "exclude": "**/node_modules/**" + }, + { + "project": "src/tsconfig.spec.json", + "exclude": "**/node_modules/**" + }, + { + "project": "e2e/tsconfig.e2e.json", + "exclude": "**/node_modules/**" + } + ], + "test": { + "karma": { + "config": "./karma.conf.js" + } + }, + "defaults": { + "styleExt": "css", + "component": {} + } +} diff --git a/app-author-affiliation/.editorconfig b/app-author-affiliation/.editorconfig new file mode 100644 index 0000000..6e87a00 --- /dev/null +++ b/app-author-affiliation/.editorconfig @@ -0,0 +1,13 @@ +# Editor configuration, see http://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +max_line_length = off +trim_trailing_whitespace = false diff --git a/app-author-affiliation/.gitignore b/app-author-affiliation/.gitignore new file mode 100644 index 0000000..4ae2c37 --- /dev/null +++ b/app-author-affiliation/.gitignore @@ -0,0 +1,43 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. + +# compiled output +/dist +/dist-server +/tmp +/out-tsc + +# dependencies +/node_modules + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +# misc +/.sass-cache +/connect.lock +/coverage +/libpeerconnection.log +npm-debug.log +testem.log +/typings + +# e2e +/e2e/*.js +/e2e/*.map + +# System Files +.DS_Store +Thumbs.db diff --git a/app-author-affiliation/README.md b/app-author-affiliation/README.md new file mode 100644 index 0000000..84828cd --- /dev/null +++ b/app-author-affiliation/README.md @@ -0,0 +1,27 @@ +# AppAngularJS + +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.6.8. + +## Development server + +Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. + +## Code scaffolding + +Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. + +## Build + +Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. + +## Running unit tests + +Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). + +## Running end-to-end tests + +Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). + +## Further help + +To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). diff --git a/app-author-affiliation/e2e/app.e2e-spec.ts b/app-author-affiliation/e2e/app.e2e-spec.ts new file mode 100644 index 0000000..03d9686 --- /dev/null +++ b/app-author-affiliation/e2e/app.e2e-spec.ts @@ -0,0 +1,14 @@ +import { AppPage } from './app.po'; + +describe('app-angular-js App', () => { + let page: AppPage; + + beforeEach(() => { + page = new AppPage(); + }); + + it('should display welcome message', () => { + page.navigateTo(); + expect(page.getParagraphText()).toEqual('Welcome to app!'); + }); +}); diff --git a/app-author-affiliation/e2e/app.po.ts b/app-author-affiliation/e2e/app.po.ts new file mode 100644 index 0000000..82ea75b --- /dev/null +++ b/app-author-affiliation/e2e/app.po.ts @@ -0,0 +1,11 @@ +import { browser, by, element } from 'protractor'; + +export class AppPage { + navigateTo() { + return browser.get('/'); + } + + getParagraphText() { + return element(by.css('app-root h1')).getText(); + } +} diff --git a/app-author-affiliation/e2e/tsconfig.e2e.json b/app-author-affiliation/e2e/tsconfig.e2e.json new file mode 100644 index 0000000..1d9e5ed --- /dev/null +++ b/app-author-affiliation/e2e/tsconfig.e2e.json @@ -0,0 +1,14 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/e2e", + "baseUrl": "./", + "module": "commonjs", + "target": "es5", + "types": [ + "jasmine", + "jasminewd2", + "node" + ] + } +} diff --git a/app-author-affiliation/karma.conf.js b/app-author-affiliation/karma.conf.js new file mode 100644 index 0000000..af139fa --- /dev/null +++ b/app-author-affiliation/karma.conf.js @@ -0,0 +1,33 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular/cli'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage-istanbul-reporter'), + require('@angular/cli/plugins/karma') + ], + client:{ + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + coverageIstanbulReporter: { + reports: [ 'html', 'lcovonly' ], + fixWebpackSourcePaths: true + }, + angularCli: { + environment: 'dev' + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false + }); +}; diff --git a/app-author-affiliation/package.json b/app-author-affiliation/package.json new file mode 100644 index 0000000..adee038 --- /dev/null +++ b/app-author-affiliation/package.json @@ -0,0 +1,50 @@ +{ + "name": "app-angular-js", + "version": "0.0.0", + "license": "MIT", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build --prod", + "test": "ng test", + "lint": "ng lint", + "e2e": "ng e2e" + }, + "private": true, + "dependencies": { + "@angular/animations": "^5.2.0", + "@angular/common": "^5.2.0", + "@angular/compiler": "^5.2.0", + "@angular/core": "^5.2.0", + "@angular/forms": "^5.2.0", + "@angular/http": "^5.2.0", + "@angular/platform-browser": "^5.2.0", + "@angular/platform-browser-dynamic": "^5.2.0", + "@angular/router": "^5.2.0", + "bootstrap": "^3.3.7", + "core-js": "^2.4.1", + "rxjs": "^5.5.6", + "zone.js": "^0.8.19" + }, + "devDependencies": { + "@angular/cli": "1.6.8", + "@angular/compiler-cli": "^5.2.0", + "@angular/language-service": "^5.2.0", + "@types/jasmine": "~2.8.3", + "@types/jasminewd2": "~2.0.2", + "@types/jquery": "^3.3.0", + "@types/node": "~6.0.60", + "codelyzer": "^4.0.1", + "jasmine-core": "~2.8.0", + "jasmine-spec-reporter": "~4.2.1", + "karma": "~2.0.0", + "karma-chrome-launcher": "~2.2.0", + "karma-coverage-istanbul-reporter": "^1.2.1", + "karma-jasmine": "~1.1.0", + "karma-jasmine-html-reporter": "^0.2.2", + "protractor": "~5.1.2", + "ts-node": "~4.1.0", + "tslint": "~5.9.1", + "typescript": "~3.2.4" + } +} diff --git a/app-author-affiliation/protractor.conf.js b/app-author-affiliation/protractor.conf.js new file mode 100644 index 0000000..7ee3b5e --- /dev/null +++ b/app-author-affiliation/protractor.conf.js @@ -0,0 +1,28 @@ +// Protractor configuration file, see link for more information +// https://github.com/angular/protractor/blob/master/lib/config.ts + +const { SpecReporter } = require('jasmine-spec-reporter'); + +exports.config = { + allScriptsTimeout: 11000, + specs: [ + './e2e/**/*.e2e-spec.ts' + ], + capabilities: { + 'browserName': 'chrome' + }, + directConnect: true, + baseUrl: 'http://localhost:4200/', + framework: 'jasmine', + jasmineNodeOpts: { + showColors: true, + defaultTimeoutInterval: 30000, + print: function() {} + }, + onPrepare() { + require('ts-node').register({ + project: 'e2e/tsconfig.e2e.json' + }); + jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); + } +}; diff --git a/app-author-affiliation/src/app/app.component.css b/app-author-affiliation/src/app/app.component.css new file mode 100644 index 0000000..6307097 --- /dev/null +++ b/app-author-affiliation/src/app/app.component.css @@ -0,0 +1,27 @@ +.weko_authors .add-button { + width: 120px; +} + +.weko_authors .name { + min-width: 200px; +} + +.weko_authors .scheme { + min-width: 250px; + max-width: 250px; +} + +.weko_authors .button-group { + text-align: right; +} + +@media only screen and (max-width: 1199px) { + .weko_authors .other-scheme { + margin-top: 10px; + } + + .weko_authors .scheme { + min-width: 150px; + max-width: 150px; + } +} diff --git a/app-author-affiliation/src/app/app.component.html b/app-author-affiliation/src/app/app.component.html new file mode 100644 index 0000000..3a115f4 --- /dev/null +++ b/app-author-affiliation/src/app/app.component.html @@ -0,0 +1,114 @@ +

+

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{langJson.Affiliation_Name[1]}} + + {{langJson.Affiliation_Scheme[1]}} + + {{langJson.Affiliation_URL[1]}} + + {{langJson.Author_Control[1]}} +
+ + + + +
+
+ +
+
+ +
+
+
+ + + + +
+ + + +
+ + +
+
+ +
+
+ +
+
+
+ + + +
+
+
+
+
+
diff --git a/app-author-affiliation/src/app/app.component.ts b/app-author-affiliation/src/app/app.component.ts new file mode 100644 index 0000000..ccfac8b --- /dev/null +++ b/app-author-affiliation/src/app/app.component.ts @@ -0,0 +1,295 @@ +import { Component, OnInit } from '@angular/core'; +import { Http, RequestOptions, Headers } from '@angular/http'; +import 'rxjs/add/operator/toPromise'; +declare var $: any; + +@Component({ + selector: 'app-affiliation-search', + templateUrl: './app.component.html', + styleUrls: ['./app.component.css'] +}) +export class AppComponent implements OnInit { + //画面データを設定 + //i18n + public langJson = { + Affiliation_Name: [], + Affiliation_Scheme: [], + Affiliation_URL: [], + Author_Control: [], + Author_Button_Edit: [], + Author_Button_Save: [], + Author_Button_Cancel: [], + Author_Button_Delete: [], + Author_Select: [], + Author_Button_Add: [] + }; + + public control = { + edit_flag: [] + }; + public displayData: [ + { + id: -1, + name: "", + url: "", + scheme: "", + name_temp: "", + url_temp: "", + scheme_temp: "", + otherScheme_temp: "", + } + ]; + public new_settings: any = { + name: "", + url: "", + scheme: "" + }; + public controlledVocabularies = []; + public otherIndex: number = 0; + public schemeOtherValue: string = ""; + public selectedScheme: string = ""; + + constructor(private http: Http, ) { } + + ngOnInit() { + this.setI18n(); + } + ngAfterViewInit() { + this.getAuthorsAffiliationSettings(); + this.getAffiliationScheme(); + } + + /** + * i18n + */ + setI18n() { + let lang = $("#lang-code").val(); + let js = document.scripts; + let jsUrl = js[js.length - 1].src; + let strUrl = jsUrl.substring(0, jsUrl.lastIndexOf('static')); + let jsonUrl = strUrl + "static/json/weko_authors/translations/" + lang + "/messages.json"; + console.log(lang); + this.getLnagJson(jsonUrl).then(res => { + this.langJson = res; + }).catch( + ); + } + + /** + * 多言語対応 + */ + getLnagJson(url: any): Promise { + return this.http + .get(url) + .toPromise() + .then(response => response.json() as any) + .catch(this.handleError); + } + + /** + * edit authors affiliation settings + */ + edit(index: any) { + this.control.edit_flag[index] = true + console.log(this.displayData[index]); + this.displayData[index].name_temp = this.displayData[index].name; + this.displayData[index].url_temp = this.displayData[index].url; + if (this.controlledVocabularies.indexOf(this.displayData[index].scheme) < 0) { + this.displayData[index].scheme_temp = this.controlledVocabularies[this.otherIndex]; + this.displayData[index].otherScheme_temp = this.displayData[index].scheme; + } else { + this.displayData[index].scheme_temp = this.displayData[index].scheme; + this.displayData[index].otherScheme_temp = ""; + } + } + /** + * update authors affiliation settings + */ + update(index: any) { + console.log(this.displayData[index]); + let data = { id: -1, name: "", url: "", scheme: "" }; + data.id = this.displayData[index].id; + data.name = this.displayData[index].name_temp; + data.url = this.displayData[index].url_temp; + data.scheme = this.displayData[index].scheme_temp != this.controlledVocabularies[this.otherIndex] ? + this.displayData[index].scheme_temp.trim() : this.displayData[index].otherScheme_temp.trim(); + let validation_res = this.validation(data); + if (validation_res != 'OK') { + alert(validation_res); + return; + } + this.updateSettings(data).then( + res => { + if (res.code == 400) { + alert(res.msg); + } else { + alert('Update completed'); + window.location.reload(); + } + }).catch( + res => { + alert(res.msg); + window.location.reload(); + }); + } + /** + * delete authors affiliation settings + */ + delete(id: any) { + console.log(id); + this.deleteSettings(id).then( + res => { + alert('Successfully deleted'); + }).catch( + res => { + alert(res.msg); + }); + window.location.reload(); + } + /** + * add authors affiliation settings + */ + add() { + console.log(this.new_settings); + this.new_settings.scheme = this.selectedScheme != this.controlledVocabularies[this.otherIndex] ? + this.selectedScheme.trim() : this.schemeOtherValue.trim(); + let validation_res = this.validation(this.new_settings); + if (validation_res != 'OK') { + alert(validation_res); + return; + } + this.putSettings(this.new_settings).then( + res => { + if (res.code == 400) { + alert(res.msg); + } else { + alert('Successfully added'); + window.location.reload(); + } + }).catch( + res => { + alert(res.msg); + window.location.reload(); + }); + } + /** + * get authors affiliation settings + */ + getAuthorsAffiliationSettings() { + this.getDataOfAuthorsAffiliationSettings().then( + res => { + this.displayData = res; + console.log(res); + for (let i = 0; i < res.length; i++) { + this.control.edit_flag[i] = false; + this.displayData[i].name_temp = this.displayData[i].name; + this.displayData[i].url_temp = this.displayData[i].url; + this.displayData[i].scheme_temp = this.displayData[i].scheme; + } + } + ).catch(); + } + /** + * get list of controlled vocabularies + */ + getAffiliationScheme() { + this.getListOfAffiliationScheme().then( + res => { + this.controlledVocabularies = res.list; + this.otherIndex = res.index; + console.log(res); + } + ).catch(); + } + /** + * call web api (get author affiliation settings) + */ + getDataOfAuthorsAffiliationSettings() { + var urlArr = window.location.href.split('/'); + const url = urlArr[0] + "//" + urlArr[2] + "/api/authors/search_affiliation"; + return this.http + .get(url) + .toPromise() + .then(response => response.json() as any) + .catch(this.handleError); + } + /** + * call web api (get list of affiliation identifier scheme) + */ + getListOfAffiliationScheme() { + var urlArr = window.location.href.split('/'); + const url = urlArr[0] + "//" + urlArr[2] + "/api/authors/list_affiliation_scheme"; + return this.http + .get(url) + .toPromise() + .then(response => response.json() as any) + .catch(this.handleError); + } + /** + * call web api (update author affiliation settings) + */ + updateSettings(data: any) { + var urlArr = window.location.href.split('/'); + const url = urlArr[0] + "//" + urlArr[2] + "/api/authors/edit_affiliation"; + return this.http + .post(url, data) + .toPromise() + .then(response => response.json() as any) + .catch(this.handleError); + } + /** + * call web api (delete author affiliation settings) + */ + deleteSettings(id: any) { + var urlArr = window.location.href.split('/'); + const url = urlArr[0] + "//" + urlArr[2] + "/api/authors/delete_affiliation/" + id; + return this.http + .delete(url) + .toPromise() + .then(response => response.json() as any) + .catch(this.handleError); + } + /** + * call web api (add an author affiliation settings) + */ + putSettings(data: any) { + var urlArr = window.location.href.split('/'); + const url = urlArr[0] + "//" + urlArr[2] + "/api/authors/add_affiliation"; + return this.http + .put(url, data) + .toPromise() + .then(response => response.json() as any) + .catch(this.handleError); + } + /** + * Check if "name" is empty and Verify URL + */ + validation(data: any) { + if (data.name.trim().length == 0) { + return 'Please enter the correct "Name"'; + } + if (data.scheme.trim().length == 0) { + return 'Please enter the correct "Scheme"'; + } + if (data.scheme.trim().length > 30) { + return '"Scheme" is longer than 30 characters'; + } + if (this.displayData.find(i => i.scheme == data.scheme && i.id != data.id)) { + return 'Specified scheme is already exist.'; + } + let reg = /^(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/; + if (data.url.length > 0 && !reg.test(data.url)) { + return 'Please enter the correct "URL"'; + } + return 'OK'; + } + /** + * エラー処理 + */ + private handleError(error: any): Promise { + console.error('An error occurred', error); // + return Promise.reject(error.message || error); + } +} + + diff --git a/app-author-affiliation/src/app/app.module.ts b/app-author-affiliation/src/app/app.module.ts new file mode 100644 index 0000000..f773563 --- /dev/null +++ b/app-author-affiliation/src/app/app.module.ts @@ -0,0 +1,22 @@ +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { HttpModule } from '@angular/http'; +import { AppComponent } from './app.component'; +import { Route } from '@angular/compiler/src/core'; + + +@NgModule({ + declarations: [ + AppComponent + ], + imports: [ + BrowserModule, + FormsModule, + HttpModule + ], + exports:[], + providers: [], + bootstrap: [AppComponent], +}) +export class AppModule { } diff --git a/app-author-affiliation/src/assets/.gitkeep b/app-author-affiliation/src/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app-author-affiliation/src/environments/environment.prod.ts b/app-author-affiliation/src/environments/environment.prod.ts new file mode 100644 index 0000000..3612073 --- /dev/null +++ b/app-author-affiliation/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/app-author-affiliation/src/environments/environment.ts b/app-author-affiliation/src/environments/environment.ts new file mode 100644 index 0000000..b7f639a --- /dev/null +++ b/app-author-affiliation/src/environments/environment.ts @@ -0,0 +1,8 @@ +// The file contents for the current environment will overwrite these during build. +// The build system defaults to the dev environment which uses `environment.ts`, but if you do +// `ng build --env=prod` then `environment.prod.ts` will be used instead. +// The list of which env maps to which file can be found in `.angular-cli.json`. + +export const environment = { + production: false +}; diff --git a/app-author-affiliation/src/favicon.ico b/app-author-affiliation/src/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..8081c7ceaf2be08bf59010158c586170d9d2d517 GIT binary patch literal 5430 zcmc(je{54#6vvCoAI3i*G5%$U7!sA3wtMZ$fH6V9C`=eXGJb@R1%(I_{vnZtpD{6n z5Pl{DmxzBDbrB>}`90e12m8T*36WoeDLA&SD_hw{H^wM!cl_RWcVA!I+x87ee975; z@4kD^=bYPn&pmG@(+JZ`rqQEKxW<}RzhW}I!|ulN=fmjVi@x{p$cC`)5$a!)X&U+blKNvN5tg=uLvuLnuqRM;Yc*swiexsoh#XPNu{9F#c`G zQLe{yWA(Y6(;>y|-efAy11k<09(@Oo1B2@0`PtZSkqK&${ zgEY}`W@t{%?9u5rF?}Y7OL{338l*JY#P!%MVQY@oqnItpZ}?s z!r?*kwuR{A@jg2Chlf0^{q*>8n5Ir~YWf*wmsh7B5&EpHfd5@xVaj&gqsdui^spyL zB|kUoblGoO7G(MuKTfa9?pGH0@QP^b#!lM1yHWLh*2iq#`C1TdrnO-d#?Oh@XV2HK zKA{`eo{--^K&MW66Lgsktfvn#cCAc*(}qsfhrvOjMGLE?`dHVipu1J3Kgr%g?cNa8 z)pkmC8DGH~fG+dlrp(5^-QBeEvkOvv#q7MBVLtm2oD^$lJZx--_=K&Ttd=-krx(Bb zcEoKJda@S!%%@`P-##$>*u%T*mh+QjV@)Qa=Mk1?#zLk+M4tIt%}wagT{5J%!tXAE;r{@=bb%nNVxvI+C+$t?!VJ@0d@HIyMJTI{vEw0Ul ze(ha!e&qANbTL1ZneNl45t=#Ot??C0MHjjgY8%*mGisN|S6%g3;Hlx#fMNcL<87MW zZ>6moo1YD?P!fJ#Jb(4)_cc50X5n0KoDYfdPoL^iV`k&o{LPyaoqMqk92wVM#_O0l z09$(A-D+gVIlq4TA&{1T@BsUH`Bm=r#l$Z51J-U&F32+hfUP-iLo=jg7Xmy+WLq6_tWv&`wDlz#`&)Jp~iQf zZP)tu>}pIIJKuw+$&t}GQuqMd%Z>0?t%&BM&Wo^4P^Y z)c6h^f2R>X8*}q|bblAF?@;%?2>$y+cMQbN{X$)^R>vtNq_5AB|0N5U*d^T?X9{xQnJYeU{ zoZL#obI;~Pp95f1`%X3D$Mh*4^?O?IT~7HqlWguezmg?Ybq|7>qQ(@pPHbE9V?f|( z+0xo!#m@Np9PljsyxBY-UA*{U*la#8Wz2sO|48_-5t8%_!n?S$zlGe+NA%?vmxjS- zHE5O3ZarU=X}$7>;Okp(UWXJxI%G_J-@IH;%5#Rt$(WUX?6*Ux!IRd$dLP6+SmPn= z8zjm4jGjN772R{FGkXwcNv8GBcZI#@Y2m{RNF_w8(Z%^A*!bS*!}s6sh*NnURytky humW;*g7R+&|Ledvc- + + + + AppAngularJS + + + + + + + + + diff --git a/app-author-affiliation/src/main.ts b/app-author-affiliation/src/main.ts new file mode 100644 index 0000000..91ec6da --- /dev/null +++ b/app-author-affiliation/src/main.ts @@ -0,0 +1,12 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule) + .catch(err => console.log(err)); diff --git a/app-author-affiliation/src/polyfills.ts b/app-author-affiliation/src/polyfills.ts new file mode 100644 index 0000000..c8301a4 --- /dev/null +++ b/app-author-affiliation/src/polyfills.ts @@ -0,0 +1,66 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE9, IE10 and IE11 requires all of the following polyfills. **/ +import 'core-js/es6/symbol'; +import 'core-js/es6/object'; +import 'core-js/es6/function'; +import 'core-js/es6/parse-int'; +import 'core-js/es6/parse-float'; +import 'core-js/es6/number'; +import 'core-js/es6/math'; +import 'core-js/es6/string'; +import 'core-js/es6/date'; +import 'core-js/es6/array'; +import 'core-js/es6/regexp'; +import 'core-js/es6/map'; +import 'core-js/es6/weak-map'; +import 'core-js/es6/set'; + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** IE10 and IE11 requires the following for the Reflect API. */ +import 'core-js/es6/reflect'; + + +/** Evergreen browsers require these. **/ +// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. +import 'core-js/es7/reflect'; + + +/** + * Required to support Web Animations `@angular/platform-browser/animations`. + * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation + **/ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + + + +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ diff --git a/app-author-affiliation/src/styles.css b/app-author-affiliation/src/styles.css new file mode 100644 index 0000000..16a6c7c --- /dev/null +++ b/app-author-affiliation/src/styles.css @@ -0,0 +1,62 @@ +.alignCenter{ + text-align: center +} +.textRight{ + text-align: right +} + +.col-sm-1{ + padding-left: 2px; + padding-right: 2px; +} +.col-sm-2{ + padding-left: 2px; + padding-right: 2px; +} +.col-sm-3{ + padding-left: 2px; + padding-right: 2px; +} +.col-sm-4{ + padding-left: 2px; + padding-right: 2px; +} +.col-sm-5{ + padding-left: 2px; + padding-right: 2px; +} +.col-sm-6{ + padding-left: 2px; + padding-right: 2px; +} +.col-sm-7{ + padding-left: 2px; + padding-right: 2px; +} +.col-sm-8{ + padding-left: 2px; + padding-right: 2px; +} +.col-sm-9{ + padding-left: 2px;; + padding-right: 2px; +} +.col-sm-10{ + padding-left: 2px; + padding-right: 2px; +} +.col-sm-11{ + padding-left: 2px; + padding-right: 2px; +} +.col-sm-12{ + padding-left: 2px; + padding-right: 2px; +} + +.delButton{ + float: left; +} +.divBottom{ + margin-bottom: 10px; +} \ No newline at end of file diff --git a/app-author-affiliation/src/test.ts b/app-author-affiliation/src/test.ts new file mode 100644 index 0000000..1631789 --- /dev/null +++ b/app-author-affiliation/src/test.ts @@ -0,0 +1,20 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/dist/zone-testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +declare const require: any; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() +); +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); diff --git a/app-author-affiliation/src/tsconfig.app.json b/app-author-affiliation/src/tsconfig.app.json new file mode 100644 index 0000000..39ba8db --- /dev/null +++ b/app-author-affiliation/src/tsconfig.app.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/app", + "baseUrl": "./", + "module": "es2015", + "types": [] + }, + "exclude": [ + "test.ts", + "**/*.spec.ts" + ] +} diff --git a/app-author-affiliation/src/tsconfig.spec.json b/app-author-affiliation/src/tsconfig.spec.json new file mode 100644 index 0000000..ac22a29 --- /dev/null +++ b/app-author-affiliation/src/tsconfig.spec.json @@ -0,0 +1,19 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/spec", + "baseUrl": "./", + "module": "commonjs", + "types": [ + "jasmine", + "node" + ] + }, + "files": [ + "test.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +} diff --git a/app-author-affiliation/src/typings.d.ts b/app-author-affiliation/src/typings.d.ts new file mode 100644 index 0000000..ef5c7bd --- /dev/null +++ b/app-author-affiliation/src/typings.d.ts @@ -0,0 +1,5 @@ +/* SystemJS module definition */ +declare var module: NodeModule; +interface NodeModule { + id: string; +} diff --git a/app-author-affiliation/tsconfig.json b/app-author-affiliation/tsconfig.json new file mode 100644 index 0000000..a6c016b --- /dev/null +++ b/app-author-affiliation/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "outDir": "./dist/out-tsc", + "sourceMap": true, + "declaration": false, + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es5", + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2017", + "dom" + ] + } +} diff --git a/app-author-affiliation/tslint.json b/app-author-affiliation/tslint.json new file mode 100644 index 0000000..9963d6c --- /dev/null +++ b/app-author-affiliation/tslint.json @@ -0,0 +1,143 @@ +{ + "rulesDirectory": [ + "node_modules/codelyzer" + ], + "rules": { + "arrow-return-shorthand": true, + "callable-types": true, + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "curly": true, + "deprecation": { + "severity": "warn" + }, + "eofline": true, + "forin": true, + "import-blacklist": [ + true, + "rxjs", + "rxjs/Rx" + ], + "import-spacing": true, + "indent": [ + true, + "spaces" + ], + "interface-over-type-literal": true, + "label-position": true, + "max-line-length": [ + true, + 140 + ], + "member-access": false, + "member-ordering": [ + true, + { + "order": [ + "static-field", + "instance-field", + "static-method", + "instance-method" + ] + } + ], + "no-arg": true, + "no-bitwise": true, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-debugger": true, + "no-duplicate-super": true, + "no-empty": false, + "no-empty-interface": true, + "no-eval": true, + "no-inferrable-types": [ + true, + "ignore-params" + ], + "no-misused-new": true, + "no-non-null-assertion": true, + "no-shadowed-variable": true, + "no-string-literal": false, + "no-string-throw": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unnecessary-initializer": true, + "no-unused-expression": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "object-literal-sort-keys": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" + ], + "prefer-const": true, + "quotemark": [ + true, + "single" + ], + "radix": true, + "semicolon": [ + true, + "always" + ], + "triple-equals": [ + true, + "allow-null-check" + ], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "unified-signatures": true, + "variable-name": false, + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ], + "directive-selector": [ + true, + "attribute", + "app", + "camelCase" + ], + "component-selector": [ + true, + "element", + "app", + "kebab-case" + ], + "no-output-on-prefix": true, + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-input-rename": true, + "no-output-rename": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "component-class-suffix": true, + "directive-class-suffix": true + } +} diff --git a/app-author-prefix/src/app/app.component.html b/app-author-prefix/src/app/app.component.html index 93f912f..a87d3ad 100644 --- a/app-author-prefix/src/app/app.component.html +++ b/app-author-prefix/src/app/app.component.html @@ -8,16 +8,16 @@ - Name + {{langJson.Prefix_Name[1]}} - Scheme + {{langJson.Prefix_Scheme[1]}} - URL + {{langJson.Prefix_URL[1]}} - Control + {{langJson.Author_Control[1]}} @@ -53,7 +53,7 @@ @@ -61,15 +61,15 @@ @@ -84,7 +84,7 @@
@@ -101,7 +101,7 @@ diff --git a/app-author-prefix/src/app/app.component.ts b/app-author-prefix/src/app/app.component.ts index d6860ea..4f5dee5 100644 --- a/app-author-prefix/src/app/app.component.ts +++ b/app-author-prefix/src/app/app.component.ts @@ -9,6 +9,21 @@ declare var $: any; styleUrls: ['./app.component.css'] }) export class AppComponent implements OnInit { + //画面データを設定 + //i18n + public langJson = { + Prefix_Name: [], + Prefix_Scheme: [], + Prefix_URL: [], + Author_Control: [], + Author_Button_Edit: [], + Author_Button_Save: [], + Author_Button_Cancel: [], + Author_Button_Delete: [], + Author_Select: [], + Author_Button_Add: [] + }; + public control = { edit_flag: [] }; @@ -37,11 +52,40 @@ export class AppComponent implements OnInit { constructor(private http: Http, ) { } ngOnInit() { + this.setI18n(); } ngAfterViewInit() { this.getAuthorsPrefixSettings(); this.getControlledVocabularies(); } + + /** + * i18n + */ + setI18n() { + let lang = $("#lang-code").val(); + let js = document.scripts; + let jsUrl = js[js.length - 1].src; + let strUrl = jsUrl.substring(0, jsUrl.lastIndexOf('static')); + let jsonUrl = strUrl + "static/json/weko_authors/translations/" + lang + "/messages.json"; + console.log(lang); + this.getLnagJson(jsonUrl).then(res => { + this.langJson = res; + }).catch( + ); + } + + /** + * 多言語対応 + */ + getLnagJson(url: any): Promise { + return this.http + .get(url) + .toPromise() + .then(response => response.json() as any) + .catch(this.handleError); + } + /** * edit authors prefix settings */ diff --git a/cp_app_author_affiliation.sh b/cp_app_author_affiliation.sh new file mode 100755 index 0000000..6313320 --- /dev/null +++ b/cp_app_author_affiliation.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# quit on errors and unbound symbols: +set -o errexit + +# args-check-begin +if [ ! -d "$1" ]; then + echo "Usage: $0 wekodir" + exit 1 +fi +WEKODIR=$1 + +if [ ! -d "${WEKODIR}/modules" ]; then + echo "No such ${WEKODIR}/modules/" + exit 1 +fi +TARGETDIR=$WEKODIR/modules +# args-check-end + +# copy-begin +cp -p ./app-author-affiliation/dist/inline.*.js ${TARGETDIR}/weko-authors/weko_authors/static/js/weko_authors/inline.affiliation.bundle.js +cp -p ./app-author-affiliation/dist/main.*.js ${TARGETDIR}/weko-authors/weko_authors/static/js/weko_authors/main.affiliation.bundle.js +cp -p ./app-author-affiliation/dist/polyfills.*.js ${TARGETDIR}/weko-authors/weko_authors/static/js/weko_authors/polyfills.affiliation.bundle.js +cp -p ./app-author-affiliation/dist/styles.*.css ${TARGETDIR}/weko-authors/weko_authors/static/css/weko_authors/styles.affiliation.bundle.css +# copy-end From 3e59d463db94b73462963701add3850ca9adeb42 Mon Sep 17 00:00:00 2001 From: Yuriko Oshima Date: Tue, 11 Jan 2022 08:29:42 +0900 Subject: [PATCH 02/11] =?UTF-8?q?=E3=83=9C=E3=82=BF=E3=83=B3=E3=81=AE?= =?UTF-8?q?=E8=A8=80=E8=AA=9E=E3=83=AA=E3=82=BD=E3=83=BC=E3=82=B9=E3=82=92?= =?UTF-8?q?=E7=B5=B1=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app-author-search/src/app/app.component.html | 4 ++-- app-author-search/src/app/app.component.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app-author-search/src/app/app.component.html b/app-author-search/src/app/app.component.html index 716acdd..7c34560 100644 --- a/app-author-search/src/app/app.component.html +++ b/app-author-search/src/app/app.component.html @@ -25,7 +25,7 @@ - {{langJson.Author_Search[1]}}    + {{langJson.Author_Button_Search[1]}}   
@@ -90,7 +90,7 @@ diff --git a/app-author-search/src/app/app.component.ts b/app-author-search/src/app/app.component.ts index be91f7f..6f4359f 100644 --- a/app-author-search/src/app/app.component.ts +++ b/app-author-search/src/app/app.component.ts @@ -15,9 +15,9 @@ export class AppComponent implements OnInit { Author_Name: [], Author_Add_Organization: [], Author_Add_Author:[], - Author_Search: [], + Author_Button_Search: [], Author_Mail_Address: [], - Author_Edit: [], + Author_Button_Edit: [], Author_Search_No_Result: [], Author_Page_Previous: [], Author_Page_Next: [], From 40204cdee2fff56c98262fbcf5ec2ad2a7021228 Mon Sep 17 00:00:00 2001 From: Yuriko Oshima Date: Tue, 11 Jan 2022 11:30:11 +0900 Subject: [PATCH 03/11] update langJson --- app-author-search/src/app/app.component.html | 28 ++++++++++---------- app-author-search/src/app/app.component.ts | 13 ++++++--- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/app-author-search/src/app/app.component.html b/app-author-search/src/app/app.component.html index 7c34560..0ebfe19 100644 --- a/app-author-search/src/app/app.component.html +++ b/app-author-search/src/app/app.component.html @@ -7,7 +7,7 @@
   +
+ + +
+
+
+   + + + {{langJson.Author_Display[1]}} +   + + + {{langJson.Author_Hide[1]}} +
+
+
+
+
+ +
+
+ + +

+ + +
+
+ +
+
+ + + + + +
+ +
+
+
+ +
+
+ + +
+
+
+
+
+ +
+
+ +
+
+
+
+   + + + {{langJson.Author_Display[1]}} +   + + + {{langJson.Author_Hide[1]}} +
+
+
+
+
+ +
+
+
+
+

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

diff --git a/app-items-author-search/src/app/add-author/add-author.component.ts b/app-items-author-search/src/app/add-author/add-author.component.ts index 627be7f..6de597c 100644 --- a/app-items-author-search/src/app/add-author/add-author.component.ts +++ b/app-items-author-search/src/app/add-author/add-author.component.ts @@ -23,6 +23,13 @@ export class AddAuthorComponent implements OnInit { Author_Add_Author_ID: [], Author_EMail: [], Author_Add_EMail: [], + Author_Identifier: [], + Author_Add_Identifier: [], + Author_Affiliation_Name: [], + Author_Add_Affiliation_Name: [], + Author_Affiliation: [], + Author_Add_Affiliation: [], + Author_Button_Delete: [], Author_Button_Clear: [], Author_Button_Save: [], Author_familyNmAndNm: [], @@ -47,16 +54,34 @@ export class AddAuthorComponent implements OnInit { ], authorIdInfo: [ { - idType: "1", + idType: "2", authorId: "", authorIdShowFlg: "true" } ], emailInfo: [ { email: "" } + ], + affiliationInfo: [ + { + identifierInfo: [ + { + affiliationNameIdentifier: "1", + affiliationNameIdentifierScheme: "", + identifierShowFlg: "true" + } + ], + affiliationNameInfo: [ + { + affiliationName: "", + affiliationNameLang: "ja", + affiliationNameShowFlg: "true" + } + ] + } ] } - //氏名の入力方 + //氏名の入力方法 // set data of name List public langOptions: any[] = [ { id: 'ja', value: 'ja' }, @@ -84,6 +109,14 @@ export class AddAuthorComponent implements OnInit { ]; // set data of group list public authorIdOptions: any[] = []; + // set data of group list + public identifierOptions: [ + { + id: -1, + name: "", + url: "" + } + ]; //氏名が姓・名で入力する場合 // set input guide public placeholderArry: any = [ @@ -101,6 +134,7 @@ export class AddAuthorComponent implements OnInit { ngOnInit() { this.setI18n(); this.getAuthorsPrefixSettings(); + this.getAuthorsAffiliationSettings(); } ngAfterViewInit() { this.getAuthorData(); @@ -115,6 +149,16 @@ export class AddAuthorComponent implements OnInit { } ).catch(); } + /** + * get authors affiliation settings + */ + getAuthorsAffiliationSettings() { + this.getDataOfAuthorsAffiliationSettings().then( + res => { + this.identifierOptions = res; + } + ).catch() + } /** * call api (get author prefix prefix) */ @@ -126,6 +170,18 @@ export class AddAuthorComponent implements OnInit { .then(response => response.json() as any) .catch(this.handleError); } + /** + * call api (get author Affiliation) + */ + getDataOfAuthorsAffiliationSettings() { + var urlArr = window.location.href.split('/'); + const url = urlArr[0] + "//" + urlArr[2] + "/api/authors/search_affiliation" + return this.http + .get(url) + .toPromise() + .then(response => response.json() as any) + .catch(this.handleError); + } /** * */ @@ -174,6 +230,12 @@ export class AddAuthorComponent implements OnInit { this.authorJsonObj.emailInfo.push(data); } } + if (info.hasOwnProperty("affiliationInfo")) { + this.authorJsonObj.affiliationInfo = []; + for (let data of info.affiliationInfo) { + this.authorJsonObj.affiliationInfo.push(data); + } + } console.log(JSON.stringify(this.authorJsonObj)) } /** @@ -183,7 +245,7 @@ export class AddAuthorComponent implements OnInit { let lang = $("#lang-code",parent.document).val(); let js = document.scripts; let jsUrl = js[js.length - 1].src; - let strUrl = jsUrl.substring(0, jsUrl.lastIndexOf('static')); + let strUrl = jsUrl.substring(0, jsUrl.lastIndexOf('_debug_toolbar')); let jsonUrl = strUrl + "static/json/weko_authors/translations/" + lang + "/messages.json"; this.getLnagJson(jsonUrl).then(res => { this.langJson = res; @@ -243,6 +305,45 @@ export class AddAuthorComponent implements OnInit { this.authorJsonObj.emailInfo.splice(index, 1) } } + /** + * identifierを削除する + * @@param 削除する位置情報 + */ + delIdentifierData(affiliationIndex: string | number, identifierIndex: any) { + //全部削除する場合 + if (this.authorJsonObj.affiliationInfo[affiliationIndex].identifierInfo.length == 1) { + let subIdentifierInfoObj = this.returnSubIdentifierInfoObj(); + this.authorJsonObj.affiliationInfo[affiliationIndex].identifierInfo.splice(identifierIndex, 1, subIdentifierInfoObj); + } else { + this.authorJsonObj.affiliationInfo[affiliationIndex].identifierInfo.splice(identifierIndex, 1) + } + } + /** + * affiliationNameを削除する + * @@param 削除する位置情報 + */ + delAffiliationNameData(affiliationIndex: string | number, affiliationNameIndex: any) { + //全部削除する場合 + if (this.authorJsonObj.affiliationInfo[affiliationIndex].affiliationNameInfo.length == 1) { + let subAffiliationNameInfoObj = this.returnSubAffiliationNameInfoObj(); + this.authorJsonObj.affiliationInfo[affiliationIndex].affiliationNameInfo.splice(affiliationNameIndex, 1, subAffiliationNameInfoObj); + } else { + this.authorJsonObj.affiliationInfo[affiliationIndex].affiliationNameInfo.splice(affiliationNameIndex, 1) + } + } + /** + * affiliationを削除する + * @@param 削除する位置情報 + */ + delAffiliationData(index: any) { + //全部削除する場合 + if (this.authorJsonObj.affiliationInfo.length == 1) { + let subAffiliationInfoObj = this.returnSubAffiliationInfoObj(); + this.authorJsonObj.affiliationInfo.splice(index, 1, subAffiliationInfoObj); + } else { + this.authorJsonObj.affiliationInfo.splice(index, 1) + } + } /** * 氏名情報を追加する */ @@ -260,13 +361,13 @@ export class AddAuthorComponent implements OnInit { * 著者情報を追加する */ addAuthorIdInfo() { - //子対象を取得す + //子対象を取得する let authorIdInfoObj = this.returnAuthorIdInfoObj(); //行目を追加 this.authorJsonObj.authorIdInfo.push(authorIdInfoObj); } /** - * メール情報を削除する + * メール情報を追加する */ addEmailInfo() { //子対象を取得する @@ -274,6 +375,36 @@ export class AddAuthorComponent implements OnInit { //行目を追加 this.authorJsonObj.emailInfo.push(subEmailInfo); } + /** + * 所属機関識別子情報を追加する + * @@param 追加する位置情報 + */ + addIdentifierInfo(affiliationIndex: any) { + //子対象を取得する + let subIdentifierInfoObj = this.returnSubIdentifierInfoObj(); + //行目を追加 + this.authorJsonObj.affiliationInfo[affiliationIndex].identifierInfo.push(subIdentifierInfoObj); + } + /** + * 所属機関名情報を追加する + * @@param 追加する位置情報 + */ + addAffiliationNameInfo(affiliationIndex: any) { + //子対象を取得する + let subAffiliationNameInfoObj = this.returnSubAffiliationNameInfoObj(); + //行目を追加 + this.authorJsonObj.affiliationInfo[affiliationIndex].affiliationNameInfo.push(subAffiliationNameInfoObj); + } + /** + * 所属情報を追加する + */ + addAffiliationInfo() { + //子対象を取得する + let subAffiliationInfoObj = this.returnSubAffiliationInfoObj(); + //行目を追加 + this.authorJsonObj.affiliationInfo.push(subAffiliationInfoObj); + } + /** *画面情報をクリアする */ @@ -282,10 +413,12 @@ export class AddAuthorComponent implements OnInit { let authorNameInfoLength = this.authorJsonObj.authorNameInfo.length; let authorIdInfoLength = this.authorJsonObj.authorIdInfo.length; let emailInfoLength = this.authorJsonObj.emailInfo.length; + let affiliationInfoLength = this.authorJsonObj.affiliationInfo.length; //画面情報を初期化 this.authorJsonObj.authorNameInfo = []; this.authorJsonObj.authorIdInfo = []; this.authorJsonObj.emailInfo = []; + this.authorJsonObj.affiliationInfo = []; //予定行を追加 for (let i = 0; i < authorNameInfoLength; i++) { let authorNameInfoObj = this.returnAuthorNameInfoObj(); @@ -302,6 +435,11 @@ export class AddAuthorComponent implements OnInit { let subEmailInfo = this.returnSubEmailInfo(); this.authorJsonObj.emailInfo.push(subEmailInfo); } + for (let i = 0; i < affiliationInfoLength; i++) { + let subAffiliationInfoObj = this.returnSubAffiliationInfoObj(); + this.authorJsonObj.affiliationInfo.push(subAffiliationInfoObj); + } + //入力案内内容を初期化に変更する } /** * 氏名情報を返す @@ -340,6 +478,47 @@ export class AddAuthorComponent implements OnInit { } return subEmailInfo; } + /** + * identifier情報を返す + */ + returnSubIdentifierInfoObj(): any { + //所属機関識別子情報 + let subIdentifierInfoObj = { + affiliationNameIdentifier: "1", + affiliationNameIdentifierScheme: "", + identifierShowFlg: "true" + } + return subIdentifierInfoObj; + } + + /** + * affiliationName情報を返す + */ + returnSubAffiliationNameInfoObj(): any { + //所属機関名情報 + let subAffiliationNameInfoObj = { + affiliationName: "", + affiliationNameLang: "ja", + affiliationNameShowFlg: "true" + } + return subAffiliationNameInfoObj; + } + /** + * affiliation情報を返す + */ + returnSubAffiliationInfoObj(): any { + //所属情報 + let subAffiliationInfoObj = { + "identifierInfo": [], + "affiliationNameInfo": [] + } + let subIdentifierInfoObj = this.returnSubIdentifierInfoObj(); + subAffiliationInfoObj.identifierInfo.push(subIdentifierInfoObj); + + let subAffiliationNameInfoObj = this.returnSubAffiliationNameInfoObj(); + subAffiliationInfoObj.affiliationNameInfo.push(subAffiliationNameInfoObj); + return subAffiliationInfoObj; + } /** *placeholder案内内容を返す */ @@ -445,6 +624,11 @@ export class AddAuthorComponent implements OnInit { jsonStrCopy.emailInfo.splice(i, 1); } } + for (let affiliationIndex = 0; affiliationIndex < jsonStrCopy.affiliationInfo.length; affiliationIndex++) { + if (jsonStrCopy.affiliationInfo[affiliationIndex].affiliation == "") { + jsonStrCopy.affiliationInfo.splice(affiliationIndex, 1); + } + } return jsonStrCopy; } /** @@ -534,4 +718,23 @@ deleteById(esIdJsonObj: any): Promise { '×' + this.langJson.Author_Confirm_Msg[1] + '
'); } } + /** + * affiliation confirm identifier url + */ + affiliationConfirm(affiliationNameIdentifier: any, affiliationNameIdentifierScheme: any) { + let url_identifier = ""; + for (let i = 0; i < this.identifierOptions.length; i++) { + if (affiliationNameIdentifier == this.identifierOptions[i].id) { + url_identifier = this.identifierOptions[i].url; + } + } + if (url_identifier != "") { + window.open(url_identifier.replace(/#+$/, affiliationNameIdentifierScheme), "_blank"); + } else { + $('#alerts').append( + '
' + + '' + this.langJson.Author_Confirm_Msg[1] + '
'); + } + } } diff --git a/app-items-author-search/src/app/app.component.ts b/app-items-author-search/src/app/app.component.ts index 00c706f..1abccbd 100644 --- a/app-items-author-search/src/app/app.component.ts +++ b/app-items-author-search/src/app/app.component.ts @@ -42,6 +42,24 @@ export class AppComponent implements OnInit { ], emailInfo: [ { email: "" } + ], + affiliationInfo: [ + { + identifierInfo: [ + { + affiliationNameIdentifier: "1", + affiliationNameIdentifierScheme: "", + identifierShowFlg: "true" + } + ], + affiliationNameInfo: [ + { + affiliationName: "", + affiliationNameLang: "ja", + affiliationNameShowFlg: "true" + } + ] + } ] } //検索すると、サービスから戻ったデータ From d604cedacc46752467cab6d4d4b1955d2fc57433 Mon Sep 17 00:00:00 2001 From: Yuriko Oshima Date: Mon, 31 Jan 2022 08:21:16 +0900 Subject: [PATCH 05/11] fix i18n --- .../src/app/add-author/add-author.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-items-author-search/src/app/add-author/add-author.component.ts b/app-items-author-search/src/app/add-author/add-author.component.ts index 6de597c..63b50ee 100644 --- a/app-items-author-search/src/app/add-author/add-author.component.ts +++ b/app-items-author-search/src/app/add-author/add-author.component.ts @@ -245,7 +245,7 @@ export class AddAuthorComponent implements OnInit { let lang = $("#lang-code",parent.document).val(); let js = document.scripts; let jsUrl = js[js.length - 1].src; - let strUrl = jsUrl.substring(0, jsUrl.lastIndexOf('_debug_toolbar')); + let strUrl = jsUrl.substring(0, jsUrl.lastIndexOf('static')); let jsonUrl = strUrl + "static/json/weko_authors/translations/" + lang + "/messages.json"; this.getLnagJson(jsonUrl).then(res => { this.langJson = res; From 3e377b673f0789931ece0ec7af4ce6207cf96b55 Mon Sep 17 00:00:00 2001 From: Yuriko Oshima Date: Mon, 31 Jan 2022 14:54:40 +0900 Subject: [PATCH 06/11] update seti18n --- .../src/app/add-author/add-author.component.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app-items-author-search/src/app/add-author/add-author.component.ts b/app-items-author-search/src/app/add-author/add-author.component.ts index 63b50ee..901cb22 100644 --- a/app-items-author-search/src/app/add-author/add-author.component.ts +++ b/app-items-author-search/src/app/add-author/add-author.component.ts @@ -246,6 +246,10 @@ export class AddAuthorComponent implements OnInit { let js = document.scripts; let jsUrl = js[js.length - 1].src; let strUrl = jsUrl.substring(0, jsUrl.lastIndexOf('static')); + if(strUrl.lastIndexOf('_debug_toolbar') > -1){ + // For debug mode + strUrl = strUrl.substring(0, strUrl.lastIndexOf('_debug_toolbar')); + } let jsonUrl = strUrl + "static/json/weko_authors/translations/" + lang + "/messages.json"; this.getLnagJson(jsonUrl).then(res => { this.langJson = res; From 4d001283baf324668932593b2ceccf9fca3b2a06 Mon Sep 17 00:00:00 2001 From: Yuriko Oshima Date: Tue, 1 Feb 2022 13:18:07 +0900 Subject: [PATCH 07/11] update build.sh --- build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sh b/build.sh index 1a34e2a..1f47f30 100755 --- a/build.sh +++ b/build.sh @@ -32,6 +32,7 @@ done < Date: Tue, 8 Feb 2022 11:52:26 +0900 Subject: [PATCH 08/11] rename variable --- app-author-add/src/app/app.component.html | 6 +++--- app-author-add/src/app/app.component.ts | 14 +++++++------- .../src/app/add-author/add-author.component.html | 6 +++--- .../src/app/add-author/add-author.component.ts | 14 +++++++------- app-items-author-search/src/app/app.component.ts | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app-author-add/src/app/app.component.html b/app-author-add/src/app/app.component.html index de51fd7..4b14a01 100644 --- a/app-author-add/src/app/app.component.html +++ b/app-author-add/src/app/app.component.html @@ -251,19 +251,19 @@
-
- +
- From 192458d96f1cb0e832ec67ae759dfb2e1f04b750 Mon Sep 17 00:00:00 2001 From: Yuriko Oshima Date: Fri, 11 Mar 2022 08:00:34 +0900 Subject: [PATCH 11/11] fix page design --- .../src/app/add-author/add-author.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-items-author-search/src/app/add-author/add-author.component.html b/app-items-author-search/src/app/add-author/add-author.component.html index 4244721..aec9805 100644 --- a/app-items-author-search/src/app/add-author/add-author.component.html +++ b/app-items-author-search/src/app/add-author/add-author.component.html @@ -244,7 +244,7 @@
-
+