| 第19行: |
第19行: |
| | local list = mw.text.listToText(other_maintainers, ",", ",") | | local list = mw.text.listToText(other_maintainers, ",", ",") |
| | return frame:expandTemplate{title = "合作维护者", args = {['合作维护者列表'] = list}} | | return frame:expandTemplate{title = "合作维护者", args = {['合作维护者列表'] = list}} |
| | + | end |
| | + | |
| | + | function _maintainer_only(frame, maintainer) |
| | + | mw.smw.set({ |
| | + | ['Editable by'] = 'whitelist', |
| | + | ['Editable by user'] = ('User:'..maintainer) |
| | + | }) |
| | + | return frame:expandTemplate{title = "本页面仅允许维护者编辑", args = {}} |
| | end | | end |
| | | | |
| | function p.render(frame) | | function p.render(frame) |
| | local creator = StringUtils.assert_not_empty(frame.args["创作者"]) | | local creator = StringUtils.assert_not_empty(frame.args["创作者"]) |
| | + | local maintainer_only = StringUtils.assert_not_empty(frame.args["仅允许维护者编辑"]) |
| | local maintainer = StringUtils.assert_not_empty(frame.args["维护者"]) | | local maintainer = StringUtils.assert_not_empty(frame.args["维护者"]) |
| | local other_maintainers = StringUtils.split_or_empty(frame.args["合作维护者列表"], ",") | | local other_maintainers = StringUtils.split_or_empty(frame.args["合作维护者列表"], ",") |
| 第36行: |
第45行: |
| | result = _proxy_post(frame, creator, maintainer) | | result = _proxy_post(frame, creator, maintainer) |
| | end | | end |
| − | mw.smw.set({ | + | if maintainer_only == "是" then |
| − | ['Editable by'] = 'whitelist',
| + | result = result .. _maintainer_only(frame, maintainer) |
| − | ['Editable by user'] = ('User:'..maintainer) | + | end |
| − | }) | |
| | else | | else |
| | result = _missing_maintainer(frame) | | result = _missing_maintainer(frame) |