--- trunk/tntnet/dynamic/adm_customer_edit.ecpp 2007/11/29 07:34:54 93 +++ trunk/tntnet/dynamic/adm_customer_edit.ecpp 2007/12/06 19:47:03 181 @@ -15,26 +15,27 @@ <%session scope="global"> std::string userName; -bool isAdmin; <%args> int id; +<{ +if (userName.size() == 0) +{ + reply.setHeader("Location", "index"); + return HTTP_MOVED_TEMPORARILY; +} +}> + + <&header title="Customer Administration"> - <{ -if (userName.size() == 0) -{ - reply.setHeader("Refresh", "0; url=login"); - return HTTP_OK; -} - if (id == -1) reply.out() << "

New Customer

\n"; else @@ -42,7 +43,7 @@ reply.out() << ""; reply.sout() << "<< back to customer list"; -reply.out() << "
"; +reply.out() << "

"; tntdb::Connection conn = tntdb::connect(dburl); @@ -64,14 +65,17 @@ //tntdb::Value v = conn.selectValue("SELECT lastval()"); //get the auto-generated id //id = v.getInt(); - reply.setHeader("Refresh", "0; url=adm_customer_list"); - return HTTP_OK; + + reply.setHeader("Location", "adm_customer_list"); + return HTTP_MOVED_TEMPORARILY; } else { tntdb::Statement st = conn.prepare("UPDATE customer SET name=:v1, address=:v2, phonenr=:v3, contactperson=:v4 WHERE id=:v5"); st.setString("v1", form_name).setString("v2", form_address).setString("v3", form_phone).setString("v4", form_contact).setInt("v5", id); st.execute(); + + reply.out() << "Customer updated
\n"; } } @@ -109,7 +113,27 @@ { }> -
+ + + + + @@ -136,16 +160,20 @@ +<{ +if (id != -1) +{ +}> +
- + - + <{ -} - - +} //fi (id != -1) +} //fi (showForm) }> <&footer>
Name: