1 DEBIAN SOURCEFORGE THEMING HOWTO
2 --------------------------------
4 Here is a short HOWTO explaining how Themes work in Debian
5 Sourceforge, and how to make a new one.
7 It was written by Christian Bayle <bayle@debian.org>, with a few
8 cosmetic fixes applied by Roland Mas <lolando@debian.org>.
10 HOW DOES THEMING WORK?
11 ----------------------
12 Themes are done by overloading the Layout class you can find in
13 /usr/share/gforge/www/include/
15 This is done by the "$HTML = new Theme();" line in the theme_sysinit
16 function (www/include/theme.php):
18 The theme_sysinit function is called in www/include/pre.php
19 The Theme class is included from
20 $GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/Theme.class.php'
21 If sys_theme is not defined it is set to "forged".
23 So this means that to write a theme you "just" have to create a
24 correct www/themes/<your theme>/Theme.class.php and to add the proper
25 record in the database. This addition can be done with Roland's
26 sf-register-theme tool or in the administrative web interface.
28 The simplest you can find is at www/themes/forged/Theme.class.php:
31 | class Theme extends Layout {
33 | // Parent constructor
39 (This one does nothing)
41 HOW DO I MAKE A THEME?
42 ----------------------
43 A simple theme is the Savannah one, that just changes some colors.
44 The big work is to make new icons found in www/themes/savannah/images/
47 | class Theme extends Layout {
50 | * Theme() - Constructor
53 | // Parent constructor
56 | // The root location for images
57 | $this->imgroot = 'themes/savannah/images/';
59 | // The content background color
60 | $this->COLOR_CONTENT_BACK= '#EAC164';
62 | // The background color
63 | $this->COLOR_BACK= '#FFFFFF';
65 | // The primary light background color
66 | $this->COLOR_LTBACK1= '#FFF4A8';
68 | // The secondary light background color
69 | $this->COLOR_LTBACK2= '#FFF4A8';
71 | // The HTML box title color
72 | $this->COLOR_HTMLBOX_TITLE = '#DAD5D7';
74 | // The HTML box background color
75 | $this->COLOR_HTMLBOX_BACK = '#FFF4A8';
77 | // Font Face Constants
79 | $this->FONT_CONTENT = 'Helvetica';
80 | // The HTML box title font
81 | $this->FONT_HTMLBOX_TITLE = 'Helvetica';
82 | // The HTML box title font color
83 | $this->FONTCOLOR_HTMLBOX_TITLE = '#333333';
84 | // The content font color
85 | $this->FONTCOLOR_CONTENT = '#333333';
86 | //The smaller font size
87 | $this->FONTSIZE_SMALLER='x-small';
88 | //The smallest font size
89 | $this->FONTSIZE_SMALLEST='xx-small';
90 | //The HTML box title font size
91 | $this->FONTSIZE_HTMLBOX_TITLE = 'small';
97 To do more you can replace all the Layout.class.php functions by yours.
98 This is done a lot in www/themes/classic/Themes.class.php. A small
99 example of this is for the tab_entry function in debian theme, that
100 allows you to customize the menu in e.g. the page located at
101 http://.../projects/siteadmin/
105 | * tab_entry() - Prints out the a themed tab, used by project_tabs
107 | * @param string Is the URL to link to
108 | * @param string Us the image to use (if the theme uses it)
109 | * @param string Is the title to use in the link tags
110 | * @param bool Is a boolean to test if the tab is 'selected'
112 | function tab_entry($url='http://localhost/', $icon='', $title='Home', $selected=0) {
116 | print 'class=tabselect ';
118 | print 'class=tabs ';
120 | print 'href="'. $url .'">';
121 | print html_image($this->imgroot . $icon,'24','24',array('alt'=>"$title",'border'=>($selected?'1':'0')));
127 I WANT TO CUSTOMIZE ICONS
128 -------------------------
130 Icons are not customizable by default. I started to enable this like
131 this in a non regressive way for icons in the project page (code is at
132 www/include/project_home.php). I added the variable $imgproj =
133 'images/ic/'; in Layout.class.php and changed html_image function calls
136 | html_image($imgproj. "manual16c.png", '15','15',array('alt'=>'Release Notes'));
139 By default images are searched in the original place, but you can now
140 change this place. It's just a matter of doing e.g. like it's done in
143 | $this->imgproj = 'themes/debian/images/proj/';
145 in the class constructor.
147 All other themes will continue to work.
149 Just proceed in the same way for other places in the code where you
150 want to customize icons, and send us the appropriate patch :)
156 Since all themes need to be known by their "identifier", which
157 corresponds to their directory name, there needs to be some sort of
158 cooperation to avoid namespace conflicts. We suggest that theme
159 authors who want to release their work to the public first contact us
160 to "allocate" a theme identifier. Once this is done, you're very
161 welcome to provide a gforge-theme-<yourthemeid> package. If you
162 are not a Debian developer yourself, we can even help you spread it to
163 the community by sponsoring the package to Debian.
165 For reference, this is the list of currently used theme names:
167 - classic: the "Classic" theme, from sourceforge.net;
168 - forged: "Forged metal", also from sourceforge.net;
169 - savannah: historical theme for Savannah, "stolen" from
171 - savannah_codex, savannah_darkslate, savannah_forest,
172 savannah_reverse, savannah_sad, savannah_savannah, savannah_slashd,
173 savannah_startrek, savannah_transparent, savannah_water,
174 savannah_www.gnu.org: lots of other themes "stolen" from Savannah;
175 - ultralite: "Ultra lite" theme, from sourceforge.net;
176 - querencia: theme from Querencia Livre, contributed by Otavio
177 Salvador <otavio@debian.org>.