Example #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)
Example #2
0
def html_news_edit(this_queue, other_queue, msg, editor):
  
  if this_queue == wgo_news.config.pending_queue and other_queue == wgo_news.config.current_queue:
    approve_disapprove = xhtml.input.submit({"name" : "action", "value" : "approve", "title" : "move this article to current queue"})
    pass
  elif this_queue == wgo_news.config.current_queue and other_queue == wgo_news.config.pending_queue:
    approve_disapprove = xhtml.input.submit({"name" : "action", "value" : "disapprove", "title" : "move article to pending queue"})
    pass
  else:
    approve_disapprove = ""
    pass

  image_selector = xhtml.input.select(wgo_news.icon_option_list(msg["image"]), {"name" : "image", "class" : "news-edit"})

  print xhtml.h1("GIMP ORG News Administration :: Edit %s Item" % (string.capitalize(this_queue)), {"class" : "heading"})

  print xhtml.form.init({"class" : "news-edit", "action" : "news-edit-action.cgi", "method" : "post"})

  print xhtml.div.init()
  print xhtml.input.hidden({"name" : "message-id", "value" : xhtml.quote(msg["message-id"])})
  print xhtml.input.hidden({"name" : "from",       "value" : xhtml.quote(msg["from"])})
  print xhtml.input.hidden({"name" : "queue",      "value" : xhtml.quote(this_queue)})
  print xhtml.input.hidden({"name" : "editor",     "value" : xhtml.quote(editor)})

  print xhtml.table.init({"class" : "news-edit", "cellpadding" : "1"})

  print xhtml.table.row(xhtml.table.cell("From:")       + xhtml.table.cell(xhtml.quote(msg["from"]), {"id" : "from"}))
  print xhtml.table.row(xhtml.table.cell("Message-Id:") + xhtml.table.cell(xhtml.quote(msg["message-id"]), {"id" : "message-id"}))
  print xhtml.table.row(xhtml.table.cell("Subject:")    + xhtml.table.cell(xhtml.input.text({"name" : "subject", "value" : msg["subject"]}), {"id" : "subject"}))
  print xhtml.table.row(xhtml.table.cell("Date:")       + xhtml.table.cell(xhtml.input.text({"name" : "date", "value" : msg["date"] })
                                                                           + "&nbsp;<i title='1-31 as appropriate for the month'>day</i>"
                                                                           + " <i title='Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'>month-name</i>"
                                                                           + " <i>year hour:minute:second TZ</i>", {"id" : "date"}))
  print xhtml.table.row(xhtml.table.cell("Image:")      + xhtml.table.cell(image_selector, {"id" : "image"}))
  print xhtml.table.row(xhtml.table.cell("Editor:")     + xhtml.table.cell("wilber", {"id" : "editor"}))

  print xhtml.table.row(xhtml.table.cell(xhtml.input.textarea(xhtml.quote(msg["body"]), {"name"  : "body", "cols" : 80, "rows"  : 20 }), {"colspan" : "2"}))
  
  print xhtml.table.row(xhtml.table.cell("&nbsp;"))
  
  print xhtml.table.row(xhtml.table.cell(xhtml.input.submit({"name" : "action", "value" : "save", "title" : "save changes"})
                                         + "&nbsp;" + approve_disapprove + "&nbsp;"
                                         + xhtml.input.submit({"name" : "action", "value" : "delete", "title" : "delete this article"}),
                                         {"colspan" : "2"}))
  
  print xhtml.table.fini()
  print xhtml.div.fini()
  print xhtml.form.fini()

  print xhtml.div("&nbsp;")

  print msg.as_news_item()

  return (1)
Example #3
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)
Example #4
0
def display_image(form):
  wgo_contest.folio_init("GIMP Splash Image Contender")

  name = os.path.basename(form.getvalue("name", "")) # XXX
  entry = wgo_contest.gallery_image(name)

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

  wgo_contest.folio_fini()

  return
Example #5
0
def format(name):
  edit_button = {"name" : "action", "value" : "edit"}
  delete_button = {"name" : "action", "value" : "delete"}
  edit = "gallery-edit.cgi?mode=EDIT&amp;name=" + name
  delete = "gallery-edit.cgi?mode=DELETE&amp;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"}))
Example #6
0
def display_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"} ])

  name = os.path.basename(form.getvalue("name", ""))

  entry = wgo_contest.gallery_image(name)

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

  wgo_admin.footer()
  return
Example #7
0
def format(name):
  view_button = {"name" : "action", "value" : "view"}
  view = "gallery.cgi?display=image&amp;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 = entry.ashtml("thumb") + xhtml.hyperlink("view", {"href" : view, "class" : "faux-button"})
    pass

  return (xhtml.div(link, {"class" : "splash-thumb"}))
Example #8
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 + "&nbsp;", {"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)
Example #9
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"}))
Example #10
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. """