Anyone have the code to change the "lock" times of games?
Anyone have the code to change the "lock" times of games?
I know this was posted on the message board that Mike had last year, it was the code to change the lock times for games from his defaults, to lock just before the start of each individual game.
I only started using this program last year, so while I still have my site/code from last year I really don't even recall where to start looking for it i nthere.
Thanks!
I only started using this program last year, so while I still have my site/code from last year I really don't even recall where to start looking for it i nthere.
Thanks!
-
- Posts: 15
- Joined: Wed Aug 28, 2013 9:19 am
Re: Anyone have the code to change the "lock" times of games
I believe it is in the "/includes/common.asp"
Can you post the "common.asp" you used last year?
Can you post the "common.asp" you used last year?
Re: Anyone have the code to change the "lock" times of games
Code: Select all
<% '**************************************************************************
'* Common application code. *
'* *
'* Note: Should be included at the beginning of every page, right after *
'* the config.asp file. *
'**************************************************************************
'Set the session timeout value.
Session.Timeout = SESSION_TIMEOUT
'**************************************************************************
'* Constant definitions. *
'**************************************************************************
'Characters allowed in usernames.
const ALLOWED_USERNAME_CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_ '."
'Username reserved for the Administrator.
const ADMIN_USERNAME = "Admin"
'Username max length.
const USERNAME_MAX_LEN = 25
'Minimum password length.
const PASSWORD_MIN_LEN = 5
'Value used to denote a tie game in the database.
const TIE_STR = "Tie"
'For checkboxes.
const CHECKED_ATTRIBUTE = " checked=""checked"""
'Placeholder for playoff team names.
const TO_BE_DETERMINED_STR = "[<em>TBD</em>]"
'**************************************************************************
'* Global variables. *
'**************************************************************************
'Page sub title.
dim PageSubTitle
PageSubTitle = "Subtitle"
'Database connection.
dim DbConn
'Conference and division names (should actually be constants).
dim ConferenceNames, DivisionNames
ConferenceNames = Array("AFC", "NFC")
DivisionNames = Array("East", "North", "South", "West")
'Define the number of wild card playoff teams in each conference.
const WILD_CARD_TEAMS = 2
'Determine the number of conferences and the number of playoff teams in
'each.
dim NumberConferences, NumberPlayoffsSeeds
NumberConferences = UBound(ConferenceNames) + 1
NumberPlayoffsSeeds = UBound(DivisionNames) + 1 + WILD_CARD_TEAMS
'Title text for the survivor/margin side pool.
dim SidePoolTitle
SidePoolTitle = ""
if ENABLE_SURVIVOR_POOL and ENABLE_MARGIN_POOL then
SidePoolTitle = "Survivor/Margin"
elseif ENABLE_SURVIVOR_POOL then
SidePoolTitle = "Survivor"
elseif ENABLE_MARGIN_POOL then
SidePoolTitle = "Margin"
end if
'Determine the number of playoffs pools enabled.
dim PlayoffsPoolsCount
PlayoffsPoolsCount = 0
if ENABLE_PLAYOFFS_PICK_POOL then
PlayoffsPoolsCount = PlayoffsPoolsCount + 1
end if
if ENABLE_PLAYOFFS_RANK_POOL then
PlayoffsPoolsCount = PlayoffsPoolsCount + 1
end if
if ENABLE_SUPER_BOWL_POOL then
PlayoffsPoolsCount = PlayoffsPoolsCount + 1
end if
'Set playoffs pool titles.
dim PlayoffsPoolsHeader
dim PlayoffsPickPoolTitle, PlayoffsRankPoolTitle
PlayoffsPoolsHeader = "Playoffs Pool"
if PlayoffsPoolsCount > 1 then
PlayoffsPoolsHeader = PlayoffsPoolsHeader & "s"
elseif PlayoffsPoolsCount = 1 and ENABLE_SUPER_BOWL_POOL then
PlayoffsPoolsHeader = "Super Bowl Pool"
end if
PlayoffsPickPoolTitle = "Playoffs"
PlayoffsRankPoolTitle = "Playoffs"
if ENABLE_PLAYOFFS_PICK_POOL then
PlayoffsRankPoolTitle = PlayoffsRankPoolTitle & " Rank'em"
end if
if ENABLE_PLAYOFFS_RANK_POOL then
PlayoffsPickPoolTitle = PlayoffsPickPoolTitle & " Pick'em"
end if
dim PlayoffsPickPoolPrefix, PlayoffsRankPoolPrefix, SuperBowlPoolPrefix
PlayoffsPickPoolPrefix = PlayoffsPickPoolTitle
PlayoffsRankPoolPrefix = PlayoffsRankPoolTitle
SuperBowlPoolPrefix = ""
if not ENABLE_SUPER_BOWL_POOL then
PlayoffsPickPoolPrefix = Trim(Replace(PlayoffsPickPoolPrefix, "Playoffs", ""))
PlayoffsRankPoolPrefix = Trim(Replace(PlayoffsRankPoolPrefix, "Playoffs", ""))
end if
PlayoffsPickPoolPrefix = PlayoffsPickPoolPrefix & " "
PlayoffsRankPoolPrefix = PlayoffsRankPoolPrefix & " "
if PlayoffsPoolsCount > 1 then
SuperBowlPoolPrefix = "Super Bowl "
end if
'Find the current script name.
dim CurrentScriptName
CurrentScriptName = Request.ServerVariables("SCRIPT_NAME")
if InStrRev(CurrentScriptName, "/") > 0 then
CurrentScriptName = Right(CurrentScriptName, Len(CurrentScriptName) - InStrRev(CurrentScriptName, "/"))
end if
'**************************************************************************
'* Functions and subroutines. *
'**************************************************************************
'--------------------------------------------------------------------------
' Used to restrict access to pages.
'--------------------------------------------------------------------------
sub CheckAccess(adminOnly)
'If the user has not logged in, or if the page is designated as Admin-only
'and the user is not the Administrator, redirects to the login page.
if Session(SESSION_USERNAME_KEY) = "" or (adminOnly and not IsAdmin()) then
Response.Redirect("userLogin.asp")
end if
end sub
'--------------------------------------------------------------------------
' Checks a username for invalid characters and returns the first one found.
' If no such characters are found, and empty string is returned.
'--------------------------------------------------------------------------
function CheckUsername(username)
dim n, i, c
CheckUsername = ""
n = Len(username)
for i = 1 to n
c = Mid(username, i, 1)
if InStr(ALLOWED_USERNAME_CHARACTERS, c) <= 0 then
CheckUsername = c
exit function
end if
next
end function
'--------------------------------------------------------------------------
' Returns the total of all credits for the specified user.
'--------------------------------------------------------------------------
function GetCreditTotal(username)
dim sql, rs
GetCreditTotal = 0
sql = "SELECT SUM(Amount) AS Total" _
& " FROM Credits" _
& " WHERE Username = '" & SqlEscape(username) & "'"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
GetCreditTotal = rs.Fields("Total").Value
if not IsNumeric(GetCreditTotal) then
GetCreditTotal = 0
end if
end if
end function
'--------------------------------------------------------------------------
' Returns a date object representing the current date and time adjusted to
' the time zone used in the database.
'--------------------------------------------------------------------------
function GetCurrentDateTime()
GetCurrentDateTime = DateAdd("h", -TIME_ZONE_DIFF, CDate(Date() & " " & Time()))
end function
'--------------------------------------------------------------------------
' Returns the current week number based on the current (time zone adjusted)
' date and time.
'--------------------------------------------------------------------------
function GetCurrentWeek()
dim dateTime, sql, rs, found
GetCurrentWeek = 0
dateTime = GetCurrentDateTime()
sql = "SELECT GameID, Week, Date FROM Schedule ORDER BY Date"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
found = false
do while not rs.EOF and not found
if DateDiff("d", DateValue(rs.Fields("Date").Value), dateTime) <= 0 then
found = true
GetCurrentWeek = rs.Fields("Week").Value
end if
rs.MoveNext
loop
end if
if GetCurrentWeek = 0 then
GetCurrentWeek = GetWeekCount()
end if
end function
'--------------------------------------------------------------------------
' Gets the week number specified in the HTTP request. If no valid number
' was specified, the current week is returned instead.
'--------------------------------------------------------------------------
function GetRequestedWeek()
dim week, sql
'Default to the current week.
GetRequestedWeek = GetCurrentWeek()
'Check the week number specified in the HTTP request.
week = Request("week")
if not IsNumeric(week) then
exit function
else
week = Round(week)
if week < 1 or week > GetWeekCount() then
exit function
end if
end if
GetRequestedWeek = week
end function
'--------------------------------------------------------------------------
' Returns the number of games scheduled for the specified week.
'--------------------------------------------------------------------------
function GetGameCount(week)
dim sql, rs
GetGameCount = 0
sql = "SELECT COUNT(*) AS Total FROM Schedule WHERE Week = " & week
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
GetGameCount = rs.Fields("Total").Value
end if
end function
'--------------------------------------------------------------------------
' Returns the number of completed games (i.e., games with a result)
' for the specified week.
'--------------------------------------------------------------------------
function GetCompletedGameCount(week)
dim sql, rs
GetCompletedGameCount = 0
sql = "SELECT COUNT(*) AS Total" _
& " FROM Schedule WHERE Week = " & week _
& " AND NOT ISNULL(Result)"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
GetCompletedGameCount = rs.Fields("Total").Value
end if
end function
'--------------------------------------------------------------------------
' Returns a record set of games for the specified week.
'--------------------------------------------------------------------------
function GetGamesRecordset(week)
dim sql
'Retrieve the week's schedule from the database.
sql = "SELECT Schedule.*," _
& " VTeams.City AS VCity, VTeams.Name AS VName, VTeams.DisplayName AS VDisplayName," _
& " HTeams.City AS HCity, HTeams.Name AS HName, HTeams.DisplayName AS HDisplayName" _
& " FROM Schedule, Teams AS VTEAMS, Teams AS HTEAMS" _
& " WHERE Schedule.VisitorID = VTeams.TeamID AND Schedule.HomeID = HTeams.TeamID" _
& " AND Week = " & week _
& " ORDER BY Date, Time, VTeams.City, VTeams.Name"
set GetGamesRecordset = DbConn.Execute(sql)
end function
'---------------------------------------------------------------------------
' Returns the total number of teams in the database.
'---------------------------------------------------------------------------
function GetTeamCount()
dim sql, rs
GetTeamCount = 0
sql = "SELECT COUNT(TeamID) AS Total FROM Teams"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
GetTeamCount = rs.Fields("Total").Value
end if
end function
'--------------------------------------------------------------------------
' Returns the display name for the given team id.
'--------------------------------------------------------------------------
function GetTeamName(id)
dim sql, rs
GetTeamName = TO_BE_DETERMINED_STR
sql = "SELECT City, DisplayName FROM Teams WHERE TeamID = '" & id & "'"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
if rs.Fields("DisplayName").Value <> "" then
GetTeamName = rs.Fields("DisplayName").Value
else
GetTeamName = rs.Fields("City").Value
end if
end if
end function
'--------------------------------------------------------------------------
' Returns a record set of all teams.
'--------------------------------------------------------------------------
function GetTeamsRecordset()
dim sql
'Retrieve teams from the database.
sql = "SELECT * FROM Teams ORDER BY City, Name"
set GetTeamsRecordset = DbConn.Execute(sql)
end function
'--------------------------------------------------------------------------
' Returns an array of all usernames in the database, optionally excluding
' the administrator username.
'--------------------------------------------------------------------------
function GetUserList(excludeAdmin)
dim list, sql, rs
GetUserList = ""
sql = "SELECT Username FROM Users"
if excludeAdmin then
sql = sql & " WHERE Username <> '" & SqlEscape(ADMIN_USERNAME) & "'"
end if
sql = sql & " ORDER BY Username"
set rs = DbConn.Execute(sql)
do while not rs.EOF
if not IsArray(list) then
redim list(0)
else
redim preserve list(UBound(list) + 1)
end if
list(UBound(list)) = rs.Fields("Username").Value
rs.MoveNext
loop
GetUserList = list
end function
'--------------------------------------------------------------------------
' Returns the total number of weeks in the schedule.
'--------------------------------------------------------------------------
function GetWeekCount()
dim sql, rs
GetWeekCount = 0
sql = "SELECT MAX(Week) AS Total FROM Schedule"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
GetWeekCount = rs.Fields("Total").Value
end if
end function
'--------------------------------------------------------------------------
' Returns true if the given date and time has passed, based on the
' current date and time.
'--------------------------------------------------------------------------
function IsDateTimePast(gameDateTime)
IsDateTimePast = false
if gameDateTime < GetCurrentDateTime() then
IsDateTimePast = true
end if
end function
'--------------------------------------------------------------------------
' Returns true if the given string occurs in the given array of strings.
'--------------------------------------------------------------------------
function InList(str, list)
dim i
InList = false
if IsArray(list) then
for i = 0 to UBound(list)
if list(i) = str then
InList = true
exit function
end if
next
end if
end function
'--------------------------------------------------------------------------
' Returns true if the current user is the Administrator.
'--------------------------------------------------------------------------
function IsAdmin()
IsAdmin = false
if Session(SESSION_USERNAME_KEY) = ADMIN_USERNAME then
IsAdmin = true
end if
end function
'--------------------------------------------------------------------------
' Returns true if the current user is disabled.
'--------------------------------------------------------------------------
function IsDisabled()
dim sql, rs
IsDisabled = false
sql = "SELECT DisableEntries FROM Users" _
& " WHERE Username = '" & SqlEscape(Session(SESSION_USERNAME_KEY)) & "'"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
IsDisabled = rs.Fields("DisableEntries").Value
end if
end function
'--------------------------------------------------------------------------
' Returns true if the given number represents a valid 32-bit integer.
'--------------------------------------------------------------------------
function IsValidInteger(n)
dim d
IsValidInteger = false
if InStr(n, ",") > 0 then
exit function
end if
if IsNumeric(n) then
d = CDbl(n)
if d <> Int(d) then
exit function
end if
if d >= -32768 and d <= 32767 then
IsValidInteger = true
end if
end if
end function
'--------------------------------------------------------------------------
' Returns true if the given number is a valid point spread.
'--------------------------------------------------------------------------
function IsValidPointSpread(n)
IsValidPointSpread = false
if InStr(n, ",") > 0 then
exit function
end if
if IsNumeric(n) then
if 2 * n = Round(2 * n) then
IsValidPointSpread = true
end if
end if
end function
'--------------------------------------------------------------------------
' Returns true if all games for the specified week are locked.
'--------------------------------------------------------------------------
function IsWeekLocked(week)
dim dateTime, rs, gameDateTime
IsWeekLocked = false
dateTime = GetCurrentDateTime()
set rs = GetGamesRecordset(week)
do while not rs.EOF
gameDateTime = CDate(rs.Fields("Date").Value & " " & rs.Fields("Time").Value)
if Weekday(gameDateTime) = vbTuesday and gameDateTime <= dateTime then
IsWeekLocked = true
exit function
end if
rs.MoveNext
loop
end function
'--------------------------------------------------------------------------
' Opens the database connection (global variable 'DbConn').
'--------------------------------------------------------------------------
sub OpenDb()
dim isPhysicalPath
dim dbDir
set DbConn = Server.CreateObject("ADODB.Connection")
'If the path to the database is not physical, map it.
isPhysicalPath = false
if Len(DATABASE_FILE_PATH) >= 3 then
if Mid(DATABASE_FILE_PATH, 2, 2) = ":\" then
isPhysicalPath = true
end if
end if
if not isPhysicalPath then
dbDir = Server.MapPath(DATABASE_FILE_PATH)
else
dbDir = DATABASE_FILE_PATH
end if
if USE_ACCESS_ODBC_DRIVER then
DbConn.Open "DBQ="& dbDir & ";Driver={Microsoft Access Driver (*.mdb)}"
else
DbConn.Open "Data Source=" & dbDir & ";Provider=Microsoft.Jet.OLEDB.4.0;"
end if
end sub
'--------------------------------------------------------------------------
' Set the results for the given game based on the game score and point
' spread.
'--------------------------------------------------------------------------
sub SetGameResults(id)
dim sql, rs, vid, hid, vscore, hscore, spread, result, atsResult
sql = "SELECT * FROM Schedule WHERE GameID = " & id
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
vid = rs.Fields("VisitorID").Value
hid = rs.Fields("HomeID").Value
vscore = rs.Fields("VisitorScore").Value
hscore = rs.Fields("HomeScore").Value
spread = rs.Fields("PointSpread").Value
result = "NULL"
atsResult = "NULL"
'If scores are available, determine the results.
if IsNumeric(vscore) and IsNumeric(hscore) then
'Find the winner.
vscore = CInt(vscore)
hscore = CInt(hscore)
if vscore > hscore then
result = vid
elseif hscore > vscore then
result = hid
else
result = TIE_STR
end if
result = "'" & result & "'"
'Find the winner vs. the spread
if IsNumeric(spread) then
spread = CDbl(spread)
else
spread = 0
end if
if (vscore + spread) > hscore then
atsResult = vid
elseif hscore > (vscore + spread) then
atsResult = hid
else
atsResult = TIE_STR
end if
atsResult = "'" & atsResult & "'"
end if
'Update the results.
sql = "UPDATE Schedule SET" _
& " Result = " & result & ", " _
& " ATSResult = " & atsResult _
& " WHERE GameID = " & id
call DbConn.Execute(sql)
end if
end sub
'--------------------------------------------------------------------------
' Returns a string with single quotes escaped. Used for variable string
' values in SQL statements.
'--------------------------------------------------------------------------
function SqlEscape(str)
SqlEscape = Replace(str, "'", "''")
end function
'**************************************************************************
'* Formatting functions. *
'**************************************************************************
'--------------------------------------------------------------------------
' Returns a formatted dollar amount string based on the given number.
'--------------------------------------------------------------------------
function FormatAmount(n)
FormatAmount = " "
if IsNumeric(n) then
FormatAmount = FormatCurrency(n, 2, true, false, true)
end if
end function
'--------------------------------------------------------------------------
' Returns a formated numeric string representing the average for given a
' sum and count.
'--------------------------------------------------------------------------
function FormatAverage(sum, n, numPlaces)
FormatAverage = " "
if IsNumeric(sum) and IsNumeric(n) then
if n = 0 then
FormatAverage = FormatNumber(0, numPlaces, true)
else
FormatAverage = FormatNumber(Round(sum / n, numPlaces), numPlaces, true)
end if
end if
end function
'--------------------------------------------------------------------------
' Returns a formatted date string (month and day) given a Date object.
'--------------------------------------------------------------------------
function FormatDate(dt)
FormatDate = Month(dt) & "/" & Day(dt)
end function
'--------------------------------------------------------------------------
' Returns a formatted time string given a Date object.
'--------------------------------------------------------------------------
function FormatTime(dt)
dim hh, mm, symbol
hh = Hour(dt)
mm = Minute(dt)
if mm < 10 then
mm = "0" & mm
end if
if hh >= 12 then
symbol = "pm"
else
symbol = "am"
end if
if hh >= 13 then
hh = hh - 12
end if
FormatTime = hh & ":" & mm & " " & symbol
end function
'--------------------------------------------------------------------------
' Returns a formatted date string (month, day and year) given a Date
' object.
'--------------------------------------------------------------------------
function FormatFullDate(dt)
FormatFullDate = Month(dt) & "/" & Day(dt) & "/" & Year(dt)
end function
'--------------------------------------------------------------------------
' Returns a formatted time string (hour, minute, second and meridiem) given
' a Date object.
'--------------------------------------------------------------------------
function FormatFullTime(dt)
FormatFullTime = LCase(FormatDateTime(dt, vbLongTime))
end function
'--------------------------------------------------------------------------
' Returns a formatted percent string based on the given number.
'--------------------------------------------------------------------------
function FormatPercentage(n)
FormatPercentage = " "
if IsNumeric(n) then
FormatPercentage = FormatNumber(Round(n, 3), 3, true)
end if
end function
'--------------------------------------------------------------------------
' Returns a formatted point spread.
'--------------------------------------------------------------------------
function FormatPointSpread(spread)
dim n
FormatPointSpread = "n/l "
if IsNumeric(spread) then
if spread = 0 then
FormatPointSpread = "even "
elseif spread = 0.5 then
FormatPointSpread = "+½ "
elseif spread = -0.5 then
FormatPointSpread = "-½ "
else
n = Fix(spread)
if n = 0 then
FormatPointSpread = ""
else
FormatPointSpread = n
end if
if Abs(spread) - Abs(n) = 0.5 then
FormatPointSpread = FormatPointSpread & "½"
else
FormatPointSpread = FormatPointSpread & " "
end if
if spread > 0 then
FormatPointSpread = "+" & FormatPointSpread
end if
end if
end if
end function
'--------------------------------------------------------------------------
' Formats a win-loss-tie record for output. Ties are not displayed if they
' are equal to zero.
'--------------------------------------------------------------------------
function FormatRecord(w, l, t)
FormatRecord = w & "-" & l
if t > 0 then
FormatRecord = FormatRecord & "-" & t
end if
end function
'--------------------------------------------------------------------------
' Returns a formatted score, optionally adding padding to allow alignment
' when half points occur.
'--------------------------------------------------------------------------
function FormatScore(score, addPadding)
dim n
FormatScore = "n/a"
if IsNumeric(score) then
n = Fix(score)
if Abs(score) - Abs(n) = .5 then
FormatScore = n & "½"
else
FormatScore = n
if addPadding then
FormatScore = FormatScore & " "
end if
end if
else
if addPadding then
FormatScore = FormatScore & " "
end if
end if
end function
'--------------------------------------------------------------------------
' Formats a string to indicate a survivor buyback.
'--------------------------------------------------------------------------
function FormatBuyback(str)
FormatBuyback = "[" & str & "]"
end function
'--------------------------------------------------------------------------
' Formats a string to indicate a correct pick.
'--------------------------------------------------------------------------
function FormatCorrectPick(str)
if USE_POINT_SPREADS then
FormatCorrectPick = FormatATSWinner(str)
else
FormatCorrectPick = FormatWinner(str)
end if
end function
'--------------------------------------------------------------------------
' Formats a string to indicate an incorrect pick.
'--------------------------------------------------------------------------
function FormatIncorrectPick(str)
FormatIncorrectPick = "<span style=""text-decoration: line-through; color:red"">" & str & "</span>"
end function
'--------------------------------------------------------------------------
' Formats a string to indicate a tie game.
'--------------------------------------------------------------------------
function FormatTie(str)
FormatTie = str & "<span style=""font-family: monospace;"">*</span>"
end function
'--------------------------------------------------------------------------
' Formats a string to indicate the game winner.
'--------------------------------------------------------------------------
function FormatWinner(str)
if USE_POINT_SPREADS then
FormatWinner = "<em>" & str & "</em>"
else
FormatWinner = "<span style=""color:limegreen; Font-weight:bold;"">" & str & "</span>"
end if
end function
'--------------------------------------------------------------------------
' Formats a string to highlight the game winner against the point spread.
'--------------------------------------------------------------------------
function FormatATSWinner(str)
if USE_POINT_SPREADS then
FormatATSWinner = "<strong>" & str & "</strong>"
else
FormatATSWinner = str
end if
end function
'**************************************************************************
'* Common displays. *
'**************************************************************************
'--------------------------------------------------------------------------
' Builds a drop down list of confidence points for the given the number of
' games. If the specified point value is found in the list it will be
' selected.
'--------------------------------------------------------------------------
sub DisplayConfidencePointsList(numGames, selectedPoints)
dim str, i
str = String(6, vbTab) & "<option value=""""></option>" & vbCrLf
for i = 1 to numGames
str = str & String(6, vbTab) & "<option value=""" & i & """"
if IsValidInteger(selectedPoints) then
if i = CInt(selectedPoints) then
str = str & " selected=""selected"""
end if
end if
str = str & ">"
'Need to pad for browsers that don't support right-aligned text
'in select options. Also, pad on right to give spacing between
'text and select button.
if i < 10 then
str = str & " "
end if
str = str & i & "</option>" & vbCrLf
next
Response.Write(str)
end sub
'--------------------------------------------------------------------------
' Builds a drop down list of usernames from the given list. If the
' specified name is found in the list it will be selected.
'--------------------------------------------------------------------------
sub DisplayUserSelectList(userList, selectedUser)
dim str, i
str = str & "<option value=""""></option>"
if IsArray(userList) then
for i = 0 to UBound(userList)
str = str & "<option value=""" & userList(i) & """"
if userList(i) = selectedUser then
str = str & " selected=""selected"""
end if
str = str & ">" & userList(i) & "</option>"
next
end if
Response.Write(str)
end sub
'--------------------------------------------------------------------------
' Displays a list of teams with open dates for the specified week.
'--------------------------------------------------------------------------
sub DisplayOpenDates(week)
dim str, sql, rs, rs2, id, team
'Build the list of team with open dates.
str = ""
sql = "SELECT * FROM Teams ORDER BY City, Name"
set rs = DbConn.Execute(sql)
do while not rs.EOF
id = rs.Fields("TeamID").Value
sql = "SELECT COUNT(*) as Total" _
& " FROM Schedule" _
& " WHERE (HomeID = '" & id & "'" _
& " OR VisitorID = '" & id & "')" _
& " AND Week = " & week
set rs2 = DbConn.Execute(sql)
if rs2.Fields("Total").Value = 0 then
'Get the team name and add it to the list.
team = rs.Fields("City").Value
if rs.Fields("DisplayName").Value <> "" then
team = rs.Fields("DisplayName").Value
end if
if str <> "" then
str = str & ", "
end if
str = str & team
end if
rs.MoveNext
loop
'Display the list.
if Len(str) > 0 then
Response.Write(String(2, vbTab) & "<p></p><div class=""adjustWidth""><strong>Open dates:</strong> " & str & ".</div>")
end if
end sub
'--------------------------------------------------------------------------
' Displays a list of indexed links (week or page). The URLs point to the
' calling script passing the specified index parameter in the query string.
' Additional parameters may also be specified.
'--------------------------------------------------------------------------
sub DisplayGoToNavigation(indexName, count, otherParams)
dim str, i
str = ""
for i = 1 to count
if i > 1 then
str = str & "<span class=""goToSeparator"">·</span>"
end if
str = str & "<a href=""" _
& Request.ServerVariables("SCRIPT_NAME") _
& "?" & indexName & "=" & i
if otherParams <> "" then
str = str & "&" & otherParams
end if
str = str & """>" & i & "</a>"
next
if Len(str) > 0 then
Response.Write(vbTab & "<p class=""goToNavigation""><span class=""goToHeader"">Go to " & indexName & ":</span> " & str & "</p>")
end if
end sub
'--------------------------------------------------------------------------
' Displays the logo of the specified team.
'--------------------------------------------------------------------------
sub DisplayTeamLogo(id)
if SHOW_TEAM_LOGOS then
Response.Write("<span class=""teamLogo " & id & """> </span>")
end if
end sub
'--------------------------------------------------------------------------
' Displays the win-loss-tie record of the specified team up to the
' specified week. Optionally includes the team's record vs. the spread.
'--------------------------------------------------------------------------
sub DisplayTeamRecord(id, week, includeATS)
dim str
dim sql, rs
dim result
dim wins, losses, ties
dim atsWins, atsLosses, atsTies
str = ""
'Get the team's record going into the week.
wins = 0 : atsWins = 0
losses = 0 : atsLosses = 0
ties = 0 : atsTies = 0
sql = "SELECT Result, ATSResult FROM Schedule" _
& " WHERE Week <= " & week _
& " AND (VisitorID = '" & id & "' OR HomeID = '" & id & "')" _
& " AND NOT ISNULL(Result)"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
do while not rs.EOF
result = rs.Fields("Result").Value
if result = id then
wins = wins + 1
elseif result = TIE_STR then
ties = ties + 1
else
losses = losses + 1
end if
if includeATS then
result = rs.Fields("ATSResult").Value
if result = id then
atsWins = atsWins + 1
elseif result = TIE_STR then
atsTies = atsTies + 1
else
atsLosses = atsLosses + 1
end if
end if
rs.MoveNext
loop
end if
str = " (" & FormatRecord(wins, losses, ties)
if includeATS then
str = str & ", " & FormatRecord(atsWins, atsLosses, atsTies) & " ATS"
end if
str = str & ")"
Response.Write("<span class=""small"">" & str & "</span>")
end sub
'--------------------------------------------------------------------------
' Displays the specified error message.
'--------------------------------------------------------------------------
sub DisplayErrorMessage(msg)
Response.Write(vbTab & "<div class=""adjustWidth errorMsg""><div>" & msg & "</div></div><br />" & vbCrLf)
end sub
'--------------------------------------------------------------------------
' Displays the specified info message.
'--------------------------------------------------------------------------
sub DisplaySuccessMessage(msg)
Response.Write(vbTab & "<div class=""adjustWidth successMsg""><div>" & msg & "</div></div><br />")
end sub
'--------------------------------------------------------------------------
' Displays the specified warning message.
'--------------------------------------------------------------------------
sub DisplayWarningMessage(msg)
Response.Write(vbTab & "<div class=""adjustWidth warningMsg""><div>" & msg & "</div></div><br />" & vbCrLf)
end sub
'--------------------------------------------------------------------------
' Used to create the page head including the title, favicon and appropriate
' external style sheets and scripts (based on the current pool options).
'
' Additional style sheets and/or scripts can be included by specifying
' them in a comma-separated list.
'--------------------------------------------------------------------------
sub BuildPageHeader(additionalStyles, additionalScripts)
dim list, name
dim teamID
'Add common headers.
Response.Write(vbTab & "<meta http-equiv=""Content-Type"" content=""text/html;charset=utf-8"" />" & vbCrLf)
Response.Write(vbTab & "<title>" & PAGE_TITLE & ": " & PageSubTitle & "</title>" & vbCrLf)
Response.Write(vbTab & "<link rel=""shortcut icon"" href=""favicon.ico"" />" & vbCrLf)
'Add the common style sheet.
Response.Write(vbTab & "<link rel=""stylesheet"" type=""text/css"" href=""styles/common.css"" />" & vbCrLf)
'Add the scoreboard style sheet, if appropriate.
if ENABLE_SCORES_ADDON then
Response.Write(vbTab & "<link rel=""stylesheet"" type=""text/css"" href=""styles/scoreboard.css"" />" & vbCrLf)
end if
'Add any additional styles sheets specified by the caller.
list = Split(additionalStyles, ",")
if IsArray(list) then
for each name in list
Response.Write(vbTab & "<link rel=""stylesheet"" type=""text/css"" href=""styles/" & Trim(name) & """ />" & vbCrLf)
next
end if
'If team themes are enabled, add the appropriate team style sheet.
if ENABLE_TEAM_THEMES then
'First check if a team theme is specified in the session. If not, check
'if one was saved in a cookie.
teamID = Session(SESSION_THEME_KEY)
if teamID = "" and Session(SESSION_USERNAME_KEY) = "" then
if Request.Cookies(SESSION_THEME_KEY) <> "" then
teamID = Request.Cookies(SESSION_THEME_KEY)
end if
end if
'If a team theme is specified, save it in a cookie and load the
'matching style sheet. Otherwise, delete the cookie.
if teamID <> "" then
Response.Cookies(SESSION_THEME_KEY) = teamID
Response.Cookies(SESSION_THEME_KEY).Expires = GetCurrentDateTime() + 30
Response.Write(vbTab & "<link rel=""stylesheet"" type=""text/css"" href=""styles/teams/" & teamID & ".css"" />" & vbCrLf)
else
Response.Cookies(SESSION_THEME_KEY).Expires = GetCurrentDateTime() - 1
end if
end if
'Add the team logos style sheet, if appropriate.
if SHOW_TEAM_LOGOS then
Response.Write(vbTab & "<link rel=""stylesheet"" type=""text/css"" href=""styles/teamLogos.css"" />" & vbCrLf)
end if
'Add the common print style sheet.
Response.Write(vbTab & "<link rel=""stylesheet"" type=""text/css"" href=""styles/print.css"" media=""print"" />" & vbCrLf)
'Add the common scripts.
Response.Write(vbTab & "<script type=""text/javascript"" src=""scripts/scriptLib.js""></script>" & vbCrLf)
Response.Write(vbTab & "<script type=""text/javascript"" src=""scripts/common.js""></script>" & vbCrLf)
'Add the scoreboard script, if appropriate.
if ENABLE_SCORES_ADDON then
Response.Write(vbTab & "<script type=""text/javascript"" src=""scripts/scoreboard.js""></script>" & vbCrLf)
end if
'Add any additional scripts specified by the caller.
list = Split(additionalScripts, ",")
if IsArray(list) then
for each name in list
Response.Write(vbTab & "<script type=""text/javascript"" src=""scripts/" & Trim(name) & """></script>" & vbCrLf)
next
end if
end sub %>
-
- Posts: 15
- Joined: Wed Aug 28, 2013 9:19 am
Re: Anyone have the code to change the "lock" times of games
So, I think if you change the line
that is in the default common.asp to
then all of the games will lock at their start time. I haven't tested it yet but I am pretty sure that is the code to change. I am going to try to test it. The section of the common.asp is below.
Code: Select all
[b][i]if Weekday(gameDateTime) = vbSunday and gameDateTime <= dateTime then[/i][/b]
Code: Select all
[b][i]if Weekday(gameDateTime) = vbTuesday and gameDateTime <= dateTime then[/i][/b]
Code: Select all
--------------------------------------------------------------------------
' Returns true if all games for the specified week are locked.
'--------------------------------------------------------------------------
function IsWeekLocked(week)
dim dateTime, rs, gameDateTime
IsWeekLocked = false
dateTime = GetCurrentDateTime()
set rs = GetGamesRecordset(week)
do while not rs.EOF
gameDateTime = CDate(rs.Fields("Date").Value & " " & rs.Fields("Time").Value)
if Weekday(gameDateTime) = vbTuesday and gameDateTime <= dateTime then
IsWeekLocked = true
exit function
end if
rs.MoveNext
loop
end function
-
- Posts: 15
- Joined: Wed Aug 28, 2013 9:19 am
Re: Anyone have the code to change the "lock" times of games
Just tested and verified that if you change the line in "/includes/common.asp" from
to
then all games for the week will lock at their scheduled start time to including Early Games, Sunday late games, and Monday night games.
Code: Select all
if Weekday(gameDateTime) = vbSunday and gameDateTime <= dateTime then
Code: Select all
if Weekday(gameDateTime) = vbTuesday and gameDateTime <= dateTime then
Re: Anyone have the code to change the "lock" times of games
Thanks Kristoffae, that is exactly what I was looking for. I knew it wasn't a hard change, but I honestly forgot where it was done.
Phil
Phil
Re: Anyone have the code to change the "lock" times of games
Last year i had changed the code for locking the games 3 hrs before the start of the first game. this locked all games. lost last years code to do it. i know i had to change the code in the common.asp file but not sure where and what. anyone have any ideas? thanks
Re: Anyone have the code to change the "lock" times of games?
Mike, just seeing your post, sorry, I have no idea.
Do you have the common.asp file from last year, can you compare it to this years and see if the line pointed out above gives you the change you are looking for from your old code?
Phil
Do you have the common.asp file from last year, can you compare it to this years and see if the line pointed out above gives you the change you are looking for from your old code?
Phil
Re: Anyone have the code to change the "lock" times of games?
all working fine, i just used the code from above and this will do. thanks