Commit 1dfa6f09b0500e4f901da140e2dbe4af5030ae47

Authored by Joenio Costa
2 parents 894e8962 d0561132

Merge branch 'master' into AI2928-categories

Showing 547 changed files with 132026 additions and 116054 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 547 files displayed.

@@ -41,6 +41,7 @@ Alessandro Palmeira + Rafael Manzo <alessandro.palmeira@gmail.com> @@ -41,6 +41,7 @@ Alessandro Palmeira + Rafael Manzo <alessandro.palmeira@gmail.com>
41 Antonio Terceiro + Carlos Morais <terceiro@colivre.coop.br> 41 Antonio Terceiro + Carlos Morais <terceiro@colivre.coop.br>
42 Antonio Terceiro + Paulo Meirelles <terceiro@colivre.coop.br> 42 Antonio Terceiro + Paulo Meirelles <terceiro@colivre.coop.br>
43 Antonio Terceiro <terceiro@colivre.coop.br> 43 Antonio Terceiro <terceiro@colivre.coop.br>
  44 +Arthur Del Esposte <arthurmde@yahoo.com.br>
44 Aurelio A. Heckert <aurelio@colivre.coop.br> 45 Aurelio A. Heckert <aurelio@colivre.coop.br>
45 Braulio Bhavamitra <brauliobo@gmail.com> 46 Braulio Bhavamitra <brauliobo@gmail.com>
46 Bráulio Bhavamitra <brauliobo@gmail.com> 47 Bráulio Bhavamitra <brauliobo@gmail.com>
@@ -68,6 +69,7 @@ Caio Salgado + Renan Teruo &lt;caio.salgado@gmail.com&gt; @@ -68,6 +69,7 @@ Caio Salgado + Renan Teruo &lt;caio.salgado@gmail.com&gt;
68 Caio Salgado + Renan Teruo + Jefferson Fernandes <jeffs.fernandes@gmail.com> 69 Caio Salgado + Renan Teruo + Jefferson Fernandes <jeffs.fernandes@gmail.com>
69 Caio Salgado + Renan Teruo <renanteruoc@gmail.com> 70 Caio Salgado + Renan Teruo <renanteruoc@gmail.com>
70 Caio SBA <caio@colivre.coop.br> 71 Caio SBA <caio@colivre.coop.br>
  72 +Carlos Andre de Souza <carlos.andre.souza@msn.com>
71 Carlos Morais <carlos88morais@gmail.com> 73 Carlos Morais <carlos88morais@gmail.com>
72 Carlos Morais + Diego Araújo <diegoamc90@gmail.com> 74 Carlos Morais + Diego Araújo <diegoamc90@gmail.com>
73 Carlos Morais + Eduardo Morais <carlos88morais@gmail.com> 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,6 +83,7 @@ Daniel Alves + Diego Araújo + Guilherme Rojas &lt;guilhermehrojas@gmail.com&gt;
81 Daniel Alves + Guilherme Rojas <danpaulalves@gmail.com> 83 Daniel Alves + Guilherme Rojas <danpaulalves@gmail.com>
82 Daniel Alves + Rafael Manzo <rr.manzo@gmail.com> 84 Daniel Alves + Rafael Manzo <rr.manzo@gmail.com>
83 Daniela Soares Feitosa <danielafeitosa@colivre.coop.br> 85 Daniela Soares Feitosa <danielafeitosa@colivre.coop.br>
  86 +Daniel Bucher <daniel.bucher88@gmail.com>
84 Daniel Cunha <daniel@colivre.coop.br> 87 Daniel Cunha <daniel@colivre.coop.br>
85 diegoamc <diegoamc90@gmail.com> 88 diegoamc <diegoamc90@gmail.com>
86 Diego Araújo + Alessandro Palmeira <diegoamc90@gmail.com> 89 Diego Araújo + Alessandro Palmeira <diegoamc90@gmail.com>
@@ -110,9 +113,12 @@ Diego + Jefferson &lt;diegoamc90@gmail.com&gt; @@ -110,9 +113,12 @@ Diego + Jefferson &lt;diegoamc90@gmail.com&gt;
110 Diego Martinez <diegoamc90@gmail.com> 113 Diego Martinez <diegoamc90@gmail.com>
111 Diego Martinez <diego@diego-K55A.(none)> 114 Diego Martinez <diego@diego-K55A.(none)>
112 Diego + Renan <renanteruoc@gmail.com> 115 Diego + Renan <renanteruoc@gmail.com>
  116 +Eduardo Tourinho Edington <eduardo.edington@serpro.gov.br>
113 Fernanda Lopes <nanda.listas+psl@gmail.com> 117 Fernanda Lopes <nanda.listas+psl@gmail.com>
114 Francisco Marcelo A. Lima Júnior <francisco.lima-junior@serpro.gov.br> 118 Francisco Marcelo A. Lima Júnior <francisco.lima-junior@serpro.gov.br>
115 Francisco Marcelo de Araujo Lima Junior <79350259591@serpro-1457614.(none)> 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 Grazieno Pellegrino <grazieno@gmail.com> 122 Grazieno Pellegrino <grazieno@gmail.com>
117 Isaac Canan <isaac@intelletto.com.br> 123 Isaac Canan <isaac@intelletto.com.br>
118 Italo Valcy <italo@dcc.ufba.br> 124 Italo Valcy <italo@dcc.ufba.br>
@@ -149,18 +155,24 @@ João M. M. Silva + Rafael Manzo &lt;jaodsilv@linux.ime.usp.br&gt; @@ -149,18 +155,24 @@ João M. M. Silva + Rafael Manzo &lt;jaodsilv@linux.ime.usp.br&gt;
149 João M. M. Silva + Renan Teruo <jaodsilv@linux.ime.usp.br> 155 João M. M. Silva + Renan Teruo <jaodsilv@linux.ime.usp.br>
150 Joenio Costa <joenio@colivre.coop.br> 156 Joenio Costa <joenio@colivre.coop.br>
151 Josef Spillner <josef.spillner@tu-dresden.de> 157 Josef Spillner <josef.spillner@tu-dresden.de>
  158 +Junior Silva <juniorsilva1001@gmail.com>
152 Junior Silva <juniorsilva7@juniorsilva-Aspire-5750Z.(none)> 159 Junior Silva <juniorsilva7@juniorsilva-Aspire-5750Z.(none)>
  160 +Junior Silva <juniorsilva@colivre.coop.br>
153 Keilla Menezes <keilla@colivre.coop.br> 161 Keilla Menezes <keilla@colivre.coop.br>
154 Larissa Reis <larissa@colivre.coop.br> 162 Larissa Reis <larissa@colivre.coop.br>
155 Larissa Reis <reiss.larissa@gmail.com> 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)>
156 Leandro Nunes dos Santos <leandronunes@gmail.com> 166 Leandro Nunes dos Santos <leandronunes@gmail.com>
157 Leandro Nunes dos Santos <leandro.santos@serpro.gov.br> 167 Leandro Nunes dos Santos <leandro.santos@serpro.gov.br>
158 LinguÁgil 2010 <linguagil.bahia@gmail.com> 168 LinguÁgil 2010 <linguagil.bahia@gmail.com>
159 Lucas Melo <lucas@colivre.coop.br> 169 Lucas Melo <lucas@colivre.coop.br>
160 Lucas Melo <lucaspradomelo@gmail.com> 170 Lucas Melo <lucaspradomelo@gmail.com>
161 Luis David Aguilar Carlos <ludwig9003@gmail.com> 171 Luis David Aguilar Carlos <ludwig9003@gmail.com>
  172 +Marcos Ramos <ms.ramos@outlook.com>
162 Martín Olivera <molivera@solar.org.ar> 173 Martín Olivera <molivera@solar.org.ar>
163 Moises Machado <moises@colivre.coop.br> 174 Moises Machado <moises@colivre.coop.br>
  175 +Naíla Alves <naila@colivre.coop.br>
164 Nanda Lopes <nanda.listas+psl@gmail.com> 176 Nanda Lopes <nanda.listas+psl@gmail.com>
165 Paulo Meirelles + Alessandro Palmeira + João M. M. da Silva <paulo@softwarelivre.org> 177 Paulo Meirelles + Alessandro Palmeira + João M. M. da Silva <paulo@softwarelivre.org>
166 Paulo Meirelles + Alessandro Palmeira <paulo@softwarelivre.org> 178 Paulo Meirelles + Alessandro Palmeira <paulo@softwarelivre.org>
@@ -195,8 +207,13 @@ Rodrigo Souto &lt;rodrigo@colivre.coop.br&gt; @@ -195,8 +207,13 @@ Rodrigo Souto &lt;rodrigo@colivre.coop.br&gt;
195 Ronny Kursawe <kursawe.ronny@googlemail.com> 207 Ronny Kursawe <kursawe.ronny@googlemail.com>
196 root <root@debian.sdr.serpro> 208 root <root@debian.sdr.serpro>
197 Samuel R. C. Vale <srcvale@holoscopio.com> 209 Samuel R. C. Vale <srcvale@holoscopio.com>
  210 +Valessio Brito <contato@valessiobrito.com.br>
  211 +Valessio Brito <contato@valessiobrito.info>
198 Valessio Brito <valessio@gmail.com> 212 Valessio Brito <valessio@gmail.com>
199 vfcosta <vfcosta@gmail.com> 213 vfcosta <vfcosta@gmail.com>
  214 +Victor Carvalho <victorhugodf.ac@gmail.com>
  215 +Victor Costa <vfcosta@gmail.com>
  216 +Victor Hugo Alves de Carvalho <victorhugodf.ac@gmail.com>
200 Vinicius Cubas Brand <viniciuscb@gmail.com> 217 Vinicius Cubas Brand <viniciuscb@gmail.com>
201 Visita <visita@debian.(none)> 218 Visita <visita@debian.(none)>
202 Yann Lugrin <yann.lugrin@liquid-concept.ch> 219 Yann Lugrin <yann.lugrin@liquid-concept.ch>
AUTHORS.md 0 → 100644
@@ -0,0 +1,214 @@ @@ -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,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 @@ @@ -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,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,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 @@ @@ -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,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 @@ @@ -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,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 @@ @@ -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 @@ @@ -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,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 @@ @@ -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,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 @@ @@ -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,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 @@ @@ -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,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 @@ @@ -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,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 @@ @@ -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 @@ @@ -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/admin/features_controller.rb
@@ -2,7 +2,7 @@ class FeaturesController &lt; AdminController @@ -2,7 +2,7 @@ class FeaturesController &lt; AdminController
2 protect 'edit_environment_features', :environment 2 protect 'edit_environment_features', :environment
3 3
4 def index 4 def index
5 - @features = Environment.available_features 5 + @features = Environment.available_features.sort_by{|k,v|v}
6 end 6 end
7 7
8 post_only :update 8 post_only :update
app/controllers/admin/users_controller.rb
@@ -4,12 +4,53 @@ class UsersController &lt; AdminController @@ -4,12 +4,53 @@ class UsersController &lt; AdminController
4 4
5 protect 'manage_environment_users', :environment 5 protect 'manage_environment_users', :environment
6 6
  7 + include UsersHelper
  8 +
7 def index 9 def index
  10 + @filter = params[:filter] || 'all_users'
  11 + scope = environment.people.no_templates
  12 + if @filter == 'admin_users'
  13 + scope = scope.admins
  14 + elsif @filter == 'activated_users'
  15 + scope = scope.activated
  16 + elsif @filter == 'deactivated_users'
  17 + scope = scope.deactivated
  18 + end
  19 + scope = scope.order('name ASC')
  20 + @q = params[:q]
  21 + @collection = find_by_contents(:people, scope, @q, {:per_page => per_page, :page => params[:npage]})[:results]
  22 + end
  23 +
  24 + def set_admin_role
  25 + person = environment.people.find(params[:id])
  26 + environment.add_admin(person)
  27 + redirect_to :action => :index, :q => params[:q], :filter => params[:filter]
  28 + end
  29 +
  30 + def reset_admin_role
  31 + person = environment.people.find(params[:id])
  32 + environment.remove_admin(person)
  33 + redirect_to :action => :index, :q => params[:q], :filter => params[:filter]
  34 + end
  35 +
  36 + def activate
  37 + person = environment.people.find(params[:id])
  38 + person.user.activate
  39 + redirect_to :action => :index, :q => params[:q], :filter => params[:filter]
  40 + end
  41 +
  42 + def deactivate
  43 + person = environment.people.find(params[:id])
  44 + person.user.deactivate
  45 + redirect_to :action => :index, :q => params[:q], :filter => params[:filter]
  46 + end
  47 +
  48 + def download
8 respond_to do |format| 49 respond_to do |format|
9 format.html 50 format.html
10 format.xml do 51 format.xml do
11 - @users = User.find(:all, :conditions => {:environment_id => environment.id}, :include => [:person])  
12 - send_data @users.to_xml( 52 + users = User.find(:all, :conditions => {:environment_id => environment.id}, :include => [:person])
  53 + send_data users.to_xml(
13 :skip_types => true, 54 :skip_types => true,
14 :only => %w[email login created_at updated_at], 55 :only => %w[email login created_at updated_at],
15 :include => { :person => {:only => %w[name updated_at created_at address birth_date contact_phone identifier lat lng] } }), 56 :include => { :person => {:only => %w[name updated_at created_at address birth_date contact_phone identifier lat lng] } }),
@@ -45,4 +86,10 @@ class UsersController &lt; AdminController @@ -45,4 +86,10 @@ class UsersController &lt; AdminController
45 end 86 end
46 end 87 end
47 88
  89 + private
  90 +
  91 + def per_page
  92 + 10
  93 + end
  94 +
48 end 95 end
app/controllers/application_controller.rb
@@ -2,7 +2,7 @@ class ApplicationController &lt; ActionController::Base @@ -2,7 +2,7 @@ class ApplicationController &lt; ActionController::Base
2 2
3 before_filter :setup_multitenancy 3 before_filter :setup_multitenancy
4 before_filter :detect_stuff_by_domain 4 before_filter :detect_stuff_by_domain
5 - before_filter :init_noosfero_plugins 5 + before_filter :init_noosfero_plugins_controller_filters
6 before_filter :allow_cross_domain_access 6 before_filter :allow_cross_domain_access
7 7
8 def allow_cross_domain_access 8 def allow_cross_domain_access
@@ -21,8 +21,13 @@ class ApplicationController &lt; ActionController::Base @@ -21,8 +21,13 @@ class ApplicationController &lt; ActionController::Base
21 include ApplicationHelper 21 include ApplicationHelper
22 layout :get_layout 22 layout :get_layout
23 def get_layout 23 def get_layout
24 - prepend_view_path('public/' + theme_path)  
25 - theme_option(:layout) || 'application' 24 + return nil if request.format == :js
  25 + theme_layout = theme_option(:layout)
  26 + if theme_layout
  27 + theme_view_file('layouts/'+theme_layout) || theme_layout
  28 + else
  29 + 'application'
  30 + end
