|
|
|
@@ -8,8 +8,8 @@ import models.user |
|
|
|
# Get html templates |
|
|
|
render = web.template.render('templates/') |
|
|
|
|
|
|
|
class New_project: |
|
|
|
|
|
|
|
class New_project: |
|
|
|
def GET(self): |
|
|
|
""" |
|
|
|
Get the project registration form |
|
|
|
@@ -60,7 +60,6 @@ class New_project: |
|
|
|
|
|
|
|
# Post the form data and save the project in the database |
|
|
|
if data.create_project: |
|
|
|
|
|
|
|
project_form = self.compose_form(data, None) |
|
|
|
if not project_form.validates(): |
|
|
|
return render.new_project(nav, project_form, project_buttons, "") |
|
|
|
@@ -89,28 +88,28 @@ class New_project: |
|
|
|
|
|
|
|
# Save the users in the database given that the input field is not empty |
|
|
|
for i in range(0, user_count): |
|
|
|
if len(data["user_name_"+str(i)]): |
|
|
|
userid = models.user.get_user_id_by_name(data["user_name_"+str(i)]) |
|
|
|
read, write, modify = "FALSE", "FALSE", "FALSE" |
|
|
|
try: |
|
|
|
data["read_permission_"+str(i)] |
|
|
|
read = "TRUE" |
|
|
|
except Exception as e: |
|
|
|
read = "FALSE" |
|
|
|
pass |
|
|
|
try: |
|
|
|
data["write_permission_"+str(i)] |
|
|
|
write = "TRUE" |
|
|
|
except Exception as e: |
|
|
|
write = "FALSE" |
|
|
|
pass |
|
|
|
try: |
|
|
|
data["modify_permission_"+str(i)] |
|
|
|
modify = "TRUE" |
|
|
|
except Exception as e: |
|
|
|
modify = "FALSE" |
|
|
|
pass |
|
|
|
models.project.set_projects_user(str(projectid), str(userid), read, write, modify) |
|
|
|
if len(data["user_name_"+str(i)]): |
|
|
|
userid = models.user.get_user_id_by_name(data["user_name_"+str(i)]) |
|
|
|
read, write, modify = "FALSE", "FALSE", "FALSE" |
|
|
|
try: |
|
|
|
data["read_permission_"+str(i)] |
|
|
|
read = "TRUE" |
|
|
|
except Exception as e: |
|
|
|
read = "FALSE" |
|
|
|
pass |
|
|
|
try: |
|
|
|
data["write_permission_"+str(i)] |
|
|
|
write = "TRUE" |
|
|
|
except Exception as e: |
|
|
|
write = "FALSE" |
|
|
|
pass |
|
|
|
try: |
|
|
|
data["modify_permission_"+str(i)] |
|
|
|
modify = "TRUE" |
|
|
|
except Exception as e: |
|
|
|
modify = "FALSE" |
|
|
|
pass |
|
|
|
models.project.set_projects_user(str(projectid), str(userid), read, write, modify) |
|
|
|
raise web.seeother('/?projects=my') |
|
|
|
|
|
|
|
def compose_form(self, data, operation): |
|
|
|
|