mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-24 13:47:33 +01:00
Buffs library book management
This commit is contained in:
@@ -39,25 +39,46 @@ var/global/datum/book_manager/book_mgr = new()
|
||||
if(!src.holder)
|
||||
to_chat(src, "Only administrators may use this command.")
|
||||
return
|
||||
//VOREStation Edit Start
|
||||
var/obj/machinery/librarycomp/our_comp
|
||||
for(var/obj/machinery/librarycomp/l in world)
|
||||
if(istype(l, /obj/machinery/librarycomp))
|
||||
our_comp = l
|
||||
break
|
||||
|
||||
var/isbn = tgui_input_number(usr, "ISBN number?", "Delete Book")
|
||||
if(!isbn)
|
||||
if(!our_comp)
|
||||
to_chat(usr, "<span class = 'warning'>Unable to locate a library computer to use for book deleting.</span>")
|
||||
return
|
||||
|
||||
if(BOOKS_USE_SQL && config.sql_enabled)
|
||||
var/DBConnection/dbcon = new()
|
||||
dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]")
|
||||
if(!dbcon.IsConnected())
|
||||
tgui_alert_async(usr, "Connection to Archive has been severed. Aborting.")
|
||||
return
|
||||
var/dat = "<HEAD><TITLE>Book Inventory Management</TITLE></HEAD><BODY>\n" // <META HTTP-EQUIV='Refresh' CONTENT='10'>
|
||||
dat += "<h3>ADMINISTRATIVE MANAGEMENT</h3>"
|
||||
establish_old_db_connection()
|
||||
|
||||
if(!dbcon_old.IsConnected())
|
||||
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font>"
|
||||
else
|
||||
var/DBQuery/query = dbcon.NewQuery("DELETE FROM library WHERE id=[isbn]")
|
||||
if(!query.Execute())
|
||||
to_chat(usr,query.ErrorMsg())
|
||||
dbcon.Disconnect()
|
||||
else
|
||||
book_mgr.remove(isbn)
|
||||
log_admin("[usr.key] has deleted the book [isbn]")
|
||||
dat += {"<A href='?our_comp=\ref[our_comp];orderbyid=1'>(Order book by SS<sup>13</sup>BN)</A><BR><BR>
|
||||
<table>
|
||||
<tr><td><A href='?our_comp=\ref[our_comp];sort=author>AUTHOR</A></td><td><A href='?our_comp=\ref[our_comp];sort=title>TITLE</A></td><td><A href='?our_comp=\ref[our_comp];sort=category>CATEGORY</A></td><td></td></tr>"}
|
||||
var/DBQuery/query = dbcon_old.NewQuery("SELECT id, author, title, category FROM library ORDER BY [sortby]")
|
||||
query.Execute()
|
||||
|
||||
var/show_admin_options = check_rights(R_ADMIN, show_msg = FALSE)
|
||||
|
||||
while(query.NextRow())
|
||||
var/id = query.item[1]
|
||||
var/author = query.item[2]
|
||||
var/title = query.item[3]
|
||||
var/category = query.item[4]
|
||||
dat += "<tr><td>[author]</td><td>[title]</td><td>[category]</td><td>"
|
||||
if(show_admin_options) // This isn't the only check, since you can just href-spoof press this button. Just to tidy things up.
|
||||
dat += "<A href='?our_comp=\ref[our_comp];delid=[id]'>\[Del\]</A>"
|
||||
dat += "</td></tr>"
|
||||
dat += "</table>"
|
||||
|
||||
usr << browse(dat, "window=library")
|
||||
onclose(usr, "library")
|
||||
//VOREStation Edit End
|
||||
|
||||
// delete a book
|
||||
/datum/book_manager/proc/remove(var/id)
|
||||
|
||||
@@ -129,7 +129,8 @@ var/list/admin_verbs_admin = list(
|
||||
/datum/admins/proc/view_feedback,
|
||||
/client/proc/make_mentor,
|
||||
/client/proc/unmake_mentor,
|
||||
/client/proc/removetickets
|
||||
/client/proc/removetickets,
|
||||
/client/proc/delbook
|
||||
)
|
||||
|
||||
var/list/admin_verbs_ban = list(
|
||||
|
||||
@@ -73,4 +73,55 @@
|
||||
log_and_message_admins("removed a security ticket from the global list: \"[input]\"", usr)
|
||||
|
||||
else
|
||||
tgui_alert_async(usr, "The ticket list is empty.","Empty")
|
||||
<<<<<<< HEAD
|
||||
tgui_alert_async(usr, "The ticket list is empty.","Empty")
|
||||
=======
|
||||
tgui_alert_async(usr, "The ticket list is empty.","Empty")
|
||||
|
||||
/client/proc/delbook()
|
||||
set name = "Delete Book"
|
||||
set desc = "Permamently deletes a book from the database."
|
||||
set category = "Admin"
|
||||
if(!src.holder)
|
||||
to_chat(src, "Only administrators may use this command.")
|
||||
return
|
||||
|
||||
var/obj/machinery/librarycomp/our_comp
|
||||
for(var/obj/machinery/librarycomp/l in world)
|
||||
if(istype(l, /obj/machinery/librarycomp))
|
||||
our_comp = l
|
||||
break
|
||||
|
||||
if(!our_comp)
|
||||
to_chat(usr, "<span class = 'warning'>Unable to locate a library computer to use for book deleting.</span>")
|
||||
return
|
||||
|
||||
var/dat = "<HEAD><TITLE>Book Inventory Management</TITLE></HEAD><BODY>\n"
|
||||
dat += "<h3>ADMINISTRATIVE MANAGEMENT</h3>"
|
||||
establish_old_db_connection()
|
||||
|
||||
if(!dbcon_old.IsConnected())
|
||||
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font>"
|
||||
else
|
||||
dat += {"<A href='?our_comp=\ref[our_comp];orderbyid=1'>(Order book by SS<sup>13</sup>BN)</A><BR><BR>
|
||||
<table>
|
||||
<tr><td><A href='?our_comp=\ref[our_comp];sort=author>AUTHOR</A></td><td><A href='?our_comp=\ref[our_comp];sort=title>TITLE</A></td><td><A href='?our_comp=\ref[our_comp];sort=category>CATEGORY</A></td><td></td></tr>"}
|
||||
var/DBQuery/query = dbcon_old.NewQuery("SELECT id, author, title, category FROM library ORDER BY [our_comp.sortby]")
|
||||
query.Execute()
|
||||
|
||||
var/show_admin_options = check_rights(R_ADMIN, show_msg = FALSE)
|
||||
|
||||
while(query.NextRow())
|
||||
var/id = query.item[1]
|
||||
var/author = query.item[2]
|
||||
var/title = query.item[3]
|
||||
var/category = query.item[4]
|
||||
dat += "<tr><td>[author]</td><td>[title]</td><td>[category]</td><td>"
|
||||
if(show_admin_options) // This isn't the only check, since you can just href-spoof press this button. Just to tidy things up.
|
||||
dat += "<A href='?our_comp=\ref[our_comp];delid=[id]'>\[Del\]</A>"
|
||||
dat += "</td></tr>"
|
||||
dat += "</table>"
|
||||
|
||||
usr << browse(dat, "window=library")
|
||||
onclose(usr, "library")
|
||||
>>>>>>> 2c6bd88519... Merge pull request #14140 from Very-Soft/bookmanagement
|
||||
|
||||
@@ -308,6 +308,43 @@
|
||||
user << browse(dat, "window=library")
|
||||
onclose(user, "library")
|
||||
|
||||
//VOREStation Addition Start
|
||||
/obj/machinery/librarycomp/attack_ghost(mob/user)
|
||||
|
||||
var/show_admin_options = check_rights(R_ADMIN, show_msg = FALSE)
|
||||
if(!show_admin_options)
|
||||
. = ..()
|
||||
|
||||
else
|
||||
usr.set_machine(src)
|
||||
var/dat = "<HEAD><TITLE>Book Inventory Management</TITLE></HEAD><BODY>\n" // <META HTTP-EQUIV='Refresh' CONTENT='10'>
|
||||
|
||||
dat += "<h3>ADMINISTRATIVE MANAGEMENT</h3>"
|
||||
establish_old_db_connection()
|
||||
|
||||
if(!dbcon_old.IsConnected())
|
||||
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font>"
|
||||
else
|
||||
dat += {"<A href='?src=\ref[src];orderbyid=1'>(Order book by SS<sup>13</sup>BN)</A><BR><BR>
|
||||
<table>
|
||||
<tr><td><A href='?src=\ref[src];sort=author>AUTHOR</A></td><td><A href='?src=\ref[src];sort=title>TITLE</A></td><td><A href='?src=\ref[src];sort=category>CATEGORY</A></td><td></td></tr>"}
|
||||
var/DBQuery/query = dbcon_old.NewQuery("SELECT id, author, title, category FROM library ORDER BY [sortby]")
|
||||
query.Execute()
|
||||
|
||||
while(query.NextRow())
|
||||
var/id = query.item[1]
|
||||
var/author = query.item[2]
|
||||
var/title = query.item[3]
|
||||
var/category = query.item[4]
|
||||
dat += "<tr><td>[author]</td><td>[title]</td><td>[category]</td><td><A href='?src=\ref[src];delid=[id]'>\[Del\]</A>"
|
||||
dat += "</td></tr>"
|
||||
dat += "</table>"
|
||||
dat += "<BR><A href='?src=\ref[src];switchscreen=0'>(Return to main menu)</A><BR>"
|
||||
|
||||
user << browse(dat, "window=library")
|
||||
onclose(user, "library")
|
||||
//VOREStation Addition End
|
||||
|
||||
/obj/machinery/librarycomp/emag_act(var/remaining_charges, var/mob/user)
|
||||
if (src.density && !src.emagged)
|
||||
src.emagged = 1
|
||||
@@ -455,7 +492,22 @@
|
||||
B.item_state = B.icon_state
|
||||
src.visible_message("[src]'s printer hums as it produces a completely bound book. How did it do that?")
|
||||
break
|
||||
<<<<<<< HEAD
|
||||
qdel(query) //CHOMPEdit TGSQL
|
||||
=======
|
||||
|
||||
if(href_list["delid"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
var/sqlid = sanitizeSQL(href_list["delid"])
|
||||
establish_old_db_connection()
|
||||
if(!dbcon_old.IsConnected())
|
||||
tgui_alert_async(usr, "Connection to Archive has been severed. Aborting.")
|
||||
else
|
||||
var/DBQuery/query = dbcon_old.NewQuery("DELETE FROM library WHERE id=[sqlid]")
|
||||
query.Execute()
|
||||
log_admin("[usr.key] has deleted the book [sqlid]") //VOREStation Addition
|
||||
>>>>>>> 2c6bd88519... Merge pull request #14140 from Very-Soft/bookmanagement
|
||||
|
||||
if(href_list["orderbyid"])
|
||||
var/orderid = tgui_input_number(usr, "Enter your order:")
|
||||
@@ -567,4 +619,4 @@
|
||||
b.icon_state = "book[rand(1,7)]"
|
||||
qdel(O)
|
||||
else
|
||||
..()
|
||||
..()
|
||||
|
||||
@@ -13678,6 +13678,7 @@
|
||||
/area/centcom/terminal)
|
||||
"SK" = (
|
||||
/obj/structure/table/reinforced,
|
||||
/obj/machinery/librarycomp,
|
||||
/turf/simulated/floor/tiled,
|
||||
/area/centcom/control)
|
||||
"SL" = (
|
||||
|
||||
@@ -4501,6 +4501,7 @@
|
||||
/area/shuttle/ccboat)
|
||||
"qB" = (
|
||||
/obj/structure/table/reinforced,
|
||||
/obj/machinery/librarycomp,
|
||||
/turf/simulated/floor/tiled,
|
||||
/area/centcom/control)
|
||||
"qE" = (
|
||||
|
||||
@@ -7043,6 +7043,7 @@
|
||||
/area/centcom/medical)
|
||||
"DJ" = (
|
||||
/obj/structure/table/reinforced,
|
||||
/obj/machinery/librarycomp,
|
||||
/turf/simulated/floor/tiled,
|
||||
/area/centcom/control)
|
||||
"DK" = (
|
||||
|
||||
Reference in New Issue
Block a user