| 第3行: |
第3行: |
| | local p = {} | | local p = {} |
| | | | |
| − | function _other_maintainers(frame, other_maintainers) | + | function renderMaintainers(frame, maintainers, other_creators) |
| | local node = mw.html.create(nil) | | local node = mw.html.create(nil) |
| − | node:wikitext("合作维护者: ") | + | node:wikitext("创作者: ") |
| − | for i, m in ipairs(other_maintainers) do | + | for i, m in ipairs(maintainers) do |
| | node:wikitext("[[User:"..m.."|"..m.."]]") | | node:wikitext("[[User:"..m.."|"..m.."]]") |
| | node:wikitext("[[Category:由"..m.."维护的条目]]") | | node:wikitext("[[Category:由"..m.."维护的条目]]") |
| | + | node:wikitext("[[Category:由"..m.."创作的条目]]") |
| | _set_editable_by_user(m) | | _set_editable_by_user(m) |
| − | mw.smw.set({
| + | end |
| − | ['维护者'] = ("User:"..m)
| + | for i, m in ipairs(other_creators) do |
| − | }) | + | node:wikitext("[[创作者:"..m.."|"..m.."]]") |
| | + | node:wikitext("[[Category:由"..m.."创作的条目]]") |
| | end | | end |
| | local res = node:done() | | local res = node:done() |
| − | | + | local args = {image = 'Copyright.svg', content = res} |
| | + | return frame:expandTemplate{title = "LiteInfoBox", args = args} |
| | end | | end |
| | | | |
| − | function _maintainer_only(frame, maintainer) | + | function renderLockedPage(frame) |
| | mw.smw.set({ | | mw.smw.set({ |
| | ['Editable by'] = 'whitelist' | | ['Editable by'] = 'whitelist' |
| 第28行: |
第31行: |
| | local title = PageName.getPageName() | | local title = PageName.getPageName() |
| | local prop_names = {"维护者", "创作者", "设定类型", "设定集核心页", "依赖设定集", "仅允许维护者编辑", "创作阶段", "上级概念", "前置条件", "事后效果"} | | local prop_names = {"维护者", "创作者", "设定类型", "设定集核心页", "依赖设定集", "仅允许维护者编辑", "创作阶段", "上级概念", "前置条件", "事后效果"} |
| − | local props = SMWUtils.query_page_properties("[["..title.."]]", prop_names)[1] | + | local props = SMWUtils.query_page_properties("[["..title.."]]", prop_names) |
| − | return mw.text.jsonEncode(props) | + | local root = mw.html.create(nil) |
| | + | root:wikitext(renderMaintainers(frame, props["维护者"], props["创作者"])) |
| | + | if props["维护者"]["仅允许维护者编辑"][1] == "t" then |
| | + | renderLockedPage(frame) |
| | + | end |
| | + | return root:done() |
| | end | | end |
| | | | |
| | return p | | return p |