mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-01-05 23:12:26 +00:00
Fix links and options on VV list page.
- Fixes the dropdown options of the /list VV page to actually do anything. - Fixes the E,C,- links next to each list entry on the /list VV page to actually do anything. - Fixes the Refresh link on the /list VV page to actually refresh.
This commit is contained in:
@@ -35,6 +35,16 @@
|
||||
//Helpers for vv_do_topic(list/href_list)
|
||||
#define IF_VV_OPTION(href_key) if(href_list[href_key])
|
||||
|
||||
// vv_do_list() keys
|
||||
#define VV_HK_LIST_ADD "listadd"
|
||||
#define VV_HK_LIST_EDIT "listedit"
|
||||
#define VV_HK_LIST_CHANGE "listchange"
|
||||
#define VV_HK_LIST_REMOVE "listremove"
|
||||
#define VV_HK_LIST_ERASE_NULLS "listnulls"
|
||||
#define VV_HK_LIST_ERASE_DUPES "listdupes"
|
||||
#define VV_HK_LIST_SHUFFLE "listshuffle"
|
||||
#define VV_HK_LIST_SET_LENGTH "listlen"
|
||||
|
||||
// /datum
|
||||
#define VV_HK_DELETE "delete"
|
||||
#define VV_HK_EXPOSE "expose"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
name = DA[name] //name is really the index until this line
|
||||
else
|
||||
value = DA[name]
|
||||
header = "<li style='backgroundColor:white'>(<a href='?_src_=vars;listedit=\ref[DA];index=[index]'>E</a>) (<a href='?_src_=vars;listchange=\ref[DA];index=[index]'>C</a>) (<a href='?_src_=vars;listremove=\ref[DA];index=[index]'>-</a>) "
|
||||
header = "<li style='backgroundColor:white'>(<a href='?_src_=vars;[VV_HK_LIST_EDIT]=1;target=\ref[DA];index=[index]'>E</a>) (<a href='?_src_=vars;[VV_HK_LIST_CHANGE]=1;target=\ref[DA];index=[index]'>C</a>) (<a href='?_src_=vars;[VV_HK_LIST_REMOVE]=1;target=\ref[DA];index=[index]'>-</a>) "
|
||||
else
|
||||
header = "<li style='backgroundColor:white'>(<a href='?_src_=vars;datumedit=\ref[DA];varnameedit=[name]'>E</a>) (<a href='?_src_=vars;datumchange=\ref[DA];varnamechange=[name]'>C</a>) (<a href='?_src_=vars;datummass=\ref[DA];varnamemass=[name]'>M</a>) "
|
||||
else
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
if((usr.client != src) || !src.holder)
|
||||
return
|
||||
var/datum/target = locate(href_list["target"])
|
||||
if(target)
|
||||
if(istype(target))
|
||||
target.vv_do_topic(href_list)
|
||||
else if(islist(target))
|
||||
vv_do_list(target, href_list)
|
||||
|
||||
if(href_list["Vars"])
|
||||
debug_variables(locate(href_list["Vars"]))
|
||||
@@ -519,6 +521,6 @@
|
||||
|
||||
if(href_list["datumrefresh"])
|
||||
var/datum/DAT = locate(href_list["datumrefresh"])
|
||||
if(istype(DAT, /datum) || istype(DAT, /client))
|
||||
if(istype(DAT, /datum) || istype(DAT, /client) || islist(DAT))
|
||||
debug_variables(DAT)
|
||||
|
||||
|
||||
44
code/modules/admin/view_variables/topic_list.dm
Normal file
44
code/modules/admin/view_variables/topic_list.dm
Normal file
@@ -0,0 +1,44 @@
|
||||
//LISTS - CAN NOT DO VV_DO_TOPIC BECAUSE LISTS AREN'T DATUMS :(
|
||||
/client/proc/vv_do_list(list/target, href_list)
|
||||
if(!check_rights(R_VAREDIT))
|
||||
return
|
||||
var/target_index = text2num(href_list["index"])
|
||||
if(target_index)
|
||||
if(href_list[VV_HK_LIST_EDIT])
|
||||
mod_list(target, null, "list", "contents", target_index, autodetect_class = TRUE)
|
||||
if(href_list[VV_HK_LIST_CHANGE])
|
||||
mod_list(target, null, "list", "contents", target_index, autodetect_class = FALSE)
|
||||
if(href_list[VV_HK_LIST_REMOVE])
|
||||
var/variable = target[target_index]
|
||||
var/prompt = alert("Do you want to remove item number [target_index] from list?", "Confirm", "Yes", "No")
|
||||
if (prompt != "Yes")
|
||||
return
|
||||
target.Cut(target_index, target_index+1)
|
||||
log_world("### ListVarEdit by [src]: /list's contents: REMOVED=[html_encode("[variable]")]")
|
||||
log_admin("[key_name(src)] modified list's contents: REMOVED=[variable]")
|
||||
message_admins("[key_name_admin(src)] modified list's contents: REMOVED=[variable]")
|
||||
if(href_list[VV_HK_LIST_ADD])
|
||||
mod_list_add(target, null, "list", "contents")
|
||||
if(href_list[VV_HK_LIST_ERASE_DUPES])
|
||||
uniqueList_inplace(target)
|
||||
log_world("### ListVarEdit by [src]: /list contents: CLEAR DUPES")
|
||||
log_admin("[key_name(src)] modified list's contents: CLEAR DUPES")
|
||||
message_admins("[key_name_admin(src)] modified list's contents: CLEAR DUPES")
|
||||
if(href_list[VV_HK_LIST_ERASE_NULLS])
|
||||
listclearnulls(target)
|
||||
log_world("### ListVarEdit by [src]: /list contents: CLEAR NULLS")
|
||||
log_admin("[key_name(src)] modified list's contents: CLEAR NULLS")
|
||||
message_admins("[key_name_admin(src)] modified list's contents: CLEAR NULLS")
|
||||
if(href_list[VV_HK_LIST_SET_LENGTH])
|
||||
var/value = vv_get_value(VV_NUM)
|
||||
if (value["class"] != VV_NUM || value["value"] > max(5000, target.len)) //safety - would rather someone not put an extra 0 and erase the server's memory lmao.
|
||||
return
|
||||
target.len = value["value"]
|
||||
log_world("### ListVarEdit by [src]: /list len: [target.len]")
|
||||
log_admin("[key_name(src)] modified list's len: [target.len]")
|
||||
message_admins("[key_name_admin(src)] modified list's len: [target.len]")
|
||||
if(href_list[VV_HK_LIST_SHUFFLE])
|
||||
shuffle_inplace(target)
|
||||
log_world("### ListVarEdit by [src]: /list contents: SHUFFLE")
|
||||
log_admin("[key_name(src)] modified list's contents: SHUFFLE")
|
||||
message_admins("[key_name_admin(src)] modified list's contents: SHUFFLE")
|
||||
@@ -55,12 +55,12 @@
|
||||
if (islist)
|
||||
dropdownoptions = list(
|
||||
"---",
|
||||
"Add Item" = "?_src_=vars;listadd=[refid]",
|
||||
"Remove Nulls" = "?_src_=vars;listnulls=[refid]",
|
||||
"Remove Dupes" = "?_src_=vars;listdupes=[refid]",
|
||||
"Set len" = "?_src_=vars;listlen=[refid]",
|
||||
"Shuffle" = "?_src_=vars;listshuffle=[refid]",
|
||||
"Show VV To Player" = "?_src_=vars;expose=[refid]"
|
||||
"Add Item" = "?_src_=vars;[VV_HK_LIST_ADD]=TRUE;target=[refid]",
|
||||
"Remove Nulls" = "?_src_=vars;[VV_HK_LIST_ERASE_NULLS]=TRUE;target=[refid]",
|
||||
"Remove Dupes" = "?_src_=vars;[VV_HK_LIST_ERASE_DUPES]=TRUE;target=[refid]",
|
||||
"Set len" = "?_src_=vars;[VV_HK_LIST_SET_LENGTH]=TRUE;target=[refid]",
|
||||
"Shuffle" = "?_src_=vars;[VV_HK_LIST_SHUFFLE]=TRUE;target=[refid]",
|
||||
// "Show VV To Player" = "?_src_=vars;[VV_HK_EXPOSE]=TRUE;target=[refid]" // TODO - Not yet implemented for lists
|
||||
)
|
||||
autoconvert_dropdown = TRUE
|
||||
else
|
||||
|
||||
@@ -1392,6 +1392,7 @@
|
||||
#include "code\modules\admin\view_variables\mass_edit_variables.dm"
|
||||
#include "code\modules\admin\view_variables\modify_variables.dm"
|
||||
#include "code\modules\admin\view_variables\topic.dm"
|
||||
#include "code\modules\admin\view_variables\topic_list.dm"
|
||||
#include "code\modules\admin\view_variables\view_variables.dm"
|
||||
#include "code\modules\ai\_defines.dm"
|
||||
#include "code\modules\ai\ai_holder.dm"
|
||||
|
||||
Reference in New Issue
Block a user