version 0.2.4
[fms.git] / src / http / pages / localidentitiespage.cpp
index 8d5ab48..8b6afcb 100644 (file)
@@ -41,15 +41,17 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
                std::vector<std::string> singleuse;\r
                std::vector<std::string> publishtrustlist;\r
                std::vector<std::string> publishboardlist;\r
+               std::vector<std::string> publishfreesite;\r
 \r
                CreateArgArray(queryvars,"chkidentityid",ids);\r
                CreateArgArray(queryvars,"singleuse",singleuse);\r
                CreateArgArray(queryvars,"publishtrustlist",publishtrustlist);\r
                CreateArgArray(queryvars,"publishboardlist",publishboardlist);\r
+               CreateArgArray(queryvars,"publishfreesite",publishfreesite);\r
 \r
                if((*queryvars.find("formaction")).second=="update")\r
                {\r
-                       SQLite3DB::Statement update=m_db->Prepare("UPDATE tblLocalIdentity SET SingleUse=?, PublishTrustList=?, PublishBoardList=? WHERE LocalIdentityID=?;");\r
+                       SQLite3DB::Statement update=m_db->Prepare("UPDATE tblLocalIdentity SET SingleUse=?, PublishTrustList=?, PublishBoardList=?, PublishFreesite=? WHERE LocalIdentityID=?;");\r
                        for(int i=0; i<ids.size(); i++)\r
                        {\r
                                if(ids[i]!="")\r
@@ -58,7 +60,8 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
                                        update.Bind(0,singleuse[i]);\r
                                        update.Bind(1,publishtrustlist[i]);\r
                                        update.Bind(2,publishboardlist[i]);\r
-                                       update.Bind(3,id);\r
+                                       update.Bind(3,publishfreesite[i]);\r
+                                       update.Bind(4,id);\r
                                        update.Step();\r
                                        update.Reset();\r
                                }\r
@@ -81,7 +84,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
                if((*queryvars.find("formaction")).second=="export")\r
                {\r
                        IdentityExportXML xml;\r
-                       SQLite3DB::Statement exp=m_db->Prepare("SELECT Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList FROM tblLocalIdentity WHERE PublicKey IS NOT NULL AND PrivateKey IS NOT NULL;");\r
+                       SQLite3DB::Statement exp=m_db->Prepare("SELECT Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList,PublishFreesite FROM tblLocalIdentity WHERE PublicKey IS NOT NULL AND PrivateKey IS NOT NULL;");\r
                        exp.Step();\r
                        while(exp.RowReturned())\r
                        {\r
@@ -92,6 +95,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
                                bool singleuse=false;\r
                                bool publishtrustlist=false;\r
                                bool publishboardlist=false;\r
+                               bool publishfreesite=false;\r
 \r
                                exp.ResultText(0,name);\r
                                exp.ResultText(1,publickey);\r
@@ -111,8 +115,13 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
                                {\r
                                        publishboardlist=true;\r
                                }\r
+                               exp.ResultText(6,tempval);\r
+                               if(tempval=="true")\r
+                               {\r
+                                       publishfreesite=true;\r
+                               }\r
 \r
-                               xml.AddIdentity(name,publickey,privatekey,singleuse,publishtrustlist,publishboardlist);\r
+                               xml.AddIdentity(name,publickey,privatekey,singleuse,publishtrustlist,publishboardlist,publishfreesite);\r
 \r
                                exp.Step();\r
                        }\r
@@ -125,7 +134,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
                                IdentityExportXML xml;\r
                                if(xml.ParseXML((*queryvars.find("file")).second))\r
                                {\r
-                                       SQLite3DB::Statement imp=m_db->Prepare("INSERT INTO tblLocalIdentity(Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList) VALUES(?,?,?,?,?,?);");\r
+                                       SQLite3DB::Statement imp=m_db->Prepare("INSERT INTO tblLocalIdentity(Name,PublicKey,PrivateKey,SingleUse,PublishTrustList,PublishBoardList,PublishFreesite) VALUES(?,?,?,?,?,?,?);");\r
                                        for(int i=0; i<xml.GetCount(); i++)\r
                                        {\r
                                                std::string tempval="false";\r
@@ -159,6 +168,15 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
                                                        tempval="false";\r
                                                }\r
                                                imp.Bind(5,tempval);\r
+                                               if(xml.GetPublishFreesite(i))\r
+                                               {\r
+                                                       tempval="true";\r
+                                               }\r
+                                               else\r
+                                               {\r
+                                                       tempval="false";\r
+                                               }\r
+                                               imp.Bind(6,tempval);\r
                                                imp.Step();\r
                                                imp.Reset();\r
                                        }\r
@@ -187,9 +205,9 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
 \r
        content+="<form name=\"frmlocalidentity\" method=\"POST\">";\r
        content+="<input type=\"hidden\" name=\"formaction\" value=\"update\">";\r
-       content+="<table><tr><td></td><th>Name</th><th>Single Use</th><th>Publish Trust List</th><th>Publish Board List</th><th>Announced? *</th></tr>";\r
+       content+="<table><tr><td></td><th>Name</th><th>Single Use</th><th>Publish Trust List</th><th>Publish Board List</th><th>Publish Freesite</th><th>Announced? *</th></tr>";\r
 \r
-       SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID,tblLocalIdentity.Name,tblLocalIdentity.PublicKey,tbLLocalIdentity.PublishTrustList,tblLocalIdentity.SingleUse,tblLocalIdentity.PublishBoardList,tblIdentity.IdentityID FROM tblLocalIdentity LEFT JOIN tblIdentity ON tblLocalIdentity.PublicKey=tblIdentity.PublicKey ORDER BY tblLocalIdentity.Name;");\r
+       SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID,tblLocalIdentity.Name,tblLocalIdentity.PublicKey,tbLLocalIdentity.PublishTrustList,tblLocalIdentity.SingleUse,tblLocalIdentity.PublishBoardList,tblIdentity.IdentityID,tblLocalIdentity.PublishFreesite FROM tblLocalIdentity LEFT JOIN tblIdentity ON tblLocalIdentity.PublicKey=tblIdentity.PublicKey ORDER BY tblLocalIdentity.Name;");\r
        st.Step();\r
 \r
        count=0;\r
@@ -203,6 +221,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
                std::string singleuse="";\r
                std::string keypart="";\r
                std::string publishboardlist="";\r
+               std::string publishfreesite="";\r
 \r
                st.ResultText(0,id);\r
                st.ResultText(1,name);\r
@@ -210,6 +229,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
                st.ResultText(3,publishtrustlist);\r
                st.ResultText(4,singleuse);\r
                st.ResultText(5,publishboardlist);\r
+               st.ResultText(7,publishfreesite);\r
 \r
                if(publickey.size()>8)\r
                {\r
@@ -222,6 +242,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
                content+="<td>"+CreateTrueFalseDropDown("singleuse["+countstr+"]",singleuse)+"</td>";\r
                content+="<td>"+CreateTrueFalseDropDown("publishtrustlist["+countstr+"]",publishtrustlist)+"</td>";\r
                content+="<td>"+CreateTrueFalseDropDown("publishboardlist["+countstr+"]",publishboardlist)+"</td>";\r
+               content+="<td>"+CreateTrueFalseDropDown("publishfreesite["+countstr+"]",publishfreesite)+"</td>";\r
                if(st.ResultNull(6))\r
                {\r
                        content+="<td>No</td>";\r
@@ -235,7 +256,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
                count++;\r
        }\r
 \r
-       content+="<tr><td colspan=\"5\"><center><input type=\"submit\" value=\"Update Selected\"> <input type=\"submit\" value=\"Delete Selected\" onClick=\"if(confirm('Delete Selected Identities?')){frmlocalidentity.formaction.value='delete';}else{return false;}\"></td></tr>";\r
+       content+="<tr><td colspan=\"5\"><center><input type=\"submit\" value=\"Update Selected\"> <input type=\"submit\" value=\"Delete Selected\"></td></tr>";\r
        content+="</table>";\r
        content+="<p class=\"paragraph\">* An identity is considered successfully announced when you have downloaded a trust list from someone that contains the identity.</p>";\r
        content+="<p class=\"paragraph\">Single Use Identities will automatically be deleted 7 days after creation.</p>";\r