summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-07-31 21:21:53 +0200
committerWuzzy <almikes@aol.com>2016-07-31 21:21:53 +0200
commit73bf1e08bb86843a20fd339e7c39ad716e854cc2 (patch)
treeff24d171d22bbee3236d4752c22843804c33ace7
parent0dc819a15708b5aefcf63609af08ab52470c20d2 (diff)
Mark entry as viewed when switching tabs
-rw-r--r--init.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index db35883..8fcecd8 100644
--- a/init.lua
+++ b/init.lua
@@ -241,14 +241,20 @@ function doc.process_form(player,formname,fields)
if fields.doc_header ~= nil then
local tab = tonumber(fields.doc_header)
local formspec, subformname, contents
+ local cid, eid
+ cid = doc.data.players[playername].category
+ eid = doc.data.players[playername].entry
if(tab==1) then
contents = doc.formspec_main()
subformname = "main"
elseif(tab==2) then
- contents = doc.formspec_category(doc.data.players[playername].category, playername)
+ contents = doc.formspec_category(cid, playername)
subformname = "category"
elseif(tab==3) then
- contents = doc.formspec_entry(doc.data.players[playername].category, doc.data.players[playername].entry)
+ contents = doc.formspec_entry(cid, eid)
+ if cid ~= nil and eid ~= nil then
+ doc.mark_entry_as_viewed(playername, cid, eid)
+ end
subformname = "entry"
end
formspec = doc.formspec_core(tab)..contents