## -*- coding: utf-8 -*-
##
## CDDL HEADER START
##
## The contents of this file are subject to the terms of the
## Common Development and Distribution License (the "License").
## You may not use this file except in compliance with the License.
##
## You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
## See the License for the specific language governing permissions
## and limitations under the License.
##
## When distributing Covered Code, include this CDDL HEADER in each
## file and include the License file at usr/src/OPENSOLARIS.LICENSE.
## If applicable, add the following below this CDDL HEADER, with the
## fields enclosed by brackets "[]" replaced with your own identifying
## information: Portions Copyright [yyyy] [name of copyright owner]
##
## CDDL HEADER END
##
## Copyright (c) 2008, 2016, 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 {0}value="{1}">{2}</option>\n""".format(
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>
<%
# last_modified is a UTC datetime object.
if lm:
lm = lm.replace(microsecond=0)
else:
lm = "Never"
%>
<td class="value">${lm}</td>
</tr>
</table>
% endif
</div>