Commit 61af39c0fc45a329633c0d7ed97fb33cb225bb62

Authored by Victor Costa
2 parents 6f19ef3b 5c115a98

Merge branch 'master_colivre' into AI2694-network_activity_email

Conflicts:
	test/unit/person_test.rb
Showing 379 changed files with 83917 additions and 73284 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 379 files displayed.

AUTHORS
... ... @@ -41,6 +41,7 @@ Alessandro Palmeira + Rafael Manzo <alessandro.palmeira@gmail.com>
41 41 Antonio Terceiro + Carlos Morais <terceiro@colivre.coop.br>
42 42 Antonio Terceiro + Paulo Meirelles <terceiro@colivre.coop.br>
43 43 Antonio Terceiro <terceiro@colivre.coop.br>
  44 +Arthur Del Esposte <arthurmde@yahoo.com.br>
44 45 Aurelio A. Heckert <aurelio@colivre.coop.br>
45 46 Braulio Bhavamitra <brauliobo@gmail.com>
46 47 Bráulio Bhavamitra <brauliobo@gmail.com>
... ... @@ -68,6 +69,7 @@ Caio Salgado + Renan Teruo &lt;caio.salgado@gmail.com&gt;
68 69 Caio Salgado + Renan Teruo + Jefferson Fernandes <jeffs.fernandes@gmail.com>
69 70 Caio Salgado + Renan Teruo <renanteruoc@gmail.com>
70 71 Caio SBA <caio@colivre.coop.br>
  72 +Carlos Andre de Souza <carlos.andre.souza@msn.com>
71 73 Carlos Morais <carlos88morais@gmail.com>
72 74 Carlos Morais + Diego Araújo <diegoamc90@gmail.com>
73 75 Carlos Morais + Eduardo Morais <carlos88morais@gmail.com>
... ... @@ -81,6 +83,7 @@ Daniel Alves + Diego Araújo + Guilherme Rojas &lt;guilhermehrojas@gmail.com&gt;
81 83 Daniel Alves + Guilherme Rojas <danpaulalves@gmail.com>
82 84 Daniel Alves + Rafael Manzo <rr.manzo@gmail.com>
83 85 Daniela Soares Feitosa <danielafeitosa@colivre.coop.br>
  86 +Daniel Bucher <daniel.bucher88@gmail.com>
84 87 Daniel Cunha <daniel@colivre.coop.br>
85 88 diegoamc <diegoamc90@gmail.com>
86 89 Diego Araújo + Alessandro Palmeira <diegoamc90@gmail.com>
... ... @@ -110,9 +113,12 @@ Diego + Jefferson &lt;diegoamc90@gmail.com&gt;
110 113 Diego Martinez <diegoamc90@gmail.com>
111 114 Diego Martinez <diego@diego-K55A.(none)>
112 115 Diego + Renan <renanteruoc@gmail.com>
  116 +Eduardo Tourinho Edington <eduardo.edington@serpro.gov.br>
113 117 Fernanda Lopes <nanda.listas+psl@gmail.com>
114 118 Francisco Marcelo A. Lima Júnior <francisco.lima-junior@serpro.gov.br>
115 119 Francisco Marcelo de Araujo Lima Junior <79350259591@serpro-1457614.(none)>
  120 +Francisco Marcelo de Araújo Lima Júnior <francisco.lima-junior@serpro.gov.br>
  121 +Francisco Marcelo de Araújo Lima Júnior <maljunior@gmail.com>
116 122 Grazieno Pellegrino <grazieno@gmail.com>
117 123 Isaac Canan <isaac@intelletto.com.br>
118 124 Italo Valcy <italo@dcc.ufba.br>
... ... @@ -151,15 +157,19 @@ Joenio Costa &lt;joenio@colivre.coop.br&gt;
151 157 Josef Spillner <josef.spillner@tu-dresden.de>
152 158 Junior Silva <juniorsilva1001@gmail.com>
153 159 Junior Silva <juniorsilva7@juniorsilva-Aspire-5750Z.(none)>
  160 +Junior Silva <juniorsilva@colivre.coop.br>
154 161 Keilla Menezes <keilla@colivre.coop.br>
155 162 Larissa Reis <larissa@colivre.coop.br>
156 163 Larissa Reis <reiss.larissa@gmail.com>
  164 +Leandro Nunes dos Santos <81665687568@serpro-1541727.Home>
  165 +Leandro Nunes dos Santos <81665687568@serpro-1541727.(none)>
157 166 Leandro Nunes dos Santos <leandronunes@gmail.com>
158 167 Leandro Nunes dos Santos <leandro.santos@serpro.gov.br>
159 168 LinguÁgil 2010 <linguagil.bahia@gmail.com>
160 169 Lucas Melo <lucas@colivre.coop.br>
161 170 Lucas Melo <lucaspradomelo@gmail.com>
162 171 Luis David Aguilar Carlos <ludwig9003@gmail.com>
  172 +Marcos Ramos <ms.ramos@outlook.com>
163 173 Martín Olivera <molivera@solar.org.ar>
164 174 Moises Machado <moises@colivre.coop.br>
165 175 Naíla Alves <naila@colivre.coop.br>
... ... @@ -197,9 +207,13 @@ Rodrigo Souto &lt;rodrigo@colivre.coop.br&gt;
197 207 Ronny Kursawe <kursawe.ronny@googlemail.com>
198 208 root <root@debian.sdr.serpro>
199 209 Samuel R. C. Vale <srcvale@holoscopio.com>
  210 +Valessio Brito <contato@valessiobrito.com.br>
  211 +Valessio Brito <contato@valessiobrito.info>
200 212 Valessio Brito <valessio@gmail.com>
201 213 vfcosta <vfcosta@gmail.com>
  214 +Victor Carvalho <victorhugodf.ac@gmail.com>
202 215 Victor Costa <vfcosta@gmail.com>
  216 +Victor Hugo Alves de Carvalho <victorhugodf.ac@gmail.com>
203 217 Vinicius Cubas Brand <viniciuscb@gmail.com>
204 218 Visita <visita@debian.(none)>
205 219 Yann Lugrin <yann.lugrin@liquid-concept.ch>
... ...
AUTHORS.md 0 → 100644
... ... @@ -0,0 +1,214 @@
  1 +If you are not listed here, but should be, please write to the noosfero mailing list: http://listas.softwarelivre.org/cgi-bin/mailman/listinfo/noosfero-dev (this list requires subscription to post, but since you are an author of noosfero, that's not a problem).
  2 +
  3 +Developers
  4 +==========
  5 +
  6 +Alan Freihof Tygel <alantygel@gmail.com>
  7 +Alessandro Palmeira <alessandro.palmeira@gmail.com>
  8 +Alessandro Palmeira + Caio C. Salgado <alessandro.palmeira@gmail.com>
  9 +Alessandro Palmeira + Caio Salgado <alessandro.palmeira@gmail.com>
  10 +Alessandro Palmeira + Caio Salgado <caio.csalgado@gmail.com>
  11 +Alessandro Palmeira + Caio Salgado + Diego Araújo + João M. M. da Silva <diegoamc90@gmail.com>
  12 +Alessandro Palmeira + Carlos Morais <alessandro.palmeira@gmail.com>
  13 +Alessandro Palmeira + Daniel Alves <alessandro.palmeira@gmail.com>
  14 +Alessandro Palmeira + Daniel Alves + Diego Araújo <diegoamc90@gmail.com>
  15 +Alessandro Palmeira + Daniel Alves + Diego Araújo + Guilherme Rojas <danpaulalves@gmail.com>
  16 +Alessandro Palmeira + Diego Araujo <alessandro.palmeira@gmail.com>
  17 +Alessandro Palmeira + Diego Araújo <alessandro.palmeira@gmail.com>
  18 +Alessandro Palmeira + Diego Araujo + Daniela Feitosa <alessandro.palmeira@gmail.com>
  19 +Alessandro Palmeira + Diego Araujo <diegoamc90@gmail.com>
  20 +Alessandro Palmeira + Diego Araújo <diegoamc90@gmail.com>
  21 +Alessandro Palmeira + Diego Araujo + Eduardo Morais <alessandro.palmeira@gmail.com>
  22 +Alessandro Palmeira + Diego Araújo + João M. M. da Silva <alessandro.palmeira@gmail.com>
  23 +Alessandro Palmeira + Diego Araújo + João M. M. da Silva <diegoamc90@gmail.com>
  24 +Alessandro Palmeira + Diego Araujo + João M. M. da Silva + Paulo Meirelles <alessandro.palmeira@gmail.com>
  25 +Alessandro Palmeira + Diego Araújo + Pedro Leal <diegoamc90@gmail.com>
  26 +Alessandro Palmeira + Diego Araújo + Pedro Leal + João M. M. da Silva <diegoamc90@gmail.com>
  27 +Alessandro Palmeira + Diego Araujo + Rafael Manzo <alessandro.palmeira@gmail.com>
  28 +Alessandro Palmeira + Eduardo Morais <alessandro.palmeira@gmail.com>
  29 +Alessandro Palmeira + Guilherme Rojas <alessandro.palmeira@gmail.com>
  30 +Alessandro Palmeira + Jefferson Fernandes <alessandro.palmeira@gmail.com>
  31 +Alessandro Palmeira + João M. M. da Silva <alessandro.palmeira@gmail.com>
  32 +Alessandro Palmeira + Joao M. M. da Silva + Diego Araujo <alessandro.palmeira@gmail.com>
  33 +Alessandro Palmeira + João M. M. da Silva + Renan Teruo <alessandro.palmeira@gmail.com>
  34 +Alessandro Palmeira + João M. M. Silva <alessandro.palmeira@gmail.com>
  35 +Alessandro Palmeira + Paulo Meirelles <alessandro.palmeira@gmail.com>
  36 +Alessandro Palmeira + Paulo Meirelles + João M. M. da Silva <alessandro.palmeira@gmail.com>
  37 +Alessandro Palmeira + Rafael Manzo <alessandro.palmeira@gmail.com>
  38 +Antonio Terceiro + Carlos Morais <terceiro@colivre.coop.br>
  39 +Antonio Terceiro + Paulo Meirelles <terceiro@colivre.coop.br>
  40 +Antonio Terceiro <terceiro@colivre.coop.br>
  41 +Aurelio A. Heckert <aurelio@colivre.coop.br>
  42 +Braulio Bhavamitra <brauliobo@gmail.com>
  43 +Bráulio Bhavamitra <brauliobo@gmail.com>
  44 +Braulio Bhavamitra <braulio@eita.org.br>
  45 +Caio <caio.csalgado@gmail.com>
  46 +Caio + Diego + Pedro + João <caio.csalgado@gmail.com>
  47 +Caio Formiga <caio.formiga@gmail.com>
  48 +Caio, Pedro <caio.csalgado@gmail.com>
  49 +Caio Salgado + Alessandro Palmeira <caio.csalgado@gmail.com>
  50 +Caio Salgado <caio.csalgado@gmail.com>
  51 +Caio Salgado + Carlos Morais + Diego Araújo + Pedro Leal <diegoamc90@gmail.com>
  52 +Caio Salgado + Diego Araujo <caio.csalgado@gmail.com>
  53 +Caio Salgado + Diego Araújo <caio.csalgado@gmail.com>
  54 +Caio Salgado + Diego Araújo <diegoamc90@gmail.com>
  55 +Caio Salgado + Diego Araújo + Jefferson Fernandes <caio.csalgado@gmail.com>
  56 +Caio Salgado + Diego Araújo + João M. M. da Silva <caio.csalgado@gmail.com>
  57 +Caio Salgado + Diego Araújo + Pedro Leal <caio.csalgado@gmail.com>
  58 +Caio Salgado + Diego Araújo + Pedro Leal <diegoamc90@gmail.com>
  59 +Caio Salgado + Diego Araújo + Rafael Manzo <diegoamc90@gmail.com>
  60 +Caio Salgado + Jefferson Fernandes <caio.csalgado@gmail.com>
  61 +Caio Salgado + Jefferson Fernandes <jeffs.fernandes@gmail.com>
  62 +Caio Salgado + Rafael Manzo <caio.csalgado@gmail.com>
  63 +Caio Salgado + Renan Teruo <caio.csalgado@gmail.com>
  64 +Caio Salgado + Renan Teruo <caio.salgado@gmail.com>
  65 +Caio Salgado + Renan Teruo + Jefferson Fernandes <jeffs.fernandes@gmail.com>
  66 +Caio Salgado + Renan Teruo <renanteruoc@gmail.com>
  67 +Caio SBA <caio@colivre.coop.br>
  68 +Carlos Morais <carlos88morais@gmail.com>
  69 +Carlos Morais + Diego Araújo <diegoamc90@gmail.com>
  70 +Carlos Morais + Eduardo Morais <carlos88morais@gmail.com>
  71 +Carlos Morais + Paulo Meirelles <carlos88morais@gmail.com>
  72 +Carlos Morais + Pedro Leal <carlos88morais@gmail.com>
  73 +Daniel Alves + Diego Araújo <danpaulalves@gmail.com>
  74 +Daniel Alves + Diego Araújo <diegoamc90@gmail.com>
  75 +Daniel Alves + Diego Araújo + Guilherme Rojas <danpaulalves@gmail.com>
  76 +Daniel Alves + Diego Araújo + Guilherme Rojas <diegoamc90@gmail.com>
  77 +Daniel Alves + Diego Araújo + Guilherme Rojas <guilhermehrojas@gmail.com>
  78 +Daniel Alves + Guilherme Rojas <danpaulalves@gmail.com>
  79 +Daniel Alves + Rafael Manzo <rr.manzo@gmail.com>
  80 +Daniela Soares Feitosa <danielafeitosa@colivre.coop.br>
  81 +Daniel Cunha <daniel@colivre.coop.br>
  82 +diegoamc <diegoamc90@gmail.com>
  83 +Diego Araújo + Alessandro Palmeira <diegoamc90@gmail.com>
  84 +Diego Araújo + Alessandro Palmeira + João M. M. da Silva <diegoamc90@gmail.com>
  85 +Diego Araújo + Alessandro Palmeira + Rafael Manzo <rr.manzo@gmail.com>
  86 +Diego Araujo + Caio Salgado <diegoamc90@gmail.com>
  87 +Diego Araújo + Daniel Alves + Rafael Manzo <rr.manzo@gmail.com>
  88 +Diego Araújo <diegoamc90@gmail.com>
  89 +Diego Araújo + Eduardo Morais + Paulo Meirelles <diegoamc90@gmail.com>
  90 +Diego Araújo + Guilherme Rojas <diegoamc90@gmail.com>
  91 +Diego Araújo + Jefferson Fernandes <diegoamc90@gmail.com>
  92 +Diego Araujo + Jefferson Fernandes <jeffs.fernandes@gmail.com>
  93 +Diego Araújo + João Machini <diegoamc90@gmail.com>
  94 +Diego Araújo + João Machini <digoamc90@gmail.com>
  95 +Diego Araújo + João M. M. da Silva + Alessandro Palmeira <jaodsilv@linux.ime.usp.br>
  96 +Diego Araújo + João M. M. da Silva <diegoamc90@gmail.com>
  97 +Diego Araújo + João M. M. da Silva + João Machini <diegoamc90@gmail.com>
  98 +Diego Araújo + João M. M. da Silva + Pedro Leal <diegoamc90@gmail.com>
  99 +Diego Araújo + Paulo Meirelles <diegoamc90@gmail.com>
  100 +Diego Araújo + Pedro Leal <diegoamc90@gmail.com>
  101 +Diego Araujo + Rafael Manzo <diegoamc90@gmail.com>
  102 +Diego Araújo + Rafael Manzo <diegoamc90@gmail.com>
  103 +Diego Araújo + Renan Teruo + Alessandro Palmeira <diegoamc90@gmail.com>
  104 +Diego Araújo + Renan Teruo <diegoamc90@gmail.com>
  105 +Diego Araujo + Rodrigo Souto + Rafael Manzo <rr.manzo@gmail.com>
  106 +Diego + Jefferson <diegoamc90@gmail.com>
  107 +Diego Martinez <diegoamc90@gmail.com>
  108 +Diego Martinez <diego@diego-K55A.(none)>
  109 +Diego + Renan <renanteruoc@gmail.com>
  110 +Fernanda Lopes <nanda.listas+psl@gmail.com>
  111 +Francisco Marcelo A. Lima Júnior <francisco.lima-junior@serpro.gov.br>
  112 +Francisco Marcelo de Araujo Lima Junior <79350259591@serpro-1457614.(none)>
  113 +Grazieno Pellegrino <grazieno@gmail.com>
  114 +Isaac Canan <isaac@intelletto.com.br>
  115 +Italo Valcy <italo@dcc.ufba.br>
  116 +Jefferson Fernandes + Diego Araujo + Rafael Manzo <jeffs.fernandes@gmail.com>
  117 +Jefferson Fernandes + Joao M. M. da Silva <jeffs.fernandes@gmail.com>
  118 +Jefferson Fernandes + Joao M. M. Silva <jeffs.fernandes@gmail.com>
  119 +João da Silva <jaodsilv@linux.ime.usp.br>
  120 +João Marco Maciel da Silva + Rafael Manzo + Renan Teruo <jaodsilv@linux.ime.usp.br>
  121 +João M. M. da Silva + Alessandro Palmeira + Diego Araújo + Caio Salgado <jaodsilv@linux.ime.usp.br>
  122 +João M. M. da Silva + Alessandro Palmeira + Diego Araújo <jaodsilv@linux.ime.usp.br>
  123 +Joao M. M. da Silva + Alessandro Palmeira <jaodsilv@linux.ime.usp.br>
  124 +João M. M. da Silva + Alessandro Palmeira <jaodsilv@linux.ime.usp.br>
  125 +João M. M. da Silva + Alessandro Palmeira + João Machini <jaodsilv@linux.ime.usp.br>
  126 +João M. M. da Silva + Caio Salgado + Alessandro Palmeira <jaodsilv@linux.ime.usp.br>
  127 +João M. M. da Silva + Caio Salgado <jaodsilv@linux.ime.usp.br>
  128 +João M. M. da Silva + Carlos Morais <jaodsilv@linux.ime.usp.br>
  129 +João M. M. da Silva + Diego Araújo <diegoamc90@gmail.com>
  130 +João M. M. da Silva + Diego Araújo <jaodsilv@linux.ime.usp.br>
  131 +João M. M. da Silva + Diego Araújo + Pedro Leal <jaodsilv@linux.ime.usp.br>
  132 +João M. M. da Silva <jaodsilv@linux.ime.usp.br>
  133 +Joao M. M. da Silva + Jefferson Fernandes <jaodsilv@linux.ime.usp.br>
  134 +João M. M. da Silva + Jefferson Fernandes <jaodsilv@linux.ime.usp.br>
  135 +João M. M. da Silva + João M. Miranda <jaodsilv@linux.ime.usp.br>
  136 +João M. M. da Silva + Paulo Meirelles <jaodsilv@linux.ime.usp.br>
  137 +João M. M. da Silva + Pedro Leal <jaodsilv@linux.ime.usp.br>
  138 +João M. M. da Silva + Rafael Manzo + Diego Araújo <jaodsilv@linux.ime.usp.br>
  139 +João M. M. da Silva + Rafael Manzo <jaodsilv@linux.ime.usp.br>
  140 +João M. M. da Silva + Renan Teruo <jaodsilv@linux.ime.usp.br>
  141 +João M. M. Silva + Caio Salgado <jaodsilv@linux.ime.usp.br>
  142 +João M. M. Silva + Diego Araújo <jaodsilv@linux.ime.usp.br>
  143 +Joao M. M. Silva + Jefferson Fernandes <jaodsilv@linux.ime.usp.br>
  144 +João M. M. Silva + Paulo Meirelles <jaodsilv@linux.ime.usp.br>
  145 +João M. M. Silva + Rafael Manzo <jaodsilv@linux.ime.usp.br>
  146 +João M. M. Silva + Renan Teruo <jaodsilv@linux.ime.usp.br>
  147 +Joenio Costa <joenio@colivre.coop.br>
  148 +Josef Spillner <josef.spillner@tu-dresden.de>
  149 +Junior Silva <juniorsilva1001@gmail.com>
  150 +Junior Silva <juniorsilva7@juniorsilva-Aspire-5750Z.(none)>
  151 +Keilla Menezes <keilla@colivre.coop.br>
  152 +Larissa Reis <larissa@colivre.coop.br>
  153 +Larissa Reis <reiss.larissa@gmail.com>
  154 +Leandro Nunes dos Santos <leandronunes@gmail.com>
  155 +Leandro Nunes dos Santos <leandro.santos@serpro.gov.br>
  156 +LinguÁgil 2010 <linguagil.bahia@gmail.com>
  157 +Lucas Melo <lucas@colivre.coop.br>
  158 +Lucas Melo <lucaspradomelo@gmail.com>
  159 +Luis David Aguilar Carlos <ludwig9003@gmail.com>
  160 +Martín Olivera <molivera@solar.org.ar>
  161 +Moises Machado <moises@colivre.coop.br>
  162 +Naíla Alves <naila@colivre.coop.br>
  163 +Nanda Lopes <nanda.listas+psl@gmail.com>
  164 +Paulo Meirelles + Alessandro Palmeira + João M. M. da Silva <paulo@softwarelivre.org>
  165 +Paulo Meirelles + Alessandro Palmeira <paulo@softwarelivre.org>
  166 +Paulo Meirelles + Carlos Morais <paulo@softwarelivre.org>
  167 +Paulo Meirelles + Diego Araújo <paulo@softwarelivre.org>
  168 +Paulo Meirelles + João M. M. da Silva <paulo@softwarelivre.org>
  169 +Paulo Meirelles <paulo@softwarelivre.org>
  170 +Paulo Meirelles + Rafael Manzo <paulo@softwarelivre.org>
  171 +Rafael Gomes <rafaelgomes@techfree.com.br>
  172 +Rafael Manzo + Alessandro Palmeira <rr.manzo@gmail.com>
  173 +Rafael Manzo + Daniel Alves <danpaulalves@gmail.com>
  174 +Rafael Manzo + Diego Araújo <rr.manzo@gmail.com>
  175 +Rafael Manzo + João M. M. Silva <rr.manzo@gmail.com>
  176 +Rafael Manzo + Paulo Meirelles <rr.manzo@gmail.com>
  177 +Rafael Martins <rmmartins@gmail.com>
  178 +Rafael Reggiani Manzo + Caio Salgado + Jefferson Fernandes <rr.manzo@gmail.com>
  179 +Rafael Reggiani Manzo + Diego Araujo <diegoamc90@gmail.com>
  180 +Rafael Reggiani Manzo + Diego Araujo <rr.manzo@gmail.com>
  181 +Rafael Reggiani Manzo + Diego Araújo <rr.manzo@gmail.com>
  182 +Rafael Reggiani Manzo + João M. M. da Silva <rr.manzo@gmail.com>
  183 +Rafael Reggiani Manzo <rr.manzo@gmail.com>
  184 +Raphaël Rousseau <raph@r4f.org>
  185 +Raquel Lira <raquel.lira@gmail.com>
  186 +Renan Teruo + Caio Salgado <renanteruoc@gmail.com>
  187 +Renan Teruoc + Diego Araujo <renanteruoc@gmail.com>
  188 +Renan Teruo + Diego Araujo <renanteruoc@gmail.com>
  189 +Renan Teruo + Diego Araújo <renanteruoc@gmail.com>
  190 +Renan Teruo + Paulo Meirelles <renanteruoc@gmail.com>
  191 +Renan Teruo + Rafael Manzo <renanteruoc@gmail.com>
  192 +Rodrigo Souto <diguliu@gmail.com>
  193 +Rodrigo Souto <rodrigo@colivre.coop.br>
  194 +Ronny Kursawe <kursawe.ronny@googlemail.com>
  195 +root <root@debian.sdr.serpro>
  196 +Samuel R. C. Vale <srcvale@holoscopio.com>
  197 +Valessio Brito <valessio@gmail.com>
  198 +vfcosta <vfcosta@gmail.com>
  199 +Victor Costa <vfcosta@gmail.com>
  200 +Vinicius Cubas Brand <viniciuscb@gmail.com>
  201 +Visita <visita@debian.(none)>
  202 +Yann Lugrin <yann.lugrin@liquid-concept.ch>
  203 +
  204 +Ideas, specifications and incentive
  205 +===================================
  206 +Daniel Tygel <dtygel@fbes.org.br>
  207 +Guilherme Rocha <guilherme@gf7.com.br>
  208 +Raphael Rousseau <raph@r4f.org>
  209 +Théo Bondolfi <move@cooperation.net>
  210 +Vicente Aguiar <vicenteaguiar@colivre.coop.br>
  211 +
  212 +Arts
  213 +===================================
  214 +Nara Oliveira <narananet@gmail.com>
