From 9542c4d9043ca546e314c48d69f78aaecae8c55c Mon Sep 17 00:00:00 2001 From: Tayyyyyyy Date: Fri, 9 Feb 2018 03:18:27 -0600 Subject: [PATCH] Add title to newscaster feed stories --- code/game/machinery/newscaster.dm | 38 +++++++++++++++++-------------- nano/templates/newscaster.tmpl | 10 +++++++- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index f7272e8e29a..98393f01dab 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -4,6 +4,7 @@ /datum/feed_message var/author = "" + var/title = "" var/body = "" var/message_type = "Story" var/backup_body = "" @@ -42,8 +43,10 @@ is_admin_channel = 0 total_view_count = 0 -/datum/feed_channel/proc/announce_news() - return "Breaking news from [channel_name]!" +/datum/feed_channel/proc/announce_news(title="") + if(title) + return "Breaking news from [channel_name]: [title]" + return "Breaking news from [channel_name]" /datum/feed_channel/station/announce_news() return "New Station Announcement Available" @@ -87,6 +90,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co // 1 = there has var/scanned_user = "Unknown" //Will contain the name of the person who currently uses the newscaster var/msg = "" //Feed message + var/msg_title = "" // Feed message title var/obj/item/weapon/photo/photo = null var/channel_name = "" //the feed channel which will be receiving the feed, or being created var/c_locked = 0 //Will our new channel be locked to public submissions? @@ -213,6 +217,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co if(3) data["scanned_user"] = scanned_user data["channel_name"] = channel_name + data["title"] = msg_title data["msg"] = msg data["photo"] = photo ? 1 : 0 if(4) @@ -236,7 +241,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co var/list/messages = list() data["messages"] = messages for(var/datum/feed_message/M in viewing_channel.messages) - messages[++messages.len] = list("body" = M.body, "img" = M.img ? icon2base64(M.img) : null, "message_type" = M.message_type, "author" = M.author, "view_count" = M.view_count) + messages[++messages.len] = list("title" = M.title, "body" = M.body, "img" = M.img ? icon2base64(M.img) : null, "message_type" = M.message_type, "author" = M.author, "view_count" = M.view_count) if(8, 9) data["channel_name"] = viewing_channel.channel_name data["ref"] = "\ref[viewing_channel]" @@ -283,9 +288,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co return 1 if(href_list["set_channel_name"]) - channel_name = sanitizeSQL(strip_html_simple(input(usr, "Provide a Feed Channel Name", "Network Channel Handler", ""))) - while(findtext(channel_name," ") == 1) - channel_name = copytext(channel_name, 2, lentext(channel_name) + 1) + channel_name = trim(sanitizeSQL(strip_html_simple(input(usr, "Provide a Feed Channel Name", "Network Channel Handler", "")))) else if(href_list["set_channel_lock"]) c_locked = !c_locked @@ -333,10 +336,12 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co available_channels += F.channel_name channel_name = strip_html_simple(input(usr, "Choose receiving Feed Channel", "Network Channel Handler") in available_channels) + else if(href_list["set_message_title"]) + msg_title = trim(strip_html(input(usr, "Write a title for your feed story", "Network Channel Handler", ""))) + msg_title = dd_limittext(msg_title, 256) + else if(href_list["set_new_message"]) - msg = strip_html(input(usr, "Write your feed story", "Network Channel Handler", "")) - while(findtext(msg, " ") == 1) - msg = copytext(msg, 2, lentext(msg) + 1) + msg = trim(strip_html(input(usr, "Write your feed story", "Network Channel Handler", ""))) else if(href_list["set_attachment"]) AttachPhoto(usr) @@ -355,6 +360,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co else var/datum/feed_message/newMsg = new /datum/feed_message newMsg.author = scanned_user + newMsg.title = msg_title newMsg.body = msg if(photo) newMsg.img = photo.img @@ -363,7 +369,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co for(var/datum/feed_channel/FC in news_network.network_channels) if(FC.channel_name == channel_name) FC.messages += newMsg //Adding message to the network's appropriate feed_channel - announcement = FC.announce_news() + announcement = FC.announce_news(msg_title) break temp = "Feed story successfully submitted to [channel_name]." temp_back_screen = NEWSCASTER_MAIN @@ -408,14 +414,10 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co screen = NEWSCASTER_W_ISSUE_H else if(href_list["set_wanted_name"]) - channel_name = strip_html(input(usr, "Provide the name of the wanted person", "Network Security Handler", "")) - while(findtext(channel_name, " ") == 1) - channel_name = copytext(channel_name, 2, lentext(channel_name) + 1) + channel_name = trim(strip_html(input(usr, "Provide the name of the wanted person", "Network Security Handler", ""))) else if(href_list["set_wanted_desc"]) - msg = strip_html(input(usr, "Provide the a description of the wanted person and any other details you deem important", "Network Security Handler", "")) - while(findtext(msg, " ") == 1) - msg = copytext(msg, 2, lentext(msg) + 1) + msg = trim(strip_html(input(usr, "Provide the a description of the wanted person and any other details you deem important", "Network Security Handler", ""))) else if(href_list["submit_wanted"]) var/input_param = text2num(href_list["submit_wanted"]) @@ -534,6 +536,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co if(screen == NEWSCASTER_MAIN) scanned_user = "Unknown" msg = "" + msg_title = "" c_locked = 0 channel_name = "" viewing_channel = null @@ -687,7 +690,8 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co var/i = 0 for(var/datum/feed_message/MESSAGE in C.messages) i++ - dat+="-[MESSAGE.body]
" + dat+="[MESSAGE.title]
" + dat+="[MESSAGE.body]
" if(MESSAGE.img) user << browse_rsc(MESSAGE.img, "tmp_photo[i].png") dat+="
" diff --git a/nano/templates/newscaster.tmpl b/nano/templates/newscaster.tmpl index c589bde4702..47a8ac71387 100644 --- a/nano/templates/newscaster.tmpl +++ b/nano/templates/newscaster.tmpl @@ -96,6 +96,13 @@ Property of Nanotrasen
{{:helper.link('Edit', 'pencil', {'set_channel_receiving' : 1})}} +
+
Title:
+
+ {{:data.title}} + {{:helper.link('Edit', 'pencil', {'set_message_title' : 1})}} +
+
Message body:
@@ -132,7 +139,8 @@ Property of Nanotrasen
{{else}} {{for data.messages}}
- - {{:value.body}}
+ {{:value.title}}
+ {{:value.body}}
{{if value.img}}
{{/if}}