$def with (work, edition=None, recaptcha=None) $ this_title = work.title + ': ' + work.subtitle if work.get('subtitle', None) else work.title $var title: $this_title $putctx("robots", "noindex,nofollow")
$code: def find_mode(): mode = query_param("mode") if not edition or not work.key: return "other" if mode == "found": return "existing_record" if mode == "add-work" and work.revision == 1 and work.edition_count == 1 and edition.revision == 1: return "new_work" if mode == "add-book" and edition.revision == 1: return "new_edition" return "other" mode = find_mode() if mode == "new_work": title = _("Add a little more?") note = '

' + _("Thank you for adding that book! Any more information you could provide would be wonderful!") + "

" elif mode == "new_edition": title = _("Add a little more?") note = '

' + _("We already know about %(work_title)s, but not the %(year)s %(publisher)s edition. Thanks! Do you know any more about this edition?", work_title=work.title, year=edition.publish_date, publisher="; ".join(edition.publishers)) + "

" elif mode == "existing_record": title = _("Add a little more?") note = '

' + _("We already know about the %(year)s %(publisher)s edition of %(work_title)s, but please, tell us more!", year=edition.publish_date, publisher="; ".join(edition.publishers), work_title=work.title) + "

" else: title = _("Editing...") note = ""

$:title

$if ctx.user and (ctx.user.is_admin() or ctx.user.is_librarian()): $if not ctx.user: $:render_template("lib/not_logged") $:note
$ authors = work.authors and [a.author for a in work.authors]

$this_title

$if authors: $ all_authors = u"By {},".format(" ".join(author.name for author in authors if author.name))

$all_authors[:-1]

  • $_("Work Details")
  • $if edition: $if edition.publishers: $ edition_name = "; ".join(edition.publishers) + ' edition' $else: $ edition_name = _('Unknown publisher edition') $if edition.publish_date: $ edition_name = truncate(edition_name, 20) + ", " + edition.publish_date
  • $edition_name
$_("This Work")
$:_("Use Title: Subtitle to add a subtitle.") *$_("Required field")
$:_('You can search by author name (like j k rowling) or by Open Library ID (like OL23919A).')
$:render_template("books/author-autocomplete", authors, "authors", "work--authors")
$:render_template("books/edit/about", work)
$_("Add Excerpts")
$:render_template("books/edit/excerpts", work)
$_("Links")
$:render_template("books/edit/web", work, prefix="work--")
$if edition:
$:render_template("books/edit/edition", work, edition)
$if recaptcha:
$:macros.EditButtons(comment=work.comment_)
$if edition: $:render_template("books/edit/addfield", edition)