26 end 31 end
27 32
28 filter_parameter_logging :password 33 filter_parameter_logging :password
@@ -122,22 +127,21 @@ class ApplicationController &lt; ActionController::Base @@ -122,22 +127,21 @@ class ApplicationController &lt; ActionController::Base
122 127
123 include Noosfero::Plugin::HotSpot 128 include Noosfero::Plugin::HotSpot
124 129
125 - def init_noosfero_plugins  
126 - plugins.each do |plugin|  
127 - prepend_view_path(plugin.class.view_path)  
128 - end  
129 - init_noosfero_plugins_controller_filters  
130 - end  
131 -  
132 # This is a generic method that initialize any possible filter defined by a 130 # This is a generic method that initialize any possible filter defined by a
133 # plugin to the current controller being initialized. 131 # plugin to the current controller being initialized.
134 def init_noosfero_plugins_controller_filters 132 def init_noosfero_plugins_controller_filters
135 plugins.each do |plugin| 133 plugins.each do |plugin|
136 filters = plugin.send(self.class.name.underscore + '_filters') 134 filters = plugin.send(self.class.name.underscore + '_filters')
137 filters = [filters] if !filters.kind_of?(Array) 135 filters = [filters] if !filters.kind_of?(Array)
  136 + controller_filters = self.class.filter_chain.map {|c| c.method }
138 filters.each do |plugin_filter| 137 filters.each do |plugin_filter|
139 - self.class.send(plugin_filter[:type], plugin.class.name.underscore + '_' + plugin_filter[:method_name], (plugin_filter[:options] || {}))  
140 - self.class.send(:define_method, plugin.class.name.underscore + '_' + plugin_filter[:method_name], plugin_filter[:block]) 138 + filter_method = plugin.class.name.underscore.gsub('/','_') + '_' + plugin_filter[:method_name]
  139 + unless controller_filters.include?(filter_method)
  140 + self.class.send(plugin_filter[:type], filter_method, (plugin_filter[:options] || {}))
  141 + self.class.send(:define_method, filter_method) do
  142 + instance_eval(&plugin_filter[:block]) if environment.plugin_enabled?(plugin.class)
  143 + end
  144 + end
141 end 145 end
142 end 146 end
143 end 147 end
@@ -174,7 +178,7 @@ class ApplicationController &lt; ActionController::Base @@ -174,7 +178,7 @@ class ApplicationController &lt; ActionController::Base
174 end 178 end
175 179
176 def find_by_contents(asset, scope, query, paginate_options={:page => 1}, options={}) 180 def find_by_contents(asset, scope, query, paginate_options={:page => 1}, options={})
177 - @plugins.dispatch_first(:find_by_contents, asset, scope, query, paginate_options, options) || 181 + plugins.dispatch_first(:find_by_contents, asset, scope, query, paginate_options, options) ||
178 fallback_find_by_contents(asset, scope, query, paginate_options, options) 182 fallback_find_by_contents(asset, scope, query, paginate_options, options)
179 end 183 end
180 184
app/controllers/box_organizer_controller.rb
@@ -70,7 +70,7 @@ class BoxOrganizerController &lt; ApplicationController @@ -70,7 +70,7 @@ class BoxOrganizerController &lt; ApplicationController
70 else 70 else
71 @center_block_types = (Box.acceptable_center_blocks & available_blocks) + plugins.dispatch(:extra_blocks, :type => boxes_holder.class, :position => 1) 71 @center_block_types = (Box.acceptable_center_blocks & available_blocks) + plugins.dispatch(:extra_blocks, :type => boxes_holder.class, :position => 1)
72 @side_block_types = (Box.acceptable_side_blocks & available_blocks) + plugins.dispatch(:extra_blocks, :type => boxes_holder.class, :position => [2,3]) 72 @side_block_types = (Box.acceptable_side_blocks & available_blocks) + plugins.dispatch(:extra_blocks, :type => boxes_holder.class, :position => [2,3])
73 - @boxes = boxes_holder.boxes 73 + @boxes = boxes_holder.boxes.with_position
74 render :action => 'add_block', :layout => false 74 render :action => 'add_block', :layout => false
75 end 75 end
76 end 76 end
app/controllers/my_profile/cms_controller.rb
@@ -2,6 +2,8 @@ class CmsController &lt; MyProfileController @@ -2,6 +2,8 @@ class CmsController &lt; MyProfileController
2 2
3 protect 'edit_profile', :profile, :only => [:set_home_page] 3 protect 'edit_profile', :profile, :only => [:set_home_page]
4 4
  5 + include ArticleHelper
  6 +
5 def self.protect_if(*args) 7 def self.protect_if(*args)
6 before_filter(*args) do |c| 8 before_filter(*args) do |c|
7 user, profile = c.send(:user), c.send(:profile) 9 user, profile = c.send(:user), c.send(:profile)
@@ -64,20 +66,32 @@ class CmsController &lt; MyProfileController @@ -64,20 +66,32 @@ class CmsController &lt; MyProfileController
64 end 66 end
65 67
66 def edit 68 def edit
  69 + @success_back_to = params[:success_back_to]
67 @article = profile.articles.find(params[:id]) 70 @article = profile.articles.find(params[:id])
  71 + version = params[:version]
  72 + @article.revert_to(version) if version
  73 +
68 @parent_id = params[:parent_id] 74 @parent_id = params[:parent_id]
69 @type = params[:type] || @article.class.to_s 75 @type = params[:type] || @article.class.to_s
70 translations if @article.translatable? 76 translations if @article.translatable?
71 continue = params[:continue] 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 refuse_blocks 86 refuse_blocks
74 record_coming 87 record_coming
75 if request.post? 88 if request.post?
  89 + @article.image = nil if params[:remove_image] == 'true'
76 @article.last_changed_by = user 90 @article.last_changed_by = user
77 if @article.update_attributes(params[:article]) 91 if @article.update_attributes(params[:article])
78 if !continue 92 if !continue
79 if @article.content_type.nil? || @article.image? 93 if @article.content_type.nil? || @article.image?
80 - redirect_to @article.view_url 94 + success_redirect
81 else 95 else
82 redirect_to :action => (@article.parent ? 'view' : 'index'), :id => @article.parent 96 redirect_to :action => (@article.parent ? 'view' : 'index'), :id => @article.parent
83 end 97 end
@@ -89,6 +103,7 @@ class CmsController &lt; MyProfileController @@ -89,6 +103,7 @@ class CmsController &lt; MyProfileController
89 def new 103 def new
90 # FIXME this method should share some logic wirh edit !!! 104 # FIXME this method should share some logic wirh edit !!!
91 105
  106 + @success_back_to = params[:success_back_to]
92 # user must choose an article type first 107 # user must choose an article type first
93 108
94 @parent = profile.articles.find(params[:parent_id]) if params && params[:parent_id] 109 @parent = profile.articles.find(params[:parent_id]) if params && params[:parent_id]
@@ -129,11 +144,13 @@ class CmsController &lt; MyProfileController @@ -129,11 +144,13 @@ class CmsController &lt; MyProfileController
129 144
130 continue = params[:continue] 145 continue = params[:continue]
131 if request.post? 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 +
132 if @article.save 149 if @article.save
133 if continue 150 if continue
134 redirect_to :action => 'edit', :id => @article 151 redirect_to :action => 'edit', :id => @article
135 else 152 else
136 - redirect_to @article.view_url 153 + success_redirect
137 end 154 end
138 return 155 return
139 end 156 end
@@ -188,7 +205,7 @@ class CmsController &lt; MyProfileController @@ -188,7 +205,7 @@ class CmsController &lt; MyProfileController
188 @article.destroy 205 @article.destroy
189 session[:notice] = _("\"#{@article.name}\" was removed.") 206 session[:notice] = _("\"#{@article.name}\" was removed.")
190 referer = ActionController::Routing::Routes.recognize_path URI.parse(request.referer).path rescue nil 207 referer = ActionController::Routing::Routes.recognize_path URI.parse(request.referer).path rescue nil
191 - if referer and referer[:controller] == 'cms' 208 + if referer and referer[:controller] == 'cms' and referer[:action] != 'edit'
192 redirect_to referer 209 redirect_to referer
193 elsif @article.parent 210 elsif @article.parent
194 redirect_to @article.parent.url 211 redirect_to @article.parent.url
@@ -289,6 +306,12 @@ class CmsController &lt; MyProfileController @@ -289,6 +306,12 @@ class CmsController &lt; MyProfileController
289 render :text => article_list_to_json(results), :content_type => 'application/json' 306 render :text => article_list_to_json(results), :content_type => 'application/json'
290 end 307 end
291 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 +
292 def media_upload 315 def media_upload
293 files_uploaded = [] 316 files_uploaded = []
294 parent = check_parent(params[:parent_id]) 317 parent = check_parent(params[:parent_id])
@@ -385,5 +408,12 @@ class CmsController &lt; MyProfileController @@ -385,5 +408,12 @@ class CmsController &lt; MyProfileController
385 true 408 true
386 end 409 end
387 410
388 -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
389 418
  419 +end
app/controllers/my_profile/memberships_controller.rb
1 class MembershipsController < MyProfileController 1 class MembershipsController < MyProfileController
2 2
3 protect 'manage_memberships', :profile 3 protect 'manage_memberships', :profile
4 - 4 +
5 def index 5 def index
6 - @memberships = profile.memberships 6 + @roles = environment.roles.select do |role|
  7 + ra = profile.role_assignments.find_by_role_id(role.id)
  8 + ra.present? && ra.resource_type == 'Profile'
  9 + end
  10 + @filter = params[:filter_type].blank? ? nil : params[:filter_type]
  11 + begin
  12 + @memberships = @filter.nil? ? profile.memberships : profile.memberships_by_role(environment.roles.find(@filter))
  13 + rescue ActiveRecord::RecordNotFound
  14 + @memberships = []
  15 + end
7 end 16 end
8 17
9 def new_community 18 def new_community
app/controllers/my_profile/profile_design_controller.rb
@@ -32,6 +32,7 @@ class ProfileDesignController &lt; BoxOrganizerController @@ -32,6 +32,7 @@ class ProfileDesignController &lt; BoxOrganizerController
32 if profile.enterprise? 32 if profile.enterprise?
33 blocks << DisabledEnterpriseMessageBlock 33 blocks << DisabledEnterpriseMessageBlock
34 blocks << HighlightsBlock 34 blocks << HighlightsBlock
  35 + blocks << ProductCategoriesBlock
35 blocks << FeaturedProductsBlock 36 blocks << FeaturedProductsBlock
36 blocks << FansBlock 37 blocks << FansBlock
37 blocks += plugins.dispatch(:extra_blocks, :type => Enterprise) 38 blocks += plugins.dispatch(:extra_blocks, :type => Enterprise)
@@ -54,4 +55,10 @@ class ProfileDesignController &lt; BoxOrganizerController @@ -54,4 +55,10 @@ class ProfileDesignController &lt; BoxOrganizerController
54 blocks 55 blocks
55 end 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 end 64 end
app/controllers/my_profile/profile_members_controller.rb
@@ -2,7 +2,7 @@ class ProfileMembersController &lt; MyProfileController @@ -2,7 +2,7 @@ class ProfileMembersController &lt; MyProfileController
2 protect 'manage_memberships', :profile 2 protect 'manage_memberships', :profile
3 3
4 def index 4 def index
5 - @members = profile.members 5 + @members = profile.members_by_name
6 @member_role = environment.roles.find_by_name('member') 6 @member_role = environment.roles.find_by_name('member')
7 end 7 end
8 8
app/controllers/my_profile/profile_themes_controller.rb 0 → 100644
@@ -0,0 +1,75 @@ @@ -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,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/account_controller.rb
@@ -141,22 +141,34 @@ class AccountController &lt; ApplicationController @@ -141,22 +141,34 @@ class AccountController &lt; ApplicationController
141 end 141 end
142 end 142 end
143 143
144 - # The user requests a password change. She forgot her old password.  
145 - #  
146 - # Posts back. 144 + include ForgotPasswordHelper
  145 + helper :forgot_password
  146 +
147 def forgot_password 147 def forgot_password
148 if @plugins.dispatch(:allow_password_recovery).include?(false) 148 if @plugins.dispatch(:allow_password_recovery).include?(false)
149 redirect_back_or_default(:controller => 'home') 149 redirect_back_or_default(:controller => 'home')
150 session[:notice] = _("This environment doesn't allow password recovery.") 150 session[:notice] = _("This environment doesn't allow password recovery.")
151 end 151 end
152 - @change_password = ChangePassword.new(params[:change_password]) 152 +
  153 + @change_password = ChangePassword.new
153 154
154 if request.post? 155 if request.post?
155 begin 156 begin
156 - @change_password.save! 157 + requestors = fetch_requestors(params[:value])
  158 + raise ActiveRecord::RecordNotFound if requestors.blank? || params[:value].blank?
  159 +
  160 + requestors.each do |requestor|
  161 + ChangePassword.create!(:requestor => requestor)
  162 + end
157 render :action => 'password_recovery_sent' 163 render :action => 'password_recovery_sent'
158 - rescue ActiveRecord::RecordInvalid => e  
159 - nil # just pass and render at the end of the action 164 + rescue ActiveRecord::RecordNotFound
  165 + if params[:value].blank?
  166 + @change_password.errors.add_to_base(_('Can not recover user password with blank value.'))
  167 + else
  168 + @change_password.errors.add_to_base(_('Could not find any user with %s equal to "%s".') % [fields_label, params[:value]])
  169 + end
  170 + rescue ActiveRecord::RecordInvald
  171 + @change_password.errors.add_to_base(_('Could not perform password recovery for the user.'))
160 end 172 end
161 end 173 end
162 end 174 end
@@ -262,7 +274,7 @@ class AccountController &lt; ApplicationController @@ -262,7 +274,7 @@ class AccountController &lt; ApplicationController
262 def user_data 274 def user_data
263 user_data = 275 user_data =
264 if logged_in? 276 if logged_in?
265 - current_user.data_hash 277 + current_user.data_hash(gravatar_default)
266 else 278 else
267 { } 279 { }
268 end 280 end
app/controllers/public/catalog_controller.rb
1 class CatalogController < PublicController 1 class CatalogController < PublicController
2 needs_profile 2 needs_profile
3 - no_design_blocks  
4 3
5 before_filter :check_enterprise_and_environment 4 before_filter :check_enterprise_and_environment
6 5
app/controllers/public/comment_controller.rb
@@ -71,7 +71,9 @@ class CommentController &lt; ApplicationController @@ -71,7 +71,9 @@ class CommentController &lt; ApplicationController
71 return 71 return
72 end 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 respond_to do |format| 78 respond_to do |format|
77 format.js do 79 format.js do
@@ -113,6 +115,8 @@ class CommentController &lt; ApplicationController @@ -113,6 +115,8 @@ class CommentController &lt; ApplicationController
113 115
114 def update 116 def update
115 if @comment.update_attributes(params[:comment]) 117 if @comment.update_attributes(params[:comment])
  118 + @plugins.dispatch(:process_extra_comment_params, [@comment,params])
  119 +
116 respond_to do |format| 120 respond_to do |format|
117 format.js do 121 format.js do
118 comment_to_render = @comment.comment_root 122 comment_to_render = @comment.comment_root
app/controllers/public/content_viewer_controller.rb
@@ -7,6 +7,7 @@ class ContentViewerController &lt; ApplicationController @@ -7,6 +7,7 @@ class ContentViewerController &lt; ApplicationController
7 7
8 def view_page 8 def view_page
9 path = params[:page].join('/') 9 path = params[:page].join('/')
  10 + @version = params[:version].to_i
