Commit ad9068c5441140d20f7a697aba6e449ea1c5e983

Authored by Victor Costa
2 parents 40c80d88 0c0fadaa

Merge branch 'rails3' into rails3_proposals

Showing 75 changed files with 667 additions and 363 deletions   Show diff stats
.ackrc 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +--ignore-dir=log
  2 +--ignore-dir=tmp
  3 +--ignore-dir=pkg
@@ -15,6 +15,7 @@ gem 'thin' @@ -15,6 +15,7 @@ gem 'thin'
15 gem 'hpricot' 15 gem 'hpricot'
16 gem 'nokogiri' 16 gem 'nokogiri'
17 gem 'rake', :require => false 17 gem 'rake', :require => false
  18 +gem 'rest-client'
18 19
19 # FIXME list here all actual dependencies (i.e. the ones in debian/control), 20 # FIXME list here all actual dependencies (i.e. the ones in debian/control),
20 # with their GEM names (not the Debian package names) 21 # with their GEM names (not the Debian package names)
INSTALL.chat.md
1 -XMPP/Chat Client Setup  
2 -====================== 1 +XMPP/Chat Setup
  2 +===============
3 3
4 -To configure XMPP/BOSH in Noosfero you need: 4 +The samples of config file to configure a XMPP/BOSH server with ejabberd,
  5 +postgresql and apache2 can be found at util/chat directory.
5 6
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/ 7 +This setup supposes that you are using Noosfero installed via Debian package
  8 +in a production environment.
9 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 -====================== 10 +Steps
  11 +=====
19 12
20 This is a step-by-step guide to get a XMPP service working, in a Debian system. 13 This is a step-by-step guide to get a XMPP service working, in a Debian system.
21 14
22 ## 1. Install the required packages 15 ## 1. Install the required packages
23 16
24 - # apt-get install ejabberd odbc-postgresql 17 + # apt-get install ejabberd odbc-postgresql librestclient-ruby pidgin-data ruby1.8-dev
  18 + # gem install SystemTimer
25 19
26 ## 2. Ejabberd configuration 20 ## 2. Ejabberd configuration
27 21
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]]. 22 + # cp /usr/share/noosfero/util/chat/ejabberd.cfg /etc/ejabberd/
57 23
58 -Add option "`{default_room_options, [{anonymous, false}]}`" to `/etc/ejabberd/ejabberd.cfg` in mod_muc session. See below: 24 +Edit the /etc/ejabberd/ejabberd.cfg file and set your domain on the first 2 lines.
59 25
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}.` 26 +## 3. Configuring Postgresql
82 27
83 - * Set database server name  
84 - `{odbc_server, "DSN=PostgreSQLEjabberdNoosfero"}.` 28 +Give permission to noosfero user create new roles, login as
  29 +postgres user and execute:
85 30
  31 + $ psql
  32 + postgres=# GRANT CREATE ON DATABASE noosfero TO noosfero;
86 33
87 -### 2.5. Increase the shaper traffic limit 34 +Change the postgresql authentication method to md5 instead of ident,
  35 +add the following line to the file /etc/postgresql/8.4/main/pg_hba.conf:
88 36
89 - { shaper, normal, { maxrate, 10000000 } }. 37 + # Noosfero user
  38 + local noosfero noosfero md5
90 39
  40 +(add this line before the following line)
91 41
92 -### 2.6. Disable unused modules 42 + # "local" is for Unix domain socket connections only
  43 + local all all ident
93 44
94 -Unused modules can be disabled, for example: 45 +Restart postgresql server:
95 46
96 - * s2s  
97 - * web_admin  
98 - * mod_pubsub  
99 - * mod_irc  
100 - * mod_offline  
101 - * mod_admin_extra  
102 - * mod_register 47 + # service postgresql restart
103 48
  49 +Login as noosfero user, and execute:
104 50
105 -### 2.7. Enable ODBC modules 51 + $ psql -U noosfero -W noosfero < /usr/share/noosfero/util/chat/postgresql/ejabberd.sql
106 52
107 - * mod_privacy -> mod_privacy_odbc  
108 - * mod_private -> mod_private_odbc  
109 - * mod_roster -> mod_roster_odbc 53 +(see database password in the /etc/noosfero/database.yml file)
110 54
111 -## 3. Configuring Postgresql 55 +This will create a new schema inside the noosfero database, called `ejabberd`.
112 56
113 -Login as noosfero user, and execute: 57 +Note that there should be at least one domain with `is_default = true` in
  58 +`domains` table, otherwise people won't be able to see their friends online.
114 59
115 - $ psql noosfero < /path/to/noosfero/util/chat/postgresql/ejabberd.sql 60 +## 4. ODBC configuration
116 61
117 -Where `noosfero` may need to be replace by the name of the database used for Noosfero. 62 +Create the following files:
118 63
119 -This will create a new schema inside the noosfero database, called `ejabberd`. 64 + # cp /usr/share/noosfero/util/chat/odbc.ini /etc/
  65 + # cp /usr/share/noosfero/util/chat/odbcinst.ini /etc/
120 66
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. 67 +Edit the odbc.ini file and set the password for the database user, see
  68 +the file /etc/noosfero/database.yml to get the password.
122 69
123 -## 4. ODBC configuration 70 +Adjust premissions:
124 71
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 72 + # chmod 640 /etc/odbc.ini
  73 + # chown ejabberd /etc/odbc.ini
155 74
156 ## 4.1 testing all: 75 ## 4.1 testing all:
157 76
@@ -159,7 +78,6 @@ The following files must be created: @@ -159,7 +78,6 @@ The following files must be created:
159 78
160 If the configuration was done right, the message "Connected!" will be displayed. 79 If the configuration was done right, the message "Connected!" will be displayed.
161 80
162 -  
163 ## 5. Enabling kernel polling and SMP in `/etc/default/ejabberd` 81 ## 5. Enabling kernel polling and SMP in `/etc/default/ejabberd`
164 82
165 POLL=true 83 POLL=true
@@ -205,32 +123,45 @@ Note: module proxy_http must be enabled: @@ -205,32 +123,45 @@ Note: module proxy_http must be enabled:
205 123
206 # a2enmod proxy_http 124 # a2enmod proxy_http
207 125
208 -## 8. DNS configuration 126 +Restart services:
209 127
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: 128 + # service ejabberd restart
  129 + # service noosfero restart
  130 + # service apache2 restart
211 131
212 - _xmpp-client._tcp SRV 5 100 5222 master  
213 - conference CNAME master  
214 - _xmpp-client._tcp.conference SRV 5 100 5222 master 132 +## 8. Test Apache Configuration
215 133
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. 134 +Open in your browser the address:
217 135
218 -## 9. Testing this Setup 136 + http://<yout domain>/http-bind
219 137
220 -Adjust shell limits to proceed with some benchmarks and load tests: 138 +You should see a page with a message like that:
221 139
222 - # ulimit −s 256  
223 - # ulimit −n 8192  
224 - # echo 10 > /proc/sys/net/ipv4/tcp_syn_retries 140 + ejabberd mod_http_bind
  141 + An implementation of XMPP over BOSH (XEP-0206)
  142 + This web page is only informative. To use HTTP-Bind you need a Jabber/XMPP
  143 + client that supports it.
225 144
226 -To measure the bandwidth between server and client: 145 +## 9. Test chat session
227 146
228 - * at server side:  
229 - `# iperf −s` 147 +Open Noosfero console and execute:
230 148
231 - * at client side:  
232 - `# iperf −c server_ip` 149 +>> environment = Environment.default
  150 +>> user = Person['guest']
  151 +>> password = user.user.crypted_password
  152 +>> login = user.jid
  153 +>> RubyBOSH.initialize_session(login, password, "http://#{environment.default_hostname}/http-bind", :wait => 30, :hold => 1, :window => 5
233 154
234 -For heavy load tests, clone and use this software: 155 +If you have luck, should see something like that:
235 156
236 - $ git clone http://git.holoscopio.com/git/metal/tester.git 157 +Ruby-BOSH - SEND
  158 +<body window="5" rid="60265" xmlns="http://jabber.org/protocol/httpbind" xmlns:xmpp="urn:xmpp:xbosh" to="vagrant-debian-squeeze.vagrantup.com" wait="30" xmpp:version="1.0" hold="1"/>
  159 +Ruby-BOSH - SEND
  160 +<body rid="60266" xmlns="http://jabber.org/protocol/httpbind" sid="24cdfc43646a2af1059a7060b677c2e11b26f34f" xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0"><auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">Z3Vlc3RAdmFncmFudC1kZWJpYW4tc3F1ZWV6ZS52YWdyYW50dXAuY29tAGd1ZXN0ADEzZTFhYWVlYjRhYjZlMTA0MmRkNWI1YWY0MzM4MjA1OGJiOWZmNzk=</auth></body>
  161 +Ruby-BOSH - SEND
  162 +<body xmpp:restart="true" rid="60267" xmlns="http://jabber.org/protocol/httpbind" sid="24cdfc43646a2af1059a7060b677c2e11b26f34f" xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0"/>
  163 +Ruby-BOSH - SEND
  164 +<body rid="60268" xmlns="http://jabber.org/protocol/httpbind" sid="24cdfc43646a2af1059a7060b677c2e11b26f34f" xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0"><iq type="set" xmlns="jabber:client" id="bind_29330"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>bosh_9631</resource></bind></iq></body>
  165 +Ruby-BOSH - SEND
  166 +<body rid="60269" xmlns="http://jabber.org/protocol/httpbind" sid="24cdfc43646a2af1059a7060b677c2e11b26f34f" xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0"><iq type="set" xmlns="jabber:client" id="sess_21557"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq></body>
  167 +=> ["guest@vagrant-debian-squeeze.vagrantup.com", "24cdfc43646a2af1059a7060b677c2e11b26f34f", 60270]
INSTALL.https.md 0 → 100644
@@ -0,0 +1,115 @@ @@ -0,0 +1,115 @@
  1 +Setup Noosfero to use HTTPS
  2 +===========================
  3 +
  4 +This document assumes that you have a fully and clean Noosfero
  5 +installation as explained at the `INSTALL.md` file.
  6 +
  7 +SSL certificate
  8 ++++++++++++++++
  9 +
  10 +You should get a valid SSL certificate, but if you want to test
  11 +your setup before, you could generate a self-signed certificate
  12 +as below:
  13 +
  14 + # mkdir /etc/noosfero/ssl
  15 + # cd /etc/noosfero/ssl
  16 + # openssl genrsa 1024 > noosfero.key
  17 + # openssl req -new -x509 -nodes -sha1 -days $[10*365] -key noosfero.key > noosfero.cert
  18 + # cat noosfero.key noosfero.cert > noosfero.pem
  19 +
  20 +There are two ways of using SSL with Noosfero: 1) If you are not using
  21 +Varnish; and 2) If you are using Varnish.
  22 +
  23 +1) If you are are not using Varnish
  24 ++++++++++++++++++++++++++++++++++++
  25 +
  26 +Simply do a redirect in apache to force all connections with SSL:
  27 +
  28 + <VirtualHost *:8080>
  29 + ServerName test.stoa.usp.br
  30 +
  31 + Redirect / https://example.com/
  32 + </VirtualHost>
  33 +
  34 +And set a vhost to receive then:
  35 +
  36 + <VirtualHost *:443>
  37 + ServerName example.com
  38 +
  39 + SSLEngine On
  40 + SSLCertificateFile /etc/ssl/certs/cert.pem
  41 + SSLCertificateKeyFile /etc/ssl/private/cert.key
  42 +
  43 + Include /etc/noosfero/apache/virtualhost.conf
  44 + </VirtualHost>
  45 +
  46 +Be aware that if you had configured varnish, the requests won't reach
  47 +it with this configuration.
  48 +
  49 +2) If you are using Varnish
  50 ++++++++++++++++++++++++++++
  51 +
  52 +Varnish isn't able to communicate with the SSL protocol, so we will
  53 +need some one who do this and Pound[1] can do the job. In order to
  54 +install it in Debian based systems:
  55 +
  56 + $ sudo apt-get install pound
  57 +
  58 +Set Varnish to listen in other port than 80:
  59 +
  60 +/etc/defaults/varnish
  61 +---------------------
  62 +
  63 + DAEMON_OPTS="-a localhost:6081 \
  64 + -T localhost:6082 \
  65 + -f /etc/varnish/default.vcl \
  66 + -S /etc/varnish/secret \
  67 + -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G"
  68 +
  69 +Configure Pound:
  70 +
  71 + # cp /usr/share/noosfero/etc/pound.cfg /etc/pound/
  72 +
  73 +Edit /etc/pound.cfg and set the IP and domain of your server.
  74 +
  75 +Configure Pound to start at system initialization:
  76 +
  77 +/etc/default/pound
  78 +------------------
  79 +
  80 + startup=1
  81 +
  82 +Set Apache to only listen to localhost:
  83 +
  84 +/etc/apache2/ports.conf
  85 +-----------------------
  86 +
  87 + Listen 127.0.0.1:8080
  88 +
  89 +Restart the services:
  90 +
  91 + $ sudo service apache2 restart
  92 + $ sudo service varnish restart
  93 +
  94 +Start pound:
  95 +
  96 + $ sudo service pound start
  97 +
  98 +[1] http://www.apsis.ch/pound
  99 +
  100 +Noosfero XMPP chat
  101 +++++++++++++++++++
  102 +
  103 +If you want to use chat over HTTPS, then you should add the domain
  104 +and IP of your server in the /etc/hosts file, example:
  105 +
  106 +/etc/hosts
  107 +----------
  108 +
  109 + 192.168.1.86 mydomain.example.com
  110 +
  111 +Also, it's recomended that you remove lines above from the file
  112 +`/etc/apache2/sites-enabled/noosfero`:
  113 +
  114 + RewriteEngine On
  115 + Include /usr/share/noosfero/util/chat/apache/xmpp.conf
