!7 concept Page { S url; } concept Entry { new Ref page; int count; S key, value; S ip; } static int lines; p { dbIndexingCI(Page, 'url); lines = countLines(mySource()); } html { S url = domain() + dropTrailingSlash(uri); Pair pageAndNew = uniqCI2_sync(Page, +url); Page page = pageAndNew.a; S top = p(small(b(ahref("http://www.agi.blue", "agi.blue")) + " | " + targetBlank(progLink(), "source code") + " of this web site (" + nLines(lines) + ")")); if (eqicOneOf(url, "agi.blue", "www.agi.blue")) ret hhtml(hhead_title("agi.blue Overview") + hbody(top + h1("agi.blue Overview") + ul(map(func(S _url) -> S { ahref("http://" + _url, htmlEncode2(_url)) }, collect url(list(Page)))) )); S key = trim(params.get('key)), value = trim(params.get('value)); L entries = withDBLock(func -> L { 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, count := l(entries) + 1)); } } ret entries; }); sortByFieldInPlace created(entries); numberEntriesInConceptField count(entries); // input reset S key2 = key, value2 = value; if (nempty(key) && nempty(value)) key2 = value2 = ""; ret hhtml( hhead_title(url) + hbody_fullcenter( p(hsnippetimg(#1101682, width := 565/5, height := 800/5, title := "Robot by Peerro @ DeviantArt")) + top + h1(htmlEncode2(url) + (pageAndNew.b ? " [huh????]" : "")) + ul(map(entries, func(Entry e) -> S { "[" + e.count + "] " + htmlencode2(e.key) + ": " + b( isURL(e.value) ? ahref(e.value, htmlEncode2(e.value)) : regexpMatchesIC("[a-z0-9-]+\\.agi\\.blue", e.value) ? ahref("http://" + e.value, htmlencode2(e.value)) : htmlencode2(e.value) ) })) + hpostform( h3("Add an entry") + "Key: " + hinputfield(key := key2) + " Value: " + hinputfield(value := value2) + "

" + hsubmit("Add") ) )); }