mirror of
https://github.com/Aurorastation/Aurora-Old.git
synced 2026-08-26 22:26:28 +01:00
Warning additions
* Warnings can now be acknowledged from the my-warnings panel. * If you have any warnings that you haven't acknowledged, then you will be informed of them every single time you log in. * Also fixed a minor logical issues due to me being a dumb upon initial implementation.
This commit is contained in:
@@ -118,7 +118,7 @@
|
||||
|
||||
feedback_add_details("admin_verb","WARN-DB")
|
||||
if(C)
|
||||
C << "<font color='red'><BIG><B>You have been formally warned by an administrator.</B></BIG><br>You can look up your warnings through the OOC panel, with the 'My Warnings' button.</font>"
|
||||
C << "<font color='red'><BIG><B>You have been formally warned by an administrator.</B></BIG><br>Click <a href='byond://?src=\ref[src];warnview=1'>here</a> to review and acknowledge them!</font>"
|
||||
message_admins("[key_name_admin(src)] has warned [warned_ckey] for: [reason].")
|
||||
message_mods("[key_name_admin(src)] has warned [warned_ckey].")
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
* A proc for a player to check their own warnings
|
||||
*/
|
||||
|
||||
/client/verb/check_warns()
|
||||
/client/verb/warnings_check()
|
||||
set name = "My warnings"
|
||||
set category = "OOC"
|
||||
set desc = "Display warnings issued to you."
|
||||
@@ -151,18 +151,20 @@
|
||||
|
||||
var/sqlkey = sanitizeSQL(ckey)
|
||||
|
||||
var/DBQuery/search_query = dbcon.NewQuery("SELECT time, severity, reason, a_ckey FROM aurora_warnings WHERE ckey='[sqlkey]' ORDER BY time DESC")
|
||||
var/DBQuery/search_query = dbcon.NewQuery("SELECT id, time, severity, reason, a_ckey, acknowledged FROM aurora_warnings WHERE visible = '1' AND (ckey='[sqlkey]' OR computerid='[computer_id]' OR ip='[address]') ORDER BY time DESC")
|
||||
search_query.Execute()
|
||||
|
||||
while(search_query.NextRow())
|
||||
var/time = search_query.item[1]
|
||||
var/severity = search_query.item[2]
|
||||
var/reason = search_query.item[3]
|
||||
var/a_ckey = search_query.item[4]
|
||||
var/id = text2num(search_query.item[1])
|
||||
var/time = search_query.item[2]
|
||||
var/severity = text2num(search_query.item[3])
|
||||
var/reason = search_query.item[4]
|
||||
var/a_ckey = search_query.item[5]
|
||||
var/ackn = text2num(search_query.item[6])
|
||||
|
||||
var/bgcolor = lcolor
|
||||
|
||||
if(severity == "1")
|
||||
if(severity)
|
||||
bgcolor = dcolor
|
||||
|
||||
dat += "<tr bgcolor='[bgcolor]' align='center'>"
|
||||
@@ -171,6 +173,11 @@
|
||||
dat += "<td>[reason]</td>"
|
||||
dat += "</tr>"
|
||||
|
||||
if(!ackn)
|
||||
dat += "<tr><td align='center' colspan='3'><b>(<a href='byond://?src=\ref[src];warnacknowledge=[id]'>Acknowledge Warning</a>)</b></td></tr>"
|
||||
else
|
||||
dat += "<tr><td align='center' colspan='3'><b>Warning Acknowledged!</b></td></tr>"
|
||||
|
||||
dat += "<tr>"
|
||||
dat += "<td colspan='5' bgcolor='white'> </td>"
|
||||
dat += "</tr>"
|
||||
@@ -178,6 +185,47 @@
|
||||
dat += "</table>"
|
||||
usr << browse(dat, "window=mywarnings;size=900x500")
|
||||
|
||||
/*
|
||||
* A proc for acknowledging a warning, so you don't get pestered about it anymore.
|
||||
*/
|
||||
|
||||
/client/proc/warnings_acknowledge(id)
|
||||
if(!id)
|
||||
return
|
||||
|
||||
establish_db_connection()
|
||||
if(!dbcon.IsConnected())
|
||||
error("Connection to SQL database failed while attempting to update a player's warnings.")
|
||||
return
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("UPDATE aurora_warnings SET acknowledged = 1 WHERE id = '[id]'")
|
||||
query.Execute()
|
||||
|
||||
warnings_check()
|
||||
|
||||
/*
|
||||
* A proc to alert you if you have unacknowledged warnings.
|
||||
* Called in /client/New (client procs.dm)
|
||||
*/
|
||||
|
||||
/client/proc/warnings_alert()
|
||||
var/sqlkey = sanitizeSQL(ckey)
|
||||
var/count = 0
|
||||
|
||||
establish_db_connection()
|
||||
if(!dbcon.IsConnected())
|
||||
error("Connection to SQL database failed while attempting to alert a player of their warnings.")
|
||||
return
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM aurora_warnings WHERE (visible = '1' AND acknowledged = '0') AND (ckey='[sqlkey]' OR computerid='[computer_id]' OR ip='[address]')")
|
||||
query.Execute()
|
||||
while(query.NextRow())
|
||||
count++
|
||||
|
||||
if(count)
|
||||
src << "<br>"
|
||||
src << "<font color=red><b>You have [count] unread [count > 1 ? "warnings" : "warning"]! Click <a href='byond://?src=\ref[src];warnview=1'>here</a> to review and acknowledge them!</b></font>"
|
||||
|
||||
/*
|
||||
* A proc for an admin/moderator to look up a member's warnings.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user