$def with (work, book) $ edition_config = get_edition_config() $ is_librarian = ctx.user and ctx.user.is_librarian() $ is_admin = ctx.user and ctx.user.is_admin() $ is_privileged_user = is_librarian or is_admin $def radiobuttons(name, options, value): $for v in options: $ id = name + '--' + v.replace(' ', '-') $ checked = cond(v == value, 'checked="checked"', '')    $jsdef render_language_autocomplete_item(item):
$item.name
$# Render the ith language input field $jsdef render_language_field(i, language, i18n_name): $ lang_name = i18n_name or language.name
$# detect-missing-i18n-skip-line [x]
$# Render the ith translated_from language input field $jsdef render_translated_from_language_field(i, language, i18n_name): $ lang_name = i18n_name or language.name
$# Render the ith work input field $jsdef render_work_field(i, work):
$# Import the side-effect of the jsdef function $:render_template('jsdef/LazyWorkPreview', None) $jsdef render_work_autocomplete_item(item): $if item.key == "__new__":
$_('-- Move to a new work')
$else: $:render_lazy_work_preview(item)
$_("This Edition")
$_("Enter the title of this specific edition.")
$_("Usually distinguished by different or smaller type.") $_("For example:") envisioning the next 50 years
$_("Publishing Info")
$:_('For example Oxford University Press; Penguin; W.W. Norton')
$_("City, Country please.") $_("For example:") New York, USA; Sydney, Australia
$_("You should be able to find this in the first few pages of the book.")
$_("The year following the copyright statement.")
$_("For example:") Centennial edition; First edition
$_("The name of the publisher's series.") $_("For example:") The Story of Civilization, Part III
$:render_template("covers/book_cover", book) $:render_template("covers/change", book)
$_("Contributors")
$ work = book.works[0] $for i, a in enumerate(work.get_authors()): $for i, c in enumerate(book.contributors):
$_('Author') $a.name
$c.role $c.name [x]
$:_('For example: edited by David Anderson')
$_('Languages')
$if book.languages: $for i, lang in enumerate(book.languages): $:render_language_field(i, lang, get_language_name(lang)) $else: $:render_language_field(0, storage(name="", key=""), None) $_('Add another language?')
$ translation = book.translation_of or book.translated_from $ checked_yes = cond(translation, 'checked="checked"', '') $ checked_no = cond(not translation, 'checked="checked"', '') $if translation: $ style_hidden = "" $else: $ style_hidden = "display: none;"

$_("What's the original book?")
$if book.translated_from: $for i, lang in enumerate(book.translated_from): $:render_translated_from_language_field(i, lang, get_language_name(lang)) $else: $:render_translated_from_language_field(0, storage(name="", key=""), None)
$_("Only if it's different from the work's description")
$:_('Use a "*" for an indent, a "|" to add a column, and line breaks for new lines. Like this:')

$# detect-missing-i18n-skip-line
 * Part 1 | THIS WORLD | 1
        ** Chapter 1 | Of the Nature of Flatland | 3
        ** Chapter 2 | Of the Climate and Houses in Flatland | 5
        * Part 2 | OTHER WORLDS | 42

$ toc = book.get_table_of_contents() $if toc and toc.is_complex():
$_("This table of contents contains extra information like authors or descriptions. We don't have a great user interface for this yet, so editing this data could be difficult. Watch out!")
$_("Anything about the book that may be of interest.") $_("For example:") A Plume Book.
$_("Use this field if the title is different on the cover or spine. If the edition is a collection or anthology, you may also add the individual titles of each work here.")
$:_('For example: Eaters of the Dead is an alternate title for The 13th Warrior.')
$if book.other_titles and len(book.other_titles) > 1: $for i, t in enumerate(book.other_titles): $if i > 0:
$_("Sometimes editions can be associated with the wrong work. You can correct that here.") $:_('You can search by title or by Open Library ID (like OL262757W).')
$_("WARNING: Any edits made to the work from this page will be ignored.")
$ config = {'addnew': is_librarian, 'new_name': _('-- Move to a new work')}
$if book.works: $for i, work in enumerate(book.works): $:render_work_field(i, work) $else: $:render_work_field(0, storage(title="", key=""))
$ config = ({ $ 'Please select an identifier.': _('Please select an identifier.'), $ 'You need to give a value to ID.': _('You need to give a value to ID.'), $ 'ID ids cannot contain whitespace.': _('ID ids cannot contain whitespace.'), $ 'ID must be exactly 10 characters [0-9] or X.': _('ID must be exactly 10 characters [0-9] or X.'), $ 'That ID already exists for this edition.': _('That ID already exists for this edition.'), $ 'ID must be exactly 13 digits [0-9]. For example: 978-1-56619-909-4': _('ID must be exactly 13 digits [0-9]. For example: 978-1-56619-909-4'), $ 'Invalid ID format': _('Invalid ID format') $ })
$_("ID Numbers")
$_("Like, ISBN?")
$for i, id in enumerate(book.get_identifiers().values()): $# Disable removing ocaid for regular users. $if id.name == "ocaid" and not is_privileged_user: $else:
$_("Open Library") $book.key.split("/")[-1]
$id_labels.get(id.name, id.name) $id.value [x]
$_("Classifications")
$_("Like, Dewey Decimal?")
$for i, id in enumerate(book.get_classifications().values()):
$ classification_labels = dict((d.name, d.label) for d in edition_config.classifications)
$classification_labels.get(id.name, id.name) $id.value [x]
$_("The Physical Object")
$_("Paperback; Hardcover, etc.")
$_("Note the highest number in each pagination pattern.") $_("Help")
$:_('For example: xii, 346p.')
$ weight = book.get_weight() or storage(value="", units="grams") $:radiobuttons("edition--weight--units", ["grams", "kilos", "ounces", "pounds"], weight.units)
$_("Dimensions") $ dimensions = book.get_physical_dimensions() or storage(height="", width="", depth="", units="centimeters") $:radiobuttons("edition--physical_dimensions--units", ["centimeters", "inches"], dimensions.units)
$_('dimensions')
$code: def is_selected(actual, selected): if actual == selected: return True return False $if is_admin: $ extra_class = ' hidden' if len(book.providers) == 0 else '' $ provider_index = 0
$_('Web Book Providers') $for i, d in enumerate(book.providers): $ provider_index = provider_index + 1
$_("Book URL") $_("Access Type") $_("File Format") $_("Provider Name")
$_("Add a provider")
$if ctx.user:
$_('The opening line that starts the lead paragraph')
$if is_admin:
$_("Admin Only")
$_('This field can accept arbitrary key:value pairs')
$# detect-missing-i18n-skip-line