10 11
11 if path.blank? 12 if path.blank?
12 @page = profile.home_page 13 @page = profile.home_page
@@ -25,31 +26,29 @@ class ContentViewerController &lt; ApplicationController @@ -25,31 +26,29 @@ class ContentViewerController &lt; ApplicationController
25 end 26 end
26 end 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 end 37 end
37 - return  
38 end 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 end 50 end
50 51
51 - redirect_to_translation if @page.profile.redirect_l10n  
52 -  
53 # At this point the page will be showed 52 # At this point the page will be showed
54 @page.hit 53 @page.hit
55 54
@@ -96,7 +95,7 @@ class ContentViewerController &lt; ApplicationController @@ -96,7 +95,7 @@ class ContentViewerController &lt; ApplicationController
96 end 95 end
97 96
98 if @page.folder? && @page.gallery? 97 if @page.folder? && @page.gallery?
99 - @images = @page.images 98 + @images = @page.images.select{ |a| a.display_to? user }
100 @images = @images.paginate(:per_page => per_page, :page => params[:npage]) unless params[:slideshow] 99 @images = @images.paginate(:per_page => per_page, :page => params[:npage]) unless params[:slideshow]
101 end 100 end
102 101
@@ -118,6 +117,15 @@ class ContentViewerController &lt; ApplicationController @@ -118,6 +117,15 @@ class ContentViewerController &lt; ApplicationController
118 end 117 end
119 end 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 protected 129 protected
122 130
123 def per_page 131 def per_page
@@ -148,4 +156,22 @@ class ContentViewerController &lt; ApplicationController @@ -148,4 +156,22 @@ class ContentViewerController &lt; ApplicationController
148 end 156 end
149 helper_method :pass_without_comment_captcha? 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 end 177 end
app/controllers/public/profile_controller.rb
@@ -67,7 +67,7 @@ class ProfileController &lt; PublicController @@ -67,7 +67,7 @@ class ProfileController &lt; PublicController
67 67
68 def members 68 def members
69 if is_cache_expired?(profile.members_cache_key(params)) 69 if is_cache_expired?(profile.members_cache_key(params))
70 - @members = profile.members.includes(relations_to_include).paginate(:per_page => members_per_page, :page => params[:npage]) 70 + @members = profile.members_by_name.includes(relations_to_include).paginate(:per_page => members_per_page, :page => params[:npage])
71 end 71 end
72 end 72 end
73 73
app/controllers/themes_controller.rb 0 → 100644
@@ -0,0 +1,42 @@ @@ -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
@@ -38,6 +38,12 @@ module ApplicationHelper @@ -38,6 +38,12 @@ module ApplicationHelper
38 38
39 include LayoutHelper 39 include LayoutHelper
40 40
  41 + include Noosfero::Gravatar
  42 +
  43 + include TokenHelper
  44 +
  45 + include CatalogHelper
  46 +
41 def locale 47 def locale
42 (@page && !@page.language.blank?) ? @page.language : FastGettext.locale 48 (@page && !@page.language.blank?) ? @page.language : FastGettext.locale
43 end 49 end
@@ -366,7 +372,7 @@ module ApplicationHelper @@ -366,7 +372,7 @@ module ApplicationHelper
366 def current_theme 372 def current_theme
367 @current_theme ||= 373 @current_theme ||=
368 begin 374 begin
369 - if (session[:theme]) 375 + if session[:theme]
370 session[:theme] 376 session[:theme]
371 else 377 else
372 # utility for developers: set the theme to 'random' in development mode and 378 # utility for developers: set the theme to 'random' in development mode and
@@ -375,7 +381,7 @@ module ApplicationHelper @@ -375,7 +381,7 @@ module ApplicationHelper
375 if ENV['RAILS_ENV'] == 'development' && environment.theme == 'random' 381 if ENV['RAILS_ENV'] == 'development' && environment.theme == 'random'
376 @random_theme ||= Dir.glob('public/designs/themes/*').map { |f| File.basename(f) }.rand 382 @random_theme ||= Dir.glob('public/designs/themes/*').map { |f| File.basename(f) }.rand
377 @random_theme 383 @random_theme
378 - elsif ENV['RAILS_ENV'] == 'development' && params[:theme] && File.exists?(File.join(Rails.root, 'public/designs/themes', params[:theme])) 384 + elsif ENV['RAILS_ENV'] == 'development' && respond_to?(:params) && params[:theme] && File.exists?(File.join(Rails.root, 'public/designs/themes', params[:theme]))
379 params[:theme] 385 params[:theme]
380 else 386 else
381 if profile && !profile.theme.nil? 387 if profile && !profile.theme.nil?
@@ -397,16 +403,24 @@ module ApplicationHelper @@ -397,16 +403,24 @@ module ApplicationHelper
397 end 403 end
398 end 404 end
399 405
400 - def theme_include(template) 406 + def theme_view_file(template)
401 ['.rhtml', '.html.erb'].each do |ext| 407 ['.rhtml', '.html.erb'].each do |ext|
402 - file = (RAILS_ROOT + '/public' + theme_path + '/' + template + ext)  
403 - if File.exists?(file)  
404 - return render :file => file, :use_full_path => false  
405 - end 408 + file = (RAILS_ROOT + '/public' + theme_path + '/' + template + ext)
  409 + return file if File.exists?(file)
406 end 410 end
407 nil 411 nil
408 end 412 end
409 413
  414 + def theme_include(template, options = {})
  415 + file = theme_view_file(template)
  416 + options.merge!({:file => file, :use_full_path => false})
  417 + if file
  418 + render options
  419 + else
  420 + nil
  421 + end
  422 + end
  423 +
410 def theme_favicon 424 def theme_favicon
411 return '/designs/themes/' + current_theme + '/favicon.ico' if profile.nil? || profile.theme.nil? 425 return '/designs/themes/' + current_theme + '/favicon.ico' if profile.nil? || profile.theme.nil?
412 if File.exists?(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico')) 426 if File.exists?(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico'))
@@ -589,33 +603,8 @@ module ApplicationHelper @@ -589,33 +603,8 @@ module ApplicationHelper
589 :class => 'vcard'), :class => 'common-profile-list-block') 603 :class => 'vcard'), :class => 'common-profile-list-block')
590 end 604 end
591 605
592 - def gravatar_url_for(email, options = {})  
593 - # Ta dando erro de roteamento  
594 - default = theme_option['gravatar'] || NOOSFERO_CONF['gravatar'] || nil  
595 - url_for( { :gravatar_id => Digest::MD5.hexdigest(email.to_s),  
596 - :host => 'www.gravatar.com',  
597 - :protocol => 'http://',  
598 - :only_path => false,  
599 - :controller => 'avatar.php',  
600 - :d => default  
601 - }.merge(options) )  
602 - end  
603 -  
604 - def str_gravatar_url_for(email, options = {})  
605 - default = theme_option['gravatar'] || NOOSFERO_CONF['gravatar'] || nil  
606 - url = 'http://www.gravatar.com/avatar.php?gravatar_id=' +  
607 - Digest::MD5.hexdigest(email.to_s)  
608 - {  
609 - :only_path => false,  
610 - :d => default  
611 - }.merge(options).each { |k,v|  
612 - url += ( '&%s=%s' % [ k,v ] )  
613 - }  
614 - url  
615 - end  
616 -  
617 - def gravatar_profile_url(email)  
618 - 'http://www.gravatar.com/'+ Digest::MD5.hexdigest(email.to_s) 606 + def gravatar_default
  607 + (respond_to?(:theme_option) && theme_option.present? && theme_option['gravatar']) || NOOSFERO_CONF['gravatar']
619 end 608 end
620 609
621 attr_reader :environment 610 attr_reader :environment
@@ -909,7 +898,7 @@ module ApplicationHelper @@ -909,7 +898,7 @@ module ApplicationHelper
909 (@category ? " - #{@category.full_name}" : '') 898 (@category ? " - #{@category.full_name}" : '')
910 end 899 end
911 900
912 - # DEPRECATED. Do not use this· 901 + # DEPRECATED. Do not use this.
913 def import_controller_stylesheets(options = {}) 902 def import_controller_stylesheets(options = {})
914 stylesheet_import( "controller_"+ @controller.controller_name(), options ) 903 stylesheet_import( "controller_"+ @controller.controller_name(), options )
915 end 904 end
@@ -1127,12 +1116,12 @@ module ApplicationHelper @@ -1127,12 +1116,12 @@ module ApplicationHelper
1127 pending_tasks_count = link_to(count.to_s, @environment.top_url + '/myprofile/{login}/tasks', :id => 'pending-tasks-count', :title => _("Manage your pending tasks")) 1116 pending_tasks_count = link_to(count.to_s, @environment.top_url + '/myprofile/{login}/tasks', :id => 'pending-tasks-count', :title => _("Manage your pending tasks"))
1128 end 1117 end
1129 1118
1130 - (_("<span class='welcome'>Welcome,</span> %s") % link_to('<i></i><strong>{login}</strong>', @environment.top_url + '/{login}', :id => "homepage-link", :title => _('Go to your homepage'))) + 1119 + (_("<span class='welcome'>Welcome,</span> %s") % link_to('<i style="background-image:url({avatar})"></i><strong>{login}</strong>', @environment.top_url + '/{login}', :id => "homepage-link", :title => _('Go to your homepage'))) +
1131 render_environment_features(:usermenu) + 1120 render_environment_features(:usermenu) +
1132 - link_to('<i class="icon-menu-admin"></i><strong>' + _('Administration') + '</strong>', @environment.top_url + '/admin', :id => "controlpanel", :title => _("Configure the environment"), :class => 'admin-link', :style => 'display: none') + 1121 + link_to('<i class="icon-menu-admin"></i><strong>' + _('Administration') + '</strong>', @environment.top_url + '/admin', :title => _("Configure the environment"), :class => 'admin-link', :style => 'display: none') +
1133 manage_enterprises.to_s + 1122 manage_enterprises.to_s +
1134 manage_communities.to_s + 1123 manage_communities.to_s +
1135 - link_to('<i class="icon-menu-ctrl-panel"></i><strong>' + _('Control panel') + '</strong>', @environment.top_url + '/myprofile/{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) + 1124 + link_to('<i class="icon-menu-ctrl-panel"></i><strong>' + _('Control panel') + '</strong>', @environment.top_url + '/myprofile/{login}', :class => 'ctrl-panel', :title => _("Configure your personal account and content")) +
1136 pending_tasks_count + 1125 pending_tasks_count +
1137 link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) 1126 link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system"))
1138 end 1127 end
@@ -1284,10 +1273,6 @@ module ApplicationHelper @@ -1284,10 +1273,6 @@ module ApplicationHelper
1284 content_tag(:div, content_tag(:ul, titles) + raw(contents), :class => 'ui-tabs') 1273 content_tag(:div, content_tag(:ul, titles) + raw(contents), :class => 'ui-tabs')
1285 end 1274 end
1286 1275
1287 - def jquery_token_input_messages_json(hintText = _('Type in an keyword'), noResultsText = _('No results'), searchingText = _('Searching...'))  
1288 - "hintText: '#{hintText}', noResultsText: '#{noResultsText}', searchingText: '#{searchingText}'"  
1289 - end  
1290 -  
1291 def delete_article_message(article) 1276 def delete_article_message(article)
1292 if article.folder? 1277 if article.folder?
1293 _("Are you sure that you want to remove the folder \"#{article.name}\"? Note that all the items inside it will also be removed!") 1278 _("Are you sure that you want to remove the folder \"#{article.name}\"? Note that all the items inside it will also be removed!")
@@ -1309,8 +1294,8 @@ module ApplicationHelper @@ -1309,8 +1294,8 @@ module ApplicationHelper
1309 @plugins.dispatch("content_remove_#{action.to_s}", @page).include?(true) 1294 @plugins.dispatch("content_remove_#{action.to_s}", @page).include?(true)
1310 end 1295 end
1311 1296
1312 - def template_options(klass, field_name)  
1313 - templates = klass.templates(environment) 1297 + def template_options(kind, field_name)
  1298 + templates = environment.send(kind).templates
