mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-09 07:54:14 +00:00
Add Note severity and changes UI of administrative notes (#39808)
* Adds note_severity and updates dbconfig. New SQL stuff too. * whoops please don't hack into my database >:^( * UI change, changed how it's stored in the DB, removed some queries when it returns, changed stuff to key. * Update sql_message_system.dm * this was not defined * random indent * wait how did this get here * okay enough web edits I promise * just kidding I got u * Update common.css * Added buttons, changed UI again, standardized the inputs, added severity for appearance bans, fed the dog * forgot about the banning panel * added an asset cache * corrects asset datum var name
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
Any time you make a change to the schema files, remember to increment the database schema version. Generally increment the minor number, major should be reserved for significant changes to the schema. Both values go up to 255.
|
||||
|
||||
The latest database version is 4.6; The query to update the schema revision table is:
|
||||
The latest database version is 4.7; The query to update the schema revision table is:
|
||||
|
||||
INSERT INTO `schema_revision` (`major`, `minor`) VALUES (4, 6);
|
||||
INSERT INTO `schema_revision` (`major`, `minor`) VALUES (4, 7);
|
||||
or
|
||||
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (4, 6);
|
||||
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (4, 7);
|
||||
|
||||
In any query remember to add a prefix to the table names if you use one.
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Version 4.7, 18 August 2018, by CitrusGender
|
||||
Modified table `messages`, adding column `severity` to classify notes based on their severity.
|
||||
|
||||
ALTER TABLE `messages` ADD `severity` enum('high','medium','minor','none') DEFAULT NULL AFTER `expire_timestamp`
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Version 4.6, 11 August 2018, by Jordie0608
|
||||
Modified table `messages`, adding column `expire_timestamp` to allow for auto-"deleting" messages.
|
||||
|
||||
|
||||
@@ -254,6 +254,7 @@ CREATE TABLE `messages` (
|
||||
`round_id` int(11) unsigned NOT NULL,
|
||||
`secret` tinyint(1) unsigned NOT NULL,
|
||||
`expire_timestamp` datetime DEFAULT NULL,
|
||||
`severity` enum('high','medium','minor','none') DEFAULT NULL,
|
||||
`lasteditor` varchar(32) DEFAULT NULL,
|
||||
`edits` text,
|
||||
`deleted` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
|
||||
@@ -254,6 +254,7 @@ CREATE TABLE `SS13_messages` (
|
||||
`round_id` int(11) unsigned NOT NULL,
|
||||
`secret` tinyint(1) unsigned NOT NULL,
|
||||
`expire_timestamp` datetime DEFAULT NULL,
|
||||
`severity` enum('high','medium','minor','none') DEFAULT NULL,
|
||||
`lasteditor` varchar(32) DEFAULT NULL,
|
||||
`edits` text,
|
||||
`deleted` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//Update this whenever the db schema changes
|
||||
//make sure you add an update to the schema_version stable in the db changelog
|
||||
#define DB_MAJOR_VERSION 4
|
||||
#define DB_MINOR_VERSION 6
|
||||
#define DB_MINOR_VERSION 7
|
||||
|
||||
//Timing subsystem
|
||||
//Don't run if there is an identical unique timer active
|
||||
|
||||
@@ -412,6 +412,12 @@
|
||||
output += "<tr><td><b>IP:</b> <input type='text' name='dbbanaddip'></td>"
|
||||
output += "<td><b>Computer id:</b> <input type='text' name='dbbanaddcid'></td></tr>"
|
||||
output += "<tr><td><b>Duration:</b> <input type='text' name='dbbaddduration'></td>"
|
||||
output += "<tr><td><b>Severity:</b><select name='dbbanaddseverity'>"
|
||||
output += "<option value=''>--</option>"
|
||||
output += "<option value='High'>High Severity</option>"
|
||||
output += "<option value='Medium'>Medium Severity</option>"
|
||||
output += "<option value='Minor'>Minor Severity</option>"
|
||||
output += "<option value='None'>No Severity</option>"
|
||||
output += "<td><b>Job:</b><select name='dbbanaddjob'>"
|
||||
output += "<option value=''>--</option>"
|
||||
for(var/j in get_all_jobs())
|
||||
|
||||
@@ -123,9 +123,9 @@ GLOBAL_PROTECT(Banlist)
|
||||
if (temp)
|
||||
WRITE_FILE(GLOB.Banlist["minutes"], bantimestamp)
|
||||
if(!temp)
|
||||
create_message("note", key, bannedby, "Permanently banned - [reason]", null, null, 0, 0, null, 0)
|
||||
create_message("note", key, bannedby, "Permanently banned - [reason]", null, null, 0, 0, null, 0, 0)
|
||||
else
|
||||
create_message("note", key, bannedby, "Banned for [minutes] minutes - [reason]", null, null, 0, 0, null, 0)
|
||||
create_message("note", key, bannedby, "Banned for [minutes] minutes - [reason]", null, null, 0, 0, null, 0, 0)
|
||||
return 1
|
||||
|
||||
/proc/RemoveBan(foldername)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/proc/create_message(type, target_key, admin_ckey, text, timestamp, server, secret, logged = 1, browse, expiry)
|
||||
/proc/create_message(type, target_key, admin_ckey, text, timestamp, server, secret, logged = 1, browse, expiry, note_severity)
|
||||
if(!SSdbcore.Connect())
|
||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||
return
|
||||
@@ -72,7 +72,12 @@
|
||||
return
|
||||
expiry = query_validate_expire_time.item[1]
|
||||
qdel(query_validate_expire_time)
|
||||
var/datum/DBQuery/query_create_message = SSdbcore.NewQuery("INSERT INTO [format_table_name("messages")] (type, targetckey, adminckey, text, timestamp, server, server_ip, server_port, round_id, secret, expire_timestamp) VALUES ('[type]', '[target_ckey]', '[admin_ckey]', '[text]', '[timestamp]', '[server]', INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')), '[world.port]', '[GLOB.round_id]','[secret]', [expiry ? "'[expiry]'" : "NULL"])")
|
||||
if(type == "note" && isnull(note_severity))
|
||||
note_severity = input("Set the severity of the note.", "Severity", null, null) as null|anything in list("High", "Medium", "Minor", "None")
|
||||
if(!note_severity)
|
||||
return
|
||||
note_severity = sanitizeSQL(note_severity)
|
||||
var/datum/DBQuery/query_create_message = SSdbcore.NewQuery("INSERT INTO [format_table_name("messages")] (type, targetckey, adminckey, text, timestamp, server, server_ip, server_port, round_id, secret, expire_timestamp, severity) VALUES ('[type]', '[target_ckey]', '[admin_ckey]', '[text]', '[timestamp]', '[server]', INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')), '[world.port]', '[GLOB.round_id]','[secret]', [expiry ? "'[expiry]'" : "NULL"], [note_severity ? "'[note_severity]'" : "NULL"])")
|
||||
var/pm = "[key_name(usr)] has created a [type][(type == "note" || type == "message" || type == "watchlist entry") ? " for [target_key]" : ""]: [text]"
|
||||
var/header = "[key_name_admin(usr)] has created a [type][(type == "note" || type == "message" || type == "watchlist entry") ? " for [target_key]" : ""]"
|
||||
if(!query_create_message.warn_execute())
|
||||
@@ -222,6 +227,45 @@
|
||||
browse_messages(target_ckey = ckey(target_key), agegate = TRUE)
|
||||
qdel(query_find_edit_expiry_message)
|
||||
|
||||
/proc/edit_message_severity(message_id)
|
||||
if(!SSdbcore.Connect())
|
||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||
return
|
||||
message_id = text2num(message_id)
|
||||
if(!message_id)
|
||||
return
|
||||
var/kn = key_name(usr)
|
||||
var/kna = key_name_admin(usr)
|
||||
var/datum/DBQuery/query_find_edit_note_severity = SSdbcore.NewQuery("SELECT type, (SELECT byond_key FROM [format_table_name("player")] WHERE ckey = targetckey), (SELECT byond_key FROM [format_table_name("player")] WHERE ckey = adminckey), severity FROM [format_table_name("messages")] WHERE id = [message_id] AND deleted = 0")
|
||||
if(!query_find_edit_note_severity.warn_execute())
|
||||
qdel(query_find_edit_note_severity)
|
||||
return
|
||||
if(query_find_edit_note_severity.NextRow())
|
||||
var/type = query_find_edit_note_severity.item[1]
|
||||
var/target_key = query_find_edit_note_severity.item[2]
|
||||
var/admin_key = query_find_edit_note_severity.item[3]
|
||||
var/old_severity = query_find_edit_note_severity.item[4]
|
||||
if(!old_severity)
|
||||
old_severity = "NA"
|
||||
var/editor_key = sanitizeSQL(usr.key)
|
||||
var/editor_ckey = sanitizeSQL(usr.ckey)
|
||||
var/new_severity = input("Set the severity of the note.", "Severity", null, null) as null|anything in list("high", "medium", "minor", "none") //lowercase for edit log consistency
|
||||
if(!new_severity)
|
||||
qdel(query_find_edit_note_severity)
|
||||
return
|
||||
new_severity = sanitizeSQL(new_severity)
|
||||
var/edit_text = sanitizeSQL("Note severity edited by [editor_key] on [SQLtime()] from [old_severity] to [new_severity]<hr>")
|
||||
var/datum/DBQuery/query_edit_note_severity = SSdbcore.NewQuery("UPDATE [format_table_name("messages")] SET severity = '[new_severity]', lasteditor = '[editor_ckey]', edits = CONCAT(IFNULL(edits,''),'[edit_text]') WHERE id = [message_id] AND deleted = 0")
|
||||
if(!query_edit_note_severity.warn_execute(async = TRUE))
|
||||
qdel(query_edit_note_severity)
|
||||
qdel(qdel(query_find_edit_note_severity))
|
||||
return
|
||||
qdel(query_edit_note_severity)
|
||||
log_admin_private("[kn] has edited the severity of a [type] for [target_key] made by [admin_key] from [old_severity] to [new_severity]")
|
||||
message_admins("[kna] has edited the severity time of a [type] for [target_key] made by [admin_key] from [old_severity] to [new_severity]")
|
||||
browse_messages(target_ckey = ckey(target_key), agegate = TRUE)
|
||||
qdel(query_find_edit_note_severity)
|
||||
|
||||
/proc/toggle_message_secrecy(message_id)
|
||||
if(!SSdbcore.Connect())
|
||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||
@@ -260,10 +304,10 @@
|
||||
return
|
||||
var/list/output = list()
|
||||
var/ruler = "<hr style='background:#000000; border:0; height:3px'>"
|
||||
var/list/navbar = list("<a href='?_src_=holder;[HrefToken()];nonalpha=1'>\[All\]</a>|<a href='?_src_=holder;[HrefToken()];nonalpha=2'>\[#\]</a>")
|
||||
var/list/navbar = list("<a href='?_src_=holder;[HrefToken()];nonalpha=1'>All</a><a href='?_src_=holder;[HrefToken()];nonalpha=2'>#</a>")
|
||||
for(var/letter in GLOB.alphabet)
|
||||
navbar += "|<a href='?_src_=holder;[HrefToken()];showmessages=[letter]'>\[[letter]\]</a>"
|
||||
navbar += "|<a href='?_src_=holder;[HrefToken()];showmemo=1'>\[Memos\]</a>|<a href='?_src_=holder;[HrefToken()];showwatch=1'>\[Watchlist\]</a>"
|
||||
navbar += "<a href='?_src_=holder;[HrefToken()];showmessages=[letter]'>[letter]</a>"
|
||||
navbar += "<a href='?_src_=holder;[HrefToken()];showmemo=1'>Memos</a><a href='?_src_=holder;[HrefToken()];showwatch=1'>Watchlist</a>"
|
||||
navbar += "<br><form method='GET' name='search' action='?'>\
|
||||
<input type='hidden' name='_src_' value='holder'>\
|
||||
[HrefTokenFormField()]\
|
||||
@@ -274,14 +318,14 @@
|
||||
if(type == "memo" || type == "watchlist entry")
|
||||
if(type == "memo")
|
||||
output += "<h2><center>Admin memos</h2>"
|
||||
output += "<a href='?_src_=holder;[HrefToken()];addmemo=1'>\[Add memo\]</a></center>"
|
||||
output += "<a href='?_src_=holder;[HrefToken()];addmemo=1'>Add memo</a></center>"
|
||||
else if(type == "watchlist entry")
|
||||
output += "<h2><center>Watchlist entries</h2>"
|
||||
output += "<a href='?_src_=holder;[HrefToken()];addwatchempty=1'>\[Add watchlist entry\]</a>"
|
||||
output += "<a href='?_src_=holder;[HrefToken()];addwatchempty=1'>Add watchlist entry</a>"
|
||||
if(filter)
|
||||
output += "|<a href='?_src_=holder;[HrefToken()];showwatch=1'>\[Unfilter clients\]</a></center>"
|
||||
output += "<a href='?_src_=holder;[HrefToken()];showwatch=1'>Unfilter clients</a></center>"
|
||||
else
|
||||
output += "|<a href='?_src_=holder;[HrefToken()];showwatchfilter=1'>\[Filter offline clients\]</a></center>"
|
||||
output += "<a href='?_src_=holder;[HrefToken()];showwatchfilter=1'>Filter offline clients</a></center>"
|
||||
output += ruler
|
||||
var/datum/DBQuery/query_get_type_messages = SSdbcore.NewQuery("SELECT id, (SELECT byond_key FROM [format_table_name("player")] WHERE ckey = targetckey), targetckey, (SELECT byond_key FROM [format_table_name("player")] WHERE ckey = adminckey), text, timestamp, server, (SELECT byond_key FROM [format_table_name("player")] WHERE ckey = lasteditor), expire_timestamp FROM [format_table_name("messages")] WHERE type = '[type]' AND deleted = 0 AND (expire_timestamp > NOW() OR expire_timestamp IS NULL)")
|
||||
if(!query_get_type_messages.warn_execute())
|
||||
@@ -308,9 +352,9 @@
|
||||
if(expire_timestamp)
|
||||
output += " | Expires [expire_timestamp]"
|
||||
output += "</b>"
|
||||
output += " <a href='?_src_=holder;[HrefToken()];editmessageexpiryempty=[id]'>\[Change Expiry Time\]</a>"
|
||||
output += " <a href='?_src_=holder;[HrefToken()];deletemessageempty=[id]'>\[Delete\]</a>"
|
||||
output += " <a href='?_src_=holder;[HrefToken()];editmessageempty=[id]'>\[Edit\]</a>"
|
||||
output += " <a href='?_src_=holder;[HrefToken()];editmessageexpiryempty=[id]'>Change Expiry Time</a>"
|
||||
output += " <a href='?_src_=holder;[HrefToken()];deletemessageempty=[id]'>Delete</a>"
|
||||
output += " <a href='?_src_=holder;[HrefToken()];editmessageempty=[id]'>Edit</a>"
|
||||
if(editor_key)
|
||||
output += " <font size='2'>Last edit by [editor_key] <a href='?_src_=holder;[HrefToken()];messageedits=[id]'>(Click here to see edit log)</a></font>"
|
||||
output += "<br>[text]<hr style='background:#000000; border:0; height:1px'>"
|
||||
@@ -318,7 +362,7 @@
|
||||
if(target_ckey)
|
||||
target_ckey = sanitizeSQL(target_ckey)
|
||||
var/target_key
|
||||
var/datum/DBQuery/query_get_messages = SSdbcore.NewQuery("SELECT type, secret, id, (SELECT byond_key FROM [format_table_name("player")] WHERE ckey = adminckey), text, timestamp, server, (SELECT byond_key FROM [format_table_name("player")] WHERE ckey = lasteditor), DATEDIFF(NOW(), timestamp), (SELECT byond_key FROM [format_table_name("player")] WHERE ckey = targetckey), expire_timestamp FROM [format_table_name("messages")] WHERE type <> 'memo' AND targetckey = '[target_ckey]' AND deleted = 0 AND (expire_timestamp > NOW() OR expire_timestamp IS NULL) ORDER BY timestamp DESC")
|
||||
var/datum/DBQuery/query_get_messages = SSdbcore.NewQuery("SELECT type, secret, id, (SELECT byond_key FROM [format_table_name("player")] WHERE ckey = adminckey), text, timestamp, server, (SELECT byond_key FROM [format_table_name("player")] WHERE ckey = lasteditor), DATEDIFF(NOW(), timestamp), (SELECT byond_key FROM [format_table_name("player")] WHERE ckey = targetckey), expire_timestamp, severity FROM [format_table_name("messages")] WHERE type <> 'memo' AND targetckey = '[target_ckey]' AND deleted = 0 AND (expire_timestamp > NOW() OR expire_timestamp IS NULL) ORDER BY timestamp DESC")
|
||||
if(!query_get_messages.warn_execute())
|
||||
qdel(query_get_messages)
|
||||
return
|
||||
@@ -344,6 +388,7 @@
|
||||
var/age = text2num(query_get_messages.item[9])
|
||||
target_key = query_get_messages.item[10]
|
||||
var/expire_timestamp = query_get_messages.item[11]
|
||||
var/severity = query_get_messages.item[12]
|
||||
var/alphatext = ""
|
||||
var/nsd = CONFIG_GET(number/note_stale_days)
|
||||
var/nfd = CONFIG_GET(number/note_fresh_days)
|
||||
@@ -357,25 +402,33 @@
|
||||
alpha = 10
|
||||
skipped = TRUE
|
||||
alphatext = "filter: alpha(opacity=[alpha]); opacity: [alpha/100];"
|
||||
|
||||
var/list/data = list("<p style='margin:0px;[alphatext]'> <b>[timestamp] | [server] | [admin_key]")
|
||||
var/list/data = list("<div style='margin:0px;[alphatext]'><p class='severity'>")
|
||||
if(severity)
|
||||
data += "<img src='[severity]_button.png' height='24' width='24'></img> "
|
||||
data += "<b>[timestamp] | [server] | [admin_key][secret ? " | <i>- Secret</i>" : ""]"
|
||||
if(expire_timestamp)
|
||||
data += " | Expires [expire_timestamp]"
|
||||
data += "</b>"
|
||||
data += "</b></p><center>"
|
||||
if(!linkless)
|
||||
data += " <a href='?_src_=holder;[HrefToken()];editmessageexpiry=[id]'>\[Change Expiry Time\]</a>"
|
||||
data += " <a href='?_src_=holder;[HrefToken()];deletemessage=[id]'>\[Delete\]</a>"
|
||||
if(type == "note")
|
||||
data += " <a href='?_src_=holder;[HrefToken()];secretmessage=[id]'>[secret ? "<b>\[Secret\]</b>" : "\[Not secret\]"]</a>"
|
||||
if(severity)
|
||||
data += "<a href='?_src_=holder;[HrefToken()];editmessageseverity=[id]'>[severity=="none" ? "No" : "[capitalize(severity)]"] Severity</a>"
|
||||
else
|
||||
data += "<a href='?_src_=holder;[HrefToken()];editmessageseverity=[id]'>N/A Severity</a>"
|
||||
data += " <a href='?_src_=holder;[HrefToken()];editmessageexpiry=[id]'>Change Expiry Time</a>"
|
||||
data += " <a href='?_src_=holder;[HrefToken()];deletemessage=[id]'>Delete</a>"
|
||||
if(type == "note")
|
||||
data += " <a href='?_src_=holder;[HrefToken()];secretmessage=[id]'>[secret ? "<b>Secret</b>" : "Not secret"]</a>"
|
||||
if(type == "message sent")
|
||||
data += " <font size='2'>Message has been sent</font>"
|
||||
if(editor_key)
|
||||
data += "|"
|
||||
else
|
||||
data += " <a href='?_src_=holder;[HrefToken()];editmessage=[id]'>\[Edit\]</a>"
|
||||
data += " <a href='?_src_=holder;[HrefToken()];editmessage=[id]'>Edit</a>"
|
||||
if(editor_key)
|
||||
data += " <font size='2'>Last edit by [editor_key] <a href='?_src_=holder;[HrefToken()];messageedits=[id]'>(Click here to see edit log)</a></font>"
|
||||
data += "<br>[text]</p><hr style='background:#000000; border:0; height:1px; [alphatext]'>"
|
||||
data += "</div></center>"
|
||||
data += "<p style='[alphatext]'>[text]</p><hr style='background:#000000; border:0; height:1px; [alphatext]'>"
|
||||
switch(type)
|
||||
if("message")
|
||||
messagedata += data
|
||||
@@ -396,34 +449,33 @@
|
||||
qdel(query_get_message_key)
|
||||
output += "<h2><center>[target_key]</center></h2><center>"
|
||||
if(!linkless)
|
||||
output += "<a href='?_src_=holder;[HrefToken()];addnote=[target_key]'>\[Add note\]</a>"
|
||||
output += " <a href='?_src_=holder;[HrefToken()];addmessage=[target_key]'>\[Add message\]</a>"
|
||||
output += " <a href='?_src_=holder;[HrefToken()];addwatch=[target_key]'>\[Add to watchlist\]</a>"
|
||||
output += " <a href='?_src_=holder;[HrefToken()];showmessageckey=[target_ckey]'>\[Refresh page\]</a></center>"
|
||||
output += "<a href='?_src_=holder;[HrefToken()];addnote=[target_key]'>Add note</a>"
|
||||
output += " <a href='?_src_=holder;[HrefToken()];addmessage=[target_key]'>Add message</a>"
|
||||
output += " <a href='?_src_=holder;[HrefToken()];addwatch=[target_key]'>Add to watchlist</a>"
|
||||
output += " <a href='?_src_=holder;[HrefToken()];showmessageckey=[target_ckey]'>Refresh page</a></center>"
|
||||
else
|
||||
output += " <a href='?_src_=holder;[HrefToken()];showmessageckeylinkless=[target_ckey]'>\[Refresh page\]</a></center>"
|
||||
output += " <a href='?_src_=holder;[HrefToken()];showmessageckeylinkless=[target_ckey]'>Refresh page</a></center>"
|
||||
output += ruler
|
||||
if(messagedata)
|
||||
output += "<h4>Messages</h4>"
|
||||
output += "<h2>Messages</h2>"
|
||||
output += messagedata
|
||||
if(watchdata)
|
||||
output += "<h4>Watchlist</h4>"
|
||||
output += "<h2>Watchlist</h2>"
|
||||
output += watchdata
|
||||
if(notedata)
|
||||
output += "<h4>Notes</h4>"
|
||||
output += "<h2>Notes</h2>"
|
||||
output += notedata
|
||||
if(!linkless)
|
||||
if (agegate)
|
||||
if (skipped) //the first skipped message is still shown so that we can put this link over it.
|
||||
output += " <center><a href='?_src_=holder;[HrefToken()];showmessageckey=[target_ckey];showall=1' style='position: relative; top: -3em;'>\[Show [skipped] hidden messages\]</center>"
|
||||
output += "<center><a href='?_src_=holder;[HrefToken()];showmessageckey=[target_ckey];showall=1' style='position: relative; top: -3em;'>Show [skipped] hidden messages</a></center>"
|
||||
else
|
||||
output += " <center><a href='?_src_=holder;[HrefToken()];showmessageckey=[target_ckey];showall=1'>\[Show All\]</center>"
|
||||
|
||||
output += "<center><a href='?_src_=holder;[HrefToken()];showmessageckey=[target_ckey];showall=1'>Show All</a></center>"
|
||||
else
|
||||
output += " <center><a href='?_src_=holder;[HrefToken()];showmessageckey=[target_ckey]'>\[Hide Old\]</center>"
|
||||
output += "<center><a href='?_src_=holder;[HrefToken()];showmessageckey=[target_ckey]'>Hide Old</a></center>"
|
||||
if(index)
|
||||
var/search
|
||||
output += "<center><a href='?_src_=holder;[HrefToken()];addmessageempty=1'>\[Add message\]</a><a href='?_src_=holder;[HrefToken()];addwatchempty=1'>\[Add watchlist entry\]</a><a href='?_src_=holder;[HrefToken()];addnoteempty=1'>\[Add note\]</a></center>"
|
||||
output += "<center><a href='?_src_=holder;[HrefToken()];addmessageempty=1'>Add message</a><a href='?_src_=holder;[HrefToken()];addwatchempty=1'>Add watchlist entry</a><a href='?_src_=holder;[HrefToken()];addnoteempty=1'>Add note</a></center>"
|
||||
output += ruler
|
||||
if(!isnum(index))
|
||||
index = sanitizeSQL(index)
|
||||
@@ -446,9 +498,13 @@
|
||||
output += "<a href='?_src_=holder;[HrefToken()];showmessageckey=[index_ckey]'>[index_key]</a><br>"
|
||||
qdel(query_list_messages)
|
||||
else if(!type && !target_ckey && !index)
|
||||
output += "<center></a> <a href='?_src_=holder;[HrefToken()];addmessageempty=1'>\[Add message\]</a><a href='?_src_=holder;[HrefToken()];addwatchempty=1'>\[Add watchlist entry\]</a><a href='?_src_=holder;[HrefToken()];addnoteempty=1'>\[Add note\]</a></center>"
|
||||
output += "<center><a href='?_src_=holder;[HrefToken()];addmessageempty=1'>Add message</a><a href='?_src_=holder;[HrefToken()];addwatchempty=1'>Add watchlist entry</a><a href='?_src_=holder;[HrefToken()];addnoteempty=1'>Add note</a></center>"
|
||||
output += ruler
|
||||
usr << browse({"<!DOCTYPE html><html><head><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /></head><body>[jointext(output, "")]</body></html>"}, "window=browse_messages;size=900x500")
|
||||
var/datum/browser/browser = new(usr, "Note panel", "Manage player notes", 1000, 500)
|
||||
var/datum/asset/notes_assets = get_asset_datum(/datum/asset/simple/notes)
|
||||
notes_assets.send(src)
|
||||
browser.set_content(jointext(output, ""))
|
||||
browser.open()
|
||||
|
||||
/proc/get_message_output(type, target_ckey)
|
||||
if(!SSdbcore.Connect())
|
||||
@@ -521,7 +577,7 @@
|
||||
timestamp = query_convert_time.item[1]
|
||||
qdel(query_convert_time)
|
||||
if(ckey && notetext && timestamp && admin_ckey && server)
|
||||
create_message("note", ckey, admin_ckey, notetext, timestamp, server, 1, 0, null, 0)
|
||||
create_message("note", ckey, admin_ckey, notetext, timestamp, server, 1, 0, null, 0, 0)
|
||||
notesfile.cd = "/"
|
||||
notesfile.dir.Remove(ckey)
|
||||
|
||||
|
||||
@@ -213,37 +213,38 @@
|
||||
var/banduration = text2num(href_list["dbbaddduration"])
|
||||
var/banjob = href_list["dbbanaddjob"]
|
||||
var/banreason = href_list["dbbanreason"]
|
||||
var/banseverity = href_list["dbbanaddseverity"]
|
||||
|
||||
switch(bantype)
|
||||
if(BANTYPE_PERMA)
|
||||
if(!banckey || !banreason)
|
||||
to_chat(usr, "Not enough parameters (Requires ckey and reason).")
|
||||
if(!banckey || !banreason || !banseverity)
|
||||
to_chat(usr, "Not enough parameters (Requires ckey, severity, and reason).")
|
||||
return
|
||||
banduration = null
|
||||
banjob = null
|
||||
if(BANTYPE_TEMP)
|
||||
if(!banckey || !banreason || !banduration)
|
||||
to_chat(usr, "Not enough parameters (Requires ckey, reason and duration).")
|
||||
if(!banckey || !banreason || !banduration || !banseverity)
|
||||
to_chat(usr, "Not enough parameters (Requires ckey, reason, severity and duration).")
|
||||
return
|
||||
banjob = null
|
||||
if(BANTYPE_JOB_PERMA)
|
||||
if(!banckey || !banreason || !banjob)
|
||||
to_chat(usr, "Not enough parameters (Requires ckey, reason and job).")
|
||||
if(!banckey || !banreason || !banjob || !banseverity)
|
||||
to_chat(usr, "Not enough parameters (Requires ckey, severity, reason and job).")
|
||||
return
|
||||
banduration = null
|
||||
if(BANTYPE_JOB_TEMP)
|
||||
if(!banckey || !banreason || !banjob || !banduration)
|
||||
to_chat(usr, "Not enough parameters (Requires ckey, reason and job).")
|
||||
if(!banckey || !banreason || !banjob || !banduration || !banseverity)
|
||||
to_chat(usr, "Not enough parameters (Requires ckey, severity, reason and job).")
|
||||
return
|
||||
if(BANTYPE_ADMIN_PERMA)
|
||||
if(!banckey || !banreason)
|
||||
to_chat(usr, "Not enough parameters (Requires ckey and reason).")
|
||||
if(!banckey || !banreason || !banseverity)
|
||||
to_chat(usr, "Not enough parameters (Requires ckey, severity and reason).")
|
||||
return
|
||||
banduration = null
|
||||
banjob = null
|
||||
if(BANTYPE_ADMIN_TEMP)
|
||||
if(!banckey || !banreason || !banduration)
|
||||
to_chat(usr, "Not enough parameters (Requires ckey, reason and duration).")
|
||||
if(!banckey || !banreason || !banduration || !banseverity)
|
||||
to_chat(usr, "Not enough parameters (Requires ckey, severity, reason and duration).")
|
||||
return
|
||||
banjob = null
|
||||
|
||||
@@ -268,7 +269,7 @@
|
||||
if(!DB_ban_record(bantype, playermob, banduration, banreason, banjob, bankey, banip, bancid ))
|
||||
to_chat(usr, "<span class='danger'>Failed to apply ban.</span>")
|
||||
return
|
||||
create_message("note", bankey, null, banreason, null, null, 0, 0, null, 0)
|
||||
create_message("note", bankey, null, banreason, null, null, 0, 0, null, 0, banseverity)
|
||||
|
||||
else if(href_list["editrightsbrowser"])
|
||||
edit_admin_permissions(0)
|
||||
@@ -597,6 +598,9 @@
|
||||
var/reason = input(usr,"Please State Reason.","Reason") as message|null
|
||||
if(!reason)
|
||||
return
|
||||
var/severity = input("Set the severity of the note/ban.", "Severity", null, null) as null|anything in list("High", "Medium", "Minor", "None")
|
||||
if(!severity)
|
||||
return
|
||||
if(!DB_ban_record(BANTYPE_JOB_PERMA, M, -1, reason, "appearance"))
|
||||
to_chat(usr, "<span class='danger'>Failed to apply ban.</span>")
|
||||
return
|
||||
@@ -604,7 +608,7 @@
|
||||
jobban_buildcache(M.client)
|
||||
ban_unban_log_save("[key_name(usr)] appearance banned [key_name(M)]. reason: [reason]")
|
||||
log_admin_private("[key_name(usr)] appearance banned [key_name(M)]. \nReason: [reason]")
|
||||
create_message("note", M.key, null, "Appearance banned - [reason]", null, null, 0, 0, null, 0)
|
||||
create_message("note", M.key, null, "Appearance banned - [reason]", null, null, 0, 0, null, 0, severity)
|
||||
message_admins("<span class='adminnotice'>[key_name_admin(usr)] appearance banned [key_name_admin(M)].</span>")
|
||||
to_chat(M, "<span class='boldannounce'><BIG>You have been appearance banned by [usr.client.key].</BIG></span>")
|
||||
to_chat(M, "<span class='boldannounce'>The reason is: [reason]</span>")
|
||||
@@ -967,6 +971,7 @@
|
||||
|
||||
//Banning comes first
|
||||
if(notbannedlist.len) //at least 1 unbanned job exists in joblist so we have stuff to ban.
|
||||
var/severity = null
|
||||
switch(alert("Temporary Ban for [M.key]?",,"Yes","No", "Cancel"))
|
||||
if("Yes")
|
||||
var/mins = input(usr,"How long (in minutes)?","Ban time",1440) as num|null
|
||||
@@ -976,7 +981,9 @@
|
||||
var/reason = input(usr,"Please State Reason For Banning [M.key].","Reason") as message|null
|
||||
if(!reason)
|
||||
return
|
||||
|
||||
severity = input("Set the severity of the note/ban.", "Severity", null, null) as null|anything in list("High", "Medium", "Minor", "None")
|
||||
if(!severity)
|
||||
return
|
||||
var/msg
|
||||
for(var/job in notbannedlist)
|
||||
if(!DB_ban_record(BANTYPE_JOB_TEMP, M, mins, reason, job))
|
||||
@@ -990,7 +997,7 @@
|
||||
msg = job
|
||||
else
|
||||
msg += ", [job]"
|
||||
create_message("note", M.key, null, "Banned from [msg] - [reason]", null, null, 0, 0, null, 0)
|
||||
create_message("note", M.key, null, "Banned from [msg] - [reason]", null, null, 0, 0, null, 0, severity)
|
||||
message_admins("<span class='adminnotice'>[key_name_admin(usr)] banned [key_name_admin(M)] from [msg] for [mins] minutes.</span>")
|
||||
to_chat(M, "<span class='boldannounce'><BIG>You have been [(msg == ("ooc" || "appearance")) ? "banned" : "jobbanned"] by [usr.client.key] from: [msg].</BIG></span>")
|
||||
to_chat(M, "<span class='boldannounce'>The reason is: [reason]</span>")
|
||||
@@ -999,6 +1006,9 @@
|
||||
return 1
|
||||
if("No")
|
||||
var/reason = input(usr,"Please State Reason For Banning [M.key].","Reason") as message|null
|
||||
severity = input("Set the severity of the note/ban.", "Severity", null, null) as null|anything in list("High", "Medium", "Minor", "None")
|
||||
if(!severity)
|
||||
return
|
||||
if(reason)
|
||||
var/msg
|
||||
for(var/job in notbannedlist)
|
||||
@@ -1013,7 +1023,7 @@
|
||||
msg = job
|
||||
else
|
||||
msg += ", [job]"
|
||||
create_message("note", M.key, null, "Banned from [msg] - [reason]", null, null, 0, 0, null, 0)
|
||||
create_message("note", M.key, null, "Banned from [msg] - [reason]", null, null, 0, 0, null, 0, severity)
|
||||
message_admins("<span class='adminnotice'>[key_name_admin(usr)] banned [key_name_admin(M)] from [msg].</span>")
|
||||
to_chat(M, "<span class='boldannounce'><BIG>You have been [(msg == ("ooc" || "appearance")) ? "banned" : "jobbanned"] by [usr.client.key] from: [msg].</BIG></span>")
|
||||
to_chat(M, "<span class='boldannounce'>The reason is: [reason]</span>")
|
||||
@@ -1150,6 +1160,12 @@
|
||||
var/message_id = href_list["editmessageexpiryempty"]
|
||||
edit_message_expiry(message_id, browse = 1)
|
||||
|
||||
else if(href_list["editmessageseverity"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
var/message_id = href_list["editmessageseverity"]
|
||||
edit_message_severity(message_id)
|
||||
|
||||
else if(href_list["secretmessage"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
@@ -1214,7 +1230,9 @@
|
||||
if(query_get_message_edits.NextRow())
|
||||
var/edit_log = query_get_message_edits.item[1]
|
||||
if(!QDELETED(usr))
|
||||
usr << browse(edit_log,"window=noteedits")
|
||||
var/datum/browser/browser = new(usr, "Note edits", "Note edits")
|
||||
browser.set_content(jointext(edit_log, ""))
|
||||
browser.open()
|
||||
qdel(query_get_message_edits)
|
||||
|
||||
else if(href_list["newban"])
|
||||
|
||||
@@ -551,6 +551,14 @@ GLOBAL_LIST_EMPTY(asset_datums)
|
||||
"padlock.png" = 'html/padlock.png'
|
||||
)
|
||||
|
||||
/datum/asset/simple/notes
|
||||
assets = list(
|
||||
"high_button.png" = 'html/high_button.png',
|
||||
"medium_button.png" = 'html/medium_button.png',
|
||||
"minor_button.png" = 'html/minor_button.png',
|
||||
"none_button.png" = 'html/none_button.png',
|
||||
)
|
||||
|
||||
//this exists purely to avoid meta by pre-loading all language icons.
|
||||
/datum/asset/language/register()
|
||||
for(var/path in typesof(/datum/language))
|
||||
|
||||
@@ -682,7 +682,7 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
|
||||
qdel(query_get_notes)
|
||||
return
|
||||
qdel(query_get_notes)
|
||||
create_message("note", key, system_ckey, message, null, null, 0, 0, null, 0)
|
||||
create_message("note", key, system_ckey, message, null, null, 0, 0, null, 0, 0)
|
||||
|
||||
|
||||
/client/proc/check_ip_intel()
|
||||
|
||||
@@ -396,3 +396,17 @@ ul.sparse {
|
||||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.severity {
|
||||
margin:0px;
|
||||
padding: 1px 8px 1px 8px;
|
||||
border-radius: 25px;
|
||||
border: 1px solid #161616;
|
||||
background: #40628a;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.severity img {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
BIN
html/high_button.png
Normal file
BIN
html/high_button.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 434 B |
BIN
html/medium_button.png
Normal file
BIN
html/medium_button.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 559 B |
BIN
html/minor_button.png
Normal file
BIN
html/minor_button.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 685 B |
BIN
html/none_button.png
Normal file
BIN
html/none_button.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 663 B |
Reference in New Issue
Block a user