package ee.tpu.hk.links; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; /** * Klass HTML-i juppide hoidmideks ja töötlemiseks. * 2003 Haapsalu Kolledz * @author Berit Hiieväli */ public class func { private db dbConn = new db(); // html lehe päis public String header = ""+ "\n"+ " Lingid\n"+ " \n"+ " "+ "

CD-plaatide andmebaas


"; // JavaScript mis sulgeb brauseri public String theEnd2 = ""; // Login vorm public String loginform = "\n"+ ""+ "Log in"+ ""+ "\n"+ "

Logi sisse

"+ "
"+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ "
Kasutajanimi
Salasõna
"+ " "+ "
"+ "
"+ "\n"+ "\n\n"; public func() { } /** * Adminstraatori menüü */ public String adminMenu(HttpServletResponse vastus ) { String menu = "vaata | \n"+ "uus | \n"+ "kasutajad | \n"+ "logi välja | \n"; return menu; } /** * Tavakasutaja menüü */ public String userMenu(HttpServletResponse vastus) { String menu = "vaata | \n"+ "uus | \n"+ "logi välja | \n"; return menu; } /** * vorm plaatide lisamisels/andmete muutmiseks */ public String form(String artist, String title, String aasta, String zanr, String comment, String update,String id) { String vorm = ""+ ""+ ""+ ""+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ " "+ "
Pealkiri
Artist
Asta
Zanr
Kommentaar
 "+ "
"; return vorm; } /** * Plaatide tabel * Ainult kasutaja plaadid */ public String albumsTable(HttpServletResponse vastus, int userId, String orderBy) { String table ="

\n"+ ""+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"; try { int ci =0; String color ="#D5F0FD"; if (orderBy == null) orderBy ="artist"; String lause ="SELECT id, artist, title , zanr , aasta, comm FROM `plaadid` WHERE `user_id` = "+userId+" ORDER BY `"+orderBy+"` ASC "; ResultSet rs1 = dbConn.executeQuery(lause); int row_id =0; while(rs1.next()) { if(ci == 0) { color ="#D5F0FD"; ci = 1; }else{ color ="#E2E2E2"; ci = 0; } row_id =rs1.getInt("id"); table += " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"; } }catch (Exception e){System.out.println(e);} table +="
\n"+ " Artist\n"+ " Pealkiri\n"+ " Stiil\n"+ " AastaKommentaarMuudaKustuta
"+ rs1.getString("artist").trim() +""+ rs1.getString("title") +""+ rs1.getString("zanr") +""+rs1.getInt("aasta") +""+ rs1.getObject("comm").toString() +"muudakustuta
\n"; return table; } /** * Vorm kasutajate lisamiseks */ public String userForm() { String vorm = "\n"+ "\n"+ ""+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ " \n"+ "
Eesnimi
Perekonnanimi
Kasutajanimi
Salasõna
Salasõna uuesti
Kautaja tyyp
  \n"+ " \n"+ "
"; return vorm; } }