{\r
localidentityidstr=(*queryvars.find("localidentityid")).second;\r
StringFunctions::Convert(localidentityidstr,localidentityid);\r
+ // insert the ID into the temporary table so we remember the identity if we load the page later\r
+ m_db->Execute("DELETE FROM tmpLocalIdentityPeerTrustPage;");\r
+ SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tmpLocalIdentityPeerTrustPage(LocalIdentityID) VALUES(?);");\r
+ st.Bind(0,localidentityid);\r
+ st.Step();\r
}\r
else\r
{\r
- SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID FROM tblLocalIdentity;");\r
+ // try to get the localidentityid if it exists in the temp table, otherwise load the first identity in the database\r
+ SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID FROM tmpLocalIdentityPeerTrustPage;");\r
st.Step();\r
if(st.RowReturned())\r
{\r
st.ResultInt(0,localidentityid);\r
StringFunctions::Convert(localidentityid,localidentityidstr);\r
}\r
+ else\r
+ {\r
+ st=m_db->Prepare("SELECT LocalIdentityID FROM tblLocalIdentity;");\r
+ st.Step();\r
+ if(st.RowReturned())\r
+ {\r
+ st.ResultInt(0,localidentityid);\r
+ StringFunctions::Convert(localidentityid,localidentityidstr);\r
+ }\r
+ st.Finalize();\r
+ }\r
}\r
\r
if(localidentityid!=-1 && queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="update")\r
content+="</tr>\r\n";\r
\r
// get count of identities we are showing\r
- sql="SELECT COUNT(*) FROM tblIdentity LEFT JOIN (SELECT IdentityID FROM tblIdentityTrust WHERE LocalIdentityID=?) AS 'tblIdentityTrust' ON tblIdentity.IdentityID=tblIdentityTrust.IdentityID ";\r
- sql+="WHERE tblIdentity.Hidden='false'";\r
+ sql="SELECT COUNT(*) FROM tblIdentity LEFT JOIN tblIdentityTrust ON tblIdentity.IdentityID=tblIdentityTrust.IdentityID ";\r
+ sql+="WHERE tblIdentity.Hidden='false' AND tblIdentityTrust.LocalIdentityID=?";\r
if(namesearch!="")\r
{\r
sql+=" AND (Name LIKE '%' || ? || '%' OR PublicKey LIKE '%' || ? || '%')";\r
st.Finalize();\r
\r
sql="SELECT tblIdentity.IdentityID,Name,tblIdentityTrust.LocalMessageTrust,PeerMessageTrust,tblIdentityTrust.LocalTrustListTrust,PeerTrustListTrust,PublicKey,tblIdentityTrust.MessageTrustComment,tblIdentityTrust.TrustListTrustComment,COUNT(MessageID) AS 'MessageCount',tblIdentity.PublishTrustList ";\r
- sql+="FROM tblIdentity LEFT JOIN (SELECT LocalIdentityID,IdentityID,LocalMessageTrust,LocalTrustListTrust,MessageTrustComment,TrustListTrustComment FROM tblIdentityTrust WHERE LocalIdentityID=?) AS tblIdentityTrust ON tblIdentity.IdentityID=tblIdentityTrust.IdentityID LEFT JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID ";\r
- sql+="WHERE tblIdentity.Hidden='false'";\r
+ sql+="FROM tblIdentity LEFT JOIN tblIdentityTrust ON tblIdentity.IdentityID=tblIdentityTrust.IdentityID LEFT JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID ";\r
+ sql+="WHERE tblIdentity.Hidden='false' AND tblIdentityTrust.LocalIdentityID=?";\r
if(namesearch!="")\r
{\r
sql+=" AND (Name LIKE '%' || ? || '%' OR PublicKey LIKE '%' || ? || '%')";\r
content+="</table>";\r
content+="</form>";\r
\r
- return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"+StringFunctions::Replace(m_template,"[CONTENT]",content);\r
+ return StringFunctions::Replace(m_template,"[CONTENT]",content);\r
}\r
\r
const std::string PeerTrustPage::GetClassString(const std::string &trustlevel)\r