Welcome Screen (#535)

The idea is to consolidate all of the spam that you see on the lower right panel into one concrete, semi-persistent pop-up window. Utilizing bootstrap, it'll show you a neat welcome screen, the message of the day, staff memos (if accessible), and a personalized set of notifications. The system is set up for easy future expansion, as well.
This commit is contained in:
skull132
2016-07-11 16:48:58 +03:00
committed by GitHub
parent 8428a94b99
commit 3663ddcfed
25 changed files with 741 additions and 103 deletions
@@ -113,8 +113,6 @@
var/DBQuery/query = dbcon.NewQuery("SELECT ban_mirror_id, player_ckey, ban_mirror_ip, ban_mirror_computerid, date(ban_mirror_datetime) as datetime FROM ss13_ban_mirrors WHERE ban_id = :ban_id")
query.Execute(list(":ban_id" = ban_id))
testing("Ban ID: [ban_id]")
var/mirrors[] = list()
while (query.NextRow())
var/items[] = list()
-54
View File
@@ -1,54 +0,0 @@
#define MEMOFILE "data/memo.sav" //where the memos are saved
#define ENABLE_MEMOS 1 //using a define because screw making a config variable for it. This is more efficient and purty.
//switch verb so we don't spam up the verb lists with like, 3 verbs for this feature.
/client/proc/admin_memo(task in list("write","show","delete"))
set name = "Memo"
set category = "Server"
if(!ENABLE_MEMOS) return
if(!check_rights(0)) return
switch(task)
if("write") admin_memo_write()
if("show") admin_memo_show()
if("delete") admin_memo_delete()
//write a message
/client/proc/admin_memo_write()
var/savefile/F = new(MEMOFILE)
if(F)
var/memo = sanitize(input(src,"Type your memo\n(Leaving it blank will delete your current memo):","Write Memo",null) as null|message, extra = 0)
switch(memo)
if(null)
return
if("")
F.dir.Remove(ckey)
src << "<b>Memo removed</b>"
return
if( findtext(memo,"<script",1,0) )
return
F[ckey] << "[key] on [time2text(world.realtime,"(DDD) DD MMM hh:mm")]<br>[memo]"
message_admins("[key] set an admin memo:<br>[memo]")
//show all memos
/client/proc/admin_memo_show()
if(ENABLE_MEMOS)
var/savefile/F = new(MEMOFILE)
if(F)
for(var/ckey in F.dir)
src << "<center><span class='motd'><b>Admin Memo</b><i> by [F[ckey]]</i></span></center>"
//delete your own or somebody else's memo
/client/proc/admin_memo_delete()
var/savefile/F = new(MEMOFILE)
if(F)
var/ckey
if(check_rights(R_SERVER,0)) //high ranking admins can delete other admin's memos
ckey = input(src,"Whose memo shall we remove?","Remove Memo",null) as null|anything in F.dir
else
ckey = src.ckey
if(ckey)
F.dir.Remove(ckey)
src << "<b>Removed Memo created by [ckey].</b>"
#undef MEMOFILE
#undef ENABLE_MEMOS
@@ -0,0 +1,80 @@
/*
* A file containing the admin commands for interfacing with the server_greeting datum.
*/
/client/proc/admin_edit_motd()
set name = "Edit MotD"
set category = "Server"
if (!check_rights(R_SERVER))
return
var/new_message = input(usr, "Please edit the Message of the Day as necessary.", "Message of the Day", server_greeting.motd) as message
if (!new_message)
new_message = "<center>This is a palceholder. Pester your staff to change it!</center>"
server_greeting.update_value("motd", new_message)
message_admins("[ckey] has edited the message of the day:<br>[html_encode(new_message)]")
/client/proc/admin_memo_control(task in list("write", "delete"))
set name = "Edit Memos"
set category = "Server"
if (!check_rights(R_ADMIN))
return
switch (task)
if ("write")
admin_memo_write()
if ("delete")
admin_memo_delete()
/client/proc/admin_memo_write()
var/current_memo = ""
if (server_greeting.memo_list.len && server_greeting.memo_list[ckey])
current_memo = server_greeting.memo_list[ckey]
var/new_memo = input(usr, "Please write your memo.", "Memo", current_memo) as message
if (server_greeting.update_value("memo_write", list(ckey, new_memo)))
src << "<span class='notice'>Operation carried out successfully.</span>"
message_admins("[ckey] wrote a new memo:<br>[html_encode(new_memo)]")
else
src << "<span class='danger'>Error carrying out desired operation.</span>"
return
/client/proc/admin_memo_delete()
if (!server_greeting.memo_list.len)
src << "<span class='notice'>No memos are currently saved.</span>"
return
if (!check_rights(R_SERVER))
if (!server_greeting.memo_list[ckey])
src << "<span class='warning'>You do not have a memo saved. Cancelling.</span>"
else if (alert("Do you wish to delete your own memo, written on [server_greeting.memo_list[ckey]["date"]]?", "Choices", "Yes", "No") == "Yes")
if (server_greeting.update_value("memo_delete", ckey))
src << "<span class='notice'>Operation carried out successfully.</span>"
message_admins("[ckey] has deleted their own memo.")
else
src << "<span class='danger'>Error carrying out desired operation.</span>"
else
src << "<span class='notice'>Cancelled.</span>"
return
else
var/input = input(usr, "Whose memo shall we delete?", "Remove Memo", null) as null|anything in server_greeting.memo_list
if (!input)
src << "<span class='notice'>Cancelled.</span>"
return
if (server_greeting.update_value("memo_delete", input))
src << "<span class='notice'>Operation carried out successfully.</span>"
message_admins("[ckey] has deleted the memo of [input].")
else
src << "<span class='danger'>Error carrying out desired operation.</span>"
return
+3 -2
View File
@@ -50,7 +50,7 @@ var/list/admin_verbs_admin = list(
/client/proc/rename_silicon, /*properly renames silicons*/
/client/proc/manage_silicon_laws, /* Allows viewing and editing silicon laws. */
/client/proc/check_antagonists,
/client/proc/admin_memo, /*admin memo system. show/delete/write. +SERVER needed to delete admin memos of others*/
/client/proc/admin_memo_control, /*admin memo system. show/delete/write. +SERVER needed to delete admin memos of others*/
/client/proc/dsay, /*talk in deadchat using our ckey/fakekey*/
/client/proc/toggleprayers, /*toggles prayers on/off*/
// /client/proc/toggle_hear_deadcast, /*toggles whether we hear deadchat*/
@@ -155,7 +155,8 @@ var/list/admin_verbs_server = list(
/datum/admins/proc/toggle_space_ninja,
/client/proc/toggle_random_events,
/client/proc/check_customitem_activity,
/client/proc/nanomapgen_DumpImage
/client/proc/nanomapgen_DumpImage,
/client/proc/admin_edit_motd
)
var/list/admin_verbs_debug = list(
/client/proc/getruntimelog, /*allows us to access runtime logs to somebody*/
+8 -8
View File
@@ -183,11 +183,10 @@
warnings_check()
/*
* A proc to alert you if you have unacknowledged warnings.
* Called in /client/New (client procs.dm)
* A proc to gather notifications regarding your warnings.
* Called by /datum/preferences/proc/gather_notifications() in preferences.dm
*/
/client/proc/warnings_alert()
/client/proc/warnings_gather()
var/count = 0
var/count_expire = 0
@@ -210,12 +209,13 @@
while (query.NextRow())
count++
var/list/data = list("unread" = "", "expired" = "")
if (count)
src << "<br>"
src << "<font color=red><b>You have [count] unread [count > 1 ? "warnings" : "warning"]! Click <a href='byond://?src=\ref[src];warnview=1'>here</a> to review and acknowledge them!</b></font>"
data["unread"] = "You have <b>[count] unread [count > 1 ? "warnings" : "warning"]!</b> Click <a href='?JSlink=warnings;notification=:src_ref'>here</a> to review and acknowledge them!"
if (count_expire)
src << "<br>"
src << "<font color=blue><b>[count_expire] of your warnings expired.</b></font>"
data["expired"] = "[count_expire] of your warnings have expired."
return data
/*
* A proc for an admin/moderator to look up a member's warnings.