এই মডিউলের জন্য মডিউল:সুরক্ষা/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে
--[[ * মডিউল যা সুরক্ষা টেমপ্লেটে প্রয়োগ করা হয়। এই মডিউলটি ইতালীয় উইকির Modulo:Protezione থেকে আনা হয়েছে। ]]-- require('মডিউল:No globals') local getArgs = require('মডিউল:Arguments').getArgs local cfg = mw.loadData('মডিউল:সুরক্ষা/রূপরেখা') local p = {} -- অনুরোধকৃত কার্যের জন্য পাতার সুরক্ষা ফেরত দেয় ও সুরক্ষিত না থাকলে nil local function getProtection(title, action) return title.protectionLevels[action] and title.protectionLevels[action][1] end -- কার্যের জন্য আইকন ও নির্দিষ্ট করা সুরক্ষা যোগ করে local function addIcon(action, prot) -- l'underscore di move serve per cambiare l'ordine di visualizzazione delle icone local icon = string.format('<indicator name="prot%s">%s</indicator>', action == 'move' and '_move' or action, cfg.icone[action][prot]) mw.getCurrentFrame():preprocess(icon) end -- Restituisce il messaggio configurato per il tipo di azione e protezione sulla pagina specificata local function getMsg(title, action, prot) local msg = cfg.messaggi[action][prot][title.namespace] return msg and msg:gsub('$1', string.format('[[%s|আলাপ পাতায়]]', title.talkPageTitle.fullText)) or nil end -- কার্যের ধরনের জন্য কনফিগার করার বিষয়শ্রেণী ও নির্দিষ্ট করা পাতার সুরক্ষা ফেরত দিবে local function getCategory(title, action, prot) local categories = cfg.categorie[action] local cat = categories[title.namespace] or categories.default if prot == 'autoconfirmed' then cat = 'অর্ধ-' .. cat end return string.format('[[বিষয়শ্রেণী:%s]]', cat) end -- ব্যবহারকারীর নির্দিষ্ট করা বিষয়শ্রেণী ফেরত দিবে local function getUserCategory(editProt, args) local cat if editProt == 'sysop' then cat = args.cat elseif editProt == 'autoconfirmed' then cat = args.cat end return cat and string.format('[[বিষয়শ্রেণী:%s]]', cat) or nil end -- অন্য মডিউল থেকে ব্যবহারের জন্য function p._main(args) local title, editProt, moveProt, editCat, moveCat, msg, ret title = mw.title.getCurrentTitle() editProt = getProtection(title, 'edit') moveProt = getProtection(title, 'move') -- moveProt=autoconfirmed bnwikiতে ইতিমধ্যে পূর্বনির্ধারিত if moveProt == 'autoconfirmed' then moveProt = nil end -- সম্পাদনার জন্য সুরক্ষা if editProt then addIcon('edit', editProt) msg = getMsg(title, 'edit', editProt) -- "cat" প্যারামিটার একটি নতুন বিষয়শ্রেণী নির্দিষ্ট করার অনুমতি দেবে if args.cat then editCat = getUserCategory(editProt, args) else editCat = getCategory(title, 'edit', editProt) end end -- স্থানান্তরের জন্য সুরক্ষা if moveProt then addIcon('move', moveProt) -- la categoria per lo spostamento non è aggiunta se editProt=sysop if editProt ~= 'sysop' then moveCat = getCategory(title, 'move', moveProt) end end if editProt or moveProt then ret = (msg or '') .. (editCat or '') .. (moveCat or '') else -- পাতাটি সুরক্ষিত নয় if title.namespace == 10 and title.isSubpage and title.subpageText:match('^খেলাঘর$') then ret = '[[বিষয়শ্রেণী:টেমপ্লেটের খেলাঘর]]' else ret = string.format('[[বিষয়শ্রেণী:%s]]', cfg.catSprotette) end end return ret end -- {{সুরক্ষা}} টেমপ্লেটের ভুক্তি-বিন্দু function p.main(frame) return p._main(getArgs(frame, { parentOnly = true })) end return p