Add admin pencode: style, class, and img

This commit is contained in:
Tayyyyyyy
2019-08-12 09:47:59 -07:00
parent dc72550d87
commit 48c002b361
5 changed files with 36 additions and 4 deletions
+29
View File
@@ -545,6 +545,35 @@ proc/checkhtml(var/t)
text = copytext(text, 1, MAX_PAPER_MESSAGE_LEN)
return text
/proc/convert_pencode_arg(text, tag, arg)
arg = replacetext(replacetext(html_encode(arg), "'", ""), "\"", "")
if(tag == "class")
return "<span class='[arg]'>"
if(tag == "style")
return "<span style='[arg]'>"
if(tag == "img")
var/list/img_props = splittext(arg, ";")
if(img_props.len == 3)
return "<img src='[img_props[1]]' width='[img_props[2]]' height='[img_props[3]]'>"
if(img_props.len == 2)
return "<img src='[img_props[1]]' width='[img_props[2]]'>"
return "<img src='[arg]'>"
return text
/proc/admin_pencode_to_html()
var/text = pencode_to_html(arglist(args))
var/regex/R = new(@"\[(.*?) (.*?)\]", "ge")
text = R.Replace(text, /proc/convert_pencode_arg)
text = replacetext(text, "\[/class\]", "</span>")
text = replacetext(text, "\[/style\]", "</span>")
text = replacetext(text, "\[/img\]", "</img>")
return text
/proc/html_to_pencode(text)
text = replacetext(text, "<BR>", "\n")
text = replacetext(text, "<center>", "\[center\]")
+1 -1
View File
@@ -642,7 +642,7 @@ var/list/admin_verbs_ticket = list(
if(!message)
return
for(var/mob/V in hearers(O))
V.show_message(message, 2)
V.show_message(admin_pencode_to_html(message), 2)
log_admin("[key_name(usr)] made [O] at [O.x], [O.y], [O.z] make a sound")
message_admins("<span class='notice'>[key_name_admin(usr)] made [O] at [O.x], [O.y], [O.z] make a sound</span>")
feedback_add_details("admin_verb","MS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
+1 -1
View File
@@ -2181,7 +2181,7 @@
if(!input)
qdel(P)
return
input = P.parsepencode(input) // Encode everything from pencode to html
input = admin_pencode_to_html(html_encode(input)) // Encode everything from pencode to html
var/customname = clean_input("Pick a title for the fax.", "Fax Title", , owner)
if(!customname)
+1 -1
View File
@@ -110,7 +110,7 @@
if(!msg)
return
else
msg = pencode_to_html(msg)
msg = admin_pencode_to_html(msg)
var/recieve_span = "playerreply"
var/send_pm_type = " "
+4 -1
View File
@@ -58,6 +58,9 @@
if(!msg)
return
msg = admin_pencode_to_html(msg)
if(usr)
if(usr.client)
if(usr.client.holder)
@@ -136,7 +139,7 @@
if( !msg )
return
msg = pencode_to_html(msg)
msg = admin_pencode_to_html(msg)
to_chat(M, msg)
log_admin("DirectNarrate: [key_name(usr)] to ([key_name(M)]): [msg]")