Exemplo n.º 1
0
  def _ashtml(self, which="image"):
    return (xhtml.span(self["title"], {"class" : "title"})
            + (xhtml.image({"src" : self[which]}))
            + (xhtml.span(self["author"] + " ", {"class": "author"})
	    #+ xhtml.span(" ")
            #   + xhtml.span(" " + xhtml.character_reference(self["email"]), {"class" : "email"})
	    ))
Exemplo n.º 2
0
def image_generate(title, image_file, author, email):
  img = (xhtml.div(title, {"class" : "title"})
         + xhtml.image({"src" : image_file})
         + xhtml.div(xhtml.span(author, {"class": "author"}) 
         # + xhtml.span(xhtml.mailto(email), {"class" : "email"})
         ))

  img = (xhtml.table(xhtml.table.row(xhtml.table.cell(xhtml.div(title, {"class" : "title"}), {"colspan": 2}))
                     + xhtml.table.row(xhtml.table.cell(xhtml.image({"src" : image_file}), {"colspan" : 2}))
                     + xhtml.table.row(xhtml.table.cell(xhtml.span(author, {"class" : "author"}), {"class" : "author"}))
                     # + xhtml.table.row(xhtml.table.cell(xhtml.span(email, {"class" : "email"}), {"class" : "email"}))
                     , {"class" : "splash-thumb"}))
  
  return (img)
Exemplo n.º 3
0
  def as_news_item(self):               # As a line in the blotter
    iso_date = time.strftime(config.datetime_format,
                             time.gmtime(calendar.timegm(email.Utils.parsedate(xhtml.unescape(self["date"])))))

    s = str(xhtml.comment("$Id$")) + str(xhtml.span(xhtml.quote(self["subject"]), {"class" : "newstitle"})
                      + xhtml.span(xhtml.quote(iso_date), {"class" : "newsdate"}))

    s = xhtml.h1(s + " ", {"class" : "newsheading"})

    img = ""
    if icon_by_name(self["image"]) != "":
      img = xhtml.image({"src" : config.icon_dir + icon_by_name(self["image"])})
      pass

    s += str(xhtml.div(img + as_para(self["body"]), {"class" : "news"}))

    return (s)
Exemplo n.º 4
0
def format(name):
  edit_button = {"name" : "action", "value" : "edit"}
  delete_button = {"name" : "action", "value" : "delete"}
  edit = "gallery-edit.cgi?mode=EDIT&name=" + name
  delete = "gallery-edit.cgi?mode=DELETE&name=" + name
  
  entry = wgo_contest.gallery_image(name)
  if not entry.exists():
    link = "Eeek!  This entry is not available in the gallery. ", name
  else:
    link =  xhtml.div(entry.ashtml("thumb")
                      + (xhtml.span(xhtml.hyperlink("edit", {"href" : edit, "class" : "faux-button"})
                                    + xhtml.hyperlink("delete", {"href" : delete, "class" : "faux-button"}), {"style" : "text-align: left;"})),
                           {"style" : "text-align: left;"})
    pass

  return (xhtml.div(link, {"class" : "splash-thumb"}))
Exemplo n.º 5
0
 def ashtml(self, which="image"):
   return (xhtml.table(xhtml.table.row(xhtml.table.cell(xhtml.div(self["title"], {"class" : "title"}), {"colspan": 2}))
                       + xhtml.table.row(xhtml.table.cell(xhtml.image({"src" : self[which]}), {"colspan" : 2}))
                       + xhtml.table.row(xhtml.table.cell(xhtml.span(self["author"], {"class" : "author"}), {"class" : "author"}))
                       # + xhtml.table.row(xhtml.table.cell(xhtml.span(self["email"], {"class" : "email"}), {"class" : "email"}))
                       , {"class" : "splash-thumb"}))