... ...
... ... @@ -1,63 +0,0 @@
1   -= Noosfero instructions for developers
2   -
3   -== A work about your the development platform
4   -
5   -These instructions are tested and known to work on Debian stable, which is the
6   -system that the Noosfero core developers use to work on Noosfero.
7   -
8   -If you want to use another OS, read "Instructions for other systems" below.
9   -
10   -== Instructions for Debian stable
11   -
12   -Download the source code:
13   -
14   - $ git clone git://gitorious.org/noosfero/noosfero.git
15   - $ cd noosfero
16   -
17   -Run the quick start script:
18   -
19   - $ ./script/quick-start
20   -
21   -Now you can execute the development server with:
22   -
23   - $ ./script/development
24   -
25   -You will be able to access Noosfero at http://localhost:3000/
26   -
27   -If you want to use a different port than 3000, pass `-p <PORT>` to
28   -./script/development
29   -
30   -== Instructions for other systems
31   -
32   -On other OS, you have 2 options:
33   -
34   -1) using a chroot or a VM with Debian stable (easier)
35   -
36   -Use a chroot (http://wiki.debian.org/Schroot) or a Virtual Machine (e.g. with
37   -VirtualBox) with a Debian stable system and follow the instructions above for
38   -Debian stable.
39   -
40   -2) Installing dependencies on other OS (harder)
41   -
42   -If you want to setup a development environment in another OS, you can create a
43   -file under script/install-dependencies/, called <OS>-<CODENAME>.sh, which
44   -installed the dependencies for your system. With this script in place,
45   -./script/quick-start will call it at the point of installing the required
46   -packages for Noosfero development.
47   -
48   -You can check script/install-dependencies/debian-squeeze.sh to have an idea of
49   -what kind of stuff that script has to do.
50   -
51   -If you write such script for your own OS, *please* share it with us at the
52   -development mailing list so that we can include it in the official repository.
53   -This way other people using the same OS will have to put less effort to develop
54   -Noosfero.
55   -
56   -== Submitting your changes back
57   -
58   -For now please read:
59   -
60   -- Coding conventions
61   - http://noosfero.org/Development/CodingConventions
62   -- Patch guidelines
63   - http://noosfero.org/Development/PatchGuidelines
HACKING.md 0 → 100644
... ... @@ -0,0 +1,56 @@
  1 +Noosfero instructions for developers
  2 +====================================
  3 +
  4 +A work about your the development platform
  5 +------------------------------------------
  6 +
  7 +These instructions are tested and known to work on Debian stable, which is the system that the Noosfero core developers use to work on Noosfero.
  8 +
  9 +If you want to use another OS, read "Instructions for other systems" below.
  10 +
  11 +Instructions for Debian stable
  12 +------------------------------
  13 +
  14 +Download the source code:
  15 +
  16 + $ git clone https://gitlab.com/noosfero/noosfero.git
  17 + $ cd noosfero
  18 +
  19 +Run the quick start script:
  20 +
  21 + $ ./script/quick-start
  22 +
  23 +Now you can execute the development server with:
  24 +
  25 + $ ./script/development
  26 +
  27 +You will be able to access Noosfero at http://localhost:3000/
  28 +
  29 +If you want to use a different port than 3000, pass `-p <PORT>` to `./script/development`
  30 +
  31 +Instructions for other systems
  32 +------------------------------
  33 +
  34 +On other OS, you have 2 options:
  35 +
  36 +### 1) using a chroot or a VM with Debian stable (easier)
  37 +
  38 +Use a chroot (http://wiki.debian.org/Schroot) or a Virtual Machine (e.g. with VirtualBox) with a Debian stable system and follow the instructions above for Debian stable.
  39 +
  40 +### 2) Installing dependencies on other OS (harder)
  41 +
  42 +If you want to setup a development environment in another OS, you can create a file under `./script/install-dependencies/`, called `<OS>-<CODENAME>.sh`, which installed the dependencies for your system. With this script in place, `./script/quick-start` will call it at the point of installing the required packages for Noosfero development.
  43 +
  44 +You can check `./script/install-dependencies/debian-squeeze.sh` to have an idea of what kind of stuff that script has to do.
  45 +
  46 +If you write such script for your own OS, *please* share it with us at the development mailing list so that we can include it in the official repository. This way other people using the same OS will have to put less effort to develop Noosfero.
  47 +
  48 +Submitting your changes back
  49 +----------------------------
  50 +
  51 +For now please read:
  52 +
  53 +- Coding conventions
  54 + http://noosfero.org/Development/CodingConventions
  55 +- Patch guidelines
  56 + http://noosfero.org/Development/PatchGuidelines
... ...
... ... @@ -1,417 +0,0 @@
1   -= Noosfero installation instructions from source for production environments
2   -
3   -The instructions below can be used for setting up a Noosfero production
4   -environment from the Noosfero sources.
5   -
6   -Before you start installing Noosfero manually, see the information about the
7   -Noosfero Debian package at http://noosfero.org/Development/DebianPackage. Using
8   -the Debian packages on a Debian stable system is the recommended method for
9   -installing production environments.
10   -
11   -If you want to setup a development environment instead of a production one,
12   -stop reading this file right now and read the file HACKING instead.
13   -
14   -For a complete installation guide, please see the following web page:
15   -http://noosfero.org/Development/HowToInstall
16   -
17   -If you have problems with the setup, please feel free to ask questions in the
18   -development mailing list.
19   -
20   -== Requirements
21   -
22   -DISCLAIMER: this installation procedure is tested with Debian stable, which is
23   -currently the only recommended operating system for production usage. It is
24   -possible that you can install it on other systems, and if you do so, please
25   -report it on one of the Noosfero mailing lists, and please send a patch
26   -updating these instructions.
27   -
28   -Noosfero is written in Ruby with the "Rails
29   -framework":http://www.rubyonrails.org, so the process of setting it up is
30   -pretty similar to other Rails applications.
31   -
32   -You need to install some packages Noosfero depends on. On Debian GNU/Linux or
33   -Debian-based systems, all of these packages are available through the Debian
34   -archive. You can install them with the following command:
35   -
36   - # apt-get install ruby rake po4a libgettext-ruby-util libgettext-ruby1.8 libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby libwill-paginate-ruby iso-codes libfeedparser-ruby libdaemons-ruby thin tango-icon-theme libhpricot-ruby
37   -
38   -On other systems, they may or may not be available through your regular package
39   -management system. Below are the links to their homepages.
40   -
41   -* Ruby: http://www.ruby-lang.org/
42   -* Rake: http://rake.rubyforge.org/
43   -* po4a: http://po4a.alioth.debian.org/
44   -* Ruby-sqlite3: http://rubyforge.org/projects/sqlite-ruby
45   -* rcov: http://eigenclass.org/hiki/rcov
46   -* RMagick: http://rmagick.rubyforge.org/
47   -* RedCloth: http://redcloth.org/
48   -* will_paginate: http://github.com/mislav/will_paginate/wikis
49   -* iso-codes: http://pkg-isocodes.alioth.debian.org/
50   -* feedparser: http://packages.debian.org/sid/libfeedparser-ruby
51   -* Daemons - http://daemons.rubyforge.org/
52   -* Thin: http://code.macournoyer.com/thin/
53   -* tango-icon-theme: http://tango.freedesktop.org/Tango_Icon_Library
54   -* Hpricot: http://hpricot.com/
55   -
56   -If you manage to install Noosfero successfully on other systems than Debian,
57   -please feel free to contact the Noosfero development mailing with the
58   -instructions for doing so, and we'll include it here.
59   -
60   -As root user
61   -============
62   -
63   -Install memcached. On Debian:
64   -
65   -# apt-get install memcached
66   -
67   -Study whether you need to raise the ammount of memory it uses for caching,
68   -depending on the demand you expect for your site. If you are going to run a
69   -high-traffic site, you will want to raise the ammount of memory reserved for
70   -caching.
71   -
72   -It is recommended that you run noosfero with its own user account. To create
73   -such an account, please do the following:
74   -
75   -# adduser --system --group noosfero --shell /bin/sh --home /var/lib/noosfero
76   -
77   -(note that you can change the $HOME directory of the user if you wish, here we
78   -are using /var/lib/noosfero)
79   -
80   -The --system option will tell adduser to create a system user, i.e. this user
81   -will not have a password and cannot login to the system directly. To become
82   -this user, you have to use sudo:
83   -
84   -# sudo -u noosfero -i
85   -
86   -or
87   -
88   -# su - noosfero
89   -
90   -As noosfero user
91   -================
92   -
93   -downloading from git
94   ---------------------
95   -
96   -Here we are cloning the noosfero repository from git. Note: you will need to
97   -install git before.
98   -
99   -$ git clone git://gitorious.org/noosfero/noosfero.git current
100   -$ cd current
101   -$ git checkout -b stable origin/stable
102   -
103   -downloading tarball
104   --------------------
105   -
106   -Note: replace 0.39.0 below from the latest stable version.
107   -
108   -$ wget http://noosfero.org/pub/Development/NoosferoVersion00x39x00/noosfero-0.39.0.tar.gz
109   -$ tar -zxvf noosfero-0.39.0.tar.gz
110   -$ ln -s noosfero-0.39.0 current
111   -$ cd current
112   -
113   -Create the thin configuration file:
114   -
115   -$ thin -C config/thin.yml -e production config
116   -
117   -Edit config/thin.yml to suit your needs. Make sure your apache
118   -configuration matches the thin cluster configuration, specially in respect
119   -to the ports and numbers of thin instances.
120   -
121   -Note: currently Noosfero only supports Rails 2.3.5, which is the version in
122   -Debian Squeeze. If you have a Rails version newer than that, Noosfero will
123   -probably not work. You can install Rails 2.3.5 into your Noosfero installation
124   -with the following procedure:
125   -
126   -$ cd /var/lib/noosfero/current/vendor
127   -$ wget http://ftp.de.debian.org/debian/pool/main/r/rails/rails_2.3.5.orig.tar.gz
128   -$ tar xzf rails_2.3.5.orig.tar.gz
129   -$ ln -s rails-2.3.5 rails
130   -
131   -As root user
132   -============
133   -
134   -Setup Noosfero log and tmp directories:
135   -
136   -# cd /var/lib/noosfero/current
137   -# ./etc/init.d/noosfero setup
138   -
139   -Now it's time to setup the database. In this example we are using PostgreSQL,
140   -so if you are planning to use a different database this steps won't apply.
141   -
142   -# apt-get install postgresql libpgsql-ruby
143   -# su postgres -c 'createuser noosfero -S -d -R'
144   -
145   -By default Rails will try to connect on postgresql through 5432 port,
146   -you can check it on /etc/postgresql/8.4/main/postgresql.conf file.
147   -
148   -Restart postgresql:
149   -
150   -# invoke-rc.d postgresql restart
151   -
152   -Noosfero needs a functional e-mail setup to work: the local mail system should
153   -be able to deliver e-mail to the internet, either directly or through an
154   -external SMTP server. Please check the documentation at the INSTALL.email file.
155   -
156   -As noosfero user
157   -================
158   -
159   -Now create the databases:
160   -
161   -$ cd /var/lib/noosfero/current
162   -$ createdb noosfero_production
163   -$ createdb noosfero_development
164   -$ createdb noosfero_test
165   -
166   -The development and test databases are actually optional. If you are creating a
167   -stricly production server, you will probably not need them.
168   -
169   -Now we want to configure Noosfero for accessing the database we just created.
170   -To do that, you can 1) copy config/database.yml.pgsql to config/database.yml,
171   -or create config/database.yml from scratch with the following content:
172   -
173   - production:
174   - adapter: postgresql
175   - encoding: unicode
176   - database: noosfero_production
177   - username: noosfero
178   -
179   -Now, to test the database access, you can fire the Rails database console:
180   -
181   -$ ./script/dbconsole production
182   -
183   -If it connects to your database, then everything is fine. If you got an error
184   -message, then you have to check your database configuration.
185   -
186   -Create the database structure:
187   -
188   -$ RAILS_ENV=production rake db:schema:load
189   -
190   -Compile the translations:
191   -
192   -$ RAILS_ENV=production rake noosfero:translations:compile
193   -
194   -Now we must create some initial data. To create your default environment
195   -(the first one), run the command below:
196   -
197   -$ RAILS_ENV=production ./script/runner 'Environment.create!(:name => "My environment", :is_default => true)'
198   -
199   -(of course, replace "My environment" with your environment's name!)
200   -
201   -And now you have to add the domain name you will be using for your noosfero
202   -site to the list of domains of that default environment you just created:
203   -
204   -$ RAILS_ENV=production ./script/runner "Environment.default.domains << Domain.new(:name => 'your.domain.com')"
205   -
206   -(replace "your.domain.com" with your actual domain name)
207   -
208   -Add at least one user as admin of environment:
209   -
210   -$ RAILS_ENV=production ./script/runner "User.create(:login => 'adminuser', :email => 'admin@example.com', :password => 'admin', :password_confirmation => 'admin', :environment => Environment.default, :activated_at => Time.new)"
211   -
212   -(replace "adminuser", "admin@example.com", "admin" with the login, email
213   -and password of your environment administrator)
214   -
215   -To start the Noosfero application servers:
216   -
217   -$ ./script/production start
218   -
219   -At this point you have a functional Noosfero installation running, the only
220   -thing left is to configure your webserver as a reverse proxy to pass requests
221   -to them.
222   -
223   -
224   -==================
225   -Apache instalation
226   -==================
227   -
228   -# apt-get install apache2
229   -
230   -Apache configuration
231   ---------------------
232   -
233   -First you have to enable the following some apache modules:
234   -
235   - deflate
236   - expires
237   - proxy
238   - proxy_balancer
239   - proxy_http
240   - rewrite
241   -
242   -On Debian GNU/Linux system, these modules can be enabled with the following
243   -command line, as root:
244   -
245   -# a2enmod deflate expires proxy proxy_balancer proxy_http rewrite
246   -
247   -In other systems the way by which you enable apache modules may be different.
248   -
249   -Now with the Apache configuration. You can use the template below, replacing
250   -/var/lib/noosfero/current with the directory in which your noosfero
251   -installation is, your.domain.com with the domain name of your noosfero site.
252   -We are assuming that you are running two thin instances on ports 3000 and
253   -3001. If your setup is different you'll need to adjust <Proxy> section. If you
254   -don't understand something in the configuration, please refer to the apache
255   -documentation.
256   -
257   -Add a file called "mysite" (or whatever name you want to give to your noosfero
258   -site) to /etc/apache2/sites-available with the following content, and customize
259   -as needed (as usual, make sure you replace "your.domain.com" with you actual
260   -domain name, and "/var/lib/noosfero/current" with the directory where Noosfero
261   -is installed):
262   -
263   - <VirtualHost *:80>
264   - ServerName your.domain.com
265   -
266   - DocumentRoot "/var/lib/noosfero/current/public"
267   - <Directory "/var/lib/noosfero/current/public">
268   - Options FollowSymLinks
269   - AllowOverride None
270   - Order Allow,Deny
271   - Allow from all
272   - </Directory>
273   -
274   - RewriteEngine On
275   -
276   - # Rewrite index to check for static index.html
277   - RewriteRule ^/$ /index.html [QSA]
278   -
279   - # Rewrite to check for Rails cached page
280   - RewriteRule ^([^.]+)$ $1.html [QSA]
281   -
282   - RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
283   - RewriteRule ^.*$ balancer://noosfero%{REQUEST_URI} [P,QSA,L]
284   -
285   - ErrorDocument 503 /503.html
286   -
287   - ErrorLog /var/log/apache2/noosfero.log
288   - LogLevel warn
289   - CustomLog /var/log/apache2/noosfero.access.log combined
290   -
291   - Include /var/lib/noosfero/current/etc/noosfero/apache/cache.conf
292   -
293   - </VirtualHost>
294   -
295   - <Proxy balancer://noosfero>
296   - BalancerMember http://127.0.0.1:3000
297   - BalancerMember http://127.0.0.1:3001
298   - Order Allow,Deny
299   - Allow from All
300   - </Proxy>
301   -
302   -The cache.conf file included in the end of the <VirtualHost> section is
303   -important, since it will tell apache to pass expiration and cache headers to
304   -clients so that the site feels faster for users. Do we need to say that using
305   -that configuration is strongly recommended?
306   -
307   -Enable that site with (as root, replace "mysite" with the actual name you gave
308   -to your site configuration):
309   -
310   -# a2ensite mysite
311   -
312   -Now restart your apache server (as root):
313   -
314   -# invoke-rc.d apache2 restart
315   -
316   -
317   -Enabling exception notifications
318   -================================
319   -
320   -This is an optional step. You will need it only if you want to receive e-mail
321   -notifications when some exception occurs on Noosfero.
322   -
323   -First, install this version of the gem.
324   -Others versions may not be compatible with Noosfero:
325   -
326   -# gem install exception_notification -v 1.0.20090728
327   -
328   -You can configure the e-mails that will receive the notifications.
329   -Change the file config/noosfero.yml as the following example, replacing the
330   -e-mails by real ones:
331   -
332   - production:
333   - exception_recipients: [admin@example.com, you@example.com]
334   -
335   -
336   -============
337   -Maintainance
338   -============
339   -
340   -To ease the maintainance, install a symbolic link for the Noosfero startup
341   -script in your server and add it to the system initialization and shutdown
342   -sequences (as root):
343   -
344   -# ln -s /var/lib/noosfero/current/etc/init.d/noosfero /etc/init.d/noosfero
345   -# update-rc.d noosfero defaults
346   - Adding system startup for /etc/init.d/noosfero ...
347   - /etc/rc0.d/K20noosfero -> ../init.d/noosfero
348   - /etc/rc1.d/K20noosfero -> ../init.d/noosfero
349   - /etc/rc6.d/K20noosfero -> ../init.d/noosfero
350   - /etc/rc2.d/S20noosfero -> ../init.d/noosfero
351   - /etc/rc3.d/S20noosfero -> ../init.d/noosfero
352   - /etc/rc4.d/S20noosfero -> ../init.d/noosfero
353   - /etc/rc5.d/S20noosfero -> ../init.d/noosfero
354   -
355   -Now to start Noosfero, you do as root:
356   -
357   -# invoke-rc.d noosfero start
358   -
359   -To stop Noosfero:
360   -
361   -# invoke-rc.d noosfero start
362   -
363   -To restart Noosfero:
364   -
365   -# invoke-rc.d noosfero restart
366   -
367   -Noosfero will be automatically started during system boot, and automatically
368   -stopped if the system shuts down for some reason (or during the shutdown part
369   -of a reboot).
370   -
371   -=============
372   -Rotating logs
373   -=============
374   -
375   -Noosfero provides an example logrotate configuation to rotate its logs. To use
376   -it, create a symbolic link in /etc/logrotate.d/:
377   -
378   -# cd /etc/logrotate.d/
379   -# ln -s /var/lib/noosfero/current/etc/logrotate.d/noosfero
380   -
381   -Note that the provided file assumes Noosfero logging is being done in
382   -/var/log/noosfero (which is the case if you followed the instructions above
383   -correctly). If the logs are stored elsewhere, it's recommended that you copy
384   -the file over to /etc/logrotate.d/ and modify it to point to your local log
385   -directly.
386   -
387   -=========
388   -Upgrading
389   -=========
390   -
391   -If you followed the steps in this document and installed Noosfero from the git
392   -repository, then upgrading is easy. First, you need to allow the noosfero user
393   -to restart the memcached server with sudo, by adding the following line in
394   -/etc/sudoers:
395   -
396   -noosfero ALL=NOPASSWD: /etc/init.d/memcached
397   -
398   -Then, to perform an upgrade, do the following as the noosfero user:
399   -
400   -$ cd /var/lib/noosfero/current
401   -$ ./script/git-upgrade
402   -
403   -The git-upgrade script will take care of everything for you. It will first stop
404   -the service, then fetch the current source code, upgrade database, compile
405   -translations, and then start the service again.
406   -
407   -Note 1: make sure your local git repository is following the "stable" branch,
408   -just like the instructions above. The "master" branch is not recommended for
409   -use in production environments.
410   -
411   -Note 2: always read the release notes before upgrading. Sometimes there will be
412   -steps that must be performed manually. If that is the case, you can invoke the
413   -git-upgrade script with the special parameter "--shell" that will give you a
414   -shell after the upgrade, which you can use to perform any manual steps
415   -required:
416   -
417   -$ ./script/git-upgrade --shell
INSTALL.awstats
... ... @@ -1,78 +0,0 @@
1   -= AWStats setup for Noosfero
2   -
3   -AWStats is a free powerful and featureful tool that generates advanced web,
4   -streaming, ftp or mail server statistics, graphically.
5   -
6   -See http://awstats.sourceforge.net/
7   -
8   -This guide supposes that the Noosfero server is running GNU/Linux Debian Squeeze.
9   -
10   -1. Install AWStats
11   -
12   -# apt-get install awstats libgeo-ip-perl geoip-database
13   -
14   -2. Basic setup
15   -
16   -Create AWStats config file:
17   -
18   - * /etc/awstats/awstats.<domain>.conf
19   -
20   -Include "/etc/awstats/awstats.conf"
21   -Include "/etc/noosfero/awstats-noosfero.conf"
22   -SiteDomain="<domain>"
23   -HostAliases="<domain-aliases>"
24   -
25   -<domain> should be the domain used in your Noosfero server (eg.:
26   -softwarelivre.org) and the <domain-aliases> should be a list with all aliases
27   -that you configured in apache (eg.: www.softwarelivre.org
28   -www2.softwarelivre.org etc).
29   -
30   -This setup is considering that the Noosfero server is running varnish (see
31   -INSTALL.varnish) and varnishncsa-vhost [1].
32   -
33   -[1] http://gitorious.org/varnisnncsa-vhost
34   -
35   -3. Running AWStats for the first time
36   -
37   -Run awstats by hand via command line:
38   -
39   -# /usr/lib/cgi-bin/awstats.pl -config=<domain>
40   -
41   -You should see something as below as output of this command:
42   -
43   -# /usr/lib/cgi-bin/awstats.pl -config=softwarelivre.org
44   -Create/Update database for config "/etc/awstats/awstats.softwarelivre.org.conf" by AWStats version 6.7 (build 1.892)
45   -From data in log file "/var/log/varnish/varnishncsa-vhost.log"...
46   -Phase 1 : First bypass old records, searching new record...
47   -Searching new records from beginning of log file...
48   -Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
49   -Jumped lines in file: 0
50   -Parsed lines in file: 452
51   - Found 0 dropped records,
52   - Found 0 corrupted records,
53   - Found 0 old records,
54   - Found 452 new qualified records.
55   -
56   -4. Setup frontend
57   -
58   -You should create a new subdomain to have access to the AWStats, usually
59   -something like tools.<domain> (eg.: tools.softwarelivre.org). Don't include
60   -this subdomain in HostAliases in the AWStats neither in SiteAlias in the
61   -Apache.
62   -
63   -# cp /usr/share/doc/awstats/examples/apache.conf /etc/apache2/conf.d/awstats.conf
64   -# invoke-rc.d apache2 restart
65   -
66   -ps.: Don't forget to change the port /etc/apache/sites-enabled/000-default to
67   -8080.
68   -
69   -Try: http://tools.<domain>/cgi-bin/awstats.pl?config=<domain>
70   -(eg.: http://tools.softwarelivre.org/cgi-bin/awstats.pl?config=softwarelivre.org).
71   -
72   -5. Schedule AWStats in crontab
73   -
74   - * /etc/cron.d/awstats
75   -
76   -0,10,20,30,40,50 * * * * www-data [ -x /usr/lib/cgi-bin/awstats.pl -a -f /etc/awstats/awstats.<domain>.conf -a -r /var/log/apache/access.log ] && /usr/lib/cgi-bin/awstats.pl -config=<domain> -update >/dev/null
77   -
78   -Done, check the AWStats frontend after one or two days to see if everything is working properly.
INSTALL.awstats.md 0 → 100644
... ... @@ -0,0 +1,67 @@
  1 +AWStats setup for Noosfero
  2 +==========================
  3 +
  4 +AWStats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically.
  5 +
  6 +See http://awstats.sourceforge.net
  7 +
  8 +This guide supposes that the Noosfero server is running GNU/Linux Debian Squeeze.
  9 +
  10 +### 1. Install AWStats
  11 +
  12 + # apt-get install awstats libgeo-ip-perl geoip-database
  13 +
  14 +### 2. Basic setup
  15 +
  16 +Create AWStats config file:
  17 +`/etc/awstats/awstats.<domain>.conf`
  18 +
  19 + Include "/etc/awstats/awstats.conf"
  20 + Include "/etc/noosfero/awstats-noosfero.conf"
  21 + SiteDomain="<domain>"
  22 + HostAliases="<domain-aliases>"
  23 +
  24 +`<domain>` should be the domain used in your Noosfero server (eg.: `softwarelivre.org`) and the `<domain-aliases>` should be a list with all aliases that you configured in apache (eg.: `www.softwarelivre.org`, `www2.softwarelivre.org`, etc).
  25 +
  26 +This setup is considering that the Noosfero server is running varnish (see `INSTALL.varnish`) and [varnishncsa-vhost](http://gitorious.org/varnisnncsa-vhost).
  27 +
  28 +### 3. Running AWStats for the first time
  29 +
  30 +Run awstats by hand via command line:
  31 +
  32 + # /usr/lib/cgi-bin/awstats.pl -config=<domain>
  33 +
  34 +You should see something as below as output of this command:
  35 +
  36 + # /usr/lib/cgi-bin/awstats.pl -config=softwarelivre.org
  37 + Create/Update database for config "/etc/awstats/awstats.softwarelivre.org.conf" by AWStats version 6.7 (build 1.892)
  38 + From data in log file "/var/log/varnish/varnishncsa-vhost.log"...
  39 + Phase 1 : First bypass old records, searching new record...
  40 + Searching new records from beginning of log file...
  41 + Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
  42 + Jumped lines in file: 0
  43 + Parsed lines in file: 452
  44 + Found 0 dropped records,
  45 + Found 0 corrupted records,
  46 + Found 0 old records,
  47 + Found 452 new qualified records.
  48 +
  49 +### 4. Setup frontend
  50 +
  51 +You should create a new subdomain to have access to the AWStats, usually something like tools.<domain> (eg.: tools.softwarelivre.org). Don't include this subdomain in HostAliases in the AWStats neither in SiteAlias in the Apache.
  52 +
  53 + # cp /usr/share/doc/awstats/examples/apache.conf /etc/apache2/conf.d/awstats.conf
  54 + # invoke-rc.d apache2 restart
  55 +
  56 +ps.: Don't forget to change the port `/etc/apache/sites-enabled/000-default` to `8080`.
  57 +
  58 +Try: `http://tools.<domain>/cgi-bin/awstats.pl?config=<domain>`
  59 +(eg.: `http://tools.softwarelivre.org/cgi-bin/awstats.pl?config=softwarelivre.org`).
  60 +
  61 +### 5. Schedule AWStats in crontab
  62 +
  63 +`/etc/cron.d/awstats`
  64 +
  65 + 0,10,20,30,40,50 * * * * www-data [ -x /usr/lib/cgi-bin/awstats.pl -a -f /etc/awstats/awstats.<domain>.conf -a -r /var/log/apache/access.log ] && /usr/lib/cgi-bin/awstats.pl -config=<domain> -update >/dev/null
  66 +
  67 +Done, check the AWStats frontend after one or two days to see if everything is working properly.
... ...
INSTALL.chat
... ... @@ -1,258 +0,0 @@
1   -== XMPP/Chat Client Setup
2   -
3   -To configure XMPP/BOSH in Noosfero you need:
4   -
5   -* REST Client - http://github.com/archiloque/rest-client
6   -* SystemTimer - http://ph7spot.com/musings/system-timer
7   -* Pidgin data files - http://www.pidgin.im/
8   -
9   -If you use Debian 6.0 (squeeze):
10   -
11   -# apt-get install librestclient-ruby pidgin-data ruby1.8-dev
12   -# gem install SystemTimer
13   -
14   -The samples of config file to configure a XMPP/BOSH server with
15   -ejabberd, postgresql and apache2 can be found at util/chat directory.
16   -
17   -== XMPP/Chat Server Setup
18   -
19   -This is a step-by-step guide to get a XMPP service working, in a Debian system.
20   -
21   -1. Install the required packages
22   -
23   -# apt-get install ejabberd odbc-postgresql
24   -
25   -2. Ejabberd configuration
26   -
27   -All the following changes must be done in config file:
28   -
29   - /etc/ejabberd/ejabberd.cfg
30   -
31   - 2.1. Set the default admin user
32   -
33   -{ acl, admin, { user, "john", "www.example.com" } }.
34   -{ acl, admin, { user, "bart", "www.example.com" } }.
35   -
36   - 2.2. Set the default host
37   -
38   -{ hosts, [ "www.example.com" ] }.
39   -
40   - 2.3. Http-Bind activation
41   -
42   -{ 5280, ejabberd_http, [
43   - http_bind,
44   - web_admin
45   - ]
46   -}
47   -
48   -(...)
49   -
50   -{ modules, [
51   - {mod_http_bind, []},
52   - ...
53   -] }.
54   -
55   -Ejabberd creates semi-anonymous rooms by default, but Noosfero's Jabber client
56   -needs non-anonymous room, then we need to change default params of creation
57   -rooms in ejabberd to create non-anonymous rooms.
58   -
59   -In non-anonymous rooms the jabber service sends the new occupant's full JID to
60   -all occupants in the room[1].
61   -
62   -Add option "{default_room_options, [{anonymous, false}]}" to
63   -/etc/ejabberd/ejabberd.cfg in mod_muc session. See below:
64   -
65   -{ mod_muc, [
66   - %%{host, "conference.@HOST@"},
67   - {access, muc},
68   - {access_create, muc},
69   - {access_persistent, muc},
70   - {access_admin, muc_admin},
71   - {max_users, 500},
72   - {default_room_options, [{anonymous, false}]}
73   -]},
74   -
75   -[1] - http://xmpp.org/extensions/xep-0045.html#enter-nonanon
76   -
77   -
78   - 2.4. Authentication method
79   -
80   -To use Postgresql through ODBC, the following modifications must be done:
81   -
82   - * Disable the default method:
83   -
84   -{auth_method, internal}.
85   -
86   - * Enable autheticantion through ODBC:
87   -
88   -{auth_method, odbc}.
89   -
90   - * Set database server name
91   -
92   -{odbc_server, "DSN=PostgreSQLEjabberdNoosfero"}.
93   -
94   -
95   - 2.5. Increase the shaper traffic limit
96   -
97   -{ shaper, normal, { maxrate, 10000000 } }.
98   -
99   -
100   - 2.6. Disable unused modules
101   -
102   -Unused modules can be disabled, for example:
103   -
104   - * s2s
105   - * web_admin
106   - * mod_pubsub
107   - * mod_irc
108   - * mod_offline
109   - * mod_admin_extra
110   - * mod_register
111   -
112   -
113   - 2.7. Enable ODBC modules
114   -
115   - * mod_privacy -> mod_privacy_odbc
116   - * mod_private -> mod_private_odbc
117   - * mod_roster -> mod_roster_odbc
118   -
119   -3. Configuring Postgresql
120   -
121   -Login as noosfero user, and execute:
122   -
123   - $ psql noosfero < /path/to/noosfero/util/chat/postgresql/ejabberd.sql
124   -
125   -Where 'noosfero' may need to be replace by the name of the database used for
126   -Noosfero.
127   -
128   -This will create a new schema inside the noosfero database, called 'ejabberd'.
129   -
130   -Note 'noosfero' user should have permission to create Postgresql schemas. Also,
131   -there should be at least one domain with 'is_default = true' in 'domains'
132   -table, otherwise people won't be able to see their friends online.
133   -
134   -
135   -4. ODBC configuration
136   -
137   -The following files must be created:
138   -
139   - * /etc/odbc.ini
140   -
141   -[PostgreSQLEjabberdNoosfero]
142   -Description = PostgreSQL Noosfero ejabberd database
143   -Driver = PostgreSQL Unicode
144   -Trace = No
145   -TraceFile = /tmp/psqlodbc.log
146   -Database = noosfero
147   -Servername = localhost
148   -UserName = <DBUSER>
149   -Password = <DBPASS>
150   -Port =
151   -ReadOnly = No
152   -RowVersioning = No
153   -ShowSystemTables = No
154   -ShowOidColumn = No
155   -FakeOidIndex = No
156   -ConnSettings = SET search_path TO ejabberd
157   -
158   - * /etc/odbcinst.ini
159   -
160   -[PostgreSQL Unicode]
161   -Description = PostgreSQL ODBC driver (Unicode version)
162   -Driver = /usr/lib/odbc/psqlodbcw.so
163   -Setup = /usr/lib/odbc/libodbcpsqlS.so
164   -Debug = 0
165   -CommLog = 1
166   -UsageCount = 3
167   -
168   - 4.1 testing all:
169   -
170   -# isql 'PostgreSQLEjabberdNoosfero'
171   -
172   -If the configuration was done right, the message "Connected!"
173   -will be displayed.
174   -
175   -
176   -5. Enabling kernel polling and SMP in /etc/default/ejabberd
177   -
178   -POLL=true
179   -SMP=auto
180   -
181   -
182   -6. Increase the file descriptors limit for user ejabberd
183   -
184   - 6.1. Uncomment this line in file /etc/pam.d/su:
185   -
186   -session required pam_limits.so
187   -
188   -
189   - 6.2. Add this lines to file /etc/security/limits.conf:
190   -
191   -ejabberd hard nofile 65536
192   -ejabberd soft nofile 65536
193   -
194   -Now, test the configuration:
195   -
196   -# cat /proc/<EJABBERD_BEAM_PROCESS_PID>/limits
197   -
198   -
199   -7. Apache Configuration
200   -
201   -Apache server must be configurated as follow:
202   -
203   - * /etc/apache2/sites-enabled/noosfero
204   -
205   -RewriteEngine On
206   -Include /usr/share/noosfero/util/chat/apache/xmpp.conf
207   -
208   - * /etc/apache2/apache2.conf:
209   -
210   -<IfModule mpm_worker_module>
211   - StartServers 8
212   - MinSpareThreads 25
213   - MaxSpareThreads 75
214   - ThreadLimit 128
215   - ThreadsPerChild 128
216   - MaxClients 2048
217   - MaxRequestsPerChild 0
218   -</IfModule>
219   -
220   -Note: module proxy_http must be enabled:
221   -
222   -# a2enmod proxy_http
223   -
224   -8. DNS configuration
225   -
226   -For this point, we assume you are using BIND as your DNS server. You need to
227   -add the following entries to the DNS zone file corresponding to the domain
228   -of your noosfero site:
229   -
230   -_xmpp-client._tcp SRV 5 100 5222 master
231   -conference CNAME master
232   -_xmpp-client._tcp.conference SRV 5 100 5222 master
233   -
234   -If you are running a DNS server other than BIND, you will have to figure out
235   -how to create equivalente rules for your zone file. Patches to this
236   -documentation are welcome.
237   -
238   -9. Testing this Setup
239   -
240   -Adjust shell limits to proceed with some benchmarks and load tests:
241   -
242   -# ulimit −s 256
243   -# ulimit −n 8192
244   -# echo 10 > /proc/sys/net/ipv4/tcp_syn_retries
245   -
246   -To measure the bandwidth between server and client:
247   -
248   - * at server side:
249   -
250   -# iperf −s
251   -
252   - * at client side:
253   -
254   -# iperf −c server_ip
255   -
256   -For heavy load tests, clone and use this software:
257   -
258   -git clone http://git.holoscopio.com/git/metal/tester.git
INSTALL.chat.md 0 → 100644
... ... @@ -0,0 +1,236 @@
  1 +XMPP/Chat Client Setup
  2 +======================
  3 +
  4 +To configure XMPP/BOSH in Noosfero you need:
  5 +
  6 +* REST Client - http://github.com/archiloque/rest-client
  7 +* SystemTimer - http://ph7spot.com/musings/system-timer
  8 +* Pidgin data files - http://www.pidgin.im/
  9 +
  10 +If you use Debian 6.0 (squeeze):
  11 +
  12 + # apt-get install librestclient-ruby pidgin-data ruby1.8-dev
  13 + # gem install SystemTimer
  14 +
  15 +The samples of config file to configure a XMPP/BOSH server with ejabberd, postgresql and apache2 can be found at util/chat directory.
  16 +
  17 +XMPP/Chat Server Setup
  18 +======================
  19 +
  20 +This is a step-by-step guide to get a XMPP service working, in a Debian system.
  21 +
  22 +## 1. Install the required packages
  23 +
  24 + # apt-get install ejabberd odbc-postgresql
  25 +
  26 +## 2. Ejabberd configuration
  27 +
  28 +All the following changes must be done in config file: `/etc/ejabberd/ejabberd.cfg`
  29 +
  30 +### 2.1. Set the default admin user
  31 +
  32 + { acl, admin, { user, "john", "www.example.com" } }.
  33 + { acl, admin, { user, "bart", "www.example.com" } }.
  34 +
  35 +### 2.2. Set the default host
  36 +
  37 + { hosts, [ "www.example.com" ] }.
  38 +
  39 +### 2.3. Http-Bind activation
  40 +
  41 + { 5280, ejabberd_http, [
  42 + http_bind,
  43 + web_admin
  44 + ]
  45 + }
  46 +
  47 + (...)
  48 +
  49 + { modules, [
  50 + {mod_http_bind, []},
  51 + ...
  52 + ] }.
  53 +
  54 +Ejabberd creates semi-anonymous rooms by default, but Noosfero's Jabber client needs non-anonymous room, then we need to change default params of creation rooms in ejabberd to create non-anonymous rooms.
  55 +
  56 +In non-anonymous rooms the jabber service sends the new occupant's full JID to all occupants in the room [[1]].
  57 +
  58 +Add option "`{default_room_options, [{anonymous, false}]}`" to `/etc/ejabberd/ejabberd.cfg` in mod_muc session. See below:
  59 +
  60 + { mod_muc, [
  61 + %%{host, "conference.@HOST@"},
  62 + {access, muc},
  63 + {access_create, muc},
  64 + {access_persistent, muc},
  65 + {access_admin, muc_admin},
  66 + {max_users, 500},
  67 + {default_room_options, [{anonymous, false}]}
  68 + ]},
  69 +
  70 +[1]: http://xmpp.org/extensions/xep-0045.html#enter-nonanon
  71 +
  72 +
  73 +### 2.4. Authentication method
  74 +
  75 +To use Postgresql through ODBC, the following modifications must be done:
  76 +
  77 + * Disable the default method:
  78 + `{auth_method, internal}.`
  79 +
  80 + * Enable autheticantion through ODBC:
  81 + `{auth_method, odbc}.`
  82 +
  83 + * Set database server name
  84 + `{odbc_server, "DSN=PostgreSQLEjabberdNoosfero"}.`
  85 +
  86 +
  87 +### 2.5. Increase the shaper traffic limit
  88 +
  89 + { shaper, normal, { maxrate, 10000000 } }.
  90 +
  91 +
  92 +### 2.6. Disable unused modules
  93 +
  94 +Unused modules can be disabled, for example:
  95 +
  96 + * s2s
  97 + * web_admin
  98 + * mod_pubsub
  99 + * mod_irc
  100 + * mod_offline
  101 + * mod_admin_extra
  102 + * mod_register
  103 +
  104 +
  105 +### 2.7. Enable ODBC modules
  106 +
  107 + * mod_privacy -> mod_privacy_odbc
  108 + * mod_private -> mod_private_odbc
  109 + * mod_roster -> mod_roster_odbc
  110 +
  111 +## 3. Configuring Postgresql
  112 +
  113 +Login as noosfero user, and execute:
  114 +
  115 + $ psql noosfero < /path/to/noosfero/util/chat/postgresql/ejabberd.sql
  116 +
  117 +Where `noosfero` may need to be replace by the name of the database used for Noosfero.
  118 +
  119 +This will create a new schema inside the noosfero database, called `ejabberd`.
  120 +
  121 +Note `noosfero` user should have permission to create Postgresql schemas. Also, there should be at least one domain with `is_default = true` in `domains` table, otherwise people won't be able to see their friends online.
  122 +
  123 +## 4. ODBC configuration
  124 +
  125 +The following files must be created:
  126 +
  127 +`/etc/odbc.ini`:
  128 +
  129 + [PostgreSQLEjabberdNoosfero]
  130 + Description = PostgreSQL Noosfero ejabberd database
  131 + Driver = PostgreSQL Unicode
  132 + Trace = No
  133 + TraceFile = /tmp/psqlodbc.log
  134 + Database = noosfero
  135 + Servername = localhost
  136 + UserName = <DBUSER>
  137 + Password = <DBPASS>
  138 + Port =
  139 + ReadOnly = No
  140 + RowVersioning = No
  141 + ShowSystemTables = No
  142 + ShowOidColumn = No
  143 + FakeOidIndex = No
  144 + ConnSettings = SET search_path TO ejabberd
  145 +
  146 +`/etc/odbcinst.ini`:
  147 +
  148 + [PostgreSQL Unicode]
  149 + Description = PostgreSQL ODBC driver (Unicode version)
  150 + Driver = /usr/lib/odbc/psqlodbcw.so
  151 + Setup = /usr/lib/odbc/libodbcpsqlS.so
  152 + Debug = 0
  153 + CommLog = 1
  154 + UsageCount = 3
  155 +
  156 +## 4.1 testing all:
  157 +
  158 + # isql 'PostgreSQLEjabberdNoosfero'
  159 +
  160 +If the configuration was done right, the message "Connected!" will be displayed.
  161 +
  162 +
  163 +## 5. Enabling kernel polling and SMP in `/etc/default/ejabberd`
  164 +
  165 + POLL=true
  166 + SMP=auto
  167 +
  168 +## 6. Increase the file descriptors limit for user ejabberd
  169 +
  170 +### 6.1. Uncomment this line in file `/etc/pam.d/su`:
  171 +
  172 + session required pam_limits.so
  173 +
  174 +### 6.2. Add this lines to file `/etc/security/limits.conf`:
  175 +
  176 + ejabberd hard nofile 65536
  177 + ejabberd soft nofile 65536
  178 +
  179 +Now, test the configuration:
  180 +
  181 + # cat /proc/<EJABBERD_BEAM_PROCESS_PID>/limits
  182 +
  183 +## 7. Apache Configuration
  184 +
  185 +Apache server must be configurated as follow:
  186 +
  187 +`/etc/apache2/sites-enabled/noosfero`:
  188 +
  189 + RewriteEngine On
  190 + Include /usr/share/noosfero/util/chat/apache/xmpp.conf
  191 +
  192 +`/etc/apache2/apache2.conf`:
  193 +
  194 + <IfModule mpm_worker_module>
  195 + StartServers 8
  196 + MinSpareThreads 25
  197 + MaxSpareThreads 75
  198 + ThreadLimit 128
  199 + ThreadsPerChild 128
  200 + MaxClients 2048
  201 + MaxRequestsPerChild 0
  202 + </IfModule>
  203 +
  204 +Note: module proxy_http must be enabled:
  205 +
  206 + # a2enmod proxy_http
  207 +
  208 +## 8. DNS configuration
  209 +
  210 +For this point, we assume you are using BIND as your DNS server. You need to add the following entries to the DNS zone file corresponding to the domain of your noosfero site:
  211 +
  212 + _xmpp-client._tcp SRV 5 100 5222 master
  213 + conference CNAME master
  214 + _xmpp-client._tcp.conference SRV 5 100 5222 master
  215 +
  216 +If you are running a DNS server other than BIND, you will have to figure out how to create equivalente rules for your zone file. Patches to this documentation are welcome.
  217 +
  218 +## 9. Testing this Setup
  219 +
  220 +Adjust shell limits to proceed with some benchmarks and load tests:
  221 +
  222 + # ulimit −s 256
  223 + # ulimit −n 8192
  224 + # echo 10 > /proc/sys/net/ipv4/tcp_syn_retries
  225 +
  226 +To measure the bandwidth between server and client:
  227 +
  228 + * at server side:
  229 + `# iperf −s`
  230 +
  231 + * at client side:
  232 + `# iperf −c server_ip`
  233 +
  234 +For heavy load tests, clone and use this software:
  235 +
  236 + $ git clone http://git.holoscopio.com/git/metal/tester.git
... ...
INSTALL.email
... ... @@ -1,43 +0,0 @@
1   -= Noosfero email setup
2   -
3   -If you know mail systems well, you just need to make sure that the local MTA,
4   -listening on localhost:25, is able to deliver e-mails to the internet. Any mail
5   -server will do it. You can stop reading now.
6   -
7   -If you are not an email specialist, then follow the instructions below. We
8   -suggest that you use the Postfix mail server, since it is easy to configure and
9   -very reliable. Just follow the instructions below.
10   -
11   -To install Postfix:
12   -
13   -# apt-get install postfix
14   -
15   -During the installation process, you will be asked a few questions. Your answer
16   -to them will vary in 2 cases:
17   -
18   -Case 1: you can send e-mails directly to the internet. This will be the case
19   -for most commercial private servers. Your answers should be:
20   -
21   - General type of mail configuration: Internet site
22   - System mail name: the name of your domain, e.g. "mysocialnetwork.com"
23   -
24   -Case 2: you cannot, or don't want to, send e-mail directly to the internet.
25   -This happens for example if your server is not allowed to make outbound
26   -connections on port 25, or if you want to concentrate all your outbound mail
27   -through a single SMTP server. Your answers in this case should be:
28   -
29   - General type of mail configuration: Internet with smarthost
30   - System mail name: the name of your domain, e.g. "mysocialnetwork.com"
31   - SMTP relay host: smtp.yourprovider.com
32   -
33   -Note that smtp.yourprovider.com must allow your server to deliver e-mails
34   -through it. You should probably ask your servive provider about this.
35   -
36   -There is another possibility: if you are installing on a shared server, and
37   -don't have permission to configure the local MTA, you can instruct Noosfero to
38   -send e-mails directly through an external server. Please note that this should
39   -be your last option, since contacting an external SMTP server directly may slow
40   -down your Noosfero application server. To configure Noosfero to send e-mails
41   -through an external SMTP server, follow the instructions on
42   -http://noosfero.org/Development/SMTPMailSending
43   -
INSTALL.email.md 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +Noosfero email setup
  2 +====================
  3 +
  4 +If you know mail systems well, you just need to make sure that the local MTA, listening on localhost:25, is able to deliver e-mails to the internet. Any mail server will do it. You can stop reading now.
  5 +
  6 +If you are not an email specialist, then follow the instructions below. We suggest that you use the Postfix mail server, since it is easy to configure and very reliable. Just follow the instructions below.
  7 +
  8 +To install Postfix:
  9 +
  10 + # apt-get install postfix
  11 +
  12 +During the installation process, you will be asked a few questions. Your answer to them will vary in 2 cases:
  13 +
  14 +**Case 1**: you can send e-mails directly to the internet. This will be the case for most commercial private servers. Your answers should be:
  15 +
  16 + * General type of mail configuration: Internet site
  17 + * System mail name: the name of your domain, e.g. "mysocialnetwork.com"
  18 +
  19 +**Case 2**: you cannot, or don't want to, send e-mail directly to the internet. This happens for example if your server is not allowed to make outbound connections on port 25, or if you want to concentrate all your outbound mail through a single SMTP server. Your answers in this case should be:
  20 +
  21 + * General type of mail configuration: Internet with smarthost
  22 + * System mail name: the name of your domain, e.g. "mysocialnetwork.com"
  23 + * SMTP relay host: smtp.yourprovider.com
  24 +
  25 +Note that smtp.yourprovider.com must allow your server to deliver e-mails through it. You should probably ask your servive provider about this.
  26 +
  27 +There is another possibility: if you are installing on a shared server, and don't have permission to configure the local MTA, you can instruct Noosfero to send e-mails directly through an external server. Please note that this should be your last option, since contacting an external SMTP server directly may slow down your Noosfero application server. To configure Noosfero to send e-mails through an external SMTP server, follow the instructions on http://noosfero.org/Development/SMTPMailSending
  28 +
... ...
INSTALL.md 0 → 100644
... ... @@ -0,0 +1,334 @@
  1 +Noosfero installation instructions from source for production environments
  2 +==========================================================================
  3 +
  4 +The instructions below can be used for setting up a Noosfero production environment from the Noosfero sources.
  5 +
  6 +Before you start installing Noosfero manually, see the information about the Noosfero Debian package at http://noosfero.org/Development/DebianPackage. Using the Debian packages on a Debian stable system is the recommended method for installing production environments.
  7 +
  8 +If you want to setup a development environment instead of a production one, stop reading this file right now and read the file `HACKING.md` instead.
  9 +
  10 +For a complete installation guide, please see the following web page: http://noosfero.org/Development/HowToInstall
  11 +
  12 +If you have problems with the setup, please feel free to ask questions in the development mailing list.
  13 +
  14 +Requirements
  15 +------------
  16 +
  17 +**DISCLAIMER**: this installation procedure is tested with Debian stable, which is currently the only recommended operating system for production usage. It is possible that you can install it on other systems, and if you do so, please report it on one of the Noosfero mailing lists, and please send a patch updating these instructions.
  18 +
  19 +Noosfero is written in Ruby with the "[Rails framework](http://www.rubyonrails.org)", so the process of setting it up is pretty similar to other Rails applications.
  20 +
  21 +You need to install some packages Noosfero depends on. On Debian GNU/Linux or Debian-based systems, all of these packages are available through the Debian archive. You can install them with the following command:
  22 +
  23 + # apt-get install ruby rake po4a libgettext-ruby-util libgettext-ruby1.8 \
  24 + libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby libhpricot-ruby \
  25 + libwill-paginate-ruby iso-codes libfeedparser-ruby libdaemons-ruby thin \
  26 + tango-icon-theme
  27 +
  28 +On other systems, they may or may not be available through your regular package management system. Below are the links to their homepages.
  29 +
  30 +* Ruby: http://www.ruby-lang.org
  31 +* Rake: http://rake.rubyforge.org
  32 +* po4a: http://po4a.alioth.debian.org
  33 +* Ruby-sqlite3: http://rubyforge.org/projects/sqlite-ruby
  34 +* rcov: http://eigenclass.org/hiki/rcov
  35 +* RMagick: http://rmagick.rubyforge.org
  36 +* RedCloth: http://redcloth.org
  37 +* will_paginate: http://github.com/mislav/will_paginate/wikis
  38 +* iso-codes: http://pkg-isocodes.alioth.debian.org
  39 +* feedparser: http://packages.debian.org/sid/libfeedparser-ruby
  40 +* Daemons - http://daemons.rubyforge.org
  41 +* Thin: http://code.macournoyer.com/thin
  42 +* tango-icon-theme: http://tango.freedesktop.org/Tango_Icon_Library
  43 +* Hpricot: http://hpricot.com
  44 +
  45 +If you manage to install Noosfero successfully on other systems than Debian,
  46 +please feel free to contact the Noosfero development mailing with the
  47 +instructions for doing so, and we'll include it here.
  48 +
  49 +As root user
  50 +============
  51 +
  52 +Install memcached. On Debian:
  53 +
  54 + # apt-get install memcached
  55 +
  56 +Study whether you need to raise the ammount of memory it uses for caching, depending on the demand you expect for your site. If you are going to run a high-traffic site, you will want to raise the ammount of memory reserved for caching.
  57 +
  58 +It is recommended that you run noosfero with its own user account. To create such an account, please do the following:
  59 +
  60 + # adduser --system --group noosfero --shell /bin/sh --home /var/lib/noosfero
  61 +
  62 +(note that you can change the `$HOME` directory of the user if you wish, here we are using `/var/lib/noosfero`)
  63 +
  64 +The `--system` option will tell adduser to create a system user, i.e. this user will not have a password and cannot login to the system directly. To become this user, you have to use sudo:
  65 +
  66 + # sudo -u noosfero -i
  67 + or
  68 + # su - noosfero
  69 +
  70 +As noosfero user
  71 +================
  72 +
  73 +downloading from git
  74 +--------------------
  75 +
  76 +Here we are cloning the noosfero repository from git. Note: you will need to install git before.
  77 +
  78 + $ git clone git://gitorious.org/noosfero/noosfero.git current
  79 + $ cd current
  80 + $ git checkout -b stable origin/stable
  81 +
  82 +downloading tarball
  83 +-------------------
  84 +
  85 +Note: replace 0.39.0 below from the latest stable version.
  86 +
  87 + $ wget http://noosfero.org/pub/Development/NoosferoVersion00x39x00/noosfero-0.39.0.tar.gz
  88 + $ tar -zxvf noosfero-0.39.0.tar.gz
  89 + $ ln -s noosfero-0.39.0 current
  90 + $ cd current
  91 +
  92 +Create the thin configuration file:
  93 +
  94 + $ thin -C config/thin.yml -e production config
  95 +
  96 +Edit config/thin.yml to suit your needs. Make sure your apache configuration matches the thin cluster configuration, specially in respect to the ports and numbers of thin instances.
  97 +
  98 +*Note*: currently Noosfero only supports Rails 2.3.5, which is the version in Debian Squeeze. If you have a Rails version newer than that, Noosfero will probably not work. You can install Rails 2.3.5 into your Noosfero installation with the following procedure:
  99 +
  100 + $ cd /var/lib/noosfero/current/vendor
  101 + $ wget http://ftp.de.debian.org/debian/pool/main/r/rails/rails_2.3.5.orig.tar.gz
  102 + $ tar xzf rails_2.3.5.orig.tar.gz
  103 + $ ln -s rails-2.3.5 rails
  104 +
  105 +As root user
  106 +============
  107 +
  108 +Setup Noosfero log and tmp directories:
  109 +
  110 + # cd /var/lib/noosfero/current
  111 + # ./etc/init.d/noosfero setup
  112 +
  113 +Now it's time to setup the database. In this example we are using PostgreSQL, so if you are planning to use a different database this steps won't apply.
  114 +
  115 + # apt-get install postgresql libpgsql-ruby
  116 + # su postgres -c 'createuser noosfero -S -d -R'
  117 +
  118 +By default Rails will try to connect on postgresql through 5432 port, you can check it on `/etc/postgresql/8.4/main/postgresql.conf` file.
  119 +
  120 +Restart postgresql:
  121 + # invoke-rc.d postgresql restart
  122 +
  123 +Noosfero needs a functional e-mail setup to work: the local mail system should be able to deliver e-mail to the internet, either directly or through an external SMTP server. Please check the documentation at the INSTALL.email file.
  124 +
  125 +As noosfero user
  126 +================
  127 +
  128 +Now create the databases:
  129 +
  130 + $ cd /var/lib/noosfero/current
  131 + $ createdb noosfero_production
  132 + $ createdb noosfero_development
  133 + $ createdb noosfero_test
  134 +
  135 +The development and test databases are actually optional. If you are creating a stricly production server, you will probably not need them.
  136 +
  137 +Now we want to configure Noosfero for accessing the database we just created. To do that, you can 1) copy `config/database.yml.pgsql` to `config/database.yml`, or create `config/database.yml` from scratch with the following content:
  138 +
  139 + production:
  140 + adapter: postgresql
  141 + encoding: unicode
  142 + database: noosfero_production
  143 + username: noosfero
  144 +
  145 +Now, to test the database access, you can fire the Rails database console:
  146 +
  147 + $ ./script/dbconsole production
  148 +
  149 +If it connects to your database, then everything is fine. If you got an error message, then you have to check your database configuration.
  150 +
  151 +Create the database structure:
  152 +
  153 + $ RAILS_ENV=production rake db:schema:load
  154 +
  155 +Compile the translations:
  156 +
  157 + $ RAILS_ENV=production rake noosfero:translations:compile
  158 +
  159 +Now we must create some initial data. To create your default environment (the first one), run the command below:
  160 +
  161 + $ RAILS_ENV=production ./script/runner 'Environment.create!(:name => "My environment", :is_default => true)'
  162 +
  163 +(of course, replace "My environment" with your environment's name!)
  164 +
  165 +And now you have to add the domain name you will be using for your noosfero site to the list of domains of that default environment you just created:
  166 +
  167 + $ RAILS_ENV=production ./script/runner "Environment.default.domains << Domain.new(:name => 'your.domain.com')"
  168 +
  169 +(replace "your.domain.com" with your actual domain name)
  170 +
  171 +Add at least one user as admin of environment:
  172 +
  173 + $ RAILS_ENV=production ./script/runner "User.create(:login => 'adminuser', :email => 'admin@example.com', :password => 'admin', :password_confirmation => 'admin', :environment => Environment.default, :activated_at => Time.new)"
  174 +
  175 +(replace "adminuser", "admin@example.com", "admin" with the login, email and password of your environment administrator)
  176 +
  177 +To start the Noosfero application servers:
  178 +
  179 + $ ./script/production start
  180 +
  181 +At this point you have a functional Noosfero installation running, the only thing left is to configure your webserver as a reverse proxy to pass requests to them.
  182 +
  183 +
  184 +Apache instalation
  185 +==================
  186 +
  187 + # apt-get install apache2
  188 +
  189 +Apache configuration
  190 +--------------------
  191 +
  192 +First you have to enable the following some apache modules:
  193 +
  194 + * deflate
  195 + * expires
  196 + * proxy
  197 + * proxy_balancer
  198 + * proxy_http
  199 + * rewrite
  200 +
  201 +On Debian GNU/Linux system, these modules can be enabled with the following command line, as root:
  202 +
  203 + # a2enmod deflate expires proxy proxy_balancer proxy_http rewrite
  204 +
  205 +In other systems the way by which you enable apache modules may be different.
  206 +
  207 +Now with the Apache configuration. You can use the template below, replacing `/var/lib/noosfero/current` with the directory in which your noosfero installation is, your.domain.com with the domain name of your noosfero site. We are assuming that you are running two thin instances on ports 3000 and 3001. If your setup is different you'll need to adjust `<Proxy>` section. If you don't understand something in the configuration, please refer to the apache documentation.
  208 +
  209 +Add a file called "mysite" (or whatever name you want to give to your noosfero site) to `/etc/apache2/sites-available` with the following content, and customize as needed (as usual, make sure you replace "your.domain.com" with you actual domain name, and "`/var/lib/noosfero/current`" with the directory where Noosfero is installed):
  210 +
  211 + <VirtualHost *:80>
  212 + ServerName your.domain.com
  213 +
  214 + DocumentRoot "/var/lib/noosfero/current/public"
  215 + <Directory "/var/lib/noosfero/current/public">
  216 + Options FollowSymLinks
  217 + AllowOverride None
  218 + Order Allow,Deny
  219 + Allow from all
  220 + </Directory>
  221 +
  222 + RewriteEngine On
  223 +
  224 + # Rewrite index to check for static index.html
  225 + RewriteRule ^/$ /index.html [QSA]
  226 +
  227 + # Rewrite to check for Rails cached page
  228 + RewriteRule ^([^.]+)$ $1.html [QSA]
  229 +
  230 + RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  231 + RewriteRule ^.*$ balancer://noosfero%{REQUEST_URI} [P,QSA,L]
  232 +
  233 + ErrorDocument 503 /503.html
  234 +
  235 + ErrorLog /var/log/apache2/noosfero.log
  236 + LogLevel warn
  237 + CustomLog /var/log/apache2/noosfero.access.log combined
  238 +
  239 + Include /var/lib/noosfero/current/etc/noosfero/apache/cache.conf
  240 +
  241 + </VirtualHost>
  242 +
  243 + <Proxy balancer://noosfero>
  244 + BalancerMember http://127.0.0.1:3000
  245 + BalancerMember http://127.0.0.1:3001
  246 + Order Allow,Deny
  247 + Allow from All
  248 + </Proxy>
  249 +
  250 +The cache.conf file included in the end of the <VirtualHost> section is important, since it will tell apache to pass expiration and cache headers to clients so that the site feels faster for users. Do we need to say that using that configuration is strongly recommended?
  251 +
  252 +Enable that site with (as root, replace "mysite" with the actual name you gave to your site configuration):
  253 +
  254 + # a2ensite mysite
  255 +
  256 +Now restart your apache server (as root):
  257 +
  258 + # invoke-rc.d apache2 restart
  259 +
  260 +
  261 +Enabling exception notifications
  262 +================================
  263 +
  264 +This is an optional step. You will need it only if you want to receive e-mail notifications when some exception occurs on Noosfero.
  265 +
  266 +First, install this version of the gem. Others versions may not be compatible with Noosfero:
  267 +
  268 + # gem install exception_notification -v 1.0.20090728
  269 +
  270 +You can configure the e-mails that will receive the notifications. Change the file config/noosfero.yml as the following example, replacing the e-mails by real ones:
  271 +
  272 + production:
  273 + exception_recipients: [admin@example.com, you@example.com]
  274 +
  275 +
  276 +Maintainance
  277 +============
  278 +
  279 +To ease the maintainance, install a symbolic link for the Noosfero startup script in your server and add it to the system initialization and shutdown sequences (as root):
  280 +
  281 + # ln -s /var/lib/noosfero/current/etc/init.d/noosfero /etc/init.d/noosfero
  282 + # update-rc.d noosfero defaults
  283 + Adding system startup for /etc/init.d/noosfero ...
  284 + /etc/rc0.d/K20noosfero -> ../init.d/noosfero
  285 + /etc/rc1.d/K20noosfero -> ../init.d/noosfero
  286 + /etc/rc6.d/K20noosfero -> ../init.d/noosfero
  287 + /etc/rc2.d/S20noosfero -> ../init.d/noosfero
  288 + /etc/rc3.d/S20noosfero -> ../init.d/noosfero
  289 + /etc/rc4.d/S20noosfero -> ../init.d/noosfero
  290 + /etc/rc5.d/S20noosfero -> ../init.d/noosfero
  291 +
  292 +Now to start Noosfero, you do as root:
  293 +
  294 + # invoke-rc.d noosfero start
  295 +
  296 +To stop Noosfero:
  297 +
  298 + # invoke-rc.d noosfero start
  299 +
  300 +To restart Noosfero:
  301 +
  302 + # invoke-rc.d noosfero restart
  303 +
  304 +Noosfero will be automatically started during system boot, and automatically stopped if the system shuts down for some reason (or during the shutdown part of a reboot).
  305 +
  306 +Rotating logs
  307 +=============
  308 +
  309 +Noosfero provides an example logrotate configuation to rotate its logs. To use it, create a symbolic link in `/etc/logrotate.d/`:
  310 +
  311 + # cd /etc/logrotate.d/
  312 + # ln -s /var/lib/noosfero/current/etc/logrotate.d/noosfero
  313 +
  314 +Note that the provided file assumes Noosfero logging is being done in `/var/log/noosfero` (which is the case if you followed the instructions above correctly). If the logs are stored elsewhere, it's recommended that you copy the file over to `/etc/logrotate.d/` and modify it to point to your local log directly.
  315 +
  316 +Upgrading
  317 +=========
  318 +
  319 +If you followed the steps in this document and installed Noosfero from the git repository, then upgrading is easy. First, you need to allow the noosfero user to restart the memcached server with sudo, by adding the following line in `/etc/sudoers`:
  320 +
  321 + noosfero ALL=NOPASSWD: /etc/init.d/memcached
  322 +
  323 +Then, to perform an upgrade, do the following as the noosfero user:
  324 +
  325 + $ cd /var/lib/noosfero/current
  326 + $ ./script/git-upgrade
  327 +
  328 +The `git-upgrade` script will take care of everything for you. It will first stop the service, then fetch the current source code, upgrade database, compile translations, and then start the service again.
  329 +
  330 +*Note 1*: make sure your local git repository is following the "stable" branch, just like the instructions above. The `master` branch is **not** recommended for use in production environments.
  331 +
  332 +*Note 2*: always read the release notes before upgrading. Sometimes there will be steps that must be performed manually. If that is the case, you can invoke the `git-upgrade` script with the special parameter `--shell` that will give you a shell after the upgrade, which you can use to perform any manual steps required:
  333 +
  334 + $ ./script/git-upgrade --shell
... ...
INSTALL.multitenancy
... ... @@ -1,163 +0,0 @@
1   -== Multitenancy support
2   -
3   -Multitenancy refers to a principle in software architecture where a
4   -single instance of the software runs on a server, serving multiple
5   -client organizations (tenants). Multitenancy is contrasted with a
6   -multi-instance architecture where separate software instances (or
7   -hardware systems) are set up for different client organizations. With
8   -a multitenant architecture, a software application is designed to
9   -virtually partition its data and configuration, and each client
10   -organization works with a customized virtual application instance.
11   -
12   -Today this feature is available only for PostgreSQL databases.
13   -
14   -This document assumes that you have a new fully PostgresSQL default Noosfero
15   -installation as explained at the INSTALL file.
16   -
17   -== Separated data
18   -
19   -The items below are separated for each hosted environment:
20   -
21   -* Uploaded files
22   -* Database
23   -* Solr index
24   -* ActiveRecord#cache_key
25   -* Feed updater
26   -* Delayed Job Workers
27   -
28   -== Database configuration file
29   -
30   -The file config/database.yml must follow a structure in order to
31   -achieve multitenancy support. In this example, we will set 3
32   -different environments: env1, env2 and env3.
33   -
34   -Each "hosted" environment must have an entry like this:
35   -
36   -env1_production:
37   - adapter: postgresql
38   - encoding: unicode
39   - database: noosfero
40   - schema_search_path: public
41   - username: noosfero
42   - domains:
43   - - env1.com
44   - - env1.org
45   -
46   -env2_production:
47   - adapter: postgresql
48   - encoding: unicode
49   - database: noosfero
50   - schema_search_path: env2
51   - username: noosfero
52   - domains:
53   - - env2.com
54   - - env2.org
55   -
56   -env3_production:
57   - adapter: postgresql
58   - encoding: unicode
59   - database: noosfero
60   - schema_search_path: env3
61   - username: noosfero
62   - domains:
63   - - env3.com
64   - - env3.net
65   -
66   -The "hosted" environments define, besides the schema_search_path, a
67   -list of domains that, when accessed, tells which database the
68   -application should use. Also, the environment name must end with
69   -'_hosting', where 'hosting' is the name of the hosting environment.
70   -
71   -You must also tell the application which is the default environment.
72   -
73   -production:
74   - env1_production
75   -
76   -On the example above there are only three hosted environments, but it
77   -can be more than three. The schemas 'env2' and 'env3' must already
78   -exist in the same database of the hosting environment. As postgres
79   -user, you can create them typing:
80   -
81   -$ psql database_name -c "CREATE SCHEMA env2 AUTHORIZATION database_user"
82   -$ psql database_name -c "CREATE SCHEMA env3 AUTHORIZATION database_user"
83   -
84   -Replace database_name and database_user above with your stuff.
85   -
86   -So, yet on this same example, when a user accesses http://env2.com or
87   -http://env2.org, the Noosfero application running on production will
88   -turn the database schema to 'env2'. When the access is from domains
89   -http://env3.com or http://env3.net, the schema to be loaded will be
90   -'env3'.
91   -
92   -There is an example of this file in config/database.yml.multitenancy
93   -
94   -== Preparing the database
95   -
96   -Now create the environments:
97   -
98   -$ RAILS_ENV=production rake multitenancy:create
99   -
100   -This command above will create the hosted environment files equal to
101   -their hosting environment, here called 'production'.
102   -
103   -Run db:schema:load for each other environment:
104   -
105   -$ RAILS_ENV=env2_production rake db:schema:load
106   -$ RAILS_ENV=env3_production rake db:schema:load
107   -
108   -Then run the migrations for the hosting environment, and it will
109   -run for each of its hosted environments:
110   -
111   -RAILS_ENV=production rake db:migrate
112   -
113   -== Start Noosfero
114   -
115   -Run Noosfero init file as root:
116   -
117   -# invoke-rc.d noosfero start
118   -
119   -== Solr
120   -
121   -It's necessary to run only one instance of Solr. Don't worry
122   -about this, Noosfero initializer had already done this for you.
123   -
124   -== Feed updater & Delayed job
125   -
126   -Just for your information, a daemon of feed-updater and delayed_job
127   -must be running for each environment. Noosfero initializer do this,
128   -relax.
129   -
130   -== Uploaded files
131   -
132   -When running with PostgreSQL, Noosfero uploads stuff to a folder named
133   -the same way as the running schema. Inside the upload folder root, for
134   -example, will be public/image_uploads/env2 and public/image_uploads/env3.
135   -
136   -== Adding multitenancy support to an existing Noosfero environment
137   -
138   -If you already have a Noosfero environment, you can turn it multitenant
139   -by following the steps below in addition to the previous steps:
140   -
141   -1. Reindex your database
142   -
143   -Rebuild the Solr index by running the following task just
144   -for your hosting environment, do this as noosfero user:
145   -
146   -$ RAILS_ENV=production rake multitenancy:reindex
147   -
148   -2. Move the uploaded files to the right place
149   -
150   -Add a directory with the same name as your schema name (by default this
151   -name is 'public') in the root of each upload directory, for example,
152   -public/articles/0000 will be moved to public/articles/public/0000. Do this
153   -with the directories public/image_uploads, public/articles and public/thumbnails.
154   -
155   -3. Fix paths on activities
156   -
157   -The profile activities store static paths to the images, so it's necessary to fix
158   -these paths. You can do this easily by setting an alias on your webserver.
159   -On Apache you can add the three rules below, where 'public' is the schema name:
160   -
161   - RewriteRule ^/articles(.+) /articles/public$1
162   - RewriteRule ^/image_uploads(.+) /image_uploads/public$1
163   - RewriteRule ^/thumbnails(.+) /thumbnails/public$1
INSTALL.multitenancy.md 0 → 100644
... ... @@ -0,0 +1,133 @@
  1 +Multitenancy support
  2 +====================
  3 +
  4 +Multitenancy refers to a principle in software architecture where a single instance of the software runs on a server, serving multiple client organizations (tenants). Multitenancy is contrasted with a multi-instance architecture where separate software instances (or hardware systems) are set up for different client organizations. With a multitenant architecture, a software application is designed to virtually partition its data and configuration, and each client organization works with a customized virtual application instance.
  5 +
  6 +Today this feature is available only for PostgreSQL databases.
  7 +
  8 +This document assumes that you have a new fully PostgresSQL default Noosfero installation as explained at the `INSTALL.md` file.
  9 +
  10 +Separated data
  11 +--------------
  12 +
  13 +The items below are separated for each hosted environment:
  14 +
  15 +* Uploaded files
  16 +* Database
  17 +* Solr index
  18 +* ActiveRecord#cache_key
  19 +* Feed updater
  20 +* Delayed Job Workers
  21 +
  22 +Database configuration file
  23 +---------------------------
  24 +
  25 +The file config/database.yml must follow a structure in order to achieve multitenancy support. In this example, we will set 3 different environments: env1, env2 and env3.
  26 +
  27 +Each "hosted" environment must have an entry like this:
  28 +
  29 + env1_production:
  30 + adapter: postgresql
  31 + encoding: unicode
  32 + database: noosfero
  33 + schema_search_path: public
  34 + username: noosfero
  35 + domains:
  36 + - env1.com
  37 + - env1.org
  38 +
  39 + env2_production:
  40 + adapter: postgresql
  41 + encoding: unicode
  42 + database: noosfero
  43 + schema_search_path: env2
  44 + username: noosfero
  45 + domains:
  46 + - env2.com
  47 + - env2.org
  48 +
  49 + env3_production:
  50 + adapter: postgresql
  51 + encoding: unicode
  52 + database: noosfero
  53 + schema_search_path: env3
  54 + username: noosfero
  55 + domains:
  56 + - env3.com
  57 + - env3.net
  58 +
  59 +The "hosted" environments define, besides the `schema_search_path`, a list of domains that, when accessed, tells which database the application should use. Also, the environment name must end with "`_<hosting>`", where `<hosting>` is the name of the hosting environment.
  60 +
  61 +You must also tell the application which is the default environment.
  62 +
  63 + production:
  64 + env1_production
  65 +
  66 +On the example above there are only three hosted environments, but it can be more than three. The schemas `env2` and `env3` must already exist in the same database of the hosting environment. As postgres user, you can create them typing:
  67 +
  68 + $ psql database_name -c "CREATE SCHEMA env2 AUTHORIZATION database_user"
  69 + $ psql database_name -c "CREATE SCHEMA env3 AUTHORIZATION database_user"
  70 +
  71 +Replace `database_name` and `database_user` above with your stuff.
  72 +
  73 +So, yet on this same example, when a user accesses http://env2.com or http://env2.org, the Noosfero application running on production will turn the database schema to `env2`. When the access is from domains http://env3.com or http://env3.net, the schema to be loaded will be `env3`.
  74 +
  75 +There is an example of this file in `config/database.yml.multitenancy`
  76 +
  77 +Preparing the database
  78 +----------------------
  79 +
  80 +Now create the environments:
  81 +
  82 + $ RAILS_ENV=production rake multitenancy:create
  83 +
  84 +This command above will create the hosted environment files equal to their hosting environment, here called 'production'.
  85 +
  86 +Run db:schema:load for each other environment:
  87 +
  88 + $ RAILS_ENV=env2_production rake db:schema:load
  89 + $ RAILS_ENV=env3_production rake db:schema:load
  90 +
  91 +Then run the migrations for the hosting environment, and it will run for each of its hosted environments:
  92 +
  93 + RAILS_ENV=production rake db:migrate
  94 +
  95 +Start Noosfero
  96 +--------------
  97 +
  98 +Run Noosfero init file as root:
  99 +
  100 + # invoke-rc.d noosfero start
  101 +
  102 +Feed updater & Delayed job
  103 +--------------------------
  104 +
  105 +Just for your information, a daemon of `feed-updater` and `delayed_job` must be running for each environment. Noosfero initializer do this, relax.
  106 +
  107 +Uploaded files
  108 +--------------
  109 +
  110 +When running with PostgreSQL, Noosfero uploads stuff to a folder named the same way as the running schema. Inside the upload folder root, for example, will be `public/image_uploads/env2` and `public/image_uploads/env3`.
  111 +
  112 +Adding multitenancy support to an existing Noosfero environment
  113 +---------------------------------------------------------------
  114 +
  115 +If you already have a Noosfero environment, you can turn it multitenant by following the steps below in addition to the previous steps:
  116 +
  117 +### 1. Reindex your database
  118 +
  119 +Rebuild the Solr index by running the following task just for your hosting environment, do this as noosfero user:
  120 +
  121 + $ RAILS_ENV=production rake multitenancy:reindex
  122 +
  123 +### 2. Move the uploaded files to the right place
  124 +
  125 +Add a directory with the same name as your schema name (by default this name is `public`) in the root of each upload directory, for example, `public/articles/0000` will be moved to `public/articles/public/0000`. Do this with the directories `public/image_uploads`, `public/articles` and `public/thumbnails`.
  126 +
  127 +### 3. Fix paths on activities
  128 +
  129 +The profile activities store static paths to the images, so it's necessary to fix these paths. You can do this easily by setting an alias on your webserver. On Apache you can add the three rules below, where 'public' is the schema name:
  130 +
  131 + RewriteRule ^/articles(.+) /articles/public$1
  132 + RewriteRule ^/image_uploads(.+) /image_uploads/public$1
  133 + RewriteRule ^/thumbnails(.+) /thumbnails/public$1
... ...
INSTALL.varnish
... ... @@ -1,71 +0,0 @@
1   -= Setting up Varnish for your Noosfero site
2   -
3   -Varnish is a HTTP caching server, and using it together with Noosfero is highly
4   -recommended. See http://www.varnish-cache.org/ for more information on Varnish.
5   -
6   -Varnish can be set up to use with Noosfero with the following steps:
7   -
8   -1) setup Noosfero with apache according to the INSTALL file. If you used the
9   -Debian package to install noosfero, you don't need to do anything about this.
10   -
11   -2) install Varnish
12   -
13   - # apt-get install varnish
14   -
15   -Install the RPAF apache module (or skip this step if not using apache):
16   -
17   - # apt-get install libapache2-mod-rpaf
18   -
19   -3) Change Apache to listen on port 8080 instead of 80
20   -
21   -3a) Edit /etc/apache2/ports.conf, and:
22   -
23   - * change 'NameVirtualHost *:80' to 'NameVirtualHost *:8080'
24   - * change 'Listen 80' to 'Listen 127.0.0.1:8080'
25   -
26   -3b) Edit /etc/apache2/sites-enabled/*, and change '<VirtualHost *:80>' to
27   -'<VirtualHost *:8080>'
28   -
29   -3c) Restart apache
30   -
31   - # invoke-rc.d apache2 restart
32   -
33   -4) Varnish configuration
34   -
35   -4a) Edit /etc/default/varnish
36   -
37   - * change the line that says "START=no" to say "START=yes"
38   - * change '-a :6081' to '-a :80'
39   -
40   -4b) Edit /etc/varnish/default.vcl and add the following lines at the end:
41   -
42   - include "/etc/noosfero/varnish-noosfero.vcl";
43   - include "/etc/noosfero/varnish-accept-language.vcl";
44   -
45   -On manual installations, change "/etc/noosfero/*" to
46   -"{Rails.root}/etc/noosfero/*"
47   -
48   -NOTE: it is very important that the *.vcl files are included in that order,
49   -i.e. *first* include "varnish-noosfero.vcl", and *after*
50   -"noosfero-accept-language.cvl".
51   -
52   -4c) Restart Varnish
53   -
54   - # invoke-rc.d varnish restart
55   -
56   -5) Enable varnish logging:
57   -
58   -5a) Edit /etc/default/varnishncsa and uncomment the line that contains:
59   -
60   -VARNISHNCSA_ENABLED=1
61   -
62   -The varnish log will be written to /var/log/varnish/varnishncsa.log in an
63   -apache-compatible format. You should change your statistics generation software
64   -(e.g. awstats) to use that instead of apache logs.
65   -
66   -5b) Restart Varnish Logging service
67   -
68   - # invoke-rc.d varnishncsa restart
69   -
70   -Thanks to Cosimo Streppone for varnish-accept-language. See
71   -http://github.com/cosimo/varnish-accept-language for more information.
INSTALL.varnish.md 0 → 100644
... ... @@ -0,0 +1,63 @@
  1 +Setting up Varnish for your Noosfero site
  2 +=========================================
  3 +
  4 +Varnish is a HTTP caching server, and using it together with Noosfero is highly recommended. See http://www.varnish-cache.org/ for more information on Varnish.
  5 +
  6 +Varnish can be set up to use with Noosfero with the following steps:
  7 +
  8 +1) setup Noosfero with apache according to the `INSTALL.md` file. If you used the Debian package to install noosfero, you don't need to do anything about this.
  9 +
  10 +2) install Varnish
  11 +
  12 + # apt-get install varnish
  13 +
  14 +Install the RPAF apache module (or skip this step if not using apache):
  15 +
  16 + # apt-get install libapache2-mod-rpaf
  17 +
  18 +3) Change Apache to listen on port `8080` instead of `80`
  19 +
  20 +3a) Edit `/etc/apache2/ports.conf`, and:
  21 +
  22 + * change `NameVirtualHost *:80` to `NameVirtualHost *:8080`
  23 + * change `Listen 80` to `Listen 127.0.0.1:8080`
  24 +
  25 +3b) Edit `/etc/apache2/sites-enabled/*`, and change `<VirtualHost *:80>` to `<VirtualHost *:8080>`
  26 +
  27 +3c) Restart apache
  28 +
  29 + # invoke-rc.d apache2 restart
  30 +
  31 +4) Varnish configuration
  32 +
  33 +4a) Edit `/etc/default/varnish`
  34 +
  35 + * change the line that says `START=no` to say `START=yes`
  36 + * change `-a :6081` to `-a :80`
  37 +
  38 +4b) Edit `/etc/varnish/default.vcl` and add the following lines at the end:
  39 +
  40 + include "/etc/noosfero/varnish-noosfero.vcl";
  41 + include "/etc/noosfero/varnish-accept-language.vcl";
  42 +
  43 +On manual installations, change `/etc/noosfero/*` to `{Rails.root}/etc/noosfero/*`
  44 +
  45 +**NOTE**: it is very important that the `*.vcl` files are included in that order, i.e. *first* include `varnish-noosfero.vcl`, and *after* `noosfero-accept-language.cvl`.
  46 +
  47 +4c) Restart Varnish
  48 +
  49 + # invoke-rc.d varnish restart
  50 +
  51 +5) Enable varnish logging:
  52 +
  53 +5a) Edit `/etc/default/varnishncsa` and uncomment the line that contains:
  54 +
  55 + VARNISHNCSA_ENABLED=1
  56 +
  57 +The varnish log will be written to `/var/log/varnish/varnishncsa.log` in an apache-compatible format. You should change your statistics generation software (e.g. awstats) to use that instead of apache logs.
  58 +
  59 +5b) Restart Varnish Logging service
  60 +
  61 + # invoke-rc.d varnishncsa restart
  62 +
  63 +Thanks to Cosimo Streppone for varnish-accept-language. See http://github.com/cosimo/varnish-accept-language for more information.
... ...
... ... @@ -1,33 +0,0 @@
1   -Noosfero - a web-based social platform
2   -======================================
3   -
4   -http://www.noosfero.org/
5   -
6   -Documentation
7   --------------
8   -
9   -The following documentation is available:
10   -
11   -File Purpose
12   -~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13   -INSTALL install instructions
14   -INSTALL.awstats install instructions - access statistics service
15   -INSTALL.chat install instructions - chat service
16   -INSTALL.email install instructions - email service
17   -INSTALL.multitenancy install instructions - multiple sites
18   -INSTALL.varnish install instructions - varnish HTTP caching (recommended)
19   -HACKING development instruction
20   -RELEASING instructions for doing releases
21   -doc/noosfero/* user documentation (available through the app itself)
22   -
23   -
24   -Authors and copyright
25   ----------------------
26   -
27   -Authorship and copyright information is available in the files listed below.
28   -
29   -File Purpose
30   -~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31   -AUTHORS list of authors (updated at each release)
32   -COPYRIGHT Copyright statement for the project
33   -COPYING Full text of the project license
README.md 0 → 100644
... ... @@ -0,0 +1,33 @@
  1 +Noosfero - a web-based social platform
  2 +======================================
  3 +
  4 +http://www.noosfero.org
  5 +
  6 +Documentation
  7 +-------------
  8 +
  9 +The following documentation is available:
  10 +
  11 + File Purpose
  12 + ----------------------- --------------------------------------------------------
  13 + INSTALL.md install instructions
  14 + INSTALL.awstats.md install instructions - access statistics service
  15 + INSTALL.chat.md install instructions - chat service
  16 + INSTALL.email.md install instructions - email service
  17 + INSTALL.multitenancy.md install instructions - multiple sites
  18 + INSTALL.varnish.md install instructions - varnish HTTP caching (recommended)
  19 + HACKING.md development instruction
  20 + RELEASING.md instructions for doing releases
  21 + doc/noosfero/* user documentation (available through the app itself)
  22 +
  23 +
  24 +Authors and copyright
  25 +---------------------
  26 +
  27 +Authorship and copyright information is available in the files listed below.
  28 +
  29 + File Purpose
  30 + -------------------- -----------------------------------------
  31 + AUTHORS.md list of authors (updated at each release)
  32 + COPYRIGHT Copyright statement for the project
  33 + COPYING Full text of the project license
... ...
README.rails
... ... @@ -1,183 +0,0 @@
1   -== Welcome to Rails
2   -
3   -Rails is a web-application and persistence framework that includes everything
4   -needed to create database-backed web-applications according to the
5   -Model-View-Control pattern of separation. This pattern splits the view (also
6   -called the presentation) into "dumb" templates that are primarily responsible
7   -for inserting pre-built data in between HTML tags. The model contains the
8   -"smart" domain objects (such as Account, Product, Person, Post) that holds all
9   -the business logic and knows how to persist themselves to a database. The
10   -controller handles the incoming requests (such as Save New Account, Update
11   -Product, Show Post) by manipulating the model and directing data to the view.
12   -
13   -In Rails, the model is handled by what's called an object-relational mapping
14   -layer entitled Active Record. This layer allows you to present the data from
15   -database rows as objects and embellish these data objects with business logic
16   -methods. You can read more about Active Record in
17   -link:files/vendor/rails/activerecord/README.html.
18   -
19   -The controller and view are handled by the Action Pack, which handles both
20   -layers by its two parts: Action View and Action Controller. These two layers
21   -are bundled in a single package due to their heavy interdependence. This is
22   -unlike the relationship between the Active Record and Action Pack that is much
23   -more separate. Each of these packages can be used independently outside of
24   -Rails. You can read more about Action Pack in
25   -link:files/vendor/rails/actionpack/README.html.
26   -
27   -
28   -== Getting started
29   -
30   -1. Start the web server: <tt>ruby script/server</tt> (run with --help for options)
31   -2. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!"
32   -3. Follow the guidelines to start developing your application
33   -
34   -
35   -== Web servers
36   -
37   -Rails uses the built-in web server in Ruby called WEBrick by default, so you don't
38   -have to install or configure anything to play around.
39   -
40   -If you have lighttpd installed, though, it'll be used instead when running script/server.
41   -It's considerably faster than WEBrick and suited for production use, but requires additional
42   -installation and currently only works well on OS X/Unix (Windows users are encouraged
43   -to start with WEBrick). We recommend version 1.4.11 and higher. You can download it from
44   -http://www.lighttpd.net.
45   -
46   -If you want something that's halfway between WEBrick and lighttpd, we heartily recommend
47   -Mongrel. It's a Ruby-based web server with a C-component (so it requires compilation) that
48   -also works very well with Windows. See more at http://mongrel.rubyforge.org/.
49   -
50   -But of course its also possible to run Rails with the premiere open source web server Apache.
51   -To get decent performance, though, you'll need to install FastCGI. For Apache 1.3, you want
52   -to use mod_fastcgi. For Apache 2.0+, you want to use mod_fcgid.
53   -
54   -See http://wiki.rubyonrails.com/rails/pages/FastCGI for more information on FastCGI.
55   -
56   -== Example for Apache conf
57   -
58   - <VirtualHost *:80>
59   - ServerName rails
60   - DocumentRoot /path/application/public/
61   - ErrorLog /path/application/log/server.log
62   -
63   - <Directory /path/application/public/>
64   - Options ExecCGI FollowSymLinks
65   - AllowOverride all
66   - Allow from all
67   - Order allow,deny
68   - </Directory>
69   - </VirtualHost>
70   -
71   -NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI
72   -should be on and ".cgi" should respond. All requests from 127.0.0.1 go
73   -through CGI, so no Apache restart is necessary for changes. All other requests
74   -go through FCGI (or mod_ruby), which requires a restart to show changes.
75   -
76   -
77   -== Debugging Rails
78   -
79   -Have "tail -f" commands running on both the server.log, production.log, and
80   -test.log files. Rails will automatically display debugging and runtime
81   -information to these files. Debugging info will also be shown in the browser
82   -on requests from 127.0.0.1.
83   -
84   -
85   -== Breakpoints
86   -
87   -Breakpoint support is available through the script/breakpointer client. This
88   -means that you can break out of execution at any point in the code, investigate
89   -and change the model, AND then resume execution! Example:
90   -
91   - class WeblogController < ActionController::Base
92   - def index
93   - @posts = Post.find_all
94   - breakpoint "Breaking out from the list"
95   - end
96   - end
97   -
98   -So the controller will accept the action, run the first line, then present you
99   -with a IRB prompt in the breakpointer window. Here you can do things like:
100   -
101   -Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
102   -
103   - >> @posts.inspect
104   - => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
105   - #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
106   - >> @posts.first.title = "hello from a breakpoint"
107   - => "hello from a breakpoint"
108   -
109   -...and even better is that you can examine how your runtime objects actually work:
110   -
111   - >> f = @posts.first
112   - => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
113   - >> f.
114   - Display all 152 possibilities? (y or n)
115   -
116   -Finally, when you're ready to resume execution, you press CTRL-D
117   -
118   -
119   -== Console
120   -
121   -You can interact with the domain model by starting the console through script/console.
122   -Here you'll have all parts of the application configured, just like it is when the
123   -application is running. You can inspect domain models, change values, and save to the
124   -database. Starting the script without arguments will launch it in the development environment.
125   -Passing an argument will specify a different environment, like <tt>script/console production</tt>.
126   -
127   -To reload your controllers and models after launching the console run <tt>reload!</tt>
128   -
129   -
130   -
131   -== Description of contents
132   -
133   -app
134   - Holds all the code that's specific to this particular application.
135   -
136   -app/controllers
137   - Holds controllers that should be named like weblog_controller.rb for
138   - automated URL mapping. All controllers should descend from
139   - ActionController::Base.
140   -
141   -app/models
142   - Holds models that should be named like post.rb.
143   - Most models will descend from ActiveRecord::Base.
144   -
145   -app/views
146   - Holds the template files for the view that should be named like
147   - weblog/index.rhtml for the WeblogController#index action. All views use eRuby
148   - syntax. This directory can also be used to keep stylesheets, images, and so on
149   - that can be symlinked to public.
150   -
151   -app/helpers
152   - Holds view helpers that should be named like weblog_helper.rb.
153   -
154   -app/apis
155   - Holds API classes for web services.
156   -
157   -config
158   - Configuration files for the Rails environment, the routing map, the database, and other dependencies.
159   -
160   -components
161   - Self-contained mini-applications that can bundle together controllers, models, and views.
162   -
163   -db
164   - Contains the database schema in schema.rb. db/migrate contains all
165   - the sequence of Migrations for your schema.
166   -
167   -lib
168   - Application specific libraries. Basically, any kind of custom code that doesn't
169   - belong under controllers, models, or helpers. This directory is in the load path.
170   -
171   -public
172   - The directory available for the web server. Contains subdirectories for images, stylesheets,
173   - and javascripts. Also contains the dispatchers and the default HTML files.
174   -
175   -script
176   - Helper scripts for automation and generation.
177   -
178   -test
179   - Unit and functional tests along with fixtures.
180   -
181   -vendor
182   - External libraries that the application depends on. Also includes the plugins subdirectory.
183   - This directory is in the load path.
README.rails.md 0 → 100644
... ... @@ -0,0 +1,138 @@
  1 +Welcome to Rails
  2 +================
  3 +
  4 +Rails is a web-application and persistence framework that includes everything needed to create database-backed web-applications according to the Model-View-Control pattern of separation. This pattern splits the view (also called the presentation) into "dumb" templates that are primarily responsible for inserting pre-built data in between HTML tags. The model contains the "smart" domain objects (such as Account, Product, Person, Post) that holds all the business logic and knows how to persist themselves to a database. The controller handles the incoming requests (such as Save New Account, Update Product, Show Post) by manipulating the model and directing data to the view.
  5 +
  6 +In Rails, the model is handled by what's called an object-relational mapping layer entitled Active Record. This layer allows you to present the data from database rows as objects and embellish these data objects with business logic methods. You can read more about Active Record in `.../rails/activerecord/README.html`.
  7 +
  8 +The controller and view are handled by the Action Pack, which handles both layers by its two parts: Action View and Action Controller. These two layers are bundled in a single package due to their heavy interdependence. This is unlike the relationship between the Active Record and Action Pack that is much more separate. Each of these packages can be used independently outside of Rails. You can read more about Action Pack in `.../rails/actionpack/README.html`.
  9 +
  10 +
  11 +Getting started
  12 +---------------
  13 +
  14 +1. Start the web server: `ruby script/server` (run with `--help` for options)
  15 +2. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!"
  16 +3. Follow the guidelines to start developing your application
  17 +
  18 +Web servers
  19 +-----------
  20 +
  21 +Rails uses the built-in web server in Ruby called WEBrick by default, so you don't have to install or configure anything to play around.
  22 +
  23 +If you have lighttpd installed, though, it'll be used instead when running script/server. It's considerably faster than WEBrick and suited for production use, but requires additional installation and currently only works well on OS X/Unix (Windows users are encouraged to start with WEBrick). We recommend version 1.4.11 and higher. You can download it from http://www.lighttpd.net.
  24 +
  25 +If you want something that's halfway between WEBrick and lighttpd, we heartily recommend Mongrel. It's a Ruby-based web server with a C-component (so it requires compilation) that also works very well with Windows. See more at http://mongrel.rubyforge.org/.
  26 +
  27 +But of course its also possible to run Rails with the premiere open source web server Apache. To get decent performance, though, you'll need to install FastCGI. For Apache 1.3, you want to use mod_fastcgi. For Apache 2.0+, you want to use mod_fcgid.
  28 +
  29 +See http://wiki.rubyonrails.com/rails/pages/FastCGI for more information on FastCGI.
  30 +
  31 +Example for Apache conf
  32 +-----------------------
  33 +
  34 + <VirtualHost *:80>
  35 + ServerName rails
  36 + DocumentRoot /path/application/public/
  37 + ErrorLog /path/application/log/server.log
  38 +
  39 + <Directory /path/application/public/>
  40 + Options ExecCGI FollowSymLinks
  41 + AllowOverride all
  42 + Allow from all
  43 + Order allow,deny
  44 + </Directory>
  45 + </VirtualHost>
  46 +
  47 +NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI should be on and ".cgi" should respond. All requests from 127.0.0.1 go through CGI, so no Apache restart is necessary for changes. All other requests go through FCGI (or mod_ruby), which requires a restart to show changes.
  48 +
  49 +Debugging Rails
  50 +---------------
  51 +
  52 +Have "tail -f" commands running on both the server.log, production.log, and test.log files. Rails will automatically display debugging and runtime information to these files. Debugging info will also be shown in the browser on requests from 127.0.0.1.
  53 +
  54 +Breakpoints
  55 +-----------
  56 +
  57 +Breakpoint support is available through the script/breakpointer client. This means that you can break out of execution at any point in the code, investigate and change the model, AND then resume execution! Example:
  58 +
  59 + class WeblogController < ActionController::Base
  60 + def index
  61 + @posts = Post.find_all
  62 + breakpoint "Breaking out from the list"
  63 + end
  64 + end
  65 +
  66 +So the controller will accept the action, run the first line, then present you with a IRB prompt in the breakpointer window. Here you can do things like:
  67 +
  68 +Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
  69 +
  70 + >> @posts.inspect
  71 + => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
  72 + #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
  73 + >> @posts.first.title = "hello from a breakpoint"
  74 + => "hello from a breakpoint"
  75 +
  76 +...and even better is that you can examine how your runtime objects actually work:
  77 +
  78 + >> f = @posts.first
  79 + => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
  80 + >> f.
  81 + Display all 152 possibilities? (y or n)
  82 +
  83 +Finally, when you're ready to resume execution, you press CTRL-D
  84 +
  85 +Console
  86 +-------
  87 +
  88 +You can interact with the domain model by starting the console through script/console. Here you'll have all parts of the application configured, just like it is when the application is running. You can inspect domain models, change values, and save to the database. Starting the script without arguments will launch it in the development environment. Passing an argument will specify a different environment, like `script/console production`.
  89 +
  90 +To reload your controllers and models after launching the console run `reload!`
  91 +
  92 +Description of contents
  93 +-----------------------
  94 +
  95 +* `app`
  96 + Holds all the code that's specific to this particular application.
  97 +
  98 +* `app/controllers`
  99 + Holds controllers that should be named like weblog_controller.rb for automated URL mapping. All controllers should descend from `ActionController::Base`.
  100 +
  101 +* `app/models`
  102 + Holds models that should be named like post.rb. Most models will descend from `ActiveRecord::Base`.
  103 +
  104 +* `app/views`
  105 + Holds the template files for the view that should be named like `weblog/index.rhtml` for the `WeblogController#index` action. All views use eRuby syntax. This directory can also be used to keep stylesheets, images, and so on that can be symlinked to public.
  106 +
  107 +* `app/helpers`
  108 + Holds view helpers that should be named like `weblog_helper.rb`.
  109 +
  110 +* `app/apis`
  111 + Holds API classes for web services.
  112 +
  113 +* `config`
  114 + Configuration files for the Rails environment, the routing map, the database, and other dependencies.
  115 +
  116 +* `components`
  117 + Self-contained mini-applications that can bundle together controllers, models, and views.
  118 +
  119 +* `db`
  120 + Contains the database schema in `schema.rb`.
  121 +
  122 +* `db/migrate`
  123 + Contains all the sequence of Migrations for your schema.
  124 +
  125 +* `lib`
  126 + Application specific libraries. Basically, any kind of custom code that doesn't belong under controllers, models, or helpers. This directory is in the load path.
  127 +
  128 +* `public`
  129 + The directory available for the web server. Contains subdirectories for images, stylesheets, and javascripts. Also contains the dispatchers and the default HTML files.
  130 +
  131 +* `script`
  132 + Helper scripts for automation and generation.
  133 +
  134 +* `test`
  135 + Unit and functional tests along with fixtures.
  136 +
  137 +* `vendor`
  138 + External libraries that the application depends on. Also includes the plugins subdirectory. This directory is in the load path.
... ...
RELEASING
... ... @@ -1,40 +0,0 @@
1   -= Noosfero release tasks
2   -
3   -This file documents release-related activities.
4   -
5   -== Working with translations
6   -
7   -* Update translation files: <tt>rake updatepo</tt>. Then <tt>git commit</tt> them.
8   -* Send the PO files to the translators.
9   -* Get the PO files back from translators, put in po/ under the correct language
10   - name (e.,g. po/pt_BR/) and <tt>git commit</tt>.
11   -* test translations: <tt>rake makemo</tt> and browse the application on the web.
12   -
13   -== Releasing noosfero
14   -
15   -Considering you are on a Debian GNU/Linux or Debian-based system
16   - # apt-get install devscripts debhelper
17   -
18   -To prepare a release of noosfero, you must follow the steps below:
19   -
20   -* Finish all requirements and bugs assigned to the to-be-released version
21   -* Make sure all tests pass
22   -* Write release notes at the version's wiki topic
23   -* Generate packages with <tt>rake noosfero:release[(stable|test)]</tt>. This task will:
24   - * Update the version in lib/noosfero.rb and debian/changelog.
25   - * Create the tarbal and the deb pkg under pkg/ directory.
26   - * Create a git tag and push it.
27   - * Upload the pkg to the configured repository (if configured) on ~/.dput.cf.
28   -* Test that the tarball and deb package are ok
29   -* Go to the version's wiki topic and edit it to reflect the new reality
30   -* Edit the topic WebPreferences and update DEBIAN_REPOSITORY_TOPICS setting
31   -* Attach the generated packages to that topic. Before attaching calculate the
32   - sha1 of the package (with sha1sum and paste the SHA1 hash as comment in the
33   - attachment form)
34   -* Download the attached and verify the MD5 hash
35   -* Update an eventual demonstration version that you run.
36   -* Write an announcement e-mail to the relevant mailing lists pointing to the
37   - release notes, and maybe to the demonstration version.
38   -
39   -If you had any problem during these steps, you can do <tt>rake clobber_package</tt> to
40   -completely delete the generated packages and start the process again.
RELEASING.md 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +Noosfero release tasks
  2 +======================
  3 +
  4 +This file documents release-related activities.
  5 +
  6 +Working with translations
  7 +-------------------------
  8 +
  9 +* Update translation files: `rake updatepo`. Then `git commit` them.
  10 +* Send the PO files to the translators.
  11 +* Get the PO files back from translators, put in `po/` under the correct language name (e.,g. `po/pt_BR/`) and `git commit`.
  12 +* test translations: `rake makemo` and browse the application on the web.
  13 +
  14 +Releasing noosfero
  15 +------------------
  16 +
  17 +Considering you are on a Debian GNU/Linux or Debian-based system
  18 +
  19 + # apt-get install devscripts debhelper
  20 +
  21 +To prepare a release of noosfero, you must follow the steps below:
  22 +
  23 +* Finish all requirements and bugs assigned to the to-be-released version
  24 +* Make sure all tests pass
  25 +* Write release notes at the version's wiki topic
  26 +* Generate packages with `rake noosfero:release[(stable|test)]`. This task will:
  27 + * Update the version in lib/noosfero.rb and debian/changelog.
  28 + * Create the tarbal and the deb pkg under pkg/ directory.
  29 + * Create a git tag and push it.
  30 + * Upload the pkg to the configured repository (if configured) on ~/.dput.cf.
  31 +* Test that the tarball and deb package are ok
  32 +* Go to the version's wiki topic and edit it to reflect the new reality
  33 +* Edit the topic WebPreferences and update DEBIAN_REPOSITORY_TOPICS setting
  34 +* Attach the generated packages to that topic. Before attaching calculate the sha1 of the package (with sha1sum and paste the SHA1 hash as comment in the attachment form)
  35 +* Download the attached and verify the MD5 hash
  36 +* Update an eventual demonstration version that you run.
  37 +* Write an announcement e-mail to the relevant mailing lists pointing to the release notes, and maybe to the demonstration version.
  38 +
  39 +If you had any problem during these steps, you can do `rake clobber_package` to completely delete the generated packages and start the process again.
... ...
app/controllers/admin/environment_themes_controller.rb 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +class EnvironmentThemesController < ThemesController
  2 +
  3 + protect 'edit_appearance', :environment
  4 +
  5 + no_design_blocks
  6 +
  7 + def target
  8 + @target = environment
  9 + end
  10 +
  11 +end
... ...
app/controllers/my_profile/cms_controller.rb
... ... @@ -2,6 +2,8 @@ class CmsController &lt; MyProfileController
2 2  
3 3 protect 'edit_profile', :profile, :only => [:set_home_page]
4 4  
  5 + include ArticleHelper
  6 +
5 7 def self.protect_if(*args)
6 8 before_filter(*args) do |c|
7 9 user, profile = c.send(:user), c.send(:profile)
... ... @@ -64,12 +66,23 @@ class CmsController &lt; MyProfileController
64 66 end
65 67  
66 68 def edit
  69 + @success_back_to = params[:success_back_to]
67 70 @article = profile.articles.find(params[:id])
  71 + version = params[:version]
  72 + @article.revert_to(version) if version
  73 +
68 74 @parent_id = params[:parent_id]
69 75 @type = params[:type] || @article.class.to_s
70 76 translations if @article.translatable?
71 77 continue = params[:continue]
72 78  
  79 + @article.article_privacy_exceptions = params[:q].split(/,/).map{|n| environment.people.find n.to_i} unless params[:q].nil?
  80 +
  81 + @tokenized_children = prepare_to_token_input(
  82 + profile.members.includes(:articles_with_access).find_all{ |m|
  83 + m.articles_with_access.include?(@article)
  84 + }
  85 + )
73 86 refuse_blocks
74 87 record_coming
75 88 if request.post?
... ... @@ -78,7 +91,7 @@ class CmsController &lt; MyProfileController
78 91 if @article.update_attributes(params[:article])
79 92 if !continue
80 93 if @article.content_type.nil? || @article.image?
81   - redirect_to @article.view_url
  94 + success_redirect
82 95 else
83 96 redirect_to :action => (@article.parent ? 'view' : 'index'), :id => @article.parent
84 97 end
... ... @@ -90,6 +103,7 @@ class CmsController &lt; MyProfileController
90 103 def new
91 104 # FIXME this method should share some logic wirh edit !!!
92 105  
  106 + @success_back_to = params[:success_back_to]
93 107 # user must choose an article type first
94 108  
95 109 @parent = profile.articles.find(params[:parent_id]) if params && params[:parent_id]
... ... @@ -130,11 +144,13 @@ class CmsController &lt; MyProfileController
130 144  
131 145 continue = params[:continue]
132 146 if request.post?
  147 + @article.article_privacy_exceptions = params[:q].split(/,/).map{|n| environment.people.find n.to_i} unless params[:q].nil?
  148 +
133 149 if @article.save
134 150 if continue
135 151 redirect_to :action => 'edit', :id => @article
136 152 else
137   - redirect_to @article.view_url
  153 + success_redirect
138 154 end
139 155 return
140 156 end
... ... @@ -189,7 +205,7 @@ class CmsController &lt; MyProfileController
189 205 @article.destroy
190 206 session[:notice] = _("\"#{@article.name}\" was removed.")
191 207 referer = ActionController::Routing::Routes.recognize_path URI.parse(request.referer).path rescue nil
192   - if referer and referer[:controller] == 'cms'
  208 + if referer and referer[:controller] == 'cms' and referer[:action] != 'edit'
193 209 redirect_to referer
194 210 elsif @article.parent
195 211 redirect_to @article.parent.url
... ... @@ -290,6 +306,12 @@ class CmsController &lt; MyProfileController
290 306 render :text => article_list_to_json(results), :content_type => 'application/json'
291 307 end
292 308  
  309 + def search_article_privacy_exceptions
  310 + arg = params[:q].downcase
  311 + result = profile.members.find(:all, :conditions => ['LOWER(name) LIKE ?', "%#{arg}%"])
  312 + render :text => prepare_to_token_input(result).to_json
  313 + end
  314 +
293 315 def media_upload
294 316 files_uploaded = []
295 317 parent = check_parent(params[:parent_id])
... ... @@ -386,5 +408,12 @@ class CmsController &lt; MyProfileController
386 408 true
387 409 end
388 410  
389   -end
  411 + def success_redirect
  412 + if !@success_back_to.blank?
  413 + redirect_to @success_back_to
  414 + else
  415 + redirect_to @article.view_url
  416 + end
  417 + end
390 418  
  419 +end
... ...
app/controllers/my_profile/profile_design_controller.rb
... ... @@ -32,6 +32,7 @@ class ProfileDesignController &lt; BoxOrganizerController
32 32 if profile.enterprise?
33 33 blocks << DisabledEnterpriseMessageBlock
34 34 blocks << HighlightsBlock
  35 + blocks << ProductCategoriesBlock
35 36 blocks << FeaturedProductsBlock
36 37 blocks << FansBlock
37 38 blocks += plugins.dispatch(:extra_blocks, :type => Enterprise)
... ... @@ -54,4 +55,10 @@ class ProfileDesignController &lt; BoxOrganizerController
54 55 blocks
55 56 end
56 57  
  58 + def clone
  59 + block = Block.find(params[:id])
  60 + block.duplicate
  61 + redirect_to :action => 'index'
  62 + end
  63 +
57 64 end
... ...
app/controllers/my_profile/profile_themes_controller.rb 0 → 100644
... ... @@ -0,0 +1,75 @@
  1 +class ProfileThemesController < ThemesController
  2 +
  3 + needs_profile
  4 +
  5 + protect 'edit_appearance', :profile
  6 +
  7 + no_design_blocks
  8 +
  9 + def target
  10 + @target = profile
  11 + end
  12 +
  13 + def new
  14 + if !request.xhr?
  15 + id = params[:name] ? params[:name].to_slug : 'my-theme'
  16 + t = Theme.new(id, :name => params[:name], :owner => profile, :public => false)
  17 + t.save
  18 + redirect_to :action => 'index'
  19 + else
  20 + render :action => 'new', :layout => false
  21 + end
  22 + end
  23 +
  24 + def edit
  25 + @theme = profile.find_theme(params[:id])
  26 + @css_files = @theme.css_files
  27 + @image_files = @theme.image_files
  28 + end
  29 +
  30 + def add_css
  31 + @theme = profile.find_theme(params[:id])
  32 + if request.xhr?
  33 + render :action => 'add_css', :layout => false
  34 + else
  35 + @theme.add_css(params[:css])
  36 + redirect_to :action => 'edit', :id => @theme.id
  37 + end
  38 + end
  39 +
  40 + def css_editor
  41 + @theme = profile.find_theme(params[:id])
  42 + @css = params[:css]
  43 +
  44 + @code = @theme.read_css(@css)
  45 + render :action => 'css_editor', :layout => false
  46 + end
  47 +
  48 + post_only :update_css
  49 + def update_css
  50 + @theme = profile.find_theme(params[:id])
  51 + @theme.update_css(params[:css], params[:csscode])
  52 + redirect_to :action => 'edit', :id => @theme.id
  53 + end
  54 +
  55 + def add_image
  56 + @theme = profile.find_theme(params[:id])
  57 + if request.xhr?
  58 + render :action => 'add_image', :layout => false
  59 + else
  60 + @theme.add_image(params[:image].original_filename, params[:image].read)
  61 + redirect_to :action => 'edit', :id => @theme.id
  62 + end
  63 + end
  64 +
  65 + def start_test
  66 + session[:theme] = params[:id]
  67 + redirect_to :controller => 'content_viewer', :profile => profile.identifier, :action => 'view_page'
  68 + end
  69 +
  70 + def stop_test
  71 + session[:theme] = nil
  72 + redirect_to :action => 'index'
  73 + end
  74 +
  75 +end
... ...
app/controllers/my_profile/themes_controller.rb
... ... @@ -1,91 +0,0 @@
1   -class ThemesController < MyProfileController
2   -
3   - protect 'edit_appearance', :profile
4   - no_design_blocks
5   -
6   - def set
7   - profile.update_theme(params[:id])
8   - redirect_to :action => 'index'
9   - end
10   -
11   - def unset
12   - profile.update_theme(nil)
13   - redirect_to :action => 'index'
14   - end
15   -
16   - def index
17   - @themes = profile.environment.themes + Theme.approved_themes(profile)
18   - @current_theme = profile.theme
19   -
20   - @layout_templates = LayoutTemplate.all
21   - @current_template = profile.layout_template
22   - end
23   -
24   - def new
25   - if !request.xhr?
26   - id = params[:name] ? params[:name].to_slug : 'my-theme'
27   - t = Theme.new(id, :name => params[:name], :owner => profile, :public => false)
28   - t.save
29   - redirect_to :action => 'index'
30   - else
31   - render :action => 'new', :layout => false
32   - end
33   - end
34   -
35   - def edit
36   - @theme = profile.find_theme(params[:id])
37   - @css_files = @theme.css_files
38   - @image_files = @theme.image_files
39   - end
40   -
41   - def add_css
42   - @theme = profile.find_theme(params[:id])
43   - if request.xhr?
44   - render :action => 'add_css', :layout => false
45   - else
46   - @theme.add_css(params[:css])
47   - redirect_to :action => 'edit', :id => @theme.id
48   - end
49   - end
50   -
51   - def css_editor
52   - @theme = profile.find_theme(params[:id])
53   - @css = params[:css]
54   -
55   - @code = @theme.read_css(@css)
56   - render :action => 'css_editor', :layout => false
57   - end
58   -
59   - post_only :update_css
60   - def update_css
61   - @theme = profile.find_theme(params[:id])
62   - @theme.update_css(params[:css], params[:csscode])
63   - redirect_to :action => 'edit', :id => @theme.id
64   - end
65   -
66   - def add_image
67   - @theme = profile.find_theme(params[:id])
68   - if request.xhr?
69   - render :action => 'add_image', :layout => false
70   - else
71   - @theme.add_image(params[:image].original_filename, params[:image].read)
72   - redirect_to :action => 'edit', :id => @theme.id
73   - end
74   - end
75   -
76   - def start_test
77   - session[:theme] = params[:id]
78   - redirect_to :controller => 'content_viewer', :profile => profile.identifier, :action => 'view_page'
79   - end
80   -
81   - def stop_test
82   - session[:theme] = nil
83   - redirect_to :action => 'index'
84   - end
85   -
86   - def set_layout_template
87   - profile.update_layout_template(params[:id])
88   - redirect_to :action => 'index'
89   - end
90   -
91   -end
app/controllers/public/catalog_controller.rb
1 1 class CatalogController < PublicController
2 2 needs_profile
3   - no_design_blocks
4 3  
5 4 before_filter :check_enterprise_and_environment
6 5  
... ...
app/controllers/public/comment_controller.rb
... ... @@ -71,7 +71,9 @@ class CommentController &lt; ApplicationController
71 71 return
72 72 end
73 73  
74   - @comment.save
  74 + if @comment.save
  75 + @plugins.dispatch(:process_extra_comment_params, [@comment,params])
  76 + end
75 77  
76 78 respond_to do |format|
77 79 format.js do
... ... @@ -113,6 +115,8 @@ class CommentController &lt; ApplicationController
113 115  
114 116 def update
115 117 if @comment.update_attributes(params[:comment])
  118 + @plugins.dispatch(:process_extra_comment_params, [@comment,params])
  119 +
116 120 respond_to do |format|
117 121 format.js do
118 122 comment_to_render = @comment.comment_root
... ...
app/controllers/public/content_viewer_controller.rb
... ... @@ -7,6 +7,7 @@ class ContentViewerController &lt; ApplicationController
7 7  
8 8 def view_page
9 9 path = params[:page].join('/')
  10 + @version = params[:version].to_i
10 11  
11 12 if path.blank?
12 13 @page = profile.home_page
... ... @@ -25,31 +26,29 @@ class ContentViewerController &lt; ApplicationController
25 26 end
26 27 end
27 28  
28   - if !@page.nil? && !@page.display_to?(user)
29   - if !profile.public?
30   - private_profile_partial_parameters
31   - render :template => 'profile/_private_profile.rhtml', :status => 403
32   - else #if !profile.visible?
33   - message = _('You are not allowed to view this content.')
34   - message += ' ' + _('You can contact the owner of this profile to request access then.')
35   - render_access_denied(message)
  29 + return unless allow_access_to_page(path)
  30 +
  31 + if @version > 0
  32 + return render_access_denied unless @page.display_versions?
  33 + @versioned_article = @page.versions.find_by_version(@version)
  34 + if @versioned_article && @page.versions.latest.version != @versioned_article.version
  35 + render :template => 'content_viewer/versioned_article.rhtml'
  36 + return
36 37 end
37   - return
38 38 end
39 39  
40   - # page not found, give error
41   - if @page.nil?
42   - render_not_found(@path)
43   - return
44   - end
  40 + redirect_to_translation if @page.profile.redirect_l10n
45 41  
46   - if request.xhr? && params[:toolbar]
47   - render :partial => 'article_toolbar'
48   - return
  42 + if request.post?
  43 + if @page.forum? && @page.has_terms_of_use && params[:terms_accepted] == "true"
  44 + @page.add_agreed_user(user)
  45 + end
  46 + elsif !@page.parent.nil? && @page.parent.forum?
  47 + unless @page.parent.agrees_with_terms?(user)
  48 + redirect_to @page.parent.url
  49 + end
49 50 end
50 51  
51   - redirect_to_translation if @page.profile.redirect_l10n
52   -
53 52 # At this point the page will be showed
54 53 @page.hit
55 54  
... ... @@ -118,6 +117,15 @@ class ContentViewerController &lt; ApplicationController
118 117 end
119 118 end
120 119  
  120 + def article_versions
  121 + path = params[:page].join('/')
  122 + @page = profile.articles.find_by_path(path)
  123 + return unless allow_access_to_page(path)
  124 +
  125 + render_access_denied unless @page.display_versions?
  126 + @versions = @page.versions.paginate(:per_page => per_page, :page => params[:npage])
  127 + end
  128 +
121 129 protected
122 130  
123 131 def per_page
... ... @@ -148,4 +156,22 @@ class ContentViewerController &lt; ApplicationController
148 156 end
149 157 helper_method :pass_without_comment_captcha?
150 158  
  159 + def allow_access_to_page(path)
  160 + allowed = true
  161 + if @page.nil? # page not found, give error
  162 + render_not_found(path)
  163 + allowed = false
  164 + elsif !@page.display_to?(user)
  165 + if !profile.public?
  166 + private_profile_partial_parameters
  167 + render :template => 'profile/_private_profile.rhtml', :status => 403
  168 + allowed = false
  169 + else #if !profile.visible?
  170 + render_access_denied
  171 + allowed = false
  172 + end
  173 + end
  174 + allowed
  175 + end
  176 +
151 177 end
... ...
app/controllers/themes_controller.rb 0 → 100644
... ... @@ -0,0 +1,42 @@
  1 +class ThemesController < ApplicationController
  2 +
  3 + before_filter :login_required
  4 +
  5 + no_design_blocks
  6 +
  7 + # attr_reader :target
  8 +
  9 + def target
  10 + @target
  11 + end
  12 +
  13 + def index
  14 + @environment = environment
  15 + @themes = environment.themes + Theme.approved_themes(target)
  16 +
  17 + @current_theme = target.theme
  18 +
  19 + @layout_templates = LayoutTemplate.all
  20 + @current_template = target.layout_template
  21 + end
  22 +
  23 + def set
  24 + target.update_theme(params[:id])
  25 + redirect_to :action => 'index'
  26 + end
  27 +
  28 + def unset
  29 + if target.kind_of?(Environment)
  30 + target.update_theme('default')
  31 + else
  32 + target.update_theme(nil)
  33 + end
  34 + redirect_to :action => 'index'
  35 + end
  36 +
  37 + def set_layout_template
  38 + target.update_layout_template(params[:id])
  39 + redirect_to :action => 'index'
  40 + end
  41 +
  42 +end
... ...
app/helpers/application_helper.rb
... ... @@ -40,6 +40,10 @@ module ApplicationHelper
40 40  
41 41 include Noosfero::Gravatar
42 42  
  43 + include TokenHelper
  44 +
  45 + include CatalogHelper
  46 +
43 47 def locale
44 48 (@page && !@page.language.blank?) ? @page.language : FastGettext.locale
45 49 end
... ... @@ -407,10 +411,11 @@ module ApplicationHelper
407 411 nil
408 412 end
409 413  
410   - def theme_include(template)
  414 + def theme_include(template, options = {})
411 415 file = theme_view_file(template)
  416 + options.merge!({:file => file, :use_full_path => false})
412 417 if file
413   - render :file => file, :use_full_path => false
  418 + render options
414 419 else
415 420 nil
416 421 end
... ... @@ -1299,10 +1304,6 @@ module ApplicationHelper
1299 1304 content_tag(:div, content_tag(:ul, titles) + raw(contents), :class => 'ui-tabs')
1300 1305 end
1301 1306  
1302   - def jquery_token_input_messages_json(hintText = _('Type in an keyword'), noResultsText = _('No results'), searchingText = _('Searching...'))
1303   - "hintText: '#{hintText}', noResultsText: '#{noResultsText}', searchingText: '#{searchingText}'"
1304   - end
1305   -
1306 1307 def delete_article_message(article)
1307 1308 if article.folder?
1308 1309 _("Are you sure that you want to remove the folder \"#{article.name}\"? Note that all the items inside it will also be removed!")
... ... @@ -1343,50 +1344,6 @@ module ApplicationHelper
1343 1344 )
1344 1345 end
1345 1346  
1346   - def token_input_field_tag(name, element_id, search_action, options = {}, text_field_options = {}, html_options = {})
1347   - options[:min_chars] ||= 3
1348   - options[:hint_text] ||= _("Type in a search term")
1349   - options[:no_results_text] ||= _("No results")
1350   - options[:searching_text] ||= _("Searching...")
1351   - options[:search_delay] ||= 1000
1352   - options[:prevent_duplicates] ||= true
1353   - options[:backspace_delete_item] ||= false
1354   - options[:focus] ||= false
1355   - options[:avoid_enter] ||= true
1356   - options[:on_result] ||= 'null'
1357   - options[:on_add] ||= 'null'
1358   - options[:on_delete] ||= 'null'
1359   - options[:on_ready] ||= 'null'
1360   -
1361   - result = text_field_tag(name, nil, text_field_options.merge(html_options.merge({:id => element_id})))
1362   - result += javascript_tag("jQuery('##{element_id}')
1363   - .tokenInput('#{url_for(search_action)}', {
1364   - minChars: #{options[:min_chars].to_json},
1365   - prePopulate: #{options[:pre_populate].to_json},
1366   - hintText: #{options[:hint_text].to_json},
1367   - noResultsText: #{options[:no_results_text].to_json},
1368   - searchingText: #{options[:searching_text].to_json},
1369   - searchDelay: #{options[:serach_delay].to_json},
1370   - preventDuplicates: #{options[:prevent_duplicates].to_json},
1371   - backspaceDeleteItem: #{options[:backspace_delete_item].to_json},
1372   - queryParam: #{name.to_json},
1373   - tokenLimit: #{options[:token_limit].to_json},
1374   - onResult: #{options[:on_result]},
1375   - onAdd: #{options[:on_add]},
1376   - onDelete: #{options[:on_delete]},
1377   - onReady: #{options[:on_ready]},
1378   - });
1379   - ")
1380   - result += javascript_tag("jQuery('##{element_id}').focus();") if options[:focus]
1381   - if options[:avoid_enter]
1382   - result += javascript_tag("jQuery('#token-input-#{element_id}')
1383   - .live('keydown', function(event){
1384   - if(event.keyCode == '13') return false;
1385   - });")
1386   - end
1387   - result
1388   - end
1389   -
1390 1347 def expirable_content_reference(content, action, text, url, options = {})
1391 1348 reason = @plugins.dispatch("content_expire_#{action.to_s}", content).first
1392 1349 options[:title] = reason
... ... @@ -1447,4 +1404,8 @@ module ApplicationHelper
1447 1404 content.nil? ? '' : content.id.to_s
1448 1405 end
1449 1406  
  1407 + def display_article_versions(article, version = nil)
  1408 + content_tag('ul', article.versions.map {|v| link_to("r#{v.version}", @page.url.merge(:version => v.version))})
  1409 + end
  1410 +
1450 1411 end
... ...
app/helpers/article_helper.rb
1 1 module ArticleHelper
2 2  
3   - def custom_options_for_article(article)
  3 + include TokenHelper
  4 +
  5 + def custom_options_for_article(article, tokenized_children)
4 6 @article = article
5   - content_tag('h4', _('Visibility')) +
6   - content_tag('div',
7   - content_tag('div',
8   - radio_button(:article, :published, true) +
9   - content_tag('label', _('Public (visible to other people)'), :for => 'article_published_true')
10   - ) +
11   - content_tag('div',
12   - radio_button(:article, :published, false) +
13   - content_tag('label', _('Private'), :for => 'article_published_false')
14   - )
15   - ) +
  7 +
  8 + visibility_options(@article, tokenized_children) +
16 9 content_tag('h4', _('Options')) +
17 10 content_tag('div',
18 11 (article.profile.has_members? ?
... ... @@ -35,7 +28,7 @@ module ArticleHelper
35 28 'div',
36 29 check_box(:article, :notify_comments) +
37 30 content_tag('label', _('I want to receive a notification of each comment written by e-mail'), :for => 'article_notify_comments') +
38   - observe_field(:article_accept_comments, :function => "$('article_notify_comments').disabled = ! $('article_accept_comments').checked;$('article_moderate_comments').disabled = ! $('article_accept_comments').checked")
  31 + observe_field(:article_accept_comments, :function => "$('article_notify_comments').disabled = ! $('article_accept_comments').checked;$('article_moderate_comments').disabled = ! $('article_accept_comments').checked")
39 32 ) +
40 33  
41 34 content_tag(
... ... @@ -49,10 +42,40 @@ module ArticleHelper
49 42 'div',
50 43 check_box(:article, :display_hits) +
51 44 content_tag('label', _('I want this article to display the number of hits it received'), :for => 'article_display_hits')
  45 + ) : '') +
  46 +
  47 + (article.can_display_versions? ?
  48 + content_tag(
  49 + 'div',
  50 + check_box(:article, :display_versions) +
  51 + content_tag('label', _('I want this article to display a link to older versions'), :for => 'article_display_versions')
52 52 ) : '')
  53 +
53 54 )
54 55 end
55 56  
  57 + def visibility_options(article, tokenized_children)
  58 + content_tag('h4', _('Visibility')) +
  59 + content_tag('div',
  60 + content_tag('div',
  61 + radio_button(:article, :published, true) +
  62 + content_tag('label', _('Public (visible to other people)'), :for => 'article_published_true')
  63 + ) +
  64 + content_tag('div',
  65 + radio_button(:article, :published, false) +
  66 + content_tag('label', _('Private'), :for => 'article_published_false', :id => "label_private")
  67 + ) +
  68 + (article.profile.community? ? content_tag('div',
  69 + content_tag('label', _('Fill in the search field to add the exception users to see this content'), :id => "text-input-search-exception-users") +
  70 + token_input_field_tag(:q, 'search-article-privacy-exceptions', {:action => 'search_article_privacy_exceptions'},
  71 + {:focus => false, :hint_text => _('Type in a search term for a user'), :pre_populate => tokenized_children})) :
  72 + ''))
  73 + end
  74 +
  75 + def prepare_to_token_input(array)
  76 + array.map { |object| {:id => object.id, :name => object.name} }
  77 + end
  78 +
56 79 def cms_label_for_new_children
57 80 _('New article')
58 81 end
... ...
app/helpers/blog_helper.rb
1 1 module BlogHelper
2 2  
3   - def custom_options_for_article(article)
  3 + include ArticleHelper
  4 +
  5 + def custom_options_for_article(article,tokenized_children)
4 6 @article = article
5 7 hidden_field_tag('article[published]', 1) +
6   - hidden_field_tag('article[accept_comments]', 0)
  8 + hidden_field_tag('article[accept_comments]', 0) +
  9 + visibility_options(article,tokenized_children)
7 10 end
8 11  
9 12 def cms_label_for_new_children
... ...
app/helpers/box_organizer_helper.rb
... ... @@ -4,4 +4,10 @@ module BoxOrganizerHelper
4 4 render :partial => 'icon_selector', :locals => { :icon => icon }
5 5 end
6 6  
7   -end
  7 + def extra_option_checkbox(option)
  8 + if [:human_name, :name, :value, :checked, :options].all? {|k| option.key? k}
  9 + labelled_check_box(option[:human_name], option[:name], option[:value], option[:checked], option[:options])
  10 + end
  11 + end
  12 +
  13 +end
8 14 \ No newline at end of file
... ...
app/helpers/boxes_helper.rb
... ... @@ -65,7 +65,7 @@ module BoxesHelper
65 65 end
66 66  
67 67 def display_box_content(box, main_content)
68   - context = { :article => @page, :request_path => request.path, :locale => locale }
  68 + context = { :article => @page, :request_path => request.path, :locale => locale, :params => request.params }
69 69 box_decorator.select_blocks(box.blocks.includes(:box), context).map { |item| display_block(item, main_content) }.join("\n") + box_decorator.block_target(box)
70 70 end
71 71  
... ... @@ -212,6 +212,7 @@ module BoxesHelper
212 212  
213 213 if !block.main?
214 214 buttons << icon_button(:delete, _('Remove block'), { :action => 'remove', :id => block.id }, { :method => 'post', :confirm => _('Are you sure you want to remove this block?')})
  215 + buttons << icon_button(:clone, _('Clone'), { :action => 'clone', :id => block.id }, { :method => 'post' })
215 216 end
216 217  
217 218 if block.respond_to?(:help)
... ... @@ -227,7 +228,7 @@ module BoxesHelper
227 228  
228 229 # DEPRECATED. Do not use this.
229 230 def import_blocks_stylesheets(options = {})
230   - @blocks_css_files ||= current_blocks.map{|b|'blocks/' + block.class.name.to_css_class}.uniq
  231 + @blocks_css_files ||= current_blocks.map{|block|'blocks/' + block.class.name.to_css_class}.uniq
231 232 stylesheet_import(@blocks_css_files, options)
232 233 end
233 234 def block_css_classes(block)
... ...
app/helpers/catalog_helper.rb
... ... @@ -9,7 +9,11 @@ module CatalogHelper
9 9 @categories = ProductCategory.on_level(params[:level]).order(:name)
10 10 end
11 11  
12   - @products = profile.products.from_category(@category).paginate(:order => 'available desc, highlighted desc, name asc', :per_page => 9, :page => options[:page])
  12 + @products = profile.products.from_category(@category).paginate(
  13 + :order => 'available desc, highlighted desc, name asc',
  14 + :per_page => @profile.products_per_catalog_page,
  15 + :page => options[:page]
  16 + )
13 17 end
14 18  
15 19 def breadcrumb(category)
... ... @@ -20,20 +24,24 @@ module CatalogHelper
20 24 content_tag('div', all_items.join(' &rarr; '), :id => 'breadcrumb')
21 25 end
22 26  
23   - def category_link(category, sub = false)
  27 + def category_link(category)
24 28 count = profile.products.from_category(category).count
25 29 name = truncate(category.name, :length => 22 - count.to_s.size)
26   - link_name = sub ? name : content_tag('strong', name)
27   - link = link_to(link_name, {:controller => :catalog, :action => 'index', :level => category.id}, :title => category.name)
28   - content_tag('li', "#{link} (#{count})") if count > 0
  30 + link = link_to(name, {:controller => 'catalog', :action => 'index', :level => category.id}, :title => category.name)
  31 + content_tag('div', "#{link} <span class=\"count\">#{count}</span>") if count > 0
29 32 end
30 33  
31   - def category_sub_links(category)
  34 + def category_with_sub_list(category)
  35 + content_tag 'li', "#{category_link(category)}\n#{sub_category_list(category)}"
  36 + end
  37 +
  38 + def sub_category_list(category)
32 39 sub_categories = []
33 40 category.children.order(:name).each do |sub_category|
34   - sub_categories << category_link(sub_category, true)
  41 + cat_link = category_link sub_category
  42 + sub_categories << content_tag('li', cat_link) unless cat_link.nil?
35 43 end
36   - content_tag('ul', sub_categories) if sub_categories.size > 1
  44 + content_tag('ul', sub_categories) if sub_categories.size > 0
37 45 end
38 46  
39 47 end
... ...
app/helpers/cms_helper.rb
... ... @@ -22,9 +22,9 @@ module CmsHelper
22 22  
23 23 attr_reader :environment
24 24  
25   - def options_for_article(article)
  25 + def options_for_article(article, tokenized_children=nil)
26 26 article_helper = helper_for_article(article)
27   - article_helper.custom_options_for_article(article)
  27 + article_helper.custom_options_for_article(article, tokenized_children)
28 28 end
29 29  
30 30 def link_to_article(article)
... ...
app/helpers/comment_helper.rb
... ... @@ -25,7 +25,10 @@ module CommentHelper
25 25 def comment_actions(comment)
26 26 url = url_for(:profile => profile.identifier, :controller => :comment, :action => :check_actions, :id => comment.id)
27 27 links = links_for_comment_actions(comment)
28   - content_tag(:li, link_to(content_tag(:span, _('Contents menu')), '#', :onclick => "toggleSubmenu(this,'',#{links.to_json}); return false", :class => 'menu-submenu-trigger comment-trigger', :url => url), :class=> 'vcard') unless links.empty?
  28 + links_submenu = links.select{|link| link[:action_bar].blank?}
  29 + links_action_bar = links - links_submenu
  30 + links_submenu = links_submenu.collect {|link| link.slice(:link)}
  31 + render :partial => 'comment/comment_actions', :locals => {:links_submenu => links_submenu, :links_action_bar => links_action_bar, :url => url, :comment => comment}
29 32 end
30 33  
31 34 private
... ...
app/helpers/folder_helper.rb
1 1 module FolderHelper
2 2  
3 3 include ShortFilename
  4 + include ArticleHelper
4 5  
5 6 def list_articles(articles, recursive = false)
6 7 if !articles.blank?
... ... @@ -60,19 +61,10 @@ module FolderHelper
60 61 "icon-new icon-new%s" % klass.icon_name
61 62 end
62 63  
63   - def custom_options_for_article(article)
  64 + def custom_options_for_article(article,tokenized_children)
64 65 @article = article
65   - content_tag('h4', _('Visibility')) +
66   - content_tag('div',
67   - content_tag('div',
68   - radio_button(:article, :published, true) +
69   - content_tag('label', _('Public (visible to other people)'), :for => 'article_published_true')
70   - ) +
71   - content_tag('div',
72   - radio_button(:article, :published, false) +
73   - content_tag('label', _('Private'), :for => 'article_published_false')
74   - )
75   - ) +
  66 +
  67 + visibility_options(article,tokenized_children) +
76 68 content_tag('div',
77 69 hidden_field_tag('article[accept_comments]', 0)
78 70 )
... ...
app/helpers/profile_helper.rb
... ... @@ -16,14 +16,17 @@ module ProfileHelper
16 16 end
17 17  
18 18 def display_contact(profile)
19   - address = display_field(_('Address:'), profile, :address)
20   - zip = display_field(_('ZIP code:'), profile, :zip_code)
21   - phone = display_field(_('Contact phone:'), profile, :contact_phone)
22   - email = display_field(_('e-Mail:'), profile, :email) { |email| link_to_email(email) }
23   - if address.blank? && zip.blank? && phone.blank? && email.blank?
  19 + fields = []
  20 + fields << display_field(_('Address:'), profile, :address).html_safe
  21 + fields << display_field(_('ZIP code:'), profile, :zip_code).html_safe
  22 + fields << display_field(_('Contact phone:'), profile, :contact_phone).html_safe
  23 + fields << display_field(_('e-Mail:'), profile, :email) { |email| link_to_email(email) }.html_safe
  24 + fields << display_field(_('Personal website:'), profile, :personal_website).html_safe
  25 + fields << display_field(_('Jabber:'), profile, :jabber_id).html_safe
  26 + if fields.reject!(&:blank?).empty?
24 27 ''
25 28 else
26   - content_tag('tr', content_tag('th', _('Contact'), { :colspan => 2 })) + address + zip + phone + email
  29 + content_tag('tr', content_tag('th', _('Contact'), { :colspan => 2 })) + fields.join.html_safe
27 30 end
28 31 end
29 32  
... ...
app/helpers/token_helper.rb 0 → 100644
... ... @@ -0,0 +1,51 @@
  1 +module TokenHelper
  2 +
  3 + def jquery_token_input_messages_json(hintText = _('Type in an keyword'), noResultsText = _('No results'), searchingText = _('Searching...'))
  4 + "hintText: '#{hintText}', noResultsText: '#{noResultsText}', searchingText: '#{searchingText}'"
  5 + end
  6 +
  7 + def token_input_field_tag(name, element_id, search_action, options = {}, text_field_options = {}, html_options = {})
  8 + options[:min_chars] ||= 3
  9 + options[:hint_text] ||= _("Type in a search term")
  10 + options[:no_results_text] ||= _("No results")
  11 + options[:searching_text] ||= _("Searching...")
  12 + options[:search_delay] ||= 1000
  13 + options[:prevent_duplicates] ||= true
  14 + options[:backspace_delete_item] ||= false
  15 + options[:focus] ||= false
  16 + options[:avoid_enter] ||= true
  17 + options[:on_result] ||= 'null'
  18 + options[:on_add] ||= 'null'
  19 + options[:on_delete] ||= 'null'
  20 + options[:on_ready] ||= 'null'
  21 +
  22 + result = text_field_tag(name, nil, text_field_options.merge(html_options.merge({:id => element_id})))
  23 + result += javascript_tag("jQuery('##{element_id}')
  24 + .tokenInput('#{url_for(search_action)}', {
  25 + minChars: #{options[:min_chars].to_json},
  26 + prePopulate: #{options[:pre_populate].to_json},
  27 + hintText: #{options[:hint_text].to_json},
  28 + noResultsText: #{options[:no_results_text].to_json},
  29 + searchingText: #{options[:searching_text].to_json},
  30 + searchDelay: #{options[:serach_delay].to_json},
  31 + preventDuplicates: #{options[:prevent_duplicates].to_json},
  32 + backspaceDeleteItem: #{options[:backspace_delete_item].to_json},
  33 + queryParam: #{name.to_json},
  34 + tokenLimit: #{options[:token_limit].to_json},
  35 + onResult: #{options[:on_result]},
  36 + onAdd: #{options[:on_add]},
  37 + onDelete: #{options[:on_delete]},
  38 + onReady: #{options[:on_ready]},
  39 + });
  40 + ")
  41 + result += javascript_tag("jQuery('##{element_id}').focus();") if options[:focus]
  42 + if options[:avoid_enter]
  43 + result += javascript_tag("jQuery('#token-input-#{element_id}')
  44 + .live('keydown', function(event){
  45 + if(event.keyCode == '13') return false;
  46 + });")
  47 + end
  48 + result
  49 + end
  50 +
  51 +end
0 52 \ No newline at end of file
... ...
app/models/article.rb
... ... @@ -69,6 +69,7 @@ class Article &lt; ActiveRecord::Base
69 69 settings_items :allow_members_to_edit, :type => :boolean, :default => false
70 70 settings_items :moderate_comments, :type => :boolean, :default => false
71 71 settings_items :followers, :type => Array, :default => []
  72 + has_and_belongs_to_many :article_privacy_exceptions, :class_name => 'Person', :join_table => 'article_privacy_exceptions'
72 73  
73 74 belongs_to :reference_article, :class_name => "Article", :foreign_key => 'reference_article_id'
74 75  
... ... @@ -200,6 +201,7 @@ class Article &lt; ActiveRecord::Base
200 201 acts_as_filesystem
201 202  
202 203 acts_as_versioned
  204 + self.non_versioned_columns << 'setting'
203 205  
204 206 def comment_data
205 207 comments.map {|item| [item.title, item.body].join(' ') }.join(' ')
... ... @@ -448,8 +450,8 @@ class Article &lt; ActiveRecord::Base
448 450 end
449 451  
450 452 named_scope :published, :conditions => { :published => true }
451   - named_scope :folders, :conditions => { :type => folder_types}
452   - named_scope :no_folders, :conditions => ['type NOT IN (?)', folder_types]
  453 + named_scope :folders, lambda {|profile|{:conditions => { :type => profile.folder_types} }}
  454 + named_scope :no_folders, lambda {|profile|{:conditions => ['type NOT IN (?)', profile.folder_types]}}
453 455 named_scope :galleries, :conditions => { :type => 'Gallery' }
454 456 named_scope :images, :conditions => { :is_image => true }
455 457 named_scope :text_articles, :conditions => [ 'articles.type IN (?)', text_article_types ]
... ... @@ -470,7 +472,8 @@ class Article &lt; ActiveRecord::Base
470 472  
471 473 def display_unpublished_article_to?(user)
472 474 user == author || allow_view_private_content?(user) || user == profile ||
473   - user.is_admin?(profile.environment) || user.is_admin?(profile)
  475 + user.is_admin?(profile.environment) || user.is_admin?(profile) ||
  476 + article_privacy_exceptions.include?(user)
474 477 end
475 478  
476 479 def display_to?(user = nil)
... ... @@ -602,17 +605,34 @@ class Article &lt; ActiveRecord::Base
602 605 false
603 606 end
604 607  
605   - def author
606   - if versions.empty?
607   - last_changed_by
608   - else
609   - author_id = versions.first.last_changed_by_id
  608 + settings_items :display_versions, :type => :boolean, :default => false
  609 +
  610 + def can_display_versions?
  611 + false
  612 + end
  613 +
  614 + def display_versions?
  615 + can_display_versions? && display_versions
  616 + end
  617 +
  618 + def author(version_number = nil)
  619 + if version_number
  620 + version = versions.find_by_version(version_number)
  621 + author_id = version.last_changed_by_id if version
610 622 Person.exists?(author_id) ? Person.find(author_id) : nil
  623 + else
  624 + if versions.empty?
  625 + last_changed_by
  626 + else
  627 + author_id = versions.first.last_changed_by_id
  628 + Person.exists?(author_id) ? Person.find(author_id) : nil
  629 + end
611 630 end
612 631 end
613 632  
614   - def author_name
615   - author ? author.name : (setting[:author_name] || _('Unknown'))
  633 + def author_name(version_number = nil)
  634 + person = version_number ? author(version_number) : author
  635 + person ? person.name : (setting[:author_name] || _('Unknown'))
616 636 end
617 637  
618 638 def author_url
... ... @@ -623,13 +643,20 @@ class Article &lt; ActiveRecord::Base
623 643 author ? author.id : nil
624 644 end
625 645  
  646 + def version_license(version_number = nil)
  647 + return license if version_number.nil?
  648 + profile.environment.licenses.find_by_id(versions.find_by_version(version_number).license_id)
  649 + end
  650 +
626 651 alias :active_record_cache_key :cache_key
627 652 def cache_key(params = {}, the_profile = nil, language = 'en')
628 653 active_record_cache_key+'-'+language +
629 654 (allow_post_content?(the_profile) ? "-owner" : '') +
630 655 (params[:npage] ? "-npage-#{params[:npage]}" : '') +
631 656 (params[:year] ? "-year-#{params[:year]}" : '') +
632   - (params[:month] ? "-month-#{params[:month]}" : '')
  657 + (params[:month] ? "-month-#{params[:month]}" : '') +
  658 + (params[:version] ? "-version-#{params[:version]}" : '')
  659 +
633 660 end
634 661  
635 662 def first_paragraph
... ...
app/models/block.rb
... ... @@ -23,30 +23,41 @@ class Block &lt; ActiveRecord::Base
23 23 # * <tt>:article</tt>: the article being viewed currently
24 24 # * <tt>:language</tt>: in which language the block will be displayed
25 25 def visible?(context = nil)
26   - if display == 'never'
27   - return false
28   - end
  26 + return false if display == 'never'
  27 +
29 28 if context
30   - if language != 'all' && language != context[:locale]
31   - return false
32   - end
33   - if display == 'home_page_only'
34   - if context[:article]
35   - return context[:article] == owner.home_page
36   - else
37   - return context[:request_path] == '/'
38   - end
39   - elsif display == 'except_home_page'
40   - if context[:article]
41   - return context[:article] != owner.home_page
42   - else
43   - return context[:request_path] != '/' + owner.identifier
44   - end
  29 + return false if language != 'all' && language != context[:locale]
  30 +
  31 + begin
  32 + return self.send("display_#{display}", context)
  33 + rescue NoMethodError => exception
  34 + raise "Display '#{display}' is not a valid value."
45 35 end
46 36 end
  37 +
  38 + true
  39 + end
  40 +
  41 + def display_always(context)
47 42 true
48 43 end
49 44  
  45 + def display_home_page_only(context)
  46 + if context[:article]
  47 + return context[:article] == owner.home_page
  48 + else
  49 + return context[:request_path] == '/'
  50 + end
  51 + end
  52 +
  53 + def display_except_home_page(context)
  54 + if context[:article]
  55 + return context[:article] != owner.home_page
  56 + else
  57 + return context[:request_path] != '/' + (owner.kind_of?(Profile) ? owner.identifier : '')
  58 + end
  59 + end
  60 +
50 61 # The condition for displaying a block. It can assume the following values:
51 62 #
52 63 # * <tt>'always'</tt>: the block is always displayed
... ... @@ -153,4 +164,29 @@ class Block &lt; ActiveRecord::Base
153 164 }
154 165 end
155 166  
  167 + DISPLAY_OPTIONS = {
  168 + 'always' => __('In all pages'),
  169 + 'home_page_only' => __('Only in the homepage'),
  170 + 'except_home_page' => __('In all pages, except in the homepage'),
  171 + 'never' => __('Don\'t display'),
  172 + }
  173 +
  174 + def display_options
  175 + DISPLAY_OPTIONS.keys
  176 + end
  177 +
  178 + def display_option_label(option)
  179 + DISPLAY_OPTIONS[option]
  180 + end
  181 +
  182 + def duplicate
  183 + duplicated_block = self.clone
  184 + duplicated_block.display = 'never'
  185 + duplicated_block.created_at = nil
  186 + duplicated_block.updated_at = nil
  187 + duplicated_block.save!
  188 + duplicated_block.insert_at(self.position + 1)
  189 + duplicated_block
  190 + end
  191 +
156 192 end
... ...
app/models/blog.rb
... ... @@ -6,7 +6,7 @@ class Blog &lt; Folder
6 6 #FIXME This should be used until there is a migration to fix all blogs that
7 7 # already have folders inside them
8 8 def posts_with_no_folders
9   - posts_without_no_folders.no_folders
  9 + posts_without_no_folders.no_folders(profile)
10 10 end
11 11 alias_method_chain :posts, :no_folders
12 12  
... ...
app/models/box.rb
... ... @@ -10,7 +10,7 @@ class Box &lt; ActiveRecord::Base
10 10 end
11 11  
12 12 def acceptable_blocks
13   - blocks_classes = central? ? Box.acceptable_center_blocks + plugins.dispatch(:extra_blocks, :position => 1) : Box.acceptable_side_blocks + plugins.dispatch(:extra_blocks, :position => [2, 3])
  13 + blocks_classes = central? ? Box.acceptable_center_blocks + plugins.dispatch(:extra_blocks, :type => owner.class, :position => 1) : Box.acceptable_side_blocks + plugins.dispatch(:extra_blocks, :type => owner.class, :position => [2, 3])
14 14 to_css_class_name(blocks_classes)
15 15 end
16 16  
... ... @@ -64,6 +64,7 @@ class Box &lt; ActiveRecord::Base
64 64 MyNetworkBlock,
65 65 PeopleBlock,
66 66 ProductsBlock,
  67 + ProductCategoriesBlock,
67 68 ProfileImageBlock,
68 69 ProfileInfoBlock,
69 70 ProfileSearchBlock,
... ...
app/models/enterprise.rb
... ... @@ -10,7 +10,7 @@ class Enterprise &lt; Organization
10 10  
11 11 N_('Enterprise')
12 12  
13   - has_many :products, :dependent => :destroy, :order => 'name ASC'
  13 + has_many :products, :foreign_key => :profile_id, :dependent => :destroy, :order => 'name ASC'
14 14 has_many :inputs, :through => :products
15 15 has_many :production_costs, :as => :owner
16 16  
... ... @@ -23,6 +23,7 @@ class Enterprise &lt; Organization
23 23 N_('Organization website'); N_('Historic and current context'); N_('Activities short description'); N_('City'); N_('State'); N_('Country'); N_('ZIP code')
24 24  
25 25 settings_items :organization_website, :historic_and_current_context, :activities_short_description, :zip_code, :city, :state, :country
  26 + settings_items :products_per_catalog_page, :type => :integer, :default => 6
26 27  
27 28 extend SetProfileRegionFromCityState::ClassMethods
28 29 set_profile_region_from_city_state
... ... @@ -131,8 +132,11 @@ class Enterprise &lt; Organization
131 132 ]
132 133 blocks = [
133 134 [MainBlock.new],
134   - [ProfileImageBlock.new, LinkListBlock.new(:links => links)],
135   - []
  135 + [ ProfileImageBlock.new,
  136 + LinkListBlock.new(:links => links),
  137 + ProductCategoriesBlock.new
  138 + ],
  139 + [LocationBlock.new]
136 140 ]
137 141 if environment.enabled?('products_for_enterprises')
138 142 blocks[2].unshift ProductsBlock.new
... ...
app/models/environment.rb
... ... @@ -26,7 +26,8 @@ class Environment &lt; ActiveRecord::Base
26 26 'manage_environment_users' => N_('Manage environment users'),
27 27 'manage_environment_templates' => N_('Manage environment templates'),
28 28 'manage_environment_licenses' => N_('Manage environment licenses'),
29   - 'manage_environment_trusted_sites' => N_('Manage environment trusted sites')
  29 + 'manage_environment_trusted_sites' => N_('Manage environment trusted sites'),
  30 + 'edit_appearance' => N_('Edit appearance'),
30 31 }
31 32  
32 33 module Roles
... ... @@ -677,6 +678,16 @@ class Environment &lt; ActiveRecord::Base
677 678 end
678 679 end
679 680  
  681 + def update_theme(theme)
  682 + self.theme = theme
  683 + self.save!
  684 + end
  685 +
  686 + def update_layout_template(template)
  687 + self.layout_template = template
  688 + self.save!
  689 + end
  690 +
680 691 before_create do |env|
681 692 env.settings[:themes] ||= %w[
682 693 aluminium
... ... @@ -692,7 +703,8 @@ class Environment &lt; ActiveRecord::Base
692 703 end
693 704  
694 705 def community_template
695   - Community.find_by_id settings[:community_template_id]
  706 + template = Community.find_by_id settings[:community_template_id]
  707 + template if template && template.is_template
696 708 end
697 709  
698 710 def community_template=(value)
... ... @@ -700,7 +712,8 @@ class Environment &lt; ActiveRecord::Base
700 712 end
701 713  
702 714 def person_template
703   - Person.find_by_id settings[:person_template_id]
  715 + template = Person.find_by_id settings[:person_template_id]
  716 + template if template && template.is_template
704 717 end
705 718  
706 719 def person_template=(value)
... ... @@ -708,7 +721,8 @@ class Environment &lt; ActiveRecord::Base
708 721 end
709 722  
710 723 def enterprise_template
711   - Enterprise.find_by_id settings[:enterprise_template_id]
  724 + template = Enterprise.find_by_id settings[:enterprise_template_id]
  725 + template if template && template.is_template
712 726 end
713 727  
714 728 def enterprise_template=(value)
... ... @@ -716,7 +730,8 @@ class Environment &lt; ActiveRecord::Base
716 730 end
717 731  
718 732 def inactive_enterprise_template
719   - Enterprise.find_by_id settings[:inactive_enterprise_template_id]
  733 + template = Enterprise.find_by_id settings[:inactive_enterprise_template_id]
  734 + template if template && template.is_template
720 735 end
721 736  
722 737 def inactive_enterprise_template=(value)
... ... @@ -798,7 +813,7 @@ class Environment &lt; ActiveRecord::Base
798 813 end
799 814  
800 815 def highlighted_products_with_image(options = {})
801   - Product.find(:all, {:conditions => {:highlighted => true, :enterprise_id => self.enterprises.find(:all, :select => :id) }, :joins => :image}.merge(options))
  816 + Product.find(:all, {:conditions => {:highlighted => true, :profile_id => self.enterprises.find(:all, :select => :id) }, :joins => :image}.merge(options))
802 817 end
803 818  
804 819 settings_items :home_cache_in_minutes, :type => :integer, :default => 5
... ...
app/models/forum.rb
... ... @@ -3,6 +3,21 @@ class Forum &lt; Folder
3 3 acts_as_having_posts :order => 'updated_at DESC'
4 4 include PostsLimit
5 5  
  6 + settings_items :terms_of_use, :type => :string, :default => ""
  7 + settings_items :has_terms_of_use, :type => :boolean, :default => false
  8 + has_and_belongs_to_many :users_with_agreement, :class_name => 'Person', :join_table => 'terms_forum_people'
  9 +
  10 + before_save do |forum|
  11 + if forum.has_terms_of_use
  12 + last_editor = forum.profile.environment.people.find_by_id(forum.last_changed_by_id)
  13 + if last_editor && !forum.users_with_agreement.exists?(last_editor)
  14 + forum.users_with_agreement << last_editor
  15 + end
  16 + else
  17 + forum.users_with_agreement.clear
  18 + end
  19 + end
  20 +
6 21 def self.type_name
7 22 _('Forum')
8 23 end
... ... @@ -39,4 +54,16 @@ class Forum &lt; Folder
39 54 paragraphs = Hpricot(body).search('p')
40 55 paragraphs.empty? ? '' : paragraphs.first.to_html
41 56 end
  57 +
  58 + def add_agreed_user(user)
  59 + self.users_with_agreement << user
  60 + self.save
  61 + end
  62 +
  63 + def agrees_with_terms?(user)
  64 + return true unless self.has_terms_of_use
  65 + return false unless user
  66 + self.users_with_agreement.exists? user
  67 + end
  68 +
42 69 end
... ...
app/models/main_block.rb
... ... @@ -17,11 +17,15 @@ class MainBlock &lt; Block
17 17 end
18 18  
19 19 def editable?
20   - false
  20 + true
21 21 end
22 22  
23 23 def cacheable?
24   - false
  24 + false
  25 + end
  26 +
  27 + def display_options
  28 + ['always', 'except_home_page']
25 29 end
26 30  
27 31 end
... ...
app/models/members_block.rb
1 1 class MembersBlock < ProfileListBlock
  2 + settings_items :show_join_leave_button, :type => :boolean, :default => false
2 3  
3 4 def self.description
4 5 _('Members')
... ... @@ -14,8 +15,10 @@ class MembersBlock &lt; ProfileListBlock
14 15  
15 16 def footer
16 17 profile = self.owner
  18 + s = show_join_leave_button
  19 +
17 20 lambda do
18   - link_to _('View all'), :profile => profile.identifier, :controller => 'profile', :action => 'members'
  21 + render :file => 'blocks/members', :locals => { :profile => profile, :show_join_leave_button => s}
19 22 end
20 23 end
21 24  
... ... @@ -23,4 +26,14 @@ class MembersBlock &lt; ProfileListBlock
23 26 owner.members
24 27 end
25 28  
  29 + def extra_option
  30 + data = {
  31 + :human_name => _("Show join leave button"),
  32 + :name => 'block[show_join_leave_button]',
  33 + :value => true,
  34 + :checked => show_join_leave_button,
  35 + :options => {}
  36 + }
  37 + end
  38 +
26 39 end
... ...
app/models/person.rb
... ... @@ -43,7 +43,12 @@ class Person &lt; Profile
43 43 alias_method_chain :has_permission?, :plugins
44 44  
45 45 def memberships
46   - Profile.memberships_of(self)
  46 + scopes = []
  47 + plugins_scopes = plugins.dispatch_scopes(:person_memberships, self)
  48 + scopes = plugins_scopes unless plugins_scopes.first.blank?
  49 + scopes << Profile.memberships_of(self)
  50 + return scopes.first if scopes.size == 1
  51 + ScopeTool.union *scopes
47 52 end
48 53  
49 54 def memberships_by_role(role)
... ... @@ -63,6 +68,9 @@ class Person &lt; Profile
63 68  
64 69 has_many :scraps_sent, :class_name => 'Scrap', :foreign_key => :sender_id, :dependent => :destroy
65 70  
  71 + has_and_belongs_to_many :acepted_forums, :class_name => 'Forum', :join_table => 'terms_forum_people'
  72 + has_and_belongs_to_many :articles_with_access, :class_name => 'Article', :join_table => 'article_privacy_exceptions'
  73 +
66 74 named_scope :more_popular,
67 75 :select => "#{Profile.qualified_column_names}, count(friend_id) as total",
68 76 :group => Profile.qualified_column_names,
... ... @@ -137,32 +145,34 @@ class Person &lt; Profile
137 145 end
138 146  
139 147 FIELDS = %w[
  148 + description
  149 + image
140 150 preferred_domain
141 151 nickname
142 152 sex
143   - address
144   - zip_code
145   - city
146   - state
147   - country
148   - nationality
149 153 birth_date
  154 + nationality
  155 + country
  156 + state
  157 + city
  158 + district
  159 + zip_code
  160 + address
  161 + address_reference
150 162 cell_phone
151 163 comercial_phone
  164 + personal_website
  165 + jabber_id
152 166 schooling
  167 + formation
  168 + custom_formation
  169 + area_of_study
  170 + custom_area_of_study
153 171 professional_activity
154 172 organization
155 173 organization_website
156   - area_of_study
157   - custom_area_of_study
158   - formation
159   - custom_formation
160 174 contact_phone
161 175 contact_information
162   - description
163   - image
164   - district
165   - address_reference
166 176 ]
167 177  
168 178 validates_multiparameter_assignments
... ...
app/models/product.rb
... ... @@ -15,7 +15,11 @@ class Product &lt; ActiveRecord::Base
15 15 'full'
16 16 end
17 17  
18   - belongs_to :enterprise
  18 + belongs_to :enterprise, :foreign_key => :profile_id, :class_name => 'Profile'
  19 + belongs_to :profile
  20 + alias_method :enterprise=, :profile=
  21 + alias_method :enterprise, :profile
  22 +
19 23 has_one :region, :through => :enterprise
20 24 validates_presence_of :enterprise
21 25  
... ... @@ -29,7 +33,10 @@ class Product &lt; ActiveRecord::Base
29 33 has_many :qualifiers, :through => :product_qualifiers
30 34 has_many :certifiers, :through => :product_qualifiers
31 35  
32   - validates_uniqueness_of :name, :scope => :enterprise_id, :allow_nil => true
  36 + acts_as_having_settings :field => :data
  37 +
  38 + validates_uniqueness_of :name, :scope => :profile_id, :allow_nil => true, :if => :validate_uniqueness_of_column_name?
  39 +
33 40 validates_presence_of :product_category_id
34 41 validates_associated :product_category
35 42  
... ... @@ -234,4 +241,10 @@ class Product &lt; ActiveRecord::Base
234 241  
235 242 delegate :enabled, :region, :region_id, :environment, :environment_id, :to => :enterprise
236 243  
  244 + protected
  245 +
  246 + def validate_uniqueness_of_column_name?
  247 + true
  248 + end
  249 +
237 250 end
... ...
app/models/product_categories_block.rb 0 → 100644
... ... @@ -0,0 +1,50 @@
  1 +class ProductCategoriesBlock < Block
  2 +
  3 + def self.description
  4 + _('Product category menu')
  5 + end
  6 +
  7 + # the title of the block. Probably will be overriden in subclasses.
  8 + def default_title
  9 + _('Catalog')
  10 + end
  11 +
  12 + def help
  13 + _('Helps to filter the products catalog.')
  14 + end
  15 +
  16 + def content(args={})
  17 + profile = owner
  18 + lambda do
  19 + if @categories.nil? or @categories.length == 0
  20 + categories = ProductCategory.on_level().order(:name)
  21 + if @categories and @categories.length == 0
  22 + notice = _('There are no sub-categories for %s') % @category.name
  23 + end
  24 + else
  25 + categories = @categories
  26 + end
  27 + render :file => 'blocks/product_categories',
  28 + :locals => {
  29 + :profile => profile,
  30 + :categories => categories,
  31 + :notice => notice
  32 + }
  33 + end
  34 + end
  35 +
  36 + DISPLAY_OPTIONS['catalog_only'] = __('Only on the catalog')
  37 +
  38 + def display
  39 + settings[:display].nil? ? 'catalog_only' : super
  40 + end
  41 +
  42 + def display_catalog_only(context)
  43 + context[:params][:controller] == 'catalog'
  44 + end
  45 +
  46 + def visible?(*args)
  47 + box.environment.enabled?('products_for_enterprises') ? super(*args) : false
  48 + end
  49 +
  50 +end
... ...
app/models/profile.rb
... ... @@ -84,7 +84,8 @@ class Profile &lt; ActiveRecord::Base
84 84 def members
85 85 scopes = plugins.dispatch_scopes(:organization_members, self)
86 86 scopes << Person.members_of(self)
87   - scopes.size == 1 ? scopes.first : Person.or_scope(scopes)
  87 + return scopes.first if scopes.size == 1
  88 + ScopeTool.union *scopes
88 89 end
89 90  
90 91 def members_count
... ... @@ -761,8 +762,20 @@ private :generate_url, :url_options
761 762 !environment.enabled?('disable_contact_' + self.class.name.downcase)
762 763 end
763 764  
  765 + include Noosfero::Plugin::HotSpot
  766 +
  767 + def folder_types
  768 + types = Article.folder_types
  769 + plugins.dispatch(:content_types).each {|type|
  770 + if type < Folder
  771 + types << type.name
  772 + end
  773 + }
  774 + types
  775 + end
  776 +
764 777 def folders
765   - articles.folders
  778 + articles.folders(self)
766 779 end
767 780  
768 781 def image_galleries
... ...
app/models/profile_list_block.rb
... ... @@ -62,4 +62,8 @@ class ProfileListBlock &lt; Block
62 62 title.gsub('{#}', profile_count.to_s)
63 63 end
64 64  
  65 + # override in subclasses! See MembersBlock for example
  66 + def extra_option
  67 + {}
  68 + end
65 69 end
... ...
app/models/text_article.rb
... ... @@ -17,4 +17,7 @@ class TextArticle &lt; Article
17 17 end
18 18 end
19 19  
  20 + def can_display_versions?
  21 + true
  22 + end
20 23 end
... ...
app/views/admin_panel/index.rhtml
... ... @@ -6,6 +6,7 @@
6 6 <tr><td><%= link_to _('Environment settings'), :action => 'site_info' %></td></tr>
7 7 <tr><td><%= link_to _('Features'), :controller => 'features' %></td></tr>
8 8 <tr><td><%= link_to _('Plugins'), :controller => 'plugins' %></td></tr>
  9 + <tr><td><%= link_to _('Appearance'), :controller =>'environment_themes' %></td></tr>
9 10 <tr><td><%= link_to _('Sideboxes'), :controller => 'environment_design'%></td></tr>
10 11 <tr><td><%= link_to _('Homepage'), :action => 'set_portal_community' %></td></tr>
11 12 <tr><td><%= link_to _('Licenses'), :controller =>'licenses' %></td></tr>
... ...
app/views/blocks/members.rhtml 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +<%= link_to _('View all'), :profile => profile.identifier, :controller => 'profile', :action => 'members' %>
  2 +
  3 +<% if show_join_leave_button %>
  4 + <%= render :partial => 'blocks/profile_info_actions/join_leave_community' %>
  5 +<% end %>
... ...
app/views/blocks/product_categories.html.erb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +<%= link_to _('Catalog start'), profile.catalog_url, :class=>'catalog-home-link' %>
  2 +<ul class="catalog-categories-list">
  3 + <% categories.each do |category| %>
  4 + <%= category_with_sub_list(category) %>
  5 + <% end %>
  6 +</ul>
  7 +<% if notice %>
  8 + <div class="catalog-categories-notice"><%= notice %></div>
  9 +<% end %>
... ...
app/views/blocks/profile_image.rhtml
... ... @@ -14,11 +14,13 @@
14 14 <p><%= h block.owner.short_name %></p>
15 15 <% end %>
16 16  
17   -<div style="text-align: center; font-size: 75%; clear: both" id="profile-admin-url-<%= block.id %>"></div>
18   -
19   -<div class="profile-info-options" id="profile-info-options-<%= block.id %>"></div>
  17 +<% if !user.nil? and user.has_permission?('edit_profile', profile) %>
  18 + <div class='admin-link'>
  19 + <%= link_to _('Control panel'), :controller => 'profile_editor' %>
  20 + </div>
  21 +<% end %>
20 22  
  23 +<div class="profile-info-options">
  24 + <%= render :file => view_for_profile_actions(block.owner.class) %>
  25 +</div>
21 26 </div><!-- end class="vcard" -->
22   -<script type="text/javascript">
23   - <%= remote_function :url => { :controller => 'profile', :profile => profile.identifier, :action => 'profile_info', :block_id => block.id } %>
24   -</script>
... ...
app/views/blocks/profile_info.rhtml
... ... @@ -14,13 +14,15 @@
14 14 </div>
15 15 </div>
16 16  
17   -<ul class="profile-info-data" id="profile-info-data-<%= block.id %>">
  17 +<ul class="profile-info-data">
18 18 <li><%= link_to __('Homepage'), block.owner.url, :class => 'url' %></li>
19 19 <li><%= link_to _('View profile'), block.owner.public_profile_url %></li>
20 20 <% if block.owner.enterprise? && block.owner.environment.enabled?('products_for_enterprises') %>
21 21 <li><%= link_to(_('Products/Services'), :controller => 'catalog', :profile => block.owner.identifier) %></li>
22 22 <% end %>
23   - <li id="profile-admin-url-<%= block.id %>"></li>
  23 + <% if !user.nil? and user.has_permission?('edit_profile', profile) %>
  24 + <li><%= link_to _('Control panel'), :controller => 'profile_editor' %></li>
  25 + <% end %>
24 26 <% if profile.person? %>
25 27 <li><%= _('Since %{year}/%{month}') % { :year => block.owner.created_at.year, :month => block.owner.created_at.month } %></li>
26 28 <% end %>
... ... @@ -37,9 +39,8 @@
37 39 </div>
38 40 <% end %>
39 41  
40   -<div class="profile-info-options" id="profile-info-options-<%= block.id %>"></div>
  42 +<div class="profile-info-options">
  43 + <%= render :file => view_for_profile_actions(@block.owner.class) %>
  44 +</div>
41 45  
42 46 </div><!-- end class="vcard" -->
43   -<script type="text/javascript">
44   - <%= remote_function :url => { :controller => 'profile', :profile => profile.identifier, :action => 'profile_info', :block_id => block.id } %>
45   -</script>
... ...
app/views/blocks/profile_info_actions/_join_leave_community.rhtml 0 → 100644
... ... @@ -0,0 +1,29 @@
  1 +<div class='join-leave-button'>
  2 + <% if logged_in? %>
  3 + <% if profile.members.include?(user) %>
  4 + <%= button(:delete, content_tag('span', __('Leave community')), profile.leave_url,
  5 + :class => 'leave-community',
  6 + :title => _("Leave community"),
  7 + :style => 'position: relative;') %>
  8 + <%= button(:add, content_tag('span', __('Join')), profile.join_url,
  9 + :class => 'join-community',
  10 + :title => _("Join community"),
  11 + :style => 'position: relative; display: none;') %>
  12 + <% else %>
  13 + <% unless profile.already_request_membership?(user) %>
  14 + <%= button(:delete, content_tag('span', __('Leave community')), profile.leave_url,
  15 + :class => 'leave-community',
  16 + :title => _("Leave community"),
  17 + :style => 'position: relative; display: none;') %>
  18 + <%= button(:add, content_tag('span', __('Join')), profile.join_url,
  19 + :class => 'join-community',
  20 + :title => _("Join community"),
  21 + :style => 'position: relative;') %>
  22 + <% end %>
  23 + <% end %>
  24 + <% else %>
  25 + <%= link_to content_tag('span', _('Join')), profile.join_not_logged_url,
  26 + :class => 'button with-text icon-add',
  27 + :title => _('Join this community') %>
  28 + <% end %>
  29 +</div>
... ...
app/views/blocks/profile_info_actions/community.rhtml
1 1 <ul>
  2 + <li>
  3 + <%= render "blocks/profile_info_actions/join_leave_community" %>
  4 + </li>
2 5 <% if logged_in? %>
3   - <% if profile.members.include?(user) %>
4   - <li>
5   - <%= button(:delete, content_tag('span', __('Leave community')), profile.leave_url,
6   - :class => 'leave-community',
7   - :title => _("Leave community"),
8   - :style => 'position: relative;') %>
9   - <%= button(:add, content_tag('span', __('Join')), profile.join_url,
10   - :class => 'join-community',
11   - :title => _("Join community"),
12   - :style => 'position: relative; display: none;') %>
13   - </li>
14   - <% else %>
15   - <% unless profile.already_request_membership?(user) %>
16   - <li>
17   - <%= button(:delete, content_tag('span', __('Leave community')), profile.leave_url,
18   - :class => 'leave-community',
19   - :title => _("Leave community"),
20   - :style => 'position: relative; display: none;') %>
21   - <%= button(:add, content_tag('span', __('Join')), profile.join_url,
22   - :class => 'join-community',
23   - :title => _("Join community"),
24   - :style => 'position: relative;') %>
25   - </li>
26   - <% end %>
27   - <% end %>
28   -
29 6 <% if profile.enable_contact? %>
30 7 <li>
31 8 <%= link_to content_tag('span', _('Send an e-mail')),
... ... @@ -39,11 +16,5 @@
39 16 <li><%= report_abuse(profile, :button) %></li>
40 17  
41 18 <%= render_environment_features(:profile_actions) %>
42   - <% else %>
43   - <li>
44   - <%= link_to content_tag('span', _('Join')), profile.join_not_logged_url,
45   - :class => 'button with-text icon-add',
46   - :title => _('Join this community') %>
47   - </li>
48 19 <% end %>
49 20 -</ul>
  21 +</ul>
50 22 \ No newline at end of file
... ...
app/views/box_organizer/_link_list_block.rhtml
... ... @@ -23,7 +23,7 @@
23 23 content_tag('td', text_field_tag('block[links][][name]', '', :maxlength => 20)) +
24 24 content_tag('td', text_field_tag('block[links][][address]', nil, :class => 'link-address'), :class => 'cel-address') +
25 25 content_tag('td', select_tag('block[links][][target]',
26   -options_for_select(LinkListBlock::TARGET_OPTIONS, link[:target])))
  26 +options_for_select(LinkListBlock::TARGET_OPTIONS, '_self')))
27 27 ) +
28 28 javascript_tag("$('edit-link-list-block').scrollTop = $('edit-link-list-block').scrollHeight")
29 29 end %>
... ...
app/views/box_organizer/_profile_list_block.rhtml
... ... @@ -2,5 +2,8 @@
2 2 <%= labelled_form_field _('Limit of items'), text_field(:block, :limit, :size => 3) %>
3 3 <%= check_box(:block, :prioritize_profiles_with_image) %>
4 4 <label for="block_prioritize_profiles_with_image"><%= _('Prioritize profiles with image') %></label>
5   -</div>
6 5  
  6 + <div>
  7 + <%= extra_option_checkbox(@block.extra_option) %>
  8 + </div>
  9 +</div>
7 10 \ No newline at end of file
... ...
app/views/box_organizer/edit.rhtml
1 1 <div class="block-config-options <%= @block.class.name %>-options">
2   - <h2 class="title"><%= _('Editing block') %></h2>
  2 + <h2 class="title"><%= _(@block.class.description) %></h2>
3 3  
4 4 <% form_tag(:action => 'save', :id => @block.id) do %>
5 5  
... ... @@ -9,17 +9,11 @@
9 9  
10 10 <%= labelled_form_field _('Display this block:'), '' %>
11 11 <div style='margin-left: 10px'>
12   - <%= radio_button(:block, :display, 'always') %>
13   - <%= label_tag('block_display_always', _('In all pages')) %>
14   - <br/>
15   - <%= radio_button(:block, :display, 'home_page_only') %>
16   - <%= label_tag('block_display_home_page_only', _('Only in the homepage')) %>
17   - <br/>
18   - <%= radio_button(:block, :display, 'except_home_page') %>
19   - <%= label_tag('block_display_except_home_page', _('In all pages, except in the homepage')) %>
20   - <br/>
21   - <%= radio_button(:block, :display, 'never') %>
22   - <%= label_tag('block_display_never', _("Don't display")) %>
  12 + <% @block.display_options.each do |option| %>
  13 + <%= radio_button(:block, :display, option) %>
  14 + <%= label_tag("block_display_#{option}", _(@block.display_option_label(option))) %>
  15 + <br/>
  16 + <% end %>
23 17 </div>
24 18  
25 19 <%= labelled_form_field(_('Show for:'), select(:block, :language, [ [ _('all languages'), 'all']] + environment.locales.map {|key, value| [value, key]} )) %>
... ...
app/views/catalog/index.rhtml
1 1 <% extra_content = [] %>
2 2 <% extra_content_list = [] %>
3 3  
4   -<h1><%= _('Products/Services') %></h1>
5   -
6   -<% if @categories %>
7   - <%= breadcrumb(@category) if params[:level] %>
8   -
9   - <div class='l-sidebar-left-bar'>
10   - <ul>
11   - <%= content_tag('li', link_to(_('Homepage'), profile.url), :class => 'catalog-categories-link') %>
12   - <%= content_tag('li', link_to(_('Catalog start'), profile.catalog_url), :class => 'catalog-categories-link') %>
13   - <% if @categories.present? %>
14   - <% @categories.each do |category| %>
15   - <%= category_link(category) %>
16   - <%= category_sub_links(category) %>
17   - <% end %>
18   - <% elsif @category.present? %>
19   - <%= content_tag('li', _('There are no sub-categories for %s') % @category.name, :id => 'catalog-categories-notice') %>
20   - <% else %>
21   - <%= content_tag('li', _('There are no categories available.'), :id => 'catalog-categories-notice') %>
22   - <% end %>
23   - </ul>
  4 +<div id="product-catalog">
  5 +<% if !user.nil? && ( user.is_admin?(profile.environment) || user.is_admin?(profile) ) %>
  6 + <div class="product-catalog-ctrl">
  7 + <%= button :product, _('Manage Products/Services'), :controller => 'manage_products' %>
24 8 </div>
25 9 <% end %>
26 10  
27   -<ul id="product-list" class="<%="l-sidebar-left-content" if @categories %>">
  11 +<h1><%= _('Products/Services') %></h1>
  12 +
  13 +<%= breadcrumb(@category) if params[:level] %>
  14 +
  15 +<ul id="product-list">
28 16 <% @products.each do |product| %>
29 17 <% extra_content = @plugins.dispatch(:catalog_item_extras, product).collect { |content| instance_eval(&content) } %>
30 18 <% extra_content_list = @plugins.dispatch(:catalog_list_item_extras, product).collect { |content| instance_eval(&content) } %>
... ... @@ -132,10 +120,11 @@
132 120 </ul>
133 121 </li>
134 122 <% end %>
135   -</ul>
  123 +</ul><!-- end id="product-list" -->
136 124  
137 125 <%= pagination_links @products, :params => {:controller => :catalog, :action => :index, :profile => profile.identifier} %>
138 126  
139 127 <%= add_zoom_to_images %>
140 128  
141 129 <br style="clear:both"/>
  130 +</div><!-- end id="product-catalog" -->
... ...
app/views/cms/_forum.rhtml
... ... @@ -11,3 +11,9 @@
11 11 <%= labelled_form_field(_('Description:'), text_area(:article, :body, :cols => 64, :rows => 10)) %>
12 12  
13 13 <%= labelled_form_field(_('Posts per page:'), f.select(:posts_per_page, Forum.posts_per_page_options)) %>
  14 +
  15 +<%= labelled_form_field(_('Has terms of use:'), check_box(:article, :has_terms_of_use))%>
  16 +
  17 +<div id="text_area_terms_of_use">
  18 + <%= labelled_form_field(_('Terms of use:'), text_area(:article, :terms_of_use, :class => 'mceEditor',:cols => 64, :rows => 10)) %>
  19 +</div>
... ...
app/views/cms/edit.rhtml
... ... @@ -9,6 +9,8 @@
9 9  
10 10 <%= hidden_field_tag('back_to', @back_to) %>
11 11  
  12 + <%= hidden_field_tag('success_back_to', @success_back_to) %>
  13 +
12 14 <%= render :partial => partial_for_class(@article.class), :locals => { :f => f } %>
13 15  
14 16 <% if environment.is_portal_community?(profile) %>
... ... @@ -33,11 +35,12 @@
33 35 <%= content_tag( 'small', _('Separate tags with commas') ) %>
34 36  
35 37 <div id='edit-article-options'>
36   - <%= options_for_article(@article) %>
  38 + <%= options_for_article(@article, @tokenized_children) %>
37 39 </div>
38 40  
39 41 <% button_bar do %>
40 42 <%= submit_button :save, _('Save') %>
  43 +
41 44 <% if @back_to %>
42 45 <%= button :cancel, _('Cancel'), @back_to %>
43 46 <% elsif @parent_id || @article.parent %>
... ... @@ -45,6 +48,11 @@
45 48 <% else %>
46 49 <%= button :cancel, _('Cancel'), :action => 'index' %>
47 50 <% end %>
  51 +
  52 + <% unless @article.new_record? %>
  53 + <%= button :delete, _('Delete'), {:controller => :cms, :action => :destroy, :id => @article},
  54 + :method => :post, :confirm => delete_article_message(@article) %>
  55 + <% end %>
48 56 <% end %>
49 57 <% end %>
50 58 </div>
... ... @@ -54,3 +62,5 @@
54 62 <% end %>
55 63  
56 64 <br style='clear: both'/>
  65 +
  66 +<%= javascript_include_tag "article.js" %>
... ...
app/views/comment/_comment.rhtml
... ... @@ -32,19 +32,7 @@
32 32  
33 33 <div class="comment-details">
34 34 <div class="comment-header">
35   - <ul>
36   - <div class="comment-actions">
37   - <%= comment_actions(comment) %>
38   - </div>
39   - </ul>
40   - <% unless comment.spam? %>
41   - <%= link_to_function '',
42   - "var f = add_comment_reply_form(this, %s); f.find('comment_title, textarea').val(''); return false" % comment.id,
43   - :class => 'comment-footer comment-footer-link comment-footer-hide comment-actions-reply button',
44   - :id => 'comment-reply-to-' + comment.id.to_s,
45   - :title => _('Reply')
46   - %>
47   - <% end %>
  35 + <%= comment_actions(comment) %>
48 36 </div>
49 37  
50 38 <div class="comment-created-at">
... ... @@ -55,6 +43,7 @@
55 43 <p/>
56 44 <%= txt2html comment.body %>
57 45 </div>
  46 + <%= @plugins.dispatch(:comment_extra_contents, local_assigns).collect { |content| instance_eval(&content) }.join("") %>
58 47 </div>
59 48  
60 49 <div class="comment_reply post_comment_box closed" id="comment_reply_to_<%= comment.id %>">
... ...
app/views/comment/_comment_actions.rhtml 0 → 100644
... ... @@ -0,0 +1,22 @@
  1 +<ul>
  2 + <% if !links_submenu.empty? %>
  3 + <div class="comment-actions">
  4 + <li class="vcard">
  5 + <%= link_to(content_tag(:span, _('Contents menu')), '#', :onclick => "toggleSubmenu(this,'',#{links_submenu.to_json}); return false", :class => 'menu-submenu-trigger comment-trigger', :url => url) %>
  6 + </li>
  7 + </div>
  8 + <% end %>
  9 +</ul>
  10 +<div class="comments-action-bar">
  11 + <% unless comment.spam? %>
  12 + <%= link_to_function '',
  13 + "var f = add_comment_reply_form(this, %s); f.find('comment_title, textarea').val(''); return false" % comment.id,
  14 + :class => 'comment-footer comment-footer-link comment-footer-hide comment-actions-reply button',
  15 + :id => 'comment-reply-to-' + comment.id.to_s,
  16 + :title => _('Reply')
  17 + %>
  18 + <% end %>
  19 + <% links_action_bar.collect do |link| %>
  20 + <%= link[:link] %>
  21 + <% end %>
  22 +</div>
... ...
app/views/content_viewer/_article_toolbar.rhtml
... ... @@ -48,6 +48,10 @@
48 48 <%= expirable_button @page, :suggest, content, url, options %>
49 49 <% end %>
50 50  
  51 + <% if @page.display_versions? %>
  52 + <%= button(:clock, _('All versions'), {:controller => 'content_viewer', :profile => profile.identifier, :action => 'article_versions'}, :id => 'article-versions-link') %>
  53 + <% end %>
  54 +
51 55 <%= report_abuse(profile, :link, @page) %>
52 56  
53 57 </div>
... ... @@ -56,6 +60,7 @@
56 60 <div class="blog-cover"><%= image_tag(@page.image.public_filename())%></div>
57 61 <% end %>
58 62 <%= link_to(image_tag('icons-mime/rss-feed.png'), @page.feed.url, :class => 'blog-feed-link') if @page.has_posts? && @page.feed %>
  63 + <%= @plugins.dispatch(:article_header_extra_contents, @page).collect { |content| instance_eval(&content) }.join("") %>
59 64 <%= article_title(@page, :no_link => true) %>
60 65 <%= article_translations(@page) %>
61 66 </div>
... ...
app/views/content_viewer/article_versions.rhtml 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +<%= article_title(@page, :no_link => true) %>
  2 +
  3 +<p><%= _('This is the list of all versions of this content. Select a version to see it and then revert to it.') %>.</p>
  4 +
  5 +<ul class='article-versions'>
  6 + <% @versions.each do |v| %>
  7 + <li>
  8 + <%= link_to(_("Version #{v.version}"), @page.url.merge(:version => v.version)) %>
  9 + <%= @page.version == v.version ? _('(current)') : '' %>
  10 + <span class='updated-by'><%= _('by %{author}') % {:author => link_to(@page.author_name(v.version), @page.author_url)} %></span>
  11 + <div class='updated-on'><%= show_time(v.updated_at) %></div>
  12 + </li>
  13 + <% end %>
  14 +</ul>
  15 +
  16 +<%= pagination_links @versions, :param_name => 'npage' %>
... ...
app/views/content_viewer/forum_page.rhtml
1 1 <% add_rss_feed_to_head(@page.name, @page.feed.url) if @page.forum? && @page.feed %>
  2 +<% if @page.agrees_with_terms?(user) %>
2 3  
3   -<div>
4   - <div class='forum-description'>
5   - <%= @page.body %>
  4 + <div>
  5 + <div class='forum-description'>
  6 + <%= @page.body %>
  7 + </div>
6 8 </div>
7   -</div>
8   -<hr class="pre-posts"/>
9   -<div class="forum-posts">
10   - <%= (@posts.compact.empty? ? content_tag('em', _('(no posts)')) : list_forum_posts(@posts)) %>
11   -</div>
  9 + <hr class="pre-posts"/>
  10 + <div class="forum-posts">
  11 + <%= (@posts.compact.empty? ? content_tag('em', _('(no posts)')) : list_forum_posts(@posts)) %>
  12 + </div>
  13 +
  14 +<% else %>
  15 +
  16 + <p><%= @page.terms_of_use %></p>
  17 +
  18 + <% form_tag @page.url.merge(:terms_accepted => true) do %>
  19 + <% button_bar do %>
  20 + <% if user %>
  21 + <%= submit_button :save, _("Accept") %>
  22 + <% else %>
  23 + <%= button :save, _("Accept"), login_url %>
  24 + <% end %>
  25 + <%= button :cancel, _("Cancel"), profile.url %>
  26 + <% end %>
  27 + <% end %>
  28 +<% end %>
... ...
app/views/content_viewer/versioned_article.rhtml 0 → 100644
... ... @@ -0,0 +1,43 @@
  1 +<div id="article" class="<%= @page.css_class_name %>">
  2 +
  3 + <div id="article-actions">
  4 + <%= button(:clock, _('All versions'), {:controller => 'content_viewer', :profile => profile.identifier, :action => 'article_versions'}, :id => 'article-versions-link') %>
  5 +
  6 + <% if @page.allow_edit?(user) && !remove_content_button(:edit) %>
  7 + <% content = content_tag('span', _('Revert to this version')) %>
  8 + <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id, :version => @version }) %>
  9 + <%= expirable_button @page, :edit, content, url, :id => 'article-revert-version-link' %>
  10 + <% end %>
  11 + </div>
  12 +
  13 + <div id="article-header">
  14 + <h1 class='title'><%= @versioned_article.name %></h1>
  15 + <%= _("Version %{version} - %{author} on %{date}") % {:version => @version, :author => @page.author_name(@version), :date => show_time(@versioned_article.updated_at) } %>
  16 + </div>
  17 +
  18 + <% version_license = @page.version_license(@version) %>
  19 + <%# This seemingly doubled verification exists because the article-sub-header
  20 + div must appear only if at least one content inside it will appeart.
  21 + Although we have only one content now, we might have others in the future.
  22 + So we're keeping it like that to avoid mistakes. %>
  23 + <% if version_license.present? %>
  24 + <div id='article-sub-header'>
  25 + <% if version_license.present? %>
  26 + <div id="article-license">
  27 + <%= _('Licensed under %s') % (version_license.url.present? ? link_to(version_license.name, version_license.url, :target => '_blank') : version_license.name) %>
  28 + </div>
  29 + <% end %>
  30 + </div>
  31 + <% end %>
  32 +
  33 + <% cache(@page.cache_key(params, user, language)) do %>
  34 + <div class="<%="article-body article-body-" + @page.css_class_name %>">
  35 + <%= @versioned_article.body %>
  36 + <br style="clear:both" />
  37 + </div> <!-- end class="article-body" -->
  38 + <% end %>
  39 +
  40 + <%= display_source_info(@page) %>
  41 +
  42 +</div><!-- end id="article" -->
  43 +<%= add_zoom_to_article_images %>
... ...
app/views/content_viewer/view_page.rhtml
... ... @@ -15,16 +15,14 @@
15 15 </script>
16 16  
17 17 <% if @page.parent && !@page.parent.path.blank? %>
18   -<div id="article-parent">
19   - <%= button(:back, _('Go back to %s') % @page.parent.short_title, @page.parent.url) %>
20   -</div>
  18 + <div id="article-parent">
  19 + <%= button(:back, _('Go back to %s') % @page.parent.short_title, @page.parent.url) %>
  20 + </div>
21 21 <% end %>
22 22  
23   -<div id="article-toolbar"></div>
24   -
25   -<script type="text/javascript">
26   - <%= remote_function :update => "article-toolbar", :url => @page.url.merge({ :toolbar => true, :only_path => true }) %>
27   -</script>
  23 +<div id="article-toolbar">
  24 + <%= render :partial => 'article_toolbar' %>
  25 +</div>
28 26  
29 27 <% if @page.display_hits? || @page.license.present? %>
30 28 <div id='article-sub-header'>
... ...
app/views/environment_themes/index.rhtml 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +<%= render :partial => 'themes/select_template' %>
  2 +<%= render :partial => 'themes/select_theme' %>
  3 +
  4 +<br style="clear:both" />
  5 +
  6 +<% button_bar do %>
  7 + <%= button(:back, _('Back'), :controller => 'admin_panel', :action => 'index') %>
  8 +<% end %>
... ...
app/views/layouts/application-ng.rhtml
... ... @@ -22,7 +22,7 @@
22 22 DEFAULT_LOADING_MESSAGE = <%="'#{ _('loading...') }'" %>;
23 23 </script>
24 24 </head>
25   - <body class="<%= body_classes %>">
  25 + <body class="<%= h body_classes %>">
26 26 <a href="#content" id="link-go-content"><span><%= _("Go to the content") %></span></a>
27 27  
28 28 <%=
... ...
app/views/profile/_create_article.rhtml
... ... @@ -4,7 +4,7 @@
4 4 <div class='profile-activity-description profile-activity-article-<%= activity.target.class.icon_name %>'>
5 5 <p class='profile-activity-text'>
6 6 <%= link_to activity.user.short_name(20), activity.user.url %>
7   - <%= _("on community %s") % link_to(activity.target.profile.short_name(20), activity.target.profile.url) if activity.target.profile.is_a?(Community) %>
  7 + <%= _("has published on community %s") % link_to(activity.target.profile.short_name(20), activity.target.profile.url) if activity.target.profile.is_a?(Community) %>
8 8 </p>
9 9 <div class='profile-activity-lead'>
10 10 <div class='article-name'><%= link_to(activity.params['name'], activity.params['url']) %></div>
... ...
app/views/profile/index.rhtml
... ... @@ -19,22 +19,21 @@
19 19 <table class='profile'>
20 20 <tr>
21 21 <td colspan='2'>
22   - <% plugins_tabs = @plugins.dispatch(:profile_tabs).
23   - map { |tab| {:title => tab[:title], :id => tab[:id], :content => instance_eval(&tab[:content]), :start => tab[:title]} }%>
  22 + <% plugins_tabs = @plugins.dispatch(:profile_tabs).map { |tab| {:title => tab[:title], :id => tab[:id], :content => instance_eval(&tab[:content]), :start => tab[:title]} }%>
24 23  
25 24 <% tabs = plugins_tabs.select { |tab| tab[:start] } %>
26 25  
27 26 <% if @profile.organization? %>
28   - <% tabs << {:title => _('Profile'), :id => 'organization-profile', :content => (render :partial => 'organization_profile')} %>
29 27 <% if logged_in? && current_person.follows?(@profile) %>
30 28 <% tabs << {:title => _('Wall'), :id => 'profile-wall', :content => (render :partial => 'profile_wall')} %>
31 29 <% end %>
  30 + <% tabs << {:title => _('Profile'), :id => 'organization-profile', :content => (render :partial => 'organization_profile')} %>
32 31 <% elsif @profile.person? %>
33   - <% tabs << {:title => _('Profile'), :id => 'person-profile', :content => (render :partial => 'person_profile')} %>
34 32 <% if logged_in? && current_person.follows?(@profile) %>
35 33 <% tabs << {:title => _('Wall'), :id => 'profile-wall', :content => (render :partial => 'profile_wall')} %>
36 34 <% tabs << {:title => _('Network'), :id => 'profile-network', :content => (render :partial => 'profile_network')} %>
37 35 <% end %>
  36 + <% tabs << {:title => _('Profile'), :id => 'person-profile', :content => (render :partial => 'person_profile')} %>
38 37 <% end %>
39 38  
40 39 <% tabs += plugins_tabs.select { |tab| !tab[:start] } %>
... ...
app/views/profile/profile_info.rjs
... ... @@ -1,6 +0,0 @@
1   -if !user.nil? and user.has_permission?('edit_profile', profile)
2   - page.replace_html "profile-admin-url-#{@block.id}", link_to(_('Control panel'), @block.owner.admin_url)
3   -else
4   - page.hide "profile-admin-url-#{@block.id}"
5   -end
6   -page.replace_html "profile-info-options-#{@block.id}", :file => view_for_profile_actions(@block.owner.class)
app/views/profile_editor/_organization.rhtml
... ... @@ -65,3 +65,8 @@
65 65 <%= labelled_check_box(_('Enable "contact us"'), 'profile_data[enable_contact_us]', "1", @profile.enable_contact_us) if @profile.enterprise? %>
66 66  
67 67 <%= render :partial => 'moderation', :locals => { :profile => @profile } %>
  68 +
  69 +<% if profile.enterprise? && profile.environment.enabled?('products_for_enterprises') %>
  70 + <h2><%=_('Products/Services catalog')%></h2>
  71 + <%= labelled_form_field(_('Number of products/services displayed per page on catalog'), text_field(:profile_data, :products_per_catalog_page, :size => 3)) %>
  72 +<% end %>
... ...
app/views/profile_editor/_person_form.rhtml
... ... @@ -13,6 +13,8 @@
13 13 <%= optional_field(@person, 'contact_phone', labelled_form_field(_('Home phone'), text_field(:profile_data, :contact_phone, :rel => _('Contact phone')))) %>
14 14 <%= optional_field(@person, 'cell_phone', f.text_field(:cell_phone, :rel => _('Cell phone'))) %>
15 15 <%= optional_field(@person, 'comercial_phone', f.text_field(:comercial_phone, :rel => _('Comercial phone'))) %>
  16 +<%= optional_field(@person, 'jabber_id', f.text_field(:jabber_id, :rel => _('Jabber'))) %>
  17 +<%= optional_field(@person, 'personal_website', f.text_field(:personal_website, :rel => _('Personal website'))) %>
16 18 <%= optional_field(@person, 'sex', f.radio_group(:profile_data, :sex, [ ['male',_('Male')], ['female',_('Female')] ])) %>
17 19 <%= optional_field(@person, 'birth_date', labelled_form_field(_('Birth date'), '<div class="select-birth-date">' + pick_date(:profile_data, :birth_date, {:start_year => (Date.today.year - 100), :end_year => (Date.today.year - 5)}) + '</div>')) %>
18 20 <%= optional_field(@person, 'nationality', f.text_field(:nationality, :rel => _('Nationality'))) %>
... ...
app/views/profile_editor/index.rhtml
... ... @@ -22,7 +22,7 @@
22 22  
23 23 <%= control_panel_button(_('Edit sideboxes'), 'blocks', :controller => 'profile_design', :action => 'index') %>
24 24  
25   - <%= control_panel_button(_('Edit Appearance'), 'design-editor', :controller => 'themes', :action => 'index') %>
  25 + <%= control_panel_button(_('Edit Appearance'), 'design-editor', :controller => 'profile_themes', :action => 'index') %>
26 26  
27 27 <%= control_panel_button(_('Edit Header and Footer'), 'header-and-footer', :controller => 'profile_editor', :action => 'header_footer') unless profile.enterprise? && environment.enabled?('disable_header_and_footer') && !user.is_admin?(environment) %>
28 28  
... ...
app/views/profile_themes/add_css.rhtml 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +<h2><%= _('Add a CSS file') %></h2>
  2 +
  3 +<% form_tag do %>
  4 + <%= labelled_form_field(_('File name'), text_field_tag('css')) %>
  5 +
  6 + <% button_bar do %>
  7 + <%= submit_button(:add, _('Add')) %>
  8 + <%= lightbox_close_button(_('Cancel')) %>
  9 + <% end %>
  10 +
  11 +<% end %>
... ...
app/views/profile_themes/add_image.rhtml 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +<% form_tag({:action => 'add_image', :id => @theme.id}, :multipart => true) do %>
  2 + <%= labelled_form_field(_('Choose the image file'), file_field_tag(:image)) %>
  3 + <% button_bar do %>
  4 + <%= submit_button(:add, _('Add image')) %>
  5 + <% end %>
  6 +<% end %>
... ...
app/views/profile_themes/css_editor.rhtml 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +<h2><%= _('CSS code: "%s"') % @css %></h2>
  2 +
  3 +<% form_tag({:action => 'update_css', :id => @theme.id }, :name => 'csscode_form') do %>
  4 + <%= hidden_field_tag('css', @css) %>
  5 + <%= text_area_tag('csscode', @code, :id => "codepressWindow", :class => 'codepress css') %>
  6 + <% button_bar do %>
  7 + <%= submit_button(:save, _('Save')) %>
  8 + <% end %>
  9 +<% end %>
  10 +
  11 +<!--<script type='text/javascript'>-->
  12 + <!--CodePress.run();-->
  13 +<!--</script>-->
... ...
app/views/profile_themes/edit.rhtml 0 → 100644
... ... @@ -0,0 +1,41 @@
  1 +<form>
  2 + <%# FIXME %>
  3 + <h1 id='theme-name'>
  4 + <%= _('Editing theme "%s"') % @theme.name %>
  5 + <%= button(:eyes, _('Preview this theme'), :action => 'start_test', :id => @theme.id) %>
  6 + <%= button(:back, _('Back'), :action => 'index') %>
  7 + </h1>
  8 +</form>
  9 +
  10 +
  11 +<div id='css-files-list'>
  12 + <h2><%= _('CSS files') %></h2>
  13 + <ul>
  14 + <% for css in @css_files %>
  15 + <li><%= link_to_remote(css, :url => { :action => 'css_editor', :id => @theme.id, :css => css }, :update => { :success => 'css-code' }) %></li>
  16 + <% end %>
  17 + </ul>
  18 + <% button_bar do %>
  19 + <%= lightbox_button(:add, _('New CSS'), :action => 'add_css', :id => @theme.id) %>
  20 + <% end %>
  21 +</div>
  22 +
  23 +<div id='image-files-list'>
  24 + <h2><%= _('Images') %></h2>
  25 + <ul>
  26 + <% for image in @image_files %>
  27 + <li><%= image_tag("/user_themes/#{@theme.id}/images/#{image}") %></li>
  28 + <% end %>
  29 + </ul>
  30 + <% button_bar do %>
  31 + <%= lightbox_button(:add, _('Add image'), :action => 'add_image', :id => @theme.id) %>
  32 + <% end %>
  33 +</div>
  34 +
  35 +<div id='css-code'>
  36 + <center style='padding-top: 5em;'>
  37 + <em><%= _('Select a CSS file to edit') %></em>
  38 + </center>
  39 +</div>
  40 +
  41 +<%# javascript_include_tag 'codepress/codepress' %>
... ...
app/views/profile_themes/index.rhtml 0 → 100644
... ... @@ -0,0 +1,48 @@
  1 +<%= render :partial => 'themes/select_template' %>
  2 +<%= render :partial => 'themes/select_theme' %>
  3 +
  4 +<% if environment.enabled?('user_themes') %>
  5 + <div id="user-themes" class="list-options">
  6 +
  7 + <h2><%= _('My themes') %></h2>
  8 +
  9 + <% for themes in profile.themes.in_groups_of(3) %>
  10 + <div class="list-group">
  11 + <% for theme in themes %><%=
  12 + if theme
  13 +
  14 + selected = theme.id == @current_theme
  15 + sel_html = selected ?
  16 + content_tag('big', _('(current)') ) :
  17 + link_to(_('Use this theme'), :action => 'set', :id => theme.id)
  18 +
  19 + content_tag( 'div',
  20 + image_tag(
  21 + '/images/icons-app/design-editor.png',
  22 + :alt => (_('The "%s" theme.') % theme.name)) +
  23 + '<div class="opt-info">' +
  24 + content_tag('strong', theme.name, :class => 'name') +
  25 + ' <br/> '+ sel_html +' <br/> ' +
  26 + link_to(_('Edit this theme'), :action => 'edit', :id => theme.id) +
  27 + ' <br/> ' +
  28 + link_to(_('Test this theme'), :action => 'start_test', :id => theme.id) +
  29 + '</div>',
  30 + :class => 'theme-opt list-opt' + (selected ? ' selected' : '')
  31 + )
  32 +
  33 + end
  34 + %><% end %>
  35 + </div>
  36 + <% end %>
  37 +
  38 + </div><!-- end id="user-themes" -->
  39 +<% end %>
  40 +
  41 +<br style="clear:both" />
  42 +
  43 +<% button_bar do %>
  44 + <% if environment.enabled?('user_themes') %>
  45 + <%= lightbox_button(:add, _('New theme ...'), :action => 'new') %>
  46 + <% end %>
  47 + <%= button(:back, _('Back'), :controller => 'profile_editor', :action => 'index') %>
  48 +<% end %>
... ...
app/views/profile_themes/new.rhtml 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +<h2><%= _('Create new theme') %></h2>
  2 +
  3 +<% form_tag(:action => 'new') do %>
  4 +
  5 + <%= labelled_form_field(_('Name of the new theme:'), text_field_tag(:name)) %>
  6 +
  7 + <% button_bar do %>
  8 + <%= submit_button(:save, _('Create')) %>
  9 + <% end %>
  10 +<% end %>
... ...
app/views/shared/_lead_and_body.rhtml
... ... @@ -33,4 +33,4 @@
33 33 <% end %>
34 34 </div>
35 35  
36   -<%= javascript_include_tag 'article'%>
  36 +<%= javascript_include_tag 'article-lead-and-body'%>
... ...
app/views/shared/theme_test_panel.rhtml
... ... @@ -6,8 +6,8 @@
6 6 <p><small><em><%= _('You can move this window away to have a better visualization of specific parts of screen.') %></em></small></p>
7 7  
8 8 <% button_bar do %>
9   - <%= button(:ok, _('Finished testing'), :controller => 'themes', :profile => theme_owner, :action => 'stop_test', :id => current_theme) %>
10   - <%= button(:edit, _('Edit theme'), :controller => 'themes', :profile => theme_owner, :action => 'edit', :id => current_theme) %>
  9 + <%= button(:ok, _('Finished testing'), :controller => 'profile_themes', :profile => theme_owner, :action => 'stop_test', :id => current_theme) %>
  10 + <%= button(:edit, _('Edit theme'), :controller => 'profile_themes', :profile => theme_owner, :action => 'edit', :id => current_theme) %>
11 11 <% end %>
12 12 </div>
13 13 <%= draggable_element('theme-test-panel') %>
... ...
app/views/themes/_select_template.rhtml 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +<h1><%= _('Editing Appearance') %></h1>
  2 +
  3 +<div id="template-options" class="list-options">
  4 +
  5 +<h2><%= _('Select template') %></h2>
  6 +
  7 +<% for templates in @layout_templates.in_groups_of(3) %>
  8 + <div class="list-group">
  9 + <% for template in templates %><%=
  10 + if template
  11 + base_content = image_tag(
  12 + "/designs/templates/#{template.id}/thumbnail.png",
  13 + :alt => _('The "%s" template')) +
  14 + '<div class="opt-info">'.html_safe +
  15 + content_tag('strong', template.name, :class => 'name') +
  16 + ' <br/> '.html_safe
  17 +
  18 + if @current_template == template.id # selected
  19 + content_tag( 'div',
  20 + base_content + content_tag('big', _('(current)') ) +'</div>'.html_safe,
  21 + :class => 'template-opt list-opt selected')
  22 + else # Not selected
  23 + link_to(
  24 + base_content +'</div>'.html_safe,
  25 + { :action => 'set_layout_template', :id => template.id },
  26 + :class => 'template-opt list-opt')
  27 + end
  28 +
  29 + end
  30 + %><% end %>
  31 + </div>
  32 +<% end %>
  33 +
  34 +</div><!-- end id="template-options" -->
  35 +
... ...
app/views/themes/_select_theme.rhtml 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +<% if !@themes.empty? %>
  2 +<div id="theme-options" class="list-options">
  3 +
  4 +<h2><%= _('Select theme') %></h2>
  5 +<%= button :home, _('Use the default theme'), { :action => 'unset'}, :method => 'post', :confirm => _('Are you sure you want to use the environment default theme?') %>
  6 +
  7 +<% for themes in @themes.in_groups_of(3) %>
  8 + <div class="list-group">
  9 + <% for theme in themes %><%=
  10 + if theme
  11 +
  12 + base_content = image_tag(
  13 + "/designs/themes/#{theme.id}/preview.png",
  14 + :alt => (_('The "%s" theme.') % theme.name)) +
  15 + '<div class="opt-info">'.html_safe +
  16 + content_tag('strong', theme.name, :class => 'name') +
  17 + ' <br/> '.html_safe
  18 +
  19 + if theme.id == @current_theme # selected
  20 + content_tag( 'div',
  21 + base_content + content_tag('big', _('(current)') ) +'</div>'.html_safe,
  22 + :class => 'theme-opt list-opt selected')
  23 + else # Not selected
  24 + link_to(
  25 + base_content + '</div>'.html_safe,
  26 + { :action => 'set', :id => theme.id },
  27 + :class => 'theme-opt list-opt')
  28 + end
  29 +
  30 + end
  31 + %><% end %>
  32 + </div>
  33 +<% end %>
  34 +
  35 +</div><!-- end id="theme-options" -->
  36 +<% end %>
  37 +
... ...
app/views/themes/add_css.rhtml
... ... @@ -1,11 +0,0 @@
1   -<h2><%= _('Add a CSS file') %></h2>
2   -
3   -<% form_tag do %>
4   - <%= labelled_form_field(_('File name'), text_field_tag('css')) %>
5   -
6   - <% button_bar do %>
7   - <%= submit_button(:add, _('Add')) %>
8   - <%= lightbox_close_button(_('Cancel')) %>
9   - <% end %>
10   -
11   -<% end %>
app/views/themes/add_image.rhtml
... ... @@ -1,6 +0,0 @@
1   -<% form_tag({:action => 'add_image', :id => @theme.id}, :multipart => true) do %>
2   - <%= labelled_form_field(_('Choose the image file'), file_field_tag(:image)) %>
3   - <% button_bar do %>
4   - <%= submit_button(:add, _('Add image')) %>
5   - <% end %>
6   -<% end %>
app/views/themes/css_editor.rhtml
... ... @@ -1,13 +0,0 @@
1   -<h2><%= _('CSS code: "%s"') % @css %></h2>
2   -
3   -<% form_tag({:action => 'update_css', :id => @theme.id }, :name => 'csscode_form') do %>
4   - <%= hidden_field_tag('css', @css) %>
5   - <%= text_area_tag('csscode', @code, :id => "codepressWindow", :class => 'codepress css') %>
6   - <% button_bar do %>
7   - <%= submit_button(:save, _('Save')) %>
8   - <% end %>
9   -<% end %>
10   -
11   -<!--<script type='text/javascript'>-->
12   - <!--CodePress.run();-->
13   -<!--</script>-->
app/views/themes/edit.rhtml
... ... @@ -1,41 +0,0 @@
1   -<form>
2   - <%# FIXME %>
3   - <h1 id='theme-name'>
4   - <%= _('Editing theme "%s"') % @theme.name %>
5   - <%= button(:eyes, _('Preview this theme'), :action => 'start_test', :id => @theme.id) %>
6   - <%= button(:back, _('Back'), :action => 'index') %>
7   - </h1>
8   -</form>
9   -
10   -
11   -<div id='css-files-list'>
12   - <h2><%= _('CSS files') %></h2>
13   - <ul>
14   - <% for css in @css_files %>
15   - <li><%= link_to_remote(css, :url => { :action => 'css_editor', :id => @theme.id, :css => css }, :update => { :success => 'css-code' }) %></li>
16   - <% end %>
17   - </ul>
18   - <% button_bar do %>
19   - <%= lightbox_button(:add, _('New CSS'), :action => 'add_css', :id => @theme.id) %>
20   - <% end %>
21   -</div>
22   -
23   -<div id='image-files-list'>
24   - <h2><%= _('Images') %></h2>
25   - <ul>
26   - <% for image in @image_files %>
27   - <li><%= image_tag("/user_themes/#{@theme.id}/images/#{image}") %></li>
28   - <% end %>
29   - </ul>
30   - <% button_bar do %>
31   - <%= lightbox_button(:add, _('Add image'), :action => 'add_image', :id => @theme.id) %>
32   - <% end %>
33   -</div>
34   -
35   -<div id='css-code'>
36   - <center style='padding-top: 5em;'>
37   - <em><%= _('Select a CSS file to edit') %></em>
38   - </center>
39   -</div>
40   -
41   -<%# javascript_include_tag 'codepress/codepress' %>
app/views/themes/index.rhtml
... ... @@ -1,120 +0,0 @@
1   -<h1><%= _('Editing Appearance') %></h1>
2   -
3   -<div id="template-options" class="list-options">
4   -
5   -<h2><%= _('Select template') %></h2>
6   -
7   -<% for templates in @layout_templates.in_groups_of(3) %>
8   - <div class="list-group">
9   - <% for template in templates %><%=
10   - if template
11   - base_content = image_tag(
12   - "/designs/templates/#{template.id}/thumbnail.png",
13   - :alt => _('The "%s" template')) +
14   - '<div class="opt-info">'.html_safe +
15   - content_tag('strong', template.name, :class => 'name') +
16   - ' <br/> '.html_safe
17   -
18   - if @current_template == template.id # selected
19   - content_tag( 'div',
20   - base_content + content_tag('big', _('(current)') ) +'</div>'.html_safe,
21   - :class => 'template-opt list-opt selected')
22   - else # Not selected
23   - link_to(
24   - base_content +'</div>'.html_safe,
25   - { :action => 'set_layout_template', :id => template.id },
26   - :class => 'template-opt list-opt')
27   - end
28   -
29   - end
30   - %><% end %>
31   - </div>
32   -<% end %>
33   -
34   -</div><!-- end id="template-options" -->
35   -
36   -
37   -<% if !@themes.empty? %>
38   -<div id="theme-options" class="list-options">
39   -
40   -<h2><%= _('Select theme') %></h2>
41   -<%= button :home, _('Use the default theme'), { :action => 'unset'}, :method => 'post', :confirm => _('Are you sure you want to use the environment default theme?') %>
42   -
43   -<% for themes in @themes.in_groups_of(3) %>
44   - <div class="list-group">
45   - <% for theme in themes %><%=
46   - if theme
47   -
48   - base_content = image_tag(
49   - "/designs/themes/#{theme.id}/preview.png",
50   - :alt => (_('The "%s" theme.') % theme.name)) +
51   - '<div class="opt-info">'.html_safe +
52   - content_tag('strong', theme.name, :class => 'name') +
53   - ' <br/> '.html_safe
54   -
55   - if theme.id == @current_theme # selected
56   - content_tag( 'div',
57   - base_content + content_tag('big', _('(current)') ) +'</div>'.html_safe,
58   - :class => 'theme-opt list-opt selected')
59   - else # Not selected
60   - link_to(
61   - base_content + '</div>'.html_safe,
62   - { :action => 'set', :id => theme.id },
63   - :class => 'theme-opt list-opt')
64   - end
65   -
66   - end
67   - %><% end %>
68   - </div>
69   -<% end %>
70   -
71   -</div><!-- end id="theme-options" -->
72   -<% end %>
73   -
74   -
75   -
76   -<% if environment.enabled?('user_themes') %>
77   - <div id="user-themes" class="list-options">
78   -
79   - <h2><%= _('My themes') %></h2>
80   -
81   - <% for themes in profile.themes.in_groups_of(3) %>
82   - <div class="list-group">
83   - <% for theme in themes %><%=
84   - if theme
85   -
86   - selected = theme.id == @current_theme
87   - sel_html = selected ?
88   - content_tag('big', _('(current)') ) :
89   - link_to(_('Use this theme'), :action => 'set', :id => theme.id)
90   -
91   - content_tag( 'div',
92   - image_tag(
93   - '/images/icons-app/design-editor.png',
94   - :alt => (_('The "%s" theme.') % theme.name)) +
95   - '<div class="opt-info">' +
96   - content_tag('strong', theme.name, :class => 'name') +
97   - ' <br/> '+ sel_html +' <br/> ' +
98   - link_to(_('Edit this theme'), :action => 'edit', :id => theme.id) +
99   - ' <br/> ' +
100   - link_to(_('Test this theme'), :action => 'start_test', :id => theme.id) +
101   - '</div>',
102   - :class => 'theme-opt list-opt' + (selected ? ' selected' : '')
103   - )
104   -
105   - end
106   - %><% end %>
107   - </div>
108   - <% end %>
109   -
110   - </div><!-- end id="user-themes" -->
111   -<% end %>
112   -
113   -<br style="clear:both" />
114   -
115   -<% button_bar do %>
116   - <% if environment.enabled?('user_themes') %>
117   - <%= lightbox_button(:add, _('New theme ...'), :action => 'new') %>
118   - <% end %>
119   - <%= button(:back, _('Back'), :controller => 'profile_editor', :action => 'index') %>
120   -<% end %>