INSTALL.varnish.md
@@ -24,10 +24,6 @@ Install the RPAF apache module (or skip this step if not using apache): @@ -24,10 +24,6 @@ Install the RPAF apache module (or skip this step if not using apache):
24 24
25 3b) Edit `/etc/apache2/sites-enabled/*`, and change `<VirtualHost *:80>` to `<VirtualHost *:8080>` 25 3b) Edit `/etc/apache2/sites-enabled/*`, and change `<VirtualHost *:80>` to `<VirtualHost *:8080>`
26 26
27 -3c) Restart apache  
28 -  
29 - # invoke-rc.d apache2 restart  
30 -  
31 4) Varnish configuration 27 4) Varnish configuration
32 28
33 4a) Edit `/etc/default/varnish` 29 4a) Edit `/etc/default/varnish`
@@ -44,10 +40,6 @@ On manual installations, change `/etc/noosfero/*` to `{Rails.root}/etc/noosfero/ @@ -44,10 +40,6 @@ On manual installations, change `/etc/noosfero/*` to `{Rails.root}/etc/noosfero/
44 40
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`. 41 **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 42
47 -4c) Restart Varnish  
48 -  
49 - # invoke-rc.d varnish restart  
50 -  
51 5) Enable varnish logging: 43 5) Enable varnish logging:
52 44
53 5a) Edit `/etc/default/varnishncsa` and uncomment the line that contains: 45 5a) Edit `/etc/default/varnishncsa` and uncomment the line that contains:
@@ -56,8 +48,10 @@ On manual installations, change `/etc/noosfero/*` to `{Rails.root}/etc/noosfero/ @@ -56,8 +48,10 @@ On manual installations, change `/etc/noosfero/*` to `{Rails.root}/etc/noosfero/
56 48
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. 49 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 50
59 -5b) Restart Varnish Logging service 51 +Thanks to Cosimo Streppone for varnish-accept-language. See http://github.com/cosimo/varnish-accept-language for more information.
60 52
61 - # invoke-rc.d varnishncsa restart 53 +6) Restart services
62 54
63 -Thanks to Cosimo Streppone for varnish-accept-language. See http://github.com/cosimo/varnish-accept-language for more information. 55 + # service apache2 restart
  56 + # service varnish restart
  57 + # service varnishncsa restart
app/controllers/my_profile/cms_controller.rb
@@ -232,7 +232,7 @@ class CmsController &lt; MyProfileController @@ -232,7 +232,7 @@ class CmsController &lt; MyProfileController
232 @current_category = Category.find(params[:category_id]) 232 @current_category = Category.find(params[:category_id])
233 @categories = @current_category.children 233 @categories = @current_category.children
234 end 234 end
235 - render :template => 'shared/update_categories', :locals => { :category => @current_category } 235 + render :template => 'shared/update_categories', :locals => { :category => @current_category, :object_name => 'article' }
236 end 236 end
237 237
238 def publish 238 def publish
@@ -248,12 +248,15 @@ class CmsController &lt; MyProfileController @@ -248,12 +248,15 @@ class CmsController &lt; MyProfileController
248 end.compact unless params[:marked_groups].nil? 248 end.compact unless params[:marked_groups].nil?
249 if request.post? 249 if request.post?
250 @failed = {} 250 @failed = {}
  251 + if @marked_groups.empty?
  252 + return session[:notice] = _("Select some group to publish your article")
  253 + end
251 @marked_groups.each do |item| 254 @marked_groups.each do |item|
252 task = ApproveArticle.create!(:article => @article, :name => item[:name], :target => item[:group], :requestor => profile) 255 task = ApproveArticle.create!(:article => @article, :name => item[:name], :target => item[:group], :requestor => profile)
253 begin 256 begin
254 task.finish unless item[:group].moderated_articles? 257 task.finish unless item[:group].moderated_articles?
255 rescue Exception => ex 258 rescue Exception => ex
256 - @failed[ex.message] ? @failed[ex.message] << item[:group].name : @failed[ex.message] = [item[:group].name] 259 + @failed[ex.message] ? @failed[ex.message] << item[:group].name : @failed[ex.message] = [item[:group].name]
257 end 260 end
258 end 261 end
259 if @failed.blank? 262 if @failed.blank?
app/controllers/my_profile/friends_controller.rb
@@ -11,7 +11,7 @@ class FriendsController &lt; MyProfileController @@ -11,7 +11,7 @@ class FriendsController &lt; MyProfileController
11 def remove 11 def remove
12 @friend = profile.friends.find(params[:id]) 12 @friend = profile.friends.find(params[:id])
13 if request.post? && params[:confirmation] 13 if request.post? && params[:confirmation]
14 - profile.remove_friend(@friend) 14 + Friendship.remove_friendship(profile, @friend)
15 redirect_to :action => 'index' 15 redirect_to :action => 'index'
16 end 16 end
17 end 17 end
app/controllers/my_profile/memberships_controller.rb
@@ -7,9 +7,9 @@ class MembershipsController &lt; MyProfileController @@ -7,9 +7,9 @@ class MembershipsController &lt; MyProfileController
7 ra = profile.role_assignments.find_by_role_id(role.id) 7 ra = profile.role_assignments.find_by_role_id(role.id)
8 ra.present? && ra.resource_type == 'Profile' 8 ra.present? && ra.resource_type == 'Profile'
9 end 9 end
10 - @filter = params[:filter_type].blank? ? nil : params[:filter_type] 10 + @filter = params[:filter_type].to_i
11 begin 11 begin
12 - @memberships = @filter.nil? ? profile.memberships : profile.memberships_by_role(environment.roles.find(@filter)) 12 + @memberships = @filter.zero? ? profile.memberships : profile.memberships_by_role(environment.roles.find(@filter))
13 rescue ActiveRecord::RecordNotFound 13 rescue ActiveRecord::RecordNotFound
14 @memberships = [] 14 @memberships = []
15 end 15 end
app/controllers/my_profile/profile_editor_controller.rb
@@ -54,7 +54,7 @@ class ProfileEditorController &lt; MyProfileController @@ -54,7 +54,7 @@ class ProfileEditorController &lt; MyProfileController
54 @current_category = Category.find(params[:category_id]) 54 @current_category = Category.find(params[:category_id])
55 @categories = @current_category.children 55 @categories = @current_category.children
56 end 56 end
57 - render :template => 'shared/update_categories', :locals => { :category => @current_category } 57 + render :template => 'shared/update_categories', :locals => { :category => @current_category, :object_name => 'profile_data' }
58 end 58 end
59 59
60 def header_footer 60 def header_footer
app/controllers/public/content_viewer_controller.rb
@@ -31,8 +31,8 @@ class ContentViewerController &lt; ApplicationController @@ -31,8 +31,8 @@ class ContentViewerController &lt; ApplicationController
31 31
32 if request.post? && @page.forum? 32 if request.post? && @page.forum?
33 process_forum_terms_of_use(user, params[:terms_accepted]) 33 process_forum_terms_of_use(user, params[:terms_accepted])
34 - elsif is_a_forum_topic?(@page)  
35 - redirect_to @page.parent.url unless @page.parent.agrees_with_terms?(user) 34 + elsif is_a_forum_topic?(@page) && !@page.parent.agrees_with_terms?(user)
  35 + redirect_to @page.parent.url
36 return 36 return
37 end 37 end
38 38
app/controllers/public/profile_controller.rb
@@ -51,7 +51,7 @@ class ProfileController &lt; PublicController @@ -51,7 +51,7 @@ class ProfileController &lt; PublicController
51 51
52 def communities 52 def communities
53 if is_cache_expired?(profile.communities_cache_key(params)) 53 if is_cache_expired?(profile.communities_cache_key(params))
54 - @communities = profile.communities.includes(relations_to_include).paginate(:per_page => per_page, :page => params[:npage]) 54 + @communities = profile.communities.includes(relations_to_include).paginate(:per_page => per_page, :page => params[:npage], :total_entries => profile.communities.count)
55 end 55 end
56 end 56 end
57 57
@@ -202,7 +202,8 @@ class ProfileController &lt; PublicController @@ -202,7 +202,8 @@ class ProfileController &lt; PublicController
202 end 202 end
203 203
204 def more_comments 204 def more_comments
205 - activity = ActionTracker::Record.find(:first, :conditions => {:id => params[:activity], :user_id => @profile}) 205 + profile_filter = @profile.person? ? {:user_id => @profile} : {:target_id => @profile}
  206 + activity = ActionTracker::Record.find(:first, :conditions => {:id => params[:activity]}.merge(profile_filter))
206 comments_count = activity.comments.count 207 comments_count = activity.comments.count
207 comment_page = (params[:comment_page] || 1).to_i 208 comment_page = (params[:comment_page] || 1).to_i
208 comments_per_page = 5 209 comments_per_page = 5
app/helpers/application_helper.rb
@@ -671,7 +671,7 @@ module ApplicationHelper @@ -671,7 +671,7 @@ module ApplicationHelper
671 671
672 def theme_javascript_ng 672 def theme_javascript_ng
673 script = File.join(theme_path, 'theme.js') 673 script = File.join(theme_path, 'theme.js')
674 - if File.join(Rails.root, 'public', script) 674 + if File.exists?(File.join(Rails.root, 'public', script))
675 javascript_include_tag script 675 javascript_include_tag script
676 else 676 else
677 nil 677 nil
app/models/article.rb
@@ -2,7 +2,7 @@ require &#39;hpricot&#39; @@ -2,7 +2,7 @@ require &#39;hpricot&#39;
2 2
3 class Article < ActiveRecord::Base 3 class Article < ActiveRecord::Base
4 4
5 - attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, :allow_members_to_edit, :translation_of_id, :language, :license_id, :parent_id, :display_posts_in_current_language, :category_ids, :posts_per_page, :moderate_comments, :accept_comments, :feed, :published, :source, :highlighted, :notify_comments, :display_hits, :slug, :external_feed_builder, :display_versions, :external_link 5 + attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, :allow_members_to_edit, :translation_of_id, :language, :license_id, :parent_id, :display_posts_in_current_language, :category_ids, :posts_per_page, :moderate_comments, :accept_comments, :feed, :published, :source, :highlighted, :notify_comments, :display_hits, :slug, :external_feed_builder, :display_versions, :external_link, :image_builder
6 6
7 acts_as_having_image 7 acts_as_having_image
8 8
app/models/friendship.rb
@@ -15,4 +15,9 @@ class Friendship &lt; ActiveRecord::Base @@ -15,4 +15,9 @@ class Friendship &lt; ActiveRecord::Base
15 Friendship.update_cache_counter(:friends_count, friendship.person, -1) 15 Friendship.update_cache_counter(:friends_count, friendship.person, -1)
16 Friendship.update_cache_counter(:friends_count, friendship.friend, -1) 16 Friendship.update_cache_counter(:friends_count, friendship.friend, -1)
17 end 17 end
  18 +
  19 + def self.remove_friendship(person1, person2)
  20 + person1.remove_friend(person2)
  21 + person2.remove_friend(person1)
  22 + end
18 end 23 end
app/models/person_notifier.rb
@@ -82,7 +82,7 @@ class PersonNotifier @@ -82,7 +82,7 @@ class PersonNotifier
82 @url = @profile.environment.top_url 82 @url = @profile.environment.top_url
83 mail( 83 mail(
84 content_type: "text/html", 84 content_type: "text/html",
85 - from: "#{@profile.environment.name} <#{@profile.environment.contact_email}>", 85 + from: "#{@profile.environment.name} <#{@profile.environment.noreply_email}>",
86 to: @profile.email, 86 to: @profile.email,
87 subject: _("[%s] Network Activity") % [@profile.environment.name] 87 subject: _("[%s] Network Activity") % [@profile.environment.name]
88 ) 88 )
app/models/slideshow_block.rb
@@ -6,6 +6,8 @@ class SlideshowBlock &lt; Block @@ -6,6 +6,8 @@ class SlideshowBlock &lt; Block
6 settings_items :navigation, :type => 'boolean', :default => false 6 settings_items :navigation, :type => 'boolean', :default => false
7 settings_items :image_size, :type => 'string', :default => 'thumb' 7 settings_items :image_size, :type => 'string', :default => 'thumb'
8 8
  9 + attr_accessible :gallery_id, :image_size, :interval, :shuffle, :navigation
  10 +
9 def self.description 11 def self.description
10 _('Slideshow') 12 _('Slideshow')
11 end 13 end
app/views/cms/view.html.erb
@@ -25,7 +25,9 @@ @@ -25,7 +25,9 @@
25 <div id='article-full-path'> 25 <div id='article-full-path'>
26 <strong><%= _('Current folder: ') %></strong> 26 <strong><%= _('Current folder: ') %></strong>
27 <%= link_to profile.identifier, :action => 'index' %> 27 <%= link_to profile.identifier, :action => 'index' %>
28 - <%= @article.hierarchy.map {|item| " / " + ((item == @article) ? item.name : link_to(item.slug, :id => item.id)) } %> 28 + <% @article.hierarchy.each do |item| %>
  29 + <%= " / " + ((item == @article) ? item.name.html_safe : link_to(item.slug, :id => item.id).html_safe) %>
  30 + <% end %>
29 </div> 31 </div>
30 <% end %> 32 <% end %>
31 33
app/views/comment/notifier/notification.html.erb
@@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
1 -<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>  
2 -  
3 -<%= word_wrap(_('%{sender} (%{sender_link}) created a new comment on your article "%{article_title}".') % { :sender => @sender, :sender_link => url_for(@sender_link), :article_title => @article_title }) %>  
4 -  
5 -<%= word_wrap(_('Title: %s') % @comment_title) %>  
6 -  
7 -<%= _("Comment:") %>  
8 --------------------------------------------------------------------------------  
9 -<%= word_wrap(@comment_body) %>  
10 --------------------------------------------------------------------------------  
11 -  
12 -<%= _('Access the address below to view this comment:') %>  
13 -<%= url_for @comment_url %>  
14 -  
15 -<%= _("Greetings,") %>  
16 -  
17 ---  
18 -<%= _('%s team.') % @environment %>  
19 -<%= url_for @url %>  
app/views/comment/notifier/notification.text.erb 0 → 100644
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
  1 +<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>
  2 +
  3 +<%= word_wrap(_('%{sender} (%{sender_link}) created a new comment on your article "%{article_title}".') % { :sender => @sender, :sender_link => url_for(@sender_link), :article_title => @article_title }) %>
  4 +
  5 +<%= word_wrap(_('Title: %s') % @comment_title) %>
  6 +
  7 +<%= _("Comment:") %>
  8 +-------------------------------------------------------------------------------
  9 +<%= word_wrap(@comment_body) %>
  10 +-------------------------------------------------------------------------------
  11 +
  12 +<%= _('Access the address below to view this comment:') %>
  13 +<%= url_for @comment_url %>
  14 +
  15 +<%= _("Greetings,") %>
  16 +
  17 +--
  18 +<%= _('%s team.') % @environment %>
  19 +<%= url_for @url %>
app/views/content_viewer/view_page.html.erb
@@ -80,8 +80,8 @@ @@ -80,8 +80,8 @@
80 </h3> 80 </h3>
81 <% end %> 81 <% end %>
82 82
83 - <% if @page.accept_comments? && @comments.present? && @comments.count > 1 %>  
84 - <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form', :id => 'top-post-comment-button', :onclick => "jQuery('#page-comment-form .display-comment-form').first().click();") %> 83 + <% if @comments.present? && @comments.count > 1 %>
  84 + <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form', :id => 'top-post-comment-button', :onclick => "jQuery('#page-comment-form .display-comment-form').first().click();") if @page.accept_comments? %>
85 85
86 <%= hidden_field_tag("page_url", url_for(:controller=>'content_viewer', :action=>'view_page', :profile=>profile.identifier, :page => @page.explode_path)) %> 86 <%= hidden_field_tag("page_url", url_for(:controller=>'content_viewer', :action=>'view_page', :profile=>profile.identifier, :page => @page.explode_path)) %>
87 <%= javascript_include_tag "comment_order.js" %> 87 <%= javascript_include_tag "comment_order.js" %>
@@ -90,12 +90,14 @@ @@ -90,12 +90,14 @@
90 <%= select_tag 'comment_order', options_for_select({_('Oldest first')=>'oldest', _('Newest first')=>'newest'}, @comment_order) %> 90 <%= select_tag 'comment_order', options_for_select({_('Oldest first')=>'oldest', _('Newest first')=>'newest'}, @comment_order) %>
91 <% end %> 91 <% end %>
92 </div> 92 </div>
  93 + <% end %>
93 94
94 - <ul class="article-comments-list"> 95 + <ul class="article-comments-list">
  96 + <% if @comments.present? %>
95 <%= render :partial => 'comment/comment', :collection => @comments %> 97 <%= render :partial => 'comment/comment', :collection => @comments %>
96 <%= pagination_links @comments, :param_name => 'comment_page' %> 98 <%= pagination_links @comments, :param_name => 'comment_page' %>
97 - </ul>  
98 - <% end %> 99 + <% end %>
  100 + </ul>
99 101
100 <% if @page.accept_comments? %> 102 <% if @page.accept_comments? %>
101 <div id='page-comment-form' class='page-comment-form'><%= render :partial => 'comment/comment_form', :locals =>{:url => {:controller => :comment, :action => :create}, :display_link => true, :cancel_triggers_hide => true}%></div> 103 <div id='page-comment-form' class='page-comment-form'><%= render :partial => 'comment/comment_form', :locals =>{:url => {:controller => :comment, :action => :create}, :display_link => true, :cancel_triggers_hide => true}%></div>
app/views/memberships/index.html.erb
@@ -8,11 +8,12 @@ @@ -8,11 +8,12 @@
8 <%= button :back, _('Go back'), :controller => 'profile_editor' %> 8 <%= button :back, _('Go back'), :controller => 'profile_editor' %>
9 <% end %> 9 <% end %>
10 10
11 -<% type_collection = [[nil, _('All')]] %> 11 +<% type_collection = [[0, _('All')]] %>
12 <% type_collection += @roles.sort_by {|role| role.id}.map{|r| ["#{r.id}", r.name]} %> 12 <% type_collection += @roles.sort_by {|role| role.id}.map{|r| ["#{r.id}", r.name]} %>
13 13
  14 +<%= javascript_include_tag "memberships_filter.js" %>
14 <p> 15 <p>
15 - <%= labelled_select(_('Filter')+': ', :filter_type, :first, :last, @filter, type_collection, :onchange => 'document.location.href = "?filter_type="+this.value')%> 16 + <%= labelled_select(_('Filter')+': ', :filter_type, :first, :last, @filter, type_collection, :id => 'memberships_filter')%>
16 </p> 17 </p>
17 18
18 <% if @memberships.empty? %> 19 <% if @memberships.empty? %>
app/views/pending_task_notifier/notification.html.erb
@@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
1 -<%= _("Dear %s") % @person.name %>,  
2 -  
3 -<%= _("You have %d pending task(s).") % @tasks.size %>  
4 -  
5 -<%= @tasks.map{|i| " * #{i.description}"}.join("\n") %>  
6 -  
7 -<%= _("Click in address below to process task(s):") %>  
8 -  
9 -<%= @url_for_pending_tasks %>  
10 -<% @organizations_with_pending_tasks.each do |organization| %>  
11 -<% pending_tasks = @person.pending_tasks_for_organization(organization) %>  
12 -<%= _("%s has %d pending task(s).") % [organization.name, pending_tasks.size] %>  
13 -  
14 -<%= pending_tasks.map{|i| " * #{i.information}"}.join("\n") %>  
15 -  
16 -<%= _("Click in address below to process task(s):") %>  
17 -  
18 -<%= url_for(:host => @default_hostname, :controller => 'tasks', :profile => organization.identifier) %>  
19 -<% end %>  
20 -  
21 -<%= _('Greetings,') %>  
22 -  
23 ---  
24 -<%= _('%s team.') % @environment %>  
25 -<%= @url %>  
app/views/pending_task_notifier/notification.text.erb 0 → 100644
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
  1 +<%= _("Dear %s") % @person.name %>,
  2 +
  3 +<%= _("You have %d pending task(s).") % @tasks.size %>
  4 +
  5 +<%= @tasks.map{|i| " * #{i.description}"}.join("\n") %>
  6 +
  7 +<%= _("Click in address below to process task(s):") %>
  8 +
  9 +<%= @url_for_pending_tasks %>
  10 +<% @organizations_with_pending_tasks.each do |organization| %>
  11 +<% pending_tasks = @person.pending_tasks_for_organization(organization) %>
  12 +<%= _("%s has %d pending task(s).") % [organization.name, pending_tasks.size] %>
  13 +
  14 +<%= pending_tasks.map{|i| " * #{i.information}"}.join("\n") %>
  15 +
  16 +<%= _("Click in address below to process task(s):") %>
  17 +
  18 +<%= url_for(:host => @default_hostname, :controller => 'tasks', :profile => organization.identifier) %>
  19 +<% end %>
  20 +
  21 +<%= _('Greetings,') %>
  22 +
  23 +--
  24 +<%= _('%s team.') % @environment %>
  25 +<%= @url %>
app/views/scrap/notifier/notification.html.erb
@@ -1,16 +0,0 @@ @@ -1,16 +0,0 @@
1 -<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>  
2 -  
3 -<%= word_wrap(_('%{sender} (%{sender_link}) has left the following scrap for you:') % { :sender => @sender, :sender_link => url_for(@sender_link) }) %>  
4 -  
5 --------------------------------------------------------------------------------  
6 -<%= word_wrap(@scrap_content) %>  
7 --------------------------------------------------------------------------------  
8 -  
9 -<%= _('View this scrap on the wall') %>:  
10 -<%= url_for @wall_url %>  
11 -  
12 -<%= _("Greetings,") %>  
13 -  
14 ---  
15 -<%= _('%s team.') % @environment %>  
16 -<%= url_for @url %>  
app/views/scrap/notifier/notification.text.erb 0 → 100644
@@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
  1 +<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>
  2 +
  3 +<%= word_wrap(_('%{sender} (%{sender_link}) has left the following scrap for you:') % { :sender => @sender, :sender_link => url_for(@sender_link) }) %>
  4 +
  5 +-------------------------------------------------------------------------------
  6 +<%= word_wrap(@scrap_content) %>
  7 +-------------------------------------------------------------------------------
  8 +
  9 +<%= _('View this scrap on the wall') %>:
  10 +<%= url_for @wall_url %>
  11 +
  12 +<%= _("Greetings,") %>
  13 +
  14 +--
  15 +<%= _('%s team.') % @environment %>
  16 +<%= url_for @url %>
app/views/shared/update_categories.js.erb
1 <% 1 <%
2 content = render :partial => 'shared/select_categories', 2 content = render :partial => 'shared/select_categories',
3 - :locals => {:object_name => 'article', :multiple => true}, :layout => false 3 + :locals => {:object_name => object_name, :multiple => true}, :layout => false
4 %> 4 %>
5 jQuery('#select-categories').html('<%= j(content) %>'); 5 jQuery('#select-categories').html('<%= j(content) %>');
app/views/task_mailer/invitation_notification.html.erb
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -<%= @message %>  
2 \ No newline at end of file 0 \ No newline at end of file
app/views/task_mailer/invitation_notification.text.erb 0 → 100644
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +<%= @message %>
0 \ No newline at end of file 2 \ No newline at end of file
app/views/task_mailer/target_notification.html.erb
@@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
1 -<%= _('Hello %s,') % @target %>  
2 -  
3 -<%= word_wrap(@message) %>  
4 -  
5 -<%= word_wrap(_('Access your list of tasks or your control panel to see this and other pending actions that need your attention.')) %>  
6 -<%= @tasks_url %>  
7 -  
8 ---  
9 -<%= _('%s team.') % @environment %>  
10 -<%= @url %>  
app/views/task_mailer/target_notification.text.erb 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +<%= _('Hello %s,') % @target %>
  2 +
  3 +<%= word_wrap(@message) %>
  4 +
  5 +<%= word_wrap(_('Access your list of tasks or your control panel to see this and other pending actions that need your attention.')) %>
  6 +<%= @tasks_url %>
  7 +
  8 +--
  9 +<%= _('%s team.') % @environment %>
  10 +<%= @url %>
app/views/task_mailer/task_activated.text.erb 0 → 120000
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +task_cancelled.text.erb
0 \ No newline at end of file 2 \ No newline at end of file
app/views/task_mailer/task_activated.text.plain.html.erb
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -task_cancelled.text.plain.html.erb  
2 \ No newline at end of file 0 \ No newline at end of file
app/views/task_mailer/task_cancelled.text.erb 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +<%= _('Dear %s,') % @requestor %>
  2 +
  3 +<%= word_wrap(@message) %>
  4 +
  5 +<%= _('Greetings,') %>
  6 +
  7 +--
  8 +<%= _('%s team.') % @environment %>
  9 +<%= @url %>
app/views/task_mailer/task_cancelled.text.plain.html.erb
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -<%= _('Dear %s,') % @requestor %>  
2 -  
3 -<%= word_wrap(@message) %>  
4 -  
5 -<%= _('Greetings,') %>  
6 -  
7 ---  
8 -<%= _('%s team.') % @environment %>  
9 -<%= @url %>  
app/views/task_mailer/task_created.text.erb 0 → 120000
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +task_cancelled.text.erb
0 \ No newline at end of file 2 \ No newline at end of file
app/views/task_mailer/task_created.text.plain.html.erb
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -task_cancelled.text.plain.html.erb  
2 \ No newline at end of file 0 \ No newline at end of file
app/views/task_mailer/task_finished.text.erb 0 → 120000
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +task_cancelled.text.erb
0 \ No newline at end of file 2 \ No newline at end of file
app/views/task_mailer/task_finished.text.plain.html.erb
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -task_cancelled.text.plain.html.erb  
2 \ No newline at end of file 0 \ No newline at end of file
app/views/user_mailer/activation_code.html.erb
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>  
2 -  
3 -<%= word_wrap(_('Welcome to %{environment}! To activate your account, follow the link: %{activation_url}') % { :environment => @environment, :activation_url => @url + url_for(:controller => :account, :action => :activate, :activation_code => @activation_code, :redirection => @redirection, :join => @join) }) %>  
4 -  
5 -<%= _("Greetings,") %>  
6 -  
7 ---  
8 -<%= _('%s team.') % @environment %>  
9 -<%= url_for @url %>  
app/views/user_mailer/activation_code.text.erb 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>
  2 +
  3 +<%= word_wrap(_('Welcome to %{environment}! To activate your account, follow the link: %{activation_url}') % { :environment => @environment, :activation_url => @url + url_for(:controller => :account, :action => :activate, :activation_code => @activation_code, :redirection => @redirection, :join => @join) }) %>
  4 +
  5 +<%= _("Greetings,") %>
  6 +
  7 +--
  8 +<%= _('%s team.') % @environment %>
  9 +<%= url_for @url %>
app/views/user_mailer/activation_email_notify.html.erb
@@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
1 -<%= _('Hello %s,') % @name %>  
2 -  
3 -<%= _('Your email %s was just activated.') % [@email] %>  
4 -  
5 -<%= _('You can access your e-mail from anywhere, using the following address:') %>  
6 -<%= @webmail %>  
7 -  
8 -<%= _('Greetings,') %>  
9 -  
10 ---  
11 -<%= _('%s team.') % @environment %>  
12 -<%= @url %>  
app/views/user_mailer/activation_email_notify.text.erb 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +<%= _('Hello %s,') % @name %>
  2 +
  3 +<%= _('Your email %s was just activated.') % [@email] %>
  4 +
  5 +<%= _('You can access your e-mail from anywhere, using the following address:') %>
  6 +<%= @webmail %>
  7 +
  8 +<%= _('Greetings,') %>
  9 +
  10 +--
  11 +<%= _('%s team.') % @environment %>
  12 +<%= @url %>
db/migrate/20140724134601_fix_yaml_encoding.rb 0 → 100644
@@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
  1 +class FixYamlEncoding < ActiveRecord::Migration
  2 + def self.up
  3 + fix_encoding(Block, 'settings')
  4 + fix_encoding(Product, 'data')
  5 + fix_encoding(Environment, 'settings')
  6 + fix_encoding(Profile, 'data')
  7 + fix_encoding(ActionTracker::Record, 'params')
  8 + fix_encoding(Article, 'setting')
  9 + end
  10 +
  11 + def self.down
  12 + puts "Warning: cannot restore original encoding"
  13 + end
  14 +
  15 + private
  16 +
  17 + def self.fix_encoding(model, param)
  18 + result = model.find(:all, :conditions => "#{param} LIKE '%!binary%'")
  19 + puts "Fixing #{result.count} rows of #{model} (#{param})"
  20 + result.each {|r| r.update_column(param, deep_fix(r.send(param)).to_yaml)}
  21 + end
  22 +
  23 + def self.deep_fix(hash)
  24 + hash.each do |value|
  25 + value.force_encoding('UTF-8') if value.is_a?(String) && !value.frozen? && value.encoding == Encoding::ASCII_8BIT
  26 + deep_fix(value) if value.respond_to?(:each)
  27 + end
  28 + end
  29 +
  30 +end
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 # 11 #
12 # It's strongly recommended to check this file into your version control system. 12 # It's strongly recommended to check this file into your version control system.
13 13
14 -ActiveRecord::Schema.define(:version => 20140605222753) do 14 +ActiveRecord::Schema.define(:version => 20140724134601) do
15 15
16 create_table "abuse_reports", :force => true do |t| 16 create_table "abuse_reports", :force => true do |t|
17 t.integer "reporter_id" 17 t.integer "reporter_id"
etc/pound.cfg 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  1 +LogLevel 1
  2 +Alive 10
  3 +Client 120
  4 +TimeOut 300
  5 +Control "/var/run/pound/poundctl.socket"
  6 +
  7 +ListenHTTP
  8 + Address 192.168.1.86
  9 + Port 80
  10 + xHTTP 1
  11 + # uncomment code above if you are using chat
  12 + #Service
  13 + # URL "/http-bind.*"
  14 + # Backend
  15 + # Address 127.0.0.1
  16 + # Port 5280
  17 + # End
  18 + #End
  19 + Service
  20 + Redirect "https://mydomain.example.com"
  21 + End
  22 +End
  23 +
  24 +ListenHTTPS
  25 + Address 192.168.1.86
  26 + Port 443
  27 + Cert "/etc/noosfero/ssl/noosfero.pem"
  28 + Ciphers "ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM"
  29 + xHTTP 1
  30 + # uncomment code above if you are using chat
  31 + #Service
  32 + # URL "/http-bind.*"
  33 + # Backend
  34 + # Address 127.0.0.1
  35 + # Port 5280
  36 + # End
  37 + #End
  38 + Service
  39 + BackEnd
  40 + Address 127.0.0.1
  41 + Port 6081
  42 + End
  43 + End
  44 +End
features/delete_profile.feature
@@ -13,7 +13,6 @@ Feature: delete profile @@ -13,7 +13,6 @@ Feature: delete profile
13 | sample-community | Sample Community | 13 | sample-community | Sample Community |
14 And "Maria Silva" is a member of "Sample Community" 14 And "Maria Silva" is a member of "Sample Community"
15 15
16 - @selenium  
17 Scenario: deleting profile 16 Scenario: deleting profile
18 Given I am logged in as "joaosilva" 17 Given I am logged in as "joaosilva"
19 And I am on joaosilva's control panel 18 And I am on joaosilva's control panel
@@ -46,7 +45,6 @@ Feature: delete profile @@ -46,7 +45,6 @@ Feature: delete profile
46 When I follow "Community Info and settings" 45 When I follow "Community Info and settings"
47 Then I should see "Delete profile" 46 Then I should see "Delete profile"
48 47
49 - @selenium  
50 Scenario: community admin deletes the community 48 Scenario: community admin deletes the community
51 Given "Joao Silva" is admin of "Sample Community" 49 Given "Joao Silva" is admin of "Sample Community"
52 And I am logged in as "joaosilva" 50 And I am logged in as "joaosilva"
@@ -75,7 +73,6 @@ Feature: delete profile @@ -75,7 +73,6 @@ Feature: delete profile
75 When I follow "Enterprise Info and settings" 73 When I follow "Enterprise Info and settings"
76 Then I should see "Delete profile" 74 Then I should see "Delete profile"
77 75
78 - @selenium  
79 Scenario: enterprise admin deletes the enterprise 76 Scenario: enterprise admin deletes the enterprise
80 Given the following enterprise 77 Given the following enterprise
81 | identifier | name | 78 | identifier | name |
@@ -101,7 +98,6 @@ Feature: delete profile @@ -101,7 +98,6 @@ Feature: delete profile
101 And I go to /myprofile/sample-enterprise/profile_editor/destroy_profile 98 And I go to /myprofile/sample-enterprise/profile_editor/destroy_profile
102 Then I should see "Access denied" 99 Then I should see "Access denied"
103 100
104 - @selenium  
105 Scenario: environment admin deletes profile 101 Scenario: environment admin deletes profile
106 Given I am logged in as admin 102 Given I am logged in as admin
107 And I am on joaosilva's control panel 103 And I am on joaosilva's control panel
features/manage_users.feature
@@ -15,7 +15,7 @@ Background: @@ -15,7 +15,7 @@ Background:
15 Scenario: deactive user 15 Scenario: deactive user
16 When I follow "Deactivate user" within "tr[title='Joao Silva']" 16 When I follow "Deactivate user" within "tr[title='Joao Silva']"
17 And I confirm the "Do you want to deactivate this user?" dialog 17 And I confirm the "Do you want to deactivate this user?" dialog
18 - Then I should see "Activate user" within "tr[title='Joao Silva']" 18 + Then the "tr[title='Joao Silva'] td.actions a.icon-activate-user" button should be enabled
19 19
20 @selenium 20 @selenium
21 Scenario: activate user 21 Scenario: activate user
@@ -23,7 +23,7 @@ Background: @@ -23,7 +23,7 @@ Background:
23 Given I confirm the "Do you want to deactivate this user?" dialog 23 Given I confirm the "Do you want to deactivate this user?" dialog
24 When I follow "Activate user" within "tr[title='Paulo Santos']" 24 When I follow "Activate user" within "tr[title='Paulo Santos']"
25 And I confirm the "Do you want to activate this user?" dialog 25 And I confirm the "Do you want to activate this user?" dialog
26 - Then I should see "Deactivate user" within "tr[title='Paulo Santos']" 26 + Then the "tr[title='Paulo Santos'] td.actions a.icon-deactivate-user" button should be enabled
27 27
28 @selenium 28 @selenium
29 Scenario: remove user 29 Scenario: remove user
@@ -36,7 +36,7 @@ Background: @@ -36,7 +36,7 @@ Background:
36 Scenario: admin user 36 Scenario: admin user
37 When I follow "Set admin role" within "tr[title='Joao Silva']" 37 When I follow "Set admin role" within "tr[title='Joao Silva']"
38 And I confirm the "Do you want to set this user as administrator?" dialog 38 And I confirm the "Do you want to set this user as administrator?" dialog
39 - Then I should see "Reset admin role" within "tr[title='Joao Silva']" 39 + Then the "tr[title='Joao Silva'] td.actions a.icon-reset-admin-role" button should be enabled
40 40
41 @selenium 41 @selenium
42 Scenario: unadmin user 42 Scenario: unadmin user
@@ -44,4 +44,4 @@ Background: @@ -44,4 +44,4 @@ Background:
44 And I confirm the "Do you want to set this user as administrator?" dialog 44 And I confirm the "Do you want to set this user as administrator?" dialog
45 When I follow "Reset admin role" within "tr[title='Paulo Santos']" 45 When I follow "Reset admin role" within "tr[title='Paulo Santos']"
46 And I confirm the "Do you want to reset this user as administrator?" dialog 46 And I confirm the "Do you want to reset this user as administrator?" dialog
47 - Then I should see "Set admin role" within "tr[title='Paulo Santos']" 47 + Then the "tr[title='Paulo Santos'] td.actions a.icon-set-admin-role" button should be enabled
features/step_definitions/web_steps.rb
@@ -27,13 +27,13 @@ end @@ -27,13 +27,13 @@ end
27 27
28 When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector| 28 When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
29 with_scope(selector) do 29 with_scope(selector) do
30 - first(:button, button).click 30 + click_button(button, :match => :prefer_exact)
31 end 31 end
32 end 32 end
33 33
34 When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector| 34 When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
35 with_scope(selector) do 35 with_scope(selector) do
36 - first(:link, link).click 36 + click_link(link, :match => :prefer_exact)
37 end 37 end
38 end 38 end
39 39
features/support/selenium.rb
@@ -10,7 +10,7 @@ end @@ -10,7 +10,7 @@ end
10 10
11 # FIXME: 'DELETE FROM ...' is being ran 3x - see cucumber.log 11 # FIXME: 'DELETE FROM ...' is being ran 3x - see cucumber.log
12 DatabaseCleaner.clean_with :truncation 12 DatabaseCleaner.clean_with :truncation
13 -DatabaseCleaner.strategy = :truncation 13 +DatabaseCleaner.strategy = :truncation, {:pre_count => true, :reset_ids => false}
14 14
15 Before do 15 Before do
16 DatabaseCleaner.start 16 DatabaseCleaner.start
features/upload_files.feature
@@ -8,7 +8,6 @@ Feature: upload files @@ -8,7 +8,6 @@ Feature: upload files
8 | joaosilva | Joao Silva | 8 | joaosilva | Joao Silva |
9 And I am logged in as "joaosilva" 9 And I am logged in as "joaosilva"
10 10
11 - @selenium  
12 Scenario: provile links to upload files to community's gallery 11 Scenario: provile links to upload files to community's gallery
13 Given the following communities 12 Given the following communities
14 | identifier | name | owner | 13 | identifier | name | owner |
@@ -16,12 +15,9 @@ Feature: upload files @@ -16,12 +15,9 @@ Feature: upload files
16 And the following galleries 15 And the following galleries
17 | owner | name | 16 | owner | name |
18 | sample-community | Gallery test | 17 | sample-community | Gallery test |
19 - And I go to sample-community's profile  
20 - And I follow "Profile"  
21 - And I follow "0 pictures"  
22 - And I should see "Upload files" 18 + And I go to article "Gallery test"
  19 + Then I should see "Upload files"
23 20
24 - @selenium  
25 Scenario: provile links to upload files to enterprise's gallery 21 Scenario: provile links to upload files to enterprise's gallery
26 Given the following enterprises 22 Given the following enterprises
27 | identifier | name | owner | 23 | identifier | name | owner |
@@ -29,10 +25,8 @@ Feature: upload files @@ -29,10 +25,8 @@ Feature: upload files
29 And the following galleries 25 And the following galleries
30 | owner | name | 26 | owner | name |
31 | sample-enterprise | Gallery test | 27 | sample-enterprise | Gallery test |
32 - And I go to sample-enterprise's profile  
33 - And I follow "Profile"  
34 - And I follow "0 pictures"  
35 - And I should see "Upload files" 28 + And I go to article "Gallery test"
  29 + Then I should see "Upload files"
36 30
37 Scenario: not provile links to upload files on blogs 31 Scenario: not provile links to upload files on blogs
38 Given the following communities 32 Given the following communities
lib/noosfero/plugin/routes.rb
@@ -24,7 +24,7 @@ Dir.glob(Rails.root.join(plugins_root, &#39;*&#39;, &#39;controllers&#39;)) do |controllers_dir| @@ -24,7 +24,7 @@ Dir.glob(Rails.root.join(plugins_root, &#39;*&#39;, &#39;controllers&#39;)) do |controllers_dir|
24 end 24 end
25 25
26 match 'plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin' 26 match 'plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin'
27 - match 'profile/:profile/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_profile'  
28 - match 'myprofile/:profile/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_myprofile' 27 + match 'profile/:profile/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_profile', :profile => /#{Noosfero.identifier_format}/
  28 + match 'myprofile/:profile/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_myprofile', :profile => /#{Noosfero.identifier_format}/
29 match 'admin/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_admin' 29 match 'admin/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_admin'
30 end 30 end
lib/tasks/plugins_tests.rake
1 @all_plugins = Dir.glob('plugins/*').map { |f| File.basename(f) } - ['template'] 1 @all_plugins = Dir.glob('plugins/*').map { |f| File.basename(f) } - ['template']
  2 +@all_plugins.sort!
2 @all_tasks = [:units, :functionals, :integration, :cucumber, :selenium] 3 @all_tasks = [:units, :functionals, :integration, :cucumber, :selenium]
3 4
4 def enabled_plugins 5 def enabled_plugins
@@ -110,7 +111,7 @@ def run_cucumber(profile, files) @@ -110,7 +111,7 @@ def run_cucumber(profile, files)
110 sh 'xvfb-run', 'ruby', '-S', 'cucumber', '--profile', profile.to_s, '--format', ENV['CUCUMBER_FORMAT'] || 'progress' , *files 111 sh 'xvfb-run', 'ruby', '-S', 'cucumber', '--profile', profile.to_s, '--format', ENV['CUCUMBER_FORMAT'] || 'progress' , *files
111 end 112 end
112 113
113 -def custom_run(name, files, run=:individually) 114 +def custom_run(name, files, run=:all)
114 case run 115 case run
115 when :all 116 when :all
116 run_test name, files 117 run_test name, files
@@ -122,7 +123,7 @@ def custom_run(name, files, run=:individually) @@ -122,7 +123,7 @@ def custom_run(name, files, run=:individually)
122 end 123 end
123 end 124 end
124 125
125 -def run_tests(name, plugins, run=:individually) 126 +def run_tests(name, plugins, run=:all)
126 plugins = Array(plugins) 127 plugins = Array(plugins)
127 glob = "plugins/{#{plugins.join(',')}}/test/#{task2folder(name)}/**/*.#{task2ext(name)}" 128 glob = "plugins/{#{plugins.join(',')}}/test/#{task2folder(name)}/**/*.#{task2ext(name)}"
128 files = Dir.glob(glob) 129 files = Dir.glob(glob)
@@ -169,7 +170,7 @@ def test_sequence(plugins, tasks) @@ -169,7 +170,7 @@ def test_sequence(plugins, tasks)
169 fail 'There are broken tests to be fixed!' if fail_flag 170 fail 'There are broken tests to be fixed!' if fail_flag
170 end 171 end
171 172
172 -def plugin_test_task(plugin, task, run=:individually) 173 +def plugin_test_task(plugin, task, run=:all)
173 desc "Run #{task} tests for #{plugin_name(plugin)}" 174 desc "Run #{task} tests for #{plugin_name(plugin)}"
174 task task do 175 task task do
175 test_sequence(plugin, task) 176 test_sequence(plugin, task)
plugins/comment_group/public/comment_group_macro.js
@@ -5,7 +5,7 @@ jQuery(document).ready(function($) { @@ -5,7 +5,7 @@ jQuery(document).ready(function($) {
5 5
6 var val = anchor.split('-'); //anchor format = #comment-\d+ 6 var val = anchor.split('-'); //anchor format = #comment-\d+
7 if(val.length!=2 || val[0]!='#comment') return; 7 if(val.length!=2 || val[0]!='#comment') return;
8 - if($('div[data-macro=comment_group_plugin/allow_comment]').length==0) return; //comment_group_plugin/allow_comment div must exists 8 + if($('div[data-macro=comment_group_plugin\\/allow_comment]').length==0) return; //comment_group_plugin/allow_comment div must exists
9 var comment_id = val[1]; 9 var comment_id = val[1];
10 if(!/^\d+$/.test(comment_id)) return; //test for integer 10 if(!/^\d+$/.test(comment_id)) return; //test for integer
11 11
plugins/display_content/lib/display_content_block.rb
@@ -26,7 +26,7 @@ class DisplayContentBlock &lt; Block @@ -26,7 +26,7 @@ class DisplayContentBlock &lt; Block
26 settings_items :display_folder_children, :type => :boolean, :default => true 26 settings_items :display_folder_children, :type => :boolean, :default => true
27 settings_items :types, :type => Array, :default => ['TextileArticle', 'TinyMceArticle', 'RawHTMLArticle'] 27 settings_items :types, :type => Array, :default => ['TextileArticle', 'TinyMceArticle', 'RawHTMLArticle']
28 28
29 - attr_accessible :sections, :checked_nodes, :display_folder_children 29 + attr_accessible :sections, :checked_nodes, :display_folder_children, :types
30 30
31 def self.description 31 def self.description
32 _('Display your contents') 32 _('Display your contents')
@@ -120,7 +120,7 @@ class DisplayContentBlock &lt; Block @@ -120,7 +120,7 @@ class DisplayContentBlock &lt; Block
120 nodes_conditions = nodes.blank? ? '' : " AND articles.id IN(:nodes) " 120 nodes_conditions = nodes.blank? ? '' : " AND articles.id IN(:nodes) "
121 nodes_conditions += ' OR articles.parent_id IN(:nodes) ' if !nodes.blank? && display_folder_children 121 nodes_conditions += ' OR articles.parent_id IN(:nodes) ' if !nodes.blank? && display_folder_children
122 122
123 - docs = owner.articles.find(:all, :conditions => ["articles.type IN(:types) #{nodes.blank? ? '' : nodes_conditions}", {:nodes => self.nodes, :types => self.types}], :include => :profile) 123 + docs = owner.articles.find(:all, :conditions => ["articles.type IN(:types) #{nodes.blank? ? '' : nodes_conditions}", {:nodes => self.nodes, :types => self.types}], :include => [:profile, :image, :tags])
124 proc do 124 proc do
125 block.block_title(block.title) + 125 block.block_title(block.title) +
126 content_tag('ul', docs.map {|item| 126 content_tag('ul', docs.map {|item|
plugins/display_content/test/unit/display_content_block_test.rb
@@ -350,10 +350,11 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase @@ -350,10 +350,11 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
350 should 'list links for all articles title defined in nodes' do 350 should 'list links for all articles title defined in nodes' do
351 profile = create_user('testuser').person 351 profile = create_user('testuser').person
352 Article.delete_all 352 Article.delete_all
353 - a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id)  
354 - a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) 353 + a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id)
  354 + a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id)
355 355
356 block = DisplayContentBlock.new 356 block = DisplayContentBlock.new
  357 + block.sections = [{:value => 'title', :checked => true}]
357 block.nodes = [a1.id, a2.id] 358 block.nodes = [a1.id, a2.id]
358 box = mock() 359 box = mock()
359 block.stubs(:box).returns(box) 360 block.stubs(:box).returns(box)
@@ -366,8 +367,8 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase @@ -366,8 +367,8 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
366 should 'list content for all articles lead defined in nodes' do 367 should 'list content for all articles lead defined in nodes' do
367 profile = create_user('testuser').person 368 profile = create_user('testuser').person
368 Article.delete_all 369 Article.delete_all
369 - a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'abstract article 1')  
370 - a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :abstract => 'abstract article 2') 370 + a1 = fast_create(TinyMceArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'abstract article 1')
  371 + a2 = fast_create(TinyMceArticle, :name => 'test article 2', :profile_id => profile.id, :abstract => 'abstract article 2')
371 372
372 block = DisplayContentBlock.new 373 block = DisplayContentBlock.new
373 block.sections = [{:value => 'abstract', :checked => true}] 374 block.sections = [{:value => 'abstract', :checked => true}]
@@ -421,7 +422,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase @@ -421,7 +422,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
421 422
422 should 'show title if defined by user' do 423 should 'show title if defined by user' do
423 profile = create_user('testuser').person 424 profile = create_user('testuser').person
424 - a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) 425 + a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id)
425 426
426 block = DisplayContentBlock.new 427 block = DisplayContentBlock.new
427 block.nodes = [a.id] 428 block.nodes = [a.id]
@@ -435,7 +436,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase @@ -435,7 +436,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
435 436
436 should 'show abstract if defined by user' do 437 should 'show abstract if defined by user' do
437 profile = create_user('testuser').person 438 profile = create_user('testuser').person
438 - a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'some abstract') 439 + a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'some abstract')
439 440
440 block = DisplayContentBlock.new 441 block = DisplayContentBlock.new
441 block.nodes = [a.id] 442 block.nodes = [a.id]
@@ -449,7 +450,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase @@ -449,7 +450,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
449 450
450 should 'show body if defined by user' do 451 should 'show body if defined by user' do
451 profile = create_user('testuser').person 452 profile = create_user('testuser').person
452 - a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body') 453 + a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body')
453 454
454 block = DisplayContentBlock.new 455 block = DisplayContentBlock.new
455 block.nodes = [a.id] 456 block.nodes = [a.id]
@@ -577,7 +578,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase @@ -577,7 +578,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
577 block.types = ['TinyMceArticle'] 578 block.types = ['TinyMceArticle']
578 579
579 block.types = ['TinyMceArticle', 'Folder'] 580 block.types = ['TinyMceArticle', 'Folder']
580 - assert_equal [TinyMceArticle, Folder, UploadedFile, Event, TextileArticle, RawHTMLArticle, Blog, Forum, Gallery, RssFeed], block.available_content_types 581 + assert_equivalent [TinyMceArticle, Folder, UploadedFile, Event, TextileArticle, RawHTMLArticle, Blog, Forum, Gallery, RssFeed], block.available_content_types
581 end 582 end
582 583
583 should 'return available content types' do 584 should 'return available content types' do
@@ -585,7 +586,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase @@ -585,7 +586,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
585 block = DisplayContentBlock.create! 586 block = DisplayContentBlock.create!
586 block.types = ['TinyMceArticle'] 587 block.types = ['TinyMceArticle']
587 block.types = [] 588 block.types = []
588 - assert_equal [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed], block.available_content_types 589 + assert_equivalent [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed], block.available_content_types
589 end 590 end
590 591
591 should 'return first 2 content types' do 592 should 'return first 2 content types' do
@@ -629,7 +630,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase @@ -629,7 +630,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
629 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new]) 630 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new])
630 631
631 block.types = [] 632 block.types = []
632 - assert_equal [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], block.available_content_types 633 + assert_equivalent [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], block.available_content_types
633 end 634 end
634 635
635 should 'do not fail if a selected article was removed' do 636 should 'do not fail if a selected article was removed' do
plugins/people_block/controllers/people_block_plugin_profile_controller.rb
@@ -4,7 +4,7 @@ class PeopleBlockPluginProfileController &lt; ProfileController @@ -4,7 +4,7 @@ class PeopleBlockPluginProfileController &lt; ProfileController
4 4
5 def members 5 def members
6 if is_cache_expired?(profile.members_cache_key(params)) 6 if is_cache_expired?(profile.members_cache_key(params))
7 - if(params[:role_key]) 7 + unless params[:role_key].blank?
8 role = Role.find_by_key_and_environment_id(params[:role_key], profile.environment) 8 role = Role.find_by_key_and_environment_id(params[:role_key], profile.environment)
9 @members = profile.members.with_role(role.id).includes(relations_to_include).paginate(:per_page => members_per_page, :page => params[:npage]) 9 @members = profile.members.with_role(role.id).includes(relations_to_include).paginate(:per_page => members_per_page, :page => params[:npage])
10 @members_title = role.name 10 @members_title = role.name
plugins/people_block/test/functional/people_block_plugin_profile_controller_test.rb
@@ -34,7 +34,7 @@ class PeopleBlockPluginProfileControllerTest &lt; ActionController::TestCase @@ -34,7 +34,7 @@ class PeopleBlockPluginProfileControllerTest &lt; ActionController::TestCase
34 attr_accessor :profile, :block, :admin, :member, :moderator 34 attr_accessor :profile, :block, :admin, :member, :moderator
35 35
36 should 'list members without role_key' do 36 should 'list members without role_key' do
37 - get :members, :profile => profile.identifier 37 + get :members, :profile => profile.identifier, :role_key => ""
38 assert_response :success 38 assert_response :success
39 assert_template 'members' 39 assert_template 'members'
40 assert_equivalent [@admin, @member, @moderator], assigns(:members) 40 assert_equivalent [@admin, @member, @moderator], assigns(:members)
plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb
@@ -18,6 +18,8 @@ class RelevantContentPlugin::RelevantContentBlock &lt; Block @@ -18,6 +18,8 @@ class RelevantContentPlugin::RelevantContentBlock &lt; Block
18 settings_items :show_most_disliked, :type => :boolean, :default => 0 18 settings_items :show_most_disliked, :type => :boolean, :default => 0
19 settings_items :show_most_voted, :type => :boolean, :default => 1 19 settings_items :show_most_voted, :type => :boolean, :default => 1
20 20
  21 + attr_accessible :limit, :show_most_voted, :show_most_disliked, :show_most_liked, :show_most_commented, :show_most_read
  22 +
