Addresses comments to r866.
http://code.google.com/p/soc/source/detail?r=866
Patch by: Pawel Solyga
Review by: to-be-reviewed
--- a/app/soc/models/site_settings.py Thu Oct 23 05:21:41 2008 +0000
+++ b/app/soc/models/site_settings.py Thu Oct 23 09:08:02 2008 +0000
@@ -34,8 +34,8 @@
#: Valid Google Analytics tracking number, if entered every page
#: is going to have Google Analytics JS initialization code in
#: the footer with the given tracking number.
- ga_tracking_no = db.StringProperty(verbose_name=ugettext_lazy('Google Analytics'))
- ga_tracking_no.help_text = ugettext_lazy(
+ ga_tracking_num = db.StringProperty(verbose_name=ugettext_lazy('Google Analytics'))
+ ga_tracking_num.help_text = ugettext_lazy(
'Valid Google Analytics tracking number. If the number is '
'entered every page is going to have Google Analytics '
'initialization code in footer.')
--- a/app/soc/templates/soc/base.html Thu Oct 23 05:21:41 2008 +0000
+++ b/app/soc/templates/soc/base.html Thu Oct 23 09:08:02 2008 +0000
@@ -147,7 +147,7 @@
{% endblock %}
</div>
<div id="footer" dir="ltr">
- {% if ga_tracking_no %}
+ {% if ga_tracking_num %}
{% include 'soc/site/ga.html' %}
{% endif %}
<div class="text">
--- a/app/soc/templates/soc/site/ga.html Thu Oct 23 05:21:41 2008 +0000
+++ b/app/soc/templates/soc/site/ga.html Thu Oct 23 09:08:02 2008 +0000
@@ -11,11 +11,11 @@
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}
-<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
-_uacct="{{ ga_tracking_no }}"; // site-wide Google Analytics tracking
-_uanchor=1;
-_uff=0;
-urchinTracker();
+var pageTracker = _gat._getTracker("{{ ga_tracking_num }}");
+pageTracker._trackPageview();
</script>
--- a/app/soc/views/helper/responses.py Thu Oct 23 05:21:41 2008 +0000
+++ b/app/soc/views/helper/responses.py Thu Oct 23 09:08:02 2008 +0000
@@ -29,7 +29,7 @@
from django.template import loader
from soc.logic import system
-from soc.logic.models import site_settings as settings_logic
+from soc.logic.models import site_settings
from soc.logic.site import id_user
from soc.logic.site import sidebar
from soc.views import helper
@@ -109,11 +109,11 @@
context['sidebar_menu_html'] = str(html_menu.UlMenu(
sidebar.buildSidebar(**context)))
- site_settings = settings_logic.logic.getFromFields(
- path=settings_logic.logic.DEF_SITE_SETTINGS_PATH)
+ settings = site_settings.logic.getFromFields(
+ path=site_settings.logic.DEF_SITE_SETTINGS_PATH)
- if site_settings and site_settings.ga_tracking_no:
- context['ga_tracking_no'] = site_settings.ga_tracking_no
+ if settings:
+ context['ga_tracking_num'] = settings.ga_tracking_num
return context
--- a/app/soc/views/site/settings.py Thu Oct 23 05:21:41 2008 +0000
+++ b/app/soc/views/site/settings.py Thu Oct 23 09:08:02 2008 +0000
@@ -65,5 +65,5 @@
A subclass of django.http.HttpResponse with generated template.
"""
return settings_views.edit(request, page=page, path=path, logic=logic,
- settings_form_class=SiteSettingsForm,
+ settings_form_class=settings_form_class,
template=template)
\ No newline at end of file