Module:SOM.Page.School Board Meeting
From SunshinePPS Wiki
This module defines the class School Board Meeting
which defines
pages in the category Category:School Board Meeting.
A School Board Meeting is a XXXXXXXYYYY.
- page_category(
frame
) - Generates the definition for this class' category, Category:School Board Meeting. Typically, invoked by
SOM.util.auto_generate_page_category
- page_form(
frame
) - Generates the definition for this class' form, Form:School Board Meeting. Typically, invoked by
SOM.util.auto_generate_page_form
- page_template(
frame
) - Generates the definition for the template which instantiates this class, Template:SOM.Page.School Board Meeting. Typically, invoked by
SOM.util.auto_generate_page_template
require("Module:No globals")
local Page = require("Module:SOM.meta.Page")
local StringBuffer = require("Module:SOM.util.StringBuffer")
local util = require("Module:SOM.util")
local AttachedFile = require("Module:SOM.Composite.AttachedFile")
local AttendingDirector = require("Module:SOM.Composite.AttendingDirector")
local BelongsToSchoolDistrict = require("Module:SOM.Simple.BelongsToSchoolDistrict")
local BoardMeetingType = require("Module:SOM.Simple.HasBoardMeetingType")
local FreeWikitext = require("Module:SOM.Simple.FreeWikitext")
--XXX local HasVideoLink = require("Module:SOM.Simple.HasVideoLink")
local InformationSource = require("Module:SOM.Composite.InformationSource")
local IsCancelledEvent = require("Module:SOM.Simple.IsCancelledEvent")
local OccursAtLocation = require("Module:SOM.Simple.OccursAtLocation")
local OccursAtTime = require("Module:SOM.Simple.OccursAtTime")
local OccursOnDate = require("Module:SOM.Simple.OccursOnDate")
-- local TimedTextTranscript = require("Module:SOM.Simple.TimedTextTranscript")
local TimedTextTranscript = require("Module:SOM.Composite.TimedTextTranscript")
local VideoLink = require("Module:SOM.Composite.VideoLink")
local function make_document_renderer(section)
return function (value, frame)
local filenames = StringBuffer.new()
local count = 0
for _, d in ipairs(value or {}) do
-- Skip entries that do not match section
if d.section == section then
if (d.file == nil) or (d.file == "") then
filenames:add_uformat(
"File:QuestionMark.svg|%s", util.MISSING_VALUE):nl()
else
filenames:add_uformat(
"%s|%s", d.file, d.description or ""):nl()
end
count = count + 1
end
end
if count == 0 then
return "''None''"
end
return frame:extensionTag{
name = "gallery",
content = filenames:output(),
args = { mode = "traditional", showfilename = "yo" }
}
end
end
return Page.generate_page{
class_name = "School Board Meeting",
parent_categories = { "Public Meeting" },
category_description = [==[
A ''School Board Meeting'' is a XXXXXXXYYYY.
]==],
attributes = {
district = {
arg = "district",
class = BelongsToSchoolDistrict,
label = "District",
},
meeting_type = {
arg = "meeting_type",
class = BoardMeetingType,
label = "Meeting Type",
},
is_cancelled = {
arg = "is_cancelled",
class = IsCancelledEvent,
label = "Cancelled?",
},
meeting_date = {
arg = "meeting_date",
class = OccursOnDate,
label = "Date",
},
meeting_time = {
arg = "meeting_time",
class = OccursAtTime,
label = "Time",
},
meeting_venue = {
arg = "meeting_venue",
class = OccursAtLocation,
label = "Venue",
},
video_links = {
arg = "video_links",
class = VideoLink,
label = "Video Links",
},
free_text = {
arg = "free_text",
class = FreeWikitext,
label = "Article Text"
},
transcripts = {
arg = "transcripts",
class = TimedTextTranscript,
label = "Transcripts",
},
directors_present = {
arg = "directors_present",
class = AttendingDirector,
label = "Directors Present",
},
documents = {
arg = "documents",
class = AttachedFile,
link_to_key = "page",
label = "Documents",
},
sources = {
arg = "sources",
class = InformationSource,
label = "Sources",
},
},
form_layout = {
{ section2 = "Basic Facts" },
{ table = {
{ attribute = "district" },
{ attribute = "meeting_type" },
{ attribute = "is_cancelled" },
{ attribute = "meeting_date" },
{ attribute = "meeting_time" },
{ attribute = "meeting_venue" },
{ attribute = "video_links" },
{ attribute = "directors_present" },
}
},
{ section2 = "Documents / Media" },
{ attribute = "documents" },
{ section2 = "Article Text" },
{ attribute = "free_text" },
{ section2 = "Transcripts" },
{ attribute = "transcripts" },
{ section2 = "Sources" },
{ attribute = "sources" },
},
page_layout = {
{ infobox = {
{ attribute = "district" },
{ attribute = "meeting_date" },
{ attribute = "meeting_time" },
{ attribute = "meeting_venue" },
{ attribute = "meeting_type" },
{ attribute = "directors_present",
render = function (value, frame)
if (value == nil) or (#value == 0) then
return util.MISSING_VALUE
end
local buffer = StringBuffer.new()
for _, d in ipairs(value) do
buffer
-- TODO maddog Should use a class.render method
:add_uformat("* %s", util.show_as_link(d.director))
:nl()
end
return buffer:output()
end },
}
},
-- { attribute = "video_link",
-- render = function (value, frame)
-- return HasVideoLink.embed_video{
-- frame = frame,
-- link = value,
-- dimensions = 480,
-- }
-- end },
{ attribute = "is_cancelled",
render = function (value, frame)
if value == "true" then
return "'''Cancelled Meeting'''\n\n"
end
return ""
end
},
{ attribute = "video_links",
render = function (value, frame)
if (value == nil) or (#value == 0) then
return util.make_missing_value("video missing") -- util.MISSING_VALUE
end
local buffer = StringBuffer.new()
for _, d in ipairs(value) do
buffer
-- TODO maddog Should use a class.render method
:add(VideoLink.embed_video{
frame = frame,
link = d.link,
dimensions = 480,
})
:nl()
end
return buffer:output()
end },
{ attribute = "free_text" },
{ section2 = "Documents / Media" },
{ section3 = "Notices/Agendas" },
{ attribute = "documents",
render = make_document_renderer("notices"),
},
{ section3 = "Materials" },
{ attribute = "documents",
render = make_document_renderer("materials"),
},
{ section3 = "Minutes" },
{ attribute = "documents",
render = make_document_renderer("minutes"),
},
{ section2 = "Transcripts" },
{ attribute = "transcripts",
render = function (value, frame)
if (value == nil) or (#value == 0) then
return util.MISSING_VALUE
end
return TimedTextTranscript.render(value, frame)
end
},
{ section2 = "Sources" },
{ attribute = "sources",
render = function (value, frame)
if (value == nil) or (#value == 0) then
return util.MISSING_VALUE
end
local buffer = StringBuffer.new()
for _, d in ipairs(value) do
buffer
-- TODO maddog Should use a class.render method
:add_uformat(
"* %s, %s <span style=\"font-size:84%%;\">(accessed: %s)</span>",
d.description,
util.show_url_as_external_link(d.url),
d.access_timestamp)
:nl()
end
return buffer:output()
end },
}
}