aboutsummaryrefslogtreecommitdiff
path: root/captain
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-06-23 13:09:15 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2021-06-23 13:09:15 -0400
commit3d7696972f5025be9612f87c0fe4203e0859641e (patch)
tree3c4b25674ec4a9c6a42681e474b1f258be6130f2 /captain
parentd6f9ce81e4fd27c94cf656699ef4952956dff608 (diff)
downloadlevitating-3d7696972f5025be9612f87c0fe4203e0859641e.tar.gz
levitating-3d7696972f5025be9612f87c0fe4203e0859641e.zip
Single Player pages now rendered in html. Need to actually connect token assignment form.
Diffstat (limited to 'captain')
-rw-r--r--captain/web.f9047
1 files changed, 44 insertions, 3 deletions
diff --git a/captain/web.f90 b/captain/web.f90
index ea3127e..c18848e 100644
--- a/captain/web.f90
+++ b/captain/web.f90
@@ -564,10 +564,17 @@ contains
type(request), intent(in)::req
character(len=:), pointer::res
- character(len=PLAYER_NAME_LENGTH)::player_name
- integer::n, pid
+ character(len=PLAYER_NAME_LENGTH)::player_name, instruction_name
+ character(len=:), pointer::one_link
+ integer::i, n, pid
+ integer, dimension(8)::values
+ integer, dimension(:), pointer::instruction_ids
+
+ character(len=64)::dateconvert
call req%last_component(player_name)
+ i = index(player_name, '.html')
+ player_name = player_name(1:i-1)
pid = get_player_id(trim(player_name))
n = get_instructions_count(player=pid)
@@ -576,12 +583,38 @@ contains
res = "<h2>"//trim(player_name)//"</h2>"
! Last checkin
+ call get_last_checkin_time(pid, values)
+ write(dateconvert, '(I4,A1,I0.2,A1,I0.2,3X,I2,A1,I0.2,A1,I0.2)') &
+ values(1), '-', values(2), '-', values(3), &
+ values(5), ':', values(6), ':', values(7)
+ res = trim(res)//new_line(' ')//'<p><em>Last Checkin: <strong>'//trim(dateconvert)//&
+ '</strong></em></p>'
! List of instructions
+ res = trim(res)//new_line(' ')//"<h3>Instructions for "//trim(player_name)//"</h3>"
+ instruction_ids => get_instruction_ids(player=pid)
+ if(associated(instruction_ids)) then
+ res = trim(res)//new_line(' ')//"<ul>"
+ do i = 1, n
+ call get_instruction_name(instruction_ids(i), instruction_name)
+ one_link => html_link("../instructions/"//trim(instruction_name)//".html", trim(instruction_name))
+ res = trim(res)//new_line(' ')//" <li>"//one_link//"</li>"
+ deallocate(one_link)
+ end do
+ res = trim(res)//new_line(' ')//"</ul>"
+ deallocate(instruction_ids)
+ else
+ res = trim(res)//"<p>None Yet</p>"
+ end if
! Token assignment
-
+ res = trim(res)//new_line(' ')//"<h3>Security</h3>"//new_line(' ')// &
+ '<form action="assign_token.html" method="POST">'//new_line(' ')// &
+ '<label for="token">Token:</label>'// &
+ '<input name="token" id="token" />'//new_line(' ')// &
+ '<input type="hidden" name="player" id="player" value="'//trim(player_name)//'"/>'//new_line(' ')// &
+ '<input type="submit" value="Set"/></form>'
end function generate_one_player_html
@@ -857,6 +890,7 @@ contains
character(len=:), pointer::contents
character(128)::job_page_title
+ integer::i
if(trim(req%location) == "/" .or. &
trim(req%location) == "/index.html" .or. &
@@ -907,6 +941,13 @@ contains
call page%assign('contents', contents)
else if(req%location(1:9) == '/players/') then
+
+ call req%last_component(job_page_title)
+ i = index(job_page_title, '.', back=.true.)
+
+ call page%assign('title', job_page_title(1:i-1))
+ contents => generate_one_player_html(req)
+ call page%assign('contents', contents)
else if(trim(req%location) == "/about.html") then