mirror of
https://github.com/Aurorastation/Aurora-Old.git
synced 2026-07-18 03:02:25 +01:00
Beurocracy
Adds the ability to print forms from the request console, and to print them. Lays the groundwork for things to move over into adding more paper shenanigans.
This commit is contained in:
@@ -40,6 +40,7 @@ var/list/obj/machinery/requests_console/allConsoles = list()
|
||||
// 8 = view messages
|
||||
// 9 = authentication before sending
|
||||
// 10 = send announcement
|
||||
// 11 = form database
|
||||
var/silent = 0 // set to 1 for it not to beep all the time
|
||||
// var/hackState = 0
|
||||
// 0 = not hacked
|
||||
@@ -54,6 +55,9 @@ var/list/obj/machinery/requests_console/allConsoles = list()
|
||||
var/message = "";
|
||||
var/dpt = ""; //the department which will be receiving the message
|
||||
var/priority = -1 ; //Priority of the message being sent
|
||||
var/SQLquery
|
||||
var/paperstock = 10
|
||||
var/lid = 0
|
||||
luminosity = 0
|
||||
|
||||
/obj/machinery/requests_console/power_change()
|
||||
@@ -187,6 +191,38 @@ var/list/obj/machinery/requests_console/allConsoles = list()
|
||||
dat += text("<A href='?src=\ref[src];sendAnnouncement=1'>Announce</A><BR>");
|
||||
dat += text("<BR><A href='?src=\ref[src];setScreen=0'>Back</A><BR>")
|
||||
|
||||
if(11) //form database
|
||||
dat += text("<B>NanoTrasen Corporate Forms</B><br><br>")
|
||||
|
||||
establish_db_connection()
|
||||
|
||||
if(!dbcon.IsConnected())
|
||||
dat += text("<font color=red><b>ERROR</b>: Unable to contact external database. Please contact your system administrator for assistance.</font>")
|
||||
else
|
||||
dat += {"<table border='1'>
|
||||
<tr><th>NCF ID</th><th>Form Name</th><td></td><td></td></tr>"}
|
||||
|
||||
//For reference:
|
||||
//Command forms, 01xx series
|
||||
//Security forms, 02xx series
|
||||
//Medical forms, 03xx series
|
||||
//Engineer forms, 04xx series
|
||||
//Science forms, 05xx series
|
||||
//Supply forms, 06xx series
|
||||
//General forms, 10xx series
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery(SQLquery)
|
||||
query.Execute()
|
||||
|
||||
while(query.NextRow())
|
||||
var/id = query.item[1]
|
||||
var/name = query.item[2]
|
||||
var/department = query.item[3]
|
||||
dat += "<tr><td>NCF-[id]</td><td>[name]</td><td><a href='?src=\ref[src];sort=[department]'>[department]</a></td><td><a href='?src=\ref[src];print=[id]'>Print</a></td></tr>"
|
||||
dat += "</table>"
|
||||
dat += text("<br><A href='?src=\ref[src];setScreen=11'>Reset Search</a>")
|
||||
dat += text("<BR><A href='?src=\ref[src];setScreen=0'>Back</A><BR>")
|
||||
|
||||
else //main menu
|
||||
screen = 0
|
||||
announceAuth = 0
|
||||
@@ -198,13 +234,22 @@ var/list/obj/machinery/requests_console/allConsoles = list()
|
||||
|
||||
dat += text("<A href='?src=\ref[src];setScreen=1'>Request Assistance</A><BR>")
|
||||
dat += text("<A href='?src=\ref[src];setScreen=2'>Request Supplies</A><BR>")
|
||||
dat += text("<A href='?src=\ref[src];setScreen=3'>Relay Anonymous Information</A><BR><BR>")
|
||||
dat += text("<A href='?src=\ref[src];setScreen=3'>Relay Anonymous Information</A><BR>")
|
||||
dat += text("<A href='?src=\ref[src];setScreen=11'>NanoTrasen Corporate Form Database</A><BR><BR>")
|
||||
if(announcementConsole)
|
||||
dat += text("<A href='?src=\ref[src];setScreen=10'>Send station-wide announcement</A><BR><BR>")
|
||||
if (silent)
|
||||
dat += text("Speaker <A href='?src=\ref[src];setSilent=0'>OFF</A>")
|
||||
else
|
||||
dat += text("Speaker <A href='?src=\ref[src];setSilent=1'>ON</A>")
|
||||
if(paperstock)
|
||||
dat += text("<br>[paperstock] papers in stock.")
|
||||
else
|
||||
dat += text("<br><font color = red>No paper in stock.</font>")
|
||||
if(lid)
|
||||
dat += text("<br>Paper container lid <A href='?src=\ref[src];setLid=0'>OPEN</A>.")
|
||||
else
|
||||
dat += text("<br>Paper container lid <A href='?src=\ref[src];setLid=1'>CLOSE</A>.")
|
||||
|
||||
user << browse("[dat]", "window=request_console")
|
||||
onclose(user, "req_console")
|
||||
@@ -314,6 +359,57 @@ var/list/obj/machinery/requests_console/allConsoles = list()
|
||||
for (var/mob/O in hearers(4, src.loc))
|
||||
O.show_message(text("\icon[src] *The Requests Console beeps: 'NOTICE: No server detected!'"))
|
||||
|
||||
if(href_list["sort"])
|
||||
var/sortdep = sanitizeSQL(href_list["sort"])
|
||||
SQLquery += " WHERE department LIKE '%[sortdep]%'"
|
||||
screen = 11
|
||||
|
||||
if(href_list["print"])
|
||||
var/printid = sanitizeSQL(href_list["print"])
|
||||
establish_db_connection()
|
||||
|
||||
if(!dbcon.IsConnected())
|
||||
alert("Connection to the database lost. Aborting.")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id, name, data FROM aurora_forms WHERE id=[printid]")
|
||||
query.Execute()
|
||||
|
||||
while(query.NextRow())
|
||||
var/id = query.item[1]
|
||||
var/name = query.item[2]
|
||||
var/data = query.item[3]
|
||||
var/obj/item/weapon/paper/C = new(src.loc)
|
||||
|
||||
//Let's start the BB >> HTML conversion!
|
||||
|
||||
data = html_encode(data)
|
||||
data = replacetext(data, "\n", "<BR>")
|
||||
|
||||
C.info += data
|
||||
C.info = C.parsepencode(C.info)
|
||||
C.updateinfolinks()
|
||||
C.name = "NFC-[id] - [name]"
|
||||
|
||||
/* WIP, finish in a further update.
|
||||
|
||||
if(href_list["info"])
|
||||
var/whatisname = sanitizeSQL(href_list["info"])
|
||||
establish_db_connection()
|
||||
|
||||
if(!dbcon.IsConnected())
|
||||
alert("Connection to the database lost. Aborting.")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id, name, department, info FROM aurora_forms WHERE name=[whatisname]")
|
||||
query.Execute()
|
||||
|
||||
while(query.NextRow())
|
||||
var/id = query.item[1]
|
||||
var/name = query.item[2]
|
||||
var/department = query.item[3]
|
||||
var/info = query.item[1]
|
||||
*/
|
||||
switch( href_list["setLid"] )
|
||||
if(null) //skip
|
||||
if("1") lid = 1
|
||||
else lid = 0
|
||||
|
||||
//Handle screen switching
|
||||
switch(text2num(href_list["setScreen"]))
|
||||
@@ -339,6 +435,9 @@ var/list/obj/machinery/requests_console/allConsoles = list()
|
||||
if(10) //send announcement
|
||||
if(!announcementConsole) return
|
||||
screen = 10
|
||||
if(11) //form database
|
||||
SQLquery = "SELECT id, name, department FROM aurora_forms"
|
||||
screen = 11
|
||||
else //main menu
|
||||
dpt = ""
|
||||
msgVerified = ""
|
||||
@@ -398,8 +497,25 @@ var/list/obj/machinery/requests_console/allConsoles = list()
|
||||
var/obj/item/weapon/stamp/T = O
|
||||
msgStamped = text("<font color='blue'><b>Stamped with the [T.name]</b></font>")
|
||||
updateUsrDialog()
|
||||
if (istype(O, /obj/item/weapon/paper_bundle))
|
||||
if(lid) //More of that restocking business
|
||||
var/obj/item/weapon/paper_bundle/C = O
|
||||
paperstock += C.amount
|
||||
user.drop_item(C)
|
||||
del(C)
|
||||
for (var/mob/U in hearers(4, src.loc))
|
||||
U.show_message(text("\icon[src] *The Requests Console beeps: 'Paper added.'"))
|
||||
else
|
||||
user << "\blue I should open the lid to add more paper, or try faxing one paper at a time."
|
||||
if (istype(O, /obj/item/weapon/paper))
|
||||
if(screen == 0)
|
||||
if(lid) //Stocking them papers
|
||||
var/obj/item/weapon/paper/C = O
|
||||
user.drop_item(C)
|
||||
del(C)
|
||||
paperstock++
|
||||
for (var/mob/U in hearers(4, src.loc))
|
||||
U.show_message(text("\icon[src] *The Requests Console beeps: 'Paper added.'"))
|
||||
else if(screen == 0) //Faxing them papers
|
||||
var/pass = 0
|
||||
var/sendto = input("Select department.", "Send Fax", null, null) in allConsoles
|
||||
|
||||
@@ -411,6 +527,9 @@ var/list/obj/machinery/requests_console/allConsoles = list()
|
||||
var/sent = 0
|
||||
for (var/obj/machinery/requests_console/Console in world)
|
||||
if (Console == sendto)
|
||||
if(Console.paperstock == 0)
|
||||
alert("Error! Receiving console out of paper! Aborting!")
|
||||
return
|
||||
if(!sent)
|
||||
sent = 1
|
||||
|
||||
@@ -446,10 +565,12 @@ var/list/obj/machinery/requests_console/allConsoles = list()
|
||||
playsound(Console.loc, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
for (var/mob/player in hearers(4, Console.loc))
|
||||
player.show_message(text("\icon[Console] *The Requests Console beeps: 'Fax received'"))
|
||||
Console.paperstock--
|
||||
|
||||
if(sent == 1)
|
||||
user.show_message(text("\icon[src] *The Requests Console beeps: 'Message Sent.'"))
|
||||
|
||||
else
|
||||
user.show_message(text("\icon[src] *The Requests Console beeps: 'NOTICE: No server detected!'"))
|
||||
|
||||
return
|
||||
|
||||
@@ -70,17 +70,21 @@
|
||||
return
|
||||
|
||||
|
||||
/obj/item/weapon/paper_bin/attackby(obj/item/weapon/paper/i as obj, mob/user as mob)
|
||||
if(!istype(i))
|
||||
return
|
||||
|
||||
user.drop_item()
|
||||
i.loc = src
|
||||
user << "<span class='notice'>You put [i] in [src].</span>"
|
||||
papers.Add(i)
|
||||
amount++
|
||||
|
||||
|
||||
/obj/item/weapon/paper_bin/attackby(obj/item/weapon/O as obj, mob/user as mob)
|
||||
if(istype(O, /obj/item/weapon/paper))
|
||||
var/obj/item/weapon/paper/i = O
|
||||
user.drop_item()
|
||||
i.loc = src
|
||||
user << "<span class='notice'>You put [i] in [src].</span>"
|
||||
papers.Add(i)
|
||||
amount++
|
||||
/* if(istype(O, /obj/item/weapon/paper_pack)) WIP written in.
|
||||
var/obj/item/weapon/paper_bundle/j = O
|
||||
user.drop_item()
|
||||
amount += j.amount
|
||||
user << "<span class='notice'>You add paper from [j] into [src].</span>"
|
||||
del(j)
|
||||
*/
|
||||
/obj/item/weapon/paper_bin/examine()
|
||||
set src in oview(1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user