Exemplo n.º 6
0
def display_slideshow(form):
  names = get_gallery_names()

  if len(names) == 0:
    wgo_contest.folio_init()
    wgo_contest.folio_fini()
    return
  
  name = os.path.basename(form.getvalue("image", names[0]))
  refresh = int(form.getvalue("refresh", "5"))
  fullscreen = form.getvalue("fullscreen", "")
  style = form.getvalue("style", "")
  if refresh < 2:
    refresh = 2

  entry = wgo_contest.gallery_image(name)

  image_file = wgo_contest.gallery_file(entry["name"], ".png")

  next_name = name[0]
  for i in range(0, len(names)):
    if names[i] == name:
      next_name = names[(i + 1) % len(names)]
      break
    pass

  url = "gallery.cgi?display=slideshow&image=%s" % (next_name)
  if (fullscreen == "true"):
    fullscreen_attr = "&fullscreen=true"
    refresh_attr    = "&refresh=%d" % (refresh)
    if style != "":
      style_attr      = "&style=" + style
    else:
      style_attr    = ""
    
    wgo.http_preamble(["Content-Type: text/html", "Refresh: " + str(refresh) + ";url=" + url + refresh_attr + fullscreen_attr + style_attr])

    print xhtml.html.init()
    print xhtml.head()
    print xhtml.body.init({"style" : "background: black; color: white;"})
    if style == "":
      fill_window = xhtml.hyperlink({"style" : "color: gray;", "href" : url + refresh_attr + fullscreen_attr + "&style=width:100%;"}, "[fill window]")
    else:
      fill_window = xhtml.hyperlink({"style" : "color: gray;", "href" : url + refresh_attr + fullscreen_attr}, "[normal size]")
    
    print xhtml.span({"style" : "font-size: small; margin-top: 10ex; margin-bottom: 5ex;"},
                     xhtml.hyperlink({"style" : "color: gray;", "href" : url + fullscreen_attr + style_attr + "&refresh=%s" % (5)}, "5s") +  " " + 
                     xhtml.hyperlink({"style" : "color: gray;", "href" : url + fullscreen_attr + style_attr + "&refresh=%s" % (10)}, "10s") + " " +
                     xhtml.hyperlink({"style" : "color: gray;", "href" : url + fullscreen_attr + style_attr + "&refresh=%s" % (15)}, "15s") + " " +
                     xhtml.hyperlink({"style" : "color: gray;", "href" : url + fullscreen_attr + style_attr + "&refresh=%s" % (20)}, "20s") + " " +
                     fill_window
                     )

    print xhtml.table.init({"style" : "text-align: center; vertical-align: middle; width: 100%;"})
    print xhtml.table.row(
      xhtml.table.cell(xhtml.image({"style" : "%s" % (style), "src" : image_file})) +
      xhtml.table.cell({"style" : "font-size: xx-large; text-align: right; padding-right: 5%;" },
                       "<i>" + entry["title"] + "</i><br />&nbsp;" + entry["author"])
      )
    print xhtml.table.fini()

    print xhtml.body.fini()
    print xhtml.html.fini()
    pass
  else:
    url = "gallery.cgi?display=slideshow&image=%s&refresh=%d" % (next_name, refresh)
    wgo.http_preamble(["Content-Type: text/html", "Refresh: %s;url=%s" % (refresh, url)])
    wgo.header("page", "GIMP Splash Image Slideshow", [{"rel" : "stylesheet", "href" : wgo_contest.config.contest_dir + "wgo-contest.css", "type" : "text/css"}])

    print xhtml.span({"style" : "font-size: small; margin-bottom: 5ex;"},
                     xhtml.hyperlink({"href" : "gallery.cgi?display=slideshow&image=%s&refresh=%s" % (next_name, 5)}, "[5s]") +  " " + 
                     xhtml.hyperlink({"href" : "gallery.cgi?display=slideshow&image=%s&refresh=%s" % (next_name, 10)}, "[10s]") + " " +
                     xhtml.hyperlink({"href" : "gallery.cgi?display=slideshow&image=%s&refresh=%s" % (next_name, 15)}, "[15s]") + " " +
                     xhtml.hyperlink({"href" : "gallery.cgi?display=slideshow&image=%s&refresh=%s" % (next_name, 20)}, "[20s]") + " " +
                     xhtml.hyperlink({"href" : "gallery.cgi?display=slideshow&image=%s&refresh=%s&fullscreen=true" % (next_name, refresh)}, "[full window]")
                     )
    print xhtml.table.init({"class" : "splash-slideshow"})
    print xhtml.table.row(
      xhtml.table.cell(xhtml.image({"src" : image_file})) +
      xhtml.table.cell("<i>" + entry["title"] + "</i><br />&nbsp;" + entry["author"])
      )
    print xhtml.table.fini()

    wgo_contest.folio_fini()
    pass
  return
Exemplo n.º 7
0
  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)

  guidelines = (xhtml.para(xhtml.span(xhtml.div(thumb, {"class": "splash-thumb"}), {"style" : "float: right; margin-left: 1em;"})
                           + """Below is your image as we see it, in its original size surrounded
                           by a red border 2 pixels thick over a background of alternating
                           light and dark grey squares to make the transparency and size
                           of the image clear. """
                           """To the right is a thumbnail image 150 pixels wide and proportionate height.""",
                           { "style" : "text-align: justify;"})
                + xhtml.para("""If this is the image you want to submit, click on the """
                             + xhtml.input.submit({"value" : "APPROVE", "disabled" : "disabled"})
                             + """ button below. """
                             """Otherwise, use your browser's Back button to submit another image.""", {"style" : "text-align: justify;"})
                + xhtml.para("""If you do not see your image, there are a large number of potential reasons. """
                             """Verify the name of the file that you are trying to submit. """
                             """Ensure that the file you are submitting is an image. """
                             """We may have run out of temporary space on our server. """
                             """Do not submit animated images, or images with more than one scene. """