Module:Tour history: Difference between revisions

From SPCodex, The Smashing Pumpkins wiki
No edit summary
m (Protected "Module:Tour history": High traffic page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
 
(10 intermediate revisions by the same user not shown)
Line 36: Line 36:
}
}
)
)
mw.logObject(results)
end
end


function p._is_tour_page(title)
function p._is_tour_page(title)
mw.logObject(title)
return string.sub(title, -12) == 'tour history'
return string.sub(title, -12) == 'tour history'
or string.sub(title, -9)  == 'residency'
or string.sub(title, -9)  == 'residency'
or string.sub(title, -5)  == ' tour'
or string.sub(title, -5)  == ' tour'
or string.sub(title, -8) == 'festival'
or ''
or ''
end
end


function p.is_tour_page(frame)
function p.is_tour_page(frame)
local title = frame.args[1]
local title = frame.args[1] or string.lower(frame:getTitle())
return p._is_tour_page(frame)
return p._is_tour_page(title)
end
end


return p
return p

Latest revision as of 02:57, 9 August 2023

Documentation for this module may be created at Module:Tour history/doc

local p = {}

-- NOT CURRENTLY USED, CAN PROBABLY BE REMOVED
function p._list( artist, tour, year, noposter )
	local cargo = mw.ext.cargo

	select_clause = "CONCAT('[[', shows._pageName, '|', shows.date, ']]')=Date, " ..
		"shows.venue=Venue, shows.location=Location, " ..
		"IF(live_songs.name IS NULL, '', '[[File:OOjs_UI_icon_check-constructive.svg|30px|link=]]')=Setlist, " ..
		"IF(live_show_photos._pageName IS NULL AND shows.poster IS NULL, '', '[[File:OOjs_UI_icon_check-constructive.svg|30px|link=]]')=Photos, " ..
		"IF(live_banter._pageName IS NULL, '', '[[File:OOjs_UI_icon_check-constructive.svg|30px|link=]]')=Banter"

	if noposter ~= '' and noposter ~= nil then
		select_clause = 'CONCAT("[[File:", shows.poster, "|200px|link=", shows._pageName, "]]")=Poster, ' .. select_clause
	end

	where_conds = {}
	if artist and artist ~= '' then
		table.insert(where_conds, 'shows.artist = "' .. artist .. '"')
	end
	if tour and tour ~= '' then
		table.insert(where_conds, 'shows.tour = "' .. tour .. '"')
	end
	if year and year ~= '' then
		table.insert(where_conds, 'YEAR(shows.date) = ' .. year)
	end

	local results = cargo.query(
		'live_songs, shows, live_show_photos, live_banter',
		select_clause,
		{
			where = mw.text.listToText( where_conds, ' AND ' ),
			join = 'shows._pageName = live_songs._pageName, shows._pageName=live_show_photos._pageName, shows._pageName=live_banter._pageName',
			groupBy = 'shows._pageName',
			orderBy = 'shows.date ASC'
		}
	)
end

function p._is_tour_page(title)
	return string.sub(title, -12) == 'tour history'
		or string.sub(title, -9)  == 'residency'
		or string.sub(title, -5)  == ' tour'
		or string.sub(title, -8) == 'festival'
		or ''
end

function p.is_tour_page(frame)
	local title = frame.args[1] or string.lower(frame:getTitle())
	return p._is_tour_page(title)
end

return p