search.shtml revision 742
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## -*- coding: utf-8 -*-
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## CDDL HEADER START
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## The contents of this file are subject to the terms of the
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## Common Development and Distribution License (the "License").
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## You may not use this file except in compliance with the License.
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## or http://www.opensolaris.org/os/licensing.
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## See the License for the specific language governing permissions
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## and limitations under the License.
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## When distributing Covered Code, include this CDDL HEADER in each
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## file and include the License file at usr/src/OPENSOLARIS.LICENSE.
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## If applicable, add the following below this CDDL HEADER, with the
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## fields enclosed by brackets "[]" replaced with your own identifying
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## information: Portions Copyright [yyyy] [name of copyright owner]
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## CDDL HEADER END
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz## Copyright 2008 Sun Microsystems, Inc. All rights reserved.
80e2ca8596e3435bc3b76f3c597833ea0a87f85e## Use is subject to license terms.
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz 'info': "Info",
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz 'manifest': "Manifest"
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz<%inherit file="layout.shtml"/>\
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz<%page args="g_vars"/>\
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz catalog = g_vars["catalog"]
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz request = g_vars["request"]
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz<%def name="page_title(g_vars)"><%
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz return "Package Search"
80e2ca8596e3435bc3b76f3c597833ea0a87f85e%></%def>\
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz<div id="yui-main">
80e2ca8596e3435bc3b76f3c597833ea0a87f85e <div class="yui-b">
80e2ca8596e3435bc3b76f3c597833ea0a87f85e <p>Search functionality is not available at this time.</p>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz token_val = request.params.get("token", "")
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz searched = False
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz if len(token_val):
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz searched = True
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <div class="yui-b">
80e2ca8596e3435bc3b76f3c597833ea0a87f85e <input id="search-field" type="text" size="30"
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz maxlength="512" name="token"
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz value="${cgi.escape(token_val, True)}"/>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <input id="submit-search" type="submit"
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz name="action" value="Search"/>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz% if not searched:
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <p>Search Tips:</p>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <ul class="tips">
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <li>All searches are case-insensitive.</li>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <li>To find packages that contain a specific
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowiczfile, start your search criteria with a '/':<br/>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <li>To find packages based on a partial match,
80e2ca8596e3435bc3b76f3c597833ea0a87f85euse the wildcard characters '*' or '?':<br/>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz<kbd>*.xhtm?</kbd></li>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <li>To find packages based on specific
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowiczmatching characters use '[' and ']':<br/>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz<kbd>/usr/bin/[ca]t</kbd></li>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <div class="yui-b results">
80e2ca8596e3435bc3b76f3c597833ea0a87f85e results = None
80e2ca8596e3435bc3b76f3c597833ea0a87f85e results = catalog.search(token_val)
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz% if searched and results:
80e2ca8596e3435bc3b76f3c597833ea0a87f85e <th>Index</th>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <th>Action</th>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <th>Value</th>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <th>Package</th>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz% for index, pfmri, action, value in results:
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz if rclass is None or rclass == ' class="odd"':
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz rclass = ' class="odd"'
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz phref = self.shared.rpath(g_vars, "info/0/%s" % (
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz urllib.quote(pfmri[len("pkg:/"):], "")))
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <tr${rclass} >
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <td>${index}</td>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <td>${action}</td>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <td>${value}</td>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <td><a href="${phref}">${pfmri}</a></td>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz% elif searched:
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <p>Your search - <b>${token_val}</b> - did not match any packages.</p>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <p>Suggestions:</p>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <li>Ensure that all words are spelled correctly.</li>
8fd04b8338ed5093ec2d1e668fa620b7de44c177Roger A. Faulkner <li>Try a different keyword.</li>
628e3cbed6489fa1db545d8524a06cd6535af456Edward Pilatowicz <li>Try a more general keyword.</li>