1314 return '' if templates.count == 0 1299 return '' if templates.count == 0
1315 return hidden_field_tag("#{field_name}[template_id]", templates.first.id) if templates.count == 1 1300 return hidden_field_tag("#{field_name}[template_id]", templates.first.id) if templates.count == 1
1316 1301
@@ -1328,50 +1313,6 @@ module ApplicationHelper @@ -1328,50 +1313,6 @@ module ApplicationHelper
1328 ) 1313 )
1329 end 1314 end
1330 1315
1331 - def token_input_field_tag(name, element_id, search_action, options = {}, text_field_options = {}, html_options = {})  
1332 - options[:min_chars] ||= 3  
1333 - options[:hint_text] ||= _("Type in a search term")  
1334 - options[:no_results_text] ||= _("No results")  
1335 - options[:searching_text] ||= _("Searching...")  
1336 - options[:search_delay] ||= 1000  
1337 - options[:prevent_duplicates] ||= true  
1338 - options[:backspace_delete_item] ||= false  
1339 - options[:focus] ||= false  
1340 - options[:avoid_enter] ||= true  
1341 - options[:on_result] ||= 'null'  
1342 - options[:on_add] ||= 'null'  
1343 - options[:on_delete] ||= 'null'  
1344 - options[:on_ready] ||= 'null'  
1345 -  
1346 - result = text_field_tag(name, nil, text_field_options.merge(html_options.merge({:id => element_id})))  
1347 - result += javascript_tag("jQuery('##{element_id}')  
1348 - .tokenInput('#{url_for(search_action)}', {  
1349 - minChars: #{options[:min_chars].to_json},  
1350 - prePopulate: #{options[:pre_populate].to_json},  
1351 - hintText: #{options[:hint_text].to_json},  
1352 - noResultsText: #{options[:no_results_text].to_json},  
1353 - searchingText: #{options[:searching_text].to_json},  
1354 - searchDelay: #{options[:serach_delay].to_json},  
1355 - preventDuplicates: #{options[:prevent_duplicates].to_json},  
1356 - backspaceDeleteItem: #{options[:backspace_delete_item].to_json},  
1357 - queryParam: #{name.to_json},  
1358 - tokenLimit: #{options[:token_limit].to_json},  
1359 - onResult: #{options[:on_result]},  
1360 - onAdd: #{options[:on_add]},  
1361 - onDelete: #{options[:on_delete]},  
1362 - onReady: #{options[:on_ready]},  
1363 - });  
1364 - ")  
1365 - result += javascript_tag("jQuery('##{element_id}').focus();") if options[:focus]  
1366 - if options[:avoid_enter]  
1367 - result += javascript_tag("jQuery('#token-input-#{element_id}')  
1368 - .live('keydown', function(event){  
1369 - if(event.keyCode == '13') return false;  
1370 - });")  
1371 - end  
1372 - result  
1373 - end  
1374 -  
1375 def expirable_content_reference(content, action, text, url, options = {}) 1316 def expirable_content_reference(content, action, text, url, options = {})
1376 reason = @plugins.dispatch("content_expire_#{action.to_s}", content).first 1317 reason = @plugins.dispatch("content_expire_#{action.to_s}", content).first
1377 options[:title] = reason 1318 options[:title] = reason
@@ -1432,4 +1373,8 @@ module ApplicationHelper @@ -1432,4 +1373,8 @@ module ApplicationHelper
1432 content.nil? ? '' : content.id.to_s 1373 content.nil? ? '' : content.id.to_s
1433 end 1374 end
1434 1375
  1376 + def display_article_versions(article, version = nil)
  1377 + content_tag('ul', article.versions.map {|v| link_to("r#{v.version}", @page.url.merge(:version => v.version))})
  1378 + end
  1379 +
1435 end 1380 end
app/helpers/article_helper.rb
1 module ArticleHelper 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 @article = article 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 content_tag('h4', _('Options')) + 9 content_tag('h4', _('Options')) +
17 content_tag('div', 10 content_tag('div',
18 (article.profile.has_members? ? 11 (article.profile.has_members? ?
@@ -35,7 +28,7 @@ module ArticleHelper @@ -35,7 +28,7 @@ module ArticleHelper
35 'div', 28 'div',
36 check_box(:article, :notify_comments) + 29 check_box(:article, :notify_comments) +
37 content_tag('label', _('I want to receive a notification of each comment written by e-mail'), :for => 'article_notify_comments') + 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 content_tag( 34 content_tag(
@@ -49,10 +42,40 @@ module ArticleHelper @@ -49,10 +42,40 @@ module ArticleHelper
49 'div', 42 'div',
50 check_box(:article, :display_hits) + 43 check_box(:article, :display_hits) +
51 content_tag('label', _('I want this article to display the number of hits it received'), :for => 'article_display_hits') 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 end 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 def cms_label_for_new_children 79 def cms_label_for_new_children
57 _('New article') 80 _('New article')
58 end 81 end
app/helpers/blog_helper.rb
1 module BlogHelper 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 @article = article 6 @article = article
5 hidden_field_tag('article[published]', 1) + 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 end 10 end
8 11
9 def cms_label_for_new_children 12 def cms_label_for_new_children
app/helpers/box_organizer_helper.rb
@@ -4,4 +4,10 @@ module BoxOrganizerHelper @@ -4,4 +4,10 @@ module BoxOrganizerHelper
4 render :partial => 'icon_selector', :locals => { :icon => icon } 4 render :partial => 'icon_selector', :locals => { :icon => icon }
5 end 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 \ No newline at end of file 14 \ No newline at end of file
app/helpers/boxes_helper.rb
@@ -39,7 +39,7 @@ module BoxesHelper @@ -39,7 +39,7 @@ module BoxesHelper
39 end 39 end
40 40
41 def display_boxes(holder, main_content) 41 def display_boxes(holder, main_content)
42 - boxes = holder.boxes.first(holder.boxes_limit) 42 + boxes = holder.boxes.with_position.first(holder.boxes_limit)
43 content = boxes.reverse.map { |item| display_box(item, main_content) }.join("\n") 43 content = boxes.reverse.map { |item| display_box(item, main_content) }.join("\n")
44 content = main_content if (content.blank?) 44 content = main_content if (content.blank?)
45 45
@@ -65,7 +65,7 @@ module BoxesHelper @@ -65,7 +65,7 @@ module BoxesHelper
65 end 65 end
66 66
67 def display_box_content(box, main_content) 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 box_decorator.select_blocks(box.blocks.includes(:box), context).map { |item| display_block(item, main_content) }.join("\n") + box_decorator.block_target(box) 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 end 70 end
71 71
@@ -102,14 +102,16 @@ module BoxesHelper @@ -102,14 +102,16 @@ module BoxesHelper
102 102
103 result = filter_html(result, block) 103 result = filter_html(result, block)
104 104
105 - box_decorator.block_target(block.box, block) +  
106 - content_tag('div',  
107 - content_tag('div', 105 + content_tag('div',
  106 + box_decorator.block_target(block.box, block) +
  107 + content_tag('div',
108 content_tag('div', 108 content_tag('div',
109 - result + footer_content + box_decorator.block_edit_buttons(block),  
110 - :class => 'block-inner-2'),  
111 - :class => 'block-inner-1'),  
112 - options) + 109 + content_tag('div',
  110 + result + footer_content + box_decorator.block_edit_buttons(block),
  111 + :class => 'block-inner-2'),
  112 + :class => 'block-inner-1'),
  113 + options),
  114 + :class => 'block-outer') +
113 box_decorator.block_handle(block) 115 box_decorator.block_handle(block)
114 end 116 end
115 117
@@ -210,6 +212,7 @@ module BoxesHelper @@ -210,6 +212,7 @@ module BoxesHelper
210 212
211 if !block.main? 213 if !block.main?
212 buttons << icon_button(:delete, _('Remove block'), { :action => 'remove', :id => block.id }, { :method => 'post', :confirm => _('Are you sure you want to remove this block?')}) 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' })
213 end 216 end
214 217
215 if block.respond_to?(:help) 218 if block.respond_to?(:help)
@@ -225,15 +228,11 @@ module BoxesHelper @@ -225,15 +228,11 @@ module BoxesHelper
225 228
226 # DEPRECATED. Do not use this. 229 # DEPRECATED. Do not use this.
227 def import_blocks_stylesheets(options = {}) 230 def import_blocks_stylesheets(options = {})
228 - @blocks_css_files ||= current_blocks.map{|b|'blocks/' + block_css_class_name(b)}.uniq 231 + @blocks_css_files ||= current_blocks.map{|block|'blocks/' + block.class.name.to_css_class}.uniq
229 stylesheet_import(@blocks_css_files, options) 232 stylesheet_import(@blocks_css_files, options)
230 end 233 end
231 -  
232 - def block_css_class_name(block)  
233 - block.class.name.underscore.gsub('_', '-')  
234 - end  
235 def block_css_classes(block) 234 def block_css_classes(block)
236 - classes = block_css_class_name(block) 235 + classes = block.class.name.to_css_class
237 classes += ' invisible-block' if block.display == 'never' 236 classes += ' invisible-block' if block.display == 'never'
238 classes 237 classes
239 end 238 end
app/helpers/catalog_helper.rb
@@ -9,7 +9,11 @@ module CatalogHelper @@ -9,7 +9,11 @@ module CatalogHelper
9 @categories = ProductCategory.on_level(params[:level]).order(:name) 9 @categories = ProductCategory.on_level(params[:level]).order(:name)
10 end 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 end 17 end
14 18
15 def breadcrumb(category) 19 def breadcrumb(category)
@@ -20,20 +24,24 @@ module CatalogHelper @@ -20,20 +24,24 @@ module CatalogHelper
20 content_tag('div', all_items.join(' &rarr; '), :id => 'breadcrumb') 24 content_tag('div', all_items.join(' &rarr; '), :id => 'breadcrumb')
21 end 25 end
22 26
23 - def category_link(category, sub = false) 27 + def category_link(category)
24 count = profile.products.from_category(category).count 28 count = profile.products.from_category(category).count
25 name = truncate(category.name, :length => 22 - count.to_s.size) 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 end 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 sub_categories = [] 39 sub_categories = []
33 category.children.order(:name).each do |sub_category| 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 end 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 end 45 end
38 46
39 end 47 end
app/helpers/cms_helper.rb
@@ -22,9 +22,9 @@ module CmsHelper @@ -22,9 +22,9 @@ module CmsHelper
22 22
23 attr_reader :environment 23 attr_reader :environment
24 24
25 - def options_for_article(article) 25 + def options_for_article(article, tokenized_children=nil)
26 article_helper = helper_for_article(article) 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 end 28 end
29 29
30 def link_to_article(article) 30 def link_to_article(article)
app/helpers/comment_helper.rb
@@ -25,7 +25,10 @@ module CommentHelper @@ -25,7 +25,10 @@ module CommentHelper
25 def comment_actions(comment) 25 def comment_actions(comment)
26 url = url_for(:profile => profile.identifier, :controller => :comment, :action => :check_actions, :id => comment.id) 26 url = url_for(:profile => profile.identifier, :controller => :comment, :action => :check_actions, :id => comment.id)
27 links = links_for_comment_actions(comment) 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 end 32 end
30 33
31 private 34 private
app/helpers/folder_helper.rb
1 module FolderHelper 1 module FolderHelper
2 2
3 include ShortFilename 3 include ShortFilename
  4 + include ArticleHelper
4 5
5 def list_articles(articles, recursive = false) 6 def list_articles(articles, recursive = false)
6 if !articles.blank? 7 if !articles.blank?
@@ -60,19 +61,10 @@ module FolderHelper @@ -60,19 +61,10 @@ module FolderHelper
60 "icon-new icon-new%s" % klass.icon_name 61 "icon-new icon-new%s" % klass.icon_name
61 end 62 end
62 63
63 - def custom_options_for_article(article) 64 + def custom_options_for_article(article,tokenized_children)
64 @article = article 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 content_tag('div', 68 content_tag('div',
77 hidden_field_tag('article[accept_comments]', 0) 69 hidden_field_tag('article[accept_comments]', 0)
78 ) 70 )
app/helpers/forgot_password_helper.rb 0 → 100644
@@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
  1 +module ForgotPasswordHelper
  2 + def plugins_options
  3 + @plugins.dispatch(:change_password_fields)
  4 + end
  5 +
  6 + def user_fields
  7 + %w[login email] + plugins_options.select {|options| options[:model].to_sym == :user }.map { |options| options[:field].to_s }
  8 + end
  9 +
  10 + def person_fields
  11 + %w[] + plugins_options.select {|options| options[:model].to_sym == :person }.map { |options| options[:field].to_s }
  12 + end
  13 +
  14 + def fields
  15 + user_fields + person_fields
  16 + end
  17 +
  18 + def fields_label
  19 + labels = [
  20 + _('Username'),
  21 + _('Email'),
  22 + ] + plugins_options.map { |options| options[:name] }
  23 +
  24 + last = labels.pop
  25 + label = labels.join(', ')
  26 + "#{label} #{_('or')} #{last}"
  27 + end
  28 +
  29 + def build_query(fields, value)
  30 + fields.map {|field| "#{field} = '#{value}'"}.join(' OR ')
  31 + end
  32 +
  33 + def fetch_requestors(value)
  34 + requestors = []
  35 + person_query = build_query(person_fields, value)
  36 + user_query = build_query(user_fields, value)
  37 +
  38 + requestors += Person.where(person_query).where(:environment_id => environment.id) if person_fields.present?
  39 + requestors += User.where(user_query).where(:environment_id => environment.id).map(&:person) if user_fields.present?
  40 + requestors
  41 + end
  42 +
  43 +end
app/helpers/profile_helper.rb
@@ -16,14 +16,17 @@ module ProfileHelper @@ -16,14 +16,17 @@ module ProfileHelper
16 end 16 end
17 17
18 def display_contact(profile) 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 else 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 end 30 end
28 end 31 end
29 32
app/helpers/token_helper.rb 0 → 100644
@@ -0,0 +1,51 @@ @@ -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 \ No newline at end of file 52 \ No newline at end of file
app/helpers/users_helper.rb 0 → 100644
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
  1 +module UsersHelper
  2 +
  3 + FILTER_TRANSLATION = {
  4 + 'all_users' => _('All users'),
  5 + 'admin_users' => _('Admin users'),
  6 + 'activated_users' => _('Activated users'),
  7 + 'deactivated_users' => _('Deativated users'),
  8 + }
  9 +
  10 + def filter_selector(filter, float = 'right')
  11 + options = options_for_select(FILTER_TRANSLATION.map {|key, name| [name, key]}, :selected => filter)
  12 + url_params = url_for(params.merge(:filter => 'FILTER'))
  13 + onchange = "document.location.href = '#{url_params}'.replace('FILTER', this.value)"
  14 + select_field = select_tag(:filter, options, :onchange => onchange)
  15 + content_tag('div',
  16 + content_tag('strong', _('Filter')) + ': ' + select_field,
  17 + :class => "environment-users-customize-search"
  18 + )
  19 + end
  20 +
  21 + def filter_title(filter)
  22 + FILTER_TRANSLATION[filter]
  23 + end
  24 +
  25 +end
app/models/article.rb
@@ -69,6 +69,7 @@ class Article &lt; ActiveRecord::Base @@ -69,6 +69,7 @@ class Article &lt; ActiveRecord::Base
69 settings_items :allow_members_to_edit, :type => :boolean, :default => false 69 settings_items :allow_members_to_edit, :type => :boolean, :default => false
70 settings_items :moderate_comments, :type => :boolean, :default => false 70 settings_items :moderate_comments, :type => :boolean, :default => false
71 settings_items :followers, :type => Array, :default => [] 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 belongs_to :reference_article, :class_name => "Article", :foreign_key => 'reference_article_id' 74 belongs_to :reference_article, :class_name => "Article", :foreign_key => 'reference_article_id'
74 75
@@ -157,7 +158,7 @@ class Article &lt; ActiveRecord::Base @@ -157,7 +158,7 @@ class Article &lt; ActiveRecord::Base
157 end 158 end
158 159
159 def css_class_list 160 def css_class_list
160 - [self.class.name.underscore.dasherize] 161 + [self.class.name.to_css_class]
161 end 162 end
162 163
163 def css_class_name 164 def css_class_name
@@ -200,6 +201,7 @@ class Article &lt; ActiveRecord::Base @@ -200,6 +201,7 @@ class Article &lt; ActiveRecord::Base
200 acts_as_filesystem 201 acts_as_filesystem
201 202
202 acts_as_versioned 203 acts_as_versioned
  204 + self.non_versioned_columns << 'setting'
203 205
204 def comment_data 206 def comment_data
205 comments.map {|item| [item.title, item.body].join(' ') }.join(' ') 207 comments.map {|item| [item.title, item.body].join(' ') }.join(' ')
@@ -288,6 +290,11 @@ class Article &lt; ActiveRecord::Base @@ -288,6 +290,11 @@ class Article &lt; ActiveRecord::Base
288 'text-html' 290 'text-html'
289 end 291 end
290 292
  293 + # TODO Migrate the class method icon_name to instance methods.
  294 + def icon_name
  295 + self.class.icon_name(self)
  296 + end
  297 +
291 def mime_type 298 def mime_type
292 'text/html' 299 'text/html'
293 end 300 end
@@ -350,22 +357,6 @@ class Article &lt; ActiveRecord::Base @@ -350,22 +357,6 @@ class Article &lt; ActiveRecord::Base
350 true 357 true
351 end 358 end
352 359
353 - def folder?  
354 - false  
355 - end  
356 -  
357 - def blog?  
358 - false  
359 - end  
360 -  
361 - def forum?  
362 - false  
363 - end  
364 -  
365 - def uploaded_file?  
366 - false  
367 - end  
368 -  
369 def has_posts? 360 def has_posts?
370 false 361 false
371 end 362 end
@@ -459,11 +450,12 @@ class Article &lt; ActiveRecord::Base @@ -459,11 +450,12 @@ class Article &lt; ActiveRecord::Base
459 end 450 end
460 451
461 named_scope :published, :conditions => { :published => true } 452 named_scope :published, :conditions => { :published => true }
462 - named_scope :folders, :conditions => { :type => folder_types}  
463 - 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]}}
464 named_scope :galleries, :conditions => { :type => 'Gallery' } 455 named_scope :galleries, :conditions => { :type => 'Gallery' }
465 named_scope :images, :conditions => { :is_image => true } 456 named_scope :images, :conditions => { :is_image => true }
466 named_scope :text_articles, :conditions => [ 'articles.type IN (?)', text_article_types ] 457 named_scope :text_articles, :conditions => [ 'articles.type IN (?)', text_article_types ]
  458 + named_scope :with_types, lambda { |types| { :conditions => [ 'articles.type IN (?)', types ] } }
467 459
468 named_scope :more_popular, :order => 'hits DESC' 460 named_scope :more_popular, :order => 'hits DESC'
469 named_scope :more_comments, :order => "comments_count DESC" 461 named_scope :more_comments, :order => "comments_count DESC"
@@ -480,7 +472,8 @@ class Article &lt; ActiveRecord::Base @@ -480,7 +472,8 @@ class Article &lt; ActiveRecord::Base
480 472
481 def display_unpublished_article_to?(user) 473 def display_unpublished_article_to?(user)
482 user == author || allow_view_private_content?(user) || user == profile || 474 user == author || allow_view_private_content?(user) || user == profile ||
483 - 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)
484 end 477 end
485 478
486 def display_to?(user = nil) 479 def display_to?(user = nil)
@@ -596,17 +589,50 @@ class Article &lt; ActiveRecord::Base @@ -596,17 +589,50 @@ class Article &lt; ActiveRecord::Base
596 false 589 false
597 end 590 end
598 591
599 - def author  
600 - if versions.empty?  
601 - last_changed_by  
602 - else  
603 - author_id = versions.first.last_changed_by_id 592 + def folder?
  593 + false
  594 + end
  595 +
  596 + def blog?
  597 + false
  598 + end
  599 +
  600 + def forum?
  601 + false
  602 + end
  603 +
  604 + def uploaded_file?
  605 + false
  606 + end
  607 +
  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
604 Person.exists?(author_id) ? Person.find(author_id) : nil 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
605 end 630 end
606 end 631 end
607 632
608 - def author_name  
609 - 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'))
610 end 636 end
611 637
612 def author_url 638 def author_url
@@ -617,13 +643,20 @@ class Article &lt; ActiveRecord::Base @@ -617,13 +643,20 @@ class Article &lt; ActiveRecord::Base
617 author ? author.id : nil 643 author ? author.id : nil
618 end 644 end
619 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 +
620 alias :active_record_cache_key :cache_key 651 alias :active_record_cache_key :cache_key
621 def cache_key(params = {}, the_profile = nil, language = 'en') 652 def cache_key(params = {}, the_profile = nil, language = 'en')
622 active_record_cache_key+'-'+language + 653 active_record_cache_key+'-'+language +
623 (allow_post_content?(the_profile) ? "-owner" : '') + 654 (allow_post_content?(the_profile) ? "-owner" : '') +
624 (params[:npage] ? "-npage-#{params[:npage]}" : '') + 655 (params[:npage] ? "-npage-#{params[:npage]}" : '') +
625 (params[:year] ? "-year-#{params[:year]}" : '') + 656 (params[:year] ? "-year-#{params[:year]}" : '') +
626 - (params[:month] ? "-month-#{params[:month]}" : '') 657 + (params[:month] ? "-month-#{params[:month]}" : '') +
  658 + (params[:version] ? "-version-#{params[:version]}" : '')
  659 +
627 end 660 end
628 661
629 def first_paragraph 662 def first_paragraph
app/models/article_block.rb
@@ -49,8 +49,8 @@ class ArticleBlock &lt; Block @@ -49,8 +49,8 @@ class ArticleBlock &lt; Block
49 end 49 end
50 50
51 def available_articles 51 def available_articles
52 - return [] if self.box.nil? or self.box.owner.nil?  
53 - self.box.owner.kind_of?(Environment) ? self.box.owner.portal_community.articles : self.box.owner.articles 52 + return [] if self.owner.nil?
  53 + self.owner.kind_of?(Environment) ? self.owner.portal_community.articles : self.owner.articles
54 end 54 end
55 55
56 def posts_per_page 56 def posts_per_page
app/models/block.rb
@@ -23,30 +23,41 @@ class Block &lt; ActiveRecord::Base @@ -23,30 +23,41 @@ class Block &lt; ActiveRecord::Base
23 # * <tt>:article</tt>: the article being viewed currently 23 # * <tt>:article</tt>: the article being viewed currently
24 # * <tt>:language</tt>: in which language the block will be displayed 24 # * <tt>:language</tt>: in which language the block will be displayed
25 def visible?(context = nil) 25 def visible?(context = nil)
26 - if display == 'never'  
27 - return false  
28 - end 26 + return false if display == 'never'
  27 +
29 if context 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 end 35 end
46 end 36 end
  37 +
  38 + true
  39 + end
  40 +
  41 + def display_always(context)
47 true 42 true
48 end 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 # The condition for displaying a block. It can assume the following values: 61 # The condition for displaying a block. It can assume the following values:
51 # 62 #
52 # * <tt>'always'</tt>: the block is always displayed 63 # * <tt>'always'</tt>: the block is always displayed
@@ -153,4 +164,29 @@ class Block &lt; ActiveRecord::Base @@ -153,4 +164,29 @@ class Block &lt; ActiveRecord::Base
153 } 164 }
154 end 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 end 192 end
app/models/blog.rb
@@ -6,7 +6,7 @@ class Blog &lt; Folder @@ -6,7 +6,7 @@ class Blog &lt; Folder
6 #FIXME This should be used until there is a migration to fix all blogs that 6 #FIXME This should be used until there is a migration to fix all blogs that
7 # already have folders inside them 7 # already have folders inside them
8 def posts_with_no_folders 8 def posts_with_no_folders
9 - posts_without_no_folders.no_folders 9 + posts_without_no_folders.no_folders(profile)
10 end 10 end
11 alias_method_chain :posts, :no_folders 11 alias_method_chain :posts, :no_folders
12 12
app/models/box.rb
@@ -3,12 +3,17 @@ class Box &lt; ActiveRecord::Base @@ -3,12 +3,17 @@ class Box &lt; ActiveRecord::Base
3 acts_as_list :scope => 'owner_id = #{owner_id} and owner_type = \'#{owner_type}\'' 3 acts_as_list :scope => 'owner_id = #{owner_id} and owner_type = \'#{owner_type}\''
4 has_many :blocks, :dependent => :destroy, :order => 'position' 4 has_many :blocks, :dependent => :destroy, :order => 'position'
5 5
  6 + include Noosfero::Plugin::HotSpot
  7 +
  8 + named_scope :with_position, :conditions => ['boxes.position > 0']
  9 +
6 def environment 10 def environment
7 owner ? (owner.kind_of?(Environment) ? owner : owner.environment) : nil 11 owner ? (owner.kind_of?(Environment) ? owner : owner.environment) : nil
8 end 12 end
9 13
10 def acceptable_blocks 14 def acceptable_blocks
11 - to_css_class_name central? ? Box.acceptable_center_blocks : Box.acceptable_side_blocks 15 + 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])
  16 + to_css_class_name(blocks_classes)
