Removes CCIA (#6678)

view duty log verb and changes the way their recorder works.

CCIA recordings are now written to the database once the interview is complete (if enabled) and printed out.
This commit is contained in:
Werner
2019-07-17 21:39:31 +02:00
committed by Erki
parent 21f8e409d1
commit 9f5a26d9ff
7 changed files with 763 additions and 694 deletions

View File

@@ -95,7 +95,6 @@ var/list/admin_verbs_admin = list(
/client/proc/check_fax_history,
/client/proc/cmd_cciaa_say,
/client/proc/cmd_dev_say,
/client/proc/view_duty_log,
/client/proc/cmd_dev_bst,
/client/proc/clear_toxins,
/client/proc/wipe_ai, // allow admins to force-wipe AIs
@@ -387,7 +386,6 @@ var/list/admin_verbs_cciaa = list(
/client/proc/cmd_admin_create_centcom_report,
/client/proc/cmd_cciaa_say,
/client/proc/returntobody,
/client/proc/view_duty_log,
/datum/admins/proc/create_admin_fax,
/client/proc/check_fax_history,
/client/proc/aooc,

View File

@@ -290,21 +290,4 @@
else
data += "<center>No faxes have been sent out.</center>"
usr << browse("<HTML><HEAD><TITLE>Centcomm Fax History</TITLE></HEAD><BODY>[data]</BODY></HTML>", "window=Centcomm Fax History")
/client/proc/view_duty_log()
set category = "Special Verbs"
set name = "Get Duty Log"
set desc = "Download a log or file from an investigation"
var/path = browse_files("data/dutylogs/")
if(!path)
return
if(file_spam_check())
return
message_admins("[key_name_admin(src)] accessed file: [path]")
to_chat(usr, run( file(path) ))
feedback_add_details("admin_verb","DOGL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
return
usr << browse("<HTML><HEAD><TITLE>Centcomm Fax History</TITLE></HEAD><BODY>[data]</BODY></HTML>", "window=Centcomm Fax History")

View File

@@ -20,12 +20,15 @@
canprint = 1
//Specific for Duty Officers
var/paused = 0
var/assignedUsers = list()
var/sessionLog = list()
var/interviewLog = list()
var/paused = FALSE
var/sLogFile = null
var/iLogFile = null
var/last_file_loc = null
var/report_id = null
var/report_name = null
var/interviewee_id = null
var/interviewee_name = null
var/date_string = null
/obj/item/device/taperecorder/cciaa/hear_talk(mob/living/M as mob, msg, var/verb="says")
if(recording && !paused)
@@ -37,158 +40,123 @@
/obj/item/device/taperecorder/cciaa/proc/get_time()
return "[round(world.time / 36000)+12]:[(world.time / 600 % 60) < 10 ? add_zero(world.time / 600 % 60, 1) : world.time / 600 % 60]:[(world.time / 60 % 60) < 10 ? add_zero(world.time / 60 % 60, 1) : world.time / 60 % 60]"
/obj/item/device/taperecorder/cciaa/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/ID = W
if(ID.GetAccess(access_cent_captain))
if(!user in assignedUsers)
assignedUsers += user
else
to_chat(user, "<span class='notice'>The device beeps and flashes \"Already Registered\".</span>")
return
else
to_chat(user, "<span class='notice'>The device beeps and appears to shutdown.</span>")
return
if(istype(W, /obj/item/weapon/paper))
var/obj/item/weapon/paper/P = W
logPaper(user, P)
..()
/obj/item/device/taperecorder/cciaa/proc/logPaper(var/mob/M, var/obj/item/weapon/paper/P)
if(!P)
return
var/case = input(usr, "Enter case name","Case Name") as null|text
if(!case || case == "")
to_chat(usr, "<span class='notice'>The device beeps and flashes \"No data entered, Aborting\".</span>")
return
var/reference = input(usr, "Enter reference","Reference") as null|text
if(!reference || reference == "")
to_chat(usr, "<span class='notice'>The device beeps and flashes \"No data entered, Aborting\".</span>")
return
var/date_string = time2text(world.realtime, "YYYY_MM_DD")
var/fileLoc = "data/dutylogs/[M.ckey]/[date_string]-[case].log"
var/fileName = "[date_string]-[case].log"
if(fexists(fileLoc))
var/safe = 0
var/i = 1
while(!safe)
fileLoc = "data/dutylogs/[M.ckey]/[date_string]-[case][i].log"
if(!fexists(fileLoc))
fileName = "[date_string]-[case][i].log"
safe = 1
break
i++
iLogFile = file(fileLoc)
iLogFile << "[P.name]-[reference]"
iLogFile << "Case file: [case]"
iLogFile << "Reference: [reference]"
iLogFile << "Date: [date_string]"
iLogFile << "Filed by: [M]"
iLogFile << "--------------------------------"
iLogFile << "[P.info]"
iLogFile << "[P.stamps]"
iLogFile = null
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Writing to [fileName]\".</span>")
return
/obj/item/device/taperecorder/cciaa/record()
set name = "Start Recording"
set category = "Recorder"
if(!usr.client.holder && !(usr.client.holder.rights & R_CCIAA))
if(!check_rights(R_CCIAA,FALSE))
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Unauthorised user.\".</span>")
return
if(usr.stat)
if(use_check_and_message(usr))
return
if(recording)
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Already recording, Aborting\".</span>")
return
var/case = input(usr, "Enter case name","Case Name") as null|text
if(!case || case == "")
to_chat(usr, "<span class='notice'>The device beeps and flashes \"No data entered, Aborting\".</span>")
//If nothing has been done with the device yet
if(!report_id && !interviewee_id)
if(config.sql_ccia_logs)
//Get the active cases from the database and display them
var/list/reports = list()
var/DBQuery/report_query = dbcon.NewQuery("SELECT id, report_date, title FROM ss13_ccia_reports WHERE status = 'approved' AND deleted_at IS NULL")
report_query.Execute()
while(report_query.NextRow())
CHECK_TICK
reports["[report_query.item[2]] - [report_query.item[3]]"] = "[report_query.item[1]]"
report_name = input(usr, "Select Report","Report Name") as null|anything in reports
if(!report_name || report_name == "")
to_chat(usr, "<span class='notice'>The device beeps and flashes \"No data entered, Aborting\".</span>")
return
report_id = reports[report_name]
to_chat(usr,"<span class='notice'>The device flashes \"Report [report_name] selected, Finterprint of interviwee required\"</span>")
else
report_name = input(usr, "Select Report Name","Report Name") as null|text
if(!report_name || report_name == "")
to_chat(usr, "<span class='notice'>The device beeps and flashes \"No data entered, Aborting\".</span>")
return
report_id = input(usr, "Select Report ID","Report ID") as null|text
if(!report_name || report_name == "")
to_chat(usr, "<span class='notice'>The device beeps and flashes \"No data entered, Aborting\".</span>")
return
return
var/interviewee = input(usr, "Enter interviewee name","Interviewee Name") as null|text
if(!interviewee || interviewee == "")
to_chat(usr, "<span class='notice'>The device beeps and flashed \"No data entered, Aborting\".</span>")
//If we are ready to record, but no interviewee is selected
else if(report_id && !interviewee_id)
to_chat(usr,"<span class='notice'>The device beeps and flashes \"Fingerprint of interviewee required\"</span>")
return
//If the report has been selected and the person scanned their frinterprint
else if(report_id && interviewee_id)
date_string = time2text(world.realtime, "YYYY_MM_DD")
var/fileLoc = "data/dutylogs/[usr.ckey]/[date_string]-[report_id]-[interviewee_id].log"
var/fileName = "[date_string]-[report_id]-[interviewee_id].log"
if(fexists(fileLoc))
var/safe = 0
var/i = 1
while(!safe)
fileLoc = "data/dutylogs/[usr.ckey]/[date_string]-[report_id]-[interviewee_id]-[i].log"
if(!fexists(fileLoc))
fileName = "[date_string]-[report_id]-[interviewee_id]-[i].log"
safe = 1
break
i++
last_file_loc = fileLoc
sLogFile = file(fileLoc)
sLogFile << "[report_id]-[interviewee_id]"
sLogFile << "Case file: [report_name]"
sLogFile << "--------------------------------"
sLogFile << "Date: [date_string]"
sLogFile << "--------------------------------"
sLogFile << "Interviewer: [usr.name]"
sLogFile << "Interviewee: [interviewee_name]"
sLogFile << "Recorder started: [get_time()]"
sLogFile << "--------------------------------"
var/date_string = time2text(world.realtime, "YYYY_MM_DD")
var/fileLoc = "data/dutylogs/[usr.ckey]/[date_string]-[case]-[interviewee].log"
var/fileName = "[date_string]-[case]-[interviewee].log"
if(fexists(fileLoc))
var/safe = 0
var/i = 1
while(!safe)
fileLoc = "data/dutylogs/[usr.ckey]/[date_string]-[case]-[interviewee]-[i].log"
if(!fexists(fileLoc))
fileName = "[date_string]-[case]-[interviewee]-[i].log"
safe = 1
break
i++
sLogFile = file(fileLoc)
sLogFile << "[case]-[interviewee]"
sLogFile << "Case file: [case]"
sLogFile << "--------------------------------"
sLogFile << "Date: [date_string]"
sLogFile << "--------------------------------"
sLogFile << "Interviewer: [usr.name]"
sLogFile << "Interviewee: [interviewee]"
sLogFile << "Recorder started: [get_time()]"
sLogFile << "--------------------------------"
recording = 1
icon_state = "taperecorderrecording"
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Writing to [fileName]\".</span>")
recording = 1
icon_state = "taperecorderrecording"
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Writing to [fileName]\".</span>")
return
return
/obj/item/device/taperecorder/cciaa/stop()
set name = "Stop"
set category = "Recorder"
if(usr.stat)
if(use_check_and_message(usr))
return
if(!usr.client.holder && !(usr.client.holder.rights & R_CCIAA))
if(!check_rights(R_CCIAA,FALSE))
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Unauthorised user.\".</span>")
return
if(!recording)
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Not recording, Aborting\".</span>")
return
recording = 0
paused = 0
recording = FALSE
paused = FALSE
sLogFile << "--------------------------------"
sLogFile << "Recorder stopped: [get_time()]"
sLogFile << "--------------------------------"
var/obj/item/weapon/paper/P = get_last_transcript()
P.forceMove(get_turf(src.loc))
//If we have sql ccia logs enabled, then persist it here
if(config.sql_ccia_logs && establish_db_connection(dbcon))
var/DBQuery/save_log = dbcon.NewQuery("INSERT INTO ss13_ccia_reports_transcripts (id, report_id, character_id, interviewer, text) VALUES (NULL, :report_id:, :character_id:, :interviewer:, :text:)")
save_log.Execute(list("report_id" = report_id, "character_id" = interviewee_id, "interviewer" = usr.name, "text" = P.info))
sLogFile = null
report_id = null
report_name = null
interviewee_id = null
interviewee_name = null
date_string = null
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Recording stopped log saved.\".</span>")
icon_state = "taperecorderidle"
return
/obj/item/device/taperecorder/cciaa/print_transcript()
set name = "Print Transcript"
set category = "Recorder"
if(usr.stat)
return
if(!usr.client.holder && !(usr.client.holder.rights & R_CCIAA))
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Unauthorised user\".</span>")
return
if(recording)
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Device recording, Aborting\".</span>")
return
var/path = usr.client.browse_files("data/dutylogs/")
if(!path)
return
message_admins("[key_name_admin(usr)] accessed file: [path]")
var/list/lFile = file2list(path)
/obj/item/device/taperecorder/cciaa/proc/get_last_transcript()
var/list/lFile = file2list(last_file_loc)
var/dat = ""
var/firstLine = null
for(var/line in lFile)
@@ -198,24 +166,40 @@
firstLine = "[line]"
continue
dat += "[line]<br>"
dat += "[line]<br>\n"
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(src)
var/pname = "[firstLine]"
var/info = "[dat]"
P.set_content_unsafe(pname, info)
P.forceMove(get_turf(src.loc))
return P
/obj/item/device/taperecorder/cciaa/print_transcript()
set name = "Print Transcript"
set category = "Recorder"
if(use_check_and_message(usr))
return
if(!check_rights(R_CCIAA,FALSE))
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Unauthorised user\".</span>")
return
if(recording)
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Device recording, Aborting\".</span>")
return
message_admins("[key_name_admin(usr)] accessed file: [last_file_loc]")
var/obj/item/weapon/paper/P = get_last_transcript()
P.forceMove(get_turf(src.loc))
return
/obj/item/device/taperecorder/cciaa/verb/pause_recording()
set name = "Pause"
set category = "Recorder"
if(usr.stat)
if(use_check_and_message(usr))
return
if(!usr.client.holder && !(usr.client.holder.rights & R_CCIAA))
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Unauthorised user.\".</span>")
if(!check_rights(R_CCIAA,FALSE))
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Unauthorised user\".</span>")
return
if(!recording)
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Not recording, Aborting\".</span>")
@@ -225,16 +209,37 @@
sLogFile << "--------------------------------"
sLogFile << "Recorder paused at: [get_time()]"
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Recording resumed\".</span>")
paused = 1
paused = TRUE
else
sLogFile << "Recorder resumed at: [get_time()]"
sLogFile << "--------------------------------"
to_chat(usr, "<span class='notice'>The device beeps and flashes \"Recording paused\".</span>")
paused = 0
paused = FALSE
return
/obj/item/device/taperecorder/cciaa/attack_self(mob/user)
return
if(!report_id)
record()
return
if(interviewee_id)
to_chat(user,"<span class='notice'>The device beeps and flashes \"A interviewee has already been associated with this interview\".</span>")
return
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(!H.character_id)
to_chat(user,"<span class='notice'>The device beeps and flashes \"Fingerprint is not recognized\".</span>")
return
else
interviewee_id = H.character_id
interviewee_name = H.name
to_chat(user,"<span class='notice'>The device beeps and flashes \"Fingerprint recognized, Employee: [interviewee_name], ID: [interviewee_id]\".</span>")
playsound(src.loc, 'sound/machines/ping.ogg', 50, 0)
return
else
to_chat(user,"<span class='notice'>The device beeps and flashes \"Unrecognized entity - Aborting\".</span>")
return
//redundent for now
/obj/item/device/taperecorder/cciaa/clear_memory()