30 from soc.logic.models import organization as org_logic |
30 from soc.logic.models import organization as org_logic |
31 from soc.logic.models import org_admin as org_admin_logic |
31 from soc.logic.models import org_admin as org_admin_logic |
32 from soc.logic.models import org_app as org_app_logic |
32 from soc.logic.models import org_app as org_app_logic |
33 from soc.views.helper import access |
33 from soc.views.helper import access |
34 from soc.views.helper import dynaform |
34 from soc.views.helper import dynaform |
|
35 from soc.views.helper import params as params_helper |
35 from soc.views.helper import widgets |
36 from soc.views.helper import widgets |
36 from soc.views.models import organization as org_view |
37 from soc.views.models import organization as org_view |
37 from soc.views.models import role |
38 from soc.views.models import role |
38 |
39 |
39 import soc.logic.models.org_admin |
40 import soc.logic.models.org_admin |
82 new_params['module_name'] = "org_admin" |
83 new_params['module_name'] = "org_admin" |
83 new_params['sidebar_grouping'] = 'Organizations' |
84 new_params['sidebar_grouping'] = 'Organizations' |
84 |
85 |
85 new_params['extra_dynaexclude'] = ['agreed_to_tos', 'program'] |
86 new_params['extra_dynaexclude'] = ['agreed_to_tos', 'program'] |
86 |
87 |
87 new_params['create_extra_dynaproperties'] = { |
88 new_params['create_dynafields'] = [ |
88 'scope_path': forms.fields.CharField(widget=forms.HiddenInput, |
89 {'name': 'scope_path', |
89 required=True), |
90 'base': forms.fields.CharField, |
90 'admin_agreement': forms.fields.CharField(required=False, |
91 'widget': forms.HiddenInput, |
91 widget=widgets.AgreementField), |
92 'required': True, |
92 'agreed_to_admin_agreement': forms.fields.BooleanField( |
93 }, |
93 initial=False, required=True, |
94 {'name': 'admin_agreement', |
94 label=ugettext('I agree to the Admin Agreement')), |
95 'base': forms.fields.CharField, |
95 } |
96 'required': False, |
|
97 'widget': widgets.AgreementField, |
|
98 'group': ugettext("5. Terms of Service"), |
|
99 }, |
|
100 {'name': 'agreed_to_admin_agreement', |
|
101 'base': forms.fields.BooleanField, |
|
102 'initial': False, |
|
103 'required':True, |
|
104 'label': ugettext('I agree to the Admin Agreement'), |
|
105 'group': ugettext("5. Terms of Service"), |
|
106 }, |
|
107 ] |
96 |
108 |
97 new_params['allow_invites'] = True |
109 new_params['allow_invites'] = True |
98 new_params['show_in_roles_overview'] = True |
110 new_params['show_in_roles_overview'] = True |
99 |
111 |
100 params = dicts.merge(params, new_params) |
112 params = dicts.merge(params, new_params) |
103 |
115 |
104 # register the role with the group_view |
116 # register the role with the group_view |
105 params['group_view'].registerRole(params['module_name'], self) |
117 params['group_view'].registerRole(params['module_name'], self) |
106 |
118 |
107 # create and store the special form for invited users |
119 # create and store the special form for invited users |
108 updated_fields = { |
120 dynafields = [ |
109 'link_id': forms.CharField(widget=widgets.ReadOnlyInput(), |
121 {'name': 'link_id', |
110 required=False), |
122 'base': forms.CharField, |
111 'admin_agreement': forms.fields.Field(required=False, |
123 'widget': widgets.ReadOnlyInput(), |
112 widget=widgets.AgreementField), |
124 'required': False, |
113 } |
125 }, |
|
126 {'name': 'admin_agreement', |
|
127 'base': forms.fields.Field, |
|
128 'required': False, |
|
129 'widget': widgets.AgreementField, |
|
130 'group': ugettext("5. Terms of Service"), |
|
131 }, |
|
132 ] |
|
133 |
|
134 dynaproperties = params_helper.getDynaFields(dynafields) |
114 |
135 |
115 invited_create_form = dynaform.extendDynaForm( |
136 invited_create_form = dynaform.extendDynaForm( |
116 dynaform = self._params['create_form'], |
137 dynaform = self._params['create_form'], |
117 dynaproperties = updated_fields) |
138 dynaproperties = dynaproperties) |
118 |
139 |
119 params['invited_create_form'] = invited_create_form |
140 params['invited_create_form'] = invited_create_form |
120 |
141 |
121 def _editPost(self, request, entity, fields): |
142 def _editPost(self, request, entity, fields): |
122 """See base.View._editPost(). |
143 """See base.View._editPost(). |