summaryrefslogtreecommitdiff
path: root/portal/README
blob: 1576d27743a983c3dea71e1d1bbbc12afc654d6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
Directory and file layout 
=========================

The portal directory of pgweb module consists of the following:
admin/ here the scripts to edit / translate the dynamic content reside.
cache/ not used.
intl/ contains the compiled (.mo) translations for gettext [1] l10n of
   website. This should probably be removed from CVS, script to build
   these files should be added instead (TODO).
layout/ contains images and stylesheets.
po/ contains human-readable gettext files.
system/ contains all the PHP code (more on this below)
template/ contains templates for the site's pages (more below)
tools/ contains helper tools. In particular, update.sql is the script
   that updates the current database schema to the one used by the new
   website. mirror.php is the script used for static mirror generation.

The PHP scripts rely on several PEAR [2] packages:

Benchmark (tested with 1.2.1) --- for displaying profiling information
  (not needed if you set DEBUG to false in system/global/settings.php)
Console_Getargs (tested with 1.2.0) --- command line arguments parsing
  in mirror.php script.
HTML_QuickForm (version 3.2.2+ for XHTML compliance) --- needed for 
  form generation and processing.
HTML_Template_Sigma (version 1.1.2+ due to important fix) --- needed 
  for all HTML generation on website.
HTTP_Client (1.0.0+) --- for mirroring script.
Log (tested with 1.8.x) --- for mirroring script.
PEAR (version 1.3.3+ due to important fix) --- base PEAR class.
XML_Serializer (tested with 0.11.1) --- RSS feeds generation.

The packages have some dependencies that are not listed here so please
use PEAR installer for their installation.


How the site is dispatched
==========================

The site uses mod_rewrite to redirect most of the requests to
handler.php script. The only exceptions are RSS feeds, community docs files
and redirections.
URLs are mapped to paths using system/global/dispatcher.php.
All pages inherit from the class pgPage (in system/global/pgpage.php),
which deals with site templating and such things.
All forms inherit from the class pgForm.

The pages' URLs for specific languages have the form
/path/to/page.html.lang, so that static mirrors may use Apache's
content negotiation [3], see also Debian [4] site as an example. For
the same reason links on the site should contain /path/to/page only,
if a directory listing is presumed (e.g. about/) then the trailing
slash is mandatory.


"Dynamic" vs. "static" templates, l10n
======================================

The site uses HTML_Template_Sigma template engine for HTML generation.
Template syntax is described in the manual available on the PEAR
website [5].

We consider the template "dynamic" if it has placeholders to be filled
with data received from the database and "static" in the other case.
There is only one copy of "dynamic" template for all the languages but
a copy of "static" template for each available language.

Thus "static" templates are translated as a whole, while "dynamic"
ones have English text wrapped in func_lang() calls, these are translated
to gettext() calls by the template engine.

"Dynamic" templates are located directly in the template/ directory,
"static" ones in template/{lang} directories, the layout of directories
within template/{lang} mimic the URLs on site.

Adding a new static page to the site does not require writing any PHP
code. One only adds a new HTML file to template/en (and optionally its
translations). Translations of dynamic content (news, events, etc.) are
done via admin/ scripts.


Preparing and adding a new translation
--------------------------------------

There are two tasks in translating the site to a new language:
1) Preparing gettext translation for dynamic templates and PHP scripts.
2) Translating the static pages.

Finally, one has to edit system/global/languages.php and add a new
language entry to the array[s] within. After the language is made known
to the website, there is a new task:

3) Translating the content stored in database (done via admin/ scripts).


Creating static mirrors
=======================

Unlike the previous mirroring script, mirror.php is just a generic HTTP
spider, it has very little code specific for postgresql.org. This
essentially means two things:
  [+] You don't have to do anything special to add a new page. If a link
      to the page does exist, it will be followed and the page will
      be mirrored.
  [-] Creating a static mirror may take quite a bit of time.

Note: mirror.php ignores layout/ and files/ directories, you'll need to
copy them to the static mirror afterwards.


Setting up a copy of the website
--------------------------------

You'll need the following software set up if you want to deploy a local
copy of the "dynamic" website to do some development on it:
  * PostgreSQL server.
  * Apache webserver with mod_rewrite and PHP support enabled.
  * PHP should be compiled with gettext and (obviously) PostgreSQL
    support. Recent PHP4 version or PHP5 will do.
  * PEAR installation containing the packages listed above.

The database needs the pgcrypto module installed, and it needs to be installed
in the schema pgcrypto. This means you need to edit the pgcrypto.sql file
and change the value for search_path.

Database schema is in tools/schema.sql, if you need data to populate 
the DB, that's available on request (dump is ~10MB packed).

Just copy the contents of portal directory to your webserver's
DocumentRoot (the site code expects to be in root, it won't work 
otherwise) and edit system/global/settings.local.php to reflect your site's
domain, database connection strings and such. You may also need to
edit .htaccess file, please review whether it contains some hardcoded
paths. 

Fonts
=====

(From Emily Boyd)

I didn't actually use a font for the logo, as I just grabbed the
Illustrator file from here:

http://www.pgsql.com/graphics/Empowered_logos/

If you need to change the logo text, I *think* the font used is Strait.
I've uploaded a copy here:

http://www.emilyboyd.com/design/postgresql/strait.ttf
[Also in tools/fonts in the web tree]

The font used for the text on the right is Frutiger Roman. (You'll need
to source your own copy of this, as it's not a free font.)

In case it helps, there's a layered PNG of the entire header here:

http://www.emilyboyd.com/design/postgresql/header.png

Regards,
Emily



[1] http://www.gnu.org/software/gettext/gettext.html
[2] http://pear.php.net/
[3] http://httpd.apache.org/docs/content-negotiation.html
[4] http://www.debian.org/
[5] http://pear.php.net/manual/en/package.html.html-template-sigma.intro-syntax.php