Skip to content

Commit 8e53da3

Browse files
authored
Ports tgui ticket panel from yogs (#5906)
1 parent 4c17049 commit 8e53da3

File tree

34 files changed

+1083
-110
lines changed

34 files changed

+1083
-110
lines changed

code/modules/admin/sql_message_system.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@
9494
VALUES (:type, :target_ckey, :admin_ckey, :text, [timestamp? ":timestamp" : "Now()"], :server, INET_ATON(:internet_address), :port, :round_id, :secret, :expiry, :note_severity, (SELECT `minutes` FROM [format_table_name("role_time")] WHERE `ckey` = :target_ckey AND `job` = 'Living'))
9595
"}, parameters)
9696
var/pm = "[key_name(usr)] has created a [type][(type == "note" || type == "message" || type == "watchlist entry") ? " for [target_key]" : ""]: [text]"
97-
var/header = "[key_name_admin(usr)] has created a [type][(type == "note" || type == "message" || type == "watchlist entry") ? " for [target_key]" : ""]"
97+
var/header = "[key_name(usr)] has created a [type][(type == "note" || type == "message" || type == "watchlist entry") ? " for [target_key]" : ""]"
9898
if(!query_create_message.warn_execute())
9999
qdel(query_create_message)
100100
return
101101
qdel(query_create_message)
102102
if(logged)
103103
log_admin_private(pm)
104104
message_admins("[header]:<br>[text]")
105-
admin_ticket_log(target_ckey, "<font color='blue'>[header]</font><br>[text]")
105+
admin_ticket_log(target_ckey, "[header]: [text]")
106106
// Monkestation edit start - plexora
107107
var/datum/client_interface/mock_player = new(target_ckey)
108108
mock_player.prefs = new /datum/preferences(mock_player)

code/modules/admin/topic.dm

+6
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,10 @@
786786

787787
else if(href_list["adminmoreinfo"])
788788
var/mob/subject = locate(href_list["adminmoreinfo"]) in GLOB.mob_list
789+
// MONKESTATION START
790+
// Moved to monkestation/code/modules/admin/admin.dm
791+
adminmoreinfo(subject)
792+
/*
789793
if(!ismob(subject))
790794
to_chat(usr, "This can only be used on instances of type /mob.", confidential = TRUE)
791795
return
@@ -860,6 +864,8 @@
860864
exportable_text += ADMIN_FULLMONTY_NONAME(subject)
861865
862866
to_chat(src.owner, boxed_message(exportable_text), confidential = TRUE)
867+
*/
868+
// MONKESTATION END
863869

864870
else if(href_list["addjobslot"])
865871
if(!check_rights(R_ADMIN))

code/modules/admin/verbs/admin.dm

+5-3
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,12 @@ monkestation end */
181181
qdel(W)
182182
M.regenerate_icons()
183183

184-
log_admin("[key_name(usr)] made [key_name(M)] drop everything!")
185-
var/msg = "[key_name_admin(usr)] made [ADMIN_LOOKUPFLW(M)] drop everything!"
186-
message_admins(msg)
184+
// MONKESTATION EDIT START - tgui tickets
185+
var/msg = "[key_name(usr)] made [key_name(M)] drop everything!"
186+
log_admin(msg)
187+
message_admins("[key_name_admin(usr)] made [ADMIN_LOOKUPFLW(M)] drop everything!")
187188
admin_ticket_log(M, msg)
189+
// MONKESTATION EDIT END
188190
SSblackbox.record_feedback("tally", "admin_verb", 1, "Drop Everything") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
189191

190192
/proc/cmd_admin_mute(whom, mute_type, automute = 0)

code/modules/admin/verbs/adminevents.dm

+10-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@
2121
M.balloon_alert(M, "you hear a voice")
2222
to_chat(M, "<i>You hear a voice in your head... <b>[msg]</i></b>", confidential = TRUE)
2323

24-
log_admin("SubtlePM: [key_name(usr)] -> [key_name(M)] : [msg]")
24+
// MONKESTATION EDIT START - tgui tickets
25+
var/log_message = "SubtlePM: [key_name(usr)] -> [key_name(M)] : [msg]"
26+
log_admin(log_message)
27+
// MONKESTATION EDIT END
2528
msg = span_adminnotice("<b> SubtleMessage: [key_name_admin(usr)] -> [key_name_admin(M)] :</b> [msg]")
2629
message_admins(msg)
27-
admin_ticket_log(M, msg)
30+
admin_ticket_log(M, log_message) // MONKESTATION EDIT - tgui tickets
2831
SSblackbox.record_feedback("tally", "admin_verb", 1, "Subtle Message") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
2932

3033
/client/proc/cmd_admin_headset_message(mob/M in GLOB.mob_list)
@@ -129,10 +132,13 @@
129132
return
130133

131134
to_chat(M, msg, confidential = TRUE)
132-
log_admin("DirectNarrate: [key_name(usr)] to ([M.name]/[M.key]): [msg]")
135+
// MONKESTATION EDIT START - tgui tickets
136+
var/log_msg = "DirectNarrate: [key_name(usr)] to ([M.name]/[M.key]): [msg]"
137+
log_admin(log_msg)
138+
// MONKESTATION EDIT END
133139
msg = span_adminnotice("<b> DirectNarrate: [key_name(usr)] to ([M.name]/[M.key]):</b> [msg]<BR>")
134140
message_admins(msg)
135-
admin_ticket_log(M, msg)
141+
admin_ticket_log(M, log_msg) // MONKESTATION EDIT - tgui tickets
136142
SSblackbox.record_feedback("tally", "admin_verb", 1, "Direct Narrate") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
137143

138144
/client/proc/cmd_admin_add_freeform_ai_law()

code/modules/admin/verbs/adminfun.dm

+5-3
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@
250250
divine_wrath.fire()
251251

252252
/client/proc/punish_log(whom, punishment)
253-
var/msg = "[key_name_admin(src)] punished [key_name_admin(whom)] with [punishment]."
254-
message_admins(msg)
253+
// MONKESTATION EDIT START - tgui tickets
254+
var/msg = "[key_name(src)] punished [key_name(whom)] with [punishment]."
255+
message_admins("[key_name_admin(src)] punished [key_name_admin(whom)] with [punishment].")
256+
log_admin(msg)
255257
admin_ticket_log(whom, msg)
256-
log_admin("[key_name(src)] punished [key_name(whom)] with [punishment].")
258+
// MONKESTATION EDIT END

code/modules/admin/verbs/admingame.dm

+6-3
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,13 @@
172172
ADD_TRAIT(mob, TRAIT_GODMODE, ADMIN_TRAIT)
173173
to_chat(usr, span_adminnotice("Toggled [had_trait ? "OFF" : "ON"]"), confidential = TRUE)
174174

175-
log_admin("[key_name(usr)] has toggled [key_name(mob)]'s nodamage to [had_trait ? "Off" : "On"]")
175+
// MONKESTATION EDIT START - tgui tickets
176+
var/log_msg = "[key_name(usr)] has toggled [key_name(mob)]'s nodamage to [had_trait ? "Off" : "On"]"
177+
log_admin()
176178
var/msg = "[key_name_admin(usr)] has toggled [ADMIN_LOOKUPFLW(mob)]'s nodamage to [had_trait ? "Off" : "On"]"
177179
message_admins(msg)
178-
admin_ticket_log(mob, msg)
180+
admin_ticket_log(mob, log_msg)
181+
// MONKESTATION EDIT END
179182
SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Godmode", "[had_trait ? "Disabled" : "Enabled"]")) // If you are copy-pasting this, ensure the 4th parameter is unique to the new proc!
180183

181184
/*
@@ -215,7 +218,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
215218
to_chat(new_monkey, "You have been fully respawned. Enjoy the game.", confidential = TRUE)
216219
var/msg = span_adminnotice("[key_name_admin(usr)] has respawned [new_monkey.key] as a filthy monkey.")
217220
message_admins(msg)
218-
admin_ticket_log(new_monkey, msg)
221+
admin_ticket_log(new_monkey, "[key_name(usr)] has respawned [new_monkey.key] as a filthy monkey.") // MONKESTATION EDIT - tgui tickets
219222
return //all done. The ghost is auto-deleted
220223

221224

code/modules/admin/verbs/adminhelp.dm

+37-25
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
195195
/// If any admins were online when the ticket was initialized
196196
var/heard_by_no_admins = FALSE
197197
/// The collection of interactions with this ticket. Use AddInteraction() or, preferably, admin_ticket_log()
198-
var/list/ticket_interactions
198+
// var/list/ticket_interactions // MONKESTATION - variable removed in favor of datum _interactions
199199
/// Statclick holder for the ticket
200200
var/obj/effect/statclick/ahelp/statclick
201201
/// Static counter used for generating each ticket ID
@@ -205,7 +205,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
205205
/// Whether this ahelp has sent a webhook or not, and what type
206206
var/webhook_sent = WEBHOOK_NONE
207207
/// List of player interactions
208-
var/list/player_interactions
208+
// var/list/player_interactions // MONKESTATION - variable removed in favor of datum _interactions
209209
/// List of admin ckeys that are involved, like through responding
210210
var/list/admins_involved = list()
211211
/// Has the player replied to this ticket yet?
@@ -242,11 +242,12 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
242242
TimeoutVerb()
243243

244244
statclick = new(null, src)
245-
ticket_interactions = list()
246-
player_interactions = list()
245+
// MONKESTATION START
246+
// ticket_interactions = list()
247+
// player_interactions = list()
248+
// MONKESTATION END
247249

248250
if(is_bwoink)
249-
AddInteraction("<font color='blue'>[key_name_admin(usr)] PM'd [LinkedReplyName()]</font>", player_message = "<font color='blue'>[key_name_admin(usr, include_name = FALSE)] PM'd [LinkedReplyName()]</font>")
250251
message_admins("<font color='blue'>Ticket [TicketHref("#[id]")] created</font>")
251252
SSplexora.aticket_new(src, msg_raw, is_bwoink, urgent, usr.ckey) // monkestation edit: PLEXORA
252253
else
@@ -359,16 +360,21 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
359360
GLOB.ahelp_tickets.resolved_tickets -= src
360361
return ..()
361362

362-
/datum/admin_help/proc/AddInteraction(formatted_message, player_message)
363+
// MONKESTATION START
364+
/datum/admin_help/proc/AddInteraction(message, player_message, for_admins = FALSE, ckey = null)
365+
_interactions += new /datum/ticket_log(src, ckey, message, player_message, for_admins)
366+
// MONKESTATION END
363367
if (!isnull(usr) && usr.ckey != initiator_ckey)
364368
admins_involved |= usr.ckey
365369
if(heard_by_no_admins)
366370
heard_by_no_admins = FALSE
367371
send2adminchat(initiator_ckey, "Ticket #[id]: Answered by [key_name(usr)]")
368372

369-
ticket_interactions += "[time_stamp()]: [formatted_message]"
370-
if (!isnull(player_message))
371-
player_interactions += "[time_stamp()]: [player_message]"
373+
// MONKESTATION EDIT START - tgui tickets
374+
// ticket_interactions += "[time_stamp()]: [formatted_message]"
375+
// if (!isnull(player_message))
376+
// player_interactions += "[time_stamp()]: [player_message]"
377+
// MONKESTATION EDIT END
372378

373379
//Removes the ahelp verb and returns it after 2 minutes
374380
/datum/admin_help/proc/TimeoutVerb()
@@ -421,7 +427,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
421427
<b class='smaller'>[FullMonty(ref_src)]</b>",
422428
"boxed_message red_box")
423429

424-
AddInteraction("<font color='red'>[LinkedReplyName(ref_src)]: [msg]</font>", player_message = "<font color='red'>[LinkedReplyName(ref_src)]: [msg]</font>")
430+
AddInteraction(msg) // Monkestation edit: datum ticket interactions
425431
log_admin_private("Ticket #[id]: [key_name(initiator)]: [msg]")
426432

427433
//send this msg to all admins
@@ -473,7 +479,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
473479
if(initiator)
474480
initiator.current_ticket = src
475481

476-
AddInteraction("<font color='purple'>Reopened by [key_name_admin(usr)]</font>", player_message = "Ticket reopened!")
482+
AddInteraction("Reopened by [key_name(usr)]", "Ticket reopened!") // Monkestation edit: datum ticket interactions
477483
var/msg = span_adminhelp("Ticket [TicketHref("#[id]")] reopened by [key_name_admin(usr)].")
478484
message_admins(msg)
479485
log_admin_private(msg)
@@ -501,7 +507,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
501507
RemoveActive()
502508
state = AHELP_CLOSED
503509
GLOB.ahelp_tickets.ListInsert(src)
504-
AddInteraction("<font color='red'>Closed by [key_name].</font>", player_message = "<font color='red'>Ticket closed!</font>")
510+
AddInteraction("Closed by [key_name(usr)]", "Ticket closed") // Monkestation edit: datum ticket interactions
505511
if(!silent)
506512
SSblackbox.record_feedback("tally", "ahelp_stats", 1, "closed")
507513
var/msg = "Ticket [TicketHref("#[id]")] closed by [key_name]."
@@ -519,7 +525,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
519525

520526
addtimer(CALLBACK(initiator, TYPE_PROC_REF(/client, giveadminhelpverb)), 50)
521527

522-
AddInteraction("<font color='green'>Resolved by [key_name].</font>", player_message = "<font color='green'>Ticket resolved!</font>")
528+
AddInteraction("Resolved by [key_name(usr)].", "Ticket resolved.") // Monkestation edit: datum ticket interactions
523529
to_chat(initiator, span_adminhelp("Your ticket has been resolved by an admin. The Adminhelp verb will be returned to you shortly."), confidential = TRUE)
524530

525531
if(!silent)
@@ -547,7 +553,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
547553
var/msg = "Ticket [TicketHref("#[id]")] rejected by [key_name]"
548554
message_admins(msg)
549555
log_admin_private(msg)
550-
AddInteraction("Rejected by [key_name].", player_message = "Ticket rejected!")
556+
AddInteraction("Rejected by [key_name(usr)].", "Ticket rejected.") // MONKESTATION EDIT - tgui tickets
551557
SSblackbox.LogAhelp(id, "Rejected", "Rejected by [usr.key]", null, usr.ckey)
552558

553559
Close(silent = TRUE)
@@ -567,12 +573,15 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
567573
msg = "Ticket [TicketHref("#[id]")] marked as IC by [key_name]"
568574
message_admins(msg)
569575
log_admin_private(msg)
570-
AddInteraction("Marked as IC issue by [key_name]", player_message = "Marked as IC issue!")
576+
AddInteraction("Marked as IC issue by [key_name(usr)]", "Marked as IC issue") // MONKESTATION EDIT - tgui tickets
571577
SSblackbox.LogAhelp(id, "IC Issue", "Marked as IC issue by [usr.key]", null, usr.ckey)
572578
Resolve(silent = TRUE)
573579

574580
//Show the ticket panel
575581
/datum/admin_help/proc/TicketPanel()
582+
// MONKESTATION EDIT START
583+
ui_interact(usr)
584+
/*
576585
var/list/dat = list("<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><title>Ticket #[id]</title></head>")
577586
var/ref_src = "[REF(src)]"
578587
dat += "<h4>Admin Help Ticket #[id]: [LinkedReplyName(ref_src)]</h4>"
@@ -603,6 +612,8 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
603612
dat += "</html>"
604613
605614
usr << browse(dat.Join(), "window=ahelp[id];size=750x480")
615+
*/
616+
// MONKESTATION EDIT END
606617

607618
/**
608619
* Renders the current status of the ticket into a displayable string
@@ -673,6 +684,9 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
673684
Resolve()
674685

675686
/datum/admin_help/proc/player_ticket_panel()
687+
//MONKESTATION EDIT
688+
TicketPanel()
689+
/*
676690
var/list/dat = list("<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><title>Player Ticket</title></head>")
677691
dat += "<b>State: "
678692
switch(state)
@@ -696,6 +710,8 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
696710
var/datum/browser/player_panel = new(usr, "ahelp[id]", 0, 620, 480)
697711
player_panel.set_content(dat.Join())
698712
player_panel.open()
713+
*/
714+
// MONKESTATION EDIT END
699715

700716

701717
//
@@ -862,31 +878,27 @@ GLOBAL_DATUM_INIT(admin_help_ui_handler, /datum/admin_help_ui_handler, new)
862878

863879
/// Use this proc when an admin takes action that may be related to an open ticket on what
864880
/// what can be a client, ckey, or mob
865-
/// player_message: If the message should be shown in the player ticket panel, fill this out
881+
/// player_message: If the players should see a different message from admins
882+
/// for_admins: If this message should be displayed only to admins, defaults to true,
883+
/// is false if player_message is set, if player_message is not set and this is false, uses message
866884
/// log_in_blackbox: Whether or not this message with the blackbox system.
867885
/// If disabled, this message should be logged with a different proc call
868-
/proc/admin_ticket_log(what, message, player_message, log_in_blackbox = TRUE)
886+
/proc/admin_ticket_log(what, message, player_message, for_admins = TRUE, log_in_blackbox = TRUE) // MONKESTATION EDIT - tgui tickets
869887
var/client/mob_client
870888
var/mob/Mob = what
871889
if(istype(Mob))
872890
mob_client = Mob.client
873891
else
874892
mob_client = what
875893
if(istype(mob_client) && mob_client.current_ticket)
876-
if (isnull(player_message))
877-
mob_client.current_ticket.AddInteraction(message)
878-
else
879-
mob_client.current_ticket.AddInteraction(message, player_message)
894+
mob_client.current_ticket.AddInteraction(message, player_message, for_admins) // MONKESTATION EDIT - tgui tickets
880895
if(log_in_blackbox)
881896
SSblackbox.LogAhelp(mob_client.current_ticket.id, "Interaction", message, mob_client.ckey, usr.ckey)
882897
return mob_client.current_ticket
883898
if(istext(what)) //ckey
884899
var/datum/admin_help/active_admin_help = GLOB.ahelp_tickets.CKey2ActiveTicket(what)
885900
if(active_admin_help)
886-
if (isnull(player_message))
887-
active_admin_help.AddInteraction(message)
888-
else
889-
active_admin_help.AddInteraction(message, player_message)
901+
active_admin_help.AddInteraction(message, player_message, for_admins) // MONKESTATION EDIT - tgui tickets
890902
if(log_in_blackbox)
891903
SSblackbox.LogAhelp(active_admin_help.id, "Interaction", message, what, usr.ckey)
892904
return active_admin_help

code/modules/admin/verbs/adminjump.dm

+11-5
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
var/turf/location = get_turf(new_location)
124124
var/msg = "[key_name_admin(usr)] teleported [ADMIN_LOOKUPFLW(src)] to [isnull(new_location) ? "nullspace" : ADMIN_VERBOSEJMP(location)]"
125125
message_admins(msg)
126-
admin_ticket_log(src, msg)
126+
admin_ticket_log(src, "[key_name(usr)] teleported [src] to [isnull(new_location) ? "nullspace" : location]") // MONKESTATION EDIT - tgui tickets
127127
return ..()
128128

129129

@@ -146,10 +146,13 @@
146146

147147
if(!M)
148148
return
149-
log_admin("[key_name(usr)] teleported [key_name(M)]")
149+
// MONKESTATION EDIT START - tgui tickets
150+
var/log_msg = "[key_name(usr)] teleported [key_name(M)]"
151+
log_admin(log_msg)
150152
var/msg = "[key_name_admin(usr)] teleported [ADMIN_LOOKUPFLW(M)]"
151153
message_admins(msg)
152-
admin_ticket_log(M, msg)
154+
admin_ticket_log(M, log_msg)
155+
// MONKESTATION EDIT END
153156
if(M)
154157
M.forceMove(get_turf(usr))
155158
usr.forceMove(M.loc)
@@ -172,10 +175,13 @@
172175
return
173176
var/list/turfs = get_area_turfs(target_area)
174177
if(length(turfs) && jumper.forceMove(pick(turfs)))
175-
log_admin("[key_name(usr)] teleported [key_name(jumper)] to [AREACOORD(jumper)]")
178+
// MONKESTATION EDIT START - tgui tickets
179+
var/log_msg = "[key_name(usr)] teleported [key_name(jumper)] to [AREACOORD(jumper)]"
180+
log_admin(log_msg)
176181
var/msg = "[key_name_admin(usr)] teleported [ADMIN_LOOKUPFLW(jumper)] to [AREACOORD(jumper)]"
177182
message_admins(msg)
178-
admin_ticket_log(jumper, msg)
183+
admin_ticket_log(jumper, log_msg)
184+
// MONKESTATION EDIT END
179185
else
180186
to_chat(src, "Failed to move mob to a valid location.", confidential = TRUE)
181187
SSblackbox.record_feedback("tally", "admin_verb", 1, "Send Mob") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!

0 commit comments

Comments
 (0)