12 end 17 end
13 18
14 def central? 19 def central?
@@ -61,6 +66,7 @@ class Box &lt; ActiveRecord::Base @@ -61,6 +66,7 @@ class Box &lt; ActiveRecord::Base
61 MyNetworkBlock, 66 MyNetworkBlock,
62 PeopleBlock, 67 PeopleBlock,
63 ProductsBlock, 68 ProductsBlock,
  69 + ProductCategoriesBlock,
64 ProfileImageBlock, 70 ProfileImageBlock,
65 ProfileInfoBlock, 71 ProfileInfoBlock,
66 ProfileSearchBlock, 72 ProfileSearchBlock,
@@ -74,8 +80,8 @@ class Box &lt; ActiveRecord::Base @@ -74,8 +80,8 @@ class Box &lt; ActiveRecord::Base
74 80
75 private 81 private
76 82
77 - def to_css_class_name(blocks)  
78 - blocks.map{ |block| block.to_s.underscore.tr('_', '-') } 83 + def to_css_class_name(blocks_classes)
  84 + blocks_classes.map{ |block_class| block_class.name.to_css_class }
79 end 85 end
80 86
81 end 87 end
app/models/change_password.rb
1 class ChangePassword < Task 1 class ChangePassword < Task
2 2
3 - attr_accessor :login, :email, :password, :password_confirmation, :environment_id 3 + attr_accessor :password, :password_confirmation
4 4
5 def self.human_attribute_name(attrib) 5 def self.human_attribute_name(attrib)
6 case attrib.to_sym 6 case attrib.to_sym
7 - when :login:  
8 - _('Username')  
9 - when :email  
10 - _('e-mail')  
11 when :password 7 when :password
12 _('Password') 8 _('Password')
13 when :password_confirmation 9 when :password_confirmation
@@ -17,29 +13,7 @@ class ChangePassword &lt; Task @@ -17,29 +13,7 @@ class ChangePassword &lt; Task
17 end 13 end
18 end 14 end
19 15
20 - ###################################################  
21 - # validations for creating a ChangePassword task  
22 -  
23 - validates_presence_of :login, :email, :environment_id, :on => :create, :message => _('must be filled in')  
24 -  
25 - validates_format_of :email, :on => :create, :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda { |obj| !obj.email.blank? })  
26 -  
27 - validates_each :login, :on => :create do |data,attr,value|  
28 - unless data.login.blank? || data.email.blank?  
29 - user = User.find_by_login_and_environment_id(data.login, data.environment_id)  
30 - if user.nil?  
31 - data.errors.add(:login, _('is invalid or user does not exists.'))  
32 - else  
33 - if user.email != data.email  
34 - data.errors.add(:email, _('does not match the username you filled in'))  
35 - end  
36 - end  
37 - end  
38 - end  
39 -  
40 - before_validation_on_create do |change_password|  
41 - change_password.requestor = Person.find_by_identifier_and_environment_id(change_password.login, change_password.environment_id)  
42 - end 16 + validates_presence_of :requestor
43 17
44 ################################################### 18 ###################################################
45 # validations for updating a ChangePassword task 19 # validations for updating a ChangePassword task
@@ -49,6 +23,10 @@ class ChangePassword &lt; Task @@ -49,6 +23,10 @@ class ChangePassword &lt; Task
49 validates_presence_of :password_confirmation, :on => :update, :if => lambda { |change| change.status != Task::Status::CANCELLED } 23 validates_presence_of :password_confirmation, :on => :update, :if => lambda { |change| change.status != Task::Status::CANCELLED }
50 validates_confirmation_of :password, :if => lambda { |change| change.status != Task::Status::CANCELLED } 24 validates_confirmation_of :password, :if => lambda { |change| change.status != Task::Status::CANCELLED }
51 25
  26 + def environment
  27 + requestor.environment unless requestor.nil?
  28 + end
  29 +
