Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Valeriej/Wish
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} --Takes in a list of role names and returns a string of image links function p.roles( frame ) --Set up variables local i = 0 local returnS = "" local linkBase = "User:Valeriej/WishingWellSandbox/Definitions" local imageSize = "30px" local imageLink = "" if frame.args[i+1] == nil then return returnS end repeat i = i + 1 if frame.args[i] == "builder" then imageLink = "Community_Noun_project_2280.svg" elseif frame.args[i] == "designer" then imageLink = "Vitruvian_Man_Noun_project_6674.svg" elseif frame.args[i] == "researcher" then imageLink = "Noun_project_8974.svg" else imageLink = "Question_Noun_project_2185.svg" end returnS = returnS .. "[[File:" .. imageLink .."|"..imageSize.."|link="..linkBase.. "#Role|This wish needs a "..frame.args[i]..".]] " mw.log(returnS) until frame.args[i+1] == nil return returnS end function p._roles(roleList) --Set up variables returnS = "" linkBase = "User:Valeriej/WishingWellSandbox/Definitions" imageSize = "30px" imageLink = "" for token in mw.ustring.gmatch( roleList, "%w+" ) do if token == "builder" then imageLink = "Community_Noun_project_2280.svg" elseif token == "designer" then imageLink = "Vitruvian_Man_Noun_project_6674.svg" elseif token == "researcher" then imageLink = "Noun_project_8974.svg" else imageLink = "Question_Noun_project_2185.svg" end returnS = returnS .. "[[File:" .. imageLink .."|"..imageSize.."|link="..linkBase.. "#Role|This wish needs a "..token..".]] " mw.log(returnS) end return returnS end --Read in usernames and return a list of links to their user pages. function p.participants( frame ) --Set up variables i = 0 userLinks = "" if frame.args[i+1] ~= nil then repeat i = i + 1 userLinks = userLinks .. "[[User:"..frame.args[i].."|"..frame.args[i].."]]" if frame.args[i+1] ~= nil then userLinks = userLinks .. ", " end mw.log(userLinks) until frame.args[i+1] == nil end return userLinks end --Read in usernames and return a list of links to their user pages. function p._participants( userList ) --Set up variables i = 0 userLinks = "" for token in mw.ustring.gmatch( userList, "%w+_*%.*%!*%?*%:*%w*%.*%!*" ) do if(i ~= 0) then userLinks = userLinks..", " end userLinks = userLinks .. "[[User:"..token.."|"..token.."]]" i=i+1 mw.log(userLinks) end return userLinks end function p.stat( frame ) i = 1 statusText = "" if frame.args[i] == "Open" then statusText = frame.args[i] elseif frame.args[i] == "In Progress" then statusText = frame.args[i] elseif frame.args[i] == "Ready to Deploy" then statusText = frame.args[i] elseif frame.args[i] == "Wish Granted" then statusText = frame.args[i] elseif frame.args[i] == "Experiment" then statusText = frame.args[i].."in Progress" elseif frame.args[i] == "Closed" then statusText = frame.args[i] else statusText = "Invalid Status" end return statusText end function p.row( frame ) --Builds up a row in the Wishing Well table tablerow = "|" .. frame.args['wishName'].." ||"..p._participants(frame.args['genies']).." ||"..p._roles(frame.args['geniesNeeded']) tablerow = tablerow.."||"..frame.args['stat'].."||"..frame.args['createdOn'].."||"..frame.args['lastUpdated'].."\n|-" return tablerow end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Valeriej/Wish/doc
(
edit
)