/macros/WorkInfo
Type: /type/macro
description: Work Finder Information Box
macro: value: $def with (page)

$ _t = i18n.get_namespace('/type/edition')
$ _ = i18n.get_namespace('/mode/view')

$ s = "other_titles", "translated_titles", "genres", "first_publish_date", "subject_places", "original_languages", "dewey_number", "lc_classifications"

<div id="nav" style="margin-left: 0px; clear: both;">
<div id="options">
<div class="navouter">
<img src="/static/images/nav.top.png" alt="Options" border="0" />
<div class="navinner">
<div class="navinner-padding">
<span class="navheader">About this Work</span><br /><br />

$for name in s:
    $if page[name]:
        <span class="navheader" style="text-transform: none; letter-spacing: .0em; font-weight: bold; color: #333;">$_t[name]:</span> 
        <div style="padding: 0px 15px 8px 25px; border-top: 0px solid #fff;">
            $if name == "other_titles":
                $:'<br />'.join(thingrepr(i) for i in page[name])
            $elif name == "translated_titles":
                $for t in page[name]: <span style="font-style: italic;">$t.language.name -</span> $t.text<br />
            $elif name == "links":
                $for link in page[name]: <a href="$link.url">$(link.title or link.url)</a><br />
            $else:
                $:thingrepr(page[name])<br />
        </div>

$ cur_locale = i18n.get_locale()
$ this_lang = False
$ simple = False
$ wikipedia = []
$ links = page.links

            <script>
            function show_full_list() {
                document.getElementById('wikipedia').style.display='none';
                document.getElementById('full_list').style.display='block';
            }
            function hide_full_list() {
                document.getElementById('wikipedia').style.display='block';
                document.getElementById('full_list').style.display='none';
            }
            </script>

$if links:
    $for link in links:
        $ wiki_find = link.url.find('.wikipedia.org/')
        $ lang = link.url[7:wiki_find]
        $if not lang.replace('-', '').isalpha():
            $continue
        $ link['lang'] = lang
        $if lang == cur_locale:
            $ this_lang = link
        $if lang == 'simple':
            $ simple = link
        $ wikipedia.append(link)
    $if this_lang or len(wikipedia):
        <span class="navheader" style="text-transform: none; letter-spacing: .0em; font-weight: bold; color: #333;">$_t['wikipedia']:</span> 
        <div style="padding: 0px 15px 8px 25px; border-top: 0px solid #fff;">
        $if wikipedia:
            <div id="wikipedia">
        $if this_lang:
            $this_lang.lang: <a href="$this_lang.url">$(this_lang.title or this_lang.url)</a>
        $else:
            No link to Wikipedia in your language
            $if simple:
                <br>
                Simple English: <a href="$simple.url">$(simple.title or simple.url)</a>
        $if len(wikipedia):
            <br>
            <a href="javascript:show_full_list()" style="color:black">Other&nbsp;languages&nbsp;»</a></div>
            <div style="display:none" id="full_list">
            <a href="javascript:hide_full_list()" style="color:black">«&nbsp;back</a><br>
            $for link in wikipedia:
                $link.lang: <a href="$link.url">$(link.title or link.url)</a><br>
            </div>
        </div>
    $ links = [l for l in links if 'lang' not in l]
    $if links:
        <span class="navheader" style="text-transform: none; letter-spacing: .0em; font-weight: bold; color: #333;">$_t['links']:</span> 
        <div style="padding: 0px 15px 8px 25px; border-top: 0px solid #fff;">
            $for link in links: <a href="$link.url">$(link.title or link.url)</a><br />
        </div>
</div>
</div>

<img src="/static/images/nav.bot.png" alt="" border="0" />

</div>
</div>
</div>