Commit 054dc42d authored by Giuseppe Terrasi's avatar Giuseppe Terrasi

Merge from:
- lp:~giuseppeterrasi/ubuntu-it-ask/1022229
- lp:~giuseppeterrasi/ubuntu-it-ask/l18ned
- lp:~giuseppeterrasi/ubuntu-it-ask/subscriptions.html
- lp:~giuseppeterrasi/ubuntu-it-ask/1022223
- lp:~giuseppeterrasi/ubuntu-it-ask/build-translation
- lp:~giuseppeterrasi/ubuntu-it-ask/apache-expires
parents 42f7e3e4 24595d5f
Elenco dei maggiori cambiamenti tra la nostra versione e upstream.
= forum/registry.py =
Rimossi da ui.registerui.HEADER_LINKS i seguenti per non farli apparire nel subheader:
ui.Link(_('faq'), ui.Url('faq'), weight=400, name='FAQ'),
ui.Link(_('about'), ui.Url('about'), weight=300, name='ABOUT'),
= forum_modules/openidauth/authentication.py =
Aggiunte le classi LaunchpadAuth e UbuntuSSOAuth.
Commentati tutti i restanti metodi di autenticazione con eccezione di Google e Yahoo.
= locale =
Aggiunta cartella "it", la nostra localizzazione, prima non presente.
= settings_local.py =
Disabilitati i seguenti moduli, di default abilitati: mysqlfulltext, localauth, oauthauth, facebookauth, sphinxfulltext
= forum/skins/light/media/js/wmd/wmd.js =
File nel quale sono state apportate direttamente delle traduzioni.
= forum/skins/light/media/js/osqa.ask.js =
File nel quale sono state apportate direttamente delle traduzioni.
= forum/skins/light/templates/auth/signin.html =
Nascosti, commentati, metodi di autenticazione e/o registrazione non utilizzati.
= ask.jquery.header.string.replace.js =
Aggiunto questo file e collegato all'interno di header.html
Questi javascript usando il metodo replaceWith agiscono sui selettori css presenti nell'output html ed eseguono una serie di sostituzioni.
Nello specifico, l'introduzione di questo work-around serve a risolvere il problema della capitalizzazone del testo mostrato nell'header che risulta essere difficoltoso per via delle diverse stringhe del file .po comuni a più parti dell'interfaccia.
= ask.jquery.subscriptions.string.replace.js =
Eliminata capitalizzazione parola "impostazioni" in subscriptions.html usando javascript. La presenza di un link dinamico non permette l'uso di string replace. L'effetto è stato raggiunto in questa maniera:
var subscriptionDiv = $('#navBar a#subscriptions_settings_button');
subscriptionDiv.text('impostazioni');
= forum/skins/light/templates/users/online_users.html =
FIXME: proporre cambiamento upstream come da lp:~giuseppeterrasi/ubuntu-it-ask/l18ned
= forum/skins/light/templates/users/subscriptions.html =
FIXME: proporre cambiamento upstream come da lp:~giuseppeterrasi/ubuntu-it-ask/l18ned
= forum/skins/light/templates/users/users.html =
FIXME: proporre cambiamento upstream come da lp:~giuseppeterrasi/ubuntu-it-ask/l18ned
= forum/templatetags/extra_tags.py =
FIXME: proporre cambiamento upstream come da lp:~giuseppeterrasi/ubuntu-it-ask/l18ned
= forum_modules/pgfulltext =
sostituito "english" con "italian"
...@@ -27,13 +27,13 @@ postgres-9.1 is ok. We need: ...@@ -27,13 +27,13 @@ postgres-9.1 is ok. We need:
c) timezone in Europe/Rome c) timezone in Europe/Rome
d) languages in IT d) languages in IT
e) DJANGO_VERSION = 1.3 e) DJANGO_VERSION = 1.3
f) DISABLED_MODULES add 'mysqlfulltxt', 'localauth' f) DISABLED_MODULES add 'mysqlfulltxt', 'localauth' 'sphinxfullsearch'
g) CACHE_BACKEND = 'memcached://<server-address>:<port>/ with the correct path. g) CACHE_BACKEND = 'memcached://<server-address>:<port>/ with the correct path.
5) python manage.py syncdb --all (no create super user) 5) python manage.py syncdb --all (no create super user)
6) python manage.py migrate forum --fake 6) python manage.py migrate forum --fake
7) cp -R locale l it
8) python manage.py makemessages -l it 8) python manage.py makemessages -l it
** Note: an example of settings_local.py with right database settings (line 27): http://bazaar.launchpad.net/~ubuntu-it-ask/ubuntu-it-ask/trunk/view/head:/settings_local.py ** Note: an example of settings_local.py with right database settings (line 27): http://bazaar.launchpad.net/~ubuntu-it-ask/ubuntu-it-ask/trunk/view/head:/settings_local.py
...@@ -48,10 +48,16 @@ sudo chmod -R g+w /srv/CHANGE_THIS_PATH/www/osqa/log ...@@ -48,10 +48,16 @@ sudo chmod -R g+w /srv/CHANGE_THIS_PATH/www/osqa/log
Put 00-forum_keyvalue.sql into osqa database: Put 00-forum_keyvalue.sql into osqa database:
1) psql -U ubuntu-it-chiedi ubuntu-it-chiedi -W < forum_keyvalue.sql 1) psql -U ubuntu-it-chiedi ubuntu-it-chiedi -W < forum_keyvalue.sql
2) python /src/CHANGE_THIS_PATH/www/osqa/manage.py syncdb 2) python /srv/CHANGE_THIS_PATH/www/osqa/manage.py syncdb
(if you need a dump of this table, please use: pg_dump ubuntu-it-chiedi --clean -O -t forum_keyvalue -f forum_keyvalue.sql -U ubuntu-it-chiedi -W ) (if you need a dump of this table, please use: pg_dump ubuntu-it-chiedi --clean -O -t forum_keyvalue -f forum_keyvalue.sql -U ubuntu-it-chiedi -W )
= Configure pgfulltext =
1) cd forum_modules/pgfulltext
2) psql -U ubuntu-it-chiedi ubuntu-it-chiedi -W < pg_fts_install.sql
3) python /src/CHANGE_THIS_PATH/www/osqa/manage.py syncdb
= Other = = Other =
We can perform other changes, if needed, using bzr with no access on We can perform other changes, if needed, using bzr with no access on
......
...@@ -29,3 +29,15 @@ WSGISocketPrefix ${APACHE_RUN_DIR} ...@@ -29,3 +29,15 @@ WSGISocketPrefix ${APACHE_RUN_DIR}
CustomLog ${APACHE_LOG_DIR}/osqa.access.log common CustomLog ${APACHE_LOG_DIR}/osqa.access.log common
ErrorLog ${APACHE_LOG_DIR}/osqa.error.log ErrorLog ${APACHE_LOG_DIR}/osqa.error.log
</VirtualHost> </VirtualHost>
# Caching some files
FileETag none
ExpiresActive On
ExpiresByType application/javascript "access plus 3 months"
ExpiresByType image/jpg "access plus 3 months"
ExpiresByType image/jpeg "access plus 3 months"
ExpiresByType image/gif "access plus 3 months"
ExpiresByType image/png "access plus 3 months"
ExpiresByType image/x-icon "access plus 3 months"
ExpiresByType text/css "access plus 3 months"
/*
* Title: jQuery header string replace
* Description: customize header link in order to capitalize first letter using jquery replaceWith method.
*
* Copyright (c) 2012 Ubuntu-it Ask Team - https://launchpad.net/~ubuntu-it-ask
* GNU GPL 3 LICENSE
*/
$('#header li #nav_index').replaceWith('<a id="nav_index" href="/">Home</a>');
$('#header li #nav_questions').replaceWith('<a id="nav_questions" href="/questions/">Domande</a>');
$('#header li #nav_tags').replaceWith('<a id="nav_tag" href="/tags/">Tag</a>');
$('#header li #nav_users').replaceWith('<a id="nav_users" href="/users/">Utenti</a>');
$('#header li #nav_badges').replaceWith('<a id="nav_badges" href="/badges/">Badge</a>');
$('#header li #nav_unanswered').replaceWith('<a id="nav_unanswered" href="/questions/unanswered/">Senza risposta</a>');
$('#header li #nav_ask').replaceWith('<a id="nav_ask" class="special" href="/questions/ask/">Chiedi</a>');
/*
* Title: jQuery subscriptions string replace
* Description: remove capitalization in "impostazioni" word using javascript.
*
* Copyright (c) 2012 Ubuntu-it Ask Team - https://launchpad.net/~ubuntu-it-ask
* GNU GPL 3 LICENSE
*/
var subscriptionDiv = $('#navBar a#subscriptions_settings_button');
subscriptionDiv.text('impostazioni');
...@@ -8,9 +8,11 @@ ...@@ -8,9 +8,11 @@
{% loopregistry page_top_tabs %}{% spaceless %} {% loopregistry page_top_tabs %}{% spaceless %}
<li><a id="nav_{{ tab_name }}"{% ifequal tab tab_name %} class="on"{% endifequal %} href="{{ tab_url }}" >{{ tab_title }}</a></li> <li><a id="nav_{{ tab_name }}"{% ifequal tab tab_name %} class="on"{% endifequal %} href="{{ tab_url }}" >{{ tab_title }}</a></li>
{% endspaceless %}{% endloopregistry %} {% endspaceless %}{% endloopregistry %}
<li><a id="nav_{{ tab_name }}" href="{% url ask %}" >{% trans "ask a question" %}</a></li> <li><a id="nav_ask" href="{% url ask %}" class="special">{% trans "ask a question" %}</a></li>
</ul> </ul>
<script type="text/javascript" src="/m/light/media/js/ask.jquery.header.string.replace.js"></script>
<div id="logo"> <div id="logo">
<div id="ubuntu-it-sites"> <div id="ubuntu-it-sites">
<a id="" href="http://www.ubuntu-it.org">web</a> <a id="" href="http://www.ubuntu-it.org">web</a>
......
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
<div id="main-body" style="width:100%"> <div id="main-body" style="width:100%">
<p> <p>
{% if suser %} {% if suser %}
{% blocktrans %}users matching query {{suser}}:{% endblocktrans %} {% blocktrans %}users matching query '{{suser}}':{% endblocktrans %}
{% endif %} {% endif %}
{% if not users.paginator.count %} {% if not users.paginator.count %}
<span>{% trans "Nothing found." %}</span> <span>{% trans "Nothing found" %}</span>
{% endif %} {% endif %}
</p> </p>
<div class="userList"> <div class="userList">
......
...@@ -26,16 +26,19 @@ ...@@ -26,16 +26,19 @@
//location.reload(true); //location.reload(true);
} }
</script> </script>
{% endblock %} {% endblock %}
{% block usercontent %} {% block usercontent %}
<br/> <br/>
<div id="navBar"><div class="tabsA"> <div id="navBar"><div class="tabsA">
<a href='{{ view_user.get_user_subscriptions_url }}?tab=settings' id="subscriptions_settings_button" {% if not manage_open %}class="on"{% endif %}>Settings</a> <a href='{{ view_user.get_user_subscriptions_url }}?tab=settings' id="subscriptions_settings_button" {% if not manage_open %}class="on"{% endif %}>{% trans "Settings" %}</a>
<a href='{{ view_user.get_user_subscriptions_url }}?tab=manage' id="subscriptions_management_button" {% if manage_open %}class="on"{% endif %}>Manage</a> <a href='{{ view_user.get_user_subscriptions_url }}?tab=manage' id="subscriptions_management_button" {% if manage_open %}class="on"{% endif %}>{% trans "manage" %}</a>
</div></div> </div></div>
<script type="text/javascript" src="/m/light/media/js/ask.jquery.subscriptions.string.replace.js"></script>
<br/> <br/>
{% if not manage_open %} {% if not manage_open %}
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
{% endif %} {% endif %}
{% if not users.paginator.count %} {% if not users.paginator.count %}
<span>{% trans "Nothing found." %}</span> <span>{% trans "Nothing found" %}</span>
{% endif %} {% endif %}
</p> </p>
<div class="userList"> <div class="userList">
......
...@@ -158,20 +158,20 @@ def diff_date(date, limen=2): ...@@ -158,20 +158,20 @@ def diff_date(date, limen=2):
minutes = int(diff.seconds/60) minutes = int(diff.seconds/60)
if date.year != now.year: if date.year != now.year:
return dateformat.format(date, 'd M \'y, H:i') return dateformat.format(date, _("d M 'y, H:i"))
elif days > 2: elif days > 2:
return dateformat.format(date, 'd M, H:i') return dateformat.format(date, _("d M, H:i"))
elif days == 2: elif days == 2:
return _('2 days ago') return _('2 days ago')
elif days == 1: elif days == 1:
return _('yesterday') return _('yesterday')
elif minutes >= 60: elif minutes >= 60:
return ungettext('%(hr)d ' + _("hour ago"), '%(hr)d ' + _("hours ago"), hours) % {'hr':hours} return ungettext("%(hr)d hour ago", "%(hr)d hours ago", hours) % {'hr':hours}
elif diff.seconds >= 60: elif diff.seconds >= 60:
return ungettext('%(min)d ' + _("min ago"), '%(min)d ' + _("mins ago"), minutes) % {'min':minutes} return ungettext("%(min)d min ago", "%(min)d mins ago", minutes) % {'min':minutes}
else: else:
return ungettext('%(sec)d ' + _("sec ago"), '%(sec)d ' + _("secs ago"), diff.seconds) % {'sec':diff.seconds} return ungettext("%(sec)d sec ago", "%(sec)d secs ago", diff.seconds) % {'sec':diff.seconds}
@register.simple_tag @register.simple_tag
def media(url): def media(url):
......
...@@ -16,11 +16,11 @@ def question_search(self, keywords): ...@@ -16,11 +16,11 @@ def question_search(self, keywords):
tables = ['forum_rootnode_doc'], tables = ['forum_rootnode_doc'],
select={ select={
'ranking': """ 'ranking': """
rank_exact_matches(ts_rank_cd('{0.1, 0.2, 0.8, 1.0}'::float4[], "forum_rootnode_doc"."document", to_tsquery('english', %s), 32)) rank_exact_matches(ts_rank_cd('{0.1, 0.2, 0.8, 1.0}'::float4[], "forum_rootnode_doc"."document", to_tsquery('italian', %s), 32))
""", """,
}, },
where=[""" where=["""
"forum_rootnode_doc"."node_id" = "forum_node"."id" AND ("forum_rootnode_doc"."document" @@ to_tsquery('english', %s) OR "forum_rootnode_doc"."node_id" = "forum_node"."id" AND ("forum_rootnode_doc"."document" @@ to_tsquery('italian', %s) OR
"forum_node"."title" ILIKE %s) "forum_node"."title" ILIKE %s)
"""], """],
params=[tsquery, ilike], params=[tsquery, ilike],
......
...@@ -54,15 +54,15 @@ begin ...@@ -54,15 +54,15 @@ begin
END IF; END IF;
SELECT SELECT
setweight(to_tsvector('english', coalesce(tagnames,'')), 'A') || setweight(to_tsvector('italian', coalesce(tagnames,'')), 'A') ||
setweight(to_tsvector('english', coalesce(title,'')), 'B') || setweight(to_tsvector('italian', coalesce(title,'')), 'B') ||
setweight(to_tsvector('english', coalesce(body,'')), 'C') INTO doc setweight(to_tsvector('italian', coalesce(body,'')), 'C') INTO doc
FROM forum_node WHERE id = root_id; FROM forum_node WHERE id = root_id;
SELECT count(*)::int INTO rcount FROM forum_node WHERE abs_parent_id = root_id AND (NOT state_string LIKE '%%deleted%%'); SELECT count(*)::int INTO rcount FROM forum_node WHERE abs_parent_id = root_id AND (NOT state_string LIKE '%%deleted%%');
IF rcount > 0 THEN IF rcount > 0 THEN
FOR cv in SELECT setweight(to_tsvector('english', coalesce(body,'')), 'C') FROM forum_node WHERE abs_parent_id = root_id AND (NOT state_string LIKE '%%deleted%%') LOOP FOR cv in SELECT setweight(to_tsvector('italian', coalesce(body,'')), 'C') FROM forum_node WHERE abs_parent_id = root_id AND (NOT state_string LIKE '%%deleted%%') LOOP
doc :=(doc || cv); doc :=(doc || cv);
END LOOP; END LOOP;
END IF; END IF;
......
This diff is collapsed.
This diff is collapsed.
...@@ -46,7 +46,7 @@ SESSION_ENGINE = 'django.contrib.sessions.backends.db' ...@@ -46,7 +46,7 @@ SESSION_ENGINE = 'django.contrib.sessions.backends.db'
# This should be equal to your domain name, plus the web application context. # This should be equal to your domain name, plus the web application context.
# This shouldn't be followed by a trailing slash. # This shouldn't be followed by a trailing slash.
# I.e., http://www.yoursite.com or http://www.hostedsite.com/yourhostapp # I.e., http://www.yoursite.com or http://www.hostedsite.com/yourhostapp
APP_URL = 'http://CHANGE_THIS_PATH' APP_URL = 'http://chiedi.ubuntu-it.org'
#LOCALIZATIONS #LOCALIZATIONS
TIME_ZONE = 'Europe/Rome' TIME_ZONE = 'Europe/Rome'
...@@ -57,7 +57,7 @@ USE_I18N = True ...@@ -57,7 +57,7 @@ USE_I18N = True
LANGUAGE_CODE = 'it' LANGUAGE_CODE = 'it'
DJANGO_VERSION = 1.3 DJANGO_VERSION = 1.3
OSQA_DEFAULT_SKIN = 'default' OSQA_DEFAULT_SKIN = 'light'
# disable mysqlfulltxt and local authentication (registrations users) # disable mysqlfulltxt and local authentication (registrations users)
DISABLED_MODULES = ['books', 'recaptcha', 'project_badges', 'mysqlfulltext', 'localauth', 'oauthauth', 'facebookauth'] DISABLED_MODULES = ['books', 'recaptcha', 'project_badges', 'mysqlfulltext', 'localauth', 'oauthauth', 'facebookauth', 'sphinxfulltext']
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment