From c56974f2e8ba65ba9d6c3fd0db35c68e85a1295e Mon Sep 17 00:00:00 2001 From: cib Date: Sun, 9 Dec 2012 16:04:43 +0100 Subject: [PATCH] Fixes issue #2043 Player notes list now has a better organized interface, which should prevent BYOND overloading and dying a gruesome death. --- code/modules/admin/admin.dm | 31 +++++++++++++++++++++++++++---- code/modules/admin/holder2.dm | 2 ++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 35c600dcd53..74c27f30e2f 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -173,10 +173,11 @@ var/global/floorIsLava = 0 /datum/player_info/var/content // text content of the information /datum/player_info/var/timestamp // Because this is bloody annoying -/datum/admins/proc/PlayerNotes() +#define PLAYER_NOTES_ENTRIES_PER_PAGE 50 +/datum/admins/proc/PlayerNotes(var/page = 1) set category = "Admin" set name = "Player Notes" - var/dat = "Player notes
" + var/dat = "Player notes
" if (!istype(src,/datum/admins)) src = usr.client.holder if (!istype(src,/datum/admins)) @@ -189,10 +190,32 @@ var/global/floorIsLava = 0 if(!note_keys) dat += "No notes found." else + dat += "
" sortList(note_keys) - for(var/t in note_keys) + + // Display the notes on the current page + var/number_pages = note_keys.len / PLAYER_NOTES_ENTRIES_PER_PAGE + var/page_index = page - 1 + if(page_index < 0 || page_index >= number_pages) + return + + for(var/index = page_index * PLAYER_NOTES_ENTRIES_PER_PAGE + 1, \ + index <= (page_index + 1) * PLAYER_NOTES_ENTRIES_PER_PAGE, \ + index++) + + var/t = note_keys[index] dat += "" - dat += "
[t]
" + + dat += "
" + + // Display a footer to select different pages + for(var/index = 1, index <= number_pages, index++) + if(index == page) + dat += "" + dat += "[index] " + if(index == page) + dat += "" + usr << browse(dat, "window=player_notes;size=400x400") diff --git a/code/modules/admin/holder2.dm b/code/modules/admin/holder2.dm index 96bc9b6e20c..3d2c506ae48 100644 --- a/code/modules/admin/holder2.dm +++ b/code/modules/admin/holder2.dm @@ -2706,4 +2706,6 @@ var/list/admin_datums = list() switch(href_list["notes"]) if("show") show_player_info(ckey) + if("list") + PlayerNotes(href_list["index"]) return