galaxy-central (ngs) / templates / user / dbkeys.mako

Full commit
    def inherit(context):
        if context.get('use_panels'):
            if context.get('webapp'):
                webapp = context.get('webapp')
                webapp = 'galaxy'
            return '/webapps/%s/base_panels.mako' % webapp
            return '/base.mako'
<%inherit file="${inherit(context)}"/>

<%def name="init()">

<%def name="title()">Custom Database Builds</%def>

<%def name="stylesheets()">
    <style type="text/css">
        #custom_dbkeys * {
            min-width: 100px;
            vertical-align: text-top;
        pre {
            padding: 0;
            margin: 0;
        ## If page is displayed in panels, pad from edges for readability.
        %if context.get('use_panels'):
        div#center {
            padding: 10px;

<%def name="javascripts()">
    <script type="text/javascript">

    $(function() {
        $(".db_hide").each(function() {
            var pre = $(this);
            pre.siblings("span").wrap( "<a href='javascript:void(0);'></a>" ).click( function() {
        $("#show_installed_builds").click(function() {


<%def name="center_panel()">

<%def name="body()">

    % if message:
        <div class="errormessagelarge">${message}</div>
    % elif lines_skipped > 0:
        <div class="warningmessagelarge">Skipped ${lines_skipped} lines that could not be parsed. (Line was either blank or not 2-column, with 2nd column being an integer)</div>
    % endif

    <h3>Current Custom Builds:</h3>

    % if dbkeys:
        <table id="custom_dbkeys" class="colored" cellspacing="0" cellpadding="0">
            <tr class="header">
                <th>Number of chroms/contigs</th>
        % for key, dct in dbkeys.iteritems():
                <td>${dct['name'] | h}</td>
                <td>${key | h}</td>
    ##                <span>${len(dct["chroms"])} entries</span>
    ##                <pre id="pre_${key}" class="db_hide">
    ##                    <table cellspacing="0" cellpadding="0">
    ##                        <tr><th>Chrom</th><th>Length</th></tr>
    ##                        % for chrom, chrom_len in dct["chroms"].iteritems():
    ##                            <tr><td>${chrom | h}</td><td>${chrom_len | h}</td></tr>
    ##                        % endfor
    ##                    </table>
    ##                </pre>
                    % if 'count' in dct:
                    % endif
                <td><form action="dbkeys" method="post"><input type="hidden" name="key" value="${key}" /><input type="submit" name="delete" value="Delete" /></form></td>
        % endfor
    % else:
        <p>You currently have no custom builds.</p>
    % endif
        <a id="show_installed_builds" href="javascript:void(0);">Show loaded, system-installed builds</a>
        <blockquote id="installed_builds">${installed_len_files}</blockquote>
    <hr />
    <h3>Add a Custom Build</h3>
    <form action="dbkeys" method="post" enctype="multipart/form-data">
        <div class="toolForm" style="float: left;">
            <div class="toolFormTitle">New Build</div>
            <div class="toolFormBody">
                <div class="form-row">
                    <label for="name">Build Name (eg: Mouse):</label>
                    <input type="text" id="name" name="name" />
                <div class="form-row">
                    <label for="key">Build Key (eg: mm9):</label>
                    <input type="text" id="key" name="key" />
                <div class="form-row">
                    <label for="len_file">Upload .len file:</label>
                    <input type="file" id="len_file" name="len_file" /><br />
                    <label for="len_text">Or enter/paste length info below:</label>
                    <textarea id="len_text" name="len_text" cols="30" rows="8"></textarea>
                <div class="form-row"><input type="submit" name="add" value="Submit"/></div>
    <div class="infomessagesmall" style="float: left; margin-left: 10px; width: 40%;">
        <h3>Length Format</h3>
            The length format is two-column, separated by whitespace, of the form:
            <pre>chrom/contig   length of chrom/contig</pre>
            For example, the first few entries of <em>mm9.len</em> are as follows:
chr1    197195432
chr2    181748087
chr3    159599783
chr4    155630120
chr5    152537259
        <p>Trackster uses this information to populate the select box for chrom/contig, and
        to set the maximum basepair of the track browser. You may either upload a .len file
        of this format, or directly enter the information into the box.</p>