!7 concept Page { S url; } concept Entry { new Ref page; S key, value; S ip; } p { dbIndexingCI(Page, 'url); } html { S url = domain() + dropTrailingSlash(uri); Pair pageAndNew = uniqCI2_sync(Page, +url); Page page = pageAndNew.a; if (eqicOneOf(url, "agi.blue", "www.agi.blue")) ret hhtml(hhead_title("agi.blue Overview") + hbody(h1("agi.blue Overview") + ul_htmlencode(collect url(list(Page))) )); S key = trim(params.get('key)), value = trim(params.get('value)); L entries = findBackRefs(page, Entry); print("Entries: " + l(entries)); if (nempty(key) && nempty(value)) { S ip = subBot_clientIP(); if (!hasWhereIC(entries, +key, +value, +ip)) { print("SAVING"); entries.add(cnew Entry(+page, +key, +value, +ip)); } } bool form = eq(params.get('form), "1"); ret hhtml( hhead_title(url) + hbody_fullcenter( p(small(ahref("http://www.agi.blue", "agi.blue"))) + h1(htmlEncode2(url)) + p(pageAndNew.b ? "NEW!" : "seen before.") + hpostform( h3("Add an entry") + "Key: " + hinputfield(+key) + " Value: " + hinputfield(+value) + "

" + hsubmit("Add") ) + h3("Entries") + ul(map(entries, func(Entry e) -> S { htmlencode2(e.key) + ": " + b(htmlencode2(e.value)) })) )); }