From faae7e62335f784a5e008404658702448351da3b Mon Sep 17 00:00:00 2001 From: "shunya.kikuchi" Date: Fri, 19 Dec 2025 19:51:34 +0900 Subject: [PATCH 01/28] =?UTF-8?q?=E3=83=AF=E3=83=BC=E3=82=AF=E3=82=B9?= =?UTF-8?q?=E3=83=9A=E3=83=BC=E3=82=B9=E6=94=B9=E4=BF=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weko_items_autofill/utils.py | 1 + modules/weko-workflow/weko_workflow/views.py | 10 +- modules/weko-workspace/weko_workspace/api.py | 75 +++++ .../weko-workspace/weko_workspace/config.py | 13 + .../weko_workspace/WorkspaceBodyContents.css | 45 ++- .../static/css/weko_workspace/style.css | 2 +- .../js/weko_workspace/WorkspaceExport.js | 12 +- .../js/weko_workspace/WorkspaceItemList.js | 246 +++++++++++---- .../js/weko_workspace/workspace_register.js | 86 ++++- .../weko_workspace/item_register.html | 17 +- .../workspace_body_contents.html | 24 +- .../translations/en/LC_MESSAGES/messages.mo | Bin 6195 -> 471 bytes .../translations/ja/LC_MESSAGES/messages.mo | Bin 6423 -> 4055 bytes .../translations/ja/LC_MESSAGES/messages.po | 196 +++++++----- .../weko_workspace/translations/messages.pot | 179 ++++++----- .../weko-workspace/weko_workspace/utils.py | 293 ++++++++++++++++-- .../weko-workspace/weko_workspace/views.py | 51 ++- 17 files changed, 978 insertions(+), 272 deletions(-) diff --git a/modules/weko-items-autofill/weko_items_autofill/utils.py b/modules/weko-items-autofill/weko_items_autofill/utils.py index 77fc0c20a8..3484b6d42c 100644 --- a/modules/weko-items-autofill/weko_items_autofill/utils.py +++ b/modules/weko-items-autofill/weko_items_autofill/utils.py @@ -840,6 +840,7 @@ def get_crossref_relation_data(isbn, doi): new_data = dict() new_data['@value'] = doi new_data['@type'] = "DOI" + new_data['@relation_type'] = 'isVersionOf' result.append(new_data) if isbn and len(result) == 0: for element in isbn: diff --git a/modules/weko-workflow/weko_workflow/views.py b/modules/weko-workflow/weko_workflow/views.py index e8d68dcb95..7863ae3210 100644 --- a/modules/weko-workflow/weko_workflow/views.py +++ b/modules/weko-workflow/weko_workflow/views.py @@ -4016,11 +4016,11 @@ def edit_item_direct_after_login(pid_value): item_uuid = latest_pid.object_uuid post_workflow = activity.get_workflow_activity_by_item_id(item_uuid) - if post_workflow: - is_begin_edit = check_item_is_being_edit(recid, post_workflow, activity) - if is_begin_edit: - return render_template("weko_theme/error.html", - error="This Item is being edited."), 400 + + is_begin_edit = check_item_is_being_edit(recid, post_workflow, activity) + if is_begin_edit: + return render_template("weko_theme/error.html", + error="This Item is being edited."), 400 post_activity = '{"workflow_id": 0, "flow_id": 0, ' \ '"itemtype_id": 0, "community": 0, "post_workflow": 0}' diff --git a/modules/weko-workspace/weko_workspace/api.py b/modules/weko-workspace/weko_workspace/api.py index 6e0ff87c5c..a0683311a5 100644 --- a/modules/weko-workspace/weko_workspace/api.py +++ b/modules/weko-workspace/weko_workspace/api.py @@ -23,6 +23,7 @@ import traceback import requests import urllib.parse +import xmltodict from flask import current_app from . import config @@ -423,3 +424,77 @@ def get_data(self): current_app.logger.error(traceback.format_exc()) response['error'] = str(e) return response + +class arXivURL: + """The Class retrieves the metadata from arXiv.""" + + _timeout = config.WEKO_WORKSPACE_REQUEST_TIMEOUT + _proxy = { + 'http': config.WEKO_WORKSPACE_SYS_HTTP_PROXY, + 'https': config.WEKO_WORKSPACE_SYS_HTTPS_PROXY + } + def __init__(self, doi, timeout=None, http_proxy=None, https_proxy=None): + """Init DataciteURL API. + + :param doi: + :param timeout: + :param http_proxy: + :param https_proxy: + """ + if not doi: + raise ValueError('DOI is required.') + self._doi = "/".join(doi.strip().strip("/").split("/")[-2:]) + if timeout: + self._timeout = timeout + if http_proxy: + self._proxy['http'] = http_proxy + if https_proxy: + self._proxy['https'] = https_proxy + + def _create_endpoint(self): + """Create endpoint. + + :return: endpoint string. + """ + endpoint_url = self._doi + return endpoint_url + + + def _create_url(self): + """Create request URL. + + :return: + """ + endpoint = self._create_endpoint() + + url = config.WEKO_WORKSPACE_ARXIV_API_URL + endpoint + return url + + @property + def url(self): + """URL property. + + :return: Request URL + """ + return self._create_url() + + def _do_http_request(self): + return requests.get(self.url, timeout=self._timeout, + proxies=self._proxy) + + def get_data(self): + """This method retrieves the metadata from arXiv.""" + response = { + 'response': '', + 'error': '' + } + try: + result = self._do_http_request() + if result.status_code == 200: + response['response'] = xmltodict.parse(result.text) + current_app.logger.debug(f"arXiv result: {response['response']}") + except Exception as e: + current_app.logger.error(e) + current_app.logger.error(traceback.format_exc()) + response['error'] = str(e) + return response diff --git a/modules/weko-workspace/weko_workspace/config.py b/modules/weko-workspace/weko_workspace/config.py index 20604df2c3..3ebdcb2be7 100644 --- a/modules/weko-workspace/weko_workspace/config.py +++ b/modules/weko-workspace/weko_workspace/config.py @@ -315,6 +315,9 @@ WEKO_WORKSPACE_DATACITE_API_URL = 'https://api.datacite.org/dois/' """DataCite API URL""" +WEKO_WORKSPACE_ARXIV_API_URL = 'http://export.arxiv.org/api/query?search_query=doi:' +"""arXiv API URL""" + WEKO_WORKSPACE_CINII_REQUIRED_ITEM = [ 'title', 'creator', @@ -361,5 +364,15 @@ ] """DataCite required item""" +WEKO_WORKSPACE_ARXIV_REQUIRED_ITEM = [ + 'title', + 'identifier', + 'date', + 'description', + 'creator', + 'relation', + 'subject', +] + WEKO_WORKSPACE_DATA_DEFAULT_LANGUAGE = 'en' """Default language for data""" diff --git a/modules/weko-workspace/weko_workspace/static/css/weko_workspace/WorkspaceBodyContents.css b/modules/weko-workspace/weko_workspace/static/css/weko_workspace/WorkspaceBodyContents.css index d99b2fba4b..afd4f12a57 100644 --- a/modules/weko-workspace/weko_workspace/static/css/weko_workspace/WorkspaceBodyContents.css +++ b/modules/weko-workspace/weko_workspace/static/css/weko_workspace/WorkspaceBodyContents.css @@ -7,7 +7,12 @@ font-family: Arial, sans-serif; font-size: 14px; } -.workspace-body-contents th, +.workspace-body-contents th{ + padding: 20px 12px 12px 12px; + border: 1px solid #ccc; + text-align: left; + vertical-align: top; +} .workspace-body-contents td { padding: 12px; border: 1px solid #ccc; @@ -27,15 +32,24 @@ .workspace-body-contents .checkbox-group { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); - gap: 10px; + column-gap: 10px; + row-gap: 3px; width: 100%; - padding: 10px; + padding: 0px 5px 0px 5px; +} + +.workspace-body-contents .checkbox-group-single { + grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); +} + +.workspace-body-contents .checkbox-group-exclude { + grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } .workspace-body-contents .checkbox-group label { display: flex; align-items: center; - margin: 5px 0; - white-space: nowrap; + margin: 10px 0; + white-space: normal; font-size: 14px; color: #333; } @@ -83,4 +97,23 @@ } .workspace-body-contents #itemListContainer td:nth-last-child(3) { width: 100px; -} \ No newline at end of file +} + + +.unread_show { + display: inline-block; + background-color: orange; + color: black; + font-size: 80%; + border-radius: 12px; + margin-left: 8px; + text-align: center; + vertical-align: middle; + padding: 1px 7.5px; + visibility: visible; +} + +.unread_hide { + visibility: hidden; +} + diff --git a/modules/weko-workspace/weko_workspace/static/css/weko_workspace/style.css b/modules/weko-workspace/weko_workspace/static/css/weko_workspace/style.css index cc582c56b4..e822a6b307 100644 --- a/modules/weko-workspace/weko_workspace/static/css/weko_workspace/style.css +++ b/modules/weko-workspace/weko_workspace/static/css/weko_workspace/style.css @@ -27,7 +27,7 @@ div.select_site_box { display: inline-block; - width: 20%; + width: 16%; text-align: center; border: 2px solid #ccc; padding: 10px; diff --git a/modules/weko-workspace/weko_workspace/static/js/weko_workspace/WorkspaceExport.js b/modules/weko-workspace/weko_workspace/static/js/weko_workspace/WorkspaceExport.js index 969c949555..5ee023f243 100644 --- a/modules/weko-workspace/weko_workspace/static/js/weko_workspace/WorkspaceExport.js +++ b/modules/weko-workspace/weko_workspace/static/js/weko_workspace/WorkspaceExport.js @@ -80,7 +80,7 @@ function showExportModal() { text-align: center; ">
-

以下のオプションを選択してください:

+

${document.getElementById('please_select').innerText}

- - - + + +
@@ -369,7 +380,7 @@ @@ -407,7 +418,7 @@