mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
TGUI Engineering: Squashed Edition (Commits Below)
TGUI APCs TGUI vending machines Fix AI default_tgui_interaction TGUI Airlocks Station & Atmospheric Alert TGUI + Misc NTOS-TGUI Fixes TGUI Air Alarms & Central Atmospheric Control Airlock TGUI TG... got rid of UI for fire alarm. í´· TGUI Gas Heating/Cooling System TGUI Gas Pump & Passive Gate + Fixes TGUI Omni Atmospherics TGUI Pipe Dispensers & RPD TGUI IntelliCore & Vending Fix TGUI Handheld Tanks TGUI Portable Pump & Scrubber TGUI Tank Dispenser & Canisters TGUI Radios TGUI SMES & Air Alarm adjustment Tweak vending machine interfaces a tad TGUI Algae Farm TGUI general_air_control - Distro & Waste Console - Riot Control Console - Atmos Intake Console - Engine Cooling Console TGUI Heavy Scrubber Control (and body scanner fix) TGUI trinary devices & shutoff monitor TGUI Telecomms Log Browser TGUI Telecomms Machine Browser TGUI Spaceheater Internal Panel TGUI Gravity Generator TGUI Id Cards & Fix ID Card Images TGUI Id Card Redesign TGUI Turbolift TGUI Suit Cycler & Suit Storage Unit & Vending Fixes TGUI Power Monitor TGUI Signalers TGUI Employment Records TGUI Drone Console TGUI RIGSuits TGUI PA & PACMAN, and Margin Fix TGUI Solar Panels & Fix Power Monitor Adjust TGUI modules & their interaction with NTOS TGUI RCON TGUI Message Monitor Bump TGUI line limit to 120 (ParadiseSS13/Paradise#14002) TGUI Exonet & NTNet Relay TGUI Telecomms Multitool Menu TGUI Shield Capacitor & Shield Generator TGUI Supermatter-everything & Refactors
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
|
||||
|
||||
#define GENERAL_RECORD_LIST 2
|
||||
#define GENERAL_RECORD_MAINT 3
|
||||
#define GENERAL_RECORD_DATA 4
|
||||
|
||||
#define FIELD(N, V, E) list(field = N, value = V, edit = E)
|
||||
|
||||
/obj/machinery/computer/skills//TODO:SANITY
|
||||
name = "employment records console"
|
||||
desc = "Used to view, edit and maintain employment records."
|
||||
@@ -16,20 +22,40 @@
|
||||
var/screen = null
|
||||
var/datum/data/record/active1 = null
|
||||
var/a_id = null
|
||||
var/temp = null
|
||||
var/list/temp = null
|
||||
var/printing = null
|
||||
var/can_change_id = 0
|
||||
var/list/Perp
|
||||
var/tempname = null
|
||||
//Sorting Variables
|
||||
var/sortBy = "name"
|
||||
var/order = 1 // -1 = Descending - 1 = Ascending
|
||||
// The below are used to make modal generation more convenient
|
||||
var/static/list/field_edit_questions
|
||||
var/static/list/field_edit_choices
|
||||
|
||||
/obj/machinery/computer/skills/Initialize()
|
||||
..()
|
||||
field_edit_questions = list(
|
||||
// General
|
||||
"name" = "Please input new name:",
|
||||
"id" = "Please input new ID:",
|
||||
"sex" = "Please select new sex:",
|
||||
"age" = "Please input new age:",
|
||||
"fingerprint" = "Please input new fingerprint hash:",
|
||||
)
|
||||
field_edit_choices = list(
|
||||
// General
|
||||
"sex" = all_genders_text_list,
|
||||
"p_stat" = list("*Deceased*", "*SSD*", "Active", "Physically Unfit", "Disabled"),
|
||||
"m_stat" = list("*Insane*", "*Unstable*", "*Watch*", "Stable"),
|
||||
)
|
||||
|
||||
/obj/machinery/computer/skills/Destroy()
|
||||
active1 = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/computer/skills/attackby(obj/item/O as obj, var/mob/user)
|
||||
if(istype(O, /obj/item/weapon/card/id) && !scan && user.unEquip(O))
|
||||
O.loc = src
|
||||
scan = O
|
||||
to_chat(user, "You insert [O].")
|
||||
tgui_interact(user)
|
||||
else
|
||||
..()
|
||||
|
||||
@@ -43,380 +69,271 @@
|
||||
if (using_map && !(src.z in using_map.contact_levels))
|
||||
to_chat(user, "<span class='danger'>Unable to establish a connection:</span> You're too far away from the station!")
|
||||
return
|
||||
var/dat
|
||||
tgui_interact(user)
|
||||
|
||||
if (temp)
|
||||
dat = text("<TT>[]</TT><BR><BR><A href='?src=\ref[];choice=Clear Screen'>Clear Screen</A>", temp, src)
|
||||
else
|
||||
dat = text("Confirm Identity: <A href='?src=\ref[];choice=Confirm Identity'>[]</A><HR>", src, (scan ? text("[]", scan.name) : "----------"))
|
||||
if (authenticated)
|
||||
switch(screen)
|
||||
if(1.0)
|
||||
dat += {"
|
||||
<p style='text-align:center;'>"}
|
||||
dat += text("<A href='?src=\ref[];choice=Search Records'>Search Records</A><BR>", src)
|
||||
dat += text("<A href='?src=\ref[];choice=New Record (General)'>New Record</A><BR>", src)
|
||||
dat += {"
|
||||
</p>
|
||||
<table style="text-align:center;" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th>Records:</th>
|
||||
</tr>
|
||||
</table>
|
||||
<table style="text-align:center;" border="1" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th><A href='?src=\ref[src];choice=Sorting;sort=name'>Name</A></th>
|
||||
<th><A href='?src=\ref[src];choice=Sorting;sort=id'>ID</A></th>
|
||||
<th><A href='?src=\ref[src];choice=Sorting;sort=rank'>Rank</A></th>
|
||||
<th><A href='?src=\ref[src];choice=Sorting;sort=fingerprint'>Fingerprints</A></th>
|
||||
</tr>"}
|
||||
if(!isnull(data_core.general))
|
||||
for(var/datum/data/record/R in sortRecord(data_core.general, sortBy, order))
|
||||
for(var/datum/data/record/E in data_core.security)
|
||||
var/background
|
||||
dat += text("<tr style=[]><td><A href='?src=\ref[];choice=Browse Record;d_rec=\ref[]'>[]</a></td>", background, src, R, R.fields["name"])
|
||||
dat += text("<td>[]</td>", R.fields["id"])
|
||||
dat += text("<td>[]</td>", R.fields["rank"])
|
||||
dat += text("<td>[]</td>", R.fields["fingerprint"])
|
||||
dat += "</table><hr width='75%' />"
|
||||
dat += text("<A href='?src=\ref[];choice=Record Maintenance'>Record Maintenance</A><br><br>", src)
|
||||
dat += text("<A href='?src=\ref[];choice=Log Out'>{Log Out}</A>",src)
|
||||
if(2.0)
|
||||
dat += "<B>Records Maintenance</B><HR>"
|
||||
dat += "<BR><A href='?src=\ref[src];choice=Delete All Records'>Delete All Records</A><BR><BR><A href='?src=\ref[src];choice=Return'>Back</A>"
|
||||
if(3.0)
|
||||
dat += "<CENTER><B>Employment Record</B></CENTER><BR>"
|
||||
if ((istype(active1, /datum/data/record) && data_core.general.Find(active1)))
|
||||
var/icon/front = active1.fields["photo_front"]
|
||||
var/icon/side = active1.fields["photo_side"]
|
||||
user << browse_rsc(front, "front.png")
|
||||
user << browse_rsc(side, "side.png")
|
||||
dat += "<table><tr><td>"
|
||||
dat += "Name: <A href='?src=\ref[src];choice=Edit Field;field=name'>[active1.fields["name"]]</A><BR>"
|
||||
dat += "ID: <A href='?src=\ref[src];choice=Edit Field;field=id'>[active1.fields["id"]]</A><BR>\n"
|
||||
dat += "Entity Classification: <A href='?src=\ref[src];field=brain_type'>[active1.fields["brain_type"]]</A><BR>\n"
|
||||
dat += "Sex: <A href='?src=\ref[src];choice=Edit Field;field=sex'>[active1.fields["sex"]]</A><BR>\n"
|
||||
dat += "Age: <A href='?src=\ref[src];choice=Edit Field;field=age'>[active1.fields["age"]]</A><BR>\n"
|
||||
dat += "Rank: <A href='?src=\ref[src];choice=Edit Field;field=rank'>[active1.fields["rank"]]</A><BR>\n"
|
||||
dat += "Fingerprint: <A href='?src=\ref[src];choice=Edit Field;field=fingerprint'>[active1.fields["fingerprint"]]</A><BR>\n"
|
||||
dat += "Physical Status: [active1.fields["p_stat"]]<BR>\n"
|
||||
dat += "Mental Status: [active1.fields["m_stat"]]<BR><BR>\n"
|
||||
/obj/machinery/computer/skills/tgui_interact(mob/user, datum/tgui/ui = null)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "GeneralRecords", "Employee Records") // 800, 380
|
||||
ui.open()
|
||||
ui.set_autoupdate(FALSE)
|
||||
|
||||
dat += "Employment/skills summary:<BR>"
|
||||
dat += decode(active1.fields["notes"])
|
||||
dat += "<BR><BR><BR>"
|
||||
var/counter = 1
|
||||
while(src.active1.fields[text("com_[]", counter)])
|
||||
dat += text("[]<BR><A href='?src=\ref[];choice=del_c;del_c=[]'>Delete Entry</A><BR><BR>", src.active1.fields[text("com_[]", counter)], src, counter)
|
||||
counter++
|
||||
dat += "<A href='?src=\ref[src];choice=add_c'>Add Entry</A><BR><BR></td>"
|
||||
|
||||
dat += "<td align = center valign = top>Photo:<br><img src=front.png height=80 width=80 border=4>"
|
||||
dat += "<img src=side.png height=80 width=80 border=4></td></tr></table>"
|
||||
else
|
||||
dat += "<B>General Record Lost!</B><BR>"
|
||||
dat += text("\n<A href='?src=\ref[];choice=Delete Record (ALL)'>Delete Record (ALL)</A><BR><BR>\n<A href='?src=\ref[];choice=Print Record'>Print Record</A><BR>\n<A href='?src=\ref[];choice=Return'>Back</A><BR>", src, src, src)
|
||||
if(4.0)
|
||||
if(!Perp.len)
|
||||
dat += text("ERROR. String could not be located.<br><br><A href='?src=\ref[];choice=Return'>Back</A>", src)
|
||||
else
|
||||
dat += {"
|
||||
<table style="text-align:center;" cellspacing="0" width="100%">
|
||||
<tr> "}
|
||||
dat += text("<th>Search Results for '[]':</th>", tempname)
|
||||
dat += {"
|
||||
</tr>
|
||||
</table>
|
||||
<table style="text-align:center;" border="1" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>ID</th>
|
||||
<th>Rank</th>
|
||||
<th>Fingerprints</th>
|
||||
</tr> "}
|
||||
for(var/i=1, i<=Perp.len, i += 2)
|
||||
var/crimstat = ""
|
||||
var/datum/data/record/R = Perp[i]
|
||||
if(istype(Perp[i+1],/datum/data/record/))
|
||||
var/datum/data/record/E = Perp[i+1]
|
||||
crimstat = E.fields["criminal"]
|
||||
var/background
|
||||
background = "'background-color:#00FF7F;'"
|
||||
dat += text("<tr style=[]><td><A href='?src=\ref[];choice=Browse Record;d_rec=\ref[]'>[]</a></td>", background, src, R, R.fields["name"])
|
||||
dat += text("<td>[]</td>", R.fields["id"])
|
||||
dat += text("<td>[]</td>", R.fields["rank"])
|
||||
dat += text("<td>[]</td>", R.fields["fingerprint"])
|
||||
dat += text("<td>[]</td></tr>", crimstat)
|
||||
dat += "</table><hr width='75%' />"
|
||||
dat += text("<br><A href='?src=\ref[];choice=Return'>Return to index.</A>", src)
|
||||
/obj/machinery/computer/skills/tgui_data(mob/user)
|
||||
var/data[0]
|
||||
data["temp"] = temp
|
||||
data["scan"] = scan ? scan.name : null
|
||||
data["authenticated"] = authenticated
|
||||
data["rank"] = rank
|
||||
data["screen"] = screen
|
||||
data["printing"] = printing
|
||||
data["isAI"] = isAI(user)
|
||||
data["isRobot"] = isrobot(user)
|
||||
if(authenticated)
|
||||
switch(screen)
|
||||
if(GENERAL_RECORD_LIST)
|
||||
if(!isnull(data_core.general))
|
||||
var/list/records = list()
|
||||
data["records"] = records
|
||||
for(var/datum/data/record/R in sortRecord(data_core.general))
|
||||
records[++records.len] = list(
|
||||
"ref" = "\ref[R]",
|
||||
"id" = R.fields["id"],
|
||||
"name" = R.fields["name"],
|
||||
"b_dna" = R.fields["b_dna"])
|
||||
if(GENERAL_RECORD_DATA)
|
||||
var/list/general = list()
|
||||
data["general"] = general
|
||||
if(istype(active1, /datum/data/record) && data_core.general.Find(active1))
|
||||
var/list/fields = list()
|
||||
general["fields"] = fields
|
||||
fields[++fields.len] = FIELD("Name", active1.fields["name"], "name")
|
||||
fields[++fields.len] = FIELD("ID", active1.fields["id"], "id")
|
||||
fields[++fields.len] = FIELD("Sex", active1.fields["sex"], "sex")
|
||||
fields[++fields.len] = FIELD("Age", active1.fields["age"], "age")
|
||||
fields[++fields.len] = FIELD("Fingerprint", active1.fields["fingerprint"], "fingerprint")
|
||||
fields[++fields.len] = FIELD("Physical Status", active1.fields["p_stat"], null)
|
||||
fields[++fields.len] = FIELD("Mental Status", active1.fields["m_stat"], null)
|
||||
var/list/photos = list()
|
||||
general["photos"] = photos
|
||||
photos[++photos.len] = active1.fields["photo-south"]
|
||||
photos[++photos.len] = active1.fields["photo-west"]
|
||||
general["has_photos"] = (active1.fields["photo-south"] || active1.fields["photo-west"] ? 1 : 0)
|
||||
if(!active1.fields["comments"] || !islist(active1.fields["comments"]))
|
||||
active1.fields["comments"] = list()
|
||||
general["skills"] = active1.fields["notes"]
|
||||
general["comments"] = active1.fields["comments"]
|
||||
general["empty"] = 0
|
||||
else
|
||||
else
|
||||
dat += text("<A href='?src=\ref[];choice=Log In'>{Log In}</A>", src)
|
||||
user << browse(text("<HEAD><TITLE>Employment Records</TITLE></HEAD><TT>[]</TT>", dat), "window=secure_rec;size=600x400")
|
||||
onclose(user, "secure_rec")
|
||||
return
|
||||
general["empty"] = 1
|
||||
|
||||
/*Revised /N
|
||||
I can't be bothered to look more of the actual code outside of switch but that probably needs revising too.
|
||||
What a mess.*/
|
||||
/obj/machinery/computer/skills/Topic(href, href_list)
|
||||
data["modal"] = tgui_modal_data(src)
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/skills/tgui_act(action, params)
|
||||
if(..())
|
||||
return 1
|
||||
if (!( data_core.general.Find(active1) ))
|
||||
return TRUE
|
||||
|
||||
add_fingerprint(usr)
|
||||
|
||||
if(!data_core.general.Find(active1))
|
||||
active1 = null
|
||||
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(loc, /turf))) || (istype(usr, /mob/living/silicon)))
|
||||
usr.set_machine(src)
|
||||
switch(href_list["choice"])
|
||||
// SORTING!
|
||||
if("Sorting")
|
||||
// Reverse the order if clicked twice
|
||||
if(sortBy == href_list["sort"])
|
||||
if(order == 1)
|
||||
order = -1
|
||||
else
|
||||
order = 1
|
||||
else
|
||||
// New sorting order!
|
||||
sortBy = href_list["sort"]
|
||||
order = initial(order)
|
||||
//BASIC FUNCTIONS
|
||||
if("Clear Screen")
|
||||
temp = null
|
||||
|
||||
if ("Return")
|
||||
screen = 1
|
||||
. = TRUE
|
||||
if(tgui_act_modal(action, params))
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("scan")
|
||||
if(scan)
|
||||
scan.forceMove(loc)
|
||||
if(ishuman(usr) && !usr.get_active_hand())
|
||||
usr.put_in_hands(scan)
|
||||
scan = null
|
||||
else
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if(istype(I, /obj/item/weapon/card/id))
|
||||
usr.drop_item()
|
||||
I.forceMove(src)
|
||||
scan = I
|
||||
if("cleartemp")
|
||||
temp = null
|
||||
if("login")
|
||||
var/login_type = text2num(params["login_type"])
|
||||
if(login_type == LOGIN_TYPE_NORMAL && istype(scan))
|
||||
if(check_access(scan))
|
||||
authenticated = scan.registered_name
|
||||
rank = scan.assignment
|
||||
else if(login_type == LOGIN_TYPE_AI && isAI(usr))
|
||||
authenticated = usr.name
|
||||
rank = "AI"
|
||||
else if(login_type == LOGIN_TYPE_ROBOT && isrobot(usr))
|
||||
authenticated = usr.name
|
||||
var/mob/living/silicon/robot/R = usr
|
||||
rank = "[R.modtype] [R.braintype]"
|
||||
if(authenticated)
|
||||
active1 = null
|
||||
screen = GENERAL_RECORD_LIST
|
||||
else
|
||||
. = FALSE
|
||||
|
||||
if(.)
|
||||
return
|
||||
|
||||
if("Confirm Identity")
|
||||
if (scan)
|
||||
if(istype(usr,/mob/living/carbon/human) && !usr.get_active_hand())
|
||||
if(authenticated)
|
||||
. = TRUE
|
||||
switch(action)
|
||||
if("logout")
|
||||
if(scan)
|
||||
scan.forceMove(loc)
|
||||
if(ishuman(usr) && !usr.get_active_hand())
|
||||
usr.put_in_hands(scan)
|
||||
else
|
||||
scan.loc = get_turf(src)
|
||||
scan = null
|
||||
else
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if (istype(I, /obj/item/weapon/card/id) && usr.unEquip(I))
|
||||
I.loc = src
|
||||
scan = I
|
||||
|
||||
if("Log Out")
|
||||
authenticated = null
|
||||
screen = null
|
||||
active1 = null
|
||||
|
||||
if("Log In")
|
||||
if (istype(usr, /mob/living/silicon/ai))
|
||||
src.active1 = null
|
||||
src.authenticated = usr.name
|
||||
src.rank = "AI"
|
||||
src.screen = 1
|
||||
else if (istype(usr, /mob/living/silicon/robot))
|
||||
src.active1 = null
|
||||
src.authenticated = usr.name
|
||||
var/mob/living/silicon/robot/R = usr
|
||||
src.rank = R.braintype
|
||||
src.screen = 1
|
||||
else if (istype(scan, /obj/item/weapon/card/id))
|
||||
active1 = null
|
||||
if(check_access(scan))
|
||||
authenticated = scan.registered_name
|
||||
rank = scan.assignment
|
||||
screen = 1
|
||||
//RECORD FUNCTIONS
|
||||
if("Search Records")
|
||||
var/t1 = input("Search String: (Partial Name or ID or Fingerprints or Rank)", "Secure. records", null, null) as text
|
||||
if ((!( t1 ) || usr.stat || !( authenticated ) || usr.restrained() || !in_range(src, usr)))
|
||||
return
|
||||
Perp = new/list()
|
||||
t1 = lowertext(t1)
|
||||
var/list/components = splittext(t1, " ")
|
||||
if(components.len > 5)
|
||||
return //Lets not let them search too greedily.
|
||||
for(var/datum/data/record/R in data_core.general)
|
||||
var/temptext = R.fields["name"] + " " + R.fields["id"] + " " + R.fields["fingerprint"] + " " + R.fields["rank"]
|
||||
for(var/i = 1, i<=components.len, i++)
|
||||
if(findtext(temptext,components[i]))
|
||||
var/prelist = new/list(2)
|
||||
prelist[1] = R
|
||||
Perp += prelist
|
||||
for(var/i = 1, i<=Perp.len, i+=2)
|
||||
for(var/datum/data/record/E in data_core.security)
|
||||
var/datum/data/record/R = Perp[i]
|
||||
if ((E.fields["name"] == R.fields["name"] && E.fields["id"] == R.fields["id"]))
|
||||
Perp[i+1] = E
|
||||
tempname = t1
|
||||
screen = 4
|
||||
|
||||
if("Record Maintenance")
|
||||
screen = 2
|
||||
if("screen")
|
||||
screen = clamp(text2num(params["screen"]) || 0, GENERAL_RECORD_LIST, GENERAL_RECORD_MAINT)
|
||||
active1 = null
|
||||
|
||||
if ("Browse Record")
|
||||
var/datum/data/record/R = locate(href_list["d_rec"])
|
||||
if (!( data_core.general.Find(R) ))
|
||||
temp = "Record Not Found!"
|
||||
else
|
||||
for(var/datum/data/record/E in data_core.security)
|
||||
active1 = R
|
||||
screen = 3
|
||||
|
||||
/* if ("Search Fingerprints")
|
||||
var/t1 = input("Search String: (Fingerprint)", "Secure. records", null, null) as text
|
||||
if ((!( t1 ) || usr.stat || !( authenticated ) || usr.restrained() || (!in_range(src, usr)) && (!istype(usr, /mob/living/silicon))))
|
||||
return
|
||||
active1 = null
|
||||
t1 = lowertext(t1)
|
||||
for(var/datum/data/record/R in data_core.general)
|
||||
if (lowertext(R.fields["fingerprint"]) == t1)
|
||||
active1 = R
|
||||
if (!( active1 ))
|
||||
temp = text("Could not locate record [].", t1)
|
||||
else
|
||||
for(var/datum/data/record/E in data_core.security)
|
||||
if ((E.fields["name"] == active1.fields["name"] || E.fields["id"] == active1.fields["id"]))
|
||||
screen = 3 */
|
||||
|
||||
if ("Print Record")
|
||||
if (!( printing ))
|
||||
printing = 1
|
||||
sleep(50)
|
||||
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper( loc )
|
||||
P.info = "<CENTER><B>Employment Record</B></CENTER><BR>"
|
||||
if ((istype(active1, /datum/data/record) && data_core.general.Find(active1)))
|
||||
P.info += text("Name: [] ID: []<BR>\nSex: []<BR>\nAge: []<BR>\nFingerprint: []<BR>\nPhysical Status: []<BR>\nMental Status: []<BR>\nEmployment/Skills Summary:<BR>\n[]<BR>", active1.fields["name"], active1.fields["id"], active1.fields["sex"], active1.fields["age"], active1.fields["fingerprint"], active1.fields["p_stat"], active1.fields["m_stat"], decode(active1.fields["notes"]))
|
||||
else
|
||||
P.info += "<B>General Record Lost!</B><BR>"
|
||||
P.info += "</TT>"
|
||||
if(active1)
|
||||
P.name = "Employment Record ([active1.fields["name"]])"
|
||||
else
|
||||
P.name = "Employment Record (Unknown/Invald Entry)"
|
||||
log_debug("[usr] ([usr.ckey]) attempted to print a null employee record, this should be investigated.")
|
||||
printing = null
|
||||
// Add comment
|
||||
if ("add_c")
|
||||
if (!( istype(src.active1, /datum/data/record) ))
|
||||
return
|
||||
var/a1 = src.active1
|
||||
var/t1 = sanitize(input("Add Comment:", "Emp. records", null, null) as message)
|
||||
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active1 != a1))
|
||||
return
|
||||
var/counter = 1
|
||||
while(src.active1.fields[text("com_[]", counter)])
|
||||
counter++
|
||||
src.active1.fields[text("com_[counter]")] = text("Made by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD")] [stationtime2text()], [game_year]<BR>[t1]")
|
||||
// Delete comment
|
||||
if ("del_c")
|
||||
var/target = href_list["del_c"]
|
||||
if (istype(src.active1, /datum/data/record) && src.active1.fields["com_[target]"])
|
||||
src.active1.fields["com_[target]"] = "<B>Deleted</B>"
|
||||
|
||||
|
||||
//RECORD DELETE
|
||||
if ("Delete All Records")
|
||||
temp = ""
|
||||
temp += "Are you sure you wish to delete all Employment records?<br>"
|
||||
temp += "<a href='?src=\ref[src];choice=Purge All Records'>Yes</a><br>"
|
||||
temp += "<a href='?src=\ref[src];choice=Clear Screen'>No</a>"
|
||||
|
||||
if ("Purge All Records")
|
||||
if(PDA_Manifest.len)
|
||||
if("del_all")
|
||||
if(PDA_Manifest)
|
||||
PDA_Manifest.Cut()
|
||||
for(var/datum/data/record/R in data_core.security)
|
||||
for(var/datum/data/record/R in data_core.general)
|
||||
qdel(R)
|
||||
temp = "All Employment records deleted."
|
||||
set_temp("All employment records deleted.")
|
||||
if("del_r")
|
||||
if(PDA_Manifest)
|
||||
PDA_Manifest.Cut()
|
||||
if(active1)
|
||||
for(var/datum/data/record/R in data_core.medical)
|
||||
if ((R.fields["name"] == active1.fields["name"] || R.fields["id"] == active1.fields["id"]))
|
||||
qdel(R)
|
||||
set_temp("Employment record deleted.")
|
||||
QDEL_NULL(active1)
|
||||
if("d_rec")
|
||||
var/datum/data/record/general_record = locate(params["d_rec"] || "")
|
||||
if(!data_core.general.Find(general_record))
|
||||
set_temp("Record not found.", "danger")
|
||||
return
|
||||
|
||||
if ("Delete Record (ALL)")
|
||||
if (active1)
|
||||
temp = "<h5>Are you sure you wish to delete the record (ALL)?</h5>"
|
||||
temp += "<a href='?src=\ref[src];choice=Delete Record (ALL) Execute'>Yes</a><br>"
|
||||
temp += "<a href='?src=\ref[src];choice=Clear Screen'>No</a>"
|
||||
//RECORD CREATE
|
||||
if ("New Record (General)")
|
||||
if(PDA_Manifest.len)
|
||||
active1 = general_record
|
||||
screen = GENERAL_RECORD_DATA
|
||||
if("new")
|
||||
if(PDA_Manifest)
|
||||
PDA_Manifest.Cut()
|
||||
active1 = data_core.CreateGeneralRecord()
|
||||
screen = GENERAL_RECORD_DATA
|
||||
set_temp("Employment record created.", "success")
|
||||
if("del_c")
|
||||
var/index = text2num(params["del_c"] || "")
|
||||
if(!index || !istype(active1, /datum/data/record))
|
||||
return
|
||||
|
||||
//FIELD FUNCTIONS
|
||||
if ("Edit Field")
|
||||
var/a1 = active1
|
||||
switch(href_list["field"])
|
||||
if("name")
|
||||
if (istype(active1, /datum/data/record))
|
||||
var/t1 = sanitizeName(input("Please input name:", "Secure. records", active1.fields["name"], null) as text)
|
||||
if ((!( t1 ) || !length(trim(t1)) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon)))) || active1 != a1)
|
||||
return
|
||||
active1.fields["name"] = t1
|
||||
if("id")
|
||||
if (istype(active1, /datum/data/record))
|
||||
var/t1 = sanitize(input("Please input id:", "Secure. records", active1.fields["id"], null) as text)
|
||||
if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || active1 != a1))
|
||||
return
|
||||
active1.fields["id"] = t1
|
||||
if("fingerprint")
|
||||
if (istype(active1, /datum/data/record))
|
||||
var/t1 = sanitize(input("Please input fingerprint hash:", "Secure. records", active1.fields["fingerprint"], null) as text)
|
||||
if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || active1 != a1))
|
||||
return
|
||||
active1.fields["fingerprint"] = t1
|
||||
if("sex")
|
||||
if (istype(active1, /datum/data/record))
|
||||
if (active1.fields["sex"] == "Male")
|
||||
active1.fields["sex"] = "Female"
|
||||
else
|
||||
active1.fields["sex"] = "Male"
|
||||
if("age")
|
||||
if (istype(active1, /datum/data/record))
|
||||
var/t1 = input("Please input age:", "Secure. records", active1.fields["age"], null) as num
|
||||
if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || active1 != a1))
|
||||
return
|
||||
active1.fields["age"] = t1
|
||||
if("rank")
|
||||
var/list/L = list( "Head of Personnel", "Colony Director", "AI" )
|
||||
//This was so silly before the change. Now it actually works without beating your head against the keyboard. /N
|
||||
if ((istype(active1, /datum/data/record) && L.Find(rank)))
|
||||
temp = "<h5>Rank:</h5>"
|
||||
temp += "<ul>"
|
||||
for(var/rank in joblist)
|
||||
temp += "<li><a href='?src=\ref[src];choice=Change Rank;rank=[rank]'>[rank]</a></li>"
|
||||
temp += "</ul>"
|
||||
else
|
||||
alert(usr, "You do not have the required rank to do this!")
|
||||
if("species")
|
||||
if (istype(active1, /datum/data/record))
|
||||
var/t1 = sanitize(input("Please enter race:", "General records", active1.fields["species"], null) as message)
|
||||
if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || active1 != a1))
|
||||
return
|
||||
active1.fields["species"] = t1
|
||||
var/list/comments = active1.fields["comments"]
|
||||
index = clamp(index, 1, length(comments))
|
||||
if(comments[index])
|
||||
comments.Cut(index, index + 1)
|
||||
if("print_p")
|
||||
if(!printing)
|
||||
printing = TRUE
|
||||
// playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, TRUE)
|
||||
SStgui.update_uis(src)
|
||||
addtimer(CALLBACK(src, .proc/print_finish), 5 SECONDS)
|
||||
else
|
||||
return FALSE
|
||||
|
||||
//TEMPORARY MENU FUNCTIONS
|
||||
else//To properly clear as per clear screen.
|
||||
temp=null
|
||||
switch(href_list["choice"])
|
||||
if ("Change Rank")
|
||||
if (active1)
|
||||
if(PDA_Manifest.len)
|
||||
PDA_Manifest.Cut()
|
||||
active1.fields["rank"] = href_list["rank"]
|
||||
if(href_list["rank"] in joblist)
|
||||
active1.fields["real_rank"] = href_list["real_rank"]
|
||||
|
||||
if ("Delete Record (ALL) Execute")
|
||||
if (active1)
|
||||
if(PDA_Manifest.len)
|
||||
PDA_Manifest.Cut()
|
||||
for(var/datum/data/record/R in data_core.medical)
|
||||
if ((R.fields["name"] == active1.fields["name"] || R.fields["id"] == active1.fields["id"]))
|
||||
qdel(R)
|
||||
else
|
||||
qdel(active1)
|
||||
/**
|
||||
* Called in tgui_act() to process modal actions
|
||||
*
|
||||
* Arguments:
|
||||
* * action - The action passed by tgui
|
||||
* * params - The params passed by tgui
|
||||
*/
|
||||
/obj/machinery/computer/skills/proc/tgui_act_modal(action, params)
|
||||
. = TRUE
|
||||
var/id = params["id"] // The modal's ID
|
||||
var/list/arguments = istext(params["arguments"]) ? json_decode(params["arguments"]) : params["arguments"]
|
||||
switch(tgui_modal_act(src, action, params))
|
||||
if(TGUI_MODAL_OPEN)
|
||||
switch(id)
|
||||
if("edit")
|
||||
var/field = arguments["field"]
|
||||
if(!length(field) || !field_edit_questions[field])
|
||||
return
|
||||
var/question = field_edit_questions[field]
|
||||
var/choices = field_edit_choices[field]
|
||||
if(length(choices))
|
||||
tgui_modal_choice(src, id, question, arguments = arguments, value = arguments["value"], choices = choices)
|
||||
else
|
||||
temp = "This function does not appear to be working at the moment. Our apologies."
|
||||
tgui_modal_input(src, id, question, arguments = arguments, value = arguments["value"])
|
||||
if("add_c")
|
||||
tgui_modal_input(src, id, "Please enter your message:")
|
||||
else
|
||||
return FALSE
|
||||
if(TGUI_MODAL_ANSWER)
|
||||
var/answer = params["answer"]
|
||||
switch(id)
|
||||
if("edit")
|
||||
var/field = arguments["field"]
|
||||
if(!length(field) || !field_edit_questions[field])
|
||||
return
|
||||
var/list/choices = field_edit_choices[field]
|
||||
if(length(choices) && !(answer in choices))
|
||||
return
|
||||
|
||||
add_fingerprint(usr)
|
||||
updateUsrDialog()
|
||||
return
|
||||
if(field == "age")
|
||||
answer = text2num(answer)
|
||||
|
||||
if(istype(active1) && (field in active1.fields))
|
||||
active1.fields[field] = answer
|
||||
. = TRUE
|
||||
if("add_c")
|
||||
if(!length(answer) || !istype(active1) || !length(authenticated))
|
||||
return
|
||||
active1.fields["comments"] += list(list(
|
||||
header = "Made by [authenticated] ([rank]) at [worldtime2stationtime(world.time)]",
|
||||
text = answer
|
||||
))
|
||||
else
|
||||
return FALSE
|
||||
else
|
||||
return FALSE
|
||||
|
||||
/**
|
||||
* Called when the print timer finishes
|
||||
*/
|
||||
/obj/machinery/computer/skills/proc/print_finish()
|
||||
var/obj/item/weapon/paper/P = new(loc)
|
||||
P.info = "<center><b>Medical Record</b></center><br>"
|
||||
if(istype(active1, /datum/data/record) && data_core.general.Find(active1))
|
||||
P.info += {"Name: [active1.fields["name"]] ID: [active1.fields["id"]]
|
||||
<br>\nSex: [active1.fields["sex"]]
|
||||
<br>\nAge: [active1.fields["age"]]
|
||||
<br>\nFingerprint: [active1.fields["fingerprint"]]
|
||||
<br>\nPhysical Status: [active1.fields["p_stat"]]
|
||||
<br>\nMental Status: [active1.fields["m_stat"]]<br>
|
||||
<br>\nEmployment/Skills Summary: [active1.fields["notes"]]
|
||||
<br>\n
|
||||
<center><b>Comments/Log</b></center><br>"}
|
||||
for(var/c in active1.fields["comments"])
|
||||
P.info += "[c]<br>"
|
||||
else
|
||||
P.info += "<b>General Record Lost!</b><br>"
|
||||
P.info += "</tt>"
|
||||
P.name = "paper - 'Employment Record: [active1.fields["name"]]'"
|
||||
printing = FALSE
|
||||
SStgui.update_uis(src)
|
||||
|
||||
/**
|
||||
* Sets a temporary message to display to the user
|
||||
*
|
||||
* Arguments:
|
||||
* * text - Text to display, null/empty to clear the message from the UI
|
||||
* * style - The style of the message: (color name), info, success, warning, danger, virus
|
||||
*/
|
||||
/obj/machinery/computer/skills/proc/set_temp(text = "", style = "info", update_now = FALSE)
|
||||
temp = list(text = text, style = style)
|
||||
if(update_now)
|
||||
SStgui.update_uis(src)
|
||||
|
||||
/obj/machinery/computer/skills/emp_act(severity)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
|
||||
Reference in New Issue
Block a user