Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/__init__.py
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/__init__.py	(revision 1120)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/__init__.py	(revision 1121)
@@ -0,0 +1,1 @@
+#
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/browser/__init__.py
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/browser/__init__.py	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/browser/__init__.py	(revision 1121)
@@ -0,0 +1,1 @@
+#
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/browser/browser.py
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/browser/browser.py	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/browser/browser.py	(revision 1121)
@@ -0,0 +1,12 @@
+from Products.Five import BrowserView
+from quintagroup.camefrominfo.interfaces import ICameFromInfoUtility
+from zope.component import getUtility
+
+class CameFromInfoView(BrowserView):
+    """
+    """
+    def __call__(self):
+        """get info"""
+        service = getUtility(ICameFromInfoUtility)
+        res = service.getInfo(self.context)
+        return res
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/browser/cameFromCookie.js
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/browser/cameFromCookie.js	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/browser/cameFromCookie.js	(revision 1121)
@@ -0,0 +1,18 @@
+function setCFCookie() {
+    var own_domain = document.domain;
+    var currRef = document.referrer;
+    var cookie_name = "cmfrm";
+    var domain = currRef.match(/:\/\/(www\.)?([^\/:]+)/);
+    domain = (domain != null && domain[2]) ? domain[2] : '';
+    if ((domain.toLowerCase() != own_domain) || (domain == '')) {
+        // set cookie with new referrer
+        createCookie(cookie_name, currRef);
+    }
+};
+
+function registerPloneFunction(func) {
+    if (window.addEventListener) window.addEventListener("load",func,false);
+    else if (window.attachEvent) window.attachEvent("onload",func);   
+};
+
+registerPloneFunction(setCFCookie);
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/browser/configure.zcml
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/browser/configure.zcml	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/browser/configure.zcml	(revision 1121)
@@ -0,0 +1,16 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:browser="http://namespaces.zope.org/browser"
+    i18n_domain="quintagroup.camefrominfo">
+
+  <browser:resource
+    name="cameFromCookie.js" image="cameFromCookie.js" />
+
+  <browser:page
+      for="*"
+      name="camefrominfo_view"
+      class=".browser.CameFromInfoView"
+      permission="zope.Public" 
+      />
+
+</configure>
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/camefromutility.py
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/camefromutility.py	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/camefromutility.py	(revision 1121)
@@ -0,0 +1,19 @@
+from interfaces import ICameFromInfoUtility
+from zope.interface import implements
+
+class CameFromInfoUtility(object):
+    """
+    """
+    implements(ICameFromInfoUtility)
+    
+    def __init__(self):
+        pass
+    
+    def getInfo(self, context):
+        """ get info """
+        request = context.REQUEST
+        ip = request.get('HTTP_X_FORWARDED_FOR', None) or request.getClientAddr()
+        ip = ip.split(',')[0]
+        browser = request.get('HTTP_USER_AGENT',"")
+        came_from = request.get("cmfrm","None")
+        return {'ip':ip, 'browser':browser, 'came_from':came_from}
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/configure.zcml
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/configure.zcml	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/configure.zcml	(revision 1121)
@@ -0,0 +1,12 @@
+<configure
+  xmlns="http://namespaces.zope.org/zope"
+  i18n_domain="quintagroup.camefrominfo">
+  
+  <include package=".browser" />
+  <include file="profiles.zcml" />
+  
+  <utility
+    provides=".interfaces.ICameFromInfoUtility"
+    factory=".camefromutility.CameFromInfoUtility" />
+
+</configure>
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/interfaces.py
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/interfaces.py	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/interfaces.py	(revision 1121)
@@ -0,0 +1,7 @@
+from zope.interface import Interface
+      
+class ICameFromInfoUtility(Interface):
+    """
+    """
+    def getInfo(self, context):
+        """ get info """
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles.zcml
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles.zcml	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles.zcml	(revision 1121)
@@ -0,0 +1,14 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
+    i18n_domain="quintagroup.camefrominfo">
+
+  <genericsetup:registerProfile
+      name="default"
+      title="Quintagroup CameFromInfo"
+      directory="profiles/default"
+      description='Quintagroup came from info package.'
+      provides="Products.GenericSetup.interfaces.EXTENSION"
+      />
+
+</configure>
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles/default/import_steps.xml
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles/default/import_steps.xml	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles/default/import_steps.xml	(revision 1121)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<import-steps>
+  <import-step id="quintagroup.camefrominfo.various" version="20090717-01"
+               handler="quintagroup.camefrominfo.setuphandlers.setupVarious"
+               title="Quintagroup CameFromInfo">
+    Various import steps that are not handled by GS import/export
+    handlers.
+  </import-step>
+</import-steps>
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles/default/jsregistry.xml
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles/default/jsregistry.xml	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles/default/jsregistry.xml	(revision 1121)
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<object name="portal_javascripts">
+ <javascript
+    id="++resource++cameFromCookie.js" enabled="True" expression=""
+    cookable="True" inline="True" insert-before="jquery.js" />
+</object>
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles/default/metadata.xml
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles/default/metadata.xml	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles/default/metadata.xml	(revision 1121)
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<metadata>
+  <version>0.1</version>
+</metadata>
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles/default/quintagroup.camefrominfo_various.txt
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles/default/quintagroup.camefrominfo_various.txt	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/profiles/default/quintagroup.camefrominfo_various.txt	(revision 1121)
@@ -0,0 +1,1 @@
+This file is used as a marker in setuphandlers.py.
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/setuphandlers.py
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/setuphandlers.py	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/setuphandlers.py	(revision 1121)
@@ -0,0 +1,11 @@
+def setupVarious(context):
+
+    # Ordinarily, GenericSetup handlers check for the existence of XML files.
+    # Here, we are not parsing an XML file, but we use this text file as a
+    # flag to check that we actually meant for this import step to be run.
+    # The file is found in profiles/default.
+
+    if context.readDataFile('quintagroup.camefrominfo_various.txt') is None:
+        return
+
+    # Add additional setup code here
Index: /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/tests.py
===================================================================
--- /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/tests.py	(revision 1121)
+++ /quintagroup.camefrominfo/trunk/quintagroup/camefrominfo/tests.py	(revision 1121)
@@ -0,0 +1,32 @@
+import unittest
+import os
+import sys
+import re
+
+from unittest import makeSuite, TestCase
+from zope.testing import doctestunit
+from zope.component import testing
+from Testing import ZopeTestCase as ztc
+
+from Products.Five import zcml
+from Products.Five import fiveconfigure
+from Products.PloneTestCase import PloneTestCase as ptc
+from Products.PloneTestCase.layer import PloneSite
+ptc.setupPloneSite()
+
+import quintagroup.camefrominfo
+from zope.testbrowser.browser import Browser
+
+class CameFromInfoTest(TestCase):
+
+    def setUp(self):
+        pass
+
+    def test_camefrominfo(self):
+        pass
+
+def test_suite():
+    return makeSuite(CameFromInfoTest)
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')
