diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 0487958560..43a12bdacc 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -218,7 +218,6 @@ var/global/floorIsLava = 0 /datum/player_info/var/content // text content of the information /datum/player_info/var/timestamp // Because this is bloody annoying -#define PLAYER_NOTES_ENTRIES_PER_PAGE 50 /datum/admins/proc/PlayerNotes() set category = "Admin" set name = "Player Notes" @@ -239,7 +238,6 @@ var/global/floorIsLava = 0 PlayerNotesPage(1, filter) /datum/admins/proc/PlayerNotesPage(page, filter) - var/dat = "Player notes - Apply Filter
" var/savefile/S=new("data/player_notes.sav") var/list/note_keys S >> note_keys @@ -247,39 +245,6 @@ var/global/floorIsLava = 0 if(note_keys) note_keys = sortList(note_keys) - if(filter) - var/list/results = list() - var/regex/needle = regex(filter, "i") - for(var/haystack in note_keys) - if(needle.Find(haystack)) - results += haystack - note_keys = results - - // Display the notes on the current page - var/number_pages = note_keys.len / PLAYER_NOTES_ENTRIES_PER_PAGE - // Emulate CEILING(why does BYOND not have ceil, 1) - if(number_pages != round(number_pages)) - number_pages = round(number_pages) + 1 - var/page_index = page - 1 - - if(page_index < 0 || page_index >= number_pages) - dat += "No keys found." - else - var/lower_bound = page_index * PLAYER_NOTES_ENTRIES_PER_PAGE + 1 - var/upper_bound = (page_index + 1) * PLAYER_NOTES_ENTRIES_PER_PAGE - upper_bound = min(upper_bound, note_keys.len) - for(var/index = lower_bound, index <= upper_bound, index++) - var/t = note_keys[index] - dat += "[t]" - - // 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 += "" - var/datum/tgui_module/player_notes/A = new(src) A.ckeys = note_keys A.tgui_interact(usr) diff --git a/code/modules/tgui/modules/admin/player_notes.dm b/code/modules/tgui/modules/admin/player_notes.dm index b9f05cc0a7..ef0b76af9e 100644 --- a/code/modules/tgui/modules/admin/player_notes.dm +++ b/code/modules/tgui/modules/admin/player_notes.dm @@ -1,3 +1,5 @@ +//#define PLAYER_NOTES_ENTRIES_PER_PAGE 50 + /datum/tgui_module/player_notes name = "Player Notes" tgui_id = "PlayerNotes" @@ -19,14 +21,54 @@ if("filter_player_notes") var/filter = tgui_input_text(usr, "Filter string (case-insensitive regex)", "Player notes filter") + var/savefile/S=new("data/player_notes.sav") + var/list/note_keys + var/page = 1 + + S >> note_keys + + if(note_keys) + note_keys = sortList(note_keys) + + if(filter) + var/list/results = list() + var/regex/needle = regex(filter, "i") + for(var/haystack in note_keys) + if(needle.Find(haystack)) + results += haystack + note_keys = results + + // Display the notes on the current page + //var/number_pages = note_keys.len / PLAYER_NOTES_ENTRIES_PER_PAGE + // Emulate CEILING(why does BYOND not have ceil, 1) + //if(number_pages != round(number_pages)) + // number_pages = round(number_pages) + 1 + //var/page_index = page - 1 + + //if(page_index < 0 || page_index >= number_pages) + // //dat += "No keys found." + //else + //var/lower_bound = page_index * PLAYER_NOTES_ENTRIES_PER_PAGE + 1 + //var/upper_bound = (page_index + 1) * PLAYER_NOTES_ENTRIES_PER_PAGE + //upper_bound = min(upper_bound, note_keys.len) + //for(var/index = lower_bound, index <= upper_bound, index++) + //var/t = note_keys[index] + + // 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 += "" + + ckeys = note_keys /datum/tgui_module/player_notes/tgui_data(mob/user) var/list/data = list() data["ckeys"] = list() - // LOAD ALL THE CKEYS (with filter too and page number!) - for(var/ckey in ckeys) data["ckeys"] += list(list( "name" = ckey diff --git a/tgui/packages/tgui/interfaces/PlayerNotesInfo.js b/tgui/packages/tgui/interfaces/PlayerNotesInfo.js index 9c5025d977..c3ad2efe0c 100644 --- a/tgui/packages/tgui/interfaces/PlayerNotesInfo.js +++ b/tgui/packages/tgui/interfaces/PlayerNotesInfo.js @@ -27,8 +27,8 @@ export const PlayerNotesInfo = (props, context) => { collapsing={false}> - Written by {entry.author} on {entry.date}
- "{entry.comment}" + Written by {entry.author} on {entry.date}
+ "{entry.comment}"