-
Notifications
You must be signed in to change notification settings - Fork 345
Ports tgui ticket panel from yogs #5906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c1b1a28
99740a0
88f44a2
3338e93
8ba125d
39fe2d9
f532706
0e3706b
dd044b6
d101862
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,10 +181,12 @@ monkestation end */ | |
qdel(W) | ||
M.regenerate_icons() | ||
|
||
log_admin("[key_name(usr)] made [key_name(M)] drop everything!") | ||
var/msg = "[key_name_admin(usr)] made [ADMIN_LOOKUPFLW(M)] drop everything!" | ||
message_admins(msg) | ||
// MONKESTATION EDIT START - tgui tickets | ||
var/msg = "[key_name(usr)] made [key_name(M)] drop everything!" | ||
log_admin(msg) | ||
message_admins("[key_name_admin(usr)] made [ADMIN_LOOKUPFLW(M)] drop everything!") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you reordering lines here, and in so many other places too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes the code a bit better, log_admin and admin_ticket_log getting the same message, w/o html tags, and then message_admins gets the tags, so I needed to move the definition of msg above the log_admin |
||
admin_ticket_log(M, msg) | ||
// MONKESTATION EDIT END | ||
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! | ||
|
||
/proc/cmd_admin_mute(whom, mute_type, automute = 0) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,7 +195,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) | |
/// If any admins were online when the ticket was initialized | ||
var/heard_by_no_admins = FALSE | ||
/// The collection of interactions with this ticket. Use AddInteraction() or, preferably, admin_ticket_log() | ||
var/list/ticket_interactions | ||
// var/list/ticket_interactions // MONKESTATION - variable removed in favor of datum _interactions | ||
/// Statclick holder for the ticket | ||
var/obj/effect/statclick/ahelp/statclick | ||
/// Static counter used for generating each ticket ID | ||
|
@@ -205,7 +205,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) | |
/// Whether this ahelp has sent a webhook or not, and what type | ||
var/webhook_sent = WEBHOOK_NONE | ||
/// List of player interactions | ||
var/list/player_interactions | ||
// var/list/player_interactions // MONKESTATION - variable removed in favor of datum _interactions | ||
/// List of admin ckeys that are involved, like through responding | ||
var/list/admins_involved = list() | ||
/// Has the player replied to this ticket yet? | ||
|
@@ -242,11 +242,12 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) | |
TimeoutVerb() | ||
|
||
statclick = new(null, src) | ||
ticket_interactions = list() | ||
player_interactions = list() | ||
// MONKESTATION START | ||
// ticket_interactions = list() | ||
// player_interactions = list() | ||
// MONKESTATION END | ||
|
||
if(is_bwoink) | ||
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>") | ||
message_admins("<font color='blue'>Ticket [TicketHref("#[id]")] created</font>") | ||
SSplexora.aticket_new(src, msg_raw, is_bwoink, urgent, usr.ckey) // monkestation edit: PLEXORA | ||
else | ||
|
@@ -359,16 +360,21 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) | |
GLOB.ahelp_tickets.resolved_tickets -= src | ||
return ..() | ||
|
||
/datum/admin_help/proc/AddInteraction(formatted_message, player_message) | ||
// MONKESTATION START | ||
/datum/admin_help/proc/AddInteraction(message, player_message, for_admins = FALSE, ckey = null) | ||
_interactions += new /datum/ticket_log(src, ckey, message, player_message, for_admins) | ||
// MONKESTATION END | ||
if (!isnull(usr) && usr.ckey != initiator_ckey) | ||
admins_involved |= usr.ckey | ||
if(heard_by_no_admins) | ||
heard_by_no_admins = FALSE | ||
send2adminchat(initiator_ckey, "Ticket #[id]: Answered by [key_name(usr)]") | ||
|
||
ticket_interactions += "[time_stamp()]: [formatted_message]" | ||
if (!isnull(player_message)) | ||
player_interactions += "[time_stamp()]: [player_message]" | ||
// MONKESTATION EDIT START - tgui tickets | ||
// ticket_interactions += "[time_stamp()]: [formatted_message]" | ||
// if (!isnull(player_message)) | ||
// player_interactions += "[time_stamp()]: [player_message]" | ||
// MONKESTATION EDIT END | ||
|
||
//Removes the ahelp verb and returns it after 2 minutes | ||
/datum/admin_help/proc/TimeoutVerb() | ||
|
@@ -421,7 +427,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) | |
<b class='smaller'>[FullMonty(ref_src)]</b>", | ||
"boxed_message red_box") | ||
|
||
AddInteraction("<font color='red'>[LinkedReplyName(ref_src)]: [msg]</font>", player_message = "<font color='red'>[LinkedReplyName(ref_src)]: [msg]</font>") | ||
AddInteraction(msg) // Monkestation edit: datum ticket interactions | ||
log_admin_private("Ticket #[id]: [key_name(initiator)]: [msg]") | ||
|
||
//send this msg to all admins | ||
|
@@ -473,7 +479,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) | |
if(initiator) | ||
initiator.current_ticket = src | ||
|
||
AddInteraction("<font color='purple'>Reopened by [key_name_admin(usr)]</font>", player_message = "Ticket reopened!") | ||
AddInteraction("Reopened by [key_name(usr)]", "Ticket reopened!") // Monkestation edit: datum ticket interactions | ||
var/msg = span_adminhelp("Ticket [TicketHref("#[id]")] reopened by [key_name_admin(usr)].") | ||
message_admins(msg) | ||
log_admin_private(msg) | ||
|
@@ -501,7 +507,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) | |
RemoveActive() | ||
state = AHELP_CLOSED | ||
GLOB.ahelp_tickets.ListInsert(src) | ||
AddInteraction("<font color='red'>Closed by [key_name].</font>", player_message = "<font color='red'>Ticket closed!</font>") | ||
AddInteraction("Closed by [key_name(usr)]", "Ticket closed") // Monkestation edit: datum ticket interactions | ||
if(!silent) | ||
SSblackbox.record_feedback("tally", "ahelp_stats", 1, "closed") | ||
var/msg = "Ticket [TicketHref("#[id]")] closed by [key_name]." | ||
|
@@ -519,7 +525,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) | |
|
||
addtimer(CALLBACK(initiator, TYPE_PROC_REF(/client, giveadminhelpverb)), 50) | ||
|
||
AddInteraction("<font color='green'>Resolved by [key_name].</font>", player_message = "<font color='green'>Ticket resolved!</font>") | ||
AddInteraction("Resolved by [key_name(usr)].", "Ticket resolved.") // Monkestation edit: datum ticket interactions | ||
to_chat(initiator, span_adminhelp("Your ticket has been resolved by an admin. The Adminhelp verb will be returned to you shortly."), confidential = TRUE) | ||
|
||
if(!silent) | ||
|
@@ -547,7 +553,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) | |
var/msg = "Ticket [TicketHref("#[id]")] rejected by [key_name]" | ||
message_admins(msg) | ||
log_admin_private(msg) | ||
AddInteraction("Rejected by [key_name].", player_message = "Ticket rejected!") | ||
AddInteraction("Rejected by [key_name(usr)].", "Ticket rejected.") // MONKESTATION EDIT - tgui tickets | ||
SSblackbox.LogAhelp(id, "Rejected", "Rejected by [usr.key]", null, usr.ckey) | ||
|
||
Close(silent = TRUE) | ||
|
@@ -567,12 +573,15 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) | |
msg = "Ticket [TicketHref("#[id]")] marked as IC by [key_name]" | ||
message_admins(msg) | ||
log_admin_private(msg) | ||
AddInteraction("Marked as IC issue by [key_name]", player_message = "Marked as IC issue!") | ||
AddInteraction("Marked as IC issue by [key_name(usr)]", "Marked as IC issue") // MONKESTATION EDIT - tgui tickets | ||
SSblackbox.LogAhelp(id, "IC Issue", "Marked as IC issue by [usr.key]", null, usr.ckey) | ||
Resolve(silent = TRUE) | ||
|
||
//Show the ticket panel | ||
/datum/admin_help/proc/TicketPanel() | ||
// MONKESTATION EDIT START | ||
ui_interact(usr) | ||
/* | ||
var/list/dat = list("<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><title>Ticket #[id]</title></head>") | ||
var/ref_src = "[REF(src)]" | ||
dat += "<h4>Admin Help Ticket #[id]: [LinkedReplyName(ref_src)]</h4>" | ||
|
@@ -603,6 +612,8 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) | |
dat += "</html>" | ||
|
||
usr << browse(dat.Join(), "window=ahelp[id];size=750x480") | ||
*/ | ||
// MONKESTATION EDIT END | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A little tip: DM supports There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its not that much easier than telling vs code to block comment, but I can see how it would make porting stuff easier, so I'll convert it to a block |
||
|
||
/** | ||
* 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) | |
Resolve() | ||
|
||
/datum/admin_help/proc/player_ticket_panel() | ||
//MONKESTATION EDIT | ||
TicketPanel() | ||
/* | ||
var/list/dat = list("<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><title>Player Ticket</title></head>") | ||
dat += "<b>State: " | ||
switch(state) | ||
|
@@ -696,6 +710,8 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) | |
var/datum/browser/player_panel = new(usr, "ahelp[id]", 0, 620, 480) | ||
player_panel.set_content(dat.Join()) | ||
player_panel.open() | ||
*/ | ||
// MONKESTATION EDIT END | ||
|
||
|
||
// | ||
|
@@ -862,31 +878,27 @@ GLOBAL_DATUM_INIT(admin_help_ui_handler, /datum/admin_help_ui_handler, new) | |
|
||
/// Use this proc when an admin takes action that may be related to an open ticket on what | ||
/// what can be a client, ckey, or mob | ||
/// player_message: If the message should be shown in the player ticket panel, fill this out | ||
/// player_message: If the players should see a different message from admins | ||
/// for_admins: If this message should be displayed only to admins, defaults to true, | ||
/// is false if player_message is set, if player_message is not set and this is false, uses message | ||
/// log_in_blackbox: Whether or not this message with the blackbox system. | ||
/// If disabled, this message should be logged with a different proc call | ||
/proc/admin_ticket_log(what, message, player_message, log_in_blackbox = TRUE) | ||
/proc/admin_ticket_log(what, message, player_message, for_admins = TRUE, log_in_blackbox = TRUE) // MONKESTATION EDIT - tgui tickets | ||
var/client/mob_client | ||
var/mob/Mob = what | ||
if(istype(Mob)) | ||
mob_client = Mob.client | ||
else | ||
mob_client = what | ||
if(istype(mob_client) && mob_client.current_ticket) | ||
if (isnull(player_message)) | ||
mob_client.current_ticket.AddInteraction(message) | ||
else | ||
mob_client.current_ticket.AddInteraction(message, player_message) | ||
mob_client.current_ticket.AddInteraction(message, player_message, for_admins) // MONKESTATION EDIT - tgui tickets | ||
if(log_in_blackbox) | ||
SSblackbox.LogAhelp(mob_client.current_ticket.id, "Interaction", message, mob_client.ckey, usr.ckey) | ||
return mob_client.current_ticket | ||
if(istext(what)) //ckey | ||
var/datum/admin_help/active_admin_help = GLOB.ahelp_tickets.CKey2ActiveTicket(what) | ||
if(active_admin_help) | ||
if (isnull(player_message)) | ||
active_admin_help.AddInteraction(message) | ||
else | ||
active_admin_help.AddInteraction(message, player_message) | ||
active_admin_help.AddInteraction(message, player_message, for_admins) // MONKESTATION EDIT - tgui tickets | ||
if(log_in_blackbox) | ||
SSblackbox.LogAhelp(active_admin_help.id, "Interaction", message, what, usr.ckey) | ||
return active_admin_help | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would highly recommend commenting out these lines of code, instead of removing them. It makes porting efforts easier.