Current File : //usr/share/lib/pkg/web/en/index.shtml
## -*- coding: utf-8 -*-
##
##
## Copyright 2008, 2013 Oracle and/or its affiliates. All rights reserved.
##
<%inherit file="layout.shtml"/>\
<%page args="g_vars"/>\
<%
        catalog = g_vars["catalog"]
        config = g_vars["config"]
        request = g_vars["request"]
        http_depot = g_vars["http_depot"]
%>\
<%def name="page_title(g_vars)"><%
        req = g_vars["request"]
        pub = req.publisher
        rname = ""
        if pub:
                repo = pub.repository
                if repo and repo.name:
                        rname = repo.name
                else:
                        rname = "package repository"
        return rname
%></%def>\
<%def name="page_crumbs(g_vars)"><%
        # None at top level.
        return []
%></%def>\
<%def name="document_class()"><%
        return "yui-t4"
%></%def>\
<div id="yui-main">
        <div class="yui-b">
<%
        req = g_vars["request"]
        pub = req.publisher
        repo_desc = ""
        if pub:
                repo = pub.repository
                if repo and repo.description:
                        repo_desc = repo.description
%>
% if repo_desc:
                <h2 class="section-title">About</h2>
                <p>${repo_desc}</p>
% endif
% if catalog.search_available:
                <form class="search" action="search.shtml">
                        <h2 class="section-title">Search Packages</h2>
                        <p>
                                <input id="search-field" type="text" size="35"
                                    maxlength="512" name="token" title="search field"/>
                                <input id="submit-search" type="submit"
                                    name="action" value="Search"/>
                                <a href="advanced_search.shtml">Advanced Search</a>
                        </p>
                </form>
% endif
% if not config.mirror and request.publisher:
<%
        versions = self.shared.get_releases(g_vars)
        if versions:
                # Add an "All" selection so that user can view entire catalog.
                versions.insert(0, ("", "", "All"))

        selected_version = request.params.get("version", None)
        selected_match = False
        for v in versions:
                ver, val, label = v
                if selected_version == val:
                        selected_match = True

        if versions and (not selected_version or not selected_match):
                # Either a version wasn't already selected, or the version
                # provided didn't match a valid one, so default to the first in
                # the list.
                selected_version = versions[1][1]
%>
%       if versions:
                <form action="catalog.shtml">
                        <h2 class="section-title">Browse Packages</h2>
                        <p>
                                <label for="version">Release and Branch</label>
                                <select id="version" name="version">
<%
                for v in versions:
                        ver, val, label = v
                        attrs = ""
                        if val == selected_version:
                                attrs = 'selected="selected" '

                        context.write("""<option %svalue="%s">%s</option>\n""" % (
                            attrs, val, label))
%>
                                </select>
                                <input id="submit-browse" type="submit"
                                    name="action" value="Browse"/>
                        </p>
                        <p>Select a release from the list above to see all of
the packages available for it.</p>
                </form>
%       else:
                <h2 class="section-title">Browse Packages</h2>
                <p>The list of all available packages can be found
<a href="catalog.shtml">here</a>.</p>
%       endif
% elif not request.publisher:
                <p>This package repository is empty or no default publisher has
 been set.</p>
% else:
                <p>Information about packages is not available when the server
 is operating in mirror mode.</p>
% endif
        </div>
</div>
<div class="yui-b">
% if not config.mirror and not http_depot and request.publisher:
        <table class="stats" summary="A summary of information about the
 package repository.">
                <tr class="first">
                        <th colspan="2" scope="row" class="last">
                                <a id="catalog-feed"
                                    href="../feed"
                                    title="${self.shared.dcval(g_vars, 'pkg_bui', 'feed_name')}"></a>
                                    Catalog
                        </th>
                </tr>
                <tr>
                        <td scope="row" class="label">Publisher</td>
                        <td class="value">${pub.prefix}</td>
                </tr>
                <tr>
                        <td scope="row" class="label">Packages</td>
                        <td class="value">${catalog.package_count}</td>
                </tr>
                <tr>
                        <td scope="row" class="label">Last Updated</td>
<%
        if catalog.version == 0:
                # Note: last_modified() is in local time relative to the
                # timezone where catalog was last modified.
                lm = catalog.last_modified()
                if not lm:
                        lm = "Never"
        else:
                # last_modified is a UTC datetime object.
                lm = catalog.last_modified
                if lm:
                        lm = lm.replace(microsecond=0)
                else:
                        lm = "Never"
%>
                        <td class="value">${lm}</td>
                </tr>
        </table>
% endif
</div>