Esempio n. 1
0
def edit_image(form):
  wgo.http_preamble(["Content-type: text/html"])

  wgo_admin.header('www.gimp.org - Administration - Splash Image',
                   [ {"rel" : "stylesheet", "href" : wgo_contest.config.contest_dir + "/wgo-contest.css", "type" : "text/css", "media" : "screen"} ])

  print xhtml.h1("www.gimp.org - Administrate Contest - Edit Entry", {"class" : "heading"})

  name = form["name"].value

  image = wgo_contest.gallery_image(name)
  
  cell = xhtml.table.cell
  row = xhtml.table.row

  fields = (xhtml.table.init({"cellspacing" : 6})
            + row(cell("Name:",          {"style" : "font-weight: bold"}) + cell(name))
            + row(cell("Title:",         {"style" : "font-weight: bold"}) + cell(xhtml.input.text({"name" : "title", "value" : image["title"]})))
            + row(cell("Artist's Name:", {"style" : "font-weight: bold"}) + cell(xhtml.input.text({"name" : "author", "value" : image["author"]})))
            + row(cell("Artists Email:", {"style" : "font-weight: bold"}) + cell(xhtml.input.text({"name" : "email", "value" : image["email"]})))
            + row(cell(xhtml.input.hidden({"name" : "name", "value" : name}))
                  + cell(xhtml.input.submit({"name" : "mode", "value" : "SAVE"})
                         + xhtml.input.submit({"name" : "mode", "value" : "DELETE"})))
            + xhtml.table.fini())
  
  print xhtml.para(xhtml.form(xhtml.div(fields), {"enctype" : "multipart/form-data", "method" : "post", "action" : "gallery-edit.cgi"}))

  if image.exists():
    print xhtml.div(image.ashtml("image"), {"class": "splash-image"})
  else:
    print xhtml.div(xhtml.para("That image is not available in the gallery."))
    pass

  wgo_admin.footer()
  return (0)
Esempio n. 2
0
def submit(form):
  wgo_contest.folio_init("GIMP 10th Anniversary Contest Submission")
  
  image = 'images/gimp-splash.png'
  author = "Wilber Gimp"
  email = "*****@*****.**"

  print xhtml.h1("GIMP 10th Anniversary Contest", {"class" : "heading"})
  #xhtml.div(thumb, {"class": "splash-thumb", "style" : "float: right; margin-left: 1em;"})
  print xhtml.para("""Welcome to the www.gimp.org 10th Anniversary Splash Contest.
  From here you may submit images to be considered as candidates
  for a splash image.""")

  print xhtml.h2("Submit Your Image", {"class" : "subtitle"})

  cell = xhtml.table.cell
  row = xhtml.table.row

  thumb = wgo_contest.image_generate("Your Image Here", image, "Wilber", "*****@*****.**")

  fields = (xhtml.table.init({"cellspacing" : 0})
            + row(cell("Image File name:",     {"style" : "font-weight: bold"}) + cell(xhtml.input.file({"name" : "image"})))
            + row(cell("Title:",         {"style" : "font-weight: bold"}) + cell(xhtml.input.text({"name" : "title"})))
            + row(cell("Artist's Name:", {"style" : "font-weight: bold"}) + cell(xhtml.input.text({"name" : "author"})))
            + row(cell("Artist's Email:", {"style" : "font-weight: bold"}) + cell(xhtml.input.text({"name" : "email"})))
            + row(cell("Tutorial File name:",     {"style" : "font-weight: bold"}) + cell(xhtml.input.file({"name" : "tutorial"})))
            + row(cell(xhtml.input.hidden({"name" : "mode","value" : "preview"})) + cell(xhtml.input.submit({"name" : "preview", "value" : "PREVIEW"})))
            + xhtml.table.fini())
  
  form = xhtml.form(fields, {"enctype" : "multipart/form-data",
                             "method" : "post",
                             "action" : "contest.cgi",
                             "style" : "margin: 1.33em 0px; margin-left: 40px; margin-right: 40px;" })

  guidelines = (xhtml.para("Fill in the fields below, and click the "
                             + xhtml.input.submit({"value" : "PREVIEW", "disabled" : "disabled"})
                             + " button below."))

  print guidelines
  print form

  wgo_contest.folio_fini()
  return
Esempio n. 3
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
Esempio n. 4
0
        pass
      pass
    elif action == "reject":
      status = "Reject unimplemented"
      pass
    else:
      status = "Bad action: " + form["action"].value
      pass
            
    if status == 0:
      print xhtml.table.cell("Successful", {"id" : "success"})
    else:
      print xhtml.table.cell(status, {"id" : "failure"})
      pass
        
    print xhtml.table.row.fini()
    pass
  pass

print xhtml.table.fini()

wgo_queue.generate_blotter(wgo_news.config.archive_queue)
wgo_queue.generate_blotter(wgo_news.config.current_queue)
wgo_queue.generate_blotter(wgo_news.config.pending_queue)

print xhtml.para(xhtml.hyperlink("Continue", { "href" : "news-index.cgi?%s" % (queue)}))

wgo_news.footer()
            
sys.exit(1)
Esempio n. 5
0
def as_para(body):
  if re.match('(?i)^\s*<p>', body):
    return body
  return xhtml.para(body)
Esempio n. 6
0
  except Exception, e:
    wgo_contest.folio_init("GIMP 10th Anniversary Contest Preview Failed")
    try: os.remove(image_path)
    except: pass
    try: os.remove(thumb_path)
    except: pass

    print wgo.error(str(e))
    wgo_contest.folio_fini()
    return (1)

  wgo_contest.folio_init("GIMP 10th Anniversary Contest Preview")

  print xhtml.h1("GIMP 10th Anniversary Contest", {"class" : "heading"})
  print xhtml.para("""Welcome to the www.gimp.org 10th Anniversary Splash Contest. """
                   """From here you may submit images with tutorials to be considered as candidates
                   for a "splash" image.  We appreciate your participation, but we
                   offer No Promises on what may become of your image here.""")

  print xhtml.h2("Approve Your Image", {"class" : "subtitle"})

  form = xhtml.form(xhtml.input.submit({"name" : "approve", "value" : "APPROVE"})
                    + xhtml.input.hidden({"name" : "mode", "value" : "approve"})
                    + xhtml.input.hidden({"name" : "name", "value" : name})
                    + xhtml.input.hidden({"name" : "title", "value" : title})
                    + xhtml.input.hidden({"name" : "author", "value" : author})
                    + xhtml.input.hidden({"name" : "email", "value" : email}),
                    {"enctype" : "multipart/form-data", "method" : "post", "action" : "contest.cgi"})

  thumb = wgo_contest.image_generate(title, thumb_file, author, email)
    
  img = wgo_contest.image_generate(title, image_file, author, email)
Esempio n. 7
0
def error(text):
  return (xhtml.h2("Eeek! An error!", {"class" : "subtitle"}) + xhtml.para(text))