52 def title 30 def title
53 _("Change password") 31 _("Change password")
54 end 32 end
@@ -87,12 +65,8 @@ class ChangePassword &lt; Task @@ -87,12 +65,8 @@ class ChangePassword &lt; Task
87 url = url_for(:host => hostname, :controller => 'account', :action => 'new_password', :code => code) 65 url = url_for(:host => hostname, :controller => 'account', :action => 'new_password', :code => code)
88 66
89 lambda do 67 lambda do
90 - _("In order to change your password, please visit the following address:\n\n%s") % url 68 + _("In order to change your password, please visit the following address:\n\n%s\n\nIf you did not required any change to your password just desconsider this email.") % url
91 end 69 end
92 end 70 end
93 71
94 - def environment  
95 - self.requestor.environment  
96 - end  
97 -  
98 end 72 end
app/models/enterprise.rb
@@ -10,7 +10,7 @@ class Enterprise &lt; Organization @@ -10,7 +10,7 @@ class Enterprise &lt; Organization
10 10
11 N_('Enterprise') 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 has_many :inputs, :through => :products 14 has_many :inputs, :through => :products
15 has_many :production_costs, :as => :owner 15 has_many :production_costs, :as => :owner
16 16
@@ -23,6 +23,7 @@ class Enterprise &lt; Organization @@ -23,6 +23,7 @@ class Enterprise &lt; Organization
23 N_('Organization website'); N_('Historic and current context'); N_('Activities short description'); N_('City'); N_('State'); N_('Country'); N_('ZIP code') 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 settings_items :organization_website, :historic_and_current_context, :activities_short_description, :zip_code, :city, :state, :country 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 extend SetProfileRegionFromCityState::ClassMethods 28 extend SetProfileRegionFromCityState::ClassMethods
28 set_profile_region_from_city_state 29 set_profile_region_from_city_state
@@ -131,8 +132,11 @@ class Enterprise &lt; Organization @@ -131,8 +132,11 @@ class Enterprise &lt; Organization
131 ] 132 ]
132 blocks = [ 133 blocks = [
133 [MainBlock.new], 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 if environment.enabled?('products_for_enterprises') 141 if environment.enabled?('products_for_enterprises')
138 blocks[2].unshift ProductsBlock.new 142 blocks[2].unshift ProductsBlock.new
app/models/environment.rb
@@ -26,7 +26,8 @@ class Environment &lt; ActiveRecord::Base @@ -26,7 +26,8 @@ class Environment &lt; ActiveRecord::Base
26 'manage_environment_users' => N_('Manage environment users'), 26 'manage_environment_users' => N_('Manage environment users'),
27 'manage_environment_templates' => N_('Manage environment templates'), 27 'manage_environment_templates' => N_('Manage environment templates'),
28 'manage_environment_licenses' => N_('Manage environment licenses'), 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 module Roles 33 module Roles
@@ -185,7 +186,7 @@ class Environment &lt; ActiveRecord::Base @@ -185,7 +186,7 @@ class Environment &lt; ActiveRecord::Base
185 has_many :product_categories, :conditions => { :type => 'ProductCategory'} 186 has_many :product_categories, :conditions => { :type => 'ProductCategory'}
186 has_many :regions 187 has_many :regions
187 188
188 - has_many :roles 189 + has_many :roles, :dependent => :destroy
189 190
190 has_many :qualifiers 191 has_many :qualifiers
191 has_many :certifiers 192 has_many :certifiers
@@ -677,6 +678,16 @@ class Environment &lt; ActiveRecord::Base @@ -677,6 +678,16 @@ class Environment &lt; ActiveRecord::Base
677 end 678 end
678 end 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 before_create do |env| 691 before_create do |env|
681 env.settings[:themes] ||= %w[ 692 env.settings[:themes] ||= %w[
682 aluminium 693 aluminium
@@ -692,7 +703,8 @@ class Environment &lt; ActiveRecord::Base @@ -692,7 +703,8 @@ class Environment &lt; ActiveRecord::Base
692 end 703 end
693 704
694 def community_template 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 end 708 end
697 709
698 def community_template=(value) 710 def community_template=(value)
@@ -700,7 +712,8 @@ class Environment &lt; ActiveRecord::Base @@ -700,7 +712,8 @@ class Environment &lt; ActiveRecord::Base
700 end 712 end
701 713
702 def person_template 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 end 717 end
705 718
706 def person_template=(value) 719 def person_template=(value)
@@ -708,7 +721,8 @@ class Environment &lt; ActiveRecord::Base @@ -708,7 +721,8 @@ class Environment &lt; ActiveRecord::Base
708 end 721 end
709 722
710 def enterprise_template 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 end 726 end
713 727
714 def enterprise_template=(value) 728 def enterprise_template=(value)
@@ -716,7 +730,8 @@ class Environment &lt; ActiveRecord::Base @@ -716,7 +730,8 @@ class Environment &lt; ActiveRecord::Base
716 end 730 end
717 731
718 def inactive_enterprise_template 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 end 735 end
721 736
722 def inactive_enterprise_template=(value) 737 def inactive_enterprise_template=(value)
@@ -798,7 +813,7 @@ class Environment &lt; ActiveRecord::Base @@ -798,7 +813,7 @@ class Environment &lt; ActiveRecord::Base
798 end 813 end
799 814
800 def highlighted_products_with_image(options = {}) 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 end 817 end
803 818
804 settings_items :home_cache_in_minutes, :type => :integer, :default => 5 819 settings_items :home_cache_in_minutes, :type => :integer, :default => 5
app/models/forum.rb
@@ -3,6 +3,21 @@ class Forum &lt; Folder @@ -3,6 +3,21 @@ class Forum &lt; Folder
3 acts_as_having_posts :order => 'updated_at DESC' 3 acts_as_having_posts :order => 'updated_at DESC'
4 include PostsLimit 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 def self.type_name 21 def self.type_name
7 _('Forum') 22 _('Forum')
8 end 23 end
@@ -39,4 +54,16 @@ class Forum &lt; Folder @@ -39,4 +54,16 @@ class Forum &lt; Folder
39 paragraphs = Hpricot(body).search('p') 54 paragraphs = Hpricot(body).search('p')
40 paragraphs.empty? ? '' : paragraphs.first.to_html 55 paragraphs.empty? ? '' : paragraphs.first.to_html
41 end 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 end 69 end
app/models/link_list_block.rb
@@ -63,7 +63,7 @@ class LinkListBlock &lt; Block @@ -63,7 +63,7 @@ class LinkListBlock &lt; Block
63 def link_html(link) 63 def link_html(link)
64 klass = 'icon-' + link[:icon] if link[:icon] 64 klass = 'icon-' + link[:icon] if link[:icon]
65 sanitize_link( 65 sanitize_link(
66 - link_to(link[:name], expand_address(link[:address]), :target => link[:target], :class => klass) 66 + link_to(link[:name], expand_address(link[:address]), :target => link[:target], :class => klass, :title => link[:title])
67 ) 67 )
68 end 68 end
69 69
app/models/main_block.rb
@@ -17,11 +17,15 @@ class MainBlock &lt; Block @@ -17,11 +17,15 @@ class MainBlock &lt; Block
17 end 17 end
18 18
19 def editable? 19 def editable?
20 - false 20 + true
21 end 21 end
22 22
23 def cacheable? 23 def cacheable?
24 - false 24 + false
  25 + end
  26 +
  27 + def display_options
  28 + ['always', 'except_home_page']
25 end 29 end
26 30
27 end 31 end
app/models/members_block.rb
1 class MembersBlock < ProfileListBlock 1 class MembersBlock < ProfileListBlock
  2 + settings_items :show_join_leave_button, :type => :boolean, :default => false
2 3
3 def self.description 4 def self.description
4 _('Members') 5 _('Members')
@@ -14,8 +15,10 @@ class MembersBlock &lt; ProfileListBlock @@ -14,8 +15,10 @@ class MembersBlock &lt; ProfileListBlock
14 15
15 def footer 16 def footer
16 profile = self.owner 17 profile = self.owner
  18 + s = show_join_leave_button
  19 +
17 lambda do 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 end 22 end
20 end 23 end
21 24
@@ -23,4 +26,14 @@ class MembersBlock &lt; ProfileListBlock @@ -23,4 +26,14 @@ class MembersBlock &lt; ProfileListBlock
23 owner.members 26 owner.members
24 end 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 end 39 end
app/models/person.rb
@@ -43,9 +43,18 @@ class Person &lt; Profile @@ -43,9 +43,18 @@ class Person &lt; Profile
43 alias_method_chain :has_permission?, :plugins 43 alias_method_chain :has_permission?, :plugins
44 44
45 def memberships 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 end 52 end
48 53
  54 + def memberships_by_role(role)
  55 + memberships.where('role_assignments.role_id = ?', role.id)
  56 + end
  57 +
49 has_many :friendships, :dependent => :destroy 58 has_many :friendships, :dependent => :destroy
50 has_many :friends, :class_name => 'Person', :through => :friendships 59 has_many :friends, :class_name => 'Person', :through => :friendships
51 60
@@ -59,6 +68,9 @@ class Person &lt; Profile @@ -59,6 +68,9 @@ class Person &lt; Profile
59 68
60 has_many :scraps_sent, :class_name => 'Scrap', :foreign_key => :sender_id, :dependent => :destroy 69 has_many :scraps_sent, :class_name => 'Scrap', :foreign_key => :sender_id, :dependent => :destroy
61 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 +
62 named_scope :more_popular, 74 named_scope :more_popular,
63 :select => "#{Profile.qualified_column_names}, count(friend_id) as total", 75 :select => "#{Profile.qualified_column_names}, count(friend_id) as total",
64 :group => Profile.qualified_column_names, 76 :group => Profile.qualified_column_names,
@@ -75,6 +87,10 @@ class Person &lt; Profile @@ -75,6 +87,10 @@ class Person &lt; Profile
75 named_scope :abusers, :joins => :abuse_complaints, :conditions => ['tasks.status = 3'], :select => 'DISTINCT profiles.*' 87 named_scope :abusers, :joins => :abuse_complaints, :conditions => ['tasks.status = 3'], :select => 'DISTINCT profiles.*'
76 named_scope :non_abusers, :joins => "LEFT JOIN tasks ON profiles.id = tasks.requestor_id AND tasks.type='AbuseComplaint'", :conditions => ["tasks.status != 3 OR tasks.id is NULL"], :select => "DISTINCT profiles.*" 88 named_scope :non_abusers, :joins => "LEFT JOIN tasks ON profiles.id = tasks.requestor_id AND tasks.type='AbuseComplaint'", :conditions => ["tasks.status != 3 OR tasks.id is NULL"], :select => "DISTINCT profiles.*"
77 89
  90 + named_scope :admins, :joins => [:role_assignments => :role], :conditions => ['roles.key = ?', 'environment_administrator' ]
  91 + named_scope :activated, :joins => :user, :conditions => ['users.activation_code IS NULL AND users.activated_at IS NOT NULL']
  92 + named_scope :deactivated, :joins => :user, :conditions => ['NOT (users.activation_code IS NULL AND users.activated_at IS NOT NULL)']
  93 +
78 after_destroy do |person| 94 after_destroy do |person|
79 Friendship.find(:all, :conditions => { :friend_id => person.id}).each { |friendship| friendship.destroy } 95 Friendship.find(:all, :conditions => { :friend_id => person.id}).each { |friendship| friendship.destroy }
80 end 96 end
@@ -129,32 +145,34 @@ class Person &lt; Profile @@ -129,32 +145,34 @@ class Person &lt; Profile
129 end 145 end
130 146
131 FIELDS = %w[ 147 FIELDS = %w[
  148 + description
  149 + image
132 preferred_domain 150 preferred_domain
133 nickname 151 nickname
134 sex 152 sex
135 - address  
136 - zip_code  
137 - city  
138 - state  
139 - country  
140 - nationality  
141 birth_date 153 birth_date
  154 + nationality
  155 + country
  156 + state
  157 + city
  158 + district
  159 + zip_code
  160 + address
  161 + address_reference
142 cell_phone 162 cell_phone
143 comercial_phone 163 comercial_phone
  164 + personal_website
  165 + jabber_id
144 schooling 166 schooling
  167 + formation
  168 + custom_formation
  169 + area_of_study
  170 + custom_area_of_study
145 professional_activity 171 professional_activity
146 organization 172 organization
147 organization_website 173 organization_website
148 - area_of_study  
149 - custom_area_of_study  
150 - formation  
151 - custom_formation  
152 contact_phone 174 contact_phone
153 contact_information 175 contact_information
154 - description  
155 - image  
156 - district  
157 - address_reference  
158 ] 176 ]
159 177
160 validates_multiparameter_assignments 178 validates_multiparameter_assignments
@@ -468,7 +486,7 @@ class Person &lt; Profile @@ -468,7 +486,7 @@ class Person &lt; Profile
468 end 486 end
469 487
470 def activities 488 def activities
471 - Scrap.find_by_sql("SELECT id, updated_at, '#{Scrap.to_s}' AS klass FROM #{Scrap.table_name} WHERE scraps.receiver_id = #{self.id} AND scraps.scrap_id IS NULL UNION SELECT id, updated_at, '#{ActionTracker::Record.to_s}' AS klass FROM #{ActionTracker::Record.table_name} WHERE action_tracker.user_id = #{self.id} and action_tracker.verb != 'leave_scrap_to_self' and action_tracker.verb != 'add_member_in_community' ORDER BY updated_at DESC") 489 + Scrap.find_by_sql("SELECT id, updated_at, '#{Scrap.to_s}' AS klass FROM #{Scrap.table_name} WHERE scraps.receiver_id = #{self.id} AND scraps.scrap_id IS NULL UNION SELECT id, updated_at, '#{ActionTracker::Record.to_s}' AS klass FROM #{ActionTracker::Record.table_name} WHERE action_tracker.user_id = #{self.id} and action_tracker.verb != 'leave_scrap_to_self' and action_tracker.verb != 'add_member_in_community' and action_tracker.verb != 'reply_scrap_on_self' ORDER BY updated_at DESC")
472 end 490 end
473 491
474 # by default, all fields are private 492 # by default, all fields are private
@@ -476,6 +494,13 @@ class Person &lt; Profile @@ -476,6 +494,13 @@ class Person &lt; Profile
476 self.fields_privacy.nil? ? [] : self.fields_privacy.reject{ |k, v| v != 'public' }.keys.map(&:to_s) 494 self.fields_privacy.nil? ? [] : self.fields_privacy.reject{ |k, v| v != 'public' }.keys.map(&:to_s)
477 end 495 end
478 496
  497 + include Noosfero::Gravatar
  498 +
  499 + def profile_custom_icon(gravatar_default=nil)
  500 + (self.image.present? && self.image.public_filename(:icon)) ||
  501 + gravatar_profile_image_url(self.email, :size=>20, :d => gravatar_default)
  502 + end
  503 +
479 protected 504 protected
480 505
481 def followed_by?(profile) 506 def followed_by?(profile)
app/models/product.rb
@@ -15,7 +15,11 @@ class Product &lt; ActiveRecord::Base @@ -15,7 +15,11 @@ class Product &lt; ActiveRecord::Base
15 'full' 15 'full'
16 end 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 has_one :region, :through => :enterprise 23 has_one :region, :through => :enterprise
20 validates_presence_of :enterprise 24 validates_presence_of :enterprise
21 25
@@ -29,7 +33,10 @@ class Product &lt; ActiveRecord::Base @@ -29,7 +33,10 @@ class Product &lt; ActiveRecord::Base
29 has_many :qualifiers, :through => :product_qualifiers 33 has_many :qualifiers, :through => :product_qualifiers
30 has_many :certifiers, :through => :product_qualifiers 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 validates_presence_of :product_category_id 40 validates_presence_of :product_category_id
34 validates_associated :product_category 41 validates_associated :product_category
35 42
@@ -234,4 +241,10 @@ class Product &lt; ActiveRecord::Base @@ -234,4 +241,10 @@ class Product &lt; ActiveRecord::Base
234 241
235 delegate :enabled, :region, :region_id, :environment, :environment_id, :to => :enterprise 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 end 250 end
app/models/product_categories_block.rb 0 → 100644
@@ -0,0 +1,50 @@ @@ -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
@@ -78,12 +78,18 @@ class Profile &lt; ActiveRecord::Base @@ -78,12 +78,18 @@ class Profile &lt; ActiveRecord::Base
78 #FIXME: these will work only if the subclass is already loaded 78 #FIXME: these will work only if the subclass is already loaded
79 named_scope :enterprises, lambda { {:conditions => (Enterprise.send(:subclasses).map(&:name) << 'Enterprise').map { |klass| "profiles.type = '#{klass}'"}.join(" OR ")} } 79 named_scope :enterprises, lambda { {:conditions => (Enterprise.send(:subclasses).map(&:name) << 'Enterprise').map { |klass| "profiles.type = '#{klass}'"}.join(" OR ")} }
80 named_scope :communities, lambda { {:conditions => (Community.send(:subclasses).map(&:name) << 'Community').map { |klass| "profiles.type = '#{klass}'"}.join(" OR ")} } 80 named_scope :communities, lambda { {:conditions => (Community.send(:subclasses).map(&:name) << 'Community').map { |klass| "profiles.type = '#{klass}'"}.join(" OR ")} }
81 - named_scope :templates, lambda { |environment| { :conditions => {:is_template => true, :environment_id => environment.id} } } 81 + named_scope :templates, {:conditions => {:is_template => true}}
  82 + named_scope :no_templates, {:conditions => {:is_template => false}}
82 83
83 def members 84 def members
84 scopes = plugins.dispatch_scopes(:organization_members, self) 85 scopes = plugins.dispatch_scopes(:organization_members, self)
85 scopes << Person.members_of(self) 86 scopes << Person.members_of(self)
86 - scopes.size == 1 ? scopes.first : Person.or_scope(scopes) 87 + return scopes.first if scopes.size == 1
  88 + ScopeTool.union *scopes
  89 + end
  90 +
  91 + def members_by_name
  92 + members.order(:name)
87 end 93 end
88 94
89 def members_count 95 def members_count
@@ -98,7 +104,6 @@ class Profile &lt; ActiveRecord::Base @@ -98,7 +104,6 @@ class Profile &lt; ActiveRecord::Base
98 alias_method_chain :count, :distinct 104 alias_method_chain :count, :distinct
99 end 105 end
100 106
101 -  
102 def members_by_role(role) 107 def members_by_role(role)
103 Person.members_of(self).all(:conditions => ['role_assignments.role_id = ?', role.id]) 108 Person.members_of(self).all(:conditions => ['role_assignments.role_id = ?', role.id])
104 end 109 end
@@ -112,6 +117,7 @@ class Profile &lt; ActiveRecord::Base @@ -112,6 +117,7 @@ class Profile &lt; ActiveRecord::Base
112 end 117 end
113 118
114 named_scope :visible, :conditions => { :visible => true } 119 named_scope :visible, :conditions => { :visible => true }
  120 + named_scope :public, :conditions => { :visible => true, :public_profile => true }
115 # Subclasses must override these methods 121 # Subclasses must override these methods
116 named_scope :more_popular 122 named_scope :more_popular
117 named_scope :more_active 123 named_scope :more_active
@@ -760,8 +766,20 @@ private :generate_url, :url_options @@ -760,8 +766,20 @@ private :generate_url, :url_options
760 !environment.enabled?('disable_contact_' + self.class.name.downcase) 766 !environment.enabled?('disable_contact_' + self.class.name.downcase)
761 end 767 end
762 768
  769 + include Noosfero::Plugin::HotSpot
  770 +
  771 + def folder_types
  772 + types = Article.folder_types
  773 + plugins.dispatch(:content_types).each {|type|
  774 + if type < Folder
  775 + types << type.name
  776 + end
  777 + }
  778 + types
  779 + end
  780 +
763 def folders 781 def folders
764 - articles.folders 782 + articles.folders(self)
765 end 783 end
766 784
767 def image_galleries 785 def image_galleries
@@ -844,8 +862,10 @@ private :generate_url, :url_options @@ -844,8 +862,10 @@ private :generate_url, :url_options
844 }[amount] || _("%s members") % amount 862 }[amount] || _("%s members") % amount
845 end 863 end
846 864
847 - def profile_custom_icon  
848 - self.image.public_filename(:icon) unless self.image.blank? 865 + include Noosfero::Gravatar
  866 +
  867 + def profile_custom_icon(gravatar_default=nil)
  868 + image.public_filename(:icon) if image.present?
849 end 869 end
850 870
851 def jid(options = {}) 871 def jid(options = {})
app/models/profile_list_block.rb
@@ -62,4 +62,8 @@ class ProfileListBlock &lt; Block @@ -62,4 +62,8 @@ class ProfileListBlock &lt; Block
62 title.gsub('{#}', profile_count.to_s) 62 title.gsub('{#}', profile_count.to_s)
63 end 63 end
64 64
  65 + # override in subclasses! See MembersBlock for example
  66 + def extra_option
  67 + {}
  68 + end
65 end 69 end
app/models/scrap.rb
@@ -14,9 +14,11 @@ class Scrap &lt; ActiveRecord::Base @@ -14,9 +14,11 @@ class Scrap &lt; ActiveRecord::Base
14 14
15 named_scope :not_replies, :conditions => {:scrap_id => nil} 15 named_scope :not_replies, :conditions => {:scrap_id => nil}
16 16
17 - track_actions :leave_scrap, :after_create, :keep_params => ['sender.name', 'content', 'receiver.name', 'receiver.url'], :if => Proc.new{|s| s.receiver != s.sender}, :custom_target => :action_tracker_target 17 + track_actions :leave_scrap, :after_create, :keep_params => ['sender.name', 'content', 'receiver.name', 'receiver.url'], :if => Proc.new{|s| s.sender != s.receiver && s.sender != s.top_root.receiver}, :custom_target => :action_tracker_target
18 18
19 - track_actions :leave_scrap_to_self, :after_create, :keep_params => ['sender.name', 'content'], :if => Proc.new{|s| s.receiver == s.sender} 19 + track_actions :leave_scrap_to_self, :after_create, :keep_params => ['sender.name', 'content'], :if => Proc.new{|s| s.sender == s.receiver}
  20 +
  21 + track_actions :reply_scrap_on_self, :after_create, :keep_params => ['sender.name', 'content'], :if => Proc.new{|s| s.sender != s.receiver && s.sender == s.top_root.receiver}
20 22
21 after_create do |scrap| 23 after_create do |scrap|
22 scrap.root.update_attribute('updated_at', DateTime.now) unless scrap.root.nil? 24 scrap.root.update_attribute('updated_at', DateTime.now) unless scrap.root.nil?
@@ -25,6 +27,12 @@ class Scrap &lt; ActiveRecord::Base @@ -25,6 +27,12 @@ class Scrap &lt; ActiveRecord::Base
25 27
26 before_validation :strip_all_html_tags 28 before_validation :strip_all_html_tags
27 29
  30 + def top_root
  31 + scrap = self
  32 + scrap = Scrap.find(scrap.scrap_id) while scrap.scrap_id
  33 + scrap
  34 + end
  35 +
28 def strip_all_html_tags 36 def strip_all_html_tags
29 sanitizer = HTML::WhiteListSanitizer.new 37 sanitizer = HTML::WhiteListSanitizer.new
30 self.content = sanitizer.sanitize(self.content, :tags => []) 38 self.content = sanitizer.sanitize(self.content, :tags => [])
app/models/text_article.rb
@@ -17,4 +17,7 @@ class TextArticle &lt; Article @@ -17,4 +17,7 @@ class TextArticle &lt; Article
17 end 17 end
18 end 18 end
19 19
  20 + def can_display_versions?
  21 + true
  22 + end
20 end 23 end
app/models/user.rb
@@ -143,6 +143,21 @@ class User &lt; ActiveRecord::Base @@ -143,6 +143,21 @@ class User &lt; ActiveRecord::Base
143 end 143 end
144 end 144 end
145 145
  146 + # Deactivates the user in the database.
  147 + def deactivate
  148 + return false unless self.person
  149 + self.activated_at = nil
  150 + self.person.visible = false
  151 + begin
  152 + self.person.save! && self.save!
  153 + rescue Exception => exception
  154 + logger.error(exception.to_s)
  155 + false
  156 + else
  157 + true
  158 + end
  159 + end
  160 +
146 def activated? 161 def activated?
147 self.activation_code.nil? && !self.activated_at.nil? 162 self.activation_code.nil? && !self.activated_at.nil?
148 end 163 end
@@ -275,19 +290,21 @@ class User &lt; ActiveRecord::Base @@ -275,19 +290,21 @@ class User &lt; ActiveRecord::Base
275 end 290 end
276 end 291 end
277 292
278 - def data_hash 293 + def data_hash(gravatar_default = nil)
279 friends_list = {} 294 friends_list = {}
280 enterprises = person.enterprises.map { |e| { 'name' => e.short_name, 'identifier' => e.identifier } } 295 enterprises = person.enterprises.map { |e| { 'name' => e.short_name, 'identifier' => e.identifier } }
281 self.person.friends.online.map do |person| 296 self.person.friends.online.map do |person|
282 friends_list[person.identifier] = { 297 friends_list[person.identifier] = {
283 - 'avatar' => person.profile_custom_icon, 298 + 'avatar' => person.profile_custom_icon(gravatar_default),
284 'name' => person.short_name, 299 'name' => person.short_name,
285 'jid' => person.full_jid, 300 'jid' => person.full_jid,
286 'status' => person.user.chat_status, 301 'status' => person.user.chat_status,
287 } 302 }
288 end 303 end
  304 +
289 { 305 {
290 'login' => self.login, 306 'login' => self.login,
  307 + 'avatar' => self.person.profile_custom_icon(gravatar_default),
291 'is_admin' => self.person.is_admin?, 308 'is_admin' => self.person.is_admin?,
292 'since_month' => self.person.created_at.month, 309 'since_month' => self.person.created_at.month,
293 'since_year' => self.person.created_at.year, 310 'since_year' => self.person.created_at.year,
app/views/account/_signup_form.rhtml
@@ -101,7 +101,7 @@ @@ -101,7 +101,7 @@
101 101
102 <%= @plugins.dispatch(:signup_extra_contents).collect { |content| instance_eval(&content) }.join("") %> 102 <%= @plugins.dispatch(:signup_extra_contents).collect { |content| instance_eval(&content) }.join("") %>
103 103
104 - <%= template_options(Person, 'profile_data') %> 104 + <%= template_options(:people, 'profile_data') %>
105 105
106 <% unless @terms_of_use.blank? %> 106 <% unless @terms_of_use.blank? %>
107 <div id='terms-of-use-box' class='formfieldline'> 107 <div id='terms-of-use-box' class='formfieldline'>
app/views/account/forgot_password.rhtml
@@ -2,21 +2,13 @@ @@ -2,21 +2,13 @@
2 2
3 <%= error_messages_for :change_password, :header_message => _('Instructions to password recovery could not be sent'), :message => nil %> 3 <%= error_messages_for :change_password, :header_message => _('Instructions to password recovery could not be sent'), :message => nil %>
4 4
5 -<% labelled_form_for :change_password, @change_password, :url => { :action => 'forgot_password' } do |f| %>  
6 -  
7 - <%= f.text_field :login,  
8 - :onchange => 'this.value = convToValidUsername( this.value )' %>  
9 -  
10 - <%= f.text_field :email %>  
11 -  
12 - <%= f.hidden_field :environment_id, :value => environment.id %>  
13 -  
14 -<div>  
15 - <% button_bar do %>  
16 - <%= submit_button('send', _('Send instructions')) %>  
17 - <% end %>  
18 -</div>  
19 -<%= content_tag(:small,_('After clicking the button above, you will receive an email with a link to a page where you will be able to create a new password.')) %>  
20 - 5 +<% form_tag do %>
  6 + <%= labelled_form_field fields_label, text_field_tag(:value) %>
  7 +
  8 + <div>
  9 + <% button_bar do %>
  10 + <%= submit_button('send', _('Send instructions')) %>
  11 + <% end %>
  12 + </div>
  13 + <%= content_tag(:small,_('After clicking the button above, you will receive an email with a link to a page where you will be able to create a new password.')) %>
21 <% end %> 14 <% end %>
22 -  
app/views/admin_panel/index.rhtml
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 <tr><td><%= link_to _('Environment settings'), :action => 'site_info' %></td></tr> 6 <tr><td><%= link_to _('Environment settings'), :action => 'site_info' %></td></tr>
7 <tr><td><%= link_to _('Features'), :controller => 'features' %></td></tr> 7 <tr><td><%= link_to _('Features'), :controller => 'features' %></td></tr>
8 <tr><td><%= link_to _('Plugins'), :controller => 'plugins' %></td></tr> 8 <tr><td><%= link_to _('Plugins'), :controller => 'plugins' %></td></tr>
  9 + <tr><td><%= link_to _('Appearance'), :controller =>'environment_themes' %></td></tr>
9 <tr><td><%= link_to _('Sideboxes'), :controller => 'environment_design'%></td></tr> 10 <tr><td><%= link_to _('Sideboxes'), :controller => 'environment_design'%></td></tr>
10 <tr><td><%= link_to _('Homepage'), :action => 'set_portal_community' %></td></tr> 11 <tr><td><%= link_to _('Homepage'), :action => 'set_portal_community' %></td></tr>
11 <tr><td><%= link_to _('Licenses'), :controller =>'licenses' %></td></tr> 12 <tr><td><%= link_to _('Licenses'), :controller =>'licenses' %></td></tr>
app/views/blocks/location.html.erb
@@ -3,7 +3,6 @@ @@ -3,7 +3,6 @@
3 <div class='the-localization-map'> 3 <div class='the-localization-map'>
4 <img src="https://maps.google.com/maps/api/staticmap?center=<%=profile.lat%>,<%=profile.lng%>&zoom=<%=block.zoom%>&size=190x250&maptype=<%=block.map_type%>&markers=<%=profile.lat%>,<%=profile.lng%>&sensor=false"/> 4 <img src="https://maps.google.com/maps/api/staticmap?center=<%=profile.lat%>,<%=profile.lng%>&zoom=<%=block.zoom%>&size=190x250&maptype=<%=block.map_type%>&markers=<%=profile.lat%>,<%=profile.lng%>&sensor=false"/>
5 </div> 5 </div>
6 -</div>  
7 <% else %> 6 <% else %>
8 <i><%= _('This profile has no geographical position registered.') %></i> 7 <i><%= _('This profile has no geographical position registered.') %></i>
9 <% end %> 8 <% end %>
app/views/blocks/members.rhtml 0 → 100644
@@ -0,0 +1,5 @@ @@ -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 @@ @@ -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,11 +14,13 @@
14 <p><%= h block.owner.short_name %></p> 14 <p><%= h block.owner.short_name %></p>
15 <% end %> 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 </div><!-- end class="vcard" --> 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,13 +14,15 @@
14 </div> 14 </div>
15 </div> 15 </div>
16 16
17 -<ul class="profile-info-data" id="profile-info-data-<%= block.id %>"> 17 +<ul class="profile-info-data">
18 <li><%= link_to __('Homepage'), block.owner.url, :class => 'url' %></li> 18 <li><%= link_to __('Homepage'), block.owner.url, :class => 'url' %></li>
19 <li><%= link_to _('View profile'), block.owner.public_profile_url %></li> 19 <li><%= link_to _('View profile'), block.owner.public_profile_url %></li>
20 <% if block.owner.enterprise? && block.owner.environment.enabled?('products_for_enterprises') %> 20 <% if block.owner.enterprise? && block.owner.environment.enabled?('products_for_enterprises') %>
21 <li><%= link_to(_('Products/Services'), :controller => 'catalog', :profile => block.owner.identifier) %></li> 21 <li><%= link_to(_('Products/Services'), :controller => 'catalog', :profile => block.owner.identifier) %></li>
22 <% end %> 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 <% if profile.person? %> 26 <% if profile.person? %>
25 <li><%= _('Since %{year}/%{month}') % { :year => block.owner.created_at.year, :month => block.owner.created_at.month } %></li> 27 <li><%= _('Since %{year}/%{month}') % { :year => block.owner.created_at.year, :month => block.owner.created_at.month } %></li>
26 <% end %> 28 <% end %>
@@ -37,9 +39,8 @@ @@ -37,9 +39,8 @@
37 </div> 39 </div>
38 <% end %> 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 </div><!-- end class="vcard" --> 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 @@ @@ -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 <ul> 1 <ul>
  2 + <li>
  3 + <%= render "blocks/profile_info_actions/join_leave_community" %>
  4 + </li>
2 <% if logged_in? %> 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 <% if profile.enable_contact? %> 6 <% if profile.enable_contact? %>
30 <li> 7 <li>
31 <%= link_to content_tag('span', _('Send an e-mail')), 8 <%= link_to content_tag('span', _('Send an e-mail')),
@@ -39,11 +16,5 @@ @@ -39,11 +16,5 @@
39 <li><%= report_abuse(profile, :button) %></li> 16 <li><%= report_abuse(profile, :button) %></li>
40 17
41 <%= render_environment_features(:profile_actions) %> 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 <% end %> 19 <% end %>
49 -</ul> 20 -</ul>
  21 +</ul>
50 \ No newline at end of file 22 \ No newline at end of file
app/views/box_organizer/_article_block.rhtml
1 <div class="article-block-edition"> 1 <div class="article-block-edition">
2 -<% if @block.box.owner.kind_of?(Environment) and @block.box.owner.portal_community.nil? %> 2 +<% if @block.owner.kind_of?(Environment) and @block.owner.portal_community.nil? %>
3 <p id="no_portal_community"> 3 <p id="no_portal_community">
4 <%= _("You don't have an community defined as the portal community. Define it before use this block properly.") %> 4 <%= _("You don't have an community defined as the portal community. Define it before use this block properly.") %>
5 </p> 5 </p>
app/views/box_organizer/_link_list_block.rhtml
1 <strong><%= _('Links') %></strong> 1 <strong><%= _('Links') %></strong>
2 -<div id='edit-link-list-block' style='width:450px'> 2 +<div id='edit-link-list-block'>
3 <table id='links' class='noborder'> 3 <table id='links' class='noborder'>
4 - <tr><th><%= _('Icon') %></th><th><%= _('Name') %></th><th><%= _('Address') %></th><th><%= _('Target') %></th></tr> 4 + <tr>
  5 + <th><%= _('Icon') %></th>
  6 + <th><%= _('Name') %></th>
  7 + <th><%= _('Address') %></th>
  8 + <th><%= _('Title') %></th>
  9 + <th><%= _('Target') %></th>
  10 + </tr>
5 <% for link in @block.links do %> 11 <% for link in @block.links do %>
6 - <tr>  
7 - <td>  
8 - <%= icon_selector(link['icon']) %>  
9 - </td>  
10 - <td><%= text_field_tag 'block[links][][name]', link[:name], :class => 'link-name', :maxlength => 20 %></td>  
11 - <td class='cel-address'><%= text_field_tag 'block[links][][address]', link[:address], :class => 'link-address' %></td>  
12 - <td>  
13 - <%= select_tag('block[links][][target]', options_for_select(LinkListBlock::TARGET_OPTIONS, link[:target])) %>  
14 - </td>  
15 - </tr> 12 + <tr>
  13 + <td><%= icon_selector(link['icon']) %></td>
  14 + <td><%= text_field_tag 'block[links][][name]', link[:name], :class => 'link-name', :maxlength => 20 %></td>
  15 + <td class='cel-address'><%= text_field_tag 'block[links][][address]', link[:address], :class => 'link-address' %></td>
  16 + <td><%= text_field_tag 'block[links][][title]', link[:title], :class => 'link-title' %></td>
  17 + <td><%= select_tag('block[links][][target]', options_for_select(LinkListBlock::TARGET_OPTIONS, link[:target])) %></td>
  18 + </tr>
16 <% end %> 19 <% end %>
17 </table> 20 </table>
18 </div> 21 </div>
@@ -22,8 +25,8 @@ @@ -22,8 +25,8 @@
22 content_tag('td', icon_selector('ok')) + 25 content_tag('td', icon_selector('ok')) +
23 content_tag('td', text_field_tag('block[links][][name]', '', :maxlength => 20)) + 26 content_tag('td', text_field_tag('block[links][][name]', '', :maxlength => 20)) +
24 content_tag('td', text_field_tag('block[links][][address]', nil, :class => 'link-address'), :class => 'cel-address') + 27 content_tag('td', text_field_tag('block[links][][address]', nil, :class => 'link-address'), :class => 'cel-address') +
25 - content_tag('td', select_tag('block[links][][target]',  
26 -options_for_select(LinkListBlock::TARGET_OPTIONS, link[:target]))) 28 + content_tag('td', text_field_tag('block[links][][title]', '', :class => 'link-title')) +
  29 + content_tag('td', select_tag('block[links][][target]', options_for_select(LinkListBlock::TARGET_OPTIONS, '_self')))
27 ) + 30 ) +
28 javascript_tag("$('edit-link-list-block').scrollTop = $('edit-link-list-block').scrollHeight") 31 javascript_tag("$('edit-link-list-block').scrollTop = $('edit-link-list-block').scrollHeight")
29 end %> 32 end %>
app/views/box_organizer/_profile_list_block.rhtml
@@ -2,5 +2,8 @@ @@ -2,5 +2,8 @@
2 <%= labelled_form_field _('Limit of items'), text_field(:block, :limit, :size => 3) %> 2 <%= labelled_form_field _('Limit of items'), text_field(:block, :limit, :size => 3) %>
3 <%= check_box(:block, :prioritize_profiles_with_image) %> 3 <%= check_box(:block, :prioritize_profiles_with_image) %>
4 <label for="block_prioritize_profiles_with_image"><%= _('Prioritize profiles with image') %></label> 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 \ No newline at end of file 10 \ No newline at end of file
app/views/box_organizer/edit.rhtml
1 <div class="block-config-options <%= @block.class.name %>-options"> 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 <% form_tag(:action => 'save', :id => @block.id) do %> 4 <% form_tag(:action => 'save', :id => @block.id) do %>
5 5
@@ -9,17 +9,11 @@ @@ -9,17 +9,11 @@
9 9
10 <%= labelled_form_field _('Display this block:'), '' %> 10 <%= labelled_form_field _('Display this block:'), '' %>
11 <div style='margin-left: 10px'> 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 </div> 17 </div>
24 18
25 <%= labelled_form_field(_('Show for:'), select(:block, :language, [ [ _('all languages'), 'all']] + environment.locales.map {|key, value| [value, key]} )) %> 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 <% extra_content = [] %> 1 <% extra_content = [] %>
2 <% extra_content_list = [] %> 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 </div> 8 </div>
25 <% end %> 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 <% @products.each do |product| %> 16 <% @products.each do |product| %>
29 <% extra_content = @plugins.dispatch(:catalog_item_extras, product).collect { |content| instance_eval(&content) } %> 17 <% extra_content = @plugins.dispatch(:catalog_item_extras, product).collect { |content| instance_eval(&content) } %>
30 <% extra_content_list = @plugins.dispatch(:catalog_list_item_extras, product).collect { |content| instance_eval(&content) } %> 18 <% extra_content_list = @plugins.dispatch(:catalog_list_item_extras, product).collect { |content| instance_eval(&content) } %>
@@ -132,10 +120,11 @@ @@ -132,10 +120,11 @@
132 </ul> 120 </ul>
133 </li> 121 </li>
134 <% end %> 122 <% end %>
135 -</ul> 123 +</ul><!-- end id="product-list" -->
136 124
137 <%= pagination_links @products, :params => {:controller => :catalog, :action => :index, :profile => profile.identifier} %> 125 <%= pagination_links @products, :params => {:controller => :catalog, :action => :index, :profile => profile.identifier} %>
138 126
139 <%= add_zoom_to_images %> 127 <%= add_zoom_to_images %>
140 128
141 <br style="clear:both"/> 129 <br style="clear:both"/>
  130 +</div><!-- end id="product-catalog" -->
app/views/cms/_blog.rhtml
@@ -54,6 +54,15 @@ @@ -54,6 +54,15 @@
54 54
55 <%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 10)) %> 55 <%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 10)) %>
56 56
  57 +<% f.fields_for :image_builder, @article.image do |i| %>
  58 + <%= file_field_or_thumbnail(_('Cover image:'), @article.image, i)%>
  59 + <%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %>
  60 +<% end %>
  61 +
  62 +<% unless @article.image.nil? %>
  63 + <%= labelled_check_box(_('Remove cover image'),'remove_image',true,false)%>
  64 +<% end %>
  65 +
