cgi shape; // -*-C-*-ish import CGI; import primitives; import Image; Void PreContent() { content("
| "); content(imageHandler(draw,d,"[Pretty picture]",d.x,d.y)); content(" | ");
idx = 0;
for p in d.ps {
case p.shape of {
Rectangle(col,rx,ry) -> shape = "Rectangle";
| Ellipse(col,ex,ey) -> shape = "Ellipse";
| Triangle(col,tb,th) -> shape = "Triangle";
}
content(shape+" at ("+p.x+","+p.y+") ");
content(linkHandler(deleteShape,(d,idx),"Delete")+" "); idx++; } content(" |
| Rectangle | "+ "X | "+textBox("rx","",5)+" | "+ "Y | "+textBox("ry","",5)+" | "+ "Width | "+textBox("rw","",5)+" | "+ "Height | "+textBox("rh","",5)+" | "+ "Colour | "+colourBox("rcol")+" | "+ ""+submit("Add Rectangle")+" |
| Ellipse | "+ "X | "+textBox("ex","",5)+" | "+ "Y | "+textBox("ey","",5)+" | "+ "Width | "+textBox("ew","",5)+" | "+ "Height | "+textBox("eh","",5)+" | "+ "Colour | "+colourBox("ecol")+" | "+ ""+submit("Add Ellipse")+" |
| Triangle | "+ "X | "+textBox("tx","",5)+" | "+ "Y | "+textBox("ty","",5)+" | "+ "Base | "+textBox("tb","",5)+" | "+ "Height | "+textBox("th","",5)+" | "+ "Colour | "+colourBox("tcol")+" | "+ ""+submit("Add Triangle")+" |
Invalid input!
"); } showDrawing(d); addShapeForm(d); } Void PostContent() { content("shape.k