Created
December 2, 2022 15:18
-
-
Save papinianus/2181898d306d4653ad240179dfb4a248 to your computer and use it in GitHub Desktop.
Pleasanter:リンク項目のCSVインポート
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"HeaderInfo": { | |
"AssemblyVersion": "1.3.25.2", | |
"BaseSiteId": 7011464, | |
"Server": "https://demo.pleasanter.org", | |
"CreatorName": "テナント管理者", | |
"PackageTime": "2022-12-02T15:17:55.744909+00:00", | |
"Convertors": [ | |
{ | |
"SiteId": 7011464, | |
"SiteTitle": "s", | |
"ReferenceType": "Sites", | |
"IncludeData": false, | |
"Order": "[7031179,7031180,7030419]" | |
}, | |
{ | |
"SiteId": 7030419, | |
"SiteTitle": "入力テーブル", | |
"ReferenceType": "Results", | |
"IncludeData": false | |
}, | |
{ | |
"SiteId": 7031179, | |
"SiteTitle": "都道府県", | |
"ReferenceType": "Results", | |
"IncludeData": false | |
}, | |
{ | |
"SiteId": 7031180, | |
"SiteTitle": "市区町村", | |
"ReferenceType": "Results", | |
"IncludeData": false | |
} | |
], | |
"IncludeSitePermission": false, | |
"IncludeRecordPermission": false, | |
"IncludeColumnPermission": false, | |
"IncludeNotifications": false, | |
"IncludeReminders": false | |
}, | |
"Sites": [ | |
{ | |
"TenantId": 13658, | |
"SiteId": 7011464, | |
"Title": "s", | |
"SiteName": "", | |
"SiteGroupName": "", | |
"Body": "", | |
"GridGuide": "", | |
"EditorGuide": "", | |
"ReferenceType": "Sites", | |
"ParentId": 0, | |
"InheritPermission": 7011464, | |
"SiteSettings": { | |
"Version": 1.017, | |
"ReferenceType": "Sites", | |
"NoDisplayIfReadOnly": false | |
}, | |
"Publish": false, | |
"DisableCrossSearch": false, | |
"Comments": [] | |
}, | |
{ | |
"TenantId": 13658, | |
"SiteId": 7030419, | |
"Title": "入力テーブル", | |
"SiteName": "", | |
"SiteGroupName": "", | |
"Body": "", | |
"GridGuide": "", | |
"EditorGuide": "", | |
"ReferenceType": "Results", | |
"ParentId": 7011464, | |
"InheritPermission": 7011464, | |
"SiteSettings": { | |
"Version": 1.017, | |
"ReferenceType": "Results", | |
"GridColumns": [ | |
"ResultId", | |
"Title", | |
"ClassA", | |
"ClassB" | |
], | |
"EditorColumnHash": { | |
"General": [ | |
"Title", | |
"ClassA", | |
"ClassB" | |
] | |
}, | |
"Columns": [ | |
{ | |
"ColumnName": "ClassB", | |
"LabelText": "市区町村", | |
"ChoicesText": "[[7031180]]", | |
"Link": true, | |
"SearchType": "PartialMatch" | |
}, | |
{ | |
"ColumnName": "AttachmentsA", | |
"LimitQuantity": 1.0 | |
}, | |
{ | |
"ColumnName": "ClassA", | |
"LabelText": "都道府県", | |
"ChoicesText": "[[7031179]]", | |
"Link": true, | |
"SearchType": "PartialMatch" | |
} | |
], | |
"Links": [ | |
{ | |
"ColumnName": "ClassB", | |
"SiteId": 7031180 | |
}, | |
{ | |
"ColumnName": "ClassA", | |
"SiteId": 7031179 | |
} | |
], | |
"Exports": [ | |
{ | |
"Name": "あ", | |
"Columns": [ | |
{ | |
"Id": 1, | |
"ColumnName": "ResultId" | |
}, | |
{ | |
"Id": 2, | |
"ColumnName": "Title" | |
}, | |
{ | |
"Id": 3, | |
"ColumnName": "ClassA" | |
}, | |
{ | |
"Id": 4, | |
"ColumnName": "ClassB" | |
}, | |
{ | |
"Id": 5, | |
"ColumnName": "Body" | |
} | |
], | |
"Type": 0, | |
"DelimiterType": 0, | |
"ExecutionType": 0, | |
"Id": 1 | |
} | |
], | |
"Scripts": [ | |
{ | |
"Title": "input", | |
"New": true, | |
"Edit": true, | |
"Body": "const allowType = { mime: ['image', 'text'], ext: ['pdf', 'xlsx'] };\nconst toAcccept = (e) => {\n const mimes = e.mime.map((e) => `${e}/*`);\n const exts = e.ext.map((e) => `.${e}`);\n return mimes.concat(exts).join(',');\n};\nconst isAllowed = (f, a) => {\n if (a.ext.some((e) => f.name.endsWith(`.${e}`))) return true;\n if (a.mime.some((e) => f.type.startsWith(`${e}/`))) return true;\n return false;\n};\n$p.events.on_editor_load = () => {\n $('input[type=\"file\"]').prop('accept', toAcccept(allowType));\n $(document).off('drop', '.control-attachments-upload');\n $(document).on('drop', '.control-attachments-upload', function(e) {\n var $control = $(this);\n console.log($control);\n $control.css('border', '2px dotted #d19405');\n e.preventDefault();\n let lst = new DataTransfer();\n [...e.originalEvent.dataTransfer.files]\n .filter((e) => isAllowed(e, allowType))\n .forEach((e) => {\n console.log(e.name);\n console.log(e.type);\n lst.items.add(e);\n });\n if (lst.files.length === 0) return;\n $p.uploadAttachments($control, lst.files);\n $p.setFormChanged($(this));\n\n // e.originalEvent.dataTransfer.files.filter((e) => isAllowed(e, allowType));\n console.log(lst);\n console.log(e.originalEvent.dataTransfer.files);\n });\n};", | |
"Id": 1 | |
} | |
], | |
"ServerScripts": [ | |
{ | |
"Title": "validate link", | |
"Name": "validate link", | |
"BeforeCreate": true, | |
"BeforeUpdate": true, | |
"Body": "try {\n const childInput = model.ClassB;\n const childId = Number(childInput);\n if (`${childId}` === childInput) {\n const child = items.Get(childId)[0];\n const parentOfChild = child.ClassA;\n const parent = model.ClassA;\n const childTitle = child.Title;\n if (parent !== parentOfChild) {\n const childSite = 7031180;\n const view = {\n View: {\n ColumnFilterHash: {\n Title: childTitle,\n ClassA: JSON.stringify([parent]),\n },\n },\n };\n const candidates = items.Get(childSite, JSON.stringify(view));\n if (candidates.Length > 0) {\n const validatedChild = candidates[0];\n model.ClassB = `${validatedChild.ResultId}`;\n } else {\n model.ClassB = childTitle;\n }\n }\n context.Log(parent === parentOfChild);\n }\n} catch (e) {\n context.Log(e.stack);\n}", | |
"Id": 1 | |
} | |
], | |
"RelatingColumns": [ | |
{ | |
"Title": "しちょうそん", | |
"Columns": [ | |
"ClassA", | |
"ClassB" | |
], | |
"Id": 1 | |
} | |
], | |
"NoDisplayIfReadOnly": false | |
}, | |
"Publish": false, | |
"DisableCrossSearch": false, | |
"Comments": [] | |
}, | |
{ | |
"TenantId": 13658, | |
"SiteId": 7031179, | |
"Title": "都道府県", | |
"SiteName": "", | |
"SiteGroupName": "", | |
"Body": "", | |
"GridGuide": "", | |
"EditorGuide": "", | |
"ReferenceType": "Results", | |
"ParentId": 7011464, | |
"InheritPermission": 7011464, | |
"SiteSettings": { | |
"Version": 1.017, | |
"ReferenceType": "Results", | |
"GridColumns": [ | |
"ResultId", | |
"Title" | |
], | |
"EditorColumnHash": { | |
"General": [ | |
"Title" | |
] | |
}, | |
"NoDisplayIfReadOnly": false | |
}, | |
"Publish": false, | |
"DisableCrossSearch": false, | |
"Comments": [] | |
}, | |
{ | |
"TenantId": 13658, | |
"SiteId": 7031180, | |
"Title": "市区町村", | |
"SiteName": "", | |
"SiteGroupName": "", | |
"Body": "", | |
"GridGuide": "", | |
"EditorGuide": "", | |
"ReferenceType": "Results", | |
"ParentId": 7011464, | |
"InheritPermission": 7011464, | |
"SiteSettings": { | |
"Version": 1.017, | |
"ReferenceType": "Results", | |
"GridColumns": [ | |
"Title", | |
"ClassA" | |
], | |
"EditorColumnHash": { | |
"General": [ | |
"Title", | |
"ClassA" | |
] | |
}, | |
"Columns": [ | |
{ | |
"ColumnName": "ClassA", | |
"LabelText": "都道府県", | |
"ChoicesText": "[[7031179]]", | |
"Link": true, | |
"SearchType": "PartialMatch" | |
} | |
], | |
"Links": [ | |
{ | |
"ColumnName": "ClassA", | |
"SiteId": 7031179 | |
} | |
], | |
"NoDisplayIfReadOnly": false | |
}, | |
"Publish": false, | |
"DisableCrossSearch": false, | |
"Comments": [] | |
} | |
], | |
"Data": [], | |
"Permissions": [], | |
"PermissionIdList": { | |
"DeptIdList": [], | |
"GroupIdList": [], | |
"UserIdList": [] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment