first commit.

This commit is contained in:
2022-06-08 13:15:52 +09:00
commit 3ed26dd828
238 changed files with 16732 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
import { ItemStimulusSubTypes } from "../../lib/ItemUtil";
import AdvancedSearchBase, { AdvancedSearchBaseProps } from "../lib/AdvancedSearchBase";
class StimulusAdvancedSearch extends AdvancedSearchBase {
constructor(props: AdvancedSearchBaseProps) {
super(props);
this.type = "stimulus";
this.title = "Stimulus";
const now = new Date();
const year = String(now.getFullYear());
const month = String(now.getMonth() + 1);
const mday = String(now.getDate());
this.state.values["title"] = "";
this.state.values["keyword"] = "";
this.state.values["description"] = "";
this.state.values["doi"] = "";
this.state.values["stimulus_type"] = "";
this.state.values["developer"] = "";
this.state.values["publication_year"] = year;
this.state.values["publication_month"] = month;
this.state.values["publication_mday"] = mday;
this.state.values["file.preview.caption"] = "";
this.setIgnoreKey("publication_year");
this.setIgnoreKey("publication_month");
this.setIgnoreKey("publication_mday");
}
getRows() {
const rows = [
{ label: "[en]Title[/en][ja]タイトル[/ja]", value: this.renderFieldInputText("title", 50) },
{ label: "[en]Free Keywords[/en][ja]フリーキーワード[/ja]", value: this.renderFieldInputText("keyword", 50) },
{ label: "[en]Description[/en][ja]概要[/ja]", value: this.renderFieldInputText("description", 50) },
{ label: "ID", value: this.renderFieldInputText("doi", 50) },
{ label: "[en]Stimulus Type[/en][ja]刺激タイプ[/ja]", value: this.renderFieldSelect("stimulus_type", ItemStimulusSubTypes) },
{ label: "[en]Developer[/en][ja]開発者[/ja]", value: this.renderFieldInputText("developer", 50) },
{ label: "[en]Date[/en][ja]日付[/ja]", value: this.renderFieldDate("", "publication_year", "publication_month", "publication_mday") },
{ label: "[en]Caption[/en][ja]キャプション[/ja]", value: this.renderFieldInputText("file.preview.caption", 50) },
];
return rows;
}
}
export default StimulusAdvancedSearch;

View File

@@ -0,0 +1,43 @@
import React from "react";
import Functions from "../../../functions";
import ItemUtil, { ItemStimulus } from "../../lib/ItemUtil";
import DetailBase from "../lib/DetailBase";
import ItemTypeField from "../lib/field";
import SimPFLinkIcon from "../lib/field/SimPFLinkIcon";
import StimulusUtil from "./StimulusUtil";
class StimulusDetail extends DetailBase {
getFields() {
const { lang, type } = this.props;
const item = this.props.item as ItemStimulus;
const fields = [
{ label: "ID", value: item.doi },
{ label: "[en]Language[/en][ja]言語[/ja]", value: <ItemTypeField.Language lang={lang} itemLang={item.lang} /> },
{ label: "[en]Title[/en][ja]タイトル[/ja]", value: Functions.mlang(item.title, lang) },
{ label: "[en]Free Keywords[/en][ja]フリーキーワード[/ja]", value: <ItemTypeField.FreeKeyword lang={lang} keyword={item.keyword} /> },
{ label: "[en]Description[/en][ja]概要[/ja]", value: <ItemTypeField.Description lang={lang} description={item.description} /> },
{ label: "[en]Date[/en][ja]日付[/ja]", value: <ItemTypeField.PublicationDate lang={lang} year={item.publication_year} month={item.publication_month} mday={item.publication_mday} /> },
{ label: "[en]Last Modified Date[/en][ja]最終更新日[/ja]", value: <ItemTypeField.DateTime lang={lang} date={item.last_update_date} /> },
{ label: "[en]Created Date[/en][ja]作成日[/ja]", value: <ItemTypeField.DateTime lang={lang} date={item.creation_date} /> },
{ label: "[en]Contributor[/en][ja]登録者[/ja]", value: <ItemTypeField.Contributer lang={lang} uname={item.uname} name={item.name} /> },
{ label: "[en]Item Type[/en][ja]アイテムタイプ[/ja]", value: item.item_type_display_name },
{ label: "[en]Change Log(History)[/en][ja]変更履歴[/ja]", value: <ItemTypeField.ChangeLog lang={lang} changelog={item.changelog} /> },
{ label: "[en]Stimulus Type[/en][ja]刺激タイプ[/ja]", value: <StimulusUtil.StimulusType lang={lang} type={item.stimulus_type} /> },
{ label: "[en]Developer[/en][ja]開発者[/ja]", value: <ItemTypeField.Author lang={lang} author={item.developer} /> },
{ label: "[en]Preview[/en][ja]プレビュー[/ja]", value: <ItemTypeField.Preview lang={lang} file={item.file} type={type} /> },
{ label: "[en]Stimulus File[/en][ja]ファイル[/ja]", value: <ItemTypeField.ItemFile lang={lang} file={item.file} ftype="stimulus_data" rights={item.rights} useCc={item.use_cc} ccCommercialUse={item.cc_commercial_use} ccModification={item.cc_modification} downloadLimit={item.attachment_dl_limit} type={type} /> },
{ label: "Readme", value: <ItemTypeField.Readme lang={lang} readme={item.readme} /> },
{ label: "Rights", value: <ItemTypeField.Rights lang={lang} rights={item.rights} useCc={item.use_cc} ccCommercialUse={item.cc_commercial_use} ccModification={item.cc_modification} /> },
{ label: "Index", value: <ItemTypeField.ItemIndex lang={lang} index={item.index} type={type} /> },
{ label: "[en]Related to[/en][ja]関連アイテム[/ja]", value: <ItemTypeField.RelatedTo lang={lang} relatedTo={item.related_to} type={type} /> },
];
const simpfLinkUrl = ItemUtil.getSimPFLinkUrl(item.item_id);
if (simpfLinkUrl !== "") {
const field = { label: "Online Simulation", value: <SimPFLinkIcon lang={lang} url={simpfLinkUrl} isDetail={true} /> };
fields.splice(14, 0, field);
}
return fields;
}
}
export default StimulusDetail;

