Module:Cfd

Jump to navigation Jump to search


The text of this module comes from the old CfD process tags. History can be found under the history of Template:Cfr, up to the end of 2009.

It should be invoked from a template, which is called with the following parameters:

  1. First unnamed parameter: the first letter of the type: delete, listify, merge, or rename
  2. Optional parameters for the target (not available for delete): target for the first, target2 for the second, target3 for the third. Only Merge supports more than one.
  3. Optional parameter for section - otherwise, the name of the category is used for the section.
  4. Parameters named day, month and year for the date on which the discussion can be found

External links[edit source]

 

local p = {};
p.all = function(frame)
	
	local text  = "'''This category is being considered for "
	local type = frame.args[1]
	local targetText = ""
	local action, target
	if type == "d" then
		action = frame.args.action
		if not (action and #action > 0) then
			action = "deletion"
		end
		text = text .. action;
	elseif type == "r" then
		text = text .. "renaming to "
		target = frame.args["target"]
		if (target == nil or target == "") then
			text = text .. "some other name"
		else
			targetText = "[[:Category:" .. target .. "]]"
			text = text .. targetText
		end
	elseif type == "m" then
		text = text .. "merging into "
		target = frame.args["target"]
		if (target == nil or target == "") then
			text = text .. "some other category"
		else
			targetText = "[[:Category:" .. target .. "]]"
			local target2 = frame.args["target2"]
			if target2 then
				local target3 = frame.args["target3"]
				if target3 then
					targetText = targetText .. ", [[:Category:" .. target2 .. "]] and [[:Category:" .. target3 .. "]]"
				else
					targetText = targetText .. " and [[:Category:" .. target2 .. "]]"
				end
			end
			text = text .. targetText
		end
	elseif type == "l" then
		text = text .. "conversion into a list";
		target = frame.args["target"]
		if not (target == nil or target == "") then
			targetText = "[[" .. target .. "]]"
			text = text .. " named " .. targetText
		end
	end
	
	text = text .. ".'''"
	local section = frame.args["section"]
	if not (section == "") then
		text = text .. " This nomination is part of a discussion of several related categories."
	end
	
	text = text .. "<br/>''This does '''not''' mean that any of the pages in the category will be deleted.'' They may, however, be recategorized.<br/>"
	
	local year = frame.args["year"]
	local month = frame.args["month"]
	local day = frame.args["day"]
	
	local discussionPlace = "Starfleet Logistics:Categories for discussion/Log/" .. year .. " " .. month .. " " .. day .. "#"
	if section == "" then
		discussionPlace = discussionPlace .. mw.title.getCurrentTitle().fullText
	else
		discussionPlace = discussionPlace .. section
	end
	
	text = text .. "Please share your thoughts on the matter at '''[[" .. discussionPlace .. "|this category's entry]]''' on the [[Starfleet Logistics:Categories for discussion|Categories for discussion]] page. Please do not empty the category or remove this notice while the discussion is in progress.<br/>"
	local discussionpage = "Categories for discussion/Log/" .. os.date("%Y %B %e")
	text = text .. "<small>" .. frame:expandTemplate{title="strong",args={"[" .. mw.title.makeTitle(4,discussionpage):fullUrl() .. "?action=edit&section=2 Add entry]"}} .. ": {{subst:cf" .. type .. "2|" .. mw.title.getCurrentTitle().text
	if target then
		text = text .. "|" .. target
	end
	text = text .. "|header="
	if not (section == "") then
	    text = text .. section
	else
	    text = text .. mw.title.getCurrentTitle().fullText
	end
	text = text .. "|text=Your reason(s) for the proposed "
	if type == "d" then
		text = text .. action
	elseif type == "m" then
		text = text .. "merger"
	elseif type == "l" then
		text = text .. "conversion"
	elseif type == "r" then
	    text = text .. "rename"
	end
	text = text .. ". ~~~~}}</small>"
	
	local adminMsg
	if type == "r" then
		adminMsg = "[http://starfleetlogistics.shoutwiki.com/w/index.php?title=Special:MovePage&wpOldTitle=" .. mw.uri.encode(mw.title.getCurrentTitle().prefixedText) ..
			"&wpReason=" .. mw.uri.encode("[[" .. discussionPlace .. "]]") .. "&wpNewTitle=" .. mw.uri.encode("Category:" .. target) .. " Click here to rename]."
	else
		adminMsg = "If this category is empty, "
		adminMsg = adminMsg .. "and all [[Special:WhatLinksHere/" .. mw.title.getCurrentTitle().fullText .. "|incoming links]] have been cleaned up,"
		reason = "[[" .. discussionPlace .. "]]"
		if type == "d" then
			reason = "This category has been deleted per the discussion at " .. reason
		elseif type == "m" then
			if targetText == "" then
				reason = "Merged per " .. reason
			else
				reason = "Merged into " .. targetText .. " per " .. reason
			end
		elseif type == "l" then
			if targetText == "" then
				reason = "Listified per " .. reason
			else
				reason = "Listified into " .. targetText .. " per " .. reason
			end
		end
		adminMsg = adminMsg .. " [" .. mw.title.getCurrentTitle():fullUrl() .. "?action=delete&wpReason="
			.. mw.uri.encode(reason)
		adminMsg = adminMsg .. " click here to delete]."
		adminMsg = adminMsg .. '<span id="delete-reason" style="display:none">'
		adminMsg = adminMsg .. mw.uri.encode("[[" .. discussionPlace .. "]]")
		adminMsg = adminMsg .. '</span><span id="delete-criterion" style="display:none"> </span>'
	end
	
	text = text .. '<span class="sysop-show"><small><br /><br />' .. "'''Administrators''': " .. adminMsg .. "</small></span>"
	
	local category = ""
	
	if mw.title.getCurrentTitle().namespace == 14 then
		category = "[[Category:Categories for "
		if type == "d" then
			category = category .. "deletion"
		elseif type == "m" then
			category = category .. "merging"
		elseif type == "l" then
			category = category .. "listifying"
		elseif type == "r" then
			category = category .. "renaming"
		end
	    category = category .. "]][[Category:All categories for discussion]]"
	    category = category .. frame:expandTemplate{title="DMC",args={"Categories for discussion","from",month .. " " .. year}}
	end
	
	return frame:expandTemplate{title="Cmbox",args={type="delete",image="none",text=text}} .. category
end

return p;