activity for users
[unfold.git] / portal / joinview.py
index f9eed28..832055b 100644 (file)
@@ -23,6 +23,8 @@ from portal.actions             import authority_get_pi_emails, manifold_add_use
 
 from myslice.theme import ThemeView
 
+import activity.institution
+
 # since we inherit from FreeAccessView we cannot redefine 'dispatch'
 # so let's override 'get' and 'post' instead
 #
@@ -93,6 +95,16 @@ class JoinView (FreeAccessView, ThemeView):
                 errors.append('First Name may contain only letters, numbers, spaces and @/./+/-/_ characters.')
             if (re.search(r'^[\w+\s.@+-]+$', reg_lname) == None):
                 errors.append('Last Name may contain only letters, numbers, spaces and @/./+/-/_ characters.')
+            if (re.search(r'^[A-Za-z0-9_ ]*$', reg_site_name) == None):
+                errors.append('Name of organization  may contain only letters, numbers, and underscore.')
+            if (re.search(r'^[A-Za-z ]*$', reg_address_city) == None):
+                errors.append('City may contain only letters.')
+            if (re.search(r'^[A-Za-z ]*$', reg_address_country) == None):
+                errors.append('Country may contain only letters.')
+            if (re.search(r'^[A-Za-z0-9]*$', reg_site_abbreviated_name) == None):
+                errors.append('Shortname  may contain only letters and numbers')
+            if (re.search(r'^[0-9]*$', reg_phone) == None):
+                errors.append('Phone number may contain only numbers.')
             #if (re.search(r'^\w+$', reg_site_authority) == None):
             #    errors.append('Site Authority may contain only letters or numbers.')
             # checking in django_db !!
@@ -229,6 +241,8 @@ class JoinView (FreeAccessView, ThemeView):
                     print "Failed to send email, please check the mail templates and the SMTP configuration of your server"
                 
                 self.template_name = 'join_complete.html'
+                # log institution activity
+                activity.institution.joined(self.request)
                 return render(request, self.template, {'theme': self.theme})
                 #return render(request, 'user_register_complete.html') 
 
@@ -259,4 +273,6 @@ class JoinView (FreeAccessView, ThemeView):
           'theme': self.theme
           }
         template_env.update(page.prelude_env ())
+        # log institution activity
+        activity.institution.join(self.request)
         return render(request, 'join_view.html',template_env)