Poll Fix + Link (#4655)

Fixes the permissions required for polling / the button not showing up for devs.
Adds the option to display a link in the poll
This commit is contained in:
Werner
2018-04-25 22:01:58 +02:00
committed by Erki
parent d4e9990e82
commit d4c2268c4e
5 changed files with 57 additions and 11 deletions
+3 -3
View File
@@ -99,8 +99,7 @@ var/list/admin_verbs_admin = list(
/client/proc/clear_toxins,
/client/proc/wipe_ai, // allow admins to force-wipe AIs
/client/proc/fix_player_list,
/client/proc/reset_openturf,
/client/proc/create_poll //Allows to create polls
/client/proc/reset_openturf
)
var/list/admin_verbs_ban = list(
/client/proc/unban_panel,
@@ -371,7 +370,8 @@ var/list/admin_verbs_dev = list( //will need to be altered - Ryan784
/client/proc/cmd_dev_bst,
/client/proc/lighting_show_verbs,
/client/proc/cmd_display_del_log,
/client/proc/cmd_display_init_log
/client/proc/cmd_display_init_log,
/client/proc/create_poll //Allows to create polls
)
var/list/admin_verbs_cciaa = list(
/client/proc/cmd_admin_pm_panel, /*admin-pm list*/
+9 -2
View File
@@ -2,7 +2,7 @@
set category = "Special Verbs"
set name = "Create Poll"
if(!check_rights(R_ADMIN|R_DEV))
if(!check_rights(R_DEV))
return
if(!establish_db_connection(dbcon))
to_chat(src,"<span class='danger'>Failed to establish database connection.</span>")
@@ -60,13 +60,20 @@
viewtoken = "'[sanitizeSQL(viewtoken)]'"
else
viewtoken = "NULL"
var/link = null
link = input("Do you want to provide a link to get more information?","Link") as text
if(link)
link = "'[sanitizeSQL(link)]'"
else
link = "NULL"
var/sql_ckey = sanitizeSQL(ckey)
var/question = input("Write your question","Question") as message
if(!question)
return
question = sanitizeSQL(question)
var/DBQuery/query_polladd_question = dbcon.NewQuery("INSERT INTO ss13_poll_question (polltype, starttime, endtime, question, adminonly, multiplechoiceoptions, createdby_ckey, createdby_ip, publicresult, viewtoken) VALUES ('[polltype]', '[starttime]', '[endtime]', '[question]', '[adminonly]', '[choice_amount]', '[sql_ckey]', '[address]', '[publicresult]', [viewtoken])")
var/DBQuery/query_polladd_question = dbcon.NewQuery("INSERT INTO ss13_poll_question (polltype, starttime, endtime, question, adminonly, multiplechoiceoptions, createdby_ckey, createdby_ip, publicresult, viewtoken, link) VALUES ('[polltype]', '[starttime]', '[endtime]', '[question]', '[adminonly]', '[choice_amount]', '[sql_ckey]', '[address]', '[publicresult]', [viewtoken], [link])")
if(!query_polladd_question.Execute())
var/err = query_polladd_question.ErrorMsg()
to_chat(src,"SQL ERROR adding new poll question to table. Error : \[[err]\]\n")