Merge from trunk

This commit is contained in:
Charles Haley 2010-10-16 14:55:21 +01:00
commit 82ab206727
2 changed files with 26 additions and 15 deletions

View File

@ -1,7 +1,7 @@
<div id="summary_{id}" class="summary"> <div id="summary_{id}" class="summary">
<div class="left"> <div class="left">
<img alt="Cover of {title}" src="/get/thumb_90_120/{id}" /> <img alt="Cover of {title}" src="/get/thumb_90_120/{id}" />
<a href="{href}" class="read" title="{read_tooltip}">{read_string}</a> {get_button}
</div> </div>
<div class="right"> <div class="right">
<div class="stars"> <div class="stars">

View File

@ -466,7 +466,10 @@ class BrowseServer(object):
fmts = '' fmts = ''
fmts = [x.lower() for x in fmts.split(',') if x] fmts = [x.lower() for x in fmts.split(',') if x]
pf = prefs['output_format'].lower() pf = prefs['output_format'].lower()
fmt = pf if pf in fmts else fmts[0] try:
fmt = pf if pf in fmts else fmts[0]
except:
fmt = None
args = {'id':id_, 'mi':mi, args = {'id':id_, 'mi':mi,
} }
for key in mi.all_field_keys(): for key in mi.all_field_keys():
@ -496,20 +499,29 @@ class BrowseServer(object):
continue continue
args, fmt, fmts, fname = self.browse_get_book_args(mi, id_) args, fmt, fmts, fname = self.browse_get_book_args(mi, id_)
args['other_formats'] = '' args['other_formats'] = ''
other_fmts = [x for x in fmts if x.lower() != fmt.lower()] if fmts and fmt:
if other_fmts: other_fmts = [x for x in fmts if x.lower() != fmt.lower()]
ofmts = [u'<a href="/get/{0}/{1}_{2}.{0}" title="{3}">{3}</a>'\ if other_fmts:
.format(f, fname, id_, f.upper()) for f in ofmts = [u'<a href="/get/{0}/{1}_{2}.{0}" title="{3}">{3}</a>'\
other_fmts] .format(f, fname, id_, f.upper()) for f in
ofmts = ', '.join(ofmts) other_fmts]
args['other_formats'] = u'<strong>%s: </strong>' % \ ofmts = ', '.join(ofmts)
_('Other formats') + ofmts args['other_formats'] = u'<strong>%s: </strong>' % \
_('Other formats') + ofmts
args['details_href'] = '/browse/details/'+str(id_) args['details_href'] = '/browse/details/'+str(id_)
args['read_tooltip'] = \
_('Read %s in the %s format')%(args['title'], fmt.upper()) if fmt:
args['href'] = '/get/%s/%s_%d.%s'%( href = '/get/%s/%s_%d.%s'%(
fmt, fname, id_, fmt) fmt, fname, id_, fmt)
rt = xml(_('Read %s in the %s format')%(args['title'],
fmt.upper()), True)
args['get_button'] = \
'<a href="%s" class="read" title="%s">%s</a>' % \
(xml(href, True), rt, xml(_('Get')))
else:
args['get_button'] = ''
args['comments'] = comments_to_html(mi.comments) args['comments'] = comments_to_html(mi.comments)
args['stars'] = '' args['stars'] = ''
if mi.rating: if mi.rating:
@ -519,7 +531,6 @@ class BrowseServer(object):
args['tags'] args['tags']
if args['series']: if args['series']:
args['series'] = args['series'] args['series'] = args['series']
args['read_string'] = xml(_('Read'), True)
args['details'] = xml(_('Details'), True) args['details'] = xml(_('Details'), True)
args['details_tt'] = xml(_('Show book details'), True) args['details_tt'] = xml(_('Show book details'), True)