Content deleted Content added
Undid revision 646877312 by Mr. Stradivarius (talk) - causing problems |
per edit request on talk page - remove line as unnecessary |
||
(9 intermediate revisions by 6 users not shown) | |||
Line 13:
-- Load required modules.
require('
local Category = require('Module:Article history/Category')
local yesno = require('Module:Yesno')
Line 127:
obj.cfg = data.cfg
obj.currentTitle = data.currentTitle
obj.makeData = data.makeData -- used by Row:getData
return obj
Line 182 ⟶ 181:
end
function Row:setIconValues(icon, caption, size
self.icon = icon
self.iconCaption = caption
self.iconSize = size
end
Line 198 ⟶ 196:
function Row:getIconSize()
return self.iconSize or self.cfg.defaultIconSize or '30px'
end
Line 347 ⟶ 341:
function Status:getIconSize()
end
Line 398 ⟶ 386:
end
obj.statuses = {}
local defaultIconSize = obj.cfg.
for
table.insert(obj.statuses, Status.new(getChildStatusData(
data,
Line 412 ⟶ 400:
function MultiStatus:exportHtml(articleHistoryObj)
local ret = mw.html.create()
for
ret:node(obj:exportHtml(articleHistoryObj))
end
Line 420 ⟶ 408:
function MultiStatus:getCategories(articleHistoryObj)
local ret = {}
for
for
ret[#ret + 1] = categoryObj
end
Line 430 ⟶ 418:
function MultiStatus:exportNoticeBarIcon()
local ret = {}
for
ret[#ret + 1] = obj:exportNoticeBarIcon()
end
Line 438 ⟶ 426:
function MultiStatus:getWarnings()
local ret = {}
for
for
ret[#ret + 1] = msg
end
Line 462 ⟶ 450:
data.icon,
data.iconCaption,
data.iconSize
)
obj:setNoticeBarIconValues(
Line 670 ⟶ 657:
self:getName(articleHistoryObj)
))
-- Result cell
row
Line 696 ⟶ 683:
data.icon,
data.iconCaption,
data.iconSize
)
obj:setNoticeBarIconValues(
Line 720 ⟶ 706:
function CollapsibleNotice:getIconSize()
or self.cfg.defaultCollapsibleNoticeIconSize
or '20px'
end
Line 749 ⟶ 729:
if collapsibleText then
cell
:tag('
:addClass('mw-collapsible mw-collapsed')
:
:
:done()
:tag('
:
else
cell:wikitext(text)
Line 817 ⟶ 787:
obj.args = args or {}
obj.currentTitle = currentTitle or mw.title.getCurrentTitle()
-- Define object structure.
obj._errors = {}
obj._allObjectsCache = {}
-- Format the config
local function substituteAliases(t, ret)
Line 941 ⟶ 908:
local actions = {}
local suffixes = self.cfg.actionParamSuffixes
for
local objArgs = {}
for k, v in pairs(t) do
Line 1,012 ⟶ 979:
id = statusId,
currentTitle = self.currentTitle,
cfg = self.cfg
}
local isMulti = self.cfg.statuses[statusId].isMulti
Line 1,034 ⟶ 1,000:
end
local ret = {}
for
if t.isActive(self) then
local data = {}
Line 1,044 ⟶ 1,010:
data.cfg = self.cfg
data.currentTitle = self.currentTitle
ret[#ret + 1] = class.new(data)
end
Line 1,078 ⟶ 1,043:
self:getCollapsibleNoticeObjects()
}
for
for
ret[#ret + 1] = obj
end
Line 1,118 ⟶ 1,083:
ret[#ret + 1] = msg
end
for
for
ret[#ret + 1] = msg
end
end
return ret
end
function ArticleHistory:categoriesAreActive()
-- Returns a boolean indicating whether categories should be output or not.
local title = self.currentTitle
local ns = title.namespace
return title.isTalkPage
and ns ~= 3 -- not user talk
and ns ~= 119 -- not draft talk
end
Line 1,129 ⟶ 1,103:
local ret = {}
if self:categoriesAreActive() then
-- Child object categories
for _, obj in ipairs(self:getAllObjects()) do
local categories = self:try(obj.getCategories, obj, self)
for _, categoryObj in ipairs(categories or {}) do
ret[#ret + 1] = tostring(categoryObj)
end
end
local cats = func(self) or {}
for
ret[#ret + 1] = tostring(categoryObj)
end
end
end
Line 1,153 ⟶ 1,129:
-- Table root
local tableRoot = root:tag('table')
tableRoot:addClass('article-history tmbox tmbox-notice')
-- Status
local statusObj = self:getStatusObj()
Line 1,193 ⟶ 1,164:
local nActionRows = #actionHtmlObjects
local nCollapsibleRows = nActionRows + #collapsibleNoticeHtmlObjects
-- Find out if we are collapsed or not.
local isCollapsed = yesno(self.args.collapse)
if
if self.cfg.uncollapsedRows == 'all' then
isCollapsed = false
elseif nCollapsibleRows == 1 then
isCollapsed = false
else
isCollapsed = nCollapsibleRows > (tonumber(self.cfg.uncollapsedRows) or 3)
end
end
Line 1,228 ⟶ 1,201:
:css('width', '100%')
:tag('table')
:addClass('
:addClass(isCollapsed and 'mw-collapsible mw-collapsed' or nil)
:css('width', '100%')
:css('font-size', '90%')
-- Header row
local ctHeader = collapsibleTable
:tag('tr')
:tag('
:
end
ctHeader:wikitext(' ')
end
end
end
Line 1,285 ⟶ 1,255:
end
end
-- Collapsible notices and current status
-- These are only included in the collapsible table if it is collapsed.
Line 1,299 ⟶ 1,269:
statusColspan = 2
end
-- Collapsible notices
for _, obj in ipairs(collapsibleNotices) do
tableNode:node(self:try(obj.exportHtml, obj, self, isCollapsed))
end
-- Current status
if statusObj and nActionRows > 1 then
Line 1,334 ⟶ 1,304:
errorList:tag('li'):wikitext(msg)
end
if self:categoriesAreActive() then
errorCategory = tostring(Category.new(self:message( 'error-category' ))) end
-- If there are no errors and no active objects, then exit. We can't make
Line 1,346 ⟶ 1,320:
root:wikitext(categories)
root:wikitext(errorCategory)
local frame = mw.getCurrentFrame()
return frame:extensionTag{
name = 'templatestyles', args = { src = 'Module:Message box/tmbox.css' }
} .. frame:extensionTag{
name = 'templatestyles', args = { src = 'Module:Article history/styles.css' }
} .. tostring(root)
end
Line 1,366 ⟶ 1,345:
wrappers = WRAPPER_TEMPLATE
})
if frame:getTitle():find('sandbox', 1, true) then
CONFIG_PAGE = CONFIG_PAGE .. '/sandbox'
end
return p._main(args)
end
|