## -*- coding: utf-8 -*- ## ## ## Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. ## <%! import operator %> ## Returns the value of the named respository configuration property in the ## given section. <%def name="dcval(g_vars, section, name)"><% return g_vars["config"].get_depot_property_value(section, name) %>\ <%def name="rcval(g_vars, section, name)"><% return g_vars["config"].get_repo_property_value(section, name) %>\ ## Returns the relative URI path to the named resource. <%def name="rpath(g_vars, name)"><% return g_vars["request"].get_rel_path(name) %>\ ## Returns path relative to the current request path for the current locale ## and region. <%def name="lrelpath(g_vars, path)"><% return g_vars["request"].get_rel_path(path)[len("../"):] %>\ ## Returns a list of tuples containing a pkg.Version object, a string ## representing the version, and a label for that version. Entries are ## sorted by release and branch in descending order. <%def name="get_releases(g_vars)"><% catalog = g_vars["catalog"] request = g_vars["request"] versions = {} for f, states, attrs in catalog.gen_packages(patterns=["/entire", "/solaris"], return_fmris=True): br = str(f.version.branch).replace(".", "").strip() ver_label = "%s-%s" % (f.version.release, f.version.branch) if br == "086": ver_label = "2008.05 (%s)" % ver_label elif br == "0101": ver_label = "2008.11 (%s)" % ver_label elif br == "0111": ver_label = "2009.06 (%s)" % ver_label entry = "%s@%s,%s-%s" % (f.pkg_name, f.version.release, f.version.build_release, f.version.branch) versions[entry] = (f.version, entry, ver_label) return [ ver[1] for ver in sorted(versions.iteritems(), key=operator.itemgetter(1), reverse=True) ] %>\ ## Returns a uri, relative to the current request path to the given resource ## based on the current theme, that is not locale or region specific. <%def name="tpath(g_vars, resource)"><% return g_vars["request"].get_rel_path("_themes/%s/%s" % ( g_vars["web_config"]["theme"], resource)) %>\ ## Returns the %include path to the given resource based on the current theme, ## locale, and region information. <%def name="ltipath(g_vars, resource)"><% return "/_themes/%s/%s/%s" % (g_vars["web_config"]["theme"], g_vars["web_config"]["locale-region"], resource) %>\ ## Returns a uri, relative to the current request path, to the given resource ## based on the current locale and region information. <%def name="ltupath(g_vars, resource)"><% path = "_themes/%s/%s/%s" % (g_vars["web_config"]["theme"], g_vars["web_config"]["locale-region"], resource) return g_vars["request"].get_rel_path(path) %>\