diff options
author | Wuzzy <almikes@aol.com> | 2016-07-31 21:21:53 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-07-31 21:21:53 +0200 |
commit | 73bf1e08bb86843a20fd339e7c39ad716e854cc2 (patch) | |
tree | ff24d171d22bbee3236d4752c22843804c33ace7 | |
parent | 0dc819a15708b5aefcf63609af08ab52470c20d2 (diff) |
Mark entry as viewed when switching tabs
-rw-r--r-- | init.lua | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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 |