/upstream/templates/account/borrow.tmpl
Type: /type/template
body: value: $def with (user, loans)

$var title: $_("Books You've Checked Out")

$if len(loans) >= 5:
    <script type="text/javascript">
    <!--
    \$().ready(function(){
        \$("#contentMsg").show();
        \$(".alert span").css({'font-size':'.6875em','color':'#333'})
        \$(".alert span").text("You have 5 ebooks out at the moment. That's the limit! You can free up slots by returning books early.");
    });
    //-->
    </script>

<div id="contentHead">
    <div class="small sansserif grey" style="margin-bottom:5px;"">$:_("%(user)s", user='<a href="%s">%s</a>' % (ctx.user.key, ctx.user.displayname)) /</div>
    <h1>$_("Books You've Checked Out")</h1>

</div>

<div id="contentBody">

$if len(loans) > 0:
    $# Have current loans
    <div id="borrowTable" class="borrow collapse">
    <table>
        <thead>
            <tr>
                <th class="titles" colspan="2">
                $if len(loans) == 1:
                    $_("1 Current Loan")
                $else:
                    $len(loans) $_("Current Loans")
                </th>
                <th class="expires">$_("Loan Expires")</th>
                <th class="actions">$_("Loan actions")</th>
            </tr>
        </thead>
        <tbody>
        <!-- for each borrow -->
        $for loan in loans:
            $ book = get_document(loan['book'])
            <tr>
                <td class="cover">
                $:render_template('covers/book_cover_small', book)
                </td>
                <td class="titles">
                    <span class="book">
                    <a href="$book.key" class="borrowResults">
                    <strong>$book.title</strong>
                    </a>
                    </span>
                    <span class="author">
                    $:macros.AuthorList(book.get_authors())
                    </span>
                    <div class="date">
                    Borrowed $datestr(datetime_from_utc_timestamp(loan['loaned_at']))
                    </div>
                </td>
                <td class="expires">
                    $:macros.FormatExpiry(loan['expiry'])
                </td>
                <td class="actions">
                    $if loan['resource_type'] == 'bookreader':
                        $# <a href="$loan['loan_link']"><img src="http://openlibrary.org/images/icons/icon_read-borrow.png" style="border:none" align="absmiddle" /></a> <a href="$loan['loan_link']">Read Online</a><br /><br />
                        $:macros.LoanReadForm(loan['book'])
                        $:macros.ReturnForm(loan)
                    $else:
                        <span class="smaller grey sansserif">Return via<br />Adobe Digital Editions</span>
                </td>
            </tr>
        </tbody>
    </table>
    </div>
    $for loan in loans:
        $:macros.BorrowTrouble(loan['expiry'])
    <h3>How To Return eBooks through Adobe Digital Editions</h3>
    <ol class="sansserif small">
        <li>Open Adobe Digital Editions</li>
        <li>Click the Library icon at the upper left corner</li>
        <li>Move your mouse over the cover of the eBook you wish to return</li>
        <li>Find the arrow at the upper left of the cover and open the eBook menu</li>
        <li>Click "Return Borrowed Item"</li>
        <li>Click "Return" to confirm</li>
        <li>Done!</li>
    </ol>

$# XXX borrow history not yet recorded so we show instructions if no current loans
<!-- if no borrow history -->
$if len(loans) == 0:
    <div class="contentHalf" style="padding-right:20px;width:419px;">
        <p>
        $_("There are 3 different sources for borrowing books through Open Library:")</p>
        <p style="line-height:1em;margin:1.5em 0 1em;">
            <strong>
            <span style="font-size:1.875em;">1.</span> 
            <span style="font-size:1.125em;">$_("Internet Archive"),</span>
            </strong>
            <span class="larger"><em>$_("eBooks everywhere")</em></span>
        </p>
        <p class="large">$:_('The <a href="http://www.archive.org/">Internet Archive</a> and several partner libraries are offering thousands of eBooks for loan to anyone with an Open Library account, anywhere in the world.')</p>
        <p style="line-height:1em;margin:1.5em 0 1em;">
            <strong>
            <span style="font-size:1.875em;">2.</span>
            <span style="font-size:1.125em;">$_("OverDrive"),</span>
            </strong>
            <span class="larger"><em>$_("eBooks from your local library")</em></span>
        </p>
        <p class="large">$:_('Open Library has teamed up with <a href="http://overdrive.com/">OverDrive.com</a>, a global disctributor of eBooks through your local library where available.')</p>
        <p style="line-height:1em;margin:1.5em 0 1em;">
            <strong>
            <span style="font-size:1.875em;">3.</span> 
            <span style="font-size:1.125em;">$_("WorldCat"),</span>
            </strong>
            <span class="larger"><em>$_("physical books from your local library")</em></span> 
        </p>
        <p class="large">$_("We connect our records to WorldCat wherever possible. You can tell WorldCat your postcode/zip code, and it will tell you the closest library with a copy of the book.")</p>
    </div>
    <div class="contentSpacer"></div>
    <div class="contentQuarter">
        <div class="section">
            <h3>$_("Getting Started")</h3>
            <p class="small sansserif">$_("All you need to borrow a book scanned at the Internet Archive is an Open Library account and Adobe Digital Editions.")</p>
            <p class="small sansserif">$_("Loans through OverDrive or WorldCat are managed through your local libraries, not through Open Library.")</p>
            <p class="small sansserif">$:_('Check out the <a href="/help/faq#section-borrowing"><strong>Lending FAQ</strong></a> for more information.')</p>
        </div>
        <div class="section">
            <h3>Which books are available?</h3>
            <p class="small sansserif">$:_('Browse all the available books through the <a href="/subjects/lending_library">"Lending Library"</a> subject, or try a <a href="/search?subject_facet=Lending%20library">search</a>.')</p>
            <p class="small sansserif">$:_('You can also <a href="/subjects/overdrive">browse OverDrive titles here</a>.')</p>
        </div>
    </div>
    <div class="contentSpacer"></div>
    <div class="contentQuarter">
        <h3>Help/Downloads</h3>
        <img src="/images/logo_adobeACS.png" alt="logo: Adobe" width="43" height="72" class="left" style="margin-right:10px;"/>
        <p class="small sansserif collapse"><a href="http://www.adobe.com/products/digitaleditions/#fp">Download Adobe Digital Editions</a></p>
        <p class="small sansserif"><a href="http://www.adobe.com/products/digitaleditions/help/">Help</a> on adobe.com</p>
    </div>
    <div class="clearfix"></div>
    <p class="small sansserif lightgreen">$:_('If you work at a library and are interested to find out more about lending ebooks through Open Library, please <a href="/contact">get in touch with us</a>!')</p>
    
</div>
title: Books You've Checked Out
plugin: upstream