X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Fpeertrustpage.cpp;fp=src%2Fhttp%2Fpages%2Fpeertrustpage.cpp;h=38bddbf116b605bb160ab7df4cafd9a4d066547a;hb=f60495a029c54358f82956482fe203fe2b7b5b23;hp=b353243972d0d9e482c0b5cf40f1a531016d7cbe;hpb=b9c3763a932cebaa015a27fe111017f6f34dfbaa;p=fms.git diff --git a/src/http/pages/peertrustpage.cpp b/src/http/pages/peertrustpage.cpp index b353243..38bddbf 100644 --- a/src/http/pages/peertrustpage.cpp +++ b/src/http/pages/peertrustpage.cpp @@ -15,6 +15,8 @@ const std::string PeerTrustPage::GeneratePage(const std::string &method, const s std::string rowsperpagestr; int startrow=0; std::string startrowstr="0"; + std::string namesearch=""; + std::string sql; StringFunctions::Convert(rowsperpage,rowsperpagestr); @@ -68,20 +70,53 @@ const std::string PeerTrustPage::GeneratePage(const std::string &method, const s StringFunctions::Convert(startrow,startrowstr); } + // if we are searching by name + if(queryvars.find("namesearch")!=queryvars.end()) + { + namesearch=(*queryvars.find("namesearch")).second; + } + content+="

Peer Trust

"; content+="Message Trust is how much you trust the identity to post good messages. Trust List Trust is how much weight you want the trust list of that identity to have when calculating the total. The local trust levels are set by you, and the peer trust levels are calculated by a weighted average using other identities trust lists."; + content+="
"; + content+="
"; + content+=""; + content+=""; + content+="
"; + content+="
"; content+="
"; content+=""; content+=""; content+=""; content+=""; - SQLite3DB::Statement st=m_db->Prepare("SELECT COUNT(*) FROM tblIdentity;"); + // get count of identities we are showing + sql="SELECT COUNT(*) FROM tblIdentity"; + if(namesearch!="") + { + sql+=" WHERE Name LIKE '%' || ? || '%'"; + } + sql+=";"; + SQLite3DB::Statement st=m_db->Prepare(sql); + if(namesearch!="") + { + st.Bind(0,namesearch); + } st.Step(); st.ResultInt(0,identitycount); st.Finalize(); - st=m_db->Prepare("SELECT IdentityID,Name,LocalMessageTrust,PeerMessageTrust,LocalTrustListTrust,PeerTrustListTrust,PublicKey FROM tblIdentity ORDER BY Name COLLATE NOCASE LIMIT "+startrowstr+","+rowsperpagestr+";"); + sql="SELECT IdentityID,Name,LocalMessageTrust,PeerMessageTrust,LocalTrustListTrust,PeerTrustListTrust,PublicKey FROM tblIdentity"; + if(namesearch!="") + { + sql+=" WHERE Name LIKE '%' || ? || '%'"; + } + sql+=" ORDER BY Name COLLATE NOCASE LIMIT "+startrowstr+","+rowsperpagestr+";"; + st=m_db->Prepare(sql); + if(namesearch!="") + { + st.Bind(0,namesearch); + } st.Step(); while(st.RowReturned()) @@ -113,6 +148,7 @@ const std::string PeerTrustPage::GeneratePage(const std::string &method, const s content+=""; content+=""; content+=""; + content+=""; cols+=2; } if(startrow+rowsperpageNext Page -->"; + content+=""; } content+=""; }
NameLocal Message TrustPeer Message TrustLocal Trust List TrustPeer Trust List Trust
"; content+=""; + content+=""; if(name!="") { content+=SanitizeOutput(name+keypart)+"..."; @@ -121,6 +157,7 @@ const std::string PeerTrustPage::GeneratePage(const std::string &method, const s { content+="[Unknown Name]"; } + content+=""; content+=""; content+=""; @@ -146,7 +183,7 @@ const std::string PeerTrustPage::GeneratePage(const std::string &method, const s if(startrow>0) { StringFunctions::Convert(startrow-rowsperpage,tempstr); - content+="<-- Previous Page<-- Previous PageNext Page -->