Exemplo n.º 1
0
def preview(form):
  name = tempfile("")

  tutorial_path = wgo_contest.spool_path(name, ".tut")

  image_path = wgo_contest.spool_path(name, ".png")
  thumb_path = wgo_contest.spool_path(name, "-t.png")
  thumb_path = wgo_contest.spool_path(name, "-t.jpg")
  
  image_file = wgo_contest.spool_file(name, ".png")
  thumb_file = wgo_contest.spool_file(name, "-t.png")
  thumb_file = wgo_contest.spool_file(name, "-t.jpg")
  
  author = form.getvalue("author", "unknown")
  email = form.getvalue("email", "")
  title = form.getvalue("title", "")

  if len(form["tutorial"].value) == 0:
    wgo_contest.folio_init("GIMP 10th Anniversary Contest Preview Failed")
    print wgo.error("You didn't submit a tutorial.")
    wgo_contest.folio_fini()
    return (1)

  if len(form["image"].value) == 0:
    wgo_contest.folio_init("GIMP 10th Anniversary Contest Preview Failed")
    print wgo.error("You didn't submit an image.")
    wgo_contest.folio_fini()
    return (1)

  try:
    fp = open(tutorial_path, "w")
    fp.write(form["tutorial"].value)
    fp.close()
  except Exception, e:
    wgo_contest.folio_init("GIMP 10th Anniversary Contest Preview Failed")
    try: os.remove(tutorial_path)
    except: pass

    print wgo.error(str(e))
    wgo_contest.folio_fini()
    return (1)
Exemplo n.º 2
0
def approved(form):
  wgo_contest.folio_init("GIMP 10th Anniversary Contest Submission Approved")

  print xhtml.h1("GIMP 10th Anniversary Contest", {"class" : "heading"})
  print xhtml.para("""Welcome to the www.gimp.org splash image contest. """
                   """From here you may submit images to be considered as candidates for a "splash" image.""")
  print xhtml.h2("Thank You!", {"class" : "subtitle"})
  print xhtml.para("Again, we offer No Promises on what may become of your image here.")
  
  name = os.path.basename(form.getvalue("name", ""))
  entry = wgo_contest.gallery_image(name)
  entry["title"] = xhtml.quote(form.getvalue("title", ""))
  entry["author"] = xhtml.quote(form.getvalue("author", ""))
  entry["email"] = xhtml.quote(form.getvalue("email", ""))

  tutorial_path = wgo_contest.spool_path(name, ".tut")

  image_path = wgo_contest.spool_path(name, ".png")
  thumb_path = wgo_contest.spool_path(name, "-t.png")
  thumb_path = wgo_contest.spool_path(name, "-t.jpg")
  
  image_file = wgo_contest.gallery_file(name, ".png")
  thumb_file = wgo_contest.gallery_file(name, "-t.png")
  thumb_file = wgo_contest.gallery_file(name, "-t.jpg")
  image_html = wgo_contest.gallery_path(name, ".html")
  thumb_html = wgo_contest.gallery_path(name, "-t.html")
  
  #print "/bin/cp -f '%s' '%s' '%s'<br />" % (image_path, thumb_path, wgo_contest.config.gallery_path)
  os.system("/bin/cp -f '%s' '%s' '%s' '%s'" % (tutorial_path, image_path, thumb_path, wgo_contest.config.gallery_path))

  entry.save()

  #print xhtml.div(entry.ashtml("image"), {"class" : "splash-image"})
  print entry.ashtml("image")

  print xhtml.para("You can " + xhtml.hyperlink("submit another image", {"href" : "/contest/contest.cgi"})
                  + " or "  + xhtml.hyperlink("view the gallery.", {"href" : "/contest/gallery.cgi?display=gallery"}))

  wgo_contest.folio_fini()
  return