Revert "avoid duplicate code for bibrec page update"

This reverts commit 18dee4c04e.
master
eric 2020-12-10 14:25:57 -05:00
parent 3b178fcd03
commit 1983313c21
1 changed files with 267 additions and 4 deletions

View File

@ -85,10 +85,275 @@ ${site_top()}
<div class="page-body">
<div id="mobile"> <!-- Remove the social and tabs wrapper divs. -->
<div property="dcterms:publisher" itemprop="publisher" content="Project Gutenberg" />
<div itemprop="bookFormat" content="EBook" />
<div id="cover-social-wrapper">
<div py:if="os.cover_image_url" id="cover">
<img class="cover-art"
src="${os.cover_image_url}"
title="Book Cover"
alt="Book Cover"
itemprop="image" />
</div>
<div py:if="not os.cover_image_url" id="no-cover">
<div class="icon icon_${os.title_icon}" />
<div class="text">No cover available</div>
</div>
<ul>
<li>
${tw_share(os.canonical_url, os.twit)}
</li>
<li>
${fb_share(os.canonical_url)}
</li>
<li>
<a onclick="printpage()" title="Print this page"><span class="icon icon_print" /></a>
</li>
</ul>
<div id="qr">
<span class="qrcode qrcode-desktop" title="Scan QR Code for this page." />
</div>
<h2>Download This eBook</h2>
</div>
<div id="tabs">
<div id="download" i18n:comment="On the 'Download' tab of the 'bibrec' page.">
<py:for each="e in os.entries">
<py:if test="isinstance(e, bs.DC)">
<div about="[ebook:$e.project_gutenberg_id]" rel="dcterms:hasFormat" >
<table class="files">
<colgroup>
<col class="narrow" />
<col />
<col />
<col />
<col class="narrow noprint" />
<col class="narrow noprint" />
<col class="narrow noprint" />
</colgroup>
<tr>
<th />
<th>Format <span>${help ('Format')}</span></th>
<th class="noscreen">Url</th>
<th i18n:comment="Size of a file." class="right">Size</th>
<th class="noprint"><span>${help ('Dropbox')}</span></th>
<th class="noprint"><span>${help ('Google Drive')}</span></th>
<th class="noprint"><span>${help ('OneDrive')}</span></th>
</tr>
<tr py:for="i, file_ in enumerate(e.files)"
py:if="not file_.hidden"
class="${i%2 and 'odd' or 'even'}"
about="${file_.url}" typeof="pgterms:file">
<td><span class="icon icon_${e.icon}" /></td>
<td property="dcterms:format" content="${file_.mediatypes[-1]}" datatype="dcterms:IMT"
class="unpadded icon_save"
><a href="/${file_.filename}" type="${file_.mediatypes[-1]}" class="link"
title="Download">${file_.hr_filetype}</a></td>
<td class="noscreen">${file_.url}</td>
<td class="right"
property="dcterms:extent" content="${file_.extent}">${file_.hr_extent}</td>
<td class="noprint">
<a py:if="file_.dropbox_url"
href="${file_.dropbox_url}"
title="Send to Dropbox." rel="nofollow"><span class="icon icon_dropbox" /></a>
</td>
<td class="noprint">
<a py:if="file_.gdrive_url"
href="${file_.gdrive_url}"
title="Send to Google Drive." rel="nofollow"><span class="icon icon_gdrive" /></a>
</td>
<td class="noprint">
<a py:if="file_.honeypot_url"
href="${file_.honeypot_url}"
title="Send to MegaUpload." rel="nofollow" />
<a py:if="file_.msdrive_url"
href="${file_.msdrive_url}"
title="Send to OneDrive." rel="nofollow"><span class="icon icon_msdrive" /></a>
</td>
</tr>
<!--! more files ... -->
<tr py:if="e.base_dir"
class="${i%2 and 'odd' or 'even'}">
<td><span class="icon icon_folder" /></td>
<td class="unpadded icon_file"><a href="${e.base_dir}" class="link"
i18n:comment="Link to the directory containing all files.">More Files…</a></td>
<td class="noscreen">${os.qualify (e.base_dir)}</td>
<td/>
<td class="noprint"><!--! dropbox column --></td>
<td class="noprint"><!--! gdrive column --></td>
<td class="noprint"><!--! msdrive column --></td>
</tr>
</table>
</div>
</py:if>
</py:for>
</div> <!-- download -->
<div id="more_stuff">
<py:for each="n, e in enumerate (os.entries)">
<py:if test="isinstance (e, bs.Cat) and e.rel not in ('start', )">
<py:if test="e.header and old_header != e.header">
<h2 class="header">${e.header}</h2>
</py:if>
<?python old_header = e.header ?>
<div class="${e.class_}">
<a rel="nofollow"
href="${e.url}"
type="${e.type}"
charset="${e.charset}"
accesskey="${str (n % 10)}">
<span class="cell leftcell">
<span class="icon icon_${e.icon}" />
</span>
<span class="cell content">
<span class="title">${e.title}</span>
<span py:if="e.subtitle" class="subtitle">${e.subtitle}</span>
<span py:if="e.extra" class="extra">${e.extra}</span>
</span>
<span class="hstrut" />
</a>
</div>
</py:if>
</py:for>
</div> <!-- more stuff -->
<div id="bibrec" i18n:comment="On the 'bibrec' tab of the 'bibrec' page.">
<py:for each="e in os.entries">
<py:if test="isinstance (e, bs.DC)">
<div typeof="pgterms:ebook" about="[ebook:$e.project_gutenberg_id]">
<h2>Bibliographic Record <span>${help (_('Table: Bibliographic Record'))}</span></h2>
<table class="bibrec" >
<colgroup>
<col class="narrow" />
<col />
</colgroup>
<tr py:for="author in e.authors">
<th>${author.role}</th>
<td>
<a href="${os.url ('author', id = author.id)}"
rel="marcrel:${author.marcrel}" about="/authors/${author.id}" typeof="pgterms:agent"
itemprop="creator">${author.name_and_dates}</a></td>
</tr>
<tr py:for="marc in e.marcs">
<th>${marc.caption}</th>
<py:choose test="">
<td py:when="marc.code == '010'">
<a class="external"
href="http://lccn.loc.gov/${marc.text}"
title="Look up this book in the Library of Congress catalog.">${marc.text} <span class="icon icon_external_link"/></a>
</td>
<td py:when="marc.code[0]=='5'">
<?python
text = gg.xmlspecialchars(marc.text)
text = re.sub(r'(//\S+)', r'<a href="\1">\1</a>', text)
text = re.sub(r'#(\d+)', r'<a href="/ebooks/\1">#\1</a>', text)
?>
${ Markup (gg.insert_breaks (text)) }
</td>
<td py:when="marc.code=='245'" itemprop="headline">
${ Markup (gg.insert_breaks(gg.xmlspecialchars(marc.text))) }
</td>
<td py:when="marc.code=='240'" itemprop="alternativeHeadline">
${ Markup (gg.insert_breaks(gg.xmlspecialchars(marc.text))) }
</td>
<td py:when="marc.code=='246'" itemprop="alternativeHeadline">
${ Markup (gg.insert_breaks(gg.xmlspecialchars(marc.text))) }
</td>
<td py:otherwise="">
${ Markup (gg.insert_breaks(gg.xmlspecialchars(marc.text))) }
</td>
</py:choose>
</tr>
<tr py:for="language in e.languages"
property="dcterms:language" datatype="dcterms:RFC4646" itemprop="inLanguage" content="${language.id}">
<th>Language</th>
<td py:if="language.id != 'en'"><a href="/browse/languages/${language.id}">${language.language}</a></td>
<td py:if="language.id == 'en'">${language.language}</td>
</tr>
<tr py:for="locc in e.loccs"
property="dcterms:subject" datatype="dcterms:LCC" content="${locc.id}">
<th>LoC Class</th>
<td>
<a href="/browse/loccs/${locc.id.lower ()}">${locc.id}: ${locc.locc}</a>
</td>
</tr>
<tr py:for="subject in e.subjects">
<th>Subject</th>
<td property="dcterms:subject" datatype="dcterms:LCSH">
<a class="block" href="${os.url ('subject', id = subject.id)}">
${subject.subject}
</a>
</td>
</tr>
<tr py:for="dcmitype in e.dcmitypes">
<th>Category</th>
<td property="dcterms:type" datatype="dcterms:DCMIType">${dcmitype.description}</td>
</tr>
<tr>
<th>EBook-No.</th>
<td>${e.project_gutenberg_id}</td>
</tr>
<tr property="dcterms:issued" datatype="xsd:date" content="${e.xsd_release_date_time}">
<th>Release Date</th>
<td itemprop="datePublished">${e.hr_release_date}</td>
</tr>
<tr>
<th>Copyright Status</th>
<td property="dcterms:rights">${e.rights}</td>
</tr>
<tr>
<th>Downloads</th>
<td itemprop="interactionCount" i18n:msg="count">${e.downloads} downloads in the last 30 days.</td>
</tr>
<tr itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer">
<th>Price</th>
<td><span itemprop="priceCurrency" content="USD" /><span itemprop="price">$0.00</span><span itemprop="availability" content="In Stock" ><a href="http://schema.org/InStock"></a></span></td>
</tr>
</table>
</div>
</py:if>
</py:for>
</div> <!--! bibrec -->
</div> <!--! tabs -->
</div> <!--! mobile -->
<div id="standard"> <!-- Keep the social and tabs wrapper divs. -->
<div property="dcterms:publisher" itemprop="publisher" content="Project Gutenberg" />
<div itemprop="bookFormat" content="EBook" />
<div id="cover-social-wrapper">
<div py:if="os.cover_image_url" id="cover">
@ -122,11 +387,8 @@ ${site_top()}
<span class="qrcode qrcode-desktop" title="Scan QR Code for this page." />
</div>
</div>
<div id="standard"> <!-- Keep the social and tabs wrapper divs. -->
<div id="tabs-wrapper">
</div> <!--! standard -->
<div id="mobile"> <!-- Keep the social and tabs wrapper divs. -->
</div> <!--! standard -->
<div id="tabs">
<div id="download" i18n:comment="On the 'Download' tab of the 'bibrec' page.">
@ -355,6 +617,7 @@ ${site_top()}
</div> <!--! tabs -->
</div> <!--! tabs-wrapper -->
</div> <!--! standard -->
</div> <!--! body -->
</div>
<div id="dialog" class="hidden">