plugin
openlibrary
Templates in the website are disabled now. Editing them will not have any effect on the live website.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
$def with (page) $if "merge-authors" in ctx.features and query_param('merge', 'false') == 'true': <script type="text/javascript"> // <!-- \$().ready(function() { if ("$query_param('merge', 'false')" == "true") { \$("#preMerge").parent().andSelf().show(); $ duplicates = ["/authors/" + k for k in query_param("duplicates", "").split(",")] var data = { "master": "$page.key", "duplicates": $:json_encode(duplicates) }; /* \$.post("/authors/merge.json", JSON.stringify(data), function(result, status, req) { \$("#preMerge").fadeOut(); \$("#postMerge").fadeIn(); }, "json" ); */ \$.ajax({ url: "/authors/merge.json", type: "POST", data: JSON.stringify(data), success: function(data, textStatus, XMLHttpRequest) { \$("#preMerge").fadeOut(); \$("#postMerge").fadeIn(); }, error: function(XMLHttpRequest, textStatus, errorThrown) { \$("#preMerge").fadeOut(); \$("#errorMerge").fadeIn(); } }); } }); //--> </script> $var title: $page.get('name', 'name missing') $var history: $page.history $ olid = page.key.split('/')[-1] $putctx("description", "Books by " + page.get("name", "")) <div id="contentHead"> $:macros.databarView(page) <h1>$page.get('name', 'name missing')</h1> <div class="clearfix"></div> <h2 class="author collapse"> $if page.birth_date or page.death_date: $page.birth_date - $page.death_date $else: $if page.date: $page.date </h2> </div> <script type="text/javascript"> <!-- \$().ready(function(){\$("#coverPop").colorbox({inline:true, opacity:"0.5", href:"#addImage"});}); //--> </script> <div id="contentBody"> $if "merge-authors" in ctx.features and query_param('merge', 'false') == 'true': <div class="message hidden"> <div id="preMerge" class="hidden"> <p class="larger collapse"><strong>Merging Authors...</strong></p> <p class="collapse adjust"><img src="/images/ajax-loader-bar.gif" width="220" height="19" alt="In progress..."/></p> <p class="smaller lightgreen collapse">Duplicates</p> <p class="small collapse"> <ul> $ duplicates = ["/authors/" + k for k in query_param("duplicates", "").split(",")] $for key in duplicates: $ doc = get_document(key) $if doc: <li> $doc.name; <small>($key)</small></li> </ul> </p> </div> <div id="postMerge" class="hidden"> <p class="right small"><b><a href="$page.key">Refresh the page</a>?</b></p> <p class="larger collapse"><strong>Success!</strong></p> <p class="small collapse">OK. The merge is in motion. <i>It will take <u>a few minutes to finish</u> the update.</i></p> </div> <div id="errorMerge" class="hidden"> <p class="larger collapse"><strong>Argh!</strong></p> <p class="small collapse">That merge didn't work. It's our fault, and we've made a note of it.</p> </div> </div> <div class="contentTwothird" style="margin-bottom:0;"> $:format(page.get('bio', '')) $if page.website: <div class="section"> <h6 class="collapse black uppercase">$_("Website")</h6> <a href="$page.website" class="datalink">$page.website</a> </div> $if page.location: <div class="section hidden"> <h6 class="collapse black uppercase">$_("Location")</h6> $page.location </div> $ books = page.get_books() <div class="clearfix"></div> <div class="section"> <a name="editions"></a> <h2 class="collapse"> $commify(books.num_found) work$("s" if books.num_found != 1 else "") <span class="count smaller"><a href="/books/add?author=$page.key">Add another</a>?</span> </h2> <a name="books"></a> <p><span class="tools"> $if books.num_found > 1: <img src="/images/icons/icon_sort.png" alt="Sorting by" width="9" height="11" style="margin-right:5px;"/> $if books.sort == 'editions': <strong class="lightgreen">Most Editions</strong> | <a href="$changequery(sort='old')#editions">First Published</a> | <a href="$changequery(sort='new')#editions">Most Recent</a> $elif books.sort == 'old': <a href="$changequery(sort=None)#editions">Most Editions</a> | <strong class="lightgreen">First Published</strong> | <a href="$changequery(sort='new')#editions">Most Recent</a> $elif books.sort == 'new': <a href="$changequery(sort=None)#editions">Most Editions</a> | <a href="$changequery(sort='old')#editions">First Published</a> | <strong class="lightgreen">Most Recent</strong> $elif books.sort == 'title': <a href="$changequery(sort=None)#editions">Most Editions</a> | <a href="$changequery(sort='old')#editions">First Published</a> | <a href="$changequery(sort='new')#editions">Most Recent</a> | <strong class="lightgreen">Title</strong> </span></p> <div id="searchResults" class="narrow"> <ul id="siteSearch" class="collapse"> $for doc in books.works: <li> <span class="bookcover"> $ cover = get_coverstore_url() + "/b/olid/%s-M.jpg" % doc.cover_edition_key if doc.cover_edition_key else "/images/icons/avatar_book-sm.png" <a href="$doc.url" title="$doc.title"><img src="$cover" height="70" alt="$doc.title"/></a> </span> <span class="details"> <span class="resultTitle"> <h3 class="booktitle"><a href="$doc.url">$doc.title$(': ' + doc.subtitle if doc.get('subtitle', None) else '')</a></h3> <span class="resultPublisher">$commify(doc.edition_count) edition$("s" if doc.edition_count != 1 else "") $if doc.first_publish_year: - first published in $doc.first_publish_year </span> </span> </span> $if doc.public_scan: <span class="actions read"> <a href="http://www.archive.org/stream/$doc.ia[0]" title="$_('Open in online Book Reader. Downloads available in ePub, DAISY, PDF, TXT formats from main book page')"> <span class="image read"></span> <span class="label">Read</span> </a> </span> $elif doc.lending_edition: <span class="actions read"> <a href="/books/$doc.lending_edition/borrow" title="Borrow book now"> <span class="image borrow"></span> <span class="label">Borrow</span> </a> </span> $elif doc.overdrive: <span class="actions read"> <a href="http://search.overdrive.com/SearchResults.aspx?ReserveID={$(doc.overdrive[0])}" title="Link to overdrive.com"> <span class="image borrow"></span> <span class="label">Borrow</span> </a> </span> $elif 'printdisabled' in doc.collections: <span class="actions read"> <a href="$doc.key" title="Protected DAISY"> <span class="image daisy"></span> <span class="label">DAISY</span> </a> </span> </li> </ul> </div> </div> </div> <div class="contentOnethird"> <div class="illustration"> $:render_template("covers/author_photo", page) $:render_template("covers/change", page, ".bookCover img") </div> $def render_subjects(label, subjects, prefix): $if subjects: <div class="section"> <h6 class="collapse black uppercase">$label</h6> <div class="sansserif"> $for subject, count in subjects: <a href="/subjects/$prefix$subject.lower().replace(' ', '_')">$subject</a>$cond(not loop.last, ",", "") </div> </div> <!-- SUBJECTS DISPLAY --> $:render_subjects("Subjects", books.get_facet('subject_facet'), '') $:render_subjects("Places", books.get_facet('place_facet'), 'place:') $:render_subjects("People", books.get_facet('person_facet'), 'person:') $:render_subjects("Time", books.get_facet('time_facet'), 'time:') <!-- /SUBJECTS --> $if "lists" in ctx.features: <div class="section"> <div class="Tools" style="margin:0 0 25px 0;float:left;"> $:render_template("lists/widget", page) </div> </div> <div class="section"> <h3>Links <span class="gray small sansserif">(outside Open Library)</span></h3> $if page.links or (page.wikipedia and page.wikipedia.startswith("http")): <ul class="booklinks sansserif"> $if page.wikipedia and page.wikipedia.startswith("http"): <li><a href="$page.wikipedia" class="sidebar">Wikipedia</a></li> $for link in page.links: <li><a href="$link.url">$link.title</a></li> </ul> $else: <p class="sansserif small">No links yet. <a href="$page.url('/edit')#web">Add one</a>?</p> </div> $if page.alternate_names: $if page.alternate_names != [""]: <div class="section"> <h3>$_("Alternate names")</h3> <ul class="booklinks sansserif"><li>$:"</li><li>".join(page.alternate_names)</li></ul> </div> </div> $ pages = (books.num_found / 100) + 1 $ page_num = safeint(query_param('page'), default=1) $if pages != 1: $ pages_in_set = 10 $ half = pages_in_set/2 $if pages < pages_in_set: $ first_page_in_set = 1 $ last_page_in_set = pages $elif page_num < half: $ first_page_in_set = 1 $ last_page_in_set = min((pages_in_set, pages)) $elif page_num > (pages-half): $ first_page_in_set = pages-pages_in_set $ last_page_in_set = pages $else: $ first_page_in_set = page_num-half $ last_page_in_set = page_num+half <div class="clearfix"></div> <div class="pagination"> $if page_num != 1: <a href="$changequery(page=None)" class="ChoosePage">« First</a> <a href="$changequery(page=page_num-1)" class="ChoosePage">< Previous</a> $for p in range(first_page_in_set, last_page_in_set+1): $if p == page_num: <span class="this">$p</span> $else: <a href="$changequery(page=p)" class="ChoosePage">$p</a> $if page_num < pages: <a href="$changequery(page=page_num+1)" class="ChoosePage">Next ></a> <a href="$changequery(page=pages)" class="ChoosePage">Last »</a> </div> $:render_template("lib/history", page) </div> |