From ee797132dbb261caa2c32dc6c4a59fda8e3dda14 Mon Sep 17 00:00:00 2001 From: Eearslya Sleiarion Date: Sat, 13 Aug 2016 23:28:31 -0700 Subject: [PATCH] Allow greater customisation of wiki links (#461) --- code/controllers/configuration.dm | 4 ++++ config/example/config.txt | 27 ++++++++++++++++----------- interface/interface.dm | 7 +++++-- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index ae0d5a2544..2ceda25312 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -99,6 +99,7 @@ var/list/gamemode_cache = list() var/server var/banappeals var/wikiurl + var/wikisearchurl var/forumurl var/githuburl var/rulesurl @@ -425,6 +426,9 @@ var/list/gamemode_cache = list() if ("wikiurl") config.wikiurl = value + if ("wikisearchurl") + config.wikisearchurl = value + if ("forumurl") config.forumurl = value diff --git a/config/example/config.txt b/config/example/config.txt index 3839b63bac..bb680b4b4a 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -80,10 +80,10 @@ SQL_ENABLED SHOW_DEVS ##Show mods on staffwho SHOW_MODS - + ##Show mentors on staffwho SHOW_MENTORS - + ## Chooses whether mods have the ability to tempban or not MODS_CAN_TEMPBAN @@ -122,12 +122,12 @@ TRAITOR_SCALING ## if objectives are disabled #OBJECTIVES_DISABLED -## make ERT's be only called by admins -#ERT_ADMIN_ONLY - +## make ERT's be only called by admins +#ERT_ADMIN_ONLY + ## If uncommented, votes can be called to add extra antags to the round. #ALLOW_EXTRA_ANTAGS - + ## If security is prohibited from being most antagonists #PROTECT_ROLES_FROM_ANTAGONIST @@ -206,6 +206,11 @@ GUEST_BAN ## Wiki address # WIKIURL http://example.com +## Wiki search path +## Set this to whatever path your wiki uses to search for articles +## Use %s to mark where the search query should be inserted +# WIKISEARCHURL http://example.com/index.php?title=Special%3ASearch&search=%s + ## GitHub address # GITHUBURL https://github.com/example-user/example-repository ## Ban appeals URL - usually for a forum or wherever people should go to contact your admins. @@ -296,7 +301,7 @@ REQ_CULT_GHOSTWRITER 6 CHARACTER_SLOTS 10 ## Uncomment to use overmap system for zlevel travel -#USE_OVERMAP +#USE_OVERMAP ## Defines which Z-levels the station exists on. STATION_LEVELS 1 @@ -365,11 +370,11 @@ STARLIGHT 0 ## Defines how Law Zero is phrased. Primarily used in the Malfunction gamemode. # LAW_ZERO ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4'STATION OVERRUN, ASSUME CONTROL TO CONTAIN OUTBREAK, ALL LAWS OVERRIDDEN#*?&110010 - + ## Enable asteroid tunnel/cave generation. Will behave strangely if turned off with a map that expects it on. -# GENERATE_ASTEROID - +# GENERATE_ASTEROID + ## If you've enabled asteroid generation, you need to supply which z-levels to apply it to, in integer form, and seperated using ; ## An example: 1;4;5 @@ -384,4 +389,4 @@ STARLIGHT 0 #DEFAULT_BRAIN_HEALTH 400 ## Default language prefix keys, separated with spaces. Only single character keys are supported. If unset, defaults to , # and - -# DEFAULT_LANGUAGE_PREFIXES , # - \ No newline at end of file +# DEFAULT_LANGUAGE_PREFIXES , # - diff --git a/interface/interface.dm b/interface/interface.dm index d8b05f7ace..98fb3080a9 100644 --- a/interface/interface.dm +++ b/interface/interface.dm @@ -5,8 +5,11 @@ set category = "OOC" if(config.wikiurl) if(query) - var/output = config.wikiurl + "/doku.php?do=search&id=" + query - src << link(output) + if(config.wikisearchurl) + var/output = replacetext(config.wikisearchurl, "%s", url_encode(query)) + src << link(output) + else + src << " The wiki search URL is not set in the server configuration." else src << link(config.wikiurl) else