21 include ActionView::Helpers 23 include ActionView::Helpers
22 include Rails.application.routes.url_helpers 24 include Rails.application.routes.url_helpers
23 25
public/javascripts/chat.js
@@ -99,7 +99,7 @@ jQuery(function($) { @@ -99,7 +99,7 @@ jQuery(function($) {
99 }, 99 },
100 100
101 render_body_message: function(body) { 101 render_body_message: function(body) {
102 - body = body.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\r?\n/g, '<br>'); 102 + body = body.replace(/\r?\n/g, '<br>');
103 body = $().emoticon(body); 103 body = $().emoticon(body);
104 body = linkify(body, { 104 body = linkify(body, {
105 callback: function(text, href) { 105 callback: function(text, href) {
@@ -320,7 +320,7 @@ jQuery(function($) { @@ -320,7 +320,7 @@ jQuery(function($) {
320 var jid_id = Jabber.jid_to_id(jid); 320 var jid_id = Jabber.jid_to_id(jid);
321 var name = Jabber.name_of(jid_id); 321 var name = Jabber.name_of(jid_id);
322 create_conversation_tab(name, jid_id); 322 create_conversation_tab(name, jid_id);
323 - Jabber.show_message(jid, name, message.body, 'other', Strophe.getNodeFromJid(jid)); 323 + Jabber.show_message(jid, name, escape_html(message.body), 'other', Strophe.getNodeFromJid(jid));
324 $.sound.play('/sounds/receive.wav'); 324 $.sound.play('/sounds/receive.wav');
325 return true; 325 return true;
326 }, 326 },
@@ -336,7 +336,7 @@ jQuery(function($) { @@ -336,7 +336,7 @@ jQuery(function($) {
336 // is a message from another user, not mine 336 // is a message from another user, not mine
337 else if ($own_name != name) { 337 else if ($own_name != name) {
338 var jid = Jabber.rooms[Jabber.jid_to_id(message.from)][name]; 338 var jid = Jabber.rooms[Jabber.jid_to_id(message.from)][name];
339 - Jabber.show_message(message.from, name, message.body, name, Strophe.getNodeFromJid(jid)); 339 + Jabber.show_message(message.from, name, escape_html(message.body), name, Strophe.getNodeFromJid(jid));
340 $.sound.play('/sounds/receive.wav'); 340 $.sound.play('/sounds/receive.wav');
341 } 341 }
342 return true; 342 return true;
@@ -432,7 +432,7 @@ jQuery(function($) { @@ -432,7 +432,7 @@ jQuery(function($) {
432 .c('body').t(body).up() 432 .c('body').t(body).up()
433 .c('active', {xmlns: Strophe.NS.CHAT_STATES}); 433 .c('active', {xmlns: Strophe.NS.CHAT_STATES});
434 Jabber.connection.send(message); 434 Jabber.connection.send(message);
435 - Jabber.show_message(jid, $own_name, body, 'self', Strophe.getNodeFromJid(Jabber.connection.jid)); 435 + Jabber.show_message(jid, $own_name, escape_html(body), 'self', Strophe.getNodeFromJid(Jabber.connection.jid));
436 }, 436 },
437 437
438 is_a_room: function(jid_id) { 438 is_a_room: function(jid_id) {
@@ -529,11 +529,27 @@ jQuery(function($) { @@ -529,11 +529,27 @@ jQuery(function($) {
529 function create_conversation_tab(title, jid_id) { 529 function create_conversation_tab(title, jid_id) {
530 if (! $('#' + Jabber.tab_prefix + jid_id).length > 0) { 530 if (! $('#' + Jabber.tab_prefix + jid_id).length > 0) {
531 // opening chat with selected online friend 531 // opening chat with selected online friend
532 - var tab = $tabs.tabs('add', '#' + Jabber.tab_prefix + jid_id, title); 532 + var panel = $('<div id="'+Jabber.tab_prefix + jid_id+'"></div>').appendTo($tabs);
  533 + panel.append("<div class='conversation'><div class='history'></div><div class='input-div'><div class='icon-chat'></div><textarea class='input'></textarea></div></div>");
  534 +
  535 + //FIXME
  536 + //var notice = $starting_chat_notice.replace('%{name}', $(ui.tab).html());
  537 + //Jabber.show_notice(jid_id, notice);
  538 +
  539 + // define textarea name as '<TAB_ID>'
  540 + panel.find('textarea').attr('name', panel.id);
  541 +
  542 + if (Jabber.is_a_room(jid_id)) {
  543 + panel.append(Jabber.templates.occupant_list);
  544 + panel.find('.history').addClass('room');
  545 + }
  546 +
  547 + $tabs.find('.ui-tabs-nav').append( "<li><a href='"+('#' + Jabber.tab_prefix + jid_id)+"'><span class=\"unread-messages\" style=\"display:none\"></span>"+title+"</a></li>" );
  548 + $tabs.tabs('refresh');
  549 +
533 var jid = Jabber.jid_of(jid_id); 550 var jid = Jabber.jid_of(jid_id);
534 $("a[href='#" + Jabber.tab_prefix + jid_id + "']").addClass($('#' + jid_id).attr('class') || 'icon-chat'); 551 $("a[href='#" + Jabber.tab_prefix + jid_id + "']").addClass($('#' + jid_id).attr('class') || 'icon-chat');
535 $('#' + Jabber.tab_prefix + jid_id).find('textarea').attr('data-to', jid); 552 $('#' + Jabber.tab_prefix + jid_id).find('textarea').attr('data-to', jid);
536 - $tabs.tabs('select', '#' + Jabber.tab_prefix + jid_id);  
537 } 553 }
538 } 554 }
539 555
@@ -555,7 +571,7 @@ jQuery(function($) { @@ -555,7 +571,7 @@ jQuery(function($) {
555 var $tabs = $('#chat-window #tabs').tabs({ 571 var $tabs = $('#chat-window #tabs').tabs({
556 tabTemplate: '<li class="tab"><a href="#{href}"><span class="unread-messages" style="display:none"></span>#{label}</a></li>', 572 tabTemplate: '<li class="tab"><a href="#{href}"><span class="unread-messages" style="display:none"></span>#{label}</a></li>',
557 panelTemplate: "<div class='conversation'><div class='history'></div><div class='input-div'><div class='icon-chat'></div><textarea class='input'></textarea></div></div>", 573 panelTemplate: "<div class='conversation'><div class='history'></div><div class='input-div'><div class='icon-chat'></div><textarea class='input'></textarea></div></div>",
558 - add: function(event, ui) { 574 + add: function(event, ui) { //FIXME DEPRECATED
559 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, ''); 575 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, '');
560 576
561 var notice = $starting_chat_notice.replace('%{name}', $(ui.tab).html()); 577 var notice = $starting_chat_notice.replace('%{name}', $(ui.tab).html());
@@ -575,7 +591,7 @@ jQuery(function($) { @@ -575,7 +591,7 @@ jQuery(function($) {
575 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, ''); 591 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, '');
576 count_unread_messages(jid_id, true); 592 count_unread_messages(jid_id, true);
577 }, 593 },
578 - remove: function(event, ui) { 594 + remove: function(event, ui) { //FIXME DEPRECATED
579 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, ''); 595 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, '');
580 if (Jabber.is_a_room(jid_id)) { 596 if (Jabber.is_a_room(jid_id)) {
581 // exiting from a chat room 597 // exiting from a chat room
@@ -632,6 +648,13 @@ jQuery(function($) { @@ -632,6 +648,13 @@ jQuery(function($) {
632 } 648 }
633 } 649 }
634 650
  651 + function escape_html(body) {
  652 + return body
  653 + .replace(/&/g, '&amp;')
  654 + .replace(/</g, '&lt;')
  655 + .replace(/>/g, '&gt;');
  656 + }
  657 +
635 }); 658 });
636 659
637 function checkTime(i) { 660 function checkTime(i) {
public/javascripts/memberships_filter.js 0 → 100644
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
  1 +jQuery(document).ready(function($){
  2 + $("#memberships_filter").change(function(){
  3 + var filter = $(this).find("option:selected").val();
  4 + redirect_to('?filter_type=' + filter);
  5 + });
  6 +});
public/stylesheets/application.css
@@ -2642,6 +2642,9 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation @@ -2642,6 +2642,9 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation
2642 background: #B8CFE7; 2642 background: #B8CFE7;
2643 padding: 0px 20px 5px 20px; 2643 padding: 0px 20px 5px 20px;
2644 } 2644 }
  2645 +#TB_window .login-box .button-bar {
  2646 + padding-top: 0;
  2647 +}
2645 .login-box-content .button-bar .button { 2648 .login-box-content .button-bar .button {
2646 position: relative; 2649 position: relative;
2647 } 2650 }
script/noosfero-plugins
@@ -104,8 +104,10 @@ _enable(){ @@ -104,8 +104,10 @@ _enable(){
104 plugins_features_dir="$NOOSFERO_DIR/features/plugins" 104 plugins_features_dir="$NOOSFERO_DIR/features/plugins"
105 cd $plugins_public_dir 105 cd $plugins_public_dir
106 test -d "$source/public" && ln -s "$source/public" "$plugin" 106 test -d "$source/public" && ln -s "$source/public" "$plugin"
107 - cd $plugins_features_dir  
108 - test -d "$NOOSFERO_DIR/features" && test -d "$source/features" && ln -s "$source/features" "$plugin" 107 + if [ -d "$NOOSFERO_DIR/features" ]; then
  108 + cd $plugins_features_dir
  109 + test -d "$source/features" && ln -s "$source/features" "$plugin"
  110 + fi
109 _say "$plugin enabled" 111 _say "$plugin enabled"
110 run "$source/after_enable.rb" 112 run "$source/after_enable.rb"
111 needs_migrate=true 113 needs_migrate=true
test/functional/cms_controller_test.rb
@@ -1791,6 +1791,14 @@ class CmsControllerTest &lt; ActionController::TestCase @@ -1791,6 +1791,14 @@ class CmsControllerTest &lt; ActionController::TestCase
1791 assert_equal other_person, a.created_by 1791 assert_equal other_person, a.created_by
1792 end 1792 end
1793 1793
  1794 + should 'continue on the same page, when no group is selected' do
  1795 + c = Community.create!(:name => 'test comm', :identifier => 'test_comm')
  1796 + c.affiliate(profile, Profile::Roles.all_roles(c.environment.id))
  1797 + article = profile.articles.create!(:name => 'something intresting', :body => 'ruby on rails')
  1798 + post :publish, :profile => profile.identifier, :id => article.id, :marked_groups => {c.id.to_s => {}}
  1799 + assert_template 'cms/publish'
  1800 + end
  1801 +
1794 protected 1802 protected
1795 1803
1796 # FIXME this is to avoid adding an extra dependency for a proper JSON parser. 1804 # FIXME this is to avoid adding an extra dependency for a proper JSON parser.
test/functional/friends_controller_test.rb
@@ -36,12 +36,12 @@ class FriendsControllerTest &lt; ActionController::TestCase @@ -36,12 +36,12 @@ class FriendsControllerTest &lt; ActionController::TestCase
36 36
37 should 'actually remove friend' do 37 should 'actually remove friend' do
38 profile.add_friend(friend) 38 profile.add_friend(friend)
  39 + friend.add_friend(profile)
39 40
40 - assert_difference 'Friendship.count', -1 do 41 + assert_difference 'Friendship.count', -2 do
41 post :remove, :id => friend.id, :confirmation => '1' 42 post :remove, :id => friend.id, :confirmation => '1'
42 assert_redirected_to :action => 'index' 43 assert_redirected_to :action => 'index'
43 end 44 end
44 - assert_equal friend, Profile.find(friend.id)  
45 end 45 end
46 46
47 should 'display find people button' do 47 should 'display find people button' do
test/integration/manage_friendships_test.rb 0 → 100644
@@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
  1 +require "#{File.dirname(__FILE__)}/../test_helper"
  2 +
  3 +class ManageFriendshipsTest < ActionController::IntegrationTest
  4 +
  5 + def setup
  6 + FriendsController.any_instance.stubs(:get_layout).returns('application')
  7 + ProfileController.any_instance.stubs(:get_layout).returns('application')
  8 +
  9 + Friendship.delete_all
  10 + Person.delete_all
  11 + @person = create_user("albert", :password => 'test',
  12 + :password_confirmation => 'test').person
  13 + @person.user.activate
  14 +
  15 + @friend = fast_create(Person, :identifier => "isaac")
  16 +
  17 + login(@person.identifier, 'test')
  18 + end
  19 +
  20 + should 'remove friendships' do
  21 + @person.add_friend(@friend)
  22 + @friend.add_friend(@person)
  23 +
  24 + get "/myprofile/#{@person.identifier}/friends/remove/#{@friend.id}"
  25 + assert_response :success
  26 +
  27 + post "/myprofile/#{@person.identifier}/friends/remove/#{@friend.id}",
  28 + :confirmation => '1'
  29 + assert_response :redirect
  30 +
  31 + follow_redirect!
  32 +
  33 + assert assigns(:friends).empty?
  34 + assert !@person.is_a_friend?(@friend)
  35 + assert !@friend.is_a_friend?(@person)
  36 + end
  37 +end
test/test_helper.rb
@@ -277,16 +277,4 @@ class ActionController::IntegrationTest @@ -277,16 +277,4 @@ class ActionController::IntegrationTest
277 277
278 end 278 end
279 279
280 -def with_constants(constants, &block)  
281 - old_constants = Hash.new  
282 - constants.each do |constant, val|  
283 - old_constants[constant] = Object.const_get(constant)  
284 - silence_stderr{ Object.const_set(constant, val) }  
285 - end  
286 - block.call  
287 - old_constants.each do |constant, val|  
288 - silence_stderr{ Object.const_set(constant, val) }  
289 - end  
290 -end  
291 -  
292 Profile 280 Profile
test/unit/application_helper_test.rb
@@ -472,13 +472,13 @@ class ApplicationHelperTest &lt; ActionView::TestCase @@ -472,13 +472,13 @@ class ApplicationHelperTest &lt; ActionView::TestCase
472 profile = mock 472 profile = mock
473 profile.stubs(:theme).returns('some-theme') 473 profile.stubs(:theme).returns('some-theme')
474 stubs(:profile).returns(profile) 474 stubs(:profile).returns(profile)
475 - with_constants :NOOSFERO_CONF => {'gravatar' => 'crazyvatar'} do  
476 - assert_equal gravatar_default, 'crazyvatar'  
477 - end 475 +
  476 + NOOSFERO_CONF.stubs(:[]).with('gravatar').returns('crazyvatar')
  477 + assert_equal gravatar_default, 'crazyvatar'
  478 +
478 stubs(:theme_option).returns('gravatar' => 'nicevatar') 479 stubs(:theme_option).returns('gravatar' => 'nicevatar')
479 - with_constants :NOOSFERO_CONF => {'gravatar' => 'crazyvatar'} do  
480 - assert_equal gravatar_default, 'nicevatar'  
481 - end 480 + NOOSFERO_CONF.stubs(:[]).with('gravatar').returns('nicevatar')
  481 + assert_equal gravatar_default, 'nicevatar'
482 end 482 end
483 483
484 should 'use theme passed via param when in development mode' do 484 should 'use theme passed via param when in development mode' do
test/unit/external_feed_test.rb
@@ -142,7 +142,7 @@ class ExternalFeedTest &lt; ActiveSupport::TestCase @@ -142,7 +142,7 @@ class ExternalFeedTest &lt; ActiveSupport::TestCase
142 should 'save hour when feed was fetched' do 142 should 'save hour when feed was fetched' do
143 external_feed = create(:external_feed) 143 external_feed = create(:external_feed)
144 144
145 - now = Time.parse('2009-01-23 09:35') 145 + now = Time.zone.parse('2009-01-23 09:35')
146 Time.stubs(:now).returns(now) 146 Time.stubs(:now).returns(now)
147 147
148 external_feed.finish_fetch 148 external_feed.finish_fetch
test/unit/friendship_test.rb
@@ -58,4 +58,18 @@ class FriendshipTest &lt; ActiveSupport::TestCase @@ -58,4 +58,18 @@ class FriendshipTest &lt; ActiveSupport::TestCase
58 assert_equal ['a'], ta.get_friend_name 58 assert_equal ['a'], ta.get_friend_name
59 end 59 end
60 60
  61 + should 'remove friendships when a friend removal occurs' do
  62 + p1 = create_user('testuser1').person
  63 + p2 = create_user('testuser2').person
  64 + p1.add_friend(p2, 'friends')
  65 + p2.add_friend(p1, 'friends')
  66 +
  67 + assert_difference 'Friendship.count', -2 do
  68 + Friendship.remove_friendship(p1, p2)
  69 + end
  70 +
  71 + assert_not_includes p1.friends(true), p2
  72 + assert_not_includes p2.friends(true), p1
  73 + end
  74 +
61 end 75 end
test/unit/google_maps_test.rb
@@ -3,13 +3,12 @@ require File.dirname(__FILE__) + &#39;/../test_helper&#39; @@ -3,13 +3,12 @@ require File.dirname(__FILE__) + &#39;/../test_helper&#39;
3 class GoogleMapsTest < ActiveSupport::TestCase 3 class GoogleMapsTest < ActiveSupport::TestCase
4 4
5 should 'provide initial_zoom setting' do 5 should 'provide initial_zoom setting' do
6 - with_constants :NOOSFERO_CONF => {'googlemaps_initial_zoom' => 2} do  
7 - assert_equal 2, GoogleMaps.initial_zoom  
8 - end 6 + NOOSFERO_CONF.stubs(:[]).with('googlemaps_initial_zoom').returns(2)
  7 + assert_equal 2, GoogleMaps.initial_zoom
9 end 8 end
10 9
11 should 'use 4 as default initial_zoom' do 10 should 'use 4 as default initial_zoom' do
12 - GoogleMaps.stubs(:config).returns({}) 11 + NOOSFERO_CONF.stubs(:[]).with('googlemaps_initial_zoom').returns(nil)
13 assert_equal 4, GoogleMaps.initial_zoom 12 assert_equal 4, GoogleMaps.initial_zoom
14 end 13 end
15 14
test/unit/mail_conf_test.rb
@@ -3,22 +3,22 @@ require File.dirname(__FILE__) + &#39;/../test_helper&#39; @@ -3,22 +3,22 @@ require File.dirname(__FILE__) + &#39;/../test_helper&#39;
3 class MailConfTest < ActiveSupport::TestCase 3 class MailConfTest < ActiveSupport::TestCase
4 4
5 should 'enable if told to' do 5 should 'enable if told to' do
6 - NOOSFERO_CONF['mail_enabled'] = true 6 + NOOSFERO_CONF.stubs(:[]).with('mail_enabled').returns(true)
7 assert_equal true, MailConf.enabled? 7 assert_equal true, MailConf.enabled?
8 end 8 end
9 9
10 should 'disable if told to' do 10 should 'disable if told to' do
11 - NOOSFERO_CONF['mail_enabled'] = false 11 + NOOSFERO_CONF.stubs(:[]).with('mail_enabled').returns(false)
12 assert_equal false, MailConf.enabled? 12 assert_equal false, MailConf.enabled?
13 end 13 end
14 14
15 should 'disable by default' do 15 should 'disable by default' do
16 - NOOSFERO_CONF['mail_enabled'] = nil 16 + NOOSFERO_CONF.stubs(:[]).with('mail_enabled').returns(nil)
17 assert_equal false, MailConf.enabled? 17 assert_equal false, MailConf.enabled?
18 end 18 end
19 19
20 should 'provide webmail url preference' do 20 should 'provide webmail url preference' do
21 - NOOSFERO_CONF['webmail_url'] = 'http://some.url/webmail/%s/%s' 21 + NOOSFERO_CONF.stubs(:[]).with('webmail_url').returns('http://some.url/webmail/%s/%s')
22 assert_equal 'http://some.url/webmail/login/example.com', MailConf.webmail_url('login', 'example.com') 22 assert_equal 'http://some.url/webmail/login/example.com', MailConf.webmail_url('login', 'example.com')
23 end 23 end
24 24
util/chat/ejabberd.cfg 0 → 100644
@@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
  1 +%%%
  2 +%%% Noosfero ejabberd configuration file
  3 +%%% This config must be in UTF-8 encoding
  4 +%%%
  5 +
  6 +{acl, admin, {user, "admin", "mydomain.example.com"}}.
  7 +{hosts, ["mydomain.example.com"]}.
  8 +
  9 +{loglevel, 4}.
  10 +{listen,
  11 + [
  12 + {5222, ejabberd_c2s, [
  13 + {access, c2s},
  14 + {shaper, c2s_shaper},
  15 + {max_stanza_size, 65536},
  16 + starttls, {certfile, "/etc/ejabberd/ejabberd.pem"}
  17 + ]},
  18 + {5280, ejabberd_http, [
  19 + http_bind,
  20 + http_poll
  21 + ]}
  22 + ]}.
  23 +{max_fsm_queue, 1000}.
  24 +{auth_method, odbc}.
  25 +{odbc_server, "DSN=PostgreSQLEjabberdNoosfero"}.
  26 +{shaper, normal, {maxrate, 10000000}}.
  27 +{shaper, fast, {maxrate, 50000}}.
  28 +{acl, local, {user_regexp, ""}}.
  29 +{access, max_user_sessions, [{10, all}]}.
  30 +{access, local, [{allow, local}]}.
  31 +{access, c2s, [{deny, blocked},
  32 + {allow, all}]}.
  33 +{access, c2s_shaper, [{none, admin},
  34 + {normal, all}]}.
  35 +{access, announce, [{allow, admin}]}.
  36 +{access, configure, [{allow, admin}]}.
  37 +{access, muc_admin, [{allow, admin}]}.
  38 +{access, muc, [{allow, all}]}.
  39 +{access, pubsub_createnode, [{allow, all}]}.
  40 +{language, "pt"}.
  41 +{modules,
  42 + [
  43 + {mod_adhoc, []},
  44 + {mod_announce, [{access, announce}]}, % requires mod_adhoc
  45 + {mod_caps, []},
  46 + {mod_configure,[]}, % requires mod_adhoc
  47 + {mod_disco, []},
  48 + {mod_last, []},
  49 + {mod_muc, [
  50 + {access, muc},
  51 + {access_create, muc},
  52 + {access_persistent, muc},
  53 + {access_admin, muc_admin},
  54 + {max_users, 500},
  55 + {default_room_options, [{anonymous, false}]}
  56 + ]},
  57 + {mod_privacy_odbc, []},
  58 + {mod_private_odbc, []},
  59 + {mod_proxy65, [
  60 + {access, local},
  61 + {shaper, c2s_shaper}
  62 + ]},
  63 + {mod_roster_odbc, []},
  64 + {mod_stats, []},
  65 + {mod_time, []},
  66 + {mod_vcard, []},
  67 + {mod_http_bind, []},
  68 + {mod_version, []}
  69 + ]}.
  70 +
  71 +%%% Local Variables:
  72 +%%% mode: erlang
  73 +%%% End:
  74 +%%% vim: set filetype=erlang tabstop=8:
util/chat/odbc.ini 0 → 100644
@@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
  1 +[PostgreSQLEjabberdNoosfero]
  2 +Description = PostgreSQL Noosfero ejabberd database
  3 +Driver = PostgreSQL Unicode
  4 +Trace = No
  5 +TraceFile = /tmp/psqlodbc.log
  6 +Database = noosfero
  7 +Servername = localhost
  8 +UserName = noosfero
  9 +Password = <copy the password present in the database.yml file>
  10 +Port =
  11 +ReadOnly = No
  12 +RowVersioning = No
  13 +ShowSystemTables = No
  14 +ShowOidColumn = No
  15 +FakeOidIndex = No
  16 +ConnSettings = SET search_path TO ejabberd
util/chat/odbcinst.ini 0 → 100644
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
  1 +[PostgreSQL Unicode]
  2 +Description = PostgreSQL ODBC driver (Unicode version)
  3 +Driver = /usr/lib/odbc/psqlodbcw.so
  4 +Setup = /usr/lib/odbc/libodbcpsqlS.so
  5 +Debug = 0
  6 +CommLog = 1
  7 +UsageCount = 3
vendor/plugins/ruby_bosh/lib/ruby_bosh.rb
@@ -4,7 +4,6 @@ require &#39;rexml/document&#39; @@ -4,7 +4,6 @@ require &#39;rexml/document&#39;
4 require 'base64' 4 require 'base64'
5 require 'hpricot' 5 require 'hpricot'
6 require 'timeout' 6 require 'timeout'
7 -require 'system_timer'  
8 7
9 class RubyBOSH 8 class RubyBOSH
10 BOSH_XMLNS = 'http://jabber.org/protocol/httpbind' 9 BOSH_XMLNS = 'http://jabber.org/protocol/httpbind'
@@ -15,7 +14,7 @@ class RubyBOSH @@ -15,7 +14,7 @@ class RubyBOSH
15 CLIENT_XMLNS = 'jabber:client' 14 CLIENT_XMLNS = 'jabber:client'
16 15
17 class Error < StandardError; end 16 class Error < StandardError; end
18 - class Timeout < RubyBOSH::Error; end 17 + class TimeoutError < RubyBOSH::Error; end
19 class AuthFailed < RubyBOSH::Error; end 18 class AuthFailed < RubyBOSH::Error; end
20 class ConnFailed < RubyBOSH::Error; end 19 class ConnFailed < RubyBOSH::Error; end
21 20
@@ -134,12 +133,12 @@ class RubyBOSH @@ -134,12 +133,12 @@ class RubyBOSH
134 end 133 end
135 134
136 def deliver(xml) 135 def deliver(xml)
137 - SystemTimer.timeout(@timeout) do 136 + Timeout::timeout(@timeout) do
138 send(xml) 137 send(xml)
139 recv(RestClient.post(@service_url, xml, @headers)) 138 recv(RestClient.post(@service_url, xml, @headers))
140 end 139 end
141 rescue ::Timeout::Error => e 140 rescue ::Timeout::Error => e
142 - raise RubyBOSH::Timeout, e.message 141 + raise RubyBOSH::TimeoutError, e.message
143 rescue Errno::ECONNREFUSED => e 142 rescue Errno::ECONNREFUSED => e
144 raise RubyBOSH::ConnFailed, "could not connect to #{@host}\n#{e.message}" 143 raise RubyBOSH::ConnFailed, "could not connect to #{@host}\n#{e.message}"
145 rescue Exception => e 144 rescue Exception => e