57 <%= labelled_form_field(_('How to display posts:'), f.select(:visualization_format, [ [ _('Full post'), 'full'], [ _('First paragraph'), 'short'] ])) %> 66 <%= labelled_form_field(_('How to display posts:'), f.select(:visualization_format, [ [ _('Full post'), 'full'], [ _('First paragraph'), 'short'] ])) %>
58 67
59 <%= labelled_form_field(_('Posts per page:'), f.select(:posts_per_page, Blog.posts_per_page_options)) %> 68 <%= labelled_form_field(_('Posts per page:'), f.select(:posts_per_page, Blog.posts_per_page_options)) %>
app/views/cms/_forum.rhtml
@@ -11,3 +11,9 @@ @@ -11,3 +11,9 @@
11 <%= labelled_form_field(_('Description:'), text_area(:article, :body, :cols => 64, :rows => 10)) %> 11 <%= labelled_form_field(_('Description:'), text_area(:article, :body, :cols => 64, :rows => 10)) %>
12 12
13 <%= labelled_form_field(_('Posts per page:'), f.select(:posts_per_page, Forum.posts_per_page_options)) %> 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,6 +9,8 @@
9 9
10 <%= hidden_field_tag('back_to', @back_to) %> 10 <%= hidden_field_tag('back_to', @back_to) %>
11 11
  12 + <%= hidden_field_tag('success_back_to', @success_back_to) %>
  13 +
