1
2
3
4 """
5 Garland theme template override file
6
7 @package includes
8 @see <a href='http://drupy.net'>Drupy Homepage</a>
9 @see <a href='http://drupal.org'>Drupal Homepage</a>
10 @note Drupy is a port of the Drupal project.
11 @note This file was ported from Drupal's themes/garland/template.php
12 @author Brendon Crawford
13 @copyright 2008 Brendon Crawford
14 @contact message144 at users dot sourceforge dot net
15 @created 2008-01-10
16 @version 0.1
17 @note License:
18
19 This program is free software; you can redistribute it and/or
20 modify it under the terms of the GNU General Public License
21 as published by the Free Software Foundation; either version 2
22 of the License, or (at your option) any later version.
23
24 This program is distributed in the hope that it will be useful,
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 GNU General Public License for more details.
28
29 You should have received a copy of the GNU General Public License
30 along with this program; if not, write to:
31
32 The Free Software Foundation, Inc.,
33 51 Franklin Street, Fifth Floor,
34 Boston, MA 02110-1301,
35 USA
36 """
37
38 __version__ = "$Revision: 1 $"
39
40 from lib.drupy import DrupyPHP as php
41 from includes import bootstrap as lib_bootstrap
42 from includes import common as lib_common
43 from includes import plugin as lib_plugin
44
46 """
47 Return a themed breadcrumb trail.
48
49 @param breadcrumb
50 An array containing the breadcrumb links.
51 @return a string containing the breadcrumb output.
52 """
53 if (not php.empty(breadcrumb)):
54 return '<div class="breadcrumb">' + \
55 php.implode(' › ', breadcrumb) + '</div>'
56
57
67
68
69
71 """
72 Override or insert variables into the page template.
73 """
74 php.Reference.check(vars_)
75 vars_['tabs2'] = menu_secondary_local_tasks()
76 vars_['primary_nav'] = (lib_theme.theme('links', \
77 vars_['main_menu'], {'class' : 'links main-menu'}) if \
78 php.isset(vars_, 'main_menu') else False)
79 vars_['secondary_nav'] = (lib_theme.theme('links', \
80 vars_['secondary_menu'], \
81 {'class' : 'links secondary-menu'}) if \
82 php.isset(vars_, 'secondary_menu') else False)
83 vars_['ie_styles'] = get_ie_styles()
84
85 site_fields = []
86 if (not php.empty(vars_['site_name'])):
87 site_fields.append( check_plain(vars_['site_name']) )
88 if (not php.empty(vars_['site_slogan'])):
89 site_fields.append( check_plain(vars_['site_slogan']) )
90 vars_['site_title'] = php.implode(' ', site_fields)
91 if (not php.empty(site_fields)):
92 site_fields[0] = '<span>' + site_fields[0] + '</span>'
93 vars_['site_html'] = php.implode(' ', site_fields)
94
95 if (lib_plugin.exists('color')):
96 lib_plugin.plugins['color']._page_alter(vars_)
97
98
99
101 """
102 Returns the rendered local tasks. The default implementation renders
103 them as tabs. Overridden to split the secondary tasks.
104 """
105 return menu_primary_local_tasks()
106
107
117
118
119
121 """
122 Format the 'Submitted by username on date/time' for each node.
123 """
124 return lib_common.t('not datetime — not username',
125 {
126 'not username' : lib_theme.theme('username', node),
127 'not datetime' : php.format_date(node.created),
128 })
129
130
131
133 """
134 Generates IE CSS links for LTR and RTL languages.
135 """
136 ie_styles = '<link type="text/css" rel="stylesheet" media="all" href="' + \
137 lib_bootstrap.base_path() + lib_theme.path_to_theme() + \
138 '/fix-ie.css" />' + "\n"
139 if (lib_plugin.exists('locale') and \
140 lib_bootstrap.language.direction == \
141 lib_plugin.plugins['locale'].LANGUAGE_RTL):
142 ie_styles += \
143 ' <style type="text/css" media="all">@import "' + \
144 lib_bootstrap.base_path() + lib_theme.path_to_theme() + \
145 '/fix-ie-rtl.css";</style>' + "\n"
146 return ie_styles
147