Exemple #1
0
def html_index_page(queue, news):
  if news == None or not news.valid:
    return (1)

  message_id = news["message-id"]

  filename = wgo_queue.message_path(queue, message_id)
  
  edit_target = "news-edit.cgi?message-id=" + xhtml.quote(message_id) + "&queue=" + xhtml.quote(queue)

  checkbox_attrs = { "class" : "news-index", "name" : xhtml.quote(news["message-id"]) }
  title = ""
  if len(news["body"]) < 2:
    title = "this article has no body"
    checkbox_attrs.update({"disabled" : "disabled", "title" : title})
    pass
           
  attrs = { "class" : "news-index" }

  print xhtml.table.row(
    xhtml.table.cell(xhtml.quote(news["date"]), {'title' : title})
    + xhtml.table.cell(xhtml.mailto(news["from"]), {'title' : title})
    + xhtml.table.cell(xhtml.hyperlink(news["subject"], {"href" : edit_target, "class" : "news-index", "title" : 'edit this article'}), {'title' : title })
    + xhtml.table.cell(xhtml.input.checkbox(checkbox_attrs), {'title' : title}))
    
  return (1)
Exemple #2
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)
Exemple #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
Exemple #4
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)
Exemple #5
0
if queue == "" or action == "":
  print wgo_news.error("Malformed request")
  wgo_news.footer()
  sys.exit(1)
  pass
    

print xhtml.table.init({"class" : "batch"})
print xhtml.table.row(xhtml.table.header("Action") + xhtml.table.header("Message-Id") + xhtml.table.header("Status"))

for key in form.keys():
  if not key in ["queue", "action"]:
    message_id = xhtml.unescape(key)
    print xhtml.table.row.init()
    print xhtml.table.cell(action)
    print xhtml.table.cell(xhtml.quote(message_id))
      
    if action == "save":
      status = 0
    elif action in ["approve", "current"]:
      try:
        os.rename(wgo_queue.message_path(queue, message_id), wgo_queue.message_path(wgo_news.config.current_queue, message_id))
        status = 0
      except OSError, e:
        status = e.strerror
        pass
      pass
    elif action == "archive":
      try:
        os.rename(wgo_queue.message_path(wgo_news.config.current_queue, message_id), wgo_queue.message_path(wgo_news.config.archive_queue, message_id))
        status = 0