View File

@@ -0,0 +1,36 @@
import React, { Fragment } from "react";
import { Link } from "react-router-dom";
import Functions from "../../../functions";
import iconFile from "../../assets/images/icon_stimulus.gif";
import { ItemStimulus } from "../../lib/ItemUtil";
import ListBase, { ListBaseProps } from "../lib/ListBase";
class StimulusList extends ListBase {
constructor(props: ListBaseProps) {
super(props);
this.label = "Stimulus";
this.icon = iconFile;
}
renderBody() {
const { lang } = this.props;
const item = this.props.item as ItemStimulus;
const authors = item.developer.map((author, i) => {
return (
<Fragment key={i}>
{i > 0 && ", "}
{Functions.mlang(author, lang)}
</Fragment>
);
});
return (
<>
<Link to={this.url}>{Functions.mlang(item.title, lang)}</Link>
<br />
{authors}
</>
);
}
}
export default StimulusList;

View File

@@ -0,0 +1,16 @@
import iconFile from "../../assets/images/icon_stimulus.gif";
import { ItemStimulusSubTypes } from "../../lib/ItemUtil";
import TopBase, { TopBaseProps } from "../lib/TopBase";
class StimulusTop extends TopBase {
constructor(props: TopBaseProps) {
super(props);
this.type = "stimulus";
this.label = "Stimulus";
this.icon = iconFile;
this.description = "[en]Picture, movie and program files for experimental stimuli.[/en][ja]実験用刺激プログラム/スクリプト[/ja]";
this.subTypes = ItemStimulusSubTypes;
}
}
export default StimulusTop;

View File

@@ -0,0 +1,25 @@
import React from "react";
import { MultiLang } from "../../../config";
import { ItemStimulusSubType, ItemStimulusSubTypes } from "../../lib/ItemUtil";
interface StimulusTypeProps {
lang: MultiLang;
type: ItemStimulusSubType;
}
const StimulusType = (props: StimulusTypeProps) => {
const { type } = props;
const subtype = ItemStimulusSubTypes.find((value) => {
return value.type === type;
});
if (typeof subtype === "undefined") {
return null;
}
return <span>{subtype.label}</span>;
};
const StimulusUtil = {
StimulusType,
};
export default StimulusUtil;

View File

@@ -0,0 +1,13 @@
import StimulusAdvancedSearch from "./StimulusAdvancedSearch";
import StimulusDetail from "./StimulusDetail";
import StimulusList from "./StimulusList";
import StimulusTop from "./StimulusTop";
const ItemTypeStimulus = {
Top: StimulusTop,
List: StimulusList,
Detail: StimulusDetail,
AdvancedSearch: StimulusAdvancedSearch,
};
export default ItemTypeStimulus;