12 <%= render :partial => partial_for_class(@article.class), :locals => { :f => f } %> 14 <%= render :partial => partial_for_class(@article.class), :locals => { :f => f } %>
13 15
14 <% if environment.is_portal_community?(profile) %> 16 <% if environment.is_portal_community?(profile) %>
@@ -33,11 +35,12 @@ @@ -33,11 +35,12 @@
33 <%= content_tag( 'small', _('Separate tags with commas') ) %> 35 <%= content_tag( 'small', _('Separate tags with commas') ) %>
34 36
35 <div id='edit-article-options'> 37 <div id='edit-article-options'>
36 - <%= options_for_article(@article) %> 38 + <%= options_for_article(@article, @tokenized_children) %>
37 </div> 39 </div>
38 40
39 <% button_bar do %> 41 <% button_bar do %>
40 <%= submit_button :save, _('Save') %> 42 <%= submit_button :save, _('Save') %>
  43 +
41 <% if @back_to %> 44 <% if @back_to %>
42 <%= button :cancel, _('Cancel'), @back_to %> 45 <%= button :cancel, _('Cancel'), @back_to %>
43 <% elsif @parent_id || @article.parent %> 46 <% elsif @parent_id || @article.parent %>
@@ -45,6 +48,11 @@ @@ -45,6 +48,11 @@
45 <% else %> 48 <% else %>
46 <%= button :cancel, _('Cancel'), :action => 'index' %> 49 <%= button :cancel, _('Cancel'), :action => 'index' %>
47 <% end %> 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 <% end %> 56 <% end %>
49 <% end %> 57 <% end %>
50 </div> 58 </div>
@@ -54,3 +62,5 @@ @@ -54,3 +62,5 @@
54 <% end %> 62 <% end %>
55 63
56 <br style='clear: both'/> 64 <br style='clear: both'/>
  65 +
  66 +<%= javascript_include_tag "article.js" %>
app/views/comment/_comment.rhtml
@@ -13,11 +13,11 @@ @@ -13,11 +13,11 @@
13 <% else %> 13 <% else %>
14 <% url_image, status_class = comment.author_id ? 14 <% url_image, status_class = comment.author_id ?
15 [comment.removed_user_image, 'icon-user-removed'] : 15 [comment.removed_user_image, 'icon-user-removed'] :
16 - [str_gravatar_url_for( comment.email, :size => 50, :d=>404 ), 'icon-user-unknown'] %> 16 + [gravatar_profile_image_url( comment.email, :size => 50, :d=>404 ), 'icon-user-unknown'] %>
17 17
18 <%= link_to( 18 <%= link_to(
19 image_tag(url_image, :onerror=>'gravatarCommentFailback(this)', 19 image_tag(url_image, :onerror=>'gravatarCommentFailback(this)',
20 - 'data-gravatar'=>str_gravatar_url_for(comment.email, :size=>50)) + 20 + 'data-gravatar'=>gravatar_profile_image_url(comment.email, :size=>50)) +
21 content_tag('span', comment.author_name, :class => 'comment-info') + 21 content_tag('span', comment.author_name, :class => 'comment-info') +
22 content_tag('span', comment.message, 22 content_tag('span', comment.message,
23 :class => 'comment-user-status ' + status_class), 23 :class => 'comment-user-status ' + status_class),
@@ -32,19 +32,7 @@ @@ -32,19 +32,7 @@
32 32
33 <div class="comment-details"> 33 <div class="comment-details">
34 <div class="comment-header"> 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 </div> 36 </div>
49 37
50 <div class="comment-created-at"> 38 <div class="comment-created-at">
@@ -55,6 +43,7 @@ @@ -55,6 +43,7 @@
55 <p/> 43 <p/>
56 <%= txt2html comment.body %> 44 <%= txt2html comment.body %>
57 </div> 45 </div>
  46 + <%= @plugins.dispatch(:comment_extra_contents, local_assigns).collect { |content| instance_eval(&content) }.join("") %>
58 </div> 47 </div>
59 48
60 <div class="comment_reply post_comment_box closed" id="comment_reply_to_<%= comment.id %>"> 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 @@ @@ -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,11 +48,19 @@ @@ -48,11 +48,19 @@
48 <%= expirable_button @page, :suggest, content, url, options %> 48 <%= expirable_button @page, :suggest, content, url, options %>
49 <% end %> 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 <%= report_abuse(profile, :link, @page) %> 55 <%= report_abuse(profile, :link, @page) %>
52 56
53 </div> 57 </div>
54 <div id="article-header"> 58 <div id="article-header">
  59 + <% if @page.blog? and !@page.image.nil? %>
  60 + <div class="blog-cover"><%= image_tag(@page.image.public_filename())%></div>
  61 + <% end %>
55 <%= link_to(image_tag('icons-mime/rss-feed.png'), @page.feed.url, :class => 'blog-feed-link') if @page.has_posts? && @page.feed %> 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("") %>
56 <%= article_title(@page, :no_link => true) %> 64 <%= article_title(@page, :no_link => true) %>
57 <%= article_translations(@page) %> 65 <%= article_translations(@page) %>
58 </div> 66 </div>
app/views/content_viewer/article_versions.rhtml 0 → 100644
@@ -0,0 +1,16 @@ @@ -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 <% add_rss_feed_to_head(@page.name, @page.feed.url) if @page.forum? && @page.feed %> 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 </div> 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 @@ @@ -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
@@ -14,11 +14,15 @@ @@ -14,11 +14,15 @@
14 window.NO_COMMENT_YET = "<%= _('No comments yet') %>"; 14 window.NO_COMMENT_YET = "<%= _('No comments yet') %>";
15 </script> 15 </script>
16 16
17 -<div id="article-toolbar"></div> 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>
  21 +<% end %>
18 22
19 -<script type="text/javascript">  
20 - <%= remote_function :update => "article-toolbar", :url => @page.url.merge({ :toolbar => true, :only_path => true }) %>  
21 -</script> 23 +<div id="article-toolbar">
  24 + <%= render :partial => 'article_toolbar' %>
  25 +</div>
22 26
23 <% if @page.display_hits? || @page.license.present? %> 27 <% if @page.display_hits? || @page.license.present? %>
24 <div id='article-sub-header'> 28 <div id='article-sub-header'>
@@ -36,19 +40,6 @@ @@ -36,19 +40,6 @@
36 </div> 40 </div>
37 <% end %> 41 <% end %>
38 42
39 -<% if !@page.tags.empty? %>  
40 - <div id="article-tags">  
41 - <%= _("This article's tags:") %>  
42 - <%= @page.tags.map { |t| link_to(t, :controller => 'profile', :profile => @profile.identifier, :action => 'tags', :id => t.name ) }.join("\n") %>  
43 - </div>  
44 -<% end %>  
45 -  
46 -<% if @page.parent && !@page.parent.path.blank? %>  
47 -<div id="article-parent">  
48 - <%= button(:back, _('Go back to %s') % @page.parent.short_title, @page.parent.url) %>  
49 -</div>  
50 -<% end %>  
51 -  
52 <%= render :partial => 'shared/disabled_enterprise' %> 43 <%= render :partial => 'shared/disabled_enterprise' %>
53 44
54 <% if NOOSFERO_CONF['addthis_enabled'] %> 45 <% if NOOSFERO_CONF['addthis_enabled'] %>
@@ -84,6 +75,13 @@ @@ -84,6 +75,13 @@
84 </div> 75 </div>
85 <% end %> 76 <% end %>
86 77
  78 +<% if !@page.tags.empty? %>
  79 + <div id="article-tags">
  80 + <%= _("This article's tags:") %>
  81 + <%= @page.tags.map { |t| link_to(t, :controller => 'profile', :profile => @profile.identifier, :action => 'tags', :id => t.name ) }.join("\n") %>
  82 + </div>
  83 +<% end %>
  84 +
87 <%= display_source_info(@page) %> 85 <%= display_source_info(@page) %>
88 86
89 <div class="comments" id="comments_list"> 87 <div class="comments" id="comments_list">
app/views/enterprise_registration/basic_information.rhtml
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 <% end %> 34 <% end %>
35 <% end %> 35 <% end %>
36 36
37 - <%= template_options(Enterprise, 'create_enterprise')%> 37 + <%= template_options(:enterprises, 'create_enterprise')%>
38 38
39 <% button_bar do %> 39 <% button_bar do %>
40 <%= submit_button('next', _('Next'), :cancel => {:profile => current_user.person.identifier, :action=>"enterprises", :controller=>"profile"}) %> 40 <%= submit_button('next', _('Next'), :cancel => {:profile => current_user.person.identifier, :action=>"enterprises", :controller=>"profile"}) %>
app/views/environment_themes/index.rhtml 0 → 100644
@@ -0,0 +1,8 @@ @@ -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,7 +22,7 @@
22 DEFAULT_LOADING_MESSAGE = <%="'#{ _('loading...') }'" %>; 22 DEFAULT_LOADING_MESSAGE = <%="'#{ _('loading...') }'" %>;
23 </script> 23 </script>
24 </head> 24 </head>
25 - <body class="<%= body_classes %>"> 25 + <body class="<%= h body_classes %>">
26 <a href="#content" id="link-go-content"><span><%= _("Go to the content") %></span></a> 26 <a href="#content" id="link-go-content"><span><%= _("Go to the content") %></span></a>
27 27
